aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-05-08 03:12:14 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-05-08 03:12:14 +0000
commit071e02c6b6b4837fa9cf0b6d4c749994e02638d7 (patch)
tree960446788703b69f0bb285450be80c5b3d8cc22c /Projects
parente331b531c6e6d93eb0eee42b9002074e8090ad18 (diff)
downloadlufa-071e02c6b6b4837fa9cf0b6d4c749994e02638d7.tar.gz
lufa-071e02c6b6b4837fa9cf0b6d4c749994e02638d7.tar.bz2
lufa-071e02c6b6b4837fa9cf0b6d4c749994e02638d7.zip
Add svn:eol-style property to source files, so that the line endings are correctly converted to the target system's native end of line style.
Diffstat (limited to 'Projects')
-rw-r--r--Projects/AVRISP-MKII/AVRISP.c262
-rw-r--r--Projects/AVRISP-MKII/AVRISP.h162
-rw-r--r--Projects/AVRISP-MKII/AVRISP.txt538
-rw-r--r--Projects/AVRISP-MKII/Descriptors.c438
-rw-r--r--Projects/AVRISP-MKII/Descriptors.h158
-rw-r--r--Projects/AVRISP-MKII/Doxygen.conf3128
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c1088
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h158
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c374
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h144
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.c518
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.h210
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h176
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolParams.c364
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolParams.h170
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c476
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h154
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c712
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h248
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c1028
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h264
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c442
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h252
-rw-r--r--Projects/AVRISP-MKII/makefile1506
-rw-r--r--Projects/Benito/Benito Programmer.inf210
-rw-r--r--Projects/Benito/Benito.c528
-rw-r--r--Projects/Benito/Benito.h154
-rw-r--r--Projects/Benito/Benito.txt200
-rw-r--r--Projects/Benito/Descriptors.c510
-rw-r--r--Projects/Benito/Descriptors.h166
-rw-r--r--Projects/Benito/Doxygen.conf3128
-rw-r--r--Projects/Benito/Lib/RingBuff.c240
-rw-r--r--Projects/Benito/Lib/RingBuff.h232
-rw-r--r--Projects/Benito/makefile1486
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/Descriptors.c652
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/Descriptors.h162
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c372
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h156
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/makefile1472
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.c442
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.h176
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskDevice.c204
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskDevice.h122
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.c254
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.h124
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c1054
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h164
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt72
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c114
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h72
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h74
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c1554
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h474
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c154
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h88
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c566
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h174
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Standalone Programmer.inf210
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c322
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h176
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/makefile1492
-rw-r--r--Projects/LEDNotifier/Board/LEDs.h224
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs262
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs226
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/Program.cs42
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs72
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs142
-rw-r--r--Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs60
-rw-r--r--Projects/LEDNotifier/Descriptors.c534
-rw-r--r--Projects/LEDNotifier/Descriptors.h166
-rw-r--r--Projects/LEDNotifier/Doxygen.conf3128
-rw-r--r--Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.Designer.cs226
-rw-r--r--Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs222
-rw-r--r--Projects/LEDNotifier/HotmailNotifierApp/Program.cs40
-rw-r--r--Projects/LEDNotifier/HotmailNotifierApp/Properties/AssemblyInfo.cs72
-rw-r--r--Projects/LEDNotifier/HotmailNotifierApp/Properties/Resources.Designer.cs126
-rw-r--r--Projects/LEDNotifier/HotmailNotifierApp/Properties/Settings.Designer.cs52
-rw-r--r--Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs298
-rw-r--r--Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs146
-rw-r--r--Projects/LEDNotifier/LEDMixerApp/Program.cs42
-rw-r--r--Projects/LEDNotifier/LEDMixerApp/Properties/AssemblyInfo.cs72
-rw-r--r--Projects/LEDNotifier/LEDMixerApp/Properties/Resources.Designer.cs142
-rw-r--r--Projects/LEDNotifier/LEDMixerApp/Properties/Settings.Designer.cs60
-rw-r--r--Projects/LEDNotifier/LEDNotifier.c334
-rw-r--r--Projects/LEDNotifier/LEDNotifier.h120
-rw-r--r--Projects/LEDNotifier/LEDNotifier.txt122
-rw-r--r--Projects/LEDNotifier/LUFA LED Notifier.inf210
-rw-r--r--Projects/LEDNotifier/makefile1474
-rw-r--r--Projects/Magstripe/Descriptors.c494
-rw-r--r--Projects/Magstripe/Descriptors.h140
-rw-r--r--Projects/Magstripe/Doxygen.conf3128
-rw-r--r--Projects/Magstripe/Lib/CircularBitBuffer.c226
-rw-r--r--Projects/Magstripe/Lib/CircularBitBuffer.h190
-rw-r--r--Projects/Magstripe/Lib/MagstripeHW.h200
-rw-r--r--Projects/Magstripe/Magstripe.c432
-rw-r--r--Projects/Magstripe/Magstripe.h166
-rw-r--r--Projects/Magstripe/Magstripe.txt328
-rw-r--r--Projects/MissileLauncher/ConfigDescriptor.c334
-rw-r--r--Projects/MissileLauncher/ConfigDescriptor.h132
-rw-r--r--Projects/MissileLauncher/Doxygen.conf3128
-rw-r--r--Projects/MissileLauncher/MissileLauncher.c674
-rw-r--r--Projects/MissileLauncher/MissileLauncher.h198
-rw-r--r--Projects/MissileLauncher/MissileLauncher.txt118
-rw-r--r--Projects/MissileLauncher/makefile1472
-rw-r--r--Projects/RelayBoard/Descriptors.c400
-rw-r--r--Projects/RelayBoard/Descriptors.h118
-rw-r--r--Projects/RelayBoard/Doxygen.conf3126
-rw-r--r--Projects/RelayBoard/RelayBoard.c298
-rw-r--r--Projects/RelayBoard/RelayBoard.h128
-rw-r--r--Projects/RelayBoard/RelayBoard.txt188
-rw-r--r--Projects/RelayBoard/makefile1470
-rw-r--r--Projects/TemperatureDataLogger/Descriptors.c576
-rw-r--r--Projects/TemperatureDataLogger/Descriptors.h120
-rw-r--r--Projects/TemperatureDataLogger/Doxygen.conf3128
-rw-r--r--Projects/TemperatureDataLogger/Lib/DS1307.c248
-rw-r--r--Projects/TemperatureDataLogger/Lib/DS1307.h218
-rw-r--r--Projects/TemperatureDataLogger/Lib/DataflashManager.c1050
-rw-r--r--Projects/TemperatureDataLogger/Lib/DataflashManager.h162
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/00readme.txt220
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/diskio.c198
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/diskio.h142
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/ff.c6306
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/ff.h1192
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h332
-rw-r--r--Projects/TemperatureDataLogger/Lib/FATFs/integer.h74
-rw-r--r--Projects/TemperatureDataLogger/Lib/SCSI.c562
-rw-r--r--Projects/TemperatureDataLogger/Lib/SCSI.h172
-rw-r--r--Projects/TemperatureDataLogger/TempDataLogger.c624
-rw-r--r--Projects/TemperatureDataLogger/TempDataLogger.h226
-rw-r--r--Projects/TemperatureDataLogger/TempLogHostApp/COPYING.LESSER.txt330
-rw-r--r--Projects/TemperatureDataLogger/TempLogHostApp/COPYING.txt1348
-rw-r--r--Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs362
-rw-r--r--Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.cs344
-rw-r--r--Projects/TemperatureDataLogger/TempLogHostApp/Program.cs42
-rw-r--r--Projects/TemperatureDataLogger/TempLogHostApp/README.txt42
-rw-r--r--Projects/TemperatureDataLogger/TemperatureDataLogger.txt170
-rw-r--r--Projects/TemperatureDataLogger/makefile1494
-rw-r--r--Projects/USBtoSerial/Descriptors.c534
-rw-r--r--Projects/USBtoSerial/Descriptors.h166
-rw-r--r--Projects/USBtoSerial/Doxygen.conf3128
-rw-r--r--Projects/USBtoSerial/LUFA USBtoSerial.inf210
-rw-r--r--Projects/USBtoSerial/Lib/RingBuff.c240
-rw-r--r--Projects/USBtoSerial/Lib/RingBuff.h232
-rw-r--r--Projects/USBtoSerial/USBtoSerial.c396
-rw-r--r--Projects/USBtoSerial/USBtoSerial.h156
-rw-r--r--Projects/USBtoSerial/USBtoSerial.txt162
-rw-r--r--Projects/USBtoSerial/makefile1476
-rw-r--r--Projects/Webserver/Descriptors.c434
-rw-r--r--Projects/Webserver/Descriptors.h144
-rw-r--r--Projects/Webserver/Doxygen.conf3128
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.c528
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.h338
-rw-r--r--Projects/Webserver/Lib/DataflashManager.c1050
-rw-r--r--Projects/Webserver/Lib/DataflashManager.h160
-rw-r--r--Projects/Webserver/Lib/FATFs/00readme.txt220
-rw-r--r--Projects/Webserver/Lib/FATFs/diskio.c128
-rw-r--r--Projects/Webserver/Lib/FATFs/diskio.h144
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.c6306
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.h1192
-rw-r--r--Projects/Webserver/Lib/FATFs/ffconf.h332
-rw-r--r--Projects/Webserver/Lib/FATFs/integer.h74
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.c578
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.h162
-rw-r--r--Projects/Webserver/Lib/SCSI.c562
-rw-r--r--Projects/Webserver/Lib/SCSI.h170
-rw-r--r--Projects/Webserver/Lib/TELNETServerApp.c324
-rw-r--r--Projects/Webserver/Lib/TELNETServerApp.h136
-rw-r--r--Projects/Webserver/Lib/uIPManagement.c502
-rw-r--r--Projects/Webserver/Lib/uIPManagement.h158
-rw-r--r--Projects/Webserver/Lib/uip/clock.c76
-rw-r--r--Projects/Webserver/Lib/uip/clock.h24
-rw-r--r--Projects/Webserver/Lib/uip/timer.c254
-rw-r--r--Projects/Webserver/Lib/uip/timer.h172
-rw-r--r--Projects/Webserver/Lib/uip/uip-split.c282
-rw-r--r--Projects/Webserver/Lib/uip/uip-split.h206
-rw-r--r--Projects/Webserver/Lib/uip/uip.c3876
-rw-r--r--Projects/Webserver/Lib/uip/uip.h4258
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.c862
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.h290
-rw-r--r--Projects/Webserver/Lib/uip/uipopt.h1474
-rw-r--r--Projects/Webserver/USBDeviceMode.c226
-rw-r--r--Projects/Webserver/USBDeviceMode.h114
-rw-r--r--Projects/Webserver/USBHostMode.c356
-rw-r--r--Projects/Webserver/USBHostMode.h116
-rw-r--r--Projects/Webserver/Webserver.c150
-rw-r--r--Projects/Webserver/Webserver.h160
-rw-r--r--Projects/Webserver/Webserver.txt224
-rw-r--r--Projects/Webserver/makefile1522
-rw-r--r--Projects/XPLAINBridge/AVRISPDescriptors.c438
-rw-r--r--Projects/XPLAINBridge/AVRISPDescriptors.h156
-rw-r--r--Projects/XPLAINBridge/Doxygen.conf3128
-rw-r--r--Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf210
-rw-r--r--Projects/XPLAINBridge/Lib/RingBuff.c240
-rw-r--r--Projects/XPLAINBridge/Lib/RingBuff.h232
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.c286
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.h118
-rw-r--r--Projects/XPLAINBridge/USARTDescriptors.c528
-rw-r--r--Projects/XPLAINBridge/USARTDescriptors.h164
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.c480
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.h188
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.txt176
-rw-r--r--Projects/XPLAINBridge/makefile1512
202 files changed, 61036 insertions, 61036 deletions
diff --git a/Projects/AVRISP-MKII/AVRISP.c b/Projects/AVRISP-MKII/AVRISP.c
index cea1161d5..88403b269 100644
--- a/Projects/AVRISP-MKII/AVRISP.c
+++ b/Projects/AVRISP-MKII/AVRISP.c
@@ -1,131 +1,131 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 AVRISP project. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-#include "AVRISP.h"
-
-/** 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);
- sei();
-
- for (;;)
- {
- Process_AVRISP_Commands();
-
- V2Params_UpdateParamValues();
-
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- LEDs_Init();
- USB_Init();
- V2Protocol_Init();
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- /* Indicate USB connected and ready */
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- /* Setup AVRISP data Endpoints */
- if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,
- ENDPOINT_BANK_SINGLE)))
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- }
-
- #if defined(LIBUSB_FILTERDRV_COMPAT)
- if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,
- ENDPOINT_BANK_SINGLE)))
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- }
- #endif
-}
-
-/** Processes incoming V2 Protocol commands from the host, returning a response when required. */
-void Process_AVRISP_Commands(void)
-{
- /* Device must be connected and configured for the task to run */
- if (USB_DeviceState != DEVICE_STATE_Configured)
- return;
-
- Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
-
- /* Check to see if a V2 Protocol command has been received */
- if (Endpoint_IsOUTReceived())
- {
- LEDs_SetAllLEDs(LEDMASK_BUSY);
-
- /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
- V2Protocol_ProcessCommand();
-
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
- }
-}
-
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 AVRISP project. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
+#include "AVRISP.h"
+
+/** 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);
+ sei();
+
+ for (;;)
+ {
+ Process_AVRISP_Commands();
+
+ V2Params_UpdateParamValues();
+
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ LEDs_Init();
+ USB_Init();
+ V2Protocol_Init();
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ /* Indicate USB connected and ready */
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ /* Setup AVRISP data Endpoints */
+ if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,
+ ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,
+ ENDPOINT_BANK_SINGLE)))
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ }
+
+ #if defined(LIBUSB_FILTERDRV_COMPAT)
+ if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,
+ ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,
+ ENDPOINT_BANK_SINGLE)))
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ }
+ #endif
+}
+
+/** Processes incoming V2 Protocol commands from the host, returning a response when required. */
+void Process_AVRISP_Commands(void)
+{
+ /* Device must be connected and configured for the task to run */
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
+
+ /* Check to see if a V2 Protocol command has been received */
+ if (Endpoint_IsOUTReceived())
+ {
+ LEDs_SetAllLEDs(LEDMASK_BUSY);
+
+ /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
+ V2Protocol_ProcessCommand();
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ }
+}
+
diff --git a/Projects/AVRISP-MKII/AVRISP.h b/Projects/AVRISP-MKII/AVRISP.h
index c9f3263ad..409b14744 100644
--- a/Projects/AVRISP-MKII/AVRISP.h
+++ b/Projects/AVRISP-MKII/AVRISP.h
@@ -1,81 +1,81 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 AVRISP.c.
- */
-
-#ifndef _AVRISP_H_
-#define _AVRISP_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/interrupt.h>
- #include <avr/power.h>
-
- #include "Descriptors.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/USB/USB.h>
-
- #if defined(ADC)
- #include <LUFA/Drivers/Peripheral/ADC.h>
- #endif
-
- #include "Lib/V2Protocol.h"
-
- /* 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_BUSY (LEDS_LED1 | LEDS_LED2)
-
- /* Function Prototypes: */
- void SetupHardware(void);
- void Process_AVRISP_Commands(void);
-
- void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
- void EVENT_USB_Device_ConfigurationChanged(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 AVRISP.c.
+ */
+
+#ifndef _AVRISP_H_
+#define _AVRISP_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/interrupt.h>
+ #include <avr/power.h>
+
+ #include "Descriptors.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/USB/USB.h>
+
+ #if defined(ADC)
+ #include <LUFA/Drivers/Peripheral/ADC.h>
+ #endif
+
+ #include "Lib/V2Protocol.h"
+
+ /* 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_BUSY (LEDS_LED1 | LEDS_LED2)
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+ void Process_AVRISP_Commands(void);
+
+ void EVENT_USB_Device_Connect(void);
+ void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_ConfigurationChanged(void);
+
+#endif
diff --git a/Projects/AVRISP-MKII/AVRISP.txt b/Projects/AVRISP-MKII/AVRISP.txt
index 034df6717..6483cbd03 100644
--- a/Projects/AVRISP-MKII/AVRISP.txt
+++ b/Projects/AVRISP-MKII/AVRISP.txt
@@ -1,269 +1,269 @@
-/** \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 AVRISP MKII Programmer Project
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - Series 7 USB AVRs
- * - Series 6 USB AVRs
- * - Series 4 USB AVRs
- * - Series 2 USB AVRs (8KB versions with reduced features only)
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Vendor Specific Class</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>N/A</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>Atmel AVRISP MKII Protocol Specification</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Firmware for an AVRStudio compatible AVRISP-MKII clone programmer. This project will enable the USB AVR series of
- * microcontrollers to act as a clone of the official Atmel AVRISP-MKII programmer, usable within AVRStudio. In its
- * most basic form, it allows for the programming of 5V AVRs from within AVRStudio with no special hardware other than
- * the USB AVR and the parts needed for the USB interface. If the user desires, more advanced circuits incorporating
- * level conversion can be made to allow for the programming of 3.3V AVR designs.
- *
- * This device spoofs Atmel's official AVRISP-MKII device PID so that it remains compatible with Atmel's AVRISP-MKII
- * drivers. When prompted, direct your OS to install Atmel's AVRISP-MKII drivers provided with AVRStudio.
- *
- * Note that this design currently has the following limitations:
- * - Minimum ISP target clock speed of 500KHz due to hardware SPI module prescaler limitations
- * - No reversed/shorted target connector detection and notification
- * - A seperate header is required for each of the ISP, PDI and TPI programming protocols that the user wishes to use
- *
- * On AVR models with an ADC converter, AVCC should be tied to 5V (e.g. VBUS) and the VTARGET_ADC_CHANNEL token should be
- * set to an appropriate ADC channel number in the project makefile for VTARGET detection to operate correctly. On models
- * without an ADC converter, VTARGET will report a fixed 5V level at all times.
- *
- * While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more
- * of FLASH is required. On 8KB devices, ISP or PDI/TPI programming support can be disabled to reduce program size.
- *
- * \section Sec_ISP ISP Connections
- * Connections to the device for SPI programming (when enabled):
- *
- * <table>
- * <tr>
- * <td><b>Programmer Pin:</b></td>
- * <td><b>Target Device Pin:</b></td>
- * <td><b>ISP 6 Pin Layout:</b></td>
- * </tr>
- * <tr>
- * <td>MISO</td>
- * <td>PDO</td>
- * <td>1</td>
- * </tr>
- * <tr>
- * <td>ADCx <b><sup>1</sup></b></td>
- * <td>VTARGET</td>
- * <td>2</td>
- * </tr>
- * <tr>
- * <td>SCLK</td>
- * <td>SCLK</td>
- * <td>3</td>
- * </tr>
- * <tr>
- * <td>MOSI</td>
- * <td>PDI</td>
- * <td>4</td>
- * </tr>
- * <tr>
- * <td>PORTx.y <b><sup>2</sup></b></td>
- * <td>/RESET</td>
- * <td>5</td>
- * </tr>
- * <tr>
- * <td>GND</td>
- * <td>GND</td>
- * <td>6</td>
- * </tr>
- * </table>
- *
- * In addition, the AVR's XCK pin will generate a .5MHz clock when SPI programming is used, to act as an external
- * device clock if the fuses have been mis-set. To use the recovery clock, connect XCK to the target AVR's XTAL1
- * pin, and set the ISP programming speed to 125KHz or below.
- *
- * <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
- * <b><sup>2</sup></b> <i>See AUX line related tokens in the \ref SSec_Options section</i>
- *
- * \section Sec_PDI PDI Connections
- * Connections to the device for PDI programming<b><sup>1</sup></b> (when enabled):
- *
- * <table>
- * <tr>
- * <td><b>Programmer Pin:</b></td>
- * <td><b>Target Device Pin:</b></td>
- * <td><b>PDI 6 Pin Layout:</b></td>
- * </tr>
- * <tr>
- * <td>Tx/Rx <b><sup>2</sup></b></td>
- * <td>DATA</td>
- * <td>1</td>
- * </tr>
- * <tr>
- * <td>ADCx <b><sup>1</sup></b></td>
- * <td>VTARGET</td>
- * <td>2</td>
- * </tr>
- * <tr>
- * <td>N/A</td>
- * <td>N/A</td>
- * <td>3</td>
- * </tr>
- * <tr>
- * <td>N/A</td>
- * <td>N/A</td>
- * <td>4</td>
- * </tr>
- * <tr>
- * <td>XCLK</td>
- * <td>CLOCK</td>
- * <td>5</td>
- * </tr>
- * <tr>
- * <td>GND</td>
- * <td>GND</td>
- * <td>6</td>
- * </tr>
- * </table>
- *
- * <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
- * <b><sup>2</sup></b> <i>The AVR's Tx and Rx become the DATA line when connected together via a pair of 220 ohm resistors</i> \n
- *
- * \section Sec_TPI TPI Connections
- * Connections to the device for TPI programming<b><sup>1</sup></b> (when enabled):
- *
- * <table>
- * <tr>
- * <td><b>Programmer Pin:</b></td>
- * <td><b>Target Device Pin:</b></td>
- * <td><b>TPI 6 Pin Layout:</b></td>
- * </tr>
- * <tr>
- * <td>Tx/Rx <b><sup>2</sup></b></td>
- * <td>DATA</td>
- * <td>1</td>
- * </tr>
- * <tr>
- * <td>ADCx <b><sup>1</sup></b></td>
- * <td>VTARGET</td>
- * <td>2</td>
- * </tr>
- * <tr>
- * <td>XCLK <b><sup>2</sup></b></td>
- * <td>CLOCK</td>
- * <td>3</td>
- * </tr>
- * <tr>
- * <td>N/A</td>
- * <td>N/A</td>
- * <td>4</td>
- * </tr>
- * <tr>
- * <td>PORTx.y <b><sup>3</sup></b></td>
- * <td>/RESET</td>
- * <td>5</td>
- * </tr>
- * <tr>
- * <td>GND</td>
- * <td>GND</td>
- * <td>6</td>
- * </tr>
- * </table>
- *
- * <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
- * <b><sup>2</sup></b> <i>The AVR's Tx and Rx become the DATA line when connected together via a pair of 220 ohm resistors</i> \n
- * <b><sup>3</sup></b> <i>See AUX line related tokens in the \ref SSec_Options section</i>
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>AUX_LINE_PORT</td>
- * <td>Makefile CDEFS</td>
- * <td>PORT register for the programmer's AUX target line. The use of this line varies between the programming protocols,
- * but is generally used for the target's /RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>
- * </tr>
- * <tr>
- * <td>AUX_LINE_PIN</td>
- * <td>Makefile CDEFS</td>
- * <td>PIN register for the programmer's AUX target line. The use of this line varies between the programming protocols,
- * but is generally used for the target's /RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>
- * </tr>
- * <tr>
- * <td>AUX_LINE_DDR</td>
- * <td>Makefile CDEFS</td>
- * <td>DDR register for the programmer's AUX target line. The use of this line varies between the programming protocols,
- * but is generally used for the target's /RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>
- * </tr>
- * <tr>
- * <td>AUX_LINE_MASK</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the programmer's AUX target line. The use of this line varies between the programming protocols,
- * but is generally used for the target's /RESET line. <b>Must not be the AVR's /SS pin</b>. <i>Ignored when
- * compiled for the XPLAIN board.</i></td>
- * </tr>
- * <tr>
- * <td>VTARGET_ADC_CHANNEL</td>
- * <td>Makefile CDEFS</td>
- * <td>ADC channel number (on supported AVRs) to use for VTARGET level detection, if NO_VTARGET_DETECT is not defined.</td>
- * </tr>
- * <tr>
- * <td>ENABLE_ISP_PROTOCOL</td>
- * <td>Makefile CDEFS</td>
- * <td>Define to enable SPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
- * </tr>
- * <tr>
- * <td>ENABLE_XPROG_PROTOCOL</td>
- * <td>Makefile CDEFS</td>
- * <td>Define to enable PDI and TPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
- * </tr>
- * <tr>
- * <td>NO_VTARGET_DETECT</td>
- * <td>Makefile CDEFS</td>
- * <td>Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer
- * to report a fixed 5V target voltage to the host regardless of the real target voltage.</td>
- * </tr>
- * <tr>
- * <td>LIBUSB_FILTERDRV_COMPAT</td>
- * <td>Makefile CDEFS</td>
- * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
- * the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this
- * option.
- * </tr>
- * </table>
- */
+/** \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 AVRISP MKII Programmer Project
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - Series 7 USB AVRs
+ * - Series 6 USB AVRs
+ * - Series 4 USB AVRs
+ * - Series 2 USB AVRs (8KB versions with reduced features only)
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Vendor Specific Class</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>N/A</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>Atmel AVRISP MKII Protocol Specification</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Firmware for an AVRStudio compatible AVRISP-MKII clone programmer. This project will enable the USB AVR series of
+ * microcontrollers to act as a clone of the official Atmel AVRISP-MKII programmer, usable within AVRStudio. In its
+ * most basic form, it allows for the programming of 5V AVRs from within AVRStudio with no special hardware other than
+ * the USB AVR and the parts needed for the USB interface. If the user desires, more advanced circuits incorporating
+ * level conversion can be made to allow for the programming of 3.3V AVR designs.
+ *
+ * This device spoofs Atmel's official AVRISP-MKII device PID so that it remains compatible with Atmel's AVRISP-MKII
+ * drivers. When prompted, direct your OS to install Atmel's AVRISP-MKII drivers provided with AVRStudio.
+ *
+ * Note that this design currently has the following limitations:
+ * - Minimum ISP target clock speed of 500KHz due to hardware SPI module prescaler limitations
+ * - No reversed/shorted target connector detection and notification
+ * - A seperate header is required for each of the ISP, PDI and TPI programming protocols that the user wishes to use
+ *
+ * On AVR models with an ADC converter, AVCC should be tied to 5V (e.g. VBUS) and the VTARGET_ADC_CHANNEL token should be
+ * set to an appropriate ADC channel number in the project makefile for VTARGET detection to operate correctly. On models
+ * without an ADC converter, VTARGET will report a fixed 5V level at all times.
+ *
+ * While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more
+ * of FLASH is required. On 8KB devices, ISP or PDI/TPI programming support can be disabled to reduce program size.
+ *
+ * \section Sec_ISP ISP Connections
+ * Connections to the device for SPI programming (when enabled):
+ *
+ * <table>
+ * <tr>
+ * <td><b>Programmer Pin:</b></td>
+ * <td><b>Target Device Pin:</b></td>
+ * <td><b>ISP 6 Pin Layout:</b></td>
+ * </tr>
+ * <tr>
+ * <td>MISO</td>
+ * <td>PDO</td>
+ * <td>1</td>
+ * </tr>
+ * <tr>
+ * <td>ADCx <b><sup>1</sup></b></td>
+ * <td>VTARGET</td>
+ * <td>2</td>
+ * </tr>
+ * <tr>
+ * <td>SCLK</td>
+ * <td>SCLK</td>
+ * <td>3</td>
+ * </tr>
+ * <tr>
+ * <td>MOSI</td>
+ * <td>PDI</td>
+ * <td>4</td>
+ * </tr>
+ * <tr>
+ * <td>PORTx.y <b><sup>2</sup></b></td>
+ * <td>/RESET</td>
+ * <td>5</td>
+ * </tr>
+ * <tr>
+ * <td>GND</td>
+ * <td>GND</td>
+ * <td>6</td>
+ * </tr>
+ * </table>
+ *
+ * In addition, the AVR's XCK pin will generate a .5MHz clock when SPI programming is used, to act as an external
+ * device clock if the fuses have been mis-set. To use the recovery clock, connect XCK to the target AVR's XTAL1
+ * pin, and set the ISP programming speed to 125KHz or below.
+ *
+ * <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
+ * <b><sup>2</sup></b> <i>See AUX line related tokens in the \ref SSec_Options section</i>
+ *
+ * \section Sec_PDI PDI Connections
+ * Connections to the device for PDI programming<b><sup>1</sup></b> (when enabled):
+ *
+ * <table>
+ * <tr>
+ * <td><b>Programmer Pin:</b></td>
+ * <td><b>Target Device Pin:</b></td>
+ * <td><b>PDI 6 Pin Layout:</b></td>
+ * </tr>
+ * <tr>
+ * <td>Tx/Rx <b><sup>2</sup></b></td>
+ * <td>DATA</td>
+ * <td>1</td>
+ * </tr>
+ * <tr>
+ * <td>ADCx <b><sup>1</sup></b></td>
+ * <td>VTARGET</td>
+ * <td>2</td>
+ * </tr>
+ * <tr>
+ * <td>N/A</td>
+ * <td>N/A</td>
+ * <td>3</td>
+ * </tr>
+ * <tr>
+ * <td>N/A</td>
+ * <td>N/A</td>
+ * <td>4</td>
+ * </tr>
+ * <tr>
+ * <td>XCLK</td>
+ * <td>CLOCK</td>
+ * <td>5</td>
+ * </tr>
+ * <tr>
+ * <td>GND</td>
+ * <td>GND</td>
+ * <td>6</td>
+ * </tr>
+ * </table>
+ *
+ * <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
+ * <b><sup>2</sup></b> <i>The AVR's Tx and Rx become the DATA line when connected together via a pair of 220 ohm resistors</i> \n
+ *
+ * \section Sec_TPI TPI Connections
+ * Connections to the device for TPI programming<b><sup>1</sup></b> (when enabled):
+ *
+ * <table>
+ * <tr>
+ * <td><b>Programmer Pin:</b></td>
+ * <td><b>Target Device Pin:</b></td>
+ * <td><b>TPI 6 Pin Layout:</b></td>
+ * </tr>
+ * <tr>
+ * <td>Tx/Rx <b><sup>2</sup></b></td>
+ * <td>DATA</td>
+ * <td>1</td>
+ * </tr>
+ * <tr>
+ * <td>ADCx <b><sup>1</sup></b></td>
+ * <td>VTARGET</td>
+ * <td>2</td>
+ * </tr>
+ * <tr>
+ * <td>XCLK <b><sup>2</sup></b></td>
+ * <td>CLOCK</td>
+ * <td>3</td>
+ * </tr>
+ * <tr>
+ * <td>N/A</td>
+ * <td>N/A</td>
+ * <td>4</td>
+ * </tr>
+ * <tr>
+ * <td>PORTx.y <b><sup>3</sup></b></td>
+ * <td>/RESET</td>
+ * <td>5</td>
+ * </tr>
+ * <tr>
+ * <td>GND</td>
+ * <td>GND</td>
+ * <td>6</td>
+ * </tr>
+ * </table>
+ *
+ * <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
+ * <b><sup>2</sup></b> <i>The AVR's Tx and Rx become the DATA line when connected together via a pair of 220 ohm resistors</i> \n
+ * <b><sup>3</sup></b> <i>See AUX line related tokens in the \ref SSec_Options section</i>
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>AUX_LINE_PORT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>PORT register for the programmer's AUX target line. The use of this line varies between the programming protocols,
+ * but is generally used for the target's /RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * </tr>
+ * <tr>
+ * <td>AUX_LINE_PIN</td>
+ * <td>Makefile CDEFS</td>
+ * <td>PIN register for the programmer's AUX target line. The use of this line varies between the programming protocols,
+ * but is generally used for the target's /RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * </tr>
+ * <tr>
+ * <td>AUX_LINE_DDR</td>
+ * <td>Makefile CDEFS</td>
+ * <td>DDR register for the programmer's AUX target line. The use of this line varies between the programming protocols,
+ * but is generally used for the target's /RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * </tr>
+ * <tr>
+ * <td>AUX_LINE_MASK</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the programmer's AUX target line. The use of this line varies between the programming protocols,
+ * but is generally used for the target's /RESET line. <b>Must not be the AVR's /SS pin</b>. <i>Ignored when
+ * compiled for the XPLAIN board.</i></td>
+ * </tr>
+ * <tr>
+ * <td>VTARGET_ADC_CHANNEL</td>
+ * <td>Makefile CDEFS</td>
+ * <td>ADC channel number (on supported AVRs) to use for VTARGET level detection, if NO_VTARGET_DETECT is not defined.</td>
+ * </tr>
+ * <tr>
+ * <td>ENABLE_ISP_PROTOCOL</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Define to enable SPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * </tr>
+ * <tr>
+ * <td>ENABLE_XPROG_PROTOCOL</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Define to enable PDI and TPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * </tr>
+ * <tr>
+ * <td>NO_VTARGET_DETECT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer
+ * to report a fixed 5V target voltage to the host regardless of the real target voltage.</td>
+ * </tr>
+ * <tr>
+ * <td>LIBUSB_FILTERDRV_COMPAT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
+ * the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this
+ * option.
+ * </tr>
+ * </table>
+ */
diff --git a/Projects/AVRISP-MKII/Descriptors.c b/Projects/AVRISP-MKII/Descriptors.c
index af28b4b30..a57ad06c3 100644
--- a/Projects/AVRISP-MKII/Descriptors.c
+++ b/Projects/AVRISP-MKII/Descriptors.c
@@ -1,219 +1,219 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0xFF,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2104,
- .ReleaseNumber = VERSION_BCD(02.00),
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = 0x03,
-
- .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.
- */
-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 = 1,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .AVRISP_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0xFF,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .AVRISP_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = AVRISP_DATA_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .AVRISP_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = AVRISP_DATA_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA AVRISP MkII Clone"
-};
-
-/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
- * series of uppercase hexadecimal digits.
- */
-USB_Descriptor_String_t PROGMEM SerialString =
-{
- .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
- .UnicodeString = L"0000A00128255"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- case 0x03:
- Address = (void*)&SerialString;
- Size = pgm_read_byte(&SerialString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0xFF,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2104,
+ .ReleaseNumber = VERSION_BCD(02.00),
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = 0x03,
+
+ .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.
+ */
+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 = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .AVRISP_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0xFF,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .AVRISP_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = AVRISP_DATA_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .AVRISP_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = AVRISP_DATA_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA AVRISP MkII Clone"
+};
+
+/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
+ * series of uppercase hexadecimal digits.
+ */
+USB_Descriptor_String_t PROGMEM SerialString =
+{
+ .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
+
+ .UnicodeString = L"0000A00128255"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ case 0x03:
+ Address = (void*)&SerialString;
+ Size = pgm_read_byte(&SerialString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/AVRISP-MKII/Descriptors.h b/Projects/AVRISP-MKII/Descriptors.h
index 3a4828364..7415d8138 100644
--- a/Projects/AVRISP-MKII/Descriptors.h
+++ b/Projects/AVRISP-MKII/Descriptors.h
@@ -1,79 +1,79 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
-
- /* Macros: */
- #if !defined(LIBUSB_FILTERDRV_COMPAT)
- /** Endpoint number of the AVRISP data OUT endpoint. */
- #define AVRISP_DATA_OUT_EPNUM 2
-
- /** Endpoint number of the AVRISP data IN endpoint. */
- #define AVRISP_DATA_IN_EPNUM 2
- #else
- /** Endpoint number of the AVRISP data OUT endpoint. */
- #define AVRISP_DATA_OUT_EPNUM 2
-
- /** Endpoint number of the AVRISP data IN endpoint. */
- #define AVRISP_DATA_IN_EPNUM 3
- #endif
-
- /** Size in bytes of the AVRISP data endpoint. */
- #define AVRISP_DATA_EPSIZE 64
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t AVRISP_Interface;
- USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
- USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+
+ /* Macros: */
+ #if !defined(LIBUSB_FILTERDRV_COMPAT)
+ /** Endpoint number of the AVRISP data OUT endpoint. */
+ #define AVRISP_DATA_OUT_EPNUM 2
+
+ /** Endpoint number of the AVRISP data IN endpoint. */
+ #define AVRISP_DATA_IN_EPNUM 2
+ #else
+ /** Endpoint number of the AVRISP data OUT endpoint. */
+ #define AVRISP_DATA_OUT_EPNUM 2
+
+ /** Endpoint number of the AVRISP data IN endpoint. */
+ #define AVRISP_DATA_IN_EPNUM 3
+ #endif
+
+ /** Size in bytes of the AVRISP data endpoint. */
+ #define AVRISP_DATA_EPSIZE 64
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t AVRISP_Interface;
+ USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
+ USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/AVRISP-MKII/Doxygen.conf b/Projects/AVRISP-MKII/Doxygen.conf
index 643c799a7..8274d0004 100644
--- a/Projects/AVRISP-MKII/Doxygen.conf
+++ b/Projects/AVRISP-MKII/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "AVRISP-MKII Clone Programmer Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "AVRISP-MKII Clone Programmer Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
index 9d0a26c33..a16504da1 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
@@ -1,545 +1,545 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * ISP Protocol handler, to process V2 Protocol wrapped ISP commands used in Atmel programmer devices.
- */
-
-#include "ISPProtocol.h"
-
-#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)
-
-/** Handler for the CMD_ENTER_PROGMODE_ISP command, which attempts to enter programming mode on
- * the attached device, returning success or failure back to the host.
- */
-void ISPProtocol_EnterISPMode(void)
-{
- struct
- {
- uint8_t TimeoutMS;
- uint8_t PinStabDelayMS;
- uint8_t ExecutionDelayMS;
- uint8_t SynchLoops;
- uint8_t ByteDelay;
- uint8_t PollValue;
- uint8_t PollIndex;
- uint8_t EnterProgBytes[4];
- } Enter_ISP_Params;
-
- Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint8_t ResponseStatus = STATUS_CMD_FAILED;
-
- CurrentAddress = 0;
-
- /* Set up the synchronous USART to generate the recovery clock on XCK pin */
- UBRR1 = (F_CPU / 500000UL);
- UCSR1B = (1 << TXEN1);
- UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
- DDRD |= (1 << 5);
-
- /* Perform execution delay, initialize SPI bus */
- ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
- SPI_Init(ISPTarget_GetSPIPrescalerMask() | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_MODE_MASTER);
-
- /* Continuously attempt to synchronize with the target until either the number of attempts specified
- * by the host has exceeded, or the the device sends back the expected response values */
- while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED) && TimeoutMSRemaining)
- {
- uint8_t ResponseBytes[4];
-
- ISPTarget_ChangeTargetResetLine(true);
- ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
-
- for (uint8_t RByte = 0; RByte < sizeof(ResponseBytes); RByte++)
- {
- ISPProtocol_DelayMS(Enter_ISP_Params.ByteDelay);
- ResponseBytes[RByte] = SPI_TransferByte(Enter_ISP_Params.EnterProgBytes[RByte]);
- }
-
- /* Check if polling disabled, or if the polled value matches the expected value */
- if (!(Enter_ISP_Params.PollIndex) || (ResponseBytes[Enter_ISP_Params.PollIndex - 1] == Enter_ISP_Params.PollValue))
- {
- ResponseStatus = STATUS_CMD_OK;
- }
- else
- {
- ISPTarget_ChangeTargetResetLine(false);
- ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
- }
- }
-
- Endpoint_Write_Byte(CMD_ENTER_PROGMODE_ISP);
- Endpoint_Write_Byte(ResponseStatus);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_LEAVE_ISP command, which releases the target from programming mode. */
-void ISPProtocol_LeaveISPMode(void)
-{
- struct
- {
- uint8_t PreDelayMS;
- uint8_t PostDelayMS;
- } Leave_ISP_Params;
-
- Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- /* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */
- ISPProtocol_DelayMS(Leave_ISP_Params.PreDelayMS);
- ISPTarget_ChangeTargetResetLine(false);
- SPI_ShutDown();
- ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);
-
- /* Turn off the synchronous USART to terminate the recovery clock on XCK pin */
- UBRR1 = (F_CPU / 500000UL);
- UCSR1B = (1 << TXEN1);
- UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
- DDRD &= ~(1 << 5);
-
- Endpoint_Write_Byte(CMD_LEAVE_PROGMODE_ISP);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_PROGRAM_FLASH_ISP and CMD_PROGRAM_EEPROM_ISP commands, writing out bytes,
- * words or pages of data to the attached device.
- *
- * \param[in] V2Command Issued V2 Protocol command byte from the host
- */
-void ISPProtocol_ProgramMemory(uint8_t V2Command)
-{
- struct
- {
- uint16_t BytesToWrite;
- uint8_t ProgrammingMode;
- uint8_t DelayMS;
- uint8_t ProgrammingCommands[3];
- uint8_t PollValue1;
- uint8_t PollValue2;
- uint8_t ProgData[256]; // Note, the Jungo driver has a very short ACK timeout period, need to buffer the
- } Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting
-
- Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -
- sizeof(Write_Memory_Params.ProgData)), NO_STREAM_CALLBACK);
-
-
- Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
-
- if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
- {
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(V2Command);
- Endpoint_Write_Byte(STATUS_CMD_FAILED);
- Endpoint_ClearIN();
- return;
- }
-
- Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite, NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint8_t ProgrammingStatus = STATUS_CMD_OK;
- uint16_t PollAddress = 0;
- uint8_t PollValue = (V2Command == CMD_PROGRAM_FLASH_ISP) ? Write_Memory_Params.PollValue1 :
- Write_Memory_Params.PollValue2;
- uint8_t* NextWriteByte = Write_Memory_Params.ProgData;
-
- /* Check to see if the host has issued a SET ADDRESS command and we haven't sent a
- * LOAD EXTENDED ADDRESS command (if needed, used when operating beyond the 128KB
- * FLASH barrier) */
- if (MustSetAddress)
- {
- if (CurrentAddress & (1UL << 31))
- ISPTarget_LoadExtendedAddress();
-
- MustSetAddress = false;
- }
-
- /* Check the programming mode desired by the host, either Paged or Word memory writes */
- if (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_WRITES_MASK)
- {
- uint16_t StartAddress = (CurrentAddress & 0xFFFF);
-
- /* Paged mode memory programming */
- for (uint16_t CurrentByte = 0; CurrentByte < Write_Memory_Params.BytesToWrite; CurrentByte++)
- {
- bool IsOddByte = (CurrentByte & 0x01);
- uint8_t ByteToWrite = *(NextWriteByte++);
-
- SPI_SendByte(Write_Memory_Params.ProgrammingCommands[0]);
- SPI_SendByte(CurrentAddress >> 8);
- SPI_SendByte(CurrentAddress & 0xFF);
- SPI_SendByte(ByteToWrite);
-
- /* AVR FLASH addressing requires us to modify the write command based on if we are writing a high
- * or low byte at the current word address */
- if (V2Command == CMD_PROGRAM_FLASH_ISP)
- Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;
-
- /* Check to see the write completion method, to see if we have a valid polling address */
- if (!(PollAddress) && (ByteToWrite != PollValue))
- {
- if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
- Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
-
- PollAddress = (CurrentAddress & 0xFFFF);
- }
-
- if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP))
- CurrentAddress++;
- }
-
- /* If the current page must be committed, send the PROGRAM PAGE command to the target */
- if (Write_Memory_Params.ProgrammingMode & PROG_MODE_COMMIT_PAGE_MASK)
- {
- SPI_SendByte(Write_Memory_Params.ProgrammingCommands[1]);
- SPI_SendByte(StartAddress >> 8);
- SPI_SendByte(StartAddress & 0xFF);
- SPI_SendByte(0x00);
-
- /* Check if polling is possible, if not switch to timed delay mode */
- if (!(PollAddress))
- {
- Write_Memory_Params.ProgrammingMode &= ~PROG_MODE_PAGED_VALUE_MASK;
- Write_Memory_Params.ProgrammingMode |= PROG_MODE_PAGED_TIMEDELAY_MASK;
- }
-
- ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
- Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
- }
- }
- else
- {
- /* Word/byte mode memory programming */
- for (uint16_t CurrentByte = 0; CurrentByte < Write_Memory_Params.BytesToWrite; CurrentByte++)
- {
- bool IsOddByte = (CurrentByte & 0x01);
- uint8_t ByteToWrite = *(NextWriteByte++);
-
- SPI_SendByte(Write_Memory_Params.ProgrammingCommands[0]);
- SPI_SendByte(CurrentAddress >> 8);
- SPI_SendByte(CurrentAddress & 0xFF);
- SPI_SendByte(ByteToWrite);
-
- /* AVR FLASH addressing requires us to modify the write command based on if we are writing a high
- * or low byte at the current word address */
- if (V2Command == CMD_PROGRAM_FLASH_ISP)
- Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;
-
- if (ByteToWrite != PollValue)
- {
- if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
- Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
-
- PollAddress = (CurrentAddress & 0xFFFF);
- }
-
- if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP))
- CurrentAddress++;
-
- ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
- Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
-
- if (ProgrammingStatus != STATUS_CMD_OK)
- break;
- }
- }
-
- Endpoint_Write_Byte(V2Command);
- Endpoint_Write_Byte(ProgrammingStatus);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_READ_FLASH_ISP and CMD_READ_EEPROM_ISP commands, reading in bytes,
- * words or pages of data from the attached device.
- *
- * \param[in] V2Command Issued V2 Protocol command byte from the host
- */
-void ISPProtocol_ReadMemory(uint8_t V2Command)
-{
- struct
- {
- uint16_t BytesToRead;
- uint8_t ReadMemoryCommand;
- } Read_Memory_Params;
-
- Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NO_STREAM_CALLBACK);
- Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(V2Command);
- Endpoint_Write_Byte(STATUS_CMD_OK);
-
- /* Check to see if the host has issued a SET ADDRESS command and we haven't sent a
- * LOAD EXTENDED ADDRESS command (if needed, used when operating beyond the 128KB
- * FLASH barrier) */
- if (MustSetAddress)
- {
- if (CurrentAddress & (1UL << 31))
- ISPTarget_LoadExtendedAddress();
-
- MustSetAddress = false;
- }
-
- /* Read each byte from the device and write them to the packet for the host */
- for (uint16_t CurrentByte = 0; CurrentByte < Read_Memory_Params.BytesToRead; CurrentByte++)
- {
- /* Read the next byte from the desired memory space in the device */
- SPI_SendByte(Read_Memory_Params.ReadMemoryCommand);
- SPI_SendByte(CurrentAddress >> 8);
- SPI_SendByte(CurrentAddress & 0xFF);
- Endpoint_Write_Byte(SPI_ReceiveByte());
-
- /* Check if the endpoint bank is currently full, if so send the packet */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
- }
-
- /* AVR FLASH addressing requires us to modify the read command based on if we are reading a high
- * or low byte at the current word address */
- if (V2Command == CMD_READ_FLASH_ISP)
- Read_Memory_Params.ReadMemoryCommand ^= READ_WRITE_HIGH_BYTE_MASK;
-
- /* Only increment the current address if we have read both bytes in the current word when in FLASH
- * read mode, or for each byte when in EEPROM read mode */
- if (((CurrentByte & 0x01) && (V2Command == CMD_READ_FLASH_ISP)) || (V2Command == CMD_READ_EEPROM_ISP))
- CurrentAddress++;
- }
-
- Endpoint_Write_Byte(STATUS_CMD_OK);
-
- bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
- Endpoint_ClearIN();
-
- /* Ensure last packet is a short packet to terminate the transfer */
- if (IsEndpointFull)
- {
- Endpoint_WaitUntilReady();
- Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
- }
-}
-
-/** Handler for the CMD_CHI_ERASE_ISP command, clearing the target's FLASH memory. */
-void ISPProtocol_ChipErase(void)
-{
- struct
- {
- uint8_t EraseDelayMS;
- uint8_t PollMethod;
- uint8_t EraseCommandBytes[4];
- } Erase_Chip_Params;
-
- Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint8_t ResponseStatus = STATUS_CMD_OK;
-
- /* Send the chip erase commands as given by the host to the device */
- for (uint8_t SByte = 0; SByte < sizeof(Erase_Chip_Params.EraseCommandBytes); SByte++)
- SPI_SendByte(Erase_Chip_Params.EraseCommandBytes[SByte]);
-
- /* Use appropriate command completion check as given by the host (delay or busy polling) */
- if (!(Erase_Chip_Params.PollMethod))
- ISPProtocol_DelayMS(Erase_Chip_Params.EraseDelayMS);
- else
- ResponseStatus = ISPTarget_WaitWhileTargetBusy();
-
- Endpoint_Write_Byte(CMD_CHIP_ERASE_ISP);
- Endpoint_Write_Byte(ResponseStatus);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_READ_FUSE_ISP, CMD_READ_LOCK_ISP, CMD_READ_SIGNATURE_ISP and CMD_READ_OSCCAL commands,
- * reading the requested configuration byte from the device.
- *
- * \param[in] V2Command Issued V2 Protocol command byte from the host
- */
-void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
-{
- struct
- {
- uint8_t RetByte;
- uint8_t ReadCommandBytes[4];
- } Read_FuseLockSigOSCCAL_Params;
-
- Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint8_t ResponseBytes[4];
-
- /* Send the Fuse or Lock byte read commands as given by the host to the device, store response */
- for (uint8_t RByte = 0; RByte < sizeof(ResponseBytes); RByte++)
- ResponseBytes[RByte] = SPI_TransferByte(Read_FuseLockSigOSCCAL_Params.ReadCommandBytes[RByte]);
-
- Endpoint_Write_Byte(V2Command);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_Write_Byte(ResponseBytes[Read_FuseLockSigOSCCAL_Params.RetByte - 1]);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_WRITE_FUSE_ISP and CMD_WRITE_LOCK_ISP commands, writing the requested configuration
- * byte to the device.
- *
- * \param[in] V2Command Issued V2 Protocol command byte from the host
- */
-void ISPProtocol_WriteFuseLock(uint8_t V2Command)
-{
- struct
- {
- uint8_t WriteCommandBytes[4];
- } Write_FuseLockSig_Params;
-
- Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- /* Send the Fuse or Lock byte program commands as given by the host to the device */
- for (uint8_t SByte = 0; SByte < sizeof(Write_FuseLockSig_Params.WriteCommandBytes); SByte++)
- SPI_SendByte(Write_FuseLockSig_Params.WriteCommandBytes[SByte]);
-
- Endpoint_Write_Byte(V2Command);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_SPI_MULTI command, writing and reading arbitrary SPI data to and from the attached device. */
-void ISPProtocol_SPIMulti(void)
-{
- struct
- {
- uint8_t TxBytes;
- uint8_t RxBytes;
- uint8_t RxStartAddr;
- uint8_t TxData[255];
- } SPI_Multi_Params;
-
- Endpoint_Read_Stream_LE(&SPI_Multi_Params, (sizeof(SPI_Multi_Params) - sizeof(SPI_Multi_Params.TxData)), NO_STREAM_CALLBACK);
- Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(CMD_SPI_MULTI);
- Endpoint_Write_Byte(STATUS_CMD_OK);
-
- uint8_t CurrTxPos = 0;
- uint8_t CurrRxPos = 0;
-
- /* Write out bytes to transmit until the start of the bytes to receive is met */
- while (CurrTxPos < SPI_Multi_Params.RxStartAddr)
- {
- if (CurrTxPos < SPI_Multi_Params.TxBytes)
- SPI_SendByte(SPI_Multi_Params.TxData[CurrTxPos]);
- else
- SPI_SendByte(0);
-
- CurrTxPos++;
- }
-
- /* Transmit remaining bytes with padding as needed, read in response bytes */
- while (CurrRxPos < SPI_Multi_Params.RxBytes)
- {
- if (CurrTxPos < SPI_Multi_Params.TxBytes)
- Endpoint_Write_Byte(SPI_TransferByte(SPI_Multi_Params.TxData[CurrTxPos++]));
- else
- Endpoint_Write_Byte(SPI_ReceiveByte());
-
- /* Check to see if we have filled the endpoint bank and need to send the packet */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
- }
-
- CurrRxPos++;
- }
-
- Endpoint_Write_Byte(STATUS_CMD_OK);
-
- bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
- Endpoint_ClearIN();
-
- /* Ensure last packet is a short packet to terminate the transfer */
- if (IsEndpointFull)
- {
- Endpoint_WaitUntilReady();
- Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
- }
-}
-
-/** Blocking delay for a given number of milliseconds.
- *
- * \param[in] DelayMS Number of milliseconds to delay for
- */
-void ISPProtocol_DelayMS(uint8_t DelayMS)
-{
- while (DelayMS-- && TimeoutMSRemaining)
- {
- if (TimeoutMSRemaining)
- TimeoutMSRemaining--;
-
- _delay_ms(1);
- }
-}
-
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * ISP Protocol handler, to process V2 Protocol wrapped ISP commands used in Atmel programmer devices.
+ */
+
+#include "ISPProtocol.h"
+
+#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)
+
+/** Handler for the CMD_ENTER_PROGMODE_ISP command, which attempts to enter programming mode on
+ * the attached device, returning success or failure back to the host.
+ */
+void ISPProtocol_EnterISPMode(void)
+{
+ struct
+ {
+ uint8_t TimeoutMS;
+ uint8_t PinStabDelayMS;
+ uint8_t ExecutionDelayMS;
+ uint8_t SynchLoops;
+ uint8_t ByteDelay;
+ uint8_t PollValue;
+ uint8_t PollIndex;
+ uint8_t EnterProgBytes[4];
+ } Enter_ISP_Params;
+
+ Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint8_t ResponseStatus = STATUS_CMD_FAILED;
+
+ CurrentAddress = 0;
+
+ /* Set up the synchronous USART to generate the recovery clock on XCK pin */
+ UBRR1 = (F_CPU / 500000UL);
+ UCSR1B = (1 << TXEN1);
+ UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
+ DDRD |= (1 << 5);
+
+ /* Perform execution delay, initialize SPI bus */
+ ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
+ SPI_Init(ISPTarget_GetSPIPrescalerMask() | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_MODE_MASTER);
+
+ /* Continuously attempt to synchronize with the target until either the number of attempts specified
+ * by the host has exceeded, or the the device sends back the expected response values */
+ while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED) && TimeoutMSRemaining)
+ {
+ uint8_t ResponseBytes[4];
+
+ ISPTarget_ChangeTargetResetLine(true);
+ ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
+
+ for (uint8_t RByte = 0; RByte < sizeof(ResponseBytes); RByte++)
+ {
+ ISPProtocol_DelayMS(Enter_ISP_Params.ByteDelay);
+ ResponseBytes[RByte] = SPI_TransferByte(Enter_ISP_Params.EnterProgBytes[RByte]);
+ }
+
+ /* Check if polling disabled, or if the polled value matches the expected value */
+ if (!(Enter_ISP_Params.PollIndex) || (ResponseBytes[Enter_ISP_Params.PollIndex - 1] == Enter_ISP_Params.PollValue))
+ {
+ ResponseStatus = STATUS_CMD_OK;
+ }
+ else
+ {
+ ISPTarget_ChangeTargetResetLine(false);
+ ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
+ }
+ }
+
+ Endpoint_Write_Byte(CMD_ENTER_PROGMODE_ISP);
+ Endpoint_Write_Byte(ResponseStatus);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_LEAVE_ISP command, which releases the target from programming mode. */
+void ISPProtocol_LeaveISPMode(void)
+{
+ struct
+ {
+ uint8_t PreDelayMS;
+ uint8_t PostDelayMS;
+ } Leave_ISP_Params;
+
+ Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ /* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */
+ ISPProtocol_DelayMS(Leave_ISP_Params.PreDelayMS);
+ ISPTarget_ChangeTargetResetLine(false);
+ SPI_ShutDown();
+ ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);
+
+ /* Turn off the synchronous USART to terminate the recovery clock on XCK pin */
+ UBRR1 = (F_CPU / 500000UL);
+ UCSR1B = (1 << TXEN1);
+ UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
+ DDRD &= ~(1 << 5);
+
+ Endpoint_Write_Byte(CMD_LEAVE_PROGMODE_ISP);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_PROGRAM_FLASH_ISP and CMD_PROGRAM_EEPROM_ISP commands, writing out bytes,
+ * words or pages of data to the attached device.
+ *
+ * \param[in] V2Command Issued V2 Protocol command byte from the host
+ */
+void ISPProtocol_ProgramMemory(uint8_t V2Command)
+{
+ struct
+ {
+ uint16_t BytesToWrite;
+ uint8_t ProgrammingMode;
+ uint8_t DelayMS;
+ uint8_t ProgrammingCommands[3];
+ uint8_t PollValue1;
+ uint8_t PollValue2;
+ uint8_t ProgData[256]; // Note, the Jungo driver has a very short ACK timeout period, need to buffer the
+ } Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting
+
+ Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -
+ sizeof(Write_Memory_Params.ProgData)), NO_STREAM_CALLBACK);
+
+
+ Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
+
+ if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
+ {
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(STATUS_CMD_FAILED);
+ Endpoint_ClearIN();
+ return;
+ }
+
+ Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite, NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint8_t ProgrammingStatus = STATUS_CMD_OK;
+ uint16_t PollAddress = 0;
+ uint8_t PollValue = (V2Command == CMD_PROGRAM_FLASH_ISP) ? Write_Memory_Params.PollValue1 :
+ Write_Memory_Params.PollValue2;
+ uint8_t* NextWriteByte = Write_Memory_Params.ProgData;
+
+ /* Check to see if the host has issued a SET ADDRESS command and we haven't sent a
+ * LOAD EXTENDED ADDRESS command (if needed, used when operating beyond the 128KB
+ * FLASH barrier) */
+ if (MustSetAddress)
+ {
+ if (CurrentAddress & (1UL << 31))
+ ISPTarget_LoadExtendedAddress();
+
+ MustSetAddress = false;
+ }
+
+ /* Check the programming mode desired by the host, either Paged or Word memory writes */
+ if (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_WRITES_MASK)
+ {
+ uint16_t StartAddress = (CurrentAddress & 0xFFFF);
+
+ /* Paged mode memory programming */
+ for (uint16_t CurrentByte = 0; CurrentByte < Write_Memory_Params.BytesToWrite; CurrentByte++)
+ {
+ bool IsOddByte = (CurrentByte & 0x01);
+ uint8_t ByteToWrite = *(NextWriteByte++);
+
+ SPI_SendByte(Write_Memory_Params.ProgrammingCommands[0]);
+ SPI_SendByte(CurrentAddress >> 8);
+ SPI_SendByte(CurrentAddress & 0xFF);
+ SPI_SendByte(ByteToWrite);
+
+ /* AVR FLASH addressing requires us to modify the write command based on if we are writing a high
+ * or low byte at the current word address */
+ if (V2Command == CMD_PROGRAM_FLASH_ISP)
+ Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;
+
+ /* Check to see the write completion method, to see if we have a valid polling address */
+ if (!(PollAddress) && (ByteToWrite != PollValue))
+ {
+ if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
+ Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
+
+ PollAddress = (CurrentAddress & 0xFFFF);
+ }
+
+ if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP))
+ CurrentAddress++;
+ }
+
+ /* If the current page must be committed, send the PROGRAM PAGE command to the target */
+ if (Write_Memory_Params.ProgrammingMode & PROG_MODE_COMMIT_PAGE_MASK)
+ {
+ SPI_SendByte(Write_Memory_Params.ProgrammingCommands[1]);
+ SPI_SendByte(StartAddress >> 8);
+ SPI_SendByte(StartAddress & 0xFF);
+ SPI_SendByte(0x00);
+
+ /* Check if polling is possible, if not switch to timed delay mode */
+ if (!(PollAddress))
+ {
+ Write_Memory_Params.ProgrammingMode &= ~PROG_MODE_PAGED_VALUE_MASK;
+ Write_Memory_Params.ProgrammingMode |= PROG_MODE_PAGED_TIMEDELAY_MASK;
+ }
+
+ ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
+ Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
+ }
+ }
+ else
+ {
+ /* Word/byte mode memory programming */
+ for (uint16_t CurrentByte = 0; CurrentByte < Write_Memory_Params.BytesToWrite; CurrentByte++)
+ {
+ bool IsOddByte = (CurrentByte & 0x01);
+ uint8_t ByteToWrite = *(NextWriteByte++);
+
+ SPI_SendByte(Write_Memory_Params.ProgrammingCommands[0]);
+ SPI_SendByte(CurrentAddress >> 8);
+ SPI_SendByte(CurrentAddress & 0xFF);
+ SPI_SendByte(ByteToWrite);
+
+ /* AVR FLASH addressing requires us to modify the write command based on if we are writing a high
+ * or low byte at the current word address */
+ if (V2Command == CMD_PROGRAM_FLASH_ISP)
+ Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;
+
+ if (ByteToWrite != PollValue)
+ {
+ if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
+ Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
+
+ PollAddress = (CurrentAddress & 0xFFFF);
+ }
+
+ if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP))
+ CurrentAddress++;
+
+ ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
+ Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
+
+ if (ProgrammingStatus != STATUS_CMD_OK)
+ break;
+ }
+ }
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(ProgrammingStatus);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_READ_FLASH_ISP and CMD_READ_EEPROM_ISP commands, reading in bytes,
+ * words or pages of data from the attached device.
+ *
+ * \param[in] V2Command Issued V2 Protocol command byte from the host
+ */
+void ISPProtocol_ReadMemory(uint8_t V2Command)
+{
+ struct
+ {
+ uint16_t BytesToRead;
+ uint8_t ReadMemoryCommand;
+ } Read_Memory_Params;
+
+ Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NO_STREAM_CALLBACK);
+ Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+
+ /* Check to see if the host has issued a SET ADDRESS command and we haven't sent a
+ * LOAD EXTENDED ADDRESS command (if needed, used when operating beyond the 128KB
+ * FLASH barrier) */
+ if (MustSetAddress)
+ {
+ if (CurrentAddress & (1UL << 31))
+ ISPTarget_LoadExtendedAddress();
+
+ MustSetAddress = false;
+ }
+
+ /* Read each byte from the device and write them to the packet for the host */
+ for (uint16_t CurrentByte = 0; CurrentByte < Read_Memory_Params.BytesToRead; CurrentByte++)
+ {
+ /* Read the next byte from the desired memory space in the device */
+ SPI_SendByte(Read_Memory_Params.ReadMemoryCommand);
+ SPI_SendByte(CurrentAddress >> 8);
+ SPI_SendByte(CurrentAddress & 0xFF);
+ Endpoint_Write_Byte(SPI_ReceiveByte());
+
+ /* Check if the endpoint bank is currently full, if so send the packet */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ Endpoint_ClearIN();
+ Endpoint_WaitUntilReady();
+ }
+
+ /* AVR FLASH addressing requires us to modify the read command based on if we are reading a high
+ * or low byte at the current word address */
+ if (V2Command == CMD_READ_FLASH_ISP)
+ Read_Memory_Params.ReadMemoryCommand ^= READ_WRITE_HIGH_BYTE_MASK;
+
+ /* Only increment the current address if we have read both bytes in the current word when in FLASH
+ * read mode, or for each byte when in EEPROM read mode */
+ if (((CurrentByte & 0x01) && (V2Command == CMD_READ_FLASH_ISP)) || (V2Command == CMD_READ_EEPROM_ISP))
+ CurrentAddress++;
+ }
+
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+
+ bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
+ Endpoint_ClearIN();
+
+ /* Ensure last packet is a short packet to terminate the transfer */
+ if (IsEndpointFull)
+ {
+ Endpoint_WaitUntilReady();
+ Endpoint_ClearIN();
+ Endpoint_WaitUntilReady();
+ }
+}
+
+/** Handler for the CMD_CHI_ERASE_ISP command, clearing the target's FLASH memory. */
+void ISPProtocol_ChipErase(void)
+{
+ struct
+ {
+ uint8_t EraseDelayMS;
+ uint8_t PollMethod;
+ uint8_t EraseCommandBytes[4];
+ } Erase_Chip_Params;
+
+ Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint8_t ResponseStatus = STATUS_CMD_OK;
+
+ /* Send the chip erase commands as given by the host to the device */
+ for (uint8_t SByte = 0; SByte < sizeof(Erase_Chip_Params.EraseCommandBytes); SByte++)
+ SPI_SendByte(Erase_Chip_Params.EraseCommandBytes[SByte]);
+
+ /* Use appropriate command completion check as given by the host (delay or busy polling) */
+ if (!(Erase_Chip_Params.PollMethod))
+ ISPProtocol_DelayMS(Erase_Chip_Params.EraseDelayMS);
+ else
+ ResponseStatus = ISPTarget_WaitWhileTargetBusy();
+
+ Endpoint_Write_Byte(CMD_CHIP_ERASE_ISP);
+ Endpoint_Write_Byte(ResponseStatus);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_READ_FUSE_ISP, CMD_READ_LOCK_ISP, CMD_READ_SIGNATURE_ISP and CMD_READ_OSCCAL commands,
+ * reading the requested configuration byte from the device.
+ *
+ * \param[in] V2Command Issued V2 Protocol command byte from the host
+ */
+void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
+{
+ struct
+ {
+ uint8_t RetByte;
+ uint8_t ReadCommandBytes[4];
+ } Read_FuseLockSigOSCCAL_Params;
+
+ Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint8_t ResponseBytes[4];
+
+ /* Send the Fuse or Lock byte read commands as given by the host to the device, store response */
+ for (uint8_t RByte = 0; RByte < sizeof(ResponseBytes); RByte++)
+ ResponseBytes[RByte] = SPI_TransferByte(Read_FuseLockSigOSCCAL_Params.ReadCommandBytes[RByte]);
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_Write_Byte(ResponseBytes[Read_FuseLockSigOSCCAL_Params.RetByte - 1]);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_WRITE_FUSE_ISP and CMD_WRITE_LOCK_ISP commands, writing the requested configuration
+ * byte to the device.
+ *
+ * \param[in] V2Command Issued V2 Protocol command byte from the host
+ */
+void ISPProtocol_WriteFuseLock(uint8_t V2Command)
+{
+ struct
+ {
+ uint8_t WriteCommandBytes[4];
+ } Write_FuseLockSig_Params;
+
+ Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ /* Send the Fuse or Lock byte program commands as given by the host to the device */
+ for (uint8_t SByte = 0; SByte < sizeof(Write_FuseLockSig_Params.WriteCommandBytes); SByte++)
+ SPI_SendByte(Write_FuseLockSig_Params.WriteCommandBytes[SByte]);
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_SPI_MULTI command, writing and reading arbitrary SPI data to and from the attached device. */
+void ISPProtocol_SPIMulti(void)
+{
+ struct
+ {
+ uint8_t TxBytes;
+ uint8_t RxBytes;
+ uint8_t RxStartAddr;
+ uint8_t TxData[255];
+ } SPI_Multi_Params;
+
+ Endpoint_Read_Stream_LE(&SPI_Multi_Params, (sizeof(SPI_Multi_Params) - sizeof(SPI_Multi_Params.TxData)), NO_STREAM_CALLBACK);
+ Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(CMD_SPI_MULTI);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+
+ uint8_t CurrTxPos = 0;
+ uint8_t CurrRxPos = 0;
+
+ /* Write out bytes to transmit until the start of the bytes to receive is met */
+ while (CurrTxPos < SPI_Multi_Params.RxStartAddr)
+ {
+ if (CurrTxPos < SPI_Multi_Params.TxBytes)
+ SPI_SendByte(SPI_Multi_Params.TxData[CurrTxPos]);
+ else
+ SPI_SendByte(0);
+
+ CurrTxPos++;
+ }
+
+ /* Transmit remaining bytes with padding as needed, read in response bytes */
+ while (CurrRxPos < SPI_Multi_Params.RxBytes)
+ {
+ if (CurrTxPos < SPI_Multi_Params.TxBytes)
+ Endpoint_Write_Byte(SPI_TransferByte(SPI_Multi_Params.TxData[CurrTxPos++]));
+ else
+ Endpoint_Write_Byte(SPI_ReceiveByte());
+
+ /* Check to see if we have filled the endpoint bank and need to send the packet */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ Endpoint_ClearIN();
+ Endpoint_WaitUntilReady();
+ }
+
+ CurrRxPos++;
+ }
+
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+
+ bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
+ Endpoint_ClearIN();
+
+ /* Ensure last packet is a short packet to terminate the transfer */
+ if (IsEndpointFull)
+ {
+ Endpoint_WaitUntilReady();
+ Endpoint_ClearIN();
+ Endpoint_WaitUntilReady();
+ }
+}
+
+/** Blocking delay for a given number of milliseconds.
+ *
+ * \param[in] DelayMS Number of milliseconds to delay for
+ */
+void ISPProtocol_DelayMS(uint8_t DelayMS)
+{
+ while (DelayMS-- && TimeoutMSRemaining)
+ {
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining--;
+
+ _delay_ms(1);
+ }
+}
+
#endif \ No newline at end of file
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
index a9114e1e8..c983f49c6 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
@@ -1,79 +1,79 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 ISPProtocol.c.
- */
-
-#ifndef _ISP_PROTOCOL_
-#define _ISP_PROTOCOL_
-
- /* Includes: */
- #include <avr/io.h>
- #include <util/delay.h>
-
- #include <LUFA/Drivers/USB/USB.h>
-
- #include "../V2Protocol.h"
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /* Macros: */
- /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */
- #define READ_WRITE_HIGH_BYTE_MASK (1 << 3)
-
- #define PROG_MODE_PAGED_WRITES_MASK (1 << 0)
- #define PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1)
- #define PROG_MODE_WORD_VALUE_MASK (1 << 2)
- #define PROG_MODE_WORD_READYBUSY_MASK (1 << 3)
- #define PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4)
- #define PROG_MODE_PAGED_VALUE_MASK (1 << 5)
- #define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6)
- #define PROG_MODE_COMMIT_PAGE_MASK (1 << 7)
-
- /* Function Prototypes: */
- void ISPProtocol_EnterISPMode(void);
- void ISPProtocol_LeaveISPMode(void);
- void ISPProtocol_ProgramMemory(const uint8_t V2Command);
- void ISPProtocol_ReadMemory(const uint8_t V2Command);
- void ISPProtocol_ChipErase(void);
- void ISPProtocol_ReadFuseLockSigOSCCAL(const uint8_t V2Command);
- void ISPProtocol_WriteFuseLock(const uint8_t V2Command);
- void ISPProtocol_SPIMulti(void);
- void ISPProtocol_DelayMS(uint8_t DelayMS);
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 ISPProtocol.c.
+ */
+
+#ifndef _ISP_PROTOCOL_
+#define _ISP_PROTOCOL_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <util/delay.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+
+ #include "../V2Protocol.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /* Macros: */
+ /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */
+ #define READ_WRITE_HIGH_BYTE_MASK (1 << 3)
+
+ #define PROG_MODE_PAGED_WRITES_MASK (1 << 0)
+ #define PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1)
+ #define PROG_MODE_WORD_VALUE_MASK (1 << 2)
+ #define PROG_MODE_WORD_READYBUSY_MASK (1 << 3)
+ #define PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4)
+ #define PROG_MODE_PAGED_VALUE_MASK (1 << 5)
+ #define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6)
+ #define PROG_MODE_COMMIT_PAGE_MASK (1 << 7)
+
+ /* Function Prototypes: */
+ void ISPProtocol_EnterISPMode(void);
+ void ISPProtocol_LeaveISPMode(void);
+ void ISPProtocol_ProgramMemory(const uint8_t V2Command);
+ void ISPProtocol_ReadMemory(const uint8_t V2Command);
+ void ISPProtocol_ChipErase(void);
+ void ISPProtocol_ReadFuseLockSigOSCCAL(const uint8_t V2Command);
+ void ISPProtocol_WriteFuseLock(const uint8_t V2Command);
+ void ISPProtocol_SPIMulti(void);
+ void ISPProtocol_DelayMS(uint8_t DelayMS);
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
index 1c5376579..d7c6882cd 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
@@ -1,187 +1,187 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Target-related functions for the ISP Protocol decoder.
- */
-
-#include "ISPTarget.h"
-
-#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)
-
-/** Converts the given AVR Studio SCK duration parameter (set by a SET PARAM command from the host) to the nearest
- * possible SPI clock prescaler mask for passing to the SPI_Init() routine.
- *
- * \return Nearest SPI prescaler mask for the given SCK frequency
- */
-uint8_t ISPTarget_GetSPIPrescalerMask(void)
-{
- static const uint8_t SPIMaskFromSCKDuration[] =
- {
- #if (F_CPU == 8000000)
- SPI_SPEED_FCPU_DIV_2, // AVRStudio = 8MHz SPI, Actual = 4MHz SPI
- SPI_SPEED_FCPU_DIV_2, // AVRStudio = 4MHz SPI, Actual = 4MHz SPI
- SPI_SPEED_FCPU_DIV_4, // AVRStudio = 2MHz SPI, Actual = 2MHz SPI
- SPI_SPEED_FCPU_DIV_8, // AVRStudio = 1MHz SPI, Actual = 1MHz SPI
- SPI_SPEED_FCPU_DIV_16, // AVRStudio = 500KHz SPI, Actual = 500KHz SPI
- SPI_SPEED_FCPU_DIV_32, // AVRStudio = 250KHz SPI, Actual = 250KHz SPI
- SPI_SPEED_FCPU_DIV_64, // AVRStudio = 125KHz SPI, Actual = 125KHz SPI
- #elif (F_CPU == 16000000)
- SPI_SPEED_FCPU_DIV_2, // AVRStudio = 8MHz SPI, Actual = 8MHz SPI
- SPI_SPEED_FCPU_DIV_4, // AVRStudio = 4MHz SPI, Actual = 4MHz SPI
- SPI_SPEED_FCPU_DIV_8, // AVRStudio = 2MHz SPI, Actual = 2MHz SPI
- SPI_SPEED_FCPU_DIV_16, // AVRStudio = 1MHz SPI, Actual = 1MHz SPI
- SPI_SPEED_FCPU_DIV_32, // AVRStudio = 500KHz SPI, Actual = 500KHz SPI
- SPI_SPEED_FCPU_DIV_64, // AVRStudio = 250KHz SPI, Actual = 250KHz SPI
- SPI_SPEED_FCPU_DIV_128 // AVRStudio = 125KHz SPI, Actual = 125KHz SPI
- #else
- #error No SPI prescaler masks for chosen F_CPU speed.
- #endif
- };
-
- uint8_t SCKDuration = V2Params_GetParameterValue(PARAM_SCK_DURATION);
-
- if (SCKDuration >= sizeof(SPIMaskFromSCKDuration))
- SCKDuration = (sizeof(SPIMaskFromSCKDuration) - 1);
-
- return SPIMaskFromSCKDuration[SCKDuration];
-}
-
-/** Asserts or deasserts the target's reset line, using the correct polarity as set by the host using a SET PARAM command.
- * When not asserted, the line is tristated so as not to interfere with normal device operation.
- *
- * \param[in] ResetTarget Boolean true when the target should be held in reset, false otherwise
- */
-void ISPTarget_ChangeTargetResetLine(const bool ResetTarget)
-{
- if (ResetTarget)
- {
- AUX_LINE_DDR |= AUX_LINE_MASK;
-
- if (!(V2Params_GetParameterValue(PARAM_RESET_POLARITY)))
- AUX_LINE_PORT |= AUX_LINE_MASK;
- }
- else
- {
- AUX_LINE_DDR &= ~AUX_LINE_MASK;
- AUX_LINE_PORT &= ~AUX_LINE_MASK;
- }
-}
-
-/** Waits until the last issued target memory programming command has completed, via the check mode given and using
- * the given parameters.
- *
- * \param[in] ProgrammingMode Programming mode used and completion check to use, a mask of PROG_MODE_* constants
- * \param[in] PollAddress Memory address to poll for completion if polling check mode used
- * \param[in] PollValue Poll value to check against if polling check mode used
- * \param[in] DelayMS Milliseconds to delay before returning if delay check mode used
- * \param[in] ReadMemCommand Device low-level READ MEMORY command to send if value check mode used
- *
- * \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT or
- * \ref STATUS_CMD_TOUT otherwise
- */
-uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint16_t PollAddress, const uint8_t PollValue,
- const uint8_t DelayMS, const uint8_t ReadMemCommand)
-{
- uint8_t ProgrammingStatus = STATUS_CMD_OK;
-
- /* Determine method of Programming Complete check */
- switch (ProgrammingMode & ~(PROG_MODE_PAGED_WRITES_MASK | PROG_MODE_COMMIT_PAGE_MASK))
- {
- case PROG_MODE_WORD_TIMEDELAY_MASK:
- case PROG_MODE_PAGED_TIMEDELAY_MASK:
- ISPProtocol_DelayMS(DelayMS);
- break;
- case PROG_MODE_WORD_VALUE_MASK:
- case PROG_MODE_PAGED_VALUE_MASK:
- do
- {
- SPI_SendByte(ReadMemCommand);
- SPI_SendByte(PollAddress >> 8);
- SPI_SendByte(PollAddress & 0xFF);
- }
- while ((SPI_TransferByte(0x00) == PollValue) && TimeoutMSRemaining);
-
- if (!(TimeoutMSRemaining))
- ProgrammingStatus = STATUS_CMD_TOUT;
-
- break;
- case PROG_MODE_WORD_READYBUSY_MASK:
- case PROG_MODE_PAGED_READYBUSY_MASK:
- ProgrammingStatus = ISPTarget_WaitWhileTargetBusy();
- break;
- }
-
- if (ProgrammingStatus == STATUS_CMD_OK)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-
- return ProgrammingStatus;
-}
-
-/** Waits until the target has completed the last operation, by continuously polling the device's
- * BUSY flag until it is cleared, or until the command timeout period has expired.
- *
- * \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT otherwise
- */
-uint8_t ISPTarget_WaitWhileTargetBusy(void)
-{
- do
- {
- SPI_SendByte(0xF0);
- SPI_SendByte(0x00);
- SPI_SendByte(0x00);
- }
- while ((SPI_ReceiveByte() & 0x01) && TimeoutMSRemaining);
-
- if (TimeoutMSRemaining)
- {
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- return STATUS_CMD_OK;
- }
- else
- {
- return STATUS_RDY_BSY_TOUT;
- }
-}
-
-/** Sends a low-level LOAD EXTENDED ADDRESS command to the target, for addressing of memory beyond the
- * 64KB boundary. This sends the command with the correct address as indicated by the current address
- * pointer variable set by the host when a SET ADDRESS command is issued.
- */
-void ISPTarget_LoadExtendedAddress(void)
-{
- SPI_SendByte(LOAD_EXTENDED_ADDRESS_CMD);
- SPI_SendByte(0x00);
- SPI_SendByte((CurrentAddress & 0x00FF0000) >> 16);
- SPI_SendByte(0x00);
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Target-related functions for the ISP Protocol decoder.
+ */
+
+#include "ISPTarget.h"
+
+#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)
+
+/** Converts the given AVR Studio SCK duration parameter (set by a SET PARAM command from the host) to the nearest
+ * possible SPI clock prescaler mask for passing to the SPI_Init() routine.
+ *
+ * \return Nearest SPI prescaler mask for the given SCK frequency
+ */
+uint8_t ISPTarget_GetSPIPrescalerMask(void)
+{
+ static const uint8_t SPIMaskFromSCKDuration[] =
+ {
+ #if (F_CPU == 8000000)
+ SPI_SPEED_FCPU_DIV_2, // AVRStudio = 8MHz SPI, Actual = 4MHz SPI
+ SPI_SPEED_FCPU_DIV_2, // AVRStudio = 4MHz SPI, Actual = 4MHz SPI
+ SPI_SPEED_FCPU_DIV_4, // AVRStudio = 2MHz SPI, Actual = 2MHz SPI
+ SPI_SPEED_FCPU_DIV_8, // AVRStudio = 1MHz SPI, Actual = 1MHz SPI
+ SPI_SPEED_FCPU_DIV_16, // AVRStudio = 500KHz SPI, Actual = 500KHz SPI
+ SPI_SPEED_FCPU_DIV_32, // AVRStudio = 250KHz SPI, Actual = 250KHz SPI
+ SPI_SPEED_FCPU_DIV_64, // AVRStudio = 125KHz SPI, Actual = 125KHz SPI
+ #elif (F_CPU == 16000000)
+ SPI_SPEED_FCPU_DIV_2, // AVRStudio = 8MHz SPI, Actual = 8MHz SPI
+ SPI_SPEED_FCPU_DIV_4, // AVRStudio = 4MHz SPI, Actual = 4MHz SPI
+ SPI_SPEED_FCPU_DIV_8, // AVRStudio = 2MHz SPI, Actual = 2MHz SPI
+ SPI_SPEED_FCPU_DIV_16, // AVRStudio = 1MHz SPI, Actual = 1MHz SPI
+ SPI_SPEED_FCPU_DIV_32, // AVRStudio = 500KHz SPI, Actual = 500KHz SPI
+ SPI_SPEED_FCPU_DIV_64, // AVRStudio = 250KHz SPI, Actual = 250KHz SPI
+ SPI_SPEED_FCPU_DIV_128 // AVRStudio = 125KHz SPI, Actual = 125KHz SPI
+ #else
+ #error No SPI prescaler masks for chosen F_CPU speed.
+ #endif
+ };
+
+ uint8_t SCKDuration = V2Params_GetParameterValue(PARAM_SCK_DURATION);
+
+ if (SCKDuration >= sizeof(SPIMaskFromSCKDuration))
+ SCKDuration = (sizeof(SPIMaskFromSCKDuration) - 1);
+
+ return SPIMaskFromSCKDuration[SCKDuration];
+}
+
+/** Asserts or deasserts the target's reset line, using the correct polarity as set by the host using a SET PARAM command.
+ * When not asserted, the line is tristated so as not to interfere with normal device operation.
+ *
+ * \param[in] ResetTarget Boolean true when the target should be held in reset, false otherwise
+ */
+void ISPTarget_ChangeTargetResetLine(const bool ResetTarget)
+{
+ if (ResetTarget)
+ {
+ AUX_LINE_DDR |= AUX_LINE_MASK;
+
+ if (!(V2Params_GetParameterValue(PARAM_RESET_POLARITY)))
+ AUX_LINE_PORT |= AUX_LINE_MASK;
+ }
+ else
+ {
+ AUX_LINE_DDR &= ~AUX_LINE_MASK;
+ AUX_LINE_PORT &= ~AUX_LINE_MASK;
+ }
+}
+
+/** Waits until the last issued target memory programming command has completed, via the check mode given and using
+ * the given parameters.
+ *
+ * \param[in] ProgrammingMode Programming mode used and completion check to use, a mask of PROG_MODE_* constants
+ * \param[in] PollAddress Memory address to poll for completion if polling check mode used
+ * \param[in] PollValue Poll value to check against if polling check mode used
+ * \param[in] DelayMS Milliseconds to delay before returning if delay check mode used
+ * \param[in] ReadMemCommand Device low-level READ MEMORY command to send if value check mode used
+ *
+ * \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT or
+ * \ref STATUS_CMD_TOUT otherwise
+ */
+uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint16_t PollAddress, const uint8_t PollValue,
+ const uint8_t DelayMS, const uint8_t ReadMemCommand)
+{
+ uint8_t ProgrammingStatus = STATUS_CMD_OK;
+
+ /* Determine method of Programming Complete check */
+ switch (ProgrammingMode & ~(PROG_MODE_PAGED_WRITES_MASK | PROG_MODE_COMMIT_PAGE_MASK))
+ {
+ case PROG_MODE_WORD_TIMEDELAY_MASK:
+ case PROG_MODE_PAGED_TIMEDELAY_MASK:
+ ISPProtocol_DelayMS(DelayMS);
+ break;
+ case PROG_MODE_WORD_VALUE_MASK:
+ case PROG_MODE_PAGED_VALUE_MASK:
+ do
+ {
+ SPI_SendByte(ReadMemCommand);
+ SPI_SendByte(PollAddress >> 8);
+ SPI_SendByte(PollAddress & 0xFF);
+ }
+ while ((SPI_TransferByte(0x00) == PollValue) && TimeoutMSRemaining);
+
+ if (!(TimeoutMSRemaining))
+ ProgrammingStatus = STATUS_CMD_TOUT;
+
+ break;
+ case PROG_MODE_WORD_READYBUSY_MASK:
+ case PROG_MODE_PAGED_READYBUSY_MASK:
+ ProgrammingStatus = ISPTarget_WaitWhileTargetBusy();
+ break;
+ }
+
+ if (ProgrammingStatus == STATUS_CMD_OK)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+
+ return ProgrammingStatus;
+}
+
+/** Waits until the target has completed the last operation, by continuously polling the device's
+ * BUSY flag until it is cleared, or until the command timeout period has expired.
+ *
+ * \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT otherwise
+ */
+uint8_t ISPTarget_WaitWhileTargetBusy(void)
+{
+ do
+ {
+ SPI_SendByte(0xF0);
+ SPI_SendByte(0x00);
+ SPI_SendByte(0x00);
+ }
+ while ((SPI_ReceiveByte() & 0x01) && TimeoutMSRemaining);
+
+ if (TimeoutMSRemaining)
+ {
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ return STATUS_CMD_OK;
+ }
+ else
+ {
+ return STATUS_RDY_BSY_TOUT;
+ }
+}
+
+/** Sends a low-level LOAD EXTENDED ADDRESS command to the target, for addressing of memory beyond the
+ * 64KB boundary. This sends the command with the correct address as indicated by the current address
+ * pointer variable set by the host when a SET ADDRESS command is issued.
+ */
+void ISPTarget_LoadExtendedAddress(void)
+{
+ SPI_SendByte(LOAD_EXTENDED_ADDRESS_CMD);
+ SPI_SendByte(0x00);
+ SPI_SendByte((CurrentAddress & 0x00FF0000) >> 16);
+ SPI_SendByte(0x00);
+}
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
index 995461099..d6e943582 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
@@ -1,72 +1,72 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 ISPTarget.c.
- */
-
-#ifndef _ISP_TARGET_
-#define _ISP_TARGET_
-
- /* Includes: */
- #include <avr/io.h>
- #include <util/delay.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/Peripheral/SPI.h>
-
- #include "../V2ProtocolParams.h"
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /* Macros: */
- /** Total number of allowable ISP programming speeds supported by the device */
- #define TOTAL_ISP_PROGRAMMING_SPEEDS 7
-
- #define LOAD_EXTENDED_ADDRESS_CMD 0x4D
-
- /* Function Prototypes: */
- uint8_t ISPTarget_GetSPIPrescalerMask(void);
- void ISPTarget_ChangeTargetResetLine(const bool ResetTarget);
- uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint16_t PollAddress,
- const uint8_t PollValue, const uint8_t DelayMS,
- const uint8_t ReadMemCommand);
- uint8_t ISPTarget_WaitWhileTargetBusy(void);
- void ISPTarget_LoadExtendedAddress(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 ISPTarget.c.
+ */
+
+#ifndef _ISP_TARGET_
+#define _ISP_TARGET_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <util/delay.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Peripheral/SPI.h>
+
+ #include "../V2ProtocolParams.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /* Macros: */
+ /** Total number of allowable ISP programming speeds supported by the device */
+ #define TOTAL_ISP_PROGRAMMING_SPEEDS 7
+
+ #define LOAD_EXTENDED_ADDRESS_CMD 0x4D
+
+ /* Function Prototypes: */
+ uint8_t ISPTarget_GetSPIPrescalerMask(void);
+ void ISPTarget_ChangeTargetResetLine(const bool ResetTarget);
+ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint16_t PollAddress,
+ const uint8_t PollValue, const uint8_t DelayMS,
+ const uint8_t ReadMemCommand);
+ uint8_t ISPTarget_WaitWhileTargetBusy(void);
+ void ISPTarget_LoadExtendedAddress(void);
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.c b/Projects/AVRISP-MKII/Lib/V2Protocol.c
index 096551d81..3e12bdc11 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.c
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.c
@@ -1,259 +1,259 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * V2Protocol handler, to process V2 Protocol commands used in Atmel programmer devices.
- */
-
-#define INCLUDE_FROM_V2PROTOCOL_C
-#include "V2Protocol.h"
-
-/** Current memory address for FLASH/EEPROM memory read/write commands */
-uint32_t CurrentAddress;
-
-/** Flag to indicate that the next read/write operation must update the device's current address */
-bool MustSetAddress;
-
-
-/** ISR to manage timeouts whilst processing a V2Protocol command */
-ISR(TIMER0_COMPA_vect, ISR_NOBLOCK)
-{
- if (TimeoutMSRemaining)
- TimeoutMSRemaining--;
-}
-
-/** Initializes the hardware and software associated with the V2 protocol command handling. */
-void V2Protocol_Init(void)
-{
- #if defined(ADC)
- /* Initialize the ADC converter for VTARGET level detection on supported AVR models */
- ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
- ADC_SetupChannel(VTARGET_ADC_CHANNEL);
- ADC_StartReading(VTARGET_ADC_CHANNEL_MASK | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);
- #endif
-
- /* Millisecond timer initialization for managing the command timeout counter */
- OCR0A = ((F_CPU / 64) / 1000);
- TCCR0A = (1 << WGM01);
- TIMSK0 = (1 << OCIE0A);
-
- V2Params_LoadNonVolatileParamValues();
-}
-
-/** Master V2 Protocol packet handler, for received V2 Protocol packets from a connected host.
- * This routine decodes the issued command and passes off the handling of the command to the
- * appropriate function.
- */
-void V2Protocol_ProcessCommand(void)
-{
- uint8_t V2Command = Endpoint_Read_Byte();
-
- /* Start the timeout management timer */
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- TCCR0B = ((1 << CS01) | (1 << CS00));
-
- switch (V2Command)
- {
- case CMD_SIGN_ON:
- V2Protocol_SignOn();
- break;
- case CMD_SET_PARAMETER:
- case CMD_GET_PARAMETER:
- V2Protocol_GetSetParam(V2Command);
- break;
- case CMD_LOAD_ADDRESS:
- V2Protocol_LoadAddress();
- break;
- case CMD_RESET_PROTECTION:
- V2Protocol_ResetProtection();
- break;
-#if defined(ENABLE_ISP_PROTOCOL)
- case CMD_ENTER_PROGMODE_ISP:
- ISPProtocol_EnterISPMode();
- break;
- case CMD_LEAVE_PROGMODE_ISP:
- ISPProtocol_LeaveISPMode();
- break;
- case CMD_PROGRAM_FLASH_ISP:
- case CMD_PROGRAM_EEPROM_ISP:
- ISPProtocol_ProgramMemory(V2Command);
- break;
- case CMD_READ_FLASH_ISP:
- case CMD_READ_EEPROM_ISP:
- ISPProtocol_ReadMemory(V2Command);
- break;
- case CMD_CHIP_ERASE_ISP:
- ISPProtocol_ChipErase();
- break;
- case CMD_READ_FUSE_ISP:
- case CMD_READ_LOCK_ISP:
- case CMD_READ_SIGNATURE_ISP:
- case CMD_READ_OSCCAL_ISP:
- ISPProtocol_ReadFuseLockSigOSCCAL(V2Command);
- break;
- case CMD_PROGRAM_FUSE_ISP:
- case CMD_PROGRAM_LOCK_ISP:
- ISPProtocol_WriteFuseLock(V2Command);
- break;
- case CMD_SPI_MULTI:
- ISPProtocol_SPIMulti();
- break;
-#endif
-#if defined(ENABLE_XPROG_PROTOCOL)
- case CMD_XPROG_SETMODE:
- XPROGProtocol_SetMode();
- break;
- case CMD_XPROG:
- XPROGProtocol_Command();
- break;
-#endif
- default:
- V2Protocol_UnknownCommand(V2Command);
- break;
- }
-
- /* Disable the timeout management timer */
- TCCR0B = 0;
-
- Endpoint_WaitUntilReady();
- Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
-}
-
-/** Handler for unknown V2 protocol commands. This discards all sent data and returns a
- * STATUS_CMD_UNKNOWN status back to the host.
- *
- * \param[in] V2Command Issued V2 Protocol command byte from the host
- */
-static void V2Protocol_UnknownCommand(const uint8_t V2Command)
-{
- /* Discard all incoming data */
- while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
- {
- Endpoint_ClearOUT();
- Endpoint_WaitUntilReady();
- }
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(V2Command);
- Endpoint_Write_Byte(STATUS_CMD_UNKNOWN);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
-static void V2Protocol_SignOn(void)
-{
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(CMD_SIGN_ON);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_Write_Byte(sizeof(PROGRAMMER_ID) - 1);
- Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_RESET_PROTECTION command, implemented as a dummy ACK function as
- * no target short-circuit protection is currently implemented.
- */
-static void V2Protocol_ResetProtection(void)
-{
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(CMD_RESET_PROTECTION);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_ClearIN();
-}
-
-
-/** Handler for the CMD_SET_PARAMETER and CMD_GET_PARAMETER commands from the host, setting or
- * getting a device parameter's value from the parameter table.
- *
- * \param[in] V2Command Issued V2 Protocol command byte from the host
- */
-static void V2Protocol_GetSetParam(const uint8_t V2Command)
-{
- uint8_t ParamID = Endpoint_Read_Byte();
- uint8_t ParamValue;
-
- if (V2Command == CMD_SET_PARAMETER)
- ParamValue = Endpoint_Read_Byte();
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(V2Command);
-
- uint8_t ParamPrivs = V2Params_GetParameterPrivileges(ParamID);
-
- if ((V2Command == CMD_SET_PARAMETER) && (ParamPrivs & PARAM_PRIV_WRITE))
- {
- Endpoint_Write_Byte(STATUS_CMD_OK);
- V2Params_SetParameterValue(ParamID, ParamValue);
- }
- else if ((V2Command == CMD_GET_PARAMETER) && (ParamPrivs & PARAM_PRIV_READ))
- {
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_Write_Byte(V2Params_GetParameterValue(ParamID));
- }
- else
- {
- Endpoint_Write_Byte(STATUS_CMD_FAILED);
- }
-
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_LOAD_ADDRESS command, loading the given device address into a
- * global storage variable for later use, and issuing LOAD EXTENDED ADDRESS commands
- * to the attached device as required.
- */
-static void V2Protocol_LoadAddress(void)
-{
- Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- MustSetAddress = true;
-
- Endpoint_Write_Byte(CMD_LOAD_ADDRESS);
- Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_ClearIN();
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * V2Protocol handler, to process V2 Protocol commands used in Atmel programmer devices.
+ */
+
+#define INCLUDE_FROM_V2PROTOCOL_C
+#include "V2Protocol.h"
+
+/** Current memory address for FLASH/EEPROM memory read/write commands */
+uint32_t CurrentAddress;
+
+/** Flag to indicate that the next read/write operation must update the device's current address */
+bool MustSetAddress;
+
+
+/** ISR to manage timeouts whilst processing a V2Protocol command */
+ISR(TIMER0_COMPA_vect, ISR_NOBLOCK)
+{
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining--;
+}
+
+/** Initializes the hardware and software associated with the V2 protocol command handling. */
+void V2Protocol_Init(void)
+{
+ #if defined(ADC)
+ /* Initialize the ADC converter for VTARGET level detection on supported AVR models */
+ ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
+ ADC_SetupChannel(VTARGET_ADC_CHANNEL);
+ ADC_StartReading(VTARGET_ADC_CHANNEL_MASK | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);
+ #endif
+
+ /* Millisecond timer initialization for managing the command timeout counter */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TIMSK0 = (1 << OCIE0A);
+
+ V2Params_LoadNonVolatileParamValues();
+}
+
+/** Master V2 Protocol packet handler, for received V2 Protocol packets from a connected host.
+ * This routine decodes the issued command and passes off the handling of the command to the
+ * appropriate function.
+ */
+void V2Protocol_ProcessCommand(void)
+{
+ uint8_t V2Command = Endpoint_Read_Byte();
+
+ /* Start the timeout management timer */
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+
+ switch (V2Command)
+ {
+ case CMD_SIGN_ON:
+ V2Protocol_SignOn();
+ break;
+ case CMD_SET_PARAMETER:
+ case CMD_GET_PARAMETER:
+ V2Protocol_GetSetParam(V2Command);
+ break;
+ case CMD_LOAD_ADDRESS:
+ V2Protocol_LoadAddress();
+ break;
+ case CMD_RESET_PROTECTION:
+ V2Protocol_ResetProtection();
+ break;
+#if defined(ENABLE_ISP_PROTOCOL)
+ case CMD_ENTER_PROGMODE_ISP:
+ ISPProtocol_EnterISPMode();
+ break;
+ case CMD_LEAVE_PROGMODE_ISP:
+ ISPProtocol_LeaveISPMode();
+ break;
+ case CMD_PROGRAM_FLASH_ISP:
+ case CMD_PROGRAM_EEPROM_ISP:
+ ISPProtocol_ProgramMemory(V2Command);
+ break;
+ case CMD_READ_FLASH_ISP:
+ case CMD_READ_EEPROM_ISP:
+ ISPProtocol_ReadMemory(V2Command);
+ break;
+ case CMD_CHIP_ERASE_ISP:
+ ISPProtocol_ChipErase();
+ break;
+ case CMD_READ_FUSE_ISP:
+ case CMD_READ_LOCK_ISP:
+ case CMD_READ_SIGNATURE_ISP:
+ case CMD_READ_OSCCAL_ISP:
+ ISPProtocol_ReadFuseLockSigOSCCAL(V2Command);
+ break;
+ case CMD_PROGRAM_FUSE_ISP:
+ case CMD_PROGRAM_LOCK_ISP:
+ ISPProtocol_WriteFuseLock(V2Command);
+ break;
+ case CMD_SPI_MULTI:
+ ISPProtocol_SPIMulti();
+ break;
+#endif
+#if defined(ENABLE_XPROG_PROTOCOL)
+ case CMD_XPROG_SETMODE:
+ XPROGProtocol_SetMode();
+ break;
+ case CMD_XPROG:
+ XPROGProtocol_Command();
+ break;
+#endif
+ default:
+ V2Protocol_UnknownCommand(V2Command);
+ break;
+ }
+
+ /* Disable the timeout management timer */
+ TCCR0B = 0;
+
+ Endpoint_WaitUntilReady();
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
+}
+
+/** Handler for unknown V2 protocol commands. This discards all sent data and returns a
+ * STATUS_CMD_UNKNOWN status back to the host.
+ *
+ * \param[in] V2Command Issued V2 Protocol command byte from the host
+ */
+static void V2Protocol_UnknownCommand(const uint8_t V2Command)
+{
+ /* Discard all incoming data */
+ while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
+ {
+ Endpoint_ClearOUT();
+ Endpoint_WaitUntilReady();
+ }
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(STATUS_CMD_UNKNOWN);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
+static void V2Protocol_SignOn(void)
+{
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(CMD_SIGN_ON);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_Write_Byte(sizeof(PROGRAMMER_ID) - 1);
+ Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_RESET_PROTECTION command, implemented as a dummy ACK function as
+ * no target short-circuit protection is currently implemented.
+ */
+static void V2Protocol_ResetProtection(void)
+{
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(CMD_RESET_PROTECTION);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_ClearIN();
+}
+
+
+/** Handler for the CMD_SET_PARAMETER and CMD_GET_PARAMETER commands from the host, setting or
+ * getting a device parameter's value from the parameter table.
+ *
+ * \param[in] V2Command Issued V2 Protocol command byte from the host
+ */
+static void V2Protocol_GetSetParam(const uint8_t V2Command)
+{
+ uint8_t ParamID = Endpoint_Read_Byte();
+ uint8_t ParamValue;
+
+ if (V2Command == CMD_SET_PARAMETER)
+ ParamValue = Endpoint_Read_Byte();
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(V2Command);
+
+ uint8_t ParamPrivs = V2Params_GetParameterPrivileges(ParamID);
+
+ if ((V2Command == CMD_SET_PARAMETER) && (ParamPrivs & PARAM_PRIV_WRITE))
+ {
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ V2Params_SetParameterValue(ParamID, ParamValue);
+ }
+ else if ((V2Command == CMD_GET_PARAMETER) && (ParamPrivs & PARAM_PRIV_READ))
+ {
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_Write_Byte(V2Params_GetParameterValue(ParamID));
+ }
+ else
+ {
+ Endpoint_Write_Byte(STATUS_CMD_FAILED);
+ }
+
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_LOAD_ADDRESS command, loading the given device address into a
+ * global storage variable for later use, and issuing LOAD EXTENDED ADDRESS commands
+ * to the attached device as required.
+ */
+static void V2Protocol_LoadAddress(void)
+{
+ Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ MustSetAddress = true;
+
+ Endpoint_Write_Byte(CMD_LOAD_ADDRESS);
+ Endpoint_Write_Byte(STATUS_CMD_OK);
+ Endpoint_ClearIN();
+}
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.h b/Projects/AVRISP-MKII/Lib/V2Protocol.h
index 7ad896da8..0f0794b5c 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.h
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.h
@@ -1,105 +1,105 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 V2Protocol.c.
- */
-
-#ifndef _V2_PROTOCOL_
-#define _V2_PROTOCOL_
-
- /* Includes: */
- #if !defined(__ASSEMBLER__)
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/Peripheral/SPI.h>
-
- #include "../Descriptors.h"
- #include "V2ProtocolConstants.h"
- #include "V2ProtocolParams.h"
- #include "ISP/ISPProtocol.h"
- #include "XPROG/XPROGProtocol.h"
- #endif
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /* Macros: */
- #if !defined(__DOXYGEN__)
- #define _GETADCMUXMASK2(x, y) x ## y
- #define _GETADCMUXMASK(x, y) _GETADCMUXMASK2(x, y)
- #endif
-
- /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
- #define PROGRAMMER_ID "AVRISP_MK2"
-
- /** Timeout period for each issued command from the host before it is aborted */
- #define COMMAND_TIMEOUT_MS 200
-
- /** Command timeout counter register, GPIOR for speed */
- #define TimeoutMSRemaining GPIOR0
-
- /** MUX mask for the VTARGET ADC channel number */
- #define VTARGET_ADC_CHANNEL_MASK _GETADCMUXMASK(ADC_CHANNEL, VTARGET_ADC_CHANNEL)
-
- #if !defined(WIN_AVRDUDE_COMPAT)
- #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
- #else
- #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SelectEndpoint();
- #endif
-
- /* External Variables: */
- #if !defined(__ASSEMBLER__)
- extern uint32_t CurrentAddress;
- extern bool MustSetAddress;
- #endif
-
- /* Function Prototypes: */
- #if !defined(__ASSEMBLER__)
- void V2Protocol_Init(void);
- void V2Protocol_ProcessCommand(void);
-
- #if defined(INCLUDE_FROM_V2PROTOCOL_C)
- static void V2Protocol_UnknownCommand(const uint8_t V2Command);
- static void V2Protocol_SignOn(void);
- static void V2Protocol_GetSetParam(const uint8_t V2Command);
- static void V2Protocol_ResetProtection(void);
- static void V2Protocol_LoadAddress(void);
- #endif
- #endif
-
-#endif
-
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 V2Protocol.c.
+ */
+
+#ifndef _V2_PROTOCOL_
+#define _V2_PROTOCOL_
+
+ /* Includes: */
+ #if !defined(__ASSEMBLER__)
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Peripheral/SPI.h>
+
+ #include "../Descriptors.h"
+ #include "V2ProtocolConstants.h"
+ #include "V2ProtocolParams.h"
+ #include "ISP/ISPProtocol.h"
+ #include "XPROG/XPROGProtocol.h"
+ #endif
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /* Macros: */
+ #if !defined(__DOXYGEN__)
+ #define _GETADCMUXMASK2(x, y) x ## y
+ #define _GETADCMUXMASK(x, y) _GETADCMUXMASK2(x, y)
+ #endif
+
+ /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
+ #define PROGRAMMER_ID "AVRISP_MK2"
+
+ /** Timeout period for each issued command from the host before it is aborted */
+ #define COMMAND_TIMEOUT_MS 200
+
+ /** Command timeout counter register, GPIOR for speed */
+ #define TimeoutMSRemaining GPIOR0
+
+ /** MUX mask for the VTARGET ADC channel number */
+ #define VTARGET_ADC_CHANNEL_MASK _GETADCMUXMASK(ADC_CHANNEL, VTARGET_ADC_CHANNEL)
+
+ #if !defined(WIN_AVRDUDE_COMPAT)
+ #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
+ #else
+ #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SelectEndpoint();
+ #endif
+
+ /* External Variables: */
+ #if !defined(__ASSEMBLER__)
+ extern uint32_t CurrentAddress;
+ extern bool MustSetAddress;
+ #endif
+
+ /* Function Prototypes: */
+ #if !defined(__ASSEMBLER__)
+ void V2Protocol_Init(void);
+ void V2Protocol_ProcessCommand(void);
+
+ #if defined(INCLUDE_FROM_V2PROTOCOL_C)
+ static void V2Protocol_UnknownCommand(const uint8_t V2Command);
+ static void V2Protocol_SignOn(void);
+ static void V2Protocol_GetSetParam(const uint8_t V2Command);
+ static void V2Protocol_ResetProtection(void);
+ static void V2Protocol_LoadAddress(void);
+ #endif
+ #endif
+
+#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h b/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
index 45397403b..94c60766b 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
@@ -1,88 +1,88 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Macros for the V2 Protocol Packet Commands and Responses.
- */
-
-#ifndef _V2_PROTOCOL_CONSTANTS_
-#define _V2_PROTOCOL_CONSTANTS_
-
- /* Macros: */
- #define CMD_SIGN_ON 0x01
- #define CMD_SET_PARAMETER 0x02
- #define CMD_GET_PARAMETER 0x03
- #define CMD_OSCCAL 0x05
- #define CMD_LOAD_ADDRESS 0x06
- #define CMD_FIRMWARE_UPGRADE 0x07
- #define CMD_RESET_PROTECTION 0x0A
- #define CMD_ENTER_PROGMODE_ISP 0x10
- #define CMD_LEAVE_PROGMODE_ISP 0x11
- #define CMD_CHIP_ERASE_ISP 0x12
- #define CMD_PROGRAM_FLASH_ISP 0x13
- #define CMD_READ_FLASH_ISP 0x14
- #define CMD_PROGRAM_EEPROM_ISP 0x15
- #define CMD_READ_EEPROM_ISP 0x16
- #define CMD_PROGRAM_FUSE_ISP 0x17
- #define CMD_READ_FUSE_ISP 0x18
- #define CMD_PROGRAM_LOCK_ISP 0x19
- #define CMD_READ_LOCK_ISP 0x1A
- #define CMD_READ_SIGNATURE_ISP 0x1B
- #define CMD_READ_OSCCAL_ISP 0x1C
- #define CMD_SPI_MULTI 0x1D
- #define CMD_XPROG 0x50
- #define CMD_XPROG_SETMODE 0x51
-
- #define STATUS_CMD_OK 0x00
- #define STATUS_CMD_TOUT 0x80
- #define STATUS_RDY_BSY_TOUT 0x81
- #define STATUS_SET_PARAM_MISSING 0x82
- #define STATUS_CMD_FAILED 0xC0
- #define STATUS_CMD_UNKNOWN 0xC9
- #define STATUS_ISP_READY 0x00
- #define STATUS_CONN_FAIL_MOSI 0x01
- #define STATUS_CONN_FAIL_RST 0x02
- #define STATUS_CONN_FAIL_SCK 0x04
- #define STATUS_TGT_NOT_DETECTED 0x10
- #define STATUS_TGT_REVERSE_INSERTED 0x20
-
- #define PARAM_BUILD_NUMBER_LOW 0x80
- #define PARAM_BUILD_NUMBER_HIGH 0x81
- #define PARAM_HW_VER 0x90
- #define PARAM_SW_MAJOR 0x91
- #define PARAM_SW_MINOR 0x92
- #define PARAM_VTARGET 0x94
- #define PARAM_SCK_DURATION 0x98
- #define PARAM_RESET_POLARITY 0x9E
- #define PARAM_STATUS_TGT_CONN 0xA1
- #define PARAM_DISCHARGEDELAY 0xA4
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Macros for the V2 Protocol Packet Commands and Responses.
+ */
+
+#ifndef _V2_PROTOCOL_CONSTANTS_
+#define _V2_PROTOCOL_CONSTANTS_
+
+ /* Macros: */
+ #define CMD_SIGN_ON 0x01
+ #define CMD_SET_PARAMETER 0x02
+ #define CMD_GET_PARAMETER 0x03
+ #define CMD_OSCCAL 0x05
+ #define CMD_LOAD_ADDRESS 0x06
+ #define CMD_FIRMWARE_UPGRADE 0x07
+ #define CMD_RESET_PROTECTION 0x0A
+ #define CMD_ENTER_PROGMODE_ISP 0x10
+ #define CMD_LEAVE_PROGMODE_ISP 0x11
+ #define CMD_CHIP_ERASE_ISP 0x12
+ #define CMD_PROGRAM_FLASH_ISP 0x13
+ #define CMD_READ_FLASH_ISP 0x14
+ #define CMD_PROGRAM_EEPROM_ISP 0x15
+ #define CMD_READ_EEPROM_ISP 0x16
+ #define CMD_PROGRAM_FUSE_ISP 0x17
+ #define CMD_READ_FUSE_ISP 0x18
+ #define CMD_PROGRAM_LOCK_ISP 0x19
+ #define CMD_READ_LOCK_ISP 0x1A
+ #define CMD_READ_SIGNATURE_ISP 0x1B
+ #define CMD_READ_OSCCAL_ISP 0x1C
+ #define CMD_SPI_MULTI 0x1D
+ #define CMD_XPROG 0x50
+ #define CMD_XPROG_SETMODE 0x51
+
+ #define STATUS_CMD_OK 0x00
+ #define STATUS_CMD_TOUT 0x80
+ #define STATUS_RDY_BSY_TOUT 0x81
+ #define STATUS_SET_PARAM_MISSING 0x82
+ #define STATUS_CMD_FAILED 0xC0
+ #define STATUS_CMD_UNKNOWN 0xC9
+ #define STATUS_ISP_READY 0x00
+ #define STATUS_CONN_FAIL_MOSI 0x01
+ #define STATUS_CONN_FAIL_RST 0x02
+ #define STATUS_CONN_FAIL_SCK 0x04
+ #define STATUS_TGT_NOT_DETECTED 0x10
+ #define STATUS_TGT_REVERSE_INSERTED 0x20
+
+ #define PARAM_BUILD_NUMBER_LOW 0x80
+ #define PARAM_BUILD_NUMBER_HIGH 0x81
+ #define PARAM_HW_VER 0x90
+ #define PARAM_SW_MAJOR 0x91
+ #define PARAM_SW_MINOR 0x92
+ #define PARAM_VTARGET 0x94
+ #define PARAM_SCK_DURATION 0x98
+ #define PARAM_RESET_POLARITY 0x9E
+ #define PARAM_STATUS_TGT_CONN 0xA1
+ #define PARAM_DISCHARGEDELAY 0xA4
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
index 4d508f508..b8c5930a0 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
@@ -1,182 +1,182 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * V2Protocol parameter handler, to process V2 Protocol device parameters.
- */
-
-#define INCLUDE_FROM_V2PROTOCOL_PARAMS_C
-#include "V2ProtocolParams.h"
-
-/* Non-Volatile Parameter Values for EEPROM storage */
-uint8_t EEMEM EEPROM_Rest_Polarity = 0x00;
-
-/* Volatile Parameter Values for RAM storage */
-static ParameterItem_t ParameterTable[] =
- {
- { .ParamID = PARAM_BUILD_NUMBER_LOW,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = (LUFA_VERSION_INTEGER >> 8) },
-
- { .ParamID = PARAM_BUILD_NUMBER_HIGH,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = (LUFA_VERSION_INTEGER & 0xFF), },
-
- { .ParamID = PARAM_HW_VER,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = 0x00 },
-
- { .ParamID = PARAM_SW_MAJOR,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = 0x01 },
-
- { .ParamID = PARAM_SW_MINOR,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = 0x0D },
-
- { .ParamID = PARAM_VTARGET,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = 0x32 },
-
- { .ParamID = PARAM_SCK_DURATION,
- .ParamPrivileges = PARAM_PRIV_READ | PARAM_PRIV_WRITE,
- .ParamValue = (TOTAL_ISP_PROGRAMMING_SPEEDS - 1) },
-
- { .ParamID = PARAM_RESET_POLARITY,
- .ParamPrivileges = PARAM_PRIV_WRITE,
- .ParamValue = 0x00 },
-
- { .ParamID = PARAM_STATUS_TGT_CONN,
- .ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = STATUS_ISP_READY },
-
- { .ParamID = PARAM_DISCHARGEDELAY,
- .ParamPrivileges = PARAM_PRIV_WRITE,
- .ParamValue = 0x00 },
- };
-
-
-/** Loads saved non-volatile parameter values from the EEPROM into the parameter table, as needed. */
-void V2Params_LoadNonVolatileParamValues(void)
-{
- /* Target RESET line polarity is a non-volatile value, retrieve current parameter value from EEPROM -
- * NB: Cannot call V2Protocol_SetParameterValue() here, as that will cause another EEPROM write! */
- V2Params_GetParamFromTable(PARAM_RESET_POLARITY)->ParamValue = eeprom_read_byte(&EEPROM_Rest_Polarity);
-}
-
-/** Updates any parameter values that are sourced from hardware rather than explicitly set by the host, such as
- * VTARGET levels from the ADC on supported AVR models.
- */
-void V2Params_UpdateParamValues(void)
-{
- #if (defined(ADC) && !defined(NO_VTARGET_DETECT))
- /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */
- V2Params_GetParamFromTable(PARAM_VTARGET)->ParamValue = ((5 * 10 * ADC_GetResult()) / 1024);
- #endif
-}
-
-/** Retrieves the host PC read/write privileges for a given parameter in the parameter table. This should
- * be called before calls to \ref V2Params_GetParameterValue() or \ref V2Params_SetParameterValue() when
- * getting or setting parameter values in response to requests from the host.
- *
- * \param[in] ParamID Parameter ID whose privileges are to be retrieved from the table
- *
- * \return Privileges for the requested parameter, as a mask of PARAM_PRIV_* masks
- */
-uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID)
-{
- ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
-
- if (ParamInfo == NULL)
- return 0;
-
- return ParamInfo->ParamPrivileges;
-}
-
-/** Retrieves the current value for a given parameter in the parameter table.
- *
- * \param[in] ParamID Parameter ID whose value is to be retrieved from the table
- *
- * \return Current value of the parameter in the table, or 0 if not found
- */
-uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
-{
- ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
-
- if (ParamInfo == NULL)
- return 0;
-
- return ParamInfo->ParamValue;
-}
-
-/** Sets the value for a given parameter in the parameter table.
- *
- * \param[in] ParamID Parameter ID whose value is to be set in the table
- * \param[in] Value New value to set the parameter to
- *
- * \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
- */
-void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value)
-{
- ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
-
- if (ParamInfo == NULL)
- return;
-
- ParamInfo->ParamValue = Value;
-
- /* The target RESET line polarity is a non-volatile parameter, save to EEPROM when changed */
- if (ParamID == PARAM_RESET_POLARITY)
- eeprom_write_byte(&EEPROM_Rest_Polarity, Value);
-}
-
-/** Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given
- * parameter ID.
- *
- * \param[in] ParamID Parameter ID to find in the table
- *
- * \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
- */
-static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID)
-{
- ParameterItem_t* CurrTableItem = ParameterTable;
-
- /* Find the parameter in the parameter table if present */
- for (uint8_t TableIndex = 0; TableIndex < TABLE_PARAM_COUNT; TableIndex++)
- {
- if (ParamID == CurrTableItem->ParamID)
- return CurrTableItem;
-
- CurrTableItem++;
- }
-
- return NULL;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * V2Protocol parameter handler, to process V2 Protocol device parameters.
+ */
+
+#define INCLUDE_FROM_V2PROTOCOL_PARAMS_C
+#include "V2ProtocolParams.h"
+
+/* Non-Volatile Parameter Values for EEPROM storage */
+uint8_t EEMEM EEPROM_Rest_Polarity = 0x00;
+
+/* Volatile Parameter Values for RAM storage */
+static ParameterItem_t ParameterTable[] =
+ {
+ { .ParamID = PARAM_BUILD_NUMBER_LOW,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = (LUFA_VERSION_INTEGER >> 8) },
+
+ { .ParamID = PARAM_BUILD_NUMBER_HIGH,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = (LUFA_VERSION_INTEGER & 0xFF), },
+
+ { .ParamID = PARAM_HW_VER,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = 0x00 },
+
+ { .ParamID = PARAM_SW_MAJOR,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = 0x01 },
+
+ { .ParamID = PARAM_SW_MINOR,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = 0x0D },
+
+ { .ParamID = PARAM_VTARGET,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = 0x32 },
+
+ { .ParamID = PARAM_SCK_DURATION,
+ .ParamPrivileges = PARAM_PRIV_READ | PARAM_PRIV_WRITE,
+ .ParamValue = (TOTAL_ISP_PROGRAMMING_SPEEDS - 1) },
+
+ { .ParamID = PARAM_RESET_POLARITY,
+ .ParamPrivileges = PARAM_PRIV_WRITE,
+ .ParamValue = 0x00 },
+
+ { .ParamID = PARAM_STATUS_TGT_CONN,
+ .ParamPrivileges = PARAM_PRIV_READ,
+ .ParamValue = STATUS_ISP_READY },
+
+ { .ParamID = PARAM_DISCHARGEDELAY,
+ .ParamPrivileges = PARAM_PRIV_WRITE,
+ .ParamValue = 0x00 },
+ };
+
+
+/** Loads saved non-volatile parameter values from the EEPROM into the parameter table, as needed. */
+void V2Params_LoadNonVolatileParamValues(void)
+{
+ /* Target RESET line polarity is a non-volatile value, retrieve current parameter value from EEPROM -
+ * NB: Cannot call V2Protocol_SetParameterValue() here, as that will cause another EEPROM write! */
+ V2Params_GetParamFromTable(PARAM_RESET_POLARITY)->ParamValue = eeprom_read_byte(&EEPROM_Rest_Polarity);
+}
+
+/** Updates any parameter values that are sourced from hardware rather than explicitly set by the host, such as
+ * VTARGET levels from the ADC on supported AVR models.
+ */
+void V2Params_UpdateParamValues(void)
+{
+ #if (defined(ADC) && !defined(NO_VTARGET_DETECT))
+ /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */
+ V2Params_GetParamFromTable(PARAM_VTARGET)->ParamValue = ((5 * 10 * ADC_GetResult()) / 1024);
+ #endif
+}
+
+/** Retrieves the host PC read/write privileges for a given parameter in the parameter table. This should
+ * be called before calls to \ref V2Params_GetParameterValue() or \ref V2Params_SetParameterValue() when
+ * getting or setting parameter values in response to requests from the host.
+ *
+ * \param[in] ParamID Parameter ID whose privileges are to be retrieved from the table
+ *
+ * \return Privileges for the requested parameter, as a mask of PARAM_PRIV_* masks
+ */
+uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID)
+{
+ ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
+
+ if (ParamInfo == NULL)
+ return 0;
+
+ return ParamInfo->ParamPrivileges;
+}
+
+/** Retrieves the current value for a given parameter in the parameter table.
+ *
+ * \param[in] ParamID Parameter ID whose value is to be retrieved from the table
+ *
+ * \return Current value of the parameter in the table, or 0 if not found
+ */
+uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
+{
+ ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
+
+ if (ParamInfo == NULL)
+ return 0;
+
+ return ParamInfo->ParamValue;
+}
+
+/** Sets the value for a given parameter in the parameter table.
+ *
+ * \param[in] ParamID Parameter ID whose value is to be set in the table
+ * \param[in] Value New value to set the parameter to
+ *
+ * \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
+ */
+void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value)
+{
+ ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
+
+ if (ParamInfo == NULL)
+ return;
+
+ ParamInfo->ParamValue = Value;
+
+ /* The target RESET line polarity is a non-volatile parameter, save to EEPROM when changed */
+ if (ParamID == PARAM_RESET_POLARITY)
+ eeprom_write_byte(&EEPROM_Rest_Polarity, Value);
+}
+
+/** Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given
+ * parameter ID.
+ *
+ * \param[in] ParamID Parameter ID to find in the table
+ *
+ * \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
+ */
+static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID)
+{
+ ParameterItem_t* CurrTableItem = ParameterTable;
+
+ /* Find the parameter in the parameter table if present */
+ for (uint8_t TableIndex = 0; TableIndex < TABLE_PARAM_COUNT; TableIndex++)
+ {
+ if (ParamID == CurrTableItem->ParamID)
+ return CurrTableItem;
+
+ CurrTableItem++;
+ }
+
+ return NULL;
+}
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
index 995468a4d..4bbb02419 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
@@ -1,85 +1,85 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 V2ProtocolParams.c.
- */
-
-#ifndef _V2_PROTOCOL_PARAMS_
-#define _V2_PROTOCOL_PARAMS_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/eeprom.h>
-
- #include <LUFA/Version.h>
-
- #if defined(ADC)
- #include <LUFA/Drivers/Peripheral/ADC.h>
- #endif
-
- #include "V2Protocol.h"
- #include "V2ProtocolConstants.h"
- #include "ISP/ISPTarget.h"
-
- /* Macros: */
- /** Parameter privilege mask to allow the host PC to read the parameter's value */
- #define PARAM_PRIV_READ (1 << 0)
-
- /** Parameter privilege mask to allow the host PC to change the parameter's value */
- #define PARAM_PRIV_WRITE (1 << 1)
-
- /** Total number of parameters in the parameter table */
- #define TABLE_PARAM_COUNT (sizeof(ParameterTable) / sizeof(ParameterTable[0]))
-
- /* Type Defines: */
- /** Type define for a parameter table entry indicating a PC readable or writable device parameter. */
- typedef struct
- {
- const uint8_t ParamID; /**< Parameter ID number to uniquely identify the parameter within the device */
- const uint8_t ParamPrivileges; /**< Parameter privileges to allow the host to read or write the parameter's value */
- uint8_t ParamValue; /**< Current parameter's value within the device */
- } ParameterItem_t;
-
- /* Function Prototypes: */
- void V2Params_LoadNonVolatileParamValues(void);
- void V2Params_UpdateParamValues(void);
-
- uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID);
- uint8_t V2Params_GetParameterValue(const uint8_t ParamID);
- void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value);
-
- #if defined(INCLUDE_FROM_V2PROTOCOL_PARAMS_C)
- static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID);
- #endif
-
-#endif
-
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 V2ProtocolParams.c.
+ */
+
+#ifndef _V2_PROTOCOL_PARAMS_
+#define _V2_PROTOCOL_PARAMS_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/eeprom.h>
+
+ #include <LUFA/Version.h>
+
+ #if defined(ADC)
+ #include <LUFA/Drivers/Peripheral/ADC.h>
+ #endif
+
+ #include "V2Protocol.h"
+ #include "V2ProtocolConstants.h"
+ #include "ISP/ISPTarget.h"
+
+ /* Macros: */
+ /** Parameter privilege mask to allow the host PC to read the parameter's value */
+ #define PARAM_PRIV_READ (1 << 0)
+
+ /** Parameter privilege mask to allow the host PC to change the parameter's value */
+ #define PARAM_PRIV_WRITE (1 << 1)
+
+ /** Total number of parameters in the parameter table */
+ #define TABLE_PARAM_COUNT (sizeof(ParameterTable) / sizeof(ParameterTable[0]))
+
+ /* Type Defines: */
+ /** Type define for a parameter table entry indicating a PC readable or writable device parameter. */
+ typedef struct
+ {
+ const uint8_t ParamID; /**< Parameter ID number to uniquely identify the parameter within the device */
+ const uint8_t ParamPrivileges; /**< Parameter privileges to allow the host to read or write the parameter's value */
+ uint8_t ParamValue; /**< Current parameter's value within the device */
+ } ParameterItem_t;
+
+ /* Function Prototypes: */
+ void V2Params_LoadNonVolatileParamValues(void);
+ void V2Params_UpdateParamValues(void);
+
+ uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID);
+ uint8_t V2Params_GetParameterValue(const uint8_t ParamID);
+ void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value);
+
+ #if defined(INCLUDE_FROM_V2PROTOCOL_PARAMS_C)
+ static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID);
+ #endif
+
+#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
index 817f22347..f9815043f 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
@@ -1,238 +1,238 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Target-related functions for the TINY target's NVM module.
- */
-
-#define INCLUDE_FROM_TINYNVM_C
-#include "TINYNVM.h"
-
-#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
-
-/** Sends the given pointer address to the target's TPI pointer register */
-static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress)
-{
- /* Send the given 16-bit address to the target, LSB first */
- XPROGTarget_SendByte(TPI_CMD_SSTPR | 0);
- XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[0]);
- XPROGTarget_SendByte(TPI_CMD_SSTPR | 1);
- XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[1]);
-}
-
-/** Sends a SIN command to the target with the specified I/O address, ready for the data byte to be written.
- *
- * \param[in] Address 6-bit I/O address to write to in the target's I/O memory space
- */
-static void TINYNVM_SendReadNVMRegister(const uint8_t Address)
-{
- /* The TPI command for reading from the I/O space uses strange addressing, where the I/O address's upper
- * two bits of the 6-bit address are shifted left once */
- XPROGTarget_SendByte(TPI_CMD_SIN | ((Address & 0x30) << 1) | (Address & 0x0F));
-}
-
-/** Sends a SOUT command to the target with the specified I/O address, ready for the data byte to be read.
- *
- * \param[in] Address 6-bit I/O address to read from in the target's I/O memory space
- */
-static void TINYNVM_SendWriteNVMRegister(const uint8_t Address)
-{
- /* The TPI command for reading from the I/O space uses strange addressing, where the I/O address's upper
- * two bits of the 6-bit address are shifted left once */
- XPROGTarget_SendByte(TPI_CMD_SOUT | ((Address & 0x30) << 1) | (Address & 0x0F));
-}
-
-/** Busy-waits while the NVM controller is busy performing a NVM operation, such as a FLASH page read.
- *
- * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
- */
-bool TINYNVM_WaitWhileNVMBusBusy(void)
-{
- /* Poll the STATUS register to check to see if NVM access has been enabled */
- while (TimeoutMSRemaining)
- {
- /* Send the SLDCS command to read the TPI STATUS register to see the NVM bus is active */
- XPROGTarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG);
-
- uint8_t StatusRegister = XPROGTarget_ReceiveByte();
-
- /* We might have timed out waiting for the status register read response, check here */
- if (!(TimeoutMSRemaining))
- return false;
-
- /* Check the status register read response to see if the NVM bus is enabled */
- if (StatusRegister & TPI_STATUS_NVM)
- {
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- return true;
- }
- }
-
- return false;
-}
-
-/** Waits while the target's NVM controller is busy performing an operation, exiting if the
- * timeout period expires.
- *
- * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
- */
-bool TINYNVM_WaitWhileNVMControllerBusy(void)
-{
- /* Poll the STATUS register to check to see if NVM access has been enabled */
- while (TimeoutMSRemaining)
- {
- /* Send the SIN command to read the TPI STATUS register to see the NVM bus is busy */
- TINYNVM_SendReadNVMRegister(XPROG_Param_NVMCSRRegAddr);
-
- uint8_t StatusRegister = XPROGTarget_ReceiveByte();
-
- /* We might have timed out waiting for the status register read response, check here */
- if (!(TimeoutMSRemaining))
- return false;
-
- /* Check to see if the BUSY flag is still set */
- if (!(StatusRegister & (1 << 7)))
- {
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- return true;
- }
- }
-
- return false;
-}
-
-/** Reads memory from the target's memory spaces.
- *
- * \param[in] ReadAddress Start address to read from within the target's address space
- * \param[out] ReadBuffer Buffer to store read data into
- * \param[in] ReadSize Length of the data to read from the device
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(TINYNVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Set the NVM control register to the NO OP command for memory reading */
- TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
- XPROGTarget_SendByte(TINY_NVM_CMD_NOOP);
-
- /* Send the address of the location to read from */
- TINYNVM_SendPointerAddress(ReadAddress);
-
- while (ReadSize-- && TimeoutMSRemaining)
- {
- /* Read the byte of data from the target */
- XPROGTarget_SendByte(TPI_CMD_SLD | TPI_POINTER_INDIRECT_PI);
- *(ReadBuffer++) = XPROGTarget_ReceiveByte();
- }
-
- return (TimeoutMSRemaining != 0);
-}
-
-/** Writes word addressed memory to the target's memory spaces.
- *
- * \param[in] WriteAddress Start address to write to within the target's address space
- * \param[in] WriteBuffer Buffer to source data from
- * \param[in] WriteLength Total number of bytes to write to the device (must be an integer multiple of 2)
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(TINYNVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Must have an integer number of words to write - if extra byte, word-align via a dummy high byte */
- if (WriteLength & 0x01)
- WriteBuffer[WriteLength++] = 0xFF;
-
- /* Set the NVM control register to the WORD WRITE command for memory reading */
- TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
- XPROGTarget_SendByte(TINY_NVM_CMD_WORDWRITE);
-
- /* Send the address of the location to write to */
- TINYNVM_SendPointerAddress(WriteAddress);
-
- while (WriteLength)
- {
- /* Wait until the NVM controller is no longer busy */
- if (!(TINYNVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Write the low byte of data to the target */
- XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);
- XPROGTarget_SendByte(*(WriteBuffer++));
-
- /* Write the high byte of data to the target */
- XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);
- XPROGTarget_SendByte(*(WriteBuffer++));
-
- /* Need to decrement the write length twice, since we read out a whole word */
- WriteLength -= 2;
- }
-
- return true;
-}
-
-/** Erases the target's memory space.
- *
- * \param[in] EraseCommand NVM erase command to send to the device
- * \param[in] Address Address inside the memory space to erase
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(TINYNVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Set the NVM control register to the target memory erase command */
- TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
- XPROGTarget_SendByte(EraseCommand);
-
- /* Write to a high byte location within the target address space to start the erase process */
- TINYNVM_SendPointerAddress(Address | 0x0001);
- XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT);
- XPROGTarget_SendByte(0x00);
-
- /* Wait until the NVM controller is no longer busy */
- if (!(TINYNVM_WaitWhileNVMControllerBusy()))
- return false;
-
- return true;
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Target-related functions for the TINY target's NVM module.
+ */
+
+#define INCLUDE_FROM_TINYNVM_C
+#include "TINYNVM.h"
+
+#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
+
+/** Sends the given pointer address to the target's TPI pointer register */
+static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress)
+{
+ /* Send the given 16-bit address to the target, LSB first */
+ XPROGTarget_SendByte(TPI_CMD_SSTPR | 0);
+ XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[0]);
+ XPROGTarget_SendByte(TPI_CMD_SSTPR | 1);
+ XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[1]);
+}
+
+/** Sends a SIN command to the target with the specified I/O address, ready for the data byte to be written.
+ *
+ * \param[in] Address 6-bit I/O address to write to in the target's I/O memory space
+ */
+static void TINYNVM_SendReadNVMRegister(const uint8_t Address)
+{
+ /* The TPI command for reading from the I/O space uses strange addressing, where the I/O address's upper
+ * two bits of the 6-bit address are shifted left once */
+ XPROGTarget_SendByte(TPI_CMD_SIN | ((Address & 0x30) << 1) | (Address & 0x0F));
+}
+
+/** Sends a SOUT command to the target with the specified I/O address, ready for the data byte to be read.
+ *
+ * \param[in] Address 6-bit I/O address to read from in the target's I/O memory space
+ */
+static void TINYNVM_SendWriteNVMRegister(const uint8_t Address)
+{
+ /* The TPI command for reading from the I/O space uses strange addressing, where the I/O address's upper
+ * two bits of the 6-bit address are shifted left once */
+ XPROGTarget_SendByte(TPI_CMD_SOUT | ((Address & 0x30) << 1) | (Address & 0x0F));
+}
+
+/** Busy-waits while the NVM controller is busy performing a NVM operation, such as a FLASH page read.
+ *
+ * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
+ */
+bool TINYNVM_WaitWhileNVMBusBusy(void)
+{
+ /* Poll the STATUS register to check to see if NVM access has been enabled */
+ while (TimeoutMSRemaining)
+ {
+ /* Send the SLDCS command to read the TPI STATUS register to see the NVM bus is active */
+ XPROGTarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG);
+
+ uint8_t StatusRegister = XPROGTarget_ReceiveByte();
+
+ /* We might have timed out waiting for the status register read response, check here */
+ if (!(TimeoutMSRemaining))
+ return false;
+
+ /* Check the status register read response to see if the NVM bus is enabled */
+ if (StatusRegister & TPI_STATUS_NVM)
+ {
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/** Waits while the target's NVM controller is busy performing an operation, exiting if the
+ * timeout period expires.
+ *
+ * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
+ */
+bool TINYNVM_WaitWhileNVMControllerBusy(void)
+{
+ /* Poll the STATUS register to check to see if NVM access has been enabled */
+ while (TimeoutMSRemaining)
+ {
+ /* Send the SIN command to read the TPI STATUS register to see the NVM bus is busy */
+ TINYNVM_SendReadNVMRegister(XPROG_Param_NVMCSRRegAddr);
+
+ uint8_t StatusRegister = XPROGTarget_ReceiveByte();
+
+ /* We might have timed out waiting for the status register read response, check here */
+ if (!(TimeoutMSRemaining))
+ return false;
+
+ /* Check to see if the BUSY flag is still set */
+ if (!(StatusRegister & (1 << 7)))
+ {
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/** Reads memory from the target's memory spaces.
+ *
+ * \param[in] ReadAddress Start address to read from within the target's address space
+ * \param[out] ReadBuffer Buffer to store read data into
+ * \param[in] ReadSize Length of the data to read from the device
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(TINYNVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Set the NVM control register to the NO OP command for memory reading */
+ TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
+ XPROGTarget_SendByte(TINY_NVM_CMD_NOOP);
+
+ /* Send the address of the location to read from */
+ TINYNVM_SendPointerAddress(ReadAddress);
+
+ while (ReadSize-- && TimeoutMSRemaining)
+ {
+ /* Read the byte of data from the target */
+ XPROGTarget_SendByte(TPI_CMD_SLD | TPI_POINTER_INDIRECT_PI);
+ *(ReadBuffer++) = XPROGTarget_ReceiveByte();
+ }
+
+ return (TimeoutMSRemaining != 0);
+}
+
+/** Writes word addressed memory to the target's memory spaces.
+ *
+ * \param[in] WriteAddress Start address to write to within the target's address space
+ * \param[in] WriteBuffer Buffer to source data from
+ * \param[in] WriteLength Total number of bytes to write to the device (must be an integer multiple of 2)
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(TINYNVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Must have an integer number of words to write - if extra byte, word-align via a dummy high byte */
+ if (WriteLength & 0x01)
+ WriteBuffer[WriteLength++] = 0xFF;
+
+ /* Set the NVM control register to the WORD WRITE command for memory reading */
+ TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
+ XPROGTarget_SendByte(TINY_NVM_CMD_WORDWRITE);
+
+ /* Send the address of the location to write to */
+ TINYNVM_SendPointerAddress(WriteAddress);
+
+ while (WriteLength)
+ {
+ /* Wait until the NVM controller is no longer busy */
+ if (!(TINYNVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Write the low byte of data to the target */
+ XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);
+ XPROGTarget_SendByte(*(WriteBuffer++));
+
+ /* Write the high byte of data to the target */
+ XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);
+ XPROGTarget_SendByte(*(WriteBuffer++));
+
+ /* Need to decrement the write length twice, since we read out a whole word */
+ WriteLength -= 2;
+ }
+
+ return true;
+}
+
+/** Erases the target's memory space.
+ *
+ * \param[in] EraseCommand NVM erase command to send to the device
+ * \param[in] Address Address inside the memory space to erase
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(TINYNVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Set the NVM control register to the target memory erase command */
+ TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
+ XPROGTarget_SendByte(EraseCommand);
+
+ /* Write to a high byte location within the target address space to start the erase process */
+ TINYNVM_SendPointerAddress(Address | 0x0001);
+ XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT);
+ XPROGTarget_SendByte(0x00);
+
+ /* Wait until the NVM controller is no longer busy */
+ if (!(TINYNVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ return true;
+}
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
index 223bbccfd..73bf1f953 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
@@ -1,77 +1,77 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 TINYNVM.c.
- */
-
-#ifndef _TINY_NVM_
-#define _TINY_NVM_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <stdbool.h>
-
- #include <LUFA/Common/Common.h>
-
- #include "XPROGProtocol.h"
- #include "XPROGTarget.h"
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /* Defines: */
- #define TINY_NVM_CMD_NOOP 0x00
- #define TINY_NVM_CMD_CHIPERASE 0x10
- #define TINY_NVM_CMD_SECTIONERASE 0x14
- #define TINY_NVM_CMD_WORDWRITE 0x1D
-
- /* Function Prototypes: */
- bool TINYNVM_WaitWhileNVMBusBusy(void);
- bool TINYNVM_WaitWhileNVMControllerBusy(void);
- bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadLength);
- bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength);
- bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address);
-
- #if defined(INCLUDE_FROM_TINYNVM_C)
- static void TINYNVM_SendReadNVMRegister(const uint8_t Address);
- static void TINYNVM_SendWriteNVMRegister(const uint8_t Address);
- static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 TINYNVM.c.
+ */
+
+#ifndef _TINY_NVM_
+#define _TINY_NVM_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include <stdbool.h>
+
+ #include <LUFA/Common/Common.h>
+
+ #include "XPROGProtocol.h"
+ #include "XPROGTarget.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /* Defines: */
+ #define TINY_NVM_CMD_NOOP 0x00
+ #define TINY_NVM_CMD_CHIPERASE 0x10
+ #define TINY_NVM_CMD_SECTIONERASE 0x14
+ #define TINY_NVM_CMD_WORDWRITE 0x1D
+
+ /* Function Prototypes: */
+ bool TINYNVM_WaitWhileNVMBusBusy(void);
+ bool TINYNVM_WaitWhileNVMControllerBusy(void);
+ bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadLength);
+ bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength);
+ bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address);
+
+ #if defined(INCLUDE_FROM_TINYNVM_C)
+ static void TINYNVM_SendReadNVMRegister(const uint8_t Address);
+ static void TINYNVM_SendWriteNVMRegister(const uint8_t Address);
+ static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress);
+ #endif
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
index 1671d29ba..14ad97c74 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
@@ -1,356 +1,356 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Target-related functions for the XMEGA target's NVM module.
- */
-
-#define INCLUDE_FROM_XMEGA_NVM_C
-#include "XMEGANVM.h"
-
-#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
-
-/** Sends the given 32-bit absolute address to the target.
- *
- * \param[in] AbsoluteAddress Absolute address to send to the target
- */
-static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress)
-{
- /* Send the given 32-bit address to the target, LSB first */
- XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[0]);
- XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[1]);
- XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[2]);
- XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[3]);
-}
-
-/** Sends the given NVM register address to the target.
- *
- * \param[in] Register NVM register whose absolute address is to be sent
- */
-static void XMEGANVM_SendNVMRegAddress(const uint8_t Register)
-{
- /* Determine the absolute register address from the NVM base memory address and the NVM register address */
- uint32_t Address = XPROG_Param_NVMBase | Register;
-
- /* Send the calculated 32-bit address to the target, LSB first */
- XMEGANVM_SendAddress(Address);
-}
-
-/** Busy-waits while the NVM controller is busy performing a NVM operation, such as a FLASH page read or CRC
- * calculation.
- *
- * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
- */
-bool XMEGANVM_WaitWhileNVMBusBusy(void)
-{
- /* Poll the STATUS register to check to see if NVM access has been enabled */
- while (TimeoutMSRemaining)
- {
- /* Send the LDCS command to read the PDI STATUS register to see the NVM bus is active */
- XPROGTarget_SendByte(PDI_CMD_LDCS | PDI_STATUS_REG);
-
- uint8_t StatusRegister = XPROGTarget_ReceiveByte();
-
- /* We might have timed out waiting for the status register read response, check here */
- if (!(TimeoutMSRemaining))
- return false;
-
- /* Check the status register read response to see if the NVM bus is enabled */
- if (StatusRegister & PDI_STATUS_NVM)
- {
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- return true;
- }
- }
-
- return false;
-}
-
-/** Waits while the target's NVM controller is busy performing an operation, exiting if the
- * timeout period expires.
- *
- * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
- */
-bool XMEGANVM_WaitWhileNVMControllerBusy(void)
-{
- /* Poll the NVM STATUS register while the NVM controller is busy */
- while (TimeoutMSRemaining)
- {
- /* Send a LDS command to read the NVM STATUS register to check the BUSY flag */
- XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS);
-
- uint8_t StatusRegister = XPROGTarget_ReceiveByte();
-
- /* We might have timed out waiting for the status register read response, check here */
- if (!(TimeoutMSRemaining))
- return false;
-
- /* Check to see if the BUSY flag is still set */
- if (!(StatusRegister & (1 << 7)))
- {
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- return true;
- }
- }
-
- return false;
-}
-
-/** Retrieves the CRC value of the given memory space.
- *
- * \param[in] CRCCommand NVM CRC command to issue to the target
- * \param[out] CRCDest CRC Destination when read from the target
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Set the NVM command to the correct CRC read command */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(CRCCommand);
-
- /* Set CMDEX bit in NVM CTRLA register to start the CRC generation */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
-
- /* Wait until the NVM bus is ready again */
- if (!(XMEGANVM_WaitWhileNVMBusBusy()))
- return false;
-
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Load the PDI pointer register with the DAT0 register start address */
- XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_DAT0);
-
- /* Send the REPEAT command to grab the CRC bytes */
- XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
- XPROGTarget_SendByte(XMEGA_CRC_LENGTH - 1);
-
- /* Read in the CRC bytes from the target */
- XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
- for (uint8_t i = 0; i < XMEGA_CRC_LENGTH; i++)
- ((uint8_t*)CRCDest)[i] = XPROGTarget_ReceiveByte();
-
- return (TimeoutMSRemaining != 0);
-}
-
-/** Reads memory from the target's memory spaces.
- *
- * \param[in] ReadAddress Start address to read from within the target's address space
- * \param[out] ReadBuffer Buffer to store read data into
- * \param[in] ReadSize Number of bytes to read
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Send the READNVM command to the NVM controller for reading of an arbitrary location */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(XMEGA_NVM_CMD_READNVM);
-
- /* Load the PDI pointer register with the start address we want to read from */
- XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
- XMEGANVM_SendAddress(ReadAddress);
-
- /* Send the REPEAT command with the specified number of bytes to read */
- XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
- XPROGTarget_SendByte(ReadSize - 1);
-
- /* Send a LD command with indirect access and postincrement to read out the bytes */
- XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
- while (ReadSize-- && TimeoutMSRemaining)
- *(ReadBuffer++) = XPROGTarget_ReceiveByte();
-
- return (TimeoutMSRemaining != 0);
-}
-
-/** Writes byte addressed memory to the target's memory spaces.
- *
- * \param[in] WriteCommand Command to send to the device to write each memory byte
- * \param[in] WriteAddress Address to write to within the target's address space
- * \param[in] Byte Byte to write to the target
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t Byte)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Send the memory write command to the target */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(WriteCommand);
-
- /* Send new memory byte to the memory to the target */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendAddress(WriteAddress);
- XPROGTarget_SendByte(Byte);
-
- return true;
-}
-
-/** Writes page addressed memory to the target's memory spaces.
- *
- * \param[in] WriteBuffCommand Command to send to the device to write a byte to the memory page buffer
- * \param[in] EraseBuffCommand Command to send to the device to erase the memory page buffer
- * \param[in] WritePageCommand Command to send to the device to write the page buffer to the destination memory
- * \param[in] PageMode Bitfield indicating what operations need to be executed on the specified page
- * \param[in] WriteAddress Start address to write the page data to within the target's address space
- * \param[in] WriteBuffer Buffer to source data from
- * \param[in] WriteSize Number of bytes to write
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t EraseBuffCommand,
- const uint8_t WritePageCommand, const uint8_t PageMode, const uint32_t WriteAddress,
- const uint8_t* WriteBuffer, uint16_t WriteSize)
-{
- if (PageMode & XPRG_PAGEMODE_ERASE)
- {
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Send the memory buffer erase command to the target */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(EraseBuffCommand);
-
- /* Set CMDEX bit in NVM CTRLA register to start the buffer erase */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
- }
-
- if (WriteSize)
- {
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Send the memory buffer write command to the target */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(WriteBuffCommand);
-
- /* Load the PDI pointer register with the start address we want to write to */
- XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
- XMEGANVM_SendAddress(WriteAddress);
-
- /* Send the REPEAT command with the specified number of bytes to write */
- XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
- XPROGTarget_SendByte(WriteSize - 1);
-
- /* Send a ST command with indirect access and postincrement to write the bytes */
- XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
- while (WriteSize--)
- XPROGTarget_SendByte(*(WriteBuffer++));
- }
-
- if (PageMode & XPRG_PAGEMODE_WRITE)
- {
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Send the memory write command to the target */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(WritePageCommand);
-
- /* Send the address of the first page location to write the memory page */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendAddress(WriteAddress);
- XPROGTarget_SendByte(0x00);
- }
-
- return true;
-}
-
-/** Erases a specific memory space of the target.
- *
- * \param[in] EraseCommand NVM erase command to send to the device
- * \param[in] Address Address inside the memory space to erase
- *
- * \return Boolean true if the command sequence complete successfully
- */
-bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
-{
- /* Wait until the NVM controller is no longer busy */
- if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
- return false;
-
- /* Send the memory erase command to the target */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
- XPROGTarget_SendByte(EraseCommand);
-
- /* Chip erase is handled separately, since it's procedure is different to other erase types */
- if (EraseCommand == XMEGA_NVM_CMD_CHIPERASE)
- {
- /* Set CMDEX bit in NVM CTRLA register to start the chip erase */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
- }
- else
- {
- /* Other erase modes just need us to address a byte within the target memory space */
- XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
- XMEGANVM_SendAddress(Address);
- XPROGTarget_SendByte(0x00);
- }
-
- /* Wait until the NVM bus is ready again */
- if (!(XMEGANVM_WaitWhileNVMBusBusy()))
- return false;
-
- return true;
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Target-related functions for the XMEGA target's NVM module.
+ */
+
+#define INCLUDE_FROM_XMEGA_NVM_C
+#include "XMEGANVM.h"
+
+#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
+
+/** Sends the given 32-bit absolute address to the target.
+ *
+ * \param[in] AbsoluteAddress Absolute address to send to the target
+ */
+static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress)
+{
+ /* Send the given 32-bit address to the target, LSB first */
+ XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[0]);
+ XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[1]);
+ XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[2]);
+ XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[3]);
+}
+
+/** Sends the given NVM register address to the target.
+ *
+ * \param[in] Register NVM register whose absolute address is to be sent
+ */
+static void XMEGANVM_SendNVMRegAddress(const uint8_t Register)
+{
+ /* Determine the absolute register address from the NVM base memory address and the NVM register address */
+ uint32_t Address = XPROG_Param_NVMBase | Register;
+
+ /* Send the calculated 32-bit address to the target, LSB first */
+ XMEGANVM_SendAddress(Address);
+}
+
+/** Busy-waits while the NVM controller is busy performing a NVM operation, such as a FLASH page read or CRC
+ * calculation.
+ *
+ * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
+ */
+bool XMEGANVM_WaitWhileNVMBusBusy(void)
+{
+ /* Poll the STATUS register to check to see if NVM access has been enabled */
+ while (TimeoutMSRemaining)
+ {
+ /* Send the LDCS command to read the PDI STATUS register to see the NVM bus is active */
+ XPROGTarget_SendByte(PDI_CMD_LDCS | PDI_STATUS_REG);
+
+ uint8_t StatusRegister = XPROGTarget_ReceiveByte();
+
+ /* We might have timed out waiting for the status register read response, check here */
+ if (!(TimeoutMSRemaining))
+ return false;
+
+ /* Check the status register read response to see if the NVM bus is enabled */
+ if (StatusRegister & PDI_STATUS_NVM)
+ {
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/** Waits while the target's NVM controller is busy performing an operation, exiting if the
+ * timeout period expires.
+ *
+ * \return Boolean true if the NVM controller became ready within the timeout period, false otherwise
+ */
+bool XMEGANVM_WaitWhileNVMControllerBusy(void)
+{
+ /* Poll the NVM STATUS register while the NVM controller is busy */
+ while (TimeoutMSRemaining)
+ {
+ /* Send a LDS command to read the NVM STATUS register to check the BUSY flag */
+ XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS);
+
+ uint8_t StatusRegister = XPROGTarget_ReceiveByte();
+
+ /* We might have timed out waiting for the status register read response, check here */
+ if (!(TimeoutMSRemaining))
+ return false;
+
+ /* Check to see if the BUSY flag is still set */
+ if (!(StatusRegister & (1 << 7)))
+ {
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/** Retrieves the CRC value of the given memory space.
+ *
+ * \param[in] CRCCommand NVM CRC command to issue to the target
+ * \param[out] CRCDest CRC Destination when read from the target
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Set the NVM command to the correct CRC read command */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(CRCCommand);
+
+ /* Set CMDEX bit in NVM CTRLA register to start the CRC generation */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
+ XPROGTarget_SendByte(1 << 0);
+
+ /* Wait until the NVM bus is ready again */
+ if (!(XMEGANVM_WaitWhileNVMBusBusy()))
+ return false;
+
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Load the PDI pointer register with the DAT0 register start address */
+ XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_DAT0);
+
+ /* Send the REPEAT command to grab the CRC bytes */
+ XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
+ XPROGTarget_SendByte(XMEGA_CRC_LENGTH - 1);
+
+ /* Read in the CRC bytes from the target */
+ XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
+ for (uint8_t i = 0; i < XMEGA_CRC_LENGTH; i++)
+ ((uint8_t*)CRCDest)[i] = XPROGTarget_ReceiveByte();
+
+ return (TimeoutMSRemaining != 0);
+}
+
+/** Reads memory from the target's memory spaces.
+ *
+ * \param[in] ReadAddress Start address to read from within the target's address space
+ * \param[out] ReadBuffer Buffer to store read data into
+ * \param[in] ReadSize Number of bytes to read
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Send the READNVM command to the NVM controller for reading of an arbitrary location */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(XMEGA_NVM_CMD_READNVM);
+
+ /* Load the PDI pointer register with the start address we want to read from */
+ XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
+ XMEGANVM_SendAddress(ReadAddress);
+
+ /* Send the REPEAT command with the specified number of bytes to read */
+ XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
+ XPROGTarget_SendByte(ReadSize - 1);
+
+ /* Send a LD command with indirect access and postincrement to read out the bytes */
+ XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
+ while (ReadSize-- && TimeoutMSRemaining)
+ *(ReadBuffer++) = XPROGTarget_ReceiveByte();
+
+ return (TimeoutMSRemaining != 0);
+}
+
+/** Writes byte addressed memory to the target's memory spaces.
+ *
+ * \param[in] WriteCommand Command to send to the device to write each memory byte
+ * \param[in] WriteAddress Address to write to within the target's address space
+ * \param[in] Byte Byte to write to the target
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t Byte)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Send the memory write command to the target */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(WriteCommand);
+
+ /* Send new memory byte to the memory to the target */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendAddress(WriteAddress);
+ XPROGTarget_SendByte(Byte);
+
+ return true;
+}
+
+/** Writes page addressed memory to the target's memory spaces.
+ *
+ * \param[in] WriteBuffCommand Command to send to the device to write a byte to the memory page buffer
+ * \param[in] EraseBuffCommand Command to send to the device to erase the memory page buffer
+ * \param[in] WritePageCommand Command to send to the device to write the page buffer to the destination memory
+ * \param[in] PageMode Bitfield indicating what operations need to be executed on the specified page
+ * \param[in] WriteAddress Start address to write the page data to within the target's address space
+ * \param[in] WriteBuffer Buffer to source data from
+ * \param[in] WriteSize Number of bytes to write
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t EraseBuffCommand,
+ const uint8_t WritePageCommand, const uint8_t PageMode, const uint32_t WriteAddress,
+ const uint8_t* WriteBuffer, uint16_t WriteSize)
+{
+ if (PageMode & XPRG_PAGEMODE_ERASE)
+ {
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Send the memory buffer erase command to the target */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(EraseBuffCommand);
+
+ /* Set CMDEX bit in NVM CTRLA register to start the buffer erase */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
+ XPROGTarget_SendByte(1 << 0);
+ }
+
+ if (WriteSize)
+ {
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Send the memory buffer write command to the target */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(WriteBuffCommand);
+
+ /* Load the PDI pointer register with the start address we want to write to */
+ XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
+ XMEGANVM_SendAddress(WriteAddress);
+
+ /* Send the REPEAT command with the specified number of bytes to write */
+ XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
+ XPROGTarget_SendByte(WriteSize - 1);
+
+ /* Send a ST command with indirect access and postincrement to write the bytes */
+ XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
+ while (WriteSize--)
+ XPROGTarget_SendByte(*(WriteBuffer++));
+ }
+
+ if (PageMode & XPRG_PAGEMODE_WRITE)
+ {
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Send the memory write command to the target */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(WritePageCommand);
+
+ /* Send the address of the first page location to write the memory page */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendAddress(WriteAddress);
+ XPROGTarget_SendByte(0x00);
+ }
+
+ return true;
+}
+
+/** Erases a specific memory space of the target.
+ *
+ * \param[in] EraseCommand NVM erase command to send to the device
+ * \param[in] Address Address inside the memory space to erase
+ *
+ * \return Boolean true if the command sequence complete successfully
+ */
+bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
+{
+ /* Wait until the NVM controller is no longer busy */
+ if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
+ return false;
+
+ /* Send the memory erase command to the target */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
+ XPROGTarget_SendByte(EraseCommand);
+
+ /* Chip erase is handled separately, since it's procedure is different to other erase types */
+ if (EraseCommand == XMEGA_NVM_CMD_CHIPERASE)
+ {
+ /* Set CMDEX bit in NVM CTRLA register to start the chip erase */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
+ XPROGTarget_SendByte(1 << 0);
+ }
+ else
+ {
+ /* Other erase modes just need us to address a byte within the target memory space */
+ XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendAddress(Address);
+ XPROGTarget_SendByte(0x00);
+ }
+
+ /* Wait until the NVM bus is ready again */
+ if (!(XMEGANVM_WaitWhileNVMBusBusy()))
+ return false;
+
+ return true;
+}
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
index 583a2878b..af38afdac 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
@@ -1,124 +1,124 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 XMEGANVM.c.
- */
-
-#ifndef _XMEGA_NVM_
-#define _XMEGA_NVM_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <stdbool.h>
-
- #include <LUFA/Common/Common.h>
-
- #include "XPROGProtocol.h"
- #include "XPROGTarget.h"
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /* Defines: */
- #define XMEGA_CRC_LENGTH 3
-
- #define XMEGA_NVM_REG_ADDR0 0x00
- #define XMEGA_NVM_REG_ADDR1 0x01
- #define XMEGA_NVM_REG_ADDR2 0x02
- #define XMEGA_NVM_REG_DAT0 0x04
- #define XMEGA_NVM_REG_DAT1 0x05
- #define XMEGA_NVM_REG_DAT2 0x06
- #define XMEGA_NVM_REG_CMD 0x0A
- #define XMEGA_NVM_REG_CTRLA 0x0B
- #define XMEGA_NVM_REG_CTRLB 0x0C
- #define XMEGA_NVM_REG_INTCTRL 0x0D
- #define XMEGA_NVM_REG_STATUS 0x0F
- #define XMEGA_NVM_REG_LOCKBITS 0x10
-
- #define XMEGA_NVM_CMD_NOOP 0x00
- #define XMEGA_NVM_CMD_CHIPERASE 0x40
- #define XMEGA_NVM_CMD_READNVM 0x43
- #define XMEGA_NVM_CMD_LOADFLASHPAGEBUFF 0x23
- #define XMEGA_NVM_CMD_ERASEFLASHPAGEBUFF 0x26
- #define XMEGA_NVM_CMD_ERASEFLASHPAGE 0x2B
- #define XMEGA_NVM_CMD_WRITEFLASHPAGE 0x2E
- #define XMEGA_NVM_CMD_ERASEWRITEFLASH 0x2F
- #define XMEGA_NVM_CMD_FLASHCRC 0x78
- #define XMEGA_NVM_CMD_ERASEAPPSEC 0x20
- #define XMEGA_NVM_CMD_ERASEAPPSECPAGE 0x22
- #define XMEGA_NVM_CMD_WRITEAPPSECPAGE 0x24
- #define XMEGA_NVM_CMD_ERASEWRITEAPPSECPAGE 0x25
- #define XMEGA_NVM_CMD_APPCRC 0x38
- #define XMEGA_NVM_CMD_ERASEBOOTSEC 0x68
- #define XMEGA_NVM_CMD_ERASEBOOTSECPAGE 0x2A
- #define XMEGA_NVM_CMD_WRITEBOOTSECPAGE 0x2C
- #define XMEGA_NVM_CMD_ERASEWRITEBOOTSECPAGE 0x2D
- #define XMEGA_NVM_CMD_BOOTCRC 0x39
- #define XMEGA_NVM_CMD_READUSERSIG 0x03
- #define XMEGA_NVM_CMD_ERASEUSERSIG 0x18
- #define XMEGA_NVM_CMD_WRITEUSERSIG 0x1A
- #define XMEGA_NVM_CMD_READCALIBRATION 0x02
- #define XMEGA_NVM_CMD_READFUSE 0x07
- #define XMEGA_NVM_CMD_WRITEFUSE 0x4C
- #define XMEGA_NVM_CMD_WRITELOCK 0x08
- #define XMEGA_NVM_CMD_LOADEEPROMPAGEBUFF 0x33
- #define XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF 0x36
- #define XMEGA_NVM_CMD_ERASEEEPROM 0x30
- #define XMEGA_NVM_CMD_ERASEEEPROMPAGE 0x32
- #define XMEGA_NVM_CMD_WRITEEEPROMPAGE 0x34
- #define XMEGA_NVM_CMD_ERASEWRITEEEPROMPAGE 0x35
- #define XMEGA_NVM_CMD_READEEPROM 0x06
-
- /* Function Prototypes: */
- bool XMEGANVM_WaitWhileNVMBusBusy(void);
- bool XMEGANVM_WaitWhileNVMControllerBusy(void);
- bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest);
- bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize);
- bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t Byte);
- bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t EraseBuffCommand,
- const uint8_t WritePageCommand, const uint8_t PageMode, const uint32_t WriteAddress,
- const uint8_t* WriteBuffer, uint16_t WriteSize);
- bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address);
-
- #if defined(INCLUDE_FROM_XMEGANVM_C)
- static void XMEGANVM_SendNVMRegAddress(const uint8_t Register);
- static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 XMEGANVM.c.
+ */
+
+#ifndef _XMEGA_NVM_
+#define _XMEGA_NVM_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include <stdbool.h>
+
+ #include <LUFA/Common/Common.h>
+
+ #include "XPROGProtocol.h"
+ #include "XPROGTarget.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /* Defines: */
+ #define XMEGA_CRC_LENGTH 3
+
+ #define XMEGA_NVM_REG_ADDR0 0x00
+ #define XMEGA_NVM_REG_ADDR1 0x01
+ #define XMEGA_NVM_REG_ADDR2 0x02
+ #define XMEGA_NVM_REG_DAT0 0x04
+ #define XMEGA_NVM_REG_DAT1 0x05
+ #define XMEGA_NVM_REG_DAT2 0x06
+ #define XMEGA_NVM_REG_CMD 0x0A
+ #define XMEGA_NVM_REG_CTRLA 0x0B
+ #define XMEGA_NVM_REG_CTRLB 0x0C
+ #define XMEGA_NVM_REG_INTCTRL 0x0D
+ #define XMEGA_NVM_REG_STATUS 0x0F
+ #define XMEGA_NVM_REG_LOCKBITS 0x10
+
+ #define XMEGA_NVM_CMD_NOOP 0x00
+ #define XMEGA_NVM_CMD_CHIPERASE 0x40
+ #define XMEGA_NVM_CMD_READNVM 0x43
+ #define XMEGA_NVM_CMD_LOADFLASHPAGEBUFF 0x23
+ #define XMEGA_NVM_CMD_ERASEFLASHPAGEBUFF 0x26
+ #define XMEGA_NVM_CMD_ERASEFLASHPAGE 0x2B
+ #define XMEGA_NVM_CMD_WRITEFLASHPAGE 0x2E
+ #define XMEGA_NVM_CMD_ERASEWRITEFLASH 0x2F
+ #define XMEGA_NVM_CMD_FLASHCRC 0x78
+ #define XMEGA_NVM_CMD_ERASEAPPSEC 0x20
+ #define XMEGA_NVM_CMD_ERASEAPPSECPAGE 0x22
+ #define XMEGA_NVM_CMD_WRITEAPPSECPAGE 0x24
+ #define XMEGA_NVM_CMD_ERASEWRITEAPPSECPAGE 0x25
+ #define XMEGA_NVM_CMD_APPCRC 0x38
+ #define XMEGA_NVM_CMD_ERASEBOOTSEC 0x68
+ #define XMEGA_NVM_CMD_ERASEBOOTSECPAGE 0x2A
+ #define XMEGA_NVM_CMD_WRITEBOOTSECPAGE 0x2C
+ #define XMEGA_NVM_CMD_ERASEWRITEBOOTSECPAGE 0x2D
+ #define XMEGA_NVM_CMD_BOOTCRC 0x39
+ #define XMEGA_NVM_CMD_READUSERSIG 0x03
+ #define XMEGA_NVM_CMD_ERASEUSERSIG 0x18
+ #define XMEGA_NVM_CMD_WRITEUSERSIG 0x1A
+ #define XMEGA_NVM_CMD_READCALIBRATION 0x02
+ #define XMEGA_NVM_CMD_READFUSE 0x07
+ #define XMEGA_NVM_CMD_WRITEFUSE 0x4C
+ #define XMEGA_NVM_CMD_WRITELOCK 0x08
+ #define XMEGA_NVM_CMD_LOADEEPROMPAGEBUFF 0x33
+ #define XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF 0x36
+ #define XMEGA_NVM_CMD_ERASEEEPROM 0x30
+ #define XMEGA_NVM_CMD_ERASEEEPROMPAGE 0x32
+ #define XMEGA_NVM_CMD_WRITEEEPROMPAGE 0x34
+ #define XMEGA_NVM_CMD_ERASEWRITEEEPROMPAGE 0x35
+ #define XMEGA_NVM_CMD_READEEPROM 0x06
+
+ /* Function Prototypes: */
+ bool XMEGANVM_WaitWhileNVMBusBusy(void);
+ bool XMEGANVM_WaitWhileNVMControllerBusy(void);
+ bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest);
+ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize);
+ bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t Byte);
+ bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t EraseBuffCommand,
+ const uint8_t WritePageCommand, const uint8_t PageMode, const uint32_t WriteAddress,
+ const uint8_t* WriteBuffer, uint16_t WriteSize);
+ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address);
+
+ #if defined(INCLUDE_FROM_XMEGANVM_C)
+ static void XMEGANVM_SendNVMRegAddress(const uint8_t Register);
+ static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress);
+ #endif
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
index cc521ce87..7a4b1a547 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
@@ -1,514 +1,514 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * XPROG Protocol handler, to process V2 Protocol wrapped XPROG commands used in Atmel programmer devices.
- */
-
-#define INCLUDE_FROM_XPROGPROTOCOL_C
-#include "XPROGProtocol.h"
-
-#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
-/** Base absolute address for the target's NVM controller for PDI programming */
-uint32_t XPROG_Param_NVMBase = 0x010001C0;
-
-/** Size in bytes of the target's EEPROM page */
-uint16_t XPROG_Param_EEPageSize;
-
-/** Address of the TPI device's NVMCMD register for TPI programming */
-uint8_t XPROG_Param_NVMCMDRegAddr;
-
-/** Address of the TPI device's NVMCSR register for TPI programming */
-uint8_t XPROG_Param_NVMCSRRegAddr;
-
-/** Currently selected XPROG programming protocol */
-uint8_t XPROG_SelectedProtocol = XPRG_PROTOCOL_PDI;
-
-/** Handler for the CMD_XPROG_SETMODE command, which sets the programmer-to-target protocol used for PDI/TPI
- * programming.
- */
-void XPROGProtocol_SetMode(void)
-{
- struct
- {
- uint8_t Protocol;
- } SetMode_XPROG_Params;
-
- Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- XPROG_SelectedProtocol = SetMode_XPROG_Params.Protocol;
-
- Endpoint_Write_Byte(CMD_XPROG_SETMODE);
- Endpoint_Write_Byte((SetMode_XPROG_Params.Protocol != XPRG_PROTOCOL_JTAG) ? STATUS_CMD_OK : STATUS_CMD_FAILED);
- Endpoint_ClearIN();
-}
-
-/** Handler for the CMD_XPROG command, which wraps up XPROG commands in a V2 wrapper which need to be
- * removed and processed so that the underlying XPROG command can be handled.
- */
-void XPROGProtocol_Command(void)
-{
- uint8_t XPROGCommand = Endpoint_Read_Byte();
-
- switch (XPROGCommand)
- {
- case XPRG_CMD_ENTER_PROGMODE:
- XPROGProtocol_EnterXPROGMode();
- break;
- case XPRG_CMD_LEAVE_PROGMODE:
- XPROGProtocol_LeaveXPROGMode();
- break;
- case XPRG_CMD_ERASE:
- XPROGProtocol_Erase();
- break;
- case XPRG_CMD_WRITE_MEM:
- XPROGProtocol_WriteMemory();
- break;
- case XPRG_CMD_READ_MEM:
- XPROGProtocol_ReadMemory();
- break;
- case XPRG_CMD_CRC:
- XPROGProtocol_ReadCRC();
- break;
- case XPRG_CMD_SET_PARAM:
- XPROGProtocol_SetParam();
- break;
- }
-}
-
-/** Handler for the XPROG ENTER_PROGMODE command to establish a connection with the attached device. */
-static void XPROGProtocol_EnterXPROGMode(void)
-{
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- bool NVMBusEnabled;
-
- if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
- /* Enable PDI programming mode with the attached target */
- XPROGTarget_EnableTargetPDI();
-
- /* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
- XPROGTarget_SendByte(PDI_RESET_KEY);
-
- /* Lower direction change guard time to 0 USART bits */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
- XPROGTarget_SendByte(0x07);
-
- /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
- XPROGTarget_SendByte(PDI_CMD_KEY);
- for (uint8_t i = sizeof(PDI_NVMENABLE_KEY); i > 0; i--)
- XPROGTarget_SendByte(PDI_NVMENABLE_KEY[i - 1]);
-
- /* Wait until the NVM bus becomes active */
- NVMBusEnabled = XMEGANVM_WaitWhileNVMBusBusy();
- }
- else
- {
- /* Enable TPI programming mode with the attached target */
- XPROGTarget_EnableTargetTPI();
-
- /* Lower direction change guard time to 0 USART bits */
- XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
- XPROGTarget_SendByte(0x07);
-
- /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
- XPROGTarget_SendByte(TPI_CMD_SKEY);
- for (uint8_t i = sizeof(TPI_NVMENABLE_KEY); i > 0; i--)
- XPROGTarget_SendByte(TPI_NVMENABLE_KEY[i - 1]);
-
- /* Wait until the NVM bus becomes active */
- NVMBusEnabled = TINYNVM_WaitWhileNVMBusBusy();
- }
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_ENTER_PROGMODE);
- Endpoint_Write_Byte(NVMBusEnabled ? XPRG_ERR_OK : XPRG_ERR_FAILED);
- Endpoint_ClearIN();
-}
-
-/** Handler for the XPROG LEAVE_PROGMODE command to terminate the PDI programming connection with
- * the attached device.
- */
-static void XPROGProtocol_LeaveXPROGMode(void)
-{
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
- XMEGANVM_WaitWhileNVMBusBusy();
-
- /* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
- XPROGTarget_SendByte(0x00);
-
- /* Do it twice to make sure it takes affect (silicon bug?) */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
- XPROGTarget_SendByte(0x00);
-
- XPROGTarget_DisableTargetPDI();
- }
- else
- {
- TINYNVM_WaitWhileNVMBusBusy();
-
- /* Clear the NVMEN bit in the TPI CONTROL register to disable TPI mode */
- XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
- XPROGTarget_SendByte(0x00);
-
- XPROGTarget_DisableTargetTPI();
- }
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_LEAVE_PROGMODE);
- Endpoint_Write_Byte(XPRG_ERR_OK);
- Endpoint_ClearIN();
-}
-
-/** Handler for the XPRG ERASE command to erase a specific memory address space in the attached device. */
-static void XPROGProtocol_Erase(void)
-{
- uint8_t ReturnStatus = XPRG_ERR_OK;
-
- struct
- {
- uint8_t MemoryType;
- uint32_t Address;
- } Erase_XPROG_Params;
-
- Endpoint_Read_Stream_LE(&Erase_XPROG_Params, sizeof(Erase_XPROG_Params), NO_STREAM_CALLBACK);
- Erase_XPROG_Params.Address = SwapEndian_32(Erase_XPROG_Params.Address);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint8_t EraseCommand;
-
- if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
- /* Determine which NVM command to send to the device depending on the memory to erase */
- switch (Erase_XPROG_Params.MemoryType)
- {
- case XPRG_ERASE_CHIP:
- EraseCommand = XMEGA_NVM_CMD_CHIPERASE;
- break;
- case XPRG_ERASE_APP:
- EraseCommand = XMEGA_NVM_CMD_ERASEAPPSEC;
- break;
- case XPRG_ERASE_BOOT:
- EraseCommand = XMEGA_NVM_CMD_ERASEBOOTSEC;
- break;
- case XPRG_ERASE_EEPROM:
- EraseCommand = XMEGA_NVM_CMD_ERASEEEPROM;
- break;
- case XPRG_ERASE_APP_PAGE:
- EraseCommand = XMEGA_NVM_CMD_ERASEAPPSECPAGE;
- break;
- case XPRG_ERASE_BOOT_PAGE:
- EraseCommand = XMEGA_NVM_CMD_ERASEBOOTSECPAGE;
- break;
- case XPRG_ERASE_EEPROM_PAGE:
- EraseCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGE;
- break;
- case XPRG_ERASE_USERSIG:
- EraseCommand = XMEGA_NVM_CMD_ERASEUSERSIG;
- break;
- default:
- EraseCommand = XMEGA_NVM_CMD_NOOP;
- break;
- }
-
- /* Erase the target memory, indicate timeout if ocurred */
- if (!(XMEGANVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
- else
- {
- if (Erase_XPROG_Params.MemoryType == XPRG_ERASE_CHIP)
- EraseCommand = TINY_NVM_CMD_CHIPERASE;
- else
- EraseCommand = TINY_NVM_CMD_SECTIONERASE;
-
- /* Erase the target memory, indicate timeout if ocurred */
- if (!(TINYNVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_ERASE);
- Endpoint_Write_Byte(ReturnStatus);
- Endpoint_ClearIN();
-}
-
-/** Handler for the XPROG WRITE_MEMORY command to write to a specific memory space within the attached device. */
-static void XPROGProtocol_WriteMemory(void)
-{
- uint8_t ReturnStatus = XPRG_ERR_OK;
-
- struct
- {
- uint8_t MemoryType;
- uint8_t PageMode;
- uint32_t Address;
- uint16_t Length;
- uint8_t ProgData[256];
- } WriteMemory_XPROG_Params;
-
- Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params, (sizeof(WriteMemory_XPROG_Params) -
- sizeof(WriteMemory_XPROG_Params).ProgData), NO_STREAM_CALLBACK);
- WriteMemory_XPROG_Params.Address = SwapEndian_32(WriteMemory_XPROG_Params.Address);
- WriteMemory_XPROG_Params.Length = SwapEndian_16(WriteMemory_XPROG_Params.Length);
- Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
- /* Assume FLASH page programming by default, as it is the common case */
- uint8_t WriteCommand = XMEGA_NVM_CMD_WRITEFLASHPAGE;
- uint8_t WriteBuffCommand = XMEGA_NVM_CMD_LOADFLASHPAGEBUFF;
- uint8_t EraseBuffCommand = XMEGA_NVM_CMD_ERASEFLASHPAGEBUFF;
- bool PagedMemory = true;
-
- switch (WriteMemory_XPROG_Params.MemoryType)
- {
- case XPRG_MEM_TYPE_APPL:
- WriteCommand = XMEGA_NVM_CMD_WRITEAPPSECPAGE;
- break;
- case XPRG_MEM_TYPE_BOOT:
- WriteCommand = XMEGA_NVM_CMD_WRITEBOOTSECPAGE;
- break;
- case XPRG_MEM_TYPE_EEPROM:
- WriteCommand = XMEGA_NVM_CMD_WRITEEEPROMPAGE;
- WriteBuffCommand = XMEGA_NVM_CMD_LOADEEPROMPAGEBUFF;
- EraseBuffCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF;
- break;
- case XPRG_MEM_TYPE_USERSIG:
- /* User signature is paged, but needs us to manually indicate the mode bits since the host doesn't set them */
- WriteMemory_XPROG_Params.PageMode = (XPRG_PAGEMODE_ERASE | XPRG_PAGEMODE_WRITE);
- WriteCommand = XMEGA_NVM_CMD_WRITEUSERSIG;
- break;
- case XPRG_MEM_TYPE_FUSE:
- WriteCommand = XMEGA_NVM_CMD_WRITEFUSE;
- PagedMemory = false;
- break;
- case XPRG_MEM_TYPE_LOCKBITS:
- WriteCommand = XMEGA_NVM_CMD_WRITELOCK;
- PagedMemory = false;
- break;
- }
-
- /* Send the appropriate memory write commands to the device, indicate timeout if occurred */
- if ((PagedMemory && !(XMEGANVM_WritePageMemory(WriteBuffCommand, EraseBuffCommand, WriteCommand,
- WriteMemory_XPROG_Params.PageMode, WriteMemory_XPROG_Params.Address,
- WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length))) ||
- (!PagedMemory && !(XMEGANVM_WriteByteMemory(WriteCommand, WriteMemory_XPROG_Params.Address,
- WriteMemory_XPROG_Params.ProgData[0]))))
- {
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
- }
- else
- {
- /* Send write command to the TPI device, indicate timeout if occurred */
- if (!(TINYNVM_WriteMemory(WriteMemory_XPROG_Params.Address, WriteMemory_XPROG_Params.ProgData,
- WriteMemory_XPROG_Params.Length)))
- {
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
- }
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_WRITE_MEM);
- Endpoint_Write_Byte(ReturnStatus);
- Endpoint_ClearIN();
-}
-
-/** Handler for the XPROG READ_MEMORY command to read data from a specific address space within the
- * attached device.
- */
-static void XPROGProtocol_ReadMemory(void)
-{
- uint8_t ReturnStatus = XPRG_ERR_OK;
-
- struct
- {
- uint8_t MemoryType;
- uint32_t Address;
- uint16_t Length;
- } ReadMemory_XPROG_Params;
-
- Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NO_STREAM_CALLBACK);
- ReadMemory_XPROG_Params.Address = SwapEndian_32(ReadMemory_XPROG_Params.Address);
- ReadMemory_XPROG_Params.Length = SwapEndian_16(ReadMemory_XPROG_Params.Length);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint8_t ReadBuffer[256];
-
- if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
- /* Read the PDI target's memory, indicate timeout if occurred */
- if (!(XMEGANVM_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length)))
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
- else
- {
- /* Read the TPI target's memory, indicate timeout if occurred */
- if (!(TINYNVM_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length)))
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_READ_MEM);
- Endpoint_Write_Byte(ReturnStatus);
-
- if (ReturnStatus == XPRG_ERR_OK)
- Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
-
- Endpoint_ClearIN();
-}
-
-/** Handler for the XPROG CRC command to read a specific memory space's CRC value for comparison between the
- * attached device's memory and a data set on the host.
- */
-static void XPROGProtocol_ReadCRC(void)
-{
- uint8_t ReturnStatus = XPRG_ERR_OK;
-
- struct
- {
- uint8_t CRCType;
- } ReadCRC_XPROG_Params;
-
- Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NO_STREAM_CALLBACK);
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- uint32_t MemoryCRC;
-
- if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
- uint8_t CRCCommand;
-
- /* Determine which NVM command to send to the device depending on the memory to CRC */
- switch (ReadCRC_XPROG_Params.CRCType)
- {
- case XPRG_CRC_APP:
- CRCCommand = XMEGA_NVM_CMD_APPCRC;
- break;
- case XPRG_CRC_BOOT:
- CRCCommand = XMEGA_NVM_CMD_BOOTCRC;
- break;
- default:
- CRCCommand = XMEGA_NVM_CMD_FLASHCRC;
- break;
- }
-
- /* Perform and retrieve the memory CRC, indicate timeout if occurred */
- if (!(XMEGANVM_GetMemoryCRC(CRCCommand, &MemoryCRC)))
- ReturnStatus = XPRG_ERR_TIMEOUT;
- }
- else
- {
- /* TPI does not support memory CRC */
- ReturnStatus = XPRG_ERR_FAILED;
- }
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_CRC);
- Endpoint_Write_Byte(ReturnStatus);
-
- if (ReturnStatus == XPRG_ERR_OK)
- {
- Endpoint_Write_Byte(MemoryCRC >> 16);
- Endpoint_Write_Word_LE(MemoryCRC & 0xFFFF);
- }
-
- Endpoint_ClearIN();
-}
-
-/** Handler for the XPROG SET_PARAM command to set a XPROG parameter for use when communicating with the
- * attached device.
- */
-static void XPROGProtocol_SetParam(void)
-{
- uint8_t ReturnStatus = XPRG_ERR_OK;
-
- uint8_t XPROGParam = Endpoint_Read_Byte();
-
- /* Determine which parameter is being set, store the new parameter value */
- switch (XPROGParam)
- {
- case XPRG_PARAM_NVMBASE:
- XPROG_Param_NVMBase = Endpoint_Read_DWord_BE();
- break;
- case XPRG_PARAM_EEPPAGESIZE:
- XPROG_Param_EEPageSize = Endpoint_Read_Word_BE();
- break;
- case XPRG_PARAM_NVMCMD_REG:
- XPROG_Param_NVMCMDRegAddr = Endpoint_Read_Byte();
- break;
- case XPRG_PARAM_NVMCSR_REG:
- XPROG_Param_NVMCSRRegAddr = Endpoint_Read_Byte();
- break;
- default:
- ReturnStatus = XPRG_ERR_FAILED;
- break;
- }
-
- Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
- Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- Endpoint_Write_Byte(CMD_XPROG);
- Endpoint_Write_Byte(XPRG_CMD_SET_PARAM);
- Endpoint_Write_Byte(ReturnStatus);
- Endpoint_ClearIN();
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * XPROG Protocol handler, to process V2 Protocol wrapped XPROG commands used in Atmel programmer devices.
+ */
+
+#define INCLUDE_FROM_XPROGPROTOCOL_C
+#include "XPROGProtocol.h"
+
+#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
+/** Base absolute address for the target's NVM controller for PDI programming */
+uint32_t XPROG_Param_NVMBase = 0x010001C0;
+
+/** Size in bytes of the target's EEPROM page */
+uint16_t XPROG_Param_EEPageSize;
+
+/** Address of the TPI device's NVMCMD register for TPI programming */
+uint8_t XPROG_Param_NVMCMDRegAddr;
+
+/** Address of the TPI device's NVMCSR register for TPI programming */
+uint8_t XPROG_Param_NVMCSRRegAddr;
+
+/** Currently selected XPROG programming protocol */
+uint8_t XPROG_SelectedProtocol = XPRG_PROTOCOL_PDI;
+
+/** Handler for the CMD_XPROG_SETMODE command, which sets the programmer-to-target protocol used for PDI/TPI
+ * programming.
+ */
+void XPROGProtocol_SetMode(void)
+{
+ struct
+ {
+ uint8_t Protocol;
+ } SetMode_XPROG_Params;
+
+ Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ XPROG_SelectedProtocol = SetMode_XPROG_Params.Protocol;
+
+ Endpoint_Write_Byte(CMD_XPROG_SETMODE);
+ Endpoint_Write_Byte((SetMode_XPROG_Params.Protocol != XPRG_PROTOCOL_JTAG) ? STATUS_CMD_OK : STATUS_CMD_FAILED);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the CMD_XPROG command, which wraps up XPROG commands in a V2 wrapper which need to be
+ * removed and processed so that the underlying XPROG command can be handled.
+ */
+void XPROGProtocol_Command(void)
+{
+ uint8_t XPROGCommand = Endpoint_Read_Byte();
+
+ switch (XPROGCommand)
+ {
+ case XPRG_CMD_ENTER_PROGMODE:
+ XPROGProtocol_EnterXPROGMode();
+ break;
+ case XPRG_CMD_LEAVE_PROGMODE:
+ XPROGProtocol_LeaveXPROGMode();
+ break;
+ case XPRG_CMD_ERASE:
+ XPROGProtocol_Erase();
+ break;
+ case XPRG_CMD_WRITE_MEM:
+ XPROGProtocol_WriteMemory();
+ break;
+ case XPRG_CMD_READ_MEM:
+ XPROGProtocol_ReadMemory();
+ break;
+ case XPRG_CMD_CRC:
+ XPROGProtocol_ReadCRC();
+ break;
+ case XPRG_CMD_SET_PARAM:
+ XPROGProtocol_SetParam();
+ break;
+ }
+}
+
+/** Handler for the XPROG ENTER_PROGMODE command to establish a connection with the attached device. */
+static void XPROGProtocol_EnterXPROGMode(void)
+{
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ bool NVMBusEnabled;
+
+ if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
+ {
+ /* Enable PDI programming mode with the attached target */
+ XPROGTarget_EnableTargetPDI();
+
+ /* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(PDI_RESET_KEY);
+
+ /* Lower direction change guard time to 0 USART bits */
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
+ XPROGTarget_SendByte(0x07);
+
+ /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
+ XPROGTarget_SendByte(PDI_CMD_KEY);
+ for (uint8_t i = sizeof(PDI_NVMENABLE_KEY); i > 0; i--)
+ XPROGTarget_SendByte(PDI_NVMENABLE_KEY[i - 1]);
+
+ /* Wait until the NVM bus becomes active */
+ NVMBusEnabled = XMEGANVM_WaitWhileNVMBusBusy();
+ }
+ else
+ {
+ /* Enable TPI programming mode with the attached target */
+ XPROGTarget_EnableTargetTPI();
+
+ /* Lower direction change guard time to 0 USART bits */
+ XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
+ XPROGTarget_SendByte(0x07);
+
+ /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
+ XPROGTarget_SendByte(TPI_CMD_SKEY);
+ for (uint8_t i = sizeof(TPI_NVMENABLE_KEY); i > 0; i--)
+ XPROGTarget_SendByte(TPI_NVMENABLE_KEY[i - 1]);
+
+ /* Wait until the NVM bus becomes active */
+ NVMBusEnabled = TINYNVM_WaitWhileNVMBusBusy();
+ }
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_ENTER_PROGMODE);
+ Endpoint_Write_Byte(NVMBusEnabled ? XPRG_ERR_OK : XPRG_ERR_FAILED);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the XPROG LEAVE_PROGMODE command to terminate the PDI programming connection with
+ * the attached device.
+ */
+static void XPROGProtocol_LeaveXPROGMode(void)
+{
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
+ {
+ XMEGANVM_WaitWhileNVMBusBusy();
+
+ /* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(0x00);
+
+ /* Do it twice to make sure it takes affect (silicon bug?) */
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(0x00);
+
+ XPROGTarget_DisableTargetPDI();
+ }
+ else
+ {
+ TINYNVM_WaitWhileNVMBusBusy();
+
+ /* Clear the NVMEN bit in the TPI CONTROL register to disable TPI mode */
+ XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
+ XPROGTarget_SendByte(0x00);
+
+ XPROGTarget_DisableTargetTPI();
+ }
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_LEAVE_PROGMODE);
+ Endpoint_Write_Byte(XPRG_ERR_OK);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the XPRG ERASE command to erase a specific memory address space in the attached device. */
+static void XPROGProtocol_Erase(void)
+{
+ uint8_t ReturnStatus = XPRG_ERR_OK;
+
+ struct
+ {
+ uint8_t MemoryType;
+ uint32_t Address;
+ } Erase_XPROG_Params;
+
+ Endpoint_Read_Stream_LE(&Erase_XPROG_Params, sizeof(Erase_XPROG_Params), NO_STREAM_CALLBACK);
+ Erase_XPROG_Params.Address = SwapEndian_32(Erase_XPROG_Params.Address);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint8_t EraseCommand;
+
+ if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
+ {
+ /* Determine which NVM command to send to the device depending on the memory to erase */
+ switch (Erase_XPROG_Params.MemoryType)
+ {
+ case XPRG_ERASE_CHIP:
+ EraseCommand = XMEGA_NVM_CMD_CHIPERASE;
+ break;
+ case XPRG_ERASE_APP:
+ EraseCommand = XMEGA_NVM_CMD_ERASEAPPSEC;
+ break;
+ case XPRG_ERASE_BOOT:
+ EraseCommand = XMEGA_NVM_CMD_ERASEBOOTSEC;
+ break;
+ case XPRG_ERASE_EEPROM:
+ EraseCommand = XMEGA_NVM_CMD_ERASEEEPROM;
+ break;
+ case XPRG_ERASE_APP_PAGE:
+ EraseCommand = XMEGA_NVM_CMD_ERASEAPPSECPAGE;
+ break;
+ case XPRG_ERASE_BOOT_PAGE:
+ EraseCommand = XMEGA_NVM_CMD_ERASEBOOTSECPAGE;
+ break;
+ case XPRG_ERASE_EEPROM_PAGE:
+ EraseCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGE;
+ break;
+ case XPRG_ERASE_USERSIG:
+ EraseCommand = XMEGA_NVM_CMD_ERASEUSERSIG;
+ break;
+ default:
+ EraseCommand = XMEGA_NVM_CMD_NOOP;
+ break;
+ }
+
+ /* Erase the target memory, indicate timeout if ocurred */
+ if (!(XMEGANVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+ else
+ {
+ if (Erase_XPROG_Params.MemoryType == XPRG_ERASE_CHIP)
+ EraseCommand = TINY_NVM_CMD_CHIPERASE;
+ else
+ EraseCommand = TINY_NVM_CMD_SECTIONERASE;
+
+ /* Erase the target memory, indicate timeout if ocurred */
+ if (!(TINYNVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_ERASE);
+ Endpoint_Write_Byte(ReturnStatus);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the XPROG WRITE_MEMORY command to write to a specific memory space within the attached device. */
+static void XPROGProtocol_WriteMemory(void)
+{
+ uint8_t ReturnStatus = XPRG_ERR_OK;
+
+ struct
+ {
+ uint8_t MemoryType;
+ uint8_t PageMode;
+ uint32_t Address;
+ uint16_t Length;
+ uint8_t ProgData[256];
+ } WriteMemory_XPROG_Params;
+
+ Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params, (sizeof(WriteMemory_XPROG_Params) -
+ sizeof(WriteMemory_XPROG_Params).ProgData), NO_STREAM_CALLBACK);
+ WriteMemory_XPROG_Params.Address = SwapEndian_32(WriteMemory_XPROG_Params.Address);
+ WriteMemory_XPROG_Params.Length = SwapEndian_16(WriteMemory_XPROG_Params.Length);
+ Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
+ {
+ /* Assume FLASH page programming by default, as it is the common case */
+ uint8_t WriteCommand = XMEGA_NVM_CMD_WRITEFLASHPAGE;
+ uint8_t WriteBuffCommand = XMEGA_NVM_CMD_LOADFLASHPAGEBUFF;
+ uint8_t EraseBuffCommand = XMEGA_NVM_CMD_ERASEFLASHPAGEBUFF;
+ bool PagedMemory = true;
+
+ switch (WriteMemory_XPROG_Params.MemoryType)
+ {
+ case XPRG_MEM_TYPE_APPL:
+ WriteCommand = XMEGA_NVM_CMD_WRITEAPPSECPAGE;
+ break;
+ case XPRG_MEM_TYPE_BOOT:
+ WriteCommand = XMEGA_NVM_CMD_WRITEBOOTSECPAGE;
+ break;
+ case XPRG_MEM_TYPE_EEPROM:
+ WriteCommand = XMEGA_NVM_CMD_WRITEEEPROMPAGE;
+ WriteBuffCommand = XMEGA_NVM_CMD_LOADEEPROMPAGEBUFF;
+ EraseBuffCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF;
+ break;
+ case XPRG_MEM_TYPE_USERSIG:
+ /* User signature is paged, but needs us to manually indicate the mode bits since the host doesn't set them */
+ WriteMemory_XPROG_Params.PageMode = (XPRG_PAGEMODE_ERASE | XPRG_PAGEMODE_WRITE);
+ WriteCommand = XMEGA_NVM_CMD_WRITEUSERSIG;
+ break;
+ case XPRG_MEM_TYPE_FUSE:
+ WriteCommand = XMEGA_NVM_CMD_WRITEFUSE;
+ PagedMemory = false;
+ break;
+ case XPRG_MEM_TYPE_LOCKBITS:
+ WriteCommand = XMEGA_NVM_CMD_WRITELOCK;
+ PagedMemory = false;
+ break;
+ }
+
+ /* Send the appropriate memory write commands to the device, indicate timeout if occurred */
+ if ((PagedMemory && !(XMEGANVM_WritePageMemory(WriteBuffCommand, EraseBuffCommand, WriteCommand,
+ WriteMemory_XPROG_Params.PageMode, WriteMemory_XPROG_Params.Address,
+ WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length))) ||
+ (!PagedMemory && !(XMEGANVM_WriteByteMemory(WriteCommand, WriteMemory_XPROG_Params.Address,
+ WriteMemory_XPROG_Params.ProgData[0]))))
+ {
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+ }
+ else
+ {
+ /* Send write command to the TPI device, indicate timeout if occurred */
+ if (!(TINYNVM_WriteMemory(WriteMemory_XPROG_Params.Address, WriteMemory_XPROG_Params.ProgData,
+ WriteMemory_XPROG_Params.Length)))
+ {
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+ }
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_WRITE_MEM);
+ Endpoint_Write_Byte(ReturnStatus);
+ Endpoint_ClearIN();
+}
+
+/** Handler for the XPROG READ_MEMORY command to read data from a specific address space within the
+ * attached device.
+ */
+static void XPROGProtocol_ReadMemory(void)
+{
+ uint8_t ReturnStatus = XPRG_ERR_OK;
+
+ struct
+ {
+ uint8_t MemoryType;
+ uint32_t Address;
+ uint16_t Length;
+ } ReadMemory_XPROG_Params;
+
+ Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NO_STREAM_CALLBACK);
+ ReadMemory_XPROG_Params.Address = SwapEndian_32(ReadMemory_XPROG_Params.Address);
+ ReadMemory_XPROG_Params.Length = SwapEndian_16(ReadMemory_XPROG_Params.Length);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint8_t ReadBuffer[256];
+
+ if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
+ {
+ /* Read the PDI target's memory, indicate timeout if occurred */
+ if (!(XMEGANVM_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length)))
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+ else
+ {
+ /* Read the TPI target's memory, indicate timeout if occurred */
+ if (!(TINYNVM_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length)))
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_READ_MEM);
+ Endpoint_Write_Byte(ReturnStatus);
+
+ if (ReturnStatus == XPRG_ERR_OK)
+ Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
+
+ Endpoint_ClearIN();
+}
+
+/** Handler for the XPROG CRC command to read a specific memory space's CRC value for comparison between the
+ * attached device's memory and a data set on the host.
+ */
+static void XPROGProtocol_ReadCRC(void)
+{
+ uint8_t ReturnStatus = XPRG_ERR_OK;
+
+ struct
+ {
+ uint8_t CRCType;
+ } ReadCRC_XPROG_Params;
+
+ Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NO_STREAM_CALLBACK);
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ uint32_t MemoryCRC;
+
+ if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
+ {
+ uint8_t CRCCommand;
+
+ /* Determine which NVM command to send to the device depending on the memory to CRC */
+ switch (ReadCRC_XPROG_Params.CRCType)
+ {
+ case XPRG_CRC_APP:
+ CRCCommand = XMEGA_NVM_CMD_APPCRC;
+ break;
+ case XPRG_CRC_BOOT:
+ CRCCommand = XMEGA_NVM_CMD_BOOTCRC;
+ break;
+ default:
+ CRCCommand = XMEGA_NVM_CMD_FLASHCRC;
+ break;
+ }
+
+ /* Perform and retrieve the memory CRC, indicate timeout if occurred */
+ if (!(XMEGANVM_GetMemoryCRC(CRCCommand, &MemoryCRC)))
+ ReturnStatus = XPRG_ERR_TIMEOUT;
+ }
+ else
+ {
+ /* TPI does not support memory CRC */
+ ReturnStatus = XPRG_ERR_FAILED;
+ }
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_CRC);
+ Endpoint_Write_Byte(ReturnStatus);
+
+ if (ReturnStatus == XPRG_ERR_OK)
+ {
+ Endpoint_Write_Byte(MemoryCRC >> 16);
+ Endpoint_Write_Word_LE(MemoryCRC & 0xFFFF);
+ }
+
+ Endpoint_ClearIN();
+}
+
+/** Handler for the XPROG SET_PARAM command to set a XPROG parameter for use when communicating with the
+ * attached device.
+ */
+static void XPROGProtocol_SetParam(void)
+{
+ uint8_t ReturnStatus = XPRG_ERR_OK;
+
+ uint8_t XPROGParam = Endpoint_Read_Byte();
+
+ /* Determine which parameter is being set, store the new parameter value */
+ switch (XPROGParam)
+ {
+ case XPRG_PARAM_NVMBASE:
+ XPROG_Param_NVMBase = Endpoint_Read_DWord_BE();
+ break;
+ case XPRG_PARAM_EEPPAGESIZE:
+ XPROG_Param_EEPageSize = Endpoint_Read_Word_BE();
+ break;
+ case XPRG_PARAM_NVMCMD_REG:
+ XPROG_Param_NVMCMDRegAddr = Endpoint_Read_Byte();
+ break;
+ case XPRG_PARAM_NVMCSR_REG:
+ XPROG_Param_NVMCSRRegAddr = Endpoint_Read_Byte();
+ break;
+ default:
+ ReturnStatus = XPRG_ERR_FAILED;
+ break;
+ }
+
+ Endpoint_ClearOUT();
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(CMD_XPROG);
+ Endpoint_Write_Byte(XPRG_CMD_SET_PARAM);
+ Endpoint_Write_Byte(ReturnStatus);
+ Endpoint_ClearIN();
+}
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
index 8e5d1b06d..1fdb5a1b8 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
@@ -1,132 +1,132 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 XPROGProtocol.c.
- */
-
-#ifndef _XPROG_PROTOCOL_
-#define _XPROG_PROTOCOL_
-
- /* Includes: */
- #include <avr/io.h>
- #include <util/delay.h>
- #include <stdio.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/Peripheral/SerialStream.h>
-
- #include "../V2Protocol.h"
- #include "XPROGTarget.h"
- #include "XMEGANVM.h"
- #include "TINYNVM.h"
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /* Macros: */
- #define XPRG_CMD_ENTER_PROGMODE 0x01
- #define XPRG_CMD_LEAVE_PROGMODE 0x02
- #define XPRG_CMD_ERASE 0x03
- #define XPRG_CMD_WRITE_MEM 0x04
- #define XPRG_CMD_READ_MEM 0x05
- #define XPRG_CMD_CRC 0x06
- #define XPRG_CMD_SET_PARAM 0x07
-
- #define XPRG_MEM_TYPE_APPL 1
- #define XPRG_MEM_TYPE_BOOT 2
- #define XPRG_MEM_TYPE_EEPROM 3
- #define XPRG_MEM_TYPE_FUSE 4
- #define XPRG_MEM_TYPE_LOCKBITS 5
- #define XPRG_MEM_TYPE_USERSIG 6
- #define XPRG_MEM_TYPE_FACTORY_CALIBRATION 7
-
- #define XPRG_ERASE_CHIP 1
- #define XPRG_ERASE_APP 2
- #define XPRG_ERASE_BOOT 3
- #define XPRG_ERASE_EEPROM 4
- #define XPRG_ERASE_APP_PAGE 5
- #define XPRG_ERASE_BOOT_PAGE 6
- #define XPRG_ERASE_EEPROM_PAGE 7
- #define XPRG_ERASE_USERSIG 8
-
- #define XPRG_MEM_WRITE_ERASE 0
- #define XPRG_MEM_WRITE_WRITE 1
-
- #define XPRG_CRC_APP 1
- #define XPRG_CRC_BOOT 2
- #define XPRG_CRC_FLASH 3
-
- #define XPRG_ERR_OK 0
- #define XPRG_ERR_FAILED 1
- #define XPRG_ERR_COLLISION 2
- #define XPRG_ERR_TIMEOUT 3
-
- #define XPRG_PARAM_NVMBASE 0x01
- #define XPRG_PARAM_EEPPAGESIZE 0x02
- #define XPRG_PARAM_NVMCMD_REG 0x03 /* Undocumented, Reverse-engineered */
- #define XPRG_PARAM_NVMCSR_REG 0x04 /* Undocumented, Reverse-engineered */
-
- #define XPRG_PROTOCOL_PDI 0x00
- #define XPRG_PROTOCOL_JTAG 0x01
- #define XPRG_PROTOCOL_TPI 0x02 /* Undocumented, Reverse-engineered */
-
- #define XPRG_PAGEMODE_WRITE (1 << 1)
- #define XPRG_PAGEMODE_ERASE (1 << 0)
-
- /* External Variables: */
- extern uint32_t XPROG_Param_NVMBase;
- extern uint16_t XPROG_Param_EEPageSize;
- extern uint8_t XPROG_Param_NVMCSRRegAddr;
- extern uint8_t XPROG_Param_NVMCMDRegAddr;
- extern uint8_t XPROG_SelectedProtocol;
-
- /* Function Prototypes: */
- void XPROGProtocol_SetMode(void);
- void XPROGProtocol_Command(void);
-
- #if defined(INCLUDE_FROM_XPROGPROTOCOL_C)
- static void XPROGProtocol_EnterXPROGMode(void);
- static void XPROGProtocol_LeaveXPROGMode(void);
- static void XPROGProtocol_SetParam(void);
- static void XPROGProtocol_Erase(void);
- static void XPROGProtocol_WriteMemory(void);
- static void XPROGProtocol_ReadMemory(void);
- static void XPROGProtocol_ReadCRC(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 XPROGProtocol.c.
+ */
+
+#ifndef _XPROG_PROTOCOL_
+#define _XPROG_PROTOCOL_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <util/delay.h>
+ #include <stdio.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Peripheral/SerialStream.h>
+
+ #include "../V2Protocol.h"
+ #include "XPROGTarget.h"
+ #include "XMEGANVM.h"
+ #include "TINYNVM.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /* Macros: */
+ #define XPRG_CMD_ENTER_PROGMODE 0x01
+ #define XPRG_CMD_LEAVE_PROGMODE 0x02
+ #define XPRG_CMD_ERASE 0x03
+ #define XPRG_CMD_WRITE_MEM 0x04
+ #define XPRG_CMD_READ_MEM 0x05
+ #define XPRG_CMD_CRC 0x06
+ #define XPRG_CMD_SET_PARAM 0x07
+
+ #define XPRG_MEM_TYPE_APPL 1
+ #define XPRG_MEM_TYPE_BOOT 2
+ #define XPRG_MEM_TYPE_EEPROM 3
+ #define XPRG_MEM_TYPE_FUSE 4
+ #define XPRG_MEM_TYPE_LOCKBITS 5
+ #define XPRG_MEM_TYPE_USERSIG 6
+ #define XPRG_MEM_TYPE_FACTORY_CALIBRATION 7
+
+ #define XPRG_ERASE_CHIP 1
+ #define XPRG_ERASE_APP 2
+ #define XPRG_ERASE_BOOT 3
+ #define XPRG_ERASE_EEPROM 4
+ #define XPRG_ERASE_APP_PAGE 5
+ #define XPRG_ERASE_BOOT_PAGE 6
+ #define XPRG_ERASE_EEPROM_PAGE 7
+ #define XPRG_ERASE_USERSIG 8
+
+ #define XPRG_MEM_WRITE_ERASE 0
+ #define XPRG_MEM_WRITE_WRITE 1
+
+ #define XPRG_CRC_APP 1
+ #define XPRG_CRC_BOOT 2
+ #define XPRG_CRC_FLASH 3
+
+ #define XPRG_ERR_OK 0
+ #define XPRG_ERR_FAILED 1
+ #define XPRG_ERR_COLLISION 2
+ #define XPRG_ERR_TIMEOUT 3
+
+ #define XPRG_PARAM_NVMBASE 0x01
+ #define XPRG_PARAM_EEPPAGESIZE 0x02
+ #define XPRG_PARAM_NVMCMD_REG 0x03 /* Undocumented, Reverse-engineered */
+ #define XPRG_PARAM_NVMCSR_REG 0x04 /* Undocumented, Reverse-engineered */
+
+ #define XPRG_PROTOCOL_PDI 0x00
+ #define XPRG_PROTOCOL_JTAG 0x01
+ #define XPRG_PROTOCOL_TPI 0x02 /* Undocumented, Reverse-engineered */
+
+ #define XPRG_PAGEMODE_WRITE (1 << 1)
+ #define XPRG_PAGEMODE_ERASE (1 << 0)
+
+ /* External Variables: */
+ extern uint32_t XPROG_Param_NVMBase;
+ extern uint16_t XPROG_Param_EEPageSize;
+ extern uint8_t XPROG_Param_NVMCSRRegAddr;
+ extern uint8_t XPROG_Param_NVMCMDRegAddr;
+ extern uint8_t XPROG_SelectedProtocol;
+
+ /* Function Prototypes: */
+ void XPROGProtocol_SetMode(void);
+ void XPROGProtocol_Command(void);
+
+ #if defined(INCLUDE_FROM_XPROGPROTOCOL_C)
+ static void XPROGProtocol_EnterXPROGMode(void);
+ static void XPROGProtocol_LeaveXPROGMode(void);
+ static void XPROGProtocol_SetParam(void);
+ static void XPROGProtocol_Erase(void);
+ static void XPROGProtocol_WriteMemory(void);
+ static void XPROGProtocol_ReadMemory(void);
+ static void XPROGProtocol_ReadCRC(void);
+ #endif
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
index 72a38f824..5598791a6 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -1,221 +1,221 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Target-related functions for the PDI Protocol decoder.
- */
-
-#define INCLUDE_FROM_XPROGTARGET_C
-#include "XPROGTarget.h"
-
-#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
-
-/** Flag to indicate if the USART is currently in Tx or Rx mode. */
-volatile bool IsSending;
-
-/** Enables the target's PDI interface, holding the target in reset until PDI mode is exited. */
-void XPROGTarget_EnableTargetPDI(void)
-{
- IsSending = false;
-
- /* Set Tx and XCK as outputs, Rx as input */
- DDRD |= (1 << 5) | (1 << 3);
- DDRD &= ~(1 << 2);
-
- /* Set DATA line high for at least 90ns to disable /RESET functionality */
- PORTD |= (1 << 3);
- _delay_us(1);
-
- /* Set up the synchronous USART for XMEGA communications - 8 data bits, even parity, 2 stop bits */
- UBRR1 = (F_CPU / XPROG_HARDWARE_SPEED);
- UCSR1B = (1 << TXEN1);
- UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
-
- /* Send two BREAKs of 12 bits each to enable PDI interface (need at least 16 idle bits) */
- XPROGTarget_SendBreak();
- XPROGTarget_SendBreak();
-}
-
-/** Enables the target's TPI interface, holding the target in reset until TPI mode is exited. */
-void XPROGTarget_EnableTargetTPI(void)
-{
- IsSending = false;
-
- /* Set /RESET line low for at least 400ns to enable TPI functionality */
- AUX_LINE_DDR |= AUX_LINE_MASK;
- AUX_LINE_PORT &= ~AUX_LINE_MASK;
- _delay_us(1);
-
- /* Set Tx and XCK as outputs, Rx as input */
- DDRD |= (1 << 5) | (1 << 3);
- DDRD &= ~(1 << 2);
-
- /* Set up the synchronous USART for TINY communications - 8 data bits, even parity, 2 stop bits */
- UBRR1 = (F_CPU / XPROG_HARDWARE_SPEED);
- UCSR1B = (1 << TXEN1);
- UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
-
- /* Send two BREAKs of 12 bits each to enable TPI interface (need at least 16 idle bits) */
- XPROGTarget_SendBreak();
- XPROGTarget_SendBreak();
-}
-
-/** Disables the target's PDI interface, exits programming mode and starts the target's application. */
-void XPROGTarget_DisableTargetPDI(void)
-{
- /* Switch to Rx mode to ensure that all pending transmissions are complete */
- XPROGTarget_SetRxMode();
-
- /* Turn off receiver and transmitter of the USART, clear settings */
- UCSR1A = ((1 << TXC1) | (1 << RXC1));
- UCSR1B = 0;
- UCSR1C = 0;
-
- /* Tristate all pins */
- DDRD &= ~((1 << 5) | (1 << 3));
- PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
-}
-
-/** Disables the target's TPI interface, exits programming mode and starts the target's application. */
-void XPROGTarget_DisableTargetTPI(void)
-{
- /* Switch to Rx mode to ensure that all pending transmissions are complete */
- XPROGTarget_SetRxMode();
-
- /* Turn off receiver and transmitter of the USART, clear settings */
- UCSR1A |= (1 << TXC1) | (1 << RXC1);
- UCSR1B = 0;
- UCSR1C = 0;
-
- /* Set all USART lines as input, tristate */
- DDRD &= ~((1 << 5) | (1 << 3));
- PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
-
- /* Tristate target /RESET line */
- AUX_LINE_DDR &= ~AUX_LINE_MASK;
- AUX_LINE_PORT &= ~AUX_LINE_MASK;
-}
-
-/** Sends a byte via the USART.
- *
- * \param[in] Byte Byte to send through the USART
- */
-void XPROGTarget_SendByte(const uint8_t Byte)
-{
- /* Switch to Tx mode if currently in Rx mode */
- if (!(IsSending))
- XPROGTarget_SetTxMode();
-
- /* Wait until there is space in the hardware Tx buffer before writing */
- while (!(UCSR1A & (1 << UDRE1)));
- UCSR1A |= (1 << TXC1);
- UDR1 = Byte;
-
- if (TimeoutMSRemaining)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-}
-
-/** Receives a byte via the software USART, blocking until data is received.
- *
- * \return Received byte from the USART
- */
-uint8_t XPROGTarget_ReceiveByte(void)
-{
- /* Switch to Rx mode if currently in Tx mode */
- if (IsSending)
- XPROGTarget_SetRxMode();
-
- /* Wait until a byte has been received before reading */
- while (!(UCSR1A & (1 << RXC1)) && TimeoutMSRemaining);
-
- if (TimeoutMSRemaining)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-
- return UDR1;
-}
-
-/** Sends a BREAK via the USART to the attached target, consisting of a full frame of idle bits. */
-void XPROGTarget_SendBreak(void)
-{
- /* Switch to Tx mode if currently in Rx mode */
- if (!(IsSending))
- XPROGTarget_SetTxMode();
-
- /* Need to do nothing for a full frame to send a BREAK */
- for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++)
- {
- /* Wait for a full cycle of the clock */
- while (PIND & (1 << 5));
- while (!(PIND & (1 << 5)));
- }
-
- if (TimeoutMSRemaining)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-}
-
-static void XPROGTarget_SetTxMode(void)
-{
- /* Wait for a full cycle of the clock */
- while (PIND & (1 << 5));
- while (!(PIND & (1 << 5)));
-
- PORTD |= (1 << 3);
- DDRD |= (1 << 3);
-
- UCSR1B &= ~(1 << RXEN1);
- UCSR1B |= (1 << TXEN1);
-
- IsSending = true;
-
- if (TimeoutMSRemaining)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-
- IsSending = true;
-}
-
-static void XPROGTarget_SetRxMode(void)
-{
- while (!(UCSR1A & (1 << TXC1)));
- UCSR1A |= (1 << TXC1);
-
- UCSR1B &= ~(1 << TXEN1);
- UCSR1B |= (1 << RXEN1);
-
- DDRD &= ~(1 << 3);
- PORTD &= ~(1 << 3);
-
- if (TimeoutMSRemaining)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-
- IsSending = false;
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Target-related functions for the PDI Protocol decoder.
+ */
+
+#define INCLUDE_FROM_XPROGTARGET_C
+#include "XPROGTarget.h"
+
+#if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)
+
+/** Flag to indicate if the USART is currently in Tx or Rx mode. */
+volatile bool IsSending;
+
+/** Enables the target's PDI interface, holding the target in reset until PDI mode is exited. */
+void XPROGTarget_EnableTargetPDI(void)
+{
+ IsSending = false;
+
+ /* Set Tx and XCK as outputs, Rx as input */
+ DDRD |= (1 << 5) | (1 << 3);
+ DDRD &= ~(1 << 2);
+
+ /* Set DATA line high for at least 90ns to disable /RESET functionality */
+ PORTD |= (1 << 3);
+ _delay_us(1);
+
+ /* Set up the synchronous USART for XMEGA communications - 8 data bits, even parity, 2 stop bits */
+ UBRR1 = (F_CPU / XPROG_HARDWARE_SPEED);
+ UCSR1B = (1 << TXEN1);
+ UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
+
+ /* Send two BREAKs of 12 bits each to enable PDI interface (need at least 16 idle bits) */
+ XPROGTarget_SendBreak();
+ XPROGTarget_SendBreak();
+}
+
+/** Enables the target's TPI interface, holding the target in reset until TPI mode is exited. */
+void XPROGTarget_EnableTargetTPI(void)
+{
+ IsSending = false;
+
+ /* Set /RESET line low for at least 400ns to enable TPI functionality */
+ AUX_LINE_DDR |= AUX_LINE_MASK;
+ AUX_LINE_PORT &= ~AUX_LINE_MASK;
+ _delay_us(1);
+
+ /* Set Tx and XCK as outputs, Rx as input */
+ DDRD |= (1 << 5) | (1 << 3);
+ DDRD &= ~(1 << 2);
+
+ /* Set up the synchronous USART for TINY communications - 8 data bits, even parity, 2 stop bits */
+ UBRR1 = (F_CPU / XPROG_HARDWARE_SPEED);
+ UCSR1B = (1 << TXEN1);
+ UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
+
+ /* Send two BREAKs of 12 bits each to enable TPI interface (need at least 16 idle bits) */
+ XPROGTarget_SendBreak();
+ XPROGTarget_SendBreak();
+}
+
+/** Disables the target's PDI interface, exits programming mode and starts the target's application. */
+void XPROGTarget_DisableTargetPDI(void)
+{
+ /* Switch to Rx mode to ensure that all pending transmissions are complete */
+ XPROGTarget_SetRxMode();
+
+ /* Turn off receiver and transmitter of the USART, clear settings */
+ UCSR1A = ((1 << TXC1) | (1 << RXC1));
+ UCSR1B = 0;
+ UCSR1C = 0;
+
+ /* Tristate all pins */
+ DDRD &= ~((1 << 5) | (1 << 3));
+ PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
+}
+
+/** Disables the target's TPI interface, exits programming mode and starts the target's application. */
+void XPROGTarget_DisableTargetTPI(void)
+{
+ /* Switch to Rx mode to ensure that all pending transmissions are complete */
+ XPROGTarget_SetRxMode();
+
+ /* Turn off receiver and transmitter of the USART, clear settings */
+ UCSR1A |= (1 << TXC1) | (1 << RXC1);
+ UCSR1B = 0;
+ UCSR1C = 0;
+
+ /* Set all USART lines as input, tristate */
+ DDRD &= ~((1 << 5) | (1 << 3));
+ PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
+
+ /* Tristate target /RESET line */
+ AUX_LINE_DDR &= ~AUX_LINE_MASK;
+ AUX_LINE_PORT &= ~AUX_LINE_MASK;
+}
+
+/** Sends a byte via the USART.
+ *
+ * \param[in] Byte Byte to send through the USART
+ */
+void XPROGTarget_SendByte(const uint8_t Byte)
+{
+ /* Switch to Tx mode if currently in Rx mode */
+ if (!(IsSending))
+ XPROGTarget_SetTxMode();
+
+ /* Wait until there is space in the hardware Tx buffer before writing */
+ while (!(UCSR1A & (1 << UDRE1)));
+ UCSR1A |= (1 << TXC1);
+ UDR1 = Byte;
+
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+}
+
+/** Receives a byte via the software USART, blocking until data is received.
+ *
+ * \return Received byte from the USART
+ */
+uint8_t XPROGTarget_ReceiveByte(void)
+{
+ /* Switch to Rx mode if currently in Tx mode */
+ if (IsSending)
+ XPROGTarget_SetRxMode();
+
+ /* Wait until a byte has been received before reading */
+ while (!(UCSR1A & (1 << RXC1)) && TimeoutMSRemaining);
+
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+
+ return UDR1;
+}
+
+/** Sends a BREAK via the USART to the attached target, consisting of a full frame of idle bits. */
+void XPROGTarget_SendBreak(void)
+{
+ /* Switch to Tx mode if currently in Rx mode */
+ if (!(IsSending))
+ XPROGTarget_SetTxMode();
+
+ /* Need to do nothing for a full frame to send a BREAK */
+ for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++)
+ {
+ /* Wait for a full cycle of the clock */
+ while (PIND & (1 << 5));
+ while (!(PIND & (1 << 5)));
+ }
+
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+}
+
+static void XPROGTarget_SetTxMode(void)
+{
+ /* Wait for a full cycle of the clock */
+ while (PIND & (1 << 5));
+ while (!(PIND & (1 << 5)));
+
+ PORTD |= (1 << 3);
+ DDRD |= (1 << 3);
+
+ UCSR1B &= ~(1 << RXEN1);
+ UCSR1B |= (1 << TXEN1);
+
+ IsSending = true;
+
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+
+ IsSending = true;
+}
+
+static void XPROGTarget_SetRxMode(void)
+{
+ while (!(UCSR1A & (1 << TXC1)));
+ UCSR1A |= (1 << TXC1);
+
+ UCSR1B &= ~(1 << TXEN1);
+ UCSR1B |= (1 << RXEN1);
+
+ DDRD &= ~(1 << 3);
+ PORTD &= ~(1 << 3);
+
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+
+ IsSending = false;
+}
+
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
index 65ec11bcf..436f0f30d 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
@@ -1,126 +1,126 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 XPROGTarget.c.
- */
-
-#ifndef _XPROG_TARGET_
-#define _XPROG_TARGET_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <stdbool.h>
-
- #include <LUFA/Common/Common.h>
-
- #include "../V2Protocol.h"
- #include "XPROGProtocol.h"
-
- /* Preprocessor Checks: */
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
- #undef ENABLE_ISP_PROTOCOL
-
- #if !defined(ENABLE_XPROG_PROTOCOL)
- #define ENABLE_XPROG_PROTOCOL
- #endif
- #endif
-
- /** Serial carrier TPI/PDI speed when hardware TPI/PDI mode is used */
- #define XPROG_HARDWARE_SPEED 1000000
-
- /** Total number of bits in a single USART frame */
- #define BITS_IN_USART_FRAME 12
-
- #define PDI_CMD_LDS 0x00
- #define PDI_CMD_LD 0x20
- #define PDI_CMD_STS 0x40
- #define PDI_CMD_ST 0x60
- #define PDI_CMD_LDCS 0x80
- #define PDI_CMD_REPEAT 0xA0
- #define PDI_CMD_STCS 0xC0
- #define PDI_CMD_KEY 0xE0
-
- #define PDI_STATUS_REG 0
- #define PDI_RESET_REG 1
- #define PDI_CTRL_REG 2
-
- #define PDI_STATUS_NVM (1 << 1)
-
- #define PDI_RESET_KEY 0x59
- #define PDI_NVMENABLE_KEY (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
-
- #define PDI_DATSIZE_1BYTE 0
- #define PDI_DATSIZE_2BYTES 1
- #define PDI_DATSIZE_3BYTES 2
- #define PDI_DATSIZE_4BYTES 3
-
- #define PDI_POINTER_INDIRECT 0
- #define PDI_POINTER_INDIRECT_PI 1
- #define PDI_POINTER_DIRECT 2
-
- #define TPI_CMD_SLD 0x20
- #define TPI_CMD_SST 0x60
- #define TPI_CMD_SSTPR 0x68
- #define TPI_CMD_SIN 0x10
- #define TPI_CMD_SOUT 0x90
- #define TPI_CMD_SLDCS 0x80
- #define TPI_CMD_SSTCS 0xC0
- #define TPI_CMD_SKEY 0xE0
-
- #define TPI_STATUS_REG 0x00
- #define TPI_CTRL_REG 0x02
- #define TPI_ID_REG 0x0F
-
- #define TPI_STATUS_NVM (1 << 1)
-
- #define TPI_NVMENABLE_KEY (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
-
- #define TPI_POINTER_INDIRECT 0
- #define TPI_POINTER_INDIRECT_PI 4
-
- /* Function Prototypes: */
- void XPROGTarget_EnableTargetPDI(void);
- void XPROGTarget_EnableTargetTPI(void);
- void XPROGTarget_DisableTargetPDI(void);
- void XPROGTarget_DisableTargetTPI(void);
- void XPROGTarget_SendByte(const uint8_t Byte);
- uint8_t XPROGTarget_ReceiveByte(void);
- void XPROGTarget_SendBreak(void);
- bool XPROGTarget_WaitWhileNVMBusBusy(void);
-
- #if defined(INCLUDE_FROM_XPROGTARGET_C)
- static void XPROGTarget_SetTxMode(void);
- static void XPROGTarget_SetRxMode(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 XPROGTarget.c.
+ */
+
+#ifndef _XPROG_TARGET_
+#define _XPROG_TARGET_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include <stdbool.h>
+
+ #include <LUFA/Common/Common.h>
+
+ #include "../V2Protocol.h"
+ #include "XPROGProtocol.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ /** Serial carrier TPI/PDI speed when hardware TPI/PDI mode is used */
+ #define XPROG_HARDWARE_SPEED 1000000
+
+ /** Total number of bits in a single USART frame */
+ #define BITS_IN_USART_FRAME 12
+
+ #define PDI_CMD_LDS 0x00
+ #define PDI_CMD_LD 0x20
+ #define PDI_CMD_STS 0x40
+ #define PDI_CMD_ST 0x60
+ #define PDI_CMD_LDCS 0x80
+ #define PDI_CMD_REPEAT 0xA0
+ #define PDI_CMD_STCS 0xC0
+ #define PDI_CMD_KEY 0xE0
+
+ #define PDI_STATUS_REG 0
+ #define PDI_RESET_REG 1
+ #define PDI_CTRL_REG 2
+
+ #define PDI_STATUS_NVM (1 << 1)
+
+ #define PDI_RESET_KEY 0x59
+ #define PDI_NVMENABLE_KEY (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
+
+ #define PDI_DATSIZE_1BYTE 0
+ #define PDI_DATSIZE_2BYTES 1
+ #define PDI_DATSIZE_3BYTES 2
+ #define PDI_DATSIZE_4BYTES 3
+
+ #define PDI_POINTER_INDIRECT 0
+ #define PDI_POINTER_INDIRECT_PI 1
+ #define PDI_POINTER_DIRECT 2
+
+ #define TPI_CMD_SLD 0x20
+ #define TPI_CMD_SST 0x60
+ #define TPI_CMD_SSTPR 0x68
+ #define TPI_CMD_SIN 0x10
+ #define TPI_CMD_SOUT 0x90
+ #define TPI_CMD_SLDCS 0x80
+ #define TPI_CMD_SSTCS 0xC0
+ #define TPI_CMD_SKEY 0xE0
+
+ #define TPI_STATUS_REG 0x00
+ #define TPI_CTRL_REG 0x02
+ #define TPI_ID_REG 0x0F
+
+ #define TPI_STATUS_NVM (1 << 1)
+
+ #define TPI_NVMENABLE_KEY (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
+
+ #define TPI_POINTER_INDIRECT 0
+ #define TPI_POINTER_INDIRECT_PI 4
+
+ /* Function Prototypes: */
+ void XPROGTarget_EnableTargetPDI(void);
+ void XPROGTarget_EnableTargetTPI(void);
+ void XPROGTarget_DisableTargetPDI(void);
+ void XPROGTarget_DisableTargetTPI(void);
+ void XPROGTarget_SendByte(const uint8_t Byte);
+ uint8_t XPROGTarget_ReceiveByte(void);
+ void XPROGTarget_SendBreak(void);
+ bool XPROGTarget_WaitWhileNVMBusBusy(void);
+
+ #if defined(INCLUDE_FROM_XPROGTARGET_C)
+ static void XPROGTarget_SetTxMode(void);
+ static void XPROGTarget_SetRxMode(void);
+ #endif
+
+#endif
diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile
index 3c946540c..a0169332f 100644
--- a/Projects/AVRISP-MKII/makefile
+++ b/Projects/AVRISP-MKII/makefile
@@ -1,754 +1,754 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = AVRISP
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=16
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- Lib/V2Protocol.c \
- Lib/V2ProtocolParams.c \
- Lib/ISP/ISPProtocol.c \
- Lib/ISP/ISPTarget.c \
- Lib/XPROG/XPROGProtocol.c \
- Lib/XPROG/XPROGTarget.c \
- Lib/XPROG/XMEGANVM.c \
- Lib/XPROG/TINYNVM.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-CDEFS += -DAUX_LINE_PORT=PORTB
-CDEFS += -DAUX_LINE_PIN=PINB
-CDEFS += -DAUX_LINE_DDR=DDRB
-CDEFS += -DAUX_LINE_MASK="(1 << 4)"
-CDEFS += -DVTARGET_ADC_CHANNEL=2
-CDEFS += -DENABLE_ISP_PROTOCOL
-CDEFS += -DENABLE_XPROG_PROTOCOL
-#CDEFS += -DXPROG_VIA_HARDWARE_USART
-#CDEFS += -DNO_VTARGET_DETECT
-#CDEFS += -DLIBUSB_FILTERDRV_COMPAT
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = AVRISP
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=16
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ Lib/V2Protocol.c \
+ Lib/V2ProtocolParams.c \
+ Lib/ISP/ISPProtocol.c \
+ Lib/ISP/ISPTarget.c \
+ Lib/XPROG/XPROGProtocol.c \
+ Lib/XPROG/XPROGTarget.c \
+ Lib/XPROG/XMEGANVM.c \
+ Lib/XPROG/TINYNVM.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+CDEFS += -DAUX_LINE_PORT=PORTB
+CDEFS += -DAUX_LINE_PIN=PINB
+CDEFS += -DAUX_LINE_DDR=DDRB
+CDEFS += -DAUX_LINE_MASK="(1 << 4)"
+CDEFS += -DVTARGET_ADC_CHANNEL=2
+CDEFS += -DENABLE_ISP_PROTOCOL
+CDEFS += -DENABLE_XPROG_PROTOCOL
+#CDEFS += -DXPROG_VIA_HARDWARE_USART
+#CDEFS += -DNO_VTARGET_DETECT
+#CDEFS += -DLIBUSB_FILTERDRV_COMPAT
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/Benito/Benito Programmer.inf b/Projects/Benito/Benito Programmer.inf
index d819ec0d5..efdfad2bc 100644
--- a/Projects/Benito/Benito Programmer.inf
+++ b/Projects/Benito/Benito Programmer.inf
@@ -1,106 +1,106 @@
-;************************************************************
-; Windows USB CDC ACM Setup File
-; Copyright (c) 2000 Microsoft Corporation
-
-
-[Version]
-Signature="$Windows NT$"
-Class=Ports
-ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
-Provider=%MFGNAME%
-LayoutFile=layout.inf
-CatalogFile=%MFGFILENAME%.cat
-DriverVer=11/15/2007,5.1.2600.0
-
-[Manufacturer]
-%MFGNAME%=DeviceList, NTamd64
-
-[DestinationDirs]
-DefaultDestDir=12
-
-
-;------------------------------------------------------------------------------
-; Windows 2000/XP/Vista-32bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.nt]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.nt
-AddReg=DriverInstall.nt.AddReg
-
-[DriverCopyFiles.nt]
-usbser.sys,,,0x20
-
-[DriverInstall.nt.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.nt.Services]
-AddService=usbser, 0x00000002, DriverService.nt
-
-[DriverService.nt]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-;------------------------------------------------------------------------------
-; Vista-64bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.NTamd64]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.NTamd64
-AddReg=DriverInstall.NTamd64.AddReg
-
-[DriverCopyFiles.NTamd64]
-%DRIVERFILENAME%.sys,,,0x20
-
-[DriverInstall.NTamd64.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.NTamd64.Services]
-AddService=usbser, 0x00000002, DriverService.NTamd64
-
-[DriverService.NTamd64]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-
-;------------------------------------------------------------------------------
-; Vendor and Product ID Definitions
-;------------------------------------------------------------------------------
-; When developing your USB device, the VID and PID used in the PC side
-; application program and the firmware on the microcontroller must match.
-; Modify the below line to use your VID and PID. Use the format as shown below.
-; Note: One INF file can be used for multiple devices with different VID and PIDs.
-; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
-;------------------------------------------------------------------------------
-[SourceDisksFiles]
-[SourceDisksNames]
-[DeviceList]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060
-
-[DeviceList.NTamd64]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060
-
-
-;------------------------------------------------------------------------------
-; String Definitions
-;------------------------------------------------------------------------------
-;Modify these strings to customize your device
-;------------------------------------------------------------------------------
-[Strings]
-MFGFILENAME="CDC_vista"
-DRIVERFILENAME ="usbser"
-MFGNAME="http://www.fourwalledcubicle.com"
-INSTDISK="LUFA Benito Programmer Driver Installer"
-DESCRIPTION="Communications Port"
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+; Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+; Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+; Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID. Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060
+
+
+;------------------------------------------------------------------------------
+; String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="http://www.fourwalledcubicle.com"
+INSTDISK="LUFA Benito Programmer Driver Installer"
+DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file
diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c
index a91cef037..1fceec1f6 100644
--- a/Projects/Benito/Benito.c
+++ b/Projects/Benito/Benito.c
@@ -1,264 +1,264 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Benito project. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-#include "Benito.h"
-
-/** Circular buffer to hold data from the serial port before it is sent to the host. */
-RingBuff_t Tx_Buffer;
-
-/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */
-volatile struct
-{
- uint8_t ResetPulse; /**< Milliseconds remaining for target /RESET pulse */
- uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */
- uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */
- uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */
-} PulseMSRemaining;
-
-/** Previous state of the virtual DTR control line from the host */
-bool PreviousDTRState = false;
-
-/** LUFA CDC Class driver interface configuration and state information. This structure is
- * passed to all CDC Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
- {
- .Config =
- {
- .ControlInterfaceNumber = 0,
-
- .DataINEndpointNumber = CDC_TX_EPNUM,
- .DataINEndpointSize = CDC_TXRX_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = CDC_RX_EPNUM,
- .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
- .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
- .NotificationEndpointDoubleBank = false,
- },
- };
-
-/** 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();
-
- Buffer_Initialize(&Tx_Buffer);
-
- sei();
-
- for (;;)
- {
- /* Echo bytes from the host to the target via the hardware USART */
- while (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface) > 0)
- {
- Serial_TxByte(CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
-
- LEDs_TurnOnLEDs(LEDMASK_TX);
- PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
- }
-
- /* Echo bytes from the target to the host via the virtual serial port */
- while (Tx_Buffer.Elements > 0)
- {
- CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&Tx_Buffer));
-
- LEDs_TurnOnLEDs(LEDMASK_RX);
- PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS;
- }
-
- /* Check if the millisecond timer has elapsed */
- if (TIFR0 & (1 << OCF0A))
- {
- /* Check if the reset pulse period has elapsed, if so tristate the target reset line */
- if (PulseMSRemaining.ResetPulse && !(--PulseMSRemaining.ResetPulse))
- {
- LEDs_TurnOffLEDs(LEDMASK_BUSY);
- AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
- }
-
- /* Check if the LEDs should be ping-ponging (during enumeration) */
- if (PulseMSRemaining.PingPongLEDPulse && !(--PulseMSRemaining.PingPongLEDPulse))
- {
- LEDs_ToggleLEDs(LEDMASK_TX | LEDMASK_RX);
- PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS;
- }
-
- /* Turn off TX LED(s) once the TX pulse period has elapsed */
- if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse))
- LEDs_TurnOffLEDs(LEDMASK_TX);
-
- /* Turn off RX LED(s) once the RX pulse period has elapsed */
- if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse))
- LEDs_TurnOffLEDs(LEDMASK_RX);
-
- /* Clear the millisecond timer CTC flag (cleared by writing logic one to the register) */
- TIFR0 |= (1 << OCF0A);
- }
-
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Hardware Initialization */
- Serial_Init(9600, false);
- LEDs_Init();
- USB_Init();
-
- /* Millisecond Timer Interrupt */
- OCR0A = (F_CPU / 64 / 1000);
- TCCR0A = (1 << WGM01);
- TCCR0B = ((1 << CS01) | (1 << CS00));
-
- /* Tristate target /RESET Line */
- AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK;
- AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS;
- LEDs_SetAllLEDs(LEDMASK_TX);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- PulseMSRemaining.PingPongLEDPulse = 0;
- LEDs_SetAllLEDs(LEDS_NO_LEDS);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- PulseMSRemaining.PingPongLEDPulse = 0;
- LEDs_SetAllLEDs(LEDS_NO_LEDS);
-
- if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
- LEDs_SetAllLEDs(LEDMASK_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
-}
-
-/** Event handler for the CDC Class driver Line Encoding Changed event.
- *
- * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
- */
-void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
-{
- uint8_t ConfigMask = 0;
-
- switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
- {
- case CDC_PARITY_Odd:
- ConfigMask = ((1 << UPM11) | (1 << UPM10));
- break;
- case CDC_PARITY_Even:
- ConfigMask = (1 << UPM11);
- break;
- }
-
- if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits)
- ConfigMask |= (1 << USBS1);
-
- switch (CDCInterfaceInfo->State.LineEncoding.DataBits)
- {
- case 6:
- ConfigMask |= (1 << UCSZ10);
- break;
- case 7:
- ConfigMask |= (1 << UCSZ11);
- break;
- case 8:
- ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10));
- break;
- }
-
- UCSR1A = (1 << U2X1);
- UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
- UCSR1C = ConfigMask;
- UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
-}
-
-/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer
- * for later transmission to the host.
- */
-ISR(USART1_RX_vect, ISR_BLOCK)
-{
- uint8_t ReceivedByte = UDR1;
-
- if (USB_DeviceState == DEVICE_STATE_Configured)
- Buffer_StoreElement(&Tx_Buffer, ReceivedByte);
-}
-
-/** Event handler for the CDC Class driver Host-to-Device Line Encoding Changed event.
- *
- * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
- */
-void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
-{
- bool CurrentDTRState = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR);
-
- /* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */
- if (!(PreviousDTRState) && CurrentDTRState)
- {
- LEDs_SetAllLEDs(LEDMASK_BUSY);
-
- AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;
- PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS;
- }
-
- PreviousDTRState = CurrentDTRState;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Benito project. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
+#include "Benito.h"
+
+/** Circular buffer to hold data from the serial port before it is sent to the host. */
+RingBuff_t Tx_Buffer;
+
+/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */
+volatile struct
+{
+ uint8_t ResetPulse; /**< Milliseconds remaining for target /RESET pulse */
+ uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */
+ uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */
+ uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */
+} PulseMSRemaining;
+
+/** Previous state of the virtual DTR control line from the host */
+bool PreviousDTRState = false;
+
+/** LUFA CDC Class driver interface configuration and state information. This structure is
+ * passed to all CDC Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
+ {
+ .Config =
+ {
+ .ControlInterfaceNumber = 0,
+
+ .DataINEndpointNumber = CDC_TX_EPNUM,
+ .DataINEndpointSize = CDC_TXRX_EPSIZE,
+ .DataINEndpointDoubleBank = false,
+
+ .DataOUTEndpointNumber = CDC_RX_EPNUM,
+ .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
+ .DataOUTEndpointDoubleBank = false,
+
+ .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
+ .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .NotificationEndpointDoubleBank = false,
+ },
+ };
+
+/** 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();
+
+ Buffer_Initialize(&Tx_Buffer);
+
+ sei();
+
+ for (;;)
+ {
+ /* Echo bytes from the host to the target via the hardware USART */
+ while (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface) > 0)
+ {
+ Serial_TxByte(CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
+
+ LEDs_TurnOnLEDs(LEDMASK_TX);
+ PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
+ }
+
+ /* Echo bytes from the target to the host via the virtual serial port */
+ while (Tx_Buffer.Elements > 0)
+ {
+ CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&Tx_Buffer));
+
+ LEDs_TurnOnLEDs(LEDMASK_RX);
+ PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS;
+ }
+
+ /* Check if the millisecond timer has elapsed */
+ if (TIFR0 & (1 << OCF0A))
+ {
+ /* Check if the reset pulse period has elapsed, if so tristate the target reset line */
+ if (PulseMSRemaining.ResetPulse && !(--PulseMSRemaining.ResetPulse))
+ {
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);
+ AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
+ }
+
+ /* Check if the LEDs should be ping-ponging (during enumeration) */
+ if (PulseMSRemaining.PingPongLEDPulse && !(--PulseMSRemaining.PingPongLEDPulse))
+ {
+ LEDs_ToggleLEDs(LEDMASK_TX | LEDMASK_RX);
+ PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS;
+ }
+
+ /* Turn off TX LED(s) once the TX pulse period has elapsed */
+ if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse))
+ LEDs_TurnOffLEDs(LEDMASK_TX);
+
+ /* Turn off RX LED(s) once the RX pulse period has elapsed */
+ if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse))
+ LEDs_TurnOffLEDs(LEDMASK_RX);
+
+ /* Clear the millisecond timer CTC flag (cleared by writing logic one to the register) */
+ TIFR0 |= (1 << OCF0A);
+ }
+
+ CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Hardware Initialization */
+ Serial_Init(9600, false);
+ LEDs_Init();
+ USB_Init();
+
+ /* Millisecond Timer Interrupt */
+ OCR0A = (F_CPU / 64 / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+
+ /* Tristate target /RESET Line */
+ AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK;
+ AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS;
+ LEDs_SetAllLEDs(LEDMASK_TX);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ PulseMSRemaining.PingPongLEDPulse = 0;
+ LEDs_SetAllLEDs(LEDS_NO_LEDS);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ PulseMSRemaining.PingPongLEDPulse = 0;
+ LEDs_SetAllLEDs(LEDS_NO_LEDS);
+
+ if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
+}
+
+/** Event handler for the CDC Class driver Line Encoding Changed event.
+ *
+ * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
+ */
+void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
+{
+ uint8_t ConfigMask = 0;
+
+ switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
+ {
+ case CDC_PARITY_Odd:
+ ConfigMask = ((1 << UPM11) | (1 << UPM10));
+ break;
+ case CDC_PARITY_Even:
+ ConfigMask = (1 << UPM11);
+ break;
+ }
+
+ if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits)
+ ConfigMask |= (1 << USBS1);
+
+ switch (CDCInterfaceInfo->State.LineEncoding.DataBits)
+ {
+ case 6:
+ ConfigMask |= (1 << UCSZ10);
+ break;
+ case 7:
+ ConfigMask |= (1 << UCSZ11);
+ break;
+ case 8:
+ ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10));
+ break;
+ }
+
+ UCSR1A = (1 << U2X1);
+ UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
+ UCSR1C = ConfigMask;
+ UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
+}
+
+/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer
+ * for later transmission to the host.
+ */
+ISR(USART1_RX_vect, ISR_BLOCK)
+{
+ uint8_t ReceivedByte = UDR1;
+
+ if (USB_DeviceState == DEVICE_STATE_Configured)
+ Buffer_StoreElement(&Tx_Buffer, ReceivedByte);
+}
+
+/** Event handler for the CDC Class driver Host-to-Device Line Encoding Changed event.
+ *
+ * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
+ */
+void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
+{
+ bool CurrentDTRState = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR);
+
+ /* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */
+ if (!(PreviousDTRState) && CurrentDTRState)
+ {
+ LEDs_SetAllLEDs(LEDMASK_BUSY);
+
+ AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;
+ PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS;
+ }
+
+ PreviousDTRState = CurrentDTRState;
+}
diff --git a/Projects/Benito/Benito.h b/Projects/Benito/Benito.h
index c6b534e42..6e72da193 100644
--- a/Projects/Benito/Benito.h
+++ b/Projects/Benito/Benito.h
@@ -1,77 +1,77 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Benito.c.
- */
-
-#ifndef _BENITO_H_
-#define _BENITO_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/interrupt.h>
-
- #include "Descriptors.h"
- #include "Lib/RingBuff.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/Peripheral/Serial.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Macros: */
- /** LED mask for the library LED driver, to indicate TX activity. */
- #define LEDMASK_TX LEDS_LED1
-
- /** LED mask for the library LED driver, to indicate RX activity. */
- #define LEDMASK_RX LEDS_LED2
-
- /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
- #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2)
-
- /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
- #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)
-
- /* 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_UnhandledControlRequest(void);
-
- void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
- void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Benito.c.
+ */
+
+#ifndef _BENITO_H_
+#define _BENITO_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/interrupt.h>
+
+ #include "Descriptors.h"
+ #include "Lib/RingBuff.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/Peripheral/Serial.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Macros: */
+ /** LED mask for the library LED driver, to indicate TX activity. */
+ #define LEDMASK_TX LEDS_LED1
+
+ /** LED mask for the library LED driver, to indicate RX activity. */
+ #define LEDMASK_RX LEDS_LED2
+
+ /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
+ #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)
+
+ /* 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_UnhandledControlRequest(void);
+
+ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
+ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
+
+#endif
diff --git a/Projects/Benito/Benito.txt b/Projects/Benito/Benito.txt
index 1461d6dc0..0f71a6b61 100644
--- a/Projects/Benito/Benito.txt
+++ b/Projects/Benito/Benito.txt
@@ -1,100 +1,100 @@
-/** \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 Benito Arduino Programmer Project
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - Series 7 USB AVRs
- * - Series 6 USB AVRs
- * - Series 4 USB AVRs
- * - Series 2 USB AVRs
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Communications Device Class (CDC)</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>Abstract Control Model (ACM)</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USBIF CDC Class Standard \n
- * Arduino Bootloader Specification</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Firmware for a USB AVR powered programmer for Arduino boards using the official Arduino bootloader. This
- * project acts like a regular USB to Serial bridge, except that asserting the DTR line will cause a pulse
- * to appear on a given port pin, to control the target's /RESET pin.
- *
- * This is primarily designed to fit the Benito board from www.dorkbotpdx.org, but will suit all USB AVRs.
- *
- * After running this project for the first time on a new computer, you will need to supply the .INF file located
- * in this project's directory as the device's driver when running under Windows. This will enable Windows to use
- * its inbuilt CDC drivers, negating the need for custom drivers for the device. Other Operating Systems should
- * automatically use their own inbuilt CDC-ACM drivers.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>AVR_RESET_LINE_PORT</td>
- * <td>Makefile CDEFS</td>
- * <td>Indicates the PORT register of the pin used to generate the target /RESET line pulse.</td>
- * </tr>
- * <tr>
- * <td>AVR_RESET_LINE_DDR</td>
- * <td>Makefile CDEFS</td>
- * <td>Indicates the DDR register of the pin used to generate the target /RESET line pulse.</td>
- * </tr>
- * <tr>
- * <td>AVR_RESET_LINE_MASK</td>
- * <td>Makefile CDEFS</td>
- * <td>Indicates the mask of the pin used to generate the target /RESET line pulse.</td>
- * </tr>
- * <tr>
- * <td>AVR_RESET_PULSE_MS</td>
- * <td>Makefile CDEFS</td>
- * <td>Pulse length in milliseconds for the target /RESET pulse.</td>
- * </tr>
- * <tr>
- * <td>TX_RX_LED_PULSE_MS</td>
- * <td>Makefile CDEFS</td>
- * <td>Pulse length in milliseconds for the activity Tx/Rx LEDs.</td>
- * </tr>
- * <tr>
- * <td>PING_PONG_LED_PULSE_MS</td>
- * <td>Makefile CDEFS</td>
- * <td>Pulse length in milliseconds for the enumeration LED ping-poning between toggles.</td>
- * </tr>
- * </table>
- */
+/** \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 Benito Arduino Programmer Project
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - Series 7 USB AVRs
+ * - Series 6 USB AVRs
+ * - Series 4 USB AVRs
+ * - Series 2 USB AVRs
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Communications Device Class (CDC)</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>Abstract Control Model (ACM)</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USBIF CDC Class Standard \n
+ * Arduino Bootloader Specification</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Firmware for a USB AVR powered programmer for Arduino boards using the official Arduino bootloader. This
+ * project acts like a regular USB to Serial bridge, except that asserting the DTR line will cause a pulse
+ * to appear on a given port pin, to control the target's /RESET pin.
+ *
+ * This is primarily designed to fit the Benito board from www.dorkbotpdx.org, but will suit all USB AVRs.
+ *
+ * After running this project for the first time on a new computer, you will need to supply the .INF file located
+ * in this project's directory as the device's driver when running under Windows. This will enable Windows to use
+ * its inbuilt CDC drivers, negating the need for custom drivers for the device. Other Operating Systems should
+ * automatically use their own inbuilt CDC-ACM drivers.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>AVR_RESET_LINE_PORT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Indicates the PORT register of the pin used to generate the target /RESET line pulse.</td>
+ * </tr>
+ * <tr>
+ * <td>AVR_RESET_LINE_DDR</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Indicates the DDR register of the pin used to generate the target /RESET line pulse.</td>
+ * </tr>
+ * <tr>
+ * <td>AVR_RESET_LINE_MASK</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Indicates the mask of the pin used to generate the target /RESET line pulse.</td>
+ * </tr>
+ * <tr>
+ * <td>AVR_RESET_PULSE_MS</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Pulse length in milliseconds for the target /RESET pulse.</td>
+ * </tr>
+ * <tr>
+ * <td>TX_RX_LED_PULSE_MS</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Pulse length in milliseconds for the activity Tx/Rx LEDs.</td>
+ * </tr>
+ * <tr>
+ * <td>PING_PONG_LED_PULSE_MS</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Pulse length in milliseconds for the enumeration LED ping-poning between toggles.</td>
+ * </tr>
+ * </table>
+ */
diff --git a/Projects/Benito/Descriptors.c b/Projects/Benito/Descriptors.c
index 85c2c1408..32f737d42 100644
--- a/Projects/Benito/Descriptors.c
+++ b/Projects/Benito/Descriptors.c
@@ -1,255 +1,255 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x02,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2060,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .CDC_CCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 1,
-
- .Class = 0x02,
- .SubClass = 0x02,
- .Protocol = 0x01,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_Functional_IntHeader =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x00,
-
- .Data = {0x01, 0x10}
- },
-
- .CDC_Functional_AbstractControlManagement =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
- .SubType = 0x02,
-
- .Data = {0x06}
- },
-
- .CDC_Functional_Union=
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x06,
-
- .Data = {0x00, 0x01}
- },
-
- .CDC_ManagementEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_NOTIFICATION_EPSIZE,
- .PollingIntervalMS = 0xFF
- },
-
- .CDC_DCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 1,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x0A,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .CDC_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(25), .Type = DTYPE_String},
-
- .UnicodeString = L"Benito Arduino Programmer"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x02,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2060,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .CDC_CCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 1,
+
+ .Class = 0x02,
+ .SubClass = 0x02,
+ .Protocol = 0x01,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_Functional_IntHeader =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x00,
+
+ .Data = {0x01, 0x10}
+ },
+
+ .CDC_Functional_AbstractControlManagement =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
+ .SubType = 0x02,
+
+ .Data = {0x06}
+ },
+
+ .CDC_Functional_Union=
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x06,
+
+ .Data = {0x00, 0x01}
+ },
+
+ .CDC_ManagementEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .PollingIntervalMS = 0xFF
+ },
+
+ .CDC_DCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 1,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x0A,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .CDC_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(25), .Type = DTYPE_String},
+
+ .UnicodeString = L"Benito Arduino Programmer"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/Benito/Descriptors.h b/Projects/Benito/Descriptors.h
index 45bab84d9..e00c5e2ed 100644
--- a/Projects/Benito/Descriptors.h
+++ b/Projects/Benito/Descriptors.h
@@ -1,83 +1,83 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Macros: */
- /** Endpoint number of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPNUM 2
-
- /** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
-
- /** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
-
- /** Size in bytes of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPSIZE 8
-
- /** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t CDC_CCI_Interface;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
- CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
- USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
- USB_Descriptor_Interface_t CDC_DCI_Interface;
- USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
- USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Macros: */
+ /** Endpoint number of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPNUM 2
+
+ /** Endpoint number of the CDC device-to-host data IN endpoint. */
+ #define CDC_TX_EPNUM 3
+
+ /** Endpoint number of the CDC host-to-device data OUT endpoint. */
+ #define CDC_RX_EPNUM 4
+
+ /** Size in bytes of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPSIZE 8
+
+ /** Size in bytes of the CDC data IN and OUT endpoints. */
+ #define CDC_TXRX_EPSIZE 16
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t CDC_CCI_Interface;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
+ CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
+ USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
+ USB_Descriptor_Interface_t CDC_DCI_Interface;
+ USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
+ USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/Benito/Doxygen.conf b/Projects/Benito/Doxygen.conf
index ef177e501..e515b441a 100644
--- a/Projects/Benito/Doxygen.conf
+++ b/Projects/Benito/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "Benito Arduino Programmer Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Benito Arduino Programmer Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/Benito/Lib/RingBuff.c b/Projects/Benito/Lib/RingBuff.c
index 2109f8cc0..91c61d06b 100644
--- a/Projects/Benito/Lib/RingBuff.c
+++ b/Projects/Benito/Lib/RingBuff.c
@@ -1,120 +1,120 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "RingBuff.h"
-
-void Buffer_Initialize(RingBuff_t* const Buffer)
-{
- BUFF_ATOMIC_BLOCK
- {
- Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- Buffer->Elements = 0;
- }
-}
-
-void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
-{
- BUFF_ATOMIC_BLOCK
- {
- #if defined(BUFF_DROPOLD)
- if (Buffer->Elements == BUFF_LENGTH)
- {
- Buffer->OutPtr++;
-
- if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
- else
- {
- Buffer->Elements++;
- }
- #elif defined(BUFF_DROPNEW)
- if (Buffer->Elements == BUFF_LENGTH)
- return;
-
- Buffer->Elements++;
- #elif defined(BUFF_NODROPCHECK)
- Buffer->Elements++;
- #endif
-
- *(Buffer->InPtr) = Data;
- Buffer->InPtr++;
-
- if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
-}
-
-RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
-{
- RingBuff_Data_t BuffData;
-
- BUFF_ATOMIC_BLOCK
- {
-#if defined(BUFF_EMPTYRETURNSZERO)
- if (!(Buffer->Elements))
- return 0;
-#elif !defined(BUFF_NOEMPTYCHECK)
- #error No empty buffer check behavior specified.
-#endif
-
- BuffData = *(Buffer->OutPtr);
-
- Buffer->OutPtr++;
- Buffer->Elements--;
-
- if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
-
- return BuffData;
-}
-
-#if defined(BUFF_USEPEEK)
-RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
-{
- RingBuff_Data_t BuffData;
-
- BUFF_ATOMIC_BLOCK
- {
-#if defined(BUFF_EMPTYRETURNSZERO)
- if (!(Buffer->Elements))
- return 0;
-#elif !defined(BUFF_NOEMPTYCHECK)
- #error No empty buffer check behavior specified.
-#endif
-
- BuffData = *(Buffer->OutPtr);
- }
-
- return BuffData;
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "RingBuff.h"
+
+void Buffer_Initialize(RingBuff_t* const Buffer)
+{
+ BUFF_ATOMIC_BLOCK
+ {
+ Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ Buffer->Elements = 0;
+ }
+}
+
+void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
+{
+ BUFF_ATOMIC_BLOCK
+ {
+ #if defined(BUFF_DROPOLD)
+ if (Buffer->Elements == BUFF_LENGTH)
+ {
+ Buffer->OutPtr++;
+
+ if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+ else
+ {
+ Buffer->Elements++;
+ }
+ #elif defined(BUFF_DROPNEW)
+ if (Buffer->Elements == BUFF_LENGTH)
+ return;
+
+ Buffer->Elements++;
+ #elif defined(BUFF_NODROPCHECK)
+ Buffer->Elements++;
+ #endif
+
+ *(Buffer->InPtr) = Data;
+ Buffer->InPtr++;
+
+ if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+}
+
+RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
+{
+ RingBuff_Data_t BuffData;
+
+ BUFF_ATOMIC_BLOCK
+ {
+#if defined(BUFF_EMPTYRETURNSZERO)
+ if (!(Buffer->Elements))
+ return 0;
+#elif !defined(BUFF_NOEMPTYCHECK)
+ #error No empty buffer check behavior specified.
+#endif
+
+ BuffData = *(Buffer->OutPtr);
+
+ Buffer->OutPtr++;
+ Buffer->Elements--;
+
+ if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+
+ return BuffData;
+}
+
+#if defined(BUFF_USEPEEK)
+RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
+{
+ RingBuff_Data_t BuffData;
+
+ BUFF_ATOMIC_BLOCK
+ {
+#if defined(BUFF_EMPTYRETURNSZERO)
+ if (!(Buffer->Elements))
+ return 0;
+#elif !defined(BUFF_NOEMPTYCHECK)
+ #error No empty buffer check behavior specified.
+#endif
+
+ BuffData = *(Buffer->OutPtr);
+ }
+
+ return BuffData;
+}
+#endif
diff --git a/Projects/Benito/Lib/RingBuff.h b/Projects/Benito/Lib/RingBuff.h
index 2e03a28be..b4933aa4d 100644
--- a/Projects/Benito/Lib/RingBuff.h
+++ b/Projects/Benito/Lib/RingBuff.h
@@ -1,116 +1,116 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/* Buffer Configuration: */
- /* Buffer length - select static size of created ring buffers: */
- #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
-
- /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
- #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
-
- /* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
- #define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
- // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
- // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
-
- /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
- //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
- #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
-
- /* Buffer storage type - set the datatype for the stored data */
- #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
-
- /* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
- //#define BUFF_USEPEEK
-
-#ifndef _RINGBUFF_H_
-#define _RINGBUFF_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/atomic.h>
- #include <limits.h>
-
- #include <LUFA/Common/Common.h>
-
- /* Defines and checks: */
- #if defined(BUFF_STATICSIZE)
- #define BUFF_LENGTH BUFF_STATICSIZE
- #else
- #error No buffer length specified!
- #endif
-
- #if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
- #error No buffer drop mode specified.
- #endif
-
- #if !defined(BUFF_DATATYPE)
- #error Ringbuffer storage data type not specified.
- #endif
-
- #if defined(BUFF_VOLATILE)
- #define BUFF_MODE volatile
- #define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- #else
- #define BUFF_MODE
- #define BUFF_ATOMIC_BLOCK
- #endif
-
- #if (BUFF_STATICSIZE > LONG_MAX)
- #define RingBuff_Elements_t uint64_t
- #elif (BUFF_STATICSIZE > INT_MAX)
- #define RingBuff_Elements_t uint32_t
- #elif (BUFF_STATICSIZE > CHAR_MAX)
- #define RingBuff_Elements_t uint16_t
- #else
- #define RingBuff_Elements_t uint8_t
- #endif
-
- /* Type Defines: */
- typedef BUFF_DATATYPE RingBuff_Data_t;
-
- typedef BUFF_MODE struct
- {
- RingBuff_Data_t Buffer[BUFF_LENGTH];
- RingBuff_Data_t* InPtr;
- RingBuff_Data_t* OutPtr;
- RingBuff_Elements_t Elements;
- } RingBuff_t;
-
- /* Function Prototypes: */
- void Buffer_Initialize(RingBuff_t* const Buff);
- void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
- RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
- #if defined(BUFF_USEPEEK)
- RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/* Buffer Configuration: */
+ /* Buffer length - select static size of created ring buffers: */
+ #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
+
+ /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
+ #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
+
+ /* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
+ #define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
+ // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
+ // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
+
+ /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
+ //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
+ #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
+
+ /* Buffer storage type - set the datatype for the stored data */
+ #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
+
+ /* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
+ //#define BUFF_USEPEEK
+
+#ifndef _RINGBUFF_H_
+#define _RINGBUFF_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include <util/atomic.h>
+ #include <limits.h>
+
+ #include <LUFA/Common/Common.h>
+
+ /* Defines and checks: */
+ #if defined(BUFF_STATICSIZE)
+ #define BUFF_LENGTH BUFF_STATICSIZE
+ #else
+ #error No buffer length specified!
+ #endif
+
+ #if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
+ #error No buffer drop mode specified.
+ #endif
+
+ #if !defined(BUFF_DATATYPE)
+ #error Ringbuffer storage data type not specified.
+ #endif
+
+ #if defined(BUFF_VOLATILE)
+ #define BUFF_MODE volatile
+ #define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ #else
+ #define BUFF_MODE
+ #define BUFF_ATOMIC_BLOCK
+ #endif
+
+ #if (BUFF_STATICSIZE > LONG_MAX)
+ #define RingBuff_Elements_t uint64_t
+ #elif (BUFF_STATICSIZE > INT_MAX)
+ #define RingBuff_Elements_t uint32_t
+ #elif (BUFF_STATICSIZE > CHAR_MAX)
+ #define RingBuff_Elements_t uint16_t
+ #else
+ #define RingBuff_Elements_t uint8_t
+ #endif
+
+ /* Type Defines: */
+ typedef BUFF_DATATYPE RingBuff_Data_t;
+
+ typedef BUFF_MODE struct
+ {
+ RingBuff_Data_t Buffer[BUFF_LENGTH];
+ RingBuff_Data_t* InPtr;
+ RingBuff_Data_t* OutPtr;
+ RingBuff_Elements_t Elements;
+ } RingBuff_t;
+
+ /* Function Prototypes: */
+ void Buffer_Initialize(RingBuff_t* const Buff);
+ void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
+ RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
+ #if defined(BUFF_USEPEEK)
+ RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
+ #endif
+
+#endif
diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile
index b6f53ad3a..96bf07c1d 100644
--- a/Projects/Benito/makefile
+++ b/Projects/Benito/makefile
@@ -1,744 +1,744 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = atmega32u2
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = BENITO
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 16000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = Benito
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- Lib/RingBuff.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-CDEFS += -DAVR_RESET_LINE_PORT="PORTD"
-CDEFS += -DAVR_RESET_LINE_DDR="DDRD"
-CDEFS += -DAVR_RESET_LINE_MASK="(1 << 4)"
-CDEFS += -DAVR_RESET_PULSE_MS=10
-CDEFS += -DTX_RX_LED_PULSE_MS=30
-CDEFS += -DPING_PONG_LED_PULSE_MS=100
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = atmega32u2
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = BENITO
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = Benito
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ Lib/RingBuff.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+CDEFS += -DAVR_RESET_LINE_PORT="PORTD"
+CDEFS += -DAVR_RESET_LINE_DDR="DDRD"
+CDEFS += -DAVR_RESET_LINE_MASK="(1 << 4)"
+CDEFS += -DAVR_RESET_PULSE_MS=10
+CDEFS += -DTX_RX_LED_PULSE_MS=30
+CDEFS += -DPING_PONG_LED_PULSE_MS=100
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/Incomplete/MIDIToneGenerator/Descriptors.c b/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
index 4b9e03bff..640c83224 100644
--- a/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
+++ b/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
@@ -1,326 +1,326 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x00,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2048,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .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.
- */
-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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .Audio_ControlInterface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 0,
-
- .Class = 0x01,
- .SubClass = 0x01,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .Audio_ControlInterface_SPC =
- {
- .Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
- .Subtype = DSUBTYPE_Header,
-
- .ACSpecification = VERSION_BCD(01.00),
- .TotalLength = sizeof(USB_Audio_Interface_AC_t),
-
- .InCollection = 1,
- .InterfaceNumbers = {1},
- },
-
- .Audio_StreamInterface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 1,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x01,
- .SubClass = 0x03,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .Audio_StreamInterface_SPC =
- {
- .Header = {.Size = sizeof(USB_MIDI_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
- .Subtype = DSUBTYPE_General,
-
- .AudioSpecification = VERSION_BCD(01.00),
-
- .TotalLength = (sizeof(USB_Descriptor_Configuration_t) -
- offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC))
- },
-
- .MIDI_In_Jack_Emb =
- {
- .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},
- .Subtype = DSUBTYPE_InputJack,
-
- .JackType = MIDI_JACKTYPE_EMBEDDED,
- .JackID = 0x01,
-
- .JackStrIndex = NO_DESCRIPTOR
- },
-
- .MIDI_In_Jack_Ext =
- {
- .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},
- .Subtype = DSUBTYPE_InputJack,
-
- .JackType = MIDI_JACKTYPE_EXTERNAL,
- .JackID = 0x02,
-
- .JackStrIndex = NO_DESCRIPTOR
- },
-
- .MIDI_Out_Jack_Emb =
- {
- .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},
- .Subtype = DSUBTYPE_OutputJack,
-
- .JackType = MIDI_JACKTYPE_EMBEDDED,
- .JackID = 0x03,
-
- .NumberOfPins = 1,
- .SourceJackID = {0x02},
- .SourcePinID = {0x01},
-
- .JackStrIndex = NO_DESCRIPTOR
- },
-
- .MIDI_Out_Jack_Ext =
- {
- .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},
- .Subtype = DSUBTYPE_OutputJack,
-
- .JackType = MIDI_JACKTYPE_EXTERNAL,
- .JackID = 0x04,
-
- .NumberOfPins = 1,
- .SourceJackID = {0x01},
- .SourcePinID = {0x01},
-
- .JackStrIndex = NO_DESCRIPTOR
- },
-
- .MIDI_In_Jack_Endpoint =
- {
- .Endpoint =
- {
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MIDI_STREAM_EPSIZE,
- .PollingIntervalMS = 0
- },
-
- .Refresh = 0,
- .SyncEndpointNumber = 0
- },
-
- .MIDI_In_Jack_Endpoint_SPC =
- {
- .Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_AudioEndpoint},
- .Subtype = DSUBTYPE_General,
-
- .TotalEmbeddedJacks = 0x01,
- .AssociatedJackID = {0x01}
- },
-
- .MIDI_Out_Jack_Endpoint =
- {
- .Endpoint =
- {
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MIDI_STREAM_IN_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MIDI_STREAM_EPSIZE,
- .PollingIntervalMS = 0
- },
-
- .Refresh = 0,
- .SyncEndpointNumber = 0
- },
-
- .MIDI_Out_Jack_Endpoint_SPC =
- {
- .Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_AudioEndpoint},
- .Subtype = DSUBTYPE_General,
-
- .TotalEmbeddedJacks = 0x01,
- .AssociatedJackID = {0x03}
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA MIDI 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 uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x00,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2048,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .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.
+ */
+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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .Audio_ControlInterface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 0,
+
+ .Class = 0x01,
+ .SubClass = 0x01,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .Audio_ControlInterface_SPC =
+ {
+ .Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
+ .Subtype = DSUBTYPE_Header,
+
+ .ACSpecification = VERSION_BCD(01.00),
+ .TotalLength = sizeof(USB_Audio_Interface_AC_t),
+
+ .InCollection = 1,
+ .InterfaceNumbers = {1},
+ },
+
+ .Audio_StreamInterface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 1,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x01,
+ .SubClass = 0x03,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .Audio_StreamInterface_SPC =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
+ .Subtype = DSUBTYPE_General,
+
+ .AudioSpecification = VERSION_BCD(01.00),
+
+ .TotalLength = (sizeof(USB_Descriptor_Configuration_t) -
+ offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC))
+ },
+
+ .MIDI_In_Jack_Emb =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},
+ .Subtype = DSUBTYPE_InputJack,
+
+ .JackType = MIDI_JACKTYPE_EMBEDDED,
+ .JackID = 0x01,
+
+ .JackStrIndex = NO_DESCRIPTOR
+ },
+
+ .MIDI_In_Jack_Ext =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},
+ .Subtype = DSUBTYPE_InputJack,
+
+ .JackType = MIDI_JACKTYPE_EXTERNAL,
+ .JackID = 0x02,
+
+ .JackStrIndex = NO_DESCRIPTOR
+ },
+
+ .MIDI_Out_Jack_Emb =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},
+ .Subtype = DSUBTYPE_OutputJack,
+
+ .JackType = MIDI_JACKTYPE_EMBEDDED,
+ .JackID = 0x03,
+
+ .NumberOfPins = 1,
+ .SourceJackID = {0x02},
+ .SourcePinID = {0x01},
+
+ .JackStrIndex = NO_DESCRIPTOR
+ },
+
+ .MIDI_Out_Jack_Ext =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},
+ .Subtype = DSUBTYPE_OutputJack,
+
+ .JackType = MIDI_JACKTYPE_EXTERNAL,
+ .JackID = 0x04,
+
+ .NumberOfPins = 1,
+ .SourceJackID = {0x01},
+ .SourcePinID = {0x01},
+
+ .JackStrIndex = NO_DESCRIPTOR
+ },
+
+ .MIDI_In_Jack_Endpoint =
+ {
+ .Endpoint =
+ {
+ .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MIDI_STREAM_EPSIZE,
+ .PollingIntervalMS = 0
+ },
+
+ .Refresh = 0,
+ .SyncEndpointNumber = 0
+ },
+
+ .MIDI_In_Jack_Endpoint_SPC =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_AudioEndpoint},
+ .Subtype = DSUBTYPE_General,
+
+ .TotalEmbeddedJacks = 0x01,
+ .AssociatedJackID = {0x01}
+ },
+
+ .MIDI_Out_Jack_Endpoint =
+ {
+ .Endpoint =
+ {
+ .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MIDI_STREAM_IN_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MIDI_STREAM_EPSIZE,
+ .PollingIntervalMS = 0
+ },
+
+ .Refresh = 0,
+ .SyncEndpointNumber = 0
+ },
+
+ .MIDI_Out_Jack_Endpoint_SPC =
+ {
+ .Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_AudioEndpoint},
+ .Subtype = DSUBTYPE_General,
+
+ .TotalEmbeddedJacks = 0x01,
+ .AssociatedJackID = {0x03}
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA MIDI 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 uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/Incomplete/MIDIToneGenerator/Descriptors.h b/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
index ffd261e58..9933d060e 100644
--- a/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
+++ b/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
@@ -1,81 +1,81 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MIDI.h>
-
- #include <avr/pgmspace.h>
-
- /* Macros: */
- /** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
- #define MIDI_STREAM_IN_EPNUM 2
-
- /** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
- #define MIDI_STREAM_OUT_EPNUM 1
-
- /** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
- #define MIDI_STREAM_EPSIZE 64
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t Audio_ControlInterface;
- USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
- USB_Descriptor_Interface_t Audio_StreamInterface;
- USB_MIDI_AudioInterface_AS_t Audio_StreamInterface_SPC;
- USB_MIDI_In_Jack_t MIDI_In_Jack_Emb;
- USB_MIDI_In_Jack_t MIDI_In_Jack_Ext;
- USB_MIDI_Out_Jack_t MIDI_Out_Jack_Emb;
- USB_MIDI_Out_Jack_t MIDI_Out_Jack_Ext;
- USB_Audio_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
- USB_MIDI_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
- USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
- USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MIDI.h>
+
+ #include <avr/pgmspace.h>
+
+ /* Macros: */
+ /** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
+ #define MIDI_STREAM_IN_EPNUM 2
+
+ /** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
+ #define MIDI_STREAM_OUT_EPNUM 1
+
+ /** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
+ #define MIDI_STREAM_EPSIZE 64
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t Audio_ControlInterface;
+ USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
+ USB_Descriptor_Interface_t Audio_StreamInterface;
+ USB_MIDI_AudioInterface_AS_t Audio_StreamInterface_SPC;
+ USB_MIDI_In_Jack_t MIDI_In_Jack_Emb;
+ USB_MIDI_In_Jack_t MIDI_In_Jack_Ext;
+ USB_MIDI_Out_Jack_t MIDI_Out_Jack_Emb;
+ USB_MIDI_Out_Jack_t MIDI_Out_Jack_Ext;
+ USB_Audio_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
+ USB_MIDI_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
+ USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
+ USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c
index c86cd0752..4b55b8da8 100644
--- a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c
+++ b/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c
@@ -1,186 +1,186 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 MIDI demo. This file contains the main tasks of
- * the demo and is responsible for the initial application hardware configuration.
- */
-
-#include "MIDIToneGenerator.h"
-
-/** LUFA MIDI Class driver interface configuration and state information. This structure is
- * passed to all MIDI Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
- {
- .Config =
- {
- .StreamingInterfaceNumber = 1,
-
- .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
- .DataINEndpointSize = MIDI_STREAM_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
- .DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
- },
- };
-
-const uint8_t SineTable[] PROGMEM =
-{
- 0x80, 0x83, 0x86, 0x89, 0x8c, 0x8f, 0x92, 0x95, 0x98, 0x9c, 0x9f, 0xa2, 0xa5, 0xa8, 0xab, 0xae,
- 0xb0, 0xb3, 0xb6, 0xb9, 0xbc, 0xbf, 0xc1, 0xc4, 0xc7, 0xc9, 0xcc, 0xce, 0xd1, 0xd3, 0xd5, 0xd8,
- 0xda, 0xdc, 0xde, 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xed, 0xef, 0xf0, 0xf2, 0xf3, 0xf5,
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfc, 0xfd, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfd, 0xfc, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7,
- 0xf6, 0xf5, 0xf3, 0xf2, 0xf0, 0xef, 0xed, 0xec, 0xea, 0xe8, 0xe6, 0xe4, 0xe2, 0xe0, 0xde, 0xdc,
- 0xda, 0xd8, 0xd5, 0xd3, 0xd1, 0xce, 0xcc, 0xc9, 0xc7, 0xc4, 0xc1, 0xbf, 0xbc, 0xb9, 0xb6, 0xb3,
- 0xb0, 0xae, 0xab, 0xa8, 0xa5, 0xa2, 0x9f, 0x9c, 0x98, 0x95, 0x92, 0x8f, 0x8c, 0x89, 0x86, 0x83,
- 0x80, 0x7c, 0x79, 0x76, 0x73, 0x70, 0x6d, 0x6a, 0x67, 0x63, 0x60, 0x5d, 0x5a, 0x57, 0x54, 0x51,
- 0x4f, 0x4c, 0x49, 0x46, 0x43, 0x40, 0x3e, 0x3b, 0x38, 0x36, 0x33, 0x31, 0x2e, 0x2c, 0x2a, 0x27,
- 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x12, 0x10, 0x0f, 0x0d, 0x0c, 0x0a,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0a, 0x0c, 0x0d, 0x0f, 0x10, 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f, 0x21, 0x23,
- 0x25, 0x27, 0x2a, 0x2c, 0x2e, 0x31, 0x33, 0x36, 0x38, 0x3b, 0x3e, 0x40, 0x43, 0x46, 0x49, 0x4c,
- 0x4f, 0x51, 0x54, 0x57, 0x5a, 0x5d, 0x60, 0x63, 0x67, 0x6a, 0x6d, 0x70, 0x73, 0x76, 0x79, 0x7c
-};
-
-uint8_t Pitch;
-uint8_t Velocity;
-uint8_t CurrentPos;
-
-/** 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);
- sei();
-
- for (;;)
- {
- MIDI_EventPacket_t ReceivedMIDIEvent;
- if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
- {
- if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
- {
- Pitch = ReceivedMIDIEvent.Data2;
- Velocity = ReceivedMIDIEvent.Data3;
-
- LEDs_SetAllLEDs(LEDS_LED1);
- }
- else if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_OFF >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
- {
- Velocity = 0;
-
- LEDs_SetAllLEDs(LEDS_NO_LEDS);
- }
- }
-
- /* Check if the sample reload timer period has elapsed, and that the USB bus is ready for a new sample */
- if (TIFR0 & (1 << OCF0A))
- {
- /* Clear the sample reload timer */
- TIFR0 |= (1 << OCF0A);
-
- /* Fetch the current sample from the sine lookup table */
- OCR3A = Velocity ? pgm_read_byte(&SineTable[CurrentPos]) : 0;
-
- /* Calculate next sample table position for this channel */
- CurrentPos += (Pitch >> 1);
- }
-
- MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- LEDs_Init();
- USB_Init();
-
- /* Sample reload timer initialization */
- OCR0A = (F_CPU / 8 / AUDIO_SAMPLE_FREQUENCY) - 1;
- TCCR0A = (1 << WGM01); // CTC mode
- TCCR0B = (1 << CS01); // Fcpu/8 speed
-
- /* PWM speaker timer initialization */
- TCCR3A = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)); // Set on match, clear on TOP
- TCCR3B = ((1 << WGM32) | (1 << CS30)); // Fast 8-Bit PWM, Fcpu speed
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
- /* Set speaker as output */
- DDRC |= (1 << 6);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-
- /* Set speaker as input to reduce current draw */
- DDRC &= ~(1 << 6);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- if (!(MIDI_Device_ConfigureEndpoints(&Keyboard_MIDI_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 MIDI demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
+#include "MIDIToneGenerator.h"
+
+/** LUFA MIDI Class driver interface configuration and state information. This structure is
+ * passed to all MIDI Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
+ {
+ .Config =
+ {
+ .StreamingInterfaceNumber = 1,
+
+ .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
+ .DataINEndpointSize = MIDI_STREAM_EPSIZE,
+ .DataINEndpointDoubleBank = false,
+
+ .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
+ .DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
+ .DataOUTEndpointDoubleBank = false,
+ },
+ };
+
+const uint8_t SineTable[] PROGMEM =
+{
+ 0x80, 0x83, 0x86, 0x89, 0x8c, 0x8f, 0x92, 0x95, 0x98, 0x9c, 0x9f, 0xa2, 0xa5, 0xa8, 0xab, 0xae,
+ 0xb0, 0xb3, 0xb6, 0xb9, 0xbc, 0xbf, 0xc1, 0xc4, 0xc7, 0xc9, 0xcc, 0xce, 0xd1, 0xd3, 0xd5, 0xd8,
+ 0xda, 0xdc, 0xde, 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xed, 0xef, 0xf0, 0xf2, 0xf3, 0xf5,
+ 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfc, 0xfd, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfd, 0xfc, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7,
+ 0xf6, 0xf5, 0xf3, 0xf2, 0xf0, 0xef, 0xed, 0xec, 0xea, 0xe8, 0xe6, 0xe4, 0xe2, 0xe0, 0xde, 0xdc,
+ 0xda, 0xd8, 0xd5, 0xd3, 0xd1, 0xce, 0xcc, 0xc9, 0xc7, 0xc4, 0xc1, 0xbf, 0xbc, 0xb9, 0xb6, 0xb3,
+ 0xb0, 0xae, 0xab, 0xa8, 0xa5, 0xa2, 0x9f, 0x9c, 0x98, 0x95, 0x92, 0x8f, 0x8c, 0x89, 0x86, 0x83,
+ 0x80, 0x7c, 0x79, 0x76, 0x73, 0x70, 0x6d, 0x6a, 0x67, 0x63, 0x60, 0x5d, 0x5a, 0x57, 0x54, 0x51,
+ 0x4f, 0x4c, 0x49, 0x46, 0x43, 0x40, 0x3e, 0x3b, 0x38, 0x36, 0x33, 0x31, 0x2e, 0x2c, 0x2a, 0x27,
+ 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x12, 0x10, 0x0f, 0x0d, 0x0c, 0x0a,
+ 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0c, 0x0d, 0x0f, 0x10, 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f, 0x21, 0x23,
+ 0x25, 0x27, 0x2a, 0x2c, 0x2e, 0x31, 0x33, 0x36, 0x38, 0x3b, 0x3e, 0x40, 0x43, 0x46, 0x49, 0x4c,
+ 0x4f, 0x51, 0x54, 0x57, 0x5a, 0x5d, 0x60, 0x63, 0x67, 0x6a, 0x6d, 0x70, 0x73, 0x76, 0x79, 0x7c
+};
+
+uint8_t Pitch;
+uint8_t Velocity;
+uint8_t CurrentPos;
+
+/** 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);
+ sei();
+
+ for (;;)
+ {
+ MIDI_EventPacket_t ReceivedMIDIEvent;
+ if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
+ {
+ if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
+ {
+ Pitch = ReceivedMIDIEvent.Data2;
+ Velocity = ReceivedMIDIEvent.Data3;
+
+ LEDs_SetAllLEDs(LEDS_LED1);
+ }
+ else if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_OFF >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
+ {
+ Velocity = 0;
+
+ LEDs_SetAllLEDs(LEDS_NO_LEDS);
+ }
+ }
+
+ /* Check if the sample reload timer period has elapsed, and that the USB bus is ready for a new sample */
+ if (TIFR0 & (1 << OCF0A))
+ {
+ /* Clear the sample reload timer */
+ TIFR0 |= (1 << OCF0A);
+
+ /* Fetch the current sample from the sine lookup table */
+ OCR3A = Velocity ? pgm_read_byte(&SineTable[CurrentPos]) : 0;
+
+ /* Calculate next sample table position for this channel */
+ CurrentPos += (Pitch >> 1);
+ }
+
+ MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ LEDs_Init();
+ USB_Init();
+
+ /* Sample reload timer initialization */
+ OCR0A = (F_CPU / 8 / AUDIO_SAMPLE_FREQUENCY) - 1;
+ TCCR0A = (1 << WGM01); // CTC mode
+ TCCR0B = (1 << CS01); // Fcpu/8 speed
+
+ /* PWM speaker timer initialization */
+ TCCR3A = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)); // Set on match, clear on TOP
+ TCCR3B = ((1 << WGM32) | (1 << CS30)); // Fast 8-Bit PWM, Fcpu speed
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+
+ /* Set speaker as output */
+ DDRC |= (1 << 6);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+
+ /* Set speaker as input to reduce current draw */
+ DDRC &= ~(1 << 6);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ if (!(MIDI_Device_ConfigureEndpoints(&Keyboard_MIDI_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
+}
diff --git a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h b/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h
index d2405f881..5ff19f1be 100644
--- a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h
+++ b/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h
@@ -1,78 +1,78 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 AudioOutput.c.
- */
-
-#ifndef _AUDIO_OUTPUT_H_
-#define _AUDIO_OUTPUT_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/pgmspace.h>
- #include <avr/interrupt.h>
- #include <stdbool.h>
-
- #include "Descriptors.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/Peripheral/ADC.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MIDI.h>
-
- /* 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)
-
- #define AUDIO_SAMPLE_FREQUENCY 24000
-
- /* 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_UnhandledControlRequest(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 AudioOutput.c.
+ */
+
+#ifndef _AUDIO_OUTPUT_H_
+#define _AUDIO_OUTPUT_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/pgmspace.h>
+ #include <avr/interrupt.h>
+ #include <stdbool.h>
+
+ #include "Descriptors.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/Peripheral/ADC.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MIDI.h>
+
+ /* 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)
+
+ #define AUDIO_SAMPLE_FREQUENCY 24000
+
+ /* 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_UnhandledControlRequest(void);
+
+#endif
diff --git a/Projects/Incomplete/MIDIToneGenerator/makefile b/Projects/Incomplete/MIDIToneGenerator/makefile
index 38060cd4c..94c745cc6 100644
--- a/Projects/Incomplete/MIDIToneGenerator/makefile
+++ b/Projects/Incomplete/MIDIToneGenerator/makefile
@@ -1,737 +1,737 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = MIDIToneGenerator
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../..
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MIDI.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = MIDIToneGenerator
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../..
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MIDI.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
index 9836d4338..d6ffde804 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
@@ -1,221 +1,221 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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"
-
-#if defined(USB_CAN_BE_DEVICE)
-
-/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
- * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
- * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
- * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
- * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
- * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
- * port location).
- */
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0xEF,
- .SubClass = 0x02,
- .Protocol = 0x01,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2063,
- .ReleaseNumber = 0x0001,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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 = 1,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .MS_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x08,
- .SubClass = 0x06,
- .Protocol = 0x50,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .MS_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MASS_STORAGE_IO_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .MS_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MASS_STORAGE_IO_EPSIZE,
- .PollingIntervalMS = 0x00
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(26), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA Standalone Programmer"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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"
+
+#if defined(USB_CAN_BE_DEVICE)
+
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0xEF,
+ .SubClass = 0x02,
+ .Protocol = 0x01,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2063,
+ .ReleaseNumber = 0x0001,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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 = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .MS_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x08,
+ .SubClass = 0x06,
+ .Protocol = 0x50,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .MS_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .MS_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .PollingIntervalMS = 0x00
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(26), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA Standalone Programmer"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
index 46a9c8014..440259341 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
@@ -1,88 +1,88 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Macros: */
- /** Endpoint number of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPNUM 5
-
- /** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 1
-
- /** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 2
-
- /** Size in bytes of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPSIZE 8
-
- /** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
-
- /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
-
- /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
-
- /** Size in bytes of the Mass Storage data endpoints. */
- #define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t MS_Interface;
- USB_Descriptor_Endpoint_t MS_DataInEndpoint;
- USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Macros: */
+ /** Endpoint number of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPNUM 5
+
+ /** Endpoint number of the CDC device-to-host data IN endpoint. */
+ #define CDC_TX_EPNUM 1
+
+ /** Endpoint number of the CDC host-to-device data OUT endpoint. */
+ #define CDC_RX_EPNUM 2
+
+ /** Size in bytes of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPSIZE 8
+
+ /** Size in bytes of the CDC data IN and OUT endpoints. */
+ #define CDC_TXRX_EPSIZE 16
+
+ /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
+ #define MASS_STORAGE_IN_EPNUM 3
+
+ /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
+ #define MASS_STORAGE_OUT_EPNUM 4
+
+ /** Size in bytes of the Mass Storage data endpoints. */
+ #define MASS_STORAGE_IO_EPSIZE 64
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t MS_Interface;
+ USB_Descriptor_Endpoint_t MS_DataInEndpoint;
+ USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
index 8868733a4..516917cf4 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
@@ -1,102 +1,102 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "DiskDevice.h"
-
-#if defined(USB_CAN_BE_DEVICE)
-/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
- * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_MS_Device_t DiskDevice_MS_Interface =
- {
- .Config =
- {
- .InterfaceNumber = 0,
-
- .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
- .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
- .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .TotalLUNs = 1,
- },
- };
-
-void DiskDevice_USBTask(void)
-{
- MS_Device_USBTask(&DiskDevice_MS_Interface);
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- if (!(MS_Device_ConfigureEndpoints(&DiskDevice_MS_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- MS_Device_ProcessControlRequest(&DiskDevice_MS_Interface);
-}
-
-/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
- */
-bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- bool CommandSuccess;
-
- LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
- CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- return CommandSuccess;
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "DiskDevice.h"
+
+#if defined(USB_CAN_BE_DEVICE)
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
+ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_MS_Device_t DiskDevice_MS_Interface =
+ {
+ .Config =
+ {
+ .InterfaceNumber = 0,
+
+ .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
+ .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .DataINEndpointDoubleBank = false,
+
+ .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
+ .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .DataOUTEndpointDoubleBank = false,
+
+ .TotalLUNs = 1,
+ },
+ };
+
+void DiskDevice_USBTask(void)
+{
+ MS_Device_USBTask(&DiskDevice_MS_Interface);
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ if (!(MS_Device_ConfigureEndpoints(&DiskDevice_MS_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ MS_Device_ProcessControlRequest(&DiskDevice_MS_Interface);
+}
+
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
+ */
+bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ bool CommandSuccess;
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
+ CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ return CommandSuccess;
+}
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
index 1d7569b1c..85977522b 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
@@ -1,61 +1,61 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 DiskDevice.c.
- */
-
-#ifndef _DISK_DEVICE_H_
-#define _DISK_DEVICE_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include "Descriptors.h"
- #include "StandaloneProgrammer.h"
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- /* Function Prototypes: */
- #if defined(USB_CAN_BE_DEVICE)
- void DiskDevice_USBTask(void);
-
- void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
- void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
-
- bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 DiskDevice.c.
+ */
+
+#ifndef _DISK_DEVICE_H_
+#define _DISK_DEVICE_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include "Descriptors.h"
+ #include "StandaloneProgrammer.h"
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ /* Function Prototypes: */
+ #if defined(USB_CAN_BE_DEVICE)
+ void DiskDevice_USBTask(void);
+
+ void EVENT_USB_Device_Connect(void);
+ void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+
+ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ #endif
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
index e50fc30af..e7831cd71 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
@@ -1,127 +1,127 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "DiskHost.h"
-
-#if defined(USB_CAN_BE_HOST)
-/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
- * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_MS_Host_t DiskHost_MS_Interface =
- {
- .Config =
- {
- .DataINPipeNumber = 1,
- .DataINPipeDoubleBank = false,
-
- .DataOUTPipeNumber = 2,
- .DataOUTPipeDoubleBank = false,
- },
- };
-
-void DiskHost_USBTask(void)
-{
- if (USB_HostState == HOST_STATE_Addressed)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
- uint16_t ConfigDescriptorSize;
- uint8_t ConfigDescriptorData[512];
-
- if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
- sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- return;
- }
-
- if (MS_Host_ConfigurePipes(&DiskHost_MS_Interface,
- ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- return;
- }
-
- if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- return;
- }
-
- uint8_t MaxLUNIndex;
- if (MS_Host_GetMaxLUN(&DiskHost_MS_Interface, &MaxLUNIndex))
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- return;
- }
-
- if (MS_Host_ResetMSInterface(&DiskHost_MS_Interface))
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- return;
- }
-
- USB_HostState = HOST_STATE_Configured;
-
- /* Note: For the RequestSense call to work, the host state machine must be in the
- * Configured state, or the call will be aborted */
- SCSI_Request_Sense_Response_t SenseData;
- if (MS_Host_RequestSense(&DiskHost_MS_Interface, 0, &SenseData) != 0)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- return;
- }
-
- pf_mount(&DiskFATState);
-
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
- }
-
- MS_Host_USBTask(&DiskHost_MS_Interface);
-}
-
-void EVENT_USB_Host_DeviceAttached(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-void EVENT_USB_Host_DeviceUnattached(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "DiskHost.h"
+
+#if defined(USB_CAN_BE_HOST)
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
+ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_MS_Host_t DiskHost_MS_Interface =
+ {
+ .Config =
+ {
+ .DataINPipeNumber = 1,
+ .DataINPipeDoubleBank = false,
+
+ .DataOUTPipeNumber = 2,
+ .DataOUTPipeDoubleBank = false,
+ },
+ };
+
+void DiskHost_USBTask(void)
+{
+ if (USB_HostState == HOST_STATE_Addressed)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+
+ uint16_t ConfigDescriptorSize;
+ uint8_t ConfigDescriptorData[512];
+
+ if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
+ sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ return;
+ }
+
+ if (MS_Host_ConfigurePipes(&DiskHost_MS_Interface,
+ ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ return;
+ }
+
+ if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ return;
+ }
+
+ uint8_t MaxLUNIndex;
+ if (MS_Host_GetMaxLUN(&DiskHost_MS_Interface, &MaxLUNIndex))
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ return;
+ }
+
+ if (MS_Host_ResetMSInterface(&DiskHost_MS_Interface))
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ return;
+ }
+
+ USB_HostState = HOST_STATE_Configured;
+
+ /* Note: For the RequestSense call to work, the host state machine must be in the
+ * Configured state, or the call will be aborted */
+ SCSI_Request_Sense_Response_t SenseData;
+ if (MS_Host_RequestSense(&DiskHost_MS_Interface, 0, &SenseData) != 0)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ return;
+ }
+
+ pf_mount(&DiskFATState);
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ }
+
+ MS_Host_USBTask(&DiskHost_MS_Interface);
+}
+
+void EVENT_USB_Host_DeviceAttached(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+void EVENT_USB_Host_DeviceUnattached(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.h b/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
index 5e417aefd..72c4f621b 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
@@ -1,62 +1,62 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 DiskHost.c.
- */
-
-#ifndef _DISK_HOST_H_
-#define _DISK_HOST_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include "Descriptors.h"
- #include "StandaloneProgrammer.h"
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- /* External Variables: */
- #if defined(USB_CAN_BE_HOST)
- extern USB_ClassInfo_MS_Host_t DiskHost_MS_Interface;
- #endif
-
- /* Function Prototypes: */
- #if defined(USB_CAN_BE_HOST)
- void DiskHost_USBTask(void);
-
- void EVENT_USB_Host_DeviceAttached(void);
- void EVENT_USB_Host_DeviceUnattached(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 DiskHost.c.
+ */
+
+#ifndef _DISK_HOST_H_
+#define _DISK_HOST_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include "Descriptors.h"
+ #include "StandaloneProgrammer.h"
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ /* External Variables: */
+ #if defined(USB_CAN_BE_HOST)
+ extern USB_ClassInfo_MS_Host_t DiskHost_MS_Interface;
+ #endif
+
+ /* Function Prototypes: */
+ #if defined(USB_CAN_BE_HOST)
+ void DiskHost_USBTask(void);
+
+ void EVENT_USB_Host_DeviceAttached(void);
+ void EVENT_USB_Host_DeviceUnattached(void);
+ #endif
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
index 976d9e98e..f54b25be4 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
@@ -1,527 +1,527 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Functions to manage the physical dataflash media, including reading and writing of
- * blocks of data. These functions are called by the SCSI layer when data must be stored
- * or retrieved to/from the physical storage media. If a different media is used (such
- * as a SD card or EEPROM), functions similar to these will need to be generated.
- */
-
-#define INCLUDE_FROM_DATAFLASHMANAGER_C
-#include "DataflashManager.h"
-
-#if defined(USB_CAN_BE_DEVICE)
-/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
- * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes
- * them to the dataflash in Dataflash page sized blocks.
- *
- * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
- * \param[in] BlockAddress Data block starting address for the write sequence
- * \param[in] TotalBlocks Number of blocks of data to write
- */
-void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- bool UsingSecondBuffer = false;
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
- /* Wait until endpoint is ready before continuing */
- if (Endpoint_WaitUntilReady())
- return;
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if the endpoint is currently empty */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the current endpoint bank */
- Endpoint_ClearOUT();
-
- /* Wait until the host has sent another packet */
- if (Endpoint_WaitUntilReady())
- return;
- }
-
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
-
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
- if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
- UsingSecondBuffer = !(UsingSecondBuffer);
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
- if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
- }
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
- }
-
- /* Write one 16-byte chunk of data to the dataflash */
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
-
- /* Check if the current command is being aborted by the host */
- if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
- }
-
- /* Decrement the blocks remaining counter and reset the sub block counter */
- TotalBlocks--;
- }
-
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0x00);
- Dataflash_WaitWhileBusy();
-
- /* If the endpoint is empty, clear it ready for the next packet from the host */
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearOUT();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
- * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash
- * and writes them in OS sized blocks to the endpoint.
- *
- * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
- * \param[in] BlockAddress Data block starting address for the read sequence
- * \param[in] TotalBlocks Number of blocks of data to read
- */
-void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
-
- /* Wait until endpoint is ready before continuing */
- if (Endpoint_WaitUntilReady())
- return;
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if the endpoint is currently full */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the endpoint bank to send its contents to the host */
- Endpoint_ClearIN();
-
- /* Wait until the endpoint is ready for more data */
- if (Endpoint_WaitUntilReady())
- return;
- }
-
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- }
-
- /* Read one 16-byte chunk of data from the dataflash */
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
-
- /* Check if the current command is being aborted by the host */
- if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
- }
-
- /* Decrement the blocks remaining counter */
- TotalBlocks--;
- }
-
- /* If the endpoint is full, send its contents to the host */
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearIN();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
- * the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the
- * dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the
- * dataflash.
- *
- * \param[in] BlockAddress Data block starting address for the write sequence
- * \param[in] TotalBlocks Number of blocks of data to write
- * \param[in] BufferPtr Pointer to the data source RAM buffer
- */
-void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- bool UsingSecondBuffer = false;
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
-
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
- if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
- UsingSecondBuffer = !(UsingSecondBuffer);
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
- if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
- }
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_ToggleSelectedChipCS();
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
- }
-
- /* Write one 16-byte chunk of data to the dataflash */
- for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
- Dataflash_SendByte(*(BufferPtr++));
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
- }
-
- /* Decrement the blocks remaining counter and reset the sub block counter */
- TotalBlocks--;
- }
-
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0x00);
- Dataflash_WaitWhileBusy();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
- * the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash
- * and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read
- * the files stored on the dataflash.
- *
- * \param[in] BlockAddress Data block starting address for the read sequence
- * \param[in] TotalBlocks Number of blocks of data to read
- * \param[out] BufferPtr Pointer to the data destination RAM buffer
- */
-void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- }
-
- /* Read one 16-byte chunk of data from the dataflash */
- for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
- *(BufferPtr++) = Dataflash_ReceiveByte();
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
- }
-
- /* Decrement the blocks remaining counter */
- TotalBlocks--;
- }
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */
-void DataflashManager_ResetDataflashProtections(void)
-{
- /* Select first dataflash chip, send the read status register command */
- Dataflash_SelectChip(DATAFLASH_CHIP1);
- Dataflash_SendByte(DF_CMD_GETSTATUS);
-
- /* Check if sector protection is enabled */
- if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
- {
- Dataflash_ToggleSelectedChipCS();
-
- /* Send the commands to disable sector protection */
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
- }
-
- /* Select second dataflash chip (if present on selected board), send read status register command */
- #if (DATAFLASH_TOTALCHIPS == 2)
- Dataflash_SelectChip(DATAFLASH_CHIP2);
- Dataflash_SendByte(DF_CMD_GETSTATUS);
-
- /* Check if sector protection is enabled */
- if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
- {
- Dataflash_ToggleSelectedChipCS();
-
- /* Send the commands to disable sector protection */
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
- }
- #endif
-
- /* Deselect current dataflash chip */
- Dataflash_DeselectChip();
-}
-
-/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
- *
- * \return Boolean true if all media chips are working, false otherwise
- */
-bool DataflashManager_CheckDataflashOperation(void)
-{
- uint8_t ReturnByte;
-
- /* Test first Dataflash IC is present and responding to commands */
- Dataflash_SelectChip(DATAFLASH_CHIP1);
- Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
- ReturnByte = Dataflash_ReceiveByte();
- Dataflash_DeselectChip();
-
- /* If returned data is invalid, fail the command */
- if (ReturnByte != DF_MANUFACTURER_ATMEL)
- return false;
-
- #if (DATAFLASH_TOTALCHIPS == 2)
- /* Test second Dataflash IC is present and responding to commands */
- Dataflash_SelectChip(DATAFLASH_CHIP2);
- Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
- ReturnByte = Dataflash_ReceiveByte();
- Dataflash_DeselectChip();
-
- /* If returned data is invalid, fail the command */
- if (ReturnByte != DF_MANUFACTURER_ATMEL)
- return false;
- #endif
-
- return true;
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Functions to manage the physical dataflash media, including reading and writing of
+ * blocks of data. These functions are called by the SCSI layer when data must be stored
+ * or retrieved to/from the physical storage media. If a different media is used (such
+ * as a SD card or EEPROM), functions similar to these will need to be generated.
+ */
+
+#define INCLUDE_FROM_DATAFLASHMANAGER_C
+#include "DataflashManager.h"
+
+#if defined(USB_CAN_BE_DEVICE)
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
+ * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes
+ * them to the dataflash in Dataflash page sized blocks.
+ *
+ * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
+ * \param[in] BlockAddress Data block starting address for the write sequence
+ * \param[in] TotalBlocks Number of blocks of data to write
+ */
+void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+ bool UsingSecondBuffer = false;
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, CurrDFPageByte);
+
+ /* Wait until endpoint is ready before continuing */
+ if (Endpoint_WaitUntilReady())
+ return;
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if the endpoint is currently empty */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the current endpoint bank */
+ Endpoint_ClearOUT();
+
+ /* Wait until the host has sent another packet */
+ if (Endpoint_WaitUntilReady())
+ return;
+ }
+
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
+ if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
+ UsingSecondBuffer = !(UsingSecondBuffer);
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
+ if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+ }
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, 0);
+ }
+
+ /* Write one 16-byte chunk of data to the dataflash */
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+
+ /* Check if the current command is being aborted by the host */
+ if (MSInterfaceInfo->State.IsMassStoreReset)
+ return;
+ }
+
+ /* Decrement the blocks remaining counter and reset the sub block counter */
+ TotalBlocks--;
+ }
+
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0x00);
+ Dataflash_WaitWhileBusy();
+
+ /* If the endpoint is empty, clear it ready for the next packet from the host */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearOUT();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
+ * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash
+ * and writes them in OS sized blocks to the endpoint.
+ *
+ * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
+ * \param[in] BlockAddress Data block starting address for the read sequence
+ * \param[in] TotalBlocks Number of blocks of data to read
+ */
+void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+
+ /* Wait until endpoint is ready before continuing */
+ if (Endpoint_WaitUntilReady())
+ return;
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if the endpoint is currently full */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the endpoint bank to send its contents to the host */
+ Endpoint_ClearIN();
+
+ /* Wait until the endpoint is ready for more data */
+ if (Endpoint_WaitUntilReady())
+ return;
+ }
+
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ }
+
+ /* Read one 16-byte chunk of data from the dataflash */
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+
+ /* Check if the current command is being aborted by the host */
+ if (MSInterfaceInfo->State.IsMassStoreReset)
+ return;
+ }
+
+ /* Decrement the blocks remaining counter */
+ TotalBlocks--;
+ }
+
+ /* If the endpoint is full, send its contents to the host */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearIN();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
+ * the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the
+ * dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the
+ * dataflash.
+ *
+ * \param[in] BlockAddress Data block starting address for the write sequence
+ * \param[in] TotalBlocks Number of blocks of data to write
+ * \param[in] BufferPtr Pointer to the data source RAM buffer
+ */
+void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+ bool UsingSecondBuffer = false;
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, CurrDFPageByte);
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
+ if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
+ UsingSecondBuffer = !(UsingSecondBuffer);
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
+ if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+ }
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_ToggleSelectedChipCS();
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, 0);
+ }
+
+ /* Write one 16-byte chunk of data to the dataflash */
+ for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
+ Dataflash_SendByte(*(BufferPtr++));
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+ }
+
+ /* Decrement the blocks remaining counter and reset the sub block counter */
+ TotalBlocks--;
+ }
+
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0x00);
+ Dataflash_WaitWhileBusy();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
+ * the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash
+ * and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read
+ * the files stored on the dataflash.
+ *
+ * \param[in] BlockAddress Data block starting address for the read sequence
+ * \param[in] TotalBlocks Number of blocks of data to read
+ * \param[out] BufferPtr Pointer to the data destination RAM buffer
+ */
+void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ }
+
+ /* Read one 16-byte chunk of data from the dataflash */
+ for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
+ *(BufferPtr++) = Dataflash_ReceiveByte();
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+ }
+
+ /* Decrement the blocks remaining counter */
+ TotalBlocks--;
+ }
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */
+void DataflashManager_ResetDataflashProtections(void)
+{
+ /* Select first dataflash chip, send the read status register command */
+ Dataflash_SelectChip(DATAFLASH_CHIP1);
+ Dataflash_SendByte(DF_CMD_GETSTATUS);
+
+ /* Check if sector protection is enabled */
+ if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
+ {
+ Dataflash_ToggleSelectedChipCS();
+
+ /* Send the commands to disable sector protection */
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
+ }
+
+ /* Select second dataflash chip (if present on selected board), send read status register command */
+ #if (DATAFLASH_TOTALCHIPS == 2)
+ Dataflash_SelectChip(DATAFLASH_CHIP2);
+ Dataflash_SendByte(DF_CMD_GETSTATUS);
+
+ /* Check if sector protection is enabled */
+ if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
+ {
+ Dataflash_ToggleSelectedChipCS();
+
+ /* Send the commands to disable sector protection */
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
+ }
+ #endif
+
+ /* Deselect current dataflash chip */
+ Dataflash_DeselectChip();
+}
+
+/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
+ *
+ * \return Boolean true if all media chips are working, false otherwise
+ */
+bool DataflashManager_CheckDataflashOperation(void)
+{
+ uint8_t ReturnByte;
+
+ /* Test first Dataflash IC is present and responding to commands */
+ Dataflash_SelectChip(DATAFLASH_CHIP1);
+ Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
+ ReturnByte = Dataflash_ReceiveByte();
+ Dataflash_DeselectChip();
+
+ /* If returned data is invalid, fail the command */
+ if (ReturnByte != DF_MANUFACTURER_ATMEL)
+ return false;
+
+ #if (DATAFLASH_TOTALCHIPS == 2)
+ /* Test second Dataflash IC is present and responding to commands */
+ Dataflash_SelectChip(DATAFLASH_CHIP2);
+ Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
+ ReturnByte = Dataflash_ReceiveByte();
+ Dataflash_DeselectChip();
+
+ /* If returned data is invalid, fail the command */
+ if (ReturnByte != DF_MANUFACTURER_ATMEL)
+ return false;
+ #endif
+
+ return true;
+}
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
index a67f533d6..8f62219ca 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
@@ -1,82 +1,82 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 DataflashManager.c.
- */
-
-#ifndef _DATAFLASH_MANAGER_H_
-#define _DATAFLASH_MANAGER_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include "StandaloneProgrammer.h"
- #include "Descriptors.h"
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/Board/Dataflash.h>
-
- /* Preprocessor Checks: */
- #if (DATAFLASH_PAGE_SIZE % 16)
- #error Dataflash page size must be a multiple of 16 bytes.
- #endif
-
- /* Defines: */
- /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */
- #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
-
- /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
- * storage media (Dataflash) using a different native block size. Do not change this value.
- */
- #define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
- * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
- */
- #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
- /* Function Prototypes: */
- #if defined(USB_CAN_BE_DEVICE)
- void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
- uint16_t TotalBlocks);
- void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
- uint16_t TotalBlocks);
- void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
- const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
- void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
- uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
- void DataflashManager_ResetDataflashProtections(void);
- bool DataflashManager_CheckDataflashOperation(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 DataflashManager.c.
+ */
+
+#ifndef _DATAFLASH_MANAGER_H_
+#define _DATAFLASH_MANAGER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include "StandaloneProgrammer.h"
+ #include "Descriptors.h"
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+ #include <LUFA/Drivers/Board/Dataflash.h>
+
+ /* Preprocessor Checks: */
+ #if (DATAFLASH_PAGE_SIZE % 16)
+ #error Dataflash page size must be a multiple of 16 bytes.
+ #endif
+
+ /* Defines: */
+ /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */
+ #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
+
+ /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
+ * storage media (Dataflash) using a different native block size. Do not change this value.
+ */
+ #define VIRTUAL_MEMORY_BLOCK_SIZE 512
+
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
+ */
+ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
+
+ /* Function Prototypes: */
+ #if defined(USB_CAN_BE_DEVICE)
+ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
+ uint16_t TotalBlocks);
+ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
+ uint16_t TotalBlocks);
+ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
+ const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
+ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
+ uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
+ void DataflashManager_ResetDataflashProtections(void);
+ bool DataflashManager_CheckDataflashOperation(void);
+ #endif
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
index 0703d5925..ee8effcf4 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
@@ -1,36 +1,36 @@
-Petit FatFs Module Source Files R0.01a (C)ChaN, 2010
-
-
-FILES
-
- pff.h Common include file for Petit FatFs and application module.
- pff.c Petit FatFs module.
- diskio.h Common include file for Petit FatFs and disk I/O module.
- diskio.c Skeleton of low level disk I/O module.
- integer.h Alternative type definitions for integer variables.
-
- Low level disk I/O module is not included in this archive because the Petit
- FatFs module is only a generic file system layer and not depend on any
- specific storage device. You have to provide a low level disk I/O module that
- written to control your storage device.
-
-
-
-AGREEMENTS
-
- Petit FatFs module is an open source software to implement FAT file system to
- small embedded systems. This is a free software and is opened for education,
- research and commercial developments under license policy of following trems.
-
- Copyright (C) 2010, ChaN, all right reserved.
-
- * The Petit FatFs module is a free software and there is NO WARRANTY.
- * No restriction on use. You can use, modify and redistribute it for
- personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
- * Redistributions of source code must retain the above copyright notice.
-
-
-
-REVISION HISTORY
-
- Jun 15, 2010 R0.01a First release (Branched from FatFs R0.07b)
+Petit FatFs Module Source Files R0.01a (C)ChaN, 2010
+
+
+FILES
+
+ pff.h Common include file for Petit FatFs and application module.
+ pff.c Petit FatFs module.
+ diskio.h Common include file for Petit FatFs and disk I/O module.
+ diskio.c Skeleton of low level disk I/O module.
+ integer.h Alternative type definitions for integer variables.
+
+ Low level disk I/O module is not included in this archive because the Petit
+ FatFs module is only a generic file system layer and not depend on any
+ specific storage device. You have to provide a low level disk I/O module that
+ written to control your storage device.
+
+
+
+AGREEMENTS
+
+ Petit FatFs module is an open source software to implement FAT file system to
+ small embedded systems. This is a free software and is opened for education,
+ research and commercial developments under license policy of following trems.
+
+ Copyright (C) 2010, ChaN, all right reserved.
+
+ * The Petit FatFs module is a free software and there is NO WARRANTY.
+ * No restriction on use. You can use, modify and redistribute it for
+ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
+ * Redistributions of source code must retain the above copyright notice.
+
+
+
+REVISION HISTORY
+
+ Jun 15, 2010 R0.01a First release (Branched from FatFs R0.07b)
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
index c0393dd84..47e73159f 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
@@ -1,57 +1,57 @@
-/*-----------------------------------------------------------------------*/
-/* Low level disk I/O module skeleton for Petit FatFs (C)ChaN, 2010 */
-/*-----------------------------------------------------------------------*/
-
-#include "diskio.h"
-
-#include <string.h>
-#include <LUFA/Drivers/USB/Class/MassStorage.h>
-#include "../DataflashManager.h"
-#include "../../DiskHost.h"
-
-/*-----------------------------------------------------------------------*/
-/* Initialize Disk Drive */
-/*-----------------------------------------------------------------------*/
-
-DSTATUS disk_initialize (void)
-{
- return RES_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read Partial Sector */
-/*-----------------------------------------------------------------------*/
-
-DRESULT disk_readp (
- void* dest, /* Pointer to the destination object */
- DWORD sector, /* Sector number (LBA) */
- WORD sofs, /* Offset in the sector */
- WORD count /* Byte count (bit15:destination) */
-)
-{
- DRESULT ErrorCode = RES_OK;
- uint8_t BlockTemp[512];
-
- if (USB_CurrentMode == USB_MODE_HOST)
- {
- #if defined(USB_CAN_BE_HOST)
- if (USB_HostState != HOST_STATE_Configured)
- ErrorCode = RES_NOTRDY;
- else if (MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp))
- ErrorCode = RES_ERROR;
- #endif
- }
- else
- {
- #if defined(USB_CAN_BE_DEVICE)
- DataflashManager_ReadBlocks_RAM(sector, 1, BlockTemp);
- #endif
- }
-
- memcpy(dest, &BlockTemp[sofs], count);
-
- return ErrorCode;
-}
-
+/*-----------------------------------------------------------------------*/
+/* Low level disk I/O module skeleton for Petit FatFs (C)ChaN, 2010 */
+/*-----------------------------------------------------------------------*/
+
+#include "diskio.h"
+
+#include <string.h>
+#include <LUFA/Drivers/USB/Class/MassStorage.h>
+#include "../DataflashManager.h"
+#include "../../DiskHost.h"
+
+/*-----------------------------------------------------------------------*/
+/* Initialize Disk Drive */
+/*-----------------------------------------------------------------------*/
+
+DSTATUS disk_initialize (void)
+{
+ return RES_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read Partial Sector */
+/*-----------------------------------------------------------------------*/
+
+DRESULT disk_readp (
+ void* dest, /* Pointer to the destination object */
+ DWORD sector, /* Sector number (LBA) */
+ WORD sofs, /* Offset in the sector */
+ WORD count /* Byte count (bit15:destination) */
+)
+{
+ DRESULT ErrorCode = RES_OK;
+ uint8_t BlockTemp[512];
+
+ if (USB_CurrentMode == USB_MODE_HOST)
+ {
+ #if defined(USB_CAN_BE_HOST)
+ if (USB_HostState != HOST_STATE_Configured)
+ ErrorCode = RES_NOTRDY;
+ else if (MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp))
+ ErrorCode = RES_ERROR;
+ #endif
+ }
+ else
+ {
+ #if defined(USB_CAN_BE_DEVICE)
+ DataflashManager_ReadBlocks_RAM(sector, 1, BlockTemp);
+ #endif
+ }
+
+ memcpy(dest, &BlockTemp[sofs], count);
+
+ return ErrorCode;
+}
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
index 7caa7f44f..4e9aa76f4 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
@@ -1,36 +1,36 @@
-/*-----------------------------------------------------------------------
-/ PFF - Low level disk interface modlue include file (C)ChaN, 2010
-/-----------------------------------------------------------------------*/
-
-#ifndef _DISKIO
-
-#include "integer.h"
-
-
-/* Status of Disk Functions */
-typedef BYTE DSTATUS;
-
-
-/* Results of Disk Functions */
-typedef enum {
- RES_OK = 0, /* 0: Function succeeded */
- RES_ERROR, /* 1: Disk error */
- RES_STRERR, /* 2: Seream error */
- RES_NOTRDY, /* 3: Not ready */
- RES_PARERR /* 4: Invalid parameter */
-} DRESULT;
-
-
-/*---------------------------------------*/
-/* Prototypes for disk control functions */
-
-DSTATUS disk_initialize (void);
-DRESULT disk_readp (void*, DWORD, WORD, WORD);
-
-BOOL assign_drives (int argc, char *argv[]);
-
-#define STA_NOINIT 0x01 /* Drive not initialized */
-#define STA_NODISK 0x02 /* No medium in the drive */
-
-#define _DISKIO
-#endif
+/*-----------------------------------------------------------------------
+/ PFF - Low level disk interface modlue include file (C)ChaN, 2010
+/-----------------------------------------------------------------------*/
+
+#ifndef _DISKIO
+
+#include "integer.h"
+
+
+/* Status of Disk Functions */
+typedef BYTE DSTATUS;
+
+
+/* Results of Disk Functions */
+typedef enum {
+ RES_OK = 0, /* 0: Function succeeded */
+ RES_ERROR, /* 1: Disk error */
+ RES_STRERR, /* 2: Seream error */
+ RES_NOTRDY, /* 3: Not ready */
+ RES_PARERR /* 4: Invalid parameter */
+} DRESULT;
+
+
+/*---------------------------------------*/
+/* Prototypes for disk control functions */
+
+DSTATUS disk_initialize (void);
+DRESULT disk_readp (void*, DWORD, WORD, WORD);
+
+BOOL assign_drives (int argc, char *argv[]);
+
+#define STA_NOINIT 0x01 /* Drive not initialized */
+#define STA_NODISK 0x02 /* No medium in the drive */
+
+#define _DISKIO
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
index 1d6bac368..851a78da2 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
@@ -1,37 +1,37 @@
-/*-------------------------------------------*/
-/* Integer type definitions for FatFs module */
-/*-------------------------------------------*/
-
-#ifndef _INTEGER
-
-#if 0
-#include <windows.h>
-#else
-
-/* These types must be 16-bit, 32-bit or larger integer */
-typedef int INT;
-typedef unsigned int UINT;
-
-/* These types must be 8-bit integer */
-typedef signed char CHAR;
-typedef unsigned char UCHAR;
-typedef unsigned char BYTE;
-
-/* These types must be 16-bit integer */
-typedef short SHORT;
-typedef unsigned short USHORT;
-typedef unsigned short WORD;
-typedef unsigned short WCHAR;
-
-/* These types must be 32-bit integer */
-typedef long LONG;
-typedef unsigned long ULONG;
-typedef unsigned long DWORD;
-
-/* Boolean type */
-typedef enum { FALSE = 0, TRUE } BOOL;
-
-#endif
-
-#define _INTEGER
-#endif
+/*-------------------------------------------*/
+/* Integer type definitions for FatFs module */
+/*-------------------------------------------*/
+
+#ifndef _INTEGER
+
+#if 0
+#include <windows.h>
+#else
+
+/* These types must be 16-bit, 32-bit or larger integer */
+typedef int INT;
+typedef unsigned int UINT;
+
+/* These types must be 8-bit integer */
+typedef signed char CHAR;
+typedef unsigned char UCHAR;
+typedef unsigned char BYTE;
+
+/* These types must be 16-bit integer */
+typedef short SHORT;
+typedef unsigned short USHORT;
+typedef unsigned short WORD;
+typedef unsigned short WCHAR;
+
+/* These types must be 32-bit integer */
+typedef long LONG;
+typedef unsigned long ULONG;
+typedef unsigned long DWORD;
+
+/* Boolean type */
+typedef enum { FALSE = 0, TRUE } BOOL;
+
+#endif
+
+#define _INTEGER
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
index 54c1d2406..b7b7fb8cb 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
@@ -1,777 +1,777 @@
-/*----------------------------------------------------------------------------/
-/ Petit FatFs - FAT file system module R0.01a (C)ChaN, 2010
-/-----------------------------------------------------------------------------/
-/ Petit FatFs module is an open source software to implement FAT file system to
-/ small embedded systems. This is a free software and is opened for education,
-/ research and commercial developments under license policy of following trems.
-/
-/ Copyright (C) 2010, ChaN, all right reserved.
-/
-/ * The Petit FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
-/
-/-----------------------------------------------------------------------------/
-/ Jun 15,'09 R0.01a Branched from FatFs R0.07b
-/----------------------------------------------------------------------------*/
-
-#include "pff.h" /* Petit FatFs configurations and declarations */
-#include "diskio.h" /* Declarations of low level disk I/O functions */
-
-
-/*--------------------------------------------------------------------------
-
- Private Work Area
-
----------------------------------------------------------------------------*/
-
-static
-FATFS *FatFs; /* Pointer to the file system object (logical drive) */
-
-
-/*--------------------------------------------------------------------------
-
- Private Functions
-
----------------------------------------------------------------------------*/
-
-
-/*-----------------------------------------------------------------------*/
-/* String functions */
-/*-----------------------------------------------------------------------*/
-
-/* Fill memory */
-static
-void mem_set (void* dst, int val, int cnt) {
- char *d = (char*)dst;
- while (cnt--) *d++ = (char)val;
-}
-
-/* Compare memory to memory */
-static
-int mem_cmp (const void* dst, const void* src, int cnt) {
- const char *d = (const char *)dst, *s = (const char *)src;
- int r = 0;
- while (cnt-- && (r = *d++ - *s++) == 0) ;
- return r;
-}
-
-/* Check if chr is contained in the string */
-static
-int chk_chr (const char* str, int chr) {
- while (*str && *str != chr) str++;
- return *str;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT access - Read value of a FAT entry */
-/*-----------------------------------------------------------------------*/
-
-static
-CLUST get_fat ( /* 1:IO error, Else:Cluster status */
- CLUST clst /* Cluster# to get the link information */
-)
-{
- WORD wc, bc, ofs;
- BYTE buf[4];
- FATFS *fs = FatFs;
-
-
- if (clst < 2 || clst >= fs->max_clust) /* Range check */
- return 1;
-
- switch (fs->fs_type) {
- case FS_FAT12 :
- bc = (WORD)clst; bc += bc / 2;
- ofs = bc % 512; bc /= 512;
- if (ofs != 511) {
- if (disk_readp(buf, fs->fatbase + bc, ofs, 2)) break;
- } else {
- if (disk_readp(buf, fs->fatbase + bc, 511, 1)) break;
- if (disk_readp(buf+1, fs->fatbase + bc + 1, 0, 1)) break;
- }
- wc = LD_WORD(buf);
- return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);
-
- case FS_FAT16 :
- if (disk_readp(buf, fs->fatbase + clst / 256, (WORD)(((WORD)clst % 256) * 2), 2)) break;
- return LD_WORD(buf);
-#if _FS_FAT32
- case FS_FAT32 :
- if (disk_readp(buf, fs->fatbase + clst / 128, (WORD)(((WORD)clst % 128) * 4), 4)) break;
- return LD_DWORD(buf) & 0x0FFFFFFF;
-#endif
- }
-
- return 1; /* An error occured at the disk I/O layer */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Get sector# from cluster# */
-/*-----------------------------------------------------------------------*/
-
-static
-DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
- CLUST clst /* Cluster# to be converted */
-)
-{
- FATFS *fs = FatFs;
-
-
- clst -= 2;
- if (clst >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
- return (DWORD)clst * fs->csize + fs->database;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Rewind directory index */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_rewind (
- DIR *dj /* Pointer to directory object */
-)
-{
- CLUST clst;
- FATFS *fs = FatFs;
-
-
- dj->index = 0;
- clst = dj->sclust;
- if (clst == 1 || clst >= fs->max_clust) /* Check start cluster range */
- return FR_DISK_ERR;
-#if _FS_FAT32
- if (!clst && fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
- clst = fs->dirbase;
-#endif
- dj->clust = clst; /* Current cluster */
- dj->sect = clst ? clust2sect(clst) : fs->dirbase; /* Current sector */
-
- return FR_OK; /* Seek succeeded */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Move directory index next */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */
- DIR *dj /* Pointer to directory object */
-)
-{
- CLUST clst;
- WORD i;
- FATFS *fs = FatFs;
-
-
- i = dj->index + 1;
- if (!i || !dj->sect) /* Report EOT when index has reached 65535 */
- return FR_NO_FILE;
-
- if (!(i & (16-1))) { /* Sector changed? */
- dj->sect++; /* Next sector */
-
- if (dj->clust == 0) { /* Static table */
- if (i >= fs->n_rootdir) /* Report EOT when end of table */
- return FR_NO_FILE;
- }
- else { /* Dynamic table */
- if (((i / 16) & (fs->csize-1)) == 0) { /* Cluster changed? */
- clst = get_fat(dj->clust); /* Get next cluster */
- if (clst <= 1) return FR_DISK_ERR;
- if (clst >= fs->max_clust) /* When it reached end of dynamic table */
- return FR_NO_FILE; /* Report EOT */
- dj->clust = clst; /* Initialize data for new cluster */
- dj->sect = clust2sect(clst);
- }
- }
- }
-
- dj->index = i;
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Find an object in the directory */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_find (
- DIR *dj /* Pointer to the directory object linked to the file name */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-
-
- res = dir_rewind(dj); /* Rewind directory object */
- if (res != FR_OK) return res;
-
- dir = FatFs->buf;
- do {
- res = disk_readp(dir, dj->sect, (WORD)((dj->index % 16) * 32), 32) /* Read an entry */
- ? FR_DISK_ERR : FR_OK;
- if (res != FR_OK) break;
- c = dir[DIR_Name]; /* First character */
- if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
- if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */
- break;
- res = dir_next(dj); /* Next entry */
- } while (res == FR_OK);
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read an object from the directory */
-/*-----------------------------------------------------------------------*/
-#if _USE_DIR
-static
-FRESULT dir_read (
- DIR *dj /* Pointer to the directory object to store read object name */
-)
-{
- FRESULT res;
- BYTE a, c, *dir;
-
-
- res = FR_NO_FILE;
- while (dj->sect) {
- dir = FatFs->buf;
- res = disk_readp(dir, dj->sect, (WORD)((dj->index % 16) * 32), 32) /* Read an entry */
- ? FR_DISK_ERR : FR_OK;
- if (res != FR_OK) break;
- c = dir[DIR_Name];
- if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
- a = dir[DIR_Attr] & AM_MASK;
- if (c != 0xE5 && c != '.' && !(a & AM_VOL)) /* Is it a valid entry? */
- break;
- res = dir_next(dj); /* Next entry */
- if (res != FR_OK) break;
- }
-
- if (res != FR_OK) dj->sect = 0;
-
- return res;
-}
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Pick a segment and create the object name in directory form */
-/*-----------------------------------------------------------------------*/
-
-
-static
-FRESULT create_name (
- DIR *dj, /* Pointer to the directory object */
- const char **path /* Pointer to pointer to the segment in the path string */
-)
-{
- BYTE c, ni, si, i, *sfn;
- const char *p;
-
- /* Create file name in directory form */
- sfn = dj->fn;
- mem_set(sfn, ' ', 11);
- si = i = 0; ni = 8;
- p = *path;
- for (;;) {
- c = p[si++];
- if (c < ' ' || c == '/') break; /* Break on end of segment */
- if (c == '.' || i >= ni) {
- if (ni != 8 || c != '.') return FR_INVALID_NAME;
- i = 8; ni = 11;
- continue;
- }
- if (c >= 0x7F || chk_chr(" +,;[=\\]\"*:<>\?|", c)) /* Reject unallowable chrs for SFN */
- return FR_INVALID_NAME;
- if (c >='a' && c <= 'z') c -= 0x20;
- sfn[i++] = c;
- }
- if (!i) return FR_INVALID_NAME; /* Reject null string */
- *path = &p[si]; /* Rerurn pointer to the next segment */
-
- sfn[11] = (c < ' ') ? 1 : 0; /* Set last segment flag if end of path */
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Get file information from directory entry */
-/*-----------------------------------------------------------------------*/
-#if _USE_DIR
-static
-void get_fileinfo ( /* No return code */
- DIR *dj, /* Pointer to the directory object */
- FILINFO *fno /* Pointer to store the file information */
-)
-{
- BYTE i, c, *dir;
- char *p;
-
-
- p = fno->fname;
- if (dj->sect) {
- dir = FatFs->buf;
- for (i = 0; i < 8; i++) { /* Copy file name body */
- c = dir[i];
- if (c == ' ') break;
- if (c == 0x05) c = 0xE5;
- *p++ = c;
- }
- if (dir[8] != ' ') { /* Copy file name extension */
- *p++ = '.';
- for (i = 8; i < 11; i++) {
- c = dir[i];
- if (c == ' ') break;
- *p++ = c;
- }
- }
- fno->fattrib = dir[DIR_Attr]; /* Attribute */
- fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */
- fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */
- fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */
- }
- *p = 0;
-}
-#endif /* _USE_DIR */
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Follow a file path */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
- DIR *dj, /* Directory object to return last directory and found object */
- const char *path /* Full-path string to find a file or directory */
-)
-{
- FRESULT res;
- BYTE *dir;
-
-
- if (*path == '/') path++; /* Strip heading separator */
- dj->sclust = 0; /* Set start directory (always root dir) */
-
- if ((BYTE)*path < ' ') { /* Null path means the root directory */
- res = dir_rewind(dj);
- FatFs->buf[0] = 0;
-
- } else { /* Follow path */
- for (;;) {
- res = create_name(dj, &path); /* Get a segment */
- if (res != FR_OK) break;
- res = dir_find(dj); /* Find it */
- if (res != FR_OK) { /* Could not find the object */
- if (res == FR_NO_FILE && !*(dj->fn+11))
- res = FR_NO_PATH;
- break;
- }
- if (*(dj->fn+11)) break; /* Last segment match. Function completed. */
- dir = FatFs->buf; /* There is next segment. Follow the sub directory */
- if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */
- res = FR_NO_PATH; break;
- }
- dj->sclust =
-#if _FS_FAT32
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
-#endif
- LD_WORD(dir+DIR_FstClusLO);
- }
- }
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Check a sector if it is an FAT boot record */
-/*-----------------------------------------------------------------------*/
-
-static
-BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
- BYTE *buf, /* Working buffer */
- DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
-)
-{
- if (disk_readp(buf, sect, 510, 2)) /* Read the boot sector */
- return 3;
- if (LD_WORD(buf) != 0xAA55) /* Check record signature */
- return 2;
-
- if (!disk_readp(buf, sect, BS_FilSysType, 2) && LD_WORD(buf) == 0x4146) /* Check FAT12/16 */
- return 0;
-#if _FS_FAT32
- if (!disk_readp(buf, sect, BS_FilSysType32, 2) && LD_WORD(buf) == 0x4146) /* Check FAT32 */
- return 0;
-#endif
- return 1;
-}
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Public Functions
-
---------------------------------------------------------------------------*/
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Mount/Unmount a Locical Drive */
-/*-----------------------------------------------------------------------*/
-
-FRESULT pf_mount (
- FATFS *fs /* Pointer to new file system object (NULL: Unmount) */
-)
-{
- BYTE fmt, buf[36];
- DWORD bsect, fsize, tsect, mclst;
-
-
- FatFs = 0;
- if (!fs) return FR_OK; /* Unregister fs object */
-
- if (disk_initialize() & STA_NOINIT) /* Check if the drive is ready or not */
- return FR_NOT_READY;
-
- /* Search FAT partition on the drive */
- bsect = 0;
- fmt = check_fs(buf, bsect); /* Check sector 0 as an SFD format */
- if (fmt == 1) { /* Not an FAT boot record, it may be FDISK format */
- /* Check a partition listed in top of the partition table */
- if (disk_readp(buf, bsect, MBR_Table, 16)) { /* 1st partition entry */
- fmt = 3;
- } else {
- if (buf[4]) { /* Is the partition existing? */
- bsect = LD_DWORD(&buf[8]); /* Partition offset in LBA */
- fmt = check_fs(buf, bsect); /* Check the partition */
- }
- }
- }
- if (fmt == 3) return FR_DISK_ERR;
- if (fmt) return FR_NO_FILESYSTEM; /* No valid FAT patition is found */
-
- /* Initialize the file system object */
- if (disk_readp(buf, bsect, 13, sizeof(buf))) return FR_DISK_ERR;
-
- fsize = LD_WORD(buf+BPB_FATSz16-13); /* Number of sectors per FAT */
- if (!fsize) fsize = LD_DWORD(buf+BPB_FATSz32-13);
-
- fsize *= buf[BPB_NumFATs-13]; /* Number of sectors in FAT area */
- fs->fatbase = bsect + LD_WORD(buf+BPB_RsvdSecCnt-13); /* FAT start sector (lba) */
- fs->csize = buf[BPB_SecPerClus-13]; /* Number of sectors per cluster */
- fs->n_rootdir = LD_WORD(buf+BPB_RootEntCnt-13); /* Nmuber of root directory entries */
- tsect = LD_WORD(buf+BPB_TotSec16-13); /* Number of sectors on the file system */
- if (!tsect) tsect = LD_DWORD(buf+BPB_TotSec32-13);
- mclst = (tsect /* Last cluster# + 1 */
- - LD_WORD(buf+BPB_RsvdSecCnt-13) - fsize - fs->n_rootdir / 16
- ) / fs->csize + 2;
- fs->max_clust = (CLUST)mclst;
-
- fmt = FS_FAT12; /* Determine the FAT sub type */
- if (mclst >= 0xFF7) fmt = FS_FAT16; /* Number of clusters >= 0xFF5 */
- if (mclst >= 0xFFF7) /* Number of clusters >= 0xFFF5 */
-#if _FS_FAT32
- fmt = FS_FAT32;
-#else
- return FR_NO_FILESYSTEM;
-#endif
-
- fs->fs_type = fmt; /* FAT sub-type */
-#if _FS_FAT32
- if (fmt == FS_FAT32)
- fs->dirbase = LD_DWORD(buf+(BPB_RootClus-13)); /* Root directory start cluster */
- else
-#endif
- fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */
- fs->database = fs->fatbase + fsize + fs->n_rootdir / 16; /* Data start sector (lba) */
-
- fs->flag = 0;
- FatFs = fs;
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Open or Create a File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT pf_open (
- const char *path /* Pointer to the file name */
-)
-{
- FRESULT res;
- DIR dj;
- BYTE sp[12], dir[32];
- FATFS *fs = FatFs;
-
-
- if (!fs) /* Check file system */
- return FR_NOT_ENABLED;
-
- fs->flag = 0;
- fs->buf = dir;
- dj.fn = sp;
- res = follow_path(&dj, path); /* Follow the file path */
- if (res != FR_OK) return res; /* Follow failed */
- if (!dir[0] || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
- return FR_NO_FILE;
-
- fs->org_clust = /* File start cluster */
-#if _FS_FAT32
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
-#endif
- LD_WORD(dir+DIR_FstClusLO);
- fs->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */
- fs->fptr = 0; /* File pointer */
- fs->flag = FA_READ;
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT pf_read (
- void* dest, /* Pointer to the destination object */
- WORD btr, /* Number of bytes to read (bit15:destination) */
- WORD* br /* Pointer to number of bytes read */
-)
-{
- DRESULT dr;
- CLUST clst;
- DWORD sect, remain;
- WORD rcnt;
- BYTE *rbuff = dest;
- FATFS *fs = FatFs;
-
-
- *br = 0;
- if (!fs) return FR_NOT_ENABLED; /* Check file system */
- if (!(fs->flag & FA_READ))
- return FR_INVALID_OBJECT;
-
- remain = fs->fsize - fs->fptr;
- if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
-
- for ( ; btr; /* Repeat until all data transferred */
- rbuff += rcnt, fs->fptr += rcnt, *br += rcnt, btr -= rcnt) {
- if ((fs->fptr % 512) == 0) { /* On the sector boundary? */
- if ((fs->fptr / 512 % fs->csize) == 0) { /* On the cluster boundary? */
- clst = (fs->fptr == 0) ? /* On the top of the file? */
- fs->org_clust : get_fat(fs->curr_clust);
- if (clst <= 1) {
- fs->flag = 0; return FR_DISK_ERR;
- }
- fs->curr_clust = clst; /* Update current cluster */
- fs->csect = 0; /* Reset sector offset in the cluster */
- }
- sect = clust2sect(fs->curr_clust); /* Get current sector */
- if (!sect) {
- fs->flag = 0; return FR_DISK_ERR;
- }
- sect += fs->csect;
- fs->dsect = sect;
- fs->csect++; /* Next sector address in the cluster */
- }
- rcnt = 512 - ((WORD)fs->fptr % 512); /* Get partial sector data from sector buffer */
- if (rcnt > btr) rcnt = btr;
- if (fs->flag & FA_STREAM) {
- dr = disk_readp(dest, fs->dsect, (WORD)(fs->fptr % 512), (WORD)(rcnt | 0x8000));
- } else {
- dr = disk_readp(rbuff, fs->dsect, (WORD)(fs->fptr % 512), rcnt);
- }
- if (dr) {
- fs->flag = 0;
- return (dr == RES_STRERR) ? FR_STREAM_ERR : FR_DISK_ERR;
- }
- }
-
- return FR_OK;
-}
-
-
-
-
-#if _USE_LSEEK
-/*-----------------------------------------------------------------------*/
-/* Seek File R/W Pointer */
-/*-----------------------------------------------------------------------*/
-
-FRESULT pf_lseek (
- DWORD ofs /* File pointer from top of file */
-)
-{
- CLUST clst;
- DWORD bcs, nsect, ifptr;
- FATFS *fs = FatFs;
-
-
- if (!fs) return FR_NOT_ENABLED; /* Check file system */
- if (!(fs->flag & FA_READ))
- return FR_INVALID_OBJECT;
-
- if (ofs > fs->fsize) ofs = fs->fsize; /* Clip offset with the file size */
- ifptr = fs->fptr;
- fs->fptr = 0;
- if (ofs > 0) {
- bcs = (DWORD)fs->csize * 512; /* Cluster size (byte) */
- if (ifptr > 0 &&
- (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */
- fs->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */
- ofs -= fs->fptr;
- clst = fs->curr_clust;
- } else { /* When seek to back cluster, */
- clst = fs->org_clust; /* start from the first cluster */
- fs->curr_clust = clst;
- }
- while (ofs > bcs) { /* Cluster following loop */
- clst = get_fat(clst); /* Follow cluster chain if not in write mode */
- if (clst <= 1 || clst >= fs->max_clust) {
- fs->flag = 0; return FR_DISK_ERR;
- }
- fs->curr_clust = clst;
- fs->fptr += bcs;
- ofs -= bcs;
- }
- fs->fptr += ofs;
- fs->csect = (BYTE)(ofs / 512) + 1; /* Sector offset in the cluster */
- nsect = clust2sect(clst); /* Current sector */
- if (!nsect) {
- fs->flag = 0; return FR_DISK_ERR;
- }
- fs->dsect = nsect + fs->csect - 1;
- }
-
- return FR_OK;
-}
-#endif
-
-
-#if _USE_DIR
-/*-----------------------------------------------------------------------*/
-/* Create a Directroy Object */
-/*-----------------------------------------------------------------------*/
-
-FRESULT pf_opendir (
- DIR *dj, /* Pointer to directory object to create */
- const char *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- BYTE sp[12], dir[32];
- FATFS *fs = FatFs;
-
-
- if (!fs) { /* Check file system */
- res = FR_NOT_ENABLED;
- } else {
- fs->buf = dir;
- dj->fn = sp;
- res = follow_path(dj, path); /* Follow the path to the directory */
- if (res == FR_OK) { /* Follow completed */
- if (dir[0]) { /* It is not the root dir */
- if (dir[DIR_Attr] & AM_DIR) { /* The object is a directory */
- dj->sclust =
-#if _FS_FAT32
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
-#endif
- LD_WORD(dir+DIR_FstClusLO);
- } else { /* The object is not a directory */
- res = FR_NO_PATH;
- }
- }
- if (res == FR_OK) {
- res = dir_rewind(dj); /* Rewind dir */
- }
- }
- if (res == FR_NO_FILE) res = FR_NO_PATH;
- }
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read Directory Entry in Sequense */
-/*-----------------------------------------------------------------------*/
-
-FRESULT pf_readdir (
- DIR *dj, /* Pointer to the open directory object */
- FILINFO *fno /* Pointer to file information to return */
-)
-{
- FRESULT res;
- BYTE sp[12], dir[32];
- FATFS *fs = FatFs;
-
-
- if (!fs) { /* Check file system */
- res = FR_NOT_ENABLED;
- } else {
- fs->buf = dir;
- dj->fn = sp;
- if (!fno) {
- res = dir_rewind(dj);
- } else {
- res = dir_read(dj);
- if (res == FR_NO_FILE) {
- dj->sect = 0;
- res = FR_OK;
- }
- if (res == FR_OK) { /* A valid entry is found */
- get_fileinfo(dj, fno); /* Get the object information */
- res = dir_next(dj); /* Increment index for next */
- if (res == FR_NO_FILE) {
- dj->sect = 0;
- res = FR_OK;
- }
- }
- }
- }
-
- return res;
-}
-
-#endif /* _FS_DIR */
-
+/*----------------------------------------------------------------------------/
+/ Petit FatFs - FAT file system module R0.01a (C)ChaN, 2010
+/-----------------------------------------------------------------------------/
+/ Petit FatFs module is an open source software to implement FAT file system to
+/ small embedded systems. This is a free software and is opened for education,
+/ research and commercial developments under license policy of following trems.
+/
+/ Copyright (C) 2010, ChaN, all right reserved.
+/
+/ * The Petit FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/
+/-----------------------------------------------------------------------------/
+/ Jun 15,'09 R0.01a Branched from FatFs R0.07b
+/----------------------------------------------------------------------------*/
+
+#include "pff.h" /* Petit FatFs configurations and declarations */
+#include "diskio.h" /* Declarations of low level disk I/O functions */
+
+
+/*--------------------------------------------------------------------------
+
+ Private Work Area
+
+---------------------------------------------------------------------------*/
+
+static
+FATFS *FatFs; /* Pointer to the file system object (logical drive) */
+
+
+/*--------------------------------------------------------------------------
+
+ Private Functions
+
+---------------------------------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------*/
+/* String functions */
+/*-----------------------------------------------------------------------*/
+
+/* Fill memory */
+static
+void mem_set (void* dst, int val, int cnt) {
+ char *d = (char*)dst;
+ while (cnt--) *d++ = (char)val;
+}
+
+/* Compare memory to memory */
+static
+int mem_cmp (const void* dst, const void* src, int cnt) {
+ const char *d = (const char *)dst, *s = (const char *)src;
+ int r = 0;
+ while (cnt-- && (r = *d++ - *s++) == 0) ;
+ return r;
+}
+
+/* Check if chr is contained in the string */
+static
+int chk_chr (const char* str, int chr) {
+ while (*str && *str != chr) str++;
+ return *str;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT access - Read value of a FAT entry */
+/*-----------------------------------------------------------------------*/
+
+static
+CLUST get_fat ( /* 1:IO error, Else:Cluster status */
+ CLUST clst /* Cluster# to get the link information */
+)
+{
+ WORD wc, bc, ofs;
+ BYTE buf[4];
+ FATFS *fs = FatFs;
+
+
+ if (clst < 2 || clst >= fs->max_clust) /* Range check */
+ return 1;
+
+ switch (fs->fs_type) {
+ case FS_FAT12 :
+ bc = (WORD)clst; bc += bc / 2;
+ ofs = bc % 512; bc /= 512;
+ if (ofs != 511) {
+ if (disk_readp(buf, fs->fatbase + bc, ofs, 2)) break;
+ } else {
+ if (disk_readp(buf, fs->fatbase + bc, 511, 1)) break;
+ if (disk_readp(buf+1, fs->fatbase + bc + 1, 0, 1)) break;
+ }
+ wc = LD_WORD(buf);
+ return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);
+
+ case FS_FAT16 :
+ if (disk_readp(buf, fs->fatbase + clst / 256, (WORD)(((WORD)clst % 256) * 2), 2)) break;
+ return LD_WORD(buf);
+#if _FS_FAT32
+ case FS_FAT32 :
+ if (disk_readp(buf, fs->fatbase + clst / 128, (WORD)(((WORD)clst % 128) * 4), 4)) break;
+ return LD_DWORD(buf) & 0x0FFFFFFF;
+#endif
+ }
+
+ return 1; /* An error occured at the disk I/O layer */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Get sector# from cluster# */
+/*-----------------------------------------------------------------------*/
+
+static
+DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
+ CLUST clst /* Cluster# to be converted */
+)
+{
+ FATFS *fs = FatFs;
+
+
+ clst -= 2;
+ if (clst >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
+ return (DWORD)clst * fs->csize + fs->database;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Rewind directory index */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_rewind (
+ DIR *dj /* Pointer to directory object */
+)
+{
+ CLUST clst;
+ FATFS *fs = FatFs;
+
+
+ dj->index = 0;
+ clst = dj->sclust;
+ if (clst == 1 || clst >= fs->max_clust) /* Check start cluster range */
+ return FR_DISK_ERR;
+#if _FS_FAT32
+ if (!clst && fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
+ clst = fs->dirbase;
+#endif
+ dj->clust = clst; /* Current cluster */
+ dj->sect = clst ? clust2sect(clst) : fs->dirbase; /* Current sector */
+
+ return FR_OK; /* Seek succeeded */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Move directory index next */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */
+ DIR *dj /* Pointer to directory object */
+)
+{
+ CLUST clst;
+ WORD i;
+ FATFS *fs = FatFs;
+
+
+ i = dj->index + 1;
+ if (!i || !dj->sect) /* Report EOT when index has reached 65535 */
+ return FR_NO_FILE;
+
+ if (!(i & (16-1))) { /* Sector changed? */
+ dj->sect++; /* Next sector */
+
+ if (dj->clust == 0) { /* Static table */
+ if (i >= fs->n_rootdir) /* Report EOT when end of table */
+ return FR_NO_FILE;
+ }
+ else { /* Dynamic table */
+ if (((i / 16) & (fs->csize-1)) == 0) { /* Cluster changed? */
+ clst = get_fat(dj->clust); /* Get next cluster */
+ if (clst <= 1) return FR_DISK_ERR;
+ if (clst >= fs->max_clust) /* When it reached end of dynamic table */
+ return FR_NO_FILE; /* Report EOT */
+ dj->clust = clst; /* Initialize data for new cluster */
+ dj->sect = clust2sect(clst);
+ }
+ }
+ }
+
+ dj->index = i;
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Find an object in the directory */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_find (
+ DIR *dj /* Pointer to the directory object linked to the file name */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+
+
+ res = dir_rewind(dj); /* Rewind directory object */
+ if (res != FR_OK) return res;
+
+ dir = FatFs->buf;
+ do {
+ res = disk_readp(dir, dj->sect, (WORD)((dj->index % 16) * 32), 32) /* Read an entry */
+ ? FR_DISK_ERR : FR_OK;
+ if (res != FR_OK) break;
+ c = dir[DIR_Name]; /* First character */
+ if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
+ if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */
+ break;
+ res = dir_next(dj); /* Next entry */
+ } while (res == FR_OK);
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read an object from the directory */
+/*-----------------------------------------------------------------------*/
+#if _USE_DIR
+static
+FRESULT dir_read (
+ DIR *dj /* Pointer to the directory object to store read object name */
+)
+{
+ FRESULT res;
+ BYTE a, c, *dir;
+
+
+ res = FR_NO_FILE;
+ while (dj->sect) {
+ dir = FatFs->buf;
+ res = disk_readp(dir, dj->sect, (WORD)((dj->index % 16) * 32), 32) /* Read an entry */
+ ? FR_DISK_ERR : FR_OK;
+ if (res != FR_OK) break;
+ c = dir[DIR_Name];
+ if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
+ a = dir[DIR_Attr] & AM_MASK;
+ if (c != 0xE5 && c != '.' && !(a & AM_VOL)) /* Is it a valid entry? */
+ break;
+ res = dir_next(dj); /* Next entry */
+ if (res != FR_OK) break;
+ }
+
+ if (res != FR_OK) dj->sect = 0;
+
+ return res;
+}
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Pick a segment and create the object name in directory form */
+/*-----------------------------------------------------------------------*/
+
+
+static
+FRESULT create_name (
+ DIR *dj, /* Pointer to the directory object */
+ const char **path /* Pointer to pointer to the segment in the path string */
+)
+{
+ BYTE c, ni, si, i, *sfn;
+ const char *p;
+
+ /* Create file name in directory form */
+ sfn = dj->fn;
+ mem_set(sfn, ' ', 11);
+ si = i = 0; ni = 8;
+ p = *path;
+ for (;;) {
+ c = p[si++];
+ if (c < ' ' || c == '/') break; /* Break on end of segment */
+ if (c == '.' || i >= ni) {
+ if (ni != 8 || c != '.') return FR_INVALID_NAME;
+ i = 8; ni = 11;
+ continue;
+ }
+ if (c >= 0x7F || chk_chr(" +,;[=\\]\"*:<>\?|", c)) /* Reject unallowable chrs for SFN */
+ return FR_INVALID_NAME;
+ if (c >='a' && c <= 'z') c -= 0x20;
+ sfn[i++] = c;
+ }
+ if (!i) return FR_INVALID_NAME; /* Reject null string */
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+
+ sfn[11] = (c < ' ') ? 1 : 0; /* Set last segment flag if end of path */
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Get file information from directory entry */
+/*-----------------------------------------------------------------------*/
+#if _USE_DIR
+static
+void get_fileinfo ( /* No return code */
+ DIR *dj, /* Pointer to the directory object */
+ FILINFO *fno /* Pointer to store the file information */
+)
+{
+ BYTE i, c, *dir;
+ char *p;
+
+
+ p = fno->fname;
+ if (dj->sect) {
+ dir = FatFs->buf;
+ for (i = 0; i < 8; i++) { /* Copy file name body */
+ c = dir[i];
+ if (c == ' ') break;
+ if (c == 0x05) c = 0xE5;
+ *p++ = c;
+ }
+ if (dir[8] != ' ') { /* Copy file name extension */
+ *p++ = '.';
+ for (i = 8; i < 11; i++) {
+ c = dir[i];
+ if (c == ' ') break;
+ *p++ = c;
+ }
+ }
+ fno->fattrib = dir[DIR_Attr]; /* Attribute */
+ fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */
+ fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */
+ fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */
+ }
+ *p = 0;
+}
+#endif /* _USE_DIR */
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Follow a file path */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
+ DIR *dj, /* Directory object to return last directory and found object */
+ const char *path /* Full-path string to find a file or directory */
+)
+{
+ FRESULT res;
+ BYTE *dir;
+
+
+ if (*path == '/') path++; /* Strip heading separator */
+ dj->sclust = 0; /* Set start directory (always root dir) */
+
+ if ((BYTE)*path < ' ') { /* Null path means the root directory */
+ res = dir_rewind(dj);
+ FatFs->buf[0] = 0;
+
+ } else { /* Follow path */
+ for (;;) {
+ res = create_name(dj, &path); /* Get a segment */
+ if (res != FR_OK) break;
+ res = dir_find(dj); /* Find it */
+ if (res != FR_OK) { /* Could not find the object */
+ if (res == FR_NO_FILE && !*(dj->fn+11))
+ res = FR_NO_PATH;
+ break;
+ }
+ if (*(dj->fn+11)) break; /* Last segment match. Function completed. */
+ dir = FatFs->buf; /* There is next segment. Follow the sub directory */
+ if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */
+ res = FR_NO_PATH; break;
+ }
+ dj->sclust =
+#if _FS_FAT32
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
+#endif
+ LD_WORD(dir+DIR_FstClusLO);
+ }
+ }
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Check a sector if it is an FAT boot record */
+/*-----------------------------------------------------------------------*/
+
+static
+BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
+ BYTE *buf, /* Working buffer */
+ DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
+)
+{
+ if (disk_readp(buf, sect, 510, 2)) /* Read the boot sector */
+ return 3;
+ if (LD_WORD(buf) != 0xAA55) /* Check record signature */
+ return 2;
+
+ if (!disk_readp(buf, sect, BS_FilSysType, 2) && LD_WORD(buf) == 0x4146) /* Check FAT12/16 */
+ return 0;
+#if _FS_FAT32
+ if (!disk_readp(buf, sect, BS_FilSysType32, 2) && LD_WORD(buf) == 0x4146) /* Check FAT32 */
+ return 0;
+#endif
+ return 1;
+}
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Public Functions
+
+--------------------------------------------------------------------------*/
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Mount/Unmount a Locical Drive */
+/*-----------------------------------------------------------------------*/
+
+FRESULT pf_mount (
+ FATFS *fs /* Pointer to new file system object (NULL: Unmount) */
+)
+{
+ BYTE fmt, buf[36];
+ DWORD bsect, fsize, tsect, mclst;
+
+
+ FatFs = 0;
+ if (!fs) return FR_OK; /* Unregister fs object */
+
+ if (disk_initialize() & STA_NOINIT) /* Check if the drive is ready or not */
+ return FR_NOT_READY;
+
+ /* Search FAT partition on the drive */
+ bsect = 0;
+ fmt = check_fs(buf, bsect); /* Check sector 0 as an SFD format */
+ if (fmt == 1) { /* Not an FAT boot record, it may be FDISK format */
+ /* Check a partition listed in top of the partition table */
+ if (disk_readp(buf, bsect, MBR_Table, 16)) { /* 1st partition entry */
+ fmt = 3;
+ } else {
+ if (buf[4]) { /* Is the partition existing? */
+ bsect = LD_DWORD(&buf[8]); /* Partition offset in LBA */
+ fmt = check_fs(buf, bsect); /* Check the partition */
+ }
+ }
+ }
+ if (fmt == 3) return FR_DISK_ERR;
+ if (fmt) return FR_NO_FILESYSTEM; /* No valid FAT patition is found */
+
+ /* Initialize the file system object */
+ if (disk_readp(buf, bsect, 13, sizeof(buf))) return FR_DISK_ERR;
+
+ fsize = LD_WORD(buf+BPB_FATSz16-13); /* Number of sectors per FAT */
+ if (!fsize) fsize = LD_DWORD(buf+BPB_FATSz32-13);
+
+ fsize *= buf[BPB_NumFATs-13]; /* Number of sectors in FAT area */
+ fs->fatbase = bsect + LD_WORD(buf+BPB_RsvdSecCnt-13); /* FAT start sector (lba) */
+ fs->csize = buf[BPB_SecPerClus-13]; /* Number of sectors per cluster */
+ fs->n_rootdir = LD_WORD(buf+BPB_RootEntCnt-13); /* Nmuber of root directory entries */
+ tsect = LD_WORD(buf+BPB_TotSec16-13); /* Number of sectors on the file system */
+ if (!tsect) tsect = LD_DWORD(buf+BPB_TotSec32-13);
+ mclst = (tsect /* Last cluster# + 1 */
+ - LD_WORD(buf+BPB_RsvdSecCnt-13) - fsize - fs->n_rootdir / 16
+ ) / fs->csize + 2;
+ fs->max_clust = (CLUST)mclst;
+
+ fmt = FS_FAT12; /* Determine the FAT sub type */
+ if (mclst >= 0xFF7) fmt = FS_FAT16; /* Number of clusters >= 0xFF5 */
+ if (mclst >= 0xFFF7) /* Number of clusters >= 0xFFF5 */
+#if _FS_FAT32
+ fmt = FS_FAT32;
+#else
+ return FR_NO_FILESYSTEM;
+#endif
+
+ fs->fs_type = fmt; /* FAT sub-type */
+#if _FS_FAT32
+ if (fmt == FS_FAT32)
+ fs->dirbase = LD_DWORD(buf+(BPB_RootClus-13)); /* Root directory start cluster */
+ else
+#endif
+ fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */
+ fs->database = fs->fatbase + fsize + fs->n_rootdir / 16; /* Data start sector (lba) */
+
+ fs->flag = 0;
+ FatFs = fs;
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Open or Create a File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT pf_open (
+ const char *path /* Pointer to the file name */
+)
+{
+ FRESULT res;
+ DIR dj;
+ BYTE sp[12], dir[32];
+ FATFS *fs = FatFs;
+
+
+ if (!fs) /* Check file system */
+ return FR_NOT_ENABLED;
+
+ fs->flag = 0;
+ fs->buf = dir;
+ dj.fn = sp;
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res != FR_OK) return res; /* Follow failed */
+ if (!dir[0] || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
+ return FR_NO_FILE;
+
+ fs->org_clust = /* File start cluster */
+#if _FS_FAT32
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
+#endif
+ LD_WORD(dir+DIR_FstClusLO);
+ fs->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */
+ fs->fptr = 0; /* File pointer */
+ fs->flag = FA_READ;
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT pf_read (
+ void* dest, /* Pointer to the destination object */
+ WORD btr, /* Number of bytes to read (bit15:destination) */
+ WORD* br /* Pointer to number of bytes read */
+)
+{
+ DRESULT dr;
+ CLUST clst;
+ DWORD sect, remain;
+ WORD rcnt;
+ BYTE *rbuff = dest;
+ FATFS *fs = FatFs;
+
+
+ *br = 0;
+ if (!fs) return FR_NOT_ENABLED; /* Check file system */
+ if (!(fs->flag & FA_READ))
+ return FR_INVALID_OBJECT;
+
+ remain = fs->fsize - fs->fptr;
+ if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
+
+ for ( ; btr; /* Repeat until all data transferred */
+ rbuff += rcnt, fs->fptr += rcnt, *br += rcnt, btr -= rcnt) {
+ if ((fs->fptr % 512) == 0) { /* On the sector boundary? */
+ if ((fs->fptr / 512 % fs->csize) == 0) { /* On the cluster boundary? */
+ clst = (fs->fptr == 0) ? /* On the top of the file? */
+ fs->org_clust : get_fat(fs->curr_clust);
+ if (clst <= 1) {
+ fs->flag = 0; return FR_DISK_ERR;
+ }
+ fs->curr_clust = clst; /* Update current cluster */
+ fs->csect = 0; /* Reset sector offset in the cluster */
+ }
+ sect = clust2sect(fs->curr_clust); /* Get current sector */
+ if (!sect) {
+ fs->flag = 0; return FR_DISK_ERR;
+ }
+ sect += fs->csect;
+ fs->dsect = sect;
+ fs->csect++; /* Next sector address in the cluster */
+ }
+ rcnt = 512 - ((WORD)fs->fptr % 512); /* Get partial sector data from sector buffer */
+ if (rcnt > btr) rcnt = btr;
+ if (fs->flag & FA_STREAM) {
+ dr = disk_readp(dest, fs->dsect, (WORD)(fs->fptr % 512), (WORD)(rcnt | 0x8000));
+ } else {
+ dr = disk_readp(rbuff, fs->dsect, (WORD)(fs->fptr % 512), rcnt);
+ }
+ if (dr) {
+ fs->flag = 0;
+ return (dr == RES_STRERR) ? FR_STREAM_ERR : FR_DISK_ERR;
+ }
+ }
+
+ return FR_OK;
+}
+
+
+
+
+#if _USE_LSEEK
+/*-----------------------------------------------------------------------*/
+/* Seek File R/W Pointer */
+/*-----------------------------------------------------------------------*/
+
+FRESULT pf_lseek (
+ DWORD ofs /* File pointer from top of file */
+)
+{
+ CLUST clst;
+ DWORD bcs, nsect, ifptr;
+ FATFS *fs = FatFs;
+
+
+ if (!fs) return FR_NOT_ENABLED; /* Check file system */
+ if (!(fs->flag & FA_READ))
+ return FR_INVALID_OBJECT;
+
+ if (ofs > fs->fsize) ofs = fs->fsize; /* Clip offset with the file size */
+ ifptr = fs->fptr;
+ fs->fptr = 0;
+ if (ofs > 0) {
+ bcs = (DWORD)fs->csize * 512; /* Cluster size (byte) */
+ if (ifptr > 0 &&
+ (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */
+ fs->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */
+ ofs -= fs->fptr;
+ clst = fs->curr_clust;
+ } else { /* When seek to back cluster, */
+ clst = fs->org_clust; /* start from the first cluster */
+ fs->curr_clust = clst;
+ }
+ while (ofs > bcs) { /* Cluster following loop */
+ clst = get_fat(clst); /* Follow cluster chain if not in write mode */
+ if (clst <= 1 || clst >= fs->max_clust) {
+ fs->flag = 0; return FR_DISK_ERR;
+ }
+ fs->curr_clust = clst;
+ fs->fptr += bcs;
+ ofs -= bcs;
+ }
+ fs->fptr += ofs;
+ fs->csect = (BYTE)(ofs / 512) + 1; /* Sector offset in the cluster */
+ nsect = clust2sect(clst); /* Current sector */
+ if (!nsect) {
+ fs->flag = 0; return FR_DISK_ERR;
+ }
+ fs->dsect = nsect + fs->csect - 1;
+ }
+
+ return FR_OK;
+}
+#endif
+
+
+#if _USE_DIR
+/*-----------------------------------------------------------------------*/
+/* Create a Directroy Object */
+/*-----------------------------------------------------------------------*/
+
+FRESULT pf_opendir (
+ DIR *dj, /* Pointer to directory object to create */
+ const char *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ BYTE sp[12], dir[32];
+ FATFS *fs = FatFs;
+
+
+ if (!fs) { /* Check file system */
+ res = FR_NOT_ENABLED;
+ } else {
+ fs->buf = dir;
+ dj->fn = sp;
+ res = follow_path(dj, path); /* Follow the path to the directory */
+ if (res == FR_OK) { /* Follow completed */
+ if (dir[0]) { /* It is not the root dir */
+ if (dir[DIR_Attr] & AM_DIR) { /* The object is a directory */
+ dj->sclust =
+#if _FS_FAT32
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
+#endif
+ LD_WORD(dir+DIR_FstClusLO);
+ } else { /* The object is not a directory */
+ res = FR_NO_PATH;
+ }
+ }
+ if (res == FR_OK) {
+ res = dir_rewind(dj); /* Rewind dir */
+ }
+ }
+ if (res == FR_NO_FILE) res = FR_NO_PATH;
+ }
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read Directory Entry in Sequense */
+/*-----------------------------------------------------------------------*/
+
+FRESULT pf_readdir (
+ DIR *dj, /* Pointer to the open directory object */
+ FILINFO *fno /* Pointer to file information to return */
+)
+{
+ FRESULT res;
+ BYTE sp[12], dir[32];
+ FATFS *fs = FatFs;
+
+
+ if (!fs) { /* Check file system */
+ res = FR_NOT_ENABLED;
+ } else {
+ fs->buf = dir;
+ dj->fn = sp;
+ if (!fno) {
+ res = dir_rewind(dj);
+ } else {
+ res = dir_read(dj);
+ if (res == FR_NO_FILE) {
+ dj->sect = 0;
+ res = FR_OK;
+ }
+ if (res == FR_OK) { /* A valid entry is found */
+ get_fileinfo(dj, fno); /* Get the object information */
+ res = dir_next(dj); /* Increment index for next */
+ if (res == FR_NO_FILE) {
+ dj->sect = 0;
+ res = FR_OK;
+ }
+ }
+ }
+ }
+
+ return res;
+}
+
+#endif /* _FS_DIR */
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
index abd4f541c..bd43fbce1 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
@@ -1,237 +1,237 @@
-/*---------------------------------------------------------------------------/
-/ Petit FatFs - FAT file system module include file R0.01a (C)ChaN, 2010
-/----------------------------------------------------------------------------/
-/ Petit FatFs module is an open source software to implement FAT file system to
-/ small embedded systems. This is a free software and is opened for education,
-/ research and commercial developments under license policy of following trems.
-/
-/ Copyright (C) 2010, ChaN, all right reserved.
-/
-/ * The Petit FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
-/----------------------------------------------------------------------------*/
-
-#include "integer.h"
-
-/*---------------------------------------------------------------------------/
-/ Petit FatFs Configuration Options
-/
-/ CAUTION! Do not forget to make clean the project after any changes to
-/ the configuration options.
-/
-/----------------------------------------------------------------------------*/
-#ifndef _FATFS
-#define _FATFS
-
-#define _WORD_ACCESS 0
-/* The _WORD_ACCESS option defines which access method is used to the word
-/ data in the FAT structure.
-/
-/ 0: Byte-by-byte access. Always compatible with all platforms.
-/ 1: Word access. Do not choose this unless following condition is met.
-/
-/ When the byte order on the memory is big-endian or address miss-aligned
-/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
-/ If it is not the case, the value can also be set to 1 to improve the
-/ performance and code efficiency. */
-
-
-#define _USE_DIR 0
-/* To enable pf_opendir and pf_readdir function, set _USE_DIR to 1. */
-
-
-#define _USE_LSEEK 0
-/* To enable pf_lseek function, set _USE_LSEEK to 1. */
-
-
-#define _FS_FAT32 1
-/* To enable FAT32 support, set _FS_FAT32 to 1. */
-
-
-/* End of configuration options. Do not change followings without care. */
-/*--------------------------------------------------------------------------*/
-
-
-#if _FS_FAT32
-#define CLUST DWORD
-#else
-#define CLUST WORD
-#endif
-
-
-/* File system object structure */
-
-typedef struct _FATFS_ {
- BYTE fs_type; /* FAT sub type */
- BYTE csize; /* Number of sectors per cluster */
- BYTE flag; /* File status flags */
- BYTE csect; /* File sector address in the cluster */
- WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
- BYTE* buf; /* Pointer to the disk access buffer */
- CLUST max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
- DWORD fatbase; /* FAT start sector */
- DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
- DWORD database; /* Data start sector */
- DWORD fptr; /* File R/W pointer */
- DWORD fsize; /* File size */
- CLUST org_clust; /* File start cluster */
- CLUST curr_clust; /* File current cluster */
- DWORD dsect; /* File current data sector */
-} FATFS;
-
-
-
-/* Directory object structure */
-
-typedef struct _DIR_ {
- WORD index; /* Current read/write index number */
- BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
- CLUST sclust; /* Table start cluster (0:Static table) */
- CLUST clust; /* Current cluster */
- DWORD sect; /* Current sector */
-} DIR;
-
-
-
-/* File status structure */
-
-typedef struct _FILINFO_ {
- DWORD fsize; /* File size */
- WORD fdate; /* Last modified date */
- WORD ftime; /* Last modified time */
- BYTE fattrib; /* Attribute */
- char fname[13]; /* File name */
-} FILINFO;
-
-
-
-/* File function return code (FRESULT) */
-
-typedef enum {
- FR_OK = 0, /* 0 */
- FR_DISK_ERR, /* 1 */
- FR_NOT_READY, /* 2 */
- FR_NO_FILE, /* 3 */
- FR_NO_PATH, /* 4 */
- FR_INVALID_NAME, /* 5 */
- FR_STREAM_ERR, /* 6 */
- FR_INVALID_OBJECT, /* 7 */
- FR_NOT_ENABLED, /* 8 */
- FR_NO_FILESYSTEM /* 9 */
-} FRESULT;
-
-
-
-/*--------------------------------------------------------------*/
-/* Petit FatFs module application interface */
-
-FRESULT pf_mount (FATFS*); /* Mount/Unmount a logical drive */
-FRESULT pf_open (const char*); /* Open a file */
-FRESULT pf_read (void*, WORD, WORD*); /* Read data from a file */
-FRESULT pf_lseek (DWORD); /* Move file pointer of a file object */
-FRESULT pf_opendir (DIR*, const char*); /* Open an existing directory */
-FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item */
-
-
-
-/*--------------------------------------------------------------*/
-/* Flags and offset address */
-
-/* File status flag (FATFS.flag) */
-
-#define FA_READ 0x01
-#define FA_STREAM 0x40
-#define FA__ERROR 0x80
-
-
-/* FAT sub type (FATFS.fs_type) */
-
-#define FS_FAT12 1
-#define FS_FAT16 2
-#define FS_FAT32 3
-
-
-/* File attribute bits for directory entry */
-
-#define AM_RDO 0x01 /* Read only */
-#define AM_HID 0x02 /* Hidden */
-#define AM_SYS 0x04 /* System */
-#define AM_VOL 0x08 /* Volume label */
-#define AM_LFN 0x0F /* LFN entry */
-#define AM_DIR 0x10 /* Directory */
-#define AM_ARC 0x20 /* Archive */
-#define AM_MASK 0x3F /* Mask of defined bits */
-
-
-/* FatFs refers the members in the FAT structures with byte offset instead
-/ of structure member because there are incompatibility of the packing option
-/ between various compilers. */
-
-#define BS_jmpBoot 0
-#define BS_OEMName 3
-#define BPB_BytsPerSec 11
-#define BPB_SecPerClus 13
-#define BPB_RsvdSecCnt 14
-#define BPB_NumFATs 16
-#define BPB_RootEntCnt 17
-#define BPB_TotSec16 19
-#define BPB_Media 21
-#define BPB_FATSz16 22
-#define BPB_SecPerTrk 24
-#define BPB_NumHeads 26
-#define BPB_HiddSec 28
-#define BPB_TotSec32 32
-#define BS_55AA 510
-
-#define BS_DrvNum 36
-#define BS_BootSig 38
-#define BS_VolID 39
-#define BS_VolLab 43
-#define BS_FilSysType 54
-
-#define BPB_FATSz32 36
-#define BPB_ExtFlags 40
-#define BPB_FSVer 42
-#define BPB_RootClus 44
-#define BPB_FSInfo 48
-#define BPB_BkBootSec 50
-#define BS_DrvNum32 64
-#define BS_BootSig32 66
-#define BS_VolID32 67
-#define BS_VolLab32 71
-#define BS_FilSysType32 82
-
-#define MBR_Table 446
-
-#define DIR_Name 0
-#define DIR_Attr 11
-#define DIR_NTres 12
-#define DIR_CrtTime 14
-#define DIR_CrtDate 16
-#define DIR_FstClusHI 20
-#define DIR_WrtTime 22
-#define DIR_WrtDate 24
-#define DIR_FstClusLO 26
-#define DIR_FileSize 28
-
-
-
-/*--------------------------------*/
-/* Multi-byte word access macros */
-
-#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
-#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
-#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
-#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
-#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
-#else /* Use byte-by-byte access to the FAT structure */
-#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
-#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
-#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
-#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
-#endif
-
-
-#endif /* _FATFS */
+/*---------------------------------------------------------------------------/
+/ Petit FatFs - FAT file system module include file R0.01a (C)ChaN, 2010
+/----------------------------------------------------------------------------/
+/ Petit FatFs module is an open source software to implement FAT file system to
+/ small embedded systems. This is a free software and is opened for education,
+/ research and commercial developments under license policy of following trems.
+/
+/ Copyright (C) 2010, ChaN, all right reserved.
+/
+/ * The Petit FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/----------------------------------------------------------------------------*/
+
+#include "integer.h"
+
+/*---------------------------------------------------------------------------/
+/ Petit FatFs Configuration Options
+/
+/ CAUTION! Do not forget to make clean the project after any changes to
+/ the configuration options.
+/
+/----------------------------------------------------------------------------*/
+#ifndef _FATFS
+#define _FATFS
+
+#define _WORD_ACCESS 0
+/* The _WORD_ACCESS option defines which access method is used to the word
+/ data in the FAT structure.
+/
+/ 0: Byte-by-byte access. Always compatible with all platforms.
+/ 1: Word access. Do not choose this unless following condition is met.
+/
+/ When the byte order on the memory is big-endian or address miss-aligned
+/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
+/ If it is not the case, the value can also be set to 1 to improve the
+/ performance and code efficiency. */
+
+
+#define _USE_DIR 0
+/* To enable pf_opendir and pf_readdir function, set _USE_DIR to 1. */
+
+
+#define _USE_LSEEK 0
+/* To enable pf_lseek function, set _USE_LSEEK to 1. */
+
+
+#define _FS_FAT32 1
+/* To enable FAT32 support, set _FS_FAT32 to 1. */
+
+
+/* End of configuration options. Do not change followings without care. */
+/*--------------------------------------------------------------------------*/
+
+
+#if _FS_FAT32
+#define CLUST DWORD
+#else
+#define CLUST WORD
+#endif
+
+
+/* File system object structure */
+
+typedef struct _FATFS_ {
+ BYTE fs_type; /* FAT sub type */
+ BYTE csize; /* Number of sectors per cluster */
+ BYTE flag; /* File status flags */
+ BYTE csect; /* File sector address in the cluster */
+ WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
+ BYTE* buf; /* Pointer to the disk access buffer */
+ CLUST max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
+ DWORD fatbase; /* FAT start sector */
+ DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
+ DWORD database; /* Data start sector */
+ DWORD fptr; /* File R/W pointer */
+ DWORD fsize; /* File size */
+ CLUST org_clust; /* File start cluster */
+ CLUST curr_clust; /* File current cluster */
+ DWORD dsect; /* File current data sector */
+} FATFS;
+
+
+
+/* Directory object structure */
+
+typedef struct _DIR_ {
+ WORD index; /* Current read/write index number */
+ BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
+ CLUST sclust; /* Table start cluster (0:Static table) */
+ CLUST clust; /* Current cluster */
+ DWORD sect; /* Current sector */
+} DIR;
+
+
+
+/* File status structure */
+
+typedef struct _FILINFO_ {
+ DWORD fsize; /* File size */
+ WORD fdate; /* Last modified date */
+ WORD ftime; /* Last modified time */
+ BYTE fattrib; /* Attribute */
+ char fname[13]; /* File name */
+} FILINFO;
+
+
+
+/* File function return code (FRESULT) */
+
+typedef enum {
+ FR_OK = 0, /* 0 */
+ FR_DISK_ERR, /* 1 */
+ FR_NOT_READY, /* 2 */
+ FR_NO_FILE, /* 3 */
+ FR_NO_PATH, /* 4 */
+ FR_INVALID_NAME, /* 5 */
+ FR_STREAM_ERR, /* 6 */
+ FR_INVALID_OBJECT, /* 7 */
+ FR_NOT_ENABLED, /* 8 */
+ FR_NO_FILESYSTEM /* 9 */
+} FRESULT;
+
+
+
+/*--------------------------------------------------------------*/
+/* Petit FatFs module application interface */
+
+FRESULT pf_mount (FATFS*); /* Mount/Unmount a logical drive */
+FRESULT pf_open (const char*); /* Open a file */
+FRESULT pf_read (void*, WORD, WORD*); /* Read data from a file */
+FRESULT pf_lseek (DWORD); /* Move file pointer of a file object */
+FRESULT pf_opendir (DIR*, const char*); /* Open an existing directory */
+FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item */
+
+
+
+/*--------------------------------------------------------------*/
+/* Flags and offset address */
+
+/* File status flag (FATFS.flag) */
+
+#define FA_READ 0x01
+#define FA_STREAM 0x40
+#define FA__ERROR 0x80
+
+
+/* FAT sub type (FATFS.fs_type) */
+
+#define FS_FAT12 1
+#define FS_FAT16 2
+#define FS_FAT32 3
+
+
+/* File attribute bits for directory entry */
+
+#define AM_RDO 0x01 /* Read only */
+#define AM_HID 0x02 /* Hidden */
+#define AM_SYS 0x04 /* System */
+#define AM_VOL 0x08 /* Volume label */
+#define AM_LFN 0x0F /* LFN entry */
+#define AM_DIR 0x10 /* Directory */
+#define AM_ARC 0x20 /* Archive */
+#define AM_MASK 0x3F /* Mask of defined bits */
+
+
+/* FatFs refers the members in the FAT structures with byte offset instead
+/ of structure member because there are incompatibility of the packing option
+/ between various compilers. */
+
+#define BS_jmpBoot 0
+#define BS_OEMName 3
+#define BPB_BytsPerSec 11
+#define BPB_SecPerClus 13
+#define BPB_RsvdSecCnt 14
+#define BPB_NumFATs 16
+#define BPB_RootEntCnt 17
+#define BPB_TotSec16 19
+#define BPB_Media 21
+#define BPB_FATSz16 22
+#define BPB_SecPerTrk 24
+#define BPB_NumHeads 26
+#define BPB_HiddSec 28
+#define BPB_TotSec32 32
+#define BS_55AA 510
+
+#define BS_DrvNum 36
+#define BS_BootSig 38
+#define BS_VolID 39
+#define BS_VolLab 43
+#define BS_FilSysType 54
+
+#define BPB_FATSz32 36
+#define BPB_ExtFlags 40
+#define BPB_FSVer 42
+#define BPB_RootClus 44
+#define BPB_FSInfo 48
+#define BPB_BkBootSec 50
+#define BS_DrvNum32 64
+#define BS_BootSig32 66
+#define BS_VolID32 67
+#define BS_VolLab32 71
+#define BS_FilSysType32 82
+
+#define MBR_Table 446
+
+#define DIR_Name 0
+#define DIR_Attr 11
+#define DIR_NTres 12
+#define DIR_CrtTime 14
+#define DIR_CrtDate 16
+#define DIR_FstClusHI 20
+#define DIR_WrtTime 22
+#define DIR_WrtDate 24
+#define DIR_FstClusLO 26
+#define DIR_FileSize 28
+
+
+
+/*--------------------------------*/
+/* Multi-byte word access macros */
+
+#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
+#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
+#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
+#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
+#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
+#else /* Use byte-by-byte access to the FAT structure */
+#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
+#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
+#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
+#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
+#endif
+
+
+#endif /* _FATFS */
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
index e43556fa1..63beb1d21 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
@@ -1,77 +1,77 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "ProgrammerConfig.h"
-
-struct
-{
- uint16_t SigBytes[4];
- bool EnforceSigBytes;
-
- uint32_t ProgrammingSpeed;
-} ProgrammerConfig;
-
-bool ProgrammerConfig_ProcessConfiguration(void)
-{
- memset(&ProgrammerConfig, sizeof(ProgrammerConfig), 0x00);
-
- if (!(pf_open("CONF.txt") == FR_OK))
- {
- puts(" >> ERROR: CONF.txt File Not Found.\r\n");
- return false;
- }
-
- char LineBuff[100];
- char* CurrentLine;
-
- do
- {
- CurrentLine = fgets(LineBuff, sizeof(LineBuff), &DiskStream);
-
- if (CurrentLine)
- {
- sscanf(CurrentLine, "SIGNATURE = %02x %02x %02x %02x", &ProgrammerConfig.SigBytes[0],
- &ProgrammerConfig.SigBytes[1],
- &ProgrammerConfig.SigBytes[2],
- &ProgrammerConfig.SigBytes[3]);
-
- sscanf(CurrentLine, "SPEED = %lu", &ProgrammerConfig.ProgrammingSpeed);
- }
- } while (CurrentLine);
-
- printf(" >> *** Configuration: ***\r\n");
- printf(" >> Device Signature: 0x%02x 0x%02x 0x%02x 0x%02x\r\n", ProgrammerConfig.SigBytes[0],
- ProgrammerConfig.SigBytes[1],
- ProgrammerConfig.SigBytes[2],
- ProgrammerConfig.SigBytes[3]);
- printf(" >> Programming Speed: %lu Hz\r\n", ProgrammerConfig.ProgrammingSpeed);
-
- return true;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "ProgrammerConfig.h"
+
+struct
+{
+ uint16_t SigBytes[4];
+ bool EnforceSigBytes;
+
+ uint32_t ProgrammingSpeed;
+} ProgrammerConfig;
+
+bool ProgrammerConfig_ProcessConfiguration(void)
+{
+ memset(&ProgrammerConfig, sizeof(ProgrammerConfig), 0x00);
+
+ if (!(pf_open("CONF.txt") == FR_OK))
+ {
+ puts(" >> ERROR: CONF.txt File Not Found.\r\n");
+ return false;
+ }
+
+ char LineBuff[100];
+ char* CurrentLine;
+
+ do
+ {
+ CurrentLine = fgets(LineBuff, sizeof(LineBuff), &DiskStream);
+
+ if (CurrentLine)
+ {
+ sscanf(CurrentLine, "SIGNATURE = %02x %02x %02x %02x", &ProgrammerConfig.SigBytes[0],
+ &ProgrammerConfig.SigBytes[1],
+ &ProgrammerConfig.SigBytes[2],
+ &ProgrammerConfig.SigBytes[3]);
+
+ sscanf(CurrentLine, "SPEED = %lu", &ProgrammerConfig.ProgrammingSpeed);
+ }
+ } while (CurrentLine);
+
+ printf(" >> *** Configuration: ***\r\n");
+ printf(" >> Device Signature: 0x%02x 0x%02x 0x%02x 0x%02x\r\n", ProgrammerConfig.SigBytes[0],
+ ProgrammerConfig.SigBytes[1],
+ ProgrammerConfig.SigBytes[2],
+ ProgrammerConfig.SigBytes[3]);
+ printf(" >> Programming Speed: %lu Hz\r\n", ProgrammerConfig.ProgrammingSpeed);
+
+ return true;
+}
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
index cd0843529..ba6e9add6 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
@@ -1,44 +1,44 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#ifndef _PROGRAMMER_CONFIG_H_
-#define _PROGRAMMER_CONFIG_H_
-
- /* Includes: */
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
-
- #include "../StandaloneProgrammer.h"
-
- /* Function Prototypes: */
- bool ProgrammerConfig_ProcessConfiguration(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#ifndef _PROGRAMMER_CONFIG_H_
+#define _PROGRAMMER_CONFIG_H_
+
+ /* Includes: */
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdbool.h>
+
+ #include "../StandaloneProgrammer.h"
+
+ /* Function Prototypes: */
+ bool ProgrammerConfig_ProcessConfiguration(void);
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
index 7a28cfc3d..402160496 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
@@ -1,283 +1,283 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * SCSI command processing routines, for SCSI commands issued by the host. Mass Storage
- * devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
- * which wrap around standard SCSI device commands for controlling the actual storage medium.
- */
-
-#define INCLUDE_FROM_SCSI_C
-#include "SCSI.h"
-
-#if defined(USB_CAN_BE_DEVICE)
-/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
- * features and capabilities.
- */
-SCSI_Inquiry_Response_t InquiryData =
- {
- .DeviceType = DEVICE_TYPE_BLOCK,
- .PeripheralQualifier = 0,
-
- .Removable = true,
-
- .Version = 0,
-
- .ResponseDataFormat = 2,
- .NormACA = false,
- .TrmTsk = false,
- .AERC = false,
-
- .AdditionalLength = 0x1F,
-
- .SoftReset = false,
- .CmdQue = false,
- .Linked = false,
- .Sync = false,
- .WideBus16Bit = false,
- .WideBus32Bit = false,
- .RelAddr = false,
-
- .VendorID = "LUFA",
- .ProductID = "Dataflash Disk",
- .RevisionID = {'0','.','0','0'},
- };
-
-/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE
- * command is issued. This gives information on exactly why the last command failed to complete.
- */
-SCSI_Request_Sense_Response_t SenseData =
- {
- .ResponseCode = 0x70,
- .AdditionalLength = 0x0A,
- };
-
-
-/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches
- * to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns
- * a command failure due to a ILLEGAL REQUEST.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- /* Set initial sense data, before the requested command is processed */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
- SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- /* Run the appropriate SCSI command hander function based on the passed command */
- switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
- {
- case SCSI_CMD_INQUIRY:
- SCSI_Command_Inquiry(MSInterfaceInfo);
- break;
- case SCSI_CMD_REQUEST_SENSE:
- SCSI_Command_Request_Sense(MSInterfaceInfo);
- break;
- case SCSI_CMD_READ_CAPACITY_10:
- SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
- break;
- case SCSI_CMD_SEND_DIAGNOSTIC:
- SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
- break;
- case SCSI_CMD_WRITE_10:
- SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
- break;
- case SCSI_CMD_READ_10:
- SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
- break;
- case SCSI_CMD_TEST_UNIT_READY:
- case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
- case SCSI_CMD_VERIFY_10:
- /* These commands should just succeed, no handling required */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
- break;
- default:
- /* Update the SENSE key to reflect the invalid command */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_COMMAND,
- SCSI_ASENSEQ_NO_QUALIFIER);
- break;
- }
-
- return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);
-}
-
-/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
- * and capabilities to the host.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint16_t AllocationLength = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
- MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
- uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
- sizeof(InquiryData);
-
- /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
- if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
- MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
- {
- /* Optional but unsupported bits set - update the SENSE key and fail the request */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_FIELD_IN_CDB,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
-
- uint8_t PadBytes[AllocationLength - BytesTransferred];
-
- /* Pad out remaining bytes with 0x00 */
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
-
- /* Finalize the stream transfer to send the last packet */
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-}
-
-/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
- * including the error code and additional error information so that the host can determine why a command failed to complete.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
- uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
- uint8_t PadBytes[AllocationLength - BytesTransferred];
-
- Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-}
-
-/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity
- * on the selected Logical Unit (drive), as a number of OS-sized blocks.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
- uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
-
- Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
- Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-}
-
-/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
- * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
- * supported.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- /* Check to see if the SELF TEST bit is not set */
- if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
- {
- /* Only self-test supported - update SENSE key and fail the command */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_FIELD_IN_CDB,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Check to see if all attached Dataflash ICs are functional */
- if (!(DataflashManager_CheckDataflashOperation()))
- {
- /* Update SENSE key with a hardware error condition and return command fail */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
- SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-}
-
-/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
- * and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual
- * reading and writing of the data.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- * \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
- */
-static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
-{
- uint32_t BlockAddress;
- uint16_t TotalBlocks;
-
- /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
- BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
-
- /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
- TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
- /* Check if the block address is outside the maximum allowable value for the LUN */
- if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
- {
- /* Block address is invalid, update SENSE key and return command fail */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
- if (IsDataRead == DATA_READ)
- DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
- else
- DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
-
- /* Update the bytes transferred counter and succeed the command */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * SCSI command processing routines, for SCSI commands issued by the host. Mass Storage
+ * devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
+ * which wrap around standard SCSI device commands for controlling the actual storage medium.
+ */
+
+#define INCLUDE_FROM_SCSI_C
+#include "SCSI.h"
+
+#if defined(USB_CAN_BE_DEVICE)
+/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
+ * features and capabilities.
+ */
+SCSI_Inquiry_Response_t InquiryData =
+ {
+ .DeviceType = DEVICE_TYPE_BLOCK,
+ .PeripheralQualifier = 0,
+
+ .Removable = true,
+
+ .Version = 0,
+
+ .ResponseDataFormat = 2,
+ .NormACA = false,
+ .TrmTsk = false,
+ .AERC = false,
+
+ .AdditionalLength = 0x1F,
+
+ .SoftReset = false,
+ .CmdQue = false,
+ .Linked = false,
+ .Sync = false,
+ .WideBus16Bit = false,
+ .WideBus32Bit = false,
+ .RelAddr = false,
+
+ .VendorID = "LUFA",
+ .ProductID = "Dataflash Disk",
+ .RevisionID = {'0','.','0','0'},
+ };
+
+/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE
+ * command is issued. This gives information on exactly why the last command failed to complete.
+ */
+SCSI_Request_Sense_Response_t SenseData =
+ {
+ .ResponseCode = 0x70,
+ .AdditionalLength = 0x0A,
+ };
+
+
+/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches
+ * to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns
+ * a command failure due to a ILLEGAL REQUEST.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ /* Set initial sense data, before the requested command is processed */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
+ SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ /* Run the appropriate SCSI command hander function based on the passed command */
+ switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
+ {
+ case SCSI_CMD_INQUIRY:
+ SCSI_Command_Inquiry(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_REQUEST_SENSE:
+ SCSI_Command_Request_Sense(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_READ_CAPACITY_10:
+ SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_SEND_DIAGNOSTIC:
+ SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_WRITE_10:
+ SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
+ break;
+ case SCSI_CMD_READ_10:
+ SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
+ break;
+ case SCSI_CMD_TEST_UNIT_READY:
+ case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
+ case SCSI_CMD_VERIFY_10:
+ /* These commands should just succeed, no handling required */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
+ break;
+ default:
+ /* Update the SENSE key to reflect the invalid command */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_COMMAND,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+ break;
+ }
+
+ return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);
+}
+
+/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
+ * and capabilities to the host.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint16_t AllocationLength = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
+ MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
+ uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
+ sizeof(InquiryData);
+
+ /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
+ if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
+ MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
+ {
+ /* Optional but unsupported bits set - update the SENSE key and fail the request */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_FIELD_IN_CDB,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
+
+ uint8_t PadBytes[AllocationLength - BytesTransferred];
+
+ /* Pad out remaining bytes with 0x00 */
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+
+ /* Finalize the stream transfer to send the last packet */
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
+}
+
+/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
+ * including the error code and additional error information so that the host can determine why a command failed to complete.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
+ uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
+
+ uint8_t PadBytes[AllocationLength - BytesTransferred];
+
+ Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
+}
+
+/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity
+ * on the selected Logical Unit (drive), as a number of OS-sized blocks.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
+ uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
+
+ Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
+ Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
+}
+
+/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
+ * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
+ * supported.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ /* Check to see if the SELF TEST bit is not set */
+ if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
+ {
+ /* Only self-test supported - update SENSE key and fail the command */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_FIELD_IN_CDB,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Check to see if all attached Dataflash ICs are functional */
+ if (!(DataflashManager_CheckDataflashOperation()))
+ {
+ /* Update SENSE key with a hardware error condition and return command fail */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
+ SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
+}
+
+/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
+ * and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual
+ * reading and writing of the data.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ * \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
+ */
+static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
+{
+ uint32_t BlockAddress;
+ uint16_t TotalBlocks;
+
+ /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
+ BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
+
+ /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
+ TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
+
+ /* Check if the block address is outside the maximum allowable value for the LUN */
+ if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
+ {
+ /* Block address is invalid, update SENSE key and return command fail */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
+ if (IsDataRead == DATA_READ)
+ DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+ else
+ DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+
+ /* Update the bytes transferred counter and succeed the command */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
+}
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
index 9d5024c70..8eeed95ed 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
@@ -1,87 +1,87 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 SCSI.c.
- */
-
-#ifndef _SCSI_H_
-#define _SCSI_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- #include "Descriptors.h"
- #include "DataflashManager.h"
-
- /* Macros: */
- /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
- * is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
- * the last command failure) in a quick and easy manner.
- *
- * \param[in] key New SCSI sense key to set the sense code to
- * \param[in] acode New SCSI additional sense key to set the additional sense code to
- * \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
- */
- #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = key; \
- SenseData.AdditionalSenseCode = acode; \
- SenseData.AdditionalSenseQualifier = aqual; }MACROE
-
- /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
- #define DATA_READ true
-
- /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */
- #define DATA_WRITE false
-
- /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
- #define DEVICE_TYPE_BLOCK 0x00
-
- /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
- #define DEVICE_TYPE_CDROM 0x05
-
- /* Function Prototypes: */
- #if defined(USB_CAN_BE_DEVICE)
- bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);
-
- #if defined(INCLUDE_FROM_SCSI_C)
- static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
- #endif
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 SCSI.c.
+ */
+
+#ifndef _SCSI_H_
+#define _SCSI_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ #include "Descriptors.h"
+ #include "DataflashManager.h"
+
+ /* Macros: */
+ /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
+ * is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
+ * the last command failure) in a quick and easy manner.
+ *
+ * \param[in] key New SCSI sense key to set the sense code to
+ * \param[in] acode New SCSI additional sense key to set the additional sense code to
+ * \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
+ */
+ #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = key; \
+ SenseData.AdditionalSenseCode = acode; \
+ SenseData.AdditionalSenseQualifier = aqual; }MACROE
+
+ /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
+ #define DATA_READ true
+
+ /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */
+ #define DATA_WRITE false
+
+ /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
+ #define DEVICE_TYPE_BLOCK 0x00
+
+ /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
+ #define DEVICE_TYPE_CDROM 0x05
+
+ /* Function Prototypes: */
+ #if defined(USB_CAN_BE_DEVICE)
+ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);
+
+ #if defined(INCLUDE_FROM_SCSI_C)
+ static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
+ #endif
+ #endif
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Standalone Programmer.inf b/Projects/Incomplete/StandaloneProgrammer/Standalone Programmer.inf
index 9881abc34..8472fefde 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Standalone Programmer.inf
+++ b/Projects/Incomplete/StandaloneProgrammer/Standalone Programmer.inf
@@ -1,106 +1,106 @@
-;************************************************************
-; Windows USB CDC ACM Setup File
-; Copyright (c) 2000 Microsoft Corporation
-
-
-[Version]
-Signature="$Windows NT$"
-Class=Ports
-ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
-Provider=%MFGNAME%
-LayoutFile=layout.inf
-CatalogFile=%MFGFILENAME%.cat
-DriverVer=11/15/2007,5.1.2600.0
-
-[Manufacturer]
-%MFGNAME%=DeviceList, NTamd64
-
-[DestinationDirs]
-DefaultDestDir=12
-
-
-;------------------------------------------------------------------------------
-; Windows 2000/XP/Vista-32bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.nt]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.nt
-AddReg=DriverInstall.nt.AddReg
-
-[DriverCopyFiles.nt]
-usbser.sys,,,0x20
-
-[DriverInstall.nt.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.nt.Services]
-AddService=usbser, 0x00000002, DriverService.nt
-
-[DriverService.nt]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-;------------------------------------------------------------------------------
-; Vista-64bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.NTamd64]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.NTamd64
-AddReg=DriverInstall.NTamd64.AddReg
-
-[DriverCopyFiles.NTamd64]
-%DRIVERFILENAME%.sys,,,0x20
-
-[DriverInstall.NTamd64.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.NTamd64.Services]
-AddService=usbser, 0x00000002, DriverService.NTamd64
-
-[DriverService.NTamd64]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-
-;------------------------------------------------------------------------------
-; Vendor and Product ID Definitions
-;------------------------------------------------------------------------------
-; When developing your USB device, the VID and PID used in the PC side
-; application program and the firmware on the microcontroller must match.
-; Modify the below line to use your VID and PID. Use the format as shown below.
-; Note: One INF file can be used for multiple devices with different VID and PIDs.
-; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
-;------------------------------------------------------------------------------
-[SourceDisksFiles]
-[SourceDisksNames]
-[DeviceList]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2063&MI_00
-
-[DeviceList.NTamd64]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2063&MI_00
-
-
-;------------------------------------------------------------------------------
-; String Definitions
-;------------------------------------------------------------------------------
-;Modify these strings to customize your device
-;------------------------------------------------------------------------------
-[Strings]
-MFGFILENAME="CDC_vista"
-DRIVERFILENAME ="usbser"
-MFGNAME="CCS, Inc."
-INSTDISK="LUFA Benito Programmer Driver Installer"
-DESCRIPTION="Communications Port"
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+; Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+; Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+; Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID. Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2063&MI_00
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2063&MI_00
+
+
+;------------------------------------------------------------------------------
+; String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="CCS, Inc."
+INSTDISK="LUFA Benito Programmer Driver Installer"
+DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file
diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
index 239eb7137..4db5a568a 100644
--- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
+++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
@@ -1,161 +1,161 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Standalone Programmer project. This file contains the main tasks of
- * the demo and is responsible for the initial application hardware configuration.
- */
-
-#define INCLUDE_FROM_STANDALONEPROG_C
-#include "StandaloneProgrammer.h"
-
-/** Standard file stream for the currently open file on the disk. */
-FILE DiskStream = FDEV_SETUP_STREAM(NULL, Disk_getchar, _FDEV_SETUP_READ);
-
-/** Petite FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */
-FATFS DiskFATState;
-
-/** Stream character fetching routine for the FAT driver so that characters from the currently open file can be
- * read in sequence when applied to a stdio stream.
- */
-static int Disk_getchar(FILE* Stream)
-{
- char ReadByte;
- WORD ByteWasRead;
-
- if (pf_read(&ReadByte, 1, &ByteWasRead) != FR_OK)
- return _FDEV_ERR;
-
- return (ByteWasRead ? ReadByte : _FDEV_EOF);
-}
-
-#if defined(USB_CAN_BE_BOTH)
-/** Event to handle mode changes in the library, to clear the FAT library's drive state structure when transitioning
- * between modes. This ensures that the library always works with current disk data.
- */
-void EVENT_USB_UIDChange(void)
-{
- pf_mount(&DiskFATState);
-}
-#endif
-
-/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
- * required functions to program the attached target (if any) with the files loaded to the dataflash.
- */
-void Programmer_Task(void)
-{
- static bool HasAttempted = false;
-
- if (Buttons_GetStatus() & BUTTONS_BUTTON1)
- {
- if (!(HasAttempted))
- HasAttempted = true;
- else
- return;
-
- puts("==== PROGRAMMING CYCLE STARTED ====\r\n");
-
- #if defined(USB_CAN_BE_BOTH)
- printf("Using %s Drive...\r\n", (USB_CurrentMode == USB_MODE_HOST) ? "External" : "Internal");
- #endif
-
- puts("Reading Configuration File...\r\n");
- if (!(ProgrammerConfig_ProcessConfiguration()))
- goto EndOfProgCycle;
-
- EndOfProgCycle:
- puts("==== PROGRAMMING CYCLE FINISHED ====\r\n");
- }
- else
- {
- HasAttempted = false;
- }
-}
-
-/** 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);
- sei();
-
- for (;;)
- {
- Programmer_Task();
-
- if (USB_CurrentMode == USB_MODE_HOST)
- {
- #if defined(USB_CAN_BE_HOST)
- DiskHost_USBTask();
- #endif
- }
- else
- {
- #if defined(USB_CAN_BE_DEVICE)
- DiskDevice_USBTask();
- #endif
- }
-
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- #if defined(USB_CAN_BE_BOTH)
- USB_Init(USB_MODE_UID);
- #else
- USB_Init();
- #endif
-
- LEDs_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
- Dataflash_Init();
- Buttons_Init();
- SerialStream_Init(9600, true);
-
- #if defined(USB_CAN_BE_DEVICE)
- /* Clear Dataflash sector protections, if enabled */
- DataflashManager_ResetDataflashProtections();
- #endif
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Standalone Programmer project. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
+#define INCLUDE_FROM_STANDALONEPROG_C
+#include "StandaloneProgrammer.h"
+
+/** Standard file stream for the currently open file on the disk. */
+FILE DiskStream = FDEV_SETUP_STREAM(NULL, Disk_getchar, _FDEV_SETUP_READ);
+
+/** Petite FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */
+FATFS DiskFATState;
+
+/** Stream character fetching routine for the FAT driver so that characters from the currently open file can be
+ * read in sequence when applied to a stdio stream.
+ */
+static int Disk_getchar(FILE* Stream)
+{
+ char ReadByte;
+ WORD ByteWasRead;
+
+ if (pf_read(&ReadByte, 1, &ByteWasRead) != FR_OK)
+ return _FDEV_ERR;
+
+ return (ByteWasRead ? ReadByte : _FDEV_EOF);
+}
+
+#if defined(USB_CAN_BE_BOTH)
+/** Event to handle mode changes in the library, to clear the FAT library's drive state structure when transitioning
+ * between modes. This ensures that the library always works with current disk data.
+ */
+void EVENT_USB_UIDChange(void)
+{
+ pf_mount(&DiskFATState);
+}
+#endif
+
+/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
+ * required functions to program the attached target (if any) with the files loaded to the dataflash.
+ */
+void Programmer_Task(void)
+{
+ static bool HasAttempted = false;
+
+ if (Buttons_GetStatus() & BUTTONS_BUTTON1)
+ {
+ if (!(HasAttempted))
+ HasAttempted = true;
+ else
+ return;
+
+ puts("==== PROGRAMMING CYCLE STARTED ====\r\n");
+
+ #if defined(USB_CAN_BE_BOTH)
+ printf("Using %s Drive...\r\n", (USB_CurrentMode == USB_MODE_HOST) ? "External" : "Internal");
+ #endif
+
+ puts("Reading Configuration File...\r\n");
+ if (!(ProgrammerConfig_ProcessConfiguration()))
+ goto EndOfProgCycle;
+
+ EndOfProgCycle:
+ puts("==== PROGRAMMING CYCLE FINISHED ====\r\n");
+ }
+ else
+ {
+ HasAttempted = false;
+ }
+}
+
+/** 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);
+ sei();
+
+ for (;;)
+ {
+ Programmer_Task();
+
+ if (USB_CurrentMode == USB_MODE_HOST)
+ {
+ #if defined(USB_CAN_BE_HOST)
+ DiskHost_USBTask();
+ #endif
+ }
+ else
+ {
+ #if defined(USB_CAN_BE_DEVICE)
+ DiskDevice_USBTask();
+ #endif
+ }
+
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ #if defined(USB_CAN_BE_BOTH)
+ USB_Init(USB_MODE_UID);
+ #else
+ USB_Init();
+ #endif
+
+ LEDs_Init();
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
+ Dataflash_Init();
+ Buttons_Init();
+ SerialStream_Init(9600, true);
+
+ #if defined(USB_CAN_BE_DEVICE)
+ /* Clear Dataflash sector protections, if enabled */
+ DataflashManager_ResetDataflashProtections();
+ #endif
+}
diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
index f61e369eb..dff45fcb2 100644
--- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
+++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
@@ -1,88 +1,88 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 StandaloneProgrammer.c.
- */
-
-#ifndef _STANDALONE_PROG_H_
-#define _STANDALONE_PROG_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
- #include <stdio.h>
-
- #include "DiskDevice.h"
- #include "DiskHost.h"
-
- #include "Lib/SCSI.h"
- #include "Lib/DataflashManager.h"
- #include "Lib/ProgrammerConfig.h"
- #include "Lib/PetiteFATFs/pff.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/Buttons.h>
- #include <LUFA/Drivers/Peripheral/SerialStream.h>
-
- /* 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
-
- /* External Variables: */
- extern FILE DiskStream;
- extern FATFS DiskFATState;
-
- /* Function Prototypes: */
- #if defined(INCLUDE_FROM_STANDALONEPROG_C)
- static int Disk_getchar(FILE* Stream);
- #endif
-
- void EVENT_USB_UIDChange(void);
-
- void SetupHardware(void);
- void Programmer_Task(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 StandaloneProgrammer.c.
+ */
+
+#ifndef _STANDALONE_PROG_H_
+#define _STANDALONE_PROG_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+ #include <stdio.h>
+
+ #include "DiskDevice.h"
+ #include "DiskHost.h"
+
+ #include "Lib/SCSI.h"
+ #include "Lib/DataflashManager.h"
+ #include "Lib/ProgrammerConfig.h"
+ #include "Lib/PetiteFATFs/pff.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/Buttons.h>
+ #include <LUFA/Drivers/Peripheral/SerialStream.h>
+
+ /* 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
+
+ /* External Variables: */
+ extern FILE DiskStream;
+ extern FATFS DiskFATState;
+
+ /* Function Prototypes: */
+ #if defined(INCLUDE_FROM_STANDALONEPROG_C)
+ static int Disk_getchar(FILE* Stream);
+ #endif
+
+ void EVENT_USB_UIDChange(void);
+
+ void SetupHardware(void);
+ void Programmer_Task(void);
+
+#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/makefile b/Projects/Incomplete/StandaloneProgrammer/makefile
index b21645237..c5ac77047 100644
--- a/Projects/Incomplete/StandaloneProgrammer/makefile
+++ b/Projects/Incomplete/StandaloneProgrammer/makefile
@@ -1,747 +1,747 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = StandaloneProgrammer
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../../
-
-
-# LUFA library compile-time options
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- DiskHost.c \
- DiskDevice.c \
- Lib/SCSI.c \
- Lib/DataflashManager.c \
- Lib/ProgrammerConfig.c \
- Lib/PetiteFATFs/diskio.c \
- Lib/PetiteFATFs/pff.c \
- $(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
- $(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = StandaloneProgrammer
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../../
+
+
+# LUFA library compile-time options
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ DiskHost.c \
+ DiskDevice.c \
+ Lib/SCSI.c \
+ Lib/DataflashManager.c \
+ Lib/ProgrammerConfig.c \
+ Lib/PetiteFATFs/diskio.c \
+ Lib/PetiteFATFs/pff.c \
+ $(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
+ $(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/LEDNotifier/Board/LEDs.h b/Projects/LEDNotifier/Board/LEDs.h
index c8d0d393b..87dbf6f02 100644
--- a/Projects/LEDNotifier/Board/LEDs.h
+++ b/Projects/LEDNotifier/Board/LEDs.h
@@ -1,112 +1,112 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/*
- LED Driver for the RGB LED on the Busware BUI board.
-*/
-
-#ifndef __LEDS_USER_H__
-#define __LEDS_USER_H__
-
- /* Includes: */
- #include <avr/io.h>
-
-/* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(INCLUDE_FROM_LEDS_H)
- #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
- #endif
-
- /* Public Interface - May be used in end-application: */
- /* Macros: */
- /** LED mask for the blue LED on the board. */
- #define LEDS_LED1 (1 << 2)
-
- /** LED mask for the green LED on the board. */
- #define LEDS_LED2 (1 << 3)
-
- /** LED mask for the red LED on the board. */
- #define LEDS_LED3 (1 << 4)
-
- /** LED mask for all the LEDs on the board. */
- #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
-
- /** LED mask for the none of the board LEDs */
- #define LEDS_NO_LEDS 0
-
- /* Inline Functions: */
- #if !defined(__DOXYGEN__)
- static inline void LEDs_Init(void)
- {
- DDRC |= LEDS_ALL_LEDS;
- }
-
- static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
- {
- PORTC |= LEDMask;
- }
-
- static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
- {
- PORTC &= ~LEDMask;
- }
-
- static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
- {
- PORTC = (PORTC & ~LEDS_ALL_LEDS) | LEDMask;
- }
-
- static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
- {
- PORTC = (PORTC & ~LEDMask) | ActiveMask;
- }
-
- static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
- {
- PORTC ^= LEDMask;
- }
-
- static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
- static inline uint8_t LEDs_GetLEDs(void)
- {
- return (PORTC & LEDS_ALL_LEDS);
- }
- #endif
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/*
+ LED Driver for the RGB LED on the Busware BUI board.
+*/
+
+#ifndef __LEDS_USER_H__
+#define __LEDS_USER_H__
+
+ /* Includes: */
+ #include <avr/io.h>
+
+/* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(INCLUDE_FROM_LEDS_H)
+ #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** LED mask for the blue LED on the board. */
+ #define LEDS_LED1 (1 << 2)
+
+ /** LED mask for the green LED on the board. */
+ #define LEDS_LED2 (1 << 3)
+
+ /** LED mask for the red LED on the board. */
+ #define LEDS_LED3 (1 << 4)
+
+ /** LED mask for all the LEDs on the board. */
+ #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
+
+ /** LED mask for the none of the board LEDs */
+ #define LEDS_NO_LEDS 0
+
+ /* Inline Functions: */
+ #if !defined(__DOXYGEN__)
+ static inline void LEDs_Init(void)
+ {
+ DDRC |= LEDS_ALL_LEDS;
+ }
+
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
+ {
+ PORTC |= LEDMask;
+ }
+
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
+ {
+ PORTC &= ~LEDMask;
+ }
+
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
+ {
+ PORTC = (PORTC & ~LEDS_ALL_LEDS) | LEDMask;
+ }
+
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
+ {
+ PORTC = (PORTC & ~LEDMask) | ActiveMask;
+ }
+
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ PORTC ^= LEDMask;
+ }
+
+ static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t LEDs_GetLEDs(void)
+ {
+ return (PORTC & LEDS_ALL_LEDS);
+ }
+ #endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs
index 020cda46e..2b189943a 100644
--- a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs
+++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs
@@ -1,131 +1,131 @@
-namespace CPUMonitor
-{
- partial class frmCPU
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
- this.tmrCPUTimer = new System.Windows.Forms.Timer(this.components);
- this.cmbComPort = new System.Windows.Forms.ComboBox();
- this.pcCPUUsage = new System.Diagnostics.PerformanceCounter();
- this.lblCPU = new System.Windows.Forms.Label();
- this.nicoNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
- this.btnMinimizeToTray = new System.Windows.Forms.Button();
- this.btnExit = new System.Windows.Forms.Button();
- ((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).BeginInit();
- this.SuspendLayout();
- //
- // tmrCPUTimer
- //
- this.tmrCPUTimer.Enabled = true;
- this.tmrCPUTimer.Interval = 1000;
- this.tmrCPUTimer.Tick += new System.EventHandler(this.tmrCPUTimer_Tick);
- //
- // cmbComPort
- //
- this.cmbComPort.FormattingEnabled = true;
- this.cmbComPort.Location = new System.Drawing.Point(48, 12);
- this.cmbComPort.Name = "cmbComPort";
- this.cmbComPort.Size = new System.Drawing.Size(156, 21);
- this.cmbComPort.TabIndex = 0;
- this.cmbComPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged);
- //
- // pcCPUUsage
- //
- this.pcCPUUsage.CategoryName = "Processor";
- this.pcCPUUsage.CounterName = "% Processor Time";
- this.pcCPUUsage.InstanceName = "_Total";
- //
- // lblCPU
- //
- this.lblCPU.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblCPU.Location = new System.Drawing.Point(44, 36);
- this.lblCPU.Name = "lblCPU";
- this.lblCPU.Size = new System.Drawing.Size(160, 28);
- this.lblCPU.TabIndex = 1;
- this.lblCPU.Text = "0%";
- this.lblCPU.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // nicoNotifyIcon
- //
- this.nicoNotifyIcon.Text = "CPU Usage Monitor";
- this.nicoNotifyIcon.Visible = true;
- //
- // btnMinimizeToTray
- //
- this.btnMinimizeToTray.Location = new System.Drawing.Point(12, 67);
- this.btnMinimizeToTray.Name = "btnMinimizeToTray";
- this.btnMinimizeToTray.Size = new System.Drawing.Size(111, 28);
- this.btnMinimizeToTray.TabIndex = 2;
- this.btnMinimizeToTray.Text = "Minimize to Tray";
- this.btnMinimizeToTray.UseVisualStyleBackColor = true;
- this.btnMinimizeToTray.Click += new System.EventHandler(this.btnMinimizeToTray_Click);
- //
- // btnExit
- //
- this.btnExit.Location = new System.Drawing.Point(126, 67);
- this.btnExit.Name = "btnExit";
- this.btnExit.Size = new System.Drawing.Size(111, 28);
- this.btnExit.TabIndex = 3;
- this.btnExit.Text = "Exit";
- this.btnExit.UseVisualStyleBackColor = true;
- this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
- //
- // frmCPU
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(249, 106);
- this.Controls.Add(this.btnExit);
- this.Controls.Add(this.btnMinimizeToTray);
- this.Controls.Add(this.lblCPU);
- this.Controls.Add(this.cmbComPort);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.Name = "frmCPU";
- this.Text = "CPU Usage Monitor";
- this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
- this.Load += new System.EventHandler(this.Form1_Load);
- ((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.IO.Ports.SerialPort serSerialPort;
- private System.Windows.Forms.Timer tmrCPUTimer;
- private System.Windows.Forms.ComboBox cmbComPort;
- private System.Diagnostics.PerformanceCounter pcCPUUsage;
- private System.Windows.Forms.Label lblCPU;
- private System.Windows.Forms.NotifyIcon nicoNotifyIcon;
- private System.Windows.Forms.Button btnMinimizeToTray;
- private System.Windows.Forms.Button btnExit;
- }
-}
-
+namespace CPUMonitor
+{
+ partial class frmCPU
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
+ this.tmrCPUTimer = new System.Windows.Forms.Timer(this.components);
+ this.cmbComPort = new System.Windows.Forms.ComboBox();
+ this.pcCPUUsage = new System.Diagnostics.PerformanceCounter();
+ this.lblCPU = new System.Windows.Forms.Label();
+ this.nicoNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
+ this.btnMinimizeToTray = new System.Windows.Forms.Button();
+ this.btnExit = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).BeginInit();
+ this.SuspendLayout();
+ //
+ // tmrCPUTimer
+ //
+ this.tmrCPUTimer.Enabled = true;
+ this.tmrCPUTimer.Interval = 1000;
+ this.tmrCPUTimer.Tick += new System.EventHandler(this.tmrCPUTimer_Tick);
+ //
+ // cmbComPort
+ //
+ this.cmbComPort.FormattingEnabled = true;
+ this.cmbComPort.Location = new System.Drawing.Point(48, 12);
+ this.cmbComPort.Name = "cmbComPort";
+ this.cmbComPort.Size = new System.Drawing.Size(156, 21);
+ this.cmbComPort.TabIndex = 0;
+ this.cmbComPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged);
+ //
+ // pcCPUUsage
+ //
+ this.pcCPUUsage.CategoryName = "Processor";
+ this.pcCPUUsage.CounterName = "% Processor Time";
+ this.pcCPUUsage.InstanceName = "_Total";
+ //
+ // lblCPU
+ //
+ this.lblCPU.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblCPU.Location = new System.Drawing.Point(44, 36);
+ this.lblCPU.Name = "lblCPU";
+ this.lblCPU.Size = new System.Drawing.Size(160, 28);
+ this.lblCPU.TabIndex = 1;
+ this.lblCPU.Text = "0%";
+ this.lblCPU.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // nicoNotifyIcon
+ //
+ this.nicoNotifyIcon.Text = "CPU Usage Monitor";
+ this.nicoNotifyIcon.Visible = true;
+ //
+ // btnMinimizeToTray
+ //
+ this.btnMinimizeToTray.Location = new System.Drawing.Point(12, 67);
+ this.btnMinimizeToTray.Name = "btnMinimizeToTray";
+ this.btnMinimizeToTray.Size = new System.Drawing.Size(111, 28);
+ this.btnMinimizeToTray.TabIndex = 2;
+ this.btnMinimizeToTray.Text = "Minimize to Tray";
+ this.btnMinimizeToTray.UseVisualStyleBackColor = true;
+ this.btnMinimizeToTray.Click += new System.EventHandler(this.btnMinimizeToTray_Click);
+ //
+ // btnExit
+ //
+ this.btnExit.Location = new System.Drawing.Point(126, 67);
+ this.btnExit.Name = "btnExit";
+ this.btnExit.Size = new System.Drawing.Size(111, 28);
+ this.btnExit.TabIndex = 3;
+ this.btnExit.Text = "Exit";
+ this.btnExit.UseVisualStyleBackColor = true;
+ this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
+ //
+ // frmCPU
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(249, 106);
+ this.Controls.Add(this.btnExit);
+ this.Controls.Add(this.btnMinimizeToTray);
+ this.Controls.Add(this.lblCPU);
+ this.Controls.Add(this.cmbComPort);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.Name = "frmCPU";
+ this.Text = "CPU Usage Monitor";
+ this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
+ this.Load += new System.EventHandler(this.Form1_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.IO.Ports.SerialPort serSerialPort;
+ private System.Windows.Forms.Timer tmrCPUTimer;
+ private System.Windows.Forms.ComboBox cmbComPort;
+ private System.Diagnostics.PerformanceCounter pcCPUUsage;
+ private System.Windows.Forms.Label lblCPU;
+ private System.Windows.Forms.NotifyIcon nicoNotifyIcon;
+ private System.Windows.Forms.Button btnMinimizeToTray;
+ private System.Windows.Forms.Button btnExit;
+ }
+}
+
diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs
index 4e2a6f9f9..34903f425 100644
--- a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs
+++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs
@@ -1,113 +1,113 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using Microsoft.Win32;
-
-namespace CPUMonitor
-{
- public partial class frmCPU : Form
- {
- private RegistryKey AppRegKey;
-
- private const int LIGHT_MAX = 0x1F;
-
- public frmCPU()
- {
- InitializeComponent();
-
- nicoNotifyIcon.Icon = this.Icon;
- nicoNotifyIcon.MouseClick += new MouseEventHandler(TrayIconClick);
- }
-
- private void Form1_Load(object sender, EventArgs e)
- {
- AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\CPUMonitor");
-
- for (int i = 1; i <= 99; i++)
- cmbComPort.Items.Add("COM" + i.ToString());
-
- cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1;
- serSerialPort.PortName = cmbComPort.Text;
-
- Hide();
- }
-
- private void NotifyLight(int Red, int Green, int Blue)
- {
- byte[] buffer = new byte[3];
- buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX));
- buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX));
- buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX));
-
- try
- {
- serSerialPort.PortName = cmbComPort.Text;
- serSerialPort.Open();
- serSerialPort.Write(buffer, 0, buffer.Length);
- serSerialPort.Close();
- }
- catch (Exception e)
- {
-
- }
- }
-
- private void tmrCPUTimer_Tick(object sender, EventArgs e)
- {
- float CPUUsage = pcCPUUsage.NextValue();
-
- int Red = 0;
- int Green = 0;
- int Blue = 0;
-
- if (CPUUsage < 25)
- {
- Green = (int)((LIGHT_MAX / 25) * CPUUsage);
- }
- else if (CPUUsage < 50)
- {
- Blue = (int)((LIGHT_MAX / 25) * (CPUUsage - 25));
- Green = LIGHT_MAX - Blue;
- }
- else if (CPUUsage < 75)
- {
- Red = (int)((LIGHT_MAX / 25) * (CPUUsage - 50));
- Blue = LIGHT_MAX - Red;
- }
- else
- {
- Red = LIGHT_MAX;
- }
-
- NotifyLight(Red, Green, Blue);
- lblCPU.Text = ((int)CPUUsage).ToString() + "%";
- }
-
- private void btnExit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
-
- private void btnMinimizeToTray_Click(object sender, EventArgs e)
- {
- this.Hide();
- }
-
- private void TrayIconClick(object sender, MouseEventArgs e)
- {
- this.Show();
- this.WindowState = FormWindowState.Normal;
- }
-
- private void cbPort_SelectedIndexChanged(object sender, EventArgs e)
- {
- AppRegKey.SetValue("Port", cmbComPort.SelectedIndex + 1);
- serSerialPort.PortName = cmbComPort.Text;
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using Microsoft.Win32;
+
+namespace CPUMonitor
+{
+ public partial class frmCPU : Form
+ {
+ private RegistryKey AppRegKey;
+
+ private const int LIGHT_MAX = 0x1F;
+
+ public frmCPU()
+ {
+ InitializeComponent();
+
+ nicoNotifyIcon.Icon = this.Icon;
+ nicoNotifyIcon.MouseClick += new MouseEventHandler(TrayIconClick);
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\CPUMonitor");
+
+ for (int i = 1; i <= 99; i++)
+ cmbComPort.Items.Add("COM" + i.ToString());
+
+ cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1;
+ serSerialPort.PortName = cmbComPort.Text;
+
+ Hide();
+ }
+
+ private void NotifyLight(int Red, int Green, int Blue)
+ {
+ byte[] buffer = new byte[3];
+ buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX));
+ buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX));
+ buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX));
+
+ try
+ {
+ serSerialPort.PortName = cmbComPort.Text;
+ serSerialPort.Open();
+ serSerialPort.Write(buffer, 0, buffer.Length);
+ serSerialPort.Close();
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+
+ private void tmrCPUTimer_Tick(object sender, EventArgs e)
+ {
+ float CPUUsage = pcCPUUsage.NextValue();
+
+ int Red = 0;
+ int Green = 0;
+ int Blue = 0;
+
+ if (CPUUsage < 25)
+ {
+ Green = (int)((LIGHT_MAX / 25) * CPUUsage);
+ }
+ else if (CPUUsage < 50)
+ {
+ Blue = (int)((LIGHT_MAX / 25) * (CPUUsage - 25));
+ Green = LIGHT_MAX - Blue;
+ }
+ else if (CPUUsage < 75)
+ {
+ Red = (int)((LIGHT_MAX / 25) * (CPUUsage - 50));
+ Blue = LIGHT_MAX - Red;
+ }
+ else
+ {
+ Red = LIGHT_MAX;
+ }
+
+ NotifyLight(Red, Green, Blue);
+ lblCPU.Text = ((int)CPUUsage).ToString() + "%";
+ }
+
+ private void btnExit_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void btnMinimizeToTray_Click(object sender, EventArgs e)
+ {
+ this.Hide();
+ }
+
+ private void TrayIconClick(object sender, MouseEventArgs e)
+ {
+ this.Show();
+ this.WindowState = FormWindowState.Normal;
+ }
+
+ private void cbPort_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ AppRegKey.SetValue("Port", cmbComPort.SelectedIndex + 1);
+ serSerialPort.PortName = cmbComPort.Text;
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/CPUUsageApp/Program.cs b/Projects/LEDNotifier/CPUUsageApp/Program.cs
index 02d83c2b6..cb4fd89f2 100644
--- a/Projects/LEDNotifier/CPUUsageApp/Program.cs
+++ b/Projects/LEDNotifier/CPUUsageApp/Program.cs
@@ -1,21 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows.Forms;
-
-namespace CPUMonitor
-{
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new frmCPU());
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace CPUMonitor
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new frmCPU());
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs b/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs
index f82aa5960..85d31fcba 100644
--- a/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs
+++ b/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs
@@ -1,36 +1,36 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("CPUMonitor")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("CPUMonitor")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3e4a61da-cdde-46de-848b-b5206d225e21")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("CPUMonitor")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("CPUMonitor")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3e4a61da-cdde-46de-848b-b5206d225e21")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs b/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs
index 43ba43ef6..a3ba63d3d 100644
--- a/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs
+++ b/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs
@@ -1,71 +1,71 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace CPUMonitor.Properties
-{
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CPUMonitor.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace CPUMonitor.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CPUMonitor.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs b/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs
index b9bf6776c..31165608c 100644
--- a/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs
+++ b/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs
@@ -1,30 +1,30 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace CPUMonitor.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace CPUMonitor.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c
index deef0876d..b5cb8872a 100644
--- a/Projects/LEDNotifier/Descriptors.c
+++ b/Projects/LEDNotifier/Descriptors.c
@@ -1,267 +1,267 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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"
-
-/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
- * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
- * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
- * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
- * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
- * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
- * port location).
- */
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x02,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2044,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .CDC_CCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 1,
-
- .Class = 0x02,
- .SubClass = 0x02,
- .Protocol = 0x01,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_Functional_IntHeader =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x00,
-
- .Data = {0x01, 0x10}
- },
-
- .CDC_Functional_AbstractControlManagement =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
- .SubType = 0x02,
-
- .Data = {0x06}
- },
-
- .CDC_Functional_Union =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x06,
-
- .Data = {0x00, 0x01}
- },
-
- .CDC_ManagementEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_NOTIFICATION_EPSIZE,
- .PollingIntervalMS = 0xFF
- },
-
- .CDC_DCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 1,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x0A,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .CDC_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(12), .Type = DTYPE_String},
-
- .UnicodeString = L"LED Notifier"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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"
+
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x02,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2044,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .CDC_CCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 1,
+
+ .Class = 0x02,
+ .SubClass = 0x02,
+ .Protocol = 0x01,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_Functional_IntHeader =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x00,
+
+ .Data = {0x01, 0x10}
+ },
+
+ .CDC_Functional_AbstractControlManagement =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
+ .SubType = 0x02,
+
+ .Data = {0x06}
+ },
+
+ .CDC_Functional_Union =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x06,
+
+ .Data = {0x00, 0x01}
+ },
+
+ .CDC_ManagementEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .PollingIntervalMS = 0xFF
+ },
+
+ .CDC_DCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 1,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x0A,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .CDC_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(12), .Type = DTYPE_String},
+
+ .UnicodeString = L"LED Notifier"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/LEDNotifier/Descriptors.h b/Projects/LEDNotifier/Descriptors.h
index 76eb1fc24..bb0b8e546 100644
--- a/Projects/LEDNotifier/Descriptors.h
+++ b/Projects/LEDNotifier/Descriptors.h
@@ -1,83 +1,83 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Macros: */
- /** Endpoint number of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPNUM 2
-
- /** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
-
- /** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
-
- /** Size in bytes of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPSIZE 8
-
- /** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t CDC_CCI_Interface;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
- CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
- USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
- USB_Descriptor_Interface_t CDC_DCI_Interface;
- USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
- USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Macros: */
+ /** Endpoint number of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPNUM 2
+
+ /** Endpoint number of the CDC device-to-host data IN endpoint. */
+ #define CDC_TX_EPNUM 3
+
+ /** Endpoint number of the CDC host-to-device data OUT endpoint. */
+ #define CDC_RX_EPNUM 4
+
+ /** Size in bytes of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPSIZE 8
+
+ /** Size in bytes of the CDC data IN and OUT endpoints. */
+ #define CDC_TXRX_EPSIZE 16
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t CDC_CCI_Interface;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
+ CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
+ USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
+ USB_Descriptor_Interface_t CDC_DCI_Interface;
+ USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
+ USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/LEDNotifier/Doxygen.conf b/Projects/LEDNotifier/Doxygen.conf
index abe146d04..524a5f3e5 100644
--- a/Projects/LEDNotifier/Doxygen.conf
+++ b/Projects/LEDNotifier/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "LUFA Library - USB LED Notifier Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/ CPUUsageApp/ HotmailNotifierApp/ LEDMixerApp/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "LUFA Library - USB LED Notifier Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/ CPUUsageApp/ HotmailNotifierApp/ LEDMixerApp/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.Designer.cs b/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.Designer.cs
index 9e4734dc1..c4e494bbe 100644
--- a/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.Designer.cs
+++ b/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.Designer.cs
@@ -1,113 +1,113 @@
-namespace TestWinForms
-{
- partial class MailNotifier
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
- this.cmbComPort = new System.Windows.Forms.ComboBox();
- this.lblComPort = new System.Windows.Forms.Label();
- this.btnMinimize = new System.Windows.Forms.Button();
- this.btnExit = new System.Windows.Forms.Button();
- this.nicoNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
- this.SuspendLayout();
- //
- // cmbComPort
- //
- this.cmbComPort.FormattingEnabled = true;
- this.cmbComPort.Location = new System.Drawing.Point(108, 12);
- this.cmbComPort.Name = "cmbComPort";
- this.cmbComPort.Size = new System.Drawing.Size(126, 21);
- this.cmbComPort.TabIndex = 0;
- this.cmbComPort.SelectedIndexChanged += new System.EventHandler(this.cmbComPort_SelectedIndexChanged);
- //
- // lblComPort
- //
- this.lblComPort.AutoSize = true;
- this.lblComPort.Location = new System.Drawing.Point(12, 15);
- this.lblComPort.Name = "lblComPort";
- this.lblComPort.Size = new System.Drawing.Size(90, 13);
- this.lblComPort.TabIndex = 1;
- this.lblComPort.Text = "COM Port to Use:";
- //
- // btnMinimize
- //
- this.btnMinimize.Location = new System.Drawing.Point(12, 42);
- this.btnMinimize.Name = "btnMinimize";
- this.btnMinimize.Size = new System.Drawing.Size(109, 23);
- this.btnMinimize.TabIndex = 2;
- this.btnMinimize.Text = "Minimize to Tray";
- this.btnMinimize.UseVisualStyleBackColor = true;
- this.btnMinimize.Click += new System.EventHandler(this.btnMinimize_Click);
- //
- // btnExit
- //
- this.btnExit.Location = new System.Drawing.Point(131, 42);
- this.btnExit.Name = "btnExit";
- this.btnExit.Size = new System.Drawing.Size(109, 23);
- this.btnExit.TabIndex = 3;
- this.btnExit.Text = "Exit";
- this.btnExit.UseVisualStyleBackColor = true;
- this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
- //
- // nicoNotifyIcon
- //
- this.nicoNotifyIcon.Text = "Mail Notifier";
- this.nicoNotifyIcon.Visible = true;
- //
- // MailNotifier
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(252, 77);
- this.Controls.Add(this.btnExit);
- this.Controls.Add(this.btnMinimize);
- this.Controls.Add(this.lblComPort);
- this.Controls.Add(this.cmbComPort);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.Name = "MailNotifier";
- this.Text = "Mail Notifier Light";
- this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
- this.Load += new System.EventHandler(this.MailNotifier_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.IO.Ports.SerialPort serSerialPort;
- private System.Windows.Forms.ComboBox cmbComPort;
- private System.Windows.Forms.Label lblComPort;
- private System.Windows.Forms.Button btnMinimize;
- private System.Windows.Forms.Button btnExit;
- private System.Windows.Forms.NotifyIcon nicoNotifyIcon;
- }
-}
-
+namespace TestWinForms
+{
+ partial class MailNotifier
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
+ this.cmbComPort = new System.Windows.Forms.ComboBox();
+ this.lblComPort = new System.Windows.Forms.Label();
+ this.btnMinimize = new System.Windows.Forms.Button();
+ this.btnExit = new System.Windows.Forms.Button();
+ this.nicoNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
+ this.SuspendLayout();
+ //
+ // cmbComPort
+ //
+ this.cmbComPort.FormattingEnabled = true;
+ this.cmbComPort.Location = new System.Drawing.Point(108, 12);
+ this.cmbComPort.Name = "cmbComPort";
+ this.cmbComPort.Size = new System.Drawing.Size(126, 21);
+ this.cmbComPort.TabIndex = 0;
+ this.cmbComPort.SelectedIndexChanged += new System.EventHandler(this.cmbComPort_SelectedIndexChanged);
+ //
+ // lblComPort
+ //
+ this.lblComPort.AutoSize = true;
+ this.lblComPort.Location = new System.Drawing.Point(12, 15);
+ this.lblComPort.Name = "lblComPort";
+ this.lblComPort.Size = new System.Drawing.Size(90, 13);
+ this.lblComPort.TabIndex = 1;
+ this.lblComPort.Text = "COM Port to Use:";
+ //
+ // btnMinimize
+ //
+ this.btnMinimize.Location = new System.Drawing.Point(12, 42);
+ this.btnMinimize.Name = "btnMinimize";
+ this.btnMinimize.Size = new System.Drawing.Size(109, 23);
+ this.btnMinimize.TabIndex = 2;
+ this.btnMinimize.Text = "Minimize to Tray";
+ this.btnMinimize.UseVisualStyleBackColor = true;
+ this.btnMinimize.Click += new System.EventHandler(this.btnMinimize_Click);
+ //
+ // btnExit
+ //
+ this.btnExit.Location = new System.Drawing.Point(131, 42);
+ this.btnExit.Name = "btnExit";
+ this.btnExit.Size = new System.Drawing.Size(109, 23);
+ this.btnExit.TabIndex = 3;
+ this.btnExit.Text = "Exit";
+ this.btnExit.UseVisualStyleBackColor = true;
+ this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
+ //
+ // nicoNotifyIcon
+ //
+ this.nicoNotifyIcon.Text = "Mail Notifier";
+ this.nicoNotifyIcon.Visible = true;
+ //
+ // MailNotifier
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(252, 77);
+ this.Controls.Add(this.btnExit);
+ this.Controls.Add(this.btnMinimize);
+ this.Controls.Add(this.lblComPort);
+ this.Controls.Add(this.cmbComPort);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.Name = "MailNotifier";
+ this.Text = "Mail Notifier Light";
+ this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
+ this.Load += new System.EventHandler(this.MailNotifier_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.IO.Ports.SerialPort serSerialPort;
+ private System.Windows.Forms.ComboBox cmbComPort;
+ private System.Windows.Forms.Label lblComPort;
+ private System.Windows.Forms.Button btnMinimize;
+ private System.Windows.Forms.Button btnExit;
+ private System.Windows.Forms.NotifyIcon nicoNotifyIcon;
+ }
+}
+
diff --git a/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs b/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs
index 742948fca..43cbef88c 100644
--- a/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs
+++ b/Projects/LEDNotifier/HotmailNotifierApp/MailNotifier.cs
@@ -1,111 +1,111 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using Microsoft.Win32;
-
-namespace TestWinForms
-{
- public partial class MailNotifier : Form
- {
- private MessengerAPI.Messenger Messenger;
- private RegistryKey AppRegKey;
-
- private const int LIGHT_MAX = 0x1F;
-
- public MailNotifier()
- {
- InitializeComponent();
-
- Messenger = new MessengerAPI.Messenger();
- AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\MailNotifier");
-
- for (int i = 1; i < 99; i++)
- cmbComPort.Items.Add("COM" + i.ToString());
-
- cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1;
- serSerialPort.PortName = cmbComPort.Text;
-
- nicoNotifyIcon.Icon = this.Icon;
- nicoNotifyIcon.MouseClick += new MouseEventHandler(TrayIconClick);
- }
-
- private void MailNotifier_Load(object sender, EventArgs e)
- {
- Messenger.OnUnreadEmailChange += new MessengerAPI.DMessengerEvents_OnUnreadEmailChangeEventHandler(NewEmail);
-
- bool UnreadMail = (Messenger.get_UnreadEmailCount(MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX) > 0);
- NotifyLight((!UnreadMail ? LIGHT_MAX : 0), (UnreadMail ? LIGHT_MAX : 0), 0);
-
- Hide();
- }
-
- private void TrayIconClick(object sender, MouseEventArgs e)
- {
- this.Show();
- this.WindowState = FormWindowState.Normal;
- }
-
- private void NewEmail(MessengerAPI.MUAFOLDER folder, int amount, ref bool enableDefault)
- {
- if (folder == MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX)
- {
- bool UnreadMail = (Messenger.get_UnreadEmailCount(MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX) > 0);
- NotifyLight((!UnreadMail ? LIGHT_MAX : 0), (UnreadMail ? LIGHT_MAX : 0), 0);
- }
- }
-
- private void NotifyLight(int Red, int Green, int Blue)
- {
- byte[] buffer = new byte[3];
- buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX));
- buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX));
- buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX));
-
- try
- {
- serSerialPort.Open();
- serSerialPort.Write(buffer, 0, buffer.Length);
- serSerialPort.Close();
- }
- catch (Exception e)
- {
-
- }
- }
-
- private void btnExit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
-
- private void cmbComPort_SelectedIndexChanged(object sender, EventArgs e)
- {
- AppRegKey.SetValue("Port", cmbComPort.SelectedIndex + 1);
- serSerialPort.PortName = cmbComPort.Text;
-
- for (int i = 1; i < 10; i++)
- {
- NotifyLight((LIGHT_MAX / i), (LIGHT_MAX / (i * 10)), 0);
- System.Threading.Thread.Sleep(10);
- }
-
- for (int i = 10; i > 0; i--)
- {
- NotifyLight((LIGHT_MAX / i), (LIGHT_MAX / (i * 10)), 0);
- System.Threading.Thread.Sleep(10);
- }
-
- bool UnreadMail = (Messenger.get_UnreadEmailCount(MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX) > 0);
- NotifyLight((!UnreadMail ? LIGHT_MAX : 0), (UnreadMail ? LIGHT_MAX : 0), 0);
- }
-
- private void btnMinimize_Click(object sender, EventArgs e)
- {
- this.Hide();
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Microsoft.Win32;
+
+namespace TestWinForms
+{
+ public partial class MailNotifier : Form
+ {
+ private MessengerAPI.Messenger Messenger;
+ private RegistryKey AppRegKey;
+
+ private const int LIGHT_MAX = 0x1F;
+
+ public MailNotifier()
+ {
+ InitializeComponent();
+
+ Messenger = new MessengerAPI.Messenger();
+ AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\MailNotifier");
+
+ for (int i = 1; i < 99; i++)
+ cmbComPort.Items.Add("COM" + i.ToString());
+
+ cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1;
+ serSerialPort.PortName = cmbComPort.Text;
+
+ nicoNotifyIcon.Icon = this.Icon;
+ nicoNotifyIcon.MouseClick += new MouseEventHandler(TrayIconClick);
+ }
+
+ private void MailNotifier_Load(object sender, EventArgs e)
+ {
+ Messenger.OnUnreadEmailChange += new MessengerAPI.DMessengerEvents_OnUnreadEmailChangeEventHandler(NewEmail);
+
+ bool UnreadMail = (Messenger.get_UnreadEmailCount(MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX) > 0);
+ NotifyLight((!UnreadMail ? LIGHT_MAX : 0), (UnreadMail ? LIGHT_MAX : 0), 0);
+
+ Hide();
+ }
+
+ private void TrayIconClick(object sender, MouseEventArgs e)
+ {
+ this.Show();
+ this.WindowState = FormWindowState.Normal;
+ }
+
+ private void NewEmail(MessengerAPI.MUAFOLDER folder, int amount, ref bool enableDefault)
+ {
+ if (folder == MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX)
+ {
+ bool UnreadMail = (Messenger.get_UnreadEmailCount(MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX) > 0);
+ NotifyLight((!UnreadMail ? LIGHT_MAX : 0), (UnreadMail ? LIGHT_MAX : 0), 0);
+ }
+ }
+
+ private void NotifyLight(int Red, int Green, int Blue)
+ {
+ byte[] buffer = new byte[3];
+ buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX));
+ buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX));
+ buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX));
+
+ try
+ {
+ serSerialPort.Open();
+ serSerialPort.Write(buffer, 0, buffer.Length);
+ serSerialPort.Close();
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+
+ private void btnExit_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void cmbComPort_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ AppRegKey.SetValue("Port", cmbComPort.SelectedIndex + 1);
+ serSerialPort.PortName = cmbComPort.Text;
+
+ for (int i = 1; i < 10; i++)
+ {
+ NotifyLight((LIGHT_MAX / i), (LIGHT_MAX / (i * 10)), 0);
+ System.Threading.Thread.Sleep(10);
+ }
+
+ for (int i = 10; i > 0; i--)
+ {
+ NotifyLight((LIGHT_MAX / i), (LIGHT_MAX / (i * 10)), 0);
+ System.Threading.Thread.Sleep(10);
+ }
+
+ bool UnreadMail = (Messenger.get_UnreadEmailCount(MessengerAPI.MUAFOLDER.MUAFOLDER_INBOX) > 0);
+ NotifyLight((!UnreadMail ? LIGHT_MAX : 0), (UnreadMail ? LIGHT_MAX : 0), 0);
+ }
+
+ private void btnMinimize_Click(object sender, EventArgs e)
+ {
+ this.Hide();
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/HotmailNotifierApp/Program.cs b/Projects/LEDNotifier/HotmailNotifierApp/Program.cs
index 1dd229d91..7c5690828 100644
--- a/Projects/LEDNotifier/HotmailNotifierApp/Program.cs
+++ b/Projects/LEDNotifier/HotmailNotifierApp/Program.cs
@@ -1,20 +1,20 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-
-namespace TestWinForms
-{
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new MailNotifier());
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace TestWinForms
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MailNotifier());
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/HotmailNotifierApp/Properties/AssemblyInfo.cs b/Projects/LEDNotifier/HotmailNotifierApp/Properties/AssemblyInfo.cs
index 86b056454..83ead884d 100644
--- a/Projects/LEDNotifier/HotmailNotifierApp/Properties/AssemblyInfo.cs
+++ b/Projects/LEDNotifier/HotmailNotifierApp/Properties/AssemblyInfo.cs
@@ -1,36 +1,36 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("MailNotifier")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Dean Camera")]
-[assembly: AssemblyProduct("Mail LED Notifier")]
-[assembly: AssemblyCopyright("Public Domain")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("25e10140-cf96-4619-adaa-9010abc62d0a")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MailNotifier")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Dean Camera")]
+[assembly: AssemblyProduct("Mail LED Notifier")]
+[assembly: AssemblyCopyright("Public Domain")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("25e10140-cf96-4619-adaa-9010abc62d0a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Projects/LEDNotifier/HotmailNotifierApp/Properties/Resources.Designer.cs b/Projects/LEDNotifier/HotmailNotifierApp/Properties/Resources.Designer.cs
index 8eb902684..67e2793d2 100644
--- a/Projects/LEDNotifier/HotmailNotifierApp/Properties/Resources.Designer.cs
+++ b/Projects/LEDNotifier/HotmailNotifierApp/Properties/Resources.Designer.cs
@@ -1,63 +1,63 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MailNotifier.Properties {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MailNotifier.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MailNotifier.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MailNotifier.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/HotmailNotifierApp/Properties/Settings.Designer.cs b/Projects/LEDNotifier/HotmailNotifierApp/Properties/Settings.Designer.cs
index bb55ab3e3..2906c3ff3 100644
--- a/Projects/LEDNotifier/HotmailNotifierApp/Properties/Settings.Designer.cs
+++ b/Projects/LEDNotifier/HotmailNotifierApp/Properties/Settings.Designer.cs
@@ -1,26 +1,26 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MailNotifier.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MailNotifier.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs
index 8ed0665f7..595083a4a 100644
--- a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs
+++ b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs
@@ -1,149 +1,149 @@
-namespace LEDMixer
-{
- partial class LEDMixer
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.tbRed = new System.Windows.Forms.TrackBar();
- this.tbGreen = new System.Windows.Forms.TrackBar();
- this.tbBlue = new System.Windows.Forms.TrackBar();
- this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
- this.cbPort = new System.Windows.Forms.ComboBox();
- this.lblRed = new System.Windows.Forms.Label();
- this.lblBlue = new System.Windows.Forms.Label();
- this.lblGreen = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.tbRed)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.tbGreen)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.tbBlue)).BeginInit();
- this.SuspendLayout();
- //
- // tbRed
- //
- this.tbRed.Location = new System.Drawing.Point(54, 64);
- this.tbRed.Maximum = 512;
- this.tbRed.Name = "tbRed";
- this.tbRed.Size = new System.Drawing.Size(230, 45);
- this.tbRed.TabIndex = 0;
- this.tbRed.Scroll += new System.EventHandler(this.tbRed_Scroll);
- //
- // tbGreen
- //
- this.tbGreen.Location = new System.Drawing.Point(54, 115);
- this.tbGreen.Maximum = 512;
- this.tbGreen.Name = "tbGreen";
- this.tbGreen.Size = new System.Drawing.Size(230, 45);
- this.tbGreen.TabIndex = 1;
- this.tbGreen.Scroll += new System.EventHandler(this.tbGreen_Scroll);
- //
- // tbBlue
- //
- this.tbBlue.Location = new System.Drawing.Point(54, 163);
- this.tbBlue.Maximum = 512;
- this.tbBlue.Name = "tbBlue";
- this.tbBlue.Size = new System.Drawing.Size(230, 45);
- this.tbBlue.TabIndex = 2;
- this.tbBlue.Scroll += new System.EventHandler(this.tbBlue_Scroll);
- //
- // cbPort
- //
- this.cbPort.FormattingEnabled = true;
- this.cbPort.Location = new System.Drawing.Point(97, 12);
- this.cbPort.Name = "cbPort";
- this.cbPort.Size = new System.Drawing.Size(99, 21);
- this.cbPort.TabIndex = 3;
- this.cbPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged);
- //
- // lblRed
- //
- this.lblRed.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblRed.Location = new System.Drawing.Point(3, 64);
- this.lblRed.Name = "lblRed";
- this.lblRed.Size = new System.Drawing.Size(48, 29);
- this.lblRed.TabIndex = 4;
- this.lblRed.Text = "Red";
- this.lblRed.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lblBlue
- //
- this.lblBlue.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblBlue.Location = new System.Drawing.Point(3, 115);
- this.lblBlue.Name = "lblGreen";
- this.lblBlue.Size = new System.Drawing.Size(50, 27);
- this.lblBlue.TabIndex = 5;
- this.lblBlue.Text = "Green";
- this.lblBlue.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lblGreen
- //
- this.lblGreen.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblGreen.Location = new System.Drawing.Point(3, 163);
- this.lblGreen.Name = "lblBlue";
- this.lblGreen.Size = new System.Drawing.Size(50, 25);
- this.lblGreen.TabIndex = 6;
- this.lblGreen.Text = "Blue";
- this.lblGreen.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // LEDMixer
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(284, 207);
- this.Controls.Add(this.lblGreen);
- this.Controls.Add(this.lblBlue);
- this.Controls.Add(this.lblRed);
- this.Controls.Add(this.cbPort);
- this.Controls.Add(this.tbBlue);
- this.Controls.Add(this.tbGreen);
- this.Controls.Add(this.tbRed);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "LEDMixer";
- this.Text = "LED Mixer";
- this.Load += new System.EventHandler(this.LEDMixer_Load);
- ((System.ComponentModel.ISupportInitialize)(this.tbRed)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.tbGreen)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.tbBlue)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.TrackBar tbRed;
- private System.Windows.Forms.TrackBar tbGreen;
- private System.Windows.Forms.TrackBar tbBlue;
- private System.IO.Ports.SerialPort serSerialPort;
- private System.Windows.Forms.ComboBox cbPort;
- private System.Windows.Forms.Label lblRed;
- private System.Windows.Forms.Label lblBlue;
- private System.Windows.Forms.Label lblGreen;
- }
-}
-
+namespace LEDMixer
+{
+ partial class LEDMixer
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.tbRed = new System.Windows.Forms.TrackBar();
+ this.tbGreen = new System.Windows.Forms.TrackBar();
+ this.tbBlue = new System.Windows.Forms.TrackBar();
+ this.serSerialPort = new System.IO.Ports.SerialPort(this.components);
+ this.cbPort = new System.Windows.Forms.ComboBox();
+ this.lblRed = new System.Windows.Forms.Label();
+ this.lblBlue = new System.Windows.Forms.Label();
+ this.lblGreen = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.tbRed)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.tbGreen)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.tbBlue)).BeginInit();
+ this.SuspendLayout();
+ //
+ // tbRed
+ //
+ this.tbRed.Location = new System.Drawing.Point(54, 64);
+ this.tbRed.Maximum = 512;
+ this.tbRed.Name = "tbRed";
+ this.tbRed.Size = new System.Drawing.Size(230, 45);
+ this.tbRed.TabIndex = 0;
+ this.tbRed.Scroll += new System.EventHandler(this.tbRed_Scroll);
+ //
+ // tbGreen
+ //
+ this.tbGreen.Location = new System.Drawing.Point(54, 115);
+ this.tbGreen.Maximum = 512;
+ this.tbGreen.Name = "tbGreen";
+ this.tbGreen.Size = new System.Drawing.Size(230, 45);
+ this.tbGreen.TabIndex = 1;
+ this.tbGreen.Scroll += new System.EventHandler(this.tbGreen_Scroll);
+ //
+ // tbBlue
+ //
+ this.tbBlue.Location = new System.Drawing.Point(54, 163);
+ this.tbBlue.Maximum = 512;
+ this.tbBlue.Name = "tbBlue";
+ this.tbBlue.Size = new System.Drawing.Size(230, 45);
+ this.tbBlue.TabIndex = 2;
+ this.tbBlue.Scroll += new System.EventHandler(this.tbBlue_Scroll);
+ //
+ // cbPort
+ //
+ this.cbPort.FormattingEnabled = true;
+ this.cbPort.Location = new System.Drawing.Point(97, 12);
+ this.cbPort.Name = "cbPort";
+ this.cbPort.Size = new System.Drawing.Size(99, 21);
+ this.cbPort.TabIndex = 3;
+ this.cbPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged);
+ //
+ // lblRed
+ //
+ this.lblRed.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblRed.Location = new System.Drawing.Point(3, 64);
+ this.lblRed.Name = "lblRed";
+ this.lblRed.Size = new System.Drawing.Size(48, 29);
+ this.lblRed.TabIndex = 4;
+ this.lblRed.Text = "Red";
+ this.lblRed.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblBlue
+ //
+ this.lblBlue.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblBlue.Location = new System.Drawing.Point(3, 115);
+ this.lblBlue.Name = "lblGreen";
+ this.lblBlue.Size = new System.Drawing.Size(50, 27);
+ this.lblBlue.TabIndex = 5;
+ this.lblBlue.Text = "Green";
+ this.lblBlue.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblGreen
+ //
+ this.lblGreen.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblGreen.Location = new System.Drawing.Point(3, 163);
+ this.lblGreen.Name = "lblBlue";
+ this.lblGreen.Size = new System.Drawing.Size(50, 25);
+ this.lblGreen.TabIndex = 6;
+ this.lblGreen.Text = "Blue";
+ this.lblGreen.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // LEDMixer
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(284, 207);
+ this.Controls.Add(this.lblGreen);
+ this.Controls.Add(this.lblBlue);
+ this.Controls.Add(this.lblRed);
+ this.Controls.Add(this.cbPort);
+ this.Controls.Add(this.tbBlue);
+ this.Controls.Add(this.tbGreen);
+ this.Controls.Add(this.tbRed);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "LEDMixer";
+ this.Text = "LED Mixer";
+ this.Load += new System.EventHandler(this.LEDMixer_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.tbRed)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.tbGreen)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.tbBlue)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TrackBar tbRed;
+ private System.Windows.Forms.TrackBar tbGreen;
+ private System.Windows.Forms.TrackBar tbBlue;
+ private System.IO.Ports.SerialPort serSerialPort;
+ private System.Windows.Forms.ComboBox cbPort;
+ private System.Windows.Forms.Label lblRed;
+ private System.Windows.Forms.Label lblBlue;
+ private System.Windows.Forms.Label lblGreen;
+ }
+}
+
diff --git a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs
index ccc89a7a2..6e19af8ed 100644
--- a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs
+++ b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs
@@ -1,73 +1,73 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-
-namespace LEDMixer
-{
- public partial class LEDMixer : Form
- {
- private const int LIGHT_MAX = 0x1F;
-
- public LEDMixer()
- {
- InitializeComponent();
- }
-
- private void LEDMixer_Load(object sender, EventArgs e)
- {
- for (int i = 1; i <= 99; i++)
- cbPort.Items.Add("COM" + i.ToString());
-
- cbPort.SelectedIndex = 0;
-
- tbRed.Maximum = LIGHT_MAX;
- tbGreen.Maximum = LIGHT_MAX;
- tbBlue.Maximum = LIGHT_MAX;
- }
-
- private void tbRed_Scroll(object sender, EventArgs e)
- {
- NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
- }
-
- private void tbGreen_Scroll(object sender, EventArgs e)
- {
- NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
- }
-
- private void tbBlue_Scroll(object sender, EventArgs e)
- {
- NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
- }
-
- private void NotifyLight(int Red, int Green, int Blue)
- {
- byte[] buffer = new byte[3];
- buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX));
- buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX));
- buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX));
-
- try
- {
- serSerialPort.PortName = cbPort.Text;
- serSerialPort.Open();
- serSerialPort.Write(buffer, 0, buffer.Length);
- serSerialPort.Close();
- }
- catch (Exception e)
- {
-
- }
- }
-
- private void cbPort_SelectedIndexChanged(object sender, EventArgs e)
- {
- NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace LEDMixer
+{
+ public partial class LEDMixer : Form
+ {
+ private const int LIGHT_MAX = 0x1F;
+
+ public LEDMixer()
+ {
+ InitializeComponent();
+ }
+
+ private void LEDMixer_Load(object sender, EventArgs e)
+ {
+ for (int i = 1; i <= 99; i++)
+ cbPort.Items.Add("COM" + i.ToString());
+
+ cbPort.SelectedIndex = 0;
+
+ tbRed.Maximum = LIGHT_MAX;
+ tbGreen.Maximum = LIGHT_MAX;
+ tbBlue.Maximum = LIGHT_MAX;
+ }
+
+ private void tbRed_Scroll(object sender, EventArgs e)
+ {
+ NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
+ }
+
+ private void tbGreen_Scroll(object sender, EventArgs e)
+ {
+ NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
+ }
+
+ private void tbBlue_Scroll(object sender, EventArgs e)
+ {
+ NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
+ }
+
+ private void NotifyLight(int Red, int Green, int Blue)
+ {
+ byte[] buffer = new byte[3];
+ buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX));
+ buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX));
+ buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX));
+
+ try
+ {
+ serSerialPort.PortName = cbPort.Text;
+ serSerialPort.Open();
+ serSerialPort.Write(buffer, 0, buffer.Length);
+ serSerialPort.Close();
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+
+ private void cbPort_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value);
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/LEDMixerApp/Program.cs b/Projects/LEDNotifier/LEDMixerApp/Program.cs
index d9171482b..8958f86d2 100644
--- a/Projects/LEDNotifier/LEDMixerApp/Program.cs
+++ b/Projects/LEDNotifier/LEDMixerApp/Program.cs
@@ -1,21 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows.Forms;
-
-namespace LEDMixer
-{
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new LEDMixer());
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace LEDMixer
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new LEDMixer());
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/LEDMixerApp/Properties/AssemblyInfo.cs b/Projects/LEDNotifier/LEDMixerApp/Properties/AssemblyInfo.cs
index 1a6f3bd3b..c88194381 100644
--- a/Projects/LEDNotifier/LEDMixerApp/Properties/AssemblyInfo.cs
+++ b/Projects/LEDNotifier/LEDMixerApp/Properties/AssemblyInfo.cs
@@ -1,36 +1,36 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("LEDMixer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("LEDMixer")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("335c1112-9aa6-42a0-9765-5cc6deb78c88")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("LEDMixer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("LEDMixer")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("335c1112-9aa6-42a0-9765-5cc6deb78c88")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Projects/LEDNotifier/LEDMixerApp/Properties/Resources.Designer.cs b/Projects/LEDNotifier/LEDMixerApp/Properties/Resources.Designer.cs
index 30431f028..74c0e3e7e 100644
--- a/Projects/LEDNotifier/LEDMixerApp/Properties/Resources.Designer.cs
+++ b/Projects/LEDNotifier/LEDMixerApp/Properties/Resources.Designer.cs
@@ -1,71 +1,71 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace LEDMixer.Properties
-{
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LEDMixer.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LEDMixer.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LEDMixer.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/LEDMixerApp/Properties/Settings.Designer.cs b/Projects/LEDNotifier/LEDMixerApp/Properties/Settings.Designer.cs
index 9c1748eda..1e613aa26 100644
--- a/Projects/LEDNotifier/LEDMixerApp/Properties/Settings.Designer.cs
+++ b/Projects/LEDNotifier/LEDMixerApp/Properties/Settings.Designer.cs
@@ -1,30 +1,30 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace LEDMixer.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LEDMixer.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c
index 5b5390024..da4ee9e5c 100644
--- a/Projects/LEDNotifier/LEDNotifier.c
+++ b/Projects/LEDNotifier/LEDNotifier.c
@@ -1,167 +1,167 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 LEDNotfier project. This file contains the main tasks of
- * the demo and is responsible for the initial application hardware configuration.
- */
-
-#include "LEDNotifier.h"
-
-/** LUFA CDC Class driver interface configuration and state information. This structure is
- * passed to all CDC Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
- {
- .Config =
- {
- .ControlInterfaceNumber = 0,
-
- .DataINEndpointNumber = CDC_TX_EPNUM,
- .DataINEndpointSize = CDC_TXRX_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = CDC_RX_EPNUM,
- .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
- .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
- .NotificationEndpointDoubleBank = false,
- },
- };
-
-/** Counter for the software PWM */
-static volatile uint8_t SoftPWM_Count;
-
-/** Duty cycle for the first software PWM channel */
-static volatile uint8_t SoftPWM_Channel1_Duty;
-
-/** Duty cycle for the second software PWM channel */
-static volatile uint8_t SoftPWM_Channel2_Duty;
-
-/** Duty cycle for the third software PWM channel */
-static volatile uint8_t SoftPWM_Channel3_Duty;
-
-
-/** Interrupt handler for managing the software PWM channels for the LEDs */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
-{
- uint8_t LEDMask = LEDS_ALL_LEDS;
-
- if (++SoftPWM_Count == 0b00011111)
- SoftPWM_Count = 0;
-
- if (SoftPWM_Count >= SoftPWM_Channel1_Duty)
- LEDMask &= ~LEDS_LED1;
-
- if (SoftPWM_Count >= SoftPWM_Channel2_Duty)
- LEDMask &= ~LEDS_LED2;
-
- if (SoftPWM_Count >= SoftPWM_Channel3_Duty)
- LEDMask &= ~LEDS_LED3;
-
- LEDs_SetAllLEDs(LEDMask);
-}
-
-/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
- * used like any regular character stream in the C APIs
- */
-static FILE USBSerialStream;
-
-/** 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();
-
- /* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */
- CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
-
- sei();
-
- for (;;)
- {
- /* Read in next LED colour command from the host */
- uint8_t ColorUpdate = fgetc(&USBSerialStream);
-
- /* Top 3 bits select the LED, bottom 5 control the brightness */
- uint8_t Channel = (ColorUpdate & 0b11100000);
- uint8_t Duty = (ColorUpdate & 0b00011111);
-
- if (Channel & (1 << 5))
- SoftPWM_Channel1_Duty = Duty;
-
- if (Channel & (1 << 6))
- SoftPWM_Channel2_Duty = Duty;
-
- if (Channel & (1 << 7))
- SoftPWM_Channel3_Duty = Duty;
-
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- LEDs_Init();
- USB_Init();
-
- /* Timer Initialization */
- OCR0A = 100;
- TCCR0A = (1 << WGM01);
- TCCR0B = (1 << CS00);
- TIMSK0 = (1 << OCIE0A);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 LEDNotfier project. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
+#include "LEDNotifier.h"
+
+/** LUFA CDC Class driver interface configuration and state information. This structure is
+ * passed to all CDC Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
+ {
+ .Config =
+ {
+ .ControlInterfaceNumber = 0,
+
+ .DataINEndpointNumber = CDC_TX_EPNUM,
+ .DataINEndpointSize = CDC_TXRX_EPSIZE,
+ .DataINEndpointDoubleBank = false,
+
+ .DataOUTEndpointNumber = CDC_RX_EPNUM,
+ .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
+ .DataOUTEndpointDoubleBank = false,
+
+ .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
+ .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .NotificationEndpointDoubleBank = false,
+ },
+ };
+
+/** Counter for the software PWM */
+static volatile uint8_t SoftPWM_Count;
+
+/** Duty cycle for the first software PWM channel */
+static volatile uint8_t SoftPWM_Channel1_Duty;
+
+/** Duty cycle for the second software PWM channel */
+static volatile uint8_t SoftPWM_Channel2_Duty;
+
+/** Duty cycle for the third software PWM channel */
+static volatile uint8_t SoftPWM_Channel3_Duty;
+
+
+/** Interrupt handler for managing the software PWM channels for the LEDs */
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+{
+ uint8_t LEDMask = LEDS_ALL_LEDS;
+
+ if (++SoftPWM_Count == 0b00011111)
+ SoftPWM_Count = 0;
+
+ if (SoftPWM_Count >= SoftPWM_Channel1_Duty)
+ LEDMask &= ~LEDS_LED1;
+
+ if (SoftPWM_Count >= SoftPWM_Channel2_Duty)
+ LEDMask &= ~LEDS_LED2;
+
+ if (SoftPWM_Count >= SoftPWM_Channel3_Duty)
+ LEDMask &= ~LEDS_LED3;
+
+ LEDs_SetAllLEDs(LEDMask);
+}
+
+/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
+ * used like any regular character stream in the C APIs
+ */
+static FILE USBSerialStream;
+
+/** 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();
+
+ /* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */
+ CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
+
+ sei();
+
+ for (;;)
+ {
+ /* Read in next LED colour command from the host */
+ uint8_t ColorUpdate = fgetc(&USBSerialStream);
+
+ /* Top 3 bits select the LED, bottom 5 control the brightness */
+ uint8_t Channel = (ColorUpdate & 0b11100000);
+ uint8_t Duty = (ColorUpdate & 0b00011111);
+
+ if (Channel & (1 << 5))
+ SoftPWM_Channel1_Duty = Duty;
+
+ if (Channel & (1 << 6))
+ SoftPWM_Channel2_Duty = Duty;
+
+ if (Channel & (1 << 7))
+ SoftPWM_Channel3_Duty = Duty;
+
+ CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ LEDs_Init();
+ USB_Init();
+
+ /* Timer Initialization */
+ OCR0A = 100;
+ TCCR0A = (1 << WGM01);
+ TCCR0B = (1 << CS00);
+ TIMSK0 = (1 << OCIE0A);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
+}
diff --git a/Projects/LEDNotifier/LEDNotifier.h b/Projects/LEDNotifier/LEDNotifier.h
index 243723ec8..3565e8bed 100644
--- a/Projects/LEDNotifier/LEDNotifier.h
+++ b/Projects/LEDNotifier/LEDNotifier.h
@@ -1,60 +1,60 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 LEDNotifier.c.
- */
-
-#ifndef _LEDNOTIFIER_H_
-#define _LEDNOTIFIER_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
- #include <string.h>
- #include <stdio.h>
-
- #include "Descriptors.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Function Prototypes: */
- void SetupHardware(void);
-
- void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 LEDNotifier.c.
+ */
+
+#ifndef _LEDNOTIFIER_H_
+#define _LEDNOTIFIER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+ #include <string.h>
+ #include <stdio.h>
+
+ #include "Descriptors.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+
+#endif
diff --git a/Projects/LEDNotifier/LEDNotifier.txt b/Projects/LEDNotifier/LEDNotifier.txt
index 840d89068..ee0a2eb85 100644
--- a/Projects/LEDNotifier/LEDNotifier.txt
+++ b/Projects/LEDNotifier/LEDNotifier.txt
@@ -1,62 +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 USB LED Notifier Project
- *
- * \section SSec_Compat Demo Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this demo.
- *
- * - AT90USB646
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this demo.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Communications Device Class (CDC)</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>Abstract Control Model (ACM)</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USBIF CDC Class Standard</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * USB LED Notifier Project. This project is designed for the Busware BUI board, however it can run easily on any
- * USB AVR. It is a generic RGB LED controller (via a three channel software PWM) which listens for commands from the
- * host on a CDC virtual serial port. When new commands are received, it updates the board LEDs.
- *
- * This can be controlled with any host application that can write to the virtual serial port, allowing it to become
- * a visual notification system for any number of custom host applications, such as a new unread email notifier.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td>
- * None
- * </td>
- * </tr>
- * </table>
+/** \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 USB LED Notifier Project
+ *
+ * \section SSec_Compat Demo Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this demo.
+ *
+ * - AT90USB646
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this demo.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Communications Device Class (CDC)</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>Abstract Control Model (ACM)</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USBIF CDC Class Standard</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * USB LED Notifier Project. This project is designed for the Busware BUI board, however it can run easily on any
+ * USB AVR. It is a generic RGB LED controller (via a three channel software PWM) which listens for commands from the
+ * host on a CDC virtual serial port. When new commands are received, it updates the board LEDs.
+ *
+ * This can be controlled with any host application that can write to the virtual serial port, allowing it to become
+ * a visual notification system for any number of custom host applications, such as a new unread email notifier.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td>
+ * None
+ * </td>
+ * </tr>
+ * </table>
*/ \ No newline at end of file
diff --git a/Projects/LEDNotifier/LUFA LED Notifier.inf b/Projects/LEDNotifier/LUFA LED Notifier.inf
index a179053eb..cd9c3433a 100644
--- a/Projects/LEDNotifier/LUFA LED Notifier.inf
+++ b/Projects/LEDNotifier/LUFA LED Notifier.inf
@@ -1,106 +1,106 @@
-;************************************************************
-; Windows USB CDC ACM Setup File
-; Copyright (c) 2000 Microsoft Corporation
-
-
-[Version]
-Signature="$Windows NT$"
-Class=Ports
-ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
-Provider=%MFGNAME%
-LayoutFile=layout.inf
-CatalogFile=%MFGFILENAME%.cat
-DriverVer=11/15/2007,5.1.2600.0
-
-[Manufacturer]
-%MFGNAME%=DeviceList, NTamd64
-
-[DestinationDirs]
-DefaultDestDir=12
-
-
-;------------------------------------------------------------------------------
-; Windows 2000/XP/Vista-32bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.nt]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.nt
-AddReg=DriverInstall.nt.AddReg
-
-[DriverCopyFiles.nt]
-usbser.sys,,,0x20
-
-[DriverInstall.nt.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.nt.Services]
-AddService=usbser, 0x00000002, DriverService.nt
-
-[DriverService.nt]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-;------------------------------------------------------------------------------
-; Vista-64bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.NTamd64]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.NTamd64
-AddReg=DriverInstall.NTamd64.AddReg
-
-[DriverCopyFiles.NTamd64]
-%DRIVERFILENAME%.sys,,,0x20
-
-[DriverInstall.NTamd64.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.NTamd64.Services]
-AddService=usbser, 0x00000002, DriverService.NTamd64
-
-[DriverService.NTamd64]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-
-;------------------------------------------------------------------------------
-; Vendor and Product ID Definitions
-;------------------------------------------------------------------------------
-; When developing your USB device, the VID and PID used in the PC side
-; application program and the firmware on the microcontroller must match.
-; Modify the below line to use your VID and PID. Use the format as shown below.
-; Note: One INF file can be used for multiple devices with different VID and PIDs.
-; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
-;------------------------------------------------------------------------------
-[SourceDisksFiles]
-[SourceDisksNames]
-[DeviceList]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044
-
-[DeviceList.NTamd64]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044
-
-
-;------------------------------------------------------------------------------
-; String Definitions
-;------------------------------------------------------------------------------
-;Modify these strings to customize your device
-;------------------------------------------------------------------------------
-[Strings]
-MFGFILENAME="CDC_vista"
-DRIVERFILENAME ="usbser"
-MFGNAME="http://www.fourwalledcubicle.com"
-INSTDISK="LUFA CDC Driver Installer"
-DESCRIPTION="Communications Port"
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+; Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+; Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+; Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID. Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044
+
+
+;------------------------------------------------------------------------------
+; String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="http://www.fourwalledcubicle.com"
+INSTDISK="LUFA CDC Driver Installer"
+DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file
diff --git a/Projects/LEDNotifier/makefile b/Projects/LEDNotifier/makefile
index 01331fb17..da9053aef 100644
--- a/Projects/LEDNotifier/makefile
+++ b/Projects/LEDNotifier/makefile
@@ -1,738 +1,738 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USER
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = LEDNotifier
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../..
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USER
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = LEDNotifier
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../..
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c
index ee6235859..c544ba635 100644
--- a/Projects/Magstripe/Descriptors.c
+++ b/Projects/Magstripe/Descriptors.c
@@ -1,247 +1,247 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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"
-
-/** HID report descriptor. This is a HID class specific descriptor, which defines the structure of the
- * reports sent and received by the HID device to and from the USB host. It indicates what data is sent,
- * where in the report each element is located and exactly how the data should be interpreted and used.
- *
- * See the HID class specification for more information on HID report descriptors.
- */
-USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
-{
- 0x05, 0x01, /* Usage Page (Generic Desktop) */
- 0x09, 0x06, /* Usage (Keyboard) */
- 0xa1, 0x01, /* Collection (Application) */
- 0x05, 0x07, /* Usage Page (Key Codes) */
- 0x19, 0xe0, /* Usage Minimum (Keyboard LeftControl) */
- 0x29, 0xe7, /* Usage Maximum (Keyboard Right GUI) */
- 0x15, 0x00, /* Logical Minimum (0) */
- 0x25, 0x01, /* Logical Maximum (1) */
- 0x75, 0x01, /* Report Size (1) */
- 0x95, 0x08, /* Report Count (8) */
- 0x81, 0x02, /* Input (Data, Variable, Absolute) */
- 0x95, 0x01, /* Report Count (1) */
- 0x75, 0x08, /* Report Size (8) */
- 0x81, 0x03, /* Input (Const, Variable, Absolute) */
- 0x95, 0x01, /* Report Count (1) */
- 0x75, 0x08, /* Report Size (8) */
- 0x15, 0x00, /* Logical Minimum (0) */
- 0x25, 0x65, /* Logical Maximum (101) */
- 0x05, 0x07, /* Usage Page (Keyboard) */
- 0x19, 0x00, /* Usage Minimum (Reserved (no event indicated)) */
- 0x29, 0x65, /* Usage Maximum (Keyboard Application) */
- 0x81, 0x00, /* Input (Data, Array, Absolute) */
- 0xc0 /* End Collection */
-};
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x00,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2042,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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 = 1,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .HID_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0x00,
- .AlternateSetting = 0x00,
-
- .TotalEndpoints = 1,
-
- .Class = 0x03,
- .SubClass = 0x01,
- .Protocol = 0x01,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .HID_KeyboardHID =
- {
- .Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
-
- .HIDSpec = VERSION_BCD(01.11),
- .CountryCode = 0x00,
- .TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
- .HIDReportLength = sizeof(KeyboardReport)
- },
-
- .HID_ReportINEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | KEYBOARD_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = KEYBOARD_EPSIZE,
- .PollingIntervalMS = 0x01
- },
-};
-
-/** 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. */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(32), .Type = DTYPE_String},
-
- .UnicodeString = L"Dean Camera and Denver Gingerich"
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(20), .Type = DTYPE_String},
-
- .UnicodeString = L"Magnetic Card Reader"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- case DTYPE_HID:
- Address = (void*)&ConfigurationDescriptor.HID_KeyboardHID;
- Size = sizeof(USB_HID_Descriptor_t);
- break;
- case DTYPE_Report:
- Address = (void*)&KeyboardReport;
- Size = sizeof(KeyboardReport);
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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"
+
+/** HID report descriptor. This is a HID class specific descriptor, which defines the structure of the
+ * reports sent and received by the HID device to and from the USB host. It indicates what data is sent,
+ * where in the report each element is located and exactly how the data should be interpreted and used.
+ *
+ * See the HID class specification for more information on HID report descriptors.
+ */
+USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
+{
+ 0x05, 0x01, /* Usage Page (Generic Desktop) */
+ 0x09, 0x06, /* Usage (Keyboard) */
+ 0xa1, 0x01, /* Collection (Application) */
+ 0x05, 0x07, /* Usage Page (Key Codes) */
+ 0x19, 0xe0, /* Usage Minimum (Keyboard LeftControl) */
+ 0x29, 0xe7, /* Usage Maximum (Keyboard Right GUI) */
+ 0x15, 0x00, /* Logical Minimum (0) */
+ 0x25, 0x01, /* Logical Maximum (1) */
+ 0x75, 0x01, /* Report Size (1) */
+ 0x95, 0x08, /* Report Count (8) */
+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */
+ 0x95, 0x01, /* Report Count (1) */
+ 0x75, 0x08, /* Report Size (8) */
+ 0x81, 0x03, /* Input (Const, Variable, Absolute) */
+ 0x95, 0x01, /* Report Count (1) */
+ 0x75, 0x08, /* Report Size (8) */
+ 0x15, 0x00, /* Logical Minimum (0) */
+ 0x25, 0x65, /* Logical Maximum (101) */
+ 0x05, 0x07, /* Usage Page (Keyboard) */
+ 0x19, 0x00, /* Usage Minimum (Reserved (no event indicated)) */
+ 0x29, 0x65, /* Usage Maximum (Keyboard Application) */
+ 0x81, 0x00, /* Input (Data, Array, Absolute) */
+ 0xc0 /* End Collection */
+};
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x00,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2042,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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 = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .HID_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0x00,
+ .AlternateSetting = 0x00,
+
+ .TotalEndpoints = 1,
+
+ .Class = 0x03,
+ .SubClass = 0x01,
+ .Protocol = 0x01,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .HID_KeyboardHID =
+ {
+ .Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
+
+ .HIDSpec = VERSION_BCD(01.11),
+ .CountryCode = 0x00,
+ .TotalReportDescriptors = 1,
+ .HIDReportType = DTYPE_Report,
+ .HIDReportLength = sizeof(KeyboardReport)
+ },
+
+ .HID_ReportINEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | KEYBOARD_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = KEYBOARD_EPSIZE,
+ .PollingIntervalMS = 0x01
+ },
+};
+
+/** 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. */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(32), .Type = DTYPE_String},
+
+ .UnicodeString = L"Dean Camera and Denver Gingerich"
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(20), .Type = DTYPE_String},
+
+ .UnicodeString = L"Magnetic Card Reader"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ case DTYPE_HID:
+ Address = (void*)&ConfigurationDescriptor.HID_KeyboardHID;
+ Size = sizeof(USB_HID_Descriptor_t);
+ break;
+ case DTYPE_Report:
+ Address = (void*)&KeyboardReport;
+ Size = sizeof(KeyboardReport);
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/Magstripe/Descriptors.h b/Projects/Magstripe/Descriptors.h
index 88eaf33d0..02a14b400 100644
--- a/Projects/Magstripe/Descriptors.h
+++ b/Projects/Magstripe/Descriptors.h
@@ -1,70 +1,70 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config; /**< Configuration descriptor header structure */
- USB_Descriptor_Interface_t HID_Interface; /**< Keyboard interface descriptor */
- USB_HID_Descriptor_t HID_KeyboardHID; /**< Keyboard HID descriptor */
- USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */
- } USB_Descriptor_Configuration_t;
-
- /* Macros: */
- /** Endpoint number of the keyboard key press reporting endpoint. */
- #define KEYBOARD_EPNUM 1
-
- /** Size of the keyboard report endpoints, in bytes. */
- #define KEYBOARD_EPSIZE 8
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/HID.h>
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config; /**< Configuration descriptor header structure */
+ USB_Descriptor_Interface_t HID_Interface; /**< Keyboard interface descriptor */
+ USB_HID_Descriptor_t HID_KeyboardHID; /**< Keyboard HID descriptor */
+ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */
+ } USB_Descriptor_Configuration_t;
+
+ /* Macros: */
+ /** Endpoint number of the keyboard key press reporting endpoint. */
+ #define KEYBOARD_EPNUM 1
+
+ /** Size of the keyboard report endpoints, in bytes. */
+ #define KEYBOARD_EPSIZE 8
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/Magstripe/Doxygen.conf b/Projects/Magstripe/Doxygen.conf
index 569be0b89..0b6bdf0b9 100644
--- a/Projects/Magstripe/Doxygen.conf
+++ b/Projects/Magstripe/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "Denver Gingerich's Stripe Snoop Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Denver Gingerich's Stripe Snoop Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.c b/Projects/Magstripe/Lib/CircularBitBuffer.c
index 128639413..8be527b4d 100644
--- a/Projects/Magstripe/Lib/CircularBitBuffer.c
+++ b/Projects/Magstripe/Lib/CircularBitBuffer.c
@@ -1,113 +1,113 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** Circular bit buffer library. This will allow for individual bits
- * to be stored in packed form inside circular buffers, to reduce
- * overall RAM usage.
- */
-
-#include "CircularBitBuffer.h"
-
-/** Function to initialize or reset a bit buffer, ready for data to be stored into it. */
-void BitBuffer_Init(BitBuffer_t* const Buffer)
-{
- /* Reset the number of stored bits in the buffer */
- Buffer->Elements = 0;
-
- /* Reset the data in and out pointer structures in the buffer to the first buffer bit */
- Buffer->In.CurrentByte = Buffer->Data;
- Buffer->In.ByteMask = (1 << 0);
- Buffer->Out.CurrentByte = Buffer->Data;
- Buffer->Out.ByteMask = (1 << 0);
-}
-
-/** Function to store the given bit into the given bit buffer. */
-void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit)
-{
- /* If the bit to store is true, set the next bit in the buffer */
- if (Bit)
- *Buffer->In.CurrentByte |= Buffer->In.ByteMask;
-
- /* Increment the number of stored bits in the buffer counter */
- Buffer->Elements++;
-
- /* Check if the current buffer byte is full of stored bits */
- if (Buffer->In.ByteMask == (1 << 7))
- {
- /* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */
- if (Buffer->In.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1])
- Buffer->In.CurrentByte++;
- else
- Buffer->In.CurrentByte = Buffer->Data;
-
- /* Reset the storage bit mask in the current buffer byte to the first bit */
- Buffer->In.ByteMask = (1 << 0);
- }
- else
- {
- /* Shift the current storage bit mask to the next bit in the current byte */
- Buffer->In.ByteMask <<= 1;
- }
-}
-
-/** Function to retrieve the next bit stored in the given bit buffer. */
-bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
-{
- /* Retrieve the value of the next bit stored in the buffer */
- bool Bit = ((*Buffer->Out.CurrentByte & Buffer->Out.ByteMask) != 0);
-
- /* Clear the buffer bit */
- *Buffer->Out.CurrentByte &= ~Buffer->Out.ByteMask;
-
- /* Decrement the number of stored bits in the buffer counter */
- Buffer->Elements--;
-
- /* Check if the current buffer byte is empty of stored bits */
- if (Buffer->Out.ByteMask == (1 << 7))
- {
- /* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */
- if (Buffer->Out.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1])
- Buffer->Out.CurrentByte++;
- else
- Buffer->Out.CurrentByte = Buffer->Data;
-
- /* Reset the retrieval bit mask in the current buffer byte to the first bit */
- Buffer->Out.ByteMask = (1 << 0);
- }
- else
- {
- /* Shift the current retrieval bit mask to the next bit in the current byte */
- Buffer->Out.ByteMask <<= 1;
- }
-
- /* Return the retrieved bit from the buffer */
- return Bit;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** Circular bit buffer library. This will allow for individual bits
+ * to be stored in packed form inside circular buffers, to reduce
+ * overall RAM usage.
+ */
+
+#include "CircularBitBuffer.h"
+
+/** Function to initialize or reset a bit buffer, ready for data to be stored into it. */
+void BitBuffer_Init(BitBuffer_t* const Buffer)
+{
+ /* Reset the number of stored bits in the buffer */
+ Buffer->Elements = 0;
+
+ /* Reset the data in and out pointer structures in the buffer to the first buffer bit */
+ Buffer->In.CurrentByte = Buffer->Data;
+ Buffer->In.ByteMask = (1 << 0);
+ Buffer->Out.CurrentByte = Buffer->Data;
+ Buffer->Out.ByteMask = (1 << 0);
+}
+
+/** Function to store the given bit into the given bit buffer. */
+void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit)
+{
+ /* If the bit to store is true, set the next bit in the buffer */
+ if (Bit)
+ *Buffer->In.CurrentByte |= Buffer->In.ByteMask;
+
+ /* Increment the number of stored bits in the buffer counter */
+ Buffer->Elements++;
+
+ /* Check if the current buffer byte is full of stored bits */
+ if (Buffer->In.ByteMask == (1 << 7))
+ {
+ /* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */
+ if (Buffer->In.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1])
+ Buffer->In.CurrentByte++;
+ else
+ Buffer->In.CurrentByte = Buffer->Data;
+
+ /* Reset the storage bit mask in the current buffer byte to the first bit */
+ Buffer->In.ByteMask = (1 << 0);
+ }
+ else
+ {
+ /* Shift the current storage bit mask to the next bit in the current byte */
+ Buffer->In.ByteMask <<= 1;
+ }
+}
+
+/** Function to retrieve the next bit stored in the given bit buffer. */
+bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
+{
+ /* Retrieve the value of the next bit stored in the buffer */
+ bool Bit = ((*Buffer->Out.CurrentByte & Buffer->Out.ByteMask) != 0);
+
+ /* Clear the buffer bit */
+ *Buffer->Out.CurrentByte &= ~Buffer->Out.ByteMask;
+
+ /* Decrement the number of stored bits in the buffer counter */
+ Buffer->Elements--;
+
+ /* Check if the current buffer byte is empty of stored bits */
+ if (Buffer->Out.ByteMask == (1 << 7))
+ {
+ /* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */
+ if (Buffer->Out.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1])
+ Buffer->Out.CurrentByte++;
+ else
+ Buffer->Out.CurrentByte = Buffer->Data;
+
+ /* Reset the retrieval bit mask in the current buffer byte to the first bit */
+ Buffer->Out.ByteMask = (1 << 0);
+ }
+ else
+ {
+ /* Shift the current retrieval bit mask to the next bit in the current byte */
+ Buffer->Out.ByteMask <<= 1;
+ }
+
+ /* Return the retrieved bit from the buffer */
+ return Bit;
+}
diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.h b/Projects/Magstripe/Lib/CircularBitBuffer.h
index 05496f62d..dff4d2e5d 100644
--- a/Projects/Magstripe/Lib/CircularBitBuffer.h
+++ b/Projects/Magstripe/Lib/CircularBitBuffer.h
@@ -1,95 +1,95 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 CircularBitBuffer.c.
- */
-
-#ifndef _CIRCULARBITBUFFER_H_
-#define _CIRCULARBITBUFFER_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <stdbool.h>
-
- #include <LUFA/Common/Common.h>
-
- /* Macros: */
- #if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
- defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)) || defined(__DOXYGEN__)
- /** Maximum number of bits which can be stored into a bit buffer. The memory usage is one eighth of this value per buffer. */
- #define MAX_BITS 8192
- #else
- #define MAX_BITS 1024
- #endif
-
- /* Type Defines: */
- /** Type define for a pointer to a bit in a bit buffer. */
- typedef struct
- {
- uint8_t* CurrentByte; /**< Pointer to the current byte in the buffer */
- uint8_t ByteMask; /**< Mask of the current bit in the buffer */
- } BitBufferPointer_t;
-
- /** Type define for a circular packet bit buffer. */
- typedef struct
- {
- uint8_t Data[MAX_BITS / 8]; /**< Buffer to hold the stored bits in packed form */
- uint16_t Elements; /**< Number of stored bits in the bit buffer */
-
- BitBufferPointer_t In; /**< Bit pointer to the next storage location in the buffer */
- BitBufferPointer_t Out; /**< Bit pointer to the next retrieval location in the buffer */
- } BitBuffer_t;
-
- /* Function Prototypes: */
- /** Initializes or resets a given bit buffer, ready to store new bits.
- *
- * \param[in,out] Buffer Bit buffer to initialize
- */
- void BitBuffer_Init(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
-
- /** Stores a bit into the next location inside a given bit buffer.
- *
- * \param[in,out] Buffer Bit buffer to store a bit into
- * \param[in] Bit Bit to store into the buffer
- */
- void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit) ATTR_NON_NULL_PTR_ARG(1);
-
- /** Retrieves a bit from the next location inside a given bit buffer.
- *
- * \param[in,out] Buffer Bit buffer to store a bit into
- *
- * \return Next bit from the buffer
- */
- bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 CircularBitBuffer.c.
+ */
+
+#ifndef _CIRCULARBITBUFFER_H_
+#define _CIRCULARBITBUFFER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <stdbool.h>
+
+ #include <LUFA/Common/Common.h>
+
+ /* Macros: */
+ #if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
+ defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)) || defined(__DOXYGEN__)
+ /** Maximum number of bits which can be stored into a bit buffer. The memory usage is one eighth of this value per buffer. */
+ #define MAX_BITS 8192
+ #else
+ #define MAX_BITS 1024
+ #endif
+
+ /* Type Defines: */
+ /** Type define for a pointer to a bit in a bit buffer. */
+ typedef struct
+ {
+ uint8_t* CurrentByte; /**< Pointer to the current byte in the buffer */
+ uint8_t ByteMask; /**< Mask of the current bit in the buffer */
+ } BitBufferPointer_t;
+
+ /** Type define for a circular packet bit buffer. */
+ typedef struct
+ {
+ uint8_t Data[MAX_BITS / 8]; /**< Buffer to hold the stored bits in packed form */
+ uint16_t Elements; /**< Number of stored bits in the bit buffer */
+
+ BitBufferPointer_t In; /**< Bit pointer to the next storage location in the buffer */
+ BitBufferPointer_t Out; /**< Bit pointer to the next retrieval location in the buffer */
+ } BitBuffer_t;
+
+ /* Function Prototypes: */
+ /** Initializes or resets a given bit buffer, ready to store new bits.
+ *
+ * \param[in,out] Buffer Bit buffer to initialize
+ */
+ void BitBuffer_Init(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Stores a bit into the next location inside a given bit buffer.
+ *
+ * \param[in,out] Buffer Bit buffer to store a bit into
+ * \param[in] Bit Bit to store into the buffer
+ */
+ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Retrieves a bit from the next location inside a given bit buffer.
+ *
+ * \param[in,out] Buffer Bit buffer to store a bit into
+ *
+ * \return Next bit from the buffer
+ */
+ bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
+
+#endif
diff --git a/Projects/Magstripe/Lib/MagstripeHW.h b/Projects/Magstripe/Lib/MagstripeHW.h
index 915144819..7afde48e8 100644
--- a/Projects/Magstripe/Lib/MagstripeHW.h
+++ b/Projects/Magstripe/Lib/MagstripeHW.h
@@ -1,100 +1,100 @@
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/*
- NOTE: The user of this include file MUST define the following macros
- prior to including the file:
-
- MAG_T1_CLOCK_PIN Pin connected to Track 1 clock wire (i.e.. PORTC1)
- MAG_T1_DATA_PIN Pin connected to Track 1 data wire (i.e.. PORTC2)
- MAG_T2_CLOCK_PIN Pin connected to Track 2 clock wire (i.e.. PORTC3)
- MAG_T2_DATA_PIN Pin connected to Track 2 data wire (i.e.. PORTC0)
- MAG_T3_CLOCK_PIN Pin connected to Track 3 clock wire (i.e.. PORTC5)
- MAG_T3_DATA_PIN Pin connected to Track 3 data wire (i.e.. PORTC6)
- MAG_CLS_PIN Pin connected to card loaded wire (i.e.. PORTC4)
- MAG_PIN PIN macro for the reader's port (i.e.. PINC)
- MAG_DDR DDR macro for the reader's port (i.e.. DDRC)
- MAG_PORT PORT macro for the reader's port (i.e.. PORTC)
-
- The example macros listed above assume that the Track 2 data wire is
- connected to pin 0 on port C, the Track 2 clock wire is connected to
- pin 3 on port C (similarly for Tracks 1 and 3), and the card loaded
- wire is connected to pin 4 on port C.
-
- If the mag-stripe reader you are using only reads one or two tracks,
- then set the clock and data pins for the tracks it doesn't read to a
- pin that is unused. For example, on the AT90USBKey, any of the pins on
- port C that do not have wires attached will be unused since they are
- not connected to any onboard devices (such as the joystick or
- temperature sensor).
-
- Connecting wires to pins on different ports (i.e.. a data wire to pin 0
- on port C and a clock wire to pin 0 on port D) is currently
- unsupported. All pins specified above must be on the same port.
-*/
-
-/** \file
- *
- * Driver header for a TTL Magnetic Card reader device (such as the Omron V3B-4K).
- */
-
-#ifndef _MAGSTRIPEHW_H_
-#define _MAGSTRIPEHW_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include <LUFA/Common/Common.h>
-
- /* Private Interface - For use in library only: */
- /* Macros: */
- /** Mask of the track data, clock and card detection pins. */
- #define MAG_MASK (MAG_T1_DATA | MAG_T1_CLOCK | \
- MAG_T2_DATA | MAG_T2_CLOCK | \
- MAG_T3_DATA | MAG_T3_CLOCK | \
- MAG_CARDPRESENT)
-
- /* Public Interface - May be used in end-application: */
- /* Inline Functions: */
- /** Initializes the magnetic stripe card reader ports and pins so that the card reader
- * device can be controlled and read by the card reader driver. This must be called before
- * trying to read any of the card reader's status lines.
- */
- static inline void Magstripe_Init(void)
- {
- MAG_DDR &= ~MAG_MASK;
- MAG_PORT |= MAG_MASK;
- };
-
- /** Returns the status of all the magnetic card reader's outputs.
- *
- * \return A mask indicating which card lines are high or low
- */
- static inline uint8_t Magstripe_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
- static inline uint8_t Magstripe_GetStatus(void)
- {
- /* Mag-stripe IOs are active low and must be inverted when read */
- return ((uint8_t)~MAG_PIN & MAG_MASK);
- }
-
-#endif
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/*
+ NOTE: The user of this include file MUST define the following macros
+ prior to including the file:
+
+ MAG_T1_CLOCK_PIN Pin connected to Track 1 clock wire (i.e.. PORTC1)
+ MAG_T1_DATA_PIN Pin connected to Track 1 data wire (i.e.. PORTC2)
+ MAG_T2_CLOCK_PIN Pin connected to Track 2 clock wire (i.e.. PORTC3)
+ MAG_T2_DATA_PIN Pin connected to Track 2 data wire (i.e.. PORTC0)
+ MAG_T3_CLOCK_PIN Pin connected to Track 3 clock wire (i.e.. PORTC5)
+ MAG_T3_DATA_PIN Pin connected to Track 3 data wire (i.e.. PORTC6)
+ MAG_CLS_PIN Pin connected to card loaded wire (i.e.. PORTC4)
+ MAG_PIN PIN macro for the reader's port (i.e.. PINC)
+ MAG_DDR DDR macro for the reader's port (i.e.. DDRC)
+ MAG_PORT PORT macro for the reader's port (i.e.. PORTC)
+
+ The example macros listed above assume that the Track 2 data wire is
+ connected to pin 0 on port C, the Track 2 clock wire is connected to
+ pin 3 on port C (similarly for Tracks 1 and 3), and the card loaded
+ wire is connected to pin 4 on port C.
+
+ If the mag-stripe reader you are using only reads one or two tracks,
+ then set the clock and data pins for the tracks it doesn't read to a
+ pin that is unused. For example, on the AT90USBKey, any of the pins on
+ port C that do not have wires attached will be unused since they are
+ not connected to any onboard devices (such as the joystick or
+ temperature sensor).
+
+ Connecting wires to pins on different ports (i.e.. a data wire to pin 0
+ on port C and a clock wire to pin 0 on port D) is currently
+ unsupported. All pins specified above must be on the same port.
+*/
+
+/** \file
+ *
+ * Driver header for a TTL Magnetic Card reader device (such as the Omron V3B-4K).
+ */
+
+#ifndef _MAGSTRIPEHW_H_
+#define _MAGSTRIPEHW_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include <LUFA/Common/Common.h>
+
+ /* Private Interface - For use in library only: */
+ /* Macros: */
+ /** Mask of the track data, clock and card detection pins. */
+ #define MAG_MASK (MAG_T1_DATA | MAG_T1_CLOCK | \
+ MAG_T2_DATA | MAG_T2_CLOCK | \
+ MAG_T3_DATA | MAG_T3_CLOCK | \
+ MAG_CARDPRESENT)
+
+ /* Public Interface - May be used in end-application: */
+ /* Inline Functions: */
+ /** Initializes the magnetic stripe card reader ports and pins so that the card reader
+ * device can be controlled and read by the card reader driver. This must be called before
+ * trying to read any of the card reader's status lines.
+ */
+ static inline void Magstripe_Init(void)
+ {
+ MAG_DDR &= ~MAG_MASK;
+ MAG_PORT |= MAG_MASK;
+ };
+
+ /** Returns the status of all the magnetic card reader's outputs.
+ *
+ * \return A mask indicating which card lines are high or low
+ */
+ static inline uint8_t Magstripe_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t Magstripe_GetStatus(void)
+ {
+ /* Mag-stripe IOs are active low and must be inverted when read */
+ return ((uint8_t)~MAG_PIN & MAG_MASK);
+ }
+
+#endif
diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c
index 39149b480..6dbceb6e5 100644
--- a/Projects/Magstripe/Magstripe.c
+++ b/Projects/Magstripe/Magstripe.c
@@ -1,216 +1,216 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 MagStripe reader program. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-#include "Magstripe.h"
-
-/** Bit buffers to hold the read bits for each of the three magnetic card tracks before they are transmitted
- * to the host as keyboard presses.
- */
-BitBuffer_t TrackDataBuffers[TOTAL_TRACKS];
-
-/** Pointer to the current track buffer being sent to the host. */
-BitBuffer_t* CurrentTrackBuffer = &TrackDataBuffers[TOTAL_TRACKS];
-
-/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */
-uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];
-
-/** LUFA HID Class driver interface configuration and state information. This structure is
- * passed to all HID Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
- {
- .Config =
- {
- .InterfaceNumber = 0,
-
- .ReportINEndpointNumber = KEYBOARD_EPNUM,
- .ReportINEndpointSize = KEYBOARD_EPSIZE,
- .ReportINEndpointDoubleBank = KEYBOARD_EPSIZE,
-
- .PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
- .PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
- },
- };
-
-/** 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();
-
- for (uint8_t Buffer = 0; Buffer < TOTAL_TRACKS; Buffer++)
- BitBuffer_Init(&TrackDataBuffers[Buffer]);
-
- sei();
-
- for (;;)
- {
- if (Magstripe_GetStatus() & MAG_CARDPRESENT)
- ReadMagstripeData();
-
- HID_Device_USBTask(&Keyboard_HID_Interface);
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- Magstripe_Init();
- USB_Init();
-}
-
-/** Determines if a card has been inserted, and if so reads in each track's contents into the bit buffers
- * until they are read out to the host as a series of keyboard presses.
- */
-void ReadMagstripeData(void)
-{
- /* Arrays to hold the buffer pointers, clock and data bit masks for the separate card tracks */
- const struct
- {
- uint8_t ClockMask;
- uint8_t DataMask;
- } TrackInfo[] = {{MAG_T1_CLOCK, MAG_T1_DATA},
- {MAG_T2_CLOCK, MAG_T2_DATA},
- {MAG_T3_CLOCK, MAG_T3_DATA}};
-
- uint8_t Magstripe_Prev = 0;
- uint8_t Magstripe_LCL = Magstripe_GetStatus();
-
- while (Magstripe_LCL & MAG_CARDPRESENT)
- {
- for (uint8_t Track = 0; Track < TOTAL_TRACKS; Track++)
- {
- bool DataPinLevel = ((Magstripe_LCL & TrackInfo[Track].DataMask) != 0);
- bool ClockPinLevel = ((Magstripe_LCL & TrackInfo[Track].ClockMask) != 0);
- bool ClockLevelChanged = (((Magstripe_LCL ^ Magstripe_Prev) & TrackInfo[Track].ClockMask) != 0);
-
- /* Sample data on rising clock edges from the card reader */
- if (ClockPinLevel && ClockLevelChanged)
- BitBuffer_StoreNextBit(&TrackDataBuffers[Track], DataPinLevel);
- }
-
- Magstripe_Prev = Magstripe_LCL;
- Magstripe_LCL = Magstripe_GetStatus();
- }
-
- CurrentTrackBuffer = &TrackDataBuffers[0];
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
-
- USB_Device_EnableSOFEvents();
-}
-
-/** Event handler for the library USB Unhandled Control Packet event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
-}
-
-/** Event handler for the USB device Start Of Frame event. */
-void EVENT_USB_Device_StartOfFrame(void)
-{
- HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
-}
-
-/** HID class driver callback function for the creation of HID reports to the host.
- *
- * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
- * \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
- * \param[in] ReportType Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature
- * \param[out] ReportData Pointer to a buffer where the created report should be stored
- * \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent
- *
- * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
- */
-bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
- const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
-{
- USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
-
- static bool IsKeyReleaseReport;
-
- /* Key reports must be interleaved with key release reports, or repeated keys will be ignored */
- IsKeyReleaseReport = !IsKeyReleaseReport;
-
- if ((IsKeyReleaseReport) || (CurrentTrackBuffer == &TrackDataBuffers[TOTAL_TRACKS]))
- {
- /* No more data to send, or key release report between key presses */
- KeyboardReport->KeyCode[0] = KEY_NONE;
- }
- else if (!(CurrentTrackBuffer->Elements))
- {
- /* End of current track, send an enter press and change to the next track's buffer */
- KeyboardReport->KeyCode[0] = KEY_ENTER;
- CurrentTrackBuffer++;
- }
- else
- {
- /* Still data in the current track; convert next bit to a 1 or 0 keypress */
- KeyboardReport->KeyCode[0] = BitBuffer_GetNextBit(CurrentTrackBuffer) ? KEY_1 : KEY_0;
- }
-
- *ReportSize = sizeof(USB_KeyboardReport_Data_t);
- return false;
-}
-
-/** HID Class driver callback function for the processing of a received HID report from the host.
- *
- * \param[in] HIDInterfaceInfo Pointer to the HID interface structure for the HID interface being referenced
- * \param[in] ReportID Report ID of the received report from the host
- * \param[in] ReportData Pointer to the report buffer where the received report is stored
- * \param[in] ReportSize Size in bytes of the report received from the host
- */
-void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
- const void* ReportData, const uint16_t ReportSize)
-{
- // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 MagStripe reader program. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
+#include "Magstripe.h"
+
+/** Bit buffers to hold the read bits for each of the three magnetic card tracks before they are transmitted
+ * to the host as keyboard presses.
+ */
+BitBuffer_t TrackDataBuffers[TOTAL_TRACKS];
+
+/** Pointer to the current track buffer being sent to the host. */
+BitBuffer_t* CurrentTrackBuffer = &TrackDataBuffers[TOTAL_TRACKS];
+
+/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */
+uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];
+
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
+ {
+ .Config =
+ {
+ .InterfaceNumber = 0,
+
+ .ReportINEndpointNumber = KEYBOARD_EPNUM,
+ .ReportINEndpointSize = KEYBOARD_EPSIZE,
+ .ReportINEndpointDoubleBank = KEYBOARD_EPSIZE,
+
+ .PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
+ .PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
+ },
+ };
+
+/** 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();
+
+ for (uint8_t Buffer = 0; Buffer < TOTAL_TRACKS; Buffer++)
+ BitBuffer_Init(&TrackDataBuffers[Buffer]);
+
+ sei();
+
+ for (;;)
+ {
+ if (Magstripe_GetStatus() & MAG_CARDPRESENT)
+ ReadMagstripeData();
+
+ HID_Device_USBTask(&Keyboard_HID_Interface);
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ Magstripe_Init();
+ USB_Init();
+}
+
+/** Determines if a card has been inserted, and if so reads in each track's contents into the bit buffers
+ * until they are read out to the host as a series of keyboard presses.
+ */
+void ReadMagstripeData(void)
+{
+ /* Arrays to hold the buffer pointers, clock and data bit masks for the separate card tracks */
+ const struct
+ {
+ uint8_t ClockMask;
+ uint8_t DataMask;
+ } TrackInfo[] = {{MAG_T1_CLOCK, MAG_T1_DATA},
+ {MAG_T2_CLOCK, MAG_T2_DATA},
+ {MAG_T3_CLOCK, MAG_T3_DATA}};
+
+ uint8_t Magstripe_Prev = 0;
+ uint8_t Magstripe_LCL = Magstripe_GetStatus();
+
+ while (Magstripe_LCL & MAG_CARDPRESENT)
+ {
+ for (uint8_t Track = 0; Track < TOTAL_TRACKS; Track++)
+ {
+ bool DataPinLevel = ((Magstripe_LCL & TrackInfo[Track].DataMask) != 0);
+ bool ClockPinLevel = ((Magstripe_LCL & TrackInfo[Track].ClockMask) != 0);
+ bool ClockLevelChanged = (((Magstripe_LCL ^ Magstripe_Prev) & TrackInfo[Track].ClockMask) != 0);
+
+ /* Sample data on rising clock edges from the card reader */
+ if (ClockPinLevel && ClockLevelChanged)
+ BitBuffer_StoreNextBit(&TrackDataBuffers[Track], DataPinLevel);
+ }
+
+ Magstripe_Prev = Magstripe_LCL;
+ Magstripe_LCL = Magstripe_GetStatus();
+ }
+
+ CurrentTrackBuffer = &TrackDataBuffers[0];
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
+
+ USB_Device_EnableSOFEvents();
+}
+
+/** Event handler for the library USB Unhandled Control Packet event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
+}
+
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
+{
+ HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
+}
+
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
+ * \param[in] ReportType Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature
+ * \param[out] ReportData Pointer to a buffer where the created report should be stored
+ * \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent
+ *
+ * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
+ */
+bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
+ const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
+{
+ USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
+
+ static bool IsKeyReleaseReport;
+
+ /* Key reports must be interleaved with key release reports, or repeated keys will be ignored */
+ IsKeyReleaseReport = !IsKeyReleaseReport;
+
+ if ((IsKeyReleaseReport) || (CurrentTrackBuffer == &TrackDataBuffers[TOTAL_TRACKS]))
+ {
+ /* No more data to send, or key release report between key presses */
+ KeyboardReport->KeyCode[0] = KEY_NONE;
+ }
+ else if (!(CurrentTrackBuffer->Elements))
+ {
+ /* End of current track, send an enter press and change to the next track's buffer */
+ KeyboardReport->KeyCode[0] = KEY_ENTER;
+ CurrentTrackBuffer++;
+ }
+ else
+ {
+ /* Still data in the current track; convert next bit to a 1 or 0 keypress */
+ KeyboardReport->KeyCode[0] = BitBuffer_GetNextBit(CurrentTrackBuffer) ? KEY_1 : KEY_0;
+ }
+
+ *ReportSize = sizeof(USB_KeyboardReport_Data_t);
+ return false;
+}
+
+/** HID Class driver callback function for the processing of a received HID report from the host.
+ *
+ * \param[in] HIDInterfaceInfo Pointer to the HID interface structure for the HID interface being referenced
+ * \param[in] ReportID Report ID of the received report from the host
+ * \param[in] ReportData Pointer to the report buffer where the received report is stored
+ * \param[in] ReportSize Size in bytes of the report received from the host
+ */
+void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
+ const void* ReportData, const uint16_t ReportSize)
+{
+ // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
+}
diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h
index 8a48e7c1a..08b867ec7 100644
--- a/Projects/Magstripe/Magstripe.h
+++ b/Projects/Magstripe/Magstripe.h
@@ -1,83 +1,83 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Magstripe.c.
- */
-
-#ifndef _MAGSTRIPE_H_
-#define _MAGSTRIPE_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
-
- #include "Descriptors.h"
- #include "Lib/MagstripeHW.h"
- #include "Lib/CircularBitBuffer.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
-
- /* Macros: */
- /** Total number of tracks which can be read from the card, between 1 and 3. */
- #define TOTAL_TRACKS 3
-
- /** HID keyboard keycode to indicate that no is currently pressed. */
- #define KEY_NONE 0
-
- /** HID keyboard keycode to indicate that the "1" key is currently pressed. */
- #define KEY_1 30
-
- /** HID keyboard keycode to indicate that the "0" key is currently pressed. */
- #define KEY_0 39
-
- /** HID keyboard keycode to indicate that the enter key is currently pressed. */
- #define KEY_ENTER 40
-
- /* Function Prototypes: */
- void SetupHardware(void);
- void ReadMagstripeData(void);
-
- void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
- void EVENT_USB_Device_StartOfFrame(void);
-
- bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
- const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
- void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
- const void* ReportData, const uint16_t ReportSize);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Magstripe.c.
+ */
+
+#ifndef _MAGSTRIPE_H_
+#define _MAGSTRIPE_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+
+ #include "Descriptors.h"
+ #include "Lib/MagstripeHW.h"
+ #include "Lib/CircularBitBuffer.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/HID.h>
+
+ /* Macros: */
+ /** Total number of tracks which can be read from the card, between 1 and 3. */
+ #define TOTAL_TRACKS 3
+
+ /** HID keyboard keycode to indicate that no is currently pressed. */
+ #define KEY_NONE 0
+
+ /** HID keyboard keycode to indicate that the "1" key is currently pressed. */
+ #define KEY_1 30
+
+ /** HID keyboard keycode to indicate that the "0" key is currently pressed. */
+ #define KEY_0 39
+
+ /** HID keyboard keycode to indicate that the enter key is currently pressed. */
+ #define KEY_ENTER 40
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+ void ReadMagstripeData(void);
+
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
+
+ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
+ const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
+ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
+ const void* ReportData, const uint16_t ReportSize);
+
+#endif
diff --git a/Projects/Magstripe/Magstripe.txt b/Projects/Magstripe/Magstripe.txt
index 41c6b6e86..931111243 100644
--- a/Projects/Magstripe/Magstripe.txt
+++ b/Projects/Magstripe/Magstripe.txt
@@ -1,164 +1,164 @@
-/** \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 Denver Gingerich's USBSnoop Magnetic Card Reader Project
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - AT90USB1287
- * - AT90USB1286
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Human Interface Device (HID)</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>Keyboard</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USBIF HID Standard, USBIF HID Usage Tables</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Firmware for a USB AVR powered USB TTL magnetic stripe reader (using a card
- * reader such as the Omron V3B-4K) by Denver Gingerich. This project is designed
- * to be used with the open source Stripe Snoop project at <a>http://stripesnoop.sourceforge.net/</a>.
- *
- * See <a>http://ossguy.com/ss_usb/</a> for the USB reader hardware project website,
- * including construction and support details.
- *
- * To use, connect your magnetic card reader device to the USB AVR as follows (pin and port mapping may be adjusted
- * from the project makefile):
- *
- * <table>
- * <tr>
- * <td><b>Signal:</b></td>
- * <td><b>AVR Port:</b></td>
- * </tr>
- * <tr>
- * <td>Track 1 Data</td>
- * <td>PORTC, Pin 1</td>
- * </tr>
- * <tr>
- * <td>Track 1 Clock</td>
- * <td>PORTC, Pin 2</td>
- * </tr>
- * <tr>
- * <td>Track 2 Data</td>
- * <td>PORTC, Pin 3</td>
- * </tr>
- * <tr>
- * <td>Track 2 Clock</td>
- * <td>PORTC, Pin 0</td>
- * </tr>
- * <tr>
- * <td>Track 3 Data</td>
- * <td>PORTC, Pin 5</td>
- * </tr>
- * <tr>
- * <td>Track 3 Clock</td>
- * <td>PORTC, Pin 6</td>
- * </tr>
- * <tr>
- * <td>Card Detect</td>
- * <td>PORTC, Pin 4</td>
- * </tr>
- * </table>
- *
- * This project is based on the LUFA Keyboard projectnstration application,
- * written by Denver Gingerich.
- *
- * This application uses a keyboard HID driver to communicate the data collected
- * a TTL magnetic stripe reader to the connected computer. The raw bitstream
- * obtained from the magnetic stripe reader is "typed" through the keyboard
- * driver as 0's and 1's. After every card swipe, the project will send a return key.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>MAX_BITS</td>
- * <td>CircularBitBuffer.h</td>
- * <td>Gives the maximum number of bits per track which can be buffered by the device for later transmission to a host.</td>
- * </tr>
- * <tr>
- * <td>MAG_T1_CLOCK</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's CLOCK line for the reader's track 1 output.</td>
- * </tr>
- * <tr>
- * <td>MAG_T1_DATA</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's DATA line for the reader's track 1 output.</td>
- * </tr>
- * <tr>
- * <td>MAG_T2_CLOCK</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's CLOCK line for the reader's track 2 output.</td>
- * </tr>
- * <tr>
- * <td>MAG_T2_DATA</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's DATA line for the reader's track 2 output.</td>
- * </tr>
- * <tr>
- * <td>MAG_T3_CLOCK</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's CLOCK line for the reader's track 3 output.</td>
- * </tr>
- * <tr>
- * <td>MAG_T3_DATA</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's DATA line for the reader's track 3 output.</td>
- * </tr>
- * <tr>
- * <td>MAG_CARDPRESENT</td>
- * <td>Makefile CDEFS</td>
- * <td>Mask for the magnetic card reader's card detection output.</td>
- * </tr>
- * <tr>
- * <td>MAG_PIN</td>
- * <td>Makefile CDEFS</td>
- * <td>PIN register that the magnetic card reader device is attached to.</td>
- * </tr>
- * <tr>
- * <td>MAG_PORT</td>
- * <td>Makefile CDEFS</td>
- * <td>PORT register that the magnetic card reader device is attached to.</td>
- * </tr>
- * <tr>
- * <td>MAG_DDR</td>
- * <td>Makefile CDEFS</td>
- * <td>DDR register that the magnetic card reader device is attached to.</td>
- * </tr>
- * </table>
- */
+/** \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 Denver Gingerich's USBSnoop Magnetic Card Reader Project
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - AT90USB1287
+ * - AT90USB1286
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Human Interface Device (HID)</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>Keyboard</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USBIF HID Standard, USBIF HID Usage Tables</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Firmware for a USB AVR powered USB TTL magnetic stripe reader (using a card
+ * reader such as the Omron V3B-4K) by Denver Gingerich. This project is designed
+ * to be used with the open source Stripe Snoop project at <a>http://stripesnoop.sourceforge.net/</a>.
+ *
+ * See <a>http://ossguy.com/ss_usb/</a> for the USB reader hardware project website,
+ * including construction and support details.
+ *
+ * To use, connect your magnetic card reader device to the USB AVR as follows (pin and port mapping may be adjusted
+ * from the project makefile):
+ *
+ * <table>
+ * <tr>
+ * <td><b>Signal:</b></td>
+ * <td><b>AVR Port:</b></td>
+ * </tr>
+ * <tr>
+ * <td>Track 1 Data</td>
+ * <td>PORTC, Pin 1</td>
+ * </tr>
+ * <tr>
+ * <td>Track 1 Clock</td>
+ * <td>PORTC, Pin 2</td>
+ * </tr>
+ * <tr>
+ * <td>Track 2 Data</td>
+ * <td>PORTC, Pin 3</td>
+ * </tr>
+ * <tr>
+ * <td>Track 2 Clock</td>
+ * <td>PORTC, Pin 0</td>
+ * </tr>
+ * <tr>
+ * <td>Track 3 Data</td>
+ * <td>PORTC, Pin 5</td>
+ * </tr>
+ * <tr>
+ * <td>Track 3 Clock</td>
+ * <td>PORTC, Pin 6</td>
+ * </tr>
+ * <tr>
+ * <td>Card Detect</td>
+ * <td>PORTC, Pin 4</td>
+ * </tr>
+ * </table>
+ *
+ * This project is based on the LUFA Keyboard projectnstration application,
+ * written by Denver Gingerich.
+ *
+ * This application uses a keyboard HID driver to communicate the data collected
+ * a TTL magnetic stripe reader to the connected computer. The raw bitstream
+ * obtained from the magnetic stripe reader is "typed" through the keyboard
+ * driver as 0's and 1's. After every card swipe, the project will send a return key.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>MAX_BITS</td>
+ * <td>CircularBitBuffer.h</td>
+ * <td>Gives the maximum number of bits per track which can be buffered by the device for later transmission to a host.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_T1_CLOCK</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's CLOCK line for the reader's track 1 output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_T1_DATA</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's DATA line for the reader's track 1 output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_T2_CLOCK</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's CLOCK line for the reader's track 2 output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_T2_DATA</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's DATA line for the reader's track 2 output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_T3_CLOCK</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's CLOCK line for the reader's track 3 output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_T3_DATA</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's DATA line for the reader's track 3 output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_CARDPRESENT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Mask for the magnetic card reader's card detection output.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_PIN</td>
+ * <td>Makefile CDEFS</td>
+ * <td>PIN register that the magnetic card reader device is attached to.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_PORT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>PORT register that the magnetic card reader device is attached to.</td>
+ * </tr>
+ * <tr>
+ * <td>MAG_DDR</td>
+ * <td>Makefile CDEFS</td>
+ * <td>DDR register that the magnetic card reader device is attached to.</td>
+ * </tr>
+ * </table>
+ */
diff --git a/Projects/MissileLauncher/ConfigDescriptor.c b/Projects/MissileLauncher/ConfigDescriptor.c
index 88f7bacb7..7214c7e6a 100644
--- a/Projects/MissileLauncher/ConfigDescriptor.c
+++ b/Projects/MissileLauncher/ConfigDescriptor.c
@@ -1,167 +1,167 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 a HID interface descriptor containing at least one Interrupt type IN endpoint.
- *
- * \return An error code from the GenericHIDHost_GetConfigDescriptorDataCodes_t enum.
- */
-uint8_t ProcessConfigurationDescriptor(void)
-{
- uint8_t ConfigDescriptorData[512];
- void* CurrConfigLocation = ConfigDescriptorData;
- uint16_t CurrConfigBytesRem;
- uint8_t FoundEndpoints = 0;
-
- /* 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 ControlError;
- }
-
- /* Get the HID interface from the configuration descriptor */
- if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
- DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- /* Descriptor not found, error out */
- return NoHIDInterfaceFound;
- }
-
- while (FoundEndpoints != ((1 << HID_DATA_IN_PIPE) | (1 << HID_DATA_OUT_PIPE)))
- {
- /* Get the next HID interface's data endpoint descriptor */
- if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
- DComp_NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- /* Not all HID devices have an OUT endpoint - if we've reached the end of the HID descriptor
- * but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */
- if (FoundEndpoints == (1 << HID_DATA_IN_PIPE))
- break;
-
- /* Descriptor not found, error out */
- return NoEndpointFound;
- }
-
- /* Retrieve the endpoint address from the endpoint descriptor */
- USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
-
- /* If the endpoint is a IN type endpoint */
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
- {
- /* Configure the HID data IN pipe */
- Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
- EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
-
- FoundEndpoints |= (1 << HID_DATA_IN_PIPE);
- }
- else
- {
- /* Configure the HID data OUT pipe */
- Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
- EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
-
- FoundEndpoints |= (1 << HID_DATA_OUT_PIPE);
- }
- }
-
- /* 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 of the correct HID Class value.
- *
- * \return A value from the DSEARCH_Return_ErrorCodes_t enum
- */
-uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
-{
- /* Determine if the current descriptor is an interface descriptor */
- if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
- {
- /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
- if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CLASS)
- {
- /* Indicate that the descriptor being searched for has been found */
- return DESCRIPTOR_SEARCH_Found;
- }
- }
-
- /* Current descriptor does not match what this comparator is looking for */
- 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 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_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor)
-{
- /* Determine the type of the current descriptor */
- if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
- {
- /* Indicate that the descriptor being searched for has been found */
- return DESCRIPTOR_SEARCH_Found;
- }
- else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
- {
- /* Indicate that the search has failed prematurely and should be aborted */
- return DESCRIPTOR_SEARCH_Fail;
- }
-
- /* Current descriptor does not match what this comparator is looking for */
- return DESCRIPTOR_SEARCH_NotFound;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 a HID interface descriptor containing at least one Interrupt type IN endpoint.
+ *
+ * \return An error code from the GenericHIDHost_GetConfigDescriptorDataCodes_t enum.
+ */
+uint8_t ProcessConfigurationDescriptor(void)
+{
+ uint8_t ConfigDescriptorData[512];
+ void* CurrConfigLocation = ConfigDescriptorData;
+ uint16_t CurrConfigBytesRem;
+ uint8_t FoundEndpoints = 0;
+
+ /* 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 ControlError;
+ }
+
+ /* Get the HID interface from the configuration descriptor */
+ if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
+ DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ {
+ /* Descriptor not found, error out */
+ return NoHIDInterfaceFound;
+ }
+
+ while (FoundEndpoints != ((1 << HID_DATA_IN_PIPE) | (1 << HID_DATA_OUT_PIPE)))
+ {
+ /* Get the next HID interface's data endpoint descriptor */
+ if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
+ DComp_NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ {
+ /* Not all HID devices have an OUT endpoint - if we've reached the end of the HID descriptor
+ * but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */
+ if (FoundEndpoints == (1 << HID_DATA_IN_PIPE))
+ break;
+
+ /* Descriptor not found, error out */
+ return NoEndpointFound;
+ }
+
+ /* Retrieve the endpoint address from the endpoint descriptor */
+ USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
+
+ /* If the endpoint is a IN type endpoint */
+ if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ {
+ /* Configure the HID data IN pipe */
+ Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
+ EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
+
+ FoundEndpoints |= (1 << HID_DATA_IN_PIPE);
+ }
+ else
+ {
+ /* Configure the HID data OUT pipe */
+ Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
+ EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
+
+ FoundEndpoints |= (1 << HID_DATA_OUT_PIPE);
+ }
+ }
+
+ /* 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 of the correct HID Class value.
+ *
+ * \return A value from the DSEARCH_Return_ErrorCodes_t enum
+ */
+uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
+{
+ /* Determine if the current descriptor is an interface descriptor */
+ if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
+ {
+ /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
+ if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CLASS)
+ {
+ /* Indicate that the descriptor being searched for has been found */
+ return DESCRIPTOR_SEARCH_Found;
+ }
+ }
+
+ /* Current descriptor does not match what this comparator is looking for */
+ 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 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_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor)
+{
+ /* Determine the type of the current descriptor */
+ if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
+ {
+ /* Indicate that the descriptor being searched for has been found */
+ return DESCRIPTOR_SEARCH_Found;
+ }
+ else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
+ {
+ /* Indicate that the search has failed prematurely and should be aborted */
+ return DESCRIPTOR_SEARCH_Fail;
+ }
+
+ /* Current descriptor does not match what this comparator is looking for */
+ return DESCRIPTOR_SEARCH_NotFound;
+}
diff --git a/Projects/MissileLauncher/ConfigDescriptor.h b/Projects/MissileLauncher/ConfigDescriptor.h
index 2d86c0b97..df21702e5 100644
--- a/Projects/MissileLauncher/ConfigDescriptor.h
+++ b/Projects/MissileLauncher/ConfigDescriptor.h
@@ -1,66 +1,66 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 <LUFA/Drivers/USB/USB.h>
-
- #include "MissileLauncher.h"
-
- /* Macros: */
- /** Interface Class value for the Human Interface Device class */
- #define HID_CLASS 0x03
-
- /* Enums: */
- /** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */
- enum GenericHIDHost_GetConfigDescriptorDataCodes_t
- {
- SuccessfulConfigRead = 0, /**< Configuration Descriptor was processed successfully */
- ControlError = 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 */
- NoHIDInterfaceFound = 4, /**< A compatible HID interface was not found in the device's Configuration Descriptor */
- NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
- };
-
- /* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
- uint8_t DComp_NextHIDInterface(void* CurrentDescriptor);
- uint8_t DComp_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 <LUFA/Drivers/USB/USB.h>
+
+ #include "MissileLauncher.h"
+
+ /* Macros: */
+ /** Interface Class value for the Human Interface Device class */
+ #define HID_CLASS 0x03
+
+ /* Enums: */
+ /** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */
+ enum GenericHIDHost_GetConfigDescriptorDataCodes_t
+ {
+ SuccessfulConfigRead = 0, /**< Configuration Descriptor was processed successfully */
+ ControlError = 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 */
+ NoHIDInterfaceFound = 4, /**< A compatible HID interface was not found in the device's Configuration Descriptor */
+ NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
+ };
+
+ /* Function Prototypes: */
+ uint8_t ProcessConfigurationDescriptor(void);
+
+ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor);
+
+#endif
diff --git a/Projects/MissileLauncher/Doxygen.conf b/Projects/MissileLauncher/Doxygen.conf
index e601541f4..dc992c576 100644
--- a/Projects/MissileLauncher/Doxygen.conf
+++ b/Projects/MissileLauncher/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "Dave Fletcher's Missile Launcher Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Dave Fletcher's Missile Launcher Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/MissileLauncher/MissileLauncher.c b/Projects/MissileLauncher/MissileLauncher.c
index cb0bd8570..dcc6e732f 100644
--- a/Projects/MissileLauncher/MissileLauncher.c
+++ b/Projects/MissileLauncher/MissileLauncher.c
@@ -1,337 +1,337 @@
-/*
- USB Missile Launcher Demo
- Copyright (C) Dave Fletcher, 2010.
- fletch at fletchtronics dot net
-
- Based on research by Scott Weston at
- http://code.google.com/p/pymissile
- */
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Copyright 2010 Dave Fletcher (fletch [at] fletchtronics [dot] net)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/*
- * Missile Launcher host. This is a host driver for the popular USB-controller table top toy missile launchers,
- * which can typically aim and fire small foam "missiles" from a spring-loaded turret. This project controls the
- * launcher via a joystick and button to aim and fire missiles at targets without a PC.
- */
-
-/** \file
- *
- * Main source file for the MissileLauncher application. This file contains the main tasks of
- * the application and is responsible for the initial application hardware configuration as well
- * as the sending of commands to the attached launcher toy.
- */
-
-#include "MissileLauncher.h"
-
-/** Launcher first init command report data sequence */
-uint8_t CMD_INITA[8] = { 85, 83, 66, 67, 0, 0, 4, 0 };
-
-/** Launcher second init command report data sequence */
-uint8_t CMD_INITB[8] = { 85, 83, 66, 67, 0, 64, 2, 0 };
-
-/** Launcher command report data sequence to stop all movement */
-uint8_t CMD_STOP[8] = { 0, 0, 0, 0, 0, 0, 8, 8 };
-
-/** Launcher command report data sequence to move left */
-uint8_t CMD_LEFT[8] = { 0, 1, 0, 0, 0, 0, 8, 8 };
-
-/** Launcher command report data sequence to move right */
-uint8_t CMD_RIGHT[8] = { 0, 0, 1, 0, 0, 0, 8, 8 };
-
-/** Launcher command report data sequence to move up */
-uint8_t CMD_UP[8] = { 0, 0, 0, 1, 0, 0, 8, 8 };
-
-/** Launcher command report data sequence to move down */
-uint8_t CMD_DOWN[8] = { 0, 0, 0, 0, 1, 0, 8, 8 };
-
-/** Launcher command report data sequence to move left and up */
-uint8_t CMD_LEFTUP[8] = { 0, 1, 0, 1, 0, 0, 8, 8 };
-
-/** Launcher command report data sequence to move right and up */
-uint8_t CMD_RIGHTUP[8] = { 0, 0, 1, 1, 0, 0, 8, 8 };
-
-/** Launcher command report data sequence to move left and down */
-uint8_t CMD_LEFTDOWN[8] = { 0, 1, 0, 0, 1, 0, 8, 8 };
-
-/** Launcher command report data sequence to move right and down */
-uint8_t CMD_RIGHTDOWN[8] = { 0, 0, 1, 0, 1, 0, 8, 8 };
-
-/** Launcher command report data sequence to fire a missile */
-uint8_t CMD_FIRE[8] = { 0, 0, 0, 0, 0, 1, 8, 8 };
-
-/** Last command sent to the launcher, to determine what new command (if any) must be sent */
-uint8_t* CmdState;
-
-/** Buffer to hold a command to send to the launcher */
-uint8_t CmdBuffer[LAUNCHER_CMD_BUFFER_SIZE];
-
-
-/** 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();
-
- CmdState = CMD_STOP;
-
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- sei();
-
- for (;;)
- {
- Read_Joystick_Status();
-
- HID_Host_Task();
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- LEDs_Init();
- USB_Init();
- Joystick_Init();
- Buttons_Init();
-}
-
-/** Reads the joystick and button status, sending commands to the launcher as needed. */
-void Read_Joystick_Status(void)
-{
- uint8_t JoyStatus_LCL = Joystick_GetStatus();
- uint8_t Buttons_LCL = Buttons_GetStatus();
-
- if (Buttons_LCL & BUTTONS_BUTTON1)
- Send_Command(CMD_FIRE);
- else if (JoyStatus_LCL & JOY_UP)
- Send_Command(CMD_UP);
- else if (JoyStatus_LCL & JOY_DOWN)
- Send_Command(CMD_DOWN);
- else if (JoyStatus_LCL & JOY_LEFT)
- Send_Command(CMD_LEFT);
- else if (JoyStatus_LCL & JOY_RIGHT)
- Send_Command(CMD_RIGHT);
- else if (CmdState != CMD_STOP)
- Send_Command(CMD_STOP);
-}
-
-/** Lower level send routine, copies report into a larger buffer and sends.
- *
- * \param[in] Report Report data to send.
- * \param[in] ReportSize Report length in bytes.
- */
-void Send_Command_Report(uint8_t* const Report, const uint16_t ReportSize)
-{
- memcpy(CmdBuffer, Report, 8);
- WriteNextReport(CmdBuffer, ReportSize);
-}
-
-/** Sends one of the CMD_* command constants to the attached device.
- *
- * \param[in] Command One of the command constants.
- */
-void Send_Command(uint8_t* const Command)
-{
- if ((CmdState == CMD_STOP && Command != CMD_STOP) ||
- (CmdState != CMD_STOP && Command == CMD_STOP))
- {
- LEDs_ToggleLEDs(LEDS_LED4);
-
- Send_Command_Report(CMD_INITA, 8);
- Send_Command_Report(CMD_INITB, 8);
- Send_Command_Report(Command, LAUNCHER_CMD_BUFFER_SIZE);
- }
-
- CmdState = Command;
-}
-
-/** 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)
-{
- 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)
-{
- 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)
-{
- 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_ShutDown();
-
- 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)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Reads in and discards the next report from the attached device. */
-void DiscardNextReport(void)
-{
- /* Select and unfreeze HID data IN pipe */
- Pipe_SelectPipe(HID_DATA_IN_PIPE);
- Pipe_Unfreeze();
-
- /* Check to see if a packet has been received */
- if (!(Pipe_IsINReceived()))
- {
- /* Refreeze HID data IN pipe */
- Pipe_Freeze();
-
- return;
- }
-
- /* Clear the IN endpoint, ready for next data packet */
- Pipe_ClearIN();
-
- /* Refreeze HID data IN pipe */
- Pipe_Freeze();
-}
-
-/** Writes a report to the attached device.
- *
- * \param[in] ReportOUTData Buffer containing the report to send to the device
- * \param[in] ReportLength Length of the report to send
- */
-void WriteNextReport(uint8_t* const ReportOUTData, const uint16_t ReportLength)
-{
- /* Select and unfreeze HID data OUT pipe */
- Pipe_SelectPipe(HID_DATA_OUT_PIPE);
-
- /* Not all HID devices have an OUT endpoint (some require OUT reports to be sent over the
- * control endpoint instead) - check to see if the OUT endpoint has been initialized */
- if (Pipe_IsConfigured())
- {
- Pipe_Unfreeze();
-
- /* Ensure pipe is ready to be written to before continuing */
- if (!(Pipe_IsOUTReady()))
- {
- /* Refreeze the data OUT pipe */
- Pipe_Freeze();
-
- return;
- }
-
- /* Write out HID report data */
- Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
-
- /* Clear the OUT endpoint, send last data packet */
- Pipe_ClearOUT();
-
- /* Refreeze the data OUT pipe */
- Pipe_Freeze();
- }
- else
- {
- /* Class specific request to send a HID report to the device */
- USB_ControlRequest = (USB_Request_Header_t)
- {
- .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetReport,
- .wValue = 0x02,
- .wIndex = 0x01,
- .wLength = ReportLength,
- };
-
- /* Select the control pipe for the request transfer */
- Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
- /* Send the request to the device */
- USB_Host_SendControlRequest(ReportOUTData);
- }
-}
-
-/** Task to set the configuration of the attached device after it has been enumerated, and to read and process
- * HID reports from the device and to send reports if desired.
- */
-void HID_Host_Task(void)
-{
- uint8_t ErrorCode;
-
- /* Switch to determine what user-application handled host state the host state machine is in */
- switch (USB_HostState)
- {
- case HOST_STATE_Addressed:
- /* Get and process the configuration descriptor data */
- if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
- {
- /* Indicate error status */
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
- /* Wait until USB device disconnected */
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
- if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
- {
- /* Indicate error status */
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
- /* Wait until USB device disconnected */
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- USB_HostState = HOST_STATE_Configured;
- break;
- case HOST_STATE_Configured:
- DiscardNextReport();
-
- break;
- }
-}
+/*
+ USB Missile Launcher Demo
+ Copyright (C) Dave Fletcher, 2010.
+ fletch at fletchtronics dot net
+
+ Based on research by Scott Weston at
+ http://code.google.com/p/pymissile
+ */
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2010 Dave Fletcher (fletch [at] fletchtronics [dot] net)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/*
+ * Missile Launcher host. This is a host driver for the popular USB-controller table top toy missile launchers,
+ * which can typically aim and fire small foam "missiles" from a spring-loaded turret. This project controls the
+ * launcher via a joystick and button to aim and fire missiles at targets without a PC.
+ */
+
+/** \file
+ *
+ * Main source file for the MissileLauncher application. This file contains the main tasks of
+ * the application and is responsible for the initial application hardware configuration as well
+ * as the sending of commands to the attached launcher toy.
+ */
+
+#include "MissileLauncher.h"
+
+/** Launcher first init command report data sequence */
+uint8_t CMD_INITA[8] = { 85, 83, 66, 67, 0, 0, 4, 0 };
+
+/** Launcher second init command report data sequence */
+uint8_t CMD_INITB[8] = { 85, 83, 66, 67, 0, 64, 2, 0 };
+
+/** Launcher command report data sequence to stop all movement */
+uint8_t CMD_STOP[8] = { 0, 0, 0, 0, 0, 0, 8, 8 };
+
+/** Launcher command report data sequence to move left */
+uint8_t CMD_LEFT[8] = { 0, 1, 0, 0, 0, 0, 8, 8 };
+
+/** Launcher command report data sequence to move right */
+uint8_t CMD_RIGHT[8] = { 0, 0, 1, 0, 0, 0, 8, 8 };
+
+/** Launcher command report data sequence to move up */
+uint8_t CMD_UP[8] = { 0, 0, 0, 1, 0, 0, 8, 8 };
+
+/** Launcher command report data sequence to move down */
+uint8_t CMD_DOWN[8] = { 0, 0, 0, 0, 1, 0, 8, 8 };
+
+/** Launcher command report data sequence to move left and up */
+uint8_t CMD_LEFTUP[8] = { 0, 1, 0, 1, 0, 0, 8, 8 };
+
+/** Launcher command report data sequence to move right and up */
+uint8_t CMD_RIGHTUP[8] = { 0, 0, 1, 1, 0, 0, 8, 8 };
+
+/** Launcher command report data sequence to move left and down */
+uint8_t CMD_LEFTDOWN[8] = { 0, 1, 0, 0, 1, 0, 8, 8 };
+
+/** Launcher command report data sequence to move right and down */
+uint8_t CMD_RIGHTDOWN[8] = { 0, 0, 1, 0, 1, 0, 8, 8 };
+
+/** Launcher command report data sequence to fire a missile */
+uint8_t CMD_FIRE[8] = { 0, 0, 0, 0, 0, 1, 8, 8 };
+
+/** Last command sent to the launcher, to determine what new command (if any) must be sent */
+uint8_t* CmdState;
+
+/** Buffer to hold a command to send to the launcher */
+uint8_t CmdBuffer[LAUNCHER_CMD_BUFFER_SIZE];
+
+
+/** 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();
+
+ CmdState = CMD_STOP;
+
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ sei();
+
+ for (;;)
+ {
+ Read_Joystick_Status();
+
+ HID_Host_Task();
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ LEDs_Init();
+ USB_Init();
+ Joystick_Init();
+ Buttons_Init();
+}
+
+/** Reads the joystick and button status, sending commands to the launcher as needed. */
+void Read_Joystick_Status(void)
+{
+ uint8_t JoyStatus_LCL = Joystick_GetStatus();
+ uint8_t Buttons_LCL = Buttons_GetStatus();
+
+ if (Buttons_LCL & BUTTONS_BUTTON1)
+ Send_Command(CMD_FIRE);
+ else if (JoyStatus_LCL & JOY_UP)
+ Send_Command(CMD_UP);
+ else if (JoyStatus_LCL & JOY_DOWN)
+ Send_Command(CMD_DOWN);
+ else if (JoyStatus_LCL & JOY_LEFT)
+ Send_Command(CMD_LEFT);
+ else if (JoyStatus_LCL & JOY_RIGHT)
+ Send_Command(CMD_RIGHT);
+ else if (CmdState != CMD_STOP)
+ Send_Command(CMD_STOP);
+}
+
+/** Lower level send routine, copies report into a larger buffer and sends.
+ *
+ * \param[in] Report Report data to send.
+ * \param[in] ReportSize Report length in bytes.
+ */
+void Send_Command_Report(uint8_t* const Report, const uint16_t ReportSize)
+{
+ memcpy(CmdBuffer, Report, 8);
+ WriteNextReport(CmdBuffer, ReportSize);
+}
+
+/** Sends one of the CMD_* command constants to the attached device.
+ *
+ * \param[in] Command One of the command constants.
+ */
+void Send_Command(uint8_t* const Command)
+{
+ if ((CmdState == CMD_STOP && Command != CMD_STOP) ||
+ (CmdState != CMD_STOP && Command == CMD_STOP))
+ {
+ LEDs_ToggleLEDs(LEDS_LED4);
+
+ Send_Command_Report(CMD_INITA, 8);
+ Send_Command_Report(CMD_INITB, 8);
+ Send_Command_Report(Command, LAUNCHER_CMD_BUFFER_SIZE);
+ }
+
+ CmdState = Command;
+}
+
+/** 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)
+{
+ 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)
+{
+ 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)
+{
+ 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_ShutDown();
+
+ 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)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Reads in and discards the next report from the attached device. */
+void DiscardNextReport(void)
+{
+ /* Select and unfreeze HID data IN pipe */
+ Pipe_SelectPipe(HID_DATA_IN_PIPE);
+ Pipe_Unfreeze();
+
+ /* Check to see if a packet has been received */
+ if (!(Pipe_IsINReceived()))
+ {
+ /* Refreeze HID data IN pipe */
+ Pipe_Freeze();
+
+ return;
+ }
+
+ /* Clear the IN endpoint, ready for next data packet */
+ Pipe_ClearIN();
+
+ /* Refreeze HID data IN pipe */
+ Pipe_Freeze();
+}
+
+/** Writes a report to the attached device.
+ *
+ * \param[in] ReportOUTData Buffer containing the report to send to the device
+ * \param[in] ReportLength Length of the report to send
+ */
+void WriteNextReport(uint8_t* const ReportOUTData, const uint16_t ReportLength)
+{
+ /* Select and unfreeze HID data OUT pipe */
+ Pipe_SelectPipe(HID_DATA_OUT_PIPE);
+
+ /* Not all HID devices have an OUT endpoint (some require OUT reports to be sent over the
+ * control endpoint instead) - check to see if the OUT endpoint has been initialized */
+ if (Pipe_IsConfigured())
+ {
+ Pipe_Unfreeze();
+
+ /* Ensure pipe is ready to be written to before continuing */
+ if (!(Pipe_IsOUTReady()))
+ {
+ /* Refreeze the data OUT pipe */
+ Pipe_Freeze();
+
+ return;
+ }
+
+ /* Write out HID report data */
+ Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
+
+ /* Clear the OUT endpoint, send last data packet */
+ Pipe_ClearOUT();
+
+ /* Refreeze the data OUT pipe */
+ Pipe_Freeze();
+ }
+ else
+ {
+ /* Class specific request to send a HID report to the device */
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
+ .bRequest = REQ_SetReport,
+ .wValue = 0x02,
+ .wIndex = 0x01,
+ .wLength = ReportLength,
+ };
+
+ /* Select the control pipe for the request transfer */
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ /* Send the request to the device */
+ USB_Host_SendControlRequest(ReportOUTData);
+ }
+}
+
+/** Task to set the configuration of the attached device after it has been enumerated, and to read and process
+ * HID reports from the device and to send reports if desired.
+ */
+void HID_Host_Task(void)
+{
+ uint8_t ErrorCode;
+
+ /* Switch to determine what user-application handled host state the host state machine is in */
+ switch (USB_HostState)
+ {
+ case HOST_STATE_Addressed:
+ /* Get and process the configuration descriptor data */
+ if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
+ {
+ /* Indicate error status */
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ /* Wait until USB device disconnected */
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
+ if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
+ {
+ /* Indicate error status */
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ /* Wait until USB device disconnected */
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ USB_HostState = HOST_STATE_Configured;
+ break;
+ case HOST_STATE_Configured:
+ DiscardNextReport();
+
+ break;
+ }
+}
diff --git a/Projects/MissileLauncher/MissileLauncher.h b/Projects/MissileLauncher/MissileLauncher.h
index 089b0dc84..31bb9386f 100644
--- a/Projects/MissileLauncher/MissileLauncher.h
+++ b/Projects/MissileLauncher/MissileLauncher.h
@@ -1,99 +1,99 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 MissileLauncher.c.
- */
-
-#ifndef _MISSILELAUNCHER_HOST_H_
-#define _MISSILELAUNCHER_HOST_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/pgmspace.h>
- #include <avr/interrupt.h>
- #include <avr/power.h>
- #include <string.h>
- #include <stdio.h>
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/Board/Buttons.h>
- #include <LUFA/Drivers/Board/Joystick.h>
- #include <LUFA/Drivers/Board/LEDs.h>
-
- #include "ConfigDescriptor.h"
-
- /* Macros: */
- /** Pipe number for the HID data IN pipe */
- #define HID_DATA_IN_PIPE 1
-
- /** Pipe number for the HID data OUT pipe */
- #define HID_DATA_OUT_PIPE 2
-
- /** HID Class specific request to send a HID report to the device. */
- #define REQ_SetReport 0x09
-
- /** 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)
-
- /** Size of the Launcher report command buffer */
- #define LAUNCHER_CMD_BUFFER_SIZE 64
-
- /* Function Prototypes: */
- void SetupHardware(void);
-
- void Read_Joystick_Status(void);
- void Send_Command_Report(uint8_t* const Report, const uint16_t ReportSize);
- void Send_Command(uint8_t* const Command);
-
- void HID_Host_Task(void);
-
- void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
- void EVENT_USB_Host_DeviceAttached(void);
- void EVENT_USB_Host_DeviceUnattached(void);
- void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
- void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
- void DiscardNextReport(void);
- void WriteNextReport(uint8_t* const ReportOUTData, const uint16_t ReportLength);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 MissileLauncher.c.
+ */
+
+#ifndef _MISSILELAUNCHER_HOST_H_
+#define _MISSILELAUNCHER_HOST_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/pgmspace.h>
+ #include <avr/interrupt.h>
+ #include <avr/power.h>
+ #include <string.h>
+ #include <stdio.h>
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Board/Buttons.h>
+ #include <LUFA/Drivers/Board/Joystick.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+
+ #include "ConfigDescriptor.h"
+
+ /* Macros: */
+ /** Pipe number for the HID data IN pipe */
+ #define HID_DATA_IN_PIPE 1
+
+ /** Pipe number for the HID data OUT pipe */
+ #define HID_DATA_OUT_PIPE 2
+
+ /** HID Class specific request to send a HID report to the device. */
+ #define REQ_SetReport 0x09
+
+ /** 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)
+
+ /** Size of the Launcher report command buffer */
+ #define LAUNCHER_CMD_BUFFER_SIZE 64
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+
+ void Read_Joystick_Status(void);
+ void Send_Command_Report(uint8_t* const Report, const uint16_t ReportSize);
+ void Send_Command(uint8_t* const Command);
+
+ void HID_Host_Task(void);
+
+ void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_Host_DeviceAttached(void);
+ void EVENT_USB_Host_DeviceUnattached(void);
+ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_Host_DeviceEnumerationComplete(void);
+
+ void DiscardNextReport(void);
+ void WriteNextReport(uint8_t* const ReportOUTData, const uint16_t ReportLength);
+
+#endif
diff --git a/Projects/MissileLauncher/MissileLauncher.txt b/Projects/MissileLauncher/MissileLauncher.txt
index 519410ef1..d93c21da1 100644
--- a/Projects/MissileLauncher/MissileLauncher.txt
+++ b/Projects/MissileLauncher/MissileLauncher.txt
@@ -1,59 +1,59 @@
-/** \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 David Fletcher's Missile Launcher
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - Series 7 USB AVRs
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Host</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Human Interface Device (HID)</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>N/A</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USBIF HID Specification, USBIF HID Usage Tables</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Low Speed Mode, Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Missile Launcher host. This is a host driver for the popular USB-controller table top toy missile launchers,
- * which can typically aim and fire small foam "missiles" from a spring-loaded turret. This project controls the
- * launcher via a joystick and button to aim and fire missiles at targets without a PC.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td>
- * None
- * </td>
- * </tr>
- * </table>
- */
+/** \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 David Fletcher's Missile Launcher
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - Series 7 USB AVRs
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Host</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Human Interface Device (HID)</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>N/A</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USBIF HID Specification, USBIF HID Usage Tables</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Low Speed Mode, Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Missile Launcher host. This is a host driver for the popular USB-controller table top toy missile launchers,
+ * which can typically aim and fire small foam "missiles" from a spring-loaded turret. This project controls the
+ * launcher via a joystick and button to aim and fire missiles at targets without a PC.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td>
+ * None
+ * </td>
+ * </tr>
+ * </table>
+ */
diff --git a/Projects/MissileLauncher/makefile b/Projects/MissileLauncher/makefile
index 7b50e6903..c57e215c3 100644
--- a/Projects/MissileLauncher/makefile
+++ b/Projects/MissileLauncher/makefile
@@ -1,737 +1,737 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = MissileLauncher
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../..
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D NO_STREAM_CALLBACKS
-LUFA_OPTS += -D USB_HOST_ONLY
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
- $(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = MissileLauncher
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../..
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D NO_STREAM_CALLBACKS
+LUFA_OPTS += -D USB_HOST_ONLY
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
+ $(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c
index d4857a557..ca353d51f 100644
--- a/Projects/RelayBoard/Descriptors.c
+++ b/Projects/RelayBoard/Descriptors.c
@@ -1,200 +1,200 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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.
- */
-USB_Descriptor_Device_t PROGMEM RelayBoard_DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0xFF,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x04B4,
- .ProductID = 0xFD11,
- .ReleaseNumber = VERSION_BCD(02.00),
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = 0x03,
-
- .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.
- */
-RelayBoard_USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor =
-{
- .Config =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
-
- .TotalConfigurationSize = sizeof(RelayBoard_USB_Descriptor_Configuration_t),
- .TotalInterfaces = 1,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(500)
- },
-
- .RelayBoardInterface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 0,
-
- .Class = 0xFF,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM RelayBoard_LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM RelayBoard_ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String},
-
- .UnicodeString = L"SISPM"
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM RelayBoard_ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},
-
- .UnicodeString = L"RelayBoard"
-};
-
-/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
- * series of uppercase hexadecimal digits.
- */
-USB_Descriptor_String_t PROGMEM RelayBoard_SerialString =
-{
- .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String},
-
- .UnicodeString = L"00001"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&RelayBoard_DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&RelayBoard_ConfigurationDescriptor;
- Size = sizeof(RelayBoard_USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&RelayBoard_LanguageString;
- Size = pgm_read_byte(&RelayBoard_LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&RelayBoard_ManufacturerString;
- Size = pgm_read_byte(&RelayBoard_ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&RelayBoard_ProductString;
- Size = pgm_read_byte(&RelayBoard_ProductString.Header.Size);
- break;
- case 0x03:
- Address = (void*)&RelayBoard_SerialString;
- Size = pgm_read_byte(&RelayBoard_SerialString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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.
+ */
+USB_Descriptor_Device_t PROGMEM RelayBoard_DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0xFF,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x04B4,
+ .ProductID = 0xFD11,
+ .ReleaseNumber = VERSION_BCD(02.00),
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = 0x03,
+
+ .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.
+ */
+RelayBoard_USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor =
+{
+ .Config =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
+
+ .TotalConfigurationSize = sizeof(RelayBoard_USB_Descriptor_Configuration_t),
+ .TotalInterfaces = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(500)
+ },
+
+ .RelayBoardInterface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 0,
+
+ .Class = 0xFF,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM RelayBoard_LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM RelayBoard_ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String},
+
+ .UnicodeString = L"SISPM"
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM RelayBoard_ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},
+
+ .UnicodeString = L"RelayBoard"
+};
+
+/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
+ * series of uppercase hexadecimal digits.
+ */
+USB_Descriptor_String_t PROGMEM RelayBoard_SerialString =
+{
+ .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String},
+
+ .UnicodeString = L"00001"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&RelayBoard_DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&RelayBoard_ConfigurationDescriptor;
+ Size = sizeof(RelayBoard_USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&RelayBoard_LanguageString;
+ Size = pgm_read_byte(&RelayBoard_LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&RelayBoard_ManufacturerString;
+ Size = pgm_read_byte(&RelayBoard_ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&RelayBoard_ProductString;
+ Size = pgm_read_byte(&RelayBoard_ProductString.Header.Size);
+ break;
+ case 0x03:
+ Address = (void*)&RelayBoard_SerialString;
+ Size = pgm_read_byte(&RelayBoard_SerialString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h
index 6cd6feefc..7b217fbcf 100644
--- a/Projects/RelayBoard/Descriptors.h
+++ b/Projects/RelayBoard/Descriptors.h
@@ -1,59 +1,59 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
- #include <LUFA/Drivers/USB/USB.h>
-
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t RelayBoardInterface;
- } RelayBoard_USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <LUFA/Drivers/USB/USB.h>
+
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t RelayBoardInterface;
+ } RelayBoard_USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
+
+#endif
diff --git a/Projects/RelayBoard/Doxygen.conf b/Projects/RelayBoard/Doxygen.conf
index aba5e61c1..afb8a17c4 100644
--- a/Projects/RelayBoard/Doxygen.conf
+++ b/Projects/RelayBoard/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "OB's Dual-Relay outlet control using a Teensy2++"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "OB's Dual-Relay outlet control using a Teensy2++"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
DOT_CLEANUP = YES \ No newline at end of file
diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c
index 2fb7b696c..2f084f3e7 100644
--- a/Projects/RelayBoard/RelayBoard.c
+++ b/Projects/RelayBoard/RelayBoard.c
@@ -1,149 +1,149 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 RelayBoard program. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-#include "RelayBoard.h"
-
-
-/** 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();
-
- sei();
-
- for (;;)
- USB_USBTask();
-}
-
-/** Configures the board hardware and chip peripherals for the project's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- USB_Init();
-
- /* Initialize Relays */
- DDRC |= ALL_RELAYS;
- PORTC &= ~ALL_RELAYS;
-}
-
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- USB_Device_EnableSOFEvents();
-}
-
-/** Event handler for the library USB Unhandled Control Packet event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- const uint8_t SerialNumber[5] = { 0, 0, 0, 0, 1 };
- uint8_t ControlData[2] = { 0, 0 };
-
- switch (USB_ControlRequest.bRequest)
- {
- case 0x09:
- if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
- {
- LEDs_ToggleLEDs(LEDS_LED1);
-
- Endpoint_ClearSETUP();
-
- Endpoint_Read_Control_Stream_LE(ControlData, sizeof(ControlData));
- Endpoint_ClearIN();
-
- switch (USB_ControlRequest.wValue)
- {
- case 0x303:
- if (ControlData[1]) PORTC &= ~RELAY1; else PORTC |= RELAY1;
- break;
- case 0x306:
- if (ControlData[1]) PORTC &= ~RELAY2; else PORTC |= RELAY2;
- break;
- case 0x309:
- if (ControlData[1]) PORTC &= ~RELAY3; else PORTC |= RELAY3;
- break;
- case 0x30c:
- if (ControlData[1]) PORTC &= ~RELAY4; else PORTC |= RELAY4;
- break;
- }
- }
-
- break;
- case 0x01:
- if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
- LEDs_ToggleLEDs(LEDS_LED1);
-
- Endpoint_ClearSETUP();
-
- switch (USB_ControlRequest.wValue)
- {
- case 0x301:
- Endpoint_Write_Control_Stream_LE(SerialNumber, sizeof(SerialNumber));
- break;
- case 0x303:
- ControlData[1] = (PORTC & RELAY1) ? 2 : 3;
- break;
- case 0x306:
- ControlData[1] = (PORTC & RELAY2) ? 2 : 3;
- break;
- case 0x309:
- ControlData[1] = (PORTC & RELAY3) ? 2 : 3;
- break;
- case 0x30c:
- ControlData[1] = (PORTC & RELAY4) ? 2 : 3;
- break;
- }
-
- if (ControlData[1])
- Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData));
-
- Endpoint_ClearOUT();
- }
-
- break;
- }
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 RelayBoard program. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
+#include "RelayBoard.h"
+
+
+/** 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();
+
+ sei();
+
+ for (;;)
+ USB_USBTask();
+}
+
+/** Configures the board hardware and chip peripherals for the project's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ USB_Init();
+
+ /* Initialize Relays */
+ DDRC |= ALL_RELAYS;
+ PORTC &= ~ALL_RELAYS;
+}
+
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ USB_Device_EnableSOFEvents();
+}
+
+/** Event handler for the library USB Unhandled Control Packet event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ const uint8_t SerialNumber[5] = { 0, 0, 0, 0, 1 };
+ uint8_t ControlData[2] = { 0, 0 };
+
+ switch (USB_ControlRequest.bRequest)
+ {
+ case 0x09:
+ if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
+ {
+ LEDs_ToggleLEDs(LEDS_LED1);
+
+ Endpoint_ClearSETUP();
+
+ Endpoint_Read_Control_Stream_LE(ControlData, sizeof(ControlData));
+ Endpoint_ClearIN();
+
+ switch (USB_ControlRequest.wValue)
+ {
+ case 0x303:
+ if (ControlData[1]) PORTC &= ~RELAY1; else PORTC |= RELAY1;
+ break;
+ case 0x306:
+ if (ControlData[1]) PORTC &= ~RELAY2; else PORTC |= RELAY2;
+ break;
+ case 0x309:
+ if (ControlData[1]) PORTC &= ~RELAY3; else PORTC |= RELAY3;
+ break;
+ case 0x30c:
+ if (ControlData[1]) PORTC &= ~RELAY4; else PORTC |= RELAY4;
+ break;
+ }
+ }
+
+ break;
+ case 0x01:
+ if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
+ {
+ LEDs_ToggleLEDs(LEDS_LED1);
+
+ Endpoint_ClearSETUP();
+
+ switch (USB_ControlRequest.wValue)
+ {
+ case 0x301:
+ Endpoint_Write_Control_Stream_LE(SerialNumber, sizeof(SerialNumber));
+ break;
+ case 0x303:
+ ControlData[1] = (PORTC & RELAY1) ? 2 : 3;
+ break;
+ case 0x306:
+ ControlData[1] = (PORTC & RELAY2) ? 2 : 3;
+ break;
+ case 0x309:
+ ControlData[1] = (PORTC & RELAY3) ? 2 : 3;
+ break;
+ case 0x30c:
+ ControlData[1] = (PORTC & RELAY4) ? 2 : 3;
+ break;
+ }
+
+ if (ControlData[1])
+ Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData));
+
+ Endpoint_ClearOUT();
+ }
+
+ break;
+ }
+}
diff --git a/Projects/RelayBoard/RelayBoard.h b/Projects/RelayBoard/RelayBoard.h
index f42d78cde..cfd75794d 100644
--- a/Projects/RelayBoard/RelayBoard.h
+++ b/Projects/RelayBoard/RelayBoard.h
@@ -1,64 +1,64 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 RelayBoard.c.
- */
-
-#ifndef _RELAYBOARD_H_
-#define _RELAYBOARD_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
-
- #include "Descriptors.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/USB/USB.h>
-
- /* Macros: */
- #define RELAY1 (1 << 7)
- #define RELAY2 (1 << 6)
- #define RELAY3 (1 << 5)
- #define RELAY4 (1 << 4)
- #define ALL_RELAYS (RELAY1|RELAY2|RELAY3|RELAY4)
-
- /* Function Prototypes: */
- void SetupHardware(void);
-
- void EVENT_USB_Device_UnhandledControlRequest(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 RelayBoard.c.
+ */
+
+#ifndef _RELAYBOARD_H_
+#define _RELAYBOARD_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+
+ #include "Descriptors.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/USB/USB.h>
+
+ /* Macros: */
+ #define RELAY1 (1 << 7)
+ #define RELAY2 (1 << 6)
+ #define RELAY3 (1 << 5)
+ #define RELAY4 (1 << 4)
+ #define ALL_RELAYS (RELAY1|RELAY2|RELAY3|RELAY4)
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+
+#endif
diff --git a/Projects/RelayBoard/RelayBoard.txt b/Projects/RelayBoard/RelayBoard.txt
index ccb188350..bb484be7e 100644
--- a/Projects/RelayBoard/RelayBoard.txt
+++ b/Projects/RelayBoard/RelayBoard.txt
@@ -1,95 +1,95 @@
-/** \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 OB's Quad-Relay outlet control using a Teensy2++
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - AT90USB1286
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>None</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>None</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USB Standards</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Low Speed Mode, Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Firmware for a Teensy2++ AVR-based miniboard to control four relays, using the
- * same protocol used by the commercially available Silver Shield PM power outlets
- * ( http://sourceforge.net/projects/sispmctl ) sold for some time. Because this
- * project mimics the original device, it can be controlled using the "sismpctl"
- * package included in many Linux distributions - including router-orientated
- * versions such as OpenWRT - to control the board's relays.
- *
- * Relays 1 to 4 are respectively wired to pins C4, C5, C6 and C7 of the Teensy++ V2,
- * which are the PORTC bits 4 to 7 of the AT90USB1286. The relays MUST be wired through
- * a transistor, and a diode must be added on the relay's contact pins to protect
- * the transistor from back EMF generated from the relay when the coil is turned off.
- * The transistor base pin is wired to the Teensy data port through a 10K resistor. A
- * LED may be also be added as a relay status indicator on each channel.
- *
- * The Relay coil will be driven by the transistor, but the power will come from
- * the 5V from the PC's USB port: Be careful in choosing the relay to avoid overloading
- * the PC, as the maximum current used MUST remains under ~450mA @ 5V.
- *
- * The author's tested relays are 2 Finder 32.21.7.005.2000, coil il 125ohm, which can
- * handle 5A @ 250VAC. Be careful to use proper isolation if high voltages are manipulated.
- * The author used Hotglue to isolate all parts of the PCB in contact with high voltage.
- *
- * See <a>http://www.pjrc.com/teensy/</a> for the Teensy2++ website.
- *
- * <table>
- * <tr>
- * <td><b>Signal:</b></td>
- * <td><b>AVR Port:</b></td>
- * </tr>
- * <tr>
- * <td>Relay 1</td>
- * <td>PORTC, Pin 4</td>
- * </tr>
- * <tr>
- * <td>Relay 2</td>
- * <td>PORTC, Pin 5</td>
- * </tr>
- * <tr>
- * <td>Relay 3</td>
- * <td>PORTC, Pin 6</td>
- * </tr>
- * <tr>
- * <td>Relay 4</td>
- * <td>PORTC, Pin 7</td>
- * </tr>
- * <tr>
- * <td>Teensy2++ Yellow Led</td>
- * <td>PORTD, pin 6</td>
- * </tr>
- * </table>
- *
+/** \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 OB's Quad-Relay outlet control using a Teensy2++
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - AT90USB1286
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>None</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>None</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USB Standards</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Low Speed Mode, Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Firmware for a Teensy2++ AVR-based miniboard to control four relays, using the
+ * same protocol used by the commercially available Silver Shield PM power outlets
+ * ( http://sourceforge.net/projects/sispmctl ) sold for some time. Because this
+ * project mimics the original device, it can be controlled using the "sismpctl"
+ * package included in many Linux distributions - including router-orientated
+ * versions such as OpenWRT - to control the board's relays.
+ *
+ * Relays 1 to 4 are respectively wired to pins C4, C5, C6 and C7 of the Teensy++ V2,
+ * which are the PORTC bits 4 to 7 of the AT90USB1286. The relays MUST be wired through
+ * a transistor, and a diode must be added on the relay's contact pins to protect
+ * the transistor from back EMF generated from the relay when the coil is turned off.
+ * The transistor base pin is wired to the Teensy data port through a 10K resistor. A
+ * LED may be also be added as a relay status indicator on each channel.
+ *
+ * The Relay coil will be driven by the transistor, but the power will come from
+ * the 5V from the PC's USB port: Be careful in choosing the relay to avoid overloading
+ * the PC, as the maximum current used MUST remains under ~450mA @ 5V.
+ *
+ * The author's tested relays are 2 Finder 32.21.7.005.2000, coil il 125ohm, which can
+ * handle 5A @ 250VAC. Be careful to use proper isolation if high voltages are manipulated.
+ * The author used Hotglue to isolate all parts of the PCB in contact with high voltage.
+ *
+ * See <a>http://www.pjrc.com/teensy/</a> for the Teensy2++ website.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Signal:</b></td>
+ * <td><b>AVR Port:</b></td>
+ * </tr>
+ * <tr>
+ * <td>Relay 1</td>
+ * <td>PORTC, Pin 4</td>
+ * </tr>
+ * <tr>
+ * <td>Relay 2</td>
+ * <td>PORTC, Pin 5</td>
+ * </tr>
+ * <tr>
+ * <td>Relay 3</td>
+ * <td>PORTC, Pin 6</td>
+ * </tr>
+ * <tr>
+ * <td>Relay 4</td>
+ * <td>PORTC, Pin 7</td>
+ * </tr>
+ * <tr>
+ * <td>Teensy2++ Yellow Led</td>
+ * <td>PORTD, pin 6</td>
+ * </tr>
+ * </table>
+ *
*/ \ No newline at end of file
diff --git a/Projects/RelayBoard/makefile b/Projects/RelayBoard/makefile
index f30f42976..ae286c61e 100644
--- a/Projects/RelayBoard/makefile
+++ b/Projects/RelayBoard/makefile
@@ -1,736 +1,736 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1286
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = TEENSY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 16000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = RelayBoard
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../..
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D CONTROL_ONLY_DEVICE
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -ffunction-sections
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1286
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = TEENSY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = RelayBoard
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../..
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D CONTROL_ONLY_DEVICE
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -ffunction-sections
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/TemperatureDataLogger/Descriptors.c b/Projects/TemperatureDataLogger/Descriptors.c
index 48778d8c5..8f409a63d 100644
--- a/Projects/TemperatureDataLogger/Descriptors.c
+++ b/Projects/TemperatureDataLogger/Descriptors.c
@@ -1,288 +1,288 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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"
-
-/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
- * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
- * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
- * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
- * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
- * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
- * port location).
- */
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
-/** HID class report descriptor. This is a special descriptor constructed with values from the
- * USBIF HID class specification to describe the reports and capabilities of the HID device. This
- * descriptor is parsed by the host and its contents used to determine what data (and in what encoding)
- * the device will send, and what it may be sent back from the host. Refer to the HID specification for
- * more details on HID report descriptors.
- */
-USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =
-{
- 0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
- 0x09, 0x01, /* Usage (Vendor Defined) */
- 0xa1, 0x01, /* Collection (Vendor Defined) */
- 0x09, 0x02, /* Usage (Vendor Defined) */
- 0x75, 0x08, /* Report Size (8) */
- 0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */
- 0x15, 0x80, /* Logical Minimum (-128) */
- 0x25, 0x7F, /* Logical Maximum (127) */
- 0x81, 0x02, /* Input (Data, Variable, Absolute) */
- 0x09, 0x03, /* Usage (Vendor Defined) */
- 0x75, 0x08, /* Report Size (8) */
- 0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */
- 0x15, 0x00, /* Logical Minimum (0) */
- 0x25, 0xff, /* Logical Maximum (255) */
- 0x91, 0x02, /* Output (Data, Variable, Absolute) */
- 0xc0 /* End Collection */
-};
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x00,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2063,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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_BUSPOWERED,
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .MS_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x08,
- .SubClass = 0x06,
- .Protocol = 0x50,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .MS_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MASS_STORAGE_IO_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .MS_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MASS_STORAGE_IO_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .HID_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 1,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 1,
-
- .Class = 0x03,
- .SubClass = 0x00,
- .Protocol = HID_NON_BOOT_PROTOCOL,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .HID_GenericHID =
- {
- .Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
-
- .HIDSpec = VERSION_BCD(01.11),
- .CountryCode = 0x00,
- .TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
- .HIDReportLength = sizeof(GenericReport)
- },
-
- .HID_ReportINEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | GENERIC_IN_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = GENERIC_EPSIZE,
- .PollingIntervalMS = 0x0A
- },
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},
-
- .UnicodeString = L"Datalogger"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- case DTYPE_HID:
- Address = (void*)&ConfigurationDescriptor.HID_GenericHID;
- Size = sizeof(USB_HID_Descriptor_t);
- break;
- case DTYPE_Report:
- Address = (void*)&GenericReport;
- Size = sizeof(GenericReport);
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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"
+
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
+/** HID class report descriptor. This is a special descriptor constructed with values from the
+ * USBIF HID class specification to describe the reports and capabilities of the HID device. This
+ * descriptor is parsed by the host and its contents used to determine what data (and in what encoding)
+ * the device will send, and what it may be sent back from the host. Refer to the HID specification for
+ * more details on HID report descriptors.
+ */
+USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =
+{
+ 0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
+ 0x09, 0x01, /* Usage (Vendor Defined) */
+ 0xa1, 0x01, /* Collection (Vendor Defined) */
+ 0x09, 0x02, /* Usage (Vendor Defined) */
+ 0x75, 0x08, /* Report Size (8) */
+ 0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */
+ 0x15, 0x80, /* Logical Minimum (-128) */
+ 0x25, 0x7F, /* Logical Maximum (127) */
+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */
+ 0x09, 0x03, /* Usage (Vendor Defined) */
+ 0x75, 0x08, /* Report Size (8) */
+ 0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */
+ 0x15, 0x00, /* Logical Minimum (0) */
+ 0x25, 0xff, /* Logical Maximum (255) */
+ 0x91, 0x02, /* Output (Data, Variable, Absolute) */
+ 0xc0 /* End Collection */
+};
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x00,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2063,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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_BUSPOWERED,
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .MS_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x08,
+ .SubClass = 0x06,
+ .Protocol = 0x50,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .MS_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .MS_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .HID_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 1,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 1,
+
+ .Class = 0x03,
+ .SubClass = 0x00,
+ .Protocol = HID_NON_BOOT_PROTOCOL,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .HID_GenericHID =
+ {
+ .Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
+
+ .HIDSpec = VERSION_BCD(01.11),
+ .CountryCode = 0x00,
+ .TotalReportDescriptors = 1,
+ .HIDReportType = DTYPE_Report,
+ .HIDReportLength = sizeof(GenericReport)
+ },
+
+ .HID_ReportINEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | GENERIC_IN_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = GENERIC_EPSIZE,
+ .PollingIntervalMS = 0x0A
+ },
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},
+
+ .UnicodeString = L"Datalogger"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ case DTYPE_HID:
+ Address = (void*)&ConfigurationDescriptor.HID_GenericHID;
+ Size = sizeof(USB_HID_Descriptor_t);
+ break;
+ case DTYPE_Report:
+ Address = (void*)&GenericReport;
+ Size = sizeof(GenericReport);
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/TemperatureDataLogger/Descriptors.h b/Projects/TemperatureDataLogger/Descriptors.h
index 6c238ac42..a2ab5852e 100644
--- a/Projects/TemperatureDataLogger/Descriptors.h
+++ b/Projects/TemperatureDataLogger/Descriptors.h
@@ -1,60 +1,60 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
-
- #include "TempDataLogger.h"
-
- /* Macros: */
- /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
-
- /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
-
- /** Size in bytes of the Mass Storage data endpoints. */
- #define MASS_STORAGE_IO_EPSIZE 64
-
- /** Endpoint number of the Generic HID reporting IN endpoint. */
- #define GENERIC_IN_EPNUM 1
-
- /** Size in bytes of the Generic HID reporting endpoint. */
- #define GENERIC_EPSIZE 16
-
- /** Size in bytes of the Generic HID reports (including report ID byte). */
- #define GENERIC_REPORT_SIZE sizeof(Device_Report_t)
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t MS_Interface;
- USB_Descriptor_Endpoint_t MS_DataInEndpoint;
- USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
- USB_Descriptor_Interface_t HID_Interface;
- USB_HID_Descriptor_t HID_GenericHID;
- USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+ #include <LUFA/Drivers/USB/Class/HID.h>
+
+ #include "TempDataLogger.h"
+
+ /* Macros: */
+ /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
+ #define MASS_STORAGE_IN_EPNUM 3
+
+ /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
+ #define MASS_STORAGE_OUT_EPNUM 4
+
+ /** Size in bytes of the Mass Storage data endpoints. */
+ #define MASS_STORAGE_IO_EPSIZE 64
+
+ /** Endpoint number of the Generic HID reporting IN endpoint. */
+ #define GENERIC_IN_EPNUM 1
+
+ /** Size in bytes of the Generic HID reporting endpoint. */
+ #define GENERIC_EPSIZE 16
+
+ /** Size in bytes of the Generic HID reports (including report ID byte). */
+ #define GENERIC_REPORT_SIZE sizeof(Device_Report_t)
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t MS_Interface;
+ USB_Descriptor_Endpoint_t MS_DataInEndpoint;
+ USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
+ USB_Descriptor_Interface_t HID_Interface;
+ USB_HID_Descriptor_t HID_GenericHID;
+ USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/TemperatureDataLogger/Doxygen.conf b/Projects/TemperatureDataLogger/Doxygen.conf
index 1430ad516..d570077b6 100644
--- a/Projects/TemperatureDataLogger/Doxygen.conf
+++ b/Projects/TemperatureDataLogger/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "Temperature Datalogger Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/ TempLogHostApp/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Temperature Datalogger Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/ TempLogHostApp/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/TemperatureDataLogger/Lib/DS1307.c b/Projects/TemperatureDataLogger/Lib/DS1307.c
index 0c1d98f00..8aa6ad0ef 100644
--- a/Projects/TemperatureDataLogger/Lib/DS1307.c
+++ b/Projects/TemperatureDataLogger/Lib/DS1307.c
@@ -1,124 +1,124 @@
-/*
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-#include "DS1307.h"
-
-void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year)
-{
-#if defined(DUMMY_RTC)
- return;
-#endif
-
- DS1307_DateRegs_t CurrentRTCDate;
- CurrentRTCDate.Byte1.TenDay = (Day / 10);
- CurrentRTCDate.Byte1.Day = (Day % 10);
- CurrentRTCDate.Byte2.TenMonth = (Month / 10);
- CurrentRTCDate.Byte2.Month = (Month % 10);
- CurrentRTCDate.Byte3.TenYear = (Year / 10);
- CurrentRTCDate.Byte3.Year = (Year % 10);
-
- if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
- {
- TWI_SendByte(DS1307_DATEREG_START);
- TWI_SendByte(CurrentRTCDate.Byte1.IntVal);
- TWI_SendByte(CurrentRTCDate.Byte2.IntVal);
- TWI_SendByte(CurrentRTCDate.Byte3.IntVal);
-
- TWI_StopTransmission();
- }
-}
-
-void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second)
-{
-#if defined(DUMMY_RTC)
- return;
-#endif
-
- DS1307_TimeRegs_t CurrentRTCTime;
- CurrentRTCTime.Byte1.TenSec = (Second / 10);
- CurrentRTCTime.Byte1.Sec = (Second % 10);
- CurrentRTCTime.Byte1.CH = false;
- CurrentRTCTime.Byte2.TenMin = (Minute / 10);
- CurrentRTCTime.Byte2.Min = (Minute % 10);
- CurrentRTCTime.Byte3.TenHour = (Hour / 10);
- CurrentRTCTime.Byte3.Hour = (Hour % 10);
- CurrentRTCTime.Byte3.TwelveHourMode = false;
-
- if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
- {
- TWI_SendByte(DS1307_TIMEREG_START);
- TWI_SendByte(CurrentRTCTime.Byte1.IntVal);
- TWI_SendByte(CurrentRTCTime.Byte2.IntVal);
- TWI_SendByte(CurrentRTCTime.Byte3.IntVal);
-
- TWI_StopTransmission();
- }
-}
-
-void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year)
-{
-#if defined(DUMMY_RTC)
- *Day = 1;
- *Month = 1;
- *Year = 1;
- return;
-#endif
-
- if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
- {
- TWI_SendByte(DS1307_DATEREG_START);
-
- TWI_StopTransmission();
- }
-
- DS1307_DateRegs_t CurrentRTCDate;
-
- if (TWI_StartTransmission(DS1307_ADDRESS_READ, 10))
- {
- TWI_ReceiveByte(&CurrentRTCDate.Byte1.IntVal, false);
- TWI_ReceiveByte(&CurrentRTCDate.Byte2.IntVal, false);
- TWI_ReceiveByte(&CurrentRTCDate.Byte3.IntVal, true);
-
- TWI_StopTransmission();
- }
-
- *Day = (CurrentRTCDate.Byte1.TenDay * 10) + CurrentRTCDate.Byte1.Day;
- *Month = (CurrentRTCDate.Byte2.TenMonth * 10) + CurrentRTCDate.Byte2.Month;
- *Year = (CurrentRTCDate.Byte3.TenYear * 10) + CurrentRTCDate.Byte3.Year;
-}
-
-void DS1307_GetTime(uint8_t* Hour, uint8_t* Minute, uint8_t* Second)
-{
-#if defined(DUMMY_RTC)
- *Hour = 1;
- *Minute = 1;
- *Second = 1;
- return;
-#endif
-
- if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
- {
- TWI_SendByte(DS1307_TIMEREG_START);
-
- TWI_StopTransmission();
- }
-
- DS1307_TimeRegs_t CurrentRTCTime;
-
- if (TWI_StartTransmission(DS1307_ADDRESS_READ, 10))
- {
- TWI_ReceiveByte(&CurrentRTCTime.Byte1.IntVal, false);
- TWI_ReceiveByte(&CurrentRTCTime.Byte2.IntVal, false);
- TWI_ReceiveByte(&CurrentRTCTime.Byte3.IntVal, true);
-
- TWI_StopTransmission();
- }
-
- *Second = (CurrentRTCTime.Byte1.TenSec * 10) + CurrentRTCTime.Byte1.Sec;
- *Minute = (CurrentRTCTime.Byte2.TenMin * 10) + CurrentRTCTime.Byte2.Min;
- *Hour = (CurrentRTCTime.Byte3.TenHour * 10) + CurrentRTCTime.Byte3.Hour;
-}
+/*
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+#include "DS1307.h"
+
+void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year)
+{
+#if defined(DUMMY_RTC)
+ return;
+#endif
+
+ DS1307_DateRegs_t CurrentRTCDate;
+ CurrentRTCDate.Byte1.TenDay = (Day / 10);
+ CurrentRTCDate.Byte1.Day = (Day % 10);
+ CurrentRTCDate.Byte2.TenMonth = (Month / 10);
+ CurrentRTCDate.Byte2.Month = (Month % 10);
+ CurrentRTCDate.Byte3.TenYear = (Year / 10);
+ CurrentRTCDate.Byte3.Year = (Year % 10);
+
+ if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
+ {
+ TWI_SendByte(DS1307_DATEREG_START);
+ TWI_SendByte(CurrentRTCDate.Byte1.IntVal);
+ TWI_SendByte(CurrentRTCDate.Byte2.IntVal);
+ TWI_SendByte(CurrentRTCDate.Byte3.IntVal);
+
+ TWI_StopTransmission();
+ }
+}
+
+void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second)
+{
+#if defined(DUMMY_RTC)
+ return;
+#endif
+
+ DS1307_TimeRegs_t CurrentRTCTime;
+ CurrentRTCTime.Byte1.TenSec = (Second / 10);
+ CurrentRTCTime.Byte1.Sec = (Second % 10);
+ CurrentRTCTime.Byte1.CH = false;
+ CurrentRTCTime.Byte2.TenMin = (Minute / 10);
+ CurrentRTCTime.Byte2.Min = (Minute % 10);
+ CurrentRTCTime.Byte3.TenHour = (Hour / 10);
+ CurrentRTCTime.Byte3.Hour = (Hour % 10);
+ CurrentRTCTime.Byte3.TwelveHourMode = false;
+
+ if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
+ {
+ TWI_SendByte(DS1307_TIMEREG_START);
+ TWI_SendByte(CurrentRTCTime.Byte1.IntVal);
+ TWI_SendByte(CurrentRTCTime.Byte2.IntVal);
+ TWI_SendByte(CurrentRTCTime.Byte3.IntVal);
+
+ TWI_StopTransmission();
+ }
+}
+
+void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year)
+{
+#if defined(DUMMY_RTC)
+ *Day = 1;
+ *Month = 1;
+ *Year = 1;
+ return;
+#endif
+
+ if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
+ {
+ TWI_SendByte(DS1307_DATEREG_START);
+
+ TWI_StopTransmission();
+ }
+
+ DS1307_DateRegs_t CurrentRTCDate;
+
+ if (TWI_StartTransmission(DS1307_ADDRESS_READ, 10))
+ {
+ TWI_ReceiveByte(&CurrentRTCDate.Byte1.IntVal, false);
+ TWI_ReceiveByte(&CurrentRTCDate.Byte2.IntVal, false);
+ TWI_ReceiveByte(&CurrentRTCDate.Byte3.IntVal, true);
+
+ TWI_StopTransmission();
+ }
+
+ *Day = (CurrentRTCDate.Byte1.TenDay * 10) + CurrentRTCDate.Byte1.Day;
+ *Month = (CurrentRTCDate.Byte2.TenMonth * 10) + CurrentRTCDate.Byte2.Month;
+ *Year = (CurrentRTCDate.Byte3.TenYear * 10) + CurrentRTCDate.Byte3.Year;
+}
+
+void DS1307_GetTime(uint8_t* Hour, uint8_t* Minute, uint8_t* Second)
+{
+#if defined(DUMMY_RTC)
+ *Hour = 1;
+ *Minute = 1;
+ *Second = 1;
+ return;
+#endif
+
+ if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
+ {
+ TWI_SendByte(DS1307_TIMEREG_START);
+
+ TWI_StopTransmission();
+ }
+
+ DS1307_TimeRegs_t CurrentRTCTime;
+
+ if (TWI_StartTransmission(DS1307_ADDRESS_READ, 10))
+ {
+ TWI_ReceiveByte(&CurrentRTCTime.Byte1.IntVal, false);
+ TWI_ReceiveByte(&CurrentRTCTime.Byte2.IntVal, false);
+ TWI_ReceiveByte(&CurrentRTCTime.Byte3.IntVal, true);
+
+ TWI_StopTransmission();
+ }
+
+ *Second = (CurrentRTCTime.Byte1.TenSec * 10) + CurrentRTCTime.Byte1.Sec;
+ *Minute = (CurrentRTCTime.Byte2.TenMin * 10) + CurrentRTCTime.Byte2.Min;
+ *Hour = (CurrentRTCTime.Byte3.TenHour * 10) + CurrentRTCTime.Byte3.Hour;
+}
diff --git a/Projects/TemperatureDataLogger/Lib/DS1307.h b/Projects/TemperatureDataLogger/Lib/DS1307.h
index 90b91e3e8..9b14ee467 100644
--- a/Projects/TemperatureDataLogger/Lib/DS1307.h
+++ b/Projects/TemperatureDataLogger/Lib/DS1307.h
@@ -1,109 +1,109 @@
-/*
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-#ifndef _DS1307_H_
-#define _DS1307_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include <LUFA/Drivers/Peripheral/TWI.h>
-
- /* Type Defines: */
- typedef struct
- {
- union
- {
- struct
- {
- unsigned int Sec : 4;
- unsigned int TenSec : 3;
- unsigned int CH : 1;
- };
-
- uint8_t IntVal;
- } Byte1;
-
- union
- {
- struct
- {
- unsigned int Min : 4;
- unsigned int TenMin : 3;
- unsigned int _RESERVED : 1;
- };
-
- uint8_t IntVal;
- } Byte2;
-
- union
- {
- struct
- {
- unsigned int Hour : 4;
- unsigned int TenHour : 2;
- unsigned int TwelveHourMode : 1;
- unsigned int _RESERVED : 1;
- };
-
- uint8_t IntVal;
- } Byte3;
- } DS1307_TimeRegs_t;
-
- typedef struct
- {
- union
- {
- struct
- {
- unsigned int Day : 4;
- unsigned int TenDay : 2;
- unsigned int _RESERVED : 2;
- };
-
- uint8_t IntVal;
- } Byte1;
-
- union
- {
- struct
- {
- unsigned int Month : 4;
- unsigned int TenMonth : 1;
- unsigned int _RESERVED : 3;
- };
-
- uint8_t IntVal;
- } Byte2;
-
- union
- {
- struct
- {
- unsigned int Year : 4;
- unsigned int TenYear : 4;
- };
-
- uint8_t IntVal;
- } Byte3;
- } DS1307_DateRegs_t;
-
- /* Macros: */
- #define DS1307_TIMEREG_START 0x00
- #define DS1307_DATEREG_START 0x04
-
- #define DS1307_ADDRESS_READ 0b11010001
- #define DS1307_ADDRESS_WRITE 0b11010000
-
- /* Function Prototypes: */
- void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year);
- void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second);
-
- void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year);
- void DS1307_GetTime(uint8_t* Hour, uint8_t* Minute, uint8_t* Second);
-
-#endif
+/*
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+#ifndef _DS1307_H_
+#define _DS1307_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include <LUFA/Drivers/Peripheral/TWI.h>
+
+ /* Type Defines: */
+ typedef struct
+ {
+ union
+ {
+ struct
+ {
+ unsigned int Sec : 4;
+ unsigned int TenSec : 3;
+ unsigned int CH : 1;
+ };
+
+ uint8_t IntVal;
+ } Byte1;
+
+ union
+ {
+ struct
+ {
+ unsigned int Min : 4;
+ unsigned int TenMin : 3;
+ unsigned int _RESERVED : 1;
+ };
+
+ uint8_t IntVal;
+ } Byte2;
+
+ union
+ {
+ struct
+ {
+ unsigned int Hour : 4;
+ unsigned int TenHour : 2;
+ unsigned int TwelveHourMode : 1;
+ unsigned int _RESERVED : 1;
+ };
+
+ uint8_t IntVal;
+ } Byte3;
+ } DS1307_TimeRegs_t;
+
+ typedef struct
+ {
+ union
+ {
+ struct
+ {
+ unsigned int Day : 4;
+ unsigned int TenDay : 2;
+ unsigned int _RESERVED : 2;
+ };
+
+ uint8_t IntVal;
+ } Byte1;
+
+ union
+ {
+ struct
+ {
+ unsigned int Month : 4;
+ unsigned int TenMonth : 1;
+ unsigned int _RESERVED : 3;
+ };
+
+ uint8_t IntVal;
+ } Byte2;
+
+ union
+ {
+ struct
+ {
+ unsigned int Year : 4;
+ unsigned int TenYear : 4;
+ };
+
+ uint8_t IntVal;
+ } Byte3;
+ } DS1307_DateRegs_t;
+
+ /* Macros: */
+ #define DS1307_TIMEREG_START 0x00
+ #define DS1307_DATEREG_START 0x04
+
+ #define DS1307_ADDRESS_READ 0b11010001
+ #define DS1307_ADDRESS_WRITE 0b11010000
+
+ /* Function Prototypes: */
+ void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year);
+ void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second);
+
+ void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year);
+ void DS1307_GetTime(uint8_t* Hour, uint8_t* Minute, uint8_t* Second);
+
+#endif
diff --git a/Projects/TemperatureDataLogger/Lib/DataflashManager.c b/Projects/TemperatureDataLogger/Lib/DataflashManager.c
index da57e7f49..48c4fa7e6 100644
--- a/Projects/TemperatureDataLogger/Lib/DataflashManager.c
+++ b/Projects/TemperatureDataLogger/Lib/DataflashManager.c
@@ -1,525 +1,525 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Functions to manage the physical dataflash media, including reading and writing of
- * blocks of data. These functions are called by the SCSI layer when data must be stored
- * or retrieved to/from the physical storage media. If a different media is used (such
- * as a SD card or EEPROM), functions similar to these will need to be generated.
- */
-
-#define INCLUDE_FROM_DATAFLASHMANAGER_C
-#include "DataflashManager.h"
-
-/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
- * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes
- * them to the dataflash in Dataflash page sized blocks.
- *
- * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
- * \param[in] BlockAddress Data block starting address for the write sequence
- * \param[in] TotalBlocks Number of blocks of data to write
- */
-void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- bool UsingSecondBuffer = false;
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
- /* Wait until endpoint is ready before continuing */
- if (Endpoint_WaitUntilReady())
- return;
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if the endpoint is currently empty */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the current endpoint bank */
- Endpoint_ClearOUT();
-
- /* Wait until the host has sent another packet */
- if (Endpoint_WaitUntilReady())
- return;
- }
-
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
-
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
- if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
- UsingSecondBuffer = !(UsingSecondBuffer);
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
- if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
- }
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
- }
-
- /* Write one 16-byte chunk of data to the dataflash */
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
-
- /* Check if the current command is being aborted by the host */
- if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
- }
-
- /* Decrement the blocks remaining counter and reset the sub block counter */
- TotalBlocks--;
- }
-
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0x00);
- Dataflash_WaitWhileBusy();
-
- /* If the endpoint is empty, clear it ready for the next packet from the host */
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearOUT();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
- * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash
- * and writes them in OS sized blocks to the endpoint.
- *
- * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
- * \param[in] BlockAddress Data block starting address for the read sequence
- * \param[in] TotalBlocks Number of blocks of data to read
- */
-void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
-
- /* Wait until endpoint is ready before continuing */
- if (Endpoint_WaitUntilReady())
- return;
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if the endpoint is currently full */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the endpoint bank to send its contents to the host */
- Endpoint_ClearIN();
-
- /* Wait until the endpoint is ready for more data */
- if (Endpoint_WaitUntilReady())
- return;
- }
-
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- }
-
- /* Read one 16-byte chunk of data from the dataflash */
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
-
- /* Check if the current command is being aborted by the host */
- if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
- }
-
- /* Decrement the blocks remaining counter */
- TotalBlocks--;
- }
-
- /* If the endpoint is full, send its contents to the host */
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearIN();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
- * the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the
- * dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the
- * dataflash.
- *
- * \param[in] BlockAddress Data block starting address for the write sequence
- * \param[in] TotalBlocks Number of blocks of data to write
- * \param[in] BufferPtr Pointer to the data source RAM buffer
- */
-void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- bool UsingSecondBuffer = false;
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
-
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
- if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
- UsingSecondBuffer = !(UsingSecondBuffer);
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
- if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
- }
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_ToggleSelectedChipCS();
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
- }
-
- /* Write one 16-byte chunk of data to the dataflash */
- for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
- Dataflash_SendByte(*(BufferPtr++));
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
- }
-
- /* Decrement the blocks remaining counter and reset the sub block counter */
- TotalBlocks--;
- }
-
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0x00);
- Dataflash_WaitWhileBusy();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
- * the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash
- * and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read
- * the files stored on the dataflash.
- *
- * \param[in] BlockAddress Data block starting address for the read sequence
- * \param[in] TotalBlocks Number of blocks of data to read
- * \param[out] BufferPtr Pointer to the data destination RAM buffer
- */
-void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- }
-
- /* Read one 16-byte chunk of data from the dataflash */
- for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
- *(BufferPtr++) = Dataflash_ReceiveByte();
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
- }
-
- /* Decrement the blocks remaining counter */
- TotalBlocks--;
- }
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */
-void DataflashManager_ResetDataflashProtections(void)
-{
- /* Select first dataflash chip, send the read status register command */
- Dataflash_SelectChip(DATAFLASH_CHIP1);
- Dataflash_SendByte(DF_CMD_GETSTATUS);
-
- /* Check if sector protection is enabled */
- if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
- {
- Dataflash_ToggleSelectedChipCS();
-
- /* Send the commands to disable sector protection */
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
- }
-
- /* Select second dataflash chip (if present on selected board), send read status register command */
- #if (DATAFLASH_TOTALCHIPS == 2)
- Dataflash_SelectChip(DATAFLASH_CHIP2);
- Dataflash_SendByte(DF_CMD_GETSTATUS);
-
- /* Check if sector protection is enabled */
- if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
- {
- Dataflash_ToggleSelectedChipCS();
-
- /* Send the commands to disable sector protection */
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
- }
- #endif
-
- /* Deselect current dataflash chip */
- Dataflash_DeselectChip();
-}
-
-/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
- *
- * \return Boolean true if all media chips are working, false otherwise
- */
-bool DataflashManager_CheckDataflashOperation(void)
-{
- uint8_t ReturnByte;
-
- /* Test first Dataflash IC is present and responding to commands */
- Dataflash_SelectChip(DATAFLASH_CHIP1);
- Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
- ReturnByte = Dataflash_ReceiveByte();
- Dataflash_DeselectChip();
-
- /* If returned data is invalid, fail the command */
- if (ReturnByte != DF_MANUFACTURER_ATMEL)
- return false;
-
- #if (DATAFLASH_TOTALCHIPS == 2)
- /* Test second Dataflash IC is present and responding to commands */
- Dataflash_SelectChip(DATAFLASH_CHIP2);
- Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
- ReturnByte = Dataflash_ReceiveByte();
- Dataflash_DeselectChip();
-
- /* If returned data is invalid, fail the command */
- if (ReturnByte != DF_MANUFACTURER_ATMEL)
- return false;
- #endif
-
- return true;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Functions to manage the physical dataflash media, including reading and writing of
+ * blocks of data. These functions are called by the SCSI layer when data must be stored
+ * or retrieved to/from the physical storage media. If a different media is used (such
+ * as a SD card or EEPROM), functions similar to these will need to be generated.
+ */
+
+#define INCLUDE_FROM_DATAFLASHMANAGER_C
+#include "DataflashManager.h"
+
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
+ * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes
+ * them to the dataflash in Dataflash page sized blocks.
+ *
+ * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
+ * \param[in] BlockAddress Data block starting address for the write sequence
+ * \param[in] TotalBlocks Number of blocks of data to write
+ */
+void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+ bool UsingSecondBuffer = false;
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, CurrDFPageByte);
+
+ /* Wait until endpoint is ready before continuing */
+ if (Endpoint_WaitUntilReady())
+ return;
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if the endpoint is currently empty */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the current endpoint bank */
+ Endpoint_ClearOUT();
+
+ /* Wait until the host has sent another packet */
+ if (Endpoint_WaitUntilReady())
+ return;
+ }
+
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
+ if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
+ UsingSecondBuffer = !(UsingSecondBuffer);
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
+ if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+ }
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, 0);
+ }
+
+ /* Write one 16-byte chunk of data to the dataflash */
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+
+ /* Check if the current command is being aborted by the host */
+ if (MSInterfaceInfo->State.IsMassStoreReset)
+ return;
+ }
+
+ /* Decrement the blocks remaining counter and reset the sub block counter */
+ TotalBlocks--;
+ }
+
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0x00);
+ Dataflash_WaitWhileBusy();
+
+ /* If the endpoint is empty, clear it ready for the next packet from the host */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearOUT();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
+ * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash
+ * and writes them in OS sized blocks to the endpoint.
+ *
+ * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
+ * \param[in] BlockAddress Data block starting address for the read sequence
+ * \param[in] TotalBlocks Number of blocks of data to read
+ */
+void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+
+ /* Wait until endpoint is ready before continuing */
+ if (Endpoint_WaitUntilReady())
+ return;
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if the endpoint is currently full */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the endpoint bank to send its contents to the host */
+ Endpoint_ClearIN();
+
+ /* Wait until the endpoint is ready for more data */
+ if (Endpoint_WaitUntilReady())
+ return;
+ }
+
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ }
+
+ /* Read one 16-byte chunk of data from the dataflash */
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+
+ /* Check if the current command is being aborted by the host */
+ if (MSInterfaceInfo->State.IsMassStoreReset)
+ return;
+ }
+
+ /* Decrement the blocks remaining counter */
+ TotalBlocks--;
+ }
+
+ /* If the endpoint is full, send its contents to the host */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearIN();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
+ * the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the
+ * dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the
+ * dataflash.
+ *
+ * \param[in] BlockAddress Data block starting address for the write sequence
+ * \param[in] TotalBlocks Number of blocks of data to write
+ * \param[in] BufferPtr Pointer to the data source RAM buffer
+ */
+void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+ bool UsingSecondBuffer = false;
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, CurrDFPageByte);
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
+ if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
+ UsingSecondBuffer = !(UsingSecondBuffer);
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
+ if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+ }
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_ToggleSelectedChipCS();
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, 0);
+ }
+
+ /* Write one 16-byte chunk of data to the dataflash */
+ for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
+ Dataflash_SendByte(*(BufferPtr++));
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+ }
+
+ /* Decrement the blocks remaining counter and reset the sub block counter */
+ TotalBlocks--;
+ }
+
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0x00);
+ Dataflash_WaitWhileBusy();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
+ * the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash
+ * and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read
+ * the files stored on the dataflash.
+ *
+ * \param[in] BlockAddress Data block starting address for the read sequence
+ * \param[in] TotalBlocks Number of blocks of data to read
+ * \param[out] BufferPtr Pointer to the data destination RAM buffer
+ */
+void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ }
+
+ /* Read one 16-byte chunk of data from the dataflash */
+ for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
+ *(BufferPtr++) = Dataflash_ReceiveByte();
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+ }
+
+ /* Decrement the blocks remaining counter */
+ TotalBlocks--;
+ }
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */
+void DataflashManager_ResetDataflashProtections(void)
+{
+ /* Select first dataflash chip, send the read status register command */
+ Dataflash_SelectChip(DATAFLASH_CHIP1);
+ Dataflash_SendByte(DF_CMD_GETSTATUS);
+
+ /* Check if sector protection is enabled */
+ if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
+ {
+ Dataflash_ToggleSelectedChipCS();
+
+ /* Send the commands to disable sector protection */
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
+ }
+
+ /* Select second dataflash chip (if present on selected board), send read status register command */
+ #if (DATAFLASH_TOTALCHIPS == 2)
+ Dataflash_SelectChip(DATAFLASH_CHIP2);
+ Dataflash_SendByte(DF_CMD_GETSTATUS);
+
+ /* Check if sector protection is enabled */
+ if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
+ {
+ Dataflash_ToggleSelectedChipCS();
+
+ /* Send the commands to disable sector protection */
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
+ }
+ #endif
+
+ /* Deselect current dataflash chip */
+ Dataflash_DeselectChip();
+}
+
+/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
+ *
+ * \return Boolean true if all media chips are working, false otherwise
+ */
+bool DataflashManager_CheckDataflashOperation(void)
+{
+ uint8_t ReturnByte;
+
+ /* Test first Dataflash IC is present and responding to commands */
+ Dataflash_SelectChip(DATAFLASH_CHIP1);
+ Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
+ ReturnByte = Dataflash_ReceiveByte();
+ Dataflash_DeselectChip();
+
+ /* If returned data is invalid, fail the command */
+ if (ReturnByte != DF_MANUFACTURER_ATMEL)
+ return false;
+
+ #if (DATAFLASH_TOTALCHIPS == 2)
+ /* Test second Dataflash IC is present and responding to commands */
+ Dataflash_SelectChip(DATAFLASH_CHIP2);
+ Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
+ ReturnByte = Dataflash_ReceiveByte();
+ Dataflash_DeselectChip();
+
+ /* If returned data is invalid, fail the command */
+ if (ReturnByte != DF_MANUFACTURER_ATMEL)
+ return false;
+ #endif
+
+ return true;
+}
diff --git a/Projects/TemperatureDataLogger/Lib/DataflashManager.h b/Projects/TemperatureDataLogger/Lib/DataflashManager.h
index 2b855dc8a..3c75c4c75 100644
--- a/Projects/TemperatureDataLogger/Lib/DataflashManager.h
+++ b/Projects/TemperatureDataLogger/Lib/DataflashManager.h
@@ -1,81 +1,81 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 DataflashManager.c.
- */
-
-#ifndef _DATAFLASH_MANAGER_H_
-#define _DATAFLASH_MANAGER_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include "TempDataLogger.h"
- #include "Descriptors.h"
-
- #include <LUFA/Common/Common.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/Board/Dataflash.h>
-
- /* Preprocessor Checks: */
- #if (DATAFLASH_PAGE_SIZE % 16)
- #error Dataflash page size must be a multiple of 16 bytes.
- #endif
-
- /* Defines: */
- /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */
- #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
-
- /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
- * storage media (Dataflash) using a different native block size. Do not change this value.
- */
- #define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
- * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
- */
- #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
- /* Function Prototypes: */
- void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
- uint16_t TotalBlocks);
- void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
- uint16_t TotalBlocks);
- void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
- const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
- void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
- uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
- void DataflashManager_ResetDataflashProtections(void);
- bool DataflashManager_CheckDataflashOperation(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 DataflashManager.c.
+ */
+
+#ifndef _DATAFLASH_MANAGER_H_
+#define _DATAFLASH_MANAGER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include "TempDataLogger.h"
+ #include "Descriptors.h"
+
+ #include <LUFA/Common/Common.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+ #include <LUFA/Drivers/Board/Dataflash.h>
+
+ /* Preprocessor Checks: */
+ #if (DATAFLASH_PAGE_SIZE % 16)
+ #error Dataflash page size must be a multiple of 16 bytes.
+ #endif
+
+ /* Defines: */
+ /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */
+ #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
+
+ /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
+ * storage media (Dataflash) using a different native block size. Do not change this value.
+ */
+ #define VIRTUAL_MEMORY_BLOCK_SIZE 512
+
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
+ */
+ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
+
+ /* Function Prototypes: */
+ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
+ uint16_t TotalBlocks);
+ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
+ uint16_t TotalBlocks);
+ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
+ const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
+ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
+ uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
+ void DataflashManager_ResetDataflashProtections(void);
+ bool DataflashManager_CheckDataflashOperation(void);
+
+#endif
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/00readme.txt b/Projects/TemperatureDataLogger/Lib/FATFs/00readme.txt
index 295be3b9a..eb378c51e 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/00readme.txt
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/00readme.txt
@@ -1,110 +1,110 @@
-FatFs Module Source Files R0.07e (C)ChaN, 2010
-
-
-FILES
-
- ffconf.h Configuration file for FatFs module.
- ff.h Common include file for FatFs and application module.
- ff.c FatFs module.
- diskio.h Common include file for FatFs and disk I/O module.
- diskio.c Skeleton of low level disk I/O module.
- integer.h Alternative type definitions for integer variables.
- option Optional external functions.
-
- Low level disk I/O module is not included in this archive because the FatFs
- module is only a generic file system layer and not depend on any specific
- storage device. You have to provide a low level disk I/O module that written
- to control your storage device.
-
-
-
-AGREEMENTS
-
- FatFs module is an open source software to implement FAT file system to
- small embedded systems. This is a free software and is opened for education,
- research and commercial developments under license policy of following trems.
-
- Copyright (C) 2010, ChaN, all right reserved.
-
- * The FatFs module is a free software and there is NO WARRANTY.
- * No restriction on use. You can use, modify and redistribute it for
- personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
- * Redistributions of source code must retain the above copyright notice.
-
-
-
-REVISION HISTORY
-
- Feb 26, 2006 R0.00 Prototype
-
- Apr 29, 2006 R0.01 First release.
-
- Jun 01, 2006 R0.02 Added FAT12.
- Removed unbuffered mode.
- Fixed a problem on small (<32M) patition.
-
- Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
-
- Sep 22, 2006 R0.03 Added f_rename.
- Changed option _FS_MINIMUM to _FS_MINIMIZE.
-
- Dec 11, 2006 R0.03a Improved cluster scan algolithm to write files fast.
- Fixed f_mkdir creates incorrect directory on FAT32.
-
- Feb 04, 2007 R0.04 Supported multiple drive system. (FatFs)
- Changed some APIs for multiple drive system.
- Added f_mkfs. (FatFs)
- Added _USE_FAT32 option. (Tiny-FatFs)
-
- Apr 01, 2007 R0.04a Supported multiple partitions on a plysical drive. (FatFs)
- Fixed an endian sensitive code in f_mkfs. (FatFs)
- Added a capability of extending the file size to f_lseek.
- Added minimization level 3.
- Fixed a problem that can collapse a sector when recreate an
- existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)
-
- May 05, 2007 R0.04b Added _USE_NTFLAG option.
- Added FSInfo support.
- Fixed some problems corresponds to FAT32. (Tiny-FatFs)
- Fixed DBCS name can result FR_INVALID_NAME.
- Fixed short seek (0 < ofs <= csize) collapses the file object.
-
- Aug 25, 2007 R0.05 Changed arguments of f_read, f_write.
- Changed arguments of f_mkfs. (FatFs)
- Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)
- Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)
-
- Feb 03, 2008 R0.05a Added f_truncate().
- Added f_utime().
- Fixed off by one error at FAT sub-type determination.
- Fixed btr in f_read() can be mistruncated.
- Fixed cached sector is not flushed when create and close without write.
-
- Apr 01, 2008 R0.06 Added f_forward(). (Tiny-FatFs)
- Added string functions: fputc(), fputs(), fprintf() and fgets().
- Improved performance of f_lseek() on move to the same or following cluster.
-
- Apr 01, 2010, R0.07 Merged Tiny-FatFs as a buffer configuration option.
- Added long file name support.
- Added multiple code page support.
- Added re-entrancy for multitask operation.
- Added auto cluster size selection to f_mkfs().
- Added rewind option to f_readdir().
- Changed result code of critical errors.
- Renamed string functions to avoid name collision.
-
- Apr 14, 2010, R0.07a Separated out OS dependent code on reentrant cfg.
- Added multiple sector size support.
-
- Jun 21, 2010, R0.07c Fixed f_unlink() may return FR_OK on error.
- Fixed wrong cache control in f_lseek().
- Added relative path feature.
- Added f_chdir().
- Added f_chdrive().
- Added proper case conversion for extended characters.
-
- Nov 03,'2010 R0.07e Separated out configuration options from ff.h to ffconf.h.
- Added a configuration option, _LFN_UNICODE.
- Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
- Fixed name matching error on the 13 char boundary.
- Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
+FatFs Module Source Files R0.07e (C)ChaN, 2010
+
+
+FILES
+
+ ffconf.h Configuration file for FatFs module.
+ ff.h Common include file for FatFs and application module.
+ ff.c FatFs module.
+ diskio.h Common include file for FatFs and disk I/O module.
+ diskio.c Skeleton of low level disk I/O module.
+ integer.h Alternative type definitions for integer variables.
+ option Optional external functions.
+
+ Low level disk I/O module is not included in this archive because the FatFs
+ module is only a generic file system layer and not depend on any specific
+ storage device. You have to provide a low level disk I/O module that written
+ to control your storage device.
+
+
+
+AGREEMENTS
+
+ FatFs module is an open source software to implement FAT file system to
+ small embedded systems. This is a free software and is opened for education,
+ research and commercial developments under license policy of following trems.
+
+ Copyright (C) 2010, ChaN, all right reserved.
+
+ * The FatFs module is a free software and there is NO WARRANTY.
+ * No restriction on use. You can use, modify and redistribute it for
+ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
+ * Redistributions of source code must retain the above copyright notice.
+
+
+
+REVISION HISTORY
+
+ Feb 26, 2006 R0.00 Prototype
+
+ Apr 29, 2006 R0.01 First release.
+
+ Jun 01, 2006 R0.02 Added FAT12.
+ Removed unbuffered mode.
+ Fixed a problem on small (<32M) patition.
+
+ Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
+
+ Sep 22, 2006 R0.03 Added f_rename.
+ Changed option _FS_MINIMUM to _FS_MINIMIZE.
+
+ Dec 11, 2006 R0.03a Improved cluster scan algolithm to write files fast.
+ Fixed f_mkdir creates incorrect directory on FAT32.
+
+ Feb 04, 2007 R0.04 Supported multiple drive system. (FatFs)
+ Changed some APIs for multiple drive system.
+ Added f_mkfs. (FatFs)
+ Added _USE_FAT32 option. (Tiny-FatFs)
+
+ Apr 01, 2007 R0.04a Supported multiple partitions on a plysical drive. (FatFs)
+ Fixed an endian sensitive code in f_mkfs. (FatFs)
+ Added a capability of extending the file size to f_lseek.
+ Added minimization level 3.
+ Fixed a problem that can collapse a sector when recreate an
+ existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)
+
+ May 05, 2007 R0.04b Added _USE_NTFLAG option.
+ Added FSInfo support.
+ Fixed some problems corresponds to FAT32. (Tiny-FatFs)
+ Fixed DBCS name can result FR_INVALID_NAME.
+ Fixed short seek (0 < ofs <= csize) collapses the file object.
+
+ Aug 25, 2007 R0.05 Changed arguments of f_read, f_write.
+ Changed arguments of f_mkfs. (FatFs)
+ Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)
+ Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)
+
+ Feb 03, 2008 R0.05a Added f_truncate().
+ Added f_utime().
+ Fixed off by one error at FAT sub-type determination.
+ Fixed btr in f_read() can be mistruncated.
+ Fixed cached sector is not flushed when create and close without write.
+
+ Apr 01, 2008 R0.06 Added f_forward(). (Tiny-FatFs)
+ Added string functions: fputc(), fputs(), fprintf() and fgets().
+ Improved performance of f_lseek() on move to the same or following cluster.
+
+ Apr 01, 2010, R0.07 Merged Tiny-FatFs as a buffer configuration option.
+ Added long file name support.
+ Added multiple code page support.
+ Added re-entrancy for multitask operation.
+ Added auto cluster size selection to f_mkfs().
+ Added rewind option to f_readdir().
+ Changed result code of critical errors.
+ Renamed string functions to avoid name collision.
+
+ Apr 14, 2010, R0.07a Separated out OS dependent code on reentrant cfg.
+ Added multiple sector size support.
+
+ Jun 21, 2010, R0.07c Fixed f_unlink() may return FR_OK on error.
+ Fixed wrong cache control in f_lseek().
+ Added relative path feature.
+ Added f_chdir().
+ Added f_chdrive().
+ Added proper case conversion for extended characters.
+
+ Nov 03,'2010 R0.07e Separated out configuration options from ff.h to ffconf.h.
+ Added a configuration option, _LFN_UNICODE.
+ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
+ Fixed name matching error on the 13 char boundary.
+ Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c b/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c
index 0c0083bac..d4f3897bb 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c
@@ -1,99 +1,99 @@
-/*-----------------------------------------------------------------------*/
-/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */
-/*-----------------------------------------------------------------------*/
-/* This is a stub disk I/O module that acts as front end of the existing */
-/* disk I/O modules and attach it to FatFs module with common interface. */
-/*-----------------------------------------------------------------------*/
-
-#include "diskio.h"
-
-/*-----------------------------------------------------------------------*/
-/* Inidialize a Drive */
-
-DSTATUS disk_initialize (
- BYTE drv /* Physical drive nmuber (0..) */
-)
-{
- return FR_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Return Disk Status */
-
-DSTATUS disk_status (
- BYTE drv /* Physical drive nmuber (0..) */
-)
-{
- return FR_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read Sector(s) */
-
-DRESULT disk_read (
- BYTE drv, /* Physical drive nmuber (0..) */
- BYTE *buff, /* Data buffer to store read data */
- DWORD sector, /* Sector address (LBA) */
- BYTE count /* Number of sectors to read (1..255) */
-)
-{
- DataflashManager_ReadBlocks_RAM(sector, count, buff);
- return RES_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Write Sector(s) */
-
-#if _READONLY == 0
-DRESULT disk_write (
- BYTE drv, /* Physical drive nmuber (0..) */
- const BYTE *buff, /* Data to be written */
- DWORD sector, /* Sector address (LBA) */
- BYTE count /* Number of sectors to write (1..255) */
-)
-{
- DataflashManager_WriteBlocks_RAM(sector, count, buff);
- return RES_OK;
-}
-#endif /* _READONLY */
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Miscellaneous Functions */
-
-DRESULT disk_ioctl (
- BYTE drv, /* Physical drive nmuber (0..) */
- BYTE ctrl, /* Control code */
- void *buff /* Buffer to send/receive control data */
-)
-{
- if (ctrl == CTRL_SYNC)
- return RES_OK;
- else
- return RES_PARERR;
-}
-
-
-DWORD get_fattime (void)
-{
- uint8_t Day, Month, Year;
- uint8_t Hour, Minute, Second;
-
- DS1307_GetDate(&Day, &Month, &Year);
- DS1307_GetTime(&Hour, &Minute, &Second);
-
-
- return ((DWORD)(20 + Year) << 25) |
- ((DWORD)Month << 21) |
- ((DWORD)Day << 16) |
- ((DWORD)Hour << 11) |
- ((DWORD)Minute << 5) |
- (((DWORD)Second >> 1) << 0);
-}
+/*-----------------------------------------------------------------------*/
+/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */
+/*-----------------------------------------------------------------------*/
+/* This is a stub disk I/O module that acts as front end of the existing */
+/* disk I/O modules and attach it to FatFs module with common interface. */
+/*-----------------------------------------------------------------------*/
+
+#include "diskio.h"
+
+/*-----------------------------------------------------------------------*/
+/* Inidialize a Drive */
+
+DSTATUS disk_initialize (
+ BYTE drv /* Physical drive nmuber (0..) */
+)
+{
+ return FR_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Return Disk Status */
+
+DSTATUS disk_status (
+ BYTE drv /* Physical drive nmuber (0..) */
+)
+{
+ return FR_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read Sector(s) */
+
+DRESULT disk_read (
+ BYTE drv, /* Physical drive nmuber (0..) */
+ BYTE *buff, /* Data buffer to store read data */
+ DWORD sector, /* Sector address (LBA) */
+ BYTE count /* Number of sectors to read (1..255) */
+)
+{
+ DataflashManager_ReadBlocks_RAM(sector, count, buff);
+ return RES_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Write Sector(s) */
+
+#if _READONLY == 0
+DRESULT disk_write (
+ BYTE drv, /* Physical drive nmuber (0..) */
+ const BYTE *buff, /* Data to be written */
+ DWORD sector, /* Sector address (LBA) */
+ BYTE count /* Number of sectors to write (1..255) */
+)
+{
+ DataflashManager_WriteBlocks_RAM(sector, count, buff);
+ return RES_OK;
+}
+#endif /* _READONLY */
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Miscellaneous Functions */
+
+DRESULT disk_ioctl (
+ BYTE drv, /* Physical drive nmuber (0..) */
+ BYTE ctrl, /* Control code */
+ void *buff /* Buffer to send/receive control data */
+)
+{
+ if (ctrl == CTRL_SYNC)
+ return RES_OK;
+ else
+ return RES_PARERR;
+}
+
+
+DWORD get_fattime (void)
+{
+ uint8_t Day, Month, Year;
+ uint8_t Hour, Minute, Second;
+
+ DS1307_GetDate(&Day, &Month, &Year);
+ DS1307_GetTime(&Hour, &Minute, &Second);
+
+
+ return ((DWORD)(20 + Year) << 25) |
+ ((DWORD)Month << 21) |
+ ((DWORD)Day << 16) |
+ ((DWORD)Hour << 11) |
+ ((DWORD)Minute << 5) |
+ (((DWORD)Second >> 1) << 0);
+}
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/diskio.h b/Projects/TemperatureDataLogger/Lib/FATFs/diskio.h
index 4085501da..ad126712d 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/diskio.h
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/diskio.h
@@ -1,71 +1,71 @@
-/*-----------------------------------------------------------------------
-/ Low level disk interface modlue include file R0.07 (C)ChaN, 2010
-/-----------------------------------------------------------------------*/
-
-#ifndef _DISKIO
-
-#define _READONLY 0 /* 1: Read-only mode */
-#define _USE_IOCTL 1
-
-#include "integer.h"
-
-#include "../DataflashManager.h"
-
-
-/* Status of Disk Functions */
-typedef BYTE DSTATUS;
-
-/* Results of Disk Functions */
-typedef enum {
- RES_OK = 0, /* 0: Successful */
- RES_ERROR, /* 1: R/W Error */
- RES_WRPRT, /* 2: Write Protected */
- RES_NOTRDY, /* 3: Not Ready */
- RES_PARERR /* 4: Invalid Parameter */
-} DRESULT;
-
-
-/*---------------------------------------*/
-/* Prototypes for disk control functions */
-
-BOOL assign_drives (int argc, char *argv[]);
-DSTATUS disk_initialize (BYTE);
-DSTATUS disk_status (BYTE);
-DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
-#if _READONLY == 0
-DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
-#endif
-DRESULT disk_ioctl (BYTE, BYTE, void*);
-
-
-/* Disk Status Bits (DSTATUS) */
-
-#define STA_NOINIT 0x01 /* Drive not initialized */
-#define STA_NODISK 0x02 /* No medium in the drive */
-#define STA_PROTECT 0x04 /* Write protected */
-
-
-/* Command code for disk_ioctrl() */
-
-/* Generic command */
-#define CTRL_SYNC 0 /* Mandatory for write functions */
-#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
-#define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */
-#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
-#define CTRL_POWER 4
-#define CTRL_LOCK 5
-#define CTRL_EJECT 6
-/* MMC/SDC command */
-#define MMC_GET_TYPE 10
-#define MMC_GET_CSD 11
-#define MMC_GET_CID 12
-#define MMC_GET_OCR 13
-#define MMC_GET_SDSTAT 14
-/* ATA/CF command */
-#define ATA_GET_REV 20
-#define ATA_GET_MODEL 21
-#define ATA_GET_SN 22
-
-
-#define _DISKIO
-#endif
+/*-----------------------------------------------------------------------
+/ Low level disk interface modlue include file R0.07 (C)ChaN, 2010
+/-----------------------------------------------------------------------*/
+
+#ifndef _DISKIO
+
+#define _READONLY 0 /* 1: Read-only mode */
+#define _USE_IOCTL 1
+
+#include "integer.h"
+
+#include "../DataflashManager.h"
+
+
+/* Status of Disk Functions */
+typedef BYTE DSTATUS;
+
+/* Results of Disk Functions */
+typedef enum {
+ RES_OK = 0, /* 0: Successful */
+ RES_ERROR, /* 1: R/W Error */
+ RES_WRPRT, /* 2: Write Protected */
+ RES_NOTRDY, /* 3: Not Ready */
+ RES_PARERR /* 4: Invalid Parameter */
+} DRESULT;
+
+
+/*---------------------------------------*/
+/* Prototypes for disk control functions */
+
+BOOL assign_drives (int argc, char *argv[]);
+DSTATUS disk_initialize (BYTE);
+DSTATUS disk_status (BYTE);
+DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
+#if _READONLY == 0
+DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
+#endif
+DRESULT disk_ioctl (BYTE, BYTE, void*);
+
+
+/* Disk Status Bits (DSTATUS) */
+
+#define STA_NOINIT 0x01 /* Drive not initialized */
+#define STA_NODISK 0x02 /* No medium in the drive */
+#define STA_PROTECT 0x04 /* Write protected */
+
+
+/* Command code for disk_ioctrl() */
+
+/* Generic command */
+#define CTRL_SYNC 0 /* Mandatory for write functions */
+#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
+#define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */
+#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
+#define CTRL_POWER 4
+#define CTRL_LOCK 5
+#define CTRL_EJECT 6
+/* MMC/SDC command */
+#define MMC_GET_TYPE 10
+#define MMC_GET_CSD 11
+#define MMC_GET_CID 12
+#define MMC_GET_OCR 13
+#define MMC_GET_SDSTAT 14
+/* ATA/CF command */
+#define ATA_GET_REV 20
+#define ATA_GET_MODEL 21
+#define ATA_GET_SN 22
+
+
+#define _DISKIO
+#endif
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/ff.c b/Projects/TemperatureDataLogger/Lib/FATFs/ff.c
index 6382fea1f..b30139055 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/ff.c
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/ff.c
@@ -1,3153 +1,3153 @@
-/*----------------------------------------------------------------------------/
-/ FatFs - FAT file system module R0.07e (C)ChaN, 2010
-/-----------------------------------------------------------------------------/
-/ FatFs module is a generic FAT file system module for small embedded systems.
-/ This is a free software that opened for education, research and commercial
-/ developments under license policy of following trems.
-/
-/ Copyright (C) 2010, ChaN, all right reserved.
-/
-/ * The FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
-/
-/-----------------------------------------------------------------------------/
-/ Feb 26,'06 R0.00 Prototype.
-/
-/ Apr 29,'06 R0.01 First stable version.
-/
-/ Jun 01,'06 R0.02 Added FAT12 support.
-/ Removed unbuffered mode.
-/ Fixed a problem on small (<32M) patition.
-/ Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).
-/
-/ Sep 22,'06 R0.03 Added f_rename().
-/ Changed option _FS_MINIMUM to _FS_MINIMIZE.
-/ Dec 11,'06 R0.03a Improved cluster scan algolithm to write files fast.
-/ Fixed f_mkdir() creates incorrect directory on FAT32.
-/
-/ Feb 04,'07 R0.04 Supported multiple drive system.
-/ Changed some interfaces for multiple drive system.
-/ Changed f_mountdrv() to f_mount().
-/ Added f_mkfs().
-/ Apr 01,'07 R0.04a Supported multiple partitions on a plysical drive.
-/ Added a capability of extending file size to f_lseek().
-/ Added minimization level 3.
-/ Fixed an endian sensitive code in f_mkfs().
-/ May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.
-/ Added FSInfo support.
-/ Fixed DBCS name can result FR_INVALID_NAME.
-/ Fixed short seek (<= csize) collapses the file object.
-/
-/ Aug 25,'07 R0.05 Changed arguments of f_read(), f_write() and f_mkfs().
-/ Fixed f_mkfs() on FAT32 creates incorrect FSInfo.
-/ Fixed f_mkdir() on FAT32 creates incorrect directory.
-/ Feb 03,'08 R0.05a Added f_truncate() and f_utime().
-/ Fixed off by one error at FAT sub-type determination.
-/ Fixed btr in f_read() can be mistruncated.
-/ Fixed cached sector is not flushed when create and close
-/ without write.
-/
-/ Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets().
-/ Improved performance of f_lseek() on moving to the same
-/ or following cluster.
-/
-/ Apr 01,'09 R0.07 Merged Tiny-FatFs as a buffer configuration option.
-/ Added long file name support.
-/ Added multiple code page support.
-/ Added re-entrancy for multitask operation.
-/ Added auto cluster size selection to f_mkfs().
-/ Added rewind option to f_readdir().
-/ Changed result code of critical errors.
-/ Renamed string functions to avoid name collision.
-/ Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg.
-/ Added multiple sector size support.
-/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error.
-/ Fixed wrong cache control in f_lseek().
-/ Added relative path feature.
-/ Added f_chdir() and f_chdrive().
-/ Added proper case conversion to extended char.
-/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h.
-/ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
-/ Fixed name matching error on the 13 char boundary.
-/ Added a configuration option, _LFN_UNICODE.
-/ Changed f_readdir() to return the SFN with always upper
-/ case on non-LFN cfg.
-/---------------------------------------------------------------------------*/
-
-#include "ff.h" /* FatFs configurations and declarations */
-#include "diskio.h" /* Declarations of low level disk I/O functions */
-
-/*--------------------------------------------------------------------------
-
- Module Private Definitions
-
----------------------------------------------------------------------------*/
-
-#if _FATFS != 0x007E
-#error Wrong include file (ff.h).
-#endif
-
-#if _FS_REENTRANT
-#if _USE_LFN == 1
-#error Static LFN work area must not be used in re-entrant configuration.
-#endif
-#define ENTER_FF(fs) { if (!lock_fs(fs)) return FR_TIMEOUT; }
-#define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; }
-
-#else
-#define ENTER_FF(fs)
-#define LEAVE_FF(fs, res) return res
-
-#endif
-
-#define ABORT(fs, res) { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Name status flags */
-#define NS 11 /* Offset of name status byte */
-#define NS_LOSS 0x01 /* Out of 8.3 format */
-#define NS_LFN 0x02 /* Force to create LFN entry */
-#define NS_LAST 0x04 /* Last segment */
-#define NS_BODY 0x08 /* Lower case flag (body) */
-#define NS_EXT 0x10 /* Lower case flag (ext) */
-#define NS_DOT 0x20 /* Dot entry */
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Private Work Area
-
----------------------------------------------------------------------------*/
-
-#if _DRIVES < 1 || _DRIVES > 9
-#error Number of drives must be 1-9.
-#endif
-static
-FATFS *FatFs[_DRIVES]; /* Pointer to the file system objects (logical drives) */
-
-static
-WORD Fsid; /* File system mount ID */
-
-#if _FS_RPATH
-static
-BYTE Drive; /* Current drive */
-#endif
-
-
-#if _USE_LFN == 1 /* LFN with static LFN working buffer */
-static
-WCHAR LfnBuf[_MAX_LFN + 1];
-#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR *lp = LfnBuf
-#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
-
-#elif _USE_LFN > 1 /* LFN with dynamic LFN working buffer */
-#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR lbuf[_MAX_LFN + 1], *lp = lbuf
-#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
-
-#else /* No LFN */
-#define NAMEBUF(sp,lp) BYTE sp[12]
-#define INITBUF(dj,sp,lp) dj.fn = sp
-
-#endif
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Module Private Functions
-
----------------------------------------------------------------------------*/
-
-
-/*-----------------------------------------------------------------------*/
-/* String functions */
-/*-----------------------------------------------------------------------*/
-
-/* Copy memory to memory */
-static
-void mem_cpy (void* dst, const void* src, int cnt) {
- char *d = (char*)dst;
- const char *s = (const char *)src;
- while (cnt--) *d++ = *s++;
-}
-
-/* Fill memory */
-static
-void mem_set (void* dst, int val, int cnt) {
- char *d = (char*)dst;
- while (cnt--) *d++ = (char)val;
-}
-
-/* Compare memory to memory */
-static
-int mem_cmp (const void* dst, const void* src, int cnt) {
- const char *d = (const char *)dst, *s = (const char *)src;
- int r = 0;
- while (cnt-- && (r = *d++ - *s++) == 0) ;
- return r;
-}
-
-/* Check if chr is contained in the string */
-static
-int chk_chr (const char* str, int chr) {
- while (*str && *str != chr) str++;
- return *str;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Request/Release grant to access the volume */
-/*-----------------------------------------------------------------------*/
-#if _FS_REENTRANT
-
-static
-BOOL lock_fs (
- FATFS *fs /* File system object */
-)
-{
- return ff_req_grant(fs->sobj);
-}
-
-
-static
-void unlock_fs (
- FATFS *fs, /* File system object */
- FRESULT res /* Result code to be returned */
-)
-{
- if (res != FR_NOT_ENABLED &&
- res != FR_INVALID_DRIVE &&
- res != FR_INVALID_OBJECT &&
- res != FR_TIMEOUT) {
- ff_rel_grant(fs->sobj);
- }
-}
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change window offset */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT move_window (
- FATFS *fs, /* File system object */
- DWORD sector /* Sector number to make apperance in the fs->win[] */
-) /* Move to zero only writes back dirty window */
-{
- DWORD wsect;
-
-
- wsect = fs->winsect;
- if (wsect != sector) { /* Changed current window */
-#if !_FS_READONLY
- if (fs->wflag) { /* Write back dirty window if needed */
- if (disk_write(fs->drive, fs->win, wsect, 1) != RES_OK)
- return FR_DISK_ERR;
- fs->wflag = 0;
- if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */
- BYTE nf;
- for (nf = fs->n_fats; nf > 1; nf--) { /* Refrect the change to all FAT copies */
- wsect += fs->sects_fat;
- disk_write(fs->drive, fs->win, wsect, 1);
- }
- }
- }
-#endif
- if (sector) {
- if (disk_read(fs->drive, fs->win, sector, 1) != RES_OK)
- return FR_DISK_ERR;
- fs->winsect = sector;
- }
- }
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Clean-up cached data */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */
- FATFS *fs /* File system object */
-)
-{
- FRESULT res;
-
-
- res = move_window(fs, 0);
- if (res == FR_OK) {
- /* Update FSInfo sector if needed */
- if (fs->fs_type == FS_FAT32 && fs->fsi_flag) {
- fs->winsect = 0;
- mem_set(fs->win, 0, 512);
- ST_WORD(fs->win+BS_55AA, 0xAA55);
- ST_DWORD(fs->win+FSI_LeadSig, 0x41615252);
- ST_DWORD(fs->win+FSI_StrucSig, 0x61417272);
- ST_DWORD(fs->win+FSI_Free_Count, fs->free_clust);
- ST_DWORD(fs->win+FSI_Nxt_Free, fs->last_clust);
- disk_write(fs->drive, fs->win, fs->fsi_sector, 1);
- fs->fsi_flag = 0;
- }
- /* Make sure that no pending write process in the physical drive */
- if (disk_ioctl(fs->drive, CTRL_SYNC, (void*)NULL) != RES_OK)
- res = FR_DISK_ERR;
- }
-
- return res;
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT access - Read value of a FAT entry */
-/*-----------------------------------------------------------------------*/
-
-
-DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status */
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to get the link information */
-)
-{
- UINT wc, bc;
- DWORD fsect;
-
-
- if (clst < 2 || clst >= fs->max_clust) /* Range check */
- return 1;
-
- fsect = fs->fatbase;
- switch (fs->fs_type) {
- case FS_FAT12 :
- bc = clst; bc += bc / 2;
- if (move_window(fs, fsect + (bc / SS(fs)))) break;
- wc = fs->win[bc & (SS(fs) - 1)]; bc++;
- if (move_window(fs, fsect + (bc / SS(fs)))) break;
- wc |= (WORD)fs->win[bc & (SS(fs) - 1)] << 8;
- return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);
-
- case FS_FAT16 :
- if (move_window(fs, fsect + (clst / (SS(fs) / 2)))) break;
- return LD_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)]);
-
- case FS_FAT32 :
- if (move_window(fs, fsect + (clst / (SS(fs) / 4)))) break;
- return LD_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)]) & 0x0FFFFFFF;
- }
-
- return 0xFFFFFFFF; /* An error occured at the disk I/O layer */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT access - Change value of a FAT entry */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-
-FRESULT put_fat (
- FATFS *fs, /* File system object */
- DWORD clst, /* Cluster# to be changed in range of 2 to fs->max_clust - 1 */
- DWORD val /* New value to mark the cluster */
-)
-{
- UINT bc;
- BYTE *p;
- DWORD fsect;
- FRESULT res;
-
-
- if (clst < 2 || clst >= fs->max_clust) { /* Range check */
- res = FR_INT_ERR;
-
- } else {
- fsect = fs->fatbase;
- switch (fs->fs_type) {
- case FS_FAT12 :
- bc = clst; bc += bc / 2;
- res = move_window(fs, fsect + (bc / SS(fs)));
- if (res != FR_OK) break;
- p = &fs->win[bc & (SS(fs) - 1)];
- *p = (clst & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val;
- bc++;
- fs->wflag = 1;
- res = move_window(fs, fsect + (bc / SS(fs)));
- if (res != FR_OK) break;
- p = &fs->win[bc & (SS(fs) - 1)];
- *p = (clst & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F));
- break;
-
- case FS_FAT16 :
- res = move_window(fs, fsect + (clst / (SS(fs) / 2)));
- if (res != FR_OK) break;
- ST_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)], (WORD)val);
- break;
-
- case FS_FAT32 :
- res = move_window(fs, fsect + (clst / (SS(fs) / 4)));
- if (res != FR_OK) break;
- ST_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)], val);
- break;
-
- default :
- res = FR_INT_ERR;
- }
- fs->wflag = 1;
- }
-
- return res;
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT handling - Remove a cluster chain */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-FRESULT remove_chain (
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to remove a chain from */
-)
-{
- FRESULT res;
- DWORD nxt;
-
-
- if (clst < 2 || clst >= fs->max_clust) { /* Check the range of cluster# */
- res = FR_INT_ERR;
-
- } else {
- res = FR_OK;
- while (clst < fs->max_clust) { /* Not a last link? */
- nxt = get_fat(fs, clst); /* Get cluster status */
- if (nxt == 0) break; /* Empty cluster? */
- if (nxt == 1) { res = FR_INT_ERR; break; } /* Internal error? */
- if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */
- res = put_fat(fs, clst, 0); /* Mark the cluster "empty" */
- if (res != FR_OK) break;
- if (fs->free_clust != 0xFFFFFFFF) { /* Update FSInfo */
- fs->free_clust++;
- fs->fsi_flag = 1;
- }
- clst = nxt; /* Next cluster */
- }
- }
-
- return res;
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT handling - Stretch or Create a cluster chain */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to stretch. 0 means create a new chain. */
-)
-{
- DWORD cs, ncl, scl, mcl;
-
-
- mcl = fs->max_clust;
- if (clst == 0) { /* Create new chain */
- scl = fs->last_clust; /* Get suggested start point */
- if (scl == 0 || scl >= mcl) scl = 1;
- }
- else { /* Stretch existing chain */
- cs = get_fat(fs, clst); /* Check the cluster status */
- if (cs < 2) return 1; /* It is an invalid cluster */
- if (cs < mcl) return cs; /* It is already followed by next cluster */
- scl = clst;
- }
-
- ncl = scl; /* Start cluster */
- for (;;) {
- ncl++; /* Next cluster */
- if (ncl >= mcl) { /* Wrap around */
- ncl = 2;
- if (ncl > scl) return 0; /* No free custer */
- }
- cs = get_fat(fs, ncl); /* Get the cluster status */
- if (cs == 0) break; /* Found a free cluster */
- if (cs == 0xFFFFFFFF || cs == 1)/* An error occured */
- return cs;
- if (ncl == scl) return 0; /* No free custer */
- }
-
- if (put_fat(fs, ncl, 0x0FFFFFFF)) /* Mark the new cluster "in use" */
- return 0xFFFFFFFF;
- if (clst != 0) { /* Link it to the previous one if needed */
- if (put_fat(fs, clst, ncl))
- return 0xFFFFFFFF;
- }
-
- fs->last_clust = ncl; /* Update FSINFO */
- if (fs->free_clust != 0xFFFFFFFF) {
- fs->free_clust--;
- fs->fsi_flag = 1;
- }
-
- return ncl; /* Return new cluster number */
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Get sector# from cluster# */
-/*-----------------------------------------------------------------------*/
-
-
-DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to be converted */
-)
-{
- clst -= 2;
- if (clst >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
- return clst * fs->csize + fs->database;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Seek directory index */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_seek (
- DIR *dj, /* Pointer to directory object */
- WORD idx /* Directory index number */
-)
-{
- DWORD clst;
- WORD ic;
-
-
- dj->index = idx;
- clst = dj->sclust;
- if (clst == 1 || clst >= dj->fs->max_clust) /* Check start cluster range */
- return FR_INT_ERR;
- if (!clst && dj->fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
- clst = dj->fs->dirbase;
-
- if (clst == 0) { /* Static table */
- dj->clust = clst;
- if (idx >= dj->fs->n_rootdir) /* Index is out of range */
- return FR_INT_ERR;
- dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / 32); /* Sector# */
- }
- else { /* Dynamic table */
- ic = SS(dj->fs) / 32 * dj->fs->csize; /* Entries per cluster */
- while (idx >= ic) { /* Follow cluster chain */
- clst = get_fat(dj->fs, clst); /* Get next cluster */
- if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */
- if (clst < 2 || clst >= dj->fs->max_clust) /* Reached to end of table or int error */
- return FR_INT_ERR;
- idx -= ic;
- }
- dj->clust = clst;
- dj->sect = clust2sect(dj->fs, clst) + idx / (SS(dj->fs) / 32); /* Sector# */
- }
-
- dj->dir = dj->fs->win + (idx % (SS(dj->fs) / 32)) * 32; /* Ptr to the entry in the sector */
-
- return FR_OK; /* Seek succeeded */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Move directory index next */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */
- DIR *dj, /* Pointer to directory object */
- BOOL streach /* FALSE: Do not streach table, TRUE: Streach table if needed */
-)
-{
- DWORD clst;
- WORD i;
-
-
- i = dj->index + 1;
- if (!i || !dj->sect) /* Report EOT when index has reached 65535 */
- return FR_NO_FILE;
-
- if (!(i % (SS(dj->fs) / 32))) { /* Sector changed? */
- dj->sect++; /* Next sector */
-
- if (dj->clust == 0) { /* Static table */
- if (i >= dj->fs->n_rootdir) /* Report EOT when end of table */
- return FR_NO_FILE;
- }
- else { /* Dynamic table */
- if (((i / (SS(dj->fs) / 32)) & (dj->fs->csize - 1)) == 0) { /* Cluster changed? */
- clst = get_fat(dj->fs, dj->clust); /* Get next cluster */
- if (clst <= 1) return FR_INT_ERR;
- if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
- if (clst >= dj->fs->max_clust) { /* When it reached end of dynamic table */
-#if !_FS_READONLY
- BYTE c;
- if (!streach) return FR_NO_FILE; /* When do not streach, report EOT */
- clst = create_chain(dj->fs, dj->clust); /* Streach cluster chain */
- if (clst == 0) return FR_DENIED; /* No free cluster */
- if (clst == 1) return FR_INT_ERR;
- if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
- /* Clean-up streached table */
- if (move_window(dj->fs, 0)) return FR_DISK_ERR; /* Flush active window */
- mem_set(dj->fs->win, 0, SS(dj->fs)); /* Clear window buffer */
- dj->fs->winsect = clust2sect(dj->fs, clst); /* Cluster start sector */
- for (c = 0; c < dj->fs->csize; c++) { /* Fill the new cluster with 0 */
- dj->fs->wflag = 1;
- if (move_window(dj->fs, 0)) return FR_DISK_ERR;
- dj->fs->winsect++;
- }
- dj->fs->winsect -= c; /* Rewind window address */
-#else
- return FR_NO_FILE; /* Report EOT */
-#endif
- }
- dj->clust = clst; /* Initialize data for new cluster */
- dj->sect = clust2sect(dj->fs, clst);
- }
- }
- }
-
- dj->index = i;
- dj->dir = dj->fs->win + (i % (SS(dj->fs) / 32)) * 32;
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry */
-/*-----------------------------------------------------------------------*/
-#if _USE_LFN
-static
-const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Offset of LFN chars in the directory entry */
-
-
-static
-BOOL cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */
- WCHAR *lfnbuf, /* Pointer to the LFN to be compared */
- BYTE *dir /* Pointer to the directory entry containing a part of LFN */
-)
-{
- int i, s;
- WCHAR wc, uc;
-
-
- i = ((dir[LDIR_Ord] & 0xBF) - 1) * 13; /* Get offset in the LFN buffer */
- s = 0; wc = 1;
- do {
- uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
- if (wc) { /* Last char has not been processed */
- wc = ff_wtoupper(uc); /* Convert it to upper case */
- if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it */
- return FALSE; /* Not matched */
- } else {
- if (uc != 0xFFFF) return FALSE; /* Check filler */
- }
- } while (++s < 13); /* Repeat until all chars in the entry are checked */
-
- if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i]) /* Last segment matched but different length */
- return FALSE;
-
- return TRUE; /* The part of LFN matched */
-}
-
-
-
-static
-BOOL pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */
- WCHAR *lfnbuf, /* Pointer to the Unicode-LFN buffer */
- BYTE *dir /* Pointer to the directory entry */
-)
-{
- int i, s;
- WCHAR wc, uc;
-
-
- i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
-
- s = 0; wc = 1;
- do {
- uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
- if (wc) { /* Last char has not been processed */
- if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
- lfnbuf[i++] = wc = uc; /* Store it */
- } else {
- if (uc != 0xFFFF) return FALSE; /* Check filler */
- }
- } while (++s < 13); /* Read all character in the entry */
-
- if (dir[LDIR_Ord] & 0x40) { /* Put terminator if it is the last LFN part */
- if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
- lfnbuf[i] = 0;
- }
-
- return TRUE;
-}
-
-
-#if !_FS_READONLY
-static
-void fit_lfn (
- const WCHAR *lfnbuf, /* Pointer to the LFN buffer */
- BYTE *dir, /* Pointer to the directory entry */
- BYTE ord, /* LFN order (1-20) */
- BYTE sum /* SFN sum */
-)
-{
- int i, s;
- WCHAR wc;
-
-
- dir[LDIR_Chksum] = sum; /* Set check sum */
- dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
- dir[LDIR_Type] = 0;
- ST_WORD(dir+LDIR_FstClusLO, 0);
-
- i = (ord - 1) * 13; /* Get offset in the LFN buffer */
- s = wc = 0;
- do {
- if (wc != 0xFFFF) wc = lfnbuf[i++]; /* Get an effective char */
- ST_WORD(dir+LfnOfs[s], wc); /* Put it */
- if (!wc) wc = 0xFFFF; /* Padding chars following last char */
- } while (++s < 13);
- if (wc == 0xFFFF || !lfnbuf[i]) ord |= 0x40; /* Bottom LFN part is the start of LFN sequence */
- dir[LDIR_Ord] = ord; /* Set the LFN order */
-}
-
-#endif
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Create numbered name */
-/*-----------------------------------------------------------------------*/
-#if _USE_LFN
-void gen_numname (
- BYTE *dst, /* Pointer to genartated SFN */
- const BYTE *src, /* Pointer to source SFN to be modified */
- const WCHAR *lfn, /* Pointer to LFN */
- WORD num /* Sequense number */
-)
-{
- char ns[8];
- int i, j;
-
-
- mem_cpy(dst, src, 11);
-
- if (num > 5) { /* On many collisions, generate a hash number instead of sequencial number */
- do num = (num >> 1) + (num << 15) + (WORD)*lfn++; while (*lfn);
- }
-
- /* itoa */
- i = 7;
- do {
- ns[i--] = (num % 10) + '0';
- num /= 10;
- } while (num);
- ns[i] = '~';
-
- /* Append the number */
- for (j = 0; j < i && dst[j] != ' '; j++) {
- if (IsDBCS1(dst[j])) {
- if (j == i - 1) break;
- j++;
- }
- }
- do {
- dst[j++] = (i < 8) ? ns[i++] : ' ';
- } while (j < 8);
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Calculate sum of an SFN */
-/*-----------------------------------------------------------------------*/
-#if _USE_LFN
-static
-BYTE sum_sfn (
- const BYTE *dir /* Ptr to directory entry */
-)
-{
- BYTE sum = 0;
- int n = 11;
-
- do sum = (sum >> 1) + (sum << 7) + *dir++; while (--n);
- return sum;
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Find an object in the directory */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_find (
- DIR *dj /* Pointer to the directory object linked to the file name */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-#if _USE_LFN
- BYTE a, ord, sum;
-#endif
-
- res = dir_seek(dj, 0); /* Rewind directory object */
- if (res != FR_OK) return res;
-
-#if _USE_LFN
- ord = sum = 0xFF;
-#endif
- do {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- dir = dj->dir; /* Ptr to the directory entry of current index */
- c = dir[DIR_Name];
- if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
-#if _USE_LFN /* LFN configuration */
- a = dir[DIR_Attr] & AM_MASK;
- if (c == 0xE5 || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
- ord = 0xFF;
- } else {
- if (a == AM_LFN) { /* An LFN entry is found */
- if (dj->lfn) {
- if (c & 0x40) { /* Is it start of LFN sequence? */
- sum = dir[LDIR_Chksum];
- c &= 0xBF; ord = c; /* LFN start order */
- dj->lfn_idx = dj->index;
- }
- /* Check validity of the LFN entry and compare it with given name */
- ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
- }
- } else { /* An SFN entry is found */
- if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */
- ord = 0xFF; dj->lfn_idx = 0xFFFF; /* Reset LFN sequence */
- if (!(dj->fn[NS] & NS_LOSS) && !mem_cmp(dir, dj->fn, 11)) break; /* SFN matched? */
- }
- }
-#else /* Non LFN configuration */
- if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */
- break;
-#endif
- res = dir_next(dj, FALSE); /* Next entry */
- } while (res == FR_OK);
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read an object from the directory */
-/*-----------------------------------------------------------------------*/
-#if _FS_MINIMIZE <= 1
-static
-FRESULT dir_read (
- DIR *dj /* Pointer to the directory object that pointing the entry to be read */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-#if _USE_LFN
- BYTE a, ord = 0xFF, sum = 0xFF;
-#endif
-
- res = FR_NO_FILE;
- while (dj->sect) {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- dir = dj->dir; /* Ptr to the directory entry of current index */
- c = dir[DIR_Name];
- if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
-#if _USE_LFN /* LFN configuration */
- a = dir[DIR_Attr] & AM_MASK;
- if (c == 0xE5 || (!_FS_RPATH && c == '.') || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
- ord = 0xFF;
- } else {
- if (a == AM_LFN) { /* An LFN entry is found */
- if (c & 0x40) { /* Is it start of LFN sequence? */
- sum = dir[LDIR_Chksum];
- c &= 0xBF; ord = c;
- dj->lfn_idx = dj->index;
- }
- /* Check LFN validity and capture it */
- ord = (c == ord && sum == dir[LDIR_Chksum] && pick_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
- } else { /* An SFN entry is found */
- if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN? */
- dj->lfn_idx = 0xFFFF; /* It has no LFN. */
- break;
- }
- }
-#else /* Non LFN configuration */
- if (c != 0xE5 && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL)) /* Is it a valid entry? */
- break;
-#endif
- res = dir_next(dj, FALSE); /* Next entry */
- if (res != FR_OK) break;
- }
-
- if (res != FR_OK) dj->sect = 0;
-
- return res;
-}
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Register an object to the directory */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many SFN collision, FR_DISK_ERR:Disk error */
- DIR *dj /* Target directory with object name to be created */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-#if _USE_LFN /* LFN configuration */
- WORD n, ne, is;
- BYTE sn[12], *fn, sum;
- WCHAR *lfn;
-
-
- fn = dj->fn; lfn = dj->lfn;
- mem_cpy(sn, fn, 12);
-
- if (_FS_RPATH && (sn[NS] & NS_DOT)) return FR_INVALID_NAME; /* Cannot create dot entry */
-
- if (sn[NS] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */
- fn[NS] = 0; dj->lfn = NULL; /* Find only SFN */
- for (n = 1; n < 100; n++) {
- gen_numname(fn, sn, lfn, n); /* Generate a numbered name */
- res = dir_find(dj); /* Check if the name collides with existing SFN */
- if (res != FR_OK) break;
- }
- if (n == 100) return FR_DENIED; /* Abort if too many collisions */
- if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */
- fn[NS] = sn[NS]; dj->lfn = lfn;
- }
-
- if (sn[NS] & NS_LFN) { /* When LFN is to be created, reserve reserve an SFN + LFN entries. */
- for (ne = 0; lfn[ne]; ne++) ;
- ne = (ne + 25) / 13;
- } else { /* Otherwise reserve only an SFN entry. */
- ne = 1;
- }
-
- /* Reserve contiguous entries */
- res = dir_seek(dj, 0);
- if (res != FR_OK) return res;
- n = is = 0;
- do {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- c = *dj->dir; /* Check the entry status */
- if (c == 0xE5 || c == 0) { /* Is it a blank entry? */
- if (n == 0) is = dj->index; /* First index of the contigulus entry */
- if (++n == ne) break; /* A contiguous entry that requiered count is found */
- } else {
- n = 0; /* Not a blank entry. Restart to search */
- }
- res = dir_next(dj, TRUE); /* Next entry with table streach */
- } while (res == FR_OK);
-
- if (res == FR_OK && ne > 1) { /* Initialize LFN entry if needed */
- res = dir_seek(dj, is);
- if (res == FR_OK) {
- sum = sum_sfn(dj->fn); /* Sum of the SFN tied to the LFN */
- ne--;
- do { /* Store LFN entries in bottom first */
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- fit_lfn(dj->lfn, dj->dir, (BYTE)ne, sum);
- dj->fs->wflag = 1;
- res = dir_next(dj, FALSE); /* Next entry */
- } while (res == FR_OK && --ne);
- }
- }
-
-#else /* Non LFN configuration */
- res = dir_seek(dj, 0);
- if (res == FR_OK) {
- do { /* Find a blank entry for the SFN */
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- c = *dj->dir;
- if (c == 0xE5 || c == 0) break; /* Is it a blank entry? */
- res = dir_next(dj, TRUE); /* Next entry with table streach */
- } while (res == FR_OK);
- }
-#endif
-
- if (res == FR_OK) { /* Initialize the SFN entry */
- res = move_window(dj->fs, dj->sect);
- if (res == FR_OK) {
- dir = dj->dir;
- mem_set(dir, 0, 32); /* Clean the entry */
- mem_cpy(dir, dj->fn, 11); /* Put SFN */
- dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */
- dj->fs->wflag = 1;
- }
- }
-
- return res;
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Remove an object from the directory */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY && !_FS_MINIMIZE
-static
-FRESULT dir_remove ( /* FR_OK: Successful, FR_DISK_ERR: A disk error */
- DIR *dj /* Directory object pointing the entry to be removed */
-)
-{
- FRESULT res;
-#if _USE_LFN /* LFN configuration */
- WORD i;
-
- i = dj->index; /* SFN index */
- res = dir_seek(dj, (WORD)((dj->lfn_idx == 0xFFFF) ? i : dj->lfn_idx)); /* Goto the SFN or top of the LFN entries */
- if (res == FR_OK) {
- do {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- *dj->dir = 0xE5; /* Mark the entry "deleted" */
- dj->fs->wflag = 1;
- if (dj->index >= i) break; /* When reached SFN, all entries of the object has been deleted. */
- res = dir_next(dj, FALSE); /* Next entry */
- } while (res == FR_OK);
- if (res == FR_NO_FILE) res = FR_INT_ERR;
- }
-
-#else /* Non LFN configuration */
- res = dir_seek(dj, dj->index);
- if (res == FR_OK) {
- res = move_window(dj->fs, dj->sect);
- if (res == FR_OK) {
- *dj->dir = 0xE5; /* Mark the entry "deleted" */
- dj->fs->wflag = 1;
- }
- }
-#endif
-
- return res;
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Pick a segment and create the object name in directory form */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT create_name (
- DIR *dj, /* Pointer to the directory object */
- const XCHAR **path /* Pointer to pointer to the segment in the path string */
-)
-{
-#ifdef _EXCVT
- static const BYTE cvt[] = _EXCVT;
-#endif
-
-#if _USE_LFN /* LFN configuration */
- BYTE b, cf;
- WCHAR w, *lfn;
- int i, ni, si, di;
- const XCHAR *p;
-
- /* Create LFN in Unicode */
- si = di = 0;
- p = *path;
- lfn = dj->lfn;
- for (;;) {
- w = p[si++]; /* Get a character */
- if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */
- if (di >= _MAX_LFN) /* Reject too long name */
- return FR_INVALID_NAME;
-#if !_LFN_UNICODE
- w &= 0xFF;
- if (IsDBCS1(w)) { /* If it is a DBC 1st byte */
- b = p[si++]; /* Get 2nd byte */
- if (!IsDBCS2(b)) /* Reject invalid code for DBC */
- return FR_INVALID_NAME;
- w = (w << 8) + b;
- }
- w = ff_convert(w, 1); /* Convert OEM to Unicode */
- if (!w) return FR_INVALID_NAME; /* Reject invalid code */
-#endif
- if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal chars for LFN */
- return FR_INVALID_NAME;
- lfn[di++] = w; /* Store the Unicode char */
- }
- *path = &p[si]; /* Rerurn pointer to the next segment */
- cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
-#if _FS_RPATH
- if ((di == 1 && lfn[di - 1] == '.') || /* Is this a dot entry? */
- (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) {
- lfn[di] = 0;
- for (i = 0; i < 11; i++)
- dj->fn[i] = (i < di) ? '.' : ' ';
- dj->fn[i] = cf | NS_DOT; /* This is a dot entry */
- return FR_OK;
- }
-#endif
- while (di) { /* Strip trailing spaces and dots */
- w = lfn[di - 1];
- if (w != ' ' && w != '.') break;
- di--;
- }
- if (!di) return FR_INVALID_NAME; /* Reject null string */
-
- lfn[di] = 0; /* LFN is created */
-
- /* Create SFN in directory form */
- mem_set(dj->fn, ' ', 11);
- for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */
- if (si) cf |= NS_LOSS | NS_LFN;
- while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */
-
- b = i = 0; ni = 8;
- for (;;) {
- w = lfn[si++]; /* Get an LFN char */
- if (!w) break; /* Break on enf of the LFN */
- if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */
- cf |= NS_LOSS | NS_LFN; continue;
- }
-
- if (i >= ni || si == di) { /* Extension or end of SFN */
- if (ni == 11) { /* Long extension */
- cf |= NS_LOSS | NS_LFN; break;
- }
- if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */
- if (si > di) break; /* No extension */
- si = di; i = 8; ni = 11; /* Enter extension section */
- b <<= 2; continue;
- }
-
- if (w >= 0x80) { /* Non ASCII char */
-#ifdef _EXCVT
- w = ff_convert(w, 0); /* Unicode -> OEM code */
- if (w) w = cvt[w - 0x80]; /* Convert extended char to upper (SBCS) */
-#else
- w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */
-#endif
- cf |= NS_LFN; /* Force create LFN entry */
- }
-
- if (_DF1S && w >= 0x100) { /* Double byte char */
- if (i >= ni - 1) {
- cf |= NS_LOSS | NS_LFN; i = ni; continue;
- }
- dj->fn[i++] = (BYTE)(w >> 8);
- } else { /* Single byte char */
- if (!w || chk_chr("+,;[=]", w)) { /* Replace illegal chars for SFN */
- w = '_'; cf |= NS_LOSS | NS_LFN; /* Lossy conversion */
- } else {
- if (IsUpper(w)) { /* ASCII large capital */
- b |= 2;
- } else {
- if (IsLower(w)) { /* ASCII small capital */
- b |= 1; w -= 0x20;
- }
- }
- }
- }
- dj->fn[i++] = (BYTE)w;
- }
-
- if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05; /* If the first char collides with deleted mark, replace it with 0x05 */
-
- if (ni == 8) b <<= 2;
- if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */
- cf |= NS_LFN;
- if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended char, NT flags are created */
- if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */
- if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */
- }
-
- dj->fn[NS] = cf; /* SFN is created */
-
- return FR_OK;
-
-
-#else /* Non-LFN configuration */
- BYTE b, c, d, *sfn;
- int ni, si, i;
- const char *p;
-
- /* Create file name in directory form */
- sfn = dj->fn;
- mem_set(sfn, ' ', 11);
- si = i = b = 0; ni = 8;
- p = *path;
-#if _FS_RPATH
- if (p[si] == '.') { /* Is this a dot entry? */
- for (;;) {
- c = p[si++];
- if (c != '.' || si >= 3) break;
- sfn[i++] = c;
- }
- if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME;
- *path = &p[si]; /* Rerurn pointer to the next segment */
- sfn[NS] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */
- return FR_OK;
- }
-#endif
- for (;;) {
- c = p[si++];
- if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */
- if (c == '.' || i >= ni) {
- if (ni != 8 || c != '.') return FR_INVALID_NAME;
- i = 8; ni = 11;
- b <<= 2; continue;
- }
- if (c >= 0x80) { /* Extended char */
-#ifdef _EXCVT
- c = cvt[c - 0x80]; /* Convert extend char (SBCS) */
-#else
- b |= 3; /* Eliminate NT flag if ext char is exist */
-#if !_DF1S /* ASCII only cfg */
- return FR_INVALID_NAME;
-#endif
-#endif
- }
- if (IsDBCS1(c)) { /* DBC 1st byte? */
- d = p[si++]; /* Get 2nd byte */
- if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */
- return FR_INVALID_NAME;
- sfn[i++] = c;
- sfn[i++] = d;
- } else { /* Single byte code */
- if (chk_chr(" \"*+,[=]|\x7F", c)) /* Reject illegal chrs for SFN */
- return FR_INVALID_NAME;
- if (IsUpper(c)) { /* ASCII large capital? */
- b |= 2;
- } else {
- if (IsLower(c)) { /* ASCII small capital? */
- b |= 1; c -= 0x20;
- }
- }
- sfn[i++] = c;
- }
- }
- *path = &p[si]; /* Rerurn pointer to the next segment */
- c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
-
- if (!i) return FR_INVALID_NAME; /* Reject null string */
- if (sfn[0] == 0xE5) sfn[0] = 0x05; /* When first char collides with 0xE5, replace it with 0x05 */
-
- if (ni == 8) b <<= 2;
- if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Extension has only small capital) */
- if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Filename has only small capital) */
-
- sfn[NS] = c; /* Store NT flag, File name is created */
-
- return FR_OK;
-#endif
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Get file information from directory entry */
-/*-----------------------------------------------------------------------*/
-#if _FS_MINIMIZE <= 1
-static
-void get_fileinfo ( /* No return code */
- DIR *dj, /* Pointer to the directory object */
- FILINFO *fno /* Pointer to the file information to be filled */
-)
-{
- int i;
- BYTE c, nt, *dir;
- char *p;
-
-
- p = fno->fname;
- if (dj->sect) {
- dir = dj->dir;
- nt = dir[DIR_NTres]; /* NT flag */
- for (i = 0; i < 8; i++) { /* Copy name body */
- c = dir[i];
- if (c == ' ') break;
- if (c == 0x05) c = 0xE5;
- if (_USE_LFN && (nt & NS_BODY) && IsUpper(c)) c += 0x20;
- *p++ = c;
- }
- if (dir[8] != ' ') { /* Copy name extension */
- *p++ = '.';
- for (i = 8; i < 11; i++) {
- c = dir[i];
- if (c == ' ') break;
- if (_USE_LFN && (nt & NS_EXT) && IsUpper(c)) c += 0x20;
- *p++ = c;
- }
- }
- fno->fattrib = dir[DIR_Attr]; /* Attribute */
- fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */
- fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */
- fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */
- }
- *p = 0;
-
-#if _USE_LFN
- if (fno->lfname) {
- XCHAR *tp = fno->lfname;
- WCHAR w, *lfn;
-
- i = 0;
- if (dj->sect && dj->lfn_idx != 0xFFFF) {/* Get LFN if available */
- lfn = dj->lfn;
- while ((w = *lfn++) != 0) { /* Get an LFN char */
-#if !_LFN_UNICODE
- w = ff_convert(w, 0); /* Unicode -> OEM conversion */
- if (!w) { i = 0; break; } /* Could not convert, no LFN */
- if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC */
- tp[i++] = (XCHAR)(w >> 8);
-#endif
- if (i >= fno->lfsize - 1) { i = 0; break; } /* Buffer overrun, no LFN */
- tp[i++] = (XCHAR)w;
- }
- }
- tp[i] = 0; /* Terminator */
- }
-#endif
-}
-#endif /* _FS_MINIMIZE <= 1 */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Follow a file path */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
- DIR *dj, /* Directory object to return last directory and found object */
- const XCHAR *path /* Full-path string to find a file or directory */
-)
-{
- FRESULT res;
- BYTE *dir, last;
-
-
- while (!_USE_LFN && *path == ' ') path++; /* Skip leading spaces */
-#if _FS_RPATH
- if (*path == '/' || *path == '\\') { /* There is a heading separator */
- path++; dj->sclust = 0; /* Strip it and start from the root dir */
- } else { /* No heading saparator */
- dj->sclust = dj->fs->cdir; /* Start from the current dir */
- }
-#else
- if (*path == '/' || *path == '\\') /* Strip heading separator if exist */
- path++;
- dj->sclust = 0; /* Start from the root dir */
-#endif
-
- if ((UINT)*path < ' ') { /* Null path means the start directory itself */
- res = dir_seek(dj, 0);
- dj->dir = NULL;
-
- } else { /* Follow path */
- for (;;) {
- res = create_name(dj, &path); /* Get a segment */
- if (res != FR_OK) break;
- res = dir_find(dj); /* Find it */
- last = *(dj->fn+NS) & NS_LAST;
- if (res != FR_OK) { /* Could not find the object */
- if (res == FR_NO_FILE && !last)
- res = FR_NO_PATH;
- break;
- }
- if (last) break; /* Last segment match. Function completed. */
- dir = dj->dir; /* There is next segment. Follow the sub directory */
- if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */
- res = FR_NO_PATH; break;
- }
- dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- }
- }
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Load boot record and check if it is an FAT boot record */
-/*-----------------------------------------------------------------------*/
-
-static
-BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
- FATFS *fs, /* File system object */
- DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
-)
-{
- if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK) /* Load boot record */
- return 3;
- if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
- return 2;
-
- if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
- return 0;
- if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
- return 0;
-
- return 1;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Make sure that the file system is valid */
-/*-----------------------------------------------------------------------*/
-
-
-FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occured */
- const XCHAR **path, /* Pointer to pointer to the path name (drive number) */
- FATFS **rfs, /* Pointer to pointer to the found file system object */
- BYTE chk_wp /* !=0: Check media write protection for write access */
-)
-{
- BYTE fmt, *tbl;
- UINT vol;
- DSTATUS stat;
- DWORD bsect, fsize, tsect, mclst;
- const XCHAR *p = *path;
- FATFS *fs;
-
- /* Get logical drive number from the path name */
- vol = p[0] - '0'; /* Is there a drive number? */
- if (vol <= 9 && p[1] == ':') { /* Found a drive number, get and strip it */
- p += 2; *path = p; /* Return pointer to the path name */
- } else { /* No drive number is given */
-#if _FS_RPATH
- vol = Drive; /* Use current drive */
-#else
- vol = 0; /* Use drive 0 */
-#endif
- }
-
- /* Check if the logical drive is valid or not */
- if (vol >= _DRIVES) /* Is the drive number valid? */
- return FR_INVALID_DRIVE;
- *rfs = fs = FatFs[vol]; /* Returen pointer to the corresponding file system object */
- if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */
-
- ENTER_FF(fs); /* Lock file system */
-
- if (fs->fs_type) { /* If the logical drive has been mounted */
- stat = disk_status(fs->drive);
- if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized (has not been changed), */
-#if !_FS_READONLY
- if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
- return FR_WRITE_PROTECTED;
-#endif
- return FR_OK; /* The file system object is valid */
- }
- }
-
- /* The logical drive must be mounted. Following code attempts to mount the volume */
-
- fs->fs_type = 0; /* Clear the file system object */
- fs->drive = (BYTE)LD2PD(vol); /* Bind the logical drive and a physical drive */
- stat = disk_initialize(fs->drive); /* Initialize low level disk I/O layer */
- if (stat & STA_NOINIT) /* Check if the drive is ready */
- return FR_NOT_READY;
-#if _MAX_SS != 512 /* Get disk sector size if needed */
- if (disk_ioctl(fs->drive, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS)
- return FR_NO_FILESYSTEM;
-#endif
-#if !_FS_READONLY
- if (chk_wp && (stat & STA_PROTECT)) /* Check disk write protection if needed */
- return FR_WRITE_PROTECTED;
-#endif
- /* Search FAT partition on the drive */
- fmt = check_fs(fs, bsect = 0); /* Check sector 0 as an SFD format */
- if (fmt == 1) { /* Not an FAT boot record, it may be patitioned */
- /* Check a partition listed in top of the partition table */
- tbl = &fs->win[MBR_Table + LD2PT(vol) * 16]; /* Partition table */
- if (tbl[4]) { /* Is the partition existing? */
- bsect = LD_DWORD(&tbl[8]); /* Partition offset in LBA */
- fmt = check_fs(fs, bsect); /* Check the partition */
- }
- }
- if (fmt == 3) return FR_DISK_ERR;
- if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs)) /* No valid FAT patition is found */
- return FR_NO_FILESYSTEM;
-
- /* Initialize the file system object */
- fsize = LD_WORD(fs->win+BPB_FATSz16); /* Number of sectors per FAT */
- if (!fsize) fsize = LD_DWORD(fs->win+BPB_FATSz32);
- fs->sects_fat = fsize;
- fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */
- fsize *= fs->n_fats; /* (Number of sectors in FAT area) */
- fs->fatbase = bsect + LD_WORD(fs->win+BPB_RsvdSecCnt); /* FAT start sector (lba) */
- fs->csize = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */
- fs->n_rootdir = LD_WORD(fs->win+BPB_RootEntCnt); /* Nmuber of root directory entries */
- tsect = LD_WORD(fs->win+BPB_TotSec16); /* Number of sectors on the volume */
- if (!tsect) tsect = LD_DWORD(fs->win+BPB_TotSec32);
- fs->max_clust = mclst = (tsect /* Last cluster# + 1 (Number of clusters + 2) */
- - LD_WORD(fs->win+BPB_RsvdSecCnt) - fsize - fs->n_rootdir / (SS(fs)/32)
- ) / fs->csize + 2;
-
- fmt = FS_FAT12; /* Determine the FAT sub type */
- if (mclst >= 0xFF7) fmt = FS_FAT16; /* Number of clusters >= 0xFF5 */
- if (mclst >= 0xFFF7) fmt = FS_FAT32; /* Number of clusters >= 0xFFF5 */
-
- if (fmt == FS_FAT32)
- fs->dirbase = LD_DWORD(fs->win+BPB_RootClus); /* Root directory start cluster */
- else
- fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */
- fs->database = fs->fatbase + fsize + fs->n_rootdir / (SS(fs)/32); /* Data start sector (lba) */
-
-#if !_FS_READONLY
- /* Initialize allocation information */
- fs->free_clust = 0xFFFFFFFF;
- fs->wflag = 0;
- /* Get fsinfo if needed */
- if (fmt == FS_FAT32) {
- fs->fsi_flag = 0;
- fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);
- if (disk_read(fs->drive, fs->win, fs->fsi_sector, 1) == RES_OK &&
- LD_WORD(fs->win+BS_55AA) == 0xAA55 &&
- LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&
- LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {
- fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);
- fs->free_clust = LD_DWORD(fs->win+FSI_Free_Count);
- }
- }
-#endif
- fs->fs_type = fmt; /* FAT sub-type */
- fs->winsect = 0; /* Invalidate sector cache */
-#if _FS_RPATH
- fs->cdir = 0; /* Current directory (root dir) */
-#endif
- fs->id = ++Fsid; /* File system mount ID */
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Check if the file/dir object is valid or not */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */
- FATFS *fs, /* Pointer to the file system object */
- WORD id /* Member id of the target object to be checked */
-)
-{
- if (!fs || !fs->fs_type || fs->id != id)
- return FR_INVALID_OBJECT;
-
- ENTER_FF(fs); /* Lock file system */
-
- if (disk_status(fs->drive) & STA_NOINIT)
- return FR_NOT_READY;
-
- return FR_OK;
-}
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Public Functions
-
---------------------------------------------------------------------------*/
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Mount/Unmount a Locical Drive */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_mount (
- BYTE vol, /* Logical drive number to be mounted/unmounted */
- FATFS *fs /* Pointer to new file system object (NULL for unmount)*/
-)
-{
- FATFS *rfs;
-
-
- if (vol >= _DRIVES) /* Check if the drive number is valid */
- return FR_INVALID_DRIVE;
- rfs = FatFs[vol]; /* Get current fs object */
-
- if (rfs) {
-#if _FS_REENTRANT /* Discard sync object of the current volume */
- if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;
-#endif
- rfs->fs_type = 0; /* Clear old fs object */
- }
-
- if (fs) {
- fs->fs_type = 0; /* Clear new fs object */
-#if _FS_REENTRANT /* Create sync object for the new volume */
- if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;
-#endif
- }
- FatFs[vol] = fs; /* Register new fs object */
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Open or Create a File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_open (
- FIL *fp, /* Pointer to the blank file object */
- const XCHAR *path, /* Pointer to the file name */
- BYTE mode /* Access mode and file open mode flags */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- fp->fs = NULL; /* Clear file object */
-#if !_FS_READONLY
- mode &= (FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW);
- res = chk_mounted(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)));
-#else
- mode &= FA_READ;
- res = chk_mounted(&path, &dj.fs, 0);
-#endif
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
-
-#if !_FS_READONLY
- /* Create or Open a file */
- if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) {
- DWORD ps, cl;
-
- if (res != FR_OK) { /* No file, create new */
- if (res == FR_NO_FILE) /* There is no file to open, create a new entry */
- res = dir_register(&dj);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- mode |= FA_CREATE_ALWAYS;
- dir = dj.dir; /* Created entry (SFN entry) */
- }
- else { /* Any object is already existing */
- if (mode & FA_CREATE_NEW) /* Cannot create new */
- LEAVE_FF(dj.fs, FR_EXIST);
- dir = dj.dir;
- if (!dir || (dir[DIR_Attr] & (AM_RDO | AM_DIR))) /* Cannot overwrite it (R/O or DIR) */
- LEAVE_FF(dj.fs, FR_DENIED);
- if (mode & FA_CREATE_ALWAYS) { /* Resize it to zero on over write mode */
- cl = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO); /* Get start cluster */
- ST_WORD(dir+DIR_FstClusHI, 0); /* cluster = 0 */
- ST_WORD(dir+DIR_FstClusLO, 0);
- ST_DWORD(dir+DIR_FileSize, 0); /* size = 0 */
- dj.fs->wflag = 1;
- ps = dj.fs->winsect; /* Remove the cluster chain */
- if (cl) {
- res = remove_chain(dj.fs, cl);
- if (res) LEAVE_FF(dj.fs, res);
- dj.fs->last_clust = cl - 1; /* Reuse the cluster hole */
- }
- res = move_window(dj.fs, ps);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- }
- }
- if (mode & FA_CREATE_ALWAYS) {
- dir[DIR_Attr] = 0; /* Reset attribute */
- ps = get_fattime();
- ST_DWORD(dir+DIR_CrtTime, ps); /* Created time */
- dj.fs->wflag = 1;
- mode |= FA__WRITTEN; /* Set file changed flag */
- }
- }
- /* Open an existing file */
- else {
-#endif /* !_FS_READONLY */
- if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
- dir = dj.dir;
- if (!dir || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
- LEAVE_FF(dj.fs, FR_NO_FILE);
-#if !_FS_READONLY
- if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */
- LEAVE_FF(dj.fs, FR_DENIED);
- }
- fp->dir_sect = dj.fs->winsect; /* Pointer to the directory entry */
- fp->dir_ptr = dj.dir;
-#endif
- fp->flag = mode; /* File access mode */
- fp->org_clust = /* File start cluster */
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- fp->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */
- fp->fptr = 0; fp->csect = 255; /* File pointer */
- fp->dsect = 0;
- fp->fs = dj.fs; fp->id = dj.fs->id; /* Owner file system object of the file */
-
- LEAVE_FF(dj.fs, FR_OK);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_read (
- FIL *fp, /* Pointer to the file object */
- void *buff, /* Pointer to data buffer */
- UINT btr, /* Number of bytes to read */
- UINT *br /* Pointer to number of bytes read */
-)
-{
- FRESULT res;
- DWORD clst, sect, remain;
- UINT rcnt, cc;
- BYTE *rbuff = buff;
-
-
- *br = 0; /* Initialize bytes read */
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_READ)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
- remain = fp->fsize - fp->fptr;
- if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
-
- for ( ; btr; /* Repeat until all data transferred */
- rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
- if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
- if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
- clst = (fp->fptr == 0) ? /* On the top of the file? */
- fp->org_clust : get_fat(fp->fs, fp->curr_clust);
- if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->curr_clust = clst; /* Update current cluster */
- fp->csect = 0; /* Reset sector offset in the cluster */
- }
- sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
- if (!sect) ABORT(fp->fs, FR_INT_ERR);
- sect += fp->csect;
- cc = btr / SS(fp->fs); /* When remaining bytes >= sector size, */
- if (cc) { /* Read maximum contiguous sectors directly */
- if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
- cc = fp->fs->csize - fp->csect;
- if (disk_read(fp->fs->drive, rbuff, sect, (BYTE)cc) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
-#if !_FS_READONLY && _FS_MINIMIZE <= 2
-#if _FS_TINY
- if (fp->fs->wflag && fp->fs->winsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
- mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs));
-#else
- if ((fp->flag & FA__DIRTY) && fp->dsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
- mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs));
-#endif
-#endif
- fp->csect += (BYTE)cc; /* Next sector address in the cluster */
- rcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
- continue;
- }
-#if !_FS_TINY
-#if !_FS_READONLY
- if (fp->flag & FA__DIRTY) { /* Write sector I/O buffer if needed */
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- if (fp->dsect != sect) { /* Fill sector buffer with file data */
- if (disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- }
-#endif
- fp->dsect = sect;
- fp->csect++; /* Next sector address in the cluster */
- }
- rcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Get partial sector data from sector buffer */
- if (rcnt > btr) rcnt = btr;
-#if _FS_TINY
- if (move_window(fp->fs, fp->dsect)) /* Move sector window */
- ABORT(fp->fs, FR_DISK_ERR);
- mem_cpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
-#else
- mem_cpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
-#endif
- }
-
- LEAVE_FF(fp->fs, FR_OK);
-}
-
-
-
-
-#if !_FS_READONLY
-/*-----------------------------------------------------------------------*/
-/* Write File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_write (
- FIL *fp, /* Pointer to the file object */
- const void *buff, /* Pointer to the data to be written */
- UINT btw, /* Number of bytes to write */
- UINT *bw /* Pointer to number of bytes written */
-)
-{
- FRESULT res;
- DWORD clst, sect;
- UINT wcnt, cc;
- const BYTE *wbuff = buff;
-
-
- *bw = 0; /* Initialize bytes written */
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_WRITE)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
- if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
-
- for ( ; btw; /* Repeat until all data transferred */
- wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
- if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
- if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
- if (fp->fptr == 0) { /* On the top of the file? */
- clst = fp->org_clust; /* Follow from the origin */
- if (clst == 0) /* When there is no cluster chain, */
- fp->org_clust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */
- } else { /* Middle or end of the file */
- clst = create_chain(fp->fs, fp->curr_clust); /* Follow or streach cluster chain */
- }
- if (clst == 0) break; /* Could not allocate a new cluster (disk full) */
- if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->curr_clust = clst; /* Update current cluster */
- fp->csect = 0; /* Reset sector address in the cluster */
- }
-#if _FS_TINY
- if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0)) /* Write back data buffer prior to following direct transfer */
- ABORT(fp->fs, FR_DISK_ERR);
-#else
- if (fp->flag & FA__DIRTY) { /* Write back data buffer prior to following direct transfer */
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
- if (!sect) ABORT(fp->fs, FR_INT_ERR);
- sect += fp->csect;
- cc = btw / SS(fp->fs); /* When remaining bytes >= sector size, */
- if (cc) { /* Write maximum contiguous sectors directly */
- if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
- cc = fp->fs->csize - fp->csect;
- if (disk_write(fp->fs->drive, wbuff, sect, (BYTE)cc) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
-#if _FS_TINY
- if (fp->fs->winsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
- mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs));
- fp->fs->wflag = 0;
- }
-#else
- if (fp->dsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
- mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs));
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- fp->csect += (BYTE)cc; /* Next sector address in the cluster */
- wcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
- continue;
- }
-#if _FS_TINY
- if (fp->fptr >= fp->fsize) { /* Avoid silly buffer filling at growing edge */
- if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR);
- fp->fs->winsect = sect;
- }
-#else
- if (fp->dsect != sect) { /* Fill sector buffer with file data */
- if (fp->fptr < fp->fsize &&
- disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- }
-#endif
- fp->dsect = sect;
- fp->csect++; /* Next sector address in the cluster */
- }
- wcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Put partial sector into file I/O buffer */
- if (wcnt > btw) wcnt = btw;
-#if _FS_TINY
- if (move_window(fp->fs, fp->dsect)) /* Move sector window */
- ABORT(fp->fs, FR_DISK_ERR);
- mem_cpy(&fp->fs->win[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
- fp->fs->wflag = 1;
-#else
- mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
- fp->flag |= FA__DIRTY;
-#endif
- }
-
- if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */
- fp->flag |= FA__WRITTEN; /* Set file changed flag */
-
- LEAVE_FF(fp->fs, FR_OK);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Synchronize the File Object */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_sync (
- FIL *fp /* Pointer to the file object */
-)
-{
- FRESULT res;
- DWORD tim;
- BYTE *dir;
-
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res == FR_OK) {
- if (fp->flag & FA__WRITTEN) { /* Has the file been written? */
-#if !_FS_TINY /* Write-back dirty buffer */
- if (fp->flag & FA__DIRTY) {
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- LEAVE_FF(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- /* Update the directory entry */
- res = move_window(fp->fs, fp->dir_sect);
- if (res == FR_OK) {
- dir = fp->dir_ptr;
- dir[DIR_Attr] |= AM_ARC; /* Set archive bit */
- ST_DWORD(dir+DIR_FileSize, fp->fsize); /* Update file size */
- ST_WORD(dir+DIR_FstClusLO, fp->org_clust); /* Update start cluster */
- ST_WORD(dir+DIR_FstClusHI, fp->org_clust >> 16);
- tim = get_fattime(); /* Updated time */
- ST_DWORD(dir+DIR_WrtTime, tim);
- fp->flag &= ~FA__WRITTEN;
- fp->fs->wflag = 1;
- res = sync(fp->fs);
- }
- }
- }
-
- LEAVE_FF(fp->fs, res);
-}
-
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Close File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_close (
- FIL *fp /* Pointer to the file object to be closed */
-)
-{
- FRESULT res;
-
-
-#if _FS_READONLY
- res = validate(fp->fs, fp->id);
- if (res == FR_OK) fp->fs = NULL;
- LEAVE_FF(fp->fs, res);
-#else
- res = f_sync(fp);
- if (res == FR_OK) fp->fs = NULL;
- return res;
-#endif
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change Current Drive/Directory */
-/*-----------------------------------------------------------------------*/
-
-#if _FS_RPATH
-
-FRESULT f_chdrive (
- BYTE drv /* Drive number */
-)
-{
- if (drv >= _DRIVES) return FR_INVALID_DRIVE;
-
- Drive = drv;
-
- return FR_OK;
-}
-
-
-
-
-FRESULT f_chdir (
- const XCHAR *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj.fs, 0);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (res == FR_OK) { /* Follow completed */
- dir = dj.dir; /* Pointer to the entry */
- if (!dir) {
- dj.fs->cdir = 0; /* No entry (root dir) */
- } else {
- if (dir[DIR_Attr] & AM_DIR) /* Reached to the dir */
- dj.fs->cdir = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- else
- res = FR_NO_PATH; /* Could not reach the dir (it is a file) */
- }
- }
- if (res == FR_NO_FILE) res = FR_NO_PATH;
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-#endif
-
-
-
-#if _FS_MINIMIZE <= 2
-/*-----------------------------------------------------------------------*/
-/* Seek File R/W Pointer */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_lseek (
- FIL *fp, /* Pointer to the file object */
- DWORD ofs /* File pointer from top of file */
-)
-{
- FRESULT res;
- DWORD clst, bcs, nsect, ifptr;
-
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (ofs > fp->fsize /* In read-only mode, clip offset with the file size */
-#if !_FS_READONLY
- && !(fp->flag & FA_WRITE)
-#endif
- ) ofs = fp->fsize;
-
- ifptr = fp->fptr;
- fp->fptr = nsect = 0; fp->csect = 255;
- if (ofs > 0) {
- bcs = (DWORD)fp->fs->csize * SS(fp->fs); /* Cluster size (byte) */
- if (ifptr > 0 &&
- (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */
- fp->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */
- ofs -= fp->fptr;
- clst = fp->curr_clust;
- } else { /* When seek to back cluster, */
- clst = fp->org_clust; /* start from the first cluster */
-#if !_FS_READONLY
- if (clst == 0) { /* If no cluster chain, create a new chain */
- clst = create_chain(fp->fs, 0);
- if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->org_clust = clst;
- }
-#endif
- fp->curr_clust = clst;
- }
- if (clst != 0) {
- while (ofs > bcs) { /* Cluster following loop */
-#if !_FS_READONLY
- if (fp->flag & FA_WRITE) { /* Check if in write mode or not */
- clst = create_chain(fp->fs, clst); /* Force streached if in write mode */
- if (clst == 0) { /* When disk gets full, clip file size */
- ofs = bcs; break;
- }
- } else
-#endif
- clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- if (clst <= 1 || clst >= fp->fs->max_clust) ABORT(fp->fs, FR_INT_ERR);
- fp->curr_clust = clst;
- fp->fptr += bcs;
- ofs -= bcs;
- }
- fp->fptr += ofs;
- fp->csect = (BYTE)(ofs / SS(fp->fs)); /* Sector offset in the cluster */
- if (ofs % SS(fp->fs)) {
- nsect = clust2sect(fp->fs, clst); /* Current sector */
- if (!nsect) ABORT(fp->fs, FR_INT_ERR);
- nsect += fp->csect;
- fp->csect++;
- }
- }
- }
- if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) {
-#if !_FS_TINY
-#if !_FS_READONLY
- if (fp->flag & FA__DIRTY) { /* Write-back dirty buffer if needed */
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- if (disk_read(fp->fs->drive, fp->buf, nsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
-#endif
- fp->dsect = nsect;
- }
-#if !_FS_READONLY
- if (fp->fptr > fp->fsize) { /* Set changed flag if the file size is extended */
- fp->fsize = fp->fptr;
- fp->flag |= FA__WRITTEN;
- }
-#endif
-
- LEAVE_FF(fp->fs, res);
-}
-
-
-
-
-#if _FS_MINIMIZE <= 1
-/*-----------------------------------------------------------------------*/
-/* Create a Directroy Object */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_opendir (
- DIR *dj, /* Pointer to directory object to create */
- const XCHAR *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj->fs, 0);
- if (res == FR_OK) {
- INITBUF((*dj), sfn, lfn);
- res = follow_path(dj, path); /* Follow the path to the directory */
- if (res == FR_OK) { /* Follow completed */
- dir = dj->dir;
- if (dir) { /* It is not the root dir */
- if (dir[DIR_Attr] & AM_DIR) { /* The object is a directory */
- dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- } else { /* The object is not a directory */
- res = FR_NO_PATH;
- }
- }
- if (res == FR_OK) {
- dj->id = dj->fs->id;
- res = dir_seek(dj, 0); /* Rewind dir */
- }
- }
- if (res == FR_NO_FILE) res = FR_NO_PATH;
- }
-
- LEAVE_FF(dj->fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read Directory Entry in Sequense */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_readdir (
- DIR *dj, /* Pointer to the open directory object */
- FILINFO *fno /* Pointer to file information to return */
-)
-{
- FRESULT res;
- NAMEBUF(sfn, lfn);
-
-
- res = validate(dj->fs, dj->id); /* Check validity of the object */
- if (res == FR_OK) {
- INITBUF((*dj), sfn, lfn);
- if (!fno) {
- res = dir_seek(dj, 0);
- } else {
- res = dir_read(dj);
- if (res == FR_NO_FILE) {
- dj->sect = 0;
- res = FR_OK;
- }
- if (res == FR_OK) { /* A valid entry is found */
- get_fileinfo(dj, fno); /* Get the object information */
- res = dir_next(dj, FALSE); /* Increment index for next */
- if (res == FR_NO_FILE) {
- dj->sect = 0;
- res = FR_OK;
- }
- }
- }
- }
-
- LEAVE_FF(dj->fs, res);
-}
-
-
-
-#if _FS_MINIMIZE == 0
-/*-----------------------------------------------------------------------*/
-/* Get File Status */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_stat (
- const XCHAR *path, /* Pointer to the file path */
- FILINFO *fno /* Pointer to file information to return */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
-
-
- res = chk_mounted(&path, &dj.fs, 0);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (res == FR_OK) { /* Follwo completed */
- if (dj.dir) /* Found an object */
- get_fileinfo(&dj, fno);
- else /* It is root dir */
- res = FR_INVALID_NAME;
- }
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-#if !_FS_READONLY
-/*-----------------------------------------------------------------------*/
-/* Get Number of Free Clusters */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_getfree (
- const XCHAR *path, /* Pointer to the logical drive number (root dir) */
- DWORD *nclst, /* Pointer to the variable to return number of free clusters */
- FATFS **fatfs /* Pointer to pointer to corresponding file system object to return */
-)
-{
- FRESULT res;
- DWORD n, clst, sect, stat;
- UINT i;
- BYTE fat, *p;
-
-
- /* Get drive number */
- res = chk_mounted(&path, fatfs, 0);
- if (res != FR_OK) LEAVE_FF(*fatfs, res);
-
- /* If number of free cluster is valid, return it without cluster scan. */
- if ((*fatfs)->free_clust <= (*fatfs)->max_clust - 2) {
- *nclst = (*fatfs)->free_clust;
- LEAVE_FF(*fatfs, FR_OK);
- }
-
- /* Get number of free clusters */
- fat = (*fatfs)->fs_type;
- n = 0;
- if (fat == FS_FAT12) {
- clst = 2;
- do {
- stat = get_fat(*fatfs, clst);
- if (stat == 0xFFFFFFFF) LEAVE_FF(*fatfs, FR_DISK_ERR);
- if (stat == 1) LEAVE_FF(*fatfs, FR_INT_ERR);
- if (stat == 0) n++;
- } while (++clst < (*fatfs)->max_clust);
- } else {
- clst = (*fatfs)->max_clust;
- sect = (*fatfs)->fatbase;
- i = 0; p = 0;
- do {
- if (!i) {
- res = move_window(*fatfs, sect++);
- if (res != FR_OK)
- LEAVE_FF(*fatfs, res);
- p = (*fatfs)->win;
- i = SS(*fatfs);
- }
- if (fat == FS_FAT16) {
- if (LD_WORD(p) == 0) n++;
- p += 2; i -= 2;
- } else {
- if ((LD_DWORD(p) & 0x0FFFFFFF) == 0) n++;
- p += 4; i -= 4;
- }
- } while (--clst);
- }
- (*fatfs)->free_clust = n;
- if (fat == FS_FAT32) (*fatfs)->fsi_flag = 1;
- *nclst = n;
-
- LEAVE_FF(*fatfs, FR_OK);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Truncate File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_truncate (
- FIL *fp /* Pointer to the file object */
-)
-{
- FRESULT res;
- DWORD ncl;
-
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_WRITE)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
-
- if (fp->fsize > fp->fptr) {
- fp->fsize = fp->fptr; /* Set file size to current R/W point */
- fp->flag |= FA__WRITTEN;
- if (fp->fptr == 0) { /* When set file size to zero, remove entire cluster chain */
- res = remove_chain(fp->fs, fp->org_clust);
- fp->org_clust = 0;
- } else { /* When truncate a part of the file, remove remaining clusters */
- ncl = get_fat(fp->fs, fp->curr_clust);
- res = FR_OK;
- if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;
- if (ncl == 1) res = FR_INT_ERR;
- if (res == FR_OK && ncl < fp->fs->max_clust) {
- res = put_fat(fp->fs, fp->curr_clust, 0x0FFFFFFF);
- if (res == FR_OK) res = remove_chain(fp->fs, ncl);
- }
- }
- }
- if (res != FR_OK) fp->flag |= FA__ERROR;
-
- LEAVE_FF(fp->fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Delete a File or Directory */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_unlink (
- const XCHAR *path /* Pointer to the file or directory path */
-)
-{
- FRESULT res;
- DIR dj, sdj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
- DWORD dclst;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
-
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
-
- dir = dj.dir;
- if (!dir) /* Is it the root directory? */
- LEAVE_FF(dj.fs, FR_INVALID_NAME);
- if (dir[DIR_Attr] & AM_RDO) /* Is it a R/O object? */
- LEAVE_FF(dj.fs, FR_DENIED);
- dclst = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
-
- if (dir[DIR_Attr] & AM_DIR) { /* It is a sub-directory */
- if (dclst < 2) LEAVE_FF(dj.fs, FR_INT_ERR);
- mem_cpy(&sdj, &dj, sizeof(DIR)); /* Check if the sub-dir is empty or not */
- sdj.sclust = dclst;
- res = dir_seek(&sdj, 2);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- res = dir_read(&sdj);
- if (res == FR_OK) res = FR_DENIED; /* Not empty sub-dir */
- if (res != FR_NO_FILE) LEAVE_FF(dj.fs, res);
- }
-
- res = dir_remove(&dj); /* Remove directory entry */
- if (res == FR_OK) {
- if (dclst)
- res = remove_chain(dj.fs, dclst); /* Remove the cluster chain */
- if (res == FR_OK) res = sync(dj.fs);
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Create a Directory */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_mkdir (
- const XCHAR *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir, n;
- DWORD dsect, dclst, pclst, tim;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
-
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (res == FR_OK) res = FR_EXIST; /* Any file or directory is already existing */
- if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res != FR_NO_FILE) /* Any error occured */
- LEAVE_FF(dj.fs, res);
-
- dclst = create_chain(dj.fs, 0); /* Allocate a new cluster for new directory table */
- res = FR_OK;
- if (dclst == 0) res = FR_DENIED;
- if (dclst == 1) res = FR_INT_ERR;
- if (dclst == 0xFFFFFFFF) res = FR_DISK_ERR;
- if (res == FR_OK)
- res = move_window(dj.fs, 0);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- dsect = clust2sect(dj.fs, dclst);
-
- dir = dj.fs->win; /* Initialize the new directory table */
- mem_set(dir, 0, SS(dj.fs));
- mem_set(dir+DIR_Name, ' ', 8+3); /* Create "." entry */
- dir[DIR_Name] = '.';
- dir[DIR_Attr] = AM_DIR;
- tim = get_fattime();
- ST_DWORD(dir+DIR_WrtTime, tim);
- ST_WORD(dir+DIR_FstClusLO, dclst);
- ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
- mem_cpy(dir+32, dir, 32); /* Create ".." entry */
- dir[33] = '.';
- pclst = dj.sclust;
- if (dj.fs->fs_type == FS_FAT32 && pclst == dj.fs->dirbase)
- pclst = 0;
- ST_WORD(dir+32+DIR_FstClusLO, pclst);
- ST_WORD(dir+32+DIR_FstClusHI, pclst >> 16);
- for (n = 0; n < dj.fs->csize; n++) { /* Write dot entries and clear left sectors */
- dj.fs->winsect = dsect++;
- dj.fs->wflag = 1;
- res = move_window(dj.fs, 0);
- if (res) LEAVE_FF(dj.fs, res);
- mem_set(dir, 0, SS(dj.fs));
- }
-
- res = dir_register(&dj);
- if (res != FR_OK) {
- remove_chain(dj.fs, dclst);
- } else {
- dir = dj.dir;
- dir[DIR_Attr] = AM_DIR; /* Attribute */
- ST_DWORD(dir+DIR_WrtTime, tim); /* Crated time */
- ST_WORD(dir+DIR_FstClusLO, dclst); /* Table start cluster */
- ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
- dj.fs->wflag = 1;
- res = sync(dj.fs);
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change File Attribute */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_chmod (
- const XCHAR *path, /* Pointer to the file path */
- BYTE value, /* Attribute bits */
- BYTE mask /* Attribute mask to change */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res == FR_OK) {
- dir = dj.dir;
- if (!dir) { /* Is it a root directory? */
- res = FR_INVALID_NAME;
- } else { /* File or sub directory */
- mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC; /* Valid attribute mask */
- dir[DIR_Attr] = (value & mask) | (dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */
- dj.fs->wflag = 1;
- res = sync(dj.fs);
- }
- }
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change Timestamp */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_utime (
- const XCHAR *path, /* Pointer to the file/directory name */
- const FILINFO *fno /* Pointer to the timestamp to be set */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res == FR_OK) {
- dir = dj.dir;
- if (!dir) { /* Root directory */
- res = FR_INVALID_NAME;
- } else { /* File or sub-directory */
- ST_WORD(dir+DIR_WrtTime, fno->ftime);
- ST_WORD(dir+DIR_WrtDate, fno->fdate);
- dj.fs->wflag = 1;
- res = sync(dj.fs);
- }
- }
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Rename File/Directory */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_rename (
- const XCHAR *path_old, /* Pointer to the old name */
- const XCHAR *path_new /* Pointer to the new name */
-)
-{
- FRESULT res;
- DIR dj_old, dj_new;
- NAMEBUF(sfn, lfn);
- BYTE buf[21], *dir;
- DWORD dw;
-
-
- INITBUF(dj_old, sfn, lfn);
- res = chk_mounted(&path_old, &dj_old.fs, 1);
- if (res == FR_OK) {
- dj_new.fs = dj_old.fs;
- res = follow_path(&dj_old, path_old); /* Check old object */
- if (_FS_RPATH && res == FR_OK && (dj_old.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- }
- if (res != FR_OK) LEAVE_FF(dj_old.fs, res); /* The old object is not found */
-
- if (!dj_old.dir) LEAVE_FF(dj_old.fs, FR_NO_FILE); /* Is root dir? */
- mem_cpy(buf, dj_old.dir+DIR_Attr, 21); /* Save the object information */
-
- mem_cpy(&dj_new, &dj_old, sizeof(DIR));
- res = follow_path(&dj_new, path_new); /* Check new object */
- if (res == FR_OK) res = FR_EXIST; /* The new object name is already existing */
- if (res == FR_NO_FILE) { /* Is it a valid path and no name collision? */
- res = dir_register(&dj_new); /* Register the new object */
- if (res == FR_OK) {
- dir = dj_new.dir; /* Copy object information into new entry */
- mem_cpy(dir+13, buf+2, 19);
- dir[DIR_Attr] = buf[0] | AM_ARC;
- dj_old.fs->wflag = 1;
- if (dir[DIR_Attr] & AM_DIR) { /* Update .. entry in the directory if needed */
- dw = clust2sect(dj_new.fs, (DWORD)LD_WORD(dir+DIR_FstClusHI) | LD_WORD(dir+DIR_FstClusLO));
- if (!dw) {
- res = FR_INT_ERR;
- } else {
- res = move_window(dj_new.fs, dw);
- dir = dj_new.fs->win+32;
- if (res == FR_OK && dir[1] == '.') {
- dw = (dj_new.fs->fs_type == FS_FAT32 && dj_new.sclust == dj_new.fs->dirbase) ? 0 : dj_new.sclust;
- ST_WORD(dir+DIR_FstClusLO, dw);
- ST_WORD(dir+DIR_FstClusHI, dw >> 16);
- dj_new.fs->wflag = 1;
- }
- }
- }
- if (res == FR_OK) {
- res = dir_remove(&dj_old); /* Remove old entry */
- if (res == FR_OK)
- res = sync(dj_old.fs);
- }
- }
- }
-
- LEAVE_FF(dj_old.fs, res);
-}
-
-#endif /* !_FS_READONLY */
-#endif /* _FS_MINIMIZE == 0 */
-#endif /* _FS_MINIMIZE <= 1 */
-#endif /* _FS_MINIMIZE <= 2 */
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Forward data to the stream directly (Available on only _FS_TINY cfg) */
-/*-----------------------------------------------------------------------*/
-#if _USE_FORWARD && _FS_TINY
-
-FRESULT f_forward (
- FIL *fp, /* Pointer to the file object */
- UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */
- UINT btr, /* Number of bytes to forward */
- UINT *bf /* Pointer to number of bytes forwarded */
-)
-{
- FRESULT res;
- DWORD remain, clst, sect;
- UINT rcnt;
-
-
- *bf = 0;
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check error flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_READ)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
-
- remain = fp->fsize - fp->fptr;
- if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
-
- for ( ; btr && (*func)(NULL, 0); /* Repeat until all data transferred or stream becomes busy */
- fp->fptr += rcnt, *bf += rcnt, btr -= rcnt) {
- if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
- if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
- clst = (fp->fptr == 0) ? /* On the top of the file? */
- fp->org_clust : get_fat(fp->fs, fp->curr_clust);
- if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->curr_clust = clst; /* Update current cluster */
- fp->csect = 0; /* Reset sector address in the cluster */
- }
- fp->csect++; /* Next sector address in the cluster */
- }
- sect = clust2sect(fp->fs, fp->curr_clust); /* Get current data sector */
- if (!sect) ABORT(fp->fs, FR_INT_ERR);
- sect += fp->csect - 1;
- if (move_window(fp->fs, sect)) /* Move sector window */
- ABORT(fp->fs, FR_DISK_ERR);
- fp->dsect = sect;
- rcnt = SS(fp->fs) - (WORD)(fp->fptr % SS(fp->fs)); /* Forward data from sector window */
- if (rcnt > btr) rcnt = btr;
- rcnt = (*func)(&fp->fs->win[(WORD)fp->fptr % SS(fp->fs)], rcnt);
- if (!rcnt) ABORT(fp->fs, FR_INT_ERR);
- }
-
- LEAVE_FF(fp->fs, FR_OK);
-}
-#endif /* _USE_FORWARD */
-
-
-
-#if _USE_MKFS && !_FS_READONLY
-/*-----------------------------------------------------------------------*/
-/* Create File System on the Drive */
-/*-----------------------------------------------------------------------*/
-#define N_ROOTDIR 512 /* Multiple of 32 and <= 2048 */
-#define N_FATS 1 /* 1 or 2 */
-#define MAX_SECTOR 131072000UL /* Maximum partition size */
-#define MIN_SECTOR 2000UL /* Minimum partition size */
-
-
-FRESULT f_mkfs (
- BYTE drv, /* Logical drive number */
- BYTE partition, /* Partitioning rule 0:FDISK, 1:SFD */
- WORD allocsize /* Allocation unit size [bytes] */
-)
-{
- static const DWORD sstbl[] = { 2048000, 1024000, 512000, 256000, 128000, 64000, 32000, 16000, 8000, 4000, 0 };
- static const WORD cstbl[] = { 32768, 16384, 8192, 4096, 2048, 16384, 8192, 4096, 2048, 1024, 512 };
- BYTE fmt, m, *tbl;
- DWORD b_part, b_fat, b_dir, b_data; /* Area offset (LBA) */
- DWORD n_part, n_rsv, n_fat, n_dir; /* Area size */
- DWORD n_clst, d, n;
- WORD as;
- FATFS *fs;
- DSTATUS stat;
-
-
- /* Check validity of the parameters */
- if (drv >= _DRIVES) return FR_INVALID_DRIVE;
- if (partition >= 2) return FR_MKFS_ABORTED;
-
- /* Check mounted drive and clear work area */
- fs = FatFs[drv];
- if (!fs) return FR_NOT_ENABLED;
- fs->fs_type = 0;
- drv = LD2PD(drv);
-
- /* Get disk statics */
- stat = disk_initialize(drv);
- if (stat & STA_NOINIT) return FR_NOT_READY;
- if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
-#if _MAX_SS != 512 /* Get disk sector size */
- if (disk_ioctl(drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK
- || SS(fs) > _MAX_SS)
- return FR_MKFS_ABORTED;
-#endif
- if (disk_ioctl(drv, GET_SECTOR_COUNT, &n_part) != RES_OK || n_part < MIN_SECTOR)
- return FR_MKFS_ABORTED;
- if (n_part > MAX_SECTOR) n_part = MAX_SECTOR;
- b_part = (!partition) ? 63 : 0; /* Boot sector */
- n_part -= b_part;
- for (d = 512; d <= 32768U && d != allocsize; d <<= 1) ; /* Check validity of the allocation unit size */
- if (d != allocsize) allocsize = 0;
- if (!allocsize) { /* Auto selection of cluster size */
- d = n_part;
- for (as = SS(fs); as > 512U; as >>= 1) d >>= 1;
- for (n = 0; d < sstbl[n]; n++) ;
- allocsize = cstbl[n];
- }
- if (allocsize < SS(fs)) allocsize = SS(fs);
-
- allocsize /= SS(fs); /* Number of sectors per cluster */
-
- /* Pre-compute number of clusters and FAT type */
- n_clst = n_part / allocsize;
- fmt = FS_FAT12;
- if (n_clst >= 0xFF5) fmt = FS_FAT16;
- if (n_clst >= 0xFFF5) fmt = FS_FAT32;
-
- /* Determine offset and size of FAT structure */
- switch (fmt) {
- case FS_FAT12:
- n_fat = ((n_clst * 3 + 1) / 2 + 3 + SS(fs) - 1) / SS(fs);
- n_rsv = 1 + partition;
- n_dir = N_ROOTDIR * 32 / SS(fs);
- break;
- case FS_FAT16:
- n_fat = ((n_clst * 2) + 4 + SS(fs) - 1) / SS(fs);
- n_rsv = 1 + partition;
- n_dir = N_ROOTDIR * 32 / SS(fs);
- break;
- default:
- n_fat = ((n_clst * 4) + 8 + SS(fs) - 1) / SS(fs);
- n_rsv = 33 - partition;
- n_dir = 0;
- }
- b_fat = b_part + n_rsv; /* FATs start sector */
- b_dir = b_fat + n_fat * N_FATS; /* Directory start sector */
- b_data = b_dir + n_dir; /* Data start sector */
-
- /* Align data start sector to erase block boundary (for flash memory media) */
- if (disk_ioctl(drv, GET_BLOCK_SIZE, &n) != RES_OK) return FR_MKFS_ABORTED;
- n = (b_data + n - 1) & ~(n - 1);
- n_fat += (n - b_data) / N_FATS;
- /* b_dir and b_data are no longer used below */
-
- /* Determine number of cluster and final check of validity of the FAT type */
- n_clst = (n_part - n_rsv - n_fat * N_FATS - n_dir) / allocsize;
- if ( (fmt == FS_FAT16 && n_clst < 0xFF5)
- || (fmt == FS_FAT32 && n_clst < 0xFFF5))
- return FR_MKFS_ABORTED;
-
- /* Create partition table if needed */
- if (!partition) {
- DWORD n_disk = b_part + n_part;
-
- mem_set(fs->win, 0, SS(fs));
- tbl = fs->win+MBR_Table;
- ST_DWORD(tbl, 0x00010180); /* Partition start in CHS */
- if (n_disk < 63UL * 255 * 1024) { /* Partition end in CHS */
- n_disk = n_disk / 63 / 255;
- tbl[7] = (BYTE)n_disk;
- tbl[6] = (BYTE)((n_disk >> 2) | 63);
- } else {
- ST_WORD(&tbl[6], 0xFFFF);
- }
- tbl[5] = 254;
- if (fmt != FS_FAT32) /* System ID */
- tbl[4] = (n_part < 0x10000) ? 0x04 : 0x06;
- else
- tbl[4] = 0x0c;
- ST_DWORD(tbl+8, 63); /* Partition start in LBA */
- ST_DWORD(tbl+12, n_part); /* Partition size in LBA */
- ST_WORD(tbl+64, 0xAA55); /* Signature */
- if (disk_write(drv, fs->win, 0, 1) != RES_OK)
- return FR_DISK_ERR;
- partition = 0xF8;
- } else {
- partition = 0xF0;
- }
-
- /* Create boot record */
- tbl = fs->win; /* Clear buffer */
- mem_set(tbl, 0, SS(fs));
- ST_DWORD(tbl+BS_jmpBoot, 0x90FEEB); /* Boot code (jmp $, nop) */
- ST_WORD(tbl+BPB_BytsPerSec, SS(fs)); /* Sector size */
- tbl[BPB_SecPerClus] = (BYTE)allocsize; /* Sectors per cluster */
- ST_WORD(tbl+BPB_RsvdSecCnt, n_rsv); /* Reserved sectors */
- tbl[BPB_NumFATs] = N_FATS; /* Number of FATs */
- ST_WORD(tbl+BPB_RootEntCnt, SS(fs) / 32 * n_dir); /* Number of rootdir entries */
- if (n_part < 0x10000) { /* Number of total sectors */
- ST_WORD(tbl+BPB_TotSec16, n_part);
- } else {
- ST_DWORD(tbl+BPB_TotSec32, n_part);
- }
- tbl[BPB_Media] = partition; /* Media descripter */
- ST_WORD(tbl+BPB_SecPerTrk, 63); /* Number of sectors per track */
- ST_WORD(tbl+BPB_NumHeads, 255); /* Number of heads */
- ST_DWORD(tbl+BPB_HiddSec, b_part); /* Hidden sectors */
- n = get_fattime(); /* Use current time as a VSN */
- if (fmt != FS_FAT32) {
- ST_DWORD(tbl+BS_VolID, n); /* Volume serial number */
- ST_WORD(tbl+BPB_FATSz16, n_fat); /* Number of secters per FAT */
- tbl[BS_DrvNum] = 0x80; /* Drive number */
- tbl[BS_BootSig] = 0x29; /* Extended boot signature */
- mem_cpy(tbl+BS_VolLab, "NO NAME FAT ", 19); /* Volume lavel, FAT signature */
- } else {
- ST_DWORD(tbl+BS_VolID32, n); /* Volume serial number */
- ST_DWORD(tbl+BPB_FATSz32, n_fat); /* Number of secters per FAT */
- ST_DWORD(tbl+BPB_RootClus, 2); /* Root directory cluster (2) */
- ST_WORD(tbl+BPB_FSInfo, 1); /* FSInfo record offset (bs+1) */
- ST_WORD(tbl+BPB_BkBootSec, 6); /* Backup boot record offset (bs+6) */
- tbl[BS_DrvNum32] = 0x80; /* Drive number */
- tbl[BS_BootSig32] = 0x29; /* Extended boot signature */
- mem_cpy(tbl+BS_VolLab32, "NO NAME FAT32 ", 19); /* Volume lavel, FAT signature */
- }
- ST_WORD(tbl+BS_55AA, 0xAA55); /* Signature */
- if (SS(fs) > 512U) {
- ST_WORD(tbl+SS(fs)-2, 0xAA55);
- }
- if (disk_write(drv, tbl, b_part+0, 1) != RES_OK)
- return FR_DISK_ERR;
- if (fmt == FS_FAT32)
- disk_write(drv, tbl, b_part+6, 1);
-
- /* Initialize FAT area */
- for (m = 0; m < N_FATS; m++) {
- mem_set(tbl, 0, SS(fs)); /* 1st sector of the FAT */
- if (fmt != FS_FAT32) {
- n = (fmt == FS_FAT12) ? 0x00FFFF00 : 0xFFFFFF00;
- n |= partition;
- ST_DWORD(tbl, n); /* Reserve cluster #0-1 (FAT12/16) */
- } else {
- ST_DWORD(tbl+0, 0xFFFFFFF8); /* Reserve cluster #0-1 (FAT32) */
- ST_DWORD(tbl+4, 0xFFFFFFFF);
- ST_DWORD(tbl+8, 0x0FFFFFFF); /* Reserve cluster #2 for root dir */
- }
- if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
- return FR_DISK_ERR;
- mem_set(tbl, 0, SS(fs)); /* Following FAT entries are filled by zero */
- for (n = 1; n < n_fat; n++) {
- if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
- return FR_DISK_ERR;
- }
- }
-
- /* Initialize Root directory */
- m = (BYTE)((fmt == FS_FAT32) ? allocsize : n_dir);
- do {
- if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
- return FR_DISK_ERR;
- } while (--m);
-
- /* Create FSInfo record if needed */
- if (fmt == FS_FAT32) {
- ST_WORD(tbl+BS_55AA, 0xAA55);
- ST_DWORD(tbl+FSI_LeadSig, 0x41615252);
- ST_DWORD(tbl+FSI_StrucSig, 0x61417272);
- ST_DWORD(tbl+FSI_Free_Count, n_clst - 1);
- ST_DWORD(tbl+FSI_Nxt_Free, 0xFFFFFFFF);
- disk_write(drv, tbl, b_part+1, 1);
- disk_write(drv, tbl, b_part+7, 1);
- }
-
- return (disk_ioctl(drv, CTRL_SYNC, (void*)NULL) == RES_OK) ? FR_OK : FR_DISK_ERR;
-}
-
-#endif /* _USE_MKFS && !_FS_READONLY */
-
-
-
-
-#if _USE_STRFUNC
-/*-----------------------------------------------------------------------*/
-/* Get a string from the file */
-/*-----------------------------------------------------------------------*/
-char* f_gets (
- char* buff, /* Pointer to the string buffer to read */
- int len, /* Size of string buffer */
- FIL* fil /* Pointer to the file object */
-)
-{
- int i = 0;
- char *p = buff;
- UINT rc;
-
-
- while (i < len - 1) { /* Read bytes until buffer gets filled */
- f_read(fil, p, 1, &rc);
- if (rc != 1) break; /* Break when no data to read */
-#if _USE_STRFUNC >= 2
- if (*p == '\r') continue; /* Strip '\r' */
-#endif
- i++;
- if (*p++ == '\n') break; /* Break when reached end of line */
- }
- *p = 0;
- return i ? buff : NULL; /* When no data read (eof or error), return with error. */
-}
-
-
-
-#if !_FS_READONLY
-#include <stdarg.h>
-/*-----------------------------------------------------------------------*/
-/* Put a character to the file */
-/*-----------------------------------------------------------------------*/
-int f_putc (
- int chr, /* A character to be output */
- FIL* fil /* Ponter to the file object */
-)
-{
- UINT bw;
- char c;
-
-
-#if _USE_STRFUNC >= 2
- if (chr == '\n') f_putc ('\r', fil); /* LF -> CRLF conversion */
-#endif
- if (!fil) { /* Special value may be used to switch the destination to any other device */
- /* put_console(chr); */
- return chr;
- }
- c = (char)chr;
- f_write(fil, &c, 1, &bw); /* Write a byte to the file */
- return bw ? chr : EOF; /* Return the result */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Put a string to the file */
-/*-----------------------------------------------------------------------*/
-int f_puts (
- const char* str, /* Pointer to the string to be output */
- FIL* fil /* Pointer to the file object */
-)
-{
- int n;
-
-
- for (n = 0; *str; str++, n++) {
- if (f_putc(*str, fil) == EOF) return EOF;
- }
- return n;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Put a formatted string to the file */
-/*-----------------------------------------------------------------------*/
-int f_printf (
- FIL* fil, /* Pointer to the file object */
- const char* str, /* Pointer to the format string */
- ... /* Optional arguments... */
-)
-{
- va_list arp;
- UCHAR c, f, r;
- ULONG val;
- char s[16];
- int i, w, res, cc;
-
-
- va_start(arp, str);
-
- for (cc = res = 0; cc != EOF; res += cc) {
- c = *str++;
- if (c == 0) break; /* End of string */
- if (c != '%') { /* Non escape cahracter */
- cc = f_putc(c, fil);
- if (cc != EOF) cc = 1;
- continue;
- }
- w = f = 0;
- c = *str++;
- if (c == '0') { /* Flag: '0' padding */
- f = 1; c = *str++;
- }
- while (c >= '0' && c <= '9') { /* Precision */
- w = w * 10 + (c - '0');
- c = *str++;
- }
- if (c == 'l') { /* Prefix: Size is long int */
- f |= 2; c = *str++;
- }
- if (c == 's') { /* Type is string */
- cc = f_puts(va_arg(arp, char*), fil);
- continue;
- }
- if (c == 'c') { /* Type is character */
- cc = f_putc(va_arg(arp, int), fil);
- if (cc != EOF) cc = 1;
- continue;
- }
- r = 0;
- if (c == 'd') r = 10; /* Type is signed decimal */
- if (c == 'u') r = 10; /* Type is unsigned decimal */
- if (c == 'X') r = 16; /* Type is unsigned hexdecimal */
- if (r == 0) break; /* Unknown type */
- if (f & 2) { /* Get the value */
- val = (ULONG)va_arg(arp, long);
- } else {
- val = (c == 'd') ? (ULONG)(long)va_arg(arp, int) : (ULONG)va_arg(arp, unsigned int);
- }
- /* Put numeral string */
- if (c == 'd') {
- if (val & 0x80000000) {
- val = 0 - val;
- f |= 4;
- }
- }
- i = sizeof(s) - 1; s[i] = 0;
- do {
- c = (UCHAR)(val % r + '0');
- if (c > '9') c += 7;
- s[--i] = c;
- val /= r;
- } while (i && val);
- if (i && (f & 4)) s[--i] = '-';
- w = sizeof(s) - 1 - w;
- while (i && i > w) s[--i] = (f & 1) ? '0' : ' ';
- cc = f_puts(&s[i], fil);
- }
-
- va_end(arp);
- return (cc == EOF) ? cc : res;
-}
-
-#endif /* !_FS_READONLY */
-#endif /* _USE_STRFUNC */
+/*----------------------------------------------------------------------------/
+/ FatFs - FAT file system module R0.07e (C)ChaN, 2010
+/-----------------------------------------------------------------------------/
+/ FatFs module is a generic FAT file system module for small embedded systems.
+/ This is a free software that opened for education, research and commercial
+/ developments under license policy of following trems.
+/
+/ Copyright (C) 2010, ChaN, all right reserved.
+/
+/ * The FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/
+/-----------------------------------------------------------------------------/
+/ Feb 26,'06 R0.00 Prototype.
+/
+/ Apr 29,'06 R0.01 First stable version.
+/
+/ Jun 01,'06 R0.02 Added FAT12 support.
+/ Removed unbuffered mode.
+/ Fixed a problem on small (<32M) patition.
+/ Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).
+/
+/ Sep 22,'06 R0.03 Added f_rename().
+/ Changed option _FS_MINIMUM to _FS_MINIMIZE.
+/ Dec 11,'06 R0.03a Improved cluster scan algolithm to write files fast.
+/ Fixed f_mkdir() creates incorrect directory on FAT32.
+/
+/ Feb 04,'07 R0.04 Supported multiple drive system.
+/ Changed some interfaces for multiple drive system.
+/ Changed f_mountdrv() to f_mount().
+/ Added f_mkfs().
+/ Apr 01,'07 R0.04a Supported multiple partitions on a plysical drive.
+/ Added a capability of extending file size to f_lseek().
+/ Added minimization level 3.
+/ Fixed an endian sensitive code in f_mkfs().
+/ May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.
+/ Added FSInfo support.
+/ Fixed DBCS name can result FR_INVALID_NAME.
+/ Fixed short seek (<= csize) collapses the file object.
+/
+/ Aug 25,'07 R0.05 Changed arguments of f_read(), f_write() and f_mkfs().
+/ Fixed f_mkfs() on FAT32 creates incorrect FSInfo.
+/ Fixed f_mkdir() on FAT32 creates incorrect directory.
+/ Feb 03,'08 R0.05a Added f_truncate() and f_utime().
+/ Fixed off by one error at FAT sub-type determination.
+/ Fixed btr in f_read() can be mistruncated.
+/ Fixed cached sector is not flushed when create and close
+/ without write.
+/
+/ Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets().
+/ Improved performance of f_lseek() on moving to the same
+/ or following cluster.
+/
+/ Apr 01,'09 R0.07 Merged Tiny-FatFs as a buffer configuration option.
+/ Added long file name support.
+/ Added multiple code page support.
+/ Added re-entrancy for multitask operation.
+/ Added auto cluster size selection to f_mkfs().
+/ Added rewind option to f_readdir().
+/ Changed result code of critical errors.
+/ Renamed string functions to avoid name collision.
+/ Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg.
+/ Added multiple sector size support.
+/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error.
+/ Fixed wrong cache control in f_lseek().
+/ Added relative path feature.
+/ Added f_chdir() and f_chdrive().
+/ Added proper case conversion to extended char.
+/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h.
+/ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
+/ Fixed name matching error on the 13 char boundary.
+/ Added a configuration option, _LFN_UNICODE.
+/ Changed f_readdir() to return the SFN with always upper
+/ case on non-LFN cfg.
+/---------------------------------------------------------------------------*/
+
+#include "ff.h" /* FatFs configurations and declarations */
+#include "diskio.h" /* Declarations of low level disk I/O functions */
+
+/*--------------------------------------------------------------------------
+
+ Module Private Definitions
+
+---------------------------------------------------------------------------*/
+
+#if _FATFS != 0x007E
+#error Wrong include file (ff.h).
+#endif
+
+#if _FS_REENTRANT
+#if _USE_LFN == 1
+#error Static LFN work area must not be used in re-entrant configuration.
+#endif
+#define ENTER_FF(fs) { if (!lock_fs(fs)) return FR_TIMEOUT; }
+#define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; }
+
+#else
+#define ENTER_FF(fs)
+#define LEAVE_FF(fs, res) return res
+
+#endif
+
+#define ABORT(fs, res) { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Name status flags */
+#define NS 11 /* Offset of name status byte */
+#define NS_LOSS 0x01 /* Out of 8.3 format */
+#define NS_LFN 0x02 /* Force to create LFN entry */
+#define NS_LAST 0x04 /* Last segment */
+#define NS_BODY 0x08 /* Lower case flag (body) */
+#define NS_EXT 0x10 /* Lower case flag (ext) */
+#define NS_DOT 0x20 /* Dot entry */
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Private Work Area
+
+---------------------------------------------------------------------------*/
+
+#if _DRIVES < 1 || _DRIVES > 9
+#error Number of drives must be 1-9.
+#endif
+static
+FATFS *FatFs[_DRIVES]; /* Pointer to the file system objects (logical drives) */
+
+static
+WORD Fsid; /* File system mount ID */
+
+#if _FS_RPATH
+static
+BYTE Drive; /* Current drive */
+#endif
+
+
+#if _USE_LFN == 1 /* LFN with static LFN working buffer */
+static
+WCHAR LfnBuf[_MAX_LFN + 1];
+#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR *lp = LfnBuf
+#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
+
+#elif _USE_LFN > 1 /* LFN with dynamic LFN working buffer */
+#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR lbuf[_MAX_LFN + 1], *lp = lbuf
+#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
+
+#else /* No LFN */
+#define NAMEBUF(sp,lp) BYTE sp[12]
+#define INITBUF(dj,sp,lp) dj.fn = sp
+
+#endif
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Module Private Functions
+
+---------------------------------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------*/
+/* String functions */
+/*-----------------------------------------------------------------------*/
+
+/* Copy memory to memory */
+static
+void mem_cpy (void* dst, const void* src, int cnt) {
+ char *d = (char*)dst;
+ const char *s = (const char *)src;
+ while (cnt--) *d++ = *s++;
+}
+
+/* Fill memory */
+static
+void mem_set (void* dst, int val, int cnt) {
+ char *d = (char*)dst;
+ while (cnt--) *d++ = (char)val;
+}
+
+/* Compare memory to memory */
+static
+int mem_cmp (const void* dst, const void* src, int cnt) {
+ const char *d = (const char *)dst, *s = (const char *)src;
+ int r = 0;
+ while (cnt-- && (r = *d++ - *s++) == 0) ;
+ return r;
+}
+
+/* Check if chr is contained in the string */
+static
+int chk_chr (const char* str, int chr) {
+ while (*str && *str != chr) str++;
+ return *str;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Request/Release grant to access the volume */
+/*-----------------------------------------------------------------------*/
+#if _FS_REENTRANT
+
+static
+BOOL lock_fs (
+ FATFS *fs /* File system object */
+)
+{
+ return ff_req_grant(fs->sobj);
+}
+
+
+static
+void unlock_fs (
+ FATFS *fs, /* File system object */
+ FRESULT res /* Result code to be returned */
+)
+{
+ if (res != FR_NOT_ENABLED &&
+ res != FR_INVALID_DRIVE &&
+ res != FR_INVALID_OBJECT &&
+ res != FR_TIMEOUT) {
+ ff_rel_grant(fs->sobj);
+ }
+}
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change window offset */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT move_window (
+ FATFS *fs, /* File system object */
+ DWORD sector /* Sector number to make apperance in the fs->win[] */
+) /* Move to zero only writes back dirty window */
+{
+ DWORD wsect;
+
+
+ wsect = fs->winsect;
+ if (wsect != sector) { /* Changed current window */
+#if !_FS_READONLY
+ if (fs->wflag) { /* Write back dirty window if needed */
+ if (disk_write(fs->drive, fs->win, wsect, 1) != RES_OK)
+ return FR_DISK_ERR;
+ fs->wflag = 0;
+ if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */
+ BYTE nf;
+ for (nf = fs->n_fats; nf > 1; nf--) { /* Refrect the change to all FAT copies */
+ wsect += fs->sects_fat;
+ disk_write(fs->drive, fs->win, wsect, 1);
+ }
+ }
+ }
+#endif
+ if (sector) {
+ if (disk_read(fs->drive, fs->win, sector, 1) != RES_OK)
+ return FR_DISK_ERR;
+ fs->winsect = sector;
+ }
+ }
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Clean-up cached data */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */
+ FATFS *fs /* File system object */
+)
+{
+ FRESULT res;
+
+
+ res = move_window(fs, 0);
+ if (res == FR_OK) {
+ /* Update FSInfo sector if needed */
+ if (fs->fs_type == FS_FAT32 && fs->fsi_flag) {
+ fs->winsect = 0;
+ mem_set(fs->win, 0, 512);
+ ST_WORD(fs->win+BS_55AA, 0xAA55);
+ ST_DWORD(fs->win+FSI_LeadSig, 0x41615252);
+ ST_DWORD(fs->win+FSI_StrucSig, 0x61417272);
+ ST_DWORD(fs->win+FSI_Free_Count, fs->free_clust);
+ ST_DWORD(fs->win+FSI_Nxt_Free, fs->last_clust);
+ disk_write(fs->drive, fs->win, fs->fsi_sector, 1);
+ fs->fsi_flag = 0;
+ }
+ /* Make sure that no pending write process in the physical drive */
+ if (disk_ioctl(fs->drive, CTRL_SYNC, (void*)NULL) != RES_OK)
+ res = FR_DISK_ERR;
+ }
+
+ return res;
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT access - Read value of a FAT entry */
+/*-----------------------------------------------------------------------*/
+
+
+DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status */
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to get the link information */
+)
+{
+ UINT wc, bc;
+ DWORD fsect;
+
+
+ if (clst < 2 || clst >= fs->max_clust) /* Range check */
+ return 1;
+
+ fsect = fs->fatbase;
+ switch (fs->fs_type) {
+ case FS_FAT12 :
+ bc = clst; bc += bc / 2;
+ if (move_window(fs, fsect + (bc / SS(fs)))) break;
+ wc = fs->win[bc & (SS(fs) - 1)]; bc++;
+ if (move_window(fs, fsect + (bc / SS(fs)))) break;
+ wc |= (WORD)fs->win[bc & (SS(fs) - 1)] << 8;
+ return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);
+
+ case FS_FAT16 :
+ if (move_window(fs, fsect + (clst / (SS(fs) / 2)))) break;
+ return LD_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)]);
+
+ case FS_FAT32 :
+ if (move_window(fs, fsect + (clst / (SS(fs) / 4)))) break;
+ return LD_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)]) & 0x0FFFFFFF;
+ }
+
+ return 0xFFFFFFFF; /* An error occured at the disk I/O layer */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT access - Change value of a FAT entry */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+
+FRESULT put_fat (
+ FATFS *fs, /* File system object */
+ DWORD clst, /* Cluster# to be changed in range of 2 to fs->max_clust - 1 */
+ DWORD val /* New value to mark the cluster */
+)
+{
+ UINT bc;
+ BYTE *p;
+ DWORD fsect;
+ FRESULT res;
+
+
+ if (clst < 2 || clst >= fs->max_clust) { /* Range check */
+ res = FR_INT_ERR;
+
+ } else {
+ fsect = fs->fatbase;
+ switch (fs->fs_type) {
+ case FS_FAT12 :
+ bc = clst; bc += bc / 2;
+ res = move_window(fs, fsect + (bc / SS(fs)));
+ if (res != FR_OK) break;
+ p = &fs->win[bc & (SS(fs) - 1)];
+ *p = (clst & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val;
+ bc++;
+ fs->wflag = 1;
+ res = move_window(fs, fsect + (bc / SS(fs)));
+ if (res != FR_OK) break;
+ p = &fs->win[bc & (SS(fs) - 1)];
+ *p = (clst & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F));
+ break;
+
+ case FS_FAT16 :
+ res = move_window(fs, fsect + (clst / (SS(fs) / 2)));
+ if (res != FR_OK) break;
+ ST_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)], (WORD)val);
+ break;
+
+ case FS_FAT32 :
+ res = move_window(fs, fsect + (clst / (SS(fs) / 4)));
+ if (res != FR_OK) break;
+ ST_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)], val);
+ break;
+
+ default :
+ res = FR_INT_ERR;
+ }
+ fs->wflag = 1;
+ }
+
+ return res;
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT handling - Remove a cluster chain */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+FRESULT remove_chain (
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to remove a chain from */
+)
+{
+ FRESULT res;
+ DWORD nxt;
+
+
+ if (clst < 2 || clst >= fs->max_clust) { /* Check the range of cluster# */
+ res = FR_INT_ERR;
+
+ } else {
+ res = FR_OK;
+ while (clst < fs->max_clust) { /* Not a last link? */
+ nxt = get_fat(fs, clst); /* Get cluster status */
+ if (nxt == 0) break; /* Empty cluster? */
+ if (nxt == 1) { res = FR_INT_ERR; break; } /* Internal error? */
+ if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */
+ res = put_fat(fs, clst, 0); /* Mark the cluster "empty" */
+ if (res != FR_OK) break;
+ if (fs->free_clust != 0xFFFFFFFF) { /* Update FSInfo */
+ fs->free_clust++;
+ fs->fsi_flag = 1;
+ }
+ clst = nxt; /* Next cluster */
+ }
+ }
+
+ return res;
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT handling - Stretch or Create a cluster chain */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to stretch. 0 means create a new chain. */
+)
+{
+ DWORD cs, ncl, scl, mcl;
+
+
+ mcl = fs->max_clust;
+ if (clst == 0) { /* Create new chain */
+ scl = fs->last_clust; /* Get suggested start point */
+ if (scl == 0 || scl >= mcl) scl = 1;
+ }
+ else { /* Stretch existing chain */
+ cs = get_fat(fs, clst); /* Check the cluster status */
+ if (cs < 2) return 1; /* It is an invalid cluster */
+ if (cs < mcl) return cs; /* It is already followed by next cluster */
+ scl = clst;
+ }
+
+ ncl = scl; /* Start cluster */
+ for (;;) {
+ ncl++; /* Next cluster */
+ if (ncl >= mcl) { /* Wrap around */
+ ncl = 2;
+ if (ncl > scl) return 0; /* No free custer */
+ }
+ cs = get_fat(fs, ncl); /* Get the cluster status */
+ if (cs == 0) break; /* Found a free cluster */
+ if (cs == 0xFFFFFFFF || cs == 1)/* An error occured */
+ return cs;
+ if (ncl == scl) return 0; /* No free custer */
+ }
+
+ if (put_fat(fs, ncl, 0x0FFFFFFF)) /* Mark the new cluster "in use" */
+ return 0xFFFFFFFF;
+ if (clst != 0) { /* Link it to the previous one if needed */
+ if (put_fat(fs, clst, ncl))
+ return 0xFFFFFFFF;
+ }
+
+ fs->last_clust = ncl; /* Update FSINFO */
+ if (fs->free_clust != 0xFFFFFFFF) {
+ fs->free_clust--;
+ fs->fsi_flag = 1;
+ }
+
+ return ncl; /* Return new cluster number */
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Get sector# from cluster# */
+/*-----------------------------------------------------------------------*/
+
+
+DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to be converted */
+)
+{
+ clst -= 2;
+ if (clst >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
+ return clst * fs->csize + fs->database;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Seek directory index */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_seek (
+ DIR *dj, /* Pointer to directory object */
+ WORD idx /* Directory index number */
+)
+{
+ DWORD clst;
+ WORD ic;
+
+
+ dj->index = idx;
+ clst = dj->sclust;
+ if (clst == 1 || clst >= dj->fs->max_clust) /* Check start cluster range */
+ return FR_INT_ERR;
+ if (!clst && dj->fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
+ clst = dj->fs->dirbase;
+
+ if (clst == 0) { /* Static table */
+ dj->clust = clst;
+ if (idx >= dj->fs->n_rootdir) /* Index is out of range */
+ return FR_INT_ERR;
+ dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / 32); /* Sector# */
+ }
+ else { /* Dynamic table */
+ ic = SS(dj->fs) / 32 * dj->fs->csize; /* Entries per cluster */
+ while (idx >= ic) { /* Follow cluster chain */
+ clst = get_fat(dj->fs, clst); /* Get next cluster */
+ if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */
+ if (clst < 2 || clst >= dj->fs->max_clust) /* Reached to end of table or int error */
+ return FR_INT_ERR;
+ idx -= ic;
+ }
+ dj->clust = clst;
+ dj->sect = clust2sect(dj->fs, clst) + idx / (SS(dj->fs) / 32); /* Sector# */
+ }
+
+ dj->dir = dj->fs->win + (idx % (SS(dj->fs) / 32)) * 32; /* Ptr to the entry in the sector */
+
+ return FR_OK; /* Seek succeeded */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Move directory index next */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */
+ DIR *dj, /* Pointer to directory object */
+ BOOL streach /* FALSE: Do not streach table, TRUE: Streach table if needed */
+)
+{
+ DWORD clst;
+ WORD i;
+
+
+ i = dj->index + 1;
+ if (!i || !dj->sect) /* Report EOT when index has reached 65535 */
+ return FR_NO_FILE;
+
+ if (!(i % (SS(dj->fs) / 32))) { /* Sector changed? */
+ dj->sect++; /* Next sector */
+
+ if (dj->clust == 0) { /* Static table */
+ if (i >= dj->fs->n_rootdir) /* Report EOT when end of table */
+ return FR_NO_FILE;
+ }
+ else { /* Dynamic table */
+ if (((i / (SS(dj->fs) / 32)) & (dj->fs->csize - 1)) == 0) { /* Cluster changed? */
+ clst = get_fat(dj->fs, dj->clust); /* Get next cluster */
+ if (clst <= 1) return FR_INT_ERR;
+ if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
+ if (clst >= dj->fs->max_clust) { /* When it reached end of dynamic table */
+#if !_FS_READONLY
+ BYTE c;
+ if (!streach) return FR_NO_FILE; /* When do not streach, report EOT */
+ clst = create_chain(dj->fs, dj->clust); /* Streach cluster chain */
+ if (clst == 0) return FR_DENIED; /* No free cluster */
+ if (clst == 1) return FR_INT_ERR;
+ if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
+ /* Clean-up streached table */
+ if (move_window(dj->fs, 0)) return FR_DISK_ERR; /* Flush active window */
+ mem_set(dj->fs->win, 0, SS(dj->fs)); /* Clear window buffer */
+ dj->fs->winsect = clust2sect(dj->fs, clst); /* Cluster start sector */
+ for (c = 0; c < dj->fs->csize; c++) { /* Fill the new cluster with 0 */
+ dj->fs->wflag = 1;
+ if (move_window(dj->fs, 0)) return FR_DISK_ERR;
+ dj->fs->winsect++;
+ }
+ dj->fs->winsect -= c; /* Rewind window address */
+#else
+ return FR_NO_FILE; /* Report EOT */
+#endif
+ }
+ dj->clust = clst; /* Initialize data for new cluster */
+ dj->sect = clust2sect(dj->fs, clst);
+ }
+ }
+ }
+
+ dj->index = i;
+ dj->dir = dj->fs->win + (i % (SS(dj->fs) / 32)) * 32;
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry */
+/*-----------------------------------------------------------------------*/
+#if _USE_LFN
+static
+const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Offset of LFN chars in the directory entry */
+
+
+static
+BOOL cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */
+ WCHAR *lfnbuf, /* Pointer to the LFN to be compared */
+ BYTE *dir /* Pointer to the directory entry containing a part of LFN */
+)
+{
+ int i, s;
+ WCHAR wc, uc;
+
+
+ i = ((dir[LDIR_Ord] & 0xBF) - 1) * 13; /* Get offset in the LFN buffer */
+ s = 0; wc = 1;
+ do {
+ uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
+ if (wc) { /* Last char has not been processed */
+ wc = ff_wtoupper(uc); /* Convert it to upper case */
+ if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it */
+ return FALSE; /* Not matched */
+ } else {
+ if (uc != 0xFFFF) return FALSE; /* Check filler */
+ }
+ } while (++s < 13); /* Repeat until all chars in the entry are checked */
+
+ if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i]) /* Last segment matched but different length */
+ return FALSE;
+
+ return TRUE; /* The part of LFN matched */
+}
+
+
+
+static
+BOOL pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */
+ WCHAR *lfnbuf, /* Pointer to the Unicode-LFN buffer */
+ BYTE *dir /* Pointer to the directory entry */
+)
+{
+ int i, s;
+ WCHAR wc, uc;
+
+
+ i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
+
+ s = 0; wc = 1;
+ do {
+ uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
+ if (wc) { /* Last char has not been processed */
+ if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
+ lfnbuf[i++] = wc = uc; /* Store it */
+ } else {
+ if (uc != 0xFFFF) return FALSE; /* Check filler */
+ }
+ } while (++s < 13); /* Read all character in the entry */
+
+ if (dir[LDIR_Ord] & 0x40) { /* Put terminator if it is the last LFN part */
+ if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
+ lfnbuf[i] = 0;
+ }
+
+ return TRUE;
+}
+
+
+#if !_FS_READONLY
+static
+void fit_lfn (
+ const WCHAR *lfnbuf, /* Pointer to the LFN buffer */
+ BYTE *dir, /* Pointer to the directory entry */
+ BYTE ord, /* LFN order (1-20) */
+ BYTE sum /* SFN sum */
+)
+{
+ int i, s;
+ WCHAR wc;
+
+
+ dir[LDIR_Chksum] = sum; /* Set check sum */
+ dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
+ dir[LDIR_Type] = 0;
+ ST_WORD(dir+LDIR_FstClusLO, 0);
+
+ i = (ord - 1) * 13; /* Get offset in the LFN buffer */
+ s = wc = 0;
+ do {
+ if (wc != 0xFFFF) wc = lfnbuf[i++]; /* Get an effective char */
+ ST_WORD(dir+LfnOfs[s], wc); /* Put it */
+ if (!wc) wc = 0xFFFF; /* Padding chars following last char */
+ } while (++s < 13);
+ if (wc == 0xFFFF || !lfnbuf[i]) ord |= 0x40; /* Bottom LFN part is the start of LFN sequence */
+ dir[LDIR_Ord] = ord; /* Set the LFN order */
+}
+
+#endif
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Create numbered name */
+/*-----------------------------------------------------------------------*/
+#if _USE_LFN
+void gen_numname (
+ BYTE *dst, /* Pointer to genartated SFN */
+ const BYTE *src, /* Pointer to source SFN to be modified */
+ const WCHAR *lfn, /* Pointer to LFN */
+ WORD num /* Sequense number */
+)
+{
+ char ns[8];
+ int i, j;
+
+
+ mem_cpy(dst, src, 11);
+
+ if (num > 5) { /* On many collisions, generate a hash number instead of sequencial number */
+ do num = (num >> 1) + (num << 15) + (WORD)*lfn++; while (*lfn);
+ }
+
+ /* itoa */
+ i = 7;
+ do {
+ ns[i--] = (num % 10) + '0';
+ num /= 10;
+ } while (num);
+ ns[i] = '~';
+
+ /* Append the number */
+ for (j = 0; j < i && dst[j] != ' '; j++) {
+ if (IsDBCS1(dst[j])) {
+ if (j == i - 1) break;
+ j++;
+ }
+ }
+ do {
+ dst[j++] = (i < 8) ? ns[i++] : ' ';
+ } while (j < 8);
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Calculate sum of an SFN */
+/*-----------------------------------------------------------------------*/
+#if _USE_LFN
+static
+BYTE sum_sfn (
+ const BYTE *dir /* Ptr to directory entry */
+)
+{
+ BYTE sum = 0;
+ int n = 11;
+
+ do sum = (sum >> 1) + (sum << 7) + *dir++; while (--n);
+ return sum;
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Find an object in the directory */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_find (
+ DIR *dj /* Pointer to the directory object linked to the file name */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+#if _USE_LFN
+ BYTE a, ord, sum;
+#endif
+
+ res = dir_seek(dj, 0); /* Rewind directory object */
+ if (res != FR_OK) return res;
+
+#if _USE_LFN
+ ord = sum = 0xFF;
+#endif
+ do {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ dir = dj->dir; /* Ptr to the directory entry of current index */
+ c = dir[DIR_Name];
+ if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
+#if _USE_LFN /* LFN configuration */
+ a = dir[DIR_Attr] & AM_MASK;
+ if (c == 0xE5 || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
+ ord = 0xFF;
+ } else {
+ if (a == AM_LFN) { /* An LFN entry is found */
+ if (dj->lfn) {
+ if (c & 0x40) { /* Is it start of LFN sequence? */
+ sum = dir[LDIR_Chksum];
+ c &= 0xBF; ord = c; /* LFN start order */
+ dj->lfn_idx = dj->index;
+ }
+ /* Check validity of the LFN entry and compare it with given name */
+ ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
+ }
+ } else { /* An SFN entry is found */
+ if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */
+ ord = 0xFF; dj->lfn_idx = 0xFFFF; /* Reset LFN sequence */
+ if (!(dj->fn[NS] & NS_LOSS) && !mem_cmp(dir, dj->fn, 11)) break; /* SFN matched? */
+ }
+ }
+#else /* Non LFN configuration */
+ if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */
+ break;
+#endif
+ res = dir_next(dj, FALSE); /* Next entry */
+ } while (res == FR_OK);
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read an object from the directory */
+/*-----------------------------------------------------------------------*/
+#if _FS_MINIMIZE <= 1
+static
+FRESULT dir_read (
+ DIR *dj /* Pointer to the directory object that pointing the entry to be read */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+#if _USE_LFN
+ BYTE a, ord = 0xFF, sum = 0xFF;
+#endif
+
+ res = FR_NO_FILE;
+ while (dj->sect) {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ dir = dj->dir; /* Ptr to the directory entry of current index */
+ c = dir[DIR_Name];
+ if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
+#if _USE_LFN /* LFN configuration */
+ a = dir[DIR_Attr] & AM_MASK;
+ if (c == 0xE5 || (!_FS_RPATH && c == '.') || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
+ ord = 0xFF;
+ } else {
+ if (a == AM_LFN) { /* An LFN entry is found */
+ if (c & 0x40) { /* Is it start of LFN sequence? */
+ sum = dir[LDIR_Chksum];
+ c &= 0xBF; ord = c;
+ dj->lfn_idx = dj->index;
+ }
+ /* Check LFN validity and capture it */
+ ord = (c == ord && sum == dir[LDIR_Chksum] && pick_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
+ } else { /* An SFN entry is found */
+ if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN? */
+ dj->lfn_idx = 0xFFFF; /* It has no LFN. */
+ break;
+ }
+ }
+#else /* Non LFN configuration */
+ if (c != 0xE5 && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL)) /* Is it a valid entry? */
+ break;
+#endif
+ res = dir_next(dj, FALSE); /* Next entry */
+ if (res != FR_OK) break;
+ }
+
+ if (res != FR_OK) dj->sect = 0;
+
+ return res;
+}
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Register an object to the directory */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many SFN collision, FR_DISK_ERR:Disk error */
+ DIR *dj /* Target directory with object name to be created */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+#if _USE_LFN /* LFN configuration */
+ WORD n, ne, is;
+ BYTE sn[12], *fn, sum;
+ WCHAR *lfn;
+
+
+ fn = dj->fn; lfn = dj->lfn;
+ mem_cpy(sn, fn, 12);
+
+ if (_FS_RPATH && (sn[NS] & NS_DOT)) return FR_INVALID_NAME; /* Cannot create dot entry */
+
+ if (sn[NS] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */
+ fn[NS] = 0; dj->lfn = NULL; /* Find only SFN */
+ for (n = 1; n < 100; n++) {
+ gen_numname(fn, sn, lfn, n); /* Generate a numbered name */
+ res = dir_find(dj); /* Check if the name collides with existing SFN */
+ if (res != FR_OK) break;
+ }
+ if (n == 100) return FR_DENIED; /* Abort if too many collisions */
+ if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */
+ fn[NS] = sn[NS]; dj->lfn = lfn;
+ }
+
+ if (sn[NS] & NS_LFN) { /* When LFN is to be created, reserve reserve an SFN + LFN entries. */
+ for (ne = 0; lfn[ne]; ne++) ;
+ ne = (ne + 25) / 13;
+ } else { /* Otherwise reserve only an SFN entry. */
+ ne = 1;
+ }
+
+ /* Reserve contiguous entries */
+ res = dir_seek(dj, 0);
+ if (res != FR_OK) return res;
+ n = is = 0;
+ do {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ c = *dj->dir; /* Check the entry status */
+ if (c == 0xE5 || c == 0) { /* Is it a blank entry? */
+ if (n == 0) is = dj->index; /* First index of the contigulus entry */
+ if (++n == ne) break; /* A contiguous entry that requiered count is found */
+ } else {
+ n = 0; /* Not a blank entry. Restart to search */
+ }
+ res = dir_next(dj, TRUE); /* Next entry with table streach */
+ } while (res == FR_OK);
+
+ if (res == FR_OK && ne > 1) { /* Initialize LFN entry if needed */
+ res = dir_seek(dj, is);
+ if (res == FR_OK) {
+ sum = sum_sfn(dj->fn); /* Sum of the SFN tied to the LFN */
+ ne--;
+ do { /* Store LFN entries in bottom first */
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ fit_lfn(dj->lfn, dj->dir, (BYTE)ne, sum);
+ dj->fs->wflag = 1;
+ res = dir_next(dj, FALSE); /* Next entry */
+ } while (res == FR_OK && --ne);
+ }
+ }
+
+#else /* Non LFN configuration */
+ res = dir_seek(dj, 0);
+ if (res == FR_OK) {
+ do { /* Find a blank entry for the SFN */
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ c = *dj->dir;
+ if (c == 0xE5 || c == 0) break; /* Is it a blank entry? */
+ res = dir_next(dj, TRUE); /* Next entry with table streach */
+ } while (res == FR_OK);
+ }
+#endif
+
+ if (res == FR_OK) { /* Initialize the SFN entry */
+ res = move_window(dj->fs, dj->sect);
+ if (res == FR_OK) {
+ dir = dj->dir;
+ mem_set(dir, 0, 32); /* Clean the entry */
+ mem_cpy(dir, dj->fn, 11); /* Put SFN */
+ dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */
+ dj->fs->wflag = 1;
+ }
+ }
+
+ return res;
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Remove an object from the directory */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY && !_FS_MINIMIZE
+static
+FRESULT dir_remove ( /* FR_OK: Successful, FR_DISK_ERR: A disk error */
+ DIR *dj /* Directory object pointing the entry to be removed */
+)
+{
+ FRESULT res;
+#if _USE_LFN /* LFN configuration */
+ WORD i;
+
+ i = dj->index; /* SFN index */
+ res = dir_seek(dj, (WORD)((dj->lfn_idx == 0xFFFF) ? i : dj->lfn_idx)); /* Goto the SFN or top of the LFN entries */
+ if (res == FR_OK) {
+ do {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ *dj->dir = 0xE5; /* Mark the entry "deleted" */
+ dj->fs->wflag = 1;
+ if (dj->index >= i) break; /* When reached SFN, all entries of the object has been deleted. */
+ res = dir_next(dj, FALSE); /* Next entry */
+ } while (res == FR_OK);
+ if (res == FR_NO_FILE) res = FR_INT_ERR;
+ }
+
+#else /* Non LFN configuration */
+ res = dir_seek(dj, dj->index);
+ if (res == FR_OK) {
+ res = move_window(dj->fs, dj->sect);
+ if (res == FR_OK) {
+ *dj->dir = 0xE5; /* Mark the entry "deleted" */
+ dj->fs->wflag = 1;
+ }
+ }
+#endif
+
+ return res;
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Pick a segment and create the object name in directory form */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT create_name (
+ DIR *dj, /* Pointer to the directory object */
+ const XCHAR **path /* Pointer to pointer to the segment in the path string */
+)
+{
+#ifdef _EXCVT
+ static const BYTE cvt[] = _EXCVT;
+#endif
+
+#if _USE_LFN /* LFN configuration */
+ BYTE b, cf;
+ WCHAR w, *lfn;
+ int i, ni, si, di;
+ const XCHAR *p;
+
+ /* Create LFN in Unicode */
+ si = di = 0;
+ p = *path;
+ lfn = dj->lfn;
+ for (;;) {
+ w = p[si++]; /* Get a character */
+ if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */
+ if (di >= _MAX_LFN) /* Reject too long name */
+ return FR_INVALID_NAME;
+#if !_LFN_UNICODE
+ w &= 0xFF;
+ if (IsDBCS1(w)) { /* If it is a DBC 1st byte */
+ b = p[si++]; /* Get 2nd byte */
+ if (!IsDBCS2(b)) /* Reject invalid code for DBC */
+ return FR_INVALID_NAME;
+ w = (w << 8) + b;
+ }
+ w = ff_convert(w, 1); /* Convert OEM to Unicode */
+ if (!w) return FR_INVALID_NAME; /* Reject invalid code */
+#endif
+ if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal chars for LFN */
+ return FR_INVALID_NAME;
+ lfn[di++] = w; /* Store the Unicode char */
+ }
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+ cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
+#if _FS_RPATH
+ if ((di == 1 && lfn[di - 1] == '.') || /* Is this a dot entry? */
+ (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) {
+ lfn[di] = 0;
+ for (i = 0; i < 11; i++)
+ dj->fn[i] = (i < di) ? '.' : ' ';
+ dj->fn[i] = cf | NS_DOT; /* This is a dot entry */
+ return FR_OK;
+ }
+#endif
+ while (di) { /* Strip trailing spaces and dots */
+ w = lfn[di - 1];
+ if (w != ' ' && w != '.') break;
+ di--;
+ }
+ if (!di) return FR_INVALID_NAME; /* Reject null string */
+
+ lfn[di] = 0; /* LFN is created */
+
+ /* Create SFN in directory form */
+ mem_set(dj->fn, ' ', 11);
+ for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */
+ if (si) cf |= NS_LOSS | NS_LFN;
+ while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */
+
+ b = i = 0; ni = 8;
+ for (;;) {
+ w = lfn[si++]; /* Get an LFN char */
+ if (!w) break; /* Break on enf of the LFN */
+ if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */
+ cf |= NS_LOSS | NS_LFN; continue;
+ }
+
+ if (i >= ni || si == di) { /* Extension or end of SFN */
+ if (ni == 11) { /* Long extension */
+ cf |= NS_LOSS | NS_LFN; break;
+ }
+ if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */
+ if (si > di) break; /* No extension */
+ si = di; i = 8; ni = 11; /* Enter extension section */
+ b <<= 2; continue;
+ }
+
+ if (w >= 0x80) { /* Non ASCII char */
+#ifdef _EXCVT
+ w = ff_convert(w, 0); /* Unicode -> OEM code */
+ if (w) w = cvt[w - 0x80]; /* Convert extended char to upper (SBCS) */
+#else
+ w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */
+#endif
+ cf |= NS_LFN; /* Force create LFN entry */
+ }
+
+ if (_DF1S && w >= 0x100) { /* Double byte char */
+ if (i >= ni - 1) {
+ cf |= NS_LOSS | NS_LFN; i = ni; continue;
+ }
+ dj->fn[i++] = (BYTE)(w >> 8);
+ } else { /* Single byte char */
+ if (!w || chk_chr("+,;[=]", w)) { /* Replace illegal chars for SFN */
+ w = '_'; cf |= NS_LOSS | NS_LFN; /* Lossy conversion */
+ } else {
+ if (IsUpper(w)) { /* ASCII large capital */
+ b |= 2;
+ } else {
+ if (IsLower(w)) { /* ASCII small capital */
+ b |= 1; w -= 0x20;
+ }
+ }
+ }
+ }
+ dj->fn[i++] = (BYTE)w;
+ }
+
+ if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05; /* If the first char collides with deleted mark, replace it with 0x05 */
+
+ if (ni == 8) b <<= 2;
+ if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */
+ cf |= NS_LFN;
+ if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended char, NT flags are created */
+ if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */
+ if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */
+ }
+
+ dj->fn[NS] = cf; /* SFN is created */
+
+ return FR_OK;
+
+
+#else /* Non-LFN configuration */
+ BYTE b, c, d, *sfn;
+ int ni, si, i;
+ const char *p;
+
+ /* Create file name in directory form */
+ sfn = dj->fn;
+ mem_set(sfn, ' ', 11);
+ si = i = b = 0; ni = 8;
+ p = *path;
+#if _FS_RPATH
+ if (p[si] == '.') { /* Is this a dot entry? */
+ for (;;) {
+ c = p[si++];
+ if (c != '.' || si >= 3) break;
+ sfn[i++] = c;
+ }
+ if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME;
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+ sfn[NS] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */
+ return FR_OK;
+ }
+#endif
+ for (;;) {
+ c = p[si++];
+ if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */
+ if (c == '.' || i >= ni) {
+ if (ni != 8 || c != '.') return FR_INVALID_NAME;
+ i = 8; ni = 11;
+ b <<= 2; continue;
+ }
+ if (c >= 0x80) { /* Extended char */
+#ifdef _EXCVT
+ c = cvt[c - 0x80]; /* Convert extend char (SBCS) */
+#else
+ b |= 3; /* Eliminate NT flag if ext char is exist */
+#if !_DF1S /* ASCII only cfg */
+ return FR_INVALID_NAME;
+#endif
+#endif
+ }
+ if (IsDBCS1(c)) { /* DBC 1st byte? */
+ d = p[si++]; /* Get 2nd byte */
+ if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */
+ return FR_INVALID_NAME;
+ sfn[i++] = c;
+ sfn[i++] = d;
+ } else { /* Single byte code */
+ if (chk_chr(" \"*+,[=]|\x7F", c)) /* Reject illegal chrs for SFN */
+ return FR_INVALID_NAME;
+ if (IsUpper(c)) { /* ASCII large capital? */
+ b |= 2;
+ } else {
+ if (IsLower(c)) { /* ASCII small capital? */
+ b |= 1; c -= 0x20;
+ }
+ }
+ sfn[i++] = c;
+ }
+ }
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+ c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
+
+ if (!i) return FR_INVALID_NAME; /* Reject null string */
+ if (sfn[0] == 0xE5) sfn[0] = 0x05; /* When first char collides with 0xE5, replace it with 0x05 */
+
+ if (ni == 8) b <<= 2;
+ if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Extension has only small capital) */
+ if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Filename has only small capital) */
+
+ sfn[NS] = c; /* Store NT flag, File name is created */
+
+ return FR_OK;
+#endif
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Get file information from directory entry */
+/*-----------------------------------------------------------------------*/
+#if _FS_MINIMIZE <= 1
+static
+void get_fileinfo ( /* No return code */
+ DIR *dj, /* Pointer to the directory object */
+ FILINFO *fno /* Pointer to the file information to be filled */
+)
+{
+ int i;
+ BYTE c, nt, *dir;
+ char *p;
+
+
+ p = fno->fname;
+ if (dj->sect) {
+ dir = dj->dir;
+ nt = dir[DIR_NTres]; /* NT flag */
+ for (i = 0; i < 8; i++) { /* Copy name body */
+ c = dir[i];
+ if (c == ' ') break;
+ if (c == 0x05) c = 0xE5;
+ if (_USE_LFN && (nt & NS_BODY) && IsUpper(c)) c += 0x20;
+ *p++ = c;
+ }
+ if (dir[8] != ' ') { /* Copy name extension */
+ *p++ = '.';
+ for (i = 8; i < 11; i++) {
+ c = dir[i];
+ if (c == ' ') break;
+ if (_USE_LFN && (nt & NS_EXT) && IsUpper(c)) c += 0x20;
+ *p++ = c;
+ }
+ }
+ fno->fattrib = dir[DIR_Attr]; /* Attribute */
+ fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */
+ fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */
+ fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */
+ }
+ *p = 0;
+
+#if _USE_LFN
+ if (fno->lfname) {
+ XCHAR *tp = fno->lfname;
+ WCHAR w, *lfn;
+
+ i = 0;
+ if (dj->sect && dj->lfn_idx != 0xFFFF) {/* Get LFN if available */
+ lfn = dj->lfn;
+ while ((w = *lfn++) != 0) { /* Get an LFN char */
+#if !_LFN_UNICODE
+ w = ff_convert(w, 0); /* Unicode -> OEM conversion */
+ if (!w) { i = 0; break; } /* Could not convert, no LFN */
+ if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC */
+ tp[i++] = (XCHAR)(w >> 8);
+#endif
+ if (i >= fno->lfsize - 1) { i = 0; break; } /* Buffer overrun, no LFN */
+ tp[i++] = (XCHAR)w;
+ }
+ }
+ tp[i] = 0; /* Terminator */
+ }
+#endif
+}
+#endif /* _FS_MINIMIZE <= 1 */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Follow a file path */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
+ DIR *dj, /* Directory object to return last directory and found object */
+ const XCHAR *path /* Full-path string to find a file or directory */
+)
+{
+ FRESULT res;
+ BYTE *dir, last;
+
+
+ while (!_USE_LFN && *path == ' ') path++; /* Skip leading spaces */
+#if _FS_RPATH
+ if (*path == '/' || *path == '\\') { /* There is a heading separator */
+ path++; dj->sclust = 0; /* Strip it and start from the root dir */
+ } else { /* No heading saparator */
+ dj->sclust = dj->fs->cdir; /* Start from the current dir */
+ }
+#else
+ if (*path == '/' || *path == '\\') /* Strip heading separator if exist */
+ path++;
+ dj->sclust = 0; /* Start from the root dir */
+#endif
+
+ if ((UINT)*path < ' ') { /* Null path means the start directory itself */
+ res = dir_seek(dj, 0);
+ dj->dir = NULL;
+
+ } else { /* Follow path */
+ for (;;) {
+ res = create_name(dj, &path); /* Get a segment */
+ if (res != FR_OK) break;
+ res = dir_find(dj); /* Find it */
+ last = *(dj->fn+NS) & NS_LAST;
+ if (res != FR_OK) { /* Could not find the object */
+ if (res == FR_NO_FILE && !last)
+ res = FR_NO_PATH;
+ break;
+ }
+ if (last) break; /* Last segment match. Function completed. */
+ dir = dj->dir; /* There is next segment. Follow the sub directory */
+ if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */
+ res = FR_NO_PATH; break;
+ }
+ dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ }
+ }
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Load boot record and check if it is an FAT boot record */
+/*-----------------------------------------------------------------------*/
+
+static
+BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
+ FATFS *fs, /* File system object */
+ DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
+)
+{
+ if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK) /* Load boot record */
+ return 3;
+ if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
+ return 2;
+
+ if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
+ return 0;
+ if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
+ return 0;
+
+ return 1;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Make sure that the file system is valid */
+/*-----------------------------------------------------------------------*/
+
+
+FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occured */
+ const XCHAR **path, /* Pointer to pointer to the path name (drive number) */
+ FATFS **rfs, /* Pointer to pointer to the found file system object */
+ BYTE chk_wp /* !=0: Check media write protection for write access */
+)
+{
+ BYTE fmt, *tbl;
+ UINT vol;
+ DSTATUS stat;
+ DWORD bsect, fsize, tsect, mclst;
+ const XCHAR *p = *path;
+ FATFS *fs;
+
+ /* Get logical drive number from the path name */
+ vol = p[0] - '0'; /* Is there a drive number? */
+ if (vol <= 9 && p[1] == ':') { /* Found a drive number, get and strip it */
+ p += 2; *path = p; /* Return pointer to the path name */
+ } else { /* No drive number is given */
+#if _FS_RPATH
+ vol = Drive; /* Use current drive */
+#else
+ vol = 0; /* Use drive 0 */
+#endif
+ }
+
+ /* Check if the logical drive is valid or not */
+ if (vol >= _DRIVES) /* Is the drive number valid? */
+ return FR_INVALID_DRIVE;
+ *rfs = fs = FatFs[vol]; /* Returen pointer to the corresponding file system object */
+ if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */
+
+ ENTER_FF(fs); /* Lock file system */
+
+ if (fs->fs_type) { /* If the logical drive has been mounted */
+ stat = disk_status(fs->drive);
+ if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized (has not been changed), */
+#if !_FS_READONLY
+ if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
+ return FR_WRITE_PROTECTED;
+#endif
+ return FR_OK; /* The file system object is valid */
+ }
+ }
+
+ /* The logical drive must be mounted. Following code attempts to mount the volume */
+
+ fs->fs_type = 0; /* Clear the file system object */
+ fs->drive = (BYTE)LD2PD(vol); /* Bind the logical drive and a physical drive */
+ stat = disk_initialize(fs->drive); /* Initialize low level disk I/O layer */
+ if (stat & STA_NOINIT) /* Check if the drive is ready */
+ return FR_NOT_READY;
+#if _MAX_SS != 512 /* Get disk sector size if needed */
+ if (disk_ioctl(fs->drive, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS)
+ return FR_NO_FILESYSTEM;
+#endif
+#if !_FS_READONLY
+ if (chk_wp && (stat & STA_PROTECT)) /* Check disk write protection if needed */
+ return FR_WRITE_PROTECTED;
+#endif
+ /* Search FAT partition on the drive */
+ fmt = check_fs(fs, bsect = 0); /* Check sector 0 as an SFD format */
+ if (fmt == 1) { /* Not an FAT boot record, it may be patitioned */
+ /* Check a partition listed in top of the partition table */
+ tbl = &fs->win[MBR_Table + LD2PT(vol) * 16]; /* Partition table */
+ if (tbl[4]) { /* Is the partition existing? */
+ bsect = LD_DWORD(&tbl[8]); /* Partition offset in LBA */
+ fmt = check_fs(fs, bsect); /* Check the partition */
+ }
+ }
+ if (fmt == 3) return FR_DISK_ERR;
+ if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs)) /* No valid FAT patition is found */
+ return FR_NO_FILESYSTEM;
+
+ /* Initialize the file system object */
+ fsize = LD_WORD(fs->win+BPB_FATSz16); /* Number of sectors per FAT */
+ if (!fsize) fsize = LD_DWORD(fs->win+BPB_FATSz32);
+ fs->sects_fat = fsize;
+ fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */
+ fsize *= fs->n_fats; /* (Number of sectors in FAT area) */
+ fs->fatbase = bsect + LD_WORD(fs->win+BPB_RsvdSecCnt); /* FAT start sector (lba) */
+ fs->csize = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */
+ fs->n_rootdir = LD_WORD(fs->win+BPB_RootEntCnt); /* Nmuber of root directory entries */
+ tsect = LD_WORD(fs->win+BPB_TotSec16); /* Number of sectors on the volume */
+ if (!tsect) tsect = LD_DWORD(fs->win+BPB_TotSec32);
+ fs->max_clust = mclst = (tsect /* Last cluster# + 1 (Number of clusters + 2) */
+ - LD_WORD(fs->win+BPB_RsvdSecCnt) - fsize - fs->n_rootdir / (SS(fs)/32)
+ ) / fs->csize + 2;
+
+ fmt = FS_FAT12; /* Determine the FAT sub type */
+ if (mclst >= 0xFF7) fmt = FS_FAT16; /* Number of clusters >= 0xFF5 */
+ if (mclst >= 0xFFF7) fmt = FS_FAT32; /* Number of clusters >= 0xFFF5 */
+
+ if (fmt == FS_FAT32)
+ fs->dirbase = LD_DWORD(fs->win+BPB_RootClus); /* Root directory start cluster */
+ else
+ fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */
+ fs->database = fs->fatbase + fsize + fs->n_rootdir / (SS(fs)/32); /* Data start sector (lba) */
+
+#if !_FS_READONLY
+ /* Initialize allocation information */
+ fs->free_clust = 0xFFFFFFFF;
+ fs->wflag = 0;
+ /* Get fsinfo if needed */
+ if (fmt == FS_FAT32) {
+ fs->fsi_flag = 0;
+ fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);
+ if (disk_read(fs->drive, fs->win, fs->fsi_sector, 1) == RES_OK &&
+ LD_WORD(fs->win+BS_55AA) == 0xAA55 &&
+ LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&
+ LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {
+ fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);
+ fs->free_clust = LD_DWORD(fs->win+FSI_Free_Count);
+ }
+ }
+#endif
+ fs->fs_type = fmt; /* FAT sub-type */
+ fs->winsect = 0; /* Invalidate sector cache */
+#if _FS_RPATH
+ fs->cdir = 0; /* Current directory (root dir) */
+#endif
+ fs->id = ++Fsid; /* File system mount ID */
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Check if the file/dir object is valid or not */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */
+ FATFS *fs, /* Pointer to the file system object */
+ WORD id /* Member id of the target object to be checked */
+)
+{
+ if (!fs || !fs->fs_type || fs->id != id)
+ return FR_INVALID_OBJECT;
+
+ ENTER_FF(fs); /* Lock file system */
+
+ if (disk_status(fs->drive) & STA_NOINIT)
+ return FR_NOT_READY;
+
+ return FR_OK;
+}
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Public Functions
+
+--------------------------------------------------------------------------*/
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Mount/Unmount a Locical Drive */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_mount (
+ BYTE vol, /* Logical drive number to be mounted/unmounted */
+ FATFS *fs /* Pointer to new file system object (NULL for unmount)*/
+)
+{
+ FATFS *rfs;
+
+
+ if (vol >= _DRIVES) /* Check if the drive number is valid */
+ return FR_INVALID_DRIVE;
+ rfs = FatFs[vol]; /* Get current fs object */
+
+ if (rfs) {
+#if _FS_REENTRANT /* Discard sync object of the current volume */
+ if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;
+#endif
+ rfs->fs_type = 0; /* Clear old fs object */
+ }
+
+ if (fs) {
+ fs->fs_type = 0; /* Clear new fs object */
+#if _FS_REENTRANT /* Create sync object for the new volume */
+ if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;
+#endif
+ }
+ FatFs[vol] = fs; /* Register new fs object */
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Open or Create a File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_open (
+ FIL *fp, /* Pointer to the blank file object */
+ const XCHAR *path, /* Pointer to the file name */
+ BYTE mode /* Access mode and file open mode flags */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ fp->fs = NULL; /* Clear file object */
+#if !_FS_READONLY
+ mode &= (FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW);
+ res = chk_mounted(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)));
+#else
+ mode &= FA_READ;
+ res = chk_mounted(&path, &dj.fs, 0);
+#endif
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+
+#if !_FS_READONLY
+ /* Create or Open a file */
+ if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) {
+ DWORD ps, cl;
+
+ if (res != FR_OK) { /* No file, create new */
+ if (res == FR_NO_FILE) /* There is no file to open, create a new entry */
+ res = dir_register(&dj);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ mode |= FA_CREATE_ALWAYS;
+ dir = dj.dir; /* Created entry (SFN entry) */
+ }
+ else { /* Any object is already existing */
+ if (mode & FA_CREATE_NEW) /* Cannot create new */
+ LEAVE_FF(dj.fs, FR_EXIST);
+ dir = dj.dir;
+ if (!dir || (dir[DIR_Attr] & (AM_RDO | AM_DIR))) /* Cannot overwrite it (R/O or DIR) */
+ LEAVE_FF(dj.fs, FR_DENIED);
+ if (mode & FA_CREATE_ALWAYS) { /* Resize it to zero on over write mode */
+ cl = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO); /* Get start cluster */
+ ST_WORD(dir+DIR_FstClusHI, 0); /* cluster = 0 */
+ ST_WORD(dir+DIR_FstClusLO, 0);
+ ST_DWORD(dir+DIR_FileSize, 0); /* size = 0 */
+ dj.fs->wflag = 1;
+ ps = dj.fs->winsect; /* Remove the cluster chain */
+ if (cl) {
+ res = remove_chain(dj.fs, cl);
+ if (res) LEAVE_FF(dj.fs, res);
+ dj.fs->last_clust = cl - 1; /* Reuse the cluster hole */
+ }
+ res = move_window(dj.fs, ps);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ }
+ }
+ if (mode & FA_CREATE_ALWAYS) {
+ dir[DIR_Attr] = 0; /* Reset attribute */
+ ps = get_fattime();
+ ST_DWORD(dir+DIR_CrtTime, ps); /* Created time */
+ dj.fs->wflag = 1;
+ mode |= FA__WRITTEN; /* Set file changed flag */
+ }
+ }
+ /* Open an existing file */
+ else {
+#endif /* !_FS_READONLY */
+ if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
+ dir = dj.dir;
+ if (!dir || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
+ LEAVE_FF(dj.fs, FR_NO_FILE);
+#if !_FS_READONLY
+ if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */
+ LEAVE_FF(dj.fs, FR_DENIED);
+ }
+ fp->dir_sect = dj.fs->winsect; /* Pointer to the directory entry */
+ fp->dir_ptr = dj.dir;
+#endif
+ fp->flag = mode; /* File access mode */
+ fp->org_clust = /* File start cluster */
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ fp->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */
+ fp->fptr = 0; fp->csect = 255; /* File pointer */
+ fp->dsect = 0;
+ fp->fs = dj.fs; fp->id = dj.fs->id; /* Owner file system object of the file */
+
+ LEAVE_FF(dj.fs, FR_OK);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_read (
+ FIL *fp, /* Pointer to the file object */
+ void *buff, /* Pointer to data buffer */
+ UINT btr, /* Number of bytes to read */
+ UINT *br /* Pointer to number of bytes read */
+)
+{
+ FRESULT res;
+ DWORD clst, sect, remain;
+ UINT rcnt, cc;
+ BYTE *rbuff = buff;
+
+
+ *br = 0; /* Initialize bytes read */
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_READ)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+ remain = fp->fsize - fp->fptr;
+ if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
+
+ for ( ; btr; /* Repeat until all data transferred */
+ rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
+ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
+ if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
+ clst = (fp->fptr == 0) ? /* On the top of the file? */
+ fp->org_clust : get_fat(fp->fs, fp->curr_clust);
+ if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->curr_clust = clst; /* Update current cluster */
+ fp->csect = 0; /* Reset sector offset in the cluster */
+ }
+ sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
+ if (!sect) ABORT(fp->fs, FR_INT_ERR);
+ sect += fp->csect;
+ cc = btr / SS(fp->fs); /* When remaining bytes >= sector size, */
+ if (cc) { /* Read maximum contiguous sectors directly */
+ if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
+ cc = fp->fs->csize - fp->csect;
+ if (disk_read(fp->fs->drive, rbuff, sect, (BYTE)cc) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+#if !_FS_READONLY && _FS_MINIMIZE <= 2
+#if _FS_TINY
+ if (fp->fs->wflag && fp->fs->winsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
+ mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs));
+#else
+ if ((fp->flag & FA__DIRTY) && fp->dsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
+ mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs));
+#endif
+#endif
+ fp->csect += (BYTE)cc; /* Next sector address in the cluster */
+ rcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
+ continue;
+ }
+#if !_FS_TINY
+#if !_FS_READONLY
+ if (fp->flag & FA__DIRTY) { /* Write sector I/O buffer if needed */
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ if (fp->dsect != sect) { /* Fill sector buffer with file data */
+ if (disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ }
+#endif
+ fp->dsect = sect;
+ fp->csect++; /* Next sector address in the cluster */
+ }
+ rcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Get partial sector data from sector buffer */
+ if (rcnt > btr) rcnt = btr;
+#if _FS_TINY
+ if (move_window(fp->fs, fp->dsect)) /* Move sector window */
+ ABORT(fp->fs, FR_DISK_ERR);
+ mem_cpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
+#else
+ mem_cpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
+#endif
+ }
+
+ LEAVE_FF(fp->fs, FR_OK);
+}
+
+
+
+
+#if !_FS_READONLY
+/*-----------------------------------------------------------------------*/
+/* Write File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_write (
+ FIL *fp, /* Pointer to the file object */
+ const void *buff, /* Pointer to the data to be written */
+ UINT btw, /* Number of bytes to write */
+ UINT *bw /* Pointer to number of bytes written */
+)
+{
+ FRESULT res;
+ DWORD clst, sect;
+ UINT wcnt, cc;
+ const BYTE *wbuff = buff;
+
+
+ *bw = 0; /* Initialize bytes written */
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_WRITE)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+ if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
+
+ for ( ; btw; /* Repeat until all data transferred */
+ wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
+ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
+ if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
+ if (fp->fptr == 0) { /* On the top of the file? */
+ clst = fp->org_clust; /* Follow from the origin */
+ if (clst == 0) /* When there is no cluster chain, */
+ fp->org_clust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */
+ } else { /* Middle or end of the file */
+ clst = create_chain(fp->fs, fp->curr_clust); /* Follow or streach cluster chain */
+ }
+ if (clst == 0) break; /* Could not allocate a new cluster (disk full) */
+ if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->curr_clust = clst; /* Update current cluster */
+ fp->csect = 0; /* Reset sector address in the cluster */
+ }
+#if _FS_TINY
+ if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0)) /* Write back data buffer prior to following direct transfer */
+ ABORT(fp->fs, FR_DISK_ERR);
+#else
+ if (fp->flag & FA__DIRTY) { /* Write back data buffer prior to following direct transfer */
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
+ if (!sect) ABORT(fp->fs, FR_INT_ERR);
+ sect += fp->csect;
+ cc = btw / SS(fp->fs); /* When remaining bytes >= sector size, */
+ if (cc) { /* Write maximum contiguous sectors directly */
+ if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
+ cc = fp->fs->csize - fp->csect;
+ if (disk_write(fp->fs->drive, wbuff, sect, (BYTE)cc) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+#if _FS_TINY
+ if (fp->fs->winsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
+ mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs));
+ fp->fs->wflag = 0;
+ }
+#else
+ if (fp->dsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
+ mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs));
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ fp->csect += (BYTE)cc; /* Next sector address in the cluster */
+ wcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
+ continue;
+ }
+#if _FS_TINY
+ if (fp->fptr >= fp->fsize) { /* Avoid silly buffer filling at growing edge */
+ if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR);
+ fp->fs->winsect = sect;
+ }
+#else
+ if (fp->dsect != sect) { /* Fill sector buffer with file data */
+ if (fp->fptr < fp->fsize &&
+ disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ }
+#endif
+ fp->dsect = sect;
+ fp->csect++; /* Next sector address in the cluster */
+ }
+ wcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Put partial sector into file I/O buffer */
+ if (wcnt > btw) wcnt = btw;
+#if _FS_TINY
+ if (move_window(fp->fs, fp->dsect)) /* Move sector window */
+ ABORT(fp->fs, FR_DISK_ERR);
+ mem_cpy(&fp->fs->win[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
+ fp->fs->wflag = 1;
+#else
+ mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
+ fp->flag |= FA__DIRTY;
+#endif
+ }
+
+ if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */
+ fp->flag |= FA__WRITTEN; /* Set file changed flag */
+
+ LEAVE_FF(fp->fs, FR_OK);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Synchronize the File Object */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_sync (
+ FIL *fp /* Pointer to the file object */
+)
+{
+ FRESULT res;
+ DWORD tim;
+ BYTE *dir;
+
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res == FR_OK) {
+ if (fp->flag & FA__WRITTEN) { /* Has the file been written? */
+#if !_FS_TINY /* Write-back dirty buffer */
+ if (fp->flag & FA__DIRTY) {
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ LEAVE_FF(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ /* Update the directory entry */
+ res = move_window(fp->fs, fp->dir_sect);
+ if (res == FR_OK) {
+ dir = fp->dir_ptr;
+ dir[DIR_Attr] |= AM_ARC; /* Set archive bit */
+ ST_DWORD(dir+DIR_FileSize, fp->fsize); /* Update file size */
+ ST_WORD(dir+DIR_FstClusLO, fp->org_clust); /* Update start cluster */
+ ST_WORD(dir+DIR_FstClusHI, fp->org_clust >> 16);
+ tim = get_fattime(); /* Updated time */
+ ST_DWORD(dir+DIR_WrtTime, tim);
+ fp->flag &= ~FA__WRITTEN;
+ fp->fs->wflag = 1;
+ res = sync(fp->fs);
+ }
+ }
+ }
+
+ LEAVE_FF(fp->fs, res);
+}
+
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Close File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_close (
+ FIL *fp /* Pointer to the file object to be closed */
+)
+{
+ FRESULT res;
+
+
+#if _FS_READONLY
+ res = validate(fp->fs, fp->id);
+ if (res == FR_OK) fp->fs = NULL;
+ LEAVE_FF(fp->fs, res);
+#else
+ res = f_sync(fp);
+ if (res == FR_OK) fp->fs = NULL;
+ return res;
+#endif
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change Current Drive/Directory */
+/*-----------------------------------------------------------------------*/
+
+#if _FS_RPATH
+
+FRESULT f_chdrive (
+ BYTE drv /* Drive number */
+)
+{
+ if (drv >= _DRIVES) return FR_INVALID_DRIVE;
+
+ Drive = drv;
+
+ return FR_OK;
+}
+
+
+
+
+FRESULT f_chdir (
+ const XCHAR *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj.fs, 0);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res == FR_OK) { /* Follow completed */
+ dir = dj.dir; /* Pointer to the entry */
+ if (!dir) {
+ dj.fs->cdir = 0; /* No entry (root dir) */
+ } else {
+ if (dir[DIR_Attr] & AM_DIR) /* Reached to the dir */
+ dj.fs->cdir = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ else
+ res = FR_NO_PATH; /* Could not reach the dir (it is a file) */
+ }
+ }
+ if (res == FR_NO_FILE) res = FR_NO_PATH;
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+#endif
+
+
+
+#if _FS_MINIMIZE <= 2
+/*-----------------------------------------------------------------------*/
+/* Seek File R/W Pointer */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_lseek (
+ FIL *fp, /* Pointer to the file object */
+ DWORD ofs /* File pointer from top of file */
+)
+{
+ FRESULT res;
+ DWORD clst, bcs, nsect, ifptr;
+
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (ofs > fp->fsize /* In read-only mode, clip offset with the file size */
+#if !_FS_READONLY
+ && !(fp->flag & FA_WRITE)
+#endif
+ ) ofs = fp->fsize;
+
+ ifptr = fp->fptr;
+ fp->fptr = nsect = 0; fp->csect = 255;
+ if (ofs > 0) {
+ bcs = (DWORD)fp->fs->csize * SS(fp->fs); /* Cluster size (byte) */
+ if (ifptr > 0 &&
+ (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */
+ fp->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */
+ ofs -= fp->fptr;
+ clst = fp->curr_clust;
+ } else { /* When seek to back cluster, */
+ clst = fp->org_clust; /* start from the first cluster */
+#if !_FS_READONLY
+ if (clst == 0) { /* If no cluster chain, create a new chain */
+ clst = create_chain(fp->fs, 0);
+ if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->org_clust = clst;
+ }
+#endif
+ fp->curr_clust = clst;
+ }
+ if (clst != 0) {
+ while (ofs > bcs) { /* Cluster following loop */
+#if !_FS_READONLY
+ if (fp->flag & FA_WRITE) { /* Check if in write mode or not */
+ clst = create_chain(fp->fs, clst); /* Force streached if in write mode */
+ if (clst == 0) { /* When disk gets full, clip file size */
+ ofs = bcs; break;
+ }
+ } else
+#endif
+ clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ if (clst <= 1 || clst >= fp->fs->max_clust) ABORT(fp->fs, FR_INT_ERR);
+ fp->curr_clust = clst;
+ fp->fptr += bcs;
+ ofs -= bcs;
+ }
+ fp->fptr += ofs;
+ fp->csect = (BYTE)(ofs / SS(fp->fs)); /* Sector offset in the cluster */
+ if (ofs % SS(fp->fs)) {
+ nsect = clust2sect(fp->fs, clst); /* Current sector */
+ if (!nsect) ABORT(fp->fs, FR_INT_ERR);
+ nsect += fp->csect;
+ fp->csect++;
+ }
+ }
+ }
+ if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) {
+#if !_FS_TINY
+#if !_FS_READONLY
+ if (fp->flag & FA__DIRTY) { /* Write-back dirty buffer if needed */
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ if (disk_read(fp->fs->drive, fp->buf, nsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+#endif
+ fp->dsect = nsect;
+ }
+#if !_FS_READONLY
+ if (fp->fptr > fp->fsize) { /* Set changed flag if the file size is extended */
+ fp->fsize = fp->fptr;
+ fp->flag |= FA__WRITTEN;
+ }
+#endif
+
+ LEAVE_FF(fp->fs, res);
+}
+
+
+
+
+#if _FS_MINIMIZE <= 1
+/*-----------------------------------------------------------------------*/
+/* Create a Directroy Object */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_opendir (
+ DIR *dj, /* Pointer to directory object to create */
+ const XCHAR *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj->fs, 0);
+ if (res == FR_OK) {
+ INITBUF((*dj), sfn, lfn);
+ res = follow_path(dj, path); /* Follow the path to the directory */
+ if (res == FR_OK) { /* Follow completed */
+ dir = dj->dir;
+ if (dir) { /* It is not the root dir */
+ if (dir[DIR_Attr] & AM_DIR) { /* The object is a directory */
+ dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ } else { /* The object is not a directory */
+ res = FR_NO_PATH;
+ }
+ }
+ if (res == FR_OK) {
+ dj->id = dj->fs->id;
+ res = dir_seek(dj, 0); /* Rewind dir */
+ }
+ }
+ if (res == FR_NO_FILE) res = FR_NO_PATH;
+ }
+
+ LEAVE_FF(dj->fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read Directory Entry in Sequense */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_readdir (
+ DIR *dj, /* Pointer to the open directory object */
+ FILINFO *fno /* Pointer to file information to return */
+)
+{
+ FRESULT res;
+ NAMEBUF(sfn, lfn);
+
+
+ res = validate(dj->fs, dj->id); /* Check validity of the object */
+ if (res == FR_OK) {
+ INITBUF((*dj), sfn, lfn);
+ if (!fno) {
+ res = dir_seek(dj, 0);
+ } else {
+ res = dir_read(dj);
+ if (res == FR_NO_FILE) {
+ dj->sect = 0;
+ res = FR_OK;
+ }
+ if (res == FR_OK) { /* A valid entry is found */
+ get_fileinfo(dj, fno); /* Get the object information */
+ res = dir_next(dj, FALSE); /* Increment index for next */
+ if (res == FR_NO_FILE) {
+ dj->sect = 0;
+ res = FR_OK;
+ }
+ }
+ }
+ }
+
+ LEAVE_FF(dj->fs, res);
+}
+
+
+
+#if _FS_MINIMIZE == 0
+/*-----------------------------------------------------------------------*/
+/* Get File Status */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_stat (
+ const XCHAR *path, /* Pointer to the file path */
+ FILINFO *fno /* Pointer to file information to return */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+
+
+ res = chk_mounted(&path, &dj.fs, 0);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res == FR_OK) { /* Follwo completed */
+ if (dj.dir) /* Found an object */
+ get_fileinfo(&dj, fno);
+ else /* It is root dir */
+ res = FR_INVALID_NAME;
+ }
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+#if !_FS_READONLY
+/*-----------------------------------------------------------------------*/
+/* Get Number of Free Clusters */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_getfree (
+ const XCHAR *path, /* Pointer to the logical drive number (root dir) */
+ DWORD *nclst, /* Pointer to the variable to return number of free clusters */
+ FATFS **fatfs /* Pointer to pointer to corresponding file system object to return */
+)
+{
+ FRESULT res;
+ DWORD n, clst, sect, stat;
+ UINT i;
+ BYTE fat, *p;
+
+
+ /* Get drive number */
+ res = chk_mounted(&path, fatfs, 0);
+ if (res != FR_OK) LEAVE_FF(*fatfs, res);
+
+ /* If number of free cluster is valid, return it without cluster scan. */
+ if ((*fatfs)->free_clust <= (*fatfs)->max_clust - 2) {
+ *nclst = (*fatfs)->free_clust;
+ LEAVE_FF(*fatfs, FR_OK);
+ }
+
+ /* Get number of free clusters */
+ fat = (*fatfs)->fs_type;
+ n = 0;
+ if (fat == FS_FAT12) {
+ clst = 2;
+ do {
+ stat = get_fat(*fatfs, clst);
+ if (stat == 0xFFFFFFFF) LEAVE_FF(*fatfs, FR_DISK_ERR);
+ if (stat == 1) LEAVE_FF(*fatfs, FR_INT_ERR);
+ if (stat == 0) n++;
+ } while (++clst < (*fatfs)->max_clust);
+ } else {
+ clst = (*fatfs)->max_clust;
+ sect = (*fatfs)->fatbase;
+ i = 0; p = 0;
+ do {
+ if (!i) {
+ res = move_window(*fatfs, sect++);
+ if (res != FR_OK)
+ LEAVE_FF(*fatfs, res);
+ p = (*fatfs)->win;
+ i = SS(*fatfs);
+ }
+ if (fat == FS_FAT16) {
+ if (LD_WORD(p) == 0) n++;
+ p += 2; i -= 2;
+ } else {
+ if ((LD_DWORD(p) & 0x0FFFFFFF) == 0) n++;
+ p += 4; i -= 4;
+ }
+ } while (--clst);
+ }
+ (*fatfs)->free_clust = n;
+ if (fat == FS_FAT32) (*fatfs)->fsi_flag = 1;
+ *nclst = n;
+
+ LEAVE_FF(*fatfs, FR_OK);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Truncate File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_truncate (
+ FIL *fp /* Pointer to the file object */
+)
+{
+ FRESULT res;
+ DWORD ncl;
+
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_WRITE)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+
+ if (fp->fsize > fp->fptr) {
+ fp->fsize = fp->fptr; /* Set file size to current R/W point */
+ fp->flag |= FA__WRITTEN;
+ if (fp->fptr == 0) { /* When set file size to zero, remove entire cluster chain */
+ res = remove_chain(fp->fs, fp->org_clust);
+ fp->org_clust = 0;
+ } else { /* When truncate a part of the file, remove remaining clusters */
+ ncl = get_fat(fp->fs, fp->curr_clust);
+ res = FR_OK;
+ if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;
+ if (ncl == 1) res = FR_INT_ERR;
+ if (res == FR_OK && ncl < fp->fs->max_clust) {
+ res = put_fat(fp->fs, fp->curr_clust, 0x0FFFFFFF);
+ if (res == FR_OK) res = remove_chain(fp->fs, ncl);
+ }
+ }
+ }
+ if (res != FR_OK) fp->flag |= FA__ERROR;
+
+ LEAVE_FF(fp->fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Delete a File or Directory */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_unlink (
+ const XCHAR *path /* Pointer to the file or directory path */
+)
+{
+ FRESULT res;
+ DIR dj, sdj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+ DWORD dclst;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
+
+ dir = dj.dir;
+ if (!dir) /* Is it the root directory? */
+ LEAVE_FF(dj.fs, FR_INVALID_NAME);
+ if (dir[DIR_Attr] & AM_RDO) /* Is it a R/O object? */
+ LEAVE_FF(dj.fs, FR_DENIED);
+ dclst = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+
+ if (dir[DIR_Attr] & AM_DIR) { /* It is a sub-directory */
+ if (dclst < 2) LEAVE_FF(dj.fs, FR_INT_ERR);
+ mem_cpy(&sdj, &dj, sizeof(DIR)); /* Check if the sub-dir is empty or not */
+ sdj.sclust = dclst;
+ res = dir_seek(&sdj, 2);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ res = dir_read(&sdj);
+ if (res == FR_OK) res = FR_DENIED; /* Not empty sub-dir */
+ if (res != FR_NO_FILE) LEAVE_FF(dj.fs, res);
+ }
+
+ res = dir_remove(&dj); /* Remove directory entry */
+ if (res == FR_OK) {
+ if (dclst)
+ res = remove_chain(dj.fs, dclst); /* Remove the cluster chain */
+ if (res == FR_OK) res = sync(dj.fs);
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Create a Directory */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_mkdir (
+ const XCHAR *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir, n;
+ DWORD dsect, dclst, pclst, tim;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res == FR_OK) res = FR_EXIST; /* Any file or directory is already existing */
+ if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res != FR_NO_FILE) /* Any error occured */
+ LEAVE_FF(dj.fs, res);
+
+ dclst = create_chain(dj.fs, 0); /* Allocate a new cluster for new directory table */
+ res = FR_OK;
+ if (dclst == 0) res = FR_DENIED;
+ if (dclst == 1) res = FR_INT_ERR;
+ if (dclst == 0xFFFFFFFF) res = FR_DISK_ERR;
+ if (res == FR_OK)
+ res = move_window(dj.fs, 0);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ dsect = clust2sect(dj.fs, dclst);
+
+ dir = dj.fs->win; /* Initialize the new directory table */
+ mem_set(dir, 0, SS(dj.fs));
+ mem_set(dir+DIR_Name, ' ', 8+3); /* Create "." entry */
+ dir[DIR_Name] = '.';
+ dir[DIR_Attr] = AM_DIR;
+ tim = get_fattime();
+ ST_DWORD(dir+DIR_WrtTime, tim);
+ ST_WORD(dir+DIR_FstClusLO, dclst);
+ ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
+ mem_cpy(dir+32, dir, 32); /* Create ".." entry */
+ dir[33] = '.';
+ pclst = dj.sclust;
+ if (dj.fs->fs_type == FS_FAT32 && pclst == dj.fs->dirbase)
+ pclst = 0;
+ ST_WORD(dir+32+DIR_FstClusLO, pclst);
+ ST_WORD(dir+32+DIR_FstClusHI, pclst >> 16);
+ for (n = 0; n < dj.fs->csize; n++) { /* Write dot entries and clear left sectors */
+ dj.fs->winsect = dsect++;
+ dj.fs->wflag = 1;
+ res = move_window(dj.fs, 0);
+ if (res) LEAVE_FF(dj.fs, res);
+ mem_set(dir, 0, SS(dj.fs));
+ }
+
+ res = dir_register(&dj);
+ if (res != FR_OK) {
+ remove_chain(dj.fs, dclst);
+ } else {
+ dir = dj.dir;
+ dir[DIR_Attr] = AM_DIR; /* Attribute */
+ ST_DWORD(dir+DIR_WrtTime, tim); /* Crated time */
+ ST_WORD(dir+DIR_FstClusLO, dclst); /* Table start cluster */
+ ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
+ dj.fs->wflag = 1;
+ res = sync(dj.fs);
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change File Attribute */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_chmod (
+ const XCHAR *path, /* Pointer to the file path */
+ BYTE value, /* Attribute bits */
+ BYTE mask /* Attribute mask to change */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res == FR_OK) {
+ dir = dj.dir;
+ if (!dir) { /* Is it a root directory? */
+ res = FR_INVALID_NAME;
+ } else { /* File or sub directory */
+ mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC; /* Valid attribute mask */
+ dir[DIR_Attr] = (value & mask) | (dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */
+ dj.fs->wflag = 1;
+ res = sync(dj.fs);
+ }
+ }
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change Timestamp */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_utime (
+ const XCHAR *path, /* Pointer to the file/directory name */
+ const FILINFO *fno /* Pointer to the timestamp to be set */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res == FR_OK) {
+ dir = dj.dir;
+ if (!dir) { /* Root directory */
+ res = FR_INVALID_NAME;
+ } else { /* File or sub-directory */
+ ST_WORD(dir+DIR_WrtTime, fno->ftime);
+ ST_WORD(dir+DIR_WrtDate, fno->fdate);
+ dj.fs->wflag = 1;
+ res = sync(dj.fs);
+ }
+ }
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Rename File/Directory */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_rename (
+ const XCHAR *path_old, /* Pointer to the old name */
+ const XCHAR *path_new /* Pointer to the new name */
+)
+{
+ FRESULT res;
+ DIR dj_old, dj_new;
+ NAMEBUF(sfn, lfn);
+ BYTE buf[21], *dir;
+ DWORD dw;
+
+
+ INITBUF(dj_old, sfn, lfn);
+ res = chk_mounted(&path_old, &dj_old.fs, 1);
+ if (res == FR_OK) {
+ dj_new.fs = dj_old.fs;
+ res = follow_path(&dj_old, path_old); /* Check old object */
+ if (_FS_RPATH && res == FR_OK && (dj_old.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ }
+ if (res != FR_OK) LEAVE_FF(dj_old.fs, res); /* The old object is not found */
+
+ if (!dj_old.dir) LEAVE_FF(dj_old.fs, FR_NO_FILE); /* Is root dir? */
+ mem_cpy(buf, dj_old.dir+DIR_Attr, 21); /* Save the object information */
+
+ mem_cpy(&dj_new, &dj_old, sizeof(DIR));
+ res = follow_path(&dj_new, path_new); /* Check new object */
+ if (res == FR_OK) res = FR_EXIST; /* The new object name is already existing */
+ if (res == FR_NO_FILE) { /* Is it a valid path and no name collision? */
+ res = dir_register(&dj_new); /* Register the new object */
+ if (res == FR_OK) {
+ dir = dj_new.dir; /* Copy object information into new entry */
+ mem_cpy(dir+13, buf+2, 19);
+ dir[DIR_Attr] = buf[0] | AM_ARC;
+ dj_old.fs->wflag = 1;
+ if (dir[DIR_Attr] & AM_DIR) { /* Update .. entry in the directory if needed */
+ dw = clust2sect(dj_new.fs, (DWORD)LD_WORD(dir+DIR_FstClusHI) | LD_WORD(dir+DIR_FstClusLO));
+ if (!dw) {
+ res = FR_INT_ERR;
+ } else {
+ res = move_window(dj_new.fs, dw);
+ dir = dj_new.fs->win+32;
+ if (res == FR_OK && dir[1] == '.') {
+ dw = (dj_new.fs->fs_type == FS_FAT32 && dj_new.sclust == dj_new.fs->dirbase) ? 0 : dj_new.sclust;
+ ST_WORD(dir+DIR_FstClusLO, dw);
+ ST_WORD(dir+DIR_FstClusHI, dw >> 16);
+ dj_new.fs->wflag = 1;
+ }
+ }
+ }
+ if (res == FR_OK) {
+ res = dir_remove(&dj_old); /* Remove old entry */
+ if (res == FR_OK)
+ res = sync(dj_old.fs);
+ }
+ }
+ }
+
+ LEAVE_FF(dj_old.fs, res);
+}
+
+#endif /* !_FS_READONLY */
+#endif /* _FS_MINIMIZE == 0 */
+#endif /* _FS_MINIMIZE <= 1 */
+#endif /* _FS_MINIMIZE <= 2 */
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Forward data to the stream directly (Available on only _FS_TINY cfg) */
+/*-----------------------------------------------------------------------*/
+#if _USE_FORWARD && _FS_TINY
+
+FRESULT f_forward (
+ FIL *fp, /* Pointer to the file object */
+ UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */
+ UINT btr, /* Number of bytes to forward */
+ UINT *bf /* Pointer to number of bytes forwarded */
+)
+{
+ FRESULT res;
+ DWORD remain, clst, sect;
+ UINT rcnt;
+
+
+ *bf = 0;
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check error flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_READ)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+
+ remain = fp->fsize - fp->fptr;
+ if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
+
+ for ( ; btr && (*func)(NULL, 0); /* Repeat until all data transferred or stream becomes busy */
+ fp->fptr += rcnt, *bf += rcnt, btr -= rcnt) {
+ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
+ if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
+ clst = (fp->fptr == 0) ? /* On the top of the file? */
+ fp->org_clust : get_fat(fp->fs, fp->curr_clust);
+ if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->curr_clust = clst; /* Update current cluster */
+ fp->csect = 0; /* Reset sector address in the cluster */
+ }
+ fp->csect++; /* Next sector address in the cluster */
+ }
+ sect = clust2sect(fp->fs, fp->curr_clust); /* Get current data sector */
+ if (!sect) ABORT(fp->fs, FR_INT_ERR);
+ sect += fp->csect - 1;
+ if (move_window(fp->fs, sect)) /* Move sector window */
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->dsect = sect;
+ rcnt = SS(fp->fs) - (WORD)(fp->fptr % SS(fp->fs)); /* Forward data from sector window */
+ if (rcnt > btr) rcnt = btr;
+ rcnt = (*func)(&fp->fs->win[(WORD)fp->fptr % SS(fp->fs)], rcnt);
+ if (!rcnt) ABORT(fp->fs, FR_INT_ERR);
+ }
+
+ LEAVE_FF(fp->fs, FR_OK);
+}
+#endif /* _USE_FORWARD */
+
+
+
+#if _USE_MKFS && !_FS_READONLY
+/*-----------------------------------------------------------------------*/
+/* Create File System on the Drive */
+/*-----------------------------------------------------------------------*/
+#define N_ROOTDIR 512 /* Multiple of 32 and <= 2048 */
+#define N_FATS 1 /* 1 or 2 */
+#define MAX_SECTOR 131072000UL /* Maximum partition size */
+#define MIN_SECTOR 2000UL /* Minimum partition size */
+
+
+FRESULT f_mkfs (
+ BYTE drv, /* Logical drive number */
+ BYTE partition, /* Partitioning rule 0:FDISK, 1:SFD */
+ WORD allocsize /* Allocation unit size [bytes] */
+)
+{
+ static const DWORD sstbl[] = { 2048000, 1024000, 512000, 256000, 128000, 64000, 32000, 16000, 8000, 4000, 0 };
+ static const WORD cstbl[] = { 32768, 16384, 8192, 4096, 2048, 16384, 8192, 4096, 2048, 1024, 512 };
+ BYTE fmt, m, *tbl;
+ DWORD b_part, b_fat, b_dir, b_data; /* Area offset (LBA) */
+ DWORD n_part, n_rsv, n_fat, n_dir; /* Area size */
+ DWORD n_clst, d, n;
+ WORD as;
+ FATFS *fs;
+ DSTATUS stat;
+
+
+ /* Check validity of the parameters */
+ if (drv >= _DRIVES) return FR_INVALID_DRIVE;
+ if (partition >= 2) return FR_MKFS_ABORTED;
+
+ /* Check mounted drive and clear work area */
+ fs = FatFs[drv];
+ if (!fs) return FR_NOT_ENABLED;
+ fs->fs_type = 0;
+ drv = LD2PD(drv);
+
+ /* Get disk statics */
+ stat = disk_initialize(drv);
+ if (stat & STA_NOINIT) return FR_NOT_READY;
+ if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
+#if _MAX_SS != 512 /* Get disk sector size */
+ if (disk_ioctl(drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK
+ || SS(fs) > _MAX_SS)
+ return FR_MKFS_ABORTED;
+#endif
+ if (disk_ioctl(drv, GET_SECTOR_COUNT, &n_part) != RES_OK || n_part < MIN_SECTOR)
+ return FR_MKFS_ABORTED;
+ if (n_part > MAX_SECTOR) n_part = MAX_SECTOR;
+ b_part = (!partition) ? 63 : 0; /* Boot sector */
+ n_part -= b_part;
+ for (d = 512; d <= 32768U && d != allocsize; d <<= 1) ; /* Check validity of the allocation unit size */
+ if (d != allocsize) allocsize = 0;
+ if (!allocsize) { /* Auto selection of cluster size */
+ d = n_part;
+ for (as = SS(fs); as > 512U; as >>= 1) d >>= 1;
+ for (n = 0; d < sstbl[n]; n++) ;
+ allocsize = cstbl[n];
+ }
+ if (allocsize < SS(fs)) allocsize = SS(fs);
+
+ allocsize /= SS(fs); /* Number of sectors per cluster */
+
+ /* Pre-compute number of clusters and FAT type */
+ n_clst = n_part / allocsize;
+ fmt = FS_FAT12;
+ if (n_clst >= 0xFF5) fmt = FS_FAT16;
+ if (n_clst >= 0xFFF5) fmt = FS_FAT32;
+
+ /* Determine offset and size of FAT structure */
+ switch (fmt) {
+ case FS_FAT12:
+ n_fat = ((n_clst * 3 + 1) / 2 + 3 + SS(fs) - 1) / SS(fs);
+ n_rsv = 1 + partition;
+ n_dir = N_ROOTDIR * 32 / SS(fs);
+ break;
+ case FS_FAT16:
+ n_fat = ((n_clst * 2) + 4 + SS(fs) - 1) / SS(fs);
+ n_rsv = 1 + partition;
+ n_dir = N_ROOTDIR * 32 / SS(fs);
+ break;
+ default:
+ n_fat = ((n_clst * 4) + 8 + SS(fs) - 1) / SS(fs);
+ n_rsv = 33 - partition;
+ n_dir = 0;
+ }
+ b_fat = b_part + n_rsv; /* FATs start sector */
+ b_dir = b_fat + n_fat * N_FATS; /* Directory start sector */
+ b_data = b_dir + n_dir; /* Data start sector */
+
+ /* Align data start sector to erase block boundary (for flash memory media) */
+ if (disk_ioctl(drv, GET_BLOCK_SIZE, &n) != RES_OK) return FR_MKFS_ABORTED;
+ n = (b_data + n - 1) & ~(n - 1);
+ n_fat += (n - b_data) / N_FATS;
+ /* b_dir and b_data are no longer used below */
+
+ /* Determine number of cluster and final check of validity of the FAT type */
+ n_clst = (n_part - n_rsv - n_fat * N_FATS - n_dir) / allocsize;
+ if ( (fmt == FS_FAT16 && n_clst < 0xFF5)
+ || (fmt == FS_FAT32 && n_clst < 0xFFF5))
+ return FR_MKFS_ABORTED;
+
+ /* Create partition table if needed */
+ if (!partition) {
+ DWORD n_disk = b_part + n_part;
+
+ mem_set(fs->win, 0, SS(fs));
+ tbl = fs->win+MBR_Table;
+ ST_DWORD(tbl, 0x00010180); /* Partition start in CHS */
+ if (n_disk < 63UL * 255 * 1024) { /* Partition end in CHS */
+ n_disk = n_disk / 63 / 255;
+ tbl[7] = (BYTE)n_disk;
+ tbl[6] = (BYTE)((n_disk >> 2) | 63);
+ } else {
+ ST_WORD(&tbl[6], 0xFFFF);
+ }
+ tbl[5] = 254;
+ if (fmt != FS_FAT32) /* System ID */
+ tbl[4] = (n_part < 0x10000) ? 0x04 : 0x06;
+ else
+ tbl[4] = 0x0c;
+ ST_DWORD(tbl+8, 63); /* Partition start in LBA */
+ ST_DWORD(tbl+12, n_part); /* Partition size in LBA */
+ ST_WORD(tbl+64, 0xAA55); /* Signature */
+ if (disk_write(drv, fs->win, 0, 1) != RES_OK)
+ return FR_DISK_ERR;
+ partition = 0xF8;
+ } else {
+ partition = 0xF0;
+ }
+
+ /* Create boot record */
+ tbl = fs->win; /* Clear buffer */
+ mem_set(tbl, 0, SS(fs));
+ ST_DWORD(tbl+BS_jmpBoot, 0x90FEEB); /* Boot code (jmp $, nop) */
+ ST_WORD(tbl+BPB_BytsPerSec, SS(fs)); /* Sector size */
+ tbl[BPB_SecPerClus] = (BYTE)allocsize; /* Sectors per cluster */
+ ST_WORD(tbl+BPB_RsvdSecCnt, n_rsv); /* Reserved sectors */
+ tbl[BPB_NumFATs] = N_FATS; /* Number of FATs */
+ ST_WORD(tbl+BPB_RootEntCnt, SS(fs) / 32 * n_dir); /* Number of rootdir entries */
+ if (n_part < 0x10000) { /* Number of total sectors */
+ ST_WORD(tbl+BPB_TotSec16, n_part);
+ } else {
+ ST_DWORD(tbl+BPB_TotSec32, n_part);
+ }
+ tbl[BPB_Media] = partition; /* Media descripter */
+ ST_WORD(tbl+BPB_SecPerTrk, 63); /* Number of sectors per track */
+ ST_WORD(tbl+BPB_NumHeads, 255); /* Number of heads */
+ ST_DWORD(tbl+BPB_HiddSec, b_part); /* Hidden sectors */
+ n = get_fattime(); /* Use current time as a VSN */
+ if (fmt != FS_FAT32) {
+ ST_DWORD(tbl+BS_VolID, n); /* Volume serial number */
+ ST_WORD(tbl+BPB_FATSz16, n_fat); /* Number of secters per FAT */
+ tbl[BS_DrvNum] = 0x80; /* Drive number */
+ tbl[BS_BootSig] = 0x29; /* Extended boot signature */
+ mem_cpy(tbl+BS_VolLab, "NO NAME FAT ", 19); /* Volume lavel, FAT signature */
+ } else {
+ ST_DWORD(tbl+BS_VolID32, n); /* Volume serial number */
+ ST_DWORD(tbl+BPB_FATSz32, n_fat); /* Number of secters per FAT */
+ ST_DWORD(tbl+BPB_RootClus, 2); /* Root directory cluster (2) */
+ ST_WORD(tbl+BPB_FSInfo, 1); /* FSInfo record offset (bs+1) */
+ ST_WORD(tbl+BPB_BkBootSec, 6); /* Backup boot record offset (bs+6) */
+ tbl[BS_DrvNum32] = 0x80; /* Drive number */
+ tbl[BS_BootSig32] = 0x29; /* Extended boot signature */
+ mem_cpy(tbl+BS_VolLab32, "NO NAME FAT32 ", 19); /* Volume lavel, FAT signature */
+ }
+ ST_WORD(tbl+BS_55AA, 0xAA55); /* Signature */
+ if (SS(fs) > 512U) {
+ ST_WORD(tbl+SS(fs)-2, 0xAA55);
+ }
+ if (disk_write(drv, tbl, b_part+0, 1) != RES_OK)
+ return FR_DISK_ERR;
+ if (fmt == FS_FAT32)
+ disk_write(drv, tbl, b_part+6, 1);
+
+ /* Initialize FAT area */
+ for (m = 0; m < N_FATS; m++) {
+ mem_set(tbl, 0, SS(fs)); /* 1st sector of the FAT */
+ if (fmt != FS_FAT32) {
+ n = (fmt == FS_FAT12) ? 0x00FFFF00 : 0xFFFFFF00;
+ n |= partition;
+ ST_DWORD(tbl, n); /* Reserve cluster #0-1 (FAT12/16) */
+ } else {
+ ST_DWORD(tbl+0, 0xFFFFFFF8); /* Reserve cluster #0-1 (FAT32) */
+ ST_DWORD(tbl+4, 0xFFFFFFFF);
+ ST_DWORD(tbl+8, 0x0FFFFFFF); /* Reserve cluster #2 for root dir */
+ }
+ if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
+ return FR_DISK_ERR;
+ mem_set(tbl, 0, SS(fs)); /* Following FAT entries are filled by zero */
+ for (n = 1; n < n_fat; n++) {
+ if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
+ return FR_DISK_ERR;
+ }
+ }
+
+ /* Initialize Root directory */
+ m = (BYTE)((fmt == FS_FAT32) ? allocsize : n_dir);
+ do {
+ if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
+ return FR_DISK_ERR;
+ } while (--m);
+
+ /* Create FSInfo record if needed */
+ if (fmt == FS_FAT32) {
+ ST_WORD(tbl+BS_55AA, 0xAA55);
+ ST_DWORD(tbl+FSI_LeadSig, 0x41615252);
+ ST_DWORD(tbl+FSI_StrucSig, 0x61417272);
+ ST_DWORD(tbl+FSI_Free_Count, n_clst - 1);
+ ST_DWORD(tbl+FSI_Nxt_Free, 0xFFFFFFFF);
+ disk_write(drv, tbl, b_part+1, 1);
+ disk_write(drv, tbl, b_part+7, 1);
+ }
+
+ return (disk_ioctl(drv, CTRL_SYNC, (void*)NULL) == RES_OK) ? FR_OK : FR_DISK_ERR;
+}
+
+#endif /* _USE_MKFS && !_FS_READONLY */
+
+
+
+
+#if _USE_STRFUNC
+/*-----------------------------------------------------------------------*/
+/* Get a string from the file */
+/*-----------------------------------------------------------------------*/
+char* f_gets (
+ char* buff, /* Pointer to the string buffer to read */
+ int len, /* Size of string buffer */
+ FIL* fil /* Pointer to the file object */
+)
+{
+ int i = 0;
+ char *p = buff;
+ UINT rc;
+
+
+ while (i < len - 1) { /* Read bytes until buffer gets filled */
+ f_read(fil, p, 1, &rc);
+ if (rc != 1) break; /* Break when no data to read */
+#if _USE_STRFUNC >= 2
+ if (*p == '\r') continue; /* Strip '\r' */
+#endif
+ i++;
+ if (*p++ == '\n') break; /* Break when reached end of line */
+ }
+ *p = 0;
+ return i ? buff : NULL; /* When no data read (eof or error), return with error. */
+}
+
+
+
+#if !_FS_READONLY
+#include <stdarg.h>
+/*-----------------------------------------------------------------------*/
+/* Put a character to the file */
+/*-----------------------------------------------------------------------*/
+int f_putc (
+ int chr, /* A character to be output */
+ FIL* fil /* Ponter to the file object */
+)
+{
+ UINT bw;
+ char c;
+
+
+#if _USE_STRFUNC >= 2
+ if (chr == '\n') f_putc ('\r', fil); /* LF -> CRLF conversion */
+#endif
+ if (!fil) { /* Special value may be used to switch the destination to any other device */
+ /* put_console(chr); */
+ return chr;
+ }
+ c = (char)chr;
+ f_write(fil, &c, 1, &bw); /* Write a byte to the file */
+ return bw ? chr : EOF; /* Return the result */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Put a string to the file */
+/*-----------------------------------------------------------------------*/
+int f_puts (
+ const char* str, /* Pointer to the string to be output */
+ FIL* fil /* Pointer to the file object */
+)
+{
+ int n;
+
+
+ for (n = 0; *str; str++, n++) {
+ if (f_putc(*str, fil) == EOF) return EOF;
+ }
+ return n;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Put a formatted string to the file */
+/*-----------------------------------------------------------------------*/
+int f_printf (
+ FIL* fil, /* Pointer to the file object */
+ const char* str, /* Pointer to the format string */
+ ... /* Optional arguments... */
+)
+{
+ va_list arp;
+ UCHAR c, f, r;
+ ULONG val;
+ char s[16];
+ int i, w, res, cc;
+
+
+ va_start(arp, str);
+
+ for (cc = res = 0; cc != EOF; res += cc) {
+ c = *str++;
+ if (c == 0) break; /* End of string */
+ if (c != '%') { /* Non escape cahracter */
+ cc = f_putc(c, fil);
+ if (cc != EOF) cc = 1;
+ continue;
+ }
+ w = f = 0;
+ c = *str++;
+ if (c == '0') { /* Flag: '0' padding */
+ f = 1; c = *str++;
+ }
+ while (c >= '0' && c <= '9') { /* Precision */
+ w = w * 10 + (c - '0');
+ c = *str++;
+ }
+ if (c == 'l') { /* Prefix: Size is long int */
+ f |= 2; c = *str++;
+ }
+ if (c == 's') { /* Type is string */
+ cc = f_puts(va_arg(arp, char*), fil);
+ continue;
+ }
+ if (c == 'c') { /* Type is character */
+ cc = f_putc(va_arg(arp, int), fil);
+ if (cc != EOF) cc = 1;
+ continue;
+ }
+ r = 0;
+ if (c == 'd') r = 10; /* Type is signed decimal */
+ if (c == 'u') r = 10; /* Type is unsigned decimal */
+ if (c == 'X') r = 16; /* Type is unsigned hexdecimal */
+ if (r == 0) break; /* Unknown type */
+ if (f & 2) { /* Get the value */
+ val = (ULONG)va_arg(arp, long);
+ } else {
+ val = (c == 'd') ? (ULONG)(long)va_arg(arp, int) : (ULONG)va_arg(arp, unsigned int);
+ }
+ /* Put numeral string */
+ if (c == 'd') {
+ if (val & 0x80000000) {
+ val = 0 - val;
+ f |= 4;
+ }
+ }
+ i = sizeof(s) - 1; s[i] = 0;
+ do {
+ c = (UCHAR)(val % r + '0');
+ if (c > '9') c += 7;
+ s[--i] = c;
+ val /= r;
+ } while (i && val);
+ if (i && (f & 4)) s[--i] = '-';
+ w = sizeof(s) - 1 - w;
+ while (i && i > w) s[--i] = (f & 1) ? '0' : ' ';
+ cc = f_puts(&s[i], fil);
+ }
+
+ va_end(arp);
+ return (cc == EOF) ? cc : res;
+}
+
+#endif /* !_FS_READONLY */
+#endif /* _USE_STRFUNC */
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/ff.h b/Projects/TemperatureDataLogger/Lib/FATFs/ff.h
index 41e136ee5..69bfd3109 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/ff.h
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/ff.h
@@ -1,596 +1,596 @@
-/*---------------------------------------------------------------------------/
-/ FatFs - FAT file system module include file R0.07e (C)ChaN, 2010
-/----------------------------------------------------------------------------/
-/ FatFs module is a generic FAT file system module for small embedded systems.
-/ This is a free software that opened for education, research and commercial
-/ developments under license policy of following trems.
-/
-/ Copyright (C) 2010, ChaN, all right reserved.
-/
-/ * The FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
-/----------------------------------------------------------------------------*/
-
-#ifndef _FATFS
-#define _FATFS 0x007E
-
-#include "integer.h" /* Basic integer types */
-#include "ffconf.h" /* FatFs configuration options */
-
-#if _FATFS != _FFCONFIG
-#error Wrong configuration file (ffconf.h).
-#endif
-
-
-/* DBCS code ranges and SBCS extend char conversion table */
-
-#if _CODE_PAGE == 932 /* Japanese Shift-JIS */
-#define _DF1S 0x81 /* DBC 1st byte range 1 start */
-#define _DF1E 0x9F /* DBC 1st byte range 1 end */
-#define _DF2S 0xE0 /* DBC 1st byte range 2 start */
-#define _DF2E 0xFC /* DBC 1st byte range 2 end */
-#define _DS1S 0x40 /* DBC 2nd byte range 1 start */
-#define _DS1E 0x7E /* DBC 2nd byte range 1 end */
-#define _DS2S 0x80 /* DBC 2nd byte range 2 start */
-#define _DS2E 0xFC /* DBC 2nd byte range 2 end */
-
-#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
-#define _DF1S 0x81
-#define _DF1E 0xFE
-#define _DS1S 0x40
-#define _DS1E 0x7E
-#define _DS2S 0x80
-#define _DS2E 0xFE
-
-#elif _CODE_PAGE == 949 /* Korean */
-#define _DF1S 0x81
-#define _DF1E 0xFE
-#define _DS1S 0x41
-#define _DS1E 0x5A
-#define _DS2S 0x61
-#define _DS2E 0x7A
-#define _DS3S 0x81
-#define _DS3E 0xFE
-
-#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
-#define _DF1S 0x81
-#define _DF1E 0xFE
-#define _DS1S 0x40
-#define _DS1E 0x7E
-#define _DS2S 0xA1
-#define _DS2E 0xFE
-
-#elif _CODE_PAGE == 437 /* U.S. (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 720 /* Arabic (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 737 /* Greek (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
- 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 775 /* Baltic (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
- 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 852 /* Latin 2 (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \
- 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
-
-#elif _CODE_PAGE == 855 /* Cyrillic (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \
- 0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \
- 0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 857 /* Turkish (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \
- 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
- 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 862 /* Hebrew (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 866 /* Russian (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
-
-#elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
- 0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
-
-#elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
-
-#elif _CODE_PAGE == 1253 /* Greek (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \
- 0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}
-
-#elif _CODE_PAGE == 1254 /* Turkish (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
-
-#elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 1256 /* Arabic (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 1257 /* Baltic (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
-
-#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}
-
-#elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */
-#define _DF1S 0
-
-#else
-#error Unknown code page
-
-#endif
-
-
-
-/* Character code support macros */
-
-#define IsUpper(c) (((c)>='A')&&((c)<='Z'))
-#define IsLower(c) (((c)>='a')&&((c)<='z'))
-
-#if _DF1S /* DBCS configuration */
-
-#ifdef _DF2S /* Two 1st byte areas */
-#define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
-#else /* One 1st byte area */
-#define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
-#endif
-
-#ifdef _DS3S /* Three 2nd byte areas */
-#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
-#else /* Two 2nd byte areas */
-#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
-#endif
-
-#else /* SBCS configuration */
-
-#define IsDBCS1(c) 0
-#define IsDBCS2(c) 0
-
-#endif /* _DF1S */
-
-
-
-/* Definitions corresponds to multi partition */
-
-#if _MULTI_PARTITION /* Multiple partition configuration */
-
-typedef struct _PARTITION {
- BYTE pd; /* Physical drive# */
- BYTE pt; /* Partition # (0-3) */
-} PARTITION;
-
-extern
-const PARTITION Drives[]; /* Logical drive# to physical location conversion table */
-#define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
-#define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
-
-#else /* Single partition configuration */
-
-#define LD2PD(drv) (drv) /* Physical drive# is equal to the logical drive# */
-#define LD2PT(drv) 0 /* Always mounts the 1st partition */
-
-#endif
-
-
-
-/* Definitions corresponds to multiple sector size */
-
-#if _MAX_SS == 512 /* Single sector size */
-#define SS(fs) 512U
-
-#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */
-#define SS(fs) ((fs)->s_size)
-
-#else
-#error Sector size must be 512, 1024, 2048 or 4096.
-
-#endif
-
-
-
-/* Type of file name on FatFs API */
-
-#if _LFN_UNICODE && _USE_LFN
-typedef WCHAR XCHAR; /* Unicode */
-#else
-typedef char XCHAR; /* SBCS, DBCS */
-#endif
-
-
-
-/* File system object structure */
-
-typedef struct _FATFS_ {
- BYTE fs_type; /* FAT sub type */
- BYTE drive; /* Physical drive number */
- BYTE csize; /* Number of sectors per cluster */
- BYTE n_fats; /* Number of FAT copies */
- BYTE wflag; /* win[] dirty flag (1:must be written back) */
- BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
- WORD id; /* File system mount ID */
- WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
-#if _FS_REENTRANT
- _SYNC_t sobj; /* Identifier of sync object */
-#endif
-#if _MAX_SS != 512
- WORD s_size; /* Sector size */
-#endif
-#if !_FS_READONLY
- DWORD last_clust; /* Last allocated cluster */
- DWORD free_clust; /* Number of free clusters */
- DWORD fsi_sector; /* fsinfo sector */
-#endif
-#if _FS_RPATH
- DWORD cdir; /* Current directory (0:root)*/
-#endif
- DWORD sects_fat; /* Sectors per fat */
- DWORD max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
- DWORD fatbase; /* FAT start sector */
- DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
- DWORD database; /* Data start sector */
- DWORD winsect; /* Current sector appearing in the win[] */
- BYTE win[_MAX_SS];/* Disk access window for Directory/FAT */
-} FATFS;
-
-
-
-/* Directory object structure */
-
-typedef struct _DIR_ {
- FATFS* fs; /* Pointer to the owner file system object */
- WORD id; /* Owner file system mount ID */
- WORD index; /* Current read/write index number */
- DWORD sclust; /* Table start cluster (0:Static table) */
- DWORD clust; /* Current cluster */
- DWORD sect; /* Current sector */
- BYTE* dir; /* Pointer to the current SFN entry in the win[] */
- BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
-#if _USE_LFN
- WCHAR* lfn; /* Pointer to the LFN working buffer */
- WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
-#endif
-} DIR;
-
-
-
-/* File object structure */
-
-typedef struct _FIL_ {
- FATFS* fs; /* Pointer to the owner file system object */
- WORD id; /* Owner file system mount ID */
- BYTE flag; /* File status flags */
- BYTE csect; /* Sector address in the cluster */
- DWORD fptr; /* File R/W pointer */
- DWORD fsize; /* File size */
- DWORD org_clust; /* File start cluster */
- DWORD curr_clust; /* Current cluster */
- DWORD dsect; /* Current data sector */
-#if !_FS_READONLY
- DWORD dir_sect; /* Sector containing the directory entry */
- BYTE* dir_ptr; /* Ponter to the directory entry in the window */
-#endif
-#if !_FS_TINY
- BYTE buf[_MAX_SS];/* File R/W buffer */
-#endif
-} FIL;
-
-
-
-/* File status structure */
-
-typedef struct _FILINFO_ {
- DWORD fsize; /* File size */
- WORD fdate; /* Last modified date */
- WORD ftime; /* Last modified time */
- BYTE fattrib; /* Attribute */
- char fname[13]; /* Short file name (8.3 format) */
-#if _USE_LFN
- XCHAR* lfname; /* Pointer to the LFN buffer */
- int lfsize; /* Size of LFN buffer [chrs] */
-#endif
-} FILINFO;
-
-
-
-/* File function return code (FRESULT) */
-
-typedef enum {
- FR_OK = 0, /* 0 */
- FR_DISK_ERR, /* 1 */
- FR_INT_ERR, /* 2 */
- FR_NOT_READY, /* 3 */
- FR_NO_FILE, /* 4 */
- FR_NO_PATH, /* 5 */
- FR_INVALID_NAME, /* 6 */
- FR_DENIED, /* 7 */
- FR_EXIST, /* 8 */
- FR_INVALID_OBJECT, /* 9 */
- FR_WRITE_PROTECTED, /* 10 */
- FR_INVALID_DRIVE, /* 11 */
- FR_NOT_ENABLED, /* 12 */
- FR_NO_FILESYSTEM, /* 13 */
- FR_MKFS_ABORTED, /* 14 */
- FR_TIMEOUT /* 15 */
-} FRESULT;
-
-
-
-/*--------------------------------------------------------------*/
-/* FatFs module application interface */
-
-FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
-FRESULT f_open (FIL*, const XCHAR*, BYTE); /* Open or create a file */
-FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
-FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
-FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
-FRESULT f_close (FIL*); /* Close an open file object */
-FRESULT f_opendir (DIR*, const XCHAR*); /* Open an existing directory */
-FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
-FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */
-FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
-FRESULT f_truncate (FIL*); /* Truncate file */
-FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
-FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */
-FRESULT f_mkdir (const XCHAR*); /* Create a new directory */
-FRESULT f_chmod (const XCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
-FRESULT f_utime (const XCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
-FRESULT f_rename (const XCHAR*, const XCHAR*); /* Rename/Move a file or directory */
-FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
-FRESULT f_mkfs (BYTE, BYTE, WORD); /* Create a file system on the drive */
-FRESULT f_chdir (const XCHAR*); /* Change current directory */
-FRESULT f_chdrive (BYTE); /* Change current drive */
-
-#if _USE_STRFUNC
-int f_putc (int, FIL*); /* Put a character to the file */
-int f_puts (const char*, FIL*); /* Put a string to the file */
-int f_printf (FIL*, const char*, ...); /* Put a formatted string to the file */
-char* f_gets (char*, int, FIL*); /* Get a string from the file */
-#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
-#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
-#ifndef EOF
-#define EOF -1
-#endif
-#endif
-
-
-
-/*--------------------------------------------------------------*/
-/* User defined functions */
-
-/* Real time clock */
-#if !_FS_READONLY
-DWORD get_fattime (void); /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
- /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
-#endif
-
-/* Unicode - OEM code conversion */
-#if _USE_LFN
-WCHAR ff_convert (WCHAR, UINT);
-WCHAR ff_wtoupper (WCHAR);
-#endif
-
-/* Sync functions */
-#if _FS_REENTRANT
-BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
-BOOL ff_del_syncobj(_SYNC_t);
-BOOL ff_req_grant(_SYNC_t);
-void ff_rel_grant(_SYNC_t);
-#endif
-
-
-
-/*--------------------------------------------------------------*/
-/* Flags and offset address */
-
-
-/* File access control and file status flags (FIL.flag) */
-
-#define FA_READ 0x01
-#define FA_OPEN_EXISTING 0x00
-#if _FS_READONLY == 0
-#define FA_WRITE 0x02
-#define FA_CREATE_NEW 0x04
-#define FA_CREATE_ALWAYS 0x08
-#define FA_OPEN_ALWAYS 0x10
-#define FA__WRITTEN 0x20
-#define FA__DIRTY 0x40
-#endif
-#define FA__ERROR 0x80
-
-
-/* FAT sub type (FATFS.fs_type) */
-
-#define FS_FAT12 1
-#define FS_FAT16 2
-#define FS_FAT32 3
-
-
-/* File attribute bits for directory entry */
-
-#define AM_RDO 0x01 /* Read only */
-#define AM_HID 0x02 /* Hidden */
-#define AM_SYS 0x04 /* System */
-#define AM_VOL 0x08 /* Volume label */
-#define AM_LFN 0x0F /* LFN entry */
-#define AM_DIR 0x10 /* Directory */
-#define AM_ARC 0x20 /* Archive */
-#define AM_MASK 0x3F /* Mask of defined bits */
-
-
-/* FatFs refers the members in the FAT structures with byte offset instead
-/ of structure member because there are incompatibility of the packing option
-/ between various compilers. */
-
-#define BS_jmpBoot 0
-#define BS_OEMName 3
-#define BPB_BytsPerSec 11
-#define BPB_SecPerClus 13
-#define BPB_RsvdSecCnt 14
-#define BPB_NumFATs 16
-#define BPB_RootEntCnt 17
-#define BPB_TotSec16 19
-#define BPB_Media 21
-#define BPB_FATSz16 22
-#define BPB_SecPerTrk 24
-#define BPB_NumHeads 26
-#define BPB_HiddSec 28
-#define BPB_TotSec32 32
-#define BS_55AA 510
-
-#define BS_DrvNum 36
-#define BS_BootSig 38
-#define BS_VolID 39
-#define BS_VolLab 43
-#define BS_FilSysType 54
-
-#define BPB_FATSz32 36
-#define BPB_ExtFlags 40
-#define BPB_FSVer 42
-#define BPB_RootClus 44
-#define BPB_FSInfo 48
-#define BPB_BkBootSec 50
-#define BS_DrvNum32 64
-#define BS_BootSig32 66
-#define BS_VolID32 67
-#define BS_VolLab32 71
-#define BS_FilSysType32 82
-
-#define FSI_LeadSig 0
-#define FSI_StrucSig 484
-#define FSI_Free_Count 488
-#define FSI_Nxt_Free 492
-
-#define MBR_Table 446
-
-#define DIR_Name 0
-#define DIR_Attr 11
-#define DIR_NTres 12
-#define DIR_CrtTime 14
-#define DIR_CrtDate 16
-#define DIR_FstClusHI 20
-#define DIR_WrtTime 22
-#define DIR_WrtDate 24
-#define DIR_FstClusLO 26
-#define DIR_FileSize 28
-#define LDIR_Ord 0
-#define LDIR_Attr 11
-#define LDIR_Type 12
-#define LDIR_Chksum 13
-#define LDIR_FstClusLO 26
-
-
-
-/*--------------------------------*/
-/* Multi-byte word access macros */
-
-#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
-#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
-#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
-#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
-#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
-#else /* Use byte-by-byte access to the FAT structure */
-#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
-#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
-#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
-#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
-#endif
-
-
-#endif /* _FATFS */
+/*---------------------------------------------------------------------------/
+/ FatFs - FAT file system module include file R0.07e (C)ChaN, 2010
+/----------------------------------------------------------------------------/
+/ FatFs module is a generic FAT file system module for small embedded systems.
+/ This is a free software that opened for education, research and commercial
+/ developments under license policy of following trems.
+/
+/ Copyright (C) 2010, ChaN, all right reserved.
+/
+/ * The FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/----------------------------------------------------------------------------*/
+
+#ifndef _FATFS
+#define _FATFS 0x007E
+
+#include "integer.h" /* Basic integer types */
+#include "ffconf.h" /* FatFs configuration options */
+
+#if _FATFS != _FFCONFIG
+#error Wrong configuration file (ffconf.h).
+#endif
+
+
+/* DBCS code ranges and SBCS extend char conversion table */
+
+#if _CODE_PAGE == 932 /* Japanese Shift-JIS */
+#define _DF1S 0x81 /* DBC 1st byte range 1 start */
+#define _DF1E 0x9F /* DBC 1st byte range 1 end */
+#define _DF2S 0xE0 /* DBC 1st byte range 2 start */
+#define _DF2E 0xFC /* DBC 1st byte range 2 end */
+#define _DS1S 0x40 /* DBC 2nd byte range 1 start */
+#define _DS1E 0x7E /* DBC 2nd byte range 1 end */
+#define _DS2S 0x80 /* DBC 2nd byte range 2 start */
+#define _DS2E 0xFC /* DBC 2nd byte range 2 end */
+
+#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
+#define _DF1S 0x81
+#define _DF1E 0xFE
+#define _DS1S 0x40
+#define _DS1E 0x7E
+#define _DS2S 0x80
+#define _DS2E 0xFE
+
+#elif _CODE_PAGE == 949 /* Korean */
+#define _DF1S 0x81
+#define _DF1E 0xFE
+#define _DS1S 0x41
+#define _DS1E 0x5A
+#define _DS2S 0x61
+#define _DS2E 0x7A
+#define _DS3S 0x81
+#define _DS3E 0xFE
+
+#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
+#define _DF1S 0x81
+#define _DF1E 0xFE
+#define _DS1S 0x40
+#define _DS1E 0x7E
+#define _DS2S 0xA1
+#define _DS2E 0xFE
+
+#elif _CODE_PAGE == 437 /* U.S. (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 720 /* Arabic (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 737 /* Greek (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
+ 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 775 /* Baltic (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
+ 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 852 /* Latin 2 (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \
+ 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
+
+#elif _CODE_PAGE == 855 /* Cyrillic (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \
+ 0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \
+ 0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 857 /* Turkish (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \
+ 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
+ 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 862 /* Hebrew (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 866 /* Russian (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
+
+#elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
+ 0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
+
+#elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
+
+#elif _CODE_PAGE == 1253 /* Greek (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \
+ 0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}
+
+#elif _CODE_PAGE == 1254 /* Turkish (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
+
+#elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 1256 /* Arabic (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 1257 /* Baltic (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
+
+#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}
+
+#elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */
+#define _DF1S 0
+
+#else
+#error Unknown code page
+
+#endif
+
+
+
+/* Character code support macros */
+
+#define IsUpper(c) (((c)>='A')&&((c)<='Z'))
+#define IsLower(c) (((c)>='a')&&((c)<='z'))
+
+#if _DF1S /* DBCS configuration */
+
+#ifdef _DF2S /* Two 1st byte areas */
+#define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
+#else /* One 1st byte area */
+#define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
+#endif
+
+#ifdef _DS3S /* Three 2nd byte areas */
+#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
+#else /* Two 2nd byte areas */
+#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
+#endif
+
+#else /* SBCS configuration */
+
+#define IsDBCS1(c) 0
+#define IsDBCS2(c) 0
+
+#endif /* _DF1S */
+
+
+
+/* Definitions corresponds to multi partition */
+
+#if _MULTI_PARTITION /* Multiple partition configuration */
+
+typedef struct _PARTITION {
+ BYTE pd; /* Physical drive# */
+ BYTE pt; /* Partition # (0-3) */
+} PARTITION;
+
+extern
+const PARTITION Drives[]; /* Logical drive# to physical location conversion table */
+#define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
+#define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
+
+#else /* Single partition configuration */
+
+#define LD2PD(drv) (drv) /* Physical drive# is equal to the logical drive# */
+#define LD2PT(drv) 0 /* Always mounts the 1st partition */
+
+#endif
+
+
+
+/* Definitions corresponds to multiple sector size */
+
+#if _MAX_SS == 512 /* Single sector size */
+#define SS(fs) 512U
+
+#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */
+#define SS(fs) ((fs)->s_size)
+
+#else
+#error Sector size must be 512, 1024, 2048 or 4096.
+
+#endif
+
+
+
+/* Type of file name on FatFs API */
+
+#if _LFN_UNICODE && _USE_LFN
+typedef WCHAR XCHAR; /* Unicode */
+#else
+typedef char XCHAR; /* SBCS, DBCS */
+#endif
+
+
+
+/* File system object structure */
+
+typedef struct _FATFS_ {
+ BYTE fs_type; /* FAT sub type */
+ BYTE drive; /* Physical drive number */
+ BYTE csize; /* Number of sectors per cluster */
+ BYTE n_fats; /* Number of FAT copies */
+ BYTE wflag; /* win[] dirty flag (1:must be written back) */
+ BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
+ WORD id; /* File system mount ID */
+ WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
+#if _FS_REENTRANT
+ _SYNC_t sobj; /* Identifier of sync object */
+#endif
+#if _MAX_SS != 512
+ WORD s_size; /* Sector size */
+#endif
+#if !_FS_READONLY
+ DWORD last_clust; /* Last allocated cluster */
+ DWORD free_clust; /* Number of free clusters */
+ DWORD fsi_sector; /* fsinfo sector */
+#endif
+#if _FS_RPATH
+ DWORD cdir; /* Current directory (0:root)*/
+#endif
+ DWORD sects_fat; /* Sectors per fat */
+ DWORD max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
+ DWORD fatbase; /* FAT start sector */
+ DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
+ DWORD database; /* Data start sector */
+ DWORD winsect; /* Current sector appearing in the win[] */
+ BYTE win[_MAX_SS];/* Disk access window for Directory/FAT */
+} FATFS;
+
+
+
+/* Directory object structure */
+
+typedef struct _DIR_ {
+ FATFS* fs; /* Pointer to the owner file system object */
+ WORD id; /* Owner file system mount ID */
+ WORD index; /* Current read/write index number */
+ DWORD sclust; /* Table start cluster (0:Static table) */
+ DWORD clust; /* Current cluster */
+ DWORD sect; /* Current sector */
+ BYTE* dir; /* Pointer to the current SFN entry in the win[] */
+ BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
+#if _USE_LFN
+ WCHAR* lfn; /* Pointer to the LFN working buffer */
+ WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
+#endif
+} DIR;
+
+
+
+/* File object structure */
+
+typedef struct _FIL_ {
+ FATFS* fs; /* Pointer to the owner file system object */
+ WORD id; /* Owner file system mount ID */
+ BYTE flag; /* File status flags */
+ BYTE csect; /* Sector address in the cluster */
+ DWORD fptr; /* File R/W pointer */
+ DWORD fsize; /* File size */
+ DWORD org_clust; /* File start cluster */
+ DWORD curr_clust; /* Current cluster */
+ DWORD dsect; /* Current data sector */
+#if !_FS_READONLY
+ DWORD dir_sect; /* Sector containing the directory entry */
+ BYTE* dir_ptr; /* Ponter to the directory entry in the window */
+#endif
+#if !_FS_TINY
+ BYTE buf[_MAX_SS];/* File R/W buffer */
+#endif
+} FIL;
+
+
+
+/* File status structure */
+
+typedef struct _FILINFO_ {
+ DWORD fsize; /* File size */
+ WORD fdate; /* Last modified date */
+ WORD ftime; /* Last modified time */
+ BYTE fattrib; /* Attribute */
+ char fname[13]; /* Short file name (8.3 format) */
+#if _USE_LFN
+ XCHAR* lfname; /* Pointer to the LFN buffer */
+ int lfsize; /* Size of LFN buffer [chrs] */
+#endif
+} FILINFO;
+
+
+
+/* File function return code (FRESULT) */
+
+typedef enum {
+ FR_OK = 0, /* 0 */
+ FR_DISK_ERR, /* 1 */
+ FR_INT_ERR, /* 2 */
+ FR_NOT_READY, /* 3 */
+ FR_NO_FILE, /* 4 */
+ FR_NO_PATH, /* 5 */
+ FR_INVALID_NAME, /* 6 */
+ FR_DENIED, /* 7 */
+ FR_EXIST, /* 8 */
+ FR_INVALID_OBJECT, /* 9 */
+ FR_WRITE_PROTECTED, /* 10 */
+ FR_INVALID_DRIVE, /* 11 */
+ FR_NOT_ENABLED, /* 12 */
+ FR_NO_FILESYSTEM, /* 13 */
+ FR_MKFS_ABORTED, /* 14 */
+ FR_TIMEOUT /* 15 */
+} FRESULT;
+
+
+
+/*--------------------------------------------------------------*/
+/* FatFs module application interface */
+
+FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
+FRESULT f_open (FIL*, const XCHAR*, BYTE); /* Open or create a file */
+FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
+FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
+FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
+FRESULT f_close (FIL*); /* Close an open file object */
+FRESULT f_opendir (DIR*, const XCHAR*); /* Open an existing directory */
+FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
+FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */
+FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
+FRESULT f_truncate (FIL*); /* Truncate file */
+FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
+FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */
+FRESULT f_mkdir (const XCHAR*); /* Create a new directory */
+FRESULT f_chmod (const XCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
+FRESULT f_utime (const XCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
+FRESULT f_rename (const XCHAR*, const XCHAR*); /* Rename/Move a file or directory */
+FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
+FRESULT f_mkfs (BYTE, BYTE, WORD); /* Create a file system on the drive */
+FRESULT f_chdir (const XCHAR*); /* Change current directory */
+FRESULT f_chdrive (BYTE); /* Change current drive */
+
+#if _USE_STRFUNC
+int f_putc (int, FIL*); /* Put a character to the file */
+int f_puts (const char*, FIL*); /* Put a string to the file */
+int f_printf (FIL*, const char*, ...); /* Put a formatted string to the file */
+char* f_gets (char*, int, FIL*); /* Get a string from the file */
+#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
+#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
+#ifndef EOF
+#define EOF -1
+#endif
+#endif
+
+
+
+/*--------------------------------------------------------------*/
+/* User defined functions */
+
+/* Real time clock */
+#if !_FS_READONLY
+DWORD get_fattime (void); /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
+ /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
+#endif
+
+/* Unicode - OEM code conversion */
+#if _USE_LFN
+WCHAR ff_convert (WCHAR, UINT);
+WCHAR ff_wtoupper (WCHAR);
+#endif
+
+/* Sync functions */
+#if _FS_REENTRANT
+BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
+BOOL ff_del_syncobj(_SYNC_t);
+BOOL ff_req_grant(_SYNC_t);
+void ff_rel_grant(_SYNC_t);
+#endif
+
+
+
+/*--------------------------------------------------------------*/
+/* Flags and offset address */
+
+
+/* File access control and file status flags (FIL.flag) */
+
+#define FA_READ 0x01
+#define FA_OPEN_EXISTING 0x00
+#if _FS_READONLY == 0
+#define FA_WRITE 0x02
+#define FA_CREATE_NEW 0x04
+#define FA_CREATE_ALWAYS 0x08
+#define FA_OPEN_ALWAYS 0x10
+#define FA__WRITTEN 0x20
+#define FA__DIRTY 0x40
+#endif
+#define FA__ERROR 0x80
+
+
+/* FAT sub type (FATFS.fs_type) */
+
+#define FS_FAT12 1
+#define FS_FAT16 2
+#define FS_FAT32 3
+
+
+/* File attribute bits for directory entry */
+
+#define AM_RDO 0x01 /* Read only */
+#define AM_HID 0x02 /* Hidden */
+#define AM_SYS 0x04 /* System */
+#define AM_VOL 0x08 /* Volume label */
+#define AM_LFN 0x0F /* LFN entry */
+#define AM_DIR 0x10 /* Directory */
+#define AM_ARC 0x20 /* Archive */
+#define AM_MASK 0x3F /* Mask of defined bits */
+
+
+/* FatFs refers the members in the FAT structures with byte offset instead
+/ of structure member because there are incompatibility of the packing option
+/ between various compilers. */
+
+#define BS_jmpBoot 0
+#define BS_OEMName 3
+#define BPB_BytsPerSec 11
+#define BPB_SecPerClus 13
+#define BPB_RsvdSecCnt 14
+#define BPB_NumFATs 16
+#define BPB_RootEntCnt 17
+#define BPB_TotSec16 19
+#define BPB_Media 21
+#define BPB_FATSz16 22
+#define BPB_SecPerTrk 24
+#define BPB_NumHeads 26
+#define BPB_HiddSec 28
+#define BPB_TotSec32 32
+#define BS_55AA 510
+
+#define BS_DrvNum 36
+#define BS_BootSig 38
+#define BS_VolID 39
+#define BS_VolLab 43
+#define BS_FilSysType 54
+
+#define BPB_FATSz32 36
+#define BPB_ExtFlags 40
+#define BPB_FSVer 42
+#define BPB_RootClus 44
+#define BPB_FSInfo 48
+#define BPB_BkBootSec 50
+#define BS_DrvNum32 64
+#define BS_BootSig32 66
+#define BS_VolID32 67
+#define BS_VolLab32 71
+#define BS_FilSysType32 82
+
+#define FSI_LeadSig 0
+#define FSI_StrucSig 484
+#define FSI_Free_Count 488
+#define FSI_Nxt_Free 492
+
+#define MBR_Table 446
+
+#define DIR_Name 0
+#define DIR_Attr 11
+#define DIR_NTres 12
+#define DIR_CrtTime 14
+#define DIR_CrtDate 16
+#define DIR_FstClusHI 20
+#define DIR_WrtTime 22
+#define DIR_WrtDate 24
+#define DIR_FstClusLO 26
+#define DIR_FileSize 28
+#define LDIR_Ord 0
+#define LDIR_Attr 11
+#define LDIR_Type 12
+#define LDIR_Chksum 13
+#define LDIR_FstClusLO 26
+
+
+
+/*--------------------------------*/
+/* Multi-byte word access macros */
+
+#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
+#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
+#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
+#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
+#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
+#else /* Use byte-by-byte access to the FAT structure */
+#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
+#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
+#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
+#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
+#endif
+
+
+#endif /* _FATFS */
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h b/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h
index 9b414e979..872e710c4 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h
@@ -1,166 +1,166 @@
-/*---------------------------------------------------------------------------/
-/ FatFs - FAT file system module configuration file R0.07e (C)ChaN, 2010
-/----------------------------------------------------------------------------/
-/
-/ CAUTION! Do not forget to make clean the project after any changes to
-/ the configuration options.
-/
-/----------------------------------------------------------------------------*/
-#ifndef _FFCONFIG
-#define _FFCONFIG 0x007E
-
-
-/*---------------------------------------------------------------------------/
-/ Function and Buffer Configurations
-/----------------------------------------------------------------------------*/
-
-#define _FS_TINY 1 /* 0 or 1 */
-/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
-/ object instead of the sector buffer in the individual file object for file
-/ data transfer. This reduces memory consumption 512 bytes each file object. */
-
-
-#define _FS_READONLY 0 /* 0 or 1 */
-/* Setting _FS_READONLY to 1 defines read only configuration. This removes
-/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
-/ f_truncate and useless f_getfree. */
-
-
-#define _FS_MINIMIZE 2 /* 0, 1, 2 or 3 */
-/* The _FS_MINIMIZE option defines minimization level to remove some functions.
-/
-/ 0: Full function.
-/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
-/ are removed.
-/ 2: f_opendir and f_readdir are removed in addition to level 1.
-/ 3: f_lseek is removed in addition to level 2. */
-
-
-#define _USE_STRFUNC 0 /* 0, 1 or 2 */
-/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
-
-
-#define _USE_MKFS 0 /* 0 or 1 */
-/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
-
-
-#define _USE_FORWARD 0 /* 0 or 1 */
-/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
-
-
-
-/*---------------------------------------------------------------------------/
-/ Locale and Namespace Configurations
-/----------------------------------------------------------------------------*/
-
-#define _CODE_PAGE 932
-/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
-/ Incorrect setting of the code page can cause a file open failure.
-/
-/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
-/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
-/ 949 - Korean (DBCS, OEM, Windows)
-/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
-/ 1250 - Central Europe (Windows)
-/ 1251 - Cyrillic (Windows)
-/ 1252 - Latin 1 (Windows)
-/ 1253 - Greek (Windows)
-/ 1254 - Turkish (Windows)
-/ 1255 - Hebrew (Windows)
-/ 1256 - Arabic (Windows)
-/ 1257 - Baltic (Windows)
-/ 1258 - Vietnam (OEM, Windows)
-/ 437 - U.S. (OEM)
-/ 720 - Arabic (OEM)
-/ 737 - Greek (OEM)
-/ 775 - Baltic (OEM)
-/ 850 - Multilingual Latin 1 (OEM)
-/ 858 - Multilingual Latin 1 + Euro (OEM)
-/ 852 - Latin 2 (OEM)
-/ 855 - Cyrillic (OEM)
-/ 866 - Russian (OEM)
-/ 857 - Turkish (OEM)
-/ 862 - Hebrew (OEM)
-/ 874 - Thai (OEM, Windows)
-/ 1 - ASCII only (Valid for non LFN cfg.)
-*/
-
-
-#define _USE_LFN 0 /* 0, 1 or 2 */
-#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
-/* The _USE_LFN option switches the LFN support.
-/
-/ 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.
-/ 1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
-/ 2: Enable LFN with dynamic working buffer on the STACK.
-/
-/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
-/ two Unicode handling functions ff_convert() and ff_wtoupper() must be added
-/ to the project. */
-
-
-#define _LFN_UNICODE 0 /* 0 or 1 */
-/* To switch the character code set on FatFs API to Unicode,
-/ enable LFN feature and set _LFN_UNICODE to 1.
-*/
-
-
-#define _FS_RPATH 0 /* 0 or 1 */
-/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,
-/ f_chdrive function are available.
-/ Note that output of the f_readdir fnction is affected by this option. */
-
-
-
-/*---------------------------------------------------------------------------/
-/ Physical Drive Configurations
-/----------------------------------------------------------------------------*/
-
-#define _DRIVES 1
-/* Number of volumes (logical drives) to be used. */
-
-
-#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
-/* Maximum sector size to be handled.
-/ Always set 512 for memory card and hard disk but a larger value may be
-/ required for floppy disk (512/1024) and optical disk (512/2048).
-/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
-/ to the disk_ioctl function. */
-
-
-#define _MULTI_PARTITION 0 /* 0 or 1 */
-/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
-/ drive number and can mount only first primaly partition. When it is set to 1,
-/ each volume is tied to the partitions listed in Drives[]. */
-
-
-
-/*---------------------------------------------------------------------------/
-/ System Configurations
-/----------------------------------------------------------------------------*/
-
-#define _WORD_ACCESS 1 /* 0 or 1 */
-/* The _WORD_ACCESS option defines which access method is used to the word
-/ data on the FAT volume.
-/
-/ 0: Byte-by-byte access. Always compatible with all platforms.
-/ 1: Word access. Do not choose this unless following condition is met.
-/
-/ When the byte order on the memory is big-endian or address miss-aligned
-/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
-/ If it is not the case, the value can also be set to 1 to improve the
-/ performance and code size. */
-
-
-#define _FS_REENTRANT 0 /* 0 or 1 */
-#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
-#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
-/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
-/
-/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
-/ 1: Enable reentrancy. Also user provided synchronization handlers,
-/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
-/ function must be added to the project. */
-
-
-#endif /* _FFCONFIG */
+/*---------------------------------------------------------------------------/
+/ FatFs - FAT file system module configuration file R0.07e (C)ChaN, 2010
+/----------------------------------------------------------------------------/
+/
+/ CAUTION! Do not forget to make clean the project after any changes to
+/ the configuration options.
+/
+/----------------------------------------------------------------------------*/
+#ifndef _FFCONFIG
+#define _FFCONFIG 0x007E
+
+
+/*---------------------------------------------------------------------------/
+/ Function and Buffer Configurations
+/----------------------------------------------------------------------------*/
+
+#define _FS_TINY 1 /* 0 or 1 */
+/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
+/ object instead of the sector buffer in the individual file object for file
+/ data transfer. This reduces memory consumption 512 bytes each file object. */
+
+
+#define _FS_READONLY 0 /* 0 or 1 */
+/* Setting _FS_READONLY to 1 defines read only configuration. This removes
+/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
+/ f_truncate and useless f_getfree. */
+
+
+#define _FS_MINIMIZE 2 /* 0, 1, 2 or 3 */
+/* The _FS_MINIMIZE option defines minimization level to remove some functions.
+/
+/ 0: Full function.
+/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
+/ are removed.
+/ 2: f_opendir and f_readdir are removed in addition to level 1.
+/ 3: f_lseek is removed in addition to level 2. */
+
+
+#define _USE_STRFUNC 0 /* 0, 1 or 2 */
+/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
+
+
+#define _USE_MKFS 0 /* 0 or 1 */
+/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
+
+
+#define _USE_FORWARD 0 /* 0 or 1 */
+/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ Locale and Namespace Configurations
+/----------------------------------------------------------------------------*/
+
+#define _CODE_PAGE 932
+/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
+/ Incorrect setting of the code page can cause a file open failure.
+/
+/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
+/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
+/ 949 - Korean (DBCS, OEM, Windows)
+/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
+/ 1250 - Central Europe (Windows)
+/ 1251 - Cyrillic (Windows)
+/ 1252 - Latin 1 (Windows)
+/ 1253 - Greek (Windows)
+/ 1254 - Turkish (Windows)
+/ 1255 - Hebrew (Windows)
+/ 1256 - Arabic (Windows)
+/ 1257 - Baltic (Windows)
+/ 1258 - Vietnam (OEM, Windows)
+/ 437 - U.S. (OEM)
+/ 720 - Arabic (OEM)
+/ 737 - Greek (OEM)
+/ 775 - Baltic (OEM)
+/ 850 - Multilingual Latin 1 (OEM)
+/ 858 - Multilingual Latin 1 + Euro (OEM)
+/ 852 - Latin 2 (OEM)
+/ 855 - Cyrillic (OEM)
+/ 866 - Russian (OEM)
+/ 857 - Turkish (OEM)
+/ 862 - Hebrew (OEM)
+/ 874 - Thai (OEM, Windows)
+/ 1 - ASCII only (Valid for non LFN cfg.)
+*/
+
+
+#define _USE_LFN 0 /* 0, 1 or 2 */
+#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
+/* The _USE_LFN option switches the LFN support.
+/
+/ 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.
+/ 1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
+/ 2: Enable LFN with dynamic working buffer on the STACK.
+/
+/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
+/ two Unicode handling functions ff_convert() and ff_wtoupper() must be added
+/ to the project. */
+
+
+#define _LFN_UNICODE 0 /* 0 or 1 */
+/* To switch the character code set on FatFs API to Unicode,
+/ enable LFN feature and set _LFN_UNICODE to 1.
+*/
+
+
+#define _FS_RPATH 0 /* 0 or 1 */
+/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,
+/ f_chdrive function are available.
+/ Note that output of the f_readdir fnction is affected by this option. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ Physical Drive Configurations
+/----------------------------------------------------------------------------*/
+
+#define _DRIVES 1
+/* Number of volumes (logical drives) to be used. */
+
+
+#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
+/* Maximum sector size to be handled.
+/ Always set 512 for memory card and hard disk but a larger value may be
+/ required for floppy disk (512/1024) and optical disk (512/2048).
+/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
+/ to the disk_ioctl function. */
+
+
+#define _MULTI_PARTITION 0 /* 0 or 1 */
+/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
+/ drive number and can mount only first primaly partition. When it is set to 1,
+/ each volume is tied to the partitions listed in Drives[]. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ System Configurations
+/----------------------------------------------------------------------------*/
+
+#define _WORD_ACCESS 1 /* 0 or 1 */
+/* The _WORD_ACCESS option defines which access method is used to the word
+/ data on the FAT volume.
+/
+/ 0: Byte-by-byte access. Always compatible with all platforms.
+/ 1: Word access. Do not choose this unless following condition is met.
+/
+/ When the byte order on the memory is big-endian or address miss-aligned
+/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
+/ If it is not the case, the value can also be set to 1 to improve the
+/ performance and code size. */
+
+
+#define _FS_REENTRANT 0 /* 0 or 1 */
+#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
+#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
+/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
+/
+/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
+/ 1: Enable reentrancy. Also user provided synchronization handlers,
+/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
+/ function must be added to the project. */
+
+
+#endif /* _FFCONFIG */
diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/integer.h b/Projects/TemperatureDataLogger/Lib/FATFs/integer.h
index 1d6bac368..851a78da2 100644
--- a/Projects/TemperatureDataLogger/Lib/FATFs/integer.h
+++ b/Projects/TemperatureDataLogger/Lib/FATFs/integer.h
@@ -1,37 +1,37 @@
-/*-------------------------------------------*/
-/* Integer type definitions for FatFs module */
-/*-------------------------------------------*/
-
-#ifndef _INTEGER
-
-#if 0
-#include <windows.h>
-#else
-
-/* These types must be 16-bit, 32-bit or larger integer */
-typedef int INT;
-typedef unsigned int UINT;
-
-/* These types must be 8-bit integer */
-typedef signed char CHAR;
-typedef unsigned char UCHAR;
-typedef unsigned char BYTE;
-
-/* These types must be 16-bit integer */
-typedef short SHORT;
-typedef unsigned short USHORT;
-typedef unsigned short WORD;
-typedef unsigned short WCHAR;
-
-/* These types must be 32-bit integer */
-typedef long LONG;
-typedef unsigned long ULONG;
-typedef unsigned long DWORD;
-
-/* Boolean type */
-typedef enum { FALSE = 0, TRUE } BOOL;
-
-#endif
-
-#define _INTEGER
-#endif
+/*-------------------------------------------*/
+/* Integer type definitions for FatFs module */
+/*-------------------------------------------*/
+
+#ifndef _INTEGER
+
+#if 0
+#include <windows.h>
+#else
+
+/* These types must be 16-bit, 32-bit or larger integer */
+typedef int INT;
+typedef unsigned int UINT;
+
+/* These types must be 8-bit integer */
+typedef signed char CHAR;
+typedef unsigned char UCHAR;
+typedef unsigned char BYTE;
+
+/* These types must be 16-bit integer */
+typedef short SHORT;
+typedef unsigned short USHORT;
+typedef unsigned short WORD;
+typedef unsigned short WCHAR;
+
+/* These types must be 32-bit integer */
+typedef long LONG;
+typedef unsigned long ULONG;
+typedef unsigned long DWORD;
+
+/* Boolean type */
+typedef enum { FALSE = 0, TRUE } BOOL;
+
+#endif
+
+#define _INTEGER
+#endif
diff --git a/Projects/TemperatureDataLogger/Lib/SCSI.c b/Projects/TemperatureDataLogger/Lib/SCSI.c
index 8a376a41b..55312e87b 100644
--- a/Projects/TemperatureDataLogger/Lib/SCSI.c
+++ b/Projects/TemperatureDataLogger/Lib/SCSI.c
@@ -1,281 +1,281 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * SCSI command processing routines, for SCSI commands issued by the host. Mass Storage
- * devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
- * which wrap around standard SCSI device commands for controlling the actual storage medium.
- */
-
-#define INCLUDE_FROM_SCSI_C
-#include "SCSI.h"
-
-/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
- * features and capabilities.
- */
-SCSI_Inquiry_Response_t InquiryData =
- {
- .DeviceType = DEVICE_TYPE_BLOCK,
- .PeripheralQualifier = 0,
-
- .Removable = true,
-
- .Version = 0,
-
- .ResponseDataFormat = 2,
- .NormACA = false,
- .TrmTsk = false,
- .AERC = false,
-
- .AdditionalLength = 0x1F,
-
- .SoftReset = false,
- .CmdQue = false,
- .Linked = false,
- .Sync = false,
- .WideBus16Bit = false,
- .WideBus32Bit = false,
- .RelAddr = false,
-
- .VendorID = "LUFA",
- .ProductID = "Dataflash Disk",
- .RevisionID = {'0','.','0','0'},
- };
-
-/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE
- * command is issued. This gives information on exactly why the last command failed to complete.
- */
-SCSI_Request_Sense_Response_t SenseData =
- {
- .ResponseCode = 0x70,
- .AdditionalLength = 0x0A,
- };
-
-
-/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches
- * to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns
- * a command failure due to a ILLEGAL REQUEST.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- /* Set initial sense data, before the requested command is processed */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
- SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- /* Run the appropriate SCSI command hander function based on the passed command */
- switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
- {
- case SCSI_CMD_INQUIRY:
- SCSI_Command_Inquiry(MSInterfaceInfo);
- break;
- case SCSI_CMD_REQUEST_SENSE:
- SCSI_Command_Request_Sense(MSInterfaceInfo);
- break;
- case SCSI_CMD_READ_CAPACITY_10:
- SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
- break;
- case SCSI_CMD_SEND_DIAGNOSTIC:
- SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
- break;
- case SCSI_CMD_WRITE_10:
- SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
- break;
- case SCSI_CMD_READ_10:
- SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
- break;
- case SCSI_CMD_TEST_UNIT_READY:
- case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
- case SCSI_CMD_VERIFY_10:
- /* These commands should just succeed, no handling required */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
- break;
- default:
- /* Update the SENSE key to reflect the invalid command */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_COMMAND,
- SCSI_ASENSEQ_NO_QUALIFIER);
- break;
- }
-
- return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);
-}
-
-/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
- * and capabilities to the host.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint16_t AllocationLength = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
- MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
- uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
- sizeof(InquiryData);
-
- /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
- if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
- MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
- {
- /* Optional but unsupported bits set - update the SENSE key and fail the request */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_FIELD_IN_CDB,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
-
- uint8_t PadBytes[AllocationLength - BytesTransferred];
-
- /* Pad out remaining bytes with 0x00 */
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
-
- /* Finalize the stream transfer to send the last packet */
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-}
-
-/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
- * including the error code and additional error information so that the host can determine why a command failed to complete.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
- uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
- uint8_t PadBytes[AllocationLength - BytesTransferred];
-
- Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-}
-
-/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity
- * on the selected Logical Unit (drive), as a number of OS-sized blocks.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
- uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
-
- Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
- Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-}
-
-/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
- * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
- * supported.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- /* Check to see if the SELF TEST bit is not set */
- if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
- {
- /* Only self-test supported - update SENSE key and fail the command */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_FIELD_IN_CDB,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Check to see if all attached Dataflash ICs are functional */
- if (!(DataflashManager_CheckDataflashOperation()))
- {
- /* Update SENSE key with a hardware error condition and return command fail */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
- SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-}
-
-/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
- * and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual
- * reading and writing of the data.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- * \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
- */
-static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
-{
- uint32_t BlockAddress;
- uint16_t TotalBlocks;
-
- /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
- BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
-
- /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
- TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
- /* Check if the block address is outside the maximum allowable value for the LUN */
- if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
- {
- /* Block address is invalid, update SENSE key and return command fail */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
- if (IsDataRead == DATA_READ)
- DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
- else
- DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
-
- /* Update the bytes transferred counter and succeed the command */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * SCSI command processing routines, for SCSI commands issued by the host. Mass Storage
+ * devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
+ * which wrap around standard SCSI device commands for controlling the actual storage medium.
+ */
+
+#define INCLUDE_FROM_SCSI_C
+#include "SCSI.h"
+
+/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
+ * features and capabilities.
+ */
+SCSI_Inquiry_Response_t InquiryData =
+ {
+ .DeviceType = DEVICE_TYPE_BLOCK,
+ .PeripheralQualifier = 0,
+
+ .Removable = true,
+
+ .Version = 0,
+
+ .ResponseDataFormat = 2,
+ .NormACA = false,
+ .TrmTsk = false,
+ .AERC = false,
+
+ .AdditionalLength = 0x1F,
+
+ .SoftReset = false,
+ .CmdQue = false,
+ .Linked = false,
+ .Sync = false,
+ .WideBus16Bit = false,
+ .WideBus32Bit = false,
+ .RelAddr = false,
+
+ .VendorID = "LUFA",
+ .ProductID = "Dataflash Disk",
+ .RevisionID = {'0','.','0','0'},
+ };
+
+/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE
+ * command is issued. This gives information on exactly why the last command failed to complete.
+ */
+SCSI_Request_Sense_Response_t SenseData =
+ {
+ .ResponseCode = 0x70,
+ .AdditionalLength = 0x0A,
+ };
+
+
+/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches
+ * to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns
+ * a command failure due to a ILLEGAL REQUEST.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ /* Set initial sense data, before the requested command is processed */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
+ SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ /* Run the appropriate SCSI command hander function based on the passed command */
+ switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
+ {
+ case SCSI_CMD_INQUIRY:
+ SCSI_Command_Inquiry(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_REQUEST_SENSE:
+ SCSI_Command_Request_Sense(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_READ_CAPACITY_10:
+ SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_SEND_DIAGNOSTIC:
+ SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_WRITE_10:
+ SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
+ break;
+ case SCSI_CMD_READ_10:
+ SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
+ break;
+ case SCSI_CMD_TEST_UNIT_READY:
+ case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
+ case SCSI_CMD_VERIFY_10:
+ /* These commands should just succeed, no handling required */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
+ break;
+ default:
+ /* Update the SENSE key to reflect the invalid command */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_COMMAND,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+ break;
+ }
+
+ return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);
+}
+
+/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
+ * and capabilities to the host.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint16_t AllocationLength = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
+ MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
+ uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
+ sizeof(InquiryData);
+
+ /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
+ if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
+ MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
+ {
+ /* Optional but unsupported bits set - update the SENSE key and fail the request */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_FIELD_IN_CDB,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
+
+ uint8_t PadBytes[AllocationLength - BytesTransferred];
+
+ /* Pad out remaining bytes with 0x00 */
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+
+ /* Finalize the stream transfer to send the last packet */
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
+}
+
+/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
+ * including the error code and additional error information so that the host can determine why a command failed to complete.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
+ uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
+
+ uint8_t PadBytes[AllocationLength - BytesTransferred];
+
+ Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
+}
+
+/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity
+ * on the selected Logical Unit (drive), as a number of OS-sized blocks.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
+ uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
+
+ Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
+ Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
+}
+
+/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
+ * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
+ * supported.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ /* Check to see if the SELF TEST bit is not set */
+ if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
+ {
+ /* Only self-test supported - update SENSE key and fail the command */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_FIELD_IN_CDB,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Check to see if all attached Dataflash ICs are functional */
+ if (!(DataflashManager_CheckDataflashOperation()))
+ {
+ /* Update SENSE key with a hardware error condition and return command fail */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
+ SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
+}
+
+/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
+ * and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual
+ * reading and writing of the data.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ * \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
+ */
+static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
+{
+ uint32_t BlockAddress;
+ uint16_t TotalBlocks;
+
+ /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
+ BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
+
+ /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
+ TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
+
+ /* Check if the block address is outside the maximum allowable value for the LUN */
+ if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
+ {
+ /* Block address is invalid, update SENSE key and return command fail */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
+ if (IsDataRead == DATA_READ)
+ DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+ else
+ DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+
+ /* Update the bytes transferred counter and succeed the command */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
+}
diff --git a/Projects/TemperatureDataLogger/Lib/SCSI.h b/Projects/TemperatureDataLogger/Lib/SCSI.h
index 190d625be..914ca7b61 100644
--- a/Projects/TemperatureDataLogger/Lib/SCSI.h
+++ b/Projects/TemperatureDataLogger/Lib/SCSI.h
@@ -1,86 +1,86 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 SCSI.c.
- */
-
-#ifndef _SCSI_H_
-#define _SCSI_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- #include "../TempDataLogger.h"
- #include "../Descriptors.h"
- #include "DataflashManager.h"
-
- /* Macros: */
- /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
- * is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
- * the last command failure) in a quick and easy manner.
- *
- * \param[in] key New SCSI sense key to set the sense code to
- * \param[in] acode New SCSI additional sense key to set the additional sense code to
- * \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
- */
- #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = (key); \
- SenseData.AdditionalSenseCode = (acode); \
- SenseData.AdditionalSenseQualifier = (aqual); }MACROE
-
- /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
- #define DATA_READ true
-
- /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */
- #define DATA_WRITE false
-
- /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
- #define DEVICE_TYPE_BLOCK 0x00
-
- /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
- #define DEVICE_TYPE_CDROM 0x05
-
- /* Function Prototypes: */
- bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
- #if defined(INCLUDE_FROM_SCSI_C)
- static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 SCSI.c.
+ */
+
+#ifndef _SCSI_H_
+#define _SCSI_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ #include "../TempDataLogger.h"
+ #include "../Descriptors.h"
+ #include "DataflashManager.h"
+
+ /* Macros: */
+ /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
+ * is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
+ * the last command failure) in a quick and easy manner.
+ *
+ * \param[in] key New SCSI sense key to set the sense code to
+ * \param[in] acode New SCSI additional sense key to set the additional sense code to
+ * \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
+ */
+ #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = (key); \
+ SenseData.AdditionalSenseCode = (acode); \
+ SenseData.AdditionalSenseQualifier = (aqual); }MACROE
+
+ /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
+ #define DATA_READ true
+
+ /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */
+ #define DATA_WRITE false
+
+ /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
+ #define DEVICE_TYPE_BLOCK 0x00
+
+ /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
+ #define DEVICE_TYPE_CDROM 0x05
+
+ /* Function Prototypes: */
+ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+
+ #if defined(INCLUDE_FROM_SCSI_C)
+ static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
+ #endif
+
+#endif
diff --git a/Projects/TemperatureDataLogger/TempDataLogger.c b/Projects/TemperatureDataLogger/TempDataLogger.c
index 59105286e..b5b913f37 100644
--- a/Projects/TemperatureDataLogger/TempDataLogger.c
+++ b/Projects/TemperatureDataLogger/TempDataLogger.c
@@ -1,312 +1,312 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 TemperatureDataLogger project. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-#include "TempDataLogger.h"
-
-/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
- * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_MS_Device_t Disk_MS_Interface =
- {
- .Config =
- {
- .InterfaceNumber = 0,
-
- .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
- .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
- .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .TotalLUNs = 1,
- },
- };
-
-/** Buffer to hold the previously generated HID report, for comparison purposes inside the HID class driver. */
-uint8_t PrevHIDReportBuffer[GENERIC_REPORT_SIZE];
-
-/** LUFA HID Class driver interface configuration and state information. This structure is
- * passed to all HID Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_HID_Device_t Generic_HID_Interface =
- {
- .Config =
- {
- .InterfaceNumber = 1,
-
- .ReportINEndpointNumber = GENERIC_IN_EPNUM,
- .ReportINEndpointSize = GENERIC_EPSIZE,
- .ReportINEndpointDoubleBank = false,
-
- .PrevReportINBuffer = PrevHIDReportBuffer,
- .PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
- },
- };
-
-/** Non-volatile Logging Interval value in EEPROM, stored as a number of 500ms ticks */
-uint8_t EEMEM LoggingInterval500MS_EEPROM;
-
-/** SRAM Logging Interval value fetched from EEPROM, stored as a number of 500ms ticks */
-uint8_t LoggingInterval500MS_SRAM;
-
-/** Total number of 500ms logging ticks elapsed since the last log value was recorded */
-uint16_t CurrentLoggingTicks;
-
-/** FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */
-FATFS DiskFATState;
-
-/** FAT Fs structure to hold a FAT file handle for the log data write destination. */
-FIL TempLogFile;
-
-
-/** ISR to handle the 500ms ticks for sampling and data logging */
-ISR(TIMER1_COMPA_vect, ISR_BLOCK)
-{
- uint8_t LEDMask = LEDs_GetLEDs();
-
- /* Check to see if the logging interval has expired */
- if (CurrentLoggingTicks++ < LoggingInterval500MS_SRAM)
- return;
-
- LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
- /* Reset log tick counter to prepare for next logging interval */
- CurrentLoggingTicks = 0;
-
- /* Only log when not connected to a USB host */
- if (USB_DeviceState == DEVICE_STATE_Unattached)
- {
- uint8_t Day, Month, Year;
- uint8_t Hour, Minute, Second;
-
- DS1307_GetDate(&Day, &Month, &Year);
- DS1307_GetTime(&Hour, &Minute, &Second);
-
- char LineBuffer[100];
- uint16_t BytesWritten;
-
- BytesWritten = sprintf(LineBuffer, "%02d/%02d/20%04d, %02d:%02d:%02d, %d Degrees\r\n",
- Day, Month, Year, Hour, Minute, Second, Temperature_GetTemperature());
-
- f_write(&TempLogFile, LineBuffer, BytesWritten, &BytesWritten);
- f_sync(&TempLogFile);
- }
-
- LEDs_SetAllLEDs(LEDMask);
-}
-
-/** 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();
-
- /* Fetch logging interval from EEPROM */
- LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);
-
- /* Mount and open the log file on the dataflash FAT partition */
- OpenLogFile();
-
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- sei();
-
- /* Discard the first sample from the temperature sensor, as it is generally incorrect */
- volatile uint8_t Dummy = Temperature_GetTemperature();
- (void)Dummy;
-
- for (;;)
- {
- MS_Device_USBTask(&Disk_MS_Interface);
- HID_Device_USBTask(&Generic_HID_Interface);
- USB_USBTask();
- }
-}
-
-/** Opens the log file on the Dataflash's FAT formatted partition according to the current date */
-void OpenLogFile(void)
-{
- char LogFileName[12];
-
- /* Get the current date for the filename as "DDMMYY.csv" */
- uint8_t Day, Month, Year;
- DS1307_GetDate(&Day, &Month, &Year);
- sprintf(LogFileName, "%02d%02d%02d.csv", Day, Month, Year);
-
- /* Mount the storage device, open the file */
- f_mount(0, &DiskFATState);
- f_open(&TempLogFile, LogFileName, FA_OPEN_ALWAYS | FA_WRITE);
- f_lseek(&TempLogFile, TempLogFile.fsize);
-}
-
-/** Closes the open data log file on the Dataflash's FAT formatted partition */
-void CloseLogFile(void)
-{
- /* Sync any data waiting to be written, unmount the storage device */
- f_sync(&TempLogFile);
- f_close(&TempLogFile);
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- LEDs_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
- ADC_Init(ADC_REFERENCE_AVCC | ADC_FREE_RUNNING | ADC_PRESCALE_128);
- Temperature_Init();
- Dataflash_Init();
- USB_Init();
- TWI_Init();
-
- /* 500ms logging interval timer configuration */
- OCR1A = ((F_CPU / 1024) / 2);
- TCCR1B = (1 << WGM12) | (1 << CS12) | (1 << CS10);
- TIMSK1 = (1 << OCIE1A);
-
- /* Clear Dataflash sector protections, if enabled */
- DataflashManager_ResetDataflashProtections();
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
- /* Close the log file so that the host has exclusive filesystem access */
- CloseLogFile();
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-
- /* Mount and open the log file on the dataflash FAT partition */
- OpenLogFile();
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
- if (!(HID_Device_ConfigureEndpoints(&Generic_HID_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- MS_Device_ProcessControlRequest(&Disk_MS_Interface);
- HID_Device_ProcessControlRequest(&Generic_HID_Interface);
-}
-
-/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
- */
-bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- bool CommandSuccess;
-
- LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
- CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- return CommandSuccess;
-}
-
-/** HID class driver callback function for the creation of HID reports to the host.
- *
- * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
- * \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
- * \param[in] ReportType Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature
- * \param[out] ReportData Pointer to a buffer where the created report should be stored
- * \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent
- *
- * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
- */
-bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
- const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
-{
- Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
-
- DS1307_GetDate(&ReportParams->Day, &ReportParams->Month, &ReportParams->Year);
- DS1307_GetTime(&ReportParams->Hour, &ReportParams->Minute, &ReportParams->Second);
-
- ReportParams->LogInterval500MS = LoggingInterval500MS_SRAM;
-
- *ReportSize = sizeof(Device_Report_t);
- return true;
-}
-
-/** HID class driver callback function for the processing of HID reports from the host.
- *
- * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
- * \param[in] ReportID Report ID of the received report from the host
- * \param[in] ReportData Pointer to a buffer where the created report has been stored
- * \param[in] ReportSize Size in bytes of the received HID report
- */
-void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
- const void* ReportData, const uint16_t ReportSize)
-{
- Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
-
- DS1307_SetDate(ReportParams->Day, ReportParams->Month, ReportParams->Year);
- DS1307_SetTime(ReportParams->Hour, ReportParams->Minute, ReportParams->Second);
-
- /* If the logging interval has changed from its current value, write it to EEPROM */
- if (LoggingInterval500MS_SRAM != ReportParams->LogInterval500MS)
- {
- LoggingInterval500MS_SRAM = ReportParams->LogInterval500MS;
- eeprom_write_byte(&LoggingInterval500MS_EEPROM, LoggingInterval500MS_SRAM);
- }
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 TemperatureDataLogger project. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
+#include "TempDataLogger.h"
+
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
+ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_MS_Device_t Disk_MS_Interface =
+ {
+ .Config =
+ {
+ .InterfaceNumber = 0,
+
+ .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
+ .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .DataINEndpointDoubleBank = false,
+
+ .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
+ .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .DataOUTEndpointDoubleBank = false,
+
+ .TotalLUNs = 1,
+ },
+ };
+
+/** Buffer to hold the previously generated HID report, for comparison purposes inside the HID class driver. */
+uint8_t PrevHIDReportBuffer[GENERIC_REPORT_SIZE];
+
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_HID_Device_t Generic_HID_Interface =
+ {
+ .Config =
+ {
+ .InterfaceNumber = 1,
+
+ .ReportINEndpointNumber = GENERIC_IN_EPNUM,
+ .ReportINEndpointSize = GENERIC_EPSIZE,
+ .ReportINEndpointDoubleBank = false,
+
+ .PrevReportINBuffer = PrevHIDReportBuffer,
+ .PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
+ },
+ };
+
+/** Non-volatile Logging Interval value in EEPROM, stored as a number of 500ms ticks */
+uint8_t EEMEM LoggingInterval500MS_EEPROM;
+
+/** SRAM Logging Interval value fetched from EEPROM, stored as a number of 500ms ticks */
+uint8_t LoggingInterval500MS_SRAM;
+
+/** Total number of 500ms logging ticks elapsed since the last log value was recorded */
+uint16_t CurrentLoggingTicks;
+
+/** FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */
+FATFS DiskFATState;
+
+/** FAT Fs structure to hold a FAT file handle for the log data write destination. */
+FIL TempLogFile;
+
+
+/** ISR to handle the 500ms ticks for sampling and data logging */
+ISR(TIMER1_COMPA_vect, ISR_BLOCK)
+{
+ uint8_t LEDMask = LEDs_GetLEDs();
+
+ /* Check to see if the logging interval has expired */
+ if (CurrentLoggingTicks++ < LoggingInterval500MS_SRAM)
+ return;
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
+
+ /* Reset log tick counter to prepare for next logging interval */
+ CurrentLoggingTicks = 0;
+
+ /* Only log when not connected to a USB host */
+ if (USB_DeviceState == DEVICE_STATE_Unattached)
+ {
+ uint8_t Day, Month, Year;
+ uint8_t Hour, Minute, Second;
+
+ DS1307_GetDate(&Day, &Month, &Year);
+ DS1307_GetTime(&Hour, &Minute, &Second);
+
+ char LineBuffer[100];
+ uint16_t BytesWritten;
+
+ BytesWritten = sprintf(LineBuffer, "%02d/%02d/20%04d, %02d:%02d:%02d, %d Degrees\r\n",
+ Day, Month, Year, Hour, Minute, Second, Temperature_GetTemperature());
+
+ f_write(&TempLogFile, LineBuffer, BytesWritten, &BytesWritten);
+ f_sync(&TempLogFile);
+ }
+
+ LEDs_SetAllLEDs(LEDMask);
+}
+
+/** 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();
+
+ /* Fetch logging interval from EEPROM */
+ LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);
+
+ /* Mount and open the log file on the dataflash FAT partition */
+ OpenLogFile();
+
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ sei();
+
+ /* Discard the first sample from the temperature sensor, as it is generally incorrect */
+ volatile uint8_t Dummy = Temperature_GetTemperature();
+ (void)Dummy;
+
+ for (;;)
+ {
+ MS_Device_USBTask(&Disk_MS_Interface);
+ HID_Device_USBTask(&Generic_HID_Interface);
+ USB_USBTask();
+ }
+}
+
+/** Opens the log file on the Dataflash's FAT formatted partition according to the current date */
+void OpenLogFile(void)
+{
+ char LogFileName[12];
+
+ /* Get the current date for the filename as "DDMMYY.csv" */
+ uint8_t Day, Month, Year;
+ DS1307_GetDate(&Day, &Month, &Year);
+ sprintf(LogFileName, "%02d%02d%02d.csv", Day, Month, Year);
+
+ /* Mount the storage device, open the file */
+ f_mount(0, &DiskFATState);
+ f_open(&TempLogFile, LogFileName, FA_OPEN_ALWAYS | FA_WRITE);
+ f_lseek(&TempLogFile, TempLogFile.fsize);
+}
+
+/** Closes the open data log file on the Dataflash's FAT formatted partition */
+void CloseLogFile(void)
+{
+ /* Sync any data waiting to be written, unmount the storage device */
+ f_sync(&TempLogFile);
+ f_close(&TempLogFile);
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ LEDs_Init();
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
+ ADC_Init(ADC_REFERENCE_AVCC | ADC_FREE_RUNNING | ADC_PRESCALE_128);
+ Temperature_Init();
+ Dataflash_Init();
+ USB_Init();
+ TWI_Init();
+
+ /* 500ms logging interval timer configuration */
+ OCR1A = ((F_CPU / 1024) / 2);
+ TCCR1B = (1 << WGM12) | (1 << CS12) | (1 << CS10);
+ TIMSK1 = (1 << OCIE1A);
+
+ /* Clear Dataflash sector protections, if enabled */
+ DataflashManager_ResetDataflashProtections();
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+
+ /* Close the log file so that the host has exclusive filesystem access */
+ CloseLogFile();
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+
+ /* Mount and open the log file on the dataflash FAT partition */
+ OpenLogFile();
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ if (!(HID_Device_ConfigureEndpoints(&Generic_HID_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ MS_Device_ProcessControlRequest(&Disk_MS_Interface);
+ HID_Device_ProcessControlRequest(&Generic_HID_Interface);
+}
+
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
+ */
+bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ bool CommandSuccess;
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
+ CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ return CommandSuccess;
+}
+
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
+ * \param[in] ReportType Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature
+ * \param[out] ReportData Pointer to a buffer where the created report should be stored
+ * \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent
+ *
+ * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
+ */
+bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
+ const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
+{
+ Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
+
+ DS1307_GetDate(&ReportParams->Day, &ReportParams->Month, &ReportParams->Year);
+ DS1307_GetTime(&ReportParams->Hour, &ReportParams->Minute, &ReportParams->Second);
+
+ ReportParams->LogInterval500MS = LoggingInterval500MS_SRAM;
+
+ *ReportSize = sizeof(Device_Report_t);
+ return true;
+}
+
+/** HID class driver callback function for the processing of HID reports from the host.
+ *
+ * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param[in] ReportID Report ID of the received report from the host
+ * \param[in] ReportData Pointer to a buffer where the created report has been stored
+ * \param[in] ReportSize Size in bytes of the received HID report
+ */
+void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
+ const void* ReportData, const uint16_t ReportSize)
+{
+ Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
+
+ DS1307_SetDate(ReportParams->Day, ReportParams->Month, ReportParams->Year);
+ DS1307_SetTime(ReportParams->Hour, ReportParams->Minute, ReportParams->Second);
+
+ /* If the logging interval has changed from its current value, write it to EEPROM */
+ if (LoggingInterval500MS_SRAM != ReportParams->LogInterval500MS)
+ {
+ LoggingInterval500MS_SRAM = ReportParams->LogInterval500MS;
+ eeprom_write_byte(&LoggingInterval500MS_EEPROM, LoggingInterval500MS_SRAM);
+ }
+}
diff --git a/Projects/TemperatureDataLogger/TempDataLogger.h b/Projects/TemperatureDataLogger/TempDataLogger.h
index a6e770bb0..b6a3389fe 100644
--- a/Projects/TemperatureDataLogger/TempDataLogger.h
+++ b/Projects/TemperatureDataLogger/TempDataLogger.h
@@ -1,113 +1,113 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 TempDataLogger.c.
- */
-
-#ifndef _TEMP_DATALOGGER_H_
-#define _TEMP_DATALOGGER_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
- #include <stdio.h>
-
- #include "Descriptors.h"
-
- #include "Lib/SCSI.h"
- #include "Lib/DataflashManager.h"
- #include "Lib/FATFs/ff.h"
- #include "Lib/DS1307.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/Board/Temperature.h>
- #include <LUFA/Drivers/Peripheral/ADC.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
-
- /* 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
-
- /** Filename for the log data when written to the dataflash FAT filesystem. */
- #define LOG_FILENAME "TEMPLOG.txt"
-
- /** Data log interval between samples, in tens of milliseconds */
- #define LOG_INTERVAL_10MS 1000
-
- /* Type Defines: */
- typedef struct
- {
- uint8_t Day;
- uint8_t Month;
- uint8_t Year;
-
- uint8_t Hour;
- uint8_t Minute;
- uint8_t Second;
-
- uint8_t LogInterval500MS;
- } Device_Report_t;
-
- /* Function Prototypes: */
- void SetupHardware(void);
- void OpenLogFile(void);
- void CloseLogFile(void);
-
- void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
- void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
-
- bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
- const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
- void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
- const void* ReportData, const uint16_t ReportSize);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 TempDataLogger.c.
+ */
+
+#ifndef _TEMP_DATALOGGER_H_
+#define _TEMP_DATALOGGER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+ #include <stdio.h>
+
+ #include "Descriptors.h"
+
+ #include "Lib/SCSI.h"
+ #include "Lib/DataflashManager.h"
+ #include "Lib/FATFs/ff.h"
+ #include "Lib/DS1307.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/Board/Temperature.h>
+ #include <LUFA/Drivers/Peripheral/ADC.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+ #include <LUFA/Drivers/USB/Class/HID.h>
+
+ /* 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
+
+ /** Filename for the log data when written to the dataflash FAT filesystem. */
+ #define LOG_FILENAME "TEMPLOG.txt"
+
+ /** Data log interval between samples, in tens of milliseconds */
+ #define LOG_INTERVAL_10MS 1000
+
+ /* Type Defines: */
+ typedef struct
+ {
+ uint8_t Day;
+ uint8_t Month;
+ uint8_t Year;
+
+ uint8_t Hour;
+ uint8_t Minute;
+ uint8_t Second;
+
+ uint8_t LogInterval500MS;
+ } Device_Report_t;
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+ void OpenLogFile(void);
+ void CloseLogFile(void);
+
+ void EVENT_USB_Device_Connect(void);
+ void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+
+ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
+ const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
+ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
+ const void* ReportData, const uint16_t ReportSize);
+
+#endif
diff --git a/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.LESSER.txt b/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.LESSER.txt
index b87303c39..fc8a5de7e 100644
--- a/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.LESSER.txt
+++ b/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.LESSER.txt
@@ -1,165 +1,165 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.txt b/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.txt
index 818433ecc..94a9ed024 100644
--- a/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.txt
+++ b/Projects/TemperatureDataLogger/TempLogHostApp/COPYING.txt
@@ -1,674 +1,674 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs b/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs
index c6b106f98..7b4249c42 100644
--- a/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs
+++ b/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs
@@ -1,181 +1,181 @@
-namespace Project1HostApp
-{
- partial class frmDataloggerSettings
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.btnSetValues = new System.Windows.Forms.Button();
- this.dtpTime = new System.Windows.Forms.DateTimePicker();
- this.lblTime = new System.Windows.Forms.Label();
- this.lblLoggingInterval = new System.Windows.Forms.Label();
- this.nudLogInterval = new System.Windows.Forms.NumericUpDown();
- this.lblSeconds = new System.Windows.Forms.Label();
- this.btnGetValues = new System.Windows.Forms.Button();
- this.lblDate = new System.Windows.Forms.Label();
- this.dtpDate = new System.Windows.Forms.DateTimePicker();
- ((System.ComponentModel.ISupportInitialize)(this.nudLogInterval)).BeginInit();
- this.SuspendLayout();
- //
- // btnSetValues
- //
- this.btnSetValues.Location = new System.Drawing.Point(168, 136);
- this.btnSetValues.Name = "btnSetValues";
- this.btnSetValues.Size = new System.Drawing.Size(90, 35);
- this.btnSetValues.TabIndex = 0;
- this.btnSetValues.Text = "Set Values";
- this.btnSetValues.UseVisualStyleBackColor = true;
- this.btnSetValues.Click += new System.EventHandler(this.btnSetValues_Click);
- //
- // dtpTime
- //
- this.dtpTime.CustomFormat = "";
- this.dtpTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
- this.dtpTime.Location = new System.Drawing.Point(148, 61);
- this.dtpTime.Name = "dtpTime";
- this.dtpTime.ShowUpDown = true;
- this.dtpTime.Size = new System.Drawing.Size(110, 20);
- this.dtpTime.TabIndex = 1;
- //
- // lblTime
- //
- this.lblTime.AutoSize = true;
- this.lblTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTime.Location = new System.Drawing.Point(51, 67);
- this.lblTime.Name = "lblTime";
- this.lblTime.Size = new System.Drawing.Size(82, 13);
- this.lblTime.TabIndex = 2;
- this.lblTime.Text = "Device Time:";
- //
- // lblLoggingInterval
- //
- this.lblLoggingInterval.AutoSize = true;
- this.lblLoggingInterval.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblLoggingInterval.Location = new System.Drawing.Point(30, 101);
- this.lblLoggingInterval.Name = "lblLoggingInterval";
- this.lblLoggingInterval.Size = new System.Drawing.Size(103, 13);
- this.lblLoggingInterval.TabIndex = 3;
- this.lblLoggingInterval.Text = "Logging Interval:";
- //
- // nudLogInterval
- //
- this.nudLogInterval.Location = new System.Drawing.Point(148, 94);
- this.nudLogInterval.Maximum = new decimal(new int[] {
- 60,
- 0,
- 0,
- 0});
- this.nudLogInterval.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudLogInterval.Name = "nudLogInterval";
- this.nudLogInterval.Size = new System.Drawing.Size(51, 20);
- this.nudLogInterval.TabIndex = 5;
- this.nudLogInterval.Value = new decimal(new int[] {
- 5,
- 0,
- 0,
- 0});
- //
- // lblSeconds
- //
- this.lblSeconds.AutoSize = true;
- this.lblSeconds.Location = new System.Drawing.Point(209, 101);
- this.lblSeconds.Name = "lblSeconds";
- this.lblSeconds.Size = new System.Drawing.Size(49, 13);
- this.lblSeconds.TabIndex = 6;
- this.lblSeconds.Text = "Seconds";
- //
- // btnGetValues
- //
- this.btnGetValues.Location = new System.Drawing.Point(30, 136);
- this.btnGetValues.Name = "btnGetValues";
- this.btnGetValues.Size = new System.Drawing.Size(90, 35);
- this.btnGetValues.TabIndex = 7;
- this.btnGetValues.Text = "Get Values";
- this.btnGetValues.UseVisualStyleBackColor = true;
- this.btnGetValues.Click += new System.EventHandler(this.btnGetValues_Click);
- //
- // lblDate
- //
- this.lblDate.AutoSize = true;
- this.lblDate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblDate.Location = new System.Drawing.Point(51, 33);
- this.lblDate.Name = "lblDate";
- this.lblDate.Size = new System.Drawing.Size(82, 13);
- this.lblDate.TabIndex = 8;
- this.lblDate.Text = "Device Date:";
- //
- // dtpDate
- //
- this.dtpDate.CustomFormat = "dd/MM/yyyy";
- this.dtpDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
- this.dtpDate.Location = new System.Drawing.Point(148, 27);
- this.dtpDate.Name = "dtpDate";
- this.dtpDate.Size = new System.Drawing.Size(110, 20);
- this.dtpDate.TabIndex = 9;
- //
- // frmDataloggerSettings
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(300, 197);
- this.Controls.Add(this.dtpDate);
- this.Controls.Add(this.lblDate);
- this.Controls.Add(this.btnGetValues);
- this.Controls.Add(this.lblSeconds);
- this.Controls.Add(this.nudLogInterval);
- this.Controls.Add(this.lblLoggingInterval);
- this.Controls.Add(this.lblTime);
- this.Controls.Add(this.dtpTime);
- this.Controls.Add(this.btnSetValues);
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "frmDataloggerSettings";
- this.Text = "DataLogger";
- this.Load += new System.EventHandler(this.frmDataloggerSettings_Load);
- ((System.ComponentModel.ISupportInitialize)(this.nudLogInterval)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Button btnSetValues;
- private System.Windows.Forms.DateTimePicker dtpTime;
- private System.Windows.Forms.Label lblTime;
- private System.Windows.Forms.Label lblLoggingInterval;
- private System.Windows.Forms.NumericUpDown nudLogInterval;
- private System.Windows.Forms.Label lblSeconds;
- private System.Windows.Forms.Button btnGetValues;
- private System.Windows.Forms.Label lblDate;
- private System.Windows.Forms.DateTimePicker dtpDate;
- }
-}
-
+namespace Project1HostApp
+{
+ partial class frmDataloggerSettings
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.btnSetValues = new System.Windows.Forms.Button();
+ this.dtpTime = new System.Windows.Forms.DateTimePicker();
+ this.lblTime = new System.Windows.Forms.Label();
+ this.lblLoggingInterval = new System.Windows.Forms.Label();
+ this.nudLogInterval = new System.Windows.Forms.NumericUpDown();
+ this.lblSeconds = new System.Windows.Forms.Label();
+ this.btnGetValues = new System.Windows.Forms.Button();
+ this.lblDate = new System.Windows.Forms.Label();
+ this.dtpDate = new System.Windows.Forms.DateTimePicker();
+ ((System.ComponentModel.ISupportInitialize)(this.nudLogInterval)).BeginInit();
+ this.SuspendLayout();
+ //
+ // btnSetValues
+ //
+ this.btnSetValues.Location = new System.Drawing.Point(168, 136);
+ this.btnSetValues.Name = "btnSetValues";
+ this.btnSetValues.Size = new System.Drawing.Size(90, 35);
+ this.btnSetValues.TabIndex = 0;
+ this.btnSetValues.Text = "Set Values";
+ this.btnSetValues.UseVisualStyleBackColor = true;
+ this.btnSetValues.Click += new System.EventHandler(this.btnSetValues_Click);
+ //
+ // dtpTime
+ //
+ this.dtpTime.CustomFormat = "";
+ this.dtpTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
+ this.dtpTime.Location = new System.Drawing.Point(148, 61);
+ this.dtpTime.Name = "dtpTime";
+ this.dtpTime.ShowUpDown = true;
+ this.dtpTime.Size = new System.Drawing.Size(110, 20);
+ this.dtpTime.TabIndex = 1;
+ //
+ // lblTime
+ //
+ this.lblTime.AutoSize = true;
+ this.lblTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblTime.Location = new System.Drawing.Point(51, 67);
+ this.lblTime.Name = "lblTime";
+ this.lblTime.Size = new System.Drawing.Size(82, 13);
+ this.lblTime.TabIndex = 2;
+ this.lblTime.Text = "Device Time:";
+ //
+ // lblLoggingInterval
+ //
+ this.lblLoggingInterval.AutoSize = true;
+ this.lblLoggingInterval.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblLoggingInterval.Location = new System.Drawing.Point(30, 101);
+ this.lblLoggingInterval.Name = "lblLoggingInterval";
+ this.lblLoggingInterval.Size = new System.Drawing.Size(103, 13);
+ this.lblLoggingInterval.TabIndex = 3;
+ this.lblLoggingInterval.Text = "Logging Interval:";
+ //
+ // nudLogInterval
+ //
+ this.nudLogInterval.Location = new System.Drawing.Point(148, 94);
+ this.nudLogInterval.Maximum = new decimal(new int[] {
+ 60,
+ 0,
+ 0,
+ 0});
+ this.nudLogInterval.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.nudLogInterval.Name = "nudLogInterval";
+ this.nudLogInterval.Size = new System.Drawing.Size(51, 20);
+ this.nudLogInterval.TabIndex = 5;
+ this.nudLogInterval.Value = new decimal(new int[] {
+ 5,
+ 0,
+ 0,
+ 0});
+ //
+ // lblSeconds
+ //
+ this.lblSeconds.AutoSize = true;
+ this.lblSeconds.Location = new System.Drawing.Point(209, 101);
+ this.lblSeconds.Name = "lblSeconds";
+ this.lblSeconds.Size = new System.Drawing.Size(49, 13);
+ this.lblSeconds.TabIndex = 6;
+ this.lblSeconds.Text = "Seconds";
+ //
+ // btnGetValues
+ //
+ this.btnGetValues.Location = new System.Drawing.Point(30, 136);
+ this.btnGetValues.Name = "btnGetValues";
+ this.btnGetValues.Size = new System.Drawing.Size(90, 35);
+ this.btnGetValues.TabIndex = 7;
+ this.btnGetValues.Text = "Get Values";
+ this.btnGetValues.UseVisualStyleBackColor = true;
+ this.btnGetValues.Click += new System.EventHandler(this.btnGetValues_Click);
+ //
+ // lblDate
+ //
+ this.lblDate.AutoSize = true;
+ this.lblDate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblDate.Location = new System.Drawing.Point(51, 33);
+ this.lblDate.Name = "lblDate";
+ this.lblDate.Size = new System.Drawing.Size(82, 13);
+ this.lblDate.TabIndex = 8;
+ this.lblDate.Text = "Device Date:";
+ //
+ // dtpDate
+ //
+ this.dtpDate.CustomFormat = "dd/MM/yyyy";
+ this.dtpDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpDate.Location = new System.Drawing.Point(148, 27);
+ this.dtpDate.Name = "dtpDate";
+ this.dtpDate.Size = new System.Drawing.Size(110, 20);
+ this.dtpDate.TabIndex = 9;
+ //
+ // frmDataloggerSettings
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(300, 197);
+ this.Controls.Add(this.dtpDate);
+ this.Controls.Add(this.lblDate);
+ this.Controls.Add(this.btnGetValues);
+ this.Controls.Add(this.lblSeconds);
+ this.Controls.Add(this.nudLogInterval);
+ this.Controls.Add(this.lblLoggingInterval);
+ this.Controls.Add(this.lblTime);
+ this.Controls.Add(this.dtpTime);
+ this.Controls.Add(this.btnSetValues);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "frmDataloggerSettings";
+ this.Text = "DataLogger";
+ this.Load += new System.EventHandler(this.frmDataloggerSettings_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.nudLogInterval)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnSetValues;
+ private System.Windows.Forms.DateTimePicker dtpTime;
+ private System.Windows.Forms.Label lblTime;
+ private System.Windows.Forms.Label lblLoggingInterval;
+ private System.Windows.Forms.NumericUpDown nudLogInterval;
+ private System.Windows.Forms.Label lblSeconds;
+ private System.Windows.Forms.Button btnGetValues;
+ private System.Windows.Forms.Label lblDate;
+ private System.Windows.Forms.DateTimePicker dtpDate;
+ }
+}
+
diff --git a/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.cs b/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.cs
index 370dfbd69..0168fb8cf 100644
--- a/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.cs
+++ b/Projects/TemperatureDataLogger/TempLogHostApp/DataLoggerSettings.cs
@@ -1,172 +1,172 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using Hid;
-
-namespace Project1HostApp
-{
- public partial class frmDataloggerSettings : Form
- {
- private const int DEVICE_VID = 0x03EB;
- private const int DEVICE_PID = 0xFAFA;
-
- private struct Device_Report_t
- {
- public Byte Day;
- public Byte Month;
- public Byte Year;
-
- public Byte Hour;
- public Byte Minute;
- public Byte Second;
-
- public Byte LogInterval500MS;
-
- public Byte[] ToReport()
- {
- Byte[] Report = new Byte[7];
-
- Report[0] = this.Day;
- Report[1] = this.Month;
- Report[2] = this.Year;
- Report[3] = this.Hour;
- Report[4] = this.Minute;
- Report[5] = this.Second;
- Report[6] = this.LogInterval500MS;
-
- return Report;
- }
-
- public void FromReport(Byte[] Report)
- {
- this.Day = Report[0];
- this.Month = Report[1];
- this.Year = Report[2];
- this.Hour = Report[3];
- this.Minute = Report[4];
- this.Second = Report[5];
- this.LogInterval500MS = Report[6];
- }
- };
-
- private IDevice GetDeviceConnection()
- {
- IDevice[] ConnectedDevices = DeviceFactory.Enumerate(DEVICE_VID, DEVICE_PID);
- IDevice ConnectionHandle = null;
-
- if (ConnectedDevices.Count() > 0)
- ConnectionHandle = ConnectedDevices[0];
- else
- return null;
-
- // Fix report handle under Windows
- if (ConnectionHandle is Hid.Win32.Win32DeviceSet)
- {
- ((Hid.Win32.Win32DeviceSet)ConnectionHandle).AddDevice(0x00,
- ((Hid.Win32.Win32DeviceSet)ConnectionHandle).UnallocatedDevices[0]);
- }
-
- return ConnectionHandle;
- }
-
- public frmDataloggerSettings()
- {
- InitializeComponent();
- }
-
- private void btnSetValues_Click(object sender, EventArgs e)
- {
- IDevice ConnectionHandle = GetDeviceConnection();
-
- if (ConnectionHandle == null)
- {
- MessageBox.Show("Error: Cannot connect to DataLogger device.");
- return;
- }
-
- Device_Report_t DeviceReport = new Device_Report_t();
- DeviceReport.Day = (byte)dtpDate.Value.Day;
- DeviceReport.Month = (byte)dtpDate.Value.Month;
- DeviceReport.Year = (byte)((dtpDate.Value.Year < 2000) ? 0 : (dtpDate.Value.Year - 2000));
- DeviceReport.Hour = (byte)dtpTime.Value.Hour;
- DeviceReport.Minute = (byte)dtpTime.Value.Minute;
- DeviceReport.Second = (byte)dtpTime.Value.Second;
- DeviceReport.LogInterval500MS = (byte)(nudLogInterval.Value * 2);
-
- try
- {
- ConnectionHandle.Write(0x00, DeviceReport.ToReport());
- MessageBox.Show("Device parameters updated sucessfully.");
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error: " + ex.Message);
- }
- }
-
- private void btnGetValues_Click(object sender, EventArgs e)
- {
- IDevice ConnectionHandle = GetDeviceConnection();
-
- if (ConnectionHandle == null)
- {
- MessageBox.Show("Error: Cannot connect to DataLogger device.");
- return;
- }
-
- Device_Report_t DeviceReport = new Device_Report_t();
-
- try
- {
- Byte[] Report = new Byte[7];
-
- ConnectionHandle.Read(0x00, Report);
- DeviceReport.FromReport(Report);
-
- try
- {
- dtpDate.Value = new DateTime(
- (2000 + DeviceReport.Year),
- DeviceReport.Month,
- DeviceReport.Day);
-
- dtpTime.Value = new DateTime(
- DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
- DeviceReport.Hour,
- DeviceReport.Minute,
- DeviceReport.Second);
- }
- catch (Exception ex)
- {
- dtpDate.Value = DateTime.Now;
- dtpTime.Value = DateTime.Now;
- }
-
- try
- {
- nudLogInterval.Value = (DeviceReport.LogInterval500MS / 2);
- }
- catch (Exception ex)
- {
- nudLogInterval.Value = nudLogInterval.Minimum;
- }
-
- MessageBox.Show("Device parameters retrieved sucessfully.");
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error: " + ex.Message);
- }
- }
-
- private void frmDataloggerSettings_Load(object sender, EventArgs e)
- {
-
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using Hid;
+
+namespace Project1HostApp
+{
+ public partial class frmDataloggerSettings : Form
+ {
+ private const int DEVICE_VID = 0x03EB;
+ private const int DEVICE_PID = 0xFAFA;
+
+ private struct Device_Report_t
+ {
+ public Byte Day;
+ public Byte Month;
+ public Byte Year;
+
+ public Byte Hour;
+ public Byte Minute;
+ public Byte Second;
+
+ public Byte LogInterval500MS;
+
+ public Byte[] ToReport()
+ {
+ Byte[] Report = new Byte[7];
+
+ Report[0] = this.Day;
+ Report[1] = this.Month;
+ Report[2] = this.Year;
+ Report[3] = this.Hour;
+ Report[4] = this.Minute;
+ Report[5] = this.Second;
+ Report[6] = this.LogInterval500MS;
+
+ return Report;
+ }
+
+ public void FromReport(Byte[] Report)
+ {
+ this.Day = Report[0];
+ this.Month = Report[1];
+ this.Year = Report[2];
+ this.Hour = Report[3];
+ this.Minute = Report[4];
+ this.Second = Report[5];
+ this.LogInterval500MS = Report[6];
+ }
+ };
+
+ private IDevice GetDeviceConnection()
+ {
+ IDevice[] ConnectedDevices = DeviceFactory.Enumerate(DEVICE_VID, DEVICE_PID);
+ IDevice ConnectionHandle = null;
+
+ if (ConnectedDevices.Count() > 0)
+ ConnectionHandle = ConnectedDevices[0];
+ else
+ return null;
+
+ // Fix report handle under Windows
+ if (ConnectionHandle is Hid.Win32.Win32DeviceSet)
+ {
+ ((Hid.Win32.Win32DeviceSet)ConnectionHandle).AddDevice(0x00,
+ ((Hid.Win32.Win32DeviceSet)ConnectionHandle).UnallocatedDevices[0]);
+ }
+
+ return ConnectionHandle;
+ }
+
+ public frmDataloggerSettings()
+ {
+ InitializeComponent();
+ }
+
+ private void btnSetValues_Click(object sender, EventArgs e)
+ {
+ IDevice ConnectionHandle = GetDeviceConnection();
+
+ if (ConnectionHandle == null)
+ {
+ MessageBox.Show("Error: Cannot connect to DataLogger device.");
+ return;
+ }
+
+ Device_Report_t DeviceReport = new Device_Report_t();
+ DeviceReport.Day = (byte)dtpDate.Value.Day;
+ DeviceReport.Month = (byte)dtpDate.Value.Month;
+ DeviceReport.Year = (byte)((dtpDate.Value.Year < 2000) ? 0 : (dtpDate.Value.Year - 2000));
+ DeviceReport.Hour = (byte)dtpTime.Value.Hour;
+ DeviceReport.Minute = (byte)dtpTime.Value.Minute;
+ DeviceReport.Second = (byte)dtpTime.Value.Second;
+ DeviceReport.LogInterval500MS = (byte)(nudLogInterval.Value * 2);
+
+ try
+ {
+ ConnectionHandle.Write(0x00, DeviceReport.ToReport());
+ MessageBox.Show("Device parameters updated sucessfully.");
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error: " + ex.Message);
+ }
+ }
+
+ private void btnGetValues_Click(object sender, EventArgs e)
+ {
+ IDevice ConnectionHandle = GetDeviceConnection();
+
+ if (ConnectionHandle == null)
+ {
+ MessageBox.Show("Error: Cannot connect to DataLogger device.");
+ return;
+ }
+
+ Device_Report_t DeviceReport = new Device_Report_t();
+
+ try
+ {
+ Byte[] Report = new Byte[7];
+
+ ConnectionHandle.Read(0x00, Report);
+ DeviceReport.FromReport(Report);
+
+ try
+ {
+ dtpDate.Value = new DateTime(
+ (2000 + DeviceReport.Year),
+ DeviceReport.Month,
+ DeviceReport.Day);
+
+ dtpTime.Value = new DateTime(
+ DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
+ DeviceReport.Hour,
+ DeviceReport.Minute,
+ DeviceReport.Second);
+ }
+ catch (Exception ex)
+ {
+ dtpDate.Value = DateTime.Now;
+ dtpTime.Value = DateTime.Now;
+ }
+
+ try
+ {
+ nudLogInterval.Value = (DeviceReport.LogInterval500MS / 2);
+ }
+ catch (Exception ex)
+ {
+ nudLogInterval.Value = nudLogInterval.Minimum;
+ }
+
+ MessageBox.Show("Device parameters retrieved sucessfully.");
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error: " + ex.Message);
+ }
+ }
+
+ private void frmDataloggerSettings_Load(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/Projects/TemperatureDataLogger/TempLogHostApp/Program.cs b/Projects/TemperatureDataLogger/TempLogHostApp/Program.cs
index dc818c822..2588e60c1 100644
--- a/Projects/TemperatureDataLogger/TempLogHostApp/Program.cs
+++ b/Projects/TemperatureDataLogger/TempLogHostApp/Program.cs
@@ -1,21 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows.Forms;
-
-namespace Project1HostApp
-{
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new frmDataloggerSettings());
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace Project1HostApp
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new frmDataloggerSettings());
+ }
+ }
+}
diff --git a/Projects/TemperatureDataLogger/TempLogHostApp/README.txt b/Projects/TemperatureDataLogger/TempLogHostApp/README.txt
index 35bc08e63..34f85533e 100644
--- a/Projects/TemperatureDataLogger/TempLogHostApp/README.txt
+++ b/Projects/TemperatureDataLogger/TempLogHostApp/README.txt
@@ -1,21 +1,21 @@
-This library has been tested on Windows Vista 32bit, Windows Vista 64bit,
-Windows XP 32bit and Debian (Lenny) AMD64 but should work on any version of
-Windows that can run the .NET framework 2.0 and any other operating system
-that has both hiddev and Mono.
-
-Any additions must be tested and work on Windows and Linux, on both 32 and
-64 bit. Windows 64 bit testing is particularly important as it is often
-neglected.
-
-
-Hid.Linux.dll was compiled under Linux with Mono (mcs) and uses no generics.
-
-Hid.Win32.dll and Hid.Net.dll were compiled under Windows with the .NET
-Framework v2.0.50727 but are also tested to compile with Mono (gmcs).
-
-
-A good starting point when using this library is Hid.DeviceFactory's Enumerate
-methods.
-
-LogitechMX5000.cs is a simple example of how the library can be used. Other
-examples on common devices are welcomed.
+This library has been tested on Windows Vista 32bit, Windows Vista 64bit,
+Windows XP 32bit and Debian (Lenny) AMD64 but should work on any version of
+Windows that can run the .NET framework 2.0 and any other operating system
+that has both hiddev and Mono.
+
+Any additions must be tested and work on Windows and Linux, on both 32 and
+64 bit. Windows 64 bit testing is particularly important as it is often
+neglected.
+
+
+Hid.Linux.dll was compiled under Linux with Mono (mcs) and uses no generics.
+
+Hid.Win32.dll and Hid.Net.dll were compiled under Windows with the .NET
+Framework v2.0.50727 but are also tested to compile with Mono (gmcs).
+
+
+A good starting point when using this library is Hid.DeviceFactory's Enumerate
+methods.
+
+LogitechMX5000.cs is a simple example of how the library can be used. Other
+examples on common devices are welcomed.
diff --git a/Projects/TemperatureDataLogger/TemperatureDataLogger.txt b/Projects/TemperatureDataLogger/TemperatureDataLogger.txt
index 280c5fe02..136d0385b 100644
--- a/Projects/TemperatureDataLogger/TemperatureDataLogger.txt
+++ b/Projects/TemperatureDataLogger/TemperatureDataLogger.txt
@@ -1,85 +1,85 @@
-/** \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 Temperature Datalogger Project
- *
- * \section SSec_Compat Demo Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this demo.
- *
- * - Series 7 USB AVRs
- * - Series 6 USB AVRs
- * - Series 4 USB AVRs (with >16KB of FLASH)
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this demo.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Classes:</b></td>
- * <td>Mass Storage Device \n
- * Human Interface Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclasses:</b></td>
- * <td>Bulk-Only Transport \n
- * Keyboard Subclass</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USBIF Mass Storage Standard \n
- * USB Bulk-Only Transport Standard \n
- * SCSI Primary Commands Specification \n
- * SCSI Block Commands Specification \n
- * USBIF HID Specification, USBIF HID Usage Tables</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Temperature Data Logger project. This project is a very basic USB data logger for the current temperature as reported by
- * the board's temperature sensor, writing the temperature to a file stored on the board's Dataflash in a FAT filesystem
- * each time a specified interval elapses. When inserted into a PC, the datalogger will appear as a standard USB Mass Storage
- * device with a single text file, which contains the logged data. Files are named according to the current date when the
- * logging commences.
- *
- * A DS1307 or compatible RTC IC is designed to be attached to the AVR's TWI bus, for the management of timestamps on the
- * sampled data. This project will not function correctly if the RTC chip is omitted unless the DUMMY_RTC compile time token
- * is specified - see \ref SSec_Options.
- *
- * Due to the host's need for exclusive access to the filesystem, the device will not log samples while connected to a host.
- * For the logger to store data, the Dataflash must first be formatted by the host so that it contains a valid FAT filesystem.
- *
- * This project uses the FatFS library from ELM Chan (http://elm-chan.org/fsw/ff/00index_e.html) and the .NET HID device library
- * LibHIDNet (http://sourceforge.net/projects/libhidnet/).
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>DUMMY_RTC</td>
- * <td>Makefile CDEFS</td>
- * <td>When a DS1307 RTC chip is not fitted, this token can be defined to make the demo assume a 1/1/1 01:01:01 date/time
- * stamp at all times, effectively transforming the project into a basic data logger with no specified sample times.</td>
- * </tr>
- * </table>
- */
+/** \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 Temperature Datalogger Project
+ *
+ * \section SSec_Compat Demo Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this demo.
+ *
+ * - Series 7 USB AVRs
+ * - Series 6 USB AVRs
+ * - Series 4 USB AVRs (with >16KB of FLASH)
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this demo.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Classes:</b></td>
+ * <td>Mass Storage Device \n
+ * Human Interface Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclasses:</b></td>
+ * <td>Bulk-Only Transport \n
+ * Keyboard Subclass</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USBIF Mass Storage Standard \n
+ * USB Bulk-Only Transport Standard \n
+ * SCSI Primary Commands Specification \n
+ * SCSI Block Commands Specification \n
+ * USBIF HID Specification, USBIF HID Usage Tables</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Temperature Data Logger project. This project is a very basic USB data logger for the current temperature as reported by
+ * the board's temperature sensor, writing the temperature to a file stored on the board's Dataflash in a FAT filesystem
+ * each time a specified interval elapses. When inserted into a PC, the datalogger will appear as a standard USB Mass Storage
+ * device with a single text file, which contains the logged data. Files are named according to the current date when the
+ * logging commences.
+ *
+ * A DS1307 or compatible RTC IC is designed to be attached to the AVR's TWI bus, for the management of timestamps on the
+ * sampled data. This project will not function correctly if the RTC chip is omitted unless the DUMMY_RTC compile time token
+ * is specified - see \ref SSec_Options.
+ *
+ * Due to the host's need for exclusive access to the filesystem, the device will not log samples while connected to a host.
+ * For the logger to store data, the Dataflash must first be formatted by the host so that it contains a valid FAT filesystem.
+ *
+ * This project uses the FatFS library from ELM Chan (http://elm-chan.org/fsw/ff/00index_e.html) and the .NET HID device library
+ * LibHIDNet (http://sourceforge.net/projects/libhidnet/).
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>DUMMY_RTC</td>
+ * <td>Makefile CDEFS</td>
+ * <td>When a DS1307 RTC chip is not fitted, this token can be defined to make the demo assume a 1/1/1 01:01:01 date/time
+ * stamp at all times, effectively transforming the project into a basic data logger with no specified sample times.</td>
+ * </tr>
+ * </table>
+ */
diff --git a/Projects/TemperatureDataLogger/makefile b/Projects/TemperatureDataLogger/makefile
index c06577ad7..c1787710a 100644
--- a/Projects/TemperatureDataLogger/makefile
+++ b/Projects/TemperatureDataLogger/makefile
@@ -1,748 +1,748 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = TempDataLogger
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- Lib/DataflashManager.c \
- Lib/SCSI.c \
- Lib/DS1307.c \
- Lib/FATFs/diskio.c \
- Lib/FATFs/ff.c \
- $(LUFA_PATH)/LUFA/Drivers/Board/Temperature.c \
- $(LUFA_PATH)/LUFA/Drivers/Peripheral/TWI.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-CDEFS += -DDUMMY_RTC
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = TempDataLogger
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ Lib/DataflashManager.c \
+ Lib/SCSI.c \
+ Lib/DS1307.c \
+ Lib/FATFs/diskio.c \
+ Lib/FATFs/ff.c \
+ $(LUFA_PATH)/LUFA/Drivers/Board/Temperature.c \
+ $(LUFA_PATH)/LUFA/Drivers/Peripheral/TWI.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+CDEFS += -DDUMMY_RTC
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/USBtoSerial/Descriptors.c b/Projects/USBtoSerial/Descriptors.c
index 9343b92c0..202c3e3fe 100644
--- a/Projects/USBtoSerial/Descriptors.c
+++ b/Projects/USBtoSerial/Descriptors.c
@@ -1,267 +1,267 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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"
-
-/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
- * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
- * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
- * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
- * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
- * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
- * port location).
- */
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x02,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x204B,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .CDC_CCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 1,
-
- .Class = 0x02,
- .SubClass = 0x02,
- .Protocol = 0x01,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_Functional_IntHeader =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x00,
-
- .Data = {0x01, 0x10}
- },
-
- .CDC_Functional_AbstractControlManagement =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
- .SubType = 0x02,
-
- .Data = {0x06}
- },
-
- .CDC_Functional_Union=
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x06,
-
- .Data = {0x00, 0x01}
- },
-
- .CDC_ManagementEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_NOTIFICATION_EPSIZE,
- .PollingIntervalMS = 0xFF
- },
-
- .CDC_DCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 1,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x0A,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .CDC_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA USB-RS232 Adapter"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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"
+
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x02,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x204B,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .CDC_CCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 1,
+
+ .Class = 0x02,
+ .SubClass = 0x02,
+ .Protocol = 0x01,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_Functional_IntHeader =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x00,
+
+ .Data = {0x01, 0x10}
+ },
+
+ .CDC_Functional_AbstractControlManagement =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
+ .SubType = 0x02,
+
+ .Data = {0x06}
+ },
+
+ .CDC_Functional_Union=
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x06,
+
+ .Data = {0x00, 0x01}
+ },
+
+ .CDC_ManagementEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .PollingIntervalMS = 0xFF
+ },
+
+ .CDC_DCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 1,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x0A,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .CDC_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA USB-RS232 Adapter"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/USBtoSerial/Descriptors.h b/Projects/USBtoSerial/Descriptors.h
index 45bab84d9..e00c5e2ed 100644
--- a/Projects/USBtoSerial/Descriptors.h
+++ b/Projects/USBtoSerial/Descriptors.h
@@ -1,83 +1,83 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Macros: */
- /** Endpoint number of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPNUM 2
-
- /** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
-
- /** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
-
- /** Size in bytes of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPSIZE 8
-
- /** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t CDC_CCI_Interface;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
- CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
- USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
- USB_Descriptor_Interface_t CDC_DCI_Interface;
- USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
- USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Macros: */
+ /** Endpoint number of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPNUM 2
+
+ /** Endpoint number of the CDC device-to-host data IN endpoint. */
+ #define CDC_TX_EPNUM 3
+
+ /** Endpoint number of the CDC host-to-device data OUT endpoint. */
+ #define CDC_RX_EPNUM 4
+
+ /** Size in bytes of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPSIZE 8
+
+ /** Size in bytes of the CDC data IN and OUT endpoints. */
+ #define CDC_TXRX_EPSIZE 16
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t CDC_CCI_Interface;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
+ CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
+ USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
+ USB_Descriptor_Interface_t CDC_DCI_Interface;
+ USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
+ USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/USBtoSerial/Doxygen.conf b/Projects/USBtoSerial/Doxygen.conf
index 697bf8a2f..e0ffac9bd 100644
--- a/Projects/USBtoSerial/Doxygen.conf
+++ b/Projects/USBtoSerial/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "LUFA Library - USB to Serial Device Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "LUFA Library - USB to Serial Device Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/USBtoSerial/LUFA USBtoSerial.inf b/Projects/USBtoSerial/LUFA USBtoSerial.inf
index 9a0a0e418..5f9bc1a3d 100644
--- a/Projects/USBtoSerial/LUFA USBtoSerial.inf
+++ b/Projects/USBtoSerial/LUFA USBtoSerial.inf
@@ -1,106 +1,106 @@
-;************************************************************
-; Windows USB CDC ACM Setup File
-; Copyright (c) 2000 Microsoft Corporation
-
-
-[Version]
-Signature="$Windows NT$"
-Class=Ports
-ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
-Provider=%MFGNAME%
-LayoutFile=layout.inf
-CatalogFile=%MFGFILENAME%.cat
-DriverVer=11/15/2007,5.1.2600.0
-
-[Manufacturer]
-%MFGNAME%=DeviceList, NTamd64
-
-[DestinationDirs]
-DefaultDestDir=12
-
-
-;------------------------------------------------------------------------------
-; Windows 2000/XP/Vista-32bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.nt]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.nt
-AddReg=DriverInstall.nt.AddReg
-
-[DriverCopyFiles.nt]
-usbser.sys,,,0x20
-
-[DriverInstall.nt.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.nt.Services]
-AddService=usbser, 0x00000002, DriverService.nt
-
-[DriverService.nt]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-;------------------------------------------------------------------------------
-; Vista-64bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.NTamd64]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.NTamd64
-AddReg=DriverInstall.NTamd64.AddReg
-
-[DriverCopyFiles.NTamd64]
-%DRIVERFILENAME%.sys,,,0x20
-
-[DriverInstall.NTamd64.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.NTamd64.Services]
-AddService=usbser, 0x00000002, DriverService.NTamd64
-
-[DriverService.NTamd64]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-
-;------------------------------------------------------------------------------
-; Vendor and Product ID Definitions
-;------------------------------------------------------------------------------
-; When developing your USB device, the VID and PID used in the PC side
-; application program and the firmware on the microcontroller must match.
-; Modify the below line to use your VID and PID. Use the format as shown below.
-; Note: One INF file can be used for multiple devices with different VID and PIDs.
-; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
-;------------------------------------------------------------------------------
-[SourceDisksFiles]
-[SourceDisksNames]
-[DeviceList]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
-
-[DeviceList.NTamd64]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
-
-
-;------------------------------------------------------------------------------
-; String Definitions
-;------------------------------------------------------------------------------
-;Modify these strings to customize your device
-;------------------------------------------------------------------------------
-[Strings]
-MFGFILENAME="CDC_vista"
-DRIVERFILENAME ="usbser"
-MFGNAME="http://www.fourwalledcubicle.com"
-INSTDISK="LUFA USB-RS232 CDC Driver Installer"
-DESCRIPTION="Communications Port"
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+; Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+; Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+; Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID. Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
+
+
+;------------------------------------------------------------------------------
+; String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="http://www.fourwalledcubicle.com"
+INSTDISK="LUFA USB-RS232 CDC Driver Installer"
+DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file
diff --git a/Projects/USBtoSerial/Lib/RingBuff.c b/Projects/USBtoSerial/Lib/RingBuff.c
index 2109f8cc0..91c61d06b 100644
--- a/Projects/USBtoSerial/Lib/RingBuff.c
+++ b/Projects/USBtoSerial/Lib/RingBuff.c
@@ -1,120 +1,120 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "RingBuff.h"
-
-void Buffer_Initialize(RingBuff_t* const Buffer)
-{
- BUFF_ATOMIC_BLOCK
- {
- Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- Buffer->Elements = 0;
- }
-}
-
-void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
-{
- BUFF_ATOMIC_BLOCK
- {
- #if defined(BUFF_DROPOLD)
- if (Buffer->Elements == BUFF_LENGTH)
- {
- Buffer->OutPtr++;
-
- if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
- else
- {
- Buffer->Elements++;
- }
- #elif defined(BUFF_DROPNEW)
- if (Buffer->Elements == BUFF_LENGTH)
- return;
-
- Buffer->Elements++;
- #elif defined(BUFF_NODROPCHECK)
- Buffer->Elements++;
- #endif
-
- *(Buffer->InPtr) = Data;
- Buffer->InPtr++;
-
- if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
-}
-
-RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
-{
- RingBuff_Data_t BuffData;
-
- BUFF_ATOMIC_BLOCK
- {
-#if defined(BUFF_EMPTYRETURNSZERO)
- if (!(Buffer->Elements))
- return 0;
-#elif !defined(BUFF_NOEMPTYCHECK)
- #error No empty buffer check behavior specified.
-#endif
-
- BuffData = *(Buffer->OutPtr);
-
- Buffer->OutPtr++;
- Buffer->Elements--;
-
- if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
-
- return BuffData;
-}
-
-#if defined(BUFF_USEPEEK)
-RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
-{
- RingBuff_Data_t BuffData;
-
- BUFF_ATOMIC_BLOCK
- {
-#if defined(BUFF_EMPTYRETURNSZERO)
- if (!(Buffer->Elements))
- return 0;
-#elif !defined(BUFF_NOEMPTYCHECK)
- #error No empty buffer check behavior specified.
-#endif
-
- BuffData = *(Buffer->OutPtr);
- }
-
- return BuffData;
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "RingBuff.h"
+
+void Buffer_Initialize(RingBuff_t* const Buffer)
+{
+ BUFF_ATOMIC_BLOCK
+ {
+ Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ Buffer->Elements = 0;
+ }
+}
+
+void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
+{
+ BUFF_ATOMIC_BLOCK
+ {
+ #if defined(BUFF_DROPOLD)
+ if (Buffer->Elements == BUFF_LENGTH)
+ {
+ Buffer->OutPtr++;
+
+ if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+ else
+ {
+ Buffer->Elements++;
+ }
+ #elif defined(BUFF_DROPNEW)
+ if (Buffer->Elements == BUFF_LENGTH)
+ return;
+
+ Buffer->Elements++;
+ #elif defined(BUFF_NODROPCHECK)
+ Buffer->Elements++;
+ #endif
+
+ *(Buffer->InPtr) = Data;
+ Buffer->InPtr++;
+
+ if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+}
+
+RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
+{
+ RingBuff_Data_t BuffData;
+
+ BUFF_ATOMIC_BLOCK
+ {
+#if defined(BUFF_EMPTYRETURNSZERO)
+ if (!(Buffer->Elements))
+ return 0;
+#elif !defined(BUFF_NOEMPTYCHECK)
+ #error No empty buffer check behavior specified.
+#endif
+
+ BuffData = *(Buffer->OutPtr);
+
+ Buffer->OutPtr++;
+ Buffer->Elements--;
+
+ if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+
+ return BuffData;
+}
+
+#if defined(BUFF_USEPEEK)
+RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
+{
+ RingBuff_Data_t BuffData;
+
+ BUFF_ATOMIC_BLOCK
+ {
+#if defined(BUFF_EMPTYRETURNSZERO)
+ if (!(Buffer->Elements))
+ return 0;
+#elif !defined(BUFF_NOEMPTYCHECK)
+ #error No empty buffer check behavior specified.
+#endif
+
+ BuffData = *(Buffer->OutPtr);
+ }
+
+ return BuffData;
+}
+#endif
diff --git a/Projects/USBtoSerial/Lib/RingBuff.h b/Projects/USBtoSerial/Lib/RingBuff.h
index 2e03a28be..b4933aa4d 100644
--- a/Projects/USBtoSerial/Lib/RingBuff.h
+++ b/Projects/USBtoSerial/Lib/RingBuff.h
@@ -1,116 +1,116 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/* Buffer Configuration: */
- /* Buffer length - select static size of created ring buffers: */
- #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
-
- /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
- #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
-
- /* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
- #define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
- // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
- // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
-
- /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
- //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
- #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
-
- /* Buffer storage type - set the datatype for the stored data */
- #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
-
- /* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
- //#define BUFF_USEPEEK
-
-#ifndef _RINGBUFF_H_
-#define _RINGBUFF_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/atomic.h>
- #include <limits.h>
-
- #include <LUFA/Common/Common.h>
-
- /* Defines and checks: */
- #if defined(BUFF_STATICSIZE)
- #define BUFF_LENGTH BUFF_STATICSIZE
- #else
- #error No buffer length specified!
- #endif
-
- #if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
- #error No buffer drop mode specified.
- #endif
-
- #if !defined(BUFF_DATATYPE)
- #error Ringbuffer storage data type not specified.
- #endif
-
- #if defined(BUFF_VOLATILE)
- #define BUFF_MODE volatile
- #define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- #else
- #define BUFF_MODE
- #define BUFF_ATOMIC_BLOCK
- #endif
-
- #if (BUFF_STATICSIZE > LONG_MAX)
- #define RingBuff_Elements_t uint64_t
- #elif (BUFF_STATICSIZE > INT_MAX)
- #define RingBuff_Elements_t uint32_t
- #elif (BUFF_STATICSIZE > CHAR_MAX)
- #define RingBuff_Elements_t uint16_t
- #else
- #define RingBuff_Elements_t uint8_t
- #endif
-
- /* Type Defines: */
- typedef BUFF_DATATYPE RingBuff_Data_t;
-
- typedef BUFF_MODE struct
- {
- RingBuff_Data_t Buffer[BUFF_LENGTH];
- RingBuff_Data_t* InPtr;
- RingBuff_Data_t* OutPtr;
- RingBuff_Elements_t Elements;
- } RingBuff_t;
-
- /* Function Prototypes: */
- void Buffer_Initialize(RingBuff_t* const Buff);
- void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
- RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
- #if defined(BUFF_USEPEEK)
- RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/* Buffer Configuration: */
+ /* Buffer length - select static size of created ring buffers: */
+ #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
+
+ /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
+ #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
+
+ /* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
+ #define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
+ // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
+ // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
+
+ /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
+ //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
+ #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
+
+ /* Buffer storage type - set the datatype for the stored data */
+ #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
+
+ /* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
+ //#define BUFF_USEPEEK
+
+#ifndef _RINGBUFF_H_
+#define _RINGBUFF_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include <util/atomic.h>
+ #include <limits.h>
+
+ #include <LUFA/Common/Common.h>
+
+ /* Defines and checks: */
+ #if defined(BUFF_STATICSIZE)
+ #define BUFF_LENGTH BUFF_STATICSIZE
+ #else
+ #error No buffer length specified!
+ #endif
+
+ #if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
+ #error No buffer drop mode specified.
+ #endif
+
+ #if !defined(BUFF_DATATYPE)
+ #error Ringbuffer storage data type not specified.
+ #endif
+
+ #if defined(BUFF_VOLATILE)
+ #define BUFF_MODE volatile
+ #define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ #else
+ #define BUFF_MODE
+ #define BUFF_ATOMIC_BLOCK
+ #endif
+
+ #if (BUFF_STATICSIZE > LONG_MAX)
+ #define RingBuff_Elements_t uint64_t
+ #elif (BUFF_STATICSIZE > INT_MAX)
+ #define RingBuff_Elements_t uint32_t
+ #elif (BUFF_STATICSIZE > CHAR_MAX)
+ #define RingBuff_Elements_t uint16_t
+ #else
+ #define RingBuff_Elements_t uint8_t
+ #endif
+
+ /* Type Defines: */
+ typedef BUFF_DATATYPE RingBuff_Data_t;
+
+ typedef BUFF_MODE struct
+ {
+ RingBuff_Data_t Buffer[BUFF_LENGTH];
+ RingBuff_Data_t* InPtr;
+ RingBuff_Data_t* OutPtr;
+ RingBuff_Elements_t Elements;
+ } RingBuff_t;
+
+ /* Function Prototypes: */
+ void Buffer_Initialize(RingBuff_t* const Buff);
+ void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
+ RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
+ #if defined(BUFF_USEPEEK)
+ RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
+ #endif
+
+#endif
diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c
index 1b4cab289..dd9a133c3 100644
--- a/Projects/USBtoSerial/USBtoSerial.c
+++ b/Projects/USBtoSerial/USBtoSerial.c
@@ -1,198 +1,198 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 USBtoSerial project. This file contains the main tasks of
- * the demo and is responsible for the initial application hardware configuration.
- */
-
-#include "USBtoSerial.h"
-
-/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
-RingBuff_t USBtoUSART_Buffer;
-
-/** Circular buffer to hold data from the serial port before it is sent to the host. */
-RingBuff_t USARTtoUSB_Buffer;
-
-/** LUFA CDC Class driver interface configuration and state information. This structure is
- * passed to all CDC Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
- {
- .Config =
- {
- .ControlInterfaceNumber = 0,
-
- .DataINEndpointNumber = CDC_TX_EPNUM,
- .DataINEndpointSize = CDC_TXRX_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = CDC_RX_EPNUM,
- .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
- .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
- .NotificationEndpointDoubleBank = false,
- },
- };
-
-/** 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();
-
- Buffer_Initialize(&USBtoUSART_Buffer);
- Buffer_Initialize(&USARTtoUSB_Buffer);
-
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- sei();
-
- for (;;)
- {
- /* Read bytes from the USB OUT endpoint into the USART transmit buffer */
- for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
- {
- if (!(BUFF_STATICSIZE - USBtoUSART_Buffer.Elements))
- break;
-
- Buffer_StoreElement(&USBtoUSART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
- }
-
- /* Read bytes from the USART receive buffer into the USB IN endpoint */
- while (USARTtoUSB_Buffer.Elements)
- CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&USARTtoUSB_Buffer));
-
- /* Load bytes from the USART transmit buffer into the USART */
- while (USBtoUSART_Buffer.Elements)
- Serial_TxByte(Buffer_GetElement(&USBtoUSART_Buffer));
-
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- Serial_Init(9600, false);
- LEDs_Init();
- USB_Init();
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
-}
-
-/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer
- * for later transmission to the host.
- */
-ISR(USART1_RX_vect, ISR_BLOCK)
-{
- uint8_t ReceivedByte = UDR1;
-
- if (USB_DeviceState == DEVICE_STATE_Configured)
- Buffer_StoreElement(&USARTtoUSB_Buffer, ReceivedByte);
-}
-
-/** Event handler for the CDC Class driver Line Encoding Changed event.
- *
- * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
- */
-void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
-{
- uint8_t ConfigMask = 0;
-
- switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
- {
- case CDC_PARITY_Odd:
- ConfigMask = ((1 << UPM11) | (1 << UPM10));
- break;
- case CDC_PARITY_Even:
- ConfigMask = (1 << UPM11);
- break;
- }
-
- if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits)
- ConfigMask |= (1 << USBS1);
-
- switch (CDCInterfaceInfo->State.LineEncoding.DataBits)
- {
- case 6:
- ConfigMask |= (1 << UCSZ10);
- break;
- case 7:
- ConfigMask |= (1 << UCSZ11);
- break;
- case 8:
- ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10));
- break;
- }
-
- UCSR1A = (1 << U2X1);
- UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
- UCSR1C = ConfigMask;
- UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 USBtoSerial project. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
+#include "USBtoSerial.h"
+
+/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
+RingBuff_t USBtoUSART_Buffer;
+
+/** Circular buffer to hold data from the serial port before it is sent to the host. */
+RingBuff_t USARTtoUSB_Buffer;
+
+/** LUFA CDC Class driver interface configuration and state information. This structure is
+ * passed to all CDC Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
+ {
+ .Config =
+ {
+ .ControlInterfaceNumber = 0,
+
+ .DataINEndpointNumber = CDC_TX_EPNUM,
+ .DataINEndpointSize = CDC_TXRX_EPSIZE,
+ .DataINEndpointDoubleBank = false,
+
+ .DataOUTEndpointNumber = CDC_RX_EPNUM,
+ .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
+ .DataOUTEndpointDoubleBank = false,
+
+ .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
+ .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .NotificationEndpointDoubleBank = false,
+ },
+ };
+
+/** 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();
+
+ Buffer_Initialize(&USBtoUSART_Buffer);
+ Buffer_Initialize(&USARTtoUSB_Buffer);
+
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ sei();
+
+ for (;;)
+ {
+ /* Read bytes from the USB OUT endpoint into the USART transmit buffer */
+ for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
+ {
+ if (!(BUFF_STATICSIZE - USBtoUSART_Buffer.Elements))
+ break;
+
+ Buffer_StoreElement(&USBtoUSART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
+ }
+
+ /* Read bytes from the USART receive buffer into the USB IN endpoint */
+ while (USARTtoUSB_Buffer.Elements)
+ CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&USARTtoUSB_Buffer));
+
+ /* Load bytes from the USART transmit buffer into the USART */
+ while (USBtoUSART_Buffer.Elements)
+ Serial_TxByte(Buffer_GetElement(&USBtoUSART_Buffer));
+
+ CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ Serial_Init(9600, false);
+ LEDs_Init();
+ USB_Init();
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
+}
+
+/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer
+ * for later transmission to the host.
+ */
+ISR(USART1_RX_vect, ISR_BLOCK)
+{
+ uint8_t ReceivedByte = UDR1;
+
+ if (USB_DeviceState == DEVICE_STATE_Configured)
+ Buffer_StoreElement(&USARTtoUSB_Buffer, ReceivedByte);
+}
+
+/** Event handler for the CDC Class driver Line Encoding Changed event.
+ *
+ * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
+ */
+void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
+{
+ uint8_t ConfigMask = 0;
+
+ switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
+ {
+ case CDC_PARITY_Odd:
+ ConfigMask = ((1 << UPM11) | (1 << UPM10));
+ break;
+ case CDC_PARITY_Even:
+ ConfigMask = (1 << UPM11);
+ break;
+ }
+
+ if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits)
+ ConfigMask |= (1 << USBS1);
+
+ switch (CDCInterfaceInfo->State.LineEncoding.DataBits)
+ {
+ case 6:
+ ConfigMask |= (1 << UCSZ10);
+ break;
+ case 7:
+ ConfigMask |= (1 << UCSZ11);
+ break;
+ case 8:
+ ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10));
+ break;
+ }
+
+ UCSR1A = (1 << U2X1);
+ UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
+ UCSR1C = ConfigMask;
+ UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
+}
diff --git a/Projects/USBtoSerial/USBtoSerial.h b/Projects/USBtoSerial/USBtoSerial.h
index 77ceefbf6..92ec055b3 100644
--- a/Projects/USBtoSerial/USBtoSerial.h
+++ b/Projects/USBtoSerial/USBtoSerial.h
@@ -1,78 +1,78 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 USBtoSerial.c.
- */
-
-#ifndef _USB_SERIAL_H_
-#define _USB_SERIAL_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/interrupt.h>
- #include <avr/power.h>
-
- #include "Descriptors.h"
-
- #include "Lib/RingBuff.h"
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/Peripheral/Serial.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* 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)
-
- /* 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_UnhandledControlRequest(void);
-
- void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 USBtoSerial.c.
+ */
+
+#ifndef _USB_SERIAL_H_
+#define _USB_SERIAL_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/interrupt.h>
+ #include <avr/power.h>
+
+ #include "Descriptors.h"
+
+ #include "Lib/RingBuff.h"
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/Peripheral/Serial.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* 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)
+
+ /* 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_UnhandledControlRequest(void);
+
+ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
+
+#endif
diff --git a/Projects/USBtoSerial/USBtoSerial.txt b/Projects/USBtoSerial/USBtoSerial.txt
index 10f0003c6..e10b359bd 100644
--- a/Projects/USBtoSerial/USBtoSerial.txt
+++ b/Projects/USBtoSerial/USBtoSerial.txt
@@ -1,82 +1,82 @@
-/** \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 USB to Serial Converter Project
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - Series 7 USB AVRs
- * - Series 6 USB AVRs
- * - Series 4 USB AVRs
- * - Series 2 USB AVRs
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Communications Device Class (CDC)</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>Abstract Control Model (ACM)</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>USBIF CDC Class Standard</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * USB to Serial bridge project. This project allows a USB AVR to serve
- * as a USB to USART bridge between a USB host and a device lacking a
- * USB port. When programmed into a USB AVR, the AVR will enumerate as a
- * virtual COM port.
- *
- * The AVR's hardware USART's settings will change to mirror as closely as
- * possible the serial settings set on the host. However, due to hardware
- * limitations, some options may not be supported (baud rates with unacceptable
- * error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,
- * 1.5 stop bits, parity other than none, even or odd).
- *
- * After running this project for the first time on a new computer,
- * you will need to supply the .INF file located in this project
- * project's directory as the device's driver when running under
- * Windows. This will enable Windows to use its inbuilt CDC drivers,
- * negating the need for custom drivers for the device. Other
- * Operating Systems should automatically use their own inbuilt
- * CDC-ACM drivers.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>BUFF_STATICSIZE</td>
- * <td>RingBuff.h</td>
- * <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>
- * </tr>
- * </table>
+/** \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 USB to Serial Converter Project
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - Series 7 USB AVRs
+ * - Series 6 USB AVRs
+ * - Series 4 USB AVRs
+ * - Series 2 USB AVRs
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Communications Device Class (CDC)</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>Abstract Control Model (ACM)</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>USBIF CDC Class Standard</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * USB to Serial bridge project. This project allows a USB AVR to serve
+ * as a USB to USART bridge between a USB host and a device lacking a
+ * USB port. When programmed into a USB AVR, the AVR will enumerate as a
+ * virtual COM port.
+ *
+ * The AVR's hardware USART's settings will change to mirror as closely as
+ * possible the serial settings set on the host. However, due to hardware
+ * limitations, some options may not be supported (baud rates with unacceptable
+ * error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,
+ * 1.5 stop bits, parity other than none, even or odd).
+ *
+ * After running this project for the first time on a new computer,
+ * you will need to supply the .INF file located in this project
+ * project's directory as the device's driver when running under
+ * Windows. This will enable Windows to use its inbuilt CDC drivers,
+ * negating the need for custom drivers for the device. Other
+ * Operating Systems should automatically use their own inbuilt
+ * CDC-ACM drivers.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>BUFF_STATICSIZE</td>
+ * <td>RingBuff.h</td>
+ * <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>
+ * </tr>
+ * </table>
*/ \ No newline at end of file
diff --git a/Projects/USBtoSerial/makefile b/Projects/USBtoSerial/makefile
index e40246eca..9d34457b5 100644
--- a/Projects/USBtoSerial/makefile
+++ b/Projects/USBtoSerial/makefile
@@ -1,739 +1,739 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = USBtoSerial
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../..
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- Lib/RingBuff.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = USBtoSerial
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../..
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ Lib/RingBuff.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c
index 72adec35f..0b134c0ad 100644
--- a/Projects/Webserver/Descriptors.c
+++ b/Projects/Webserver/Descriptors.c
@@ -1,217 +1,217 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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"
-
-/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
- * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
- * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
- * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
- * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
- * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
- * port location).
- */
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x00,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2045,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-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 = 1,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .MS_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x08,
- .SubClass = 0x06,
- .Protocol = 0x50,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .MS_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MASS_STORAGE_IO_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .MS_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = MASS_STORAGE_IO_EPSIZE,
- .PollingIntervalMS = 0x00
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA Webserver"
-};
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&LanguageString;
- Size = pgm_read_byte(&LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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"
+
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x00,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2045,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+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 = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .MS_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x08,
+ .SubClass = 0x06,
+ .Protocol = 0x50,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .MS_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .MS_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .PollingIntervalMS = 0x00
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA Webserver"
+};
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h
index e249fc479..a13ee013f 100644
--- a/Projects/Webserver/Descriptors.h
+++ b/Projects/Webserver/Descriptors.h
@@ -1,72 +1,72 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header file for Descriptors.c.
- */
-
-#ifndef _DESCRIPTORS_H_
-#define _DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- /* Macros: */
- /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
-
- /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
-
- /** Size in bytes of the Mass Storage data endpoints. */
- #define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t MS_Interface;
- USB_Descriptor_Endpoint_t MS_DataInEndpoint;
- USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
- } USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ /* Macros: */
+ /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
+ #define MASS_STORAGE_IN_EPNUM 3
+
+ /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
+ #define MASS_STORAGE_OUT_EPNUM 4
+
+ /** Size in bytes of the Mass Storage data endpoints. */
+ #define MASS_STORAGE_IO_EPSIZE 64
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t MS_Interface;
+ USB_Descriptor_Endpoint_t MS_DataInEndpoint;
+ USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
diff --git a/Projects/Webserver/Doxygen.conf b/Projects/Webserver/Doxygen.conf
index dd0be3e6e..0d3c83cf5 100644
--- a/Projects/Webserver/Doxygen.conf
+++ b/Projects/Webserver/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "LUFA Library - uIP Powered Webserver Project"
-
-# 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS = */uip/* */FATFs/*
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "LUFA Library - uIP Powered Webserver Project"
+
+# 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */uip/* */FATFs/*
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/Webserver/Lib/DHCPClientApp.c b/Projects/Webserver/Lib/DHCPClientApp.c
index 9d085a785..7f822538e 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.c
+++ b/Projects/Webserver/Lib/DHCPClientApp.c
@@ -1,264 +1,264 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#if defined(ENABLE_DHCP_CLIENT) || defined(__DOXYGEN__)
-
-/** \file
- *
- * DHCP Client Application. When connected to the uIP stack, this will retrieve IP configuration settings from the
- * DHCP server on the network.
- */
-
-#define INCLUDE_FROM_DHCPCLIENTAPP_C
-#include "DHCPClientApp.h"
-
-/** Initialization function for the DHCP client. */
-void DHCPClientApp_Init(void)
-{
- /* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
- struct uip_udp_conn* Connection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCPC_SERVER_PORT));
-
- /* If the connection was successfully created, bind it to the local DHCP client port */
- if (Connection != NULL)
- {
- uip_udp_appstate_t* const AppState = &Connection->appstate;
- uip_udp_bind(Connection, HTONS(DHCPC_CLIENT_PORT));
-
- /* Set the initial client state */
- AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
-
- /* Set timeout period to half a second for a DHCP server to respond */
- timer_set(&AppState->DHCPClient.Timeout, CLOCK_SECOND / 2);
- }
-}
-
-/** uIP stack application callback for the DHCP client. This function must be called each time the TCP/IP stack
- * needs a UDP packet to be processed.
- */
-void DHCPClientApp_Callback(void)
-{
- uip_udp_appstate_t* const AppState = &uip_udp_conn->appstate;
- DHCP_Header_t* const AppData = (DHCP_Header_t*)uip_appdata;
- uint16_t AppDataSize = 0;
-
- switch (AppState->DHCPClient.CurrentState)
- {
- case DHCP_STATE_SendDiscover:
- /* Clear all DHCP settings, reset client IP address */
- memset(&AppState->DHCPClient.DHCPOffer_Data, 0x00, sizeof(AppState->DHCPClient.DHCPOffer_Data));
- uip_sethostaddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
-
- /* Fill out the DHCP response header */
- AppDataSize += DHCPClientApp_FillDHCPHeader(AppData, DHCP_DISCOVER, AppState);
-
- /* Add the required DHCP options list to the packet */
- uint8_t RequiredOptionList[] = {DHCP_OPTION_SUBNET_MASK, DHCP_OPTION_ROUTER, DHCP_OPTION_DNS_SERVER};
- AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_REQ_LIST, sizeof(RequiredOptionList),
- RequiredOptionList);
-
- /* Send the DHCP DISCOVER packet */
- uip_udp_send(AppDataSize);
-
- /* Reset the timeout timer, progress to next state */
- timer_reset(&AppState->DHCPClient.Timeout);
- AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForOffer;
-
- break;
- case DHCP_STATE_WaitForOffer:
- if (!(uip_newdata()))
- {
- /* Check if the DHCP timeout period has expired while waiting for a response */
- if (timer_expired(&AppState->DHCPClient.Timeout))
- AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
-
- break;
- }
-
- uint8_t OfferResponse_MessageType;
- if ((AppData->TransactionID == DHCP_TRANSACTION_ID) &&
- DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_MSG_TYPE, &OfferResponse_MessageType) &&
- (OfferResponse_MessageType == DHCP_OFFER))
- {
- /* Received a DHCP offer for an IP address, copy over values for later request */
- memcpy(&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, &AppData->YourIP, sizeof(uip_ipaddr_t));
- DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_SUBNET_MASK, &AppState->DHCPClient.DHCPOffer_Data.Netmask);
- DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_ROUTER, &AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
- DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_SERVER_ID, &AppState->DHCPClient.DHCPOffer_Data.ServerIP);
-
- timer_reset(&AppState->DHCPClient.Timeout);
- AppState->DHCPClient.CurrentState = DHCP_STATE_SendRequest;
- }
-
- break;
- case DHCP_STATE_SendRequest:
- /* Fill out the DHCP response header */
- AppDataSize += DHCPClientApp_FillDHCPHeader(AppData, DHCP_REQUEST, AppState);
-
- /* Add the DHCP REQUESTED IP ADDRESS option to the packet */
- AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_REQ_IPADDR, sizeof(uip_ipaddr_t),
- &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
-
- /* Add the DHCP SERVER IP ADDRESS option to the packet */
- AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_SERVER_ID, sizeof(uip_ipaddr_t),
- &AppState->DHCPClient.DHCPOffer_Data.ServerIP);
-
- /* Send the DHCP REQUEST packet */
- uip_udp_send(AppDataSize);
-
- /* Reset the timeout timer, progress to next state */
- timer_reset(&AppState->DHCPClient.Timeout);
- AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForACK;
-
- break;
- case DHCP_STATE_WaitForACK:
- if (!(uip_newdata()))
- {
- /* Check if the DHCP timeout period has expired while waiting for a response */
- if (timer_expired(&AppState->DHCPClient.Timeout))
- AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
-
- break;
- }
-
- uint8_t RequestResponse_MessageType;
- if ((AppData->TransactionID == DHCP_TRANSACTION_ID) &&
- DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_MSG_TYPE, &RequestResponse_MessageType) &&
- (RequestResponse_MessageType == DHCP_ACK))
- {
- /* Set the new network parameters from the DHCP server */
- uip_sethostaddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
- uip_setnetmask((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.Netmask);
- uip_setdraddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
-
- /* Indicate to the user that we now have a valid IP configuration */
- HaveIPConfiguration = true;
-
- AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
- }
-
- break;
- }
-}
-
-/** Fills the DHCP packet response with the appropriate BOOTP header for DHCP. This fills out all the required
- * fields, leaving only the additional DHCP options to be added to the packet before it is sent to the DHCP server.
- *
- * \param[out] DHCPHeader Location in the packet buffer where the BOOTP header should be written to
- * \param[in] DHCPMessageType DHCP Message type, such as DHCP_DISCOVER
- * \param[in] AppState Application state of the current UDP connection
- *
- * \return Size in bytes of the created DHCP packet
- */
-static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, const uint8_t DHCPMessageType, uip_udp_appstate_t* AppState)
-{
- /* Erase existing packet data so that we start will all 0x00 DHCP header data */
- memset(DHCPHeader, 0, sizeof(DHCP_Header_t));
-
- /* Fill out the DHCP packet header */
- DHCPHeader->Operation = DHCP_OP_BOOTREQUEST;
- DHCPHeader->HardwareType = DHCP_HTYPE_ETHERNET;
- DHCPHeader->HardwareAddressLength = sizeof(MACAddress);
- DHCPHeader->Hops = 0;
- DHCPHeader->TransactionID = DHCP_TRANSACTION_ID;
- DHCPHeader->ElapsedSeconds = 0;
- DHCPHeader->Flags = HTONS(BOOTP_BROADCAST);
- memcpy(&DHCPHeader->ClientIP, &uip_hostaddr, sizeof(uip_ipaddr_t));
- memcpy(&DHCPHeader->YourIP, &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, sizeof(uip_ipaddr_t));
- memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP, sizeof(uip_ipaddr_t));
- memcpy(&DHCPHeader->ClientHardwareAddress, &MACAddress, sizeof(struct uip_eth_addr));
- DHCPHeader->Cookie = DHCP_MAGIC_COOKIE;
-
- /* Add a DHCP message type and terminator options to the start of the DHCP options field */
- DHCPHeader->Options[0] = DHCP_OPTION_MSG_TYPE;
- DHCPHeader->Options[1] = 1;
- DHCPHeader->Options[2] = DHCPMessageType;
- DHCPHeader->Options[3] = DHCP_OPTION_END;
-
- /* Calculate the total number of bytes added to the outgoing packet */
- return (sizeof(DHCP_Header_t) + 4);
-}
-
-/** Sets the given DHCP option in the DHCP packet's option list. This automatically moves the
- * end of options terminator past the new option in the options list.
- *
- * \param[in,out] DHCPOptionList Pointer to the start of the DHCP packet's options list
- * \param[in] Option DHCP option to add to the list
- * \param[in] DataLen Size in bytes of the option data to add
- * \param[in] OptionData Buffer where the option's data is to be sourced from
- *
- * \return Number of bytes added to the DHCP packet
- */
-static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen, void* OptionData)
-{
- /* Skip through the DHCP options list until the terminator option is found */
- while (*DHCPOptionList != DHCP_OPTION_END)
- DHCPOptionList += (DHCPOptionList[1] + 2);
-
- /* Overwrite the existing terminator with the new option, add a new terminator at the end of the list */
- DHCPOptionList[0] = Option;
- DHCPOptionList[1] = DataLen;
- memcpy(&DHCPOptionList[2], OptionData, DataLen);
- DHCPOptionList[2 + DataLen] = DHCP_OPTION_END;
-
- /* Calculate the total number of bytes added to the outgoing packet */
- return (2 + DataLen);
-}
-
-/** Retrieves the given option's data (if present) from the DHCP packet's options list.
- *
- * \param[in,out] DHCPOptionList Pointer to the start of the DHCP packet's options list
- * \param[in] Option DHCP option to retrieve to the list
- * \param[out] Destination Buffer where the option's data is to be written to if found
- *
- * \return Boolean true if the option was found in the DHCP packet's options list, false otherwise
- */
-static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList, const uint8_t Option, void* const Destination)
-{
- /* Look through the incoming DHCP packet's options list for the requested option */
- while (*DHCPOptionList != DHCP_OPTION_END)
- {
- /* Check if the current DHCP option in the packet is the one requested */
- if (DHCPOptionList[0] == Option)
- {
- /* Copy request option's data to the destination buffer */
- memcpy(Destination, &DHCPOptionList[2], DHCPOptionList[1]);
-
- /* Indicate that the requested option data was successfully retrieved */
- return true;
- }
-
- /* Skip to next DHCP option in the options list */
- DHCPOptionList += (DHCPOptionList[1] + 2);
- }
-
- /* Requested option not found in the incoming packet's DHCP options list */
- return false;
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#if defined(ENABLE_DHCP_CLIENT) || defined(__DOXYGEN__)
+
+/** \file
+ *
+ * DHCP Client Application. When connected to the uIP stack, this will retrieve IP configuration settings from the
+ * DHCP server on the network.
+ */
+
+#define INCLUDE_FROM_DHCPCLIENTAPP_C
+#include "DHCPClientApp.h"
+
+/** Initialization function for the DHCP client. */
+void DHCPClientApp_Init(void)
+{
+ /* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
+ struct uip_udp_conn* Connection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCPC_SERVER_PORT));
+
+ /* If the connection was successfully created, bind it to the local DHCP client port */
+ if (Connection != NULL)
+ {
+ uip_udp_appstate_t* const AppState = &Connection->appstate;
+ uip_udp_bind(Connection, HTONS(DHCPC_CLIENT_PORT));
+
+ /* Set the initial client state */
+ AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
+
+ /* Set timeout period to half a second for a DHCP server to respond */
+ timer_set(&AppState->DHCPClient.Timeout, CLOCK_SECOND / 2);
+ }
+}
+
+/** uIP stack application callback for the DHCP client. This function must be called each time the TCP/IP stack
+ * needs a UDP packet to be processed.
+ */
+void DHCPClientApp_Callback(void)
+{
+ uip_udp_appstate_t* const AppState = &uip_udp_conn->appstate;
+ DHCP_Header_t* const AppData = (DHCP_Header_t*)uip_appdata;
+ uint16_t AppDataSize = 0;
+
+ switch (AppState->DHCPClient.CurrentState)
+ {
+ case DHCP_STATE_SendDiscover:
+ /* Clear all DHCP settings, reset client IP address */
+ memset(&AppState->DHCPClient.DHCPOffer_Data, 0x00, sizeof(AppState->DHCPClient.DHCPOffer_Data));
+ uip_sethostaddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
+
+ /* Fill out the DHCP response header */
+ AppDataSize += DHCPClientApp_FillDHCPHeader(AppData, DHCP_DISCOVER, AppState);
+
+ /* Add the required DHCP options list to the packet */
+ uint8_t RequiredOptionList[] = {DHCP_OPTION_SUBNET_MASK, DHCP_OPTION_ROUTER, DHCP_OPTION_DNS_SERVER};
+ AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_REQ_LIST, sizeof(RequiredOptionList),
+ RequiredOptionList);
+
+ /* Send the DHCP DISCOVER packet */
+ uip_udp_send(AppDataSize);
+
+ /* Reset the timeout timer, progress to next state */
+ timer_reset(&AppState->DHCPClient.Timeout);
+ AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForOffer;
+
+ break;
+ case DHCP_STATE_WaitForOffer:
+ if (!(uip_newdata()))
+ {
+ /* Check if the DHCP timeout period has expired while waiting for a response */
+ if (timer_expired(&AppState->DHCPClient.Timeout))
+ AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
+
+ break;
+ }
+
+ uint8_t OfferResponse_MessageType;
+ if ((AppData->TransactionID == DHCP_TRANSACTION_ID) &&
+ DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_MSG_TYPE, &OfferResponse_MessageType) &&
+ (OfferResponse_MessageType == DHCP_OFFER))
+ {
+ /* Received a DHCP offer for an IP address, copy over values for later request */
+ memcpy(&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, &AppData->YourIP, sizeof(uip_ipaddr_t));
+ DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_SUBNET_MASK, &AppState->DHCPClient.DHCPOffer_Data.Netmask);
+ DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_ROUTER, &AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
+ DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_SERVER_ID, &AppState->DHCPClient.DHCPOffer_Data.ServerIP);
+
+ timer_reset(&AppState->DHCPClient.Timeout);
+ AppState->DHCPClient.CurrentState = DHCP_STATE_SendRequest;
+ }
+
+ break;
+ case DHCP_STATE_SendRequest:
+ /* Fill out the DHCP response header */
+ AppDataSize += DHCPClientApp_FillDHCPHeader(AppData, DHCP_REQUEST, AppState);
+
+ /* Add the DHCP REQUESTED IP ADDRESS option to the packet */
+ AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_REQ_IPADDR, sizeof(uip_ipaddr_t),
+ &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
+
+ /* Add the DHCP SERVER IP ADDRESS option to the packet */
+ AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_SERVER_ID, sizeof(uip_ipaddr_t),
+ &AppState->DHCPClient.DHCPOffer_Data.ServerIP);
+
+ /* Send the DHCP REQUEST packet */
+ uip_udp_send(AppDataSize);
+
+ /* Reset the timeout timer, progress to next state */
+ timer_reset(&AppState->DHCPClient.Timeout);
+ AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForACK;
+
+ break;
+ case DHCP_STATE_WaitForACK:
+ if (!(uip_newdata()))
+ {
+ /* Check if the DHCP timeout period has expired while waiting for a response */
+ if (timer_expired(&AppState->DHCPClient.Timeout))
+ AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
+
+ break;
+ }
+
+ uint8_t RequestResponse_MessageType;
+ if ((AppData->TransactionID == DHCP_TRANSACTION_ID) &&
+ DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_MSG_TYPE, &RequestResponse_MessageType) &&
+ (RequestResponse_MessageType == DHCP_ACK))
+ {
+ /* Set the new network parameters from the DHCP server */
+ uip_sethostaddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
+ uip_setnetmask((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.Netmask);
+ uip_setdraddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
+
+ /* Indicate to the user that we now have a valid IP configuration */
+ HaveIPConfiguration = true;
+
+ AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
+ }
+
+ break;
+ }
+}
+
+/** Fills the DHCP packet response with the appropriate BOOTP header for DHCP. This fills out all the required
+ * fields, leaving only the additional DHCP options to be added to the packet before it is sent to the DHCP server.
+ *
+ * \param[out] DHCPHeader Location in the packet buffer where the BOOTP header should be written to
+ * \param[in] DHCPMessageType DHCP Message type, such as DHCP_DISCOVER
+ * \param[in] AppState Application state of the current UDP connection
+ *
+ * \return Size in bytes of the created DHCP packet
+ */
+static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, const uint8_t DHCPMessageType, uip_udp_appstate_t* AppState)
+{
+ /* Erase existing packet data so that we start will all 0x00 DHCP header data */
+ memset(DHCPHeader, 0, sizeof(DHCP_Header_t));
+
+ /* Fill out the DHCP packet header */
+ DHCPHeader->Operation = DHCP_OP_BOOTREQUEST;
+ DHCPHeader->HardwareType = DHCP_HTYPE_ETHERNET;
+ DHCPHeader->HardwareAddressLength = sizeof(MACAddress);
+ DHCPHeader->Hops = 0;
+ DHCPHeader->TransactionID = DHCP_TRANSACTION_ID;
+ DHCPHeader->ElapsedSeconds = 0;
+ DHCPHeader->Flags = HTONS(BOOTP_BROADCAST);
+ memcpy(&DHCPHeader->ClientIP, &uip_hostaddr, sizeof(uip_ipaddr_t));
+ memcpy(&DHCPHeader->YourIP, &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, sizeof(uip_ipaddr_t));
+ memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP, sizeof(uip_ipaddr_t));
+ memcpy(&DHCPHeader->ClientHardwareAddress, &MACAddress, sizeof(struct uip_eth_addr));
+ DHCPHeader->Cookie = DHCP_MAGIC_COOKIE;
+
+ /* Add a DHCP message type and terminator options to the start of the DHCP options field */
+ DHCPHeader->Options[0] = DHCP_OPTION_MSG_TYPE;
+ DHCPHeader->Options[1] = 1;
+ DHCPHeader->Options[2] = DHCPMessageType;
+ DHCPHeader->Options[3] = DHCP_OPTION_END;
+
+ /* Calculate the total number of bytes added to the outgoing packet */
+ return (sizeof(DHCP_Header_t) + 4);
+}
+
+/** Sets the given DHCP option in the DHCP packet's option list. This automatically moves the
+ * end of options terminator past the new option in the options list.
+ *
+ * \param[in,out] DHCPOptionList Pointer to the start of the DHCP packet's options list
+ * \param[in] Option DHCP option to add to the list
+ * \param[in] DataLen Size in bytes of the option data to add
+ * \param[in] OptionData Buffer where the option's data is to be sourced from
+ *
+ * \return Number of bytes added to the DHCP packet
+ */
+static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen, void* OptionData)
+{
+ /* Skip through the DHCP options list until the terminator option is found */
+ while (*DHCPOptionList != DHCP_OPTION_END)
+ DHCPOptionList += (DHCPOptionList[1] + 2);
+
+ /* Overwrite the existing terminator with the new option, add a new terminator at the end of the list */
+ DHCPOptionList[0] = Option;
+ DHCPOptionList[1] = DataLen;
+ memcpy(&DHCPOptionList[2], OptionData, DataLen);
+ DHCPOptionList[2 + DataLen] = DHCP_OPTION_END;
+
+ /* Calculate the total number of bytes added to the outgoing packet */
+ return (2 + DataLen);
+}
+
+/** Retrieves the given option's data (if present) from the DHCP packet's options list.
+ *
+ * \param[in,out] DHCPOptionList Pointer to the start of the DHCP packet's options list
+ * \param[in] Option DHCP option to retrieve to the list
+ * \param[out] Destination Buffer where the option's data is to be written to if found
+ *
+ * \return Boolean true if the option was found in the DHCP packet's options list, false otherwise
+ */
+static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList, const uint8_t Option, void* const Destination)
+{
+ /* Look through the incoming DHCP packet's options list for the requested option */
+ while (*DHCPOptionList != DHCP_OPTION_END)
+ {
+ /* Check if the current DHCP option in the packet is the one requested */
+ if (DHCPOptionList[0] == Option)
+ {
+ /* Copy request option's data to the destination buffer */
+ memcpy(Destination, &DHCPOptionList[2], DHCPOptionList[1]);
+
+ /* Indicate that the requested option data was successfully retrieved */
+ return true;
+ }
+
+ /* Skip to next DHCP option in the options list */
+ DHCPOptionList += (DHCPOptionList[1] + 2);
+ }
+
+ /* Requested option not found in the incoming packet's DHCP options list */
+ return false;
+}
+#endif
diff --git a/Projects/Webserver/Lib/DHCPClientApp.h b/Projects/Webserver/Lib/DHCPClientApp.h
index fc43f6be5..d52398325 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.h
+++ b/Projects/Webserver/Lib/DHCPClientApp.h
@@ -1,169 +1,169 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 DHCPClientApp.c.
- */
-
-#ifndef _DHCPCLIENT_APP_H_
-#define _DHCPCLIENT_APP_H_
-
- /* Includes: */
- #include <stdio.h>
-
- #include <uip.h>
-
- #include "../Webserver.h"
-
- /* Macros: */
- /** UDP listen port for a BOOTP server */
- #define DHCPC_SERVER_PORT 67
-
- /** UDP listen port for a BOOTP client */
- #define DHCPC_CLIENT_PORT 68
-
- /** BOOTP message type for a BOOTP REQUEST message */
- #define DHCP_OP_BOOTREQUEST 0x01
-
- /** BOOTP message type for a BOOTP REPLY message */
- #define DHCP_OP_BOOTREPLY 0x02
-
- /** BOOTP flag for a BOOTP broadcast message */
- #define BOOTP_BROADCAST 0x8000
-
- /** Magic DHCP cookie for a BOOTP message to identify it as a DHCP message */
- #define DHCP_MAGIC_COOKIE 0x63538263
-
- /** Unique transaction ID used to identify DHCP responses to the client */
- #define DHCP_TRANSACTION_ID 0x13245466
-
- /** DHCP message type for a DISCOVER message */
- #define DHCP_DISCOVER 1
-
- /** DHCP message type for an OFFER message */
- #define DHCP_OFFER 2
-
- /** DHCP message type for a REQUEST message */
- #define DHCP_REQUEST 3
-
- /** DHCP message type for a DECLINE message */
- #define DHCP_DECLINE 4
-
- /** DHCP message type for an ACK message */
- #define DHCP_ACK 5
-
- /** DHCP message type for a NAK message */
- #define DHCP_NAK 6
-
- /** DHCP message type for a RELEASE message */
- #define DHCP_RELEASE 7
-
- /** DHCP medium type for standard Ethernet */
- #define DHCP_HTYPE_ETHERNET 1
-
- /** DHCP message option for the network subnet mask */
- #define DHCP_OPTION_SUBNET_MASK 1
-
- /** DHCP message option for the network gateway IP */
- #define DHCP_OPTION_ROUTER 3
-
- /** DHCP message option for the network DNS server */
- #define DHCP_OPTION_DNS_SERVER 6
-
- /** DHCP message option for the requested client IP address */
- #define DHCP_OPTION_REQ_IPADDR 50
-
- /** DHCP message option for the IP address lease time */
- #define DHCP_OPTION_LEASE_TIME 51
-
- /** DHCP message option for the DHCP message type */
- #define DHCP_OPTION_MSG_TYPE 53
-
- /** DHCP message option for the DHCP server IP */
- #define DHCP_OPTION_SERVER_ID 54
-
- /** DHCP message option for the list of required options from the server */
- #define DHCP_OPTION_REQ_LIST 55
-
- /** DHCP message option for the options list terminator */
- #define DHCP_OPTION_END 255
-
- /* Type Defines: */
- /** Type define for a DHCP packet inside an Ethernet frame. */
- typedef struct
- {
- uint8_t Operation; /**< DHCP operation, either DHCP_OP_BOOTREQUEST or DHCP_OP_BOOTREPLY */
- uint8_t HardwareType; /**< Hardware carrier type constant */
- uint8_t HardwareAddressLength; /**< Length in bytes of a hardware (MAC) address on the network */
- uint8_t Hops; /**< Number of hops required to reach the server, unused */
-
- uint32_t TransactionID; /**< Unique ID of the DHCP packet, for positive matching between sent and received packets */
-
- uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
- uint16_t Flags; /**< BOOTP packet flags */
-
- uip_ipaddr_t ClientIP; /**< Client IP address, if already leased an IP */
- uip_ipaddr_t YourIP; /**< Client IP address */
- uip_ipaddr_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */
- uip_ipaddr_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */
-
- uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */
- uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */
- uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */
-
- uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */
-
- uint8_t Options[]; /** DHCP message options */
- } DHCP_Header_t;
-
- /* Enums: */
- /** States for each DHCP connection to a DHCP client. */
- enum DHCP_States_t
- {
- DHCP_STATE_SendDiscover, /**< Send DISCOVER packet to retrieve DHCP lease offers */
- DHCP_STATE_WaitForOffer, /**< Waiting for OFFER packet giving available DHCP leases */
- DHCP_STATE_SendRequest, /**< Send REQUEST packet to request a DHCP lease */
- DHCP_STATE_WaitForACK, /**< Wait for ACK packet to complete the DHCP lease */
- DHCP_STATE_AddressLeased, /**< DHCP address has been leased from a DHCP server */
- };
-
- /* Function Prototypes: */
- void DHCPClientApp_Init(void);
- void DHCPClientApp_Callback(void);
-
- #if defined(INCLUDE_FROM_DHCPCLIENTAPP_C)
- static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, const uint8_t DHCPMessageType,
- uip_udp_appstate_t* AppState);
- static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen,
- void* OptionData);
- static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList, const uint8_t Option, void* const Destination);
- #endif
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 DHCPClientApp.c.
+ */
+
+#ifndef _DHCPCLIENT_APP_H_
+#define _DHCPCLIENT_APP_H_
+
+ /* Includes: */
+ #include <stdio.h>
+
+ #include <uip.h>
+
+ #include "../Webserver.h"
+
+ /* Macros: */
+ /** UDP listen port for a BOOTP server */
+ #define DHCPC_SERVER_PORT 67
+
+ /** UDP listen port for a BOOTP client */
+ #define DHCPC_CLIENT_PORT 68
+
+ /** BOOTP message type for a BOOTP REQUEST message */
+ #define DHCP_OP_BOOTREQUEST 0x01
+
+ /** BOOTP message type for a BOOTP REPLY message */
+ #define DHCP_OP_BOOTREPLY 0x02
+
+ /** BOOTP flag for a BOOTP broadcast message */
+ #define BOOTP_BROADCAST 0x8000
+
+ /** Magic DHCP cookie for a BOOTP message to identify it as a DHCP message */
+ #define DHCP_MAGIC_COOKIE 0x63538263
+
+ /** Unique transaction ID used to identify DHCP responses to the client */
+ #define DHCP_TRANSACTION_ID 0x13245466
+
+ /** DHCP message type for a DISCOVER message */
+ #define DHCP_DISCOVER 1
+
+ /** DHCP message type for an OFFER message */
+ #define DHCP_OFFER 2
+
+ /** DHCP message type for a REQUEST message */
+ #define DHCP_REQUEST 3
+
+ /** DHCP message type for a DECLINE message */
+ #define DHCP_DECLINE 4
+
+ /** DHCP message type for an ACK message */
+ #define DHCP_ACK 5
+
+ /** DHCP message type for a NAK message */
+ #define DHCP_NAK 6
+
+ /** DHCP message type for a RELEASE message */
+ #define DHCP_RELEASE 7
+
+ /** DHCP medium type for standard Ethernet */
+ #define DHCP_HTYPE_ETHERNET 1
+
+ /** DHCP message option for the network subnet mask */
+ #define DHCP_OPTION_SUBNET_MASK 1
+
+ /** DHCP message option for the network gateway IP */
+ #define DHCP_OPTION_ROUTER 3
+
+ /** DHCP message option for the network DNS server */
+ #define DHCP_OPTION_DNS_SERVER 6
+
+ /** DHCP message option for the requested client IP address */
+ #define DHCP_OPTION_REQ_IPADDR 50
+
+ /** DHCP message option for the IP address lease time */
+ #define DHCP_OPTION_LEASE_TIME 51
+
+ /** DHCP message option for the DHCP message type */
+ #define DHCP_OPTION_MSG_TYPE 53
+
+ /** DHCP message option for the DHCP server IP */
+ #define DHCP_OPTION_SERVER_ID 54
+
+ /** DHCP message option for the list of required options from the server */
+ #define DHCP_OPTION_REQ_LIST 55
+
+ /** DHCP message option for the options list terminator */
+ #define DHCP_OPTION_END 255
+
+ /* Type Defines: */
+ /** Type define for a DHCP packet inside an Ethernet frame. */
+ typedef struct
+ {
+ uint8_t Operation; /**< DHCP operation, either DHCP_OP_BOOTREQUEST or DHCP_OP_BOOTREPLY */
+ uint8_t HardwareType; /**< Hardware carrier type constant */
+ uint8_t HardwareAddressLength; /**< Length in bytes of a hardware (MAC) address on the network */
+ uint8_t Hops; /**< Number of hops required to reach the server, unused */
+
+ uint32_t TransactionID; /**< Unique ID of the DHCP packet, for positive matching between sent and received packets */
+
+ uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
+ uint16_t Flags; /**< BOOTP packet flags */
+
+ uip_ipaddr_t ClientIP; /**< Client IP address, if already leased an IP */
+ uip_ipaddr_t YourIP; /**< Client IP address */
+ uip_ipaddr_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */
+ uip_ipaddr_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */
+
+ uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */
+ uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */
+ uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */
+
+ uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */
+
+ uint8_t Options[]; /** DHCP message options */
+ } DHCP_Header_t;
+
+ /* Enums: */
+ /** States for each DHCP connection to a DHCP client. */
+ enum DHCP_States_t
+ {
+ DHCP_STATE_SendDiscover, /**< Send DISCOVER packet to retrieve DHCP lease offers */
+ DHCP_STATE_WaitForOffer, /**< Waiting for OFFER packet giving available DHCP leases */
+ DHCP_STATE_SendRequest, /**< Send REQUEST packet to request a DHCP lease */
+ DHCP_STATE_WaitForACK, /**< Wait for ACK packet to complete the DHCP lease */
+ DHCP_STATE_AddressLeased, /**< DHCP address has been leased from a DHCP server */
+ };
+
+ /* Function Prototypes: */
+ void DHCPClientApp_Init(void);
+ void DHCPClientApp_Callback(void);
+
+ #if defined(INCLUDE_FROM_DHCPCLIENTAPP_C)
+ static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, const uint8_t DHCPMessageType,
+ uip_udp_appstate_t* AppState);
+ static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen,
+ void* OptionData);
+ static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList, const uint8_t Option, void* const Destination);
+ #endif
+#endif
diff --git a/Projects/Webserver/Lib/DataflashManager.c b/Projects/Webserver/Lib/DataflashManager.c
index da57e7f49..48c4fa7e6 100644
--- a/Projects/Webserver/Lib/DataflashManager.c
+++ b/Projects/Webserver/Lib/DataflashManager.c
@@ -1,525 +1,525 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Functions to manage the physical dataflash media, including reading and writing of
- * blocks of data. These functions are called by the SCSI layer when data must be stored
- * or retrieved to/from the physical storage media. If a different media is used (such
- * as a SD card or EEPROM), functions similar to these will need to be generated.
- */
-
-#define INCLUDE_FROM_DATAFLASHMANAGER_C
-#include "DataflashManager.h"
-
-/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
- * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes
- * them to the dataflash in Dataflash page sized blocks.
- *
- * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
- * \param[in] BlockAddress Data block starting address for the write sequence
- * \param[in] TotalBlocks Number of blocks of data to write
- */
-void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- bool UsingSecondBuffer = false;
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
- /* Wait until endpoint is ready before continuing */
- if (Endpoint_WaitUntilReady())
- return;
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if the endpoint is currently empty */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the current endpoint bank */
- Endpoint_ClearOUT();
-
- /* Wait until the host has sent another packet */
- if (Endpoint_WaitUntilReady())
- return;
- }
-
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
-
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
- if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
- UsingSecondBuffer = !(UsingSecondBuffer);
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
- if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
- }
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
- }
-
- /* Write one 16-byte chunk of data to the dataflash */
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
- Dataflash_SendByte(Endpoint_Read_Byte());
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
-
- /* Check if the current command is being aborted by the host */
- if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
- }
-
- /* Decrement the blocks remaining counter and reset the sub block counter */
- TotalBlocks--;
- }
-
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0x00);
- Dataflash_WaitWhileBusy();
-
- /* If the endpoint is empty, clear it ready for the next packet from the host */
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearOUT();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
- * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash
- * and writes them in OS sized blocks to the endpoint.
- *
- * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
- * \param[in] BlockAddress Data block starting address for the read sequence
- * \param[in] TotalBlocks Number of blocks of data to read
- */
-void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
-
- /* Wait until endpoint is ready before continuing */
- if (Endpoint_WaitUntilReady())
- return;
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if the endpoint is currently full */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the endpoint bank to send its contents to the host */
- Endpoint_ClearIN();
-
- /* Wait until the endpoint is ready for more data */
- if (Endpoint_WaitUntilReady())
- return;
- }
-
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- }
-
- /* Read one 16-byte chunk of data from the dataflash */
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
- Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
-
- /* Check if the current command is being aborted by the host */
- if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
- }
-
- /* Decrement the blocks remaining counter */
- TotalBlocks--;
- }
-
- /* If the endpoint is full, send its contents to the host */
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearIN();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
- * the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the
- * dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the
- * dataflash.
- *
- * \param[in] BlockAddress Data block starting address for the write sequence
- * \param[in] TotalBlocks Number of blocks of data to write
- * \param[in] BufferPtr Pointer to the data source RAM buffer
- */
-void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- bool UsingSecondBuffer = false;
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
-
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
- if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
- UsingSecondBuffer = !(UsingSecondBuffer);
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
-#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
- /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
- if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Copy selected dataflash's current page contents to the dataflash buffer */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_WaitWhileBusy();
- }
-#endif
-
- /* Send the dataflash buffer write command */
- Dataflash_ToggleSelectedChipCS();
- Dataflash_SendByte(DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
- }
-
- /* Write one 16-byte chunk of data to the dataflash */
- for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
- Dataflash_SendByte(*(BufferPtr++));
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
- }
-
- /* Decrement the blocks remaining counter and reset the sub block counter */
- TotalBlocks--;
- }
-
- /* Write the dataflash buffer contents back to the dataflash page */
- Dataflash_WaitWhileBusy();
- Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
- Dataflash_SendAddressBytes(CurrDFPage, 0x00);
- Dataflash_WaitWhileBusy();
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
- * the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash
- * and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read
- * the files stored on the dataflash.
- *
- * \param[in] BlockAddress Data block starting address for the read sequence
- * \param[in] TotalBlocks Number of blocks of data to read
- * \param[out] BufferPtr Pointer to the data destination RAM buffer
- */
-void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
-{
- uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
- uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
- uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
-
- /* Select the correct starting Dataflash IC for the block requested */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
-
- while (TotalBlocks)
- {
- uint8_t BytesInBlockDiv16 = 0;
-
- /* Write an endpoint packet sized data block to the dataflash */
- while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
- {
- /* Check if end of dataflash page reached */
- if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
- {
- /* Reset the dataflash buffer counter, increment the page counter */
- CurrDFPageByteDiv16 = 0;
- CurrDFPage++;
-
- /* Select the next dataflash chip based on the new dataflash page index */
- Dataflash_SelectChipFromPage(CurrDFPage);
-
- /* Send the dataflash main memory page read command */
- Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
- Dataflash_SendAddressBytes(CurrDFPage, 0);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- Dataflash_SendByte(0x00);
- }
-
- /* Read one 16-byte chunk of data from the dataflash */
- for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
- *(BufferPtr++) = Dataflash_ReceiveByte();
-
- /* Increment the dataflash page 16 byte block counter */
- CurrDFPageByteDiv16++;
-
- /* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
- }
-
- /* Decrement the blocks remaining counter */
- TotalBlocks--;
- }
-
- /* Deselect all dataflash chips */
- Dataflash_DeselectChip();
-}
-
-/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */
-void DataflashManager_ResetDataflashProtections(void)
-{
- /* Select first dataflash chip, send the read status register command */
- Dataflash_SelectChip(DATAFLASH_CHIP1);
- Dataflash_SendByte(DF_CMD_GETSTATUS);
-
- /* Check if sector protection is enabled */
- if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
- {
- Dataflash_ToggleSelectedChipCS();
-
- /* Send the commands to disable sector protection */
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
- }
-
- /* Select second dataflash chip (if present on selected board), send read status register command */
- #if (DATAFLASH_TOTALCHIPS == 2)
- Dataflash_SelectChip(DATAFLASH_CHIP2);
- Dataflash_SendByte(DF_CMD_GETSTATUS);
-
- /* Check if sector protection is enabled */
- if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
- {
- Dataflash_ToggleSelectedChipCS();
-
- /* Send the commands to disable sector protection */
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
- Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
- }
- #endif
-
- /* Deselect current dataflash chip */
- Dataflash_DeselectChip();
-}
-
-/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
- *
- * \return Boolean true if all media chips are working, false otherwise
- */
-bool DataflashManager_CheckDataflashOperation(void)
-{
- uint8_t ReturnByte;
-
- /* Test first Dataflash IC is present and responding to commands */
- Dataflash_SelectChip(DATAFLASH_CHIP1);
- Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
- ReturnByte = Dataflash_ReceiveByte();
- Dataflash_DeselectChip();
-
- /* If returned data is invalid, fail the command */
- if (ReturnByte != DF_MANUFACTURER_ATMEL)
- return false;
-
- #if (DATAFLASH_TOTALCHIPS == 2)
- /* Test second Dataflash IC is present and responding to commands */
- Dataflash_SelectChip(DATAFLASH_CHIP2);
- Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
- ReturnByte = Dataflash_ReceiveByte();
- Dataflash_DeselectChip();
-
- /* If returned data is invalid, fail the command */
- if (ReturnByte != DF_MANUFACTURER_ATMEL)
- return false;
- #endif
-
- return true;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Functions to manage the physical dataflash media, including reading and writing of
+ * blocks of data. These functions are called by the SCSI layer when data must be stored
+ * or retrieved to/from the physical storage media. If a different media is used (such
+ * as a SD card or EEPROM), functions similar to these will need to be generated.
+ */
+
+#define INCLUDE_FROM_DATAFLASHMANAGER_C
+#include "DataflashManager.h"
+
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
+ * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes
+ * them to the dataflash in Dataflash page sized blocks.
+ *
+ * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
+ * \param[in] BlockAddress Data block starting address for the write sequence
+ * \param[in] TotalBlocks Number of blocks of data to write
+ */
+void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+ bool UsingSecondBuffer = false;
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, CurrDFPageByte);
+
+ /* Wait until endpoint is ready before continuing */
+ if (Endpoint_WaitUntilReady())
+ return;
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if the endpoint is currently empty */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the current endpoint bank */
+ Endpoint_ClearOUT();
+
+ /* Wait until the host has sent another packet */
+ if (Endpoint_WaitUntilReady())
+ return;
+ }
+
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
+ if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
+ UsingSecondBuffer = !(UsingSecondBuffer);
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
+ if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+ }
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, 0);
+ }
+
+ /* Write one 16-byte chunk of data to the dataflash */
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+ Dataflash_SendByte(Endpoint_Read_Byte());
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+
+ /* Check if the current command is being aborted by the host */
+ if (MSInterfaceInfo->State.IsMassStoreReset)
+ return;
+ }
+
+ /* Decrement the blocks remaining counter and reset the sub block counter */
+ TotalBlocks--;
+ }
+
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0x00);
+ Dataflash_WaitWhileBusy();
+
+ /* If the endpoint is empty, clear it ready for the next packet from the host */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearOUT();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
+ * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash
+ * and writes them in OS sized blocks to the endpoint.
+ *
+ * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state
+ * \param[in] BlockAddress Data block starting address for the read sequence
+ * \param[in] TotalBlocks Number of blocks of data to read
+ */
+void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+
+ /* Wait until endpoint is ready before continuing */
+ if (Endpoint_WaitUntilReady())
+ return;
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if the endpoint is currently full */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the endpoint bank to send its contents to the host */
+ Endpoint_ClearIN();
+
+ /* Wait until the endpoint is ready for more data */
+ if (Endpoint_WaitUntilReady())
+ return;
+ }
+
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ }
+
+ /* Read one 16-byte chunk of data from the dataflash */
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+ Endpoint_Write_Byte(Dataflash_ReceiveByte());
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+
+ /* Check if the current command is being aborted by the host */
+ if (MSInterfaceInfo->State.IsMassStoreReset)
+ return;
+ }
+
+ /* Decrement the blocks remaining counter */
+ TotalBlocks--;
+ }
+
+ /* If the endpoint is full, send its contents to the host */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearIN();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from
+ * the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the
+ * dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the
+ * dataflash.
+ *
+ * \param[in] BlockAddress Data block starting address for the write sequence
+ * \param[in] TotalBlocks Number of blocks of data to write
+ * \param[in] BufferPtr Pointer to the data source RAM buffer
+ */
+void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+ bool UsingSecondBuffer = false;
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, CurrDFPageByte);
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */
+ if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))
+ UsingSecondBuffer = !(UsingSecondBuffer);
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */
+ if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_WaitWhileBusy();
+ }
+#endif
+
+ /* Send the dataflash buffer write command */
+ Dataflash_ToggleSelectedChipCS();
+ Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+ Dataflash_SendAddressBytes(0, 0);
+ }
+
+ /* Write one 16-byte chunk of data to the dataflash */
+ for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
+ Dataflash_SendByte(*(BufferPtr++));
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+ }
+
+ /* Decrement the blocks remaining counter and reset the sub block counter */
+ TotalBlocks--;
+ }
+
+ /* Write the dataflash buffer contents back to the dataflash page */
+ Dataflash_WaitWhileBusy();
+ Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);
+ Dataflash_SendAddressBytes(CurrDFPage, 0x00);
+ Dataflash_WaitWhileBusy();
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into
+ * the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash
+ * and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read
+ * the files stored on the dataflash.
+ *
+ * \param[in] BlockAddress Data block starting address for the read sequence
+ * \param[in] TotalBlocks Number of blocks of data to read
+ * \param[out] BufferPtr Pointer to the data destination RAM buffer
+ */
+void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
+{
+ uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
+ uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
+ uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
+
+ /* Select the correct starting Dataflash IC for the block requested */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+
+ while (TotalBlocks)
+ {
+ uint8_t BytesInBlockDiv16 = 0;
+
+ /* Write an endpoint packet sized data block to the dataflash */
+ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
+ {
+ /* Check if end of dataflash page reached */
+ if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
+ {
+ /* Reset the dataflash buffer counter, increment the page counter */
+ CurrDFPageByteDiv16 = 0;
+ CurrDFPage++;
+
+ /* Select the next dataflash chip based on the new dataflash page index */
+ Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
+ Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
+ Dataflash_SendAddressBytes(CurrDFPage, 0);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ Dataflash_SendByte(0x00);
+ }
+
+ /* Read one 16-byte chunk of data from the dataflash */
+ for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
+ *(BufferPtr++) = Dataflash_ReceiveByte();
+
+ /* Increment the dataflash page 16 byte block counter */
+ CurrDFPageByteDiv16++;
+
+ /* Increment the block 16 byte block counter */
+ BytesInBlockDiv16++;
+ }
+
+ /* Decrement the blocks remaining counter */
+ TotalBlocks--;
+ }
+
+ /* Deselect all dataflash chips */
+ Dataflash_DeselectChip();
+}
+
+/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */
+void DataflashManager_ResetDataflashProtections(void)
+{
+ /* Select first dataflash chip, send the read status register command */
+ Dataflash_SelectChip(DATAFLASH_CHIP1);
+ Dataflash_SendByte(DF_CMD_GETSTATUS);
+
+ /* Check if sector protection is enabled */
+ if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
+ {
+ Dataflash_ToggleSelectedChipCS();
+
+ /* Send the commands to disable sector protection */
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
+ }
+
+ /* Select second dataflash chip (if present on selected board), send read status register command */
+ #if (DATAFLASH_TOTALCHIPS == 2)
+ Dataflash_SelectChip(DATAFLASH_CHIP2);
+ Dataflash_SendByte(DF_CMD_GETSTATUS);
+
+ /* Check if sector protection is enabled */
+ if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
+ {
+ Dataflash_ToggleSelectedChipCS();
+
+ /* Send the commands to disable sector protection */
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
+ Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
+ }
+ #endif
+
+ /* Deselect current dataflash chip */
+ Dataflash_DeselectChip();
+}
+
+/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
+ *
+ * \return Boolean true if all media chips are working, false otherwise
+ */
+bool DataflashManager_CheckDataflashOperation(void)
+{
+ uint8_t ReturnByte;
+
+ /* Test first Dataflash IC is present and responding to commands */
+ Dataflash_SelectChip(DATAFLASH_CHIP1);
+ Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
+ ReturnByte = Dataflash_ReceiveByte();
+ Dataflash_DeselectChip();
+
+ /* If returned data is invalid, fail the command */
+ if (ReturnByte != DF_MANUFACTURER_ATMEL)
+ return false;
+
+ #if (DATAFLASH_TOTALCHIPS == 2)
+ /* Test second Dataflash IC is present and responding to commands */
+ Dataflash_SelectChip(DATAFLASH_CHIP2);
+ Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
+ ReturnByte = Dataflash_ReceiveByte();
+ Dataflash_DeselectChip();
+
+ /* If returned data is invalid, fail the command */
+ if (ReturnByte != DF_MANUFACTURER_ATMEL)
+ return false;
+ #endif
+
+ return true;
+}
diff --git a/Projects/Webserver/Lib/DataflashManager.h b/Projects/Webserver/Lib/DataflashManager.h
index f475f449a..ebf0bd329 100644
--- a/Projects/Webserver/Lib/DataflashManager.h
+++ b/Projects/Webserver/Lib/DataflashManager.h
@@ -1,80 +1,80 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 DataflashManager.c.
- */
-
-#ifndef _DATAFLASH_MANAGER_H_
-#define _DATAFLASH_MANAGER_H_
-
- /* Includes: */
- #include <avr/io.h>
-
- #include "Descriptors.h"
-
- #include <LUFA/Common/Common.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/Board/Dataflash.h>
-
- /* Preprocessor Checks: */
- #if (DATAFLASH_PAGE_SIZE % 16)
- #error Dataflash page size must be a multiple of 16 bytes.
- #endif
-
- /* Defines: */
- /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */
- #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
-
- /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
- * storage media (Dataflash) using a different native block size. Do not change this value.
- */
- #define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
- * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
- */
- #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
- /* Function Prototypes: */
- void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
- uint16_t TotalBlocks);
- void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
- uint16_t TotalBlocks);
- void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
- const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
- void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
- uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
- void DataflashManager_ResetDataflashProtections(void);
- bool DataflashManager_CheckDataflashOperation(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 DataflashManager.c.
+ */
+
+#ifndef _DATAFLASH_MANAGER_H_
+#define _DATAFLASH_MANAGER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+
+ #include "Descriptors.h"
+
+ #include <LUFA/Common/Common.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+ #include <LUFA/Drivers/Board/Dataflash.h>
+
+ /* Preprocessor Checks: */
+ #if (DATAFLASH_PAGE_SIZE % 16)
+ #error Dataflash page size must be a multiple of 16 bytes.
+ #endif
+
+ /* Defines: */
+ /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */
+ #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)
+
+ /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying
+ * storage media (Dataflash) using a different native block size. Do not change this value.
+ */
+ #define VIRTUAL_MEMORY_BLOCK_SIZE 512
+
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
+ */
+ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
+
+ /* Function Prototypes: */
+ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
+ uint16_t TotalBlocks);
+ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
+ uint16_t TotalBlocks);
+ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
+ const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
+ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
+ uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
+ void DataflashManager_ResetDataflashProtections(void);
+ bool DataflashManager_CheckDataflashOperation(void);
+
+#endif
diff --git a/Projects/Webserver/Lib/FATFs/00readme.txt b/Projects/Webserver/Lib/FATFs/00readme.txt
index 295be3b9a..eb378c51e 100644
--- a/Projects/Webserver/Lib/FATFs/00readme.txt
+++ b/Projects/Webserver/Lib/FATFs/00readme.txt
@@ -1,110 +1,110 @@
-FatFs Module Source Files R0.07e (C)ChaN, 2010
-
-
-FILES
-
- ffconf.h Configuration file for FatFs module.
- ff.h Common include file for FatFs and application module.
- ff.c FatFs module.
- diskio.h Common include file for FatFs and disk I/O module.
- diskio.c Skeleton of low level disk I/O module.
- integer.h Alternative type definitions for integer variables.
- option Optional external functions.
-
- Low level disk I/O module is not included in this archive because the FatFs
- module is only a generic file system layer and not depend on any specific
- storage device. You have to provide a low level disk I/O module that written
- to control your storage device.
-
-
-
-AGREEMENTS
-
- FatFs module is an open source software to implement FAT file system to
- small embedded systems. This is a free software and is opened for education,
- research and commercial developments under license policy of following trems.
-
- Copyright (C) 2010, ChaN, all right reserved.
-
- * The FatFs module is a free software and there is NO WARRANTY.
- * No restriction on use. You can use, modify and redistribute it for
- personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
- * Redistributions of source code must retain the above copyright notice.
-
-
-
-REVISION HISTORY
-
- Feb 26, 2006 R0.00 Prototype
-
- Apr 29, 2006 R0.01 First release.
-
- Jun 01, 2006 R0.02 Added FAT12.
- Removed unbuffered mode.
- Fixed a problem on small (<32M) patition.
-
- Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
-
- Sep 22, 2006 R0.03 Added f_rename.
- Changed option _FS_MINIMUM to _FS_MINIMIZE.
-
- Dec 11, 2006 R0.03a Improved cluster scan algolithm to write files fast.
- Fixed f_mkdir creates incorrect directory on FAT32.
-
- Feb 04, 2007 R0.04 Supported multiple drive system. (FatFs)
- Changed some APIs for multiple drive system.
- Added f_mkfs. (FatFs)
- Added _USE_FAT32 option. (Tiny-FatFs)
-
- Apr 01, 2007 R0.04a Supported multiple partitions on a plysical drive. (FatFs)
- Fixed an endian sensitive code in f_mkfs. (FatFs)
- Added a capability of extending the file size to f_lseek.
- Added minimization level 3.
- Fixed a problem that can collapse a sector when recreate an
- existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)
-
- May 05, 2007 R0.04b Added _USE_NTFLAG option.
- Added FSInfo support.
- Fixed some problems corresponds to FAT32. (Tiny-FatFs)
- Fixed DBCS name can result FR_INVALID_NAME.
- Fixed short seek (0 < ofs <= csize) collapses the file object.
-
- Aug 25, 2007 R0.05 Changed arguments of f_read, f_write.
- Changed arguments of f_mkfs. (FatFs)
- Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)
- Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)
-
- Feb 03, 2008 R0.05a Added f_truncate().
- Added f_utime().
- Fixed off by one error at FAT sub-type determination.
- Fixed btr in f_read() can be mistruncated.
- Fixed cached sector is not flushed when create and close without write.
-
- Apr 01, 2008 R0.06 Added f_forward(). (Tiny-FatFs)
- Added string functions: fputc(), fputs(), fprintf() and fgets().
- Improved performance of f_lseek() on move to the same or following cluster.
-
- Apr 01, 2010, R0.07 Merged Tiny-FatFs as a buffer configuration option.
- Added long file name support.
- Added multiple code page support.
- Added re-entrancy for multitask operation.
- Added auto cluster size selection to f_mkfs().
- Added rewind option to f_readdir().
- Changed result code of critical errors.
- Renamed string functions to avoid name collision.
-
- Apr 14, 2010, R0.07a Separated out OS dependent code on reentrant cfg.
- Added multiple sector size support.
-
- Jun 21, 2010, R0.07c Fixed f_unlink() may return FR_OK on error.
- Fixed wrong cache control in f_lseek().
- Added relative path feature.
- Added f_chdir().
- Added f_chdrive().
- Added proper case conversion for extended characters.
-
- Nov 03,'2010 R0.07e Separated out configuration options from ff.h to ffconf.h.
- Added a configuration option, _LFN_UNICODE.
- Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
- Fixed name matching error on the 13 char boundary.
- Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
+FatFs Module Source Files R0.07e (C)ChaN, 2010
+
+
+FILES
+
+ ffconf.h Configuration file for FatFs module.
+ ff.h Common include file for FatFs and application module.
+ ff.c FatFs module.
+ diskio.h Common include file for FatFs and disk I/O module.
+ diskio.c Skeleton of low level disk I/O module.
+ integer.h Alternative type definitions for integer variables.
+ option Optional external functions.
+
+ Low level disk I/O module is not included in this archive because the FatFs
+ module is only a generic file system layer and not depend on any specific
+ storage device. You have to provide a low level disk I/O module that written
+ to control your storage device.
+
+
+
+AGREEMENTS
+
+ FatFs module is an open source software to implement FAT file system to
+ small embedded systems. This is a free software and is opened for education,
+ research and commercial developments under license policy of following trems.
+
+ Copyright (C) 2010, ChaN, all right reserved.
+
+ * The FatFs module is a free software and there is NO WARRANTY.
+ * No restriction on use. You can use, modify and redistribute it for
+ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
+ * Redistributions of source code must retain the above copyright notice.
+
+
+
+REVISION HISTORY
+
+ Feb 26, 2006 R0.00 Prototype
+
+ Apr 29, 2006 R0.01 First release.
+
+ Jun 01, 2006 R0.02 Added FAT12.
+ Removed unbuffered mode.
+ Fixed a problem on small (<32M) patition.
+
+ Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
+
+ Sep 22, 2006 R0.03 Added f_rename.
+ Changed option _FS_MINIMUM to _FS_MINIMIZE.
+
+ Dec 11, 2006 R0.03a Improved cluster scan algolithm to write files fast.
+ Fixed f_mkdir creates incorrect directory on FAT32.
+
+ Feb 04, 2007 R0.04 Supported multiple drive system. (FatFs)
+ Changed some APIs for multiple drive system.
+ Added f_mkfs. (FatFs)
+ Added _USE_FAT32 option. (Tiny-FatFs)
+
+ Apr 01, 2007 R0.04a Supported multiple partitions on a plysical drive. (FatFs)
+ Fixed an endian sensitive code in f_mkfs. (FatFs)
+ Added a capability of extending the file size to f_lseek.
+ Added minimization level 3.
+ Fixed a problem that can collapse a sector when recreate an
+ existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)
+
+ May 05, 2007 R0.04b Added _USE_NTFLAG option.
+ Added FSInfo support.
+ Fixed some problems corresponds to FAT32. (Tiny-FatFs)
+ Fixed DBCS name can result FR_INVALID_NAME.
+ Fixed short seek (0 < ofs <= csize) collapses the file object.
+
+ Aug 25, 2007 R0.05 Changed arguments of f_read, f_write.
+ Changed arguments of f_mkfs. (FatFs)
+ Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)
+ Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)
+
+ Feb 03, 2008 R0.05a Added f_truncate().
+ Added f_utime().
+ Fixed off by one error at FAT sub-type determination.
+ Fixed btr in f_read() can be mistruncated.
+ Fixed cached sector is not flushed when create and close without write.
+
+ Apr 01, 2008 R0.06 Added f_forward(). (Tiny-FatFs)
+ Added string functions: fputc(), fputs(), fprintf() and fgets().
+ Improved performance of f_lseek() on move to the same or following cluster.
+
+ Apr 01, 2010, R0.07 Merged Tiny-FatFs as a buffer configuration option.
+ Added long file name support.
+ Added multiple code page support.
+ Added re-entrancy for multitask operation.
+ Added auto cluster size selection to f_mkfs().
+ Added rewind option to f_readdir().
+ Changed result code of critical errors.
+ Renamed string functions to avoid name collision.
+
+ Apr 14, 2010, R0.07a Separated out OS dependent code on reentrant cfg.
+ Added multiple sector size support.
+
+ Jun 21, 2010, R0.07c Fixed f_unlink() may return FR_OK on error.
+ Fixed wrong cache control in f_lseek().
+ Added relative path feature.
+ Added f_chdir().
+ Added f_chdrive().
+ Added proper case conversion for extended characters.
+
+ Nov 03,'2010 R0.07e Separated out configuration options from ff.h to ffconf.h.
+ Added a configuration option, _LFN_UNICODE.
+ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
+ Fixed name matching error on the 13 char boundary.
+ Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
diff --git a/Projects/Webserver/Lib/FATFs/diskio.c b/Projects/Webserver/Lib/FATFs/diskio.c
index 028c631ba..d81885c29 100644
--- a/Projects/Webserver/Lib/FATFs/diskio.c
+++ b/Projects/Webserver/Lib/FATFs/diskio.c
@@ -1,64 +1,64 @@
-/*-----------------------------------------------------------------------*/
-/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */
-/*-----------------------------------------------------------------------*/
-/* This is a stub disk I/O module that acts as front end of the existing */
-/* disk I/O modules and attach it to FatFs module with common interface. */
-/*-----------------------------------------------------------------------*/
-
-#include "diskio.h"
-
-/*-----------------------------------------------------------------------*/
-/* Inidialize a Drive */
-
-DSTATUS disk_initialize (
- BYTE drv /* Physical drive nmuber (0..) */
-)
-{
- return FR_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Return Disk Status */
-
-DSTATUS disk_status (
- BYTE drv /* Physical drive nmuber (0..) */
-)
-{
- return FR_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read Sector(s) */
-
-DRESULT disk_read (
- BYTE drv, /* Physical drive nmuber (0..) */
- BYTE *buff, /* Data buffer to store read data */
- DWORD sector, /* Sector address (LBA) */
- BYTE count /* Number of sectors to read (1..255) */
-)
-{
- DataflashManager_ReadBlocks_RAM(sector, count, buff);
- return RES_OK;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Write Sector(s) */
-
-#if _READONLY == 0
-DRESULT disk_write (
- BYTE drv, /* Physical drive nmuber (0..) */
- const BYTE *buff, /* Data to be written */
- DWORD sector, /* Sector address (LBA) */
- BYTE count /* Number of sectors to write (1..255) */
-)
-{
- DataflashManager_WriteBlocks_RAM(sector, count, buff);
- return RES_OK;
-}
-#endif /* _READONLY */
+/*-----------------------------------------------------------------------*/
+/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */
+/*-----------------------------------------------------------------------*/
+/* This is a stub disk I/O module that acts as front end of the existing */
+/* disk I/O modules and attach it to FatFs module with common interface. */
+/*-----------------------------------------------------------------------*/
+
+#include "diskio.h"
+
+/*-----------------------------------------------------------------------*/
+/* Inidialize a Drive */
+
+DSTATUS disk_initialize (
+ BYTE drv /* Physical drive nmuber (0..) */
+)
+{
+ return FR_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Return Disk Status */
+
+DSTATUS disk_status (
+ BYTE drv /* Physical drive nmuber (0..) */
+)
+{
+ return FR_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read Sector(s) */
+
+DRESULT disk_read (
+ BYTE drv, /* Physical drive nmuber (0..) */
+ BYTE *buff, /* Data buffer to store read data */
+ DWORD sector, /* Sector address (LBA) */
+ BYTE count /* Number of sectors to read (1..255) */
+)
+{
+ DataflashManager_ReadBlocks_RAM(sector, count, buff);
+ return RES_OK;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Write Sector(s) */
+
+#if _READONLY == 0
+DRESULT disk_write (
+ BYTE drv, /* Physical drive nmuber (0..) */
+ const BYTE *buff, /* Data to be written */
+ DWORD sector, /* Sector address (LBA) */
+ BYTE count /* Number of sectors to write (1..255) */
+)
+{
+ DataflashManager_WriteBlocks_RAM(sector, count, buff);
+ return RES_OK;
+}
+#endif /* _READONLY */
diff --git a/Projects/Webserver/Lib/FATFs/diskio.h b/Projects/Webserver/Lib/FATFs/diskio.h
index 2f444f7b6..bd9d223c0 100644
--- a/Projects/Webserver/Lib/FATFs/diskio.h
+++ b/Projects/Webserver/Lib/FATFs/diskio.h
@@ -1,72 +1,72 @@
-/*-----------------------------------------------------------------------
-/ Low level disk interface modlue include file R0.07 (C)ChaN, 2010
-/-----------------------------------------------------------------------*/
-
-#ifndef _DISKIO
-
-#define _READONLY 0 /* 1: Read-only mode */
-#define _USE_IOCTL 0
-
-#include "integer.h"
-#include "ff.h"
-
-#include "../DataflashManager.h"
-
-
-/* Status of Disk Functions */
-typedef BYTE DSTATUS;
-
-/* Results of Disk Functions */
-typedef enum {
- RES_OK = 0, /* 0: Successful */
- RES_ERROR, /* 1: R/W Error */
- RES_WRPRT, /* 2: Write Protected */
- RES_NOTRDY, /* 3: Not Ready */
- RES_PARERR /* 4: Invalid Parameter */
-} DRESULT;
-
-
-/*---------------------------------------*/
-/* Prototypes for disk control functions */
-
-BOOL assign_drives (int argc, char *argv[]);
-DSTATUS disk_initialize (BYTE);
-DSTATUS disk_status (BYTE);
-DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
-#if _READONLY == 0
-DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
-#endif
-DRESULT disk_ioctl (BYTE, BYTE, void*);
-
-
-/* Disk Status Bits (DSTATUS) */
-
-#define STA_NOINIT 0x01 /* Drive not initialized */
-#define STA_NODISK 0x02 /* No medium in the drive */
-#define STA_PROTECT 0x04 /* Write protected */
-
-
-/* Command code for disk_ioctrl() */
-
-/* Generic command */
-#define CTRL_SYNC 0 /* Mandatory for write functions */
-#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
-#define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */
-#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
-#define CTRL_POWER 4
-#define CTRL_LOCK 5
-#define CTRL_EJECT 6
-/* MMC/SDC command */
-#define MMC_GET_TYPE 10
-#define MMC_GET_CSD 11
-#define MMC_GET_CID 12
-#define MMC_GET_OCR 13
-#define MMC_GET_SDSTAT 14
-/* ATA/CF command */
-#define ATA_GET_REV 20
-#define ATA_GET_MODEL 21
-#define ATA_GET_SN 22
-
-
-#define _DISKIO
-#endif
+/*-----------------------------------------------------------------------
+/ Low level disk interface modlue include file R0.07 (C)ChaN, 2010
+/-----------------------------------------------------------------------*/
+
+#ifndef _DISKIO
+
+#define _READONLY 0 /* 1: Read-only mode */
+#define _USE_IOCTL 0
+
+#include "integer.h"
+#include "ff.h"
+
+#include "../DataflashManager.h"
+
+
+/* Status of Disk Functions */
+typedef BYTE DSTATUS;
+
+/* Results of Disk Functions */
+typedef enum {
+ RES_OK = 0, /* 0: Successful */
+ RES_ERROR, /* 1: R/W Error */
+ RES_WRPRT, /* 2: Write Protected */
+ RES_NOTRDY, /* 3: Not Ready */
+ RES_PARERR /* 4: Invalid Parameter */
+} DRESULT;
+
+
+/*---------------------------------------*/
+/* Prototypes for disk control functions */
+
+BOOL assign_drives (int argc, char *argv[]);
+DSTATUS disk_initialize (BYTE);
+DSTATUS disk_status (BYTE);
+DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
+#if _READONLY == 0
+DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
+#endif
+DRESULT disk_ioctl (BYTE, BYTE, void*);
+
+
+/* Disk Status Bits (DSTATUS) */
+
+#define STA_NOINIT 0x01 /* Drive not initialized */
+#define STA_NODISK 0x02 /* No medium in the drive */
+#define STA_PROTECT 0x04 /* Write protected */
+
+
+/* Command code for disk_ioctrl() */
+
+/* Generic command */
+#define CTRL_SYNC 0 /* Mandatory for write functions */
+#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
+#define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */
+#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
+#define CTRL_POWER 4
+#define CTRL_LOCK 5
+#define CTRL_EJECT 6
+/* MMC/SDC command */
+#define MMC_GET_TYPE 10
+#define MMC_GET_CSD 11
+#define MMC_GET_CID 12
+#define MMC_GET_OCR 13
+#define MMC_GET_SDSTAT 14
+/* ATA/CF command */
+#define ATA_GET_REV 20
+#define ATA_GET_MODEL 21
+#define ATA_GET_SN 22
+
+
+#define _DISKIO
+#endif
diff --git a/Projects/Webserver/Lib/FATFs/ff.c b/Projects/Webserver/Lib/FATFs/ff.c
index 6382fea1f..b30139055 100644
--- a/Projects/Webserver/Lib/FATFs/ff.c
+++ b/Projects/Webserver/Lib/FATFs/ff.c
@@ -1,3153 +1,3153 @@
-/*----------------------------------------------------------------------------/
-/ FatFs - FAT file system module R0.07e (C)ChaN, 2010
-/-----------------------------------------------------------------------------/
-/ FatFs module is a generic FAT file system module for small embedded systems.
-/ This is a free software that opened for education, research and commercial
-/ developments under license policy of following trems.
-/
-/ Copyright (C) 2010, ChaN, all right reserved.
-/
-/ * The FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
-/
-/-----------------------------------------------------------------------------/
-/ Feb 26,'06 R0.00 Prototype.
-/
-/ Apr 29,'06 R0.01 First stable version.
-/
-/ Jun 01,'06 R0.02 Added FAT12 support.
-/ Removed unbuffered mode.
-/ Fixed a problem on small (<32M) patition.
-/ Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).
-/
-/ Sep 22,'06 R0.03 Added f_rename().
-/ Changed option _FS_MINIMUM to _FS_MINIMIZE.
-/ Dec 11,'06 R0.03a Improved cluster scan algolithm to write files fast.
-/ Fixed f_mkdir() creates incorrect directory on FAT32.
-/
-/ Feb 04,'07 R0.04 Supported multiple drive system.
-/ Changed some interfaces for multiple drive system.
-/ Changed f_mountdrv() to f_mount().
-/ Added f_mkfs().
-/ Apr 01,'07 R0.04a Supported multiple partitions on a plysical drive.
-/ Added a capability of extending file size to f_lseek().
-/ Added minimization level 3.
-/ Fixed an endian sensitive code in f_mkfs().
-/ May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.
-/ Added FSInfo support.
-/ Fixed DBCS name can result FR_INVALID_NAME.
-/ Fixed short seek (<= csize) collapses the file object.
-/
-/ Aug 25,'07 R0.05 Changed arguments of f_read(), f_write() and f_mkfs().
-/ Fixed f_mkfs() on FAT32 creates incorrect FSInfo.
-/ Fixed f_mkdir() on FAT32 creates incorrect directory.
-/ Feb 03,'08 R0.05a Added f_truncate() and f_utime().
-/ Fixed off by one error at FAT sub-type determination.
-/ Fixed btr in f_read() can be mistruncated.
-/ Fixed cached sector is not flushed when create and close
-/ without write.
-/
-/ Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets().
-/ Improved performance of f_lseek() on moving to the same
-/ or following cluster.
-/
-/ Apr 01,'09 R0.07 Merged Tiny-FatFs as a buffer configuration option.
-/ Added long file name support.
-/ Added multiple code page support.
-/ Added re-entrancy for multitask operation.
-/ Added auto cluster size selection to f_mkfs().
-/ Added rewind option to f_readdir().
-/ Changed result code of critical errors.
-/ Renamed string functions to avoid name collision.
-/ Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg.
-/ Added multiple sector size support.
-/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error.
-/ Fixed wrong cache control in f_lseek().
-/ Added relative path feature.
-/ Added f_chdir() and f_chdrive().
-/ Added proper case conversion to extended char.
-/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h.
-/ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
-/ Fixed name matching error on the 13 char boundary.
-/ Added a configuration option, _LFN_UNICODE.
-/ Changed f_readdir() to return the SFN with always upper
-/ case on non-LFN cfg.
-/---------------------------------------------------------------------------*/
-
-#include "ff.h" /* FatFs configurations and declarations */
-#include "diskio.h" /* Declarations of low level disk I/O functions */
-
-/*--------------------------------------------------------------------------
-
- Module Private Definitions
-
----------------------------------------------------------------------------*/
-
-#if _FATFS != 0x007E
-#error Wrong include file (ff.h).
-#endif
-
-#if _FS_REENTRANT
-#if _USE_LFN == 1
-#error Static LFN work area must not be used in re-entrant configuration.
-#endif
-#define ENTER_FF(fs) { if (!lock_fs(fs)) return FR_TIMEOUT; }
-#define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; }
-
-#else
-#define ENTER_FF(fs)
-#define LEAVE_FF(fs, res) return res
-
-#endif
-
-#define ABORT(fs, res) { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Name status flags */
-#define NS 11 /* Offset of name status byte */
-#define NS_LOSS 0x01 /* Out of 8.3 format */
-#define NS_LFN 0x02 /* Force to create LFN entry */
-#define NS_LAST 0x04 /* Last segment */
-#define NS_BODY 0x08 /* Lower case flag (body) */
-#define NS_EXT 0x10 /* Lower case flag (ext) */
-#define NS_DOT 0x20 /* Dot entry */
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Private Work Area
-
----------------------------------------------------------------------------*/
-
-#if _DRIVES < 1 || _DRIVES > 9
-#error Number of drives must be 1-9.
-#endif
-static
-FATFS *FatFs[_DRIVES]; /* Pointer to the file system objects (logical drives) */
-
-static
-WORD Fsid; /* File system mount ID */
-
-#if _FS_RPATH
-static
-BYTE Drive; /* Current drive */
-#endif
-
-
-#if _USE_LFN == 1 /* LFN with static LFN working buffer */
-static
-WCHAR LfnBuf[_MAX_LFN + 1];
-#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR *lp = LfnBuf
-#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
-
-#elif _USE_LFN > 1 /* LFN with dynamic LFN working buffer */
-#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR lbuf[_MAX_LFN + 1], *lp = lbuf
-#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
-
-#else /* No LFN */
-#define NAMEBUF(sp,lp) BYTE sp[12]
-#define INITBUF(dj,sp,lp) dj.fn = sp
-
-#endif
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Module Private Functions
-
----------------------------------------------------------------------------*/
-
-
-/*-----------------------------------------------------------------------*/
-/* String functions */
-/*-----------------------------------------------------------------------*/
-
-/* Copy memory to memory */
-static
-void mem_cpy (void* dst, const void* src, int cnt) {
- char *d = (char*)dst;
- const char *s = (const char *)src;
- while (cnt--) *d++ = *s++;
-}
-
-/* Fill memory */
-static
-void mem_set (void* dst, int val, int cnt) {
- char *d = (char*)dst;
- while (cnt--) *d++ = (char)val;
-}
-
-/* Compare memory to memory */
-static
-int mem_cmp (const void* dst, const void* src, int cnt) {
- const char *d = (const char *)dst, *s = (const char *)src;
- int r = 0;
- while (cnt-- && (r = *d++ - *s++) == 0) ;
- return r;
-}
-
-/* Check if chr is contained in the string */
-static
-int chk_chr (const char* str, int chr) {
- while (*str && *str != chr) str++;
- return *str;
-}
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Request/Release grant to access the volume */
-/*-----------------------------------------------------------------------*/
-#if _FS_REENTRANT
-
-static
-BOOL lock_fs (
- FATFS *fs /* File system object */
-)
-{
- return ff_req_grant(fs->sobj);
-}
-
-
-static
-void unlock_fs (
- FATFS *fs, /* File system object */
- FRESULT res /* Result code to be returned */
-)
-{
- if (res != FR_NOT_ENABLED &&
- res != FR_INVALID_DRIVE &&
- res != FR_INVALID_OBJECT &&
- res != FR_TIMEOUT) {
- ff_rel_grant(fs->sobj);
- }
-}
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change window offset */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT move_window (
- FATFS *fs, /* File system object */
- DWORD sector /* Sector number to make apperance in the fs->win[] */
-) /* Move to zero only writes back dirty window */
-{
- DWORD wsect;
-
-
- wsect = fs->winsect;
- if (wsect != sector) { /* Changed current window */
-#if !_FS_READONLY
- if (fs->wflag) { /* Write back dirty window if needed */
- if (disk_write(fs->drive, fs->win, wsect, 1) != RES_OK)
- return FR_DISK_ERR;
- fs->wflag = 0;
- if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */
- BYTE nf;
- for (nf = fs->n_fats; nf > 1; nf--) { /* Refrect the change to all FAT copies */
- wsect += fs->sects_fat;
- disk_write(fs->drive, fs->win, wsect, 1);
- }
- }
- }
-#endif
- if (sector) {
- if (disk_read(fs->drive, fs->win, sector, 1) != RES_OK)
- return FR_DISK_ERR;
- fs->winsect = sector;
- }
- }
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Clean-up cached data */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */
- FATFS *fs /* File system object */
-)
-{
- FRESULT res;
-
-
- res = move_window(fs, 0);
- if (res == FR_OK) {
- /* Update FSInfo sector if needed */
- if (fs->fs_type == FS_FAT32 && fs->fsi_flag) {
- fs->winsect = 0;
- mem_set(fs->win, 0, 512);
- ST_WORD(fs->win+BS_55AA, 0xAA55);
- ST_DWORD(fs->win+FSI_LeadSig, 0x41615252);
- ST_DWORD(fs->win+FSI_StrucSig, 0x61417272);
- ST_DWORD(fs->win+FSI_Free_Count, fs->free_clust);
- ST_DWORD(fs->win+FSI_Nxt_Free, fs->last_clust);
- disk_write(fs->drive, fs->win, fs->fsi_sector, 1);
- fs->fsi_flag = 0;
- }
- /* Make sure that no pending write process in the physical drive */
- if (disk_ioctl(fs->drive, CTRL_SYNC, (void*)NULL) != RES_OK)
- res = FR_DISK_ERR;
- }
-
- return res;
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT access - Read value of a FAT entry */
-/*-----------------------------------------------------------------------*/
-
-
-DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status */
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to get the link information */
-)
-{
- UINT wc, bc;
- DWORD fsect;
-
-
- if (clst < 2 || clst >= fs->max_clust) /* Range check */
- return 1;
-
- fsect = fs->fatbase;
- switch (fs->fs_type) {
- case FS_FAT12 :
- bc = clst; bc += bc / 2;
- if (move_window(fs, fsect + (bc / SS(fs)))) break;
- wc = fs->win[bc & (SS(fs) - 1)]; bc++;
- if (move_window(fs, fsect + (bc / SS(fs)))) break;
- wc |= (WORD)fs->win[bc & (SS(fs) - 1)] << 8;
- return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);
-
- case FS_FAT16 :
- if (move_window(fs, fsect + (clst / (SS(fs) / 2)))) break;
- return LD_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)]);
-
- case FS_FAT32 :
- if (move_window(fs, fsect + (clst / (SS(fs) / 4)))) break;
- return LD_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)]) & 0x0FFFFFFF;
- }
-
- return 0xFFFFFFFF; /* An error occured at the disk I/O layer */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT access - Change value of a FAT entry */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-
-FRESULT put_fat (
- FATFS *fs, /* File system object */
- DWORD clst, /* Cluster# to be changed in range of 2 to fs->max_clust - 1 */
- DWORD val /* New value to mark the cluster */
-)
-{
- UINT bc;
- BYTE *p;
- DWORD fsect;
- FRESULT res;
-
-
- if (clst < 2 || clst >= fs->max_clust) { /* Range check */
- res = FR_INT_ERR;
-
- } else {
- fsect = fs->fatbase;
- switch (fs->fs_type) {
- case FS_FAT12 :
- bc = clst; bc += bc / 2;
- res = move_window(fs, fsect + (bc / SS(fs)));
- if (res != FR_OK) break;
- p = &fs->win[bc & (SS(fs) - 1)];
- *p = (clst & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val;
- bc++;
- fs->wflag = 1;
- res = move_window(fs, fsect + (bc / SS(fs)));
- if (res != FR_OK) break;
- p = &fs->win[bc & (SS(fs) - 1)];
- *p = (clst & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F));
- break;
-
- case FS_FAT16 :
- res = move_window(fs, fsect + (clst / (SS(fs) / 2)));
- if (res != FR_OK) break;
- ST_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)], (WORD)val);
- break;
-
- case FS_FAT32 :
- res = move_window(fs, fsect + (clst / (SS(fs) / 4)));
- if (res != FR_OK) break;
- ST_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)], val);
- break;
-
- default :
- res = FR_INT_ERR;
- }
- fs->wflag = 1;
- }
-
- return res;
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT handling - Remove a cluster chain */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-FRESULT remove_chain (
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to remove a chain from */
-)
-{
- FRESULT res;
- DWORD nxt;
-
-
- if (clst < 2 || clst >= fs->max_clust) { /* Check the range of cluster# */
- res = FR_INT_ERR;
-
- } else {
- res = FR_OK;
- while (clst < fs->max_clust) { /* Not a last link? */
- nxt = get_fat(fs, clst); /* Get cluster status */
- if (nxt == 0) break; /* Empty cluster? */
- if (nxt == 1) { res = FR_INT_ERR; break; } /* Internal error? */
- if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */
- res = put_fat(fs, clst, 0); /* Mark the cluster "empty" */
- if (res != FR_OK) break;
- if (fs->free_clust != 0xFFFFFFFF) { /* Update FSInfo */
- fs->free_clust++;
- fs->fsi_flag = 1;
- }
- clst = nxt; /* Next cluster */
- }
- }
-
- return res;
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* FAT handling - Stretch or Create a cluster chain */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to stretch. 0 means create a new chain. */
-)
-{
- DWORD cs, ncl, scl, mcl;
-
-
- mcl = fs->max_clust;
- if (clst == 0) { /* Create new chain */
- scl = fs->last_clust; /* Get suggested start point */
- if (scl == 0 || scl >= mcl) scl = 1;
- }
- else { /* Stretch existing chain */
- cs = get_fat(fs, clst); /* Check the cluster status */
- if (cs < 2) return 1; /* It is an invalid cluster */
- if (cs < mcl) return cs; /* It is already followed by next cluster */
- scl = clst;
- }
-
- ncl = scl; /* Start cluster */
- for (;;) {
- ncl++; /* Next cluster */
- if (ncl >= mcl) { /* Wrap around */
- ncl = 2;
- if (ncl > scl) return 0; /* No free custer */
- }
- cs = get_fat(fs, ncl); /* Get the cluster status */
- if (cs == 0) break; /* Found a free cluster */
- if (cs == 0xFFFFFFFF || cs == 1)/* An error occured */
- return cs;
- if (ncl == scl) return 0; /* No free custer */
- }
-
- if (put_fat(fs, ncl, 0x0FFFFFFF)) /* Mark the new cluster "in use" */
- return 0xFFFFFFFF;
- if (clst != 0) { /* Link it to the previous one if needed */
- if (put_fat(fs, clst, ncl))
- return 0xFFFFFFFF;
- }
-
- fs->last_clust = ncl; /* Update FSINFO */
- if (fs->free_clust != 0xFFFFFFFF) {
- fs->free_clust--;
- fs->fsi_flag = 1;
- }
-
- return ncl; /* Return new cluster number */
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Get sector# from cluster# */
-/*-----------------------------------------------------------------------*/
-
-
-DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
- FATFS *fs, /* File system object */
- DWORD clst /* Cluster# to be converted */
-)
-{
- clst -= 2;
- if (clst >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
- return clst * fs->csize + fs->database;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Seek directory index */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_seek (
- DIR *dj, /* Pointer to directory object */
- WORD idx /* Directory index number */
-)
-{
- DWORD clst;
- WORD ic;
-
-
- dj->index = idx;
- clst = dj->sclust;
- if (clst == 1 || clst >= dj->fs->max_clust) /* Check start cluster range */
- return FR_INT_ERR;
- if (!clst && dj->fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
- clst = dj->fs->dirbase;
-
- if (clst == 0) { /* Static table */
- dj->clust = clst;
- if (idx >= dj->fs->n_rootdir) /* Index is out of range */
- return FR_INT_ERR;
- dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / 32); /* Sector# */
- }
- else { /* Dynamic table */
- ic = SS(dj->fs) / 32 * dj->fs->csize; /* Entries per cluster */
- while (idx >= ic) { /* Follow cluster chain */
- clst = get_fat(dj->fs, clst); /* Get next cluster */
- if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */
- if (clst < 2 || clst >= dj->fs->max_clust) /* Reached to end of table or int error */
- return FR_INT_ERR;
- idx -= ic;
- }
- dj->clust = clst;
- dj->sect = clust2sect(dj->fs, clst) + idx / (SS(dj->fs) / 32); /* Sector# */
- }
-
- dj->dir = dj->fs->win + (idx % (SS(dj->fs) / 32)) * 32; /* Ptr to the entry in the sector */
-
- return FR_OK; /* Seek succeeded */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Move directory index next */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */
- DIR *dj, /* Pointer to directory object */
- BOOL streach /* FALSE: Do not streach table, TRUE: Streach table if needed */
-)
-{
- DWORD clst;
- WORD i;
-
-
- i = dj->index + 1;
- if (!i || !dj->sect) /* Report EOT when index has reached 65535 */
- return FR_NO_FILE;
-
- if (!(i % (SS(dj->fs) / 32))) { /* Sector changed? */
- dj->sect++; /* Next sector */
-
- if (dj->clust == 0) { /* Static table */
- if (i >= dj->fs->n_rootdir) /* Report EOT when end of table */
- return FR_NO_FILE;
- }
- else { /* Dynamic table */
- if (((i / (SS(dj->fs) / 32)) & (dj->fs->csize - 1)) == 0) { /* Cluster changed? */
- clst = get_fat(dj->fs, dj->clust); /* Get next cluster */
- if (clst <= 1) return FR_INT_ERR;
- if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
- if (clst >= dj->fs->max_clust) { /* When it reached end of dynamic table */
-#if !_FS_READONLY
- BYTE c;
- if (!streach) return FR_NO_FILE; /* When do not streach, report EOT */
- clst = create_chain(dj->fs, dj->clust); /* Streach cluster chain */
- if (clst == 0) return FR_DENIED; /* No free cluster */
- if (clst == 1) return FR_INT_ERR;
- if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
- /* Clean-up streached table */
- if (move_window(dj->fs, 0)) return FR_DISK_ERR; /* Flush active window */
- mem_set(dj->fs->win, 0, SS(dj->fs)); /* Clear window buffer */
- dj->fs->winsect = clust2sect(dj->fs, clst); /* Cluster start sector */
- for (c = 0; c < dj->fs->csize; c++) { /* Fill the new cluster with 0 */
- dj->fs->wflag = 1;
- if (move_window(dj->fs, 0)) return FR_DISK_ERR;
- dj->fs->winsect++;
- }
- dj->fs->winsect -= c; /* Rewind window address */
-#else
- return FR_NO_FILE; /* Report EOT */
-#endif
- }
- dj->clust = clst; /* Initialize data for new cluster */
- dj->sect = clust2sect(dj->fs, clst);
- }
- }
- }
-
- dj->index = i;
- dj->dir = dj->fs->win + (i % (SS(dj->fs) / 32)) * 32;
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry */
-/*-----------------------------------------------------------------------*/
-#if _USE_LFN
-static
-const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Offset of LFN chars in the directory entry */
-
-
-static
-BOOL cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */
- WCHAR *lfnbuf, /* Pointer to the LFN to be compared */
- BYTE *dir /* Pointer to the directory entry containing a part of LFN */
-)
-{
- int i, s;
- WCHAR wc, uc;
-
-
- i = ((dir[LDIR_Ord] & 0xBF) - 1) * 13; /* Get offset in the LFN buffer */
- s = 0; wc = 1;
- do {
- uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
- if (wc) { /* Last char has not been processed */
- wc = ff_wtoupper(uc); /* Convert it to upper case */
- if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it */
- return FALSE; /* Not matched */
- } else {
- if (uc != 0xFFFF) return FALSE; /* Check filler */
- }
- } while (++s < 13); /* Repeat until all chars in the entry are checked */
-
- if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i]) /* Last segment matched but different length */
- return FALSE;
-
- return TRUE; /* The part of LFN matched */
-}
-
-
-
-static
-BOOL pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */
- WCHAR *lfnbuf, /* Pointer to the Unicode-LFN buffer */
- BYTE *dir /* Pointer to the directory entry */
-)
-{
- int i, s;
- WCHAR wc, uc;
-
-
- i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
-
- s = 0; wc = 1;
- do {
- uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
- if (wc) { /* Last char has not been processed */
- if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
- lfnbuf[i++] = wc = uc; /* Store it */
- } else {
- if (uc != 0xFFFF) return FALSE; /* Check filler */
- }
- } while (++s < 13); /* Read all character in the entry */
-
- if (dir[LDIR_Ord] & 0x40) { /* Put terminator if it is the last LFN part */
- if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
- lfnbuf[i] = 0;
- }
-
- return TRUE;
-}
-
-
-#if !_FS_READONLY
-static
-void fit_lfn (
- const WCHAR *lfnbuf, /* Pointer to the LFN buffer */
- BYTE *dir, /* Pointer to the directory entry */
- BYTE ord, /* LFN order (1-20) */
- BYTE sum /* SFN sum */
-)
-{
- int i, s;
- WCHAR wc;
-
-
- dir[LDIR_Chksum] = sum; /* Set check sum */
- dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
- dir[LDIR_Type] = 0;
- ST_WORD(dir+LDIR_FstClusLO, 0);
-
- i = (ord - 1) * 13; /* Get offset in the LFN buffer */
- s = wc = 0;
- do {
- if (wc != 0xFFFF) wc = lfnbuf[i++]; /* Get an effective char */
- ST_WORD(dir+LfnOfs[s], wc); /* Put it */
- if (!wc) wc = 0xFFFF; /* Padding chars following last char */
- } while (++s < 13);
- if (wc == 0xFFFF || !lfnbuf[i]) ord |= 0x40; /* Bottom LFN part is the start of LFN sequence */
- dir[LDIR_Ord] = ord; /* Set the LFN order */
-}
-
-#endif
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Create numbered name */
-/*-----------------------------------------------------------------------*/
-#if _USE_LFN
-void gen_numname (
- BYTE *dst, /* Pointer to genartated SFN */
- const BYTE *src, /* Pointer to source SFN to be modified */
- const WCHAR *lfn, /* Pointer to LFN */
- WORD num /* Sequense number */
-)
-{
- char ns[8];
- int i, j;
-
-
- mem_cpy(dst, src, 11);
-
- if (num > 5) { /* On many collisions, generate a hash number instead of sequencial number */
- do num = (num >> 1) + (num << 15) + (WORD)*lfn++; while (*lfn);
- }
-
- /* itoa */
- i = 7;
- do {
- ns[i--] = (num % 10) + '0';
- num /= 10;
- } while (num);
- ns[i] = '~';
-
- /* Append the number */
- for (j = 0; j < i && dst[j] != ' '; j++) {
- if (IsDBCS1(dst[j])) {
- if (j == i - 1) break;
- j++;
- }
- }
- do {
- dst[j++] = (i < 8) ? ns[i++] : ' ';
- } while (j < 8);
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Calculate sum of an SFN */
-/*-----------------------------------------------------------------------*/
-#if _USE_LFN
-static
-BYTE sum_sfn (
- const BYTE *dir /* Ptr to directory entry */
-)
-{
- BYTE sum = 0;
- int n = 11;
-
- do sum = (sum >> 1) + (sum << 7) + *dir++; while (--n);
- return sum;
-}
-#endif
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Directory handling - Find an object in the directory */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT dir_find (
- DIR *dj /* Pointer to the directory object linked to the file name */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-#if _USE_LFN
- BYTE a, ord, sum;
-#endif
-
- res = dir_seek(dj, 0); /* Rewind directory object */
- if (res != FR_OK) return res;
-
-#if _USE_LFN
- ord = sum = 0xFF;
-#endif
- do {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- dir = dj->dir; /* Ptr to the directory entry of current index */
- c = dir[DIR_Name];
- if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
-#if _USE_LFN /* LFN configuration */
- a = dir[DIR_Attr] & AM_MASK;
- if (c == 0xE5 || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
- ord = 0xFF;
- } else {
- if (a == AM_LFN) { /* An LFN entry is found */
- if (dj->lfn) {
- if (c & 0x40) { /* Is it start of LFN sequence? */
- sum = dir[LDIR_Chksum];
- c &= 0xBF; ord = c; /* LFN start order */
- dj->lfn_idx = dj->index;
- }
- /* Check validity of the LFN entry and compare it with given name */
- ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
- }
- } else { /* An SFN entry is found */
- if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */
- ord = 0xFF; dj->lfn_idx = 0xFFFF; /* Reset LFN sequence */
- if (!(dj->fn[NS] & NS_LOSS) && !mem_cmp(dir, dj->fn, 11)) break; /* SFN matched? */
- }
- }
-#else /* Non LFN configuration */
- if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */
- break;
-#endif
- res = dir_next(dj, FALSE); /* Next entry */
- } while (res == FR_OK);
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read an object from the directory */
-/*-----------------------------------------------------------------------*/
-#if _FS_MINIMIZE <= 1
-static
-FRESULT dir_read (
- DIR *dj /* Pointer to the directory object that pointing the entry to be read */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-#if _USE_LFN
- BYTE a, ord = 0xFF, sum = 0xFF;
-#endif
-
- res = FR_NO_FILE;
- while (dj->sect) {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- dir = dj->dir; /* Ptr to the directory entry of current index */
- c = dir[DIR_Name];
- if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
-#if _USE_LFN /* LFN configuration */
- a = dir[DIR_Attr] & AM_MASK;
- if (c == 0xE5 || (!_FS_RPATH && c == '.') || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
- ord = 0xFF;
- } else {
- if (a == AM_LFN) { /* An LFN entry is found */
- if (c & 0x40) { /* Is it start of LFN sequence? */
- sum = dir[LDIR_Chksum];
- c &= 0xBF; ord = c;
- dj->lfn_idx = dj->index;
- }
- /* Check LFN validity and capture it */
- ord = (c == ord && sum == dir[LDIR_Chksum] && pick_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
- } else { /* An SFN entry is found */
- if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN? */
- dj->lfn_idx = 0xFFFF; /* It has no LFN. */
- break;
- }
- }
-#else /* Non LFN configuration */
- if (c != 0xE5 && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL)) /* Is it a valid entry? */
- break;
-#endif
- res = dir_next(dj, FALSE); /* Next entry */
- if (res != FR_OK) break;
- }
-
- if (res != FR_OK) dj->sect = 0;
-
- return res;
-}
-#endif
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Register an object to the directory */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY
-static
-FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many SFN collision, FR_DISK_ERR:Disk error */
- DIR *dj /* Target directory with object name to be created */
-)
-{
- FRESULT res;
- BYTE c, *dir;
-#if _USE_LFN /* LFN configuration */
- WORD n, ne, is;
- BYTE sn[12], *fn, sum;
- WCHAR *lfn;
-
-
- fn = dj->fn; lfn = dj->lfn;
- mem_cpy(sn, fn, 12);
-
- if (_FS_RPATH && (sn[NS] & NS_DOT)) return FR_INVALID_NAME; /* Cannot create dot entry */
-
- if (sn[NS] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */
- fn[NS] = 0; dj->lfn = NULL; /* Find only SFN */
- for (n = 1; n < 100; n++) {
- gen_numname(fn, sn, lfn, n); /* Generate a numbered name */
- res = dir_find(dj); /* Check if the name collides with existing SFN */
- if (res != FR_OK) break;
- }
- if (n == 100) return FR_DENIED; /* Abort if too many collisions */
- if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */
- fn[NS] = sn[NS]; dj->lfn = lfn;
- }
-
- if (sn[NS] & NS_LFN) { /* When LFN is to be created, reserve reserve an SFN + LFN entries. */
- for (ne = 0; lfn[ne]; ne++) ;
- ne = (ne + 25) / 13;
- } else { /* Otherwise reserve only an SFN entry. */
- ne = 1;
- }
-
- /* Reserve contiguous entries */
- res = dir_seek(dj, 0);
- if (res != FR_OK) return res;
- n = is = 0;
- do {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- c = *dj->dir; /* Check the entry status */
- if (c == 0xE5 || c == 0) { /* Is it a blank entry? */
- if (n == 0) is = dj->index; /* First index of the contigulus entry */
- if (++n == ne) break; /* A contiguous entry that requiered count is found */
- } else {
- n = 0; /* Not a blank entry. Restart to search */
- }
- res = dir_next(dj, TRUE); /* Next entry with table streach */
- } while (res == FR_OK);
-
- if (res == FR_OK && ne > 1) { /* Initialize LFN entry if needed */
- res = dir_seek(dj, is);
- if (res == FR_OK) {
- sum = sum_sfn(dj->fn); /* Sum of the SFN tied to the LFN */
- ne--;
- do { /* Store LFN entries in bottom first */
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- fit_lfn(dj->lfn, dj->dir, (BYTE)ne, sum);
- dj->fs->wflag = 1;
- res = dir_next(dj, FALSE); /* Next entry */
- } while (res == FR_OK && --ne);
- }
- }
-
-#else /* Non LFN configuration */
- res = dir_seek(dj, 0);
- if (res == FR_OK) {
- do { /* Find a blank entry for the SFN */
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- c = *dj->dir;
- if (c == 0xE5 || c == 0) break; /* Is it a blank entry? */
- res = dir_next(dj, TRUE); /* Next entry with table streach */
- } while (res == FR_OK);
- }
-#endif
-
- if (res == FR_OK) { /* Initialize the SFN entry */
- res = move_window(dj->fs, dj->sect);
- if (res == FR_OK) {
- dir = dj->dir;
- mem_set(dir, 0, 32); /* Clean the entry */
- mem_cpy(dir, dj->fn, 11); /* Put SFN */
- dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */
- dj->fs->wflag = 1;
- }
- }
-
- return res;
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Remove an object from the directory */
-/*-----------------------------------------------------------------------*/
-#if !_FS_READONLY && !_FS_MINIMIZE
-static
-FRESULT dir_remove ( /* FR_OK: Successful, FR_DISK_ERR: A disk error */
- DIR *dj /* Directory object pointing the entry to be removed */
-)
-{
- FRESULT res;
-#if _USE_LFN /* LFN configuration */
- WORD i;
-
- i = dj->index; /* SFN index */
- res = dir_seek(dj, (WORD)((dj->lfn_idx == 0xFFFF) ? i : dj->lfn_idx)); /* Goto the SFN or top of the LFN entries */
- if (res == FR_OK) {
- do {
- res = move_window(dj->fs, dj->sect);
- if (res != FR_OK) break;
- *dj->dir = 0xE5; /* Mark the entry "deleted" */
- dj->fs->wflag = 1;
- if (dj->index >= i) break; /* When reached SFN, all entries of the object has been deleted. */
- res = dir_next(dj, FALSE); /* Next entry */
- } while (res == FR_OK);
- if (res == FR_NO_FILE) res = FR_INT_ERR;
- }
-
-#else /* Non LFN configuration */
- res = dir_seek(dj, dj->index);
- if (res == FR_OK) {
- res = move_window(dj->fs, dj->sect);
- if (res == FR_OK) {
- *dj->dir = 0xE5; /* Mark the entry "deleted" */
- dj->fs->wflag = 1;
- }
- }
-#endif
-
- return res;
-}
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Pick a segment and create the object name in directory form */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT create_name (
- DIR *dj, /* Pointer to the directory object */
- const XCHAR **path /* Pointer to pointer to the segment in the path string */
-)
-{
-#ifdef _EXCVT
- static const BYTE cvt[] = _EXCVT;
-#endif
-
-#if _USE_LFN /* LFN configuration */
- BYTE b, cf;
- WCHAR w, *lfn;
- int i, ni, si, di;
- const XCHAR *p;
-
- /* Create LFN in Unicode */
- si = di = 0;
- p = *path;
- lfn = dj->lfn;
- for (;;) {
- w = p[si++]; /* Get a character */
- if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */
- if (di >= _MAX_LFN) /* Reject too long name */
- return FR_INVALID_NAME;
-#if !_LFN_UNICODE
- w &= 0xFF;
- if (IsDBCS1(w)) { /* If it is a DBC 1st byte */
- b = p[si++]; /* Get 2nd byte */
- if (!IsDBCS2(b)) /* Reject invalid code for DBC */
- return FR_INVALID_NAME;
- w = (w << 8) + b;
- }
- w = ff_convert(w, 1); /* Convert OEM to Unicode */
- if (!w) return FR_INVALID_NAME; /* Reject invalid code */
-#endif
- if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal chars for LFN */
- return FR_INVALID_NAME;
- lfn[di++] = w; /* Store the Unicode char */
- }
- *path = &p[si]; /* Rerurn pointer to the next segment */
- cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
-#if _FS_RPATH
- if ((di == 1 && lfn[di - 1] == '.') || /* Is this a dot entry? */
- (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) {
- lfn[di] = 0;
- for (i = 0; i < 11; i++)
- dj->fn[i] = (i < di) ? '.' : ' ';
- dj->fn[i] = cf | NS_DOT; /* This is a dot entry */
- return FR_OK;
- }
-#endif
- while (di) { /* Strip trailing spaces and dots */
- w = lfn[di - 1];
- if (w != ' ' && w != '.') break;
- di--;
- }
- if (!di) return FR_INVALID_NAME; /* Reject null string */
-
- lfn[di] = 0; /* LFN is created */
-
- /* Create SFN in directory form */
- mem_set(dj->fn, ' ', 11);
- for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */
- if (si) cf |= NS_LOSS | NS_LFN;
- while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */
-
- b = i = 0; ni = 8;
- for (;;) {
- w = lfn[si++]; /* Get an LFN char */
- if (!w) break; /* Break on enf of the LFN */
- if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */
- cf |= NS_LOSS | NS_LFN; continue;
- }
-
- if (i >= ni || si == di) { /* Extension or end of SFN */
- if (ni == 11) { /* Long extension */
- cf |= NS_LOSS | NS_LFN; break;
- }
- if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */
- if (si > di) break; /* No extension */
- si = di; i = 8; ni = 11; /* Enter extension section */
- b <<= 2; continue;
- }
-
- if (w >= 0x80) { /* Non ASCII char */
-#ifdef _EXCVT
- w = ff_convert(w, 0); /* Unicode -> OEM code */
- if (w) w = cvt[w - 0x80]; /* Convert extended char to upper (SBCS) */
-#else
- w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */
-#endif
- cf |= NS_LFN; /* Force create LFN entry */
- }
-
- if (_DF1S && w >= 0x100) { /* Double byte char */
- if (i >= ni - 1) {
- cf |= NS_LOSS | NS_LFN; i = ni; continue;
- }
- dj->fn[i++] = (BYTE)(w >> 8);
- } else { /* Single byte char */
- if (!w || chk_chr("+,;[=]", w)) { /* Replace illegal chars for SFN */
- w = '_'; cf |= NS_LOSS | NS_LFN; /* Lossy conversion */
- } else {
- if (IsUpper(w)) { /* ASCII large capital */
- b |= 2;
- } else {
- if (IsLower(w)) { /* ASCII small capital */
- b |= 1; w -= 0x20;
- }
- }
- }
- }
- dj->fn[i++] = (BYTE)w;
- }
-
- if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05; /* If the first char collides with deleted mark, replace it with 0x05 */
-
- if (ni == 8) b <<= 2;
- if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */
- cf |= NS_LFN;
- if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended char, NT flags are created */
- if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */
- if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */
- }
-
- dj->fn[NS] = cf; /* SFN is created */
-
- return FR_OK;
-
-
-#else /* Non-LFN configuration */
- BYTE b, c, d, *sfn;
- int ni, si, i;
- const char *p;
-
- /* Create file name in directory form */
- sfn = dj->fn;
- mem_set(sfn, ' ', 11);
- si = i = b = 0; ni = 8;
- p = *path;
-#if _FS_RPATH
- if (p[si] == '.') { /* Is this a dot entry? */
- for (;;) {
- c = p[si++];
- if (c != '.' || si >= 3) break;
- sfn[i++] = c;
- }
- if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME;
- *path = &p[si]; /* Rerurn pointer to the next segment */
- sfn[NS] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */
- return FR_OK;
- }
-#endif
- for (;;) {
- c = p[si++];
- if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */
- if (c == '.' || i >= ni) {
- if (ni != 8 || c != '.') return FR_INVALID_NAME;
- i = 8; ni = 11;
- b <<= 2; continue;
- }
- if (c >= 0x80) { /* Extended char */
-#ifdef _EXCVT
- c = cvt[c - 0x80]; /* Convert extend char (SBCS) */
-#else
- b |= 3; /* Eliminate NT flag if ext char is exist */
-#if !_DF1S /* ASCII only cfg */
- return FR_INVALID_NAME;
-#endif
-#endif
- }
- if (IsDBCS1(c)) { /* DBC 1st byte? */
- d = p[si++]; /* Get 2nd byte */
- if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */
- return FR_INVALID_NAME;
- sfn[i++] = c;
- sfn[i++] = d;
- } else { /* Single byte code */
- if (chk_chr(" \"*+,[=]|\x7F", c)) /* Reject illegal chrs for SFN */
- return FR_INVALID_NAME;
- if (IsUpper(c)) { /* ASCII large capital? */
- b |= 2;
- } else {
- if (IsLower(c)) { /* ASCII small capital? */
- b |= 1; c -= 0x20;
- }
- }
- sfn[i++] = c;
- }
- }
- *path = &p[si]; /* Rerurn pointer to the next segment */
- c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
-
- if (!i) return FR_INVALID_NAME; /* Reject null string */
- if (sfn[0] == 0xE5) sfn[0] = 0x05; /* When first char collides with 0xE5, replace it with 0x05 */
-
- if (ni == 8) b <<= 2;
- if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Extension has only small capital) */
- if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Filename has only small capital) */
-
- sfn[NS] = c; /* Store NT flag, File name is created */
-
- return FR_OK;
-#endif
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Get file information from directory entry */
-/*-----------------------------------------------------------------------*/
-#if _FS_MINIMIZE <= 1
-static
-void get_fileinfo ( /* No return code */
- DIR *dj, /* Pointer to the directory object */
- FILINFO *fno /* Pointer to the file information to be filled */
-)
-{
- int i;
- BYTE c, nt, *dir;
- char *p;
-
-
- p = fno->fname;
- if (dj->sect) {
- dir = dj->dir;
- nt = dir[DIR_NTres]; /* NT flag */
- for (i = 0; i < 8; i++) { /* Copy name body */
- c = dir[i];
- if (c == ' ') break;
- if (c == 0x05) c = 0xE5;
- if (_USE_LFN && (nt & NS_BODY) && IsUpper(c)) c += 0x20;
- *p++ = c;
- }
- if (dir[8] != ' ') { /* Copy name extension */
- *p++ = '.';
- for (i = 8; i < 11; i++) {
- c = dir[i];
- if (c == ' ') break;
- if (_USE_LFN && (nt & NS_EXT) && IsUpper(c)) c += 0x20;
- *p++ = c;
- }
- }
- fno->fattrib = dir[DIR_Attr]; /* Attribute */
- fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */
- fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */
- fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */
- }
- *p = 0;
-
-#if _USE_LFN
- if (fno->lfname) {
- XCHAR *tp = fno->lfname;
- WCHAR w, *lfn;
-
- i = 0;
- if (dj->sect && dj->lfn_idx != 0xFFFF) {/* Get LFN if available */
- lfn = dj->lfn;
- while ((w = *lfn++) != 0) { /* Get an LFN char */
-#if !_LFN_UNICODE
- w = ff_convert(w, 0); /* Unicode -> OEM conversion */
- if (!w) { i = 0; break; } /* Could not convert, no LFN */
- if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC */
- tp[i++] = (XCHAR)(w >> 8);
-#endif
- if (i >= fno->lfsize - 1) { i = 0; break; } /* Buffer overrun, no LFN */
- tp[i++] = (XCHAR)w;
- }
- }
- tp[i] = 0; /* Terminator */
- }
-#endif
-}
-#endif /* _FS_MINIMIZE <= 1 */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Follow a file path */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
- DIR *dj, /* Directory object to return last directory and found object */
- const XCHAR *path /* Full-path string to find a file or directory */
-)
-{
- FRESULT res;
- BYTE *dir, last;
-
-
- while (!_USE_LFN && *path == ' ') path++; /* Skip leading spaces */
-#if _FS_RPATH
- if (*path == '/' || *path == '\\') { /* There is a heading separator */
- path++; dj->sclust = 0; /* Strip it and start from the root dir */
- } else { /* No heading saparator */
- dj->sclust = dj->fs->cdir; /* Start from the current dir */
- }
-#else
- if (*path == '/' || *path == '\\') /* Strip heading separator if exist */
- path++;
- dj->sclust = 0; /* Start from the root dir */
-#endif
-
- if ((UINT)*path < ' ') { /* Null path means the start directory itself */
- res = dir_seek(dj, 0);
- dj->dir = NULL;
-
- } else { /* Follow path */
- for (;;) {
- res = create_name(dj, &path); /* Get a segment */
- if (res != FR_OK) break;
- res = dir_find(dj); /* Find it */
- last = *(dj->fn+NS) & NS_LAST;
- if (res != FR_OK) { /* Could not find the object */
- if (res == FR_NO_FILE && !last)
- res = FR_NO_PATH;
- break;
- }
- if (last) break; /* Last segment match. Function completed. */
- dir = dj->dir; /* There is next segment. Follow the sub directory */
- if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */
- res = FR_NO_PATH; break;
- }
- dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- }
- }
-
- return res;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Load boot record and check if it is an FAT boot record */
-/*-----------------------------------------------------------------------*/
-
-static
-BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
- FATFS *fs, /* File system object */
- DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
-)
-{
- if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK) /* Load boot record */
- return 3;
- if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
- return 2;
-
- if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
- return 0;
- if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
- return 0;
-
- return 1;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Make sure that the file system is valid */
-/*-----------------------------------------------------------------------*/
-
-
-FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occured */
- const XCHAR **path, /* Pointer to pointer to the path name (drive number) */
- FATFS **rfs, /* Pointer to pointer to the found file system object */
- BYTE chk_wp /* !=0: Check media write protection for write access */
-)
-{
- BYTE fmt, *tbl;
- UINT vol;
- DSTATUS stat;
- DWORD bsect, fsize, tsect, mclst;
- const XCHAR *p = *path;
- FATFS *fs;
-
- /* Get logical drive number from the path name */
- vol = p[0] - '0'; /* Is there a drive number? */
- if (vol <= 9 && p[1] == ':') { /* Found a drive number, get and strip it */
- p += 2; *path = p; /* Return pointer to the path name */
- } else { /* No drive number is given */
-#if _FS_RPATH
- vol = Drive; /* Use current drive */
-#else
- vol = 0; /* Use drive 0 */
-#endif
- }
-
- /* Check if the logical drive is valid or not */
- if (vol >= _DRIVES) /* Is the drive number valid? */
- return FR_INVALID_DRIVE;
- *rfs = fs = FatFs[vol]; /* Returen pointer to the corresponding file system object */
- if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */
-
- ENTER_FF(fs); /* Lock file system */
-
- if (fs->fs_type) { /* If the logical drive has been mounted */
- stat = disk_status(fs->drive);
- if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized (has not been changed), */
-#if !_FS_READONLY
- if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
- return FR_WRITE_PROTECTED;
-#endif
- return FR_OK; /* The file system object is valid */
- }
- }
-
- /* The logical drive must be mounted. Following code attempts to mount the volume */
-
- fs->fs_type = 0; /* Clear the file system object */
- fs->drive = (BYTE)LD2PD(vol); /* Bind the logical drive and a physical drive */
- stat = disk_initialize(fs->drive); /* Initialize low level disk I/O layer */
- if (stat & STA_NOINIT) /* Check if the drive is ready */
- return FR_NOT_READY;
-#if _MAX_SS != 512 /* Get disk sector size if needed */
- if (disk_ioctl(fs->drive, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS)
- return FR_NO_FILESYSTEM;
-#endif
-#if !_FS_READONLY
- if (chk_wp && (stat & STA_PROTECT)) /* Check disk write protection if needed */
- return FR_WRITE_PROTECTED;
-#endif
- /* Search FAT partition on the drive */
- fmt = check_fs(fs, bsect = 0); /* Check sector 0 as an SFD format */
- if (fmt == 1) { /* Not an FAT boot record, it may be patitioned */
- /* Check a partition listed in top of the partition table */
- tbl = &fs->win[MBR_Table + LD2PT(vol) * 16]; /* Partition table */
- if (tbl[4]) { /* Is the partition existing? */
- bsect = LD_DWORD(&tbl[8]); /* Partition offset in LBA */
- fmt = check_fs(fs, bsect); /* Check the partition */
- }
- }
- if (fmt == 3) return FR_DISK_ERR;
- if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs)) /* No valid FAT patition is found */
- return FR_NO_FILESYSTEM;
-
- /* Initialize the file system object */
- fsize = LD_WORD(fs->win+BPB_FATSz16); /* Number of sectors per FAT */
- if (!fsize) fsize = LD_DWORD(fs->win+BPB_FATSz32);
- fs->sects_fat = fsize;
- fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */
- fsize *= fs->n_fats; /* (Number of sectors in FAT area) */
- fs->fatbase = bsect + LD_WORD(fs->win+BPB_RsvdSecCnt); /* FAT start sector (lba) */
- fs->csize = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */
- fs->n_rootdir = LD_WORD(fs->win+BPB_RootEntCnt); /* Nmuber of root directory entries */
- tsect = LD_WORD(fs->win+BPB_TotSec16); /* Number of sectors on the volume */
- if (!tsect) tsect = LD_DWORD(fs->win+BPB_TotSec32);
- fs->max_clust = mclst = (tsect /* Last cluster# + 1 (Number of clusters + 2) */
- - LD_WORD(fs->win+BPB_RsvdSecCnt) - fsize - fs->n_rootdir / (SS(fs)/32)
- ) / fs->csize + 2;
-
- fmt = FS_FAT12; /* Determine the FAT sub type */
- if (mclst >= 0xFF7) fmt = FS_FAT16; /* Number of clusters >= 0xFF5 */
- if (mclst >= 0xFFF7) fmt = FS_FAT32; /* Number of clusters >= 0xFFF5 */
-
- if (fmt == FS_FAT32)
- fs->dirbase = LD_DWORD(fs->win+BPB_RootClus); /* Root directory start cluster */
- else
- fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */
- fs->database = fs->fatbase + fsize + fs->n_rootdir / (SS(fs)/32); /* Data start sector (lba) */
-
-#if !_FS_READONLY
- /* Initialize allocation information */
- fs->free_clust = 0xFFFFFFFF;
- fs->wflag = 0;
- /* Get fsinfo if needed */
- if (fmt == FS_FAT32) {
- fs->fsi_flag = 0;
- fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);
- if (disk_read(fs->drive, fs->win, fs->fsi_sector, 1) == RES_OK &&
- LD_WORD(fs->win+BS_55AA) == 0xAA55 &&
- LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&
- LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {
- fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);
- fs->free_clust = LD_DWORD(fs->win+FSI_Free_Count);
- }
- }
-#endif
- fs->fs_type = fmt; /* FAT sub-type */
- fs->winsect = 0; /* Invalidate sector cache */
-#if _FS_RPATH
- fs->cdir = 0; /* Current directory (root dir) */
-#endif
- fs->id = ++Fsid; /* File system mount ID */
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Check if the file/dir object is valid or not */
-/*-----------------------------------------------------------------------*/
-
-static
-FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */
- FATFS *fs, /* Pointer to the file system object */
- WORD id /* Member id of the target object to be checked */
-)
-{
- if (!fs || !fs->fs_type || fs->id != id)
- return FR_INVALID_OBJECT;
-
- ENTER_FF(fs); /* Lock file system */
-
- if (disk_status(fs->drive) & STA_NOINIT)
- return FR_NOT_READY;
-
- return FR_OK;
-}
-
-
-
-
-/*--------------------------------------------------------------------------
-
- Public Functions
-
---------------------------------------------------------------------------*/
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Mount/Unmount a Locical Drive */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_mount (
- BYTE vol, /* Logical drive number to be mounted/unmounted */
- FATFS *fs /* Pointer to new file system object (NULL for unmount)*/
-)
-{
- FATFS *rfs;
-
-
- if (vol >= _DRIVES) /* Check if the drive number is valid */
- return FR_INVALID_DRIVE;
- rfs = FatFs[vol]; /* Get current fs object */
-
- if (rfs) {
-#if _FS_REENTRANT /* Discard sync object of the current volume */
- if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;
-#endif
- rfs->fs_type = 0; /* Clear old fs object */
- }
-
- if (fs) {
- fs->fs_type = 0; /* Clear new fs object */
-#if _FS_REENTRANT /* Create sync object for the new volume */
- if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;
-#endif
- }
- FatFs[vol] = fs; /* Register new fs object */
-
- return FR_OK;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Open or Create a File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_open (
- FIL *fp, /* Pointer to the blank file object */
- const XCHAR *path, /* Pointer to the file name */
- BYTE mode /* Access mode and file open mode flags */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- fp->fs = NULL; /* Clear file object */
-#if !_FS_READONLY
- mode &= (FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW);
- res = chk_mounted(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)));
-#else
- mode &= FA_READ;
- res = chk_mounted(&path, &dj.fs, 0);
-#endif
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
-
-#if !_FS_READONLY
- /* Create or Open a file */
- if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) {
- DWORD ps, cl;
-
- if (res != FR_OK) { /* No file, create new */
- if (res == FR_NO_FILE) /* There is no file to open, create a new entry */
- res = dir_register(&dj);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- mode |= FA_CREATE_ALWAYS;
- dir = dj.dir; /* Created entry (SFN entry) */
- }
- else { /* Any object is already existing */
- if (mode & FA_CREATE_NEW) /* Cannot create new */
- LEAVE_FF(dj.fs, FR_EXIST);
- dir = dj.dir;
- if (!dir || (dir[DIR_Attr] & (AM_RDO | AM_DIR))) /* Cannot overwrite it (R/O or DIR) */
- LEAVE_FF(dj.fs, FR_DENIED);
- if (mode & FA_CREATE_ALWAYS) { /* Resize it to zero on over write mode */
- cl = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO); /* Get start cluster */
- ST_WORD(dir+DIR_FstClusHI, 0); /* cluster = 0 */
- ST_WORD(dir+DIR_FstClusLO, 0);
- ST_DWORD(dir+DIR_FileSize, 0); /* size = 0 */
- dj.fs->wflag = 1;
- ps = dj.fs->winsect; /* Remove the cluster chain */
- if (cl) {
- res = remove_chain(dj.fs, cl);
- if (res) LEAVE_FF(dj.fs, res);
- dj.fs->last_clust = cl - 1; /* Reuse the cluster hole */
- }
- res = move_window(dj.fs, ps);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- }
- }
- if (mode & FA_CREATE_ALWAYS) {
- dir[DIR_Attr] = 0; /* Reset attribute */
- ps = get_fattime();
- ST_DWORD(dir+DIR_CrtTime, ps); /* Created time */
- dj.fs->wflag = 1;
- mode |= FA__WRITTEN; /* Set file changed flag */
- }
- }
- /* Open an existing file */
- else {
-#endif /* !_FS_READONLY */
- if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
- dir = dj.dir;
- if (!dir || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
- LEAVE_FF(dj.fs, FR_NO_FILE);
-#if !_FS_READONLY
- if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */
- LEAVE_FF(dj.fs, FR_DENIED);
- }
- fp->dir_sect = dj.fs->winsect; /* Pointer to the directory entry */
- fp->dir_ptr = dj.dir;
-#endif
- fp->flag = mode; /* File access mode */
- fp->org_clust = /* File start cluster */
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- fp->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */
- fp->fptr = 0; fp->csect = 255; /* File pointer */
- fp->dsect = 0;
- fp->fs = dj.fs; fp->id = dj.fs->id; /* Owner file system object of the file */
-
- LEAVE_FF(dj.fs, FR_OK);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_read (
- FIL *fp, /* Pointer to the file object */
- void *buff, /* Pointer to data buffer */
- UINT btr, /* Number of bytes to read */
- UINT *br /* Pointer to number of bytes read */
-)
-{
- FRESULT res;
- DWORD clst, sect, remain;
- UINT rcnt, cc;
- BYTE *rbuff = buff;
-
-
- *br = 0; /* Initialize bytes read */
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_READ)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
- remain = fp->fsize - fp->fptr;
- if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
-
- for ( ; btr; /* Repeat until all data transferred */
- rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
- if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
- if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
- clst = (fp->fptr == 0) ? /* On the top of the file? */
- fp->org_clust : get_fat(fp->fs, fp->curr_clust);
- if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->curr_clust = clst; /* Update current cluster */
- fp->csect = 0; /* Reset sector offset in the cluster */
- }
- sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
- if (!sect) ABORT(fp->fs, FR_INT_ERR);
- sect += fp->csect;
- cc = btr / SS(fp->fs); /* When remaining bytes >= sector size, */
- if (cc) { /* Read maximum contiguous sectors directly */
- if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
- cc = fp->fs->csize - fp->csect;
- if (disk_read(fp->fs->drive, rbuff, sect, (BYTE)cc) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
-#if !_FS_READONLY && _FS_MINIMIZE <= 2
-#if _FS_TINY
- if (fp->fs->wflag && fp->fs->winsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
- mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs));
-#else
- if ((fp->flag & FA__DIRTY) && fp->dsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
- mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs));
-#endif
-#endif
- fp->csect += (BYTE)cc; /* Next sector address in the cluster */
- rcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
- continue;
- }
-#if !_FS_TINY
-#if !_FS_READONLY
- if (fp->flag & FA__DIRTY) { /* Write sector I/O buffer if needed */
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- if (fp->dsect != sect) { /* Fill sector buffer with file data */
- if (disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- }
-#endif
- fp->dsect = sect;
- fp->csect++; /* Next sector address in the cluster */
- }
- rcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Get partial sector data from sector buffer */
- if (rcnt > btr) rcnt = btr;
-#if _FS_TINY
- if (move_window(fp->fs, fp->dsect)) /* Move sector window */
- ABORT(fp->fs, FR_DISK_ERR);
- mem_cpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
-#else
- mem_cpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
-#endif
- }
-
- LEAVE_FF(fp->fs, FR_OK);
-}
-
-
-
-
-#if !_FS_READONLY
-/*-----------------------------------------------------------------------*/
-/* Write File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_write (
- FIL *fp, /* Pointer to the file object */
- const void *buff, /* Pointer to the data to be written */
- UINT btw, /* Number of bytes to write */
- UINT *bw /* Pointer to number of bytes written */
-)
-{
- FRESULT res;
- DWORD clst, sect;
- UINT wcnt, cc;
- const BYTE *wbuff = buff;
-
-
- *bw = 0; /* Initialize bytes written */
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_WRITE)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
- if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
-
- for ( ; btw; /* Repeat until all data transferred */
- wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
- if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
- if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
- if (fp->fptr == 0) { /* On the top of the file? */
- clst = fp->org_clust; /* Follow from the origin */
- if (clst == 0) /* When there is no cluster chain, */
- fp->org_clust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */
- } else { /* Middle or end of the file */
- clst = create_chain(fp->fs, fp->curr_clust); /* Follow or streach cluster chain */
- }
- if (clst == 0) break; /* Could not allocate a new cluster (disk full) */
- if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->curr_clust = clst; /* Update current cluster */
- fp->csect = 0; /* Reset sector address in the cluster */
- }
-#if _FS_TINY
- if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0)) /* Write back data buffer prior to following direct transfer */
- ABORT(fp->fs, FR_DISK_ERR);
-#else
- if (fp->flag & FA__DIRTY) { /* Write back data buffer prior to following direct transfer */
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
- if (!sect) ABORT(fp->fs, FR_INT_ERR);
- sect += fp->csect;
- cc = btw / SS(fp->fs); /* When remaining bytes >= sector size, */
- if (cc) { /* Write maximum contiguous sectors directly */
- if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
- cc = fp->fs->csize - fp->csect;
- if (disk_write(fp->fs->drive, wbuff, sect, (BYTE)cc) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
-#if _FS_TINY
- if (fp->fs->winsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
- mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs));
- fp->fs->wflag = 0;
- }
-#else
- if (fp->dsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
- mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs));
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- fp->csect += (BYTE)cc; /* Next sector address in the cluster */
- wcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
- continue;
- }
-#if _FS_TINY
- if (fp->fptr >= fp->fsize) { /* Avoid silly buffer filling at growing edge */
- if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR);
- fp->fs->winsect = sect;
- }
-#else
- if (fp->dsect != sect) { /* Fill sector buffer with file data */
- if (fp->fptr < fp->fsize &&
- disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- }
-#endif
- fp->dsect = sect;
- fp->csect++; /* Next sector address in the cluster */
- }
- wcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Put partial sector into file I/O buffer */
- if (wcnt > btw) wcnt = btw;
-#if _FS_TINY
- if (move_window(fp->fs, fp->dsect)) /* Move sector window */
- ABORT(fp->fs, FR_DISK_ERR);
- mem_cpy(&fp->fs->win[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
- fp->fs->wflag = 1;
-#else
- mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
- fp->flag |= FA__DIRTY;
-#endif
- }
-
- if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */
- fp->flag |= FA__WRITTEN; /* Set file changed flag */
-
- LEAVE_FF(fp->fs, FR_OK);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Synchronize the File Object */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_sync (
- FIL *fp /* Pointer to the file object */
-)
-{
- FRESULT res;
- DWORD tim;
- BYTE *dir;
-
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res == FR_OK) {
- if (fp->flag & FA__WRITTEN) { /* Has the file been written? */
-#if !_FS_TINY /* Write-back dirty buffer */
- if (fp->flag & FA__DIRTY) {
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- LEAVE_FF(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- /* Update the directory entry */
- res = move_window(fp->fs, fp->dir_sect);
- if (res == FR_OK) {
- dir = fp->dir_ptr;
- dir[DIR_Attr] |= AM_ARC; /* Set archive bit */
- ST_DWORD(dir+DIR_FileSize, fp->fsize); /* Update file size */
- ST_WORD(dir+DIR_FstClusLO, fp->org_clust); /* Update start cluster */
- ST_WORD(dir+DIR_FstClusHI, fp->org_clust >> 16);
- tim = get_fattime(); /* Updated time */
- ST_DWORD(dir+DIR_WrtTime, tim);
- fp->flag &= ~FA__WRITTEN;
- fp->fs->wflag = 1;
- res = sync(fp->fs);
- }
- }
- }
-
- LEAVE_FF(fp->fs, res);
-}
-
-#endif /* !_FS_READONLY */
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Close File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_close (
- FIL *fp /* Pointer to the file object to be closed */
-)
-{
- FRESULT res;
-
-
-#if _FS_READONLY
- res = validate(fp->fs, fp->id);
- if (res == FR_OK) fp->fs = NULL;
- LEAVE_FF(fp->fs, res);
-#else
- res = f_sync(fp);
- if (res == FR_OK) fp->fs = NULL;
- return res;
-#endif
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change Current Drive/Directory */
-/*-----------------------------------------------------------------------*/
-
-#if _FS_RPATH
-
-FRESULT f_chdrive (
- BYTE drv /* Drive number */
-)
-{
- if (drv >= _DRIVES) return FR_INVALID_DRIVE;
-
- Drive = drv;
-
- return FR_OK;
-}
-
-
-
-
-FRESULT f_chdir (
- const XCHAR *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj.fs, 0);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (res == FR_OK) { /* Follow completed */
- dir = dj.dir; /* Pointer to the entry */
- if (!dir) {
- dj.fs->cdir = 0; /* No entry (root dir) */
- } else {
- if (dir[DIR_Attr] & AM_DIR) /* Reached to the dir */
- dj.fs->cdir = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- else
- res = FR_NO_PATH; /* Could not reach the dir (it is a file) */
- }
- }
- if (res == FR_NO_FILE) res = FR_NO_PATH;
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-#endif
-
-
-
-#if _FS_MINIMIZE <= 2
-/*-----------------------------------------------------------------------*/
-/* Seek File R/W Pointer */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_lseek (
- FIL *fp, /* Pointer to the file object */
- DWORD ofs /* File pointer from top of file */
-)
-{
- FRESULT res;
- DWORD clst, bcs, nsect, ifptr;
-
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (ofs > fp->fsize /* In read-only mode, clip offset with the file size */
-#if !_FS_READONLY
- && !(fp->flag & FA_WRITE)
-#endif
- ) ofs = fp->fsize;
-
- ifptr = fp->fptr;
- fp->fptr = nsect = 0; fp->csect = 255;
- if (ofs > 0) {
- bcs = (DWORD)fp->fs->csize * SS(fp->fs); /* Cluster size (byte) */
- if (ifptr > 0 &&
- (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */
- fp->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */
- ofs -= fp->fptr;
- clst = fp->curr_clust;
- } else { /* When seek to back cluster, */
- clst = fp->org_clust; /* start from the first cluster */
-#if !_FS_READONLY
- if (clst == 0) { /* If no cluster chain, create a new chain */
- clst = create_chain(fp->fs, 0);
- if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->org_clust = clst;
- }
-#endif
- fp->curr_clust = clst;
- }
- if (clst != 0) {
- while (ofs > bcs) { /* Cluster following loop */
-#if !_FS_READONLY
- if (fp->flag & FA_WRITE) { /* Check if in write mode or not */
- clst = create_chain(fp->fs, clst); /* Force streached if in write mode */
- if (clst == 0) { /* When disk gets full, clip file size */
- ofs = bcs; break;
- }
- } else
-#endif
- clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- if (clst <= 1 || clst >= fp->fs->max_clust) ABORT(fp->fs, FR_INT_ERR);
- fp->curr_clust = clst;
- fp->fptr += bcs;
- ofs -= bcs;
- }
- fp->fptr += ofs;
- fp->csect = (BYTE)(ofs / SS(fp->fs)); /* Sector offset in the cluster */
- if (ofs % SS(fp->fs)) {
- nsect = clust2sect(fp->fs, clst); /* Current sector */
- if (!nsect) ABORT(fp->fs, FR_INT_ERR);
- nsect += fp->csect;
- fp->csect++;
- }
- }
- }
- if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) {
-#if !_FS_TINY
-#if !_FS_READONLY
- if (fp->flag & FA__DIRTY) { /* Write-back dirty buffer if needed */
- if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
- fp->flag &= ~FA__DIRTY;
- }
-#endif
- if (disk_read(fp->fs->drive, fp->buf, nsect, 1) != RES_OK)
- ABORT(fp->fs, FR_DISK_ERR);
-#endif
- fp->dsect = nsect;
- }
-#if !_FS_READONLY
- if (fp->fptr > fp->fsize) { /* Set changed flag if the file size is extended */
- fp->fsize = fp->fptr;
- fp->flag |= FA__WRITTEN;
- }
-#endif
-
- LEAVE_FF(fp->fs, res);
-}
-
-
-
-
-#if _FS_MINIMIZE <= 1
-/*-----------------------------------------------------------------------*/
-/* Create a Directroy Object */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_opendir (
- DIR *dj, /* Pointer to directory object to create */
- const XCHAR *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj->fs, 0);
- if (res == FR_OK) {
- INITBUF((*dj), sfn, lfn);
- res = follow_path(dj, path); /* Follow the path to the directory */
- if (res == FR_OK) { /* Follow completed */
- dir = dj->dir;
- if (dir) { /* It is not the root dir */
- if (dir[DIR_Attr] & AM_DIR) { /* The object is a directory */
- dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
- } else { /* The object is not a directory */
- res = FR_NO_PATH;
- }
- }
- if (res == FR_OK) {
- dj->id = dj->fs->id;
- res = dir_seek(dj, 0); /* Rewind dir */
- }
- }
- if (res == FR_NO_FILE) res = FR_NO_PATH;
- }
-
- LEAVE_FF(dj->fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Read Directory Entry in Sequense */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_readdir (
- DIR *dj, /* Pointer to the open directory object */
- FILINFO *fno /* Pointer to file information to return */
-)
-{
- FRESULT res;
- NAMEBUF(sfn, lfn);
-
-
- res = validate(dj->fs, dj->id); /* Check validity of the object */
- if (res == FR_OK) {
- INITBUF((*dj), sfn, lfn);
- if (!fno) {
- res = dir_seek(dj, 0);
- } else {
- res = dir_read(dj);
- if (res == FR_NO_FILE) {
- dj->sect = 0;
- res = FR_OK;
- }
- if (res == FR_OK) { /* A valid entry is found */
- get_fileinfo(dj, fno); /* Get the object information */
- res = dir_next(dj, FALSE); /* Increment index for next */
- if (res == FR_NO_FILE) {
- dj->sect = 0;
- res = FR_OK;
- }
- }
- }
- }
-
- LEAVE_FF(dj->fs, res);
-}
-
-
-
-#if _FS_MINIMIZE == 0
-/*-----------------------------------------------------------------------*/
-/* Get File Status */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_stat (
- const XCHAR *path, /* Pointer to the file path */
- FILINFO *fno /* Pointer to file information to return */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
-
-
- res = chk_mounted(&path, &dj.fs, 0);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (res == FR_OK) { /* Follwo completed */
- if (dj.dir) /* Found an object */
- get_fileinfo(&dj, fno);
- else /* It is root dir */
- res = FR_INVALID_NAME;
- }
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-#if !_FS_READONLY
-/*-----------------------------------------------------------------------*/
-/* Get Number of Free Clusters */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_getfree (
- const XCHAR *path, /* Pointer to the logical drive number (root dir) */
- DWORD *nclst, /* Pointer to the variable to return number of free clusters */
- FATFS **fatfs /* Pointer to pointer to corresponding file system object to return */
-)
-{
- FRESULT res;
- DWORD n, clst, sect, stat;
- UINT i;
- BYTE fat, *p;
-
-
- /* Get drive number */
- res = chk_mounted(&path, fatfs, 0);
- if (res != FR_OK) LEAVE_FF(*fatfs, res);
-
- /* If number of free cluster is valid, return it without cluster scan. */
- if ((*fatfs)->free_clust <= (*fatfs)->max_clust - 2) {
- *nclst = (*fatfs)->free_clust;
- LEAVE_FF(*fatfs, FR_OK);
- }
-
- /* Get number of free clusters */
- fat = (*fatfs)->fs_type;
- n = 0;
- if (fat == FS_FAT12) {
- clst = 2;
- do {
- stat = get_fat(*fatfs, clst);
- if (stat == 0xFFFFFFFF) LEAVE_FF(*fatfs, FR_DISK_ERR);
- if (stat == 1) LEAVE_FF(*fatfs, FR_INT_ERR);
- if (stat == 0) n++;
- } while (++clst < (*fatfs)->max_clust);
- } else {
- clst = (*fatfs)->max_clust;
- sect = (*fatfs)->fatbase;
- i = 0; p = 0;
- do {
- if (!i) {
- res = move_window(*fatfs, sect++);
- if (res != FR_OK)
- LEAVE_FF(*fatfs, res);
- p = (*fatfs)->win;
- i = SS(*fatfs);
- }
- if (fat == FS_FAT16) {
- if (LD_WORD(p) == 0) n++;
- p += 2; i -= 2;
- } else {
- if ((LD_DWORD(p) & 0x0FFFFFFF) == 0) n++;
- p += 4; i -= 4;
- }
- } while (--clst);
- }
- (*fatfs)->free_clust = n;
- if (fat == FS_FAT32) (*fatfs)->fsi_flag = 1;
- *nclst = n;
-
- LEAVE_FF(*fatfs, FR_OK);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Truncate File */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_truncate (
- FIL *fp /* Pointer to the file object */
-)
-{
- FRESULT res;
- DWORD ncl;
-
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check abort flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_WRITE)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
-
- if (fp->fsize > fp->fptr) {
- fp->fsize = fp->fptr; /* Set file size to current R/W point */
- fp->flag |= FA__WRITTEN;
- if (fp->fptr == 0) { /* When set file size to zero, remove entire cluster chain */
- res = remove_chain(fp->fs, fp->org_clust);
- fp->org_clust = 0;
- } else { /* When truncate a part of the file, remove remaining clusters */
- ncl = get_fat(fp->fs, fp->curr_clust);
- res = FR_OK;
- if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;
- if (ncl == 1) res = FR_INT_ERR;
- if (res == FR_OK && ncl < fp->fs->max_clust) {
- res = put_fat(fp->fs, fp->curr_clust, 0x0FFFFFFF);
- if (res == FR_OK) res = remove_chain(fp->fs, ncl);
- }
- }
- }
- if (res != FR_OK) fp->flag |= FA__ERROR;
-
- LEAVE_FF(fp->fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Delete a File or Directory */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_unlink (
- const XCHAR *path /* Pointer to the file or directory path */
-)
-{
- FRESULT res;
- DIR dj, sdj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
- DWORD dclst;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
-
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
-
- dir = dj.dir;
- if (!dir) /* Is it the root directory? */
- LEAVE_FF(dj.fs, FR_INVALID_NAME);
- if (dir[DIR_Attr] & AM_RDO) /* Is it a R/O object? */
- LEAVE_FF(dj.fs, FR_DENIED);
- dclst = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
-
- if (dir[DIR_Attr] & AM_DIR) { /* It is a sub-directory */
- if (dclst < 2) LEAVE_FF(dj.fs, FR_INT_ERR);
- mem_cpy(&sdj, &dj, sizeof(DIR)); /* Check if the sub-dir is empty or not */
- sdj.sclust = dclst;
- res = dir_seek(&sdj, 2);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- res = dir_read(&sdj);
- if (res == FR_OK) res = FR_DENIED; /* Not empty sub-dir */
- if (res != FR_NO_FILE) LEAVE_FF(dj.fs, res);
- }
-
- res = dir_remove(&dj); /* Remove directory entry */
- if (res == FR_OK) {
- if (dclst)
- res = remove_chain(dj.fs, dclst); /* Remove the cluster chain */
- if (res == FR_OK) res = sync(dj.fs);
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Create a Directory */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_mkdir (
- const XCHAR *path /* Pointer to the directory path */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir, n;
- DWORD dsect, dclst, pclst, tim;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
-
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (res == FR_OK) res = FR_EXIST; /* Any file or directory is already existing */
- if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res != FR_NO_FILE) /* Any error occured */
- LEAVE_FF(dj.fs, res);
-
- dclst = create_chain(dj.fs, 0); /* Allocate a new cluster for new directory table */
- res = FR_OK;
- if (dclst == 0) res = FR_DENIED;
- if (dclst == 1) res = FR_INT_ERR;
- if (dclst == 0xFFFFFFFF) res = FR_DISK_ERR;
- if (res == FR_OK)
- res = move_window(dj.fs, 0);
- if (res != FR_OK) LEAVE_FF(dj.fs, res);
- dsect = clust2sect(dj.fs, dclst);
-
- dir = dj.fs->win; /* Initialize the new directory table */
- mem_set(dir, 0, SS(dj.fs));
- mem_set(dir+DIR_Name, ' ', 8+3); /* Create "." entry */
- dir[DIR_Name] = '.';
- dir[DIR_Attr] = AM_DIR;
- tim = get_fattime();
- ST_DWORD(dir+DIR_WrtTime, tim);
- ST_WORD(dir+DIR_FstClusLO, dclst);
- ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
- mem_cpy(dir+32, dir, 32); /* Create ".." entry */
- dir[33] = '.';
- pclst = dj.sclust;
- if (dj.fs->fs_type == FS_FAT32 && pclst == dj.fs->dirbase)
- pclst = 0;
- ST_WORD(dir+32+DIR_FstClusLO, pclst);
- ST_WORD(dir+32+DIR_FstClusHI, pclst >> 16);
- for (n = 0; n < dj.fs->csize; n++) { /* Write dot entries and clear left sectors */
- dj.fs->winsect = dsect++;
- dj.fs->wflag = 1;
- res = move_window(dj.fs, 0);
- if (res) LEAVE_FF(dj.fs, res);
- mem_set(dir, 0, SS(dj.fs));
- }
-
- res = dir_register(&dj);
- if (res != FR_OK) {
- remove_chain(dj.fs, dclst);
- } else {
- dir = dj.dir;
- dir[DIR_Attr] = AM_DIR; /* Attribute */
- ST_DWORD(dir+DIR_WrtTime, tim); /* Crated time */
- ST_WORD(dir+DIR_FstClusLO, dclst); /* Table start cluster */
- ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
- dj.fs->wflag = 1;
- res = sync(dj.fs);
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change File Attribute */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_chmod (
- const XCHAR *path, /* Pointer to the file path */
- BYTE value, /* Attribute bits */
- BYTE mask /* Attribute mask to change */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res == FR_OK) {
- dir = dj.dir;
- if (!dir) { /* Is it a root directory? */
- res = FR_INVALID_NAME;
- } else { /* File or sub directory */
- mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC; /* Valid attribute mask */
- dir[DIR_Attr] = (value & mask) | (dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */
- dj.fs->wflag = 1;
- res = sync(dj.fs);
- }
- }
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Change Timestamp */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_utime (
- const XCHAR *path, /* Pointer to the file/directory name */
- const FILINFO *fno /* Pointer to the timestamp to be set */
-)
-{
- FRESULT res;
- DIR dj;
- NAMEBUF(sfn, lfn);
- BYTE *dir;
-
-
- res = chk_mounted(&path, &dj.fs, 1);
- if (res == FR_OK) {
- INITBUF(dj, sfn, lfn);
- res = follow_path(&dj, path); /* Follow the file path */
- if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- if (res == FR_OK) {
- dir = dj.dir;
- if (!dir) { /* Root directory */
- res = FR_INVALID_NAME;
- } else { /* File or sub-directory */
- ST_WORD(dir+DIR_WrtTime, fno->ftime);
- ST_WORD(dir+DIR_WrtDate, fno->fdate);
- dj.fs->wflag = 1;
- res = sync(dj.fs);
- }
- }
- }
-
- LEAVE_FF(dj.fs, res);
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Rename File/Directory */
-/*-----------------------------------------------------------------------*/
-
-FRESULT f_rename (
- const XCHAR *path_old, /* Pointer to the old name */
- const XCHAR *path_new /* Pointer to the new name */
-)
-{
- FRESULT res;
- DIR dj_old, dj_new;
- NAMEBUF(sfn, lfn);
- BYTE buf[21], *dir;
- DWORD dw;
-
-
- INITBUF(dj_old, sfn, lfn);
- res = chk_mounted(&path_old, &dj_old.fs, 1);
- if (res == FR_OK) {
- dj_new.fs = dj_old.fs;
- res = follow_path(&dj_old, path_old); /* Check old object */
- if (_FS_RPATH && res == FR_OK && (dj_old.fn[NS] & NS_DOT))
- res = FR_INVALID_NAME;
- }
- if (res != FR_OK) LEAVE_FF(dj_old.fs, res); /* The old object is not found */
-
- if (!dj_old.dir) LEAVE_FF(dj_old.fs, FR_NO_FILE); /* Is root dir? */
- mem_cpy(buf, dj_old.dir+DIR_Attr, 21); /* Save the object information */
-
- mem_cpy(&dj_new, &dj_old, sizeof(DIR));
- res = follow_path(&dj_new, path_new); /* Check new object */
- if (res == FR_OK) res = FR_EXIST; /* The new object name is already existing */
- if (res == FR_NO_FILE) { /* Is it a valid path and no name collision? */
- res = dir_register(&dj_new); /* Register the new object */
- if (res == FR_OK) {
- dir = dj_new.dir; /* Copy object information into new entry */
- mem_cpy(dir+13, buf+2, 19);
- dir[DIR_Attr] = buf[0] | AM_ARC;
- dj_old.fs->wflag = 1;
- if (dir[DIR_Attr] & AM_DIR) { /* Update .. entry in the directory if needed */
- dw = clust2sect(dj_new.fs, (DWORD)LD_WORD(dir+DIR_FstClusHI) | LD_WORD(dir+DIR_FstClusLO));
- if (!dw) {
- res = FR_INT_ERR;
- } else {
- res = move_window(dj_new.fs, dw);
- dir = dj_new.fs->win+32;
- if (res == FR_OK && dir[1] == '.') {
- dw = (dj_new.fs->fs_type == FS_FAT32 && dj_new.sclust == dj_new.fs->dirbase) ? 0 : dj_new.sclust;
- ST_WORD(dir+DIR_FstClusLO, dw);
- ST_WORD(dir+DIR_FstClusHI, dw >> 16);
- dj_new.fs->wflag = 1;
- }
- }
- }
- if (res == FR_OK) {
- res = dir_remove(&dj_old); /* Remove old entry */
- if (res == FR_OK)
- res = sync(dj_old.fs);
- }
- }
- }
-
- LEAVE_FF(dj_old.fs, res);
-}
-
-#endif /* !_FS_READONLY */
-#endif /* _FS_MINIMIZE == 0 */
-#endif /* _FS_MINIMIZE <= 1 */
-#endif /* _FS_MINIMIZE <= 2 */
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Forward data to the stream directly (Available on only _FS_TINY cfg) */
-/*-----------------------------------------------------------------------*/
-#if _USE_FORWARD && _FS_TINY
-
-FRESULT f_forward (
- FIL *fp, /* Pointer to the file object */
- UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */
- UINT btr, /* Number of bytes to forward */
- UINT *bf /* Pointer to number of bytes forwarded */
-)
-{
- FRESULT res;
- DWORD remain, clst, sect;
- UINT rcnt;
-
-
- *bf = 0;
-
- res = validate(fp->fs, fp->id); /* Check validity of the object */
- if (res != FR_OK) LEAVE_FF(fp->fs, res);
- if (fp->flag & FA__ERROR) /* Check error flag */
- LEAVE_FF(fp->fs, FR_INT_ERR);
- if (!(fp->flag & FA_READ)) /* Check access mode */
- LEAVE_FF(fp->fs, FR_DENIED);
-
- remain = fp->fsize - fp->fptr;
- if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
-
- for ( ; btr && (*func)(NULL, 0); /* Repeat until all data transferred or stream becomes busy */
- fp->fptr += rcnt, *bf += rcnt, btr -= rcnt) {
- if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
- if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
- clst = (fp->fptr == 0) ? /* On the top of the file? */
- fp->org_clust : get_fat(fp->fs, fp->curr_clust);
- if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
- if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
- fp->curr_clust = clst; /* Update current cluster */
- fp->csect = 0; /* Reset sector address in the cluster */
- }
- fp->csect++; /* Next sector address in the cluster */
- }
- sect = clust2sect(fp->fs, fp->curr_clust); /* Get current data sector */
- if (!sect) ABORT(fp->fs, FR_INT_ERR);
- sect += fp->csect - 1;
- if (move_window(fp->fs, sect)) /* Move sector window */
- ABORT(fp->fs, FR_DISK_ERR);
- fp->dsect = sect;
- rcnt = SS(fp->fs) - (WORD)(fp->fptr % SS(fp->fs)); /* Forward data from sector window */
- if (rcnt > btr) rcnt = btr;
- rcnt = (*func)(&fp->fs->win[(WORD)fp->fptr % SS(fp->fs)], rcnt);
- if (!rcnt) ABORT(fp->fs, FR_INT_ERR);
- }
-
- LEAVE_FF(fp->fs, FR_OK);
-}
-#endif /* _USE_FORWARD */
-
-
-
-#if _USE_MKFS && !_FS_READONLY
-/*-----------------------------------------------------------------------*/
-/* Create File System on the Drive */
-/*-----------------------------------------------------------------------*/
-#define N_ROOTDIR 512 /* Multiple of 32 and <= 2048 */
-#define N_FATS 1 /* 1 or 2 */
-#define MAX_SECTOR 131072000UL /* Maximum partition size */
-#define MIN_SECTOR 2000UL /* Minimum partition size */
-
-
-FRESULT f_mkfs (
- BYTE drv, /* Logical drive number */
- BYTE partition, /* Partitioning rule 0:FDISK, 1:SFD */
- WORD allocsize /* Allocation unit size [bytes] */
-)
-{
- static const DWORD sstbl[] = { 2048000, 1024000, 512000, 256000, 128000, 64000, 32000, 16000, 8000, 4000, 0 };
- static const WORD cstbl[] = { 32768, 16384, 8192, 4096, 2048, 16384, 8192, 4096, 2048, 1024, 512 };
- BYTE fmt, m, *tbl;
- DWORD b_part, b_fat, b_dir, b_data; /* Area offset (LBA) */
- DWORD n_part, n_rsv, n_fat, n_dir; /* Area size */
- DWORD n_clst, d, n;
- WORD as;
- FATFS *fs;
- DSTATUS stat;
-
-
- /* Check validity of the parameters */
- if (drv >= _DRIVES) return FR_INVALID_DRIVE;
- if (partition >= 2) return FR_MKFS_ABORTED;
-
- /* Check mounted drive and clear work area */
- fs = FatFs[drv];
- if (!fs) return FR_NOT_ENABLED;
- fs->fs_type = 0;
- drv = LD2PD(drv);
-
- /* Get disk statics */
- stat = disk_initialize(drv);
- if (stat & STA_NOINIT) return FR_NOT_READY;
- if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
-#if _MAX_SS != 512 /* Get disk sector size */
- if (disk_ioctl(drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK
- || SS(fs) > _MAX_SS)
- return FR_MKFS_ABORTED;
-#endif
- if (disk_ioctl(drv, GET_SECTOR_COUNT, &n_part) != RES_OK || n_part < MIN_SECTOR)
- return FR_MKFS_ABORTED;
- if (n_part > MAX_SECTOR) n_part = MAX_SECTOR;
- b_part = (!partition) ? 63 : 0; /* Boot sector */
- n_part -= b_part;
- for (d = 512; d <= 32768U && d != allocsize; d <<= 1) ; /* Check validity of the allocation unit size */
- if (d != allocsize) allocsize = 0;
- if (!allocsize) { /* Auto selection of cluster size */
- d = n_part;
- for (as = SS(fs); as > 512U; as >>= 1) d >>= 1;
- for (n = 0; d < sstbl[n]; n++) ;
- allocsize = cstbl[n];
- }
- if (allocsize < SS(fs)) allocsize = SS(fs);
-
- allocsize /= SS(fs); /* Number of sectors per cluster */
-
- /* Pre-compute number of clusters and FAT type */
- n_clst = n_part / allocsize;
- fmt = FS_FAT12;
- if (n_clst >= 0xFF5) fmt = FS_FAT16;
- if (n_clst >= 0xFFF5) fmt = FS_FAT32;
-
- /* Determine offset and size of FAT structure */
- switch (fmt) {
- case FS_FAT12:
- n_fat = ((n_clst * 3 + 1) / 2 + 3 + SS(fs) - 1) / SS(fs);
- n_rsv = 1 + partition;
- n_dir = N_ROOTDIR * 32 / SS(fs);
- break;
- case FS_FAT16:
- n_fat = ((n_clst * 2) + 4 + SS(fs) - 1) / SS(fs);
- n_rsv = 1 + partition;
- n_dir = N_ROOTDIR * 32 / SS(fs);
- break;
- default:
- n_fat = ((n_clst * 4) + 8 + SS(fs) - 1) / SS(fs);
- n_rsv = 33 - partition;
- n_dir = 0;
- }
- b_fat = b_part + n_rsv; /* FATs start sector */
- b_dir = b_fat + n_fat * N_FATS; /* Directory start sector */
- b_data = b_dir + n_dir; /* Data start sector */
-
- /* Align data start sector to erase block boundary (for flash memory media) */
- if (disk_ioctl(drv, GET_BLOCK_SIZE, &n) != RES_OK) return FR_MKFS_ABORTED;
- n = (b_data + n - 1) & ~(n - 1);
- n_fat += (n - b_data) / N_FATS;
- /* b_dir and b_data are no longer used below */
-
- /* Determine number of cluster and final check of validity of the FAT type */
- n_clst = (n_part - n_rsv - n_fat * N_FATS - n_dir) / allocsize;
- if ( (fmt == FS_FAT16 && n_clst < 0xFF5)
- || (fmt == FS_FAT32 && n_clst < 0xFFF5))
- return FR_MKFS_ABORTED;
-
- /* Create partition table if needed */
- if (!partition) {
- DWORD n_disk = b_part + n_part;
-
- mem_set(fs->win, 0, SS(fs));
- tbl = fs->win+MBR_Table;
- ST_DWORD(tbl, 0x00010180); /* Partition start in CHS */
- if (n_disk < 63UL * 255 * 1024) { /* Partition end in CHS */
- n_disk = n_disk / 63 / 255;
- tbl[7] = (BYTE)n_disk;
- tbl[6] = (BYTE)((n_disk >> 2) | 63);
- } else {
- ST_WORD(&tbl[6], 0xFFFF);
- }
- tbl[5] = 254;
- if (fmt != FS_FAT32) /* System ID */
- tbl[4] = (n_part < 0x10000) ? 0x04 : 0x06;
- else
- tbl[4] = 0x0c;
- ST_DWORD(tbl+8, 63); /* Partition start in LBA */
- ST_DWORD(tbl+12, n_part); /* Partition size in LBA */
- ST_WORD(tbl+64, 0xAA55); /* Signature */
- if (disk_write(drv, fs->win, 0, 1) != RES_OK)
- return FR_DISK_ERR;
- partition = 0xF8;
- } else {
- partition = 0xF0;
- }
-
- /* Create boot record */
- tbl = fs->win; /* Clear buffer */
- mem_set(tbl, 0, SS(fs));
- ST_DWORD(tbl+BS_jmpBoot, 0x90FEEB); /* Boot code (jmp $, nop) */
- ST_WORD(tbl+BPB_BytsPerSec, SS(fs)); /* Sector size */
- tbl[BPB_SecPerClus] = (BYTE)allocsize; /* Sectors per cluster */
- ST_WORD(tbl+BPB_RsvdSecCnt, n_rsv); /* Reserved sectors */
- tbl[BPB_NumFATs] = N_FATS; /* Number of FATs */
- ST_WORD(tbl+BPB_RootEntCnt, SS(fs) / 32 * n_dir); /* Number of rootdir entries */
- if (n_part < 0x10000) { /* Number of total sectors */
- ST_WORD(tbl+BPB_TotSec16, n_part);
- } else {
- ST_DWORD(tbl+BPB_TotSec32, n_part);
- }
- tbl[BPB_Media] = partition; /* Media descripter */
- ST_WORD(tbl+BPB_SecPerTrk, 63); /* Number of sectors per track */
- ST_WORD(tbl+BPB_NumHeads, 255); /* Number of heads */
- ST_DWORD(tbl+BPB_HiddSec, b_part); /* Hidden sectors */
- n = get_fattime(); /* Use current time as a VSN */
- if (fmt != FS_FAT32) {
- ST_DWORD(tbl+BS_VolID, n); /* Volume serial number */
- ST_WORD(tbl+BPB_FATSz16, n_fat); /* Number of secters per FAT */
- tbl[BS_DrvNum] = 0x80; /* Drive number */
- tbl[BS_BootSig] = 0x29; /* Extended boot signature */
- mem_cpy(tbl+BS_VolLab, "NO NAME FAT ", 19); /* Volume lavel, FAT signature */
- } else {
- ST_DWORD(tbl+BS_VolID32, n); /* Volume serial number */
- ST_DWORD(tbl+BPB_FATSz32, n_fat); /* Number of secters per FAT */
- ST_DWORD(tbl+BPB_RootClus, 2); /* Root directory cluster (2) */
- ST_WORD(tbl+BPB_FSInfo, 1); /* FSInfo record offset (bs+1) */
- ST_WORD(tbl+BPB_BkBootSec, 6); /* Backup boot record offset (bs+6) */
- tbl[BS_DrvNum32] = 0x80; /* Drive number */
- tbl[BS_BootSig32] = 0x29; /* Extended boot signature */
- mem_cpy(tbl+BS_VolLab32, "NO NAME FAT32 ", 19); /* Volume lavel, FAT signature */
- }
- ST_WORD(tbl+BS_55AA, 0xAA55); /* Signature */
- if (SS(fs) > 512U) {
- ST_WORD(tbl+SS(fs)-2, 0xAA55);
- }
- if (disk_write(drv, tbl, b_part+0, 1) != RES_OK)
- return FR_DISK_ERR;
- if (fmt == FS_FAT32)
- disk_write(drv, tbl, b_part+6, 1);
-
- /* Initialize FAT area */
- for (m = 0; m < N_FATS; m++) {
- mem_set(tbl, 0, SS(fs)); /* 1st sector of the FAT */
- if (fmt != FS_FAT32) {
- n = (fmt == FS_FAT12) ? 0x00FFFF00 : 0xFFFFFF00;
- n |= partition;
- ST_DWORD(tbl, n); /* Reserve cluster #0-1 (FAT12/16) */
- } else {
- ST_DWORD(tbl+0, 0xFFFFFFF8); /* Reserve cluster #0-1 (FAT32) */
- ST_DWORD(tbl+4, 0xFFFFFFFF);
- ST_DWORD(tbl+8, 0x0FFFFFFF); /* Reserve cluster #2 for root dir */
- }
- if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
- return FR_DISK_ERR;
- mem_set(tbl, 0, SS(fs)); /* Following FAT entries are filled by zero */
- for (n = 1; n < n_fat; n++) {
- if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
- return FR_DISK_ERR;
- }
- }
-
- /* Initialize Root directory */
- m = (BYTE)((fmt == FS_FAT32) ? allocsize : n_dir);
- do {
- if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
- return FR_DISK_ERR;
- } while (--m);
-
- /* Create FSInfo record if needed */
- if (fmt == FS_FAT32) {
- ST_WORD(tbl+BS_55AA, 0xAA55);
- ST_DWORD(tbl+FSI_LeadSig, 0x41615252);
- ST_DWORD(tbl+FSI_StrucSig, 0x61417272);
- ST_DWORD(tbl+FSI_Free_Count, n_clst - 1);
- ST_DWORD(tbl+FSI_Nxt_Free, 0xFFFFFFFF);
- disk_write(drv, tbl, b_part+1, 1);
- disk_write(drv, tbl, b_part+7, 1);
- }
-
- return (disk_ioctl(drv, CTRL_SYNC, (void*)NULL) == RES_OK) ? FR_OK : FR_DISK_ERR;
-}
-
-#endif /* _USE_MKFS && !_FS_READONLY */
-
-
-
-
-#if _USE_STRFUNC
-/*-----------------------------------------------------------------------*/
-/* Get a string from the file */
-/*-----------------------------------------------------------------------*/
-char* f_gets (
- char* buff, /* Pointer to the string buffer to read */
- int len, /* Size of string buffer */
- FIL* fil /* Pointer to the file object */
-)
-{
- int i = 0;
- char *p = buff;
- UINT rc;
-
-
- while (i < len - 1) { /* Read bytes until buffer gets filled */
- f_read(fil, p, 1, &rc);
- if (rc != 1) break; /* Break when no data to read */
-#if _USE_STRFUNC >= 2
- if (*p == '\r') continue; /* Strip '\r' */
-#endif
- i++;
- if (*p++ == '\n') break; /* Break when reached end of line */
- }
- *p = 0;
- return i ? buff : NULL; /* When no data read (eof or error), return with error. */
-}
-
-
-
-#if !_FS_READONLY
-#include <stdarg.h>
-/*-----------------------------------------------------------------------*/
-/* Put a character to the file */
-/*-----------------------------------------------------------------------*/
-int f_putc (
- int chr, /* A character to be output */
- FIL* fil /* Ponter to the file object */
-)
-{
- UINT bw;
- char c;
-
-
-#if _USE_STRFUNC >= 2
- if (chr == '\n') f_putc ('\r', fil); /* LF -> CRLF conversion */
-#endif
- if (!fil) { /* Special value may be used to switch the destination to any other device */
- /* put_console(chr); */
- return chr;
- }
- c = (char)chr;
- f_write(fil, &c, 1, &bw); /* Write a byte to the file */
- return bw ? chr : EOF; /* Return the result */
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Put a string to the file */
-/*-----------------------------------------------------------------------*/
-int f_puts (
- const char* str, /* Pointer to the string to be output */
- FIL* fil /* Pointer to the file object */
-)
-{
- int n;
-
-
- for (n = 0; *str; str++, n++) {
- if (f_putc(*str, fil) == EOF) return EOF;
- }
- return n;
-}
-
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Put a formatted string to the file */
-/*-----------------------------------------------------------------------*/
-int f_printf (
- FIL* fil, /* Pointer to the file object */
- const char* str, /* Pointer to the format string */
- ... /* Optional arguments... */
-)
-{
- va_list arp;
- UCHAR c, f, r;
- ULONG val;
- char s[16];
- int i, w, res, cc;
-
-
- va_start(arp, str);
-
- for (cc = res = 0; cc != EOF; res += cc) {
- c = *str++;
- if (c == 0) break; /* End of string */
- if (c != '%') { /* Non escape cahracter */
- cc = f_putc(c, fil);
- if (cc != EOF) cc = 1;
- continue;
- }
- w = f = 0;
- c = *str++;
- if (c == '0') { /* Flag: '0' padding */
- f = 1; c = *str++;
- }
- while (c >= '0' && c <= '9') { /* Precision */
- w = w * 10 + (c - '0');
- c = *str++;
- }
- if (c == 'l') { /* Prefix: Size is long int */
- f |= 2; c = *str++;
- }
- if (c == 's') { /* Type is string */
- cc = f_puts(va_arg(arp, char*), fil);
- continue;
- }
- if (c == 'c') { /* Type is character */
- cc = f_putc(va_arg(arp, int), fil);
- if (cc != EOF) cc = 1;
- continue;
- }
- r = 0;
- if (c == 'd') r = 10; /* Type is signed decimal */
- if (c == 'u') r = 10; /* Type is unsigned decimal */
- if (c == 'X') r = 16; /* Type is unsigned hexdecimal */
- if (r == 0) break; /* Unknown type */
- if (f & 2) { /* Get the value */
- val = (ULONG)va_arg(arp, long);
- } else {
- val = (c == 'd') ? (ULONG)(long)va_arg(arp, int) : (ULONG)va_arg(arp, unsigned int);
- }
- /* Put numeral string */
- if (c == 'd') {
- if (val & 0x80000000) {
- val = 0 - val;
- f |= 4;
- }
- }
- i = sizeof(s) - 1; s[i] = 0;
- do {
- c = (UCHAR)(val % r + '0');
- if (c > '9') c += 7;
- s[--i] = c;
- val /= r;
- } while (i && val);
- if (i && (f & 4)) s[--i] = '-';
- w = sizeof(s) - 1 - w;
- while (i && i > w) s[--i] = (f & 1) ? '0' : ' ';
- cc = f_puts(&s[i], fil);
- }
-
- va_end(arp);
- return (cc == EOF) ? cc : res;
-}
-
-#endif /* !_FS_READONLY */
-#endif /* _USE_STRFUNC */
+/*----------------------------------------------------------------------------/
+/ FatFs - FAT file system module R0.07e (C)ChaN, 2010
+/-----------------------------------------------------------------------------/
+/ FatFs module is a generic FAT file system module for small embedded systems.
+/ This is a free software that opened for education, research and commercial
+/ developments under license policy of following trems.
+/
+/ Copyright (C) 2010, ChaN, all right reserved.
+/
+/ * The FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/
+/-----------------------------------------------------------------------------/
+/ Feb 26,'06 R0.00 Prototype.
+/
+/ Apr 29,'06 R0.01 First stable version.
+/
+/ Jun 01,'06 R0.02 Added FAT12 support.
+/ Removed unbuffered mode.
+/ Fixed a problem on small (<32M) patition.
+/ Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).
+/
+/ Sep 22,'06 R0.03 Added f_rename().
+/ Changed option _FS_MINIMUM to _FS_MINIMIZE.
+/ Dec 11,'06 R0.03a Improved cluster scan algolithm to write files fast.
+/ Fixed f_mkdir() creates incorrect directory on FAT32.
+/
+/ Feb 04,'07 R0.04 Supported multiple drive system.
+/ Changed some interfaces for multiple drive system.
+/ Changed f_mountdrv() to f_mount().
+/ Added f_mkfs().
+/ Apr 01,'07 R0.04a Supported multiple partitions on a plysical drive.
+/ Added a capability of extending file size to f_lseek().
+/ Added minimization level 3.
+/ Fixed an endian sensitive code in f_mkfs().
+/ May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.
+/ Added FSInfo support.
+/ Fixed DBCS name can result FR_INVALID_NAME.
+/ Fixed short seek (<= csize) collapses the file object.
+/
+/ Aug 25,'07 R0.05 Changed arguments of f_read(), f_write() and f_mkfs().
+/ Fixed f_mkfs() on FAT32 creates incorrect FSInfo.
+/ Fixed f_mkdir() on FAT32 creates incorrect directory.
+/ Feb 03,'08 R0.05a Added f_truncate() and f_utime().
+/ Fixed off by one error at FAT sub-type determination.
+/ Fixed btr in f_read() can be mistruncated.
+/ Fixed cached sector is not flushed when create and close
+/ without write.
+/
+/ Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets().
+/ Improved performance of f_lseek() on moving to the same
+/ or following cluster.
+/
+/ Apr 01,'09 R0.07 Merged Tiny-FatFs as a buffer configuration option.
+/ Added long file name support.
+/ Added multiple code page support.
+/ Added re-entrancy for multitask operation.
+/ Added auto cluster size selection to f_mkfs().
+/ Added rewind option to f_readdir().
+/ Changed result code of critical errors.
+/ Renamed string functions to avoid name collision.
+/ Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg.
+/ Added multiple sector size support.
+/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error.
+/ Fixed wrong cache control in f_lseek().
+/ Added relative path feature.
+/ Added f_chdir() and f_chdrive().
+/ Added proper case conversion to extended char.
+/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h.
+/ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
+/ Fixed name matching error on the 13 char boundary.
+/ Added a configuration option, _LFN_UNICODE.
+/ Changed f_readdir() to return the SFN with always upper
+/ case on non-LFN cfg.
+/---------------------------------------------------------------------------*/
+
+#include "ff.h" /* FatFs configurations and declarations */
+#include "diskio.h" /* Declarations of low level disk I/O functions */
+
+/*--------------------------------------------------------------------------
+
+ Module Private Definitions
+
+---------------------------------------------------------------------------*/
+
+#if _FATFS != 0x007E
+#error Wrong include file (ff.h).
+#endif
+
+#if _FS_REENTRANT
+#if _USE_LFN == 1
+#error Static LFN work area must not be used in re-entrant configuration.
+#endif
+#define ENTER_FF(fs) { if (!lock_fs(fs)) return FR_TIMEOUT; }
+#define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; }
+
+#else
+#define ENTER_FF(fs)
+#define LEAVE_FF(fs, res) return res
+
+#endif
+
+#define ABORT(fs, res) { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Name status flags */
+#define NS 11 /* Offset of name status byte */
+#define NS_LOSS 0x01 /* Out of 8.3 format */
+#define NS_LFN 0x02 /* Force to create LFN entry */
+#define NS_LAST 0x04 /* Last segment */
+#define NS_BODY 0x08 /* Lower case flag (body) */
+#define NS_EXT 0x10 /* Lower case flag (ext) */
+#define NS_DOT 0x20 /* Dot entry */
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Private Work Area
+
+---------------------------------------------------------------------------*/
+
+#if _DRIVES < 1 || _DRIVES > 9
+#error Number of drives must be 1-9.
+#endif
+static
+FATFS *FatFs[_DRIVES]; /* Pointer to the file system objects (logical drives) */
+
+static
+WORD Fsid; /* File system mount ID */
+
+#if _FS_RPATH
+static
+BYTE Drive; /* Current drive */
+#endif
+
+
+#if _USE_LFN == 1 /* LFN with static LFN working buffer */
+static
+WCHAR LfnBuf[_MAX_LFN + 1];
+#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR *lp = LfnBuf
+#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
+
+#elif _USE_LFN > 1 /* LFN with dynamic LFN working buffer */
+#define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR lbuf[_MAX_LFN + 1], *lp = lbuf
+#define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp
+
+#else /* No LFN */
+#define NAMEBUF(sp,lp) BYTE sp[12]
+#define INITBUF(dj,sp,lp) dj.fn = sp
+
+#endif
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Module Private Functions
+
+---------------------------------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------*/
+/* String functions */
+/*-----------------------------------------------------------------------*/
+
+/* Copy memory to memory */
+static
+void mem_cpy (void* dst, const void* src, int cnt) {
+ char *d = (char*)dst;
+ const char *s = (const char *)src;
+ while (cnt--) *d++ = *s++;
+}
+
+/* Fill memory */
+static
+void mem_set (void* dst, int val, int cnt) {
+ char *d = (char*)dst;
+ while (cnt--) *d++ = (char)val;
+}
+
+/* Compare memory to memory */
+static
+int mem_cmp (const void* dst, const void* src, int cnt) {
+ const char *d = (const char *)dst, *s = (const char *)src;
+ int r = 0;
+ while (cnt-- && (r = *d++ - *s++) == 0) ;
+ return r;
+}
+
+/* Check if chr is contained in the string */
+static
+int chk_chr (const char* str, int chr) {
+ while (*str && *str != chr) str++;
+ return *str;
+}
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Request/Release grant to access the volume */
+/*-----------------------------------------------------------------------*/
+#if _FS_REENTRANT
+
+static
+BOOL lock_fs (
+ FATFS *fs /* File system object */
+)
+{
+ return ff_req_grant(fs->sobj);
+}
+
+
+static
+void unlock_fs (
+ FATFS *fs, /* File system object */
+ FRESULT res /* Result code to be returned */
+)
+{
+ if (res != FR_NOT_ENABLED &&
+ res != FR_INVALID_DRIVE &&
+ res != FR_INVALID_OBJECT &&
+ res != FR_TIMEOUT) {
+ ff_rel_grant(fs->sobj);
+ }
+}
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change window offset */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT move_window (
+ FATFS *fs, /* File system object */
+ DWORD sector /* Sector number to make apperance in the fs->win[] */
+) /* Move to zero only writes back dirty window */
+{
+ DWORD wsect;
+
+
+ wsect = fs->winsect;
+ if (wsect != sector) { /* Changed current window */
+#if !_FS_READONLY
+ if (fs->wflag) { /* Write back dirty window if needed */
+ if (disk_write(fs->drive, fs->win, wsect, 1) != RES_OK)
+ return FR_DISK_ERR;
+ fs->wflag = 0;
+ if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */
+ BYTE nf;
+ for (nf = fs->n_fats; nf > 1; nf--) { /* Refrect the change to all FAT copies */
+ wsect += fs->sects_fat;
+ disk_write(fs->drive, fs->win, wsect, 1);
+ }
+ }
+ }
+#endif
+ if (sector) {
+ if (disk_read(fs->drive, fs->win, sector, 1) != RES_OK)
+ return FR_DISK_ERR;
+ fs->winsect = sector;
+ }
+ }
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Clean-up cached data */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */
+ FATFS *fs /* File system object */
+)
+{
+ FRESULT res;
+
+
+ res = move_window(fs, 0);
+ if (res == FR_OK) {
+ /* Update FSInfo sector if needed */
+ if (fs->fs_type == FS_FAT32 && fs->fsi_flag) {
+ fs->winsect = 0;
+ mem_set(fs->win, 0, 512);
+ ST_WORD(fs->win+BS_55AA, 0xAA55);
+ ST_DWORD(fs->win+FSI_LeadSig, 0x41615252);
+ ST_DWORD(fs->win+FSI_StrucSig, 0x61417272);
+ ST_DWORD(fs->win+FSI_Free_Count, fs->free_clust);
+ ST_DWORD(fs->win+FSI_Nxt_Free, fs->last_clust);
+ disk_write(fs->drive, fs->win, fs->fsi_sector, 1);
+ fs->fsi_flag = 0;
+ }
+ /* Make sure that no pending write process in the physical drive */
+ if (disk_ioctl(fs->drive, CTRL_SYNC, (void*)NULL) != RES_OK)
+ res = FR_DISK_ERR;
+ }
+
+ return res;
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT access - Read value of a FAT entry */
+/*-----------------------------------------------------------------------*/
+
+
+DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status */
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to get the link information */
+)
+{
+ UINT wc, bc;
+ DWORD fsect;
+
+
+ if (clst < 2 || clst >= fs->max_clust) /* Range check */
+ return 1;
+
+ fsect = fs->fatbase;
+ switch (fs->fs_type) {
+ case FS_FAT12 :
+ bc = clst; bc += bc / 2;
+ if (move_window(fs, fsect + (bc / SS(fs)))) break;
+ wc = fs->win[bc & (SS(fs) - 1)]; bc++;
+ if (move_window(fs, fsect + (bc / SS(fs)))) break;
+ wc |= (WORD)fs->win[bc & (SS(fs) - 1)] << 8;
+ return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);
+
+ case FS_FAT16 :
+ if (move_window(fs, fsect + (clst / (SS(fs) / 2)))) break;
+ return LD_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)]);
+
+ case FS_FAT32 :
+ if (move_window(fs, fsect + (clst / (SS(fs) / 4)))) break;
+ return LD_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)]) & 0x0FFFFFFF;
+ }
+
+ return 0xFFFFFFFF; /* An error occured at the disk I/O layer */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT access - Change value of a FAT entry */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+
+FRESULT put_fat (
+ FATFS *fs, /* File system object */
+ DWORD clst, /* Cluster# to be changed in range of 2 to fs->max_clust - 1 */
+ DWORD val /* New value to mark the cluster */
+)
+{
+ UINT bc;
+ BYTE *p;
+ DWORD fsect;
+ FRESULT res;
+
+
+ if (clst < 2 || clst >= fs->max_clust) { /* Range check */
+ res = FR_INT_ERR;
+
+ } else {
+ fsect = fs->fatbase;
+ switch (fs->fs_type) {
+ case FS_FAT12 :
+ bc = clst; bc += bc / 2;
+ res = move_window(fs, fsect + (bc / SS(fs)));
+ if (res != FR_OK) break;
+ p = &fs->win[bc & (SS(fs) - 1)];
+ *p = (clst & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val;
+ bc++;
+ fs->wflag = 1;
+ res = move_window(fs, fsect + (bc / SS(fs)));
+ if (res != FR_OK) break;
+ p = &fs->win[bc & (SS(fs) - 1)];
+ *p = (clst & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F));
+ break;
+
+ case FS_FAT16 :
+ res = move_window(fs, fsect + (clst / (SS(fs) / 2)));
+ if (res != FR_OK) break;
+ ST_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)], (WORD)val);
+ break;
+
+ case FS_FAT32 :
+ res = move_window(fs, fsect + (clst / (SS(fs) / 4)));
+ if (res != FR_OK) break;
+ ST_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)], val);
+ break;
+
+ default :
+ res = FR_INT_ERR;
+ }
+ fs->wflag = 1;
+ }
+
+ return res;
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT handling - Remove a cluster chain */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+FRESULT remove_chain (
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to remove a chain from */
+)
+{
+ FRESULT res;
+ DWORD nxt;
+
+
+ if (clst < 2 || clst >= fs->max_clust) { /* Check the range of cluster# */
+ res = FR_INT_ERR;
+
+ } else {
+ res = FR_OK;
+ while (clst < fs->max_clust) { /* Not a last link? */
+ nxt = get_fat(fs, clst); /* Get cluster status */
+ if (nxt == 0) break; /* Empty cluster? */
+ if (nxt == 1) { res = FR_INT_ERR; break; } /* Internal error? */
+ if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */
+ res = put_fat(fs, clst, 0); /* Mark the cluster "empty" */
+ if (res != FR_OK) break;
+ if (fs->free_clust != 0xFFFFFFFF) { /* Update FSInfo */
+ fs->free_clust++;
+ fs->fsi_flag = 1;
+ }
+ clst = nxt; /* Next cluster */
+ }
+ }
+
+ return res;
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* FAT handling - Stretch or Create a cluster chain */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to stretch. 0 means create a new chain. */
+)
+{
+ DWORD cs, ncl, scl, mcl;
+
+
+ mcl = fs->max_clust;
+ if (clst == 0) { /* Create new chain */
+ scl = fs->last_clust; /* Get suggested start point */
+ if (scl == 0 || scl >= mcl) scl = 1;
+ }
+ else { /* Stretch existing chain */
+ cs = get_fat(fs, clst); /* Check the cluster status */
+ if (cs < 2) return 1; /* It is an invalid cluster */
+ if (cs < mcl) return cs; /* It is already followed by next cluster */
+ scl = clst;
+ }
+
+ ncl = scl; /* Start cluster */
+ for (;;) {
+ ncl++; /* Next cluster */
+ if (ncl >= mcl) { /* Wrap around */
+ ncl = 2;
+ if (ncl > scl) return 0; /* No free custer */
+ }
+ cs = get_fat(fs, ncl); /* Get the cluster status */
+ if (cs == 0) break; /* Found a free cluster */
+ if (cs == 0xFFFFFFFF || cs == 1)/* An error occured */
+ return cs;
+ if (ncl == scl) return 0; /* No free custer */
+ }
+
+ if (put_fat(fs, ncl, 0x0FFFFFFF)) /* Mark the new cluster "in use" */
+ return 0xFFFFFFFF;
+ if (clst != 0) { /* Link it to the previous one if needed */
+ if (put_fat(fs, clst, ncl))
+ return 0xFFFFFFFF;
+ }
+
+ fs->last_clust = ncl; /* Update FSINFO */
+ if (fs->free_clust != 0xFFFFFFFF) {
+ fs->free_clust--;
+ fs->fsi_flag = 1;
+ }
+
+ return ncl; /* Return new cluster number */
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Get sector# from cluster# */
+/*-----------------------------------------------------------------------*/
+
+
+DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
+ FATFS *fs, /* File system object */
+ DWORD clst /* Cluster# to be converted */
+)
+{
+ clst -= 2;
+ if (clst >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
+ return clst * fs->csize + fs->database;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Seek directory index */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_seek (
+ DIR *dj, /* Pointer to directory object */
+ WORD idx /* Directory index number */
+)
+{
+ DWORD clst;
+ WORD ic;
+
+
+ dj->index = idx;
+ clst = dj->sclust;
+ if (clst == 1 || clst >= dj->fs->max_clust) /* Check start cluster range */
+ return FR_INT_ERR;
+ if (!clst && dj->fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
+ clst = dj->fs->dirbase;
+
+ if (clst == 0) { /* Static table */
+ dj->clust = clst;
+ if (idx >= dj->fs->n_rootdir) /* Index is out of range */
+ return FR_INT_ERR;
+ dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / 32); /* Sector# */
+ }
+ else { /* Dynamic table */
+ ic = SS(dj->fs) / 32 * dj->fs->csize; /* Entries per cluster */
+ while (idx >= ic) { /* Follow cluster chain */
+ clst = get_fat(dj->fs, clst); /* Get next cluster */
+ if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */
+ if (clst < 2 || clst >= dj->fs->max_clust) /* Reached to end of table or int error */
+ return FR_INT_ERR;
+ idx -= ic;
+ }
+ dj->clust = clst;
+ dj->sect = clust2sect(dj->fs, clst) + idx / (SS(dj->fs) / 32); /* Sector# */
+ }
+
+ dj->dir = dj->fs->win + (idx % (SS(dj->fs) / 32)) * 32; /* Ptr to the entry in the sector */
+
+ return FR_OK; /* Seek succeeded */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Move directory index next */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */
+ DIR *dj, /* Pointer to directory object */
+ BOOL streach /* FALSE: Do not streach table, TRUE: Streach table if needed */
+)
+{
+ DWORD clst;
+ WORD i;
+
+
+ i = dj->index + 1;
+ if (!i || !dj->sect) /* Report EOT when index has reached 65535 */
+ return FR_NO_FILE;
+
+ if (!(i % (SS(dj->fs) / 32))) { /* Sector changed? */
+ dj->sect++; /* Next sector */
+
+ if (dj->clust == 0) { /* Static table */
+ if (i >= dj->fs->n_rootdir) /* Report EOT when end of table */
+ return FR_NO_FILE;
+ }
+ else { /* Dynamic table */
+ if (((i / (SS(dj->fs) / 32)) & (dj->fs->csize - 1)) == 0) { /* Cluster changed? */
+ clst = get_fat(dj->fs, dj->clust); /* Get next cluster */
+ if (clst <= 1) return FR_INT_ERR;
+ if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
+ if (clst >= dj->fs->max_clust) { /* When it reached end of dynamic table */
+#if !_FS_READONLY
+ BYTE c;
+ if (!streach) return FR_NO_FILE; /* When do not streach, report EOT */
+ clst = create_chain(dj->fs, dj->clust); /* Streach cluster chain */
+ if (clst == 0) return FR_DENIED; /* No free cluster */
+ if (clst == 1) return FR_INT_ERR;
+ if (clst == 0xFFFFFFFF) return FR_DISK_ERR;
+ /* Clean-up streached table */
+ if (move_window(dj->fs, 0)) return FR_DISK_ERR; /* Flush active window */
+ mem_set(dj->fs->win, 0, SS(dj->fs)); /* Clear window buffer */
+ dj->fs->winsect = clust2sect(dj->fs, clst); /* Cluster start sector */
+ for (c = 0; c < dj->fs->csize; c++) { /* Fill the new cluster with 0 */
+ dj->fs->wflag = 1;
+ if (move_window(dj->fs, 0)) return FR_DISK_ERR;
+ dj->fs->winsect++;
+ }
+ dj->fs->winsect -= c; /* Rewind window address */
+#else
+ return FR_NO_FILE; /* Report EOT */
+#endif
+ }
+ dj->clust = clst; /* Initialize data for new cluster */
+ dj->sect = clust2sect(dj->fs, clst);
+ }
+ }
+ }
+
+ dj->index = i;
+ dj->dir = dj->fs->win + (i % (SS(dj->fs) / 32)) * 32;
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry */
+/*-----------------------------------------------------------------------*/
+#if _USE_LFN
+static
+const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Offset of LFN chars in the directory entry */
+
+
+static
+BOOL cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */
+ WCHAR *lfnbuf, /* Pointer to the LFN to be compared */
+ BYTE *dir /* Pointer to the directory entry containing a part of LFN */
+)
+{
+ int i, s;
+ WCHAR wc, uc;
+
+
+ i = ((dir[LDIR_Ord] & 0xBF) - 1) * 13; /* Get offset in the LFN buffer */
+ s = 0; wc = 1;
+ do {
+ uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
+ if (wc) { /* Last char has not been processed */
+ wc = ff_wtoupper(uc); /* Convert it to upper case */
+ if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it */
+ return FALSE; /* Not matched */
+ } else {
+ if (uc != 0xFFFF) return FALSE; /* Check filler */
+ }
+ } while (++s < 13); /* Repeat until all chars in the entry are checked */
+
+ if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i]) /* Last segment matched but different length */
+ return FALSE;
+
+ return TRUE; /* The part of LFN matched */
+}
+
+
+
+static
+BOOL pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */
+ WCHAR *lfnbuf, /* Pointer to the Unicode-LFN buffer */
+ BYTE *dir /* Pointer to the directory entry */
+)
+{
+ int i, s;
+ WCHAR wc, uc;
+
+
+ i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
+
+ s = 0; wc = 1;
+ do {
+ uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */
+ if (wc) { /* Last char has not been processed */
+ if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
+ lfnbuf[i++] = wc = uc; /* Store it */
+ } else {
+ if (uc != 0xFFFF) return FALSE; /* Check filler */
+ }
+ } while (++s < 13); /* Read all character in the entry */
+
+ if (dir[LDIR_Ord] & 0x40) { /* Put terminator if it is the last LFN part */
+ if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */
+ lfnbuf[i] = 0;
+ }
+
+ return TRUE;
+}
+
+
+#if !_FS_READONLY
+static
+void fit_lfn (
+ const WCHAR *lfnbuf, /* Pointer to the LFN buffer */
+ BYTE *dir, /* Pointer to the directory entry */
+ BYTE ord, /* LFN order (1-20) */
+ BYTE sum /* SFN sum */
+)
+{
+ int i, s;
+ WCHAR wc;
+
+
+ dir[LDIR_Chksum] = sum; /* Set check sum */
+ dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
+ dir[LDIR_Type] = 0;
+ ST_WORD(dir+LDIR_FstClusLO, 0);
+
+ i = (ord - 1) * 13; /* Get offset in the LFN buffer */
+ s = wc = 0;
+ do {
+ if (wc != 0xFFFF) wc = lfnbuf[i++]; /* Get an effective char */
+ ST_WORD(dir+LfnOfs[s], wc); /* Put it */
+ if (!wc) wc = 0xFFFF; /* Padding chars following last char */
+ } while (++s < 13);
+ if (wc == 0xFFFF || !lfnbuf[i]) ord |= 0x40; /* Bottom LFN part is the start of LFN sequence */
+ dir[LDIR_Ord] = ord; /* Set the LFN order */
+}
+
+#endif
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Create numbered name */
+/*-----------------------------------------------------------------------*/
+#if _USE_LFN
+void gen_numname (
+ BYTE *dst, /* Pointer to genartated SFN */
+ const BYTE *src, /* Pointer to source SFN to be modified */
+ const WCHAR *lfn, /* Pointer to LFN */
+ WORD num /* Sequense number */
+)
+{
+ char ns[8];
+ int i, j;
+
+
+ mem_cpy(dst, src, 11);
+
+ if (num > 5) { /* On many collisions, generate a hash number instead of sequencial number */
+ do num = (num >> 1) + (num << 15) + (WORD)*lfn++; while (*lfn);
+ }
+
+ /* itoa */
+ i = 7;
+ do {
+ ns[i--] = (num % 10) + '0';
+ num /= 10;
+ } while (num);
+ ns[i] = '~';
+
+ /* Append the number */
+ for (j = 0; j < i && dst[j] != ' '; j++) {
+ if (IsDBCS1(dst[j])) {
+ if (j == i - 1) break;
+ j++;
+ }
+ }
+ do {
+ dst[j++] = (i < 8) ? ns[i++] : ' ';
+ } while (j < 8);
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Calculate sum of an SFN */
+/*-----------------------------------------------------------------------*/
+#if _USE_LFN
+static
+BYTE sum_sfn (
+ const BYTE *dir /* Ptr to directory entry */
+)
+{
+ BYTE sum = 0;
+ int n = 11;
+
+ do sum = (sum >> 1) + (sum << 7) + *dir++; while (--n);
+ return sum;
+}
+#endif
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Directory handling - Find an object in the directory */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT dir_find (
+ DIR *dj /* Pointer to the directory object linked to the file name */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+#if _USE_LFN
+ BYTE a, ord, sum;
+#endif
+
+ res = dir_seek(dj, 0); /* Rewind directory object */
+ if (res != FR_OK) return res;
+
+#if _USE_LFN
+ ord = sum = 0xFF;
+#endif
+ do {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ dir = dj->dir; /* Ptr to the directory entry of current index */
+ c = dir[DIR_Name];
+ if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
+#if _USE_LFN /* LFN configuration */
+ a = dir[DIR_Attr] & AM_MASK;
+ if (c == 0xE5 || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
+ ord = 0xFF;
+ } else {
+ if (a == AM_LFN) { /* An LFN entry is found */
+ if (dj->lfn) {
+ if (c & 0x40) { /* Is it start of LFN sequence? */
+ sum = dir[LDIR_Chksum];
+ c &= 0xBF; ord = c; /* LFN start order */
+ dj->lfn_idx = dj->index;
+ }
+ /* Check validity of the LFN entry and compare it with given name */
+ ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
+ }
+ } else { /* An SFN entry is found */
+ if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */
+ ord = 0xFF; dj->lfn_idx = 0xFFFF; /* Reset LFN sequence */
+ if (!(dj->fn[NS] & NS_LOSS) && !mem_cmp(dir, dj->fn, 11)) break; /* SFN matched? */
+ }
+ }
+#else /* Non LFN configuration */
+ if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */
+ break;
+#endif
+ res = dir_next(dj, FALSE); /* Next entry */
+ } while (res == FR_OK);
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read an object from the directory */
+/*-----------------------------------------------------------------------*/
+#if _FS_MINIMIZE <= 1
+static
+FRESULT dir_read (
+ DIR *dj /* Pointer to the directory object that pointing the entry to be read */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+#if _USE_LFN
+ BYTE a, ord = 0xFF, sum = 0xFF;
+#endif
+
+ res = FR_NO_FILE;
+ while (dj->sect) {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ dir = dj->dir; /* Ptr to the directory entry of current index */
+ c = dir[DIR_Name];
+ if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
+#if _USE_LFN /* LFN configuration */
+ a = dir[DIR_Attr] & AM_MASK;
+ if (c == 0xE5 || (!_FS_RPATH && c == '.') || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
+ ord = 0xFF;
+ } else {
+ if (a == AM_LFN) { /* An LFN entry is found */
+ if (c & 0x40) { /* Is it start of LFN sequence? */
+ sum = dir[LDIR_Chksum];
+ c &= 0xBF; ord = c;
+ dj->lfn_idx = dj->index;
+ }
+ /* Check LFN validity and capture it */
+ ord = (c == ord && sum == dir[LDIR_Chksum] && pick_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;
+ } else { /* An SFN entry is found */
+ if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN? */
+ dj->lfn_idx = 0xFFFF; /* It has no LFN. */
+ break;
+ }
+ }
+#else /* Non LFN configuration */
+ if (c != 0xE5 && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL)) /* Is it a valid entry? */
+ break;
+#endif
+ res = dir_next(dj, FALSE); /* Next entry */
+ if (res != FR_OK) break;
+ }
+
+ if (res != FR_OK) dj->sect = 0;
+
+ return res;
+}
+#endif
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Register an object to the directory */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY
+static
+FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many SFN collision, FR_DISK_ERR:Disk error */
+ DIR *dj /* Target directory with object name to be created */
+)
+{
+ FRESULT res;
+ BYTE c, *dir;
+#if _USE_LFN /* LFN configuration */
+ WORD n, ne, is;
+ BYTE sn[12], *fn, sum;
+ WCHAR *lfn;
+
+
+ fn = dj->fn; lfn = dj->lfn;
+ mem_cpy(sn, fn, 12);
+
+ if (_FS_RPATH && (sn[NS] & NS_DOT)) return FR_INVALID_NAME; /* Cannot create dot entry */
+
+ if (sn[NS] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */
+ fn[NS] = 0; dj->lfn = NULL; /* Find only SFN */
+ for (n = 1; n < 100; n++) {
+ gen_numname(fn, sn, lfn, n); /* Generate a numbered name */
+ res = dir_find(dj); /* Check if the name collides with existing SFN */
+ if (res != FR_OK) break;
+ }
+ if (n == 100) return FR_DENIED; /* Abort if too many collisions */
+ if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */
+ fn[NS] = sn[NS]; dj->lfn = lfn;
+ }
+
+ if (sn[NS] & NS_LFN) { /* When LFN is to be created, reserve reserve an SFN + LFN entries. */
+ for (ne = 0; lfn[ne]; ne++) ;
+ ne = (ne + 25) / 13;
+ } else { /* Otherwise reserve only an SFN entry. */
+ ne = 1;
+ }
+
+ /* Reserve contiguous entries */
+ res = dir_seek(dj, 0);
+ if (res != FR_OK) return res;
+ n = is = 0;
+ do {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ c = *dj->dir; /* Check the entry status */
+ if (c == 0xE5 || c == 0) { /* Is it a blank entry? */
+ if (n == 0) is = dj->index; /* First index of the contigulus entry */
+ if (++n == ne) break; /* A contiguous entry that requiered count is found */
+ } else {
+ n = 0; /* Not a blank entry. Restart to search */
+ }
+ res = dir_next(dj, TRUE); /* Next entry with table streach */
+ } while (res == FR_OK);
+
+ if (res == FR_OK && ne > 1) { /* Initialize LFN entry if needed */
+ res = dir_seek(dj, is);
+ if (res == FR_OK) {
+ sum = sum_sfn(dj->fn); /* Sum of the SFN tied to the LFN */
+ ne--;
+ do { /* Store LFN entries in bottom first */
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ fit_lfn(dj->lfn, dj->dir, (BYTE)ne, sum);
+ dj->fs->wflag = 1;
+ res = dir_next(dj, FALSE); /* Next entry */
+ } while (res == FR_OK && --ne);
+ }
+ }
+
+#else /* Non LFN configuration */
+ res = dir_seek(dj, 0);
+ if (res == FR_OK) {
+ do { /* Find a blank entry for the SFN */
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ c = *dj->dir;
+ if (c == 0xE5 || c == 0) break; /* Is it a blank entry? */
+ res = dir_next(dj, TRUE); /* Next entry with table streach */
+ } while (res == FR_OK);
+ }
+#endif
+
+ if (res == FR_OK) { /* Initialize the SFN entry */
+ res = move_window(dj->fs, dj->sect);
+ if (res == FR_OK) {
+ dir = dj->dir;
+ mem_set(dir, 0, 32); /* Clean the entry */
+ mem_cpy(dir, dj->fn, 11); /* Put SFN */
+ dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */
+ dj->fs->wflag = 1;
+ }
+ }
+
+ return res;
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Remove an object from the directory */
+/*-----------------------------------------------------------------------*/
+#if !_FS_READONLY && !_FS_MINIMIZE
+static
+FRESULT dir_remove ( /* FR_OK: Successful, FR_DISK_ERR: A disk error */
+ DIR *dj /* Directory object pointing the entry to be removed */
+)
+{
+ FRESULT res;
+#if _USE_LFN /* LFN configuration */
+ WORD i;
+
+ i = dj->index; /* SFN index */
+ res = dir_seek(dj, (WORD)((dj->lfn_idx == 0xFFFF) ? i : dj->lfn_idx)); /* Goto the SFN or top of the LFN entries */
+ if (res == FR_OK) {
+ do {
+ res = move_window(dj->fs, dj->sect);
+ if (res != FR_OK) break;
+ *dj->dir = 0xE5; /* Mark the entry "deleted" */
+ dj->fs->wflag = 1;
+ if (dj->index >= i) break; /* When reached SFN, all entries of the object has been deleted. */
+ res = dir_next(dj, FALSE); /* Next entry */
+ } while (res == FR_OK);
+ if (res == FR_NO_FILE) res = FR_INT_ERR;
+ }
+
+#else /* Non LFN configuration */
+ res = dir_seek(dj, dj->index);
+ if (res == FR_OK) {
+ res = move_window(dj->fs, dj->sect);
+ if (res == FR_OK) {
+ *dj->dir = 0xE5; /* Mark the entry "deleted" */
+ dj->fs->wflag = 1;
+ }
+ }
+#endif
+
+ return res;
+}
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Pick a segment and create the object name in directory form */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT create_name (
+ DIR *dj, /* Pointer to the directory object */
+ const XCHAR **path /* Pointer to pointer to the segment in the path string */
+)
+{
+#ifdef _EXCVT
+ static const BYTE cvt[] = _EXCVT;
+#endif
+
+#if _USE_LFN /* LFN configuration */
+ BYTE b, cf;
+ WCHAR w, *lfn;
+ int i, ni, si, di;
+ const XCHAR *p;
+
+ /* Create LFN in Unicode */
+ si = di = 0;
+ p = *path;
+ lfn = dj->lfn;
+ for (;;) {
+ w = p[si++]; /* Get a character */
+ if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */
+ if (di >= _MAX_LFN) /* Reject too long name */
+ return FR_INVALID_NAME;
+#if !_LFN_UNICODE
+ w &= 0xFF;
+ if (IsDBCS1(w)) { /* If it is a DBC 1st byte */
+ b = p[si++]; /* Get 2nd byte */
+ if (!IsDBCS2(b)) /* Reject invalid code for DBC */
+ return FR_INVALID_NAME;
+ w = (w << 8) + b;
+ }
+ w = ff_convert(w, 1); /* Convert OEM to Unicode */
+ if (!w) return FR_INVALID_NAME; /* Reject invalid code */
+#endif
+ if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal chars for LFN */
+ return FR_INVALID_NAME;
+ lfn[di++] = w; /* Store the Unicode char */
+ }
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+ cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
+#if _FS_RPATH
+ if ((di == 1 && lfn[di - 1] == '.') || /* Is this a dot entry? */
+ (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) {
+ lfn[di] = 0;
+ for (i = 0; i < 11; i++)
+ dj->fn[i] = (i < di) ? '.' : ' ';
+ dj->fn[i] = cf | NS_DOT; /* This is a dot entry */
+ return FR_OK;
+ }
+#endif
+ while (di) { /* Strip trailing spaces and dots */
+ w = lfn[di - 1];
+ if (w != ' ' && w != '.') break;
+ di--;
+ }
+ if (!di) return FR_INVALID_NAME; /* Reject null string */
+
+ lfn[di] = 0; /* LFN is created */
+
+ /* Create SFN in directory form */
+ mem_set(dj->fn, ' ', 11);
+ for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */
+ if (si) cf |= NS_LOSS | NS_LFN;
+ while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */
+
+ b = i = 0; ni = 8;
+ for (;;) {
+ w = lfn[si++]; /* Get an LFN char */
+ if (!w) break; /* Break on enf of the LFN */
+ if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */
+ cf |= NS_LOSS | NS_LFN; continue;
+ }
+
+ if (i >= ni || si == di) { /* Extension or end of SFN */
+ if (ni == 11) { /* Long extension */
+ cf |= NS_LOSS | NS_LFN; break;
+ }
+ if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */
+ if (si > di) break; /* No extension */
+ si = di; i = 8; ni = 11; /* Enter extension section */
+ b <<= 2; continue;
+ }
+
+ if (w >= 0x80) { /* Non ASCII char */
+#ifdef _EXCVT
+ w = ff_convert(w, 0); /* Unicode -> OEM code */
+ if (w) w = cvt[w - 0x80]; /* Convert extended char to upper (SBCS) */
+#else
+ w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */
+#endif
+ cf |= NS_LFN; /* Force create LFN entry */
+ }
+
+ if (_DF1S && w >= 0x100) { /* Double byte char */
+ if (i >= ni - 1) {
+ cf |= NS_LOSS | NS_LFN; i = ni; continue;
+ }
+ dj->fn[i++] = (BYTE)(w >> 8);
+ } else { /* Single byte char */
+ if (!w || chk_chr("+,;[=]", w)) { /* Replace illegal chars for SFN */
+ w = '_'; cf |= NS_LOSS | NS_LFN; /* Lossy conversion */
+ } else {
+ if (IsUpper(w)) { /* ASCII large capital */
+ b |= 2;
+ } else {
+ if (IsLower(w)) { /* ASCII small capital */
+ b |= 1; w -= 0x20;
+ }
+ }
+ }
+ }
+ dj->fn[i++] = (BYTE)w;
+ }
+
+ if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05; /* If the first char collides with deleted mark, replace it with 0x05 */
+
+ if (ni == 8) b <<= 2;
+ if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */
+ cf |= NS_LFN;
+ if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended char, NT flags are created */
+ if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */
+ if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */
+ }
+
+ dj->fn[NS] = cf; /* SFN is created */
+
+ return FR_OK;
+
+
+#else /* Non-LFN configuration */
+ BYTE b, c, d, *sfn;
+ int ni, si, i;
+ const char *p;
+
+ /* Create file name in directory form */
+ sfn = dj->fn;
+ mem_set(sfn, ' ', 11);
+ si = i = b = 0; ni = 8;
+ p = *path;
+#if _FS_RPATH
+ if (p[si] == '.') { /* Is this a dot entry? */
+ for (;;) {
+ c = p[si++];
+ if (c != '.' || si >= 3) break;
+ sfn[i++] = c;
+ }
+ if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME;
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+ sfn[NS] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */
+ return FR_OK;
+ }
+#endif
+ for (;;) {
+ c = p[si++];
+ if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */
+ if (c == '.' || i >= ni) {
+ if (ni != 8 || c != '.') return FR_INVALID_NAME;
+ i = 8; ni = 11;
+ b <<= 2; continue;
+ }
+ if (c >= 0x80) { /* Extended char */
+#ifdef _EXCVT
+ c = cvt[c - 0x80]; /* Convert extend char (SBCS) */
+#else
+ b |= 3; /* Eliminate NT flag if ext char is exist */
+#if !_DF1S /* ASCII only cfg */
+ return FR_INVALID_NAME;
+#endif
+#endif
+ }
+ if (IsDBCS1(c)) { /* DBC 1st byte? */
+ d = p[si++]; /* Get 2nd byte */
+ if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */
+ return FR_INVALID_NAME;
+ sfn[i++] = c;
+ sfn[i++] = d;
+ } else { /* Single byte code */
+ if (chk_chr(" \"*+,[=]|\x7F", c)) /* Reject illegal chrs for SFN */
+ return FR_INVALID_NAME;
+ if (IsUpper(c)) { /* ASCII large capital? */
+ b |= 2;
+ } else {
+ if (IsLower(c)) { /* ASCII small capital? */
+ b |= 1; c -= 0x20;
+ }
+ }
+ sfn[i++] = c;
+ }
+ }
+ *path = &p[si]; /* Rerurn pointer to the next segment */
+ c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */
+
+ if (!i) return FR_INVALID_NAME; /* Reject null string */
+ if (sfn[0] == 0xE5) sfn[0] = 0x05; /* When first char collides with 0xE5, replace it with 0x05 */
+
+ if (ni == 8) b <<= 2;
+ if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Extension has only small capital) */
+ if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Filename has only small capital) */
+
+ sfn[NS] = c; /* Store NT flag, File name is created */
+
+ return FR_OK;
+#endif
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Get file information from directory entry */
+/*-----------------------------------------------------------------------*/
+#if _FS_MINIMIZE <= 1
+static
+void get_fileinfo ( /* No return code */
+ DIR *dj, /* Pointer to the directory object */
+ FILINFO *fno /* Pointer to the file information to be filled */
+)
+{
+ int i;
+ BYTE c, nt, *dir;
+ char *p;
+
+
+ p = fno->fname;
+ if (dj->sect) {
+ dir = dj->dir;
+ nt = dir[DIR_NTres]; /* NT flag */
+ for (i = 0; i < 8; i++) { /* Copy name body */
+ c = dir[i];
+ if (c == ' ') break;
+ if (c == 0x05) c = 0xE5;
+ if (_USE_LFN && (nt & NS_BODY) && IsUpper(c)) c += 0x20;
+ *p++ = c;
+ }
+ if (dir[8] != ' ') { /* Copy name extension */
+ *p++ = '.';
+ for (i = 8; i < 11; i++) {
+ c = dir[i];
+ if (c == ' ') break;
+ if (_USE_LFN && (nt & NS_EXT) && IsUpper(c)) c += 0x20;
+ *p++ = c;
+ }
+ }
+ fno->fattrib = dir[DIR_Attr]; /* Attribute */
+ fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */
+ fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */
+ fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */
+ }
+ *p = 0;
+
+#if _USE_LFN
+ if (fno->lfname) {
+ XCHAR *tp = fno->lfname;
+ WCHAR w, *lfn;
+
+ i = 0;
+ if (dj->sect && dj->lfn_idx != 0xFFFF) {/* Get LFN if available */
+ lfn = dj->lfn;
+ while ((w = *lfn++) != 0) { /* Get an LFN char */
+#if !_LFN_UNICODE
+ w = ff_convert(w, 0); /* Unicode -> OEM conversion */
+ if (!w) { i = 0; break; } /* Could not convert, no LFN */
+ if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC */
+ tp[i++] = (XCHAR)(w >> 8);
+#endif
+ if (i >= fno->lfsize - 1) { i = 0; break; } /* Buffer overrun, no LFN */
+ tp[i++] = (XCHAR)w;
+ }
+ }
+ tp[i] = 0; /* Terminator */
+ }
+#endif
+}
+#endif /* _FS_MINIMIZE <= 1 */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Follow a file path */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
+ DIR *dj, /* Directory object to return last directory and found object */
+ const XCHAR *path /* Full-path string to find a file or directory */
+)
+{
+ FRESULT res;
+ BYTE *dir, last;
+
+
+ while (!_USE_LFN && *path == ' ') path++; /* Skip leading spaces */
+#if _FS_RPATH
+ if (*path == '/' || *path == '\\') { /* There is a heading separator */
+ path++; dj->sclust = 0; /* Strip it and start from the root dir */
+ } else { /* No heading saparator */
+ dj->sclust = dj->fs->cdir; /* Start from the current dir */
+ }
+#else
+ if (*path == '/' || *path == '\\') /* Strip heading separator if exist */
+ path++;
+ dj->sclust = 0; /* Start from the root dir */
+#endif
+
+ if ((UINT)*path < ' ') { /* Null path means the start directory itself */
+ res = dir_seek(dj, 0);
+ dj->dir = NULL;
+
+ } else { /* Follow path */
+ for (;;) {
+ res = create_name(dj, &path); /* Get a segment */
+ if (res != FR_OK) break;
+ res = dir_find(dj); /* Find it */
+ last = *(dj->fn+NS) & NS_LAST;
+ if (res != FR_OK) { /* Could not find the object */
+ if (res == FR_NO_FILE && !last)
+ res = FR_NO_PATH;
+ break;
+ }
+ if (last) break; /* Last segment match. Function completed. */
+ dir = dj->dir; /* There is next segment. Follow the sub directory */
+ if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */
+ res = FR_NO_PATH; break;
+ }
+ dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ }
+ }
+
+ return res;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Load boot record and check if it is an FAT boot record */
+/*-----------------------------------------------------------------------*/
+
+static
+BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
+ FATFS *fs, /* File system object */
+ DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
+)
+{
+ if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK) /* Load boot record */
+ return 3;
+ if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
+ return 2;
+
+ if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
+ return 0;
+ if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
+ return 0;
+
+ return 1;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Make sure that the file system is valid */
+/*-----------------------------------------------------------------------*/
+
+
+FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occured */
+ const XCHAR **path, /* Pointer to pointer to the path name (drive number) */
+ FATFS **rfs, /* Pointer to pointer to the found file system object */
+ BYTE chk_wp /* !=0: Check media write protection for write access */
+)
+{
+ BYTE fmt, *tbl;
+ UINT vol;
+ DSTATUS stat;
+ DWORD bsect, fsize, tsect, mclst;
+ const XCHAR *p = *path;
+ FATFS *fs;
+
+ /* Get logical drive number from the path name */
+ vol = p[0] - '0'; /* Is there a drive number? */
+ if (vol <= 9 && p[1] == ':') { /* Found a drive number, get and strip it */
+ p += 2; *path = p; /* Return pointer to the path name */
+ } else { /* No drive number is given */
+#if _FS_RPATH
+ vol = Drive; /* Use current drive */
+#else
+ vol = 0; /* Use drive 0 */
+#endif
+ }
+
+ /* Check if the logical drive is valid or not */
+ if (vol >= _DRIVES) /* Is the drive number valid? */
+ return FR_INVALID_DRIVE;
+ *rfs = fs = FatFs[vol]; /* Returen pointer to the corresponding file system object */
+ if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */
+
+ ENTER_FF(fs); /* Lock file system */
+
+ if (fs->fs_type) { /* If the logical drive has been mounted */
+ stat = disk_status(fs->drive);
+ if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized (has not been changed), */
+#if !_FS_READONLY
+ if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
+ return FR_WRITE_PROTECTED;
+#endif
+ return FR_OK; /* The file system object is valid */
+ }
+ }
+
+ /* The logical drive must be mounted. Following code attempts to mount the volume */
+
+ fs->fs_type = 0; /* Clear the file system object */
+ fs->drive = (BYTE)LD2PD(vol); /* Bind the logical drive and a physical drive */
+ stat = disk_initialize(fs->drive); /* Initialize low level disk I/O layer */
+ if (stat & STA_NOINIT) /* Check if the drive is ready */
+ return FR_NOT_READY;
+#if _MAX_SS != 512 /* Get disk sector size if needed */
+ if (disk_ioctl(fs->drive, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS)
+ return FR_NO_FILESYSTEM;
+#endif
+#if !_FS_READONLY
+ if (chk_wp && (stat & STA_PROTECT)) /* Check disk write protection if needed */
+ return FR_WRITE_PROTECTED;
+#endif
+ /* Search FAT partition on the drive */
+ fmt = check_fs(fs, bsect = 0); /* Check sector 0 as an SFD format */
+ if (fmt == 1) { /* Not an FAT boot record, it may be patitioned */
+ /* Check a partition listed in top of the partition table */
+ tbl = &fs->win[MBR_Table + LD2PT(vol) * 16]; /* Partition table */
+ if (tbl[4]) { /* Is the partition existing? */
+ bsect = LD_DWORD(&tbl[8]); /* Partition offset in LBA */
+ fmt = check_fs(fs, bsect); /* Check the partition */
+ }
+ }
+ if (fmt == 3) return FR_DISK_ERR;
+ if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs)) /* No valid FAT patition is found */
+ return FR_NO_FILESYSTEM;
+
+ /* Initialize the file system object */
+ fsize = LD_WORD(fs->win+BPB_FATSz16); /* Number of sectors per FAT */
+ if (!fsize) fsize = LD_DWORD(fs->win+BPB_FATSz32);
+ fs->sects_fat = fsize;
+ fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */
+ fsize *= fs->n_fats; /* (Number of sectors in FAT area) */
+ fs->fatbase = bsect + LD_WORD(fs->win+BPB_RsvdSecCnt); /* FAT start sector (lba) */
+ fs->csize = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */
+ fs->n_rootdir = LD_WORD(fs->win+BPB_RootEntCnt); /* Nmuber of root directory entries */
+ tsect = LD_WORD(fs->win+BPB_TotSec16); /* Number of sectors on the volume */
+ if (!tsect) tsect = LD_DWORD(fs->win+BPB_TotSec32);
+ fs->max_clust = mclst = (tsect /* Last cluster# + 1 (Number of clusters + 2) */
+ - LD_WORD(fs->win+BPB_RsvdSecCnt) - fsize - fs->n_rootdir / (SS(fs)/32)
+ ) / fs->csize + 2;
+
+ fmt = FS_FAT12; /* Determine the FAT sub type */
+ if (mclst >= 0xFF7) fmt = FS_FAT16; /* Number of clusters >= 0xFF5 */
+ if (mclst >= 0xFFF7) fmt = FS_FAT32; /* Number of clusters >= 0xFFF5 */
+
+ if (fmt == FS_FAT32)
+ fs->dirbase = LD_DWORD(fs->win+BPB_RootClus); /* Root directory start cluster */
+ else
+ fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */
+ fs->database = fs->fatbase + fsize + fs->n_rootdir / (SS(fs)/32); /* Data start sector (lba) */
+
+#if !_FS_READONLY
+ /* Initialize allocation information */
+ fs->free_clust = 0xFFFFFFFF;
+ fs->wflag = 0;
+ /* Get fsinfo if needed */
+ if (fmt == FS_FAT32) {
+ fs->fsi_flag = 0;
+ fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);
+ if (disk_read(fs->drive, fs->win, fs->fsi_sector, 1) == RES_OK &&
+ LD_WORD(fs->win+BS_55AA) == 0xAA55 &&
+ LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&
+ LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {
+ fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);
+ fs->free_clust = LD_DWORD(fs->win+FSI_Free_Count);
+ }
+ }
+#endif
+ fs->fs_type = fmt; /* FAT sub-type */
+ fs->winsect = 0; /* Invalidate sector cache */
+#if _FS_RPATH
+ fs->cdir = 0; /* Current directory (root dir) */
+#endif
+ fs->id = ++Fsid; /* File system mount ID */
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Check if the file/dir object is valid or not */
+/*-----------------------------------------------------------------------*/
+
+static
+FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */
+ FATFS *fs, /* Pointer to the file system object */
+ WORD id /* Member id of the target object to be checked */
+)
+{
+ if (!fs || !fs->fs_type || fs->id != id)
+ return FR_INVALID_OBJECT;
+
+ ENTER_FF(fs); /* Lock file system */
+
+ if (disk_status(fs->drive) & STA_NOINIT)
+ return FR_NOT_READY;
+
+ return FR_OK;
+}
+
+
+
+
+/*--------------------------------------------------------------------------
+
+ Public Functions
+
+--------------------------------------------------------------------------*/
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Mount/Unmount a Locical Drive */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_mount (
+ BYTE vol, /* Logical drive number to be mounted/unmounted */
+ FATFS *fs /* Pointer to new file system object (NULL for unmount)*/
+)
+{
+ FATFS *rfs;
+
+
+ if (vol >= _DRIVES) /* Check if the drive number is valid */
+ return FR_INVALID_DRIVE;
+ rfs = FatFs[vol]; /* Get current fs object */
+
+ if (rfs) {
+#if _FS_REENTRANT /* Discard sync object of the current volume */
+ if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;
+#endif
+ rfs->fs_type = 0; /* Clear old fs object */
+ }
+
+ if (fs) {
+ fs->fs_type = 0; /* Clear new fs object */
+#if _FS_REENTRANT /* Create sync object for the new volume */
+ if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;
+#endif
+ }
+ FatFs[vol] = fs; /* Register new fs object */
+
+ return FR_OK;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Open or Create a File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_open (
+ FIL *fp, /* Pointer to the blank file object */
+ const XCHAR *path, /* Pointer to the file name */
+ BYTE mode /* Access mode and file open mode flags */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ fp->fs = NULL; /* Clear file object */
+#if !_FS_READONLY
+ mode &= (FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW);
+ res = chk_mounted(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)));
+#else
+ mode &= FA_READ;
+ res = chk_mounted(&path, &dj.fs, 0);
+#endif
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+
+#if !_FS_READONLY
+ /* Create or Open a file */
+ if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) {
+ DWORD ps, cl;
+
+ if (res != FR_OK) { /* No file, create new */
+ if (res == FR_NO_FILE) /* There is no file to open, create a new entry */
+ res = dir_register(&dj);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ mode |= FA_CREATE_ALWAYS;
+ dir = dj.dir; /* Created entry (SFN entry) */
+ }
+ else { /* Any object is already existing */
+ if (mode & FA_CREATE_NEW) /* Cannot create new */
+ LEAVE_FF(dj.fs, FR_EXIST);
+ dir = dj.dir;
+ if (!dir || (dir[DIR_Attr] & (AM_RDO | AM_DIR))) /* Cannot overwrite it (R/O or DIR) */
+ LEAVE_FF(dj.fs, FR_DENIED);
+ if (mode & FA_CREATE_ALWAYS) { /* Resize it to zero on over write mode */
+ cl = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO); /* Get start cluster */
+ ST_WORD(dir+DIR_FstClusHI, 0); /* cluster = 0 */
+ ST_WORD(dir+DIR_FstClusLO, 0);
+ ST_DWORD(dir+DIR_FileSize, 0); /* size = 0 */
+ dj.fs->wflag = 1;
+ ps = dj.fs->winsect; /* Remove the cluster chain */
+ if (cl) {
+ res = remove_chain(dj.fs, cl);
+ if (res) LEAVE_FF(dj.fs, res);
+ dj.fs->last_clust = cl - 1; /* Reuse the cluster hole */
+ }
+ res = move_window(dj.fs, ps);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ }
+ }
+ if (mode & FA_CREATE_ALWAYS) {
+ dir[DIR_Attr] = 0; /* Reset attribute */
+ ps = get_fattime();
+ ST_DWORD(dir+DIR_CrtTime, ps); /* Created time */
+ dj.fs->wflag = 1;
+ mode |= FA__WRITTEN; /* Set file changed flag */
+ }
+ }
+ /* Open an existing file */
+ else {
+#endif /* !_FS_READONLY */
+ if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
+ dir = dj.dir;
+ if (!dir || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
+ LEAVE_FF(dj.fs, FR_NO_FILE);
+#if !_FS_READONLY
+ if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */
+ LEAVE_FF(dj.fs, FR_DENIED);
+ }
+ fp->dir_sect = dj.fs->winsect; /* Pointer to the directory entry */
+ fp->dir_ptr = dj.dir;
+#endif
+ fp->flag = mode; /* File access mode */
+ fp->org_clust = /* File start cluster */
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ fp->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */
+ fp->fptr = 0; fp->csect = 255; /* File pointer */
+ fp->dsect = 0;
+ fp->fs = dj.fs; fp->id = dj.fs->id; /* Owner file system object of the file */
+
+ LEAVE_FF(dj.fs, FR_OK);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_read (
+ FIL *fp, /* Pointer to the file object */
+ void *buff, /* Pointer to data buffer */
+ UINT btr, /* Number of bytes to read */
+ UINT *br /* Pointer to number of bytes read */
+)
+{
+ FRESULT res;
+ DWORD clst, sect, remain;
+ UINT rcnt, cc;
+ BYTE *rbuff = buff;
+
+
+ *br = 0; /* Initialize bytes read */
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_READ)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+ remain = fp->fsize - fp->fptr;
+ if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
+
+ for ( ; btr; /* Repeat until all data transferred */
+ rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
+ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
+ if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
+ clst = (fp->fptr == 0) ? /* On the top of the file? */
+ fp->org_clust : get_fat(fp->fs, fp->curr_clust);
+ if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->curr_clust = clst; /* Update current cluster */
+ fp->csect = 0; /* Reset sector offset in the cluster */
+ }
+ sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
+ if (!sect) ABORT(fp->fs, FR_INT_ERR);
+ sect += fp->csect;
+ cc = btr / SS(fp->fs); /* When remaining bytes >= sector size, */
+ if (cc) { /* Read maximum contiguous sectors directly */
+ if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
+ cc = fp->fs->csize - fp->csect;
+ if (disk_read(fp->fs->drive, rbuff, sect, (BYTE)cc) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+#if !_FS_READONLY && _FS_MINIMIZE <= 2
+#if _FS_TINY
+ if (fp->fs->wflag && fp->fs->winsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
+ mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs));
+#else
+ if ((fp->flag & FA__DIRTY) && fp->dsect - sect < cc) /* Replace one of the read sectors with cached data if it contains a dirty sector */
+ mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs));
+#endif
+#endif
+ fp->csect += (BYTE)cc; /* Next sector address in the cluster */
+ rcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
+ continue;
+ }
+#if !_FS_TINY
+#if !_FS_READONLY
+ if (fp->flag & FA__DIRTY) { /* Write sector I/O buffer if needed */
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ if (fp->dsect != sect) { /* Fill sector buffer with file data */
+ if (disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ }
+#endif
+ fp->dsect = sect;
+ fp->csect++; /* Next sector address in the cluster */
+ }
+ rcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Get partial sector data from sector buffer */
+ if (rcnt > btr) rcnt = btr;
+#if _FS_TINY
+ if (move_window(fp->fs, fp->dsect)) /* Move sector window */
+ ABORT(fp->fs, FR_DISK_ERR);
+ mem_cpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
+#else
+ mem_cpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */
+#endif
+ }
+
+ LEAVE_FF(fp->fs, FR_OK);
+}
+
+
+
+
+#if !_FS_READONLY
+/*-----------------------------------------------------------------------*/
+/* Write File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_write (
+ FIL *fp, /* Pointer to the file object */
+ const void *buff, /* Pointer to the data to be written */
+ UINT btw, /* Number of bytes to write */
+ UINT *bw /* Pointer to number of bytes written */
+)
+{
+ FRESULT res;
+ DWORD clst, sect;
+ UINT wcnt, cc;
+ const BYTE *wbuff = buff;
+
+
+ *bw = 0; /* Initialize bytes written */
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_WRITE)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+ if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
+
+ for ( ; btw; /* Repeat until all data transferred */
+ wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
+ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
+ if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
+ if (fp->fptr == 0) { /* On the top of the file? */
+ clst = fp->org_clust; /* Follow from the origin */
+ if (clst == 0) /* When there is no cluster chain, */
+ fp->org_clust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */
+ } else { /* Middle or end of the file */
+ clst = create_chain(fp->fs, fp->curr_clust); /* Follow or streach cluster chain */
+ }
+ if (clst == 0) break; /* Could not allocate a new cluster (disk full) */
+ if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->curr_clust = clst; /* Update current cluster */
+ fp->csect = 0; /* Reset sector address in the cluster */
+ }
+#if _FS_TINY
+ if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0)) /* Write back data buffer prior to following direct transfer */
+ ABORT(fp->fs, FR_DISK_ERR);
+#else
+ if (fp->flag & FA__DIRTY) { /* Write back data buffer prior to following direct transfer */
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ sect = clust2sect(fp->fs, fp->curr_clust); /* Get current sector */
+ if (!sect) ABORT(fp->fs, FR_INT_ERR);
+ sect += fp->csect;
+ cc = btw / SS(fp->fs); /* When remaining bytes >= sector size, */
+ if (cc) { /* Write maximum contiguous sectors directly */
+ if (fp->csect + cc > fp->fs->csize) /* Clip at cluster boundary */
+ cc = fp->fs->csize - fp->csect;
+ if (disk_write(fp->fs->drive, wbuff, sect, (BYTE)cc) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+#if _FS_TINY
+ if (fp->fs->winsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
+ mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs));
+ fp->fs->wflag = 0;
+ }
+#else
+ if (fp->dsect - sect < cc) { /* Refill sector cache if it gets dirty by the direct write */
+ mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs));
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ fp->csect += (BYTE)cc; /* Next sector address in the cluster */
+ wcnt = SS(fp->fs) * cc; /* Number of bytes transferred */
+ continue;
+ }
+#if _FS_TINY
+ if (fp->fptr >= fp->fsize) { /* Avoid silly buffer filling at growing edge */
+ if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR);
+ fp->fs->winsect = sect;
+ }
+#else
+ if (fp->dsect != sect) { /* Fill sector buffer with file data */
+ if (fp->fptr < fp->fsize &&
+ disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ }
+#endif
+ fp->dsect = sect;
+ fp->csect++; /* Next sector address in the cluster */
+ }
+ wcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs)); /* Put partial sector into file I/O buffer */
+ if (wcnt > btw) wcnt = btw;
+#if _FS_TINY
+ if (move_window(fp->fs, fp->dsect)) /* Move sector window */
+ ABORT(fp->fs, FR_DISK_ERR);
+ mem_cpy(&fp->fs->win[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
+ fp->fs->wflag = 1;
+#else
+ mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */
+ fp->flag |= FA__DIRTY;
+#endif
+ }
+
+ if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */
+ fp->flag |= FA__WRITTEN; /* Set file changed flag */
+
+ LEAVE_FF(fp->fs, FR_OK);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Synchronize the File Object */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_sync (
+ FIL *fp /* Pointer to the file object */
+)
+{
+ FRESULT res;
+ DWORD tim;
+ BYTE *dir;
+
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res == FR_OK) {
+ if (fp->flag & FA__WRITTEN) { /* Has the file been written? */
+#if !_FS_TINY /* Write-back dirty buffer */
+ if (fp->flag & FA__DIRTY) {
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ LEAVE_FF(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ /* Update the directory entry */
+ res = move_window(fp->fs, fp->dir_sect);
+ if (res == FR_OK) {
+ dir = fp->dir_ptr;
+ dir[DIR_Attr] |= AM_ARC; /* Set archive bit */
+ ST_DWORD(dir+DIR_FileSize, fp->fsize); /* Update file size */
+ ST_WORD(dir+DIR_FstClusLO, fp->org_clust); /* Update start cluster */
+ ST_WORD(dir+DIR_FstClusHI, fp->org_clust >> 16);
+ tim = get_fattime(); /* Updated time */
+ ST_DWORD(dir+DIR_WrtTime, tim);
+ fp->flag &= ~FA__WRITTEN;
+ fp->fs->wflag = 1;
+ res = sync(fp->fs);
+ }
+ }
+ }
+
+ LEAVE_FF(fp->fs, res);
+}
+
+#endif /* !_FS_READONLY */
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Close File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_close (
+ FIL *fp /* Pointer to the file object to be closed */
+)
+{
+ FRESULT res;
+
+
+#if _FS_READONLY
+ res = validate(fp->fs, fp->id);
+ if (res == FR_OK) fp->fs = NULL;
+ LEAVE_FF(fp->fs, res);
+#else
+ res = f_sync(fp);
+ if (res == FR_OK) fp->fs = NULL;
+ return res;
+#endif
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change Current Drive/Directory */
+/*-----------------------------------------------------------------------*/
+
+#if _FS_RPATH
+
+FRESULT f_chdrive (
+ BYTE drv /* Drive number */
+)
+{
+ if (drv >= _DRIVES) return FR_INVALID_DRIVE;
+
+ Drive = drv;
+
+ return FR_OK;
+}
+
+
+
+
+FRESULT f_chdir (
+ const XCHAR *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj.fs, 0);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res == FR_OK) { /* Follow completed */
+ dir = dj.dir; /* Pointer to the entry */
+ if (!dir) {
+ dj.fs->cdir = 0; /* No entry (root dir) */
+ } else {
+ if (dir[DIR_Attr] & AM_DIR) /* Reached to the dir */
+ dj.fs->cdir = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ else
+ res = FR_NO_PATH; /* Could not reach the dir (it is a file) */
+ }
+ }
+ if (res == FR_NO_FILE) res = FR_NO_PATH;
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+#endif
+
+
+
+#if _FS_MINIMIZE <= 2
+/*-----------------------------------------------------------------------*/
+/* Seek File R/W Pointer */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_lseek (
+ FIL *fp, /* Pointer to the file object */
+ DWORD ofs /* File pointer from top of file */
+)
+{
+ FRESULT res;
+ DWORD clst, bcs, nsect, ifptr;
+
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (ofs > fp->fsize /* In read-only mode, clip offset with the file size */
+#if !_FS_READONLY
+ && !(fp->flag & FA_WRITE)
+#endif
+ ) ofs = fp->fsize;
+
+ ifptr = fp->fptr;
+ fp->fptr = nsect = 0; fp->csect = 255;
+ if (ofs > 0) {
+ bcs = (DWORD)fp->fs->csize * SS(fp->fs); /* Cluster size (byte) */
+ if (ifptr > 0 &&
+ (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */
+ fp->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */
+ ofs -= fp->fptr;
+ clst = fp->curr_clust;
+ } else { /* When seek to back cluster, */
+ clst = fp->org_clust; /* start from the first cluster */
+#if !_FS_READONLY
+ if (clst == 0) { /* If no cluster chain, create a new chain */
+ clst = create_chain(fp->fs, 0);
+ if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->org_clust = clst;
+ }
+#endif
+ fp->curr_clust = clst;
+ }
+ if (clst != 0) {
+ while (ofs > bcs) { /* Cluster following loop */
+#if !_FS_READONLY
+ if (fp->flag & FA_WRITE) { /* Check if in write mode or not */
+ clst = create_chain(fp->fs, clst); /* Force streached if in write mode */
+ if (clst == 0) { /* When disk gets full, clip file size */
+ ofs = bcs; break;
+ }
+ } else
+#endif
+ clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ if (clst <= 1 || clst >= fp->fs->max_clust) ABORT(fp->fs, FR_INT_ERR);
+ fp->curr_clust = clst;
+ fp->fptr += bcs;
+ ofs -= bcs;
+ }
+ fp->fptr += ofs;
+ fp->csect = (BYTE)(ofs / SS(fp->fs)); /* Sector offset in the cluster */
+ if (ofs % SS(fp->fs)) {
+ nsect = clust2sect(fp->fs, clst); /* Current sector */
+ if (!nsect) ABORT(fp->fs, FR_INT_ERR);
+ nsect += fp->csect;
+ fp->csect++;
+ }
+ }
+ }
+ if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) {
+#if !_FS_TINY
+#if !_FS_READONLY
+ if (fp->flag & FA__DIRTY) { /* Write-back dirty buffer if needed */
+ if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->flag &= ~FA__DIRTY;
+ }
+#endif
+ if (disk_read(fp->fs->drive, fp->buf, nsect, 1) != RES_OK)
+ ABORT(fp->fs, FR_DISK_ERR);
+#endif
+ fp->dsect = nsect;
+ }
+#if !_FS_READONLY
+ if (fp->fptr > fp->fsize) { /* Set changed flag if the file size is extended */
+ fp->fsize = fp->fptr;
+ fp->flag |= FA__WRITTEN;
+ }
+#endif
+
+ LEAVE_FF(fp->fs, res);
+}
+
+
+
+
+#if _FS_MINIMIZE <= 1
+/*-----------------------------------------------------------------------*/
+/* Create a Directroy Object */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_opendir (
+ DIR *dj, /* Pointer to directory object to create */
+ const XCHAR *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj->fs, 0);
+ if (res == FR_OK) {
+ INITBUF((*dj), sfn, lfn);
+ res = follow_path(dj, path); /* Follow the path to the directory */
+ if (res == FR_OK) { /* Follow completed */
+ dir = dj->dir;
+ if (dir) { /* It is not the root dir */
+ if (dir[DIR_Attr] & AM_DIR) { /* The object is a directory */
+ dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+ } else { /* The object is not a directory */
+ res = FR_NO_PATH;
+ }
+ }
+ if (res == FR_OK) {
+ dj->id = dj->fs->id;
+ res = dir_seek(dj, 0); /* Rewind dir */
+ }
+ }
+ if (res == FR_NO_FILE) res = FR_NO_PATH;
+ }
+
+ LEAVE_FF(dj->fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Read Directory Entry in Sequense */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_readdir (
+ DIR *dj, /* Pointer to the open directory object */
+ FILINFO *fno /* Pointer to file information to return */
+)
+{
+ FRESULT res;
+ NAMEBUF(sfn, lfn);
+
+
+ res = validate(dj->fs, dj->id); /* Check validity of the object */
+ if (res == FR_OK) {
+ INITBUF((*dj), sfn, lfn);
+ if (!fno) {
+ res = dir_seek(dj, 0);
+ } else {
+ res = dir_read(dj);
+ if (res == FR_NO_FILE) {
+ dj->sect = 0;
+ res = FR_OK;
+ }
+ if (res == FR_OK) { /* A valid entry is found */
+ get_fileinfo(dj, fno); /* Get the object information */
+ res = dir_next(dj, FALSE); /* Increment index for next */
+ if (res == FR_NO_FILE) {
+ dj->sect = 0;
+ res = FR_OK;
+ }
+ }
+ }
+ }
+
+ LEAVE_FF(dj->fs, res);
+}
+
+
+
+#if _FS_MINIMIZE == 0
+/*-----------------------------------------------------------------------*/
+/* Get File Status */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_stat (
+ const XCHAR *path, /* Pointer to the file path */
+ FILINFO *fno /* Pointer to file information to return */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+
+
+ res = chk_mounted(&path, &dj.fs, 0);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res == FR_OK) { /* Follwo completed */
+ if (dj.dir) /* Found an object */
+ get_fileinfo(&dj, fno);
+ else /* It is root dir */
+ res = FR_INVALID_NAME;
+ }
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+#if !_FS_READONLY
+/*-----------------------------------------------------------------------*/
+/* Get Number of Free Clusters */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_getfree (
+ const XCHAR *path, /* Pointer to the logical drive number (root dir) */
+ DWORD *nclst, /* Pointer to the variable to return number of free clusters */
+ FATFS **fatfs /* Pointer to pointer to corresponding file system object to return */
+)
+{
+ FRESULT res;
+ DWORD n, clst, sect, stat;
+ UINT i;
+ BYTE fat, *p;
+
+
+ /* Get drive number */
+ res = chk_mounted(&path, fatfs, 0);
+ if (res != FR_OK) LEAVE_FF(*fatfs, res);
+
+ /* If number of free cluster is valid, return it without cluster scan. */
+ if ((*fatfs)->free_clust <= (*fatfs)->max_clust - 2) {
+ *nclst = (*fatfs)->free_clust;
+ LEAVE_FF(*fatfs, FR_OK);
+ }
+
+ /* Get number of free clusters */
+ fat = (*fatfs)->fs_type;
+ n = 0;
+ if (fat == FS_FAT12) {
+ clst = 2;
+ do {
+ stat = get_fat(*fatfs, clst);
+ if (stat == 0xFFFFFFFF) LEAVE_FF(*fatfs, FR_DISK_ERR);
+ if (stat == 1) LEAVE_FF(*fatfs, FR_INT_ERR);
+ if (stat == 0) n++;
+ } while (++clst < (*fatfs)->max_clust);
+ } else {
+ clst = (*fatfs)->max_clust;
+ sect = (*fatfs)->fatbase;
+ i = 0; p = 0;
+ do {
+ if (!i) {
+ res = move_window(*fatfs, sect++);
+ if (res != FR_OK)
+ LEAVE_FF(*fatfs, res);
+ p = (*fatfs)->win;
+ i = SS(*fatfs);
+ }
+ if (fat == FS_FAT16) {
+ if (LD_WORD(p) == 0) n++;
+ p += 2; i -= 2;
+ } else {
+ if ((LD_DWORD(p) & 0x0FFFFFFF) == 0) n++;
+ p += 4; i -= 4;
+ }
+ } while (--clst);
+ }
+ (*fatfs)->free_clust = n;
+ if (fat == FS_FAT32) (*fatfs)->fsi_flag = 1;
+ *nclst = n;
+
+ LEAVE_FF(*fatfs, FR_OK);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Truncate File */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_truncate (
+ FIL *fp /* Pointer to the file object */
+)
+{
+ FRESULT res;
+ DWORD ncl;
+
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check abort flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_WRITE)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+
+ if (fp->fsize > fp->fptr) {
+ fp->fsize = fp->fptr; /* Set file size to current R/W point */
+ fp->flag |= FA__WRITTEN;
+ if (fp->fptr == 0) { /* When set file size to zero, remove entire cluster chain */
+ res = remove_chain(fp->fs, fp->org_clust);
+ fp->org_clust = 0;
+ } else { /* When truncate a part of the file, remove remaining clusters */
+ ncl = get_fat(fp->fs, fp->curr_clust);
+ res = FR_OK;
+ if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;
+ if (ncl == 1) res = FR_INT_ERR;
+ if (res == FR_OK && ncl < fp->fs->max_clust) {
+ res = put_fat(fp->fs, fp->curr_clust, 0x0FFFFFFF);
+ if (res == FR_OK) res = remove_chain(fp->fs, ncl);
+ }
+ }
+ }
+ if (res != FR_OK) fp->flag |= FA__ERROR;
+
+ LEAVE_FF(fp->fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Delete a File or Directory */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_unlink (
+ const XCHAR *path /* Pointer to the file or directory path */
+)
+{
+ FRESULT res;
+ DIR dj, sdj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+ DWORD dclst;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */
+
+ dir = dj.dir;
+ if (!dir) /* Is it the root directory? */
+ LEAVE_FF(dj.fs, FR_INVALID_NAME);
+ if (dir[DIR_Attr] & AM_RDO) /* Is it a R/O object? */
+ LEAVE_FF(dj.fs, FR_DENIED);
+ dclst = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
+
+ if (dir[DIR_Attr] & AM_DIR) { /* It is a sub-directory */
+ if (dclst < 2) LEAVE_FF(dj.fs, FR_INT_ERR);
+ mem_cpy(&sdj, &dj, sizeof(DIR)); /* Check if the sub-dir is empty or not */
+ sdj.sclust = dclst;
+ res = dir_seek(&sdj, 2);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ res = dir_read(&sdj);
+ if (res == FR_OK) res = FR_DENIED; /* Not empty sub-dir */
+ if (res != FR_NO_FILE) LEAVE_FF(dj.fs, res);
+ }
+
+ res = dir_remove(&dj); /* Remove directory entry */
+ if (res == FR_OK) {
+ if (dclst)
+ res = remove_chain(dj.fs, dclst); /* Remove the cluster chain */
+ if (res == FR_OK) res = sync(dj.fs);
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Create a Directory */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_mkdir (
+ const XCHAR *path /* Pointer to the directory path */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir, n;
+ DWORD dsect, dclst, pclst, tim;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (res == FR_OK) res = FR_EXIST; /* Any file or directory is already existing */
+ if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res != FR_NO_FILE) /* Any error occured */
+ LEAVE_FF(dj.fs, res);
+
+ dclst = create_chain(dj.fs, 0); /* Allocate a new cluster for new directory table */
+ res = FR_OK;
+ if (dclst == 0) res = FR_DENIED;
+ if (dclst == 1) res = FR_INT_ERR;
+ if (dclst == 0xFFFFFFFF) res = FR_DISK_ERR;
+ if (res == FR_OK)
+ res = move_window(dj.fs, 0);
+ if (res != FR_OK) LEAVE_FF(dj.fs, res);
+ dsect = clust2sect(dj.fs, dclst);
+
+ dir = dj.fs->win; /* Initialize the new directory table */
+ mem_set(dir, 0, SS(dj.fs));
+ mem_set(dir+DIR_Name, ' ', 8+3); /* Create "." entry */
+ dir[DIR_Name] = '.';
+ dir[DIR_Attr] = AM_DIR;
+ tim = get_fattime();
+ ST_DWORD(dir+DIR_WrtTime, tim);
+ ST_WORD(dir+DIR_FstClusLO, dclst);
+ ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
+ mem_cpy(dir+32, dir, 32); /* Create ".." entry */
+ dir[33] = '.';
+ pclst = dj.sclust;
+ if (dj.fs->fs_type == FS_FAT32 && pclst == dj.fs->dirbase)
+ pclst = 0;
+ ST_WORD(dir+32+DIR_FstClusLO, pclst);
+ ST_WORD(dir+32+DIR_FstClusHI, pclst >> 16);
+ for (n = 0; n < dj.fs->csize; n++) { /* Write dot entries and clear left sectors */
+ dj.fs->winsect = dsect++;
+ dj.fs->wflag = 1;
+ res = move_window(dj.fs, 0);
+ if (res) LEAVE_FF(dj.fs, res);
+ mem_set(dir, 0, SS(dj.fs));
+ }
+
+ res = dir_register(&dj);
+ if (res != FR_OK) {
+ remove_chain(dj.fs, dclst);
+ } else {
+ dir = dj.dir;
+ dir[DIR_Attr] = AM_DIR; /* Attribute */
+ ST_DWORD(dir+DIR_WrtTime, tim); /* Crated time */
+ ST_WORD(dir+DIR_FstClusLO, dclst); /* Table start cluster */
+ ST_WORD(dir+DIR_FstClusHI, dclst >> 16);
+ dj.fs->wflag = 1;
+ res = sync(dj.fs);
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change File Attribute */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_chmod (
+ const XCHAR *path, /* Pointer to the file path */
+ BYTE value, /* Attribute bits */
+ BYTE mask /* Attribute mask to change */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res == FR_OK) {
+ dir = dj.dir;
+ if (!dir) { /* Is it a root directory? */
+ res = FR_INVALID_NAME;
+ } else { /* File or sub directory */
+ mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC; /* Valid attribute mask */
+ dir[DIR_Attr] = (value & mask) | (dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */
+ dj.fs->wflag = 1;
+ res = sync(dj.fs);
+ }
+ }
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Change Timestamp */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_utime (
+ const XCHAR *path, /* Pointer to the file/directory name */
+ const FILINFO *fno /* Pointer to the timestamp to be set */
+)
+{
+ FRESULT res;
+ DIR dj;
+ NAMEBUF(sfn, lfn);
+ BYTE *dir;
+
+
+ res = chk_mounted(&path, &dj.fs, 1);
+ if (res == FR_OK) {
+ INITBUF(dj, sfn, lfn);
+ res = follow_path(&dj, path); /* Follow the file path */
+ if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ if (res == FR_OK) {
+ dir = dj.dir;
+ if (!dir) { /* Root directory */
+ res = FR_INVALID_NAME;
+ } else { /* File or sub-directory */
+ ST_WORD(dir+DIR_WrtTime, fno->ftime);
+ ST_WORD(dir+DIR_WrtDate, fno->fdate);
+ dj.fs->wflag = 1;
+ res = sync(dj.fs);
+ }
+ }
+ }
+
+ LEAVE_FF(dj.fs, res);
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Rename File/Directory */
+/*-----------------------------------------------------------------------*/
+
+FRESULT f_rename (
+ const XCHAR *path_old, /* Pointer to the old name */
+ const XCHAR *path_new /* Pointer to the new name */
+)
+{
+ FRESULT res;
+ DIR dj_old, dj_new;
+ NAMEBUF(sfn, lfn);
+ BYTE buf[21], *dir;
+ DWORD dw;
+
+
+ INITBUF(dj_old, sfn, lfn);
+ res = chk_mounted(&path_old, &dj_old.fs, 1);
+ if (res == FR_OK) {
+ dj_new.fs = dj_old.fs;
+ res = follow_path(&dj_old, path_old); /* Check old object */
+ if (_FS_RPATH && res == FR_OK && (dj_old.fn[NS] & NS_DOT))
+ res = FR_INVALID_NAME;
+ }
+ if (res != FR_OK) LEAVE_FF(dj_old.fs, res); /* The old object is not found */
+
+ if (!dj_old.dir) LEAVE_FF(dj_old.fs, FR_NO_FILE); /* Is root dir? */
+ mem_cpy(buf, dj_old.dir+DIR_Attr, 21); /* Save the object information */
+
+ mem_cpy(&dj_new, &dj_old, sizeof(DIR));
+ res = follow_path(&dj_new, path_new); /* Check new object */
+ if (res == FR_OK) res = FR_EXIST; /* The new object name is already existing */
+ if (res == FR_NO_FILE) { /* Is it a valid path and no name collision? */
+ res = dir_register(&dj_new); /* Register the new object */
+ if (res == FR_OK) {
+ dir = dj_new.dir; /* Copy object information into new entry */
+ mem_cpy(dir+13, buf+2, 19);
+ dir[DIR_Attr] = buf[0] | AM_ARC;
+ dj_old.fs->wflag = 1;
+ if (dir[DIR_Attr] & AM_DIR) { /* Update .. entry in the directory if needed */
+ dw = clust2sect(dj_new.fs, (DWORD)LD_WORD(dir+DIR_FstClusHI) | LD_WORD(dir+DIR_FstClusLO));
+ if (!dw) {
+ res = FR_INT_ERR;
+ } else {
+ res = move_window(dj_new.fs, dw);
+ dir = dj_new.fs->win+32;
+ if (res == FR_OK && dir[1] == '.') {
+ dw = (dj_new.fs->fs_type == FS_FAT32 && dj_new.sclust == dj_new.fs->dirbase) ? 0 : dj_new.sclust;
+ ST_WORD(dir+DIR_FstClusLO, dw);
+ ST_WORD(dir+DIR_FstClusHI, dw >> 16);
+ dj_new.fs->wflag = 1;
+ }
+ }
+ }
+ if (res == FR_OK) {
+ res = dir_remove(&dj_old); /* Remove old entry */
+ if (res == FR_OK)
+ res = sync(dj_old.fs);
+ }
+ }
+ }
+
+ LEAVE_FF(dj_old.fs, res);
+}
+
+#endif /* !_FS_READONLY */
+#endif /* _FS_MINIMIZE == 0 */
+#endif /* _FS_MINIMIZE <= 1 */
+#endif /* _FS_MINIMIZE <= 2 */
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Forward data to the stream directly (Available on only _FS_TINY cfg) */
+/*-----------------------------------------------------------------------*/
+#if _USE_FORWARD && _FS_TINY
+
+FRESULT f_forward (
+ FIL *fp, /* Pointer to the file object */
+ UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */
+ UINT btr, /* Number of bytes to forward */
+ UINT *bf /* Pointer to number of bytes forwarded */
+)
+{
+ FRESULT res;
+ DWORD remain, clst, sect;
+ UINT rcnt;
+
+
+ *bf = 0;
+
+ res = validate(fp->fs, fp->id); /* Check validity of the object */
+ if (res != FR_OK) LEAVE_FF(fp->fs, res);
+ if (fp->flag & FA__ERROR) /* Check error flag */
+ LEAVE_FF(fp->fs, FR_INT_ERR);
+ if (!(fp->flag & FA_READ)) /* Check access mode */
+ LEAVE_FF(fp->fs, FR_DENIED);
+
+ remain = fp->fsize - fp->fptr;
+ if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */
+
+ for ( ; btr && (*func)(NULL, 0); /* Repeat until all data transferred or stream becomes busy */
+ fp->fptr += rcnt, *bf += rcnt, btr -= rcnt) {
+ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */
+ if (fp->csect >= fp->fs->csize) { /* On the cluster boundary? */
+ clst = (fp->fptr == 0) ? /* On the top of the file? */
+ fp->org_clust : get_fat(fp->fs, fp->curr_clust);
+ if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
+ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
+ fp->curr_clust = clst; /* Update current cluster */
+ fp->csect = 0; /* Reset sector address in the cluster */
+ }
+ fp->csect++; /* Next sector address in the cluster */
+ }
+ sect = clust2sect(fp->fs, fp->curr_clust); /* Get current data sector */
+ if (!sect) ABORT(fp->fs, FR_INT_ERR);
+ sect += fp->csect - 1;
+ if (move_window(fp->fs, sect)) /* Move sector window */
+ ABORT(fp->fs, FR_DISK_ERR);
+ fp->dsect = sect;
+ rcnt = SS(fp->fs) - (WORD)(fp->fptr % SS(fp->fs)); /* Forward data from sector window */
+ if (rcnt > btr) rcnt = btr;
+ rcnt = (*func)(&fp->fs->win[(WORD)fp->fptr % SS(fp->fs)], rcnt);
+ if (!rcnt) ABORT(fp->fs, FR_INT_ERR);
+ }
+
+ LEAVE_FF(fp->fs, FR_OK);
+}
+#endif /* _USE_FORWARD */
+
+
+
+#if _USE_MKFS && !_FS_READONLY
+/*-----------------------------------------------------------------------*/
+/* Create File System on the Drive */
+/*-----------------------------------------------------------------------*/
+#define N_ROOTDIR 512 /* Multiple of 32 and <= 2048 */
+#define N_FATS 1 /* 1 or 2 */
+#define MAX_SECTOR 131072000UL /* Maximum partition size */
+#define MIN_SECTOR 2000UL /* Minimum partition size */
+
+
+FRESULT f_mkfs (
+ BYTE drv, /* Logical drive number */
+ BYTE partition, /* Partitioning rule 0:FDISK, 1:SFD */
+ WORD allocsize /* Allocation unit size [bytes] */
+)
+{
+ static const DWORD sstbl[] = { 2048000, 1024000, 512000, 256000, 128000, 64000, 32000, 16000, 8000, 4000, 0 };
+ static const WORD cstbl[] = { 32768, 16384, 8192, 4096, 2048, 16384, 8192, 4096, 2048, 1024, 512 };
+ BYTE fmt, m, *tbl;
+ DWORD b_part, b_fat, b_dir, b_data; /* Area offset (LBA) */
+ DWORD n_part, n_rsv, n_fat, n_dir; /* Area size */
+ DWORD n_clst, d, n;
+ WORD as;
+ FATFS *fs;
+ DSTATUS stat;
+
+
+ /* Check validity of the parameters */
+ if (drv >= _DRIVES) return FR_INVALID_DRIVE;
+ if (partition >= 2) return FR_MKFS_ABORTED;
+
+ /* Check mounted drive and clear work area */
+ fs = FatFs[drv];
+ if (!fs) return FR_NOT_ENABLED;
+ fs->fs_type = 0;
+ drv = LD2PD(drv);
+
+ /* Get disk statics */
+ stat = disk_initialize(drv);
+ if (stat & STA_NOINIT) return FR_NOT_READY;
+ if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
+#if _MAX_SS != 512 /* Get disk sector size */
+ if (disk_ioctl(drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK
+ || SS(fs) > _MAX_SS)
+ return FR_MKFS_ABORTED;
+#endif
+ if (disk_ioctl(drv, GET_SECTOR_COUNT, &n_part) != RES_OK || n_part < MIN_SECTOR)
+ return FR_MKFS_ABORTED;
+ if (n_part > MAX_SECTOR) n_part = MAX_SECTOR;
+ b_part = (!partition) ? 63 : 0; /* Boot sector */
+ n_part -= b_part;
+ for (d = 512; d <= 32768U && d != allocsize; d <<= 1) ; /* Check validity of the allocation unit size */
+ if (d != allocsize) allocsize = 0;
+ if (!allocsize) { /* Auto selection of cluster size */
+ d = n_part;
+ for (as = SS(fs); as > 512U; as >>= 1) d >>= 1;
+ for (n = 0; d < sstbl[n]; n++) ;
+ allocsize = cstbl[n];
+ }
+ if (allocsize < SS(fs)) allocsize = SS(fs);
+
+ allocsize /= SS(fs); /* Number of sectors per cluster */
+
+ /* Pre-compute number of clusters and FAT type */
+ n_clst = n_part / allocsize;
+ fmt = FS_FAT12;
+ if (n_clst >= 0xFF5) fmt = FS_FAT16;
+ if (n_clst >= 0xFFF5) fmt = FS_FAT32;
+
+ /* Determine offset and size of FAT structure */
+ switch (fmt) {
+ case FS_FAT12:
+ n_fat = ((n_clst * 3 + 1) / 2 + 3 + SS(fs) - 1) / SS(fs);
+ n_rsv = 1 + partition;
+ n_dir = N_ROOTDIR * 32 / SS(fs);
+ break;
+ case FS_FAT16:
+ n_fat = ((n_clst * 2) + 4 + SS(fs) - 1) / SS(fs);
+ n_rsv = 1 + partition;
+ n_dir = N_ROOTDIR * 32 / SS(fs);
+ break;
+ default:
+ n_fat = ((n_clst * 4) + 8 + SS(fs) - 1) / SS(fs);
+ n_rsv = 33 - partition;
+ n_dir = 0;
+ }
+ b_fat = b_part + n_rsv; /* FATs start sector */
+ b_dir = b_fat + n_fat * N_FATS; /* Directory start sector */
+ b_data = b_dir + n_dir; /* Data start sector */
+
+ /* Align data start sector to erase block boundary (for flash memory media) */
+ if (disk_ioctl(drv, GET_BLOCK_SIZE, &n) != RES_OK) return FR_MKFS_ABORTED;
+ n = (b_data + n - 1) & ~(n - 1);
+ n_fat += (n - b_data) / N_FATS;
+ /* b_dir and b_data are no longer used below */
+
+ /* Determine number of cluster and final check of validity of the FAT type */
+ n_clst = (n_part - n_rsv - n_fat * N_FATS - n_dir) / allocsize;
+ if ( (fmt == FS_FAT16 && n_clst < 0xFF5)
+ || (fmt == FS_FAT32 && n_clst < 0xFFF5))
+ return FR_MKFS_ABORTED;
+
+ /* Create partition table if needed */
+ if (!partition) {
+ DWORD n_disk = b_part + n_part;
+
+ mem_set(fs->win, 0, SS(fs));
+ tbl = fs->win+MBR_Table;
+ ST_DWORD(tbl, 0x00010180); /* Partition start in CHS */
+ if (n_disk < 63UL * 255 * 1024) { /* Partition end in CHS */
+ n_disk = n_disk / 63 / 255;
+ tbl[7] = (BYTE)n_disk;
+ tbl[6] = (BYTE)((n_disk >> 2) | 63);
+ } else {
+ ST_WORD(&tbl[6], 0xFFFF);
+ }
+ tbl[5] = 254;
+ if (fmt != FS_FAT32) /* System ID */
+ tbl[4] = (n_part < 0x10000) ? 0x04 : 0x06;
+ else
+ tbl[4] = 0x0c;
+ ST_DWORD(tbl+8, 63); /* Partition start in LBA */
+ ST_DWORD(tbl+12, n_part); /* Partition size in LBA */
+ ST_WORD(tbl+64, 0xAA55); /* Signature */
+ if (disk_write(drv, fs->win, 0, 1) != RES_OK)
+ return FR_DISK_ERR;
+ partition = 0xF8;
+ } else {
+ partition = 0xF0;
+ }
+
+ /* Create boot record */
+ tbl = fs->win; /* Clear buffer */
+ mem_set(tbl, 0, SS(fs));
+ ST_DWORD(tbl+BS_jmpBoot, 0x90FEEB); /* Boot code (jmp $, nop) */
+ ST_WORD(tbl+BPB_BytsPerSec, SS(fs)); /* Sector size */
+ tbl[BPB_SecPerClus] = (BYTE)allocsize; /* Sectors per cluster */
+ ST_WORD(tbl+BPB_RsvdSecCnt, n_rsv); /* Reserved sectors */
+ tbl[BPB_NumFATs] = N_FATS; /* Number of FATs */
+ ST_WORD(tbl+BPB_RootEntCnt, SS(fs) / 32 * n_dir); /* Number of rootdir entries */
+ if (n_part < 0x10000) { /* Number of total sectors */
+ ST_WORD(tbl+BPB_TotSec16, n_part);
+ } else {
+ ST_DWORD(tbl+BPB_TotSec32, n_part);
+ }
+ tbl[BPB_Media] = partition; /* Media descripter */
+ ST_WORD(tbl+BPB_SecPerTrk, 63); /* Number of sectors per track */
+ ST_WORD(tbl+BPB_NumHeads, 255); /* Number of heads */
+ ST_DWORD(tbl+BPB_HiddSec, b_part); /* Hidden sectors */
+ n = get_fattime(); /* Use current time as a VSN */
+ if (fmt != FS_FAT32) {
+ ST_DWORD(tbl+BS_VolID, n); /* Volume serial number */
+ ST_WORD(tbl+BPB_FATSz16, n_fat); /* Number of secters per FAT */
+ tbl[BS_DrvNum] = 0x80; /* Drive number */
+ tbl[BS_BootSig] = 0x29; /* Extended boot signature */
+ mem_cpy(tbl+BS_VolLab, "NO NAME FAT ", 19); /* Volume lavel, FAT signature */
+ } else {
+ ST_DWORD(tbl+BS_VolID32, n); /* Volume serial number */
+ ST_DWORD(tbl+BPB_FATSz32, n_fat); /* Number of secters per FAT */
+ ST_DWORD(tbl+BPB_RootClus, 2); /* Root directory cluster (2) */
+ ST_WORD(tbl+BPB_FSInfo, 1); /* FSInfo record offset (bs+1) */
+ ST_WORD(tbl+BPB_BkBootSec, 6); /* Backup boot record offset (bs+6) */
+ tbl[BS_DrvNum32] = 0x80; /* Drive number */
+ tbl[BS_BootSig32] = 0x29; /* Extended boot signature */
+ mem_cpy(tbl+BS_VolLab32, "NO NAME FAT32 ", 19); /* Volume lavel, FAT signature */
+ }
+ ST_WORD(tbl+BS_55AA, 0xAA55); /* Signature */
+ if (SS(fs) > 512U) {
+ ST_WORD(tbl+SS(fs)-2, 0xAA55);
+ }
+ if (disk_write(drv, tbl, b_part+0, 1) != RES_OK)
+ return FR_DISK_ERR;
+ if (fmt == FS_FAT32)
+ disk_write(drv, tbl, b_part+6, 1);
+
+ /* Initialize FAT area */
+ for (m = 0; m < N_FATS; m++) {
+ mem_set(tbl, 0, SS(fs)); /* 1st sector of the FAT */
+ if (fmt != FS_FAT32) {
+ n = (fmt == FS_FAT12) ? 0x00FFFF00 : 0xFFFFFF00;
+ n |= partition;
+ ST_DWORD(tbl, n); /* Reserve cluster #0-1 (FAT12/16) */
+ } else {
+ ST_DWORD(tbl+0, 0xFFFFFFF8); /* Reserve cluster #0-1 (FAT32) */
+ ST_DWORD(tbl+4, 0xFFFFFFFF);
+ ST_DWORD(tbl+8, 0x0FFFFFFF); /* Reserve cluster #2 for root dir */
+ }
+ if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
+ return FR_DISK_ERR;
+ mem_set(tbl, 0, SS(fs)); /* Following FAT entries are filled by zero */
+ for (n = 1; n < n_fat; n++) {
+ if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
+ return FR_DISK_ERR;
+ }
+ }
+
+ /* Initialize Root directory */
+ m = (BYTE)((fmt == FS_FAT32) ? allocsize : n_dir);
+ do {
+ if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)
+ return FR_DISK_ERR;
+ } while (--m);
+
+ /* Create FSInfo record if needed */
+ if (fmt == FS_FAT32) {
+ ST_WORD(tbl+BS_55AA, 0xAA55);
+ ST_DWORD(tbl+FSI_LeadSig, 0x41615252);
+ ST_DWORD(tbl+FSI_StrucSig, 0x61417272);
+ ST_DWORD(tbl+FSI_Free_Count, n_clst - 1);
+ ST_DWORD(tbl+FSI_Nxt_Free, 0xFFFFFFFF);
+ disk_write(drv, tbl, b_part+1, 1);
+ disk_write(drv, tbl, b_part+7, 1);
+ }
+
+ return (disk_ioctl(drv, CTRL_SYNC, (void*)NULL) == RES_OK) ? FR_OK : FR_DISK_ERR;
+}
+
+#endif /* _USE_MKFS && !_FS_READONLY */
+
+
+
+
+#if _USE_STRFUNC
+/*-----------------------------------------------------------------------*/
+/* Get a string from the file */
+/*-----------------------------------------------------------------------*/
+char* f_gets (
+ char* buff, /* Pointer to the string buffer to read */
+ int len, /* Size of string buffer */
+ FIL* fil /* Pointer to the file object */
+)
+{
+ int i = 0;
+ char *p = buff;
+ UINT rc;
+
+
+ while (i < len - 1) { /* Read bytes until buffer gets filled */
+ f_read(fil, p, 1, &rc);
+ if (rc != 1) break; /* Break when no data to read */
+#if _USE_STRFUNC >= 2
+ if (*p == '\r') continue; /* Strip '\r' */
+#endif
+ i++;
+ if (*p++ == '\n') break; /* Break when reached end of line */
+ }
+ *p = 0;
+ return i ? buff : NULL; /* When no data read (eof or error), return with error. */
+}
+
+
+
+#if !_FS_READONLY
+#include <stdarg.h>
+/*-----------------------------------------------------------------------*/
+/* Put a character to the file */
+/*-----------------------------------------------------------------------*/
+int f_putc (
+ int chr, /* A character to be output */
+ FIL* fil /* Ponter to the file object */
+)
+{
+ UINT bw;
+ char c;
+
+
+#if _USE_STRFUNC >= 2
+ if (chr == '\n') f_putc ('\r', fil); /* LF -> CRLF conversion */
+#endif
+ if (!fil) { /* Special value may be used to switch the destination to any other device */
+ /* put_console(chr); */
+ return chr;
+ }
+ c = (char)chr;
+ f_write(fil, &c, 1, &bw); /* Write a byte to the file */
+ return bw ? chr : EOF; /* Return the result */
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Put a string to the file */
+/*-----------------------------------------------------------------------*/
+int f_puts (
+ const char* str, /* Pointer to the string to be output */
+ FIL* fil /* Pointer to the file object */
+)
+{
+ int n;
+
+
+ for (n = 0; *str; str++, n++) {
+ if (f_putc(*str, fil) == EOF) return EOF;
+ }
+ return n;
+}
+
+
+
+
+/*-----------------------------------------------------------------------*/
+/* Put a formatted string to the file */
+/*-----------------------------------------------------------------------*/
+int f_printf (
+ FIL* fil, /* Pointer to the file object */
+ const char* str, /* Pointer to the format string */
+ ... /* Optional arguments... */
+)
+{
+ va_list arp;
+ UCHAR c, f, r;
+ ULONG val;
+ char s[16];
+ int i, w, res, cc;
+
+
+ va_start(arp, str);
+
+ for (cc = res = 0; cc != EOF; res += cc) {
+ c = *str++;
+ if (c == 0) break; /* End of string */
+ if (c != '%') { /* Non escape cahracter */
+ cc = f_putc(c, fil);
+ if (cc != EOF) cc = 1;
+ continue;
+ }
+ w = f = 0;
+ c = *str++;
+ if (c == '0') { /* Flag: '0' padding */
+ f = 1; c = *str++;
+ }
+ while (c >= '0' && c <= '9') { /* Precision */
+ w = w * 10 + (c - '0');
+ c = *str++;
+ }
+ if (c == 'l') { /* Prefix: Size is long int */
+ f |= 2; c = *str++;
+ }
+ if (c == 's') { /* Type is string */
+ cc = f_puts(va_arg(arp, char*), fil);
+ continue;
+ }
+ if (c == 'c') { /* Type is character */
+ cc = f_putc(va_arg(arp, int), fil);
+ if (cc != EOF) cc = 1;
+ continue;
+ }
+ r = 0;
+ if (c == 'd') r = 10; /* Type is signed decimal */
+ if (c == 'u') r = 10; /* Type is unsigned decimal */
+ if (c == 'X') r = 16; /* Type is unsigned hexdecimal */
+ if (r == 0) break; /* Unknown type */
+ if (f & 2) { /* Get the value */
+ val = (ULONG)va_arg(arp, long);
+ } else {
+ val = (c == 'd') ? (ULONG)(long)va_arg(arp, int) : (ULONG)va_arg(arp, unsigned int);
+ }
+ /* Put numeral string */
+ if (c == 'd') {
+ if (val & 0x80000000) {
+ val = 0 - val;
+ f |= 4;
+ }
+ }
+ i = sizeof(s) - 1; s[i] = 0;
+ do {
+ c = (UCHAR)(val % r + '0');
+ if (c > '9') c += 7;
+ s[--i] = c;
+ val /= r;
+ } while (i && val);
+ if (i && (f & 4)) s[--i] = '-';
+ w = sizeof(s) - 1 - w;
+ while (i && i > w) s[--i] = (f & 1) ? '0' : ' ';
+ cc = f_puts(&s[i], fil);
+ }
+
+ va_end(arp);
+ return (cc == EOF) ? cc : res;
+}
+
+#endif /* !_FS_READONLY */
+#endif /* _USE_STRFUNC */
diff --git a/Projects/Webserver/Lib/FATFs/ff.h b/Projects/Webserver/Lib/FATFs/ff.h
index 41e136ee5..69bfd3109 100644
--- a/Projects/Webserver/Lib/FATFs/ff.h
+++ b/Projects/Webserver/Lib/FATFs/ff.h
@@ -1,596 +1,596 @@
-/*---------------------------------------------------------------------------/
-/ FatFs - FAT file system module include file R0.07e (C)ChaN, 2010
-/----------------------------------------------------------------------------/
-/ FatFs module is a generic FAT file system module for small embedded systems.
-/ This is a free software that opened for education, research and commercial
-/ developments under license policy of following trems.
-/
-/ Copyright (C) 2010, ChaN, all right reserved.
-/
-/ * The FatFs module is a free software and there is NO WARRANTY.
-/ * No restriction on use. You can use, modify and redistribute it for
-/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
-/ * Redistributions of source code must retain the above copyright notice.
-/----------------------------------------------------------------------------*/
-
-#ifndef _FATFS
-#define _FATFS 0x007E
-
-#include "integer.h" /* Basic integer types */
-#include "ffconf.h" /* FatFs configuration options */
-
-#if _FATFS != _FFCONFIG
-#error Wrong configuration file (ffconf.h).
-#endif
-
-
-/* DBCS code ranges and SBCS extend char conversion table */
-
-#if _CODE_PAGE == 932 /* Japanese Shift-JIS */
-#define _DF1S 0x81 /* DBC 1st byte range 1 start */
-#define _DF1E 0x9F /* DBC 1st byte range 1 end */
-#define _DF2S 0xE0 /* DBC 1st byte range 2 start */
-#define _DF2E 0xFC /* DBC 1st byte range 2 end */
-#define _DS1S 0x40 /* DBC 2nd byte range 1 start */
-#define _DS1E 0x7E /* DBC 2nd byte range 1 end */
-#define _DS2S 0x80 /* DBC 2nd byte range 2 start */
-#define _DS2E 0xFC /* DBC 2nd byte range 2 end */
-
-#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
-#define _DF1S 0x81
-#define _DF1E 0xFE
-#define _DS1S 0x40
-#define _DS1E 0x7E
-#define _DS2S 0x80
-#define _DS2E 0xFE
-
-#elif _CODE_PAGE == 949 /* Korean */
-#define _DF1S 0x81
-#define _DF1E 0xFE
-#define _DS1S 0x41
-#define _DS1E 0x5A
-#define _DS2S 0x61
-#define _DS2E 0x7A
-#define _DS3S 0x81
-#define _DS3E 0xFE
-
-#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
-#define _DF1S 0x81
-#define _DF1E 0xFE
-#define _DS1S 0x40
-#define _DS1E 0x7E
-#define _DS2S 0xA1
-#define _DS2E 0xFE
-
-#elif _CODE_PAGE == 437 /* U.S. (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 720 /* Arabic (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 737 /* Greek (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
- 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 775 /* Baltic (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
- 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 852 /* Latin 2 (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \
- 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
-
-#elif _CODE_PAGE == 855 /* Cyrillic (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \
- 0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \
- 0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 857 /* Turkish (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \
- 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
- 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 862 /* Hebrew (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 866 /* Russian (OEM) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
-
-#elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
- 0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
-
-#elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
-
-#elif _CODE_PAGE == 1253 /* Greek (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \
- 0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}
-
-#elif _CODE_PAGE == 1254 /* Turkish (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
-
-#elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 1256 /* Arabic (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}
-
-#elif _CODE_PAGE == 1257 /* Baltic (Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
-
-#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
-#define _DF1S 0
-#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \
- 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}
-
-#elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */
-#define _DF1S 0
-
-#else
-#error Unknown code page
-
-#endif
-
-
-
-/* Character code support macros */
-
-#define IsUpper(c) (((c)>='A')&&((c)<='Z'))
-#define IsLower(c) (((c)>='a')&&((c)<='z'))
-
-#if _DF1S /* DBCS configuration */
-
-#ifdef _DF2S /* Two 1st byte areas */
-#define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
-#else /* One 1st byte area */
-#define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
-#endif
-
-#ifdef _DS3S /* Three 2nd byte areas */
-#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
-#else /* Two 2nd byte areas */
-#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
-#endif
-
-#else /* SBCS configuration */
-
-#define IsDBCS1(c) 0
-#define IsDBCS2(c) 0
-
-#endif /* _DF1S */
-
-
-
-/* Definitions corresponds to multi partition */
-
-#if _MULTI_PARTITION /* Multiple partition configuration */
-
-typedef struct _PARTITION {
- BYTE pd; /* Physical drive# */
- BYTE pt; /* Partition # (0-3) */
-} PARTITION;
-
-extern
-const PARTITION Drives[]; /* Logical drive# to physical location conversion table */
-#define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
-#define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
-
-#else /* Single partition configuration */
-
-#define LD2PD(drv) (drv) /* Physical drive# is equal to the logical drive# */
-#define LD2PT(drv) 0 /* Always mounts the 1st partition */
-
-#endif
-
-
-
-/* Definitions corresponds to multiple sector size */
-
-#if _MAX_SS == 512 /* Single sector size */
-#define SS(fs) 512U
-
-#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */
-#define SS(fs) ((fs)->s_size)
-
-#else
-#error Sector size must be 512, 1024, 2048 or 4096.
-
-#endif
-
-
-
-/* Type of file name on FatFs API */
-
-#if _LFN_UNICODE && _USE_LFN
-typedef WCHAR XCHAR; /* Unicode */
-#else
-typedef char XCHAR; /* SBCS, DBCS */
-#endif
-
-
-
-/* File system object structure */
-
-typedef struct _FATFS_ {
- BYTE fs_type; /* FAT sub type */
- BYTE drive; /* Physical drive number */
- BYTE csize; /* Number of sectors per cluster */
- BYTE n_fats; /* Number of FAT copies */
- BYTE wflag; /* win[] dirty flag (1:must be written back) */
- BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
- WORD id; /* File system mount ID */
- WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
-#if _FS_REENTRANT
- _SYNC_t sobj; /* Identifier of sync object */
-#endif
-#if _MAX_SS != 512
- WORD s_size; /* Sector size */
-#endif
-#if !_FS_READONLY
- DWORD last_clust; /* Last allocated cluster */
- DWORD free_clust; /* Number of free clusters */
- DWORD fsi_sector; /* fsinfo sector */
-#endif
-#if _FS_RPATH
- DWORD cdir; /* Current directory (0:root)*/
-#endif
- DWORD sects_fat; /* Sectors per fat */
- DWORD max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
- DWORD fatbase; /* FAT start sector */
- DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
- DWORD database; /* Data start sector */
- DWORD winsect; /* Current sector appearing in the win[] */
- BYTE win[_MAX_SS];/* Disk access window for Directory/FAT */
-} FATFS;
-
-
-
-/* Directory object structure */
-
-typedef struct _DIR_ {
- FATFS* fs; /* Pointer to the owner file system object */
- WORD id; /* Owner file system mount ID */
- WORD index; /* Current read/write index number */
- DWORD sclust; /* Table start cluster (0:Static table) */
- DWORD clust; /* Current cluster */
- DWORD sect; /* Current sector */
- BYTE* dir; /* Pointer to the current SFN entry in the win[] */
- BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
-#if _USE_LFN
- WCHAR* lfn; /* Pointer to the LFN working buffer */
- WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
-#endif
-} DIR;
-
-
-
-/* File object structure */
-
-typedef struct _FIL_ {
- FATFS* fs; /* Pointer to the owner file system object */
- WORD id; /* Owner file system mount ID */
- BYTE flag; /* File status flags */
- BYTE csect; /* Sector address in the cluster */
- DWORD fptr; /* File R/W pointer */
- DWORD fsize; /* File size */
- DWORD org_clust; /* File start cluster */
- DWORD curr_clust; /* Current cluster */
- DWORD dsect; /* Current data sector */
-#if !_FS_READONLY
- DWORD dir_sect; /* Sector containing the directory entry */
- BYTE* dir_ptr; /* Ponter to the directory entry in the window */
-#endif
-#if !_FS_TINY
- BYTE buf[_MAX_SS];/* File R/W buffer */
-#endif
-} FIL;
-
-
-
-/* File status structure */
-
-typedef struct _FILINFO_ {
- DWORD fsize; /* File size */
- WORD fdate; /* Last modified date */
- WORD ftime; /* Last modified time */
- BYTE fattrib; /* Attribute */
- char fname[13]; /* Short file name (8.3 format) */
-#if _USE_LFN
- XCHAR* lfname; /* Pointer to the LFN buffer */
- int lfsize; /* Size of LFN buffer [chrs] */
-#endif
-} FILINFO;
-
-
-
-/* File function return code (FRESULT) */
-
-typedef enum {
- FR_OK = 0, /* 0 */
- FR_DISK_ERR, /* 1 */
- FR_INT_ERR, /* 2 */
- FR_NOT_READY, /* 3 */
- FR_NO_FILE, /* 4 */
- FR_NO_PATH, /* 5 */
- FR_INVALID_NAME, /* 6 */
- FR_DENIED, /* 7 */
- FR_EXIST, /* 8 */
- FR_INVALID_OBJECT, /* 9 */
- FR_WRITE_PROTECTED, /* 10 */
- FR_INVALID_DRIVE, /* 11 */
- FR_NOT_ENABLED, /* 12 */
- FR_NO_FILESYSTEM, /* 13 */
- FR_MKFS_ABORTED, /* 14 */
- FR_TIMEOUT /* 15 */
-} FRESULT;
-
-
-
-/*--------------------------------------------------------------*/
-/* FatFs module application interface */
-
-FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
-FRESULT f_open (FIL*, const XCHAR*, BYTE); /* Open or create a file */
-FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
-FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
-FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
-FRESULT f_close (FIL*); /* Close an open file object */
-FRESULT f_opendir (DIR*, const XCHAR*); /* Open an existing directory */
-FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
-FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */
-FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
-FRESULT f_truncate (FIL*); /* Truncate file */
-FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
-FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */
-FRESULT f_mkdir (const XCHAR*); /* Create a new directory */
-FRESULT f_chmod (const XCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
-FRESULT f_utime (const XCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
-FRESULT f_rename (const XCHAR*, const XCHAR*); /* Rename/Move a file or directory */
-FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
-FRESULT f_mkfs (BYTE, BYTE, WORD); /* Create a file system on the drive */
-FRESULT f_chdir (const XCHAR*); /* Change current directory */
-FRESULT f_chdrive (BYTE); /* Change current drive */
-
-#if _USE_STRFUNC
-int f_putc (int, FIL*); /* Put a character to the file */
-int f_puts (const char*, FIL*); /* Put a string to the file */
-int f_printf (FIL*, const char*, ...); /* Put a formatted string to the file */
-char* f_gets (char*, int, FIL*); /* Get a string from the file */
-#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
-#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
-#ifndef EOF
-#define EOF -1
-#endif
-#endif
-
-
-
-/*--------------------------------------------------------------*/
-/* User defined functions */
-
-/* Real time clock */
-#if !_FS_READONLY
-DWORD get_fattime (void); /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
- /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
-#endif
-
-/* Unicode - OEM code conversion */
-#if _USE_LFN
-WCHAR ff_convert (WCHAR, UINT);
-WCHAR ff_wtoupper (WCHAR);
-#endif
-
-/* Sync functions */
-#if _FS_REENTRANT
-BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
-BOOL ff_del_syncobj(_SYNC_t);
-BOOL ff_req_grant(_SYNC_t);
-void ff_rel_grant(_SYNC_t);
-#endif
-
-
-
-/*--------------------------------------------------------------*/
-/* Flags and offset address */
-
-
-/* File access control and file status flags (FIL.flag) */
-
-#define FA_READ 0x01
-#define FA_OPEN_EXISTING 0x00
-#if _FS_READONLY == 0
-#define FA_WRITE 0x02
-#define FA_CREATE_NEW 0x04
-#define FA_CREATE_ALWAYS 0x08
-#define FA_OPEN_ALWAYS 0x10
-#define FA__WRITTEN 0x20
-#define FA__DIRTY 0x40
-#endif
-#define FA__ERROR 0x80
-
-
-/* FAT sub type (FATFS.fs_type) */
-
-#define FS_FAT12 1
-#define FS_FAT16 2
-#define FS_FAT32 3
-
-
-/* File attribute bits for directory entry */
-
-#define AM_RDO 0x01 /* Read only */
-#define AM_HID 0x02 /* Hidden */
-#define AM_SYS 0x04 /* System */
-#define AM_VOL 0x08 /* Volume label */
-#define AM_LFN 0x0F /* LFN entry */
-#define AM_DIR 0x10 /* Directory */
-#define AM_ARC 0x20 /* Archive */
-#define AM_MASK 0x3F /* Mask of defined bits */
-
-
-/* FatFs refers the members in the FAT structures with byte offset instead
-/ of structure member because there are incompatibility of the packing option
-/ between various compilers. */
-
-#define BS_jmpBoot 0
-#define BS_OEMName 3
-#define BPB_BytsPerSec 11
-#define BPB_SecPerClus 13
-#define BPB_RsvdSecCnt 14
-#define BPB_NumFATs 16
-#define BPB_RootEntCnt 17
-#define BPB_TotSec16 19
-#define BPB_Media 21
-#define BPB_FATSz16 22
-#define BPB_SecPerTrk 24
-#define BPB_NumHeads 26
-#define BPB_HiddSec 28
-#define BPB_TotSec32 32
-#define BS_55AA 510
-
-#define BS_DrvNum 36
-#define BS_BootSig 38
-#define BS_VolID 39
-#define BS_VolLab 43
-#define BS_FilSysType 54
-
-#define BPB_FATSz32 36
-#define BPB_ExtFlags 40
-#define BPB_FSVer 42
-#define BPB_RootClus 44
-#define BPB_FSInfo 48
-#define BPB_BkBootSec 50
-#define BS_DrvNum32 64
-#define BS_BootSig32 66
-#define BS_VolID32 67
-#define BS_VolLab32 71
-#define BS_FilSysType32 82
-
-#define FSI_LeadSig 0
-#define FSI_StrucSig 484
-#define FSI_Free_Count 488
-#define FSI_Nxt_Free 492
-
-#define MBR_Table 446
-
-#define DIR_Name 0
-#define DIR_Attr 11
-#define DIR_NTres 12
-#define DIR_CrtTime 14
-#define DIR_CrtDate 16
-#define DIR_FstClusHI 20
-#define DIR_WrtTime 22
-#define DIR_WrtDate 24
-#define DIR_FstClusLO 26
-#define DIR_FileSize 28
-#define LDIR_Ord 0
-#define LDIR_Attr 11
-#define LDIR_Type 12
-#define LDIR_Chksum 13
-#define LDIR_FstClusLO 26
-
-
-
-/*--------------------------------*/
-/* Multi-byte word access macros */
-
-#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
-#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
-#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
-#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
-#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
-#else /* Use byte-by-byte access to the FAT structure */
-#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
-#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
-#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
-#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
-#endif
-
-
-#endif /* _FATFS */
+/*---------------------------------------------------------------------------/
+/ FatFs - FAT file system module include file R0.07e (C)ChaN, 2010
+/----------------------------------------------------------------------------/
+/ FatFs module is a generic FAT file system module for small embedded systems.
+/ This is a free software that opened for education, research and commercial
+/ developments under license policy of following trems.
+/
+/ Copyright (C) 2010, ChaN, all right reserved.
+/
+/ * The FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/----------------------------------------------------------------------------*/
+
+#ifndef _FATFS
+#define _FATFS 0x007E
+
+#include "integer.h" /* Basic integer types */
+#include "ffconf.h" /* FatFs configuration options */
+
+#if _FATFS != _FFCONFIG
+#error Wrong configuration file (ffconf.h).
+#endif
+
+
+/* DBCS code ranges and SBCS extend char conversion table */
+
+#if _CODE_PAGE == 932 /* Japanese Shift-JIS */
+#define _DF1S 0x81 /* DBC 1st byte range 1 start */
+#define _DF1E 0x9F /* DBC 1st byte range 1 end */
+#define _DF2S 0xE0 /* DBC 1st byte range 2 start */
+#define _DF2E 0xFC /* DBC 1st byte range 2 end */
+#define _DS1S 0x40 /* DBC 2nd byte range 1 start */
+#define _DS1E 0x7E /* DBC 2nd byte range 1 end */
+#define _DS2S 0x80 /* DBC 2nd byte range 2 start */
+#define _DS2E 0xFC /* DBC 2nd byte range 2 end */
+
+#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
+#define _DF1S 0x81
+#define _DF1E 0xFE
+#define _DS1S 0x40
+#define _DS1E 0x7E
+#define _DS2S 0x80
+#define _DS2E 0xFE
+
+#elif _CODE_PAGE == 949 /* Korean */
+#define _DF1S 0x81
+#define _DF1E 0xFE
+#define _DS1S 0x41
+#define _DS1E 0x5A
+#define _DS2S 0x61
+#define _DS2E 0x7A
+#define _DS3S 0x81
+#define _DS3E 0xFE
+
+#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
+#define _DF1S 0x81
+#define _DF1E 0xFE
+#define _DS1S 0x40
+#define _DS1E 0x7E
+#define _DS2S 0xA1
+#define _DS2E 0xFE
+
+#elif _CODE_PAGE == 437 /* U.S. (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 720 /* Arabic (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 737 /* Greek (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
+ 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 775 /* Baltic (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
+ 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 852 /* Latin 2 (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \
+ 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
+
+#elif _CODE_PAGE == 855 /* Cyrillic (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \
+ 0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \
+ 0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 857 /* Turkish (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \
+ 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
+ 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 862 /* Hebrew (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 866 /* Russian (OEM) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
+
+#elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
+ 0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
+
+#elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
+
+#elif _CODE_PAGE == 1253 /* Greek (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \
+ 0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}
+
+#elif _CODE_PAGE == 1254 /* Turkish (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
+
+#elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 1256 /* Arabic (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}
+
+#elif _CODE_PAGE == 1257 /* Baltic (Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
+ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
+
+#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
+#define _DF1S 0
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \
+ 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}
+
+#elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */
+#define _DF1S 0
+
+#else
+#error Unknown code page
+
+#endif
+
+
+
+/* Character code support macros */
+
+#define IsUpper(c) (((c)>='A')&&((c)<='Z'))
+#define IsLower(c) (((c)>='a')&&((c)<='z'))
+
+#if _DF1S /* DBCS configuration */
+
+#ifdef _DF2S /* Two 1st byte areas */
+#define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
+#else /* One 1st byte area */
+#define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
+#endif
+
+#ifdef _DS3S /* Three 2nd byte areas */
+#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
+#else /* Two 2nd byte areas */
+#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
+#endif
+
+#else /* SBCS configuration */
+
+#define IsDBCS1(c) 0
+#define IsDBCS2(c) 0
+
+#endif /* _DF1S */
+
+
+
+/* Definitions corresponds to multi partition */
+
+#if _MULTI_PARTITION /* Multiple partition configuration */
+
+typedef struct _PARTITION {
+ BYTE pd; /* Physical drive# */
+ BYTE pt; /* Partition # (0-3) */
+} PARTITION;
+
+extern
+const PARTITION Drives[]; /* Logical drive# to physical location conversion table */
+#define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
+#define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
+
+#else /* Single partition configuration */
+
+#define LD2PD(drv) (drv) /* Physical drive# is equal to the logical drive# */
+#define LD2PT(drv) 0 /* Always mounts the 1st partition */
+
+#endif
+
+
+
+/* Definitions corresponds to multiple sector size */
+
+#if _MAX_SS == 512 /* Single sector size */
+#define SS(fs) 512U
+
+#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */
+#define SS(fs) ((fs)->s_size)
+
+#else
+#error Sector size must be 512, 1024, 2048 or 4096.
+
+#endif
+
+
+
+/* Type of file name on FatFs API */
+
+#if _LFN_UNICODE && _USE_LFN
+typedef WCHAR XCHAR; /* Unicode */
+#else
+typedef char XCHAR; /* SBCS, DBCS */
+#endif
+
+
+
+/* File system object structure */
+
+typedef struct _FATFS_ {
+ BYTE fs_type; /* FAT sub type */
+ BYTE drive; /* Physical drive number */
+ BYTE csize; /* Number of sectors per cluster */
+ BYTE n_fats; /* Number of FAT copies */
+ BYTE wflag; /* win[] dirty flag (1:must be written back) */
+ BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
+ WORD id; /* File system mount ID */
+ WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
+#if _FS_REENTRANT
+ _SYNC_t sobj; /* Identifier of sync object */
+#endif
+#if _MAX_SS != 512
+ WORD s_size; /* Sector size */
+#endif
+#if !_FS_READONLY
+ DWORD last_clust; /* Last allocated cluster */
+ DWORD free_clust; /* Number of free clusters */
+ DWORD fsi_sector; /* fsinfo sector */
+#endif
+#if _FS_RPATH
+ DWORD cdir; /* Current directory (0:root)*/
+#endif
+ DWORD sects_fat; /* Sectors per fat */
+ DWORD max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
+ DWORD fatbase; /* FAT start sector */
+ DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
+ DWORD database; /* Data start sector */
+ DWORD winsect; /* Current sector appearing in the win[] */
+ BYTE win[_MAX_SS];/* Disk access window for Directory/FAT */
+} FATFS;
+
+
+
+/* Directory object structure */
+
+typedef struct _DIR_ {
+ FATFS* fs; /* Pointer to the owner file system object */
+ WORD id; /* Owner file system mount ID */
+ WORD index; /* Current read/write index number */
+ DWORD sclust; /* Table start cluster (0:Static table) */
+ DWORD clust; /* Current cluster */
+ DWORD sect; /* Current sector */
+ BYTE* dir; /* Pointer to the current SFN entry in the win[] */
+ BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
+#if _USE_LFN
+ WCHAR* lfn; /* Pointer to the LFN working buffer */
+ WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
+#endif
+} DIR;
+
+
+
+/* File object structure */
+
+typedef struct _FIL_ {
+ FATFS* fs; /* Pointer to the owner file system object */
+ WORD id; /* Owner file system mount ID */
+ BYTE flag; /* File status flags */
+ BYTE csect; /* Sector address in the cluster */
+ DWORD fptr; /* File R/W pointer */
+ DWORD fsize; /* File size */
+ DWORD org_clust; /* File start cluster */
+ DWORD curr_clust; /* Current cluster */
+ DWORD dsect; /* Current data sector */
+#if !_FS_READONLY
+ DWORD dir_sect; /* Sector containing the directory entry */
+ BYTE* dir_ptr; /* Ponter to the directory entry in the window */
+#endif
+#if !_FS_TINY
+ BYTE buf[_MAX_SS];/* File R/W buffer */
+#endif
+} FIL;
+
+
+
+/* File status structure */
+
+typedef struct _FILINFO_ {
+ DWORD fsize; /* File size */
+ WORD fdate; /* Last modified date */
+ WORD ftime; /* Last modified time */
+ BYTE fattrib; /* Attribute */
+ char fname[13]; /* Short file name (8.3 format) */
+#if _USE_LFN
+ XCHAR* lfname; /* Pointer to the LFN buffer */
+ int lfsize; /* Size of LFN buffer [chrs] */
+#endif
+} FILINFO;
+
+
+
+/* File function return code (FRESULT) */
+
+typedef enum {
+ FR_OK = 0, /* 0 */
+ FR_DISK_ERR, /* 1 */
+ FR_INT_ERR, /* 2 */
+ FR_NOT_READY, /* 3 */
+ FR_NO_FILE, /* 4 */
+ FR_NO_PATH, /* 5 */
+ FR_INVALID_NAME, /* 6 */
+ FR_DENIED, /* 7 */
+ FR_EXIST, /* 8 */
+ FR_INVALID_OBJECT, /* 9 */
+ FR_WRITE_PROTECTED, /* 10 */
+ FR_INVALID_DRIVE, /* 11 */
+ FR_NOT_ENABLED, /* 12 */
+ FR_NO_FILESYSTEM, /* 13 */
+ FR_MKFS_ABORTED, /* 14 */
+ FR_TIMEOUT /* 15 */
+} FRESULT;
+
+
+
+/*--------------------------------------------------------------*/
+/* FatFs module application interface */
+
+FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
+FRESULT f_open (FIL*, const XCHAR*, BYTE); /* Open or create a file */
+FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
+FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
+FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
+FRESULT f_close (FIL*); /* Close an open file object */
+FRESULT f_opendir (DIR*, const XCHAR*); /* Open an existing directory */
+FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
+FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */
+FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
+FRESULT f_truncate (FIL*); /* Truncate file */
+FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
+FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */
+FRESULT f_mkdir (const XCHAR*); /* Create a new directory */
+FRESULT f_chmod (const XCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
+FRESULT f_utime (const XCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
+FRESULT f_rename (const XCHAR*, const XCHAR*); /* Rename/Move a file or directory */
+FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
+FRESULT f_mkfs (BYTE, BYTE, WORD); /* Create a file system on the drive */
+FRESULT f_chdir (const XCHAR*); /* Change current directory */
+FRESULT f_chdrive (BYTE); /* Change current drive */
+
+#if _USE_STRFUNC
+int f_putc (int, FIL*); /* Put a character to the file */
+int f_puts (const char*, FIL*); /* Put a string to the file */
+int f_printf (FIL*, const char*, ...); /* Put a formatted string to the file */
+char* f_gets (char*, int, FIL*); /* Get a string from the file */
+#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
+#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
+#ifndef EOF
+#define EOF -1
+#endif
+#endif
+
+
+
+/*--------------------------------------------------------------*/
+/* User defined functions */
+
+/* Real time clock */
+#if !_FS_READONLY
+DWORD get_fattime (void); /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
+ /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
+#endif
+
+/* Unicode - OEM code conversion */
+#if _USE_LFN
+WCHAR ff_convert (WCHAR, UINT);
+WCHAR ff_wtoupper (WCHAR);
+#endif
+
+/* Sync functions */
+#if _FS_REENTRANT
+BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
+BOOL ff_del_syncobj(_SYNC_t);
+BOOL ff_req_grant(_SYNC_t);
+void ff_rel_grant(_SYNC_t);
+#endif
+
+
+
+/*--------------------------------------------------------------*/
+/* Flags and offset address */
+
+
+/* File access control and file status flags (FIL.flag) */
+
+#define FA_READ 0x01
+#define FA_OPEN_EXISTING 0x00
+#if _FS_READONLY == 0
+#define FA_WRITE 0x02
+#define FA_CREATE_NEW 0x04
+#define FA_CREATE_ALWAYS 0x08
+#define FA_OPEN_ALWAYS 0x10
+#define FA__WRITTEN 0x20
+#define FA__DIRTY 0x40
+#endif
+#define FA__ERROR 0x80
+
+
+/* FAT sub type (FATFS.fs_type) */
+
+#define FS_FAT12 1
+#define FS_FAT16 2
+#define FS_FAT32 3
+
+
+/* File attribute bits for directory entry */
+
+#define AM_RDO 0x01 /* Read only */
+#define AM_HID 0x02 /* Hidden */
+#define AM_SYS 0x04 /* System */
+#define AM_VOL 0x08 /* Volume label */
+#define AM_LFN 0x0F /* LFN entry */
+#define AM_DIR 0x10 /* Directory */
+#define AM_ARC 0x20 /* Archive */
+#define AM_MASK 0x3F /* Mask of defined bits */
+
+
+/* FatFs refers the members in the FAT structures with byte offset instead
+/ of structure member because there are incompatibility of the packing option
+/ between various compilers. */
+
+#define BS_jmpBoot 0
+#define BS_OEMName 3
+#define BPB_BytsPerSec 11
+#define BPB_SecPerClus 13
+#define BPB_RsvdSecCnt 14
+#define BPB_NumFATs 16
+#define BPB_RootEntCnt 17
+#define BPB_TotSec16 19
+#define BPB_Media 21
+#define BPB_FATSz16 22
+#define BPB_SecPerTrk 24
+#define BPB_NumHeads 26
+#define BPB_HiddSec 28
+#define BPB_TotSec32 32
+#define BS_55AA 510
+
+#define BS_DrvNum 36
+#define BS_BootSig 38
+#define BS_VolID 39
+#define BS_VolLab 43
+#define BS_FilSysType 54
+
+#define BPB_FATSz32 36
+#define BPB_ExtFlags 40
+#define BPB_FSVer 42
+#define BPB_RootClus 44
+#define BPB_FSInfo 48
+#define BPB_BkBootSec 50
+#define BS_DrvNum32 64
+#define BS_BootSig32 66
+#define BS_VolID32 67
+#define BS_VolLab32 71
+#define BS_FilSysType32 82
+
+#define FSI_LeadSig 0
+#define FSI_StrucSig 484
+#define FSI_Free_Count 488
+#define FSI_Nxt_Free 492
+
+#define MBR_Table 446
+
+#define DIR_Name 0
+#define DIR_Attr 11
+#define DIR_NTres 12
+#define DIR_CrtTime 14
+#define DIR_CrtDate 16
+#define DIR_FstClusHI 20
+#define DIR_WrtTime 22
+#define DIR_WrtDate 24
+#define DIR_FstClusLO 26
+#define DIR_FileSize 28
+#define LDIR_Ord 0
+#define LDIR_Attr 11
+#define LDIR_Type 12
+#define LDIR_Chksum 13
+#define LDIR_FstClusLO 26
+
+
+
+/*--------------------------------*/
+/* Multi-byte word access macros */
+
+#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
+#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
+#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
+#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
+#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
+#else /* Use byte-by-byte access to the FAT structure */
+#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
+#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
+#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
+#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
+#endif
+
+
+#endif /* _FATFS */
diff --git a/Projects/Webserver/Lib/FATFs/ffconf.h b/Projects/Webserver/Lib/FATFs/ffconf.h
index 4b19f1326..a82109469 100644
--- a/Projects/Webserver/Lib/FATFs/ffconf.h
+++ b/Projects/Webserver/Lib/FATFs/ffconf.h
@@ -1,166 +1,166 @@
-/*---------------------------------------------------------------------------/
-/ FatFs - FAT file system module configuration file R0.07e (C)ChaN, 2010
-/----------------------------------------------------------------------------/
-/
-/ CAUTION! Do not forget to make clean the project after any changes to
-/ the configuration options.
-/
-/----------------------------------------------------------------------------*/
-#ifndef _FFCONFIG
-#define _FFCONFIG 0x007E
-
-
-/*---------------------------------------------------------------------------/
-/ Function and Buffer Configurations
-/----------------------------------------------------------------------------*/
-
-#define _FS_TINY 1 /* 0 or 1 */
-/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
-/ object instead of the sector buffer in the individual file object for file
-/ data transfer. This reduces memory consumption 512 bytes each file object. */
-
-
-#define _FS_READONLY 1 /* 0 or 1 */
-/* Setting _FS_READONLY to 1 defines read only configuration. This removes
-/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
-/ f_truncate and useless f_getfree. */
-
-
-#define _FS_MINIMIZE 2 /* 0, 1, 2 or 3 */
-/* The _FS_MINIMIZE option defines minimization level to remove some functions.
-/
-/ 0: Full function.
-/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
-/ are removed.
-/ 2: f_opendir and f_readdir are removed in addition to level 1.
-/ 3: f_lseek is removed in addition to level 2. */
-
-
-#define _USE_STRFUNC 0 /* 0, 1 or 2 */
-/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
-
-
-#define _USE_MKFS 0 /* 0 or 1 */
-/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
-
-
-#define _USE_FORWARD 0 /* 0 or 1 */
-/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
-
-
-
-/*---------------------------------------------------------------------------/
-/ Locale and Namespace Configurations
-/----------------------------------------------------------------------------*/
-
-#define _CODE_PAGE 932
-/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
-/ Incorrect setting of the code page can cause a file open failure.
-/
-/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
-/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
-/ 949 - Korean (DBCS, OEM, Windows)
-/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
-/ 1250 - Central Europe (Windows)
-/ 1251 - Cyrillic (Windows)
-/ 1252 - Latin 1 (Windows)
-/ 1253 - Greek (Windows)
-/ 1254 - Turkish (Windows)
-/ 1255 - Hebrew (Windows)
-/ 1256 - Arabic (Windows)
-/ 1257 - Baltic (Windows)
-/ 1258 - Vietnam (OEM, Windows)
-/ 437 - U.S. (OEM)
-/ 720 - Arabic (OEM)
-/ 737 - Greek (OEM)
-/ 775 - Baltic (OEM)
-/ 850 - Multilingual Latin 1 (OEM)
-/ 858 - Multilingual Latin 1 + Euro (OEM)
-/ 852 - Latin 2 (OEM)
-/ 855 - Cyrillic (OEM)
-/ 866 - Russian (OEM)
-/ 857 - Turkish (OEM)
-/ 862 - Hebrew (OEM)
-/ 874 - Thai (OEM, Windows)
-/ 1 - ASCII only (Valid for non LFN cfg.)
-*/
-
-
-#define _USE_LFN 0 /* 0, 1 or 2 */
-#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
-/* The _USE_LFN option switches the LFN support.
-/
-/ 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.
-/ 1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
-/ 2: Enable LFN with dynamic working buffer on the STACK.
-/
-/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
-/ two Unicode handling functions ff_convert() and ff_wtoupper() must be added
-/ to the project. */
-
-
-#define _LFN_UNICODE 0 /* 0 or 1 */
-/* To switch the character code set on FatFs API to Unicode,
-/ enable LFN feature and set _LFN_UNICODE to 1.
-*/
-
-
-#define _FS_RPATH 0 /* 0 or 1 */
-/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,
-/ f_chdrive function are available.
-/ Note that output of the f_readdir fnction is affected by this option. */
-
-
-
-/*---------------------------------------------------------------------------/
-/ Physical Drive Configurations
-/----------------------------------------------------------------------------*/
-
-#define _DRIVES 1
-/* Number of volumes (logical drives) to be used. */
-
-
-#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
-/* Maximum sector size to be handled.
-/ Always set 512 for memory card and hard disk but a larger value may be
-/ required for floppy disk (512/1024) and optical disk (512/2048).
-/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
-/ to the disk_ioctl function. */
-
-
-#define _MULTI_PARTITION 0 /* 0 or 1 */
-/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
-/ drive number and can mount only first primaly partition. When it is set to 1,
-/ each volume is tied to the partitions listed in Drives[]. */
-
-
-
-/*---------------------------------------------------------------------------/
-/ System Configurations
-/----------------------------------------------------------------------------*/
-
-#define _WORD_ACCESS 1 /* 0 or 1 */
-/* The _WORD_ACCESS option defines which access method is used to the word
-/ data on the FAT volume.
-/
-/ 0: Byte-by-byte access. Always compatible with all platforms.
-/ 1: Word access. Do not choose this unless following condition is met.
-/
-/ When the byte order on the memory is big-endian or address miss-aligned
-/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
-/ If it is not the case, the value can also be set to 1 to improve the
-/ performance and code size. */
-
-
-#define _FS_REENTRANT 0 /* 0 or 1 */
-#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
-#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
-/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
-/
-/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
-/ 1: Enable reentrancy. Also user provided synchronization handlers,
-/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
-/ function must be added to the project. */
-
-
-#endif /* _FFCONFIG */
+/*---------------------------------------------------------------------------/
+/ FatFs - FAT file system module configuration file R0.07e (C)ChaN, 2010
+/----------------------------------------------------------------------------/
+/
+/ CAUTION! Do not forget to make clean the project after any changes to
+/ the configuration options.
+/
+/----------------------------------------------------------------------------*/
+#ifndef _FFCONFIG
+#define _FFCONFIG 0x007E
+
+
+/*---------------------------------------------------------------------------/
+/ Function and Buffer Configurations
+/----------------------------------------------------------------------------*/
+
+#define _FS_TINY 1 /* 0 or 1 */
+/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
+/ object instead of the sector buffer in the individual file object for file
+/ data transfer. This reduces memory consumption 512 bytes each file object. */
+
+
+#define _FS_READONLY 1 /* 0 or 1 */
+/* Setting _FS_READONLY to 1 defines read only configuration. This removes
+/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
+/ f_truncate and useless f_getfree. */
+
+
+#define _FS_MINIMIZE 2 /* 0, 1, 2 or 3 */
+/* The _FS_MINIMIZE option defines minimization level to remove some functions.
+/
+/ 0: Full function.
+/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
+/ are removed.
+/ 2: f_opendir and f_readdir are removed in addition to level 1.
+/ 3: f_lseek is removed in addition to level 2. */
+
+
+#define _USE_STRFUNC 0 /* 0, 1 or 2 */
+/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
+
+
+#define _USE_MKFS 0 /* 0 or 1 */
+/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
+
+
+#define _USE_FORWARD 0 /* 0 or 1 */
+/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ Locale and Namespace Configurations
+/----------------------------------------------------------------------------*/
+
+#define _CODE_PAGE 932
+/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
+/ Incorrect setting of the code page can cause a file open failure.
+/
+/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
+/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
+/ 949 - Korean (DBCS, OEM, Windows)
+/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
+/ 1250 - Central Europe (Windows)
+/ 1251 - Cyrillic (Windows)
+/ 1252 - Latin 1 (Windows)
+/ 1253 - Greek (Windows)
+/ 1254 - Turkish (Windows)
+/ 1255 - Hebrew (Windows)
+/ 1256 - Arabic (Windows)
+/ 1257 - Baltic (Windows)
+/ 1258 - Vietnam (OEM, Windows)
+/ 437 - U.S. (OEM)
+/ 720 - Arabic (OEM)
+/ 737 - Greek (OEM)
+/ 775 - Baltic (OEM)
+/ 850 - Multilingual Latin 1 (OEM)
+/ 858 - Multilingual Latin 1 + Euro (OEM)
+/ 852 - Latin 2 (OEM)
+/ 855 - Cyrillic (OEM)
+/ 866 - Russian (OEM)
+/ 857 - Turkish (OEM)
+/ 862 - Hebrew (OEM)
+/ 874 - Thai (OEM, Windows)
+/ 1 - ASCII only (Valid for non LFN cfg.)
+*/
+
+
+#define _USE_LFN 0 /* 0, 1 or 2 */
+#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
+/* The _USE_LFN option switches the LFN support.
+/
+/ 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.
+/ 1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
+/ 2: Enable LFN with dynamic working buffer on the STACK.
+/
+/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
+/ two Unicode handling functions ff_convert() and ff_wtoupper() must be added
+/ to the project. */
+
+
+#define _LFN_UNICODE 0 /* 0 or 1 */
+/* To switch the character code set on FatFs API to Unicode,
+/ enable LFN feature and set _LFN_UNICODE to 1.
+*/
+
+
+#define _FS_RPATH 0 /* 0 or 1 */
+/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,
+/ f_chdrive function are available.
+/ Note that output of the f_readdir fnction is affected by this option. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ Physical Drive Configurations
+/----------------------------------------------------------------------------*/
+
+#define _DRIVES 1
+/* Number of volumes (logical drives) to be used. */
+
+
+#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
+/* Maximum sector size to be handled.
+/ Always set 512 for memory card and hard disk but a larger value may be
+/ required for floppy disk (512/1024) and optical disk (512/2048).
+/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
+/ to the disk_ioctl function. */
+
+
+#define _MULTI_PARTITION 0 /* 0 or 1 */
+/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
+/ drive number and can mount only first primaly partition. When it is set to 1,
+/ each volume is tied to the partitions listed in Drives[]. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ System Configurations
+/----------------------------------------------------------------------------*/
+
+#define _WORD_ACCESS 1 /* 0 or 1 */
+/* The _WORD_ACCESS option defines which access method is used to the word
+/ data on the FAT volume.
+/
+/ 0: Byte-by-byte access. Always compatible with all platforms.
+/ 1: Word access. Do not choose this unless following condition is met.
+/
+/ When the byte order on the memory is big-endian or address miss-aligned
+/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
+/ If it is not the case, the value can also be set to 1 to improve the
+/ performance and code size. */
+
+
+#define _FS_REENTRANT 0 /* 0 or 1 */
+#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
+#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
+/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
+/
+/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
+/ 1: Enable reentrancy. Also user provided synchronization handlers,
+/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
+/ function must be added to the project. */
+
+
+#endif /* _FFCONFIG */
diff --git a/Projects/Webserver/Lib/FATFs/integer.h b/Projects/Webserver/Lib/FATFs/integer.h
index 1d6bac368..851a78da2 100644
--- a/Projects/Webserver/Lib/FATFs/integer.h
+++ b/Projects/Webserver/Lib/FATFs/integer.h
@@ -1,37 +1,37 @@
-/*-------------------------------------------*/
-/* Integer type definitions for FatFs module */
-/*-------------------------------------------*/
-
-#ifndef _INTEGER
-
-#if 0
-#include <windows.h>
-#else
-
-/* These types must be 16-bit, 32-bit or larger integer */
-typedef int INT;
-typedef unsigned int UINT;
-
-/* These types must be 8-bit integer */
-typedef signed char CHAR;
-typedef unsigned char UCHAR;
-typedef unsigned char BYTE;
-
-/* These types must be 16-bit integer */
-typedef short SHORT;
-typedef unsigned short USHORT;
-typedef unsigned short WORD;
-typedef unsigned short WCHAR;
-
-/* These types must be 32-bit integer */
-typedef long LONG;
-typedef unsigned long ULONG;
-typedef unsigned long DWORD;
-
-/* Boolean type */
-typedef enum { FALSE = 0, TRUE } BOOL;
-
-#endif
-
-#define _INTEGER
-#endif
+/*-------------------------------------------*/
+/* Integer type definitions for FatFs module */
+/*-------------------------------------------*/
+
+#ifndef _INTEGER
+
+#if 0
+#include <windows.h>
+#else
+
+/* These types must be 16-bit, 32-bit or larger integer */
+typedef int INT;
+typedef unsigned int UINT;
+
+/* These types must be 8-bit integer */
+typedef signed char CHAR;
+typedef unsigned char UCHAR;
+typedef unsigned char BYTE;
+
+/* These types must be 16-bit integer */
+typedef short SHORT;
+typedef unsigned short USHORT;
+typedef unsigned short WORD;
+typedef unsigned short WCHAR;
+
+/* These types must be 32-bit integer */
+typedef long LONG;
+typedef unsigned long ULONG;
+typedef unsigned long DWORD;
+
+/* Boolean type */
+typedef enum { FALSE = 0, TRUE } BOOL;
+
+#endif
+
+#define _INTEGER
+#endif
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
index 08d849433..646410f3d 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.c
+++ b/Projects/Webserver/Lib/HTTPServerApp.c
@@ -1,289 +1,289 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * Simple HTTP Webserver Application. When connected to the uIP stack,
- * this will serve out files to HTTP clients on port 80.
- */
-
-#define INCLUDE_FROM_HTTPSERVERAPP_C
-#include "HTTPServerApp.h"
-
-/** HTTP server response header, for transmission before the page contents. This indicates to the host that a page exists at the
- * given location, and gives extra connection information.
- */
-const char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"
- "Server: LUFA " LUFA_VERSION_STRING "\r\n"
- "Connection: close\r\n"
- "MIME-version: 1.0\r\n"
- "Content-Type: ";
-
-/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
- * given URL is invalid, and gives extra error information.
- */
-const char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
- "Server: LUFA " LUFA_VERSION_STRING "\r\n"
- "Connection: close\r\n"
- "MIME-version: 1.0\r\n"
- "Content-Type: text/plain\r\n\r\n"
- "Error 404: File Not Found: /";
-
-/** Default filename to fetch when a directory is requested */
-const char PROGMEM DefaultDirFileName[] = "index.htm";
-
-/** Default MIME type sent if no other MIME type can be determined. */
-const char PROGMEM DefaultMIMEType[] = "text/plain";
-
-/** List of MIME types for each supported file extension. */
-const MIME_Type_t MIMETypes[] =
- {
- {.Extension = "htm", .MIMEType = "text/html"},
- {.Extension = "jpg", .MIMEType = "image/jpeg"},
- {.Extension = "gif", .MIMEType = "image/gif"},
- {.Extension = "bmp", .MIMEType = "image/bmp"},
- {.Extension = "png", .MIMEType = "image/png"},
- {.Extension = "ico", .MIMEType = "image/x-icon"},
- {.Extension = "exe", .MIMEType = "application/octet-stream"},
- {.Extension = "gz", .MIMEType = "application/x-gzip"},
- {.Extension = "zip", .MIMEType = "application/zip"},
- {.Extension = "pdf", .MIMEType = "application/pdf"},
- };
-
-/** FATFs structure to hold the internal state of the FAT driver for the dataflash contents. */
-FATFS DiskFATState;
-
-
-/** Initialization function for the simple HTTP webserver. */
-void HTTPServerApp_Init(void)
-{
- /* Listen on port 80 for HTTP connections from hosts */
- uip_listen(HTONS(HTTP_SERVER_PORT));
-
- /* Mount the dataflash disk via FatFS */
- f_mount(0, &DiskFATState);
-}
-
-/** uIP stack application callback for the simple HTTP webserver. This function must be called each time the
- * TCP/IP stack needs a TCP packet to be processed.
- */
-void HTTPServerApp_Callback(void)
-{
- uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
-
- if (uip_aborted() || uip_timedout() || uip_closed())
- {
- /* Lock to the closed state so that no further processing will occur on the connection */
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closing;
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
- }
-
- if (uip_connected())
- {
- /* New connection - initialize connection state values */
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_OpenRequestedFile;
- AppState->HTTPServer.NextState = WEBSERVER_STATE_OpenRequestedFile;
- AppState->HTTPServer.FileOpen = false;
- AppState->HTTPServer.ACKedFilePos = 0;
- AppState->HTTPServer.SentChunkSize = 0;
- }
-
- if (uip_acked())
- {
- /* Add the amount of ACKed file data to the total sent file bytes counter */
- AppState->HTTPServer.ACKedFilePos += AppState->HTTPServer.SentChunkSize;
-
- /* Progress to the next state once the current state's data has been ACKed */
- AppState->HTTPServer.CurrentState = AppState->HTTPServer.NextState;
- }
-
- if (uip_rexmit())
- {
- /* Return file pointer to the last ACKed position */
- f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
- }
-
- if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
- {
- switch (AppState->HTTPServer.CurrentState)
- {
- case WEBSERVER_STATE_OpenRequestedFile:
- HTTPServerApp_OpenRequestedFile();
- break;
- case WEBSERVER_STATE_SendResponseHeader:
- HTTPServerApp_SendResponseHeader();
- break;
- case WEBSERVER_STATE_SendData:
- HTTPServerApp_SendData();
- break;
- case WEBSERVER_STATE_Closing:
- /* Connection is being terminated for some reason - close file handle */
- f_close(&AppState->HTTPServer.FileHandle);
- AppState->HTTPServer.FileOpen = false;
-
- /* If connection is not already closed, close it */
- uip_close();
-
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;
- break;
- }
- }
-}
-
-/** HTTP Server State handler for the Request Process state. This state manages the processing of incoming HTTP
- * GET requests to the server from the receiving HTTP client.
- */
-static void HTTPServerApp_OpenRequestedFile(void)
-{
- uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* const AppData = (char*)uip_appdata;
-
- /* No HTTP header received from the client, abort processing */
- if (!(uip_newdata()))
- return;
-
- char* RequestToken = strtok(AppData, " ");
- char* RequestedFileName = strtok(NULL, " ");
-
- /* Must be a GET request, abort otherwise */
- if (strcmp_P(RequestToken, PSTR("GET")) != 0)
- {
- uip_abort();
- return;
- }
-
- /* Copy over the requested filename */
- strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
-
- /* Ensure filename is null-terminated */
- AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
-
- /* Determine the length of the URI so that it can be checked to see if it is a directory */
- uint8_t FileNameLen = strlen(AppState->HTTPServer.FileName);
-
- /* If the URI is a directory, append the default filename */
- if (AppState->HTTPServer.FileName[FileNameLen - 1] == '/')
- {
- strncpy_P(&AppState->HTTPServer.FileName[FileNameLen], DefaultDirFileName,
- (sizeof(AppState->HTTPServer.FileName) - FileNameLen));
-
- /* Ensure altered filename is still null-terminated */
- AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
- }
-
- /* Try to open the file from the Dataflash disk */
- AppState->HTTPServer.FileOpen = (f_open(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.FileName,
- (FA_OPEN_EXISTING | FA_READ)) == FR_OK);
-
- /* Lock to the SendResponseHeader state until connection terminated */
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_SendResponseHeader;
- AppState->HTTPServer.NextState = WEBSERVER_STATE_SendResponseHeader;
-}
-
-/** HTTP Server State handler for the HTTP Response Header Send state. This state manages the transmission of
- * the HTTP response header to the receiving HTTP client.
- */
-static void HTTPServerApp_SendResponseHeader(void)
-{
- uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* const AppData = (char*)uip_appdata;
-
- char* Extension = strpbrk(AppState->HTTPServer.FileName, ".");
- bool FoundMIMEType = false;
-
- /* If the file isn't already open, it wasn't found - send back a 404 error response and abort */
- if (!(AppState->HTTPServer.FileOpen))
- {
- /* Copy over the HTTP 404 response header and send it to the receiving client */
- strcpy_P(AppData, HTTP404Header);
- strcpy(&AppData[strlen(AppData)], AppState->HTTPServer.FileName);
- uip_send(AppData, strlen(AppData));
-
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
- return;
- }
-
- /* Copy over the HTTP 200 response header and send it to the receiving client */
- strcpy_P(AppData, HTTP200Header);
-
- /* Check to see if a MIME type for the requested file's extension was found */
- if (Extension != NULL)
- {
- /* Look through the MIME type list, copy over the required MIME type if found */
- for (uint8_t i = 0; i < (sizeof(MIMETypes) / sizeof(MIMETypes[0])); i++)
- {
- if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
- {
- strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
- FoundMIMEType = true;
- break;
- }
- }
- }
-
- /* Check if a MIME type was found and copied to the output buffer */
- if (!(FoundMIMEType))
- {
- /* MIME type not found - copy over the default MIME type */
- strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType);
- }
-
- /* Add the end-of-line terminator and end-of-headers terminator after the MIME type */
- strcpy_P(&AppData[strlen(AppData)], PSTR("\r\n\r\n"));
-
- /* Send the MIME header to the receiving client */
- uip_send(AppData, strlen(AppData));
-
- /* When the MIME header is ACKed, progress to the data send stage */
- AppState->HTTPServer.NextState = WEBSERVER_STATE_SendData;
-}
-
-/** HTTP Server State handler for the Data Send state. This state manages the transmission of file chunks
- * to the receiving HTTP client.
- */
-static void HTTPServerApp_SendData(void)
-{
- uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* const AppData = (char*)uip_appdata;
-
- /* Get the maximum segment size for the current packet */
- uint16_t MaxChunkSize = uip_mss();
-
- /* Read the next chunk of data from the open file */
- f_read(&AppState->HTTPServer.FileHandle, AppData, MaxChunkSize, &AppState->HTTPServer.SentChunkSize);
-
- /* Send the next file chunk to the receiving client */
- uip_send(AppData, AppState->HTTPServer.SentChunkSize);
-
- /* Check if we are at the last chunk of the file, if so next ACK should close the connection */
- if (MaxChunkSize != AppState->HTTPServer.SentChunkSize)
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * Simple HTTP Webserver Application. When connected to the uIP stack,
+ * this will serve out files to HTTP clients on port 80.
+ */
+
+#define INCLUDE_FROM_HTTPSERVERAPP_C
+#include "HTTPServerApp.h"
+
+/** HTTP server response header, for transmission before the page contents. This indicates to the host that a page exists at the
+ * given location, and gives extra connection information.
+ */
+const char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"
+ "Server: LUFA " LUFA_VERSION_STRING "\r\n"
+ "Connection: close\r\n"
+ "MIME-version: 1.0\r\n"
+ "Content-Type: ";
+
+/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
+ * given URL is invalid, and gives extra error information.
+ */
+const char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
+ "Server: LUFA " LUFA_VERSION_STRING "\r\n"
+ "Connection: close\r\n"
+ "MIME-version: 1.0\r\n"
+ "Content-Type: text/plain\r\n\r\n"
+ "Error 404: File Not Found: /";
+
+/** Default filename to fetch when a directory is requested */
+const char PROGMEM DefaultDirFileName[] = "index.htm";
+
+/** Default MIME type sent if no other MIME type can be determined. */
+const char PROGMEM DefaultMIMEType[] = "text/plain";
+
+/** List of MIME types for each supported file extension. */
+const MIME_Type_t MIMETypes[] =
+ {
+ {.Extension = "htm", .MIMEType = "text/html"},
+ {.Extension = "jpg", .MIMEType = "image/jpeg"},
+ {.Extension = "gif", .MIMEType = "image/gif"},
+ {.Extension = "bmp", .MIMEType = "image/bmp"},
+ {.Extension = "png", .MIMEType = "image/png"},
+ {.Extension = "ico", .MIMEType = "image/x-icon"},
+ {.Extension = "exe", .MIMEType = "application/octet-stream"},
+ {.Extension = "gz", .MIMEType = "application/x-gzip"},
+ {.Extension = "zip", .MIMEType = "application/zip"},
+ {.Extension = "pdf", .MIMEType = "application/pdf"},
+ };
+
+/** FATFs structure to hold the internal state of the FAT driver for the dataflash contents. */
+FATFS DiskFATState;
+
+
+/** Initialization function for the simple HTTP webserver. */
+void HTTPServerApp_Init(void)
+{
+ /* Listen on port 80 for HTTP connections from hosts */
+ uip_listen(HTONS(HTTP_SERVER_PORT));
+
+ /* Mount the dataflash disk via FatFS */
+ f_mount(0, &DiskFATState);
+}
+
+/** uIP stack application callback for the simple HTTP webserver. This function must be called each time the
+ * TCP/IP stack needs a TCP packet to be processed.
+ */
+void HTTPServerApp_Callback(void)
+{
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
+
+ if (uip_aborted() || uip_timedout() || uip_closed())
+ {
+ /* Lock to the closed state so that no further processing will occur on the connection */
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closing;
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
+ }
+
+ if (uip_connected())
+ {
+ /* New connection - initialize connection state values */
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_OpenRequestedFile;
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_OpenRequestedFile;
+ AppState->HTTPServer.FileOpen = false;
+ AppState->HTTPServer.ACKedFilePos = 0;
+ AppState->HTTPServer.SentChunkSize = 0;
+ }
+
+ if (uip_acked())
+ {
+ /* Add the amount of ACKed file data to the total sent file bytes counter */
+ AppState->HTTPServer.ACKedFilePos += AppState->HTTPServer.SentChunkSize;
+
+ /* Progress to the next state once the current state's data has been ACKed */
+ AppState->HTTPServer.CurrentState = AppState->HTTPServer.NextState;
+ }
+
+ if (uip_rexmit())
+ {
+ /* Return file pointer to the last ACKed position */
+ f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
+ }
+
+ if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
+ {
+ switch (AppState->HTTPServer.CurrentState)
+ {
+ case WEBSERVER_STATE_OpenRequestedFile:
+ HTTPServerApp_OpenRequestedFile();
+ break;
+ case WEBSERVER_STATE_SendResponseHeader:
+ HTTPServerApp_SendResponseHeader();
+ break;
+ case WEBSERVER_STATE_SendData:
+ HTTPServerApp_SendData();
+ break;
+ case WEBSERVER_STATE_Closing:
+ /* Connection is being terminated for some reason - close file handle */
+ f_close(&AppState->HTTPServer.FileHandle);
+ AppState->HTTPServer.FileOpen = false;
+
+ /* If connection is not already closed, close it */
+ uip_close();
+
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;
+ break;
+ }
+ }
+}
+
+/** HTTP Server State handler for the Request Process state. This state manages the processing of incoming HTTP
+ * GET requests to the server from the receiving HTTP client.
+ */
+static void HTTPServerApp_OpenRequestedFile(void)
+{
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
+ char* const AppData = (char*)uip_appdata;
+
+ /* No HTTP header received from the client, abort processing */
+ if (!(uip_newdata()))
+ return;
+
+ char* RequestToken = strtok(AppData, " ");
+ char* RequestedFileName = strtok(NULL, " ");
+
+ /* Must be a GET request, abort otherwise */
+ if (strcmp_P(RequestToken, PSTR("GET")) != 0)
+ {
+ uip_abort();
+ return;
+ }
+
+ /* Copy over the requested filename */
+ strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
+
+ /* Ensure filename is null-terminated */
+ AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
+
+ /* Determine the length of the URI so that it can be checked to see if it is a directory */
+ uint8_t FileNameLen = strlen(AppState->HTTPServer.FileName);
+
+ /* If the URI is a directory, append the default filename */
+ if (AppState->HTTPServer.FileName[FileNameLen - 1] == '/')
+ {
+ strncpy_P(&AppState->HTTPServer.FileName[FileNameLen], DefaultDirFileName,
+ (sizeof(AppState->HTTPServer.FileName) - FileNameLen));
+
+ /* Ensure altered filename is still null-terminated */
+ AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
+ }
+
+ /* Try to open the file from the Dataflash disk */
+ AppState->HTTPServer.FileOpen = (f_open(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.FileName,
+ (FA_OPEN_EXISTING | FA_READ)) == FR_OK);
+
+ /* Lock to the SendResponseHeader state until connection terminated */
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_SendResponseHeader;
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_SendResponseHeader;
+}
+
+/** HTTP Server State handler for the HTTP Response Header Send state. This state manages the transmission of
+ * the HTTP response header to the receiving HTTP client.
+ */
+static void HTTPServerApp_SendResponseHeader(void)
+{
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
+ char* const AppData = (char*)uip_appdata;
+
+ char* Extension = strpbrk(AppState->HTTPServer.FileName, ".");
+ bool FoundMIMEType = false;
+
+ /* If the file isn't already open, it wasn't found - send back a 404 error response and abort */
+ if (!(AppState->HTTPServer.FileOpen))
+ {
+ /* Copy over the HTTP 404 response header and send it to the receiving client */
+ strcpy_P(AppData, HTTP404Header);
+ strcpy(&AppData[strlen(AppData)], AppState->HTTPServer.FileName);
+ uip_send(AppData, strlen(AppData));
+
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
+ return;
+ }
+
+ /* Copy over the HTTP 200 response header and send it to the receiving client */
+ strcpy_P(AppData, HTTP200Header);
+
+ /* Check to see if a MIME type for the requested file's extension was found */
+ if (Extension != NULL)
+ {
+ /* Look through the MIME type list, copy over the required MIME type if found */
+ for (uint8_t i = 0; i < (sizeof(MIMETypes) / sizeof(MIMETypes[0])); i++)
+ {
+ if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
+ {
+ strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
+ FoundMIMEType = true;
+ break;
+ }
+ }
+ }
+
+ /* Check if a MIME type was found and copied to the output buffer */
+ if (!(FoundMIMEType))
+ {
+ /* MIME type not found - copy over the default MIME type */
+ strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType);
+ }
+
+ /* Add the end-of-line terminator and end-of-headers terminator after the MIME type */
+ strcpy_P(&AppData[strlen(AppData)], PSTR("\r\n\r\n"));
+
+ /* Send the MIME header to the receiving client */
+ uip_send(AppData, strlen(AppData));
+
+ /* When the MIME header is ACKed, progress to the data send stage */
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_SendData;
+}
+
+/** HTTP Server State handler for the Data Send state. This state manages the transmission of file chunks
+ * to the receiving HTTP client.
+ */
+static void HTTPServerApp_SendData(void)
+{
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
+ char* const AppData = (char*)uip_appdata;
+
+ /* Get the maximum segment size for the current packet */
+ uint16_t MaxChunkSize = uip_mss();
+
+ /* Read the next chunk of data from the open file */
+ f_read(&AppState->HTTPServer.FileHandle, AppData, MaxChunkSize, &AppState->HTTPServer.SentChunkSize);
+
+ /* Send the next file chunk to the receiving client */
+ uip_send(AppData, AppState->HTTPServer.SentChunkSize);
+
+ /* Check if we are at the last chunk of the file, if so next ACK should close the connection */
+ if (MaxChunkSize != AppState->HTTPServer.SentChunkSize)
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
+}
diff --git a/Projects/Webserver/Lib/HTTPServerApp.h b/Projects/Webserver/Lib/HTTPServerApp.h
index 47b810845..04cdbe5fe 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.h
+++ b/Projects/Webserver/Lib/HTTPServerApp.h
@@ -1,81 +1,81 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 HTTPServerApp.c.
- */
-
-#ifndef _HTTPSERVER_APP_H_
-#define _HTTPSERVER_APP_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
- #include <string.h>
-
- #include <LUFA/Version.h>
-
- #include <uip.h>
- #include <ff.h>
-
- /* Enums: */
- /** States for each HTTP connection to the webserver. */
- enum Webserver_States_t
- {
- WEBSERVER_STATE_OpenRequestedFile, /**< Currently opening requested file */
- WEBSERVER_STATE_SendResponseHeader, /**< Currently sending HTTP response headers to the client */
- WEBSERVER_STATE_SendData, /**< Currently sending HTTP page data to the client */
- WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */
- WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */
- };
-
- /* Type Defines: */
- /** Type define for a MIME type handler. */
- typedef struct
- {
- char* Extension; /**< File extension (no leading '.' character) */
- char* MIMEType; /**< Appropriate MIME type to send when the extension is encountered */
- } MIME_Type_t;
-
- /* Macros: */
- /** TCP listen port for incoming HTTP traffic */
- #define HTTP_SERVER_PORT 80
-
- /* Function Prototypes: */
- void HTTPServerApp_Init(void);
- void HTTPServerApp_Callback(void);
-
- #if defined(INCLUDE_FROM_HTTPSERVERAPP_C)
- static void HTTPServerApp_OpenRequestedFile(void);
- static void HTTPServerApp_SendResponseHeader(void);
- static void HTTPServerApp_SendData(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 HTTPServerApp.c.
+ */
+
+#ifndef _HTTPSERVER_APP_H_
+#define _HTTPSERVER_APP_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <string.h>
+
+ #include <LUFA/Version.h>
+
+ #include <uip.h>
+ #include <ff.h>
+
+ /* Enums: */
+ /** States for each HTTP connection to the webserver. */
+ enum Webserver_States_t
+ {
+ WEBSERVER_STATE_OpenRequestedFile, /**< Currently opening requested file */
+ WEBSERVER_STATE_SendResponseHeader, /**< Currently sending HTTP response headers to the client */
+ WEBSERVER_STATE_SendData, /**< Currently sending HTTP page data to the client */
+ WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */
+ WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */
+ };
+
+ /* Type Defines: */
+ /** Type define for a MIME type handler. */
+ typedef struct
+ {
+ char* Extension; /**< File extension (no leading '.' character) */
+ char* MIMEType; /**< Appropriate MIME type to send when the extension is encountered */
+ } MIME_Type_t;
+
+ /* Macros: */
+ /** TCP listen port for incoming HTTP traffic */
+ #define HTTP_SERVER_PORT 80
+
+ /* Function Prototypes: */
+ void HTTPServerApp_Init(void);
+ void HTTPServerApp_Callback(void);
+
+ #if defined(INCLUDE_FROM_HTTPSERVERAPP_C)
+ static void HTTPServerApp_OpenRequestedFile(void);
+ static void HTTPServerApp_SendResponseHeader(void);
+ static void HTTPServerApp_SendData(void);
+ #endif
+
+#endif
diff --git a/Projects/Webserver/Lib/SCSI.c b/Projects/Webserver/Lib/SCSI.c
index 8a376a41b..55312e87b 100644
--- a/Projects/Webserver/Lib/SCSI.c
+++ b/Projects/Webserver/Lib/SCSI.c
@@ -1,281 +1,281 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * SCSI command processing routines, for SCSI commands issued by the host. Mass Storage
- * devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
- * which wrap around standard SCSI device commands for controlling the actual storage medium.
- */
-
-#define INCLUDE_FROM_SCSI_C
-#include "SCSI.h"
-
-/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
- * features and capabilities.
- */
-SCSI_Inquiry_Response_t InquiryData =
- {
- .DeviceType = DEVICE_TYPE_BLOCK,
- .PeripheralQualifier = 0,
-
- .Removable = true,
-
- .Version = 0,
-
- .ResponseDataFormat = 2,
- .NormACA = false,
- .TrmTsk = false,
- .AERC = false,
-
- .AdditionalLength = 0x1F,
-
- .SoftReset = false,
- .CmdQue = false,
- .Linked = false,
- .Sync = false,
- .WideBus16Bit = false,
- .WideBus32Bit = false,
- .RelAddr = false,
-
- .VendorID = "LUFA",
- .ProductID = "Dataflash Disk",
- .RevisionID = {'0','.','0','0'},
- };
-
-/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE
- * command is issued. This gives information on exactly why the last command failed to complete.
- */
-SCSI_Request_Sense_Response_t SenseData =
- {
- .ResponseCode = 0x70,
- .AdditionalLength = 0x0A,
- };
-
-
-/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches
- * to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns
- * a command failure due to a ILLEGAL REQUEST.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- /* Set initial sense data, before the requested command is processed */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
- SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- /* Run the appropriate SCSI command hander function based on the passed command */
- switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
- {
- case SCSI_CMD_INQUIRY:
- SCSI_Command_Inquiry(MSInterfaceInfo);
- break;
- case SCSI_CMD_REQUEST_SENSE:
- SCSI_Command_Request_Sense(MSInterfaceInfo);
- break;
- case SCSI_CMD_READ_CAPACITY_10:
- SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
- break;
- case SCSI_CMD_SEND_DIAGNOSTIC:
- SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
- break;
- case SCSI_CMD_WRITE_10:
- SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
- break;
- case SCSI_CMD_READ_10:
- SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
- break;
- case SCSI_CMD_TEST_UNIT_READY:
- case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
- case SCSI_CMD_VERIFY_10:
- /* These commands should just succeed, no handling required */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
- break;
- default:
- /* Update the SENSE key to reflect the invalid command */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_COMMAND,
- SCSI_ASENSEQ_NO_QUALIFIER);
- break;
- }
-
- return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);
-}
-
-/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
- * and capabilities to the host.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint16_t AllocationLength = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
- MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
- uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
- sizeof(InquiryData);
-
- /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
- if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
- MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
- {
- /* Optional but unsupported bits set - update the SENSE key and fail the request */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_FIELD_IN_CDB,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
-
- uint8_t PadBytes[AllocationLength - BytesTransferred];
-
- /* Pad out remaining bytes with 0x00 */
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
-
- /* Finalize the stream transfer to send the last packet */
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-}
-
-/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
- * including the error code and additional error information so that the host can determine why a command failed to complete.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
- uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
- uint8_t PadBytes[AllocationLength - BytesTransferred];
-
- Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-}
-
-/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity
- * on the selected Logical Unit (drive), as a number of OS-sized blocks.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
- uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
-
- Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
- Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-}
-
-/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
- * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
- * supported.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- */
-static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- /* Check to see if the SELF TEST bit is not set */
- if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
- {
- /* Only self-test supported - update SENSE key and fail the command */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_INVALID_FIELD_IN_CDB,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Check to see if all attached Dataflash ICs are functional */
- if (!(DataflashManager_CheckDataflashOperation()))
- {
- /* Update SENSE key with a hardware error condition and return command fail */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
- SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Succeed the command and update the bytes transferred counter */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-}
-
-/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
- * and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual
- * reading and writing of the data.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
- * \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
- */
-static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
-{
- uint32_t BlockAddress;
- uint16_t TotalBlocks;
-
- /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
- BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
-
- /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
- TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
- /* Check if the block address is outside the maximum allowable value for the LUN */
- if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
- {
- /* Block address is invalid, update SENSE key and return command fail */
- SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
- SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
- return;
- }
-
- /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
- if (IsDataRead == DATA_READ)
- DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
- else
- DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
-
- /* Update the bytes transferred counter and succeed the command */
- MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * SCSI command processing routines, for SCSI commands issued by the host. Mass Storage
+ * devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
+ * which wrap around standard SCSI device commands for controlling the actual storage medium.
+ */
+
+#define INCLUDE_FROM_SCSI_C
+#include "SCSI.h"
+
+/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
+ * features and capabilities.
+ */
+SCSI_Inquiry_Response_t InquiryData =
+ {
+ .DeviceType = DEVICE_TYPE_BLOCK,
+ .PeripheralQualifier = 0,
+
+ .Removable = true,
+
+ .Version = 0,
+
+ .ResponseDataFormat = 2,
+ .NormACA = false,
+ .TrmTsk = false,
+ .AERC = false,
+
+ .AdditionalLength = 0x1F,
+
+ .SoftReset = false,
+ .CmdQue = false,
+ .Linked = false,
+ .Sync = false,
+ .WideBus16Bit = false,
+ .WideBus32Bit = false,
+ .RelAddr = false,
+
+ .VendorID = "LUFA",
+ .ProductID = "Dataflash Disk",
+ .RevisionID = {'0','.','0','0'},
+ };
+
+/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE
+ * command is issued. This gives information on exactly why the last command failed to complete.
+ */
+SCSI_Request_Sense_Response_t SenseData =
+ {
+ .ResponseCode = 0x70,
+ .AdditionalLength = 0x0A,
+ };
+
+
+/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches
+ * to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns
+ * a command failure due to a ILLEGAL REQUEST.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ /* Set initial sense data, before the requested command is processed */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
+ SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ /* Run the appropriate SCSI command hander function based on the passed command */
+ switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
+ {
+ case SCSI_CMD_INQUIRY:
+ SCSI_Command_Inquiry(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_REQUEST_SENSE:
+ SCSI_Command_Request_Sense(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_READ_CAPACITY_10:
+ SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_SEND_DIAGNOSTIC:
+ SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
+ break;
+ case SCSI_CMD_WRITE_10:
+ SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
+ break;
+ case SCSI_CMD_READ_10:
+ SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
+ break;
+ case SCSI_CMD_TEST_UNIT_READY:
+ case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
+ case SCSI_CMD_VERIFY_10:
+ /* These commands should just succeed, no handling required */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
+ break;
+ default:
+ /* Update the SENSE key to reflect the invalid command */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_COMMAND,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+ break;
+ }
+
+ return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);
+}
+
+/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
+ * and capabilities to the host.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint16_t AllocationLength = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
+ MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
+ uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
+ sizeof(InquiryData);
+
+ /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
+ if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
+ MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
+ {
+ /* Optional but unsupported bits set - update the SENSE key and fail the request */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_FIELD_IN_CDB,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
+
+ uint8_t PadBytes[AllocationLength - BytesTransferred];
+
+ /* Pad out remaining bytes with 0x00 */
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+
+ /* Finalize the stream transfer to send the last packet */
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
+}
+
+/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
+ * including the error code and additional error information so that the host can determine why a command failed to complete.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
+ uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
+
+ uint8_t PadBytes[AllocationLength - BytesTransferred];
+
+ Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
+}
+
+/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity
+ * on the selected Logical Unit (drive), as a number of OS-sized blocks.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
+ uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
+
+ Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
+ Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
+}
+
+/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
+ * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
+ * supported.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ */
+static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ /* Check to see if the SELF TEST bit is not set */
+ if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
+ {
+ /* Only self-test supported - update SENSE key and fail the command */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_INVALID_FIELD_IN_CDB,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Check to see if all attached Dataflash ICs are functional */
+ if (!(DataflashManager_CheckDataflashOperation()))
+ {
+ /* Update SENSE key with a hardware error condition and return command fail */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
+ SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Succeed the command and update the bytes transferred counter */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
+}
+
+/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
+ * and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual
+ * reading and writing of the data.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
+ * \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
+ */
+static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
+{
+ uint32_t BlockAddress;
+ uint16_t TotalBlocks;
+
+ /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
+ BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
+
+ /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
+ TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
+
+ /* Check if the block address is outside the maximum allowable value for the LUN */
+ if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
+ {
+ /* Block address is invalid, update SENSE key and return command fail */
+ SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
+ SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
+ return;
+ }
+
+ /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
+ if (IsDataRead == DATA_READ)
+ DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+ else
+ DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+
+ /* Update the bytes transferred counter and succeed the command */
+ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
+}
diff --git a/Projects/Webserver/Lib/SCSI.h b/Projects/Webserver/Lib/SCSI.h
index 196b5f689..e83f59bfc 100644
--- a/Projects/Webserver/Lib/SCSI.h
+++ b/Projects/Webserver/Lib/SCSI.h
@@ -1,85 +1,85 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 SCSI.c.
- */
-
-#ifndef _SCSI_H_
-#define _SCSI_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- #include "../Descriptors.h"
- #include "DataflashManager.h"
-
- /* Macros: */
- /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
- * is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
- * the last command failure) in a quick and easy manner.
- *
- * \param[in] key New SCSI sense key to set the sense code to
- * \param[in] acode New SCSI additional sense key to set the additional sense code to
- * \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
- */
- #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = (key); \
- SenseData.AdditionalSenseCode = (acode); \
- SenseData.AdditionalSenseQualifier = (aqual); }MACROE
-
- /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
- #define DATA_READ true
-
- /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */
- #define DATA_WRITE false
-
- /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
- #define DEVICE_TYPE_BLOCK 0x00
-
- /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
- #define DEVICE_TYPE_CDROM 0x05
-
- /* Function Prototypes: */
- bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
- #if defined(INCLUDE_FROM_SCSI_C)
- static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
- static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 SCSI.c.
+ */
+
+#ifndef _SCSI_H_
+#define _SCSI_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ #include "../Descriptors.h"
+ #include "DataflashManager.h"
+
+ /* Macros: */
+ /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
+ * is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
+ * the last command failure) in a quick and easy manner.
+ *
+ * \param[in] key New SCSI sense key to set the sense code to
+ * \param[in] acode New SCSI additional sense key to set the additional sense code to
+ * \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
+ */
+ #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = (key); \
+ SenseData.AdditionalSenseCode = (acode); \
+ SenseData.AdditionalSenseQualifier = (aqual); }MACROE
+
+ /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
+ #define DATA_READ true
+
+ /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */
+ #define DATA_WRITE false
+
+ /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
+ #define DEVICE_TYPE_BLOCK 0x00
+
+ /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
+ #define DEVICE_TYPE_CDROM 0x05
+
+ /* Function Prototypes: */
+ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+
+ #if defined(INCLUDE_FROM_SCSI_C)
+ static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+ static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
+ #endif
+
+#endif
diff --git a/Projects/Webserver/Lib/TELNETServerApp.c b/Projects/Webserver/Lib/TELNETServerApp.c
index 2855f8d76..da9108676 100644
--- a/Projects/Webserver/Lib/TELNETServerApp.c
+++ b/Projects/Webserver/Lib/TELNETServerApp.c
@@ -1,162 +1,162 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#if defined(ENABLE_TELNET_SERVER) || defined(__DOXYGEN__)
-
-/** \file
- *
- * TELNET Webserver Application. When connected to the uIP stack,
- * this will serve out raw TELNET to the client on port 23.
- */
-
-#define INCLUDE_FROM_TELNETSERVERAPP_C
-#include "TELNETServerApp.h"
-
-/** Welcome message to send to a TELNET client when a connection is first made. */
-const char PROGMEM WelcomeHeader[] = "********************************************\r\n"
- "* LUFA uIP Webserver (TELNET) *\r\n"
- "********************************************\r\n";
-
-/** Main TELNET menu, giving the user the list of available commands they may issue */
-const char PROGMEM TELNETMenu[] = "\r\n"
- " == Available Commands: ==\r\n"
- " c) List Active TCP Connections\r\n"
- " =========================\r\n"
- "\r\n>";
-
-/** Header to print before the current connections are printed to the client */
-const char PROGMEM CurrentConnectionsHeader[] = "\r\n* Current TCP Connections: *\r\n";
-
-/** Initialization function for the simple HTTP webserver. */
-void TELNETServerApp_Init(void)
-{
- /* Listen on port 23 for TELNET connections from hosts */
- uip_listen(HTONS(TELNET_SERVER_PORT));
-}
-
-/** uIP stack application callback for the TELNET server. This function must be called each time the
- * TCP/IP stack needs a TCP packet to be processed.
- */
-void TELNETServerApp_Callback(void)
-{
- uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* const AppData = (char*)uip_appdata;
-
- if (uip_connected())
- {
- /* New connection - initialize connection state values */
- AppState->TELNETServer.CurrentState = TELNET_STATE_SendHeader;
- }
-
- if (uip_acked())
- {
- /* Progress to the next state once the current state's data has been ACKed */
- AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
- }
-
- if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
- {
- switch (AppState->TELNETServer.CurrentState)
- {
- case TELNET_STATE_SendHeader:
- /* Copy over and send the TELNET welcome message upon first connection */
- strcpy_P(AppData, WelcomeHeader);
- uip_send(AppData, strlen(AppData));
-
- AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
- break;
- case TELNET_STATE_SendMenu:
- /* Copy over and send the TELNET menu to the client */
- strcpy_P(AppData, TELNETMenu);
- uip_send(AppData, strlen(AppData));
-
- AppState->TELNETServer.NextState = TELNET_STATE_GetCommand;
- break;
- case TELNET_STATE_GetCommand:
- if (!(uip_datalen()))
- break;
-
- /* Save the issued command for later processing */
- AppState->TELNETServer.IssuedCommand = AppData[0];
-
- AppState->TELNETServer.CurrentState = TELNET_STATE_SendResponse;
- break;
- case TELNET_STATE_SendResponse:
- /* Determine which command was issued, perform command processing */
- switch (AppState->TELNETServer.IssuedCommand)
- {
- case 'c':
- TELNETServerApp_DisplayTCPConnections();
- break;
- default:
- strcpy_P(AppData, PSTR("Invalid Command.\r\n"));
- uip_send(AppData, strlen(AppData));
- break;
- }
-
- AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
- break;
- }
- }
-}
-
-/** Sends a list of active TCP connections to the TELNET client. */
-static void TELNETServerApp_DisplayTCPConnections(void)
-{
- char* const AppData = (char*)uip_appdata;
-
- strcpy_P(AppData, CurrentConnectionsHeader);
-
- uint16_t ResponseLen = strlen(AppData);
- uint8_t ActiveConnCount = 0;
-
- /* Loop through the complete uIP TCP connections list, looking for active connections */
- for (uint8_t i = 0; i < UIP_CONNS; i++)
- {
- struct uip_conn* CurrConnection = &uip_conns[i];
-
- /* If the connection is not closed, it is active and must be added to the out buffer */
- if (CurrConnection->tcpstateflags != UIP_CLOSED)
- {
- /* Add the current connection's details to the out buffer */
- ResponseLen += sprintf_P(&AppData[ResponseLen], PSTR("%u) %02d.%02d.%02d.%02d (Local %u, Remote %u)\r\n"),
- ++ActiveConnCount,
- CurrConnection->ripaddr.u8[0],
- CurrConnection->ripaddr.u8[1],
- CurrConnection->ripaddr.u8[2],
- CurrConnection->ripaddr.u8[3],
- HTONS(CurrConnection->lport), HTONS(CurrConnection->rport));
- }
- }
-
- uip_send(AppData, ResponseLen);
-}
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#if defined(ENABLE_TELNET_SERVER) || defined(__DOXYGEN__)
+
+/** \file
+ *
+ * TELNET Webserver Application. When connected to the uIP stack,
+ * this will serve out raw TELNET to the client on port 23.
+ */
+
+#define INCLUDE_FROM_TELNETSERVERAPP_C
+#include "TELNETServerApp.h"
+
+/** Welcome message to send to a TELNET client when a connection is first made. */
+const char PROGMEM WelcomeHeader[] = "********************************************\r\n"
+ "* LUFA uIP Webserver (TELNET) *\r\n"
+ "********************************************\r\n";
+
+/** Main TELNET menu, giving the user the list of available commands they may issue */
+const char PROGMEM TELNETMenu[] = "\r\n"
+ " == Available Commands: ==\r\n"
+ " c) List Active TCP Connections\r\n"
+ " =========================\r\n"
+ "\r\n>";
+
+/** Header to print before the current connections are printed to the client */
+const char PROGMEM CurrentConnectionsHeader[] = "\r\n* Current TCP Connections: *\r\n";
+
+/** Initialization function for the simple HTTP webserver. */
+void TELNETServerApp_Init(void)
+{
+ /* Listen on port 23 for TELNET connections from hosts */
+ uip_listen(HTONS(TELNET_SERVER_PORT));
+}
+
+/** uIP stack application callback for the TELNET server. This function must be called each time the
+ * TCP/IP stack needs a TCP packet to be processed.
+ */
+void TELNETServerApp_Callback(void)
+{
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
+ char* const AppData = (char*)uip_appdata;
+
+ if (uip_connected())
+ {
+ /* New connection - initialize connection state values */
+ AppState->TELNETServer.CurrentState = TELNET_STATE_SendHeader;
+ }
+
+ if (uip_acked())
+ {
+ /* Progress to the next state once the current state's data has been ACKed */
+ AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
+ }
+
+ if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
+ {
+ switch (AppState->TELNETServer.CurrentState)
+ {
+ case TELNET_STATE_SendHeader:
+ /* Copy over and send the TELNET welcome message upon first connection */
+ strcpy_P(AppData, WelcomeHeader);
+ uip_send(AppData, strlen(AppData));
+
+ AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
+ break;
+ case TELNET_STATE_SendMenu:
+ /* Copy over and send the TELNET menu to the client */
+ strcpy_P(AppData, TELNETMenu);
+ uip_send(AppData, strlen(AppData));
+
+ AppState->TELNETServer.NextState = TELNET_STATE_GetCommand;
+ break;
+ case TELNET_STATE_GetCommand:
+ if (!(uip_datalen()))
+ break;
+
+ /* Save the issued command for later processing */
+ AppState->TELNETServer.IssuedCommand = AppData[0];
+
+ AppState->TELNETServer.CurrentState = TELNET_STATE_SendResponse;
+ break;
+ case TELNET_STATE_SendResponse:
+ /* Determine which command was issued, perform command processing */
+ switch (AppState->TELNETServer.IssuedCommand)
+ {
+ case 'c':
+ TELNETServerApp_DisplayTCPConnections();
+ break;
+ default:
+ strcpy_P(AppData, PSTR("Invalid Command.\r\n"));
+ uip_send(AppData, strlen(AppData));
+ break;
+ }
+
+ AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
+ break;
+ }
+ }
+}
+
+/** Sends a list of active TCP connections to the TELNET client. */
+static void TELNETServerApp_DisplayTCPConnections(void)
+{
+ char* const AppData = (char*)uip_appdata;
+
+ strcpy_P(AppData, CurrentConnectionsHeader);
+
+ uint16_t ResponseLen = strlen(AppData);
+ uint8_t ActiveConnCount = 0;
+
+ /* Loop through the complete uIP TCP connections list, looking for active connections */
+ for (uint8_t i = 0; i < UIP_CONNS; i++)
+ {
+ struct uip_conn* CurrConnection = &uip_conns[i];
+
+ /* If the connection is not closed, it is active and must be added to the out buffer */
+ if (CurrConnection->tcpstateflags != UIP_CLOSED)
+ {
+ /* Add the current connection's details to the out buffer */
+ ResponseLen += sprintf_P(&AppData[ResponseLen], PSTR("%u) %02d.%02d.%02d.%02d (Local %u, Remote %u)\r\n"),
+ ++ActiveConnCount,
+ CurrConnection->ripaddr.u8[0],
+ CurrConnection->ripaddr.u8[1],
+ CurrConnection->ripaddr.u8[2],
+ CurrConnection->ripaddr.u8[3],
+ HTONS(CurrConnection->lport), HTONS(CurrConnection->rport));
+ }
+ }
+
+ uip_send(AppData, ResponseLen);
+}
+
+#endif
diff --git a/Projects/Webserver/Lib/TELNETServerApp.h b/Projects/Webserver/Lib/TELNETServerApp.h
index ff34d1482..c42725763 100644
--- a/Projects/Webserver/Lib/TELNETServerApp.h
+++ b/Projects/Webserver/Lib/TELNETServerApp.h
@@ -1,68 +1,68 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 TELNETServerApp.c.
- */
-
-#ifndef _TELNETSERVER_APP_H_
-#define _TELNETSERVER_APP_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
- #include <string.h>
- #include <stdio.h>
-
- #include <uip.h>
-
- /* Macros: */
- /** TCP listen port for incoming TELNET traffic */
- #define TELNET_SERVER_PORT 23
-
- /* Enums: */
- /** States for each TELNET connection to the server. */
- enum TELNET_States_t
- {
- TELNET_STATE_SendHeader, /**< Currently sending welcome header to the client */
- TELNET_STATE_SendMenu, /**< Currently sending the command list menu to the client */
- TELNET_STATE_GetCommand, /**< Currently waiting for a command from the client */
- TELNET_STATE_SendResponse, /**< Processing the issued command and sending a response */
- };
-
- /* Function Prototypes: */
- void TELNETServerApp_Init(void);
- void TELNETServerApp_Callback(void);
-
- #if defined(INCLUDE_FROM_TELNETSERVERAPP_C)
- static void TELNETServerApp_DisplayTCPConnections(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 TELNETServerApp.c.
+ */
+
+#ifndef _TELNETSERVER_APP_H_
+#define _TELNETSERVER_APP_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <string.h>
+ #include <stdio.h>
+
+ #include <uip.h>
+
+ /* Macros: */
+ /** TCP listen port for incoming TELNET traffic */
+ #define TELNET_SERVER_PORT 23
+
+ /* Enums: */
+ /** States for each TELNET connection to the server. */
+ enum TELNET_States_t
+ {
+ TELNET_STATE_SendHeader, /**< Currently sending welcome header to the client */
+ TELNET_STATE_SendMenu, /**< Currently sending the command list menu to the client */
+ TELNET_STATE_GetCommand, /**< Currently waiting for a command from the client */
+ TELNET_STATE_SendResponse, /**< Processing the issued command and sending a response */
+ };
+
+ /* Function Prototypes: */
+ void TELNETServerApp_Init(void);
+ void TELNETServerApp_Callback(void);
+
+ #if defined(INCLUDE_FROM_TELNETSERVERAPP_C)
+ static void TELNETServerApp_DisplayTCPConnections(void);
+ #endif
+
+#endif
diff --git a/Projects/Webserver/Lib/uIPManagement.c b/Projects/Webserver/Lib/uIPManagement.c
index 45f8a6ae5..2d1a93130 100644
--- a/Projects/Webserver/Lib/uIPManagement.c
+++ b/Projects/Webserver/Lib/uIPManagement.c
@@ -1,251 +1,251 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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
- *
- * uIP Management functions. This file contains the functions and globals needed to maintain the uIP
- * stack once an RNDIS device has been attached to the system.
- */
-
-#define INCLUDE_FROM_UIPMANAGEMENT_C
-#include "uIPManagement.h"
-
-/** Connection timer, to retain the time elapsed since the last time the uIP connections were managed. */
-struct timer ConnectionTimer;
-
-/** ARP timer, to retain the time elapsed since the ARP cache was last updated. */
-struct timer ARPTimer;
-
-/** MAC address of the RNDIS device, when enumerated */
-struct uip_eth_addr MACAddress;
-
-bool HaveIPConfiguration;
-
-/** Configures the uIP stack ready for network traffic. */
-void uIPManagement_Init(void)
-{
- /* uIP Timing Initialization */
- clock_init();
- timer_set(&ConnectionTimer, CLOCK_SECOND / 2);
- timer_set(&ARPTimer, CLOCK_SECOND * 10);
-
- /* uIP Stack Initialization */
- uip_init();
- uip_arp_init();
- uip_setethaddr(MACAddress);
-
- /* DHCP/Server IP Settings Initialization */
- #if defined(ENABLE_DHCP_CLIENT)
- HaveIPConfiguration = false;
- DHCPClientApp_Init();
- #else
- HaveIPConfiguration = true;
- uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
- uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);
- uip_ipaddr(&Netmask, DEVICE_NETMASK[0], DEVICE_NETMASK[1], DEVICE_NETMASK[2], DEVICE_NETMASK[3]);
- uip_ipaddr(&GatewayIPAddress, DEVICE_GATEWAY[0], DEVICE_GATEWAY[1], DEVICE_GATEWAY[2], DEVICE_GATEWAY[3]);
- uip_sethostaddr(&IPAddress);
- uip_setnetmask(&Netmask);
- uip_setdraddr(&GatewayIPAddress);
- #endif
-
- /* HTTP Webserver Initialization */
- HTTPServerApp_Init();
-
- /* TELNET Server Initialization */
- #if defined(ENABLE_TELNET_SERVER)
- TELNETServerApp_Init();
- #endif
-}
-
-/** uIP Management function. This function manages the uIP stack when called while an RNDIS device has been
- * attached to the system.
- */
-void uIPManagement_ManageNetwork(void)
-{
- if ((USB_CurrentMode == USB_MODE_HOST) && (USB_HostState == HOST_STATE_Configured))
- {
- uIPManagement_ProcessIncomingPacket();
- uIPManagement_ManageConnections();
- }
-}
-
-/** uIP TCP/IP network stack callback function for the processing of a given TCP connection. This routine dispatches
- * to the appropriate TCP protocol application based on the connection's listen port number.
- */
-void uIPManagement_TCPCallback(void)
-{
- /* Call the correct TCP application based on the port number the connection is listening on */
- switch (uip_conn->lport)
- {
- case HTONS(HTTP_SERVER_PORT):
- HTTPServerApp_Callback();
- break;
- #if defined(ENABLE_TELNET_SERVER)
- case HTONS(TELNET_SERVER_PORT):
- TELNETServerApp_Callback();
- break;
- #endif
- }
-}
-
-/** uIP TCP/IP network stack callback function for the processing of a given UDP connection. This routine dispatches
- * to the appropriate UDP protocol application based on the connection's listen port number.
- */
-void uIPManagement_UDPCallback(void)
-{
- /* Call the correct UDP application based on the port number the connection is listening on */
- switch (uip_udp_conn->lport)
- {
- case HTONS(DHCPC_CLIENT_PORT):
- DHCPClientApp_Callback();
- break;
- }
-}
-
-/** Processes Incoming packets to the server from the connected RNDIS device, creating responses as needed. */
-static void uIPManagement_ProcessIncomingPacket(void)
-{
- /* If no packet received, exit processing routine */
- if (!(RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface)))
- return;
-
- LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
- /* Read the Incoming packet straight into the UIP packet buffer */
- RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, uip_buf, &uip_len);
-
- /* If the packet contains an Ethernet frame, process it */
- if (uip_len > 0)
- {
- switch (((struct uip_eth_hdr*)uip_buf)->type)
- {
- case HTONS(UIP_ETHTYPE_IP):
- /* Filter packet by MAC destination */
- uip_arp_ipin();
-
- /* Process Incoming packet */
- uip_input();
-
- /* If a response was generated, send it */
- if (uip_len > 0)
- {
- /* Add destination MAC to outgoing packet */
- uip_arp_out();
-
- uip_split_output();
- }
-
- break;
- case HTONS(UIP_ETHTYPE_ARP):
- /* Process ARP packet */
- uip_arp_arpin();
-
- /* If a response was generated, send it */
- if (uip_len > 0)
- uip_split_output();
-
- break;
- }
- }
-
- LEDs_SetAllLEDs(LEDMASK_USB_READY | ((HaveIPConfiguration) ? LEDMASK_UIP_READY_CONFIG : LEDMASK_UIP_READY_NOCONFIG));
-}
-
-/** Manages the currently open network connections, including TCP and (if enabled) UDP. */
-static void uIPManagement_ManageConnections(void)
-{
- /* Poll TCP connections for more data to send back to the host */
- for (uint8_t i = 0; i < UIP_CONNS; i++)
- {
- uip_poll_conn(&uip_conns[i]);
-
- /* If a response was generated, send it */
- if (uip_len > 0)
- {
- /* Add destination MAC to outgoing packet */
- uip_arp_out();
-
- /* Split and send the outgoing packet */
- uip_split_output();
- }
- }
-
- /* Manage open connections for timeouts */
- if (timer_expired(&ConnectionTimer))
- {
- timer_reset(&ConnectionTimer);
-
- LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
- for (uint8_t i = 0; i < UIP_CONNS; i++)
- {
- /* Run periodic connection management for each TCP connection */
- uip_periodic(i);
-
- /* If a response was generated, send it */
- if (uip_len > 0)
- {
- /* Add destination MAC to outgoing packet */
- uip_arp_out();
-
- /* Split and send the outgoing packet */
- uip_split_output();
- }
- }
-
- #if defined(ENABLE_DHCP_CLIENT)
- for (uint8_t i = 0; i < UIP_UDP_CONNS; i++)
- {
- /* Run periodic connection management for each UDP connection */
- uip_udp_periodic(i);
-
- /* If a response was generated, send it */
- if (uip_len > 0)
- {
- /* Add destination MAC to outgoing packet */
- uip_arp_out();
-
- /* Split and send the outgoing packet */
- uip_split_output();
- }
- }
- #endif
-
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
- }
-
- /* Manage ARP cache refreshing */
- if (timer_expired(&ARPTimer))
- {
- timer_reset(&ARPTimer);
- uip_arp_timer();
- }
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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
+ *
+ * uIP Management functions. This file contains the functions and globals needed to maintain the uIP
+ * stack once an RNDIS device has been attached to the system.
+ */
+
+#define INCLUDE_FROM_UIPMANAGEMENT_C
+#include "uIPManagement.h"
+
+/** Connection timer, to retain the time elapsed since the last time the uIP connections were managed. */
+struct timer ConnectionTimer;
+
+/** ARP timer, to retain the time elapsed since the ARP cache was last updated. */
+struct timer ARPTimer;
+
+/** MAC address of the RNDIS device, when enumerated */
+struct uip_eth_addr MACAddress;
+
+bool HaveIPConfiguration;
+
+/** Configures the uIP stack ready for network traffic. */
+void uIPManagement_Init(void)
+{
+ /* uIP Timing Initialization */
+ clock_init();
+ timer_set(&ConnectionTimer, CLOCK_SECOND / 2);
+ timer_set(&ARPTimer, CLOCK_SECOND * 10);
+
+ /* uIP Stack Initialization */
+ uip_init();
+ uip_arp_init();
+ uip_setethaddr(MACAddress);
+
+ /* DHCP/Server IP Settings Initialization */
+ #if defined(ENABLE_DHCP_CLIENT)
+ HaveIPConfiguration = false;
+ DHCPClientApp_Init();
+ #else
+ HaveIPConfiguration = true;
+ uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
+ uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);
+ uip_ipaddr(&Netmask, DEVICE_NETMASK[0], DEVICE_NETMASK[1], DEVICE_NETMASK[2], DEVICE_NETMASK[3]);
+ uip_ipaddr(&GatewayIPAddress, DEVICE_GATEWAY[0], DEVICE_GATEWAY[1], DEVICE_GATEWAY[2], DEVICE_GATEWAY[3]);
+ uip_sethostaddr(&IPAddress);
+ uip_setnetmask(&Netmask);
+ uip_setdraddr(&GatewayIPAddress);
+ #endif
+
+ /* HTTP Webserver Initialization */
+ HTTPServerApp_Init();
+
+ /* TELNET Server Initialization */
+ #if defined(ENABLE_TELNET_SERVER)
+ TELNETServerApp_Init();
+ #endif
+}
+
+/** uIP Management function. This function manages the uIP stack when called while an RNDIS device has been
+ * attached to the system.
+ */
+void uIPManagement_ManageNetwork(void)
+{
+ if ((USB_CurrentMode == USB_MODE_HOST) && (USB_HostState == HOST_STATE_Configured))
+ {
+ uIPManagement_ProcessIncomingPacket();
+ uIPManagement_ManageConnections();
+ }
+}
+
+/** uIP TCP/IP network stack callback function for the processing of a given TCP connection. This routine dispatches
+ * to the appropriate TCP protocol application based on the connection's listen port number.
+ */
+void uIPManagement_TCPCallback(void)
+{
+ /* Call the correct TCP application based on the port number the connection is listening on */
+ switch (uip_conn->lport)
+ {
+ case HTONS(HTTP_SERVER_PORT):
+ HTTPServerApp_Callback();
+ break;
+ #if defined(ENABLE_TELNET_SERVER)
+ case HTONS(TELNET_SERVER_PORT):
+ TELNETServerApp_Callback();
+ break;
+ #endif
+ }
+}
+
+/** uIP TCP/IP network stack callback function for the processing of a given UDP connection. This routine dispatches
+ * to the appropriate UDP protocol application based on the connection's listen port number.
+ */
+void uIPManagement_UDPCallback(void)
+{
+ /* Call the correct UDP application based on the port number the connection is listening on */
+ switch (uip_udp_conn->lport)
+ {
+ case HTONS(DHCPC_CLIENT_PORT):
+ DHCPClientApp_Callback();
+ break;
+ }
+}
+
+/** Processes Incoming packets to the server from the connected RNDIS device, creating responses as needed. */
+static void uIPManagement_ProcessIncomingPacket(void)
+{
+ /* If no packet received, exit processing routine */
+ if (!(RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface)))
+ return;
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
+
+ /* Read the Incoming packet straight into the UIP packet buffer */
+ RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, uip_buf, &uip_len);
+
+ /* If the packet contains an Ethernet frame, process it */
+ if (uip_len > 0)
+ {
+ switch (((struct uip_eth_hdr*)uip_buf)->type)
+ {
+ case HTONS(UIP_ETHTYPE_IP):
+ /* Filter packet by MAC destination */
+ uip_arp_ipin();
+
+ /* Process Incoming packet */
+ uip_input();
+
+ /* If a response was generated, send it */
+ if (uip_len > 0)
+ {
+ /* Add destination MAC to outgoing packet */
+ uip_arp_out();
+
+ uip_split_output();
+ }
+
+ break;
+ case HTONS(UIP_ETHTYPE_ARP):
+ /* Process ARP packet */
+ uip_arp_arpin();
+
+ /* If a response was generated, send it */
+ if (uip_len > 0)
+ uip_split_output();
+
+ break;
+ }
+ }
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY | ((HaveIPConfiguration) ? LEDMASK_UIP_READY_CONFIG : LEDMASK_UIP_READY_NOCONFIG));
+}
+
+/** Manages the currently open network connections, including TCP and (if enabled) UDP. */
+static void uIPManagement_ManageConnections(void)
+{
+ /* Poll TCP connections for more data to send back to the host */
+ for (uint8_t i = 0; i < UIP_CONNS; i++)
+ {
+ uip_poll_conn(&uip_conns[i]);
+
+ /* If a response was generated, send it */
+ if (uip_len > 0)
+ {
+ /* Add destination MAC to outgoing packet */
+ uip_arp_out();
+
+ /* Split and send the outgoing packet */
+ uip_split_output();
+ }
+ }
+
+ /* Manage open connections for timeouts */
+ if (timer_expired(&ConnectionTimer))
+ {
+ timer_reset(&ConnectionTimer);
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
+
+ for (uint8_t i = 0; i < UIP_CONNS; i++)
+ {
+ /* Run periodic connection management for each TCP connection */
+ uip_periodic(i);
+
+ /* If a response was generated, send it */
+ if (uip_len > 0)
+ {
+ /* Add destination MAC to outgoing packet */
+ uip_arp_out();
+
+ /* Split and send the outgoing packet */
+ uip_split_output();
+ }
+ }
+
+ #if defined(ENABLE_DHCP_CLIENT)
+ for (uint8_t i = 0; i < UIP_UDP_CONNS; i++)
+ {
+ /* Run periodic connection management for each UDP connection */
+ uip_udp_periodic(i);
+
+ /* If a response was generated, send it */
+ if (uip_len > 0)
+ {
+ /* Add destination MAC to outgoing packet */
+ uip_arp_out();
+
+ /* Split and send the outgoing packet */
+ uip_split_output();
+ }
+ }
+ #endif
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ }
+
+ /* Manage ARP cache refreshing */
+ if (timer_expired(&ARPTimer))
+ {
+ timer_reset(&ARPTimer);
+ uip_arp_timer();
+ }
+}
diff --git a/Projects/Webserver/Lib/uIPManagement.h b/Projects/Webserver/Lib/uIPManagement.h
index ed02374f5..37c54e9ad 100644
--- a/Projects/Webserver/Lib/uIPManagement.h
+++ b/Projects/Webserver/Lib/uIPManagement.h
@@ -1,79 +1,79 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 uIPManagement.c.
- */
-
-#ifndef _UIP_MANAGEMENT_H_
-#define _UIP_MANAGEMENT_H_
-
- /* Includes: */
- #include <LUFA/Drivers/USB/Class/RNDIS.h>
-
- #include <uip.h>
- #include <uip_arp.h>
- #include <uip-split.h>
- #include <timer.h>
-
- #include "Lib/DHCPClientApp.h"
- #include "Lib/HTTPServerApp.h"
- #include "Lib/TELNETServerApp.h"
-
- /* Macros: */
- /** IP address that the webserver should use once connected to a RNDIS device (when DHCP is disabled). */
- #define DEVICE_IP_ADDRESS (uint8_t[]){192, 168, 1, 10}
-
- /** Netmask that the webserver should once connected to a RNDIS device (when DHCP is disabled). */
- #define DEVICE_NETMASK (uint8_t[]){255, 255, 255, 0}
-
- /** IP address of the default gateway the webserver should use when routing outside the local subnet
- * (when DHCP is disabled).
- */
- #define DEVICE_GATEWAY (uint8_t[]){192, 168, 1, 1}
-
- /* External Variables: */
- extern struct uip_eth_addr MACAddress;
-
- extern bool HaveIPConfiguration;
-
- /* Function Prototypes: */
- void uIPManagement_Init(void);
- void uIPManagement_ManageNetwork(void);
- void uIPManagement_TCPCallback(void);
- void uIPManagement_UDPCallback(void);
-
- #if defined(INCLUDE_FROM_UIPMANAGEMENT_C)
- static void uIPManagement_ProcessIncomingPacket(void);
- static void uIPManagement_ManageConnections(void);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 uIPManagement.c.
+ */
+
+#ifndef _UIP_MANAGEMENT_H_
+#define _UIP_MANAGEMENT_H_
+
+ /* Includes: */
+ #include <LUFA/Drivers/USB/Class/RNDIS.h>
+
+ #include <uip.h>
+ #include <uip_arp.h>
+ #include <uip-split.h>
+ #include <timer.h>
+
+ #include "Lib/DHCPClientApp.h"
+ #include "Lib/HTTPServerApp.h"
+ #include "Lib/TELNETServerApp.h"
+
+ /* Macros: */
+ /** IP address that the webserver should use once connected to a RNDIS device (when DHCP is disabled). */
+ #define DEVICE_IP_ADDRESS (uint8_t[]){192, 168, 1, 10}
+
+ /** Netmask that the webserver should once connected to a RNDIS device (when DHCP is disabled). */
+ #define DEVICE_NETMASK (uint8_t[]){255, 255, 255, 0}
+
+ /** IP address of the default gateway the webserver should use when routing outside the local subnet
+ * (when DHCP is disabled).
+ */
+ #define DEVICE_GATEWAY (uint8_t[]){192, 168, 1, 1}
+
+ /* External Variables: */
+ extern struct uip_eth_addr MACAddress;
+
+ extern bool HaveIPConfiguration;
+
+ /* Function Prototypes: */
+ void uIPManagement_Init(void);
+ void uIPManagement_ManageNetwork(void);
+ void uIPManagement_TCPCallback(void);
+ void uIPManagement_UDPCallback(void);
+
+ #if defined(INCLUDE_FROM_UIPMANAGEMENT_C)
+ static void uIPManagement_ProcessIncomingPacket(void);
+ static void uIPManagement_ManageConnections(void);
+ #endif
+
+#endif
diff --git a/Projects/Webserver/Lib/uip/clock.c b/Projects/Webserver/Lib/uip/clock.c
index 450714888..046b6e344 100644
--- a/Projects/Webserver/Lib/uip/clock.c
+++ b/Projects/Webserver/Lib/uip/clock.c
@@ -1,38 +1,38 @@
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <avr/interrupt.h>
-#include <avr/io.h>
-#include <avr/sfr_defs.h>
-
-#include "clock.h"
-
-//Counted time
-volatile clock_time_t clock_datetime = 0;
-
-//Overflow interrupt
-ISR(TIMER1_COMPA_vect)
-{
- clock_datetime += 1;
-}
-
-//Initialise the clock
-void clock_init()
-{
- OCR1A = ((F_CPU / 1024) / 100);
- TCCR1B = ((1 << WGM12) | (1 << CS12) | (1 << CS10));
- TIMSK1 = (1 << OCIE1A);
-}
-
-//Return time
-clock_time_t clock_time()
-{
- clock_time_t time;
-
- ATOMIC_BLOCK(ATOMIC_FORCEON)
- {
- time = clock_datetime;
- }
-
- return time;
-}
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+#include <avr/sfr_defs.h>
+
+#include "clock.h"
+
+//Counted time
+volatile clock_time_t clock_datetime = 0;
+
+//Overflow interrupt
+ISR(TIMER1_COMPA_vect)
+{
+ clock_datetime += 1;
+}
+
+//Initialise the clock
+void clock_init()
+{
+ OCR1A = ((F_CPU / 1024) / 100);
+ TCCR1B = ((1 << WGM12) | (1 << CS12) | (1 << CS10));
+ TIMSK1 = (1 << OCIE1A);
+}
+
+//Return time
+clock_time_t clock_time()
+{
+ clock_time_t time;
+
+ ATOMIC_BLOCK(ATOMIC_FORCEON)
+ {
+ time = clock_datetime;
+ }
+
+ return time;
+}
diff --git a/Projects/Webserver/Lib/uip/clock.h b/Projects/Webserver/Lib/uip/clock.h
index b585f47aa..05d30386b 100644
--- a/Projects/Webserver/Lib/uip/clock.h
+++ b/Projects/Webserver/Lib/uip/clock.h
@@ -1,12 +1,12 @@
-#ifndef __CLOCK_ARCH_H__
-#define __CLOCK_ARCH_H__
-
-#include <stdint.h>
-#include <util/atomic.h>
-
-typedef uint16_t clock_time_t;
-#define CLOCK_SECOND 100
-void clock_init(void);
-clock_time_t clock_time(void);
-
-#endif /* __CLOCK_ARCH_H__ */
+#ifndef __CLOCK_ARCH_H__
+#define __CLOCK_ARCH_H__
+
+#include <stdint.h>
+#include <util/atomic.h>
+
+typedef uint16_t clock_time_t;
+#define CLOCK_SECOND 100
+void clock_init(void);
+clock_time_t clock_time(void);
+
+#endif /* __CLOCK_ARCH_H__ */
diff --git a/Projects/Webserver/Lib/uip/timer.c b/Projects/Webserver/Lib/uip/timer.c
index 8c270b233..74eedf611 100644
--- a/Projects/Webserver/Lib/uip/timer.c
+++ b/Projects/Webserver/Lib/uip/timer.c
@@ -1,127 +1,127 @@
-/**
- * \addtogroup timer
- * @{
- */
-
-/**
- * \file
- * Timer library implementation.
- * \author
- * Adam Dunkels <adam@sics.se>
- */
-
-/*
- * Copyright (c) 2004, Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- * $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $
- */
-
-#include "clock.h"
-#include "timer.h"
-
-/*---------------------------------------------------------------------------*/
-/**
- * Set a timer.
- *
- * This function is used to set a timer for a time sometime in the
- * future. The function timer_expired() will evaluate to true after
- * the timer has expired.
- *
- * \param t A pointer to the timer
- * \param interval The interval before the timer expires.
- *
- */
-void
-timer_set(struct timer *t, clock_time_t interval)
-{
- t->interval = interval;
- t->start = clock_time();
-}
-/*---------------------------------------------------------------------------*/
-/**
- * Reset the timer with the same interval.
- *
- * This function resets the timer with the same interval that was
- * given to the timer_set() function. The start point of the interval
- * is the exact time that the timer last expired. Therefore, this
- * function will cause the timer to be stable over time, unlike the
- * timer_rester() function.
- *
- * \param t A pointer to the timer.
- *
- * \sa timer_restart()
- */
-void
-timer_reset(struct timer *t)
-{
- t->start += t->interval;
-}
-/*---------------------------------------------------------------------------*/
-/**
- * Restart the timer from the current point in time
- *
- * This function restarts a timer with the same interval that was
- * given to the timer_set() function. The timer will start at the
- * current time.
- *
- * \note A periodic timer will drift if this function is used to reset
- * it. For preioric timers, use the timer_reset() function instead.
- *
- * \param t A pointer to the timer.
- *
- * \sa timer_reset()
- */
-void
-timer_restart(struct timer *t)
-{
- t->start = clock_time();
-}
-/*---------------------------------------------------------------------------*/
-/**
- * Check if a timer has expired.
- *
- * This function tests if a timer has expired and returns true or
- * false depending on its status.
- *
- * \param t A pointer to the timer
- *
- * \return Non-zero if the timer has expired, zero otherwise.
- *
- */
-int
-timer_expired(struct timer *t)
-{
- return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;
-}
-/*---------------------------------------------------------------------------*/
-
-/** @} */
+/**
+ * \addtogroup timer
+ * @{
+ */
+
+/**
+ * \file
+ * Timer library implementation.
+ * \author
+ * Adam Dunkels <adam@sics.se>
+ */
+
+/*
+ * Copyright (c) 2004, Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ * $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $
+ */
+
+#include "clock.h"
+#include "timer.h"
+
+/*---------------------------------------------------------------------------*/
+/**
+ * Set a timer.
+ *
+ * This function is used to set a timer for a time sometime in the
+ * future. The function timer_expired() will evaluate to true after
+ * the timer has expired.
+ *
+ * \param t A pointer to the timer
+ * \param interval The interval before the timer expires.
+ *
+ */
+void
+timer_set(struct timer *t, clock_time_t interval)
+{
+ t->interval = interval;
+ t->start = clock_time();
+}
+/*---------------------------------------------------------------------------*/
+/**
+ * Reset the timer with the same interval.
+ *
+ * This function resets the timer with the same interval that was
+ * given to the timer_set() function. The start point of the interval
+ * is the exact time that the timer last expired. Therefore, this
+ * function will cause the timer to be stable over time, unlike the
+ * timer_rester() function.
+ *
+ * \param t A pointer to the timer.
+ *
+ * \sa timer_restart()
+ */
+void
+timer_reset(struct timer *t)
+{
+ t->start += t->interval;
+}
+/*---------------------------------------------------------------------------*/
+/**
+ * Restart the timer from the current point in time
+ *
+ * This function restarts a timer with the same interval that was
+ * given to the timer_set() function. The timer will start at the
+ * current time.
+ *
+ * \note A periodic timer will drift if this function is used to reset
+ * it. For preioric timers, use the timer_reset() function instead.
+ *
+ * \param t A pointer to the timer.
+ *
+ * \sa timer_reset()
+ */
+void
+timer_restart(struct timer *t)
+{
+ t->start = clock_time();
+}
+/*---------------------------------------------------------------------------*/
+/**
+ * Check if a timer has expired.
+ *
+ * This function tests if a timer has expired and returns true or
+ * false depending on its status.
+ *
+ * \param t A pointer to the timer
+ *
+ * \return Non-zero if the timer has expired, zero otherwise.
+ *
+ */
+int
+timer_expired(struct timer *t)
+{
+ return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;
+}
+/*---------------------------------------------------------------------------*/
+
+/** @} */
diff --git a/Projects/Webserver/Lib/uip/timer.h b/Projects/Webserver/Lib/uip/timer.h
index e28e3ca5f..057bea49c 100644
--- a/Projects/Webserver/Lib/uip/timer.h
+++ b/Projects/Webserver/Lib/uip/timer.h
@@ -1,86 +1,86 @@
-/**
- * \defgroup timer Timer library
- *
- * The timer library provides functions for setting, resetting and
- * restarting timers, and for checking if a timer has expired. An
- * application must "manually" check if its timers have expired; this
- * is not done automatically.
- *
- * A timer is declared as a \c struct \c timer and all access to the
- * timer is made by a pointer to the declared timer.
- *
- * \note The timer library uses the \ref clock "Clock library" to
- * measure time. Intervals should be specified in the format used by
- * the clock library.
- *
- * @{
- */
-
-
-/**
- * \file
- * Timer library header file.
- * \author
- * Adam Dunkels <adam@sics.se>
- */
-
-/*
- * Copyright (c) 2004, Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $
- */
-#ifndef __TIMER_H__
-#define __TIMER_H__
-
-#include "clock.h"
-
-/**
- * A timer.
- *
- * This structure is used for declaring a timer. The timer must be set
- * with timer_set() before it can be used.
- *
- * \hideinitializer
- */
-struct timer {
- clock_time_t start;
- clock_time_t interval;
-};
-
-void timer_set(struct timer *t, clock_time_t interval);
-void timer_reset(struct timer *t);
-void timer_restart(struct timer *t);
-int timer_expired(struct timer *t);
-
-#endif /* __TIMER_H__ */
-
-/** @} */
+/**
+ * \defgroup timer Timer library
+ *
+ * The timer library provides functions for setting, resetting and
+ * restarting timers, and for checking if a timer has expired. An
+ * application must "manually" check if its timers have expired; this
+ * is not done automatically.
+ *
+ * A timer is declared as a \c struct \c timer and all access to the
+ * timer is made by a pointer to the declared timer.
+ *
+ * \note The timer library uses the \ref clock "Clock library" to
+ * measure time. Intervals should be specified in the format used by
+ * the clock library.
+ *
+ * @{
+ */
+
+
+/**
+ * \file
+ * Timer library header file.
+ * \author
+ * Adam Dunkels <adam@sics.se>
+ */
+
+/*
+ * Copyright (c) 2004, Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $
+ */
+#ifndef __TIMER_H__
+#define __TIMER_H__
+
+#include "clock.h"
+
+/**
+ * A timer.
+ *
+ * This structure is used for declaring a timer. The timer must be set
+ * with timer_set() before it can be used.
+ *
+ * \hideinitializer
+ */
+struct timer {
+ clock_time_t start;
+ clock_time_t interval;
+};
+
+void timer_set(struct timer *t, clock_time_t interval);
+void timer_reset(struct timer *t);
+void timer_restart(struct timer *t);
+int timer_expired(struct timer *t);
+
+#endif /* __TIMER_H__ */
+
+/** @} */
diff --git a/Projects/Webserver/Lib/uip/uip-split.c b/Projects/Webserver/Lib/uip/uip-split.c
index 9b1d1ce88..5924fabe5 100644
--- a/Projects/Webserver/Lib/uip/uip-split.c
+++ b/Projects/Webserver/Lib/uip/uip-split.c
@@ -1,141 +1,141 @@
-/*
- * Copyright (c) 2004, Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is part of the Contiki operating system.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- * $Id: uip-split.c,v 1.2 2008/10/14 13:39:12 julienabeille Exp $
- */
-
-#include "uip-split.h"
-
-
-#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
-
-/*-----------------------------------------------------------------------------*/
-void
-uip_split_output(void)
-{
-#if UIP_TCP
- u16_t tcplen, len1, len2;
-
- /* We only try to split maximum sized TCP segments. */
- if(BUF->proto == UIP_PROTO_TCP && uip_len == UIP_BUFSIZE) {
-
- tcplen = uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN;
- /* Split the segment in two. If the original packet length was
- odd, we make the second packet one byte larger. */
- len1 = len2 = tcplen / 2;
- if(len1 + len2 < tcplen) {
- ++len2;
- }
-
- /* Create the first packet. This is done by altering the length
- field of the IP header and updating the checksums. */
- uip_len = len1 + UIP_TCPIP_HLEN + UIP_LLH_LEN;
-#if UIP_CONF_IPV6
- /* For IPv6, the IP length field does not include the IPv6 IP header
- length. */
- BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
- BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
-#else /* UIP_CONF_IPV6 */
- BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
- BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
-#endif /* UIP_CONF_IPV6 */
-
- /* Recalculate the TCP checksum. */
- BUF->tcpchksum = 0;
- BUF->tcpchksum = ~(uip_tcpchksum());
-
-#if !UIP_CONF_IPV6
- /* Recalculate the IP checksum. */
- BUF->ipchksum = 0;
- BUF->ipchksum = ~(uip_ipchksum());
-#endif /* UIP_CONF_IPV6 */
-
- /* Transmit the first packet. */
-#if UIP_CONF_IPV6
- tcpip_ipv6_output();
-#else
- RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
-#endif /* UIP_CONF_IPV6 */
-
- /* Now, create the second packet. To do this, it is not enough to
- just alter the length field, but we must also update the TCP
- sequence number and point the uip_appdata to a new place in
- memory. This place is detemined by the length of the first
- packet (len1). */
- uip_len = len2 + UIP_TCPIP_HLEN + UIP_LLH_LEN;
-#if UIP_CONF_IPV6
- /* For IPv6, the IP length field does not include the IPv6 IP header
- length. */
- BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
- BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
-#else /* UIP_CONF_IPV6 */
- BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
- BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
-#endif /* UIP_CONF_IPV6 */
-
- memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);
-
- uip_add32(BUF->seqno, len1);
- BUF->seqno[0] = uip_acc32[0];
- BUF->seqno[1] = uip_acc32[1];
- BUF->seqno[2] = uip_acc32[2];
- BUF->seqno[3] = uip_acc32[3];
-
- /* Recalculate the TCP checksum. */
- BUF->tcpchksum = 0;
- BUF->tcpchksum = ~(uip_tcpchksum());
-
-#if !UIP_CONF_IPV6
- /* Recalculate the IP checksum. */
- BUF->ipchksum = 0;
- BUF->ipchksum = ~(uip_ipchksum());
-#endif /* UIP_CONF_IPV6 */
-
- /* Transmit the second packet. */
-#if UIP_CONF_IPV6
- tcpip_ipv6_output();
-#else
- RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
-#endif /* UIP_CONF_IPV6 */
- return;
- }
-#endif /* UIP_TCP */
-
- /* uip_fw_output();*/
-#if UIP_CONF_IPV6
- tcpip_ipv6_output();
-#else
- RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
-#endif /* UIP_CONF_IPV6 */
-}
-
-/*-----------------------------------------------------------------------------*/
+/*
+ * Copyright (c) 2004, Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file is part of the Contiki operating system.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ * $Id: uip-split.c,v 1.2 2008/10/14 13:39:12 julienabeille Exp $
+ */
+
+#include "uip-split.h"
+
+
+#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
+
+/*-----------------------------------------------------------------------------*/
+void
+uip_split_output(void)
+{
+#if UIP_TCP
+ u16_t tcplen, len1, len2;
+
+ /* We only try to split maximum sized TCP segments. */
+ if(BUF->proto == UIP_PROTO_TCP && uip_len == UIP_BUFSIZE) {
+
+ tcplen = uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN;
+ /* Split the segment in two. If the original packet length was
+ odd, we make the second packet one byte larger. */
+ len1 = len2 = tcplen / 2;
+ if(len1 + len2 < tcplen) {
+ ++len2;
+ }
+
+ /* Create the first packet. This is done by altering the length
+ field of the IP header and updating the checksums. */
+ uip_len = len1 + UIP_TCPIP_HLEN + UIP_LLH_LEN;
+#if UIP_CONF_IPV6
+ /* For IPv6, the IP length field does not include the IPv6 IP header
+ length. */
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
+#else /* UIP_CONF_IPV6 */
+ BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
+ BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
+#endif /* UIP_CONF_IPV6 */
+
+ /* Recalculate the TCP checksum. */
+ BUF->tcpchksum = 0;
+ BUF->tcpchksum = ~(uip_tcpchksum());
+
+#if !UIP_CONF_IPV6
+ /* Recalculate the IP checksum. */
+ BUF->ipchksum = 0;
+ BUF->ipchksum = ~(uip_ipchksum());
+#endif /* UIP_CONF_IPV6 */
+
+ /* Transmit the first packet. */
+#if UIP_CONF_IPV6
+ tcpip_ipv6_output();
+#else
+ RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
+#endif /* UIP_CONF_IPV6 */
+
+ /* Now, create the second packet. To do this, it is not enough to
+ just alter the length field, but we must also update the TCP
+ sequence number and point the uip_appdata to a new place in
+ memory. This place is detemined by the length of the first
+ packet (len1). */
+ uip_len = len2 + UIP_TCPIP_HLEN + UIP_LLH_LEN;
+#if UIP_CONF_IPV6
+ /* For IPv6, the IP length field does not include the IPv6 IP header
+ length. */
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
+#else /* UIP_CONF_IPV6 */
+ BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
+ BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
+#endif /* UIP_CONF_IPV6 */
+
+ memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);
+
+ uip_add32(BUF->seqno, len1);
+ BUF->seqno[0] = uip_acc32[0];
+ BUF->seqno[1] = uip_acc32[1];
+ BUF->seqno[2] = uip_acc32[2];
+ BUF->seqno[3] = uip_acc32[3];
+
+ /* Recalculate the TCP checksum. */
+ BUF->tcpchksum = 0;
+ BUF->tcpchksum = ~(uip_tcpchksum());
+
+#if !UIP_CONF_IPV6
+ /* Recalculate the IP checksum. */
+ BUF->ipchksum = 0;
+ BUF->ipchksum = ~(uip_ipchksum());
+#endif /* UIP_CONF_IPV6 */
+
+ /* Transmit the second packet. */
+#if UIP_CONF_IPV6
+ tcpip_ipv6_output();
+#else
+ RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
+#endif /* UIP_CONF_IPV6 */
+ return;
+ }
+#endif /* UIP_TCP */
+
+ /* uip_fw_output();*/
+#if UIP_CONF_IPV6
+ tcpip_ipv6_output();
+#else
+ RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
+#endif /* UIP_CONF_IPV6 */
+}
+
+/*-----------------------------------------------------------------------------*/
diff --git a/Projects/Webserver/Lib/uip/uip-split.h b/Projects/Webserver/Lib/uip/uip-split.h
index 1df837ef3..c7274c36a 100644
--- a/Projects/Webserver/Lib/uip/uip-split.h
+++ b/Projects/Webserver/Lib/uip/uip-split.h
@@ -1,103 +1,103 @@
-/*
- * Copyright (c) 2004, Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is part of the Contiki operating system.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- * $Id: uip-split.h,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $
- */
-/**
- * \addtogroup uip
- * @{
- */
-
-/**
- * \defgroup uipsplit uIP TCP throughput booster hack
- * @{
- *
- * The basic uIP TCP implementation only allows each TCP connection to
- * have a single TCP segment in flight at any given time. Because of
- * the delayed ACK algorithm employed by most TCP receivers, uIP's
- * limit on the amount of in-flight TCP segments seriously reduces the
- * maximum achievable throughput for sending data from uIP.
- *
- * The uip-split module is a hack which tries to remedy this
- * situation. By splitting maximum sized outgoing TCP segments into
- * two, the delayed ACK algorithm is not invoked at TCP
- * receivers. This improves the throughput when sending data from uIP
- * by orders of magnitude.
- *
- * The uip-split module uses the uip-fw module (uIP IP packet
- * forwarding) for sending packets. Therefore, the uip-fw module must
- * be set up with the appropriate network interfaces for this module
- * to work.
- */
-
-
-/**
- * \file
- * Module for splitting outbound TCP segments in two to avoid the
- * delayed ACK throughput degradation.
- * \author
- * Adam Dunkels <adam@sics.se>
- *
- */
-
-#ifndef __UIP_SPLIT_H__
-#define __UIP_SPLIT_H__
-
-#include <string.h>
-#include <uip.h>
-
-#include "../../USBHostMode.h"
-
-#include <LUFA/Drivers/USB/Class/RNDIS.h>
-
-/**
- * Handle outgoing packets.
- *
- * This function inspects an outgoing packet in the uip_buf buffer and
- * sends it out using the uip_fw_output() function. If the packet is a
- * full-sized TCP segment it will be split into two segments and
- * transmitted separately. This function should be called instead of
- * the actual device driver output function, or the uip_fw_output()
- * function.
- *
- * The headers of the outgoing packet is assumed to be in the uip_buf
- * buffer and the payload is assumed to be wherever uip_appdata
- * points. The length of the outgoing packet is assumed to be in the
- * uip_len variable.
- *
- */
-void uip_split_output(void);
-void uip_add32(u8_t *op32, u16_t op16);
-#endif /* __UIP_SPLIT_H__ */
-
-/** @} */
-/** @} */
+/*
+ * Copyright (c) 2004, Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file is part of the Contiki operating system.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ * $Id: uip-split.h,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $
+ */
+/**
+ * \addtogroup uip
+ * @{
+ */
+
+/**
+ * \defgroup uipsplit uIP TCP throughput booster hack
+ * @{
+ *
+ * The basic uIP TCP implementation only allows each TCP connection to
+ * have a single TCP segment in flight at any given time. Because of
+ * the delayed ACK algorithm employed by most TCP receivers, uIP's
+ * limit on the amount of in-flight TCP segments seriously reduces the
+ * maximum achievable throughput for sending data from uIP.
+ *
+ * The uip-split module is a hack which tries to remedy this
+ * situation. By splitting maximum sized outgoing TCP segments into
+ * two, the delayed ACK algorithm is not invoked at TCP
+ * receivers. This improves the throughput when sending data from uIP
+ * by orders of magnitude.
+ *
+ * The uip-split module uses the uip-fw module (uIP IP packet
+ * forwarding) for sending packets. Therefore, the uip-fw module must
+ * be set up with the appropriate network interfaces for this module
+ * to work.
+ */
+
+
+/**
+ * \file
+ * Module for splitting outbound TCP segments in two to avoid the
+ * delayed ACK throughput degradation.
+ * \author
+ * Adam Dunkels <adam@sics.se>
+ *
+ */
+
+#ifndef __UIP_SPLIT_H__
+#define __UIP_SPLIT_H__
+
+#include <string.h>
+#include <uip.h>
+
+#include "../../USBHostMode.h"
+
+#include <LUFA/Drivers/USB/Class/RNDIS.h>
+
+/**
+ * Handle outgoing packets.
+ *
+ * This function inspects an outgoing packet in the uip_buf buffer and
+ * sends it out using the uip_fw_output() function. If the packet is a
+ * full-sized TCP segment it will be split into two segments and
+ * transmitted separately. This function should be called instead of
+ * the actual device driver output function, or the uip_fw_output()
+ * function.
+ *
+ * The headers of the outgoing packet is assumed to be in the uip_buf
+ * buffer and the payload is assumed to be wherever uip_appdata
+ * points. The length of the outgoing packet is assumed to be in the
+ * uip_len variable.
+ *
+ */
+void uip_split_output(void);
+void uip_add32(u8_t *op32, u16_t op16);
+#endif /* __UIP_SPLIT_H__ */
+
+/** @} */
+/** @} */
diff --git a/Projects/Webserver/Lib/uip/uip.c b/Projects/Webserver/Lib/uip/uip.c
index b2c422825..22a72043f 100644
--- a/Projects/Webserver/Lib/uip/uip.c
+++ b/Projects/Webserver/Lib/uip/uip.c
@@ -1,1938 +1,1938 @@
-#define DEBUG_PRINTF(...) /*printf(__VA_ARGS__)*/
-
-/**
- * \addtogroup uip
- * @{
- */
-
-/**
- * \file
- * The uIP TCP/IP stack code.
- * \author Adam Dunkels <adam@dunkels.com>
- */
-
-/*
- * Copyright (c) 2001-2003, Adam Dunkels.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack.
- *
- * $Id: uip.c,v 1.15 2008/10/15 08:08:32 adamdunkels Exp $
- *
- */
-
-/*
- * uIP is a small implementation of the IP, UDP and TCP protocols (as
- * well as some basic ICMP stuff). The implementation couples the IP,
- * UDP, TCP and the application layers very tightly. To keep the size
- * of the compiled code down, this code frequently uses the goto
- * statement. While it would be possible to break the uip_process()
- * function into many smaller functions, this would increase the code
- * size because of the overhead of parameter passing and the fact that
- * the optimier would not be as efficient.
- *
- * The principle is that we have a small buffer, called the uip_buf,
- * in which the device driver puts an incoming packet. The TCP/IP
- * stack parses the headers in the packet, and calls the
- * application. If the remote host has sent data to the application,
- * this data is present in the uip_buf and the application read the
- * data from there. It is up to the application to put this data into
- * a byte stream if needed. The application will not be fed with data
- * that is out of sequence.
- *
- * If the application whishes to send data to the peer, it should put
- * its data into the uip_buf. The uip_appdata pointer points to the
- * first available byte. The TCP/IP stack will calculate the
- * checksums, and fill in the necessary header fields and finally send
- * the packet back to the peer.
-*/
-
-#include "uip.h"
-#include "uipopt.h"
-#include "uip_arp.h"
-
-#if !UIP_CONF_IPV6 /* If UIP_CONF_IPV6 is defined, we compile the
- uip6.c file instead of this one. Therefore
- this #ifndef removes the entire compilation
- output of the uip.c file */
-
-
-#if UIP_CONF_IPV6
-#include "net/uip-neighbor.h"
-#endif /* UIP_CONF_IPV6 */
-
-#include <string.h>
-
-/*---------------------------------------------------------------------------*/
-/* Variable definitions. */
-
-
-/* The IP address of this host. If it is defined to be fixed (by
- setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set
- here. Otherwise, the address */
-#if UIP_FIXEDADDR > 0
-const uip_ipaddr_t uip_hostaddr =
- { UIP_IPADDR0, UIP_IPADDR1, UIP_IPADDR2, UIP_IPADDR3 };
-const uip_ipaddr_t uip_draddr =
- { UIP_DRIPADDR0, UIP_DRIPADDR1, UIP_DRIPADDR2, UIP_DRIPADDR3 };
-const uip_ipaddr_t uip_netmask =
- { UIP_NETMASK0, UIP_NETMASK1, UIP_NETMASK2, UIP_NETMASK3 };
-#else
-uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;
-#endif /* UIP_FIXEDADDR */
-
-const uip_ipaddr_t uip_broadcast_addr =
-#if UIP_CONF_IPV6
- { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
-#else /* UIP_CONF_IPV6 */
- { { 0xff, 0xff, 0xff, 0xff } };
-#endif /* UIP_CONF_IPV6 */
-const uip_ipaddr_t uip_all_zeroes_addr = { { 0x0, /* rest is 0 */ } };
-
-#if UIP_FIXEDETHADDR
-const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0,
- UIP_ETHADDR1,
- UIP_ETHADDR2,
- UIP_ETHADDR3,
- UIP_ETHADDR4,
- UIP_ETHADDR5}};
-#else
-struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
-#endif
-
-#ifndef UIP_CONF_EXTERNAL_BUFFER
-u8_t uip_buf[UIP_BUFSIZE + 2]; /* The packet buffer that contains
- incoming packets. */
-#endif /* UIP_CONF_EXTERNAL_BUFFER */
-
-void *uip_appdata; /* The uip_appdata pointer points to
- application data. */
-void *uip_sappdata; /* The uip_appdata pointer points to
- the application data which is to
- be sent. */
-#if UIP_URGDATA > 0
-void *uip_urgdata; /* The uip_urgdata pointer points to
- urgent data (out-of-band data), if
- present. */
-u16_t uip_urglen, uip_surglen;
-#endif /* UIP_URGDATA > 0 */
-
-u16_t uip_len, uip_slen;
- /* The uip_len is either 8 or 16 bits,
- depending on the maximum packet
- size. */
-
-u8_t uip_flags; /* The uip_flags variable is used for
- communication between the TCP/IP stack
- and the application program. */
-struct uip_conn *uip_conn; /* uip_conn always points to the current
- connection. */
-
-struct uip_conn uip_conns[UIP_CONNS];
- /* The uip_conns array holds all TCP
- connections. */
-u16_t uip_listenports[UIP_LISTENPORTS];
- /* The uip_listenports list all currently
- listning ports. */
-#if UIP_UDP
-struct uip_udp_conn *uip_udp_conn;
-struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
-#endif /* UIP_UDP */
-
-static u16_t ipid; /* Ths ipid variable is an increasing
- number that is used for the IP ID
- field. */
-
-void uip_setipid(u16_t id) { ipid = id; }
-
-static u8_t iss[4]; /* The iss variable is used for the TCP
- initial sequence number. */
-
-#if UIP_ACTIVE_OPEN
-static u16_t lastport; /* Keeps track of the last port used for
- a new connection. */
-#endif /* UIP_ACTIVE_OPEN */
-
-/* Temporary variables. */
-u8_t uip_acc32[4];
-static u8_t c, opt;
-static u16_t tmp16;
-
-/* Structures and definitions. */
-#define TCP_FIN 0x01
-#define TCP_SYN 0x02
-#define TCP_RST 0x04
-#define TCP_PSH 0x08
-#define TCP_ACK 0x10
-#define TCP_URG 0x20
-#define TCP_CTL 0x3f
-
-#define TCP_OPT_END 0 /* End of TCP options list */
-#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */
-#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */
-
-#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */
-
-#define ICMP_ECHO_REPLY 0
-#define ICMP_ECHO 8
-
-#define ICMP_DEST_UNREACHABLE 3
-#define ICMP_PORT_UNREACHABLE 3
-
-#define ICMP6_ECHO_REPLY 129
-#define ICMP6_ECHO 128
-#define ICMP6_NEIGHBOR_SOLICITATION 135
-#define ICMP6_NEIGHBOR_ADVERTISEMENT 136
-
-#define ICMP6_FLAG_S (1 << 6)
-
-#define ICMP6_OPTION_SOURCE_LINK_ADDRESS 1
-#define ICMP6_OPTION_TARGET_LINK_ADDRESS 2
-
-
-/* Macros. */
-#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
-#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0])
-#define ICMPBUF ((struct uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
-#define UDPBUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
-
-
-#if UIP_STATISTICS == 1
-struct uip_stats uip_stat;
-#define UIP_STAT(s) s
-#else
-#define UIP_STAT(s)
-#endif /* UIP_STATISTICS == 1 */
-
-#if UIP_LOGGING == 1
-#include <stdio.h>
-void uip_log(char *msg);
-#define UIP_LOG(m) uip_log(m)
-#else
-#define UIP_LOG(m)
-#endif /* UIP_LOGGING == 1 */
-
-#if ! UIP_ARCH_ADD32
-void
-uip_add32(u8_t *op32, u16_t op16)
-{
- uip_acc32[3] = op32[3] + (op16 & 0xff);
- uip_acc32[2] = op32[2] + (op16 >> 8);
- uip_acc32[1] = op32[1];
- uip_acc32[0] = op32[0];
-
- if(uip_acc32[2] < (op16 >> 8)) {
- ++uip_acc32[1];
- if(uip_acc32[1] == 0) {
- ++uip_acc32[0];
- }
- }
-
-
- if(uip_acc32[3] < (op16 & 0xff)) {
- ++uip_acc32[2];
- if(uip_acc32[2] == 0) {
- ++uip_acc32[1];
- if(uip_acc32[1] == 0) {
- ++uip_acc32[0];
- }
- }
- }
-}
-
-#endif /* UIP_ARCH_ADD32 */
-
-#if ! UIP_ARCH_CHKSUM
-/*---------------------------------------------------------------------------*/
-static u16_t
-chksum(u16_t sum, const u8_t *data, u16_t len)
-{
- u16_t t;
- const u8_t *dataptr;
- const u8_t *last_byte;
-
- dataptr = data;
- last_byte = data + len - 1;
-
- while(dataptr < last_byte) { /* At least two more bytes */
- t = (dataptr[0] << 8) + dataptr[1];
- sum += t;
- if(sum < t) {
- sum++; /* carry */
- }
- dataptr += 2;
- }
-
- if(dataptr == last_byte) {
- t = (dataptr[0] << 8) + 0;
- sum += t;
- if(sum < t) {
- sum++; /* carry */
- }
- }
-
- /* Return sum in host byte order. */
- return sum;
-}
-/*---------------------------------------------------------------------------*/
-u16_t
-uip_chksum(u16_t *data, u16_t len)
-{
- return htons(chksum(0, (u8_t *)data, len));
-}
-/*---------------------------------------------------------------------------*/
-#ifndef UIP_ARCH_IPCHKSUM
-u16_t
-uip_ipchksum(void)
-{
- u16_t sum;
-
- sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
- DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
- return (sum == 0) ? 0xffff : htons(sum);
-}
-#endif
-/*---------------------------------------------------------------------------*/
-static u16_t
-upper_layer_chksum(u8_t proto)
-{
- u16_t upper_layer_len;
- u16_t sum;
-
-#if UIP_CONF_IPV6
- upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]);
-#else /* UIP_CONF_IPV6 */
- upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
-#endif /* UIP_CONF_IPV6 */
-
- /* First sum pseudoheader. */
-
- /* IP protocol and length fields. This addition cannot carry. */
- sum = upper_layer_len + proto;
- /* Sum IP source and destination addresses. */
- sum = chksum(sum, (u8_t *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t));
-
- /* Sum TCP header and data. */
- sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
- upper_layer_len);
-
- return (sum == 0) ? 0xffff : htons(sum);
-}
-/*---------------------------------------------------------------------------*/
-#if UIP_CONF_IPV6
-u16_t
-uip_icmp6chksum(void)
-{
- return upper_layer_chksum(UIP_PROTO_ICMP6);
-
-}
-#endif /* UIP_CONF_IPV6 */
-/*---------------------------------------------------------------------------*/
-u16_t
-uip_tcpchksum(void)
-{
- return upper_layer_chksum(UIP_PROTO_TCP);
-}
-/*---------------------------------------------------------------------------*/
-#if UIP_UDP_CHECKSUMS
-u16_t
-uip_udpchksum(void)
-{
- return upper_layer_chksum(UIP_PROTO_UDP);
-}
-#endif /* UIP_UDP_CHECKSUMS */
-#endif /* UIP_ARCH_CHKSUM */
-/*---------------------------------------------------------------------------*/
-void
-uip_init(void)
-{
- for(c = 0; c < UIP_LISTENPORTS; ++c) {
- uip_listenports[c] = 0;
- }
- for(c = 0; c < UIP_CONNS; ++c) {
- uip_conns[c].tcpstateflags = UIP_CLOSED;
- }
-#if UIP_ACTIVE_OPEN
- lastport = 1024;
-#endif /* UIP_ACTIVE_OPEN */
-
-#if UIP_UDP
- for(c = 0; c < UIP_UDP_CONNS; ++c) {
- uip_udp_conns[c].lport = 0;
- }
-#endif /* UIP_UDP */
-
-
- /* IPv4 initialization. */
-#if UIP_FIXEDADDR == 0
- /* uip_hostaddr[0] = uip_hostaddr[1] = 0;*/
-#endif /* UIP_FIXEDADDR */
-
-}
-/*---------------------------------------------------------------------------*/
-#if UIP_ACTIVE_OPEN
-struct uip_conn *
-uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
-{
- register struct uip_conn *conn, *cconn;
-
- /* Find an unused local port. */
- again:
- ++lastport;
-
- if(lastport >= 32000) {
- lastport = 4096;
- }
-
- /* Check if this port is already in use, and if so try to find
- another one. */
- for(c = 0; c < UIP_CONNS; ++c) {
- conn = &uip_conns[c];
- if(conn->tcpstateflags != UIP_CLOSED &&
- conn->lport == htons(lastport)) {
- goto again;
- }
- }
-
- conn = 0;
- for(c = 0; c < UIP_CONNS; ++c) {
- cconn = &uip_conns[c];
- if(cconn->tcpstateflags == UIP_CLOSED) {
- conn = cconn;
- break;
- }
- if(cconn->tcpstateflags == UIP_TIME_WAIT) {
- if(conn == 0 ||
- cconn->timer > conn->timer) {
- conn = cconn;
- }
- }
- }
-
- if(conn == 0) {
- return 0;
- }
-
- conn->tcpstateflags = UIP_SYN_SENT;
-
- conn->snd_nxt[0] = iss[0];
- conn->snd_nxt[1] = iss[1];
- conn->snd_nxt[2] = iss[2];
- conn->snd_nxt[3] = iss[3];
-
- conn->initialmss = conn->mss = UIP_TCP_MSS;
-
- conn->len = 1; /* TCP length of the SYN is one. */
- conn->nrtx = 0;
- conn->timer = 1; /* Send the SYN next time around. */
- conn->rto = UIP_RTO;
- conn->sa = 0;
- conn->sv = 16; /* Initial value of the RTT variance. */
- conn->lport = htons(lastport);
- conn->rport = rport;
- uip_ipaddr_copy(&conn->ripaddr, ripaddr);
-
- return conn;
-}
-#endif /* UIP_ACTIVE_OPEN */
-/*---------------------------------------------------------------------------*/
-#if UIP_UDP
-struct uip_udp_conn *
-uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
-{
- register struct uip_udp_conn *conn;
-
- /* Find an unused local port. */
- again:
- ++lastport;
-
- if(lastport >= 32000) {
- lastport = 4096;
- }
-
- for(c = 0; c < UIP_UDP_CONNS; ++c) {
- if(uip_udp_conns[c].lport == htons(lastport)) {
- goto again;
- }
- }
-
-
- conn = 0;
- for(c = 0; c < UIP_UDP_CONNS; ++c) {
- if(uip_udp_conns[c].lport == 0) {
- conn = &uip_udp_conns[c];
- break;
- }
- }
-
- if(conn == 0) {
- return 0;
- }
-
- conn->lport = HTONS(lastport);
- conn->rport = rport;
- if(ripaddr == NULL) {
- memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
- } else {
- uip_ipaddr_copy(&conn->ripaddr, ripaddr);
- }
- conn->ttl = UIP_TTL;
-
- return conn;
-}
-#endif /* UIP_UDP */
-/*---------------------------------------------------------------------------*/
-void
-uip_unlisten(u16_t port)
-{
- for(c = 0; c < UIP_LISTENPORTS; ++c) {
- if(uip_listenports[c] == port) {
- uip_listenports[c] = 0;
- return;
- }
- }
-}
-/*---------------------------------------------------------------------------*/
-void
-uip_listen(u16_t port)
-{
- for(c = 0; c < UIP_LISTENPORTS; ++c) {
- if(uip_listenports[c] == 0) {
- uip_listenports[c] = port;
- return;
- }
- }
-}
-/*---------------------------------------------------------------------------*/
-/* XXX: IP fragment reassembly: not well-tested. */
-
-#if UIP_REASSEMBLY && !UIP_CONF_IPV6
-#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)
-static u8_t uip_reassbuf[UIP_REASS_BUFSIZE];
-static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
-static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
- 0x0f, 0x07, 0x03, 0x01};
-static u16_t uip_reasslen;
-static u8_t uip_reassflags;
-#define UIP_REASS_FLAG_LASTFRAG 0x01
-static u8_t uip_reasstmr;
-
-#define IP_MF 0x20
-
-static u8_t
-uip_reass(void)
-{
- u16_t offset, len;
- u16_t i;
-
- /* If ip_reasstmr is zero, no packet is present in the buffer, so we
- write the IP header of the fragment into the reassembly
- buffer. The timer is updated with the maximum age. */
- if(uip_reasstmr == 0) {
- memcpy(uip_reassbuf, &BUF->vhl, UIP_IPH_LEN);
- uip_reasstmr = UIP_REASS_MAXAGE;
- uip_reassflags = 0;
- /* Clear the bitmap. */
- memset(uip_reassbitmap, 0, sizeof(uip_reassbitmap));
- }
-
- /* Check if the incoming fragment matches the one currently present
- in the reasembly buffer. If so, we proceed with copying the
- fragment into the buffer. */
- if(BUF->srcipaddr[0] == FBUF->srcipaddr[0] &&
- BUF->srcipaddr[1] == FBUF->srcipaddr[1] &&
- BUF->destipaddr[0] == FBUF->destipaddr[0] &&
- BUF->destipaddr[1] == FBUF->destipaddr[1] &&
- BUF->ipid[0] == FBUF->ipid[0] &&
- BUF->ipid[1] == FBUF->ipid[1]) {
-
- len = (BUF->len[0] << 8) + BUF->len[1] - (BUF->vhl & 0x0f) * 4;
- offset = (((BUF->ipoffset[0] & 0x3f) << 8) + BUF->ipoffset[1]) * 8;
-
- /* If the offset or the offset + fragment length overflows the
- reassembly buffer, we discard the entire packet. */
- if(offset > UIP_REASS_BUFSIZE ||
- offset + len > UIP_REASS_BUFSIZE) {
- uip_reasstmr = 0;
- goto nullreturn;
- }
-
- /* Copy the fragment into the reassembly buffer, at the right
- offset. */
- memcpy(&uip_reassbuf[UIP_IPH_LEN + offset],
- (char *)BUF + (int)((BUF->vhl & 0x0f) * 4),
- len);
-
- /* Update the bitmap. */
- if(offset / (8 * 8) == (offset + len) / (8 * 8)) {
- /* If the two endpoints are in the same byte, we only update
- that byte. */
-
- uip_reassbitmap[offset / (8 * 8)] |=
- bitmap_bits[(offset / 8 ) & 7] &
- ~bitmap_bits[((offset + len) / 8 ) & 7];
- } else {
- /* If the two endpoints are in different bytes, we update the
- bytes in the endpoints and fill the stuff inbetween with
- 0xff. */
- uip_reassbitmap[offset / (8 * 8)] |=
- bitmap_bits[(offset / 8 ) & 7];
- for(i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) {
- uip_reassbitmap[i] = 0xff;
- }
- uip_reassbitmap[(offset + len) / (8 * 8)] |=
- ~bitmap_bits[((offset + len) / 8 ) & 7];
- }
-
- /* If this fragment has the More Fragments flag set to zero, we
- know that this is the last fragment, so we can calculate the
- size of the entire packet. We also set the
- IP_REASS_FLAG_LASTFRAG flag to indicate that we have received
- the final fragment. */
-
- if((BUF->ipoffset[0] & IP_MF) == 0) {
- uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
- uip_reasslen = offset + len;
- }
-
- /* Finally, we check if we have a full packet in the buffer. We do
- this by checking if we have the last fragment and if all bits
- in the bitmap are set. */
- if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) {
- /* Check all bytes up to and including all but the last byte in
- the bitmap. */
- for(i = 0; i < uip_reasslen / (8 * 8) - 1; ++i) {
- if(uip_reassbitmap[i] != 0xff) {
- goto nullreturn;
- }
- }
- /* Check the last byte in the bitmap. It should contain just the
- right amount of bits. */
- if(uip_reassbitmap[uip_reasslen / (8 * 8)] !=
- (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) {
- goto nullreturn;
- }
-
- /* If we have come this far, we have a full packet in the
- buffer, so we allocate a pbuf and copy the packet into it. We
- also reset the timer. */
- uip_reasstmr = 0;
- memcpy(BUF, FBUF, uip_reasslen);
-
- /* Pretend to be a "normal" (i.e., not fragmented) IP packet
- from now on. */
- BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
- BUF->len[0] = uip_reasslen >> 8;
- BUF->len[1] = uip_reasslen & 0xff;
- BUF->ipchksum = 0;
- BUF->ipchksum = ~(uip_ipchksum());
-
- return uip_reasslen;
- }
- }
-
- nullreturn:
- return 0;
-}
-#endif /* UIP_REASSEMBLY */
-/*---------------------------------------------------------------------------*/
-static void
-uip_add_rcv_nxt(u16_t n)
-{
- uip_add32(uip_conn->rcv_nxt, n);
- uip_conn->rcv_nxt[0] = uip_acc32[0];
- uip_conn->rcv_nxt[1] = uip_acc32[1];
- uip_conn->rcv_nxt[2] = uip_acc32[2];
- uip_conn->rcv_nxt[3] = uip_acc32[3];
-}
-/*---------------------------------------------------------------------------*/
-void
-uip_process(u8_t flag)
-{
- register struct uip_conn *uip_connr = uip_conn;
-
-#if UIP_UDP
- if(flag == UIP_UDP_SEND_CONN) {
- goto udp_send;
- }
-#endif /* UIP_UDP */
-
- uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
-
- /* Check if we were invoked because of a poll request for a
- particular connection. */
- if(flag == UIP_POLL_REQUEST) {
- if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED &&
- !uip_outstanding(uip_connr)) {
- uip_len = uip_slen = 0;
- uip_flags = UIP_POLL;
- UIP_APPCALL();
- goto appsend;
- }
- goto drop;
-
- /* Check if we were invoked because of the perodic timer fireing. */
- } else if(flag == UIP_TIMER) {
-#if UIP_REASSEMBLY
- if(uip_reasstmr != 0) {
- --uip_reasstmr;
- }
-#endif /* UIP_REASSEMBLY */
- /* Increase the initial sequence number. */
- if(++iss[3] == 0) {
- if(++iss[2] == 0) {
- if(++iss[1] == 0) {
- ++iss[0];
- }
- }
- }
-
- /* Reset the length variables. */
- uip_len = 0;
- uip_slen = 0;
-
- /* Check if the connection is in a state in which we simply wait
- for the connection to time out. If so, we increase the
- connection's timer and remove the connection if it times
- out. */
- if(uip_connr->tcpstateflags == UIP_TIME_WAIT ||
- uip_connr->tcpstateflags == UIP_FIN_WAIT_2) {
- ++(uip_connr->timer);
- if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) {
- uip_connr->tcpstateflags = UIP_CLOSED;
- }
- } else if(uip_connr->tcpstateflags != UIP_CLOSED) {
- /* If the connection has outstanding data, we increase the
- connection's timer and see if it has reached the RTO value
- in which case we retransmit. */
- if(uip_outstanding(uip_connr)) {
- if(uip_connr->timer-- == 0) {
- if(uip_connr->nrtx == UIP_MAXRTX ||
- ((uip_connr->tcpstateflags == UIP_SYN_SENT ||
- uip_connr->tcpstateflags == UIP_SYN_RCVD) &&
- uip_connr->nrtx == UIP_MAXSYNRTX)) {
- uip_connr->tcpstateflags = UIP_CLOSED;
-
- /* We call UIP_APPCALL() with uip_flags set to
- UIP_TIMEDOUT to inform the application that the
- connection has timed out. */
- uip_flags = UIP_TIMEDOUT;
- UIP_APPCALL();
-
- /* We also send a reset packet to the remote host. */
- BUF->flags = TCP_RST | TCP_ACK;
- goto tcp_send_nodata;
- }
-
- /* Exponential backoff. */
- uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4?
- 4:
- uip_connr->nrtx);
- ++(uip_connr->nrtx);
-
- /* Ok, so we need to retransmit. We do this differently
- depending on which state we are in. In ESTABLISHED, we
- call upon the application so that it may prepare the
- data for the retransmit. In SYN_RCVD, we resend the
- SYNACK that we sent earlier and in LAST_ACK we have to
- retransmit our FINACK. */
- UIP_STAT(++uip_stat.tcp.rexmit);
- switch(uip_connr->tcpstateflags & UIP_TS_MASK) {
- case UIP_SYN_RCVD:
- /* In the SYN_RCVD state, we should retransmit our
- SYNACK. */
- goto tcp_send_synack;
-
-#if UIP_ACTIVE_OPEN
- case UIP_SYN_SENT:
- /* In the SYN_SENT state, we retransmit out SYN. */
- BUF->flags = 0;
- goto tcp_send_syn;
-#endif /* UIP_ACTIVE_OPEN */
-
- case UIP_ESTABLISHED:
- /* In the ESTABLISHED state, we call upon the application
- to do the actual retransmit after which we jump into
- the code for sending out the packet (the apprexmit
- label). */
- uip_flags = UIP_REXMIT;
- UIP_APPCALL();
- goto apprexmit;
-
- case UIP_FIN_WAIT_1:
- case UIP_CLOSING:
- case UIP_LAST_ACK:
- /* In all these states we should retransmit a FINACK. */
- goto tcp_send_finack;
-
- }
- }
- } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) {
- /* If there was no need for a retransmission, we poll the
- application for new data. */
- uip_len = uip_slen = 0;
- uip_flags = UIP_POLL;
- UIP_APPCALL();
- goto appsend;
- }
- }
- goto drop;
- }
-#if UIP_UDP
- if(flag == UIP_UDP_TIMER) {
- if(uip_udp_conn->lport != 0) {
- uip_conn = NULL;
- uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
- uip_len = uip_slen = 0;
- uip_flags = UIP_POLL;
- UIP_UDP_APPCALL();
- goto udp_send;
- } else {
- goto drop;
- }
- }
-#endif
-
- /* This is where the input processing starts. */
- UIP_STAT(++uip_stat.ip.recv);
-
- /* Start of IP input header processing code. */
-
-#if UIP_CONF_IPV6
- /* Check validity of the IP header. */
- if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */
- UIP_STAT(++uip_stat.ip.drop);
- UIP_STAT(++uip_stat.ip.vhlerr);
- UIP_LOG("ipv6: invalid version.");
- goto drop;
- }
-#else /* UIP_CONF_IPV6 */
- /* Check validity of the IP header. */
- if(BUF->vhl != 0x45) { /* IP version and header length. */
- UIP_STAT(++uip_stat.ip.drop);
- UIP_STAT(++uip_stat.ip.vhlerr);
- UIP_LOG("ip: invalid version or header length.");
- goto drop;
- }
-#endif /* UIP_CONF_IPV6 */
-
- /* Check the size of the packet. If the size reported to us in
- uip_len is smaller the size reported in the IP header, we assume
- that the packet has been corrupted in transit. If the size of
- uip_len is larger than the size reported in the IP packet header,
- the packet has been padded and we set uip_len to the correct
- value.. */
-
- if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) {
- uip_len = (BUF->len[0] << 8) + BUF->len[1];
-#if UIP_CONF_IPV6
- uip_len += 40; /* The length reported in the IPv6 header is the
- length of the payload that follows the
- header. However, uIP uses the uip_len variable
- for holding the size of the entire packet,
- including the IP header. For IPv4 this is not a
- problem as the length field in the IPv4 header
- contains the length of the entire packet. But
- for IPv6 we need to add the size of the IPv6
- header (40 bytes). */
-#endif /* UIP_CONF_IPV6 */
- } else {
- UIP_LOG("ip: packet shorter than reported in IP header.");
- goto drop;
- }
-
-#if !UIP_CONF_IPV6
- /* Check the fragment flag. */
- if((BUF->ipoffset[0] & 0x3f) != 0 ||
- BUF->ipoffset[1] != 0) {
-#if UIP_REASSEMBLY
- uip_len = uip_reass();
- if(uip_len == 0) {
- goto drop;
- }
-#else /* UIP_REASSEMBLY */
- UIP_STAT(++uip_stat.ip.drop);
- UIP_STAT(++uip_stat.ip.fragerr);
- UIP_LOG("ip: fragment dropped.");
- goto drop;
-#endif /* UIP_REASSEMBLY */
- }
-#endif /* UIP_CONF_IPV6 */
-
- if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) {
- /* If we are configured to use ping IP address configuration and
- hasn't been assigned an IP address yet, we accept all ICMP
- packets. */
-#if UIP_PINGADDRCONF && !UIP_CONF_IPV6
- if(BUF->proto == UIP_PROTO_ICMP) {
- UIP_LOG("ip: possible ping config packet received.");
- goto icmp_input;
- } else {
- UIP_LOG("ip: packet dropped since no address assigned.");
- goto drop;
- }
-#endif /* UIP_PINGADDRCONF */
-
- } else {
- /* If IP broadcast support is configured, we check for a broadcast
- UDP packet, which may be destined to us. */
-#if UIP_BROADCAST
- DEBUG_PRINTF("UDP IP checksum 0x%04x\n", uip_ipchksum());
- if(BUF->proto == UIP_PROTO_UDP &&
- uip_ipaddr_cmp(&BUF->destipaddr, &uip_broadcast_addr)
- /*&&
- uip_ipchksum() == 0xffff*/) {
- goto udp_input;
- }
-#endif /* UIP_BROADCAST */
-
- /* Check if the packet is destined for our IP address. */
-#if !UIP_CONF_IPV6
- if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) {
- UIP_STAT(++uip_stat.ip.drop);
- goto drop;
- }
-#else /* UIP_CONF_IPV6 */
- /* For IPv6, packet reception is a little trickier as we need to
- make sure that we listen to certain multicast addresses (all
- hosts multicast address, and the solicited-node multicast
- address) as well. However, we will cheat here and accept all
- multicast packets that are sent to the ff02::/16 addresses. */
- if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr) &&
- BUF->destipaddr.u16[0] != HTONS(0xff02)) {
- UIP_STAT(++uip_stat.ip.drop);
- goto drop;
- }
-#endif /* UIP_CONF_IPV6 */
- }
-
-#if !UIP_CONF_IPV6
- if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header
- checksum. */
- UIP_STAT(++uip_stat.ip.drop);
- UIP_STAT(++uip_stat.ip.chkerr);
- UIP_LOG("ip: bad checksum.");
- goto drop;
- }
-#endif /* UIP_CONF_IPV6 */
-
- if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so,
- proceed with TCP input
- processing. */
- goto tcp_input;
- }
-
-#if UIP_UDP
- if(BUF->proto == UIP_PROTO_UDP) {
- goto udp_input;
- }
-#endif /* UIP_UDP */
-
-#if !UIP_CONF_IPV6
- /* ICMPv4 processing code follows. */
- if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from
- here. */
- UIP_STAT(++uip_stat.ip.drop);
- UIP_STAT(++uip_stat.ip.protoerr);
- UIP_LOG("ip: neither tcp nor icmp.");
- goto drop;
- }
-
-#if UIP_PINGADDRCONF
- icmp_input:
-#endif /* UIP_PINGADDRCONF */
- UIP_STAT(++uip_stat.icmp.recv);
-
- /* ICMP echo (i.e., ping) processing. This is simple, we only change
- the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP
- checksum before we return the packet. */
- if(ICMPBUF->type != ICMP_ECHO) {
- UIP_STAT(++uip_stat.icmp.drop);
- UIP_STAT(++uip_stat.icmp.typeerr);
- UIP_LOG("icmp: not icmp echo.");
- goto drop;
- }
-
- /* If we are configured to use ping IP address assignment, we use
- the destination IP address of this ping packet and assign it to
- ourself. */
-#if UIP_PINGADDRCONF
- if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) {
- uip_hostaddr = BUF->destipaddr;
- }
-#endif /* UIP_PINGADDRCONF */
-
- ICMPBUF->type = ICMP_ECHO_REPLY;
-
- if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {
- ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;
- } else {
- ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);
- }
-
- /* Swap IP addresses. */
- uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
- uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
-
- UIP_STAT(++uip_stat.icmp.sent);
- BUF->ttl = UIP_TTL;
- goto ip_send_nolen;
-
- /* End of IPv4 input header processing code. */
-#else /* !UIP_CONF_IPV6 */
-
- /* This is IPv6 ICMPv6 processing code. */
- DEBUG_PRINTF("icmp6_input: length %d\n", uip_len);
-
- if(BUF->proto != UIP_PROTO_ICMP6) { /* We only allow ICMPv6 packets from
- here. */
- UIP_STAT(++uip_stat.ip.drop);
- UIP_STAT(++uip_stat.ip.protoerr);
- UIP_LOG("ip: neither tcp nor icmp6.");
- goto drop;
- }
-
- UIP_STAT(++uip_stat.icmp.recv);
-
- /* If we get a neighbor solicitation for our address we should send
- a neighbor advertisement message back. */
- if(ICMPBUF->type == ICMP6_NEIGHBOR_SOLICITATION) {
- if(uip_ipaddr_cmp(&ICMPBUF->icmp6data, &uip_hostaddr)) {
-
- if(ICMPBUF->options[0] == ICMP6_OPTION_SOURCE_LINK_ADDRESS) {
- /* Save the sender's address in our neighbor list. */
- uip_neighbor_add(&ICMPBUF->srcipaddr, &(ICMPBUF->options[2]));
- }
-
- /* We should now send a neighbor advertisement back to where the
- neighbor solicication came from. */
- ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT;
- ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */
-
- ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0;
-
- uip_ipaddr_copy(&ICMPBUF->destipaddr, &ICMPBUF->srcipaddr);
- uip_ipaddr_copy(&ICMPBUF->srcipaddr, &uip_hostaddr);
- ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS;
- ICMPBUF->options[1] = 1; /* Options length, 1 = 8 bytes. */
- memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr));
- ICMPBUF->icmpchksum = 0;
- ICMPBUF->icmpchksum = ~uip_icmp6chksum();
-
- goto send;
-
- }
- goto drop;
- } else if(ICMPBUF->type == ICMP6_ECHO) {
- /* ICMP echo (i.e., ping) processing. This is simple, we only
- change the ICMP type from ECHO to ECHO_REPLY and update the
- ICMP checksum before we return the packet. */
-
- ICMPBUF->type = ICMP6_ECHO_REPLY;
-
- uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
- uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
- ICMPBUF->icmpchksum = 0;
- ICMPBUF->icmpchksum = ~uip_icmp6chksum();
-
- UIP_STAT(++uip_stat.icmp.sent);
- goto send;
- } else {
- DEBUG_PRINTF("Unknown icmp6 message type %d\n", ICMPBUF->type);
- UIP_STAT(++uip_stat.icmp.drop);
- UIP_STAT(++uip_stat.icmp.typeerr);
- UIP_LOG("icmp: unknown ICMP message.");
- goto drop;
- }
-
- /* End of IPv6 ICMP processing. */
-
-#endif /* !UIP_CONF_IPV6 */
-
-#if UIP_UDP
- /* UDP input processing. */
- udp_input:
- /* UDP processing is really just a hack. We don't do anything to the
- UDP/IP headers, but let the UDP application do all the hard
- work. If the application sets uip_slen, it has a packet to
- send. */
-#if UIP_UDP_CHECKSUMS
- uip_len = uip_len - UIP_IPUDPH_LEN;
- uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
- if(UDPBUF->udpchksum != 0 && uip_udpchksum() != 0xffff) {
- UIP_STAT(++uip_stat.udp.drop);
- UIP_STAT(++uip_stat.udp.chkerr);
- UIP_LOG("udp: bad checksum.");
- goto drop;
- }
-#else /* UIP_UDP_CHECKSUMS */
- uip_len = uip_len - UIP_IPUDPH_LEN;
-#endif /* UIP_UDP_CHECKSUMS */
-
- /* Demultiplex this UDP packet between the UDP "connections". */
- for(uip_udp_conn = &uip_udp_conns[0];
- uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS];
- ++uip_udp_conn) {
- /* If the local UDP port is non-zero, the connection is considered
- to be used. If so, the local port number is checked against the
- destination port number in the received packet. If the two port
- numbers match, the remote port number is checked if the
- connection is bound to a remote port. Finally, if the
- connection is bound to a remote IP address, the source IP
- address of the packet is checked. */
- if(uip_udp_conn->lport != 0 &&
- UDPBUF->destport == uip_udp_conn->lport &&
- (uip_udp_conn->rport == 0 ||
- UDPBUF->srcport == uip_udp_conn->rport) &&
- (uip_ipaddr_cmp(&uip_udp_conn->ripaddr, &uip_all_zeroes_addr) ||
- uip_ipaddr_cmp(&uip_udp_conn->ripaddr, &uip_broadcast_addr) ||
- uip_ipaddr_cmp(&BUF->srcipaddr, &uip_udp_conn->ripaddr))) {
- goto udp_found;
- }
- }
- UIP_LOG("udp: no matching connection found");
-#if UIP_CONF_ICMP_DEST_UNREACH && !UIP_CONF_IPV6
- /* Copy fields from packet header into payload of this ICMP packet. */
- memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8);
-
- /* Set the ICMP type and code. */
- ICMPBUF->type = ICMP_DEST_UNREACHABLE;
- ICMPBUF->icode = ICMP_PORT_UNREACHABLE;
-
- /* Calculate the ICMP checksum. */
- ICMPBUF->icmpchksum = 0;
- ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36);
-
- /* Set the IP destination address to be the source address of the
- original packet. */
- uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
-
- /* Set our IP address as the source address. */
- uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
-
- /* The size of the ICMP destination unreachable packet is 36 + the
- size of the IP header (20) = 56. */
- uip_len = 36 + UIP_IPH_LEN;
- ICMPBUF->len[0] = 0;
- ICMPBUF->len[1] = (u8_t)uip_len;
- ICMPBUF->ttl = UIP_TTL;
- ICMPBUF->proto = UIP_PROTO_ICMP;
-
- goto ip_send_nolen;
-#else /* UIP_CONF_ICMP_DEST_UNREACH */
- goto drop;
-#endif /* UIP_CONF_ICMP_DEST_UNREACH */
-
- udp_found:
- uip_conn = NULL;
- uip_flags = UIP_NEWDATA;
- uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
- uip_slen = 0;
- UIP_UDP_APPCALL();
-
- udp_send:
- if(uip_slen == 0) {
- goto drop;
- }
- uip_len = uip_slen + UIP_IPUDPH_LEN;
-
-#if UIP_CONF_IPV6
- /* For IPv6, the IP length field does not include the IPv6 IP header
- length. */
- BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
- BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
-#else /* UIP_CONF_IPV6 */
- BUF->len[0] = (uip_len >> 8);
- BUF->len[1] = (uip_len & 0xff);
-#endif /* UIP_CONF_IPV6 */
-
- BUF->ttl = uip_udp_conn->ttl;
- BUF->proto = UIP_PROTO_UDP;
-
- UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN);
- UDPBUF->udpchksum = 0;
-
- BUF->srcport = uip_udp_conn->lport;
- BUF->destport = uip_udp_conn->rport;
-
- uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
- uip_ipaddr_copy(&BUF->destipaddr, &uip_udp_conn->ripaddr);
-
- uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN];
-
-#if UIP_UDP_CHECKSUMS
- /* Calculate UDP checksum. */
- UDPBUF->udpchksum = ~(uip_udpchksum());
- if(UDPBUF->udpchksum == 0) {
- UDPBUF->udpchksum = 0xffff;
- }
-#endif /* UIP_UDP_CHECKSUMS */
-
- goto ip_send_nolen;
-#endif /* UIP_UDP */
-
- /* TCP input processing. */
- tcp_input:
- UIP_STAT(++uip_stat.tcp.recv);
-
- /* Start of TCP input header processing code. */
-
- if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP
- checksum. */
- UIP_STAT(++uip_stat.tcp.drop);
- UIP_STAT(++uip_stat.tcp.chkerr);
- UIP_LOG("tcp: bad checksum.");
- goto drop;
- }
-
- /* Demultiplex this segment. */
- /* First check any active connections. */
- for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1];
- ++uip_connr) {
- if(uip_connr->tcpstateflags != UIP_CLOSED &&
- BUF->destport == uip_connr->lport &&
- BUF->srcport == uip_connr->rport &&
- uip_ipaddr_cmp(&BUF->srcipaddr, &uip_connr->ripaddr)) {
- goto found;
- }
- }
-
- /* If we didn't find and active connection that expected the packet,
- either this packet is an old duplicate, or this is a SYN packet
- destined for a connection in LISTEN. If the SYN flag isn't set,
- it is an old packet and we send a RST. */
- if((BUF->flags & TCP_CTL) != TCP_SYN) {
- goto reset;
- }
-
- tmp16 = BUF->destport;
- /* Next, check listening connections. */
- for(c = 0; c < UIP_LISTENPORTS; ++c) {
- if(tmp16 == uip_listenports[c]) {
- goto found_listen;
- }
- }
-
- /* No matching connection found, so we send a RST packet. */
- UIP_STAT(++uip_stat.tcp.synrst);
-
- reset:
- /* We do not send resets in response to resets. */
- if(BUF->flags & TCP_RST) {
- goto drop;
- }
-
- UIP_STAT(++uip_stat.tcp.rst);
-
- BUF->flags = TCP_RST | TCP_ACK;
- uip_len = UIP_IPTCPH_LEN;
- BUF->tcpoffset = 5 << 4;
-
- /* Flip the seqno and ackno fields in the TCP header. */
- c = BUF->seqno[3];
- BUF->seqno[3] = BUF->ackno[3];
- BUF->ackno[3] = c;
-
- c = BUF->seqno[2];
- BUF->seqno[2] = BUF->ackno[2];
- BUF->ackno[2] = c;
-
- c = BUF->seqno[1];
- BUF->seqno[1] = BUF->ackno[1];
- BUF->ackno[1] = c;
-
- c = BUF->seqno[0];
- BUF->seqno[0] = BUF->ackno[0];
- BUF->ackno[0] = c;
-
- /* We also have to increase the sequence number we are
- acknowledging. If the least significant byte overflowed, we need
- to propagate the carry to the other bytes as well. */
- if(++BUF->ackno[3] == 0) {
- if(++BUF->ackno[2] == 0) {
- if(++BUF->ackno[1] == 0) {
- ++BUF->ackno[0];
- }
- }
- }
-
- /* Swap port numbers. */
- tmp16 = BUF->srcport;
- BUF->srcport = BUF->destport;
- BUF->destport = tmp16;
-
- /* Swap IP addresses. */
- uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
- uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
-
- /* And send out the RST packet! */
- goto tcp_send_noconn;
-
- /* This label will be jumped to if we matched the incoming packet
- with a connection in LISTEN. In that case, we should create a new
- connection and send a SYNACK in return. */
- found_listen:
- /* First we check if there are any connections avaliable. Unused
- connections are kept in the same table as used connections, but
- unused ones have the tcpstate set to CLOSED. Also, connections in
- TIME_WAIT are kept track of and we'll use the oldest one if no
- CLOSED connections are found. Thanks to Eddie C. Dost for a very
- nice algorithm for the TIME_WAIT search. */
- uip_connr = 0;
- for(c = 0; c < UIP_CONNS; ++c) {
- if(uip_conns[c].tcpstateflags == UIP_CLOSED) {
- uip_connr = &uip_conns[c];
- break;
- }
- if(uip_conns[c].tcpstateflags == UIP_TIME_WAIT) {
- if(uip_connr == 0 ||
- uip_conns[c].timer > uip_connr->timer) {
- uip_connr = &uip_conns[c];
- }
- }
- }
-
- if(uip_connr == 0) {
- /* All connections are used already, we drop packet and hope that
- the remote end will retransmit the packet at a time when we
- have more spare connections. */
- UIP_STAT(++uip_stat.tcp.syndrop);
- UIP_LOG("tcp: found no unused connections.");
- goto drop;
- }
- uip_conn = uip_connr;
-
- /* Fill in the necessary fields for the new connection. */
- uip_connr->rto = uip_connr->timer = UIP_RTO;
- uip_connr->sa = 0;
- uip_connr->sv = 4;
- uip_connr->nrtx = 0;
- uip_connr->lport = BUF->destport;
- uip_connr->rport = BUF->srcport;
- uip_ipaddr_copy(&uip_connr->ripaddr, &BUF->srcipaddr);
- uip_connr->tcpstateflags = UIP_SYN_RCVD;
-
- uip_connr->snd_nxt[0] = iss[0];
- uip_connr->snd_nxt[1] = iss[1];
- uip_connr->snd_nxt[2] = iss[2];
- uip_connr->snd_nxt[3] = iss[3];
- uip_connr->len = 1;
-
- /* rcv_nxt should be the seqno from the incoming packet + 1. */
- uip_connr->rcv_nxt[3] = BUF->seqno[3];
- uip_connr->rcv_nxt[2] = BUF->seqno[2];
- uip_connr->rcv_nxt[1] = BUF->seqno[1];
- uip_connr->rcv_nxt[0] = BUF->seqno[0];
- uip_add_rcv_nxt(1);
-
- /* Parse the TCP MSS option, if present. */
- if((BUF->tcpoffset & 0xf0) > 0x50) {
- for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {
- opt = uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + c];
- if(opt == TCP_OPT_END) {
- /* End of options. */
- break;
- } else if(opt == TCP_OPT_NOOP) {
- ++c;
- /* NOP option. */
- } else if(opt == TCP_OPT_MSS &&
- uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
- /* An MSS option with the right option length. */
- tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
- (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
- uip_connr->initialmss = uip_connr->mss =
- tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
-
- /* And we are done processing options. */
- break;
- } else {
- /* All other options have a length field, so that we easily
- can skip past them. */
- if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {
- /* If the length field is zero, the options are malformed
- and we don't process them further. */
- break;
- }
- c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];
- }
- }
- }
-
- /* Our response will be a SYNACK. */
-#if UIP_ACTIVE_OPEN
- tcp_send_synack:
- BUF->flags = TCP_ACK;
-
- tcp_send_syn:
- BUF->flags |= TCP_SYN;
-#else /* UIP_ACTIVE_OPEN */
- tcp_send_synack:
- BUF->flags = TCP_SYN | TCP_ACK;
-#endif /* UIP_ACTIVE_OPEN */
-
- /* We send out the TCP Maximum Segment Size option with our
- SYNACK. */
- BUF->optdata[0] = TCP_OPT_MSS;
- BUF->optdata[1] = TCP_OPT_MSS_LEN;
- BUF->optdata[2] = (UIP_TCP_MSS) / 256;
- BUF->optdata[3] = (UIP_TCP_MSS) & 255;
- uip_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN;
- BUF->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4;
- goto tcp_send;
-
- /* This label will be jumped to if we found an active connection. */
- found:
- uip_conn = uip_connr;
- uip_flags = 0;
- /* We do a very naive form of TCP reset processing; we just accept
- any RST and kill our connection. We should in fact check if the
- sequence number of this reset is wihtin our advertised window
- before we accept the reset. */
- if(BUF->flags & TCP_RST) {
- uip_connr->tcpstateflags = UIP_CLOSED;
- UIP_LOG("tcp: got reset, aborting connection.");
- uip_flags = UIP_ABORT;
- UIP_APPCALL();
- goto drop;
- }
- /* Calculate the length of the data, if the application has sent
- any data to us. */
- c = (BUF->tcpoffset >> 4) << 2;
- /* uip_len will contain the length of the actual TCP data. This is
- calculated by subtracing the length of the TCP header (in
- c) and the length of the IP header (20 bytes). */
- uip_len = uip_len - c - UIP_IPH_LEN;
-
- /* First, check if the sequence number of the incoming packet is
- what we're expecting next. If not, we send out an ACK with the
- correct numbers in. */
- if(!(((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) &&
- ((BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)))) {
- if((uip_len > 0 || ((BUF->flags & (TCP_SYN | TCP_FIN)) != 0)) &&
- (BUF->seqno[0] != uip_connr->rcv_nxt[0] ||
- BUF->seqno[1] != uip_connr->rcv_nxt[1] ||
- BUF->seqno[2] != uip_connr->rcv_nxt[2] ||
- BUF->seqno[3] != uip_connr->rcv_nxt[3])) {
- goto tcp_send_ack;
- }
- }
-
- /* Next, check if the incoming segment acknowledges any outstanding
- data. If so, we update the sequence number, reset the length of
- the outstanding data, calculate RTT estimations, and reset the
- retransmission timer. */
- if((BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) {
- uip_add32(uip_connr->snd_nxt, uip_connr->len);
-
- if(BUF->ackno[0] == uip_acc32[0] &&
- BUF->ackno[1] == uip_acc32[1] &&
- BUF->ackno[2] == uip_acc32[2] &&
- BUF->ackno[3] == uip_acc32[3]) {
- /* Update sequence number. */
- uip_connr->snd_nxt[0] = uip_acc32[0];
- uip_connr->snd_nxt[1] = uip_acc32[1];
- uip_connr->snd_nxt[2] = uip_acc32[2];
- uip_connr->snd_nxt[3] = uip_acc32[3];
-
- /* Do RTT estimation, unless we have done retransmissions. */
- if(uip_connr->nrtx == 0) {
- signed char m;
- m = uip_connr->rto - uip_connr->timer;
- /* This is taken directly from VJs original code in his paper */
- m = m - (uip_connr->sa >> 3);
- uip_connr->sa += m;
- if(m < 0) {
- m = -m;
- }
- m = m - (uip_connr->sv >> 2);
- uip_connr->sv += m;
- uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv;
-
- }
- /* Set the acknowledged flag. */
- uip_flags = UIP_ACKDATA;
- /* Reset the retransmission timer. */
- uip_connr->timer = uip_connr->rto;
-
- /* Reset length of outstanding data. */
- uip_connr->len = 0;
- }
-
- }
-
- /* Do different things depending on in what state the connection is. */
- switch(uip_connr->tcpstateflags & UIP_TS_MASK) {
- /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not
- implemented, since we force the application to close when the
- peer sends a FIN (hence the application goes directly from
- ESTABLISHED to LAST_ACK). */
- case UIP_SYN_RCVD:
- /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and
- we are waiting for an ACK that acknowledges the data we sent
- out the last time. Therefore, we want to have the UIP_ACKDATA
- flag set. If so, we enter the ESTABLISHED state. */
- if(uip_flags & UIP_ACKDATA) {
- uip_connr->tcpstateflags = UIP_ESTABLISHED;
- uip_flags = UIP_CONNECTED;
- uip_connr->len = 0;
- if(uip_len > 0) {
- uip_flags |= UIP_NEWDATA;
- uip_add_rcv_nxt(uip_len);
- }
- uip_slen = 0;
- UIP_APPCALL();
- goto appsend;
- }
- goto drop;
-#if UIP_ACTIVE_OPEN
- case UIP_SYN_SENT:
- /* In SYN_SENT, we wait for a SYNACK that is sent in response to
- our SYN. The rcv_nxt is set to sequence number in the SYNACK
- plus one, and we send an ACK. We move into the ESTABLISHED
- state. */
- if((uip_flags & UIP_ACKDATA) &&
- (BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) {
-
- /* Parse the TCP MSS option, if present. */
- if((BUF->tcpoffset & 0xf0) > 0x50) {
- for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {
- opt = uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + c];
- if(opt == TCP_OPT_END) {
- /* End of options. */
- break;
- } else if(opt == TCP_OPT_NOOP) {
- ++c;
- /* NOP option. */
- } else if(opt == TCP_OPT_MSS &&
- uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
- /* An MSS option with the right option length. */
- tmp16 = (uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
- uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 3 + c];
- uip_connr->initialmss =
- uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
-
- /* And we are done processing options. */
- break;
- } else {
- /* All other options have a length field, so that we easily
- can skip past them. */
- if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {
- /* If the length field is zero, the options are malformed
- and we don't process them further. */
- break;
- }
- c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];
- }
- }
- }
- uip_connr->tcpstateflags = UIP_ESTABLISHED;
- uip_connr->rcv_nxt[0] = BUF->seqno[0];
- uip_connr->rcv_nxt[1] = BUF->seqno[1];
- uip_connr->rcv_nxt[2] = BUF->seqno[2];
- uip_connr->rcv_nxt[3] = BUF->seqno[3];
- uip_add_rcv_nxt(1);
- uip_flags = UIP_CONNECTED | UIP_NEWDATA;
- uip_connr->len = 0;
- uip_len = 0;
- uip_slen = 0;
- UIP_APPCALL();
- goto appsend;
- }
- /* Inform the application that the connection failed */
- uip_flags = UIP_ABORT;
- UIP_APPCALL();
- /* The connection is closed after we send the RST */
- uip_conn->tcpstateflags = UIP_CLOSED;
- goto reset;
-#endif /* UIP_ACTIVE_OPEN */
-
- case UIP_ESTABLISHED:
- /* In the ESTABLISHED state, we call upon the application to feed
- data into the uip_buf. If the UIP_ACKDATA flag is set, the
- application should put new data into the buffer, otherwise we are
- retransmitting an old segment, and the application should put that
- data into the buffer.
-
- If the incoming packet is a FIN, we should close the connection on
- this side as well, and we send out a FIN and enter the LAST_ACK
- state. We require that there is no outstanding data; otherwise the
- sequence numbers will be screwed up. */
-
- if(BUF->flags & TCP_FIN && !(uip_connr->tcpstateflags & UIP_STOPPED)) {
- if(uip_outstanding(uip_connr)) {
- goto drop;
- }
- uip_add_rcv_nxt(1 + uip_len);
- uip_flags |= UIP_CLOSE;
- if(uip_len > 0) {
- uip_flags |= UIP_NEWDATA;
- }
- UIP_APPCALL();
- uip_connr->len = 1;
- uip_connr->tcpstateflags = UIP_LAST_ACK;
- uip_connr->nrtx = 0;
- tcp_send_finack:
- BUF->flags = TCP_FIN | TCP_ACK;
- goto tcp_send_nodata;
- }
-
- /* Check the URG flag. If this is set, the segment carries urgent
- data that we must pass to the application. */
- if((BUF->flags & TCP_URG) != 0) {
-#if UIP_URGDATA > 0
- uip_urglen = (BUF->urgp[0] << 8) | BUF->urgp[1];
- if(uip_urglen > uip_len) {
- /* There is more urgent data in the next segment to come. */
- uip_urglen = uip_len;
- }
- uip_add_rcv_nxt(uip_urglen);
- uip_len -= uip_urglen;
- uip_urgdata = uip_appdata;
- uip_appdata += uip_urglen;
- } else {
- uip_urglen = 0;
-#else /* UIP_URGDATA > 0 */
- uip_appdata = ((char *)uip_appdata) + ((BUF->urgp[0] << 8) | BUF->urgp[1]);
- uip_len -= (BUF->urgp[0] << 8) | BUF->urgp[1];
-#endif /* UIP_URGDATA > 0 */
- }
-
- /* If uip_len > 0 we have TCP data in the packet, and we flag this
- by setting the UIP_NEWDATA flag and update the sequence number
- we acknowledge. If the application has stopped the dataflow
- using uip_stop(), we must not accept any data packets from the
- remote host. */
- if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) {
- uip_flags |= UIP_NEWDATA;
- uip_add_rcv_nxt(uip_len);
- }
-
- /* Check if the available buffer space advertised by the other end
- is smaller than the initial MSS for this connection. If so, we
- set the current MSS to the window size to ensure that the
- application does not send more data than the other end can
- handle.
-
- If the remote host advertises a zero window, we set the MSS to
- the initial MSS so that the application will send an entire MSS
- of data. This data will not be acknowledged by the receiver,
- and the application will retransmit it. This is called the
- "persistent timer" and uses the retransmission mechanim.
- */
- tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1];
- if(tmp16 > uip_connr->initialmss ||
- tmp16 == 0) {
- tmp16 = uip_connr->initialmss;
- }
- uip_connr->mss = tmp16;
-
- /* If this packet constitutes an ACK for outstanding data (flagged
- by the UIP_ACKDATA flag, we should call the application since it
- might want to send more data. If the incoming packet had data
- from the peer (as flagged by the UIP_NEWDATA flag), the
- application must also be notified.
-
- When the application is called, the global variable uip_len
- contains the length of the incoming data. The application can
- access the incoming data through the global pointer
- uip_appdata, which usually points UIP_IPTCPH_LEN + UIP_LLH_LEN
- bytes into the uip_buf array.
-
- If the application wishes to send any data, this data should be
- put into the uip_appdata and the length of the data should be
- put into uip_len. If the application don't have any data to
- send, uip_len must be set to 0. */
- if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) {
- uip_slen = 0;
- UIP_APPCALL();
-
- appsend:
-
- if(uip_flags & UIP_ABORT) {
- uip_slen = 0;
- uip_connr->tcpstateflags = UIP_CLOSED;
- BUF->flags = TCP_RST | TCP_ACK;
- goto tcp_send_nodata;
- }
-
- if(uip_flags & UIP_CLOSE) {
- uip_slen = 0;
- uip_connr->len = 1;
- uip_connr->tcpstateflags = UIP_FIN_WAIT_1;
- uip_connr->nrtx = 0;
- BUF->flags = TCP_FIN | TCP_ACK;
- goto tcp_send_nodata;
- }
-
- /* If uip_slen > 0, the application has data to be sent. */
- if(uip_slen > 0) {
-
- /* If the connection has acknowledged data, the contents of
- the ->len variable should be discarded. */
- if((uip_flags & UIP_ACKDATA) != 0) {
- uip_connr->len = 0;
- }
-
- /* If the ->len variable is non-zero the connection has
- already data in transit and cannot send anymore right
- now. */
- if(uip_connr->len == 0) {
-
- /* The application cannot send more than what is allowed by
- the mss (the minumum of the MSS and the available
- window). */
- if(uip_slen > uip_connr->mss) {
- uip_slen = uip_connr->mss;
- }
-
- /* Remember how much data we send out now so that we know
- when everything has been acknowledged. */
- uip_connr->len = uip_slen;
- } else {
-
- /* If the application already had unacknowledged data, we
- make sure that the application does not send (i.e.,
- retransmit) out more than it previously sent out. */
- uip_slen = uip_connr->len;
- }
- }
- uip_connr->nrtx = 0;
- apprexmit:
- uip_appdata = uip_sappdata;
-
- /* If the application has data to be sent, or if the incoming
- packet had new data in it, we must send out a packet. */
- if(uip_slen > 0 && uip_connr->len > 0) {
- /* Add the length of the IP and TCP headers. */
- uip_len = uip_connr->len + UIP_TCPIP_HLEN;
- /* We always set the ACK flag in response packets. */
- BUF->flags = TCP_ACK | TCP_PSH;
- /* Send the packet. */
- goto tcp_send_noopts;
- }
- /* If there is no data to send, just send out a pure ACK if
- there is newdata. */
- if(uip_flags & UIP_NEWDATA) {
- uip_len = UIP_TCPIP_HLEN;
- BUF->flags = TCP_ACK;
- goto tcp_send_noopts;
- }
- }
- goto drop;
- case UIP_LAST_ACK:
- /* We can close this connection if the peer has acknowledged our
- FIN. This is indicated by the UIP_ACKDATA flag. */
- if(uip_flags & UIP_ACKDATA) {
- uip_connr->tcpstateflags = UIP_CLOSED;
- uip_flags = UIP_CLOSE;
- UIP_APPCALL();
- }
- break;
-
- case UIP_FIN_WAIT_1:
- /* The application has closed the connection, but the remote host
- hasn't closed its end yet. Thus we do nothing but wait for a
- FIN from the other side. */
- if(uip_len > 0) {
- uip_add_rcv_nxt(uip_len);
- }
- if(BUF->flags & TCP_FIN) {
- if(uip_flags & UIP_ACKDATA) {
- uip_connr->tcpstateflags = UIP_TIME_WAIT;
- uip_connr->timer = 0;
- uip_connr->len = 0;
- } else {
- uip_connr->tcpstateflags = UIP_CLOSING;
- }
- uip_add_rcv_nxt(1);
- uip_flags = UIP_CLOSE;
- UIP_APPCALL();
- goto tcp_send_ack;
- } else if(uip_flags & UIP_ACKDATA) {
- uip_connr->tcpstateflags = UIP_FIN_WAIT_2;
- uip_connr->len = 0;
- goto drop;
- }
- if(uip_len > 0) {
- goto tcp_send_ack;
- }
- goto drop;
-
- case UIP_FIN_WAIT_2:
- if(uip_len > 0) {
- uip_add_rcv_nxt(uip_len);
- }
- if(BUF->flags & TCP_FIN) {
- uip_connr->tcpstateflags = UIP_TIME_WAIT;
- uip_connr->timer = 0;
- uip_add_rcv_nxt(1);
- uip_flags = UIP_CLOSE;
- UIP_APPCALL();
- goto tcp_send_ack;
- }
- if(uip_len > 0) {
- goto tcp_send_ack;
- }
- goto drop;
-
- case UIP_TIME_WAIT:
- goto tcp_send_ack;
-
- case UIP_CLOSING:
- if(uip_flags & UIP_ACKDATA) {
- uip_connr->tcpstateflags = UIP_TIME_WAIT;
- uip_connr->timer = 0;
- }
- }
- goto drop;
-
- /* We jump here when we are ready to send the packet, and just want
- to set the appropriate TCP sequence numbers in the TCP header. */
- tcp_send_ack:
- BUF->flags = TCP_ACK;
-
- tcp_send_nodata:
- uip_len = UIP_IPTCPH_LEN;
-
- tcp_send_noopts:
- BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4;
-
- /* We're done with the input processing. We are now ready to send a
- reply. Our job is to fill in all the fields of the TCP and IP
- headers before calculating the checksum and finally send the
- packet. */
- tcp_send:
- BUF->ackno[0] = uip_connr->rcv_nxt[0];
- BUF->ackno[1] = uip_connr->rcv_nxt[1];
- BUF->ackno[2] = uip_connr->rcv_nxt[2];
- BUF->ackno[3] = uip_connr->rcv_nxt[3];
-
- BUF->seqno[0] = uip_connr->snd_nxt[0];
- BUF->seqno[1] = uip_connr->snd_nxt[1];
- BUF->seqno[2] = uip_connr->snd_nxt[2];
- BUF->seqno[3] = uip_connr->snd_nxt[3];
-
- BUF->proto = UIP_PROTO_TCP;
-
- BUF->srcport = uip_connr->lport;
- BUF->destport = uip_connr->rport;
-
- uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
- uip_ipaddr_copy(&BUF->destipaddr, &uip_connr->ripaddr);
-
- if(uip_connr->tcpstateflags & UIP_STOPPED) {
- /* If the connection has issued uip_stop(), we advertise a zero
- window so that the remote host will stop sending data. */
- BUF->wnd[0] = BUF->wnd[1] = 0;
- } else {
- BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8);
- BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff);
- }
-
- tcp_send_noconn:
- BUF->ttl = UIP_TTL;
-#if UIP_CONF_IPV6
- /* For IPv6, the IP length field does not include the IPv6 IP header
- length. */
- BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
- BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
-#else /* UIP_CONF_IPV6 */
- BUF->len[0] = (uip_len >> 8);
- BUF->len[1] = (uip_len & 0xff);
-#endif /* UIP_CONF_IPV6 */
-
- BUF->urgp[0] = BUF->urgp[1] = 0;
-
- /* Calculate TCP checksum. */
- BUF->tcpchksum = 0;
- BUF->tcpchksum = ~(uip_tcpchksum());
-
- ip_send_nolen:
-#if UIP_CONF_IPV6
- BUF->vtc = 0x60;
- BUF->tcflow = 0x00;
- BUF->flow = 0x00;
-#else /* UIP_CONF_IPV6 */
- BUF->vhl = 0x45;
- BUF->tos = 0;
- BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
- ++ipid;
- BUF->ipid[0] = ipid >> 8;
- BUF->ipid[1] = ipid & 0xff;
- /* Calculate IP checksum. */
- BUF->ipchksum = 0;
- BUF->ipchksum = ~(uip_ipchksum());
- DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());
-#endif /* UIP_CONF_IPV6 */
- UIP_STAT(++uip_stat.tcp.sent);
-#if UIP_CONF_IPV6
- send:
-#endif /* UIP_CONF_IPV6 */
- DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len,
- (BUF->len[0] << 8) | BUF->len[1]);
-
- UIP_STAT(++uip_stat.ip.sent);
- /* Return and let the caller do the actual transmission. */
- uip_flags = 0;
- return;
-
- drop:
- uip_len = 0;
- uip_flags = 0;
- return;
-}
-/*---------------------------------------------------------------------------*/
-u16_t
-htons(u16_t val)
-{
- return HTONS(val);
-}
-
-u32_t
-htonl(u32_t val)
-{
- return HTONL(val);
-}
-/*---------------------------------------------------------------------------*/
-void
-uip_send(const void *data, int len)
-{
- int copylen;
-#define MIN(a,b) ((a) < (b)? (a): (b))
- copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
- (int)((char *)uip_sappdata - (char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]));
- if(copylen > 0) {
- uip_slen = copylen;
- if(data != uip_sappdata) {
- memcpy(uip_sappdata, (data), uip_slen);
- }
- }
-}
-/*---------------------------------------------------------------------------*/
-/** @} */
-#endif /* UIP_CONF_IPV6 */
+#define DEBUG_PRINTF(...) /*printf(__VA_ARGS__)*/
+
+/**
+ * \addtogroup uip
+ * @{
+ */
+
+/**
+ * \file
+ * The uIP TCP/IP stack code.
+ * \author Adam Dunkels <adam@dunkels.com>
+ */
+
+/*
+ * Copyright (c) 2001-2003, Adam Dunkels.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uip.c,v 1.15 2008/10/15 08:08:32 adamdunkels Exp $
+ *
+ */
+
+/*
+ * uIP is a small implementation of the IP, UDP and TCP protocols (as
+ * well as some basic ICMP stuff). The implementation couples the IP,
+ * UDP, TCP and the application layers very tightly. To keep the size
+ * of the compiled code down, this code frequently uses the goto
+ * statement. While it would be possible to break the uip_process()
+ * function into many smaller functions, this would increase the code
+ * size because of the overhead of parameter passing and the fact that
+ * the optimier would not be as efficient.
+ *
+ * The principle is that we have a small buffer, called the uip_buf,
+ * in which the device driver puts an incoming packet. The TCP/IP
+ * stack parses the headers in the packet, and calls the
+ * application. If the remote host has sent data to the application,
+ * this data is present in the uip_buf and the application read the
+ * data from there. It is up to the application to put this data into
+ * a byte stream if needed. The application will not be fed with data
+ * that is out of sequence.
+ *
+ * If the application whishes to send data to the peer, it should put
+ * its data into the uip_buf. The uip_appdata pointer points to the
+ * first available byte. The TCP/IP stack will calculate the
+ * checksums, and fill in the necessary header fields and finally send
+ * the packet back to the peer.
+*/
+
+#include "uip.h"
+#include "uipopt.h"
+#include "uip_arp.h"
+
+#if !UIP_CONF_IPV6 /* If UIP_CONF_IPV6 is defined, we compile the
+ uip6.c file instead of this one. Therefore
+ this #ifndef removes the entire compilation
+ output of the uip.c file */
+
+
+#if UIP_CONF_IPV6
+#include "net/uip-neighbor.h"
+#endif /* UIP_CONF_IPV6 */
+
+#include <string.h>
+
+/*---------------------------------------------------------------------------*/
+/* Variable definitions. */
+
+
+/* The IP address of this host. If it is defined to be fixed (by
+ setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set
+ here. Otherwise, the address */
+#if UIP_FIXEDADDR > 0
+const uip_ipaddr_t uip_hostaddr =
+ { UIP_IPADDR0, UIP_IPADDR1, UIP_IPADDR2, UIP_IPADDR3 };
+const uip_ipaddr_t uip_draddr =
+ { UIP_DRIPADDR0, UIP_DRIPADDR1, UIP_DRIPADDR2, UIP_DRIPADDR3 };
+const uip_ipaddr_t uip_netmask =
+ { UIP_NETMASK0, UIP_NETMASK1, UIP_NETMASK2, UIP_NETMASK3 };
+#else
+uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;
+#endif /* UIP_FIXEDADDR */
+
+const uip_ipaddr_t uip_broadcast_addr =
+#if UIP_CONF_IPV6
+ { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+#else /* UIP_CONF_IPV6 */
+ { { 0xff, 0xff, 0xff, 0xff } };
+#endif /* UIP_CONF_IPV6 */
+const uip_ipaddr_t uip_all_zeroes_addr = { { 0x0, /* rest is 0 */ } };
+
+#if UIP_FIXEDETHADDR
+const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0,
+ UIP_ETHADDR1,
+ UIP_ETHADDR2,
+ UIP_ETHADDR3,
+ UIP_ETHADDR4,
+ UIP_ETHADDR5}};
+#else
+struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
+#endif
+
+#ifndef UIP_CONF_EXTERNAL_BUFFER
+u8_t uip_buf[UIP_BUFSIZE + 2]; /* The packet buffer that contains
+ incoming packets. */
+#endif /* UIP_CONF_EXTERNAL_BUFFER */
+
+void *uip_appdata; /* The uip_appdata pointer points to
+ application data. */
+void *uip_sappdata; /* The uip_appdata pointer points to
+ the application data which is to
+ be sent. */
+#if UIP_URGDATA > 0
+void *uip_urgdata; /* The uip_urgdata pointer points to
+ urgent data (out-of-band data), if
+ present. */
+u16_t uip_urglen, uip_surglen;
+#endif /* UIP_URGDATA > 0 */
+
+u16_t uip_len, uip_slen;
+ /* The uip_len is either 8 or 16 bits,
+ depending on the maximum packet
+ size. */
+
+u8_t uip_flags; /* The uip_flags variable is used for
+ communication between the TCP/IP stack
+ and the application program. */
+struct uip_conn *uip_conn; /* uip_conn always points to the current
+ connection. */
+
+struct uip_conn uip_conns[UIP_CONNS];
+ /* The uip_conns array holds all TCP
+ connections. */
+u16_t uip_listenports[UIP_LISTENPORTS];
+ /* The uip_listenports list all currently
+ listning ports. */
+#if UIP_UDP
+struct uip_udp_conn *uip_udp_conn;
+struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
+#endif /* UIP_UDP */
+
+static u16_t ipid; /* Ths ipid variable is an increasing
+ number that is used for the IP ID
+ field. */
+
+void uip_setipid(u16_t id) { ipid = id; }
+
+static u8_t iss[4]; /* The iss variable is used for the TCP
+ initial sequence number. */
+
+#if UIP_ACTIVE_OPEN
+static u16_t lastport; /* Keeps track of the last port used for
+ a new connection. */
+#endif /* UIP_ACTIVE_OPEN */
+
+/* Temporary variables. */
+u8_t uip_acc32[4];
+static u8_t c, opt;
+static u16_t tmp16;
+
+/* Structures and definitions. */
+#define TCP_FIN 0x01
+#define TCP_SYN 0x02
+#define TCP_RST 0x04
+#define TCP_PSH 0x08
+#define TCP_ACK 0x10
+#define TCP_URG 0x20
+#define TCP_CTL 0x3f
+
+#define TCP_OPT_END 0 /* End of TCP options list */
+#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */
+#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */
+
+#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */
+
+#define ICMP_ECHO_REPLY 0
+#define ICMP_ECHO 8
+
+#define ICMP_DEST_UNREACHABLE 3
+#define ICMP_PORT_UNREACHABLE 3
+
+#define ICMP6_ECHO_REPLY 129
+#define ICMP6_ECHO 128
+#define ICMP6_NEIGHBOR_SOLICITATION 135
+#define ICMP6_NEIGHBOR_ADVERTISEMENT 136
+
+#define ICMP6_FLAG_S (1 << 6)
+
+#define ICMP6_OPTION_SOURCE_LINK_ADDRESS 1
+#define ICMP6_OPTION_TARGET_LINK_ADDRESS 2
+
+
+/* Macros. */
+#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
+#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0])
+#define ICMPBUF ((struct uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
+#define UDPBUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
+
+
+#if UIP_STATISTICS == 1
+struct uip_stats uip_stat;
+#define UIP_STAT(s) s
+#else
+#define UIP_STAT(s)
+#endif /* UIP_STATISTICS == 1 */
+
+#if UIP_LOGGING == 1
+#include <stdio.h>
+void uip_log(char *msg);
+#define UIP_LOG(m) uip_log(m)
+#else
+#define UIP_LOG(m)
+#endif /* UIP_LOGGING == 1 */
+
+#if ! UIP_ARCH_ADD32
+void
+uip_add32(u8_t *op32, u16_t op16)
+{
+ uip_acc32[3] = op32[3] + (op16 & 0xff);
+ uip_acc32[2] = op32[2] + (op16 >> 8);
+ uip_acc32[1] = op32[1];
+ uip_acc32[0] = op32[0];
+
+ if(uip_acc32[2] < (op16 >> 8)) {
+ ++uip_acc32[1];
+ if(uip_acc32[1] == 0) {
+ ++uip_acc32[0];
+ }
+ }
+
+
+ if(uip_acc32[3] < (op16 & 0xff)) {
+ ++uip_acc32[2];
+ if(uip_acc32[2] == 0) {
+ ++uip_acc32[1];
+ if(uip_acc32[1] == 0) {
+ ++uip_acc32[0];
+ }
+ }
+ }
+}
+
+#endif /* UIP_ARCH_ADD32 */
+
+#if ! UIP_ARCH_CHKSUM
+/*---------------------------------------------------------------------------*/
+static u16_t
+chksum(u16_t sum, const u8_t *data, u16_t len)
+{
+ u16_t t;
+ const u8_t *dataptr;
+ const u8_t *last_byte;
+
+ dataptr = data;
+ last_byte = data + len - 1;
+
+ while(dataptr < last_byte) { /* At least two more bytes */
+ t = (dataptr[0] << 8) + dataptr[1];
+ sum += t;
+ if(sum < t) {
+ sum++; /* carry */
+ }
+ dataptr += 2;
+ }
+
+ if(dataptr == last_byte) {
+ t = (dataptr[0] << 8) + 0;
+ sum += t;
+ if(sum < t) {
+ sum++; /* carry */
+ }
+ }
+
+ /* Return sum in host byte order. */
+ return sum;
+}
+/*---------------------------------------------------------------------------*/
+u16_t
+uip_chksum(u16_t *data, u16_t len)
+{
+ return htons(chksum(0, (u8_t *)data, len));
+}
+/*---------------------------------------------------------------------------*/
+#ifndef UIP_ARCH_IPCHKSUM
+u16_t
+uip_ipchksum(void)
+{
+ u16_t sum;
+
+ sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
+ DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
+ return (sum == 0) ? 0xffff : htons(sum);
+}
+#endif
+/*---------------------------------------------------------------------------*/
+static u16_t
+upper_layer_chksum(u8_t proto)
+{
+ u16_t upper_layer_len;
+ u16_t sum;
+
+#if UIP_CONF_IPV6
+ upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]);
+#else /* UIP_CONF_IPV6 */
+ upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
+#endif /* UIP_CONF_IPV6 */
+
+ /* First sum pseudoheader. */
+
+ /* IP protocol and length fields. This addition cannot carry. */
+ sum = upper_layer_len + proto;
+ /* Sum IP source and destination addresses. */
+ sum = chksum(sum, (u8_t *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t));
+
+ /* Sum TCP header and data. */
+ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
+ upper_layer_len);
+
+ return (sum == 0) ? 0xffff : htons(sum);
+}
+/*---------------------------------------------------------------------------*/
+#if UIP_CONF_IPV6
+u16_t
+uip_icmp6chksum(void)
+{
+ return upper_layer_chksum(UIP_PROTO_ICMP6);
+
+}
+#endif /* UIP_CONF_IPV6 */
+/*---------------------------------------------------------------------------*/
+u16_t
+uip_tcpchksum(void)
+{
+ return upper_layer_chksum(UIP_PROTO_TCP);
+}
+/*---------------------------------------------------------------------------*/
+#if UIP_UDP_CHECKSUMS
+u16_t
+uip_udpchksum(void)
+{
+ return upper_layer_chksum(UIP_PROTO_UDP);
+}
+#endif /* UIP_UDP_CHECKSUMS */
+#endif /* UIP_ARCH_CHKSUM */
+/*---------------------------------------------------------------------------*/
+void
+uip_init(void)
+{
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {
+ uip_listenports[c] = 0;
+ }
+ for(c = 0; c < UIP_CONNS; ++c) {
+ uip_conns[c].tcpstateflags = UIP_CLOSED;
+ }
+#if UIP_ACTIVE_OPEN
+ lastport = 1024;
+#endif /* UIP_ACTIVE_OPEN */
+
+#if UIP_UDP
+ for(c = 0; c < UIP_UDP_CONNS; ++c) {
+ uip_udp_conns[c].lport = 0;
+ }
+#endif /* UIP_UDP */
+
+
+ /* IPv4 initialization. */
+#if UIP_FIXEDADDR == 0
+ /* uip_hostaddr[0] = uip_hostaddr[1] = 0;*/
+#endif /* UIP_FIXEDADDR */
+
+}
+/*---------------------------------------------------------------------------*/
+#if UIP_ACTIVE_OPEN
+struct uip_conn *
+uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
+{
+ register struct uip_conn *conn, *cconn;
+
+ /* Find an unused local port. */
+ again:
+ ++lastport;
+
+ if(lastport >= 32000) {
+ lastport = 4096;
+ }
+
+ /* Check if this port is already in use, and if so try to find
+ another one. */
+ for(c = 0; c < UIP_CONNS; ++c) {
+ conn = &uip_conns[c];
+ if(conn->tcpstateflags != UIP_CLOSED &&
+ conn->lport == htons(lastport)) {
+ goto again;
+ }
+ }
+
+ conn = 0;
+ for(c = 0; c < UIP_CONNS; ++c) {
+ cconn = &uip_conns[c];
+ if(cconn->tcpstateflags == UIP_CLOSED) {
+ conn = cconn;
+ break;
+ }
+ if(cconn->tcpstateflags == UIP_TIME_WAIT) {
+ if(conn == 0 ||
+ cconn->timer > conn->timer) {
+ conn = cconn;
+ }
+ }
+ }
+
+ if(conn == 0) {
+ return 0;
+ }
+
+ conn->tcpstateflags = UIP_SYN_SENT;
+
+ conn->snd_nxt[0] = iss[0];
+ conn->snd_nxt[1] = iss[1];
+ conn->snd_nxt[2] = iss[2];
+ conn->snd_nxt[3] = iss[3];
+
+ conn->initialmss = conn->mss = UIP_TCP_MSS;
+
+ conn->len = 1; /* TCP length of the SYN is one. */
+ conn->nrtx = 0;
+ conn->timer = 1; /* Send the SYN next time around. */
+ conn->rto = UIP_RTO;
+ conn->sa = 0;
+ conn->sv = 16; /* Initial value of the RTT variance. */
+ conn->lport = htons(lastport);
+ conn->rport = rport;
+ uip_ipaddr_copy(&conn->ripaddr, ripaddr);
+
+ return conn;
+}
+#endif /* UIP_ACTIVE_OPEN */
+/*---------------------------------------------------------------------------*/
+#if UIP_UDP
+struct uip_udp_conn *
+uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
+{
+ register struct uip_udp_conn *conn;
+
+ /* Find an unused local port. */
+ again:
+ ++lastport;
+
+ if(lastport >= 32000) {
+ lastport = 4096;
+ }
+
+ for(c = 0; c < UIP_UDP_CONNS; ++c) {
+ if(uip_udp_conns[c].lport == htons(lastport)) {
+ goto again;
+ }
+ }
+
+
+ conn = 0;
+ for(c = 0; c < UIP_UDP_CONNS; ++c) {
+ if(uip_udp_conns[c].lport == 0) {
+ conn = &uip_udp_conns[c];
+ break;
+ }
+ }
+
+ if(conn == 0) {
+ return 0;
+ }
+
+ conn->lport = HTONS(lastport);
+ conn->rport = rport;
+ if(ripaddr == NULL) {
+ memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
+ } else {
+ uip_ipaddr_copy(&conn->ripaddr, ripaddr);
+ }
+ conn->ttl = UIP_TTL;
+
+ return conn;
+}
+#endif /* UIP_UDP */
+/*---------------------------------------------------------------------------*/
+void
+uip_unlisten(u16_t port)
+{
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {
+ if(uip_listenports[c] == port) {
+ uip_listenports[c] = 0;
+ return;
+ }
+ }
+}
+/*---------------------------------------------------------------------------*/
+void
+uip_listen(u16_t port)
+{
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {
+ if(uip_listenports[c] == 0) {
+ uip_listenports[c] = port;
+ return;
+ }
+ }
+}
+/*---------------------------------------------------------------------------*/
+/* XXX: IP fragment reassembly: not well-tested. */
+
+#if UIP_REASSEMBLY && !UIP_CONF_IPV6
+#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)
+static u8_t uip_reassbuf[UIP_REASS_BUFSIZE];
+static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
+static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
+ 0x0f, 0x07, 0x03, 0x01};
+static u16_t uip_reasslen;
+static u8_t uip_reassflags;
+#define UIP_REASS_FLAG_LASTFRAG 0x01
+static u8_t uip_reasstmr;
+
+#define IP_MF 0x20
+
+static u8_t
+uip_reass(void)
+{
+ u16_t offset, len;
+ u16_t i;
+
+ /* If ip_reasstmr is zero, no packet is present in the buffer, so we
+ write the IP header of the fragment into the reassembly
+ buffer. The timer is updated with the maximum age. */
+ if(uip_reasstmr == 0) {
+ memcpy(uip_reassbuf, &BUF->vhl, UIP_IPH_LEN);
+ uip_reasstmr = UIP_REASS_MAXAGE;
+ uip_reassflags = 0;
+ /* Clear the bitmap. */
+ memset(uip_reassbitmap, 0, sizeof(uip_reassbitmap));
+ }
+
+ /* Check if the incoming fragment matches the one currently present
+ in the reasembly buffer. If so, we proceed with copying the
+ fragment into the buffer. */
+ if(BUF->srcipaddr[0] == FBUF->srcipaddr[0] &&
+ BUF->srcipaddr[1] == FBUF->srcipaddr[1] &&
+ BUF->destipaddr[0] == FBUF->destipaddr[0] &&
+ BUF->destipaddr[1] == FBUF->destipaddr[1] &&
+ BUF->ipid[0] == FBUF->ipid[0] &&
+ BUF->ipid[1] == FBUF->ipid[1]) {
+
+ len = (BUF->len[0] << 8) + BUF->len[1] - (BUF->vhl & 0x0f) * 4;
+ offset = (((BUF->ipoffset[0] & 0x3f) << 8) + BUF->ipoffset[1]) * 8;
+
+ /* If the offset or the offset + fragment length overflows the
+ reassembly buffer, we discard the entire packet. */
+ if(offset > UIP_REASS_BUFSIZE ||
+ offset + len > UIP_REASS_BUFSIZE) {
+ uip_reasstmr = 0;
+ goto nullreturn;
+ }
+
+ /* Copy the fragment into the reassembly buffer, at the right
+ offset. */
+ memcpy(&uip_reassbuf[UIP_IPH_LEN + offset],
+ (char *)BUF + (int)((BUF->vhl & 0x0f) * 4),
+ len);
+
+ /* Update the bitmap. */
+ if(offset / (8 * 8) == (offset + len) / (8 * 8)) {
+ /* If the two endpoints are in the same byte, we only update
+ that byte. */
+
+ uip_reassbitmap[offset / (8 * 8)] |=
+ bitmap_bits[(offset / 8 ) & 7] &
+ ~bitmap_bits[((offset + len) / 8 ) & 7];
+ } else {
+ /* If the two endpoints are in different bytes, we update the
+ bytes in the endpoints and fill the stuff inbetween with
+ 0xff. */
+ uip_reassbitmap[offset / (8 * 8)] |=
+ bitmap_bits[(offset / 8 ) & 7];
+ for(i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) {
+ uip_reassbitmap[i] = 0xff;
+ }
+ uip_reassbitmap[(offset + len) / (8 * 8)] |=
+ ~bitmap_bits[((offset + len) / 8 ) & 7];
+ }
+
+ /* If this fragment has the More Fragments flag set to zero, we
+ know that this is the last fragment, so we can calculate the
+ size of the entire packet. We also set the
+ IP_REASS_FLAG_LASTFRAG flag to indicate that we have received
+ the final fragment. */
+
+ if((BUF->ipoffset[0] & IP_MF) == 0) {
+ uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
+ uip_reasslen = offset + len;
+ }
+
+ /* Finally, we check if we have a full packet in the buffer. We do
+ this by checking if we have the last fragment and if all bits
+ in the bitmap are set. */
+ if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) {
+ /* Check all bytes up to and including all but the last byte in
+ the bitmap. */
+ for(i = 0; i < uip_reasslen / (8 * 8) - 1; ++i) {
+ if(uip_reassbitmap[i] != 0xff) {
+ goto nullreturn;
+ }
+ }
+ /* Check the last byte in the bitmap. It should contain just the
+ right amount of bits. */
+ if(uip_reassbitmap[uip_reasslen / (8 * 8)] !=
+ (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) {
+ goto nullreturn;
+ }
+
+ /* If we have come this far, we have a full packet in the
+ buffer, so we allocate a pbuf and copy the packet into it. We
+ also reset the timer. */
+ uip_reasstmr = 0;
+ memcpy(BUF, FBUF, uip_reasslen);
+
+ /* Pretend to be a "normal" (i.e., not fragmented) IP packet
+ from now on. */
+ BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
+ BUF->len[0] = uip_reasslen >> 8;
+ BUF->len[1] = uip_reasslen & 0xff;
+ BUF->ipchksum = 0;
+ BUF->ipchksum = ~(uip_ipchksum());
+
+ return uip_reasslen;
+ }
+ }
+
+ nullreturn:
+ return 0;
+}
+#endif /* UIP_REASSEMBLY */
+/*---------------------------------------------------------------------------*/
+static void
+uip_add_rcv_nxt(u16_t n)
+{
+ uip_add32(uip_conn->rcv_nxt, n);
+ uip_conn->rcv_nxt[0] = uip_acc32[0];
+ uip_conn->rcv_nxt[1] = uip_acc32[1];
+ uip_conn->rcv_nxt[2] = uip_acc32[2];
+ uip_conn->rcv_nxt[3] = uip_acc32[3];
+}
+/*---------------------------------------------------------------------------*/
+void
+uip_process(u8_t flag)
+{
+ register struct uip_conn *uip_connr = uip_conn;
+
+#if UIP_UDP
+ if(flag == UIP_UDP_SEND_CONN) {
+ goto udp_send;
+ }
+#endif /* UIP_UDP */
+
+ uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
+
+ /* Check if we were invoked because of a poll request for a
+ particular connection. */
+ if(flag == UIP_POLL_REQUEST) {
+ if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED &&
+ !uip_outstanding(uip_connr)) {
+ uip_len = uip_slen = 0;
+ uip_flags = UIP_POLL;
+ UIP_APPCALL();
+ goto appsend;
+ }
+ goto drop;
+
+ /* Check if we were invoked because of the perodic timer fireing. */
+ } else if(flag == UIP_TIMER) {
+#if UIP_REASSEMBLY
+ if(uip_reasstmr != 0) {
+ --uip_reasstmr;
+ }
+#endif /* UIP_REASSEMBLY */
+ /* Increase the initial sequence number. */
+ if(++iss[3] == 0) {
+ if(++iss[2] == 0) {
+ if(++iss[1] == 0) {
+ ++iss[0];
+ }
+ }
+ }
+
+ /* Reset the length variables. */
+ uip_len = 0;
+ uip_slen = 0;
+
+ /* Check if the connection is in a state in which we simply wait
+ for the connection to time out. If so, we increase the
+ connection's timer and remove the connection if it times
+ out. */
+ if(uip_connr->tcpstateflags == UIP_TIME_WAIT ||
+ uip_connr->tcpstateflags == UIP_FIN_WAIT_2) {
+ ++(uip_connr->timer);
+ if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) {
+ uip_connr->tcpstateflags = UIP_CLOSED;
+ }
+ } else if(uip_connr->tcpstateflags != UIP_CLOSED) {
+ /* If the connection has outstanding data, we increase the
+ connection's timer and see if it has reached the RTO value
+ in which case we retransmit. */
+ if(uip_outstanding(uip_connr)) {
+ if(uip_connr->timer-- == 0) {
+ if(uip_connr->nrtx == UIP_MAXRTX ||
+ ((uip_connr->tcpstateflags == UIP_SYN_SENT ||
+ uip_connr->tcpstateflags == UIP_SYN_RCVD) &&
+ uip_connr->nrtx == UIP_MAXSYNRTX)) {
+ uip_connr->tcpstateflags = UIP_CLOSED;
+
+ /* We call UIP_APPCALL() with uip_flags set to
+ UIP_TIMEDOUT to inform the application that the
+ connection has timed out. */
+ uip_flags = UIP_TIMEDOUT;
+ UIP_APPCALL();
+
+ /* We also send a reset packet to the remote host. */
+ BUF->flags = TCP_RST | TCP_ACK;
+ goto tcp_send_nodata;
+ }
+
+ /* Exponential backoff. */
+ uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4?
+ 4:
+ uip_connr->nrtx);
+ ++(uip_connr->nrtx);
+
+ /* Ok, so we need to retransmit. We do this differently
+ depending on which state we are in. In ESTABLISHED, we
+ call upon the application so that it may prepare the
+ data for the retransmit. In SYN_RCVD, we resend the
+ SYNACK that we sent earlier and in LAST_ACK we have to
+ retransmit our FINACK. */
+ UIP_STAT(++uip_stat.tcp.rexmit);
+ switch(uip_connr->tcpstateflags & UIP_TS_MASK) {
+ case UIP_SYN_RCVD:
+ /* In the SYN_RCVD state, we should retransmit our
+ SYNACK. */
+ goto tcp_send_synack;
+
+#if UIP_ACTIVE_OPEN
+ case UIP_SYN_SENT:
+ /* In the SYN_SENT state, we retransmit out SYN. */
+ BUF->flags = 0;
+ goto tcp_send_syn;
+#endif /* UIP_ACTIVE_OPEN */
+
+ case UIP_ESTABLISHED:
+ /* In the ESTABLISHED state, we call upon the application
+ to do the actual retransmit after which we jump into
+ the code for sending out the packet (the apprexmit
+ label). */
+ uip_flags = UIP_REXMIT;
+ UIP_APPCALL();
+ goto apprexmit;
+
+ case UIP_FIN_WAIT_1:
+ case UIP_CLOSING:
+ case UIP_LAST_ACK:
+ /* In all these states we should retransmit a FINACK. */
+ goto tcp_send_finack;
+
+ }
+ }
+ } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) {
+ /* If there was no need for a retransmission, we poll the
+ application for new data. */
+ uip_len = uip_slen = 0;
+ uip_flags = UIP_POLL;
+ UIP_APPCALL();
+ goto appsend;
+ }
+ }
+ goto drop;
+ }
+#if UIP_UDP
+ if(flag == UIP_UDP_TIMER) {
+ if(uip_udp_conn->lport != 0) {
+ uip_conn = NULL;
+ uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
+ uip_len = uip_slen = 0;
+ uip_flags = UIP_POLL;
+ UIP_UDP_APPCALL();
+ goto udp_send;
+ } else {
+ goto drop;
+ }
+ }
+#endif
+
+ /* This is where the input processing starts. */
+ UIP_STAT(++uip_stat.ip.recv);
+
+ /* Start of IP input header processing code. */
+
+#if UIP_CONF_IPV6
+ /* Check validity of the IP header. */
+ if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */
+ UIP_STAT(++uip_stat.ip.drop);
+ UIP_STAT(++uip_stat.ip.vhlerr);
+ UIP_LOG("ipv6: invalid version.");
+ goto drop;
+ }
+#else /* UIP_CONF_IPV6 */
+ /* Check validity of the IP header. */
+ if(BUF->vhl != 0x45) { /* IP version and header length. */
+ UIP_STAT(++uip_stat.ip.drop);
+ UIP_STAT(++uip_stat.ip.vhlerr);
+ UIP_LOG("ip: invalid version or header length.");
+ goto drop;
+ }
+#endif /* UIP_CONF_IPV6 */
+
+ /* Check the size of the packet. If the size reported to us in
+ uip_len is smaller the size reported in the IP header, we assume
+ that the packet has been corrupted in transit. If the size of
+ uip_len is larger than the size reported in the IP packet header,
+ the packet has been padded and we set uip_len to the correct
+ value.. */
+
+ if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) {
+ uip_len = (BUF->len[0] << 8) + BUF->len[1];
+#if UIP_CONF_IPV6
+ uip_len += 40; /* The length reported in the IPv6 header is the
+ length of the payload that follows the
+ header. However, uIP uses the uip_len variable
+ for holding the size of the entire packet,
+ including the IP header. For IPv4 this is not a
+ problem as the length field in the IPv4 header
+ contains the length of the entire packet. But
+ for IPv6 we need to add the size of the IPv6
+ header (40 bytes). */
+#endif /* UIP_CONF_IPV6 */
+ } else {
+ UIP_LOG("ip: packet shorter than reported in IP header.");
+ goto drop;
+ }
+
+#if !UIP_CONF_IPV6
+ /* Check the fragment flag. */
+ if((BUF->ipoffset[0] & 0x3f) != 0 ||
+ BUF->ipoffset[1] != 0) {
+#if UIP_REASSEMBLY
+ uip_len = uip_reass();
+ if(uip_len == 0) {
+ goto drop;
+ }
+#else /* UIP_REASSEMBLY */
+ UIP_STAT(++uip_stat.ip.drop);
+ UIP_STAT(++uip_stat.ip.fragerr);
+ UIP_LOG("ip: fragment dropped.");
+ goto drop;
+#endif /* UIP_REASSEMBLY */
+ }
+#endif /* UIP_CONF_IPV6 */
+
+ if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) {
+ /* If we are configured to use ping IP address configuration and
+ hasn't been assigned an IP address yet, we accept all ICMP
+ packets. */
+#if UIP_PINGADDRCONF && !UIP_CONF_IPV6
+ if(BUF->proto == UIP_PROTO_ICMP) {
+ UIP_LOG("ip: possible ping config packet received.");
+ goto icmp_input;
+ } else {
+ UIP_LOG("ip: packet dropped since no address assigned.");
+ goto drop;
+ }
+#endif /* UIP_PINGADDRCONF */
+
+ } else {
+ /* If IP broadcast support is configured, we check for a broadcast
+ UDP packet, which may be destined to us. */
+#if UIP_BROADCAST
+ DEBUG_PRINTF("UDP IP checksum 0x%04x\n", uip_ipchksum());
+ if(BUF->proto == UIP_PROTO_UDP &&
+ uip_ipaddr_cmp(&BUF->destipaddr, &uip_broadcast_addr)
+ /*&&
+ uip_ipchksum() == 0xffff*/) {
+ goto udp_input;
+ }
+#endif /* UIP_BROADCAST */
+
+ /* Check if the packet is destined for our IP address. */
+#if !UIP_CONF_IPV6
+ if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) {
+ UIP_STAT(++uip_stat.ip.drop);
+ goto drop;
+ }
+#else /* UIP_CONF_IPV6 */
+ /* For IPv6, packet reception is a little trickier as we need to
+ make sure that we listen to certain multicast addresses (all
+ hosts multicast address, and the solicited-node multicast
+ address) as well. However, we will cheat here and accept all
+ multicast packets that are sent to the ff02::/16 addresses. */
+ if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr) &&
+ BUF->destipaddr.u16[0] != HTONS(0xff02)) {
+ UIP_STAT(++uip_stat.ip.drop);
+ goto drop;
+ }
+#endif /* UIP_CONF_IPV6 */
+ }
+
+#if !UIP_CONF_IPV6
+ if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header
+ checksum. */
+ UIP_STAT(++uip_stat.ip.drop);
+ UIP_STAT(++uip_stat.ip.chkerr);
+ UIP_LOG("ip: bad checksum.");
+ goto drop;
+ }
+#endif /* UIP_CONF_IPV6 */
+
+ if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so,
+ proceed with TCP input
+ processing. */
+ goto tcp_input;
+ }
+
+#if UIP_UDP
+ if(BUF->proto == UIP_PROTO_UDP) {
+ goto udp_input;
+ }
+#endif /* UIP_UDP */
+
+#if !UIP_CONF_IPV6
+ /* ICMPv4 processing code follows. */
+ if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from
+ here. */
+ UIP_STAT(++uip_stat.ip.drop);
+ UIP_STAT(++uip_stat.ip.protoerr);
+ UIP_LOG("ip: neither tcp nor icmp.");
+ goto drop;
+ }
+
+#if UIP_PINGADDRCONF
+ icmp_input:
+#endif /* UIP_PINGADDRCONF */
+ UIP_STAT(++uip_stat.icmp.recv);
+
+ /* ICMP echo (i.e., ping) processing. This is simple, we only change
+ the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP
+ checksum before we return the packet. */
+ if(ICMPBUF->type != ICMP_ECHO) {
+ UIP_STAT(++uip_stat.icmp.drop);
+ UIP_STAT(++uip_stat.icmp.typeerr);
+ UIP_LOG("icmp: not icmp echo.");
+ goto drop;
+ }
+
+ /* If we are configured to use ping IP address assignment, we use
+ the destination IP address of this ping packet and assign it to
+ ourself. */
+#if UIP_PINGADDRCONF
+ if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) {
+ uip_hostaddr = BUF->destipaddr;
+ }
+#endif /* UIP_PINGADDRCONF */
+
+ ICMPBUF->type = ICMP_ECHO_REPLY;
+
+ if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {
+ ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;
+ } else {
+ ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);
+ }
+
+ /* Swap IP addresses. */
+ uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
+ uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
+
+ UIP_STAT(++uip_stat.icmp.sent);
+ BUF->ttl = UIP_TTL;
+ goto ip_send_nolen;
+
+ /* End of IPv4 input header processing code. */
+#else /* !UIP_CONF_IPV6 */
+
+ /* This is IPv6 ICMPv6 processing code. */
+ DEBUG_PRINTF("icmp6_input: length %d\n", uip_len);
+
+ if(BUF->proto != UIP_PROTO_ICMP6) { /* We only allow ICMPv6 packets from
+ here. */
+ UIP_STAT(++uip_stat.ip.drop);
+ UIP_STAT(++uip_stat.ip.protoerr);
+ UIP_LOG("ip: neither tcp nor icmp6.");
+ goto drop;
+ }
+
+ UIP_STAT(++uip_stat.icmp.recv);
+
+ /* If we get a neighbor solicitation for our address we should send
+ a neighbor advertisement message back. */
+ if(ICMPBUF->type == ICMP6_NEIGHBOR_SOLICITATION) {
+ if(uip_ipaddr_cmp(&ICMPBUF->icmp6data, &uip_hostaddr)) {
+
+ if(ICMPBUF->options[0] == ICMP6_OPTION_SOURCE_LINK_ADDRESS) {
+ /* Save the sender's address in our neighbor list. */
+ uip_neighbor_add(&ICMPBUF->srcipaddr, &(ICMPBUF->options[2]));
+ }
+
+ /* We should now send a neighbor advertisement back to where the
+ neighbor solicication came from. */
+ ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT;
+ ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */
+
+ ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0;
+
+ uip_ipaddr_copy(&ICMPBUF->destipaddr, &ICMPBUF->srcipaddr);
+ uip_ipaddr_copy(&ICMPBUF->srcipaddr, &uip_hostaddr);
+ ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS;
+ ICMPBUF->options[1] = 1; /* Options length, 1 = 8 bytes. */
+ memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr));
+ ICMPBUF->icmpchksum = 0;
+ ICMPBUF->icmpchksum = ~uip_icmp6chksum();
+
+ goto send;
+
+ }
+ goto drop;
+ } else if(ICMPBUF->type == ICMP6_ECHO) {
+ /* ICMP echo (i.e., ping) processing. This is simple, we only
+ change the ICMP type from ECHO to ECHO_REPLY and update the
+ ICMP checksum before we return the packet. */
+
+ ICMPBUF->type = ICMP6_ECHO_REPLY;
+
+ uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
+ uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
+ ICMPBUF->icmpchksum = 0;
+ ICMPBUF->icmpchksum = ~uip_icmp6chksum();
+
+ UIP_STAT(++uip_stat.icmp.sent);
+ goto send;
+ } else {
+ DEBUG_PRINTF("Unknown icmp6 message type %d\n", ICMPBUF->type);
+ UIP_STAT(++uip_stat.icmp.drop);
+ UIP_STAT(++uip_stat.icmp.typeerr);
+ UIP_LOG("icmp: unknown ICMP message.");
+ goto drop;
+ }
+
+ /* End of IPv6 ICMP processing. */
+
+#endif /* !UIP_CONF_IPV6 */
+
+#if UIP_UDP
+ /* UDP input processing. */
+ udp_input:
+ /* UDP processing is really just a hack. We don't do anything to the
+ UDP/IP headers, but let the UDP application do all the hard
+ work. If the application sets uip_slen, it has a packet to
+ send. */
+#if UIP_UDP_CHECKSUMS
+ uip_len = uip_len - UIP_IPUDPH_LEN;
+ uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
+ if(UDPBUF->udpchksum != 0 && uip_udpchksum() != 0xffff) {
+ UIP_STAT(++uip_stat.udp.drop);
+ UIP_STAT(++uip_stat.udp.chkerr);
+ UIP_LOG("udp: bad checksum.");
+ goto drop;
+ }
+#else /* UIP_UDP_CHECKSUMS */
+ uip_len = uip_len - UIP_IPUDPH_LEN;
+#endif /* UIP_UDP_CHECKSUMS */
+
+ /* Demultiplex this UDP packet between the UDP "connections". */
+ for(uip_udp_conn = &uip_udp_conns[0];
+ uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS];
+ ++uip_udp_conn) {
+ /* If the local UDP port is non-zero, the connection is considered
+ to be used. If so, the local port number is checked against the
+ destination port number in the received packet. If the two port
+ numbers match, the remote port number is checked if the
+ connection is bound to a remote port. Finally, if the
+ connection is bound to a remote IP address, the source IP
+ address of the packet is checked. */
+ if(uip_udp_conn->lport != 0 &&
+ UDPBUF->destport == uip_udp_conn->lport &&
+ (uip_udp_conn->rport == 0 ||
+ UDPBUF->srcport == uip_udp_conn->rport) &&
+ (uip_ipaddr_cmp(&uip_udp_conn->ripaddr, &uip_all_zeroes_addr) ||
+ uip_ipaddr_cmp(&uip_udp_conn->ripaddr, &uip_broadcast_addr) ||
+ uip_ipaddr_cmp(&BUF->srcipaddr, &uip_udp_conn->ripaddr))) {
+ goto udp_found;
+ }
+ }
+ UIP_LOG("udp: no matching connection found");
+#if UIP_CONF_ICMP_DEST_UNREACH && !UIP_CONF_IPV6
+ /* Copy fields from packet header into payload of this ICMP packet. */
+ memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8);
+
+ /* Set the ICMP type and code. */
+ ICMPBUF->type = ICMP_DEST_UNREACHABLE;
+ ICMPBUF->icode = ICMP_PORT_UNREACHABLE;
+
+ /* Calculate the ICMP checksum. */
+ ICMPBUF->icmpchksum = 0;
+ ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36);
+
+ /* Set the IP destination address to be the source address of the
+ original packet. */
+ uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
+
+ /* Set our IP address as the source address. */
+ uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
+
+ /* The size of the ICMP destination unreachable packet is 36 + the
+ size of the IP header (20) = 56. */
+ uip_len = 36 + UIP_IPH_LEN;
+ ICMPBUF->len[0] = 0;
+ ICMPBUF->len[1] = (u8_t)uip_len;
+ ICMPBUF->ttl = UIP_TTL;
+ ICMPBUF->proto = UIP_PROTO_ICMP;
+
+ goto ip_send_nolen;
+#else /* UIP_CONF_ICMP_DEST_UNREACH */
+ goto drop;
+#endif /* UIP_CONF_ICMP_DEST_UNREACH */
+
+ udp_found:
+ uip_conn = NULL;
+ uip_flags = UIP_NEWDATA;
+ uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
+ uip_slen = 0;
+ UIP_UDP_APPCALL();
+
+ udp_send:
+ if(uip_slen == 0) {
+ goto drop;
+ }
+ uip_len = uip_slen + UIP_IPUDPH_LEN;
+
+#if UIP_CONF_IPV6
+ /* For IPv6, the IP length field does not include the IPv6 IP header
+ length. */
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
+#else /* UIP_CONF_IPV6 */
+ BUF->len[0] = (uip_len >> 8);
+ BUF->len[1] = (uip_len & 0xff);
+#endif /* UIP_CONF_IPV6 */
+
+ BUF->ttl = uip_udp_conn->ttl;
+ BUF->proto = UIP_PROTO_UDP;
+
+ UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN);
+ UDPBUF->udpchksum = 0;
+
+ BUF->srcport = uip_udp_conn->lport;
+ BUF->destport = uip_udp_conn->rport;
+
+ uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
+ uip_ipaddr_copy(&BUF->destipaddr, &uip_udp_conn->ripaddr);
+
+ uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN];
+
+#if UIP_UDP_CHECKSUMS
+ /* Calculate UDP checksum. */
+ UDPBUF->udpchksum = ~(uip_udpchksum());
+ if(UDPBUF->udpchksum == 0) {
+ UDPBUF->udpchksum = 0xffff;
+ }
+#endif /* UIP_UDP_CHECKSUMS */
+
+ goto ip_send_nolen;
+#endif /* UIP_UDP */
+
+ /* TCP input processing. */
+ tcp_input:
+ UIP_STAT(++uip_stat.tcp.recv);
+
+ /* Start of TCP input header processing code. */
+
+ if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP
+ checksum. */
+ UIP_STAT(++uip_stat.tcp.drop);
+ UIP_STAT(++uip_stat.tcp.chkerr);
+ UIP_LOG("tcp: bad checksum.");
+ goto drop;
+ }
+
+ /* Demultiplex this segment. */
+ /* First check any active connections. */
+ for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1];
+ ++uip_connr) {
+ if(uip_connr->tcpstateflags != UIP_CLOSED &&
+ BUF->destport == uip_connr->lport &&
+ BUF->srcport == uip_connr->rport &&
+ uip_ipaddr_cmp(&BUF->srcipaddr, &uip_connr->ripaddr)) {
+ goto found;
+ }
+ }
+
+ /* If we didn't find and active connection that expected the packet,
+ either this packet is an old duplicate, or this is a SYN packet
+ destined for a connection in LISTEN. If the SYN flag isn't set,
+ it is an old packet and we send a RST. */
+ if((BUF->flags & TCP_CTL) != TCP_SYN) {
+ goto reset;
+ }
+
+ tmp16 = BUF->destport;
+ /* Next, check listening connections. */
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {
+ if(tmp16 == uip_listenports[c]) {
+ goto found_listen;
+ }
+ }
+
+ /* No matching connection found, so we send a RST packet. */
+ UIP_STAT(++uip_stat.tcp.synrst);
+
+ reset:
+ /* We do not send resets in response to resets. */
+ if(BUF->flags & TCP_RST) {
+ goto drop;
+ }
+
+ UIP_STAT(++uip_stat.tcp.rst);
+
+ BUF->flags = TCP_RST | TCP_ACK;
+ uip_len = UIP_IPTCPH_LEN;
+ BUF->tcpoffset = 5 << 4;
+
+ /* Flip the seqno and ackno fields in the TCP header. */
+ c = BUF->seqno[3];
+ BUF->seqno[3] = BUF->ackno[3];
+ BUF->ackno[3] = c;
+
+ c = BUF->seqno[2];
+ BUF->seqno[2] = BUF->ackno[2];
+ BUF->ackno[2] = c;
+
+ c = BUF->seqno[1];
+ BUF->seqno[1] = BUF->ackno[1];
+ BUF->ackno[1] = c;
+
+ c = BUF->seqno[0];
+ BUF->seqno[0] = BUF->ackno[0];
+ BUF->ackno[0] = c;
+
+ /* We also have to increase the sequence number we are
+ acknowledging. If the least significant byte overflowed, we need
+ to propagate the carry to the other bytes as well. */
+ if(++BUF->ackno[3] == 0) {
+ if(++BUF->ackno[2] == 0) {
+ if(++BUF->ackno[1] == 0) {
+ ++BUF->ackno[0];
+ }
+ }
+ }
+
+ /* Swap port numbers. */
+ tmp16 = BUF->srcport;
+ BUF->srcport = BUF->destport;
+ BUF->destport = tmp16;
+
+ /* Swap IP addresses. */
+ uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
+ uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
+
+ /* And send out the RST packet! */
+ goto tcp_send_noconn;
+
+ /* This label will be jumped to if we matched the incoming packet
+ with a connection in LISTEN. In that case, we should create a new
+ connection and send a SYNACK in return. */
+ found_listen:
+ /* First we check if there are any connections avaliable. Unused
+ connections are kept in the same table as used connections, but
+ unused ones have the tcpstate set to CLOSED. Also, connections in
+ TIME_WAIT are kept track of and we'll use the oldest one if no
+ CLOSED connections are found. Thanks to Eddie C. Dost for a very
+ nice algorithm for the TIME_WAIT search. */
+ uip_connr = 0;
+ for(c = 0; c < UIP_CONNS; ++c) {
+ if(uip_conns[c].tcpstateflags == UIP_CLOSED) {
+ uip_connr = &uip_conns[c];
+ break;
+ }
+ if(uip_conns[c].tcpstateflags == UIP_TIME_WAIT) {
+ if(uip_connr == 0 ||
+ uip_conns[c].timer > uip_connr->timer) {
+ uip_connr = &uip_conns[c];
+ }
+ }
+ }
+
+ if(uip_connr == 0) {
+ /* All connections are used already, we drop packet and hope that
+ the remote end will retransmit the packet at a time when we
+ have more spare connections. */
+ UIP_STAT(++uip_stat.tcp.syndrop);
+ UIP_LOG("tcp: found no unused connections.");
+ goto drop;
+ }
+ uip_conn = uip_connr;
+
+ /* Fill in the necessary fields for the new connection. */
+ uip_connr->rto = uip_connr->timer = UIP_RTO;
+ uip_connr->sa = 0;
+ uip_connr->sv = 4;
+ uip_connr->nrtx = 0;
+ uip_connr->lport = BUF->destport;
+ uip_connr->rport = BUF->srcport;
+ uip_ipaddr_copy(&uip_connr->ripaddr, &BUF->srcipaddr);
+ uip_connr->tcpstateflags = UIP_SYN_RCVD;
+
+ uip_connr->snd_nxt[0] = iss[0];
+ uip_connr->snd_nxt[1] = iss[1];
+ uip_connr->snd_nxt[2] = iss[2];
+ uip_connr->snd_nxt[3] = iss[3];
+ uip_connr->len = 1;
+
+ /* rcv_nxt should be the seqno from the incoming packet + 1. */
+ uip_connr->rcv_nxt[3] = BUF->seqno[3];
+ uip_connr->rcv_nxt[2] = BUF->seqno[2];
+ uip_connr->rcv_nxt[1] = BUF->seqno[1];
+ uip_connr->rcv_nxt[0] = BUF->seqno[0];
+ uip_add_rcv_nxt(1);
+
+ /* Parse the TCP MSS option, if present. */
+ if((BUF->tcpoffset & 0xf0) > 0x50) {
+ for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {
+ opt = uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + c];
+ if(opt == TCP_OPT_END) {
+ /* End of options. */
+ break;
+ } else if(opt == TCP_OPT_NOOP) {
+ ++c;
+ /* NOP option. */
+ } else if(opt == TCP_OPT_MSS &&
+ uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
+ /* An MSS option with the right option length. */
+ tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
+ (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
+ uip_connr->initialmss = uip_connr->mss =
+ tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
+
+ /* And we are done processing options. */
+ break;
+ } else {
+ /* All other options have a length field, so that we easily
+ can skip past them. */
+ if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {
+ /* If the length field is zero, the options are malformed
+ and we don't process them further. */
+ break;
+ }
+ c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];
+ }
+ }
+ }
+
+ /* Our response will be a SYNACK. */
+#if UIP_ACTIVE_OPEN
+ tcp_send_synack:
+ BUF->flags = TCP_ACK;
+
+ tcp_send_syn:
+ BUF->flags |= TCP_SYN;
+#else /* UIP_ACTIVE_OPEN */
+ tcp_send_synack:
+ BUF->flags = TCP_SYN | TCP_ACK;
+#endif /* UIP_ACTIVE_OPEN */
+
+ /* We send out the TCP Maximum Segment Size option with our
+ SYNACK. */
+ BUF->optdata[0] = TCP_OPT_MSS;
+ BUF->optdata[1] = TCP_OPT_MSS_LEN;
+ BUF->optdata[2] = (UIP_TCP_MSS) / 256;
+ BUF->optdata[3] = (UIP_TCP_MSS) & 255;
+ uip_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN;
+ BUF->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4;
+ goto tcp_send;
+
+ /* This label will be jumped to if we found an active connection. */
+ found:
+ uip_conn = uip_connr;
+ uip_flags = 0;
+ /* We do a very naive form of TCP reset processing; we just accept
+ any RST and kill our connection. We should in fact check if the
+ sequence number of this reset is wihtin our advertised window
+ before we accept the reset. */
+ if(BUF->flags & TCP_RST) {
+ uip_connr->tcpstateflags = UIP_CLOSED;
+ UIP_LOG("tcp: got reset, aborting connection.");
+ uip_flags = UIP_ABORT;
+ UIP_APPCALL();
+ goto drop;
+ }
+ /* Calculate the length of the data, if the application has sent
+ any data to us. */
+ c = (BUF->tcpoffset >> 4) << 2;
+ /* uip_len will contain the length of the actual TCP data. This is
+ calculated by subtracing the length of the TCP header (in
+ c) and the length of the IP header (20 bytes). */
+ uip_len = uip_len - c - UIP_IPH_LEN;
+
+ /* First, check if the sequence number of the incoming packet is
+ what we're expecting next. If not, we send out an ACK with the
+ correct numbers in. */
+ if(!(((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) &&
+ ((BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)))) {
+ if((uip_len > 0 || ((BUF->flags & (TCP_SYN | TCP_FIN)) != 0)) &&
+ (BUF->seqno[0] != uip_connr->rcv_nxt[0] ||
+ BUF->seqno[1] != uip_connr->rcv_nxt[1] ||
+ BUF->seqno[2] != uip_connr->rcv_nxt[2] ||
+ BUF->seqno[3] != uip_connr->rcv_nxt[3])) {
+ goto tcp_send_ack;
+ }
+ }
+
+ /* Next, check if the incoming segment acknowledges any outstanding
+ data. If so, we update the sequence number, reset the length of
+ the outstanding data, calculate RTT estimations, and reset the
+ retransmission timer. */
+ if((BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) {
+ uip_add32(uip_connr->snd_nxt, uip_connr->len);
+
+ if(BUF->ackno[0] == uip_acc32[0] &&
+ BUF->ackno[1] == uip_acc32[1] &&
+ BUF->ackno[2] == uip_acc32[2] &&
+ BUF->ackno[3] == uip_acc32[3]) {
+ /* Update sequence number. */
+ uip_connr->snd_nxt[0] = uip_acc32[0];
+ uip_connr->snd_nxt[1] = uip_acc32[1];
+ uip_connr->snd_nxt[2] = uip_acc32[2];
+ uip_connr->snd_nxt[3] = uip_acc32[3];
+
+ /* Do RTT estimation, unless we have done retransmissions. */
+ if(uip_connr->nrtx == 0) {
+ signed char m;
+ m = uip_connr->rto - uip_connr->timer;
+ /* This is taken directly from VJs original code in his paper */
+ m = m - (uip_connr->sa >> 3);
+ uip_connr->sa += m;
+ if(m < 0) {
+ m = -m;
+ }
+ m = m - (uip_connr->sv >> 2);
+ uip_connr->sv += m;
+ uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv;
+
+ }
+ /* Set the acknowledged flag. */
+ uip_flags = UIP_ACKDATA;
+ /* Reset the retransmission timer. */
+ uip_connr->timer = uip_connr->rto;
+
+ /* Reset length of outstanding data. */
+ uip_connr->len = 0;
+ }
+
+ }
+
+ /* Do different things depending on in what state the connection is. */
+ switch(uip_connr->tcpstateflags & UIP_TS_MASK) {
+ /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not
+ implemented, since we force the application to close when the
+ peer sends a FIN (hence the application goes directly from
+ ESTABLISHED to LAST_ACK). */
+ case UIP_SYN_RCVD:
+ /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and
+ we are waiting for an ACK that acknowledges the data we sent
+ out the last time. Therefore, we want to have the UIP_ACKDATA
+ flag set. If so, we enter the ESTABLISHED state. */
+ if(uip_flags & UIP_ACKDATA) {
+ uip_connr->tcpstateflags = UIP_ESTABLISHED;
+ uip_flags = UIP_CONNECTED;
+ uip_connr->len = 0;
+ if(uip_len > 0) {
+ uip_flags |= UIP_NEWDATA;
+ uip_add_rcv_nxt(uip_len);
+ }
+ uip_slen = 0;
+ UIP_APPCALL();
+ goto appsend;
+ }
+ goto drop;
+#if UIP_ACTIVE_OPEN
+ case UIP_SYN_SENT:
+ /* In SYN_SENT, we wait for a SYNACK that is sent in response to
+ our SYN. The rcv_nxt is set to sequence number in the SYNACK
+ plus one, and we send an ACK. We move into the ESTABLISHED
+ state. */
+ if((uip_flags & UIP_ACKDATA) &&
+ (BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) {
+
+ /* Parse the TCP MSS option, if present. */
+ if((BUF->tcpoffset & 0xf0) > 0x50) {
+ for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {
+ opt = uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + c];
+ if(opt == TCP_OPT_END) {
+ /* End of options. */
+ break;
+ } else if(opt == TCP_OPT_NOOP) {
+ ++c;
+ /* NOP option. */
+ } else if(opt == TCP_OPT_MSS &&
+ uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
+ /* An MSS option with the right option length. */
+ tmp16 = (uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
+ uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 3 + c];
+ uip_connr->initialmss =
+ uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
+
+ /* And we are done processing options. */
+ break;
+ } else {
+ /* All other options have a length field, so that we easily
+ can skip past them. */
+ if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {
+ /* If the length field is zero, the options are malformed
+ and we don't process them further. */
+ break;
+ }
+ c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];
+ }
+ }
+ }
+ uip_connr->tcpstateflags = UIP_ESTABLISHED;
+ uip_connr->rcv_nxt[0] = BUF->seqno[0];
+ uip_connr->rcv_nxt[1] = BUF->seqno[1];
+ uip_connr->rcv_nxt[2] = BUF->seqno[2];
+ uip_connr->rcv_nxt[3] = BUF->seqno[3];
+ uip_add_rcv_nxt(1);
+ uip_flags = UIP_CONNECTED | UIP_NEWDATA;
+ uip_connr->len = 0;
+ uip_len = 0;
+ uip_slen = 0;
+ UIP_APPCALL();
+ goto appsend;
+ }
+ /* Inform the application that the connection failed */
+ uip_flags = UIP_ABORT;
+ UIP_APPCALL();
+ /* The connection is closed after we send the RST */
+ uip_conn->tcpstateflags = UIP_CLOSED;
+ goto reset;
+#endif /* UIP_ACTIVE_OPEN */
+
+ case UIP_ESTABLISHED:
+ /* In the ESTABLISHED state, we call upon the application to feed
+ data into the uip_buf. If the UIP_ACKDATA flag is set, the
+ application should put new data into the buffer, otherwise we are
+ retransmitting an old segment, and the application should put that
+ data into the buffer.
+
+ If the incoming packet is a FIN, we should close the connection on
+ this side as well, and we send out a FIN and enter the LAST_ACK
+ state. We require that there is no outstanding data; otherwise the
+ sequence numbers will be screwed up. */
+
+ if(BUF->flags & TCP_FIN && !(uip_connr->tcpstateflags & UIP_STOPPED)) {
+ if(uip_outstanding(uip_connr)) {
+ goto drop;
+ }
+ uip_add_rcv_nxt(1 + uip_len);
+ uip_flags |= UIP_CLOSE;
+ if(uip_len > 0) {
+ uip_flags |= UIP_NEWDATA;
+ }
+ UIP_APPCALL();
+ uip_connr->len = 1;
+ uip_connr->tcpstateflags = UIP_LAST_ACK;
+ uip_connr->nrtx = 0;
+ tcp_send_finack:
+ BUF->flags = TCP_FIN | TCP_ACK;
+ goto tcp_send_nodata;
+ }
+
+ /* Check the URG flag. If this is set, the segment carries urgent
+ data that we must pass to the application. */
+ if((BUF->flags & TCP_URG) != 0) {
+#if UIP_URGDATA > 0
+ uip_urglen = (BUF->urgp[0] << 8) | BUF->urgp[1];
+ if(uip_urglen > uip_len) {
+ /* There is more urgent data in the next segment to come. */
+ uip_urglen = uip_len;
+ }
+ uip_add_rcv_nxt(uip_urglen);
+ uip_len -= uip_urglen;
+ uip_urgdata = uip_appdata;
+ uip_appdata += uip_urglen;
+ } else {
+ uip_urglen = 0;
+#else /* UIP_URGDATA > 0 */
+ uip_appdata = ((char *)uip_appdata) + ((BUF->urgp[0] << 8) | BUF->urgp[1]);
+ uip_len -= (BUF->urgp[0] << 8) | BUF->urgp[1];
+#endif /* UIP_URGDATA > 0 */
+ }
+
+ /* If uip_len > 0 we have TCP data in the packet, and we flag this
+ by setting the UIP_NEWDATA flag and update the sequence number
+ we acknowledge. If the application has stopped the dataflow
+ using uip_stop(), we must not accept any data packets from the
+ remote host. */
+ if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) {
+ uip_flags |= UIP_NEWDATA;
+ uip_add_rcv_nxt(uip_len);
+ }
+
+ /* Check if the available buffer space advertised by the other end
+ is smaller than the initial MSS for this connection. If so, we
+ set the current MSS to the window size to ensure that the
+ application does not send more data than the other end can
+ handle.
+
+ If the remote host advertises a zero window, we set the MSS to
+ the initial MSS so that the application will send an entire MSS
+ of data. This data will not be acknowledged by the receiver,
+ and the application will retransmit it. This is called the
+ "persistent timer" and uses the retransmission mechanim.
+ */
+ tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1];
+ if(tmp16 > uip_connr->initialmss ||
+ tmp16 == 0) {
+ tmp16 = uip_connr->initialmss;
+ }
+ uip_connr->mss = tmp16;
+
+ /* If this packet constitutes an ACK for outstanding data (flagged
+ by the UIP_ACKDATA flag, we should call the application since it
+ might want to send more data. If the incoming packet had data
+ from the peer (as flagged by the UIP_NEWDATA flag), the
+ application must also be notified.
+
+ When the application is called, the global variable uip_len
+ contains the length of the incoming data. The application can
+ access the incoming data through the global pointer
+ uip_appdata, which usually points UIP_IPTCPH_LEN + UIP_LLH_LEN
+ bytes into the uip_buf array.
+
+ If the application wishes to send any data, this data should be
+ put into the uip_appdata and the length of the data should be
+ put into uip_len. If the application don't have any data to
+ send, uip_len must be set to 0. */
+ if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) {
+ uip_slen = 0;
+ UIP_APPCALL();
+
+ appsend:
+
+ if(uip_flags & UIP_ABORT) {
+ uip_slen = 0;
+ uip_connr->tcpstateflags = UIP_CLOSED;
+ BUF->flags = TCP_RST | TCP_ACK;
+ goto tcp_send_nodata;
+ }
+
+ if(uip_flags & UIP_CLOSE) {
+ uip_slen = 0;
+ uip_connr->len = 1;
+ uip_connr->tcpstateflags = UIP_FIN_WAIT_1;
+ uip_connr->nrtx = 0;
+ BUF->flags = TCP_FIN | TCP_ACK;
+ goto tcp_send_nodata;
+ }
+
+ /* If uip_slen > 0, the application has data to be sent. */
+ if(uip_slen > 0) {
+
+ /* If the connection has acknowledged data, the contents of
+ the ->len variable should be discarded. */
+ if((uip_flags & UIP_ACKDATA) != 0) {
+ uip_connr->len = 0;
+ }
+
+ /* If the ->len variable is non-zero the connection has
+ already data in transit and cannot send anymore right
+ now. */
+ if(uip_connr->len == 0) {
+
+ /* The application cannot send more than what is allowed by
+ the mss (the minumum of the MSS and the available
+ window). */
+ if(uip_slen > uip_connr->mss) {
+ uip_slen = uip_connr->mss;
+ }
+
+ /* Remember how much data we send out now so that we know
+ when everything has been acknowledged. */
+ uip_connr->len = uip_slen;
+ } else {
+
+ /* If the application already had unacknowledged data, we
+ make sure that the application does not send (i.e.,
+ retransmit) out more than it previously sent out. */
+ uip_slen = uip_connr->len;
+ }
+ }
+ uip_connr->nrtx = 0;
+ apprexmit:
+ uip_appdata = uip_sappdata;
+
+ /* If the application has data to be sent, or if the incoming
+ packet had new data in it, we must send out a packet. */
+ if(uip_slen > 0 && uip_connr->len > 0) {
+ /* Add the length of the IP and TCP headers. */
+ uip_len = uip_connr->len + UIP_TCPIP_HLEN;
+ /* We always set the ACK flag in response packets. */
+ BUF->flags = TCP_ACK | TCP_PSH;
+ /* Send the packet. */
+ goto tcp_send_noopts;
+ }
+ /* If there is no data to send, just send out a pure ACK if
+ there is newdata. */
+ if(uip_flags & UIP_NEWDATA) {
+ uip_len = UIP_TCPIP_HLEN;
+ BUF->flags = TCP_ACK;
+ goto tcp_send_noopts;
+ }
+ }
+ goto drop;
+ case UIP_LAST_ACK:
+ /* We can close this connection if the peer has acknowledged our
+ FIN. This is indicated by the UIP_ACKDATA flag. */
+ if(uip_flags & UIP_ACKDATA) {
+ uip_connr->tcpstateflags = UIP_CLOSED;
+ uip_flags = UIP_CLOSE;
+ UIP_APPCALL();
+ }
+ break;
+
+ case UIP_FIN_WAIT_1:
+ /* The application has closed the connection, but the remote host
+ hasn't closed its end yet. Thus we do nothing but wait for a
+ FIN from the other side. */
+ if(uip_len > 0) {
+ uip_add_rcv_nxt(uip_len);
+ }
+ if(BUF->flags & TCP_FIN) {
+ if(uip_flags & UIP_ACKDATA) {
+ uip_connr->tcpstateflags = UIP_TIME_WAIT;
+ uip_connr->timer = 0;
+ uip_connr->len = 0;
+ } else {
+ uip_connr->tcpstateflags = UIP_CLOSING;
+ }
+ uip_add_rcv_nxt(1);
+ uip_flags = UIP_CLOSE;
+ UIP_APPCALL();
+ goto tcp_send_ack;
+ } else if(uip_flags & UIP_ACKDATA) {
+ uip_connr->tcpstateflags = UIP_FIN_WAIT_2;
+ uip_connr->len = 0;
+ goto drop;
+ }
+ if(uip_len > 0) {
+ goto tcp_send_ack;
+ }
+ goto drop;
+
+ case UIP_FIN_WAIT_2:
+ if(uip_len > 0) {
+ uip_add_rcv_nxt(uip_len);
+ }
+ if(BUF->flags & TCP_FIN) {
+ uip_connr->tcpstateflags = UIP_TIME_WAIT;
+ uip_connr->timer = 0;
+ uip_add_rcv_nxt(1);
+ uip_flags = UIP_CLOSE;
+ UIP_APPCALL();
+ goto tcp_send_ack;
+ }
+ if(uip_len > 0) {
+ goto tcp_send_ack;
+ }
+ goto drop;
+
+ case UIP_TIME_WAIT:
+ goto tcp_send_ack;
+
+ case UIP_CLOSING:
+ if(uip_flags & UIP_ACKDATA) {
+ uip_connr->tcpstateflags = UIP_TIME_WAIT;
+ uip_connr->timer = 0;
+ }
+ }
+ goto drop;
+
+ /* We jump here when we are ready to send the packet, and just want
+ to set the appropriate TCP sequence numbers in the TCP header. */
+ tcp_send_ack:
+ BUF->flags = TCP_ACK;
+
+ tcp_send_nodata:
+ uip_len = UIP_IPTCPH_LEN;
+
+ tcp_send_noopts:
+ BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4;
+
+ /* We're done with the input processing. We are now ready to send a
+ reply. Our job is to fill in all the fields of the TCP and IP
+ headers before calculating the checksum and finally send the
+ packet. */
+ tcp_send:
+ BUF->ackno[0] = uip_connr->rcv_nxt[0];
+ BUF->ackno[1] = uip_connr->rcv_nxt[1];
+ BUF->ackno[2] = uip_connr->rcv_nxt[2];
+ BUF->ackno[3] = uip_connr->rcv_nxt[3];
+
+ BUF->seqno[0] = uip_connr->snd_nxt[0];
+ BUF->seqno[1] = uip_connr->snd_nxt[1];
+ BUF->seqno[2] = uip_connr->snd_nxt[2];
+ BUF->seqno[3] = uip_connr->snd_nxt[3];
+
+ BUF->proto = UIP_PROTO_TCP;
+
+ BUF->srcport = uip_connr->lport;
+ BUF->destport = uip_connr->rport;
+
+ uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
+ uip_ipaddr_copy(&BUF->destipaddr, &uip_connr->ripaddr);
+
+ if(uip_connr->tcpstateflags & UIP_STOPPED) {
+ /* If the connection has issued uip_stop(), we advertise a zero
+ window so that the remote host will stop sending data. */
+ BUF->wnd[0] = BUF->wnd[1] = 0;
+ } else {
+ BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8);
+ BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff);
+ }
+
+ tcp_send_noconn:
+ BUF->ttl = UIP_TTL;
+#if UIP_CONF_IPV6
+ /* For IPv6, the IP length field does not include the IPv6 IP header
+ length. */
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
+#else /* UIP_CONF_IPV6 */
+ BUF->len[0] = (uip_len >> 8);
+ BUF->len[1] = (uip_len & 0xff);
+#endif /* UIP_CONF_IPV6 */
+
+ BUF->urgp[0] = BUF->urgp[1] = 0;
+
+ /* Calculate TCP checksum. */
+ BUF->tcpchksum = 0;
+ BUF->tcpchksum = ~(uip_tcpchksum());
+
+ ip_send_nolen:
+#if UIP_CONF_IPV6
+ BUF->vtc = 0x60;
+ BUF->tcflow = 0x00;
+ BUF->flow = 0x00;
+#else /* UIP_CONF_IPV6 */
+ BUF->vhl = 0x45;
+ BUF->tos = 0;
+ BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
+ ++ipid;
+ BUF->ipid[0] = ipid >> 8;
+ BUF->ipid[1] = ipid & 0xff;
+ /* Calculate IP checksum. */
+ BUF->ipchksum = 0;
+ BUF->ipchksum = ~(uip_ipchksum());
+ DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());
+#endif /* UIP_CONF_IPV6 */
+ UIP_STAT(++uip_stat.tcp.sent);
+#if UIP_CONF_IPV6
+ send:
+#endif /* UIP_CONF_IPV6 */
+ DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len,
+ (BUF->len[0] << 8) | BUF->len[1]);
+
+ UIP_STAT(++uip_stat.ip.sent);
+ /* Return and let the caller do the actual transmission. */
+ uip_flags = 0;
+ return;
+
+ drop:
+ uip_len = 0;
+ uip_flags = 0;
+ return;
+}
+/*---------------------------------------------------------------------------*/
+u16_t
+htons(u16_t val)
+{
+ return HTONS(val);
+}
+
+u32_t
+htonl(u32_t val)
+{
+ return HTONL(val);
+}
+/*---------------------------------------------------------------------------*/
+void
+uip_send(const void *data, int len)
+{
+ int copylen;
+#define MIN(a,b) ((a) < (b)? (a): (b))
+ copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
+ (int)((char *)uip_sappdata - (char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]));
+ if(copylen > 0) {
+ uip_slen = copylen;
+ if(data != uip_sappdata) {
+ memcpy(uip_sappdata, (data), uip_slen);
+ }
+ }
+}
+/*---------------------------------------------------------------------------*/
+/** @} */
+#endif /* UIP_CONF_IPV6 */
diff --git a/Projects/Webserver/Lib/uip/uip.h b/Projects/Webserver/Lib/uip/uip.h
index 3e8504c49..a10699dc1 100644
--- a/Projects/Webserver/Lib/uip/uip.h
+++ b/Projects/Webserver/Lib/uip/uip.h
@@ -1,2129 +1,2129 @@
-
-/**
- * \addtogroup uip
- * @{
- */
-
-/**
- * \file
- * Header file for the uIP TCP/IP stack.
- * \author Adam Dunkels <adam@dunkels.com>
- * \author Julien Abeille <jabeille@cisco.com> (IPv6 related code)
- * \author Mathilde Durvy <mdurvy@cisco.com> (IPv6 related code)
- *
- * The uIP TCP/IP stack header file contains definitions for a number
- * of C macros that are used by uIP programs as well as internal uIP
- * structures, TCP/IP header structures and function declarations.
- *
- */
-
-/*
- * Copyright (c) 2001-2003, Adam Dunkels.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack.
- *
- * $Id: uip.h,v 1.24 2009/04/06 13:18:50 nvt-se Exp $
- *
- */
-
-#ifndef __UIP_H__
-#define __UIP_H__
-
-#include "uipopt.h"
-
-/**
- * Representation of an IP address.
- *
- */
-#if UIP_CONF_IPV6
-typedef union uip_ip6addr_t {
- u8_t u8[16]; /* Initializer, must come first!!! */
- u16_t u16[8];
-} uip_ip6addr_t;
-
-typedef uip_ip6addr_t uip_ipaddr_t;
-#else /* UIP_CONF_IPV6 */
-typedef union uip_ip4addr_t {
- u8_t u8[4]; /* Initializer, must come first!!! */
- u16_t u16[2];
-#if 0
- u32_t u32;
-#endif
-} uip_ip4addr_t;
-typedef uip_ip4addr_t uip_ipaddr_t;
-#endif /* UIP_CONF_IPV6 */
-
-
-/*---------------------------------------------------------------------------*/
-
-/** \brief 16 bit 802.15.4 address */
-struct uip_802154_shortaddr {
- u8_t addr[2];
-};
-/** \brief 64 bit 802.15.4 address */
-struct uip_802154_longaddr {
- u8_t addr[8];
-};
-
-/** \brief 802.11 address */
-struct uip_80211_addr {
- u8_t addr[6];
-};
-
-/** \brief 802.3 address */
-struct uip_eth_addr {
- u8_t addr[6];
-};
-
-#if UIP_CONF_LL_802154
-/** \brief 802.15.4 address */
-typedef struct uip_802154_longaddr uip_lladdr_t;
-#define UIP_802154_SHORTADDR_LEN 2
-#define UIP_802154_LONGADDR_LEN 8
-#define UIP_LLADDR_LEN UIP_802154_LONGADDR_LEN
-#else /*UIP_CONF_LL_802154*/
-#if UIP_CONF_LL_80211
-/** \brief 802.11 address */
-typedef struct uip_80211_addr uip_lladdr_t;
-#define UIP_LLADDR_LEN 6
-#else /*UIP_CONF_LL_80211*/
-/** \brief Ethernet address */
-typedef struct uip_eth_addr uip_lladdr_t;
-#define UIP_LLADDR_LEN 6
-#endif /*UIP_CONF_LL_80211*/
-#endif /*UIP_CONF_LL_802154*/
-
-/*---------------------------------------------------------------------------*/
-/* First, the functions that should be called from the
- * system. Initialization, the periodic timer, and incoming packets are
- * handled by the following three functions.
- */
-/**
- * \defgroup uipconffunc uIP configuration functions
- * @{
- *
- * The uIP configuration functions are used for setting run-time
- * parameters in uIP such as IP addresses.
- */
-
-/**
- * Set the IP address of this host.
- *
- * The IP address is represented as a 4-byte array where the first
- * octet of the IP address is put in the first member of the 4-byte
- * array.
- *
- * Example:
- \code
-
- uip_ipaddr_t addr;
-
- uip_ipaddr(&addr, 192,168,1,2);
- uip_sethostaddr(&addr);
-
- \endcode
- * \param addr A pointer to an IP address of type uip_ipaddr_t;
- *
- * \sa uip_ipaddr()
- *
- * \hideinitializer
- */
-#define uip_sethostaddr(addr) uip_ipaddr_copy(&uip_hostaddr, (addr))
-
-/**
- * Get the IP address of this host.
- *
- * The IP address is represented as a 4-byte array where the first
- * octet of the IP address is put in the first member of the 4-byte
- * array.
- *
- * Example:
- \code
- uip_ipaddr_t hostaddr;
-
- uip_gethostaddr(&hostaddr);
- \endcode
- * \param addr A pointer to a uip_ipaddr_t variable that will be
- * filled in with the currently configured IP address.
- *
- * \hideinitializer
- */
-#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), &uip_hostaddr)
-
-/**
- * Set the default router's IP address.
- *
- * \param addr A pointer to a uip_ipaddr_t variable containing the IP
- * address of the default router.
- *
- * \sa uip_ipaddr()
- *
- * \hideinitializer
- */
-#define uip_setdraddr(addr) uip_ipaddr_copy(&uip_draddr, (addr))
-
-/**
- * Set the netmask.
- *
- * \param addr A pointer to a uip_ipaddr_t variable containing the IP
- * address of the netmask.
- *
- * \sa uip_ipaddr()
- *
- * \hideinitializer
- */
-#define uip_setnetmask(addr) uip_ipaddr_copy(&uip_netmask, (addr))
-
-
-/**
- * Get the default router's IP address.
- *
- * \param addr A pointer to a uip_ipaddr_t variable that will be
- * filled in with the IP address of the default router.
- *
- * \hideinitializer
- */
-#define uip_getdraddr(addr) uip_ipaddr_copy((addr), &uip_draddr)
-
-/**
- * Get the netmask.
- *
- * \param addr A pointer to a uip_ipaddr_t variable that will be
- * filled in with the value of the netmask.
- *
- * \hideinitializer
- */
-#define uip_getnetmask(addr) uip_ipaddr_copy((addr), &uip_netmask)
-
-/** @} */
-
-/**
- * \defgroup uipinit uIP initialization functions
- * @{
- *
- * The uIP initialization functions are used for booting uIP.
- */
-
-/**
- * uIP initialization function.
- *
- * This function should be called at boot up to initilize the uIP
- * TCP/IP stack.
- */
-void uip_init(void);
-
-/**
- * uIP initialization function.
- *
- * This function may be used at boot time to set the initial ip_id.
- */
-void uip_setipid(u16_t id);
-
-/** @} */
-
-/**
- * \defgroup uipdevfunc uIP device driver functions
- * @{
- *
- * These functions are used by a network device driver for interacting
- * with uIP.
- */
-
-/**
- * Process an incoming packet.
- *
- * This function should be called when the device driver has received
- * a packet from the network. The packet from the device driver must
- * be present in the uip_buf buffer, and the length of the packet
- * should be placed in the uip_len variable.
- *
- * When the function returns, there may be an outbound packet placed
- * in the uip_buf packet buffer. If so, the uip_len variable is set to
- * the length of the packet. If no packet is to be sent out, the
- * uip_len variable is set to 0.
- *
- * The usual way of calling the function is presented by the source
- * code below.
- \code
- uip_len = devicedriver_poll();
- if(uip_len > 0) {
- uip_input();
- if(uip_len > 0) {
- devicedriver_send();
- }
- }
- \endcode
- *
- * \note If you are writing a uIP device driver that needs ARP
- * (Address Resolution Protocol), e.g., when running uIP over
- * Ethernet, you will need to call the uIP ARP code before calling
- * this function:
- \code
- #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
- uip_len = ethernet_devicedrver_poll();
- if(uip_len > 0) {
- if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
- uip_arp_ipin();
- uip_input();
- if(uip_len > 0) {
- uip_arp_out();
- ethernet_devicedriver_send();
- }
- } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
- uip_arp_arpin();
- if(uip_len > 0) {
- ethernet_devicedriver_send();
- }
- }
- \endcode
- *
- * \hideinitializer
- */
-#define uip_input() uip_process(UIP_DATA)
-
-
-/**
- * Periodic processing for a connection identified by its number.
- *
- * This function does the necessary periodic processing (timers,
- * polling) for a uIP TCP conneciton, and should be called when the
- * periodic uIP timer goes off. It should be called for every
- * connection, regardless of whether they are open of closed.
- *
- * When the function returns, it may have an outbound packet waiting
- * for service in the uIP packet buffer, and if so the uip_len
- * variable is set to a value larger than zero. The device driver
- * should be called to send out the packet.
- *
- * The usual way of calling the function is through a for() loop like
- * this:
- \code
- for(i = 0; i < UIP_CONNS; ++i) {
- uip_periodic(i);
- if(uip_len > 0) {
- devicedriver_send();
- }
- }
- \endcode
- *
- * \note If you are writing a uIP device driver that needs ARP
- * (Address Resolution Protocol), e.g., when running uIP over
- * Ethernet, you will need to call the uip_arp_out() function before
- * calling the device driver:
- \code
- for(i = 0; i < UIP_CONNS; ++i) {
- uip_periodic(i);
- if(uip_len > 0) {
- uip_arp_out();
- ethernet_devicedriver_send();
- }
- }
- \endcode
- *
- * \param conn The number of the connection which is to be periodically polled.
- *
- * \hideinitializer
- */
-#if UIP_TCP
-#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \
- uip_process(UIP_TIMER); } while (0)
-
-/**
- *
- *
- */
-#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED)
-
-/**
- * Perform periodic processing for a connection identified by a pointer
- * to its structure.
- *
- * Same as uip_periodic() but takes a pointer to the actual uip_conn
- * struct instead of an integer as its argument. This function can be
- * used to force periodic processing of a specific connection.
- *
- * \param conn A pointer to the uip_conn struct for the connection to
- * be processed.
- *
- * \hideinitializer
- */
-#define uip_periodic_conn(conn) do { uip_conn = conn; \
- uip_process(UIP_TIMER); } while (0)
-
-/**
- * Request that a particular connection should be polled.
- *
- * Similar to uip_periodic_conn() but does not perform any timer
- * processing. The application is polled for new data.
- *
- * \param conn A pointer to the uip_conn struct for the connection to
- * be processed.
- *
- * \hideinitializer
- */
-#define uip_poll_conn(conn) do { uip_conn = conn; \
- uip_process(UIP_POLL_REQUEST); } while (0)
-
-#endif /* UIP_TCP */
-
-#if UIP_UDP
-/**
- * Periodic processing for a UDP connection identified by its number.
- *
- * This function is essentially the same as uip_periodic(), but for
- * UDP connections. It is called in a similar fashion as the
- * uip_periodic() function:
- \code
- for(i = 0; i < UIP_UDP_CONNS; i++) {
- uip_udp_periodic(i);
- if(uip_len > 0) {
- devicedriver_send();
- }
- }
- \endcode
- *
- * \note As for the uip_periodic() function, special care has to be
- * taken when using uIP together with ARP and Ethernet:
- \code
- for(i = 0; i < UIP_UDP_CONNS; i++) {
- uip_udp_periodic(i);
- if(uip_len > 0) {
- uip_arp_out();
- ethernet_devicedriver_send();
- }
- }
- \endcode
- *
- * \param conn The number of the UDP connection to be processed.
- *
- * \hideinitializer
- */
-#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \
- uip_process(UIP_UDP_TIMER); } while(0)
-
-/**
- * Periodic processing for a UDP connection identified by a pointer to
- * its structure.
- *
- * Same as uip_udp_periodic() but takes a pointer to the actual
- * uip_conn struct instead of an integer as its argument. This
- * function can be used to force periodic processing of a specific
- * connection.
- *
- * \param conn A pointer to the uip_udp_conn struct for the connection
- * to be processed.
- *
- * \hideinitializer
- */
-#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \
- uip_process(UIP_UDP_TIMER); } while(0)
-#endif /* UIP_UDP */
-
-/** \brief Abandon the reassembly of the current packet */
-void uip_reass_over(void);
-
-/**
- * The uIP packet buffer.
- *
- * The uip_buf array is used to hold incoming and outgoing
- * packets. The device driver should place incoming data into this
- * buffer. When sending data, the device driver should read the link
- * level headers and the TCP/IP headers from this buffer. The size of
- * the link level headers is configured by the UIP_LLH_LEN define.
- *
- * \note The application data need not be placed in this buffer, so
- * the device driver must read it from the place pointed to by the
- * uip_appdata pointer as illustrated by the following example:
- \code
- void
- devicedriver_send(void)
- {
- hwsend(&uip_buf[0], UIP_LLH_LEN);
- if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) {
- hwsend(&uip_buf[UIP_LLH_LEN], uip_len - UIP_LLH_LEN);
- } else {
- hwsend(&uip_buf[UIP_LLH_LEN], UIP_TCPIP_HLEN);
- hwsend(uip_appdata, uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN);
- }
- }
- \endcode
-*/
-extern u8_t uip_buf[UIP_BUFSIZE+2];
-
-
-
-/** @} */
-
-/*---------------------------------------------------------------------------*/
-/* Functions that are used by the uIP application program. Opening and
- * closing connections, sending and receiving data, etc. is all
- * handled by the functions below.
- */
-/**
- * \defgroup uipappfunc uIP application functions
- * @{
- *
- * Functions used by an application running of top of uIP.
- */
-
-/**
- * Start listening to the specified port.
- *
- * \note Since this function expects the port number in network byte
- * order, a conversion using HTONS() or htons() is necessary.
- *
- \code
- uip_listen(HTONS(80));
- \endcode
- *
- * \param port A 16-bit port number in network byte order.
- */
-void uip_listen(u16_t port);
-
-/**
- * Stop listening to the specified port.
- *
- * \note Since this function expects the port number in network byte
- * order, a conversion using HTONS() or htons() is necessary.
- *
- \code
- uip_unlisten(HTONS(80));
- \endcode
- *
- * \param port A 16-bit port number in network byte order.
- */
-void uip_unlisten(u16_t port);
-
-/**
- * Connect to a remote host using TCP.
- *
- * This function is used to start a new connection to the specified
- * port on the specified host. It allocates a new connection identifier,
- * sets the connection to the SYN_SENT state and sets the
- * retransmission timer to 0. This will cause a TCP SYN segment to be
- * sent out the next time this connection is periodically processed,
- * which usually is done within 0.5 seconds after the call to
- * uip_connect().
- *
- * \note This function is available only if support for active open
- * has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h.
- *
- * \note Since this function requires the port number to be in network
- * byte order, a conversion using HTONS() or htons() is necessary.
- *
- \code
- uip_ipaddr_t ipaddr;
-
- uip_ipaddr(&ipaddr, 192,168,1,2);
- uip_connect(&ipaddr, HTONS(80));
- \endcode
- *
- * \param ripaddr The IP address of the remote host.
- *
- * \param port A 16-bit port number in network byte order.
- *
- * \return A pointer to the uIP connection identifier for the new connection,
- * or NULL if no connection could be allocated.
- *
- */
-struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port);
-
-
-
-/**
- * \internal
- *
- * Check if a connection has outstanding (i.e., unacknowledged) data.
- *
- * \param conn A pointer to the uip_conn structure for the connection.
- *
- * \hideinitializer
- */
-#define uip_outstanding(conn) ((conn)->len)
-
-/**
- * Send data on the current connection.
- *
- * This function is used to send out a single segment of TCP
- * data. Only applications that have been invoked by uIP for event
- * processing can send data.
- *
- * The amount of data that actually is sent out after a call to this
- * function is determined by the maximum amount of data TCP allows. uIP
- * will automatically crop the data so that only the appropriate
- * amount of data is sent. The function uip_mss() can be used to query
- * uIP for the amount of data that actually will be sent.
- *
- * \note This function does not guarantee that the sent data will
- * arrive at the destination. If the data is lost in the network, the
- * application will be invoked with the uip_rexmit() event being
- * set. The application will then have to resend the data using this
- * function.
- *
- * \param data A pointer to the data which is to be sent.
- *
- * \param len The maximum amount of data bytes to be sent.
- *
- * \hideinitializer
- */
-void uip_send(const void *data, int len);
-
-/**
- * The length of any incoming data that is currently available (if available)
- * in the uip_appdata buffer.
- *
- * The test function uip_data() must first be used to check if there
- * is any data available at all.
- *
- * \hideinitializer
- */
-/*void uip_datalen(void);*/
-#define uip_datalen() uip_len
-
-/**
- * The length of any out-of-band data (urgent data) that has arrived
- * on the connection.
- *
- * \note The configuration parameter UIP_URGDATA must be set for this
- * function to be enabled.
- *
- * \hideinitializer
- */
-#define uip_urgdatalen() uip_urglen
-
-/**
- * Close the current connection.
- *
- * This function will close the current connection in a nice way.
- *
- * \hideinitializer
- */
-#define uip_close() (uip_flags = UIP_CLOSE)
-
-/**
- * Abort the current connection.
- *
- * This function will abort (reset) the current connection, and is
- * usually used when an error has occurred that prevents using the
- * uip_close() function.
- *
- * \hideinitializer
- */
-#define uip_abort() (uip_flags = UIP_ABORT)
-
-/**
- * Tell the sending host to stop sending data.
- *
- * This function will close our receiver's window so that we stop
- * receiving data for the current connection.
- *
- * \hideinitializer
- */
-#define uip_stop() (uip_conn->tcpstateflags |= UIP_STOPPED)
-
-/**
- * Find out if the current connection has been previously stopped with
- * uip_stop().
- *
- * \hideinitializer
- */
-#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED)
-
-/**
- * Restart the current connection, if is has previously been stopped
- * with uip_stop().
- *
- * This function will open the receiver's window again so that we
- * start receiving data for the current connection.
- *
- * \hideinitializer
- */
-#define uip_restart() do { uip_flags |= UIP_NEWDATA; \
- uip_conn->tcpstateflags &= ~UIP_STOPPED; \
- } while(0)
-
-
-/* uIP tests that can be made to determine in what state the current
- connection is, and what the application function should do. */
-
-/**
- * Is the current connection a UDP connection?
- *
- * This function checks whether the current connection is a UDP connection.
- *
- * \hideinitializer
- *
- */
-#define uip_udpconnection() (uip_conn == NULL)
-
-/**
- * Is new incoming data available?
- *
- * Will reduce to non-zero if there is new data for the application
- * present at the uip_appdata pointer. The size of the data is
- * available through the uip_len variable.
- *
- * \hideinitializer
- */
-#define uip_newdata() (uip_flags & UIP_NEWDATA)
-
-/**
- * Has previously sent data been acknowledged?
- *
- * Will reduce to non-zero if the previously sent data has been
- * acknowledged by the remote host. This means that the application
- * can send new data.
- *
- * \hideinitializer
- */
-#define uip_acked() (uip_flags & UIP_ACKDATA)
-
-/**
- * Has the connection just been connected?
- *
- * Reduces to non-zero if the current connection has been connected to
- * a remote host. This will happen both if the connection has been
- * actively opened (with uip_connect()) or passively opened (with
- * uip_listen()).
- *
- * \hideinitializer
- */
-#define uip_connected() (uip_flags & UIP_CONNECTED)
-
-/**
- * Has the connection been closed by the other end?
- *
- * Is non-zero if the connection has been closed by the remote
- * host. The application may then do the necessary clean-ups.
- *
- * \hideinitializer
- */
-#define uip_closed() (uip_flags & UIP_CLOSE)
-
-/**
- * Has the connection been aborted by the other end?
- *
- * Non-zero if the current connection has been aborted (reset) by the
- * remote host.
- *
- * \hideinitializer
- */
-#define uip_aborted() (uip_flags & UIP_ABORT)
-
-/**
- * Has the connection timed out?
- *
- * Non-zero if the current connection has been aborted due to too many
- * retransmissions.
- *
- * \hideinitializer
- */
-#define uip_timedout() (uip_flags & UIP_TIMEDOUT)
-
-/**
- * Do we need to retransmit previously data?
- *
- * Reduces to non-zero if the previously sent data has been lost in
- * the network, and the application should retransmit it. The
- * application should send the exact same data as it did the last
- * time, using the uip_send() function.
- *
- * \hideinitializer
- */
-#define uip_rexmit() (uip_flags & UIP_REXMIT)
-
-/**
- * Is the connection being polled by uIP?
- *
- * Is non-zero if the reason the application is invoked is that the
- * current connection has been idle for a while and should be
- * polled.
- *
- * The polling event can be used for sending data without having to
- * wait for the remote host to send data.
- *
- * \hideinitializer
- */
-#define uip_poll() (uip_flags & UIP_POLL)
-
-/**
- * Get the initial maximum segment size (MSS) of the current
- * connection.
- *
- * \hideinitializer
- */
-#define uip_initialmss() (uip_conn->initialmss)
-
-/**
- * Get the current maximum segment size that can be sent on the current
- * connection.
- *
- * The current maximum segment size that can be sent on the
- * connection is computed from the receiver's window and the MSS of
- * the connection (which also is available by calling
- * uip_initialmss()).
- *
- * \hideinitializer
- */
-#define uip_mss() (uip_conn->mss)
-
-/**
- * Set up a new UDP connection.
- *
- * This function sets up a new UDP connection. The function will
- * automatically allocate an unused local port for the new
- * connection. However, another port can be chosen by using the
- * uip_udp_bind() call, after the uip_udp_new() function has been
- * called.
- *
- * Example:
- \code
- uip_ipaddr_t addr;
- struct uip_udp_conn *c;
-
- uip_ipaddr(&addr, 192,168,2,1);
- c = uip_udp_new(&addr, HTONS(12345));
- if(c != NULL) {
- uip_udp_bind(c, HTONS(12344));
- }
- \endcode
- * \param ripaddr The IP address of the remote host.
- *
- * \param rport The remote port number in network byte order.
- *
- * \return The uip_udp_conn structure for the new connection or NULL
- * if no connection could be allocated.
- */
-struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
-
-/**
- * Removed a UDP connection.
- *
- * \param conn A pointer to the uip_udp_conn structure for the connection.
- *
- * \hideinitializer
- */
-#define uip_udp_remove(conn) (conn)->lport = 0
-
-/**
- * Bind a UDP connection to a local port.
- *
- * \param conn A pointer to the uip_udp_conn structure for the
- * connection.
- *
- * \param port The local port number, in network byte order.
- *
- * \hideinitializer
- */
-#define uip_udp_bind(conn, port) (conn)->lport = port
-
-/**
- * Send a UDP datagram of length len on the current connection.
- *
- * This function can only be called in response to a UDP event (poll
- * or newdata). The data must be present in the uip_buf buffer, at the
- * place pointed to by the uip_appdata pointer.
- *
- * \param len The length of the data in the uip_buf buffer.
- *
- * \hideinitializer
- */
-#define uip_udp_send(len) uip_send((char *)uip_appdata, len)
-
-/** @} */
-
-/* uIP convenience and converting functions. */
-
-/**
- * \defgroup uipconvfunc uIP conversion functions
- * @{
- *
- * These functions can be used for converting between different data
- * formats used by uIP.
- */
-
-/**
- * Convert an IP address to four bytes separated by commas.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr;
- printf("ipaddr=%d.%d.%d.%d\n", uip_ipaddr_to_quad(&ipaddr));
- \endcode
- *
- * \param a A pointer to a uip_ipaddr_t.
- * \hideinitializer
- */
-#define uip_ipaddr_to_quad(a) (a)->u8[0],(a)->u8[1],(a)->u8[2],(a)->u8[3]
-
-/**
- * Construct an IP address from four bytes.
- *
- * This function constructs an IP address of the type that uIP handles
- * internally from four bytes. The function is handy for specifying IP
- * addresses to use with e.g. the uip_connect() function.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr;
- struct uip_conn *c;
-
- uip_ipaddr(&ipaddr, 192,168,1,2);
- c = uip_connect(&ipaddr, HTONS(80));
- \endcode
- *
- * \param addr A pointer to a uip_ipaddr_t variable that will be
- * filled in with the IP address.
- *
- * \param addr0 The first octet of the IP address.
- * \param addr1 The second octet of the IP address.
- * \param addr2 The third octet of the IP address.
- * \param addr3 The forth octet of the IP address.
- *
- * \hideinitializer
- */
-#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \
- (addr)->u8[0] = addr0; \
- (addr)->u8[1] = addr1; \
- (addr)->u8[2] = addr2; \
- (addr)->u8[3] = addr3; \
- } while(0)
-
-/**
- * Construct an IPv6 address from eight 16-bit words.
- *
- * This function constructs an IPv6 address.
- *
- * \hideinitializer
- */
-#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
- (addr)->u16[0] = HTONS(addr0); \
- (addr)->u16[1] = HTONS(addr1); \
- (addr)->u16[2] = HTONS(addr2); \
- (addr)->u16[3] = HTONS(addr3); \
- (addr)->u16[4] = HTONS(addr4); \
- (addr)->u16[5] = HTONS(addr5); \
- (addr)->u16[6] = HTONS(addr6); \
- (addr)->u16[7] = HTONS(addr7); \
- } while(0)
-
-/**
- * Construct an IPv6 address from eight 8-bit words.
- *
- * This function constructs an IPv6 address.
- *
- * \hideinitializer
- */
-#define uip_ip6addr_u8(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7,addr8,addr9,addr10,addr11,addr12,addr13,addr14,addr15) do { \
- (addr)->u8[0] = addr0; \
- (addr)->u8[1] = addr1; \
- (addr)->u8[2] = addr2; \
- (addr)->u8[3] = addr3; \
- (addr)->u8[4] = addr4; \
- (addr)->u8[5] = addr5; \
- (addr)->u8[6] = addr6; \
- (addr)->u8[7] = addr7; \
- (addr)->u8[8] = addr8; \
- (addr)->u8[9] = addr9; \
- (addr)->u8[10] = addr10; \
- (addr)->u8[11] = addr11; \
- (addr)->u8[12] = addr12; \
- (addr)->u8[13] = addr13; \
- (addr)->u8[14] = addr14; \
- (addr)->u8[15] = addr15; \
- } while(0)
-
-
-/**
- * Copy an IP address to another IP address.
- *
- * Copies an IP address from one place to another.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr1, ipaddr2;
-
- uip_ipaddr(&ipaddr1, 192,16,1,2);
- uip_ipaddr_copy(&ipaddr2, &ipaddr1);
- \endcode
- *
- * \param dest The destination for the copy.
- * \param src The source from where to copy.
- *
- * \hideinitializer
- */
-#ifndef uip_ipaddr_copy
-#define uip_ipaddr_copy(dest, src) (*(dest) = *(src))
-#endif
-
-/**
- * Compare two IP addresses
- *
- * Compares two IP addresses.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr1, ipaddr2;
-
- uip_ipaddr(&ipaddr1, 192,16,1,2);
- if(uip_ipaddr_cmp(&ipaddr2, &ipaddr1)) {
- printf("They are the same");
- }
- \endcode
- *
- * \param addr1 The first IP address.
- * \param addr2 The second IP address.
- *
- * \hideinitializer
- */
-#if !UIP_CONF_IPV6
-#define uip_ipaddr_cmp(addr1, addr2) ((addr1)->u16[0] == (addr2)->u16[0] && \
- (addr1)->u16[1] == (addr2)->u16[1])
-#else /* !UIP_CONF_IPV6 */
-#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
-#endif /* !UIP_CONF_IPV6 */
-
-/**
- * Compare two IP addresses with netmasks
- *
- * Compares two IP addresses with netmasks. The masks are used to mask
- * out the bits that are to be compared.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr1, ipaddr2, mask;
-
- uip_ipaddr(&mask, 255,255,255,0);
- uip_ipaddr(&ipaddr1, 192,16,1,2);
- uip_ipaddr(&ipaddr2, 192,16,1,3);
- if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) {
- printf("They are the same");
- }
- \endcode
- *
- * \param addr1 The first IP address.
- * \param addr2 The second IP address.
- * \param mask The netmask.
- *
- * \hideinitializer
- */
-#if !UIP_CONF_IPV6
-#define uip_ipaddr_maskcmp(addr1, addr2, mask) \
- (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \
- (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \
- ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \
- (((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))
-#else
-#define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0)
-#endif
-
-
-/**
- * Check if an address is a broadcast address for a network.
- *
- * Checks if an address is the broadcast address for a network. The
- * network is defined by an IP address that is on the network and the
- * network's netmask.
- *
- * \param addr The IP address.
- * \param netaddr The network's IP address.
- * \param netmask The network's netmask.
- *
- * \hideinitializer
- */
-/*#define uip_ipaddr_isbroadcast(addr, netaddr, netmask)
- ((uip_ipaddr_t *)(addr)).u16 & ((uip_ipaddr_t *)(addr)).u16*/
-
-
-
-/**
- * Mask out the network part of an IP address.
- *
- * Masks out the network part of an IP address, given the address and
- * the netmask.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr1, ipaddr2, netmask;
-
- uip_ipaddr(&ipaddr1, 192,16,1,2);
- uip_ipaddr(&netmask, 255,255,255,0);
- uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask);
- \endcode
- *
- * In the example above, the variable "ipaddr2" will contain the IP
- * address 192.168.1.0.
- *
- * \param dest Where the result is to be placed.
- * \param src The IP address.
- * \param mask The netmask.
- *
- * \hideinitializer
- */
-#define uip_ipaddr_mask(dest, src, mask) do { \
- ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \
- ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \
- } while(0)
-
-/**
- * Pick the first octet of an IP address.
- *
- * Picks out the first octet of an IP address.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr;
- u8_t octet;
-
- uip_ipaddr(&ipaddr, 1,2,3,4);
- octet = uip_ipaddr1(&ipaddr);
- \endcode
- *
- * In the example above, the variable "octet" will contain the value 1.
- *
- * \hideinitializer
- */
-#define uip_ipaddr1(addr) ((addr)->u8[0])
-
-/**
- * Pick the second octet of an IP address.
- *
- * Picks out the second octet of an IP address.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr;
- u8_t octet;
-
- uip_ipaddr(&ipaddr, 1,2,3,4);
- octet = uip_ipaddr2(&ipaddr);
- \endcode
- *
- * In the example above, the variable "octet" will contain the value 2.
- *
- * \hideinitializer
- */
-#define uip_ipaddr2(addr) ((addr)->u8[1])
-
-/**
- * Pick the third octet of an IP address.
- *
- * Picks out the third octet of an IP address.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr;
- u8_t octet;
-
- uip_ipaddr(&ipaddr, 1,2,3,4);
- octet = uip_ipaddr3(&ipaddr);
- \endcode
- *
- * In the example above, the variable "octet" will contain the value 3.
- *
- * \hideinitializer
- */
-#define uip_ipaddr3(addr) ((addr)->u8[2])
-
-/**
- * Pick the fourth octet of an IP address.
- *
- * Picks out the fourth octet of an IP address.
- *
- * Example:
- \code
- uip_ipaddr_t ipaddr;
- u8_t octet;
-
- uip_ipaddr(&ipaddr, 1,2,3,4);
- octet = uip_ipaddr4(&ipaddr);
- \endcode
- *
- * In the example above, the variable "octet" will contain the value 4.
- *
- * \hideinitializer
- */
-#define uip_ipaddr4(addr) ((addr)->u8[3])
-
-/**
- * Convert 16-bit quantity from host byte order to network byte order.
- *
- * This macro is primarily used for converting constants from host
- * byte order to network byte order. For converting variables to
- * network byte order, use the htons() function instead.
- *
- * \hideinitializer
- */
-#ifndef HTONS
-# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
-# define HTONS(n) (n)
-# define HTONL(n) (n)
-# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
-# define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
-# define HTONL(n) (((u32_t)HTONS(n) << 16) | HTONS((u32_t)(n) >> 16))
-# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
-#else
-#error "HTONS already defined!"
-#endif /* HTONS */
-
-/**
- * Convert 16-bit quantity from host byte order to network byte order.
- *
- * This function is primarily used for converting variables from host
- * byte order to network byte order. For converting constants to
- * network byte order, use the HTONS() macro instead.
- */
-#ifndef htons
-u16_t htons(u16_t val);
-#endif /* htons */
-#ifndef ntohs
-#define ntohs htons
-#endif
-
-#ifndef htonl
-u32_t htonl(u32_t val);
-#endif /* htonl */
-#ifndef ntohl
-#define ntohl htonl
-#endif
-
-/** @} */
-
-/**
- * Pointer to the application data in the packet buffer.
- *
- * This pointer points to the application data when the application is
- * called. If the application wishes to send data, the application may
- * use this space to write the data into before calling uip_send().
- */
-extern void *uip_appdata;
-
-#if UIP_URGDATA > 0
-/* u8_t *uip_urgdata:
- *
- * This pointer points to any urgent data that has been received. Only
- * present if compiled with support for urgent data (UIP_URGDATA).
- */
-extern void *uip_urgdata;
-#endif /* UIP_URGDATA > 0 */
-
-
-/**
- * \defgroup uipdrivervars Variables used in uIP device drivers
- * @{
- *
- * uIP has a few global variables that are used in device drivers for
- * uIP.
- */
-
-/**
- * The length of the packet in the uip_buf buffer.
- *
- * The global variable uip_len holds the length of the packet in the
- * uip_buf buffer.
- *
- * When the network device driver calls the uIP input function,
- * uip_len should be set to the length of the packet in the uip_buf
- * buffer.
- *
- * When sending packets, the device driver should use the contents of
- * the uip_len variable to determine the length of the outgoing
- * packet.
- *
- */
-extern u16_t uip_len;
-
-/**
- * The length of the extension headers
- */
-extern u8_t uip_ext_len;
-/** @} */
-
-#if UIP_URGDATA > 0
-extern u16_t uip_urglen, uip_surglen;
-#endif /* UIP_URGDATA > 0 */
-
-
-/**
- * Representation of a uIP TCP connection.
- *
- * The uip_conn structure is used for identifying a connection. All
- * but one field in the structure are to be considered read-only by an
- * application. The only exception is the appstate field whose purpose
- * is to let the application store application-specific state (e.g.,
- * file pointers) for the connection. The type of this field is
- * configured in the "uipopt.h" header file.
- */
-struct uip_conn {
- uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */
-
- u16_t lport; /**< The local TCP port, in network byte order. */
- u16_t rport; /**< The local remote TCP port, in network byte
- order. */
-
- u8_t rcv_nxt[4]; /**< The sequence number that we expect to
- receive next. */
- u8_t snd_nxt[4]; /**< The sequence number that was last sent by
- us. */
- u16_t len; /**< Length of the data that was previously sent. */
- u16_t mss; /**< Current maximum segment size for the
- connection. */
- u16_t initialmss; /**< Initial maximum segment size for the
- connection. */
- u8_t sa; /**< Retransmission time-out calculation state
- variable. */
- u8_t sv; /**< Retransmission time-out calculation state
- variable. */
- u8_t rto; /**< Retransmission time-out. */
- u8_t tcpstateflags; /**< TCP state and flags. */
- u8_t timer; /**< The retransmission timer. */
- u8_t nrtx; /**< The number of retransmissions for the last
- segment sent. */
-
- /** The application state. */
- uip_tcp_appstate_t appstate;
-};
-
-
-/**
- * Pointer to the current TCP connection.
- *
- * The uip_conn pointer can be used to access the current TCP
- * connection.
- */
-
-extern struct uip_conn *uip_conn;
-#if UIP_TCP
-/* The array containing all uIP connections. */
-extern struct uip_conn uip_conns[UIP_CONNS];
-#endif
-
-/**
- * \addtogroup uiparch
- * @{
- */
-
-/**
- * 4-byte array used for the 32-bit sequence number calculations.
- */
-extern u8_t uip_acc32[4];
-/** @} */
-
-/**
- * Representation of a uIP UDP connection.
- */
-struct uip_udp_conn {
- uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */
- u16_t lport; /**< The local port number in network byte order. */
- u16_t rport; /**< The remote port number in network byte order. */
- u8_t ttl; /**< Default time-to-live. */
-
- /** The application state. */
- uip_udp_appstate_t appstate;
-};
-
-/**
- * The current UDP connection.
- */
-extern struct uip_udp_conn *uip_udp_conn;
-extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
-
-struct uip_router {
- int (*activate)(void);
- int (*deactivate)(void);
- uip_ipaddr_t *(*lookup)(uip_ipaddr_t *destipaddr, uip_ipaddr_t *nexthop);
-};
-
-#if UIP_CONF_ROUTER
-extern const struct uip_router *uip_router;
-
-/**
- * uIP routing driver registration function.
- */
-void uip_router_register(const struct uip_router *router);
-#endif /*UIP_CONF_ROUTER*/
-
-#if UIP_CONF_ICMP6
-struct uip_icmp6_conn {
- uip_icmp6_appstate_t appstate;
-};
-extern struct uip_icmp6_conn uip_icmp6_conns;
-#endif /*UIP_CONF_ICMP6*/
-
-/**
- * The uIP TCP/IP statistics.
- *
- * This is the variable in which the uIP TCP/IP statistics are gathered.
- */
-#if UIP_STATISTICS == 1
-extern struct uip_stats uip_stat;
-#define UIP_STAT(s) s
-#else
-#define UIP_STAT(s)
-#endif /* UIP_STATISTICS == 1 */
-
-/**
- * The structure holding the TCP/IP statistics that are gathered if
- * UIP_STATISTICS is set to 1.
- *
- */
-struct uip_stats {
- struct {
- uip_stats_t recv; /**< Number of received packets at the IP
- layer. */
- uip_stats_t sent; /**< Number of sent packets at the IP
- layer. */
- uip_stats_t forwarded;/**< Number of forwarded packets at the IP
- layer. */
- uip_stats_t drop; /**< Number of dropped packets at the IP
- layer. */
- uip_stats_t vhlerr; /**< Number of packets dropped due to wrong
- IP version or header length. */
- uip_stats_t hblenerr; /**< Number of packets dropped due to wrong
- IP length, high byte. */
- uip_stats_t lblenerr; /**< Number of packets dropped due to wrong
- IP length, low byte. */
- uip_stats_t fragerr; /**< Number of packets dropped since they
- were IP fragments. */
- uip_stats_t chkerr; /**< Number of packets dropped due to IP
- checksum errors. */
- uip_stats_t protoerr; /**< Number of packets dropped since they
- were neither ICMP, UDP nor TCP. */
- } ip; /**< IP statistics. */
- struct {
- uip_stats_t recv; /**< Number of received ICMP packets. */
- uip_stats_t sent; /**< Number of sent ICMP packets. */
- uip_stats_t drop; /**< Number of dropped ICMP packets. */
- uip_stats_t typeerr; /**< Number of ICMP packets with a wrong
- type. */
- uip_stats_t chkerr; /**< Number of ICMP packets with a bad
- checksum. */
- } icmp; /**< ICMP statistics. */
-#if UIP_TCP
- struct {
- uip_stats_t recv; /**< Number of recived TCP segments. */
- uip_stats_t sent; /**< Number of sent TCP segments. */
- uip_stats_t drop; /**< Number of dropped TCP segments. */
- uip_stats_t chkerr; /**< Number of TCP segments with a bad
- checksum. */
- uip_stats_t ackerr; /**< Number of TCP segments with a bad ACK
- number. */
- uip_stats_t rst; /**< Number of recevied TCP RST (reset) segments. */
- uip_stats_t rexmit; /**< Number of retransmitted TCP segments. */
- uip_stats_t syndrop; /**< Number of dropped SYNs due to too few
- connections was avaliable. */
- uip_stats_t synrst; /**< Number of SYNs for closed ports,
- triggering a RST. */
- } tcp; /**< TCP statistics. */
-#endif
-#if UIP_UDP
- struct {
- uip_stats_t drop; /**< Number of dropped UDP segments. */
- uip_stats_t recv; /**< Number of recived UDP segments. */
- uip_stats_t sent; /**< Number of sent UDP segments. */
- uip_stats_t chkerr; /**< Number of UDP segments with a bad
- checksum. */
- } udp; /**< UDP statistics. */
-#endif /* UIP_UDP */
-#if UIP_CONF_IPV6
- struct {
- uip_stats_t drop; /**< Number of dropped ND6 packets. */
- uip_stats_t recv; /**< Number of recived ND6 packets */
- uip_stats_t sent; /**< Number of sent ND6 packets */
- } nd6;
-#endif /*UIP_CONF_IPV6*/
-};
-
-
-/*---------------------------------------------------------------------------*/
-/* All the stuff below this point is internal to uIP and should not be
- * used directly by an application or by a device driver.
- */
-/*---------------------------------------------------------------------------*/
-
-
-
-/* u8_t uip_flags:
- *
- * When the application is called, uip_flags will contain the flags
- * that are defined in this file. Please read below for more
- * information.
- */
-extern u8_t uip_flags;
-
-/* The following flags may be set in the global variable uip_flags
- before calling the application callback. The UIP_ACKDATA,
- UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time,
- whereas the others are mutually exclusive. Note that these flags
- should *NOT* be accessed directly, but only through the uIP
- functions/macros. */
-
-#define UIP_ACKDATA 1 /* Signifies that the outstanding data was
- acked and the application should send
- out new data instead of retransmitting
- the last data. */
-#define UIP_NEWDATA 2 /* Flags the fact that the peer has sent
- us new data. */
-#define UIP_REXMIT 4 /* Tells the application to retransmit the
- data that was last sent. */
-#define UIP_POLL 8 /* Used for polling the application, to
- check if the application has data that
- it wants to send. */
-#define UIP_CLOSE 16 /* The remote host has closed the
- connection, thus the connection has
- gone away. Or the application signals
- that it wants to close the
- connection. */
-#define UIP_ABORT 32 /* The remote host has aborted the
- connection, thus the connection has
- gone away. Or the application signals
- that it wants to abort the
- connection. */
-#define UIP_CONNECTED 64 /* We have got a connection from a remote
- host and have set up a new connection
- for it, or an active connection has
- been successfully established. */
-
-#define UIP_TIMEDOUT 128 /* The connection has been aborted due to
- too many retransmissions. */
-
-
-/**
- * \brief process the options within a hop by hop or destination option header
- * \retval 0: nothing to send,
- * \retval 1: drop pkt
- * \retval 2: ICMP error message to send
-*/
-/*static u8_t
-uip_ext_hdr_options_process(); */
-
-/* uip_process(flag):
- *
- * The actual uIP function which does all the work.
- */
-void uip_process(u8_t flag);
-
- /* The following flags are passed as an argument to the uip_process()
- function. They are used to distinguish between the two cases where
- uip_process() is called. It can be called either because we have
- incoming data that should be processed, or because the periodic
- timer has fired. These values are never used directly, but only in
- the macros defined in this file. */
-
-#define UIP_DATA 1 /* Tells uIP that there is incoming
- data in the uip_buf buffer. The
- length of the data is stored in the
- global variable uip_len. */
-#define UIP_TIMER 2 /* Tells uIP that the periodic timer
- has fired. */
-#define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should
- be polled. */
-#define UIP_UDP_SEND_CONN 4 /* Tells uIP that a UDP datagram
- should be constructed in the
- uip_buf buffer. */
-#if UIP_UDP
-#define UIP_UDP_TIMER 5
-#endif /* UIP_UDP */
-
-/* The TCP states used in the uip_conn->tcpstateflags. */
-#define UIP_CLOSED 0
-#define UIP_SYN_RCVD 1
-#define UIP_SYN_SENT 2
-#define UIP_ESTABLISHED 3
-#define UIP_FIN_WAIT_1 4
-#define UIP_FIN_WAIT_2 5
-#define UIP_CLOSING 6
-#define UIP_TIME_WAIT 7
-#define UIP_LAST_ACK 8
-#define UIP_TS_MASK 15
-
-#define UIP_STOPPED 16
-
-/* The TCP and IP headers. */
-struct uip_tcpip_hdr {
-#if UIP_CONF_IPV6
- /* IPv6 header. */
- u8_t vtc,
- tcflow;
- u16_t flow;
- u8_t len[2];
- u8_t proto, ttl;
- uip_ip6addr_t srcipaddr, destipaddr;
-#else /* UIP_CONF_IPV6 */
- /* IPv4 header. */
- u8_t vhl,
- tos,
- len[2],
- ipid[2],
- ipoffset[2],
- ttl,
- proto;
- u16_t ipchksum;
- uip_ipaddr_t srcipaddr, destipaddr;
-#endif /* UIP_CONF_IPV6 */
-
- /* TCP header. */
- u16_t srcport,
- destport;
- u8_t seqno[4],
- ackno[4],
- tcpoffset,
- flags,
- wnd[2];
- u16_t tcpchksum;
- u8_t urgp[2];
- u8_t optdata[4];
-};
-
-/* The ICMP and IP headers. */
-struct uip_icmpip_hdr {
-#if UIP_CONF_IPV6
- /* IPv6 header. */
- u8_t vtc,
- tcf;
- u16_t flow;
- u8_t len[2];
- u8_t proto, ttl;
- uip_ip6addr_t srcipaddr, destipaddr;
-#else /* UIP_CONF_IPV6 */
- /* IPv4 header. */
- u8_t vhl,
- tos,
- len[2],
- ipid[2],
- ipoffset[2],
- ttl,
- proto;
- u16_t ipchksum;
- uip_ipaddr_t srcipaddr, destipaddr;
-#endif /* UIP_CONF_IPV6 */
-
- /* ICMP header. */
- u8_t type, icode;
- u16_t icmpchksum;
-#if !UIP_CONF_IPV6
- u16_t id, seqno;
- u8_t payload[1];
-#endif /* !UIP_CONF_IPV6 */
-};
-
-
-/* The UDP and IP headers. */
-struct uip_udpip_hdr {
-#if UIP_CONF_IPV6
- /* IPv6 header. */
- u8_t vtc,
- tcf;
- u16_t flow;
- u8_t len[2];
- u8_t proto, ttl;
- uip_ip6addr_t srcipaddr, destipaddr;
-#else /* UIP_CONF_IPV6 */
- /* IP header. */
- u8_t vhl,
- tos,
- len[2],
- ipid[2],
- ipoffset[2],
- ttl,
- proto;
- u16_t ipchksum;
- uip_ipaddr_t srcipaddr, destipaddr;
-#endif /* UIP_CONF_IPV6 */
-
- /* UDP header. */
- u16_t srcport,
- destport;
- u16_t udplen;
- u16_t udpchksum;
-};
-
-/*
- * In IPv6 the length of the L3 headers before the transport header is
- * not fixed, due to the possibility to include extension option headers
- * after the IP header. hence we split here L3 and L4 headers
- */
-/* The IP header */
-struct uip_ip_hdr {
-#if UIP_CONF_IPV6
- /* IPV6 header */
- u8_t vtc;
- u8_t tcflow;
- u16_t flow;
- u8_t len[2];
- u8_t proto, ttl;
- uip_ip6addr_t srcipaddr, destipaddr;
-#else /* UIP_CONF_IPV6 */
- /* IPV4 header */
- u8_t vhl,
- tos,
- len[2],
- ipid[2],
- ipoffset[2],
- ttl,
- proto;
- u16_t ipchksum;
- uip_ipaddr_t srcipaddr, destipaddr;
-#endif /* UIP_CONF_IPV6 */
-};
-
-
-/*
- * IPv6 extension option headers: we are able to process
- * the 4 extension headers defined in RFC2460 (IPv6):
- * - Hop by hop option header, destination option header:
- * These two are not used by any core IPv6 protocol, hence
- * we just read them and go to the next. They convey options,
- * the options defined in RFC2460 are Pad1 and PadN, which do
- * some padding, and that we do not need to read (the length
- * field in the header is enough)
- * - Routing header: this one is most notably used by MIPv6,
- * which we do not implement, hence we just read it and go
- * to the next
- * - Fragmentation header: we read this header and are able to
- * reassemble packets
- *
- * We do not offer any means to send packets with extension headers
- *
- * We do not implement Authentication and ESP headers, which are
- * used in IPSec and defined in RFC4302,4303,4305,4385
- */
-/* common header part */
-struct uip_ext_hdr {
- u8_t next;
- u8_t len;
-};
-
-/* Hop by Hop option header */
-struct uip_hbho_hdr {
- u8_t next;
- u8_t len;
-};
-
-/* destination option header */
-struct uip_desto_hdr {
- u8_t next;
- u8_t len;
-};
-
-/* We do not define structures for PAD1 and PADN options */
-
-/*
- * routing header
- * the routing header as 4 common bytes, then routing header type
- * specific data there are several types of routing header. Type 0 was
- * deprecated as per RFC5095 most notable other type is 2, used in
- * RFC3775 (MIPv6) here we do not implement MIPv6, so we just need to
- * parse the 4 first bytes
- */
-struct uip_routing_hdr {
- u8_t next;
- u8_t len;
- u8_t routing_type;
- u8_t seg_left;
-};
-
-/* fragmentation header */
-struct uip_frag_hdr {
- u8_t next;
- u8_t res;
- u16_t offsetresmore;
- u32_t id;
-};
-
-/*
- * an option within the destination or hop by hop option headers
- * it contains type an length, which is true for all options but PAD1
- */
-struct uip_ext_hdr_opt {
- u8_t type;
- u8_t len;
-};
-
-/* PADN option */
-struct uip_ext_hdr_opt_padn {
- u8_t opt_type;
- u8_t opt_len;
-};
-
-/* TCP header */
-struct uip_tcp_hdr {
- u16_t srcport;
- u16_t destport;
- u8_t seqno[4];
- u8_t ackno[4];
- u8_t tcpoffset;
- u8_t flags;
- u8_t wnd[2];
- u16_t tcpchksum;
- u8_t urgp[2];
- u8_t optdata[4];
-};
-
-/* The ICMP headers. */
-struct uip_icmp_hdr {
- u8_t type, icode;
- u16_t icmpchksum;
-#if !UIP_CONF_IPV6
- u16_t id, seqno;
-#endif /* !UIP_CONF_IPV6 */
-};
-
-
-/* The UDP headers. */
-struct uip_udp_hdr {
- u16_t srcport;
- u16_t destport;
- u16_t udplen;
- u16_t udpchksum;
-};
-
-
-/**
- * The buffer size available for user data in the \ref uip_buf buffer.
- *
- * This macro holds the available size for user data in the \ref
- * uip_buf buffer. The macro is intended to be used for checking
- * bounds of available user data.
- *
- * Example:
- \code
- snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i);
- \endcode
- *
- * \hideinitializer
- */
-#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
-#define UIP_APPDATA_PTR (void *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]
-
-#define UIP_PROTO_ICMP 1
-#define UIP_PROTO_TCP 6
-#define UIP_PROTO_UDP 17
-#define UIP_PROTO_ICMP6 58
-
-
-#if UIP_CONF_IPV6
-/** @{ */
-/** \brief extension headers types */
-#define UIP_PROTO_HBHO 0
-#define UIP_PROTO_DESTO 60
-#define UIP_PROTO_ROUTING 43
-#define UIP_PROTO_FRAG 44
-#define UIP_PROTO_NONE 59
-/** @} */
-
-/** @{ */
-/** \brief Destination and Hop By Hop extension headers option types */
-#define UIP_EXT_HDR_OPT_PAD1 0
-#define UIP_EXT_HDR_OPT_PADN 1
-/** @} */
-
-/** @{ */
-/**
- * \brief Bitmaps for extension header processing
- *
- * When processing extension headers, we should record somehow which one we
- * see, because you cannot have twice the same header, except for destination
- * We store all this in one u8_t bitmap one bit for each header expected. The
- * order in the bitmap is the order recommended in RFC2460
- */
-#define UIP_EXT_HDR_BITMAP_HBHO 0x01
-#define UIP_EXT_HDR_BITMAP_DESTO1 0x02
-#define UIP_EXT_HDR_BITMAP_ROUTING 0x04
-#define UIP_EXT_HDR_BITMAP_FRAG 0x08
-#define UIP_EXT_HDR_BITMAP_AH 0x10
-#define UIP_EXT_HDR_BITMAP_ESP 0x20
-#define UIP_EXT_HDR_BITMAP_DESTO2 0x40
-/** @} */
-
-
-#endif /* UIP_CONF_IPV6 */
-
-
-/* Header sizes. */
-#if UIP_CONF_IPV6
-#define UIP_IPH_LEN 40
-#define UIP_FRAGH_LEN 8
-#else /* UIP_CONF_IPV6 */
-#define UIP_IPH_LEN 20 /* Size of IP header */
-#endif /* UIP_CONF_IPV6 */
-
-#define UIP_UDPH_LEN 8 /* Size of UDP header */
-#define UIP_TCPH_LEN 20 /* Size of TCP header */
-#ifdef UIP_IPH_LEN
-#define UIP_ICMPH_LEN 4 /* Size of ICMP header */
-#endif
-#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP +
- * UDP
- * header */
-#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP +
- * TCP
- * header */
-#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
-#define UIP_IPICMPH_LEN (UIP_IPH_LEN + UIP_ICMPH_LEN) /* size of ICMP
- + IP header */
-#define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* size of L2
- + IP header */
-#if UIP_CONF_IPV6
-/**
- * The sums below are quite used in ND. When used for uip_buf, we
- * include link layer length when used for uip_len, we do not, hence
- * we need values with and without LLH_LEN we do not use capital
- * letters as these values are variable
- */
-#define uip_l2_l3_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len)
-#define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
-#define uip_l3_hdr_len (UIP_IPH_LEN + uip_ext_len)
-#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
-#endif /*UIP_CONF_IPV6*/
-
-
-#if UIP_FIXEDADDR
-extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
-#else /* UIP_FIXEDADDR */
-extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
-#endif /* UIP_FIXEDADDR */
-extern const uip_ipaddr_t uip_broadcast_addr;
-extern const uip_ipaddr_t uip_all_zeroes_addr;
-
-#if UIP_FIXEDETHADDR
-extern const uip_lladdr_t uip_lladdr;
-#else
-extern uip_lladdr_t uip_lladdr;
-#endif
-
-
-
-
-#ifdef UIP_CONF_IPV6
-/**
- * \brief Is IPv6 address a the unspecified address
- * a is of type uip_ipaddr_t
- */
-#define uip_is_addr_unspecified(a) \
- ((((a)->u16[0]) == 0) && \
- (((a)->u16[1]) == 0) && \
- (((a)->u16[2]) == 0) && \
- (((a)->u16[3]) == 0) && \
- (((a)->u16[4]) == 0) && \
- (((a)->u16[5]) == 0) && \
- (((a)->u16[6]) == 0) && \
- (((a)->u16[7]) == 0))
-
-/** \brief Is IPv6 address a the link local all-nodes multicast address */
-#define uip_is_addr_linklocal_allnodes_mcast(a) \
- ((((a)->u8[0]) == 0xff) && \
- (((a)->u8[1]) == 0x02) && \
- (((a)->u16[1]) == 0) && \
- (((a)->u16[2]) == 0) && \
- (((a)->u16[3]) == 0) && \
- (((a)->u16[4]) == 0) && \
- (((a)->u16[5]) == 0) && \
- (((a)->u16[6]) == 0) && \
- (((a)->u8[14]) == 0) && \
- (((a)->u8[15]) == 0x01))
-
-/** \brief set IP address a to unspecified */
-#define uip_create_unspecified(a) uip_ip6addr(a, 0, 0, 0, 0, 0, 0, 0, 0)
-
-/** \brief set IP address a to the link local all-nodes multicast address */
-#define uip_create_linklocal_allnodes_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001)
-
-/** \brief set IP address a to the link local all-routers multicast address */
-#define uip_create_linklocal_allrouters_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002)
-
-/**
- * \brief is addr (a) a solicited node multicast address, see RFC3513
- * a is of type uip_ipaddr_t*
- */
-#define uip_is_addr_solicited_node(a) \
- ((((a)->u8[0]) == 0xFF) && \
- (((a)->u8[1]) == 0x02) && \
- (((a)->u16[1]) == 0) && \
- (((a)->u16[2]) == 0) && \
- (((a)->u16[3]) == 0) && \
- (((a)->u16[4]) == 0) && \
- (((a)->u16[5]) == 1) && \
- (((a)->u8[12]) == 0xFF))
-
-/**
- * \briefput in b the solicited node address corresponding to address a
- * both a and b are of type uip_ipaddr_t*
- * */
-#define uip_create_solicited_node(a, b) \
- (((b)->u8[0]) = 0xFF); \
- (((b)->u8[1]) = 0x02); \
- (((b)->u16[1]) = 0); \
- (((b)->u16[2]) = 0); \
- (((b)->u16[3]) = 0); \
- (((b)->u16[4]) = 0); \
- (((b)->u8[10]) = 0); \
- (((b)->u8[11]) = 0x01); \
- (((b)->u8[12]) = 0xFF); \
- (((b)->u8[13]) = ((a)->u8[13])); \
- (((b)->u16[7]) = ((a)->u16[7]))
-
-/**
- * \brief is addr (a) a link local unicast address, see RFC3513
- * i.e. is (a) on prefix FE80::/10
- * a is of type uip_ipaddr_t*
- */
-#define uip_is_addr_link_local(a) \
- ((((a)->u8[0]) == 0xFE) && \
- (((a)->u8[1]) == 0x80))
-
-/**
- * \brief was addr (a) forged based on the mac address m
- * a type is uip_ipaddr_t
- * m type is uiplladdr_t
- */
-#if UIP_CONF_LL_802154
-#define uip_is_addr_mac_addr_based(a, m) \
- ((((a)->u8[8]) == (((m)->addr[0]) ^ 0x02)) && \
- (((a)->u8[9]) == (m)->addr[1]) && \
- (((a)->u8[10]) == (m)->addr[2]) && \
- (((a)->u8[11]) == (m)->addr[3]) && \
- (((a)->u8[12]) == (m)->addr[4]) && \
- (((a)->u8[13]) == (m)->addr[5]) && \
- (((a)->u8[14]) == (m)->addr[6]) && \
- (((a)->u8[15]) == (m)->addr[7]))
-#else
-
-#define uip_is_addr_mac_addr_based(a, m) \
- ((((a)->u8[8]) == (((m)->addr[0]) | 0x02)) && \
- (((a)->u8[9]) == (m)->addr[1]) && \
- (((a)->u8[10]) == (m)->addr[2]) && \
- (((a)->u8[11]) == 0xff) && \
- (((a)->u8[12]) == 0xfe) && \
- (((a)->u8[13]) == (m)->addr[3]) && \
- (((a)->u8[14]) == (m)->addr[4]) && \
- (((a)->u8[15]) == (m)->addr[5]))
-
-#endif /*UIP_CONF_LL_802154*/
-
-/**
- * \brief is address a multicast address, see RFC 3513
- * a is of type uip_ipaddr_t*
- * */
-#define uip_is_addr_mcast(a) \
- (((a)->u8[0]) == 0xFF)
-
-/**
- * \brief is group-id of multicast address a
- * the all nodes group-id
- */
-#define uip_is_mcast_group_id_all_nodes(a) \
- ((((a)->u16[1]) == 0) && \
- (((a)->u16[2]) == 0) && \
- (((a)->u16[3]) == 0) && \
- (((a)->u16[4]) == 0) && \
- (((a)->u16[5]) == 0) && \
- (((a)->u16[6]) == 0) && \
- (((a)->u8[14]) == 0) && \
- (((a)->u8[15]) == 1))
-
-/**
- * \brief is group-id of multicast address a
- * the all routers group-id
- */
-#define uip_is_mcast_group_id_all_routers(a) \
- ((((a)->u16[1]) == 0) && \
- (((a)->u16[2]) == 0) && \
- (((a)->u16[3]) == 0) && \
- (((a)->u16[4]) == 0) && \
- (((a)->u16[5]) == 0) && \
- (((a)->u16[6]) == 0) && \
- (((a)->u8[14]) == 0) && \
- (((a)->u8[15]) == 2))
-
-
-#endif /*UIP_CONF_IPV6*/
-
-/**
- * Calculate the Internet checksum over a buffer.
- *
- * The Internet checksum is the one's complement of the one's
- * complement sum of all 16-bit words in the buffer.
- *
- * See RFC1071.
- *
- * \param buf A pointer to the buffer over which the checksum is to be
- * computed.
- *
- * \param len The length of the buffer over which the checksum is to
- * be computed.
- *
- * \return The Internet checksum of the buffer.
- */
-u16_t uip_chksum(u16_t *buf, u16_t len);
-
-/**
- * Calculate the IP header checksum of the packet header in uip_buf.
- *
- * The IP header checksum is the Internet checksum of the 20 bytes of
- * the IP header.
- *
- * \return The IP header checksum of the IP header in the uip_buf
- * buffer.
- */
-u16_t uip_ipchksum(void);
-
-/**
- * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
- *
- * The TCP checksum is the Internet checksum of data contents of the
- * TCP segment, and a pseudo-header as defined in RFC793.
- *
- * \return The TCP checksum of the TCP segment in uip_buf and pointed
- * to by uip_appdata.
- */
-u16_t uip_tcpchksum(void);
-
-/**
- * Calculate the UDP checksum of the packet in uip_buf and uip_appdata.
- *
- * The UDP checksum is the Internet checksum of data contents of the
- * UDP segment, and a pseudo-header as defined in RFC768.
- *
- * \return The UDP checksum of the UDP segment in uip_buf and pointed
- * to by uip_appdata.
- */
-u16_t uip_udpchksum(void);
-
-/**
- * Calculate the ICMP checksum of the packet in uip_buf.
- *
- * \return The ICMP checksum of the ICMP packet in uip_buf
- */
-u16_t uip_icmp6chksum(void);
-
-
-#endif /* __UIP_H__ */
-
-
-/** @} */
+
+/**
+ * \addtogroup uip
+ * @{
+ */
+
+/**
+ * \file
+ * Header file for the uIP TCP/IP stack.
+ * \author Adam Dunkels <adam@dunkels.com>
+ * \author Julien Abeille <jabeille@cisco.com> (IPv6 related code)
+ * \author Mathilde Durvy <mdurvy@cisco.com> (IPv6 related code)
+ *
+ * The uIP TCP/IP stack header file contains definitions for a number
+ * of C macros that are used by uIP programs as well as internal uIP
+ * structures, TCP/IP header structures and function declarations.
+ *
+ */
+
+/*
+ * Copyright (c) 2001-2003, Adam Dunkels.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uip.h,v 1.24 2009/04/06 13:18:50 nvt-se Exp $
+ *
+ */
+
+#ifndef __UIP_H__
+#define __UIP_H__
+
+#include "uipopt.h"
+
+/**
+ * Representation of an IP address.
+ *
+ */
+#if UIP_CONF_IPV6
+typedef union uip_ip6addr_t {
+ u8_t u8[16]; /* Initializer, must come first!!! */
+ u16_t u16[8];
+} uip_ip6addr_t;
+
+typedef uip_ip6addr_t uip_ipaddr_t;
+#else /* UIP_CONF_IPV6 */
+typedef union uip_ip4addr_t {
+ u8_t u8[4]; /* Initializer, must come first!!! */
+ u16_t u16[2];
+#if 0
+ u32_t u32;
+#endif
+} uip_ip4addr_t;
+typedef uip_ip4addr_t uip_ipaddr_t;
+#endif /* UIP_CONF_IPV6 */
+
+
+/*---------------------------------------------------------------------------*/
+
+/** \brief 16 bit 802.15.4 address */
+struct uip_802154_shortaddr {
+ u8_t addr[2];
+};
+/** \brief 64 bit 802.15.4 address */
+struct uip_802154_longaddr {
+ u8_t addr[8];
+};
+
+/** \brief 802.11 address */
+struct uip_80211_addr {
+ u8_t addr[6];
+};
+
+/** \brief 802.3 address */
+struct uip_eth_addr {
+ u8_t addr[6];
+};
+
+#if UIP_CONF_LL_802154
+/** \brief 802.15.4 address */
+typedef struct uip_802154_longaddr uip_lladdr_t;
+#define UIP_802154_SHORTADDR_LEN 2
+#define UIP_802154_LONGADDR_LEN 8
+#define UIP_LLADDR_LEN UIP_802154_LONGADDR_LEN
+#else /*UIP_CONF_LL_802154*/
+#if UIP_CONF_LL_80211
+/** \brief 802.11 address */
+typedef struct uip_80211_addr uip_lladdr_t;
+#define UIP_LLADDR_LEN 6
+#else /*UIP_CONF_LL_80211*/
+/** \brief Ethernet address */
+typedef struct uip_eth_addr uip_lladdr_t;
+#define UIP_LLADDR_LEN 6
+#endif /*UIP_CONF_LL_80211*/
+#endif /*UIP_CONF_LL_802154*/
+
+/*---------------------------------------------------------------------------*/
+/* First, the functions that should be called from the
+ * system. Initialization, the periodic timer, and incoming packets are
+ * handled by the following three functions.
+ */
+/**
+ * \defgroup uipconffunc uIP configuration functions
+ * @{
+ *
+ * The uIP configuration functions are used for setting run-time
+ * parameters in uIP such as IP addresses.
+ */
+
+/**
+ * Set the IP address of this host.
+ *
+ * The IP address is represented as a 4-byte array where the first
+ * octet of the IP address is put in the first member of the 4-byte
+ * array.
+ *
+ * Example:
+ \code
+
+ uip_ipaddr_t addr;
+
+ uip_ipaddr(&addr, 192,168,1,2);
+ uip_sethostaddr(&addr);
+
+ \endcode
+ * \param addr A pointer to an IP address of type uip_ipaddr_t;
+ *
+ * \sa uip_ipaddr()
+ *
+ * \hideinitializer
+ */
+#define uip_sethostaddr(addr) uip_ipaddr_copy(&uip_hostaddr, (addr))
+
+/**
+ * Get the IP address of this host.
+ *
+ * The IP address is represented as a 4-byte array where the first
+ * octet of the IP address is put in the first member of the 4-byte
+ * array.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t hostaddr;
+
+ uip_gethostaddr(&hostaddr);
+ \endcode
+ * \param addr A pointer to a uip_ipaddr_t variable that will be
+ * filled in with the currently configured IP address.
+ *
+ * \hideinitializer
+ */
+#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), &uip_hostaddr)
+
+/**
+ * Set the default router's IP address.
+ *
+ * \param addr A pointer to a uip_ipaddr_t variable containing the IP
+ * address of the default router.
+ *
+ * \sa uip_ipaddr()
+ *
+ * \hideinitializer
+ */
+#define uip_setdraddr(addr) uip_ipaddr_copy(&uip_draddr, (addr))
+
+/**
+ * Set the netmask.
+ *
+ * \param addr A pointer to a uip_ipaddr_t variable containing the IP
+ * address of the netmask.
+ *
+ * \sa uip_ipaddr()
+ *
+ * \hideinitializer
+ */
+#define uip_setnetmask(addr) uip_ipaddr_copy(&uip_netmask, (addr))
+
+
+/**
+ * Get the default router's IP address.
+ *
+ * \param addr A pointer to a uip_ipaddr_t variable that will be
+ * filled in with the IP address of the default router.
+ *
+ * \hideinitializer
+ */
+#define uip_getdraddr(addr) uip_ipaddr_copy((addr), &uip_draddr)
+
+/**
+ * Get the netmask.
+ *
+ * \param addr A pointer to a uip_ipaddr_t variable that will be
+ * filled in with the value of the netmask.
+ *
+ * \hideinitializer
+ */
+#define uip_getnetmask(addr) uip_ipaddr_copy((addr), &uip_netmask)
+
+/** @} */
+
+/**
+ * \defgroup uipinit uIP initialization functions
+ * @{
+ *
+ * The uIP initialization functions are used for booting uIP.
+ */
+
+/**
+ * uIP initialization function.
+ *
+ * This function should be called at boot up to initilize the uIP
+ * TCP/IP stack.
+ */
+void uip_init(void);
+
+/**
+ * uIP initialization function.
+ *
+ * This function may be used at boot time to set the initial ip_id.
+ */
+void uip_setipid(u16_t id);
+
+/** @} */
+
+/**
+ * \defgroup uipdevfunc uIP device driver functions
+ * @{
+ *
+ * These functions are used by a network device driver for interacting
+ * with uIP.
+ */
+
+/**
+ * Process an incoming packet.
+ *
+ * This function should be called when the device driver has received
+ * a packet from the network. The packet from the device driver must
+ * be present in the uip_buf buffer, and the length of the packet
+ * should be placed in the uip_len variable.
+ *
+ * When the function returns, there may be an outbound packet placed
+ * in the uip_buf packet buffer. If so, the uip_len variable is set to
+ * the length of the packet. If no packet is to be sent out, the
+ * uip_len variable is set to 0.
+ *
+ * The usual way of calling the function is presented by the source
+ * code below.
+ \code
+ uip_len = devicedriver_poll();
+ if(uip_len > 0) {
+ uip_input();
+ if(uip_len > 0) {
+ devicedriver_send();
+ }
+ }
+ \endcode
+ *
+ * \note If you are writing a uIP device driver that needs ARP
+ * (Address Resolution Protocol), e.g., when running uIP over
+ * Ethernet, you will need to call the uIP ARP code before calling
+ * this function:
+ \code
+ #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
+ uip_len = ethernet_devicedrver_poll();
+ if(uip_len > 0) {
+ if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
+ uip_arp_ipin();
+ uip_input();
+ if(uip_len > 0) {
+ uip_arp_out();
+ ethernet_devicedriver_send();
+ }
+ } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
+ uip_arp_arpin();
+ if(uip_len > 0) {
+ ethernet_devicedriver_send();
+ }
+ }
+ \endcode
+ *
+ * \hideinitializer
+ */
+#define uip_input() uip_process(UIP_DATA)
+
+
+/**
+ * Periodic processing for a connection identified by its number.
+ *
+ * This function does the necessary periodic processing (timers,
+ * polling) for a uIP TCP conneciton, and should be called when the
+ * periodic uIP timer goes off. It should be called for every
+ * connection, regardless of whether they are open of closed.
+ *
+ * When the function returns, it may have an outbound packet waiting
+ * for service in the uIP packet buffer, and if so the uip_len
+ * variable is set to a value larger than zero. The device driver
+ * should be called to send out the packet.
+ *
+ * The usual way of calling the function is through a for() loop like
+ * this:
+ \code
+ for(i = 0; i < UIP_CONNS; ++i) {
+ uip_periodic(i);
+ if(uip_len > 0) {
+ devicedriver_send();
+ }
+ }
+ \endcode
+ *
+ * \note If you are writing a uIP device driver that needs ARP
+ * (Address Resolution Protocol), e.g., when running uIP over
+ * Ethernet, you will need to call the uip_arp_out() function before
+ * calling the device driver:
+ \code
+ for(i = 0; i < UIP_CONNS; ++i) {
+ uip_periodic(i);
+ if(uip_len > 0) {
+ uip_arp_out();
+ ethernet_devicedriver_send();
+ }
+ }
+ \endcode
+ *
+ * \param conn The number of the connection which is to be periodically polled.
+ *
+ * \hideinitializer
+ */
+#if UIP_TCP
+#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \
+ uip_process(UIP_TIMER); } while (0)
+
+/**
+ *
+ *
+ */
+#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED)
+
+/**
+ * Perform periodic processing for a connection identified by a pointer
+ * to its structure.
+ *
+ * Same as uip_periodic() but takes a pointer to the actual uip_conn
+ * struct instead of an integer as its argument. This function can be
+ * used to force periodic processing of a specific connection.
+ *
+ * \param conn A pointer to the uip_conn struct for the connection to
+ * be processed.
+ *
+ * \hideinitializer
+ */
+#define uip_periodic_conn(conn) do { uip_conn = conn; \
+ uip_process(UIP_TIMER); } while (0)
+
+/**
+ * Request that a particular connection should be polled.
+ *
+ * Similar to uip_periodic_conn() but does not perform any timer
+ * processing. The application is polled for new data.
+ *
+ * \param conn A pointer to the uip_conn struct for the connection to
+ * be processed.
+ *
+ * \hideinitializer
+ */
+#define uip_poll_conn(conn) do { uip_conn = conn; \
+ uip_process(UIP_POLL_REQUEST); } while (0)
+
+#endif /* UIP_TCP */
+
+#if UIP_UDP
+/**
+ * Periodic processing for a UDP connection identified by its number.
+ *
+ * This function is essentially the same as uip_periodic(), but for
+ * UDP connections. It is called in a similar fashion as the
+ * uip_periodic() function:
+ \code
+ for(i = 0; i < UIP_UDP_CONNS; i++) {
+ uip_udp_periodic(i);
+ if(uip_len > 0) {
+ devicedriver_send();
+ }
+ }
+ \endcode
+ *
+ * \note As for the uip_periodic() function, special care has to be
+ * taken when using uIP together with ARP and Ethernet:
+ \code
+ for(i = 0; i < UIP_UDP_CONNS; i++) {
+ uip_udp_periodic(i);
+ if(uip_len > 0) {
+ uip_arp_out();
+ ethernet_devicedriver_send();
+ }
+ }
+ \endcode
+ *
+ * \param conn The number of the UDP connection to be processed.
+ *
+ * \hideinitializer
+ */
+#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \
+ uip_process(UIP_UDP_TIMER); } while(0)
+
+/**
+ * Periodic processing for a UDP connection identified by a pointer to
+ * its structure.
+ *
+ * Same as uip_udp_periodic() but takes a pointer to the actual
+ * uip_conn struct instead of an integer as its argument. This
+ * function can be used to force periodic processing of a specific
+ * connection.
+ *
+ * \param conn A pointer to the uip_udp_conn struct for the connection
+ * to be processed.
+ *
+ * \hideinitializer
+ */
+#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \
+ uip_process(UIP_UDP_TIMER); } while(0)
+#endif /* UIP_UDP */
+
+/** \brief Abandon the reassembly of the current packet */
+void uip_reass_over(void);
+
+/**
+ * The uIP packet buffer.
+ *
+ * The uip_buf array is used to hold incoming and outgoing
+ * packets. The device driver should place incoming data into this
+ * buffer. When sending data, the device driver should read the link
+ * level headers and the TCP/IP headers from this buffer. The size of
+ * the link level headers is configured by the UIP_LLH_LEN define.
+ *
+ * \note The application data need not be placed in this buffer, so
+ * the device driver must read it from the place pointed to by the
+ * uip_appdata pointer as illustrated by the following example:
+ \code
+ void
+ devicedriver_send(void)
+ {
+ hwsend(&uip_buf[0], UIP_LLH_LEN);
+ if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) {
+ hwsend(&uip_buf[UIP_LLH_LEN], uip_len - UIP_LLH_LEN);
+ } else {
+ hwsend(&uip_buf[UIP_LLH_LEN], UIP_TCPIP_HLEN);
+ hwsend(uip_appdata, uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN);
+ }
+ }
+ \endcode
+*/
+extern u8_t uip_buf[UIP_BUFSIZE+2];
+
+
+
+/** @} */
+
+/*---------------------------------------------------------------------------*/
+/* Functions that are used by the uIP application program. Opening and
+ * closing connections, sending and receiving data, etc. is all
+ * handled by the functions below.
+ */
+/**
+ * \defgroup uipappfunc uIP application functions
+ * @{
+ *
+ * Functions used by an application running of top of uIP.
+ */
+
+/**
+ * Start listening to the specified port.
+ *
+ * \note Since this function expects the port number in network byte
+ * order, a conversion using HTONS() or htons() is necessary.
+ *
+ \code
+ uip_listen(HTONS(80));
+ \endcode
+ *
+ * \param port A 16-bit port number in network byte order.
+ */
+void uip_listen(u16_t port);
+
+/**
+ * Stop listening to the specified port.
+ *
+ * \note Since this function expects the port number in network byte
+ * order, a conversion using HTONS() or htons() is necessary.
+ *
+ \code
+ uip_unlisten(HTONS(80));
+ \endcode
+ *
+ * \param port A 16-bit port number in network byte order.
+ */
+void uip_unlisten(u16_t port);
+
+/**
+ * Connect to a remote host using TCP.
+ *
+ * This function is used to start a new connection to the specified
+ * port on the specified host. It allocates a new connection identifier,
+ * sets the connection to the SYN_SENT state and sets the
+ * retransmission timer to 0. This will cause a TCP SYN segment to be
+ * sent out the next time this connection is periodically processed,
+ * which usually is done within 0.5 seconds after the call to
+ * uip_connect().
+ *
+ * \note This function is available only if support for active open
+ * has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h.
+ *
+ * \note Since this function requires the port number to be in network
+ * byte order, a conversion using HTONS() or htons() is necessary.
+ *
+ \code
+ uip_ipaddr_t ipaddr;
+
+ uip_ipaddr(&ipaddr, 192,168,1,2);
+ uip_connect(&ipaddr, HTONS(80));
+ \endcode
+ *
+ * \param ripaddr The IP address of the remote host.
+ *
+ * \param port A 16-bit port number in network byte order.
+ *
+ * \return A pointer to the uIP connection identifier for the new connection,
+ * or NULL if no connection could be allocated.
+ *
+ */
+struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port);
+
+
+
+/**
+ * \internal
+ *
+ * Check if a connection has outstanding (i.e., unacknowledged) data.
+ *
+ * \param conn A pointer to the uip_conn structure for the connection.
+ *
+ * \hideinitializer
+ */
+#define uip_outstanding(conn) ((conn)->len)
+
+/**
+ * Send data on the current connection.
+ *
+ * This function is used to send out a single segment of TCP
+ * data. Only applications that have been invoked by uIP for event
+ * processing can send data.
+ *
+ * The amount of data that actually is sent out after a call to this
+ * function is determined by the maximum amount of data TCP allows. uIP
+ * will automatically crop the data so that only the appropriate
+ * amount of data is sent. The function uip_mss() can be used to query
+ * uIP for the amount of data that actually will be sent.
+ *
+ * \note This function does not guarantee that the sent data will
+ * arrive at the destination. If the data is lost in the network, the
+ * application will be invoked with the uip_rexmit() event being
+ * set. The application will then have to resend the data using this
+ * function.
+ *
+ * \param data A pointer to the data which is to be sent.
+ *
+ * \param len The maximum amount of data bytes to be sent.
+ *
+ * \hideinitializer
+ */
+void uip_send(const void *data, int len);
+
+/**
+ * The length of any incoming data that is currently available (if available)
+ * in the uip_appdata buffer.
+ *
+ * The test function uip_data() must first be used to check if there
+ * is any data available at all.
+ *
+ * \hideinitializer
+ */
+/*void uip_datalen(void);*/
+#define uip_datalen() uip_len
+
+/**
+ * The length of any out-of-band data (urgent data) that has arrived
+ * on the connection.
+ *
+ * \note The configuration parameter UIP_URGDATA must be set for this
+ * function to be enabled.
+ *
+ * \hideinitializer
+ */
+#define uip_urgdatalen() uip_urglen
+
+/**
+ * Close the current connection.
+ *
+ * This function will close the current connection in a nice way.
+ *
+ * \hideinitializer
+ */
+#define uip_close() (uip_flags = UIP_CLOSE)
+
+/**
+ * Abort the current connection.
+ *
+ * This function will abort (reset) the current connection, and is
+ * usually used when an error has occurred that prevents using the
+ * uip_close() function.
+ *
+ * \hideinitializer
+ */
+#define uip_abort() (uip_flags = UIP_ABORT)
+
+/**
+ * Tell the sending host to stop sending data.
+ *
+ * This function will close our receiver's window so that we stop
+ * receiving data for the current connection.
+ *
+ * \hideinitializer
+ */
+#define uip_stop() (uip_conn->tcpstateflags |= UIP_STOPPED)
+
+/**
+ * Find out if the current connection has been previously stopped with
+ * uip_stop().
+ *
+ * \hideinitializer
+ */
+#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED)
+
+/**
+ * Restart the current connection, if is has previously been stopped
+ * with uip_stop().
+ *
+ * This function will open the receiver's window again so that we
+ * start receiving data for the current connection.
+ *
+ * \hideinitializer
+ */
+#define uip_restart() do { uip_flags |= UIP_NEWDATA; \
+ uip_conn->tcpstateflags &= ~UIP_STOPPED; \
+ } while(0)
+
+
+/* uIP tests that can be made to determine in what state the current
+ connection is, and what the application function should do. */
+
+/**
+ * Is the current connection a UDP connection?
+ *
+ * This function checks whether the current connection is a UDP connection.
+ *
+ * \hideinitializer
+ *
+ */
+#define uip_udpconnection() (uip_conn == NULL)
+
+/**
+ * Is new incoming data available?
+ *
+ * Will reduce to non-zero if there is new data for the application
+ * present at the uip_appdata pointer. The size of the data is
+ * available through the uip_len variable.
+ *
+ * \hideinitializer
+ */
+#define uip_newdata() (uip_flags & UIP_NEWDATA)
+
+/**
+ * Has previously sent data been acknowledged?
+ *
+ * Will reduce to non-zero if the previously sent data has been
+ * acknowledged by the remote host. This means that the application
+ * can send new data.
+ *
+ * \hideinitializer
+ */
+#define uip_acked() (uip_flags & UIP_ACKDATA)
+
+/**
+ * Has the connection just been connected?
+ *
+ * Reduces to non-zero if the current connection has been connected to
+ * a remote host. This will happen both if the connection has been
+ * actively opened (with uip_connect()) or passively opened (with
+ * uip_listen()).
+ *
+ * \hideinitializer
+ */
+#define uip_connected() (uip_flags & UIP_CONNECTED)
+
+/**
+ * Has the connection been closed by the other end?
+ *
+ * Is non-zero if the connection has been closed by the remote
+ * host. The application may then do the necessary clean-ups.
+ *
+ * \hideinitializer
+ */
+#define uip_closed() (uip_flags & UIP_CLOSE)
+
+/**
+ * Has the connection been aborted by the other end?
+ *
+ * Non-zero if the current connection has been aborted (reset) by the
+ * remote host.
+ *
+ * \hideinitializer
+ */
+#define uip_aborted() (uip_flags & UIP_ABORT)
+
+/**
+ * Has the connection timed out?
+ *
+ * Non-zero if the current connection has been aborted due to too many
+ * retransmissions.
+ *
+ * \hideinitializer
+ */
+#define uip_timedout() (uip_flags & UIP_TIMEDOUT)
+
+/**
+ * Do we need to retransmit previously data?
+ *
+ * Reduces to non-zero if the previously sent data has been lost in
+ * the network, and the application should retransmit it. The
+ * application should send the exact same data as it did the last
+ * time, using the uip_send() function.
+ *
+ * \hideinitializer
+ */
+#define uip_rexmit() (uip_flags & UIP_REXMIT)
+
+/**
+ * Is the connection being polled by uIP?
+ *
+ * Is non-zero if the reason the application is invoked is that the
+ * current connection has been idle for a while and should be
+ * polled.
+ *
+ * The polling event can be used for sending data without having to
+ * wait for the remote host to send data.
+ *
+ * \hideinitializer
+ */
+#define uip_poll() (uip_flags & UIP_POLL)
+
+/**
+ * Get the initial maximum segment size (MSS) of the current
+ * connection.
+ *
+ * \hideinitializer
+ */
+#define uip_initialmss() (uip_conn->initialmss)
+
+/**
+ * Get the current maximum segment size that can be sent on the current
+ * connection.
+ *
+ * The current maximum segment size that can be sent on the
+ * connection is computed from the receiver's window and the MSS of
+ * the connection (which also is available by calling
+ * uip_initialmss()).
+ *
+ * \hideinitializer
+ */
+#define uip_mss() (uip_conn->mss)
+
+/**
+ * Set up a new UDP connection.
+ *
+ * This function sets up a new UDP connection. The function will
+ * automatically allocate an unused local port for the new
+ * connection. However, another port can be chosen by using the
+ * uip_udp_bind() call, after the uip_udp_new() function has been
+ * called.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t addr;
+ struct uip_udp_conn *c;
+
+ uip_ipaddr(&addr, 192,168,2,1);
+ c = uip_udp_new(&addr, HTONS(12345));
+ if(c != NULL) {
+ uip_udp_bind(c, HTONS(12344));
+ }
+ \endcode
+ * \param ripaddr The IP address of the remote host.
+ *
+ * \param rport The remote port number in network byte order.
+ *
+ * \return The uip_udp_conn structure for the new connection or NULL
+ * if no connection could be allocated.
+ */
+struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
+
+/**
+ * Removed a UDP connection.
+ *
+ * \param conn A pointer to the uip_udp_conn structure for the connection.
+ *
+ * \hideinitializer
+ */
+#define uip_udp_remove(conn) (conn)->lport = 0
+
+/**
+ * Bind a UDP connection to a local port.
+ *
+ * \param conn A pointer to the uip_udp_conn structure for the
+ * connection.
+ *
+ * \param port The local port number, in network byte order.
+ *
+ * \hideinitializer
+ */
+#define uip_udp_bind(conn, port) (conn)->lport = port
+
+/**
+ * Send a UDP datagram of length len on the current connection.
+ *
+ * This function can only be called in response to a UDP event (poll
+ * or newdata). The data must be present in the uip_buf buffer, at the
+ * place pointed to by the uip_appdata pointer.
+ *
+ * \param len The length of the data in the uip_buf buffer.
+ *
+ * \hideinitializer
+ */
+#define uip_udp_send(len) uip_send((char *)uip_appdata, len)
+
+/** @} */
+
+/* uIP convenience and converting functions. */
+
+/**
+ * \defgroup uipconvfunc uIP conversion functions
+ * @{
+ *
+ * These functions can be used for converting between different data
+ * formats used by uIP.
+ */
+
+/**
+ * Convert an IP address to four bytes separated by commas.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr;
+ printf("ipaddr=%d.%d.%d.%d\n", uip_ipaddr_to_quad(&ipaddr));
+ \endcode
+ *
+ * \param a A pointer to a uip_ipaddr_t.
+ * \hideinitializer
+ */
+#define uip_ipaddr_to_quad(a) (a)->u8[0],(a)->u8[1],(a)->u8[2],(a)->u8[3]
+
+/**
+ * Construct an IP address from four bytes.
+ *
+ * This function constructs an IP address of the type that uIP handles
+ * internally from four bytes. The function is handy for specifying IP
+ * addresses to use with e.g. the uip_connect() function.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr;
+ struct uip_conn *c;
+
+ uip_ipaddr(&ipaddr, 192,168,1,2);
+ c = uip_connect(&ipaddr, HTONS(80));
+ \endcode
+ *
+ * \param addr A pointer to a uip_ipaddr_t variable that will be
+ * filled in with the IP address.
+ *
+ * \param addr0 The first octet of the IP address.
+ * \param addr1 The second octet of the IP address.
+ * \param addr2 The third octet of the IP address.
+ * \param addr3 The forth octet of the IP address.
+ *
+ * \hideinitializer
+ */
+#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \
+ (addr)->u8[0] = addr0; \
+ (addr)->u8[1] = addr1; \
+ (addr)->u8[2] = addr2; \
+ (addr)->u8[3] = addr3; \
+ } while(0)
+
+/**
+ * Construct an IPv6 address from eight 16-bit words.
+ *
+ * This function constructs an IPv6 address.
+ *
+ * \hideinitializer
+ */
+#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
+ (addr)->u16[0] = HTONS(addr0); \
+ (addr)->u16[1] = HTONS(addr1); \
+ (addr)->u16[2] = HTONS(addr2); \
+ (addr)->u16[3] = HTONS(addr3); \
+ (addr)->u16[4] = HTONS(addr4); \
+ (addr)->u16[5] = HTONS(addr5); \
+ (addr)->u16[6] = HTONS(addr6); \
+ (addr)->u16[7] = HTONS(addr7); \
+ } while(0)
+
+/**
+ * Construct an IPv6 address from eight 8-bit words.
+ *
+ * This function constructs an IPv6 address.
+ *
+ * \hideinitializer
+ */
+#define uip_ip6addr_u8(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7,addr8,addr9,addr10,addr11,addr12,addr13,addr14,addr15) do { \
+ (addr)->u8[0] = addr0; \
+ (addr)->u8[1] = addr1; \
+ (addr)->u8[2] = addr2; \
+ (addr)->u8[3] = addr3; \
+ (addr)->u8[4] = addr4; \
+ (addr)->u8[5] = addr5; \
+ (addr)->u8[6] = addr6; \
+ (addr)->u8[7] = addr7; \
+ (addr)->u8[8] = addr8; \
+ (addr)->u8[9] = addr9; \
+ (addr)->u8[10] = addr10; \
+ (addr)->u8[11] = addr11; \
+ (addr)->u8[12] = addr12; \
+ (addr)->u8[13] = addr13; \
+ (addr)->u8[14] = addr14; \
+ (addr)->u8[15] = addr15; \
+ } while(0)
+
+
+/**
+ * Copy an IP address to another IP address.
+ *
+ * Copies an IP address from one place to another.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr1, ipaddr2;
+
+ uip_ipaddr(&ipaddr1, 192,16,1,2);
+ uip_ipaddr_copy(&ipaddr2, &ipaddr1);
+ \endcode
+ *
+ * \param dest The destination for the copy.
+ * \param src The source from where to copy.
+ *
+ * \hideinitializer
+ */
+#ifndef uip_ipaddr_copy
+#define uip_ipaddr_copy(dest, src) (*(dest) = *(src))
+#endif
+
+/**
+ * Compare two IP addresses
+ *
+ * Compares two IP addresses.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr1, ipaddr2;
+
+ uip_ipaddr(&ipaddr1, 192,16,1,2);
+ if(uip_ipaddr_cmp(&ipaddr2, &ipaddr1)) {
+ printf("They are the same");
+ }
+ \endcode
+ *
+ * \param addr1 The first IP address.
+ * \param addr2 The second IP address.
+ *
+ * \hideinitializer
+ */
+#if !UIP_CONF_IPV6
+#define uip_ipaddr_cmp(addr1, addr2) ((addr1)->u16[0] == (addr2)->u16[0] && \
+ (addr1)->u16[1] == (addr2)->u16[1])
+#else /* !UIP_CONF_IPV6 */
+#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
+#endif /* !UIP_CONF_IPV6 */
+
+/**
+ * Compare two IP addresses with netmasks
+ *
+ * Compares two IP addresses with netmasks. The masks are used to mask
+ * out the bits that are to be compared.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr1, ipaddr2, mask;
+
+ uip_ipaddr(&mask, 255,255,255,0);
+ uip_ipaddr(&ipaddr1, 192,16,1,2);
+ uip_ipaddr(&ipaddr2, 192,16,1,3);
+ if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) {
+ printf("They are the same");
+ }
+ \endcode
+ *
+ * \param addr1 The first IP address.
+ * \param addr2 The second IP address.
+ * \param mask The netmask.
+ *
+ * \hideinitializer
+ */
+#if !UIP_CONF_IPV6
+#define uip_ipaddr_maskcmp(addr1, addr2, mask) \
+ (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \
+ (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \
+ ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \
+ (((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))
+#else
+#define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0)
+#endif
+
+
+/**
+ * Check if an address is a broadcast address for a network.
+ *
+ * Checks if an address is the broadcast address for a network. The
+ * network is defined by an IP address that is on the network and the
+ * network's netmask.
+ *
+ * \param addr The IP address.
+ * \param netaddr The network's IP address.
+ * \param netmask The network's netmask.
+ *
+ * \hideinitializer
+ */
+/*#define uip_ipaddr_isbroadcast(addr, netaddr, netmask)
+ ((uip_ipaddr_t *)(addr)).u16 & ((uip_ipaddr_t *)(addr)).u16*/
+
+
+
+/**
+ * Mask out the network part of an IP address.
+ *
+ * Masks out the network part of an IP address, given the address and
+ * the netmask.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr1, ipaddr2, netmask;
+
+ uip_ipaddr(&ipaddr1, 192,16,1,2);
+ uip_ipaddr(&netmask, 255,255,255,0);
+ uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask);
+ \endcode
+ *
+ * In the example above, the variable "ipaddr2" will contain the IP
+ * address 192.168.1.0.
+ *
+ * \param dest Where the result is to be placed.
+ * \param src The IP address.
+ * \param mask The netmask.
+ *
+ * \hideinitializer
+ */
+#define uip_ipaddr_mask(dest, src, mask) do { \
+ ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \
+ ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \
+ } while(0)
+
+/**
+ * Pick the first octet of an IP address.
+ *
+ * Picks out the first octet of an IP address.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr;
+ u8_t octet;
+
+ uip_ipaddr(&ipaddr, 1,2,3,4);
+ octet = uip_ipaddr1(&ipaddr);
+ \endcode
+ *
+ * In the example above, the variable "octet" will contain the value 1.
+ *
+ * \hideinitializer
+ */
+#define uip_ipaddr1(addr) ((addr)->u8[0])
+
+/**
+ * Pick the second octet of an IP address.
+ *
+ * Picks out the second octet of an IP address.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr;
+ u8_t octet;
+
+ uip_ipaddr(&ipaddr, 1,2,3,4);
+ octet = uip_ipaddr2(&ipaddr);
+ \endcode
+ *
+ * In the example above, the variable "octet" will contain the value 2.
+ *
+ * \hideinitializer
+ */
+#define uip_ipaddr2(addr) ((addr)->u8[1])
+
+/**
+ * Pick the third octet of an IP address.
+ *
+ * Picks out the third octet of an IP address.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr;
+ u8_t octet;
+
+ uip_ipaddr(&ipaddr, 1,2,3,4);
+ octet = uip_ipaddr3(&ipaddr);
+ \endcode
+ *
+ * In the example above, the variable "octet" will contain the value 3.
+ *
+ * \hideinitializer
+ */
+#define uip_ipaddr3(addr) ((addr)->u8[2])
+
+/**
+ * Pick the fourth octet of an IP address.
+ *
+ * Picks out the fourth octet of an IP address.
+ *
+ * Example:
+ \code
+ uip_ipaddr_t ipaddr;
+ u8_t octet;
+
+ uip_ipaddr(&ipaddr, 1,2,3,4);
+ octet = uip_ipaddr4(&ipaddr);
+ \endcode
+ *
+ * In the example above, the variable "octet" will contain the value 4.
+ *
+ * \hideinitializer
+ */
+#define uip_ipaddr4(addr) ((addr)->u8[3])
+
+/**
+ * Convert 16-bit quantity from host byte order to network byte order.
+ *
+ * This macro is primarily used for converting constants from host
+ * byte order to network byte order. For converting variables to
+ * network byte order, use the htons() function instead.
+ *
+ * \hideinitializer
+ */
+#ifndef HTONS
+# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
+# define HTONS(n) (n)
+# define HTONL(n) (n)
+# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
+# define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
+# define HTONL(n) (((u32_t)HTONS(n) << 16) | HTONS((u32_t)(n) >> 16))
+# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
+#else
+#error "HTONS already defined!"
+#endif /* HTONS */
+
+/**
+ * Convert 16-bit quantity from host byte order to network byte order.
+ *
+ * This function is primarily used for converting variables from host
+ * byte order to network byte order. For converting constants to
+ * network byte order, use the HTONS() macro instead.
+ */
+#ifndef htons
+u16_t htons(u16_t val);
+#endif /* htons */
+#ifndef ntohs
+#define ntohs htons
+#endif
+
+#ifndef htonl
+u32_t htonl(u32_t val);
+#endif /* htonl */
+#ifndef ntohl
+#define ntohl htonl
+#endif
+
+/** @} */
+
+/**
+ * Pointer to the application data in the packet buffer.
+ *
+ * This pointer points to the application data when the application is
+ * called. If the application wishes to send data, the application may
+ * use this space to write the data into before calling uip_send().
+ */
+extern void *uip_appdata;
+
+#if UIP_URGDATA > 0
+/* u8_t *uip_urgdata:
+ *
+ * This pointer points to any urgent data that has been received. Only
+ * present if compiled with support for urgent data (UIP_URGDATA).
+ */
+extern void *uip_urgdata;
+#endif /* UIP_URGDATA > 0 */
+
+
+/**
+ * \defgroup uipdrivervars Variables used in uIP device drivers
+ * @{
+ *
+ * uIP has a few global variables that are used in device drivers for
+ * uIP.
+ */
+
+/**
+ * The length of the packet in the uip_buf buffer.
+ *
+ * The global variable uip_len holds the length of the packet in the
+ * uip_buf buffer.
+ *
+ * When the network device driver calls the uIP input function,
+ * uip_len should be set to the length of the packet in the uip_buf
+ * buffer.
+ *
+ * When sending packets, the device driver should use the contents of
+ * the uip_len variable to determine the length of the outgoing
+ * packet.
+ *
+ */
+extern u16_t uip_len;
+
+/**
+ * The length of the extension headers
+ */
+extern u8_t uip_ext_len;
+/** @} */
+
+#if UIP_URGDATA > 0
+extern u16_t uip_urglen, uip_surglen;
+#endif /* UIP_URGDATA > 0 */
+
+
+/**
+ * Representation of a uIP TCP connection.
+ *
+ * The uip_conn structure is used for identifying a connection. All
+ * but one field in the structure are to be considered read-only by an
+ * application. The only exception is the appstate field whose purpose
+ * is to let the application store application-specific state (e.g.,
+ * file pointers) for the connection. The type of this field is
+ * configured in the "uipopt.h" header file.
+ */
+struct uip_conn {
+ uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */
+
+ u16_t lport; /**< The local TCP port, in network byte order. */
+ u16_t rport; /**< The local remote TCP port, in network byte
+ order. */
+
+ u8_t rcv_nxt[4]; /**< The sequence number that we expect to
+ receive next. */
+ u8_t snd_nxt[4]; /**< The sequence number that was last sent by
+ us. */
+ u16_t len; /**< Length of the data that was previously sent. */
+ u16_t mss; /**< Current maximum segment size for the
+ connection. */
+ u16_t initialmss; /**< Initial maximum segment size for the
+ connection. */
+ u8_t sa; /**< Retransmission time-out calculation state
+ variable. */
+ u8_t sv; /**< Retransmission time-out calculation state
+ variable. */
+ u8_t rto; /**< Retransmission time-out. */
+ u8_t tcpstateflags; /**< TCP state and flags. */
+ u8_t timer; /**< The retransmission timer. */
+ u8_t nrtx; /**< The number of retransmissions for the last
+ segment sent. */
+
+ /** The application state. */
+ uip_tcp_appstate_t appstate;
+};
+
+
+/**
+ * Pointer to the current TCP connection.
+ *
+ * The uip_conn pointer can be used to access the current TCP
+ * connection.
+ */
+
+extern struct uip_conn *uip_conn;
+#if UIP_TCP
+/* The array containing all uIP connections. */
+extern struct uip_conn uip_conns[UIP_CONNS];
+#endif
+
+/**
+ * \addtogroup uiparch
+ * @{
+ */
+
+/**
+ * 4-byte array used for the 32-bit sequence number calculations.
+ */
+extern u8_t uip_acc32[4];
+/** @} */
+
+/**
+ * Representation of a uIP UDP connection.
+ */
+struct uip_udp_conn {
+ uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */
+ u16_t lport; /**< The local port number in network byte order. */
+ u16_t rport; /**< The remote port number in network byte order. */
+ u8_t ttl; /**< Default time-to-live. */
+
+ /** The application state. */
+ uip_udp_appstate_t appstate;
+};
+
+/**
+ * The current UDP connection.
+ */
+extern struct uip_udp_conn *uip_udp_conn;
+extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
+
+struct uip_router {
+ int (*activate)(void);
+ int (*deactivate)(void);
+ uip_ipaddr_t *(*lookup)(uip_ipaddr_t *destipaddr, uip_ipaddr_t *nexthop);
+};
+
+#if UIP_CONF_ROUTER
+extern const struct uip_router *uip_router;
+
+/**
+ * uIP routing driver registration function.
+ */
+void uip_router_register(const struct uip_router *router);
+#endif /*UIP_CONF_ROUTER*/
+
+#if UIP_CONF_ICMP6
+struct uip_icmp6_conn {
+ uip_icmp6_appstate_t appstate;
+};
+extern struct uip_icmp6_conn uip_icmp6_conns;
+#endif /*UIP_CONF_ICMP6*/
+
+/**
+ * The uIP TCP/IP statistics.
+ *
+ * This is the variable in which the uIP TCP/IP statistics are gathered.
+ */
+#if UIP_STATISTICS == 1
+extern struct uip_stats uip_stat;
+#define UIP_STAT(s) s
+#else
+#define UIP_STAT(s)
+#endif /* UIP_STATISTICS == 1 */
+
+/**
+ * The structure holding the TCP/IP statistics that are gathered if
+ * UIP_STATISTICS is set to 1.
+ *
+ */
+struct uip_stats {
+ struct {
+ uip_stats_t recv; /**< Number of received packets at the IP
+ layer. */
+ uip_stats_t sent; /**< Number of sent packets at the IP
+ layer. */
+ uip_stats_t forwarded;/**< Number of forwarded packets at the IP
+ layer. */
+ uip_stats_t drop; /**< Number of dropped packets at the IP
+ layer. */
+ uip_stats_t vhlerr; /**< Number of packets dropped due to wrong
+ IP version or header length. */
+ uip_stats_t hblenerr; /**< Number of packets dropped due to wrong
+ IP length, high byte. */
+ uip_stats_t lblenerr; /**< Number of packets dropped due to wrong
+ IP length, low byte. */
+ uip_stats_t fragerr; /**< Number of packets dropped since they
+ were IP fragments. */
+ uip_stats_t chkerr; /**< Number of packets dropped due to IP
+ checksum errors. */
+ uip_stats_t protoerr; /**< Number of packets dropped since they
+ were neither ICMP, UDP nor TCP. */
+ } ip; /**< IP statistics. */
+ struct {
+ uip_stats_t recv; /**< Number of received ICMP packets. */
+ uip_stats_t sent; /**< Number of sent ICMP packets. */
+ uip_stats_t drop; /**< Number of dropped ICMP packets. */
+ uip_stats_t typeerr; /**< Number of ICMP packets with a wrong
+ type. */
+ uip_stats_t chkerr; /**< Number of ICMP packets with a bad
+ checksum. */
+ } icmp; /**< ICMP statistics. */
+#if UIP_TCP
+ struct {
+ uip_stats_t recv; /**< Number of recived TCP segments. */
+ uip_stats_t sent; /**< Number of sent TCP segments. */
+ uip_stats_t drop; /**< Number of dropped TCP segments. */
+ uip_stats_t chkerr; /**< Number of TCP segments with a bad
+ checksum. */
+ uip_stats_t ackerr; /**< Number of TCP segments with a bad ACK
+ number. */
+ uip_stats_t rst; /**< Number of recevied TCP RST (reset) segments. */
+ uip_stats_t rexmit; /**< Number of retransmitted TCP segments. */
+ uip_stats_t syndrop; /**< Number of dropped SYNs due to too few
+ connections was avaliable. */
+ uip_stats_t synrst; /**< Number of SYNs for closed ports,
+ triggering a RST. */
+ } tcp; /**< TCP statistics. */
+#endif
+#if UIP_UDP
+ struct {
+ uip_stats_t drop; /**< Number of dropped UDP segments. */
+ uip_stats_t recv; /**< Number of recived UDP segments. */
+ uip_stats_t sent; /**< Number of sent UDP segments. */
+ uip_stats_t chkerr; /**< Number of UDP segments with a bad
+ checksum. */
+ } udp; /**< UDP statistics. */
+#endif /* UIP_UDP */
+#if UIP_CONF_IPV6
+ struct {
+ uip_stats_t drop; /**< Number of dropped ND6 packets. */
+ uip_stats_t recv; /**< Number of recived ND6 packets */
+ uip_stats_t sent; /**< Number of sent ND6 packets */
+ } nd6;
+#endif /*UIP_CONF_IPV6*/
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* All the stuff below this point is internal to uIP and should not be
+ * used directly by an application or by a device driver.
+ */
+/*---------------------------------------------------------------------------*/
+
+
+
+/* u8_t uip_flags:
+ *
+ * When the application is called, uip_flags will contain the flags
+ * that are defined in this file. Please read below for more
+ * information.
+ */
+extern u8_t uip_flags;
+
+/* The following flags may be set in the global variable uip_flags
+ before calling the application callback. The UIP_ACKDATA,
+ UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time,
+ whereas the others are mutually exclusive. Note that these flags
+ should *NOT* be accessed directly, but only through the uIP
+ functions/macros. */
+
+#define UIP_ACKDATA 1 /* Signifies that the outstanding data was
+ acked and the application should send
+ out new data instead of retransmitting
+ the last data. */
+#define UIP_NEWDATA 2 /* Flags the fact that the peer has sent
+ us new data. */
+#define UIP_REXMIT 4 /* Tells the application to retransmit the
+ data that was last sent. */
+#define UIP_POLL 8 /* Used for polling the application, to
+ check if the application has data that
+ it wants to send. */
+#define UIP_CLOSE 16 /* The remote host has closed the
+ connection, thus the connection has
+ gone away. Or the application signals
+ that it wants to close the
+ connection. */
+#define UIP_ABORT 32 /* The remote host has aborted the
+ connection, thus the connection has
+ gone away. Or the application signals
+ that it wants to abort the
+ connection. */
+#define UIP_CONNECTED 64 /* We have got a connection from a remote
+ host and have set up a new connection
+ for it, or an active connection has
+ been successfully established. */
+
+#define UIP_TIMEDOUT 128 /* The connection has been aborted due to
+ too many retransmissions. */
+
+
+/**
+ * \brief process the options within a hop by hop or destination option header
+ * \retval 0: nothing to send,
+ * \retval 1: drop pkt
+ * \retval 2: ICMP error message to send
+*/
+/*static u8_t
+uip_ext_hdr_options_process(); */
+
+/* uip_process(flag):
+ *
+ * The actual uIP function which does all the work.
+ */
+void uip_process(u8_t flag);
+
+ /* The following flags are passed as an argument to the uip_process()
+ function. They are used to distinguish between the two cases where
+ uip_process() is called. It can be called either because we have
+ incoming data that should be processed, or because the periodic
+ timer has fired. These values are never used directly, but only in
+ the macros defined in this file. */
+
+#define UIP_DATA 1 /* Tells uIP that there is incoming
+ data in the uip_buf buffer. The
+ length of the data is stored in the
+ global variable uip_len. */
+#define UIP_TIMER 2 /* Tells uIP that the periodic timer
+ has fired. */
+#define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should
+ be polled. */
+#define UIP_UDP_SEND_CONN 4 /* Tells uIP that a UDP datagram
+ should be constructed in the
+ uip_buf buffer. */
+#if UIP_UDP
+#define UIP_UDP_TIMER 5
+#endif /* UIP_UDP */
+
+/* The TCP states used in the uip_conn->tcpstateflags. */
+#define UIP_CLOSED 0
+#define UIP_SYN_RCVD 1
+#define UIP_SYN_SENT 2
+#define UIP_ESTABLISHED 3
+#define UIP_FIN_WAIT_1 4
+#define UIP_FIN_WAIT_2 5
+#define UIP_CLOSING 6
+#define UIP_TIME_WAIT 7
+#define UIP_LAST_ACK 8
+#define UIP_TS_MASK 15
+
+#define UIP_STOPPED 16
+
+/* The TCP and IP headers. */
+struct uip_tcpip_hdr {
+#if UIP_CONF_IPV6
+ /* IPv6 header. */
+ u8_t vtc,
+ tcflow;
+ u16_t flow;
+ u8_t len[2];
+ u8_t proto, ttl;
+ uip_ip6addr_t srcipaddr, destipaddr;
+#else /* UIP_CONF_IPV6 */
+ /* IPv4 header. */
+ u8_t vhl,
+ tos,
+ len[2],
+ ipid[2],
+ ipoffset[2],
+ ttl,
+ proto;
+ u16_t ipchksum;
+ uip_ipaddr_t srcipaddr, destipaddr;
+#endif /* UIP_CONF_IPV6 */
+
+ /* TCP header. */
+ u16_t srcport,
+ destport;
+ u8_t seqno[4],
+ ackno[4],
+ tcpoffset,
+ flags,
+ wnd[2];
+ u16_t tcpchksum;
+ u8_t urgp[2];
+ u8_t optdata[4];
+};
+
+/* The ICMP and IP headers. */
+struct uip_icmpip_hdr {
+#if UIP_CONF_IPV6
+ /* IPv6 header. */
+ u8_t vtc,
+ tcf;
+ u16_t flow;
+ u8_t len[2];
+ u8_t proto, ttl;
+ uip_ip6addr_t srcipaddr, destipaddr;
+#else /* UIP_CONF_IPV6 */
+ /* IPv4 header. */
+ u8_t vhl,
+ tos,
+ len[2],
+ ipid[2],
+ ipoffset[2],
+ ttl,
+ proto;
+ u16_t ipchksum;
+ uip_ipaddr_t srcipaddr, destipaddr;
+#endif /* UIP_CONF_IPV6 */
+
+ /* ICMP header. */
+ u8_t type, icode;
+ u16_t icmpchksum;
+#if !UIP_CONF_IPV6
+ u16_t id, seqno;
+ u8_t payload[1];
+#endif /* !UIP_CONF_IPV6 */
+};
+
+
+/* The UDP and IP headers. */
+struct uip_udpip_hdr {
+#if UIP_CONF_IPV6
+ /* IPv6 header. */
+ u8_t vtc,
+ tcf;
+ u16_t flow;
+ u8_t len[2];
+ u8_t proto, ttl;
+ uip_ip6addr_t srcipaddr, destipaddr;
+#else /* UIP_CONF_IPV6 */
+ /* IP header. */
+ u8_t vhl,
+ tos,
+ len[2],
+ ipid[2],
+ ipoffset[2],
+ ttl,
+ proto;
+ u16_t ipchksum;
+ uip_ipaddr_t srcipaddr, destipaddr;
+#endif /* UIP_CONF_IPV6 */
+
+ /* UDP header. */
+ u16_t srcport,
+ destport;
+ u16_t udplen;
+ u16_t udpchksum;
+};
+
+/*
+ * In IPv6 the length of the L3 headers before the transport header is
+ * not fixed, due to the possibility to include extension option headers
+ * after the IP header. hence we split here L3 and L4 headers
+ */
+/* The IP header */
+struct uip_ip_hdr {
+#if UIP_CONF_IPV6
+ /* IPV6 header */
+ u8_t vtc;
+ u8_t tcflow;
+ u16_t flow;
+ u8_t len[2];
+ u8_t proto, ttl;
+ uip_ip6addr_t srcipaddr, destipaddr;
+#else /* UIP_CONF_IPV6 */
+ /* IPV4 header */
+ u8_t vhl,
+ tos,
+ len[2],
+ ipid[2],
+ ipoffset[2],
+ ttl,
+ proto;
+ u16_t ipchksum;
+ uip_ipaddr_t srcipaddr, destipaddr;
+#endif /* UIP_CONF_IPV6 */
+};
+
+
+/*
+ * IPv6 extension option headers: we are able to process
+ * the 4 extension headers defined in RFC2460 (IPv6):
+ * - Hop by hop option header, destination option header:
+ * These two are not used by any core IPv6 protocol, hence
+ * we just read them and go to the next. They convey options,
+ * the options defined in RFC2460 are Pad1 and PadN, which do
+ * some padding, and that we do not need to read (the length
+ * field in the header is enough)
+ * - Routing header: this one is most notably used by MIPv6,
+ * which we do not implement, hence we just read it and go
+ * to the next
+ * - Fragmentation header: we read this header and are able to
+ * reassemble packets
+ *
+ * We do not offer any means to send packets with extension headers
+ *
+ * We do not implement Authentication and ESP headers, which are
+ * used in IPSec and defined in RFC4302,4303,4305,4385
+ */
+/* common header part */
+struct uip_ext_hdr {
+ u8_t next;
+ u8_t len;
+};
+
+/* Hop by Hop option header */
+struct uip_hbho_hdr {
+ u8_t next;
+ u8_t len;
+};
+
+/* destination option header */
+struct uip_desto_hdr {
+ u8_t next;
+ u8_t len;
+};
+
+/* We do not define structures for PAD1 and PADN options */
+
+/*
+ * routing header
+ * the routing header as 4 common bytes, then routing header type
+ * specific data there are several types of routing header. Type 0 was
+ * deprecated as per RFC5095 most notable other type is 2, used in
+ * RFC3775 (MIPv6) here we do not implement MIPv6, so we just need to
+ * parse the 4 first bytes
+ */
+struct uip_routing_hdr {
+ u8_t next;
+ u8_t len;
+ u8_t routing_type;
+ u8_t seg_left;
+};
+
+/* fragmentation header */
+struct uip_frag_hdr {
+ u8_t next;
+ u8_t res;
+ u16_t offsetresmore;
+ u32_t id;
+};
+
+/*
+ * an option within the destination or hop by hop option headers
+ * it contains type an length, which is true for all options but PAD1
+ */
+struct uip_ext_hdr_opt {
+ u8_t type;
+ u8_t len;
+};
+
+/* PADN option */
+struct uip_ext_hdr_opt_padn {
+ u8_t opt_type;
+ u8_t opt_len;
+};
+
+/* TCP header */
+struct uip_tcp_hdr {
+ u16_t srcport;
+ u16_t destport;
+ u8_t seqno[4];
+ u8_t ackno[4];
+ u8_t tcpoffset;
+ u8_t flags;
+ u8_t wnd[2];
+ u16_t tcpchksum;
+ u8_t urgp[2];
+ u8_t optdata[4];
+};
+
+/* The ICMP headers. */
+struct uip_icmp_hdr {
+ u8_t type, icode;
+ u16_t icmpchksum;
+#if !UIP_CONF_IPV6
+ u16_t id, seqno;
+#endif /* !UIP_CONF_IPV6 */
+};
+
+
+/* The UDP headers. */
+struct uip_udp_hdr {
+ u16_t srcport;
+ u16_t destport;
+ u16_t udplen;
+ u16_t udpchksum;
+};
+
+
+/**
+ * The buffer size available for user data in the \ref uip_buf buffer.
+ *
+ * This macro holds the available size for user data in the \ref
+ * uip_buf buffer. The macro is intended to be used for checking
+ * bounds of available user data.
+ *
+ * Example:
+ \code
+ snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i);
+ \endcode
+ *
+ * \hideinitializer
+ */
+#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
+#define UIP_APPDATA_PTR (void *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]
+
+#define UIP_PROTO_ICMP 1
+#define UIP_PROTO_TCP 6
+#define UIP_PROTO_UDP 17
+#define UIP_PROTO_ICMP6 58
+
+
+#if UIP_CONF_IPV6
+/** @{ */
+/** \brief extension headers types */
+#define UIP_PROTO_HBHO 0
+#define UIP_PROTO_DESTO 60
+#define UIP_PROTO_ROUTING 43
+#define UIP_PROTO_FRAG 44
+#define UIP_PROTO_NONE 59
+/** @} */
+
+/** @{ */
+/** \brief Destination and Hop By Hop extension headers option types */
+#define UIP_EXT_HDR_OPT_PAD1 0
+#define UIP_EXT_HDR_OPT_PADN 1
+/** @} */
+
+/** @{ */
+/**
+ * \brief Bitmaps for extension header processing
+ *
+ * When processing extension headers, we should record somehow which one we
+ * see, because you cannot have twice the same header, except for destination
+ * We store all this in one u8_t bitmap one bit for each header expected. The
+ * order in the bitmap is the order recommended in RFC2460
+ */
+#define UIP_EXT_HDR_BITMAP_HBHO 0x01
+#define UIP_EXT_HDR_BITMAP_DESTO1 0x02
+#define UIP_EXT_HDR_BITMAP_ROUTING 0x04
+#define UIP_EXT_HDR_BITMAP_FRAG 0x08
+#define UIP_EXT_HDR_BITMAP_AH 0x10
+#define UIP_EXT_HDR_BITMAP_ESP 0x20
+#define UIP_EXT_HDR_BITMAP_DESTO2 0x40
+/** @} */
+
+
+#endif /* UIP_CONF_IPV6 */
+
+
+/* Header sizes. */
+#if UIP_CONF_IPV6
+#define UIP_IPH_LEN 40
+#define UIP_FRAGH_LEN 8
+#else /* UIP_CONF_IPV6 */
+#define UIP_IPH_LEN 20 /* Size of IP header */
+#endif /* UIP_CONF_IPV6 */
+
+#define UIP_UDPH_LEN 8 /* Size of UDP header */
+#define UIP_TCPH_LEN 20 /* Size of TCP header */
+#ifdef UIP_IPH_LEN
+#define UIP_ICMPH_LEN 4 /* Size of ICMP header */
+#endif
+#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP +
+ * UDP
+ * header */
+#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP +
+ * TCP
+ * header */
+#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
+#define UIP_IPICMPH_LEN (UIP_IPH_LEN + UIP_ICMPH_LEN) /* size of ICMP
+ + IP header */
+#define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* size of L2
+ + IP header */
+#if UIP_CONF_IPV6
+/**
+ * The sums below are quite used in ND. When used for uip_buf, we
+ * include link layer length when used for uip_len, we do not, hence
+ * we need values with and without LLH_LEN we do not use capital
+ * letters as these values are variable
+ */
+#define uip_l2_l3_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len)
+#define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
+#define uip_l3_hdr_len (UIP_IPH_LEN + uip_ext_len)
+#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
+#endif /*UIP_CONF_IPV6*/
+
+
+#if UIP_FIXEDADDR
+extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
+#else /* UIP_FIXEDADDR */
+extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
+#endif /* UIP_FIXEDADDR */
+extern const uip_ipaddr_t uip_broadcast_addr;
+extern const uip_ipaddr_t uip_all_zeroes_addr;
+
+#if UIP_FIXEDETHADDR
+extern const uip_lladdr_t uip_lladdr;
+#else
+extern uip_lladdr_t uip_lladdr;
+#endif
+
+
+
+
+#ifdef UIP_CONF_IPV6
+/**
+ * \brief Is IPv6 address a the unspecified address
+ * a is of type uip_ipaddr_t
+ */
+#define uip_is_addr_unspecified(a) \
+ ((((a)->u16[0]) == 0) && \
+ (((a)->u16[1]) == 0) && \
+ (((a)->u16[2]) == 0) && \
+ (((a)->u16[3]) == 0) && \
+ (((a)->u16[4]) == 0) && \
+ (((a)->u16[5]) == 0) && \
+ (((a)->u16[6]) == 0) && \
+ (((a)->u16[7]) == 0))
+
+/** \brief Is IPv6 address a the link local all-nodes multicast address */
+#define uip_is_addr_linklocal_allnodes_mcast(a) \
+ ((((a)->u8[0]) == 0xff) && \
+ (((a)->u8[1]) == 0x02) && \
+ (((a)->u16[1]) == 0) && \
+ (((a)->u16[2]) == 0) && \
+ (((a)->u16[3]) == 0) && \
+ (((a)->u16[4]) == 0) && \
+ (((a)->u16[5]) == 0) && \
+ (((a)->u16[6]) == 0) && \
+ (((a)->u8[14]) == 0) && \
+ (((a)->u8[15]) == 0x01))
+
+/** \brief set IP address a to unspecified */
+#define uip_create_unspecified(a) uip_ip6addr(a, 0, 0, 0, 0, 0, 0, 0, 0)
+
+/** \brief set IP address a to the link local all-nodes multicast address */
+#define uip_create_linklocal_allnodes_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001)
+
+/** \brief set IP address a to the link local all-routers multicast address */
+#define uip_create_linklocal_allrouters_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002)
+
+/**
+ * \brief is addr (a) a solicited node multicast address, see RFC3513
+ * a is of type uip_ipaddr_t*
+ */
+#define uip_is_addr_solicited_node(a) \
+ ((((a)->u8[0]) == 0xFF) && \
+ (((a)->u8[1]) == 0x02) && \
+ (((a)->u16[1]) == 0) && \
+ (((a)->u16[2]) == 0) && \
+ (((a)->u16[3]) == 0) && \
+ (((a)->u16[4]) == 0) && \
+ (((a)->u16[5]) == 1) && \
+ (((a)->u8[12]) == 0xFF))
+
+/**
+ * \briefput in b the solicited node address corresponding to address a
+ * both a and b are of type uip_ipaddr_t*
+ * */
+#define uip_create_solicited_node(a, b) \
+ (((b)->u8[0]) = 0xFF); \
+ (((b)->u8[1]) = 0x02); \
+ (((b)->u16[1]) = 0); \
+ (((b)->u16[2]) = 0); \
+ (((b)->u16[3]) = 0); \
+ (((b)->u16[4]) = 0); \
+ (((b)->u8[10]) = 0); \
+ (((b)->u8[11]) = 0x01); \
+ (((b)->u8[12]) = 0xFF); \
+ (((b)->u8[13]) = ((a)->u8[13])); \
+ (((b)->u16[7]) = ((a)->u16[7]))
+
+/**
+ * \brief is addr (a) a link local unicast address, see RFC3513
+ * i.e. is (a) on prefix FE80::/10
+ * a is of type uip_ipaddr_t*
+ */
+#define uip_is_addr_link_local(a) \
+ ((((a)->u8[0]) == 0xFE) && \
+ (((a)->u8[1]) == 0x80))
+
+/**
+ * \brief was addr (a) forged based on the mac address m
+ * a type is uip_ipaddr_t
+ * m type is uiplladdr_t
+ */
+#if UIP_CONF_LL_802154
+#define uip_is_addr_mac_addr_based(a, m) \
+ ((((a)->u8[8]) == (((m)->addr[0]) ^ 0x02)) && \
+ (((a)->u8[9]) == (m)->addr[1]) && \
+ (((a)->u8[10]) == (m)->addr[2]) && \
+ (((a)->u8[11]) == (m)->addr[3]) && \
+ (((a)->u8[12]) == (m)->addr[4]) && \
+ (((a)->u8[13]) == (m)->addr[5]) && \
+ (((a)->u8[14]) == (m)->addr[6]) && \
+ (((a)->u8[15]) == (m)->addr[7]))
+#else
+
+#define uip_is_addr_mac_addr_based(a, m) \
+ ((((a)->u8[8]) == (((m)->addr[0]) | 0x02)) && \
+ (((a)->u8[9]) == (m)->addr[1]) && \
+ (((a)->u8[10]) == (m)->addr[2]) && \
+ (((a)->u8[11]) == 0xff) && \
+ (((a)->u8[12]) == 0xfe) && \
+ (((a)->u8[13]) == (m)->addr[3]) && \
+ (((a)->u8[14]) == (m)->addr[4]) && \
+ (((a)->u8[15]) == (m)->addr[5]))
+
+#endif /*UIP_CONF_LL_802154*/
+
+/**
+ * \brief is address a multicast address, see RFC 3513
+ * a is of type uip_ipaddr_t*
+ * */
+#define uip_is_addr_mcast(a) \
+ (((a)->u8[0]) == 0xFF)
+
+/**
+ * \brief is group-id of multicast address a
+ * the all nodes group-id
+ */
+#define uip_is_mcast_group_id_all_nodes(a) \
+ ((((a)->u16[1]) == 0) && \
+ (((a)->u16[2]) == 0) && \
+ (((a)->u16[3]) == 0) && \
+ (((a)->u16[4]) == 0) && \
+ (((a)->u16[5]) == 0) && \
+ (((a)->u16[6]) == 0) && \
+ (((a)->u8[14]) == 0) && \
+ (((a)->u8[15]) == 1))
+
+/**
+ * \brief is group-id of multicast address a
+ * the all routers group-id
+ */
+#define uip_is_mcast_group_id_all_routers(a) \
+ ((((a)->u16[1]) == 0) && \
+ (((a)->u16[2]) == 0) && \
+ (((a)->u16[3]) == 0) && \
+ (((a)->u16[4]) == 0) && \
+ (((a)->u16[5]) == 0) && \
+ (((a)->u16[6]) == 0) && \
+ (((a)->u8[14]) == 0) && \
+ (((a)->u8[15]) == 2))
+
+
+#endif /*UIP_CONF_IPV6*/
+
+/**
+ * Calculate the Internet checksum over a buffer.
+ *
+ * The Internet checksum is the one's complement of the one's
+ * complement sum of all 16-bit words in the buffer.
+ *
+ * See RFC1071.
+ *
+ * \param buf A pointer to the buffer over which the checksum is to be
+ * computed.
+ *
+ * \param len The length of the buffer over which the checksum is to
+ * be computed.
+ *
+ * \return The Internet checksum of the buffer.
+ */
+u16_t uip_chksum(u16_t *buf, u16_t len);
+
+/**
+ * Calculate the IP header checksum of the packet header in uip_buf.
+ *
+ * The IP header checksum is the Internet checksum of the 20 bytes of
+ * the IP header.
+ *
+ * \return The IP header checksum of the IP header in the uip_buf
+ * buffer.
+ */
+u16_t uip_ipchksum(void);
+
+/**
+ * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
+ *
+ * The TCP checksum is the Internet checksum of data contents of the
+ * TCP segment, and a pseudo-header as defined in RFC793.
+ *
+ * \return The TCP checksum of the TCP segment in uip_buf and pointed
+ * to by uip_appdata.
+ */
+u16_t uip_tcpchksum(void);
+
+/**
+ * Calculate the UDP checksum of the packet in uip_buf and uip_appdata.
+ *
+ * The UDP checksum is the Internet checksum of data contents of the
+ * UDP segment, and a pseudo-header as defined in RFC768.
+ *
+ * \return The UDP checksum of the UDP segment in uip_buf and pointed
+ * to by uip_appdata.
+ */
+u16_t uip_udpchksum(void);
+
+/**
+ * Calculate the ICMP checksum of the packet in uip_buf.
+ *
+ * \return The ICMP checksum of the ICMP packet in uip_buf
+ */
+u16_t uip_icmp6chksum(void);
+
+
+#endif /* __UIP_H__ */
+
+
+/** @} */
diff --git a/Projects/Webserver/Lib/uip/uip_arp.c b/Projects/Webserver/Lib/uip/uip_arp.c
index 88c14cc01..56dff9c43 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.c
+++ b/Projects/Webserver/Lib/uip/uip_arp.c
@@ -1,431 +1,431 @@
-/**
- * \addtogroup uip
- * @{
- */
-
-/**
- * \defgroup uiparp uIP Address Resolution Protocol
- * @{
- *
- * The Address Resolution Protocol ARP is used for mapping between IP
- * addresses and link level addresses such as the Ethernet MAC
- * addresses. ARP uses broadcast queries to ask for the link level
- * address of a known IP address and the host which is configured with
- * the IP address for which the query was meant, will respond with its
- * link level address.
- *
- * \note This ARP implementation only supports Ethernet.
- */
-
-/**
- * \file
- * Implementation of the ARP Address Resolution Protocol.
- * \author Adam Dunkels <adam@dunkels.com>
- *
- */
-
-/*
- * Copyright (c) 2001-2003, Adam Dunkels.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack.
- *
- * $Id: uip_arp.c,v 1.5 2008/02/07 01:35:00 adamdunkels Exp $
- *
- */
-
-
-#include "uip_arp.h"
-
-#include <string.h>
-
-struct arp_hdr {
- struct uip_eth_hdr ethhdr;
- u16_t hwtype;
- u16_t protocol;
- u8_t hwlen;
- u8_t protolen;
- u16_t opcode;
- struct uip_eth_addr shwaddr;
- uip_ipaddr_t sipaddr;
- struct uip_eth_addr dhwaddr;
- uip_ipaddr_t dipaddr;
-};
-
-struct ethip_hdr {
- struct uip_eth_hdr ethhdr;
- /* IP header. */
- u8_t vhl,
- tos,
- len[2],
- ipid[2],
- ipoffset[2],
- ttl,
- proto;
- u16_t ipchksum;
- uip_ipaddr_t srcipaddr, destipaddr;
-};
-
-#define ARP_REQUEST 1
-#define ARP_REPLY 2
-
-#define ARP_HWTYPE_ETH 1
-
-struct arp_entry {
- uip_ipaddr_t ipaddr;
- struct uip_eth_addr ethaddr;
- u8_t time;
-};
-
-static const struct uip_eth_addr broadcast_ethaddr =
- {{0xff,0xff,0xff,0xff,0xff,0xff}};
-static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff};
-
-static struct arp_entry arp_table[UIP_ARPTAB_SIZE];
-static uip_ipaddr_t ipaddr;
-static u8_t i, c;
-
-static u8_t arptime;
-static u8_t tmpage;
-
-#define BUF ((struct arp_hdr *)&uip_buf[0])
-#define IPBUF ((struct ethip_hdr *)&uip_buf[0])
-
-#define DEBUG 0
-#if DEBUG
-#include <stdio.h>
-#define PRINTF(...) printf(__VA_ARGS__)
-#else
-#define PRINTF(...)
-#endif
-
-/*-----------------------------------------------------------------------------------*/
-/**
- * Initialize the ARP module.
- *
- */
-/*-----------------------------------------------------------------------------------*/
-void
-uip_arp_init(void)
-{
- for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
- memset(&arp_table[i].ipaddr, 0, 4);
- }
-}
-/*-----------------------------------------------------------------------------------*/
-/**
- * Periodic ARP processing function.
- *
- * This function performs periodic timer processing in the ARP module
- * and should be called at regular intervals. The recommended interval
- * is 10 seconds between the calls.
- *
- */
-/*-----------------------------------------------------------------------------------*/
-void
-uip_arp_timer(void)
-{
- struct arp_entry *tabptr = NULL;
-
- ++arptime;
- for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
- tabptr = &arp_table[i];
- if(uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr) &&
- arptime - tabptr->time >= UIP_ARP_MAXAGE) {
- memset(&tabptr->ipaddr, 0, 4);
- }
- }
-
-}
-/*-----------------------------------------------------------------------------------*/
-static void
-uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr)
-{
- register struct arp_entry *tabptr = NULL;
- /* Walk through the ARP mapping table and try to find an entry to
- update. If none is found, the IP -> MAC address mapping is
- inserted in the ARP table. */
- for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
-
- tabptr = &arp_table[i];
- /* Only check those entries that are actually in use. */
- if(!uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) {
-
- /* Check if the source IP address of the incoming packet matches
- the IP address in this ARP table entry. */
- if(uip_ipaddr_cmp(ipaddr, &tabptr->ipaddr)) {
-
- /* An old entry found, update this and return. */
- memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
- tabptr->time = arptime;
-
- return;
- }
- }
- }
-
- /* If we get here, no existing ARP table entry was found, so we
- create one. */
-
- /* First, we try to find an unused entry in the ARP table. */
- for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
- tabptr = &arp_table[i];
- if(uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) {
- break;
- }
- }
-
- /* If no unused entry is found, we try to find the oldest entry and
- throw it away. */
- if(i == UIP_ARPTAB_SIZE) {
- tmpage = 0;
- c = 0;
- for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
- tabptr = &arp_table[i];
- if(arptime - tabptr->time > tmpage) {
- tmpage = arptime - tabptr->time;
- c = i;
- }
- }
- i = c;
- tabptr = &arp_table[i];
- }
-
- /* Now, i is the ARP table entry which we will fill with the new
- information. */
- uip_ipaddr_copy(&tabptr->ipaddr, ipaddr);
- memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
- tabptr->time = arptime;
-}
-/*-----------------------------------------------------------------------------------*/
-/**
- * ARP processing for incoming IP packets
- *
- * This function should be called by the device driver when an IP
- * packet has been received. The function will check if the address is
- * in the ARP cache, and if so the ARP cache entry will be
- * refreshed. If no ARP cache entry was found, a new one is created.
- *
- * This function expects an IP packet with a prepended Ethernet header
- * in the uip_buf[] buffer, and the length of the packet in the global
- * variable uip_len.
- */
-/*-----------------------------------------------------------------------------------*/
-#if 0
-void
-uip_arp_ipin(void)
-{
- uip_len -= sizeof(struct uip_eth_hdr);
-
- /* Only insert/update an entry if the source IP address of the
- incoming IP packet comes from a host on the local network. */
- if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=
- (uip_hostaddr[0] & uip_netmask[0])) {
- return;
- }
- if((IPBUF->srcipaddr[1] & uip_netmask[1]) !=
- (uip_hostaddr[1] & uip_netmask[1])) {
- return;
- }
- uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
-
- return;
-}
-#endif /* 0 */
-/*-----------------------------------------------------------------------------------*/
-/**
- * ARP processing for incoming ARP packets.
- *
- * This function should be called by the device driver when an ARP
- * packet has been received. The function will act differently
- * depending on the ARP packet type: if it is a reply for a request
- * that we previously sent out, the ARP cache will be filled in with
- * the values from the ARP reply. If the incoming ARP packet is an ARP
- * request for our IP address, an ARP reply packet is created and put
- * into the uip_buf[] buffer.
- *
- * When the function returns, the value of the global variable uip_len
- * indicates whether the device driver should send out a packet or
- * not. If uip_len is zero, no packet should be sent. If uip_len is
- * non-zero, it contains the length of the outbound packet that is
- * present in the uip_buf[] buffer.
- *
- * This function expects an ARP packet with a prepended Ethernet
- * header in the uip_buf[] buffer, and the length of the packet in the
- * global variable uip_len.
- */
-/*-----------------------------------------------------------------------------------*/
-void
-uip_arp_arpin(void)
-{
- if(uip_len < sizeof(struct arp_hdr)) {
- uip_len = 0;
- return;
- }
- uip_len = 0;
-
- switch(BUF->opcode) {
- case HTONS(ARP_REQUEST):
- /* ARP request. If it asked for our address, we send out a
- reply. */
- /* if(BUF->dipaddr[0] == uip_hostaddr[0] &&
- BUF->dipaddr[1] == uip_hostaddr[1]) {*/
- PRINTF("uip_arp_arpin: request for %d.%d.%d.%d (we are %d.%d.%d.%d)\n",
- BUF->dipaddr.u8[0], BUF->dipaddr.u8[1],
- BUF->dipaddr.u8[2], BUF->dipaddr.u8[3],
- uip_hostaddr.u8[0], uip_hostaddr.u8[1],
- uip_hostaddr.u8[2], uip_hostaddr.u8[3]);
- if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
- /* First, we register the one who made the request in our ARP
- table, since it is likely that we will do more communication
- with this host in the future. */
- uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
-
- BUF->opcode = HTONS(ARP_REPLY);
-
- memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
- memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
- memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
- memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
-
- uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
- uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
-
- BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
- uip_len = sizeof(struct arp_hdr);
- }
- break;
- case HTONS(ARP_REPLY):
- /* ARP reply. We insert or update the ARP table if it was meant
- for us. */
- if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
- uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
- }
- break;
- }
-
- return;
-}
-/*-----------------------------------------------------------------------------------*/
-/**
- * Prepend Ethernet header to an outbound IP packet and see if we need
- * to send out an ARP request.
- *
- * This function should be called before sending out an IP packet. The
- * function checks the destination IP address of the IP packet to see
- * what Ethernet MAC address that should be used as a destination MAC
- * address on the Ethernet.
- *
- * If the destination IP address is in the local network (determined
- * by logical ANDing of netmask and our IP address), the function
- * checks the ARP cache to see if an entry for the destination IP
- * address is found. If so, an Ethernet header is prepended and the
- * function returns. If no ARP cache entry is found for the
- * destination IP address, the packet in the uip_buf[] is replaced by
- * an ARP request packet for the IP address. The IP packet is dropped
- * and it is assumed that they higher level protocols (e.g., TCP)
- * eventually will retransmit the dropped packet.
- *
- * If the destination IP address is not on the local network, the IP
- * address of the default router is used instead.
- *
- * When the function returns, a packet is present in the uip_buf[]
- * buffer, and the length of the packet is in the global variable
- * uip_len.
- */
-/*-----------------------------------------------------------------------------------*/
-void
-uip_arp_out(void)
-{
- struct arp_entry *tabptr = NULL;
-
- /* Find the destination IP address in the ARP table and construct
- the Ethernet header. If the destination IP addres isn't on the
- local network, we use the default router's IP address instead.
-
- If not ARP table entry is found, we overwrite the original IP
- packet with an ARP request for the IP address. */
-
- /* First check if destination is a local broadcast. */
- if(uip_ipaddr_cmp(&IPBUF->destipaddr, &uip_broadcast_addr)) {
- memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6);
- } else {
- /* Check if the destination address is on the local network. */
- if(!uip_ipaddr_maskcmp(&IPBUF->destipaddr, &uip_hostaddr, &uip_netmask)) {
- /* Destination address was not on the local network, so we need to
- use the default router's IP address instead of the destination
- address when determining the MAC address. */
- uip_ipaddr_copy(&ipaddr, &uip_draddr);
- } else {
- /* Else, we use the destination IP address. */
- uip_ipaddr_copy(&ipaddr, &IPBUF->destipaddr);
- }
-
- for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
- tabptr = &arp_table[i];
- if(uip_ipaddr_cmp(&ipaddr, &tabptr->ipaddr)) {
- break;
- }
- }
-
- if(i == UIP_ARPTAB_SIZE) {
- /* The destination address was not in our ARP table, so we
- overwrite the IP packet with an ARP request. */
-
- memset(BUF->ethhdr.dest.addr, 0xff, 6);
- memset(BUF->dhwaddr.addr, 0x00, 6);
- memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
- memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
-
- uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
- uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
- BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
- BUF->hwtype = HTONS(ARP_HWTYPE_ETH);
- BUF->protocol = HTONS(UIP_ETHTYPE_IP);
- BUF->hwlen = 6;
- BUF->protolen = 4;
- BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
-
- uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
-
- uip_len = sizeof(struct arp_hdr);
- return;
- }
-
- /* Build an ethernet header. */
- memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
- }
- memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
-
- IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
-
- uip_len += sizeof(struct uip_eth_hdr);
-}
-/*-----------------------------------------------------------------------------------*/
-
-/** @} */
-/** @} */
+/**
+ * \addtogroup uip
+ * @{
+ */
+
+/**
+ * \defgroup uiparp uIP Address Resolution Protocol
+ * @{
+ *
+ * The Address Resolution Protocol ARP is used for mapping between IP
+ * addresses and link level addresses such as the Ethernet MAC
+ * addresses. ARP uses broadcast queries to ask for the link level
+ * address of a known IP address and the host which is configured with
+ * the IP address for which the query was meant, will respond with its
+ * link level address.
+ *
+ * \note This ARP implementation only supports Ethernet.
+ */
+
+/**
+ * \file
+ * Implementation of the ARP Address Resolution Protocol.
+ * \author Adam Dunkels <adam@dunkels.com>
+ *
+ */
+
+/*
+ * Copyright (c) 2001-2003, Adam Dunkels.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uip_arp.c,v 1.5 2008/02/07 01:35:00 adamdunkels Exp $
+ *
+ */
+
+
+#include "uip_arp.h"
+
+#include <string.h>
+
+struct arp_hdr {
+ struct uip_eth_hdr ethhdr;
+ u16_t hwtype;
+ u16_t protocol;
+ u8_t hwlen;
+ u8_t protolen;
+ u16_t opcode;
+ struct uip_eth_addr shwaddr;
+ uip_ipaddr_t sipaddr;
+ struct uip_eth_addr dhwaddr;
+ uip_ipaddr_t dipaddr;
+};
+
+struct ethip_hdr {
+ struct uip_eth_hdr ethhdr;
+ /* IP header. */
+ u8_t vhl,
+ tos,
+ len[2],
+ ipid[2],
+ ipoffset[2],
+ ttl,
+ proto;
+ u16_t ipchksum;
+ uip_ipaddr_t srcipaddr, destipaddr;
+};
+
+#define ARP_REQUEST 1
+#define ARP_REPLY 2
+
+#define ARP_HWTYPE_ETH 1
+
+struct arp_entry {
+ uip_ipaddr_t ipaddr;
+ struct uip_eth_addr ethaddr;
+ u8_t time;
+};
+
+static const struct uip_eth_addr broadcast_ethaddr =
+ {{0xff,0xff,0xff,0xff,0xff,0xff}};
+static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff};
+
+static struct arp_entry arp_table[UIP_ARPTAB_SIZE];
+static uip_ipaddr_t ipaddr;
+static u8_t i, c;
+
+static u8_t arptime;
+static u8_t tmpage;
+
+#define BUF ((struct arp_hdr *)&uip_buf[0])
+#define IPBUF ((struct ethip_hdr *)&uip_buf[0])
+
+#define DEBUG 0
+#if DEBUG
+#include <stdio.h>
+#define PRINTF(...) printf(__VA_ARGS__)
+#else
+#define PRINTF(...)
+#endif
+
+/*-----------------------------------------------------------------------------------*/
+/**
+ * Initialize the ARP module.
+ *
+ */
+/*-----------------------------------------------------------------------------------*/
+void
+uip_arp_init(void)
+{
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
+ memset(&arp_table[i].ipaddr, 0, 4);
+ }
+}
+/*-----------------------------------------------------------------------------------*/
+/**
+ * Periodic ARP processing function.
+ *
+ * This function performs periodic timer processing in the ARP module
+ * and should be called at regular intervals. The recommended interval
+ * is 10 seconds between the calls.
+ *
+ */
+/*-----------------------------------------------------------------------------------*/
+void
+uip_arp_timer(void)
+{
+ struct arp_entry *tabptr = NULL;
+
+ ++arptime;
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
+ tabptr = &arp_table[i];
+ if(uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr) &&
+ arptime - tabptr->time >= UIP_ARP_MAXAGE) {
+ memset(&tabptr->ipaddr, 0, 4);
+ }
+ }
+
+}
+/*-----------------------------------------------------------------------------------*/
+static void
+uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr)
+{
+ register struct arp_entry *tabptr = NULL;
+ /* Walk through the ARP mapping table and try to find an entry to
+ update. If none is found, the IP -> MAC address mapping is
+ inserted in the ARP table. */
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
+
+ tabptr = &arp_table[i];
+ /* Only check those entries that are actually in use. */
+ if(!uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) {
+
+ /* Check if the source IP address of the incoming packet matches
+ the IP address in this ARP table entry. */
+ if(uip_ipaddr_cmp(ipaddr, &tabptr->ipaddr)) {
+
+ /* An old entry found, update this and return. */
+ memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
+ tabptr->time = arptime;
+
+ return;
+ }
+ }
+ }
+
+ /* If we get here, no existing ARP table entry was found, so we
+ create one. */
+
+ /* First, we try to find an unused entry in the ARP table. */
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
+ tabptr = &arp_table[i];
+ if(uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) {
+ break;
+ }
+ }
+
+ /* If no unused entry is found, we try to find the oldest entry and
+ throw it away. */
+ if(i == UIP_ARPTAB_SIZE) {
+ tmpage = 0;
+ c = 0;
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
+ tabptr = &arp_table[i];
+ if(arptime - tabptr->time > tmpage) {
+ tmpage = arptime - tabptr->time;
+ c = i;
+ }
+ }
+ i = c;
+ tabptr = &arp_table[i];
+ }
+
+ /* Now, i is the ARP table entry which we will fill with the new
+ information. */
+ uip_ipaddr_copy(&tabptr->ipaddr, ipaddr);
+ memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
+ tabptr->time = arptime;
+}
+/*-----------------------------------------------------------------------------------*/
+/**
+ * ARP processing for incoming IP packets
+ *
+ * This function should be called by the device driver when an IP
+ * packet has been received. The function will check if the address is
+ * in the ARP cache, and if so the ARP cache entry will be
+ * refreshed. If no ARP cache entry was found, a new one is created.
+ *
+ * This function expects an IP packet with a prepended Ethernet header
+ * in the uip_buf[] buffer, and the length of the packet in the global
+ * variable uip_len.
+ */
+/*-----------------------------------------------------------------------------------*/
+#if 0
+void
+uip_arp_ipin(void)
+{
+ uip_len -= sizeof(struct uip_eth_hdr);
+
+ /* Only insert/update an entry if the source IP address of the
+ incoming IP packet comes from a host on the local network. */
+ if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=
+ (uip_hostaddr[0] & uip_netmask[0])) {
+ return;
+ }
+ if((IPBUF->srcipaddr[1] & uip_netmask[1]) !=
+ (uip_hostaddr[1] & uip_netmask[1])) {
+ return;
+ }
+ uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
+
+ return;
+}
+#endif /* 0 */
+/*-----------------------------------------------------------------------------------*/
+/**
+ * ARP processing for incoming ARP packets.
+ *
+ * This function should be called by the device driver when an ARP
+ * packet has been received. The function will act differently
+ * depending on the ARP packet type: if it is a reply for a request
+ * that we previously sent out, the ARP cache will be filled in with
+ * the values from the ARP reply. If the incoming ARP packet is an ARP
+ * request for our IP address, an ARP reply packet is created and put
+ * into the uip_buf[] buffer.
+ *
+ * When the function returns, the value of the global variable uip_len
+ * indicates whether the device driver should send out a packet or
+ * not. If uip_len is zero, no packet should be sent. If uip_len is
+ * non-zero, it contains the length of the outbound packet that is
+ * present in the uip_buf[] buffer.
+ *
+ * This function expects an ARP packet with a prepended Ethernet
+ * header in the uip_buf[] buffer, and the length of the packet in the
+ * global variable uip_len.
+ */
+/*-----------------------------------------------------------------------------------*/
+void
+uip_arp_arpin(void)
+{
+ if(uip_len < sizeof(struct arp_hdr)) {
+ uip_len = 0;
+ return;
+ }
+ uip_len = 0;
+
+ switch(BUF->opcode) {
+ case HTONS(ARP_REQUEST):
+ /* ARP request. If it asked for our address, we send out a
+ reply. */
+ /* if(BUF->dipaddr[0] == uip_hostaddr[0] &&
+ BUF->dipaddr[1] == uip_hostaddr[1]) {*/
+ PRINTF("uip_arp_arpin: request for %d.%d.%d.%d (we are %d.%d.%d.%d)\n",
+ BUF->dipaddr.u8[0], BUF->dipaddr.u8[1],
+ BUF->dipaddr.u8[2], BUF->dipaddr.u8[3],
+ uip_hostaddr.u8[0], uip_hostaddr.u8[1],
+ uip_hostaddr.u8[2], uip_hostaddr.u8[3]);
+ if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
+ /* First, we register the one who made the request in our ARP
+ table, since it is likely that we will do more communication
+ with this host in the future. */
+ uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
+
+ BUF->opcode = HTONS(ARP_REPLY);
+
+ memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
+ memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
+ memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
+ memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
+
+ uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
+ uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
+
+ BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
+ uip_len = sizeof(struct arp_hdr);
+ }
+ break;
+ case HTONS(ARP_REPLY):
+ /* ARP reply. We insert or update the ARP table if it was meant
+ for us. */
+ if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
+ uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
+ }
+ break;
+ }
+
+ return;
+}
+/*-----------------------------------------------------------------------------------*/
+/**
+ * Prepend Ethernet header to an outbound IP packet and see if we need
+ * to send out an ARP request.
+ *
+ * This function should be called before sending out an IP packet. The
+ * function checks the destination IP address of the IP packet to see
+ * what Ethernet MAC address that should be used as a destination MAC
+ * address on the Ethernet.
+ *
+ * If the destination IP address is in the local network (determined
+ * by logical ANDing of netmask and our IP address), the function
+ * checks the ARP cache to see if an entry for the destination IP
+ * address is found. If so, an Ethernet header is prepended and the
+ * function returns. If no ARP cache entry is found for the
+ * destination IP address, the packet in the uip_buf[] is replaced by
+ * an ARP request packet for the IP address. The IP packet is dropped
+ * and it is assumed that they higher level protocols (e.g., TCP)
+ * eventually will retransmit the dropped packet.
+ *
+ * If the destination IP address is not on the local network, the IP
+ * address of the default router is used instead.
+ *
+ * When the function returns, a packet is present in the uip_buf[]
+ * buffer, and the length of the packet is in the global variable
+ * uip_len.
+ */
+/*-----------------------------------------------------------------------------------*/
+void
+uip_arp_out(void)
+{
+ struct arp_entry *tabptr = NULL;
+
+ /* Find the destination IP address in the ARP table and construct
+ the Ethernet header. If the destination IP addres isn't on the
+ local network, we use the default router's IP address instead.
+
+ If not ARP table entry is found, we overwrite the original IP
+ packet with an ARP request for the IP address. */
+
+ /* First check if destination is a local broadcast. */
+ if(uip_ipaddr_cmp(&IPBUF->destipaddr, &uip_broadcast_addr)) {
+ memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6);
+ } else {
+ /* Check if the destination address is on the local network. */
+ if(!uip_ipaddr_maskcmp(&IPBUF->destipaddr, &uip_hostaddr, &uip_netmask)) {
+ /* Destination address was not on the local network, so we need to
+ use the default router's IP address instead of the destination
+ address when determining the MAC address. */
+ uip_ipaddr_copy(&ipaddr, &uip_draddr);
+ } else {
+ /* Else, we use the destination IP address. */
+ uip_ipaddr_copy(&ipaddr, &IPBUF->destipaddr);
+ }
+
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
+ tabptr = &arp_table[i];
+ if(uip_ipaddr_cmp(&ipaddr, &tabptr->ipaddr)) {
+ break;
+ }
+ }
+
+ if(i == UIP_ARPTAB_SIZE) {
+ /* The destination address was not in our ARP table, so we
+ overwrite the IP packet with an ARP request. */
+
+ memset(BUF->ethhdr.dest.addr, 0xff, 6);
+ memset(BUF->dhwaddr.addr, 0x00, 6);
+ memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
+ memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
+
+ uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
+ uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
+ BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
+ BUF->hwtype = HTONS(ARP_HWTYPE_ETH);
+ BUF->protocol = HTONS(UIP_ETHTYPE_IP);
+ BUF->hwlen = 6;
+ BUF->protolen = 4;
+ BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
+
+ uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
+
+ uip_len = sizeof(struct arp_hdr);
+ return;
+ }
+
+ /* Build an ethernet header. */
+ memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
+ }
+ memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
+
+ IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
+
+ uip_len += sizeof(struct uip_eth_hdr);
+}
+/*-----------------------------------------------------------------------------------*/
+
+/** @} */
+/** @} */
diff --git a/Projects/Webserver/Lib/uip/uip_arp.h b/Projects/Webserver/Lib/uip/uip_arp.h
index ea2fd293c..114d4310c 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.h
+++ b/Projects/Webserver/Lib/uip/uip_arp.h
@@ -1,145 +1,145 @@
-/**
- * \addtogroup uip
- * @{
- */
-
-/**
- * \addtogroup uiparp
- * @{
- */
-
-/**
- * \file
- * Macros and definitions for the ARP module.
- * \author Adam Dunkels <adam@dunkels.com>
- */
-
-
-/*
- * Copyright (c) 2001-2003, Adam Dunkels.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack.
- *
- * $Id: uip_arp.h,v 1.2 2006/08/26 23:58:45 oliverschmidt Exp $
- *
- */
-
-#ifndef __UIP_ARP_H__
-#define __UIP_ARP_H__
-
-#include "uip.h"
-
-
-extern struct uip_eth_addr uip_ethaddr;
-
-/**
- * The Ethernet header.
- */
-struct uip_eth_hdr {
- struct uip_eth_addr dest;
- struct uip_eth_addr src;
- u16_t type;
-};
-
-#define UIP_ETHTYPE_ARP 0x0806
-#define UIP_ETHTYPE_IP 0x0800
-#define UIP_ETHTYPE_IPV6 0x86dd
-
-
-/* The uip_arp_init() function must be called before any of the other
- ARP functions. */
-void uip_arp_init(void);
-
-/* The uip_arp_ipin() function should be called whenever an IP packet
- arrives from the Ethernet. This function refreshes the ARP table or
- inserts a new mapping if none exists. The function assumes that an
- IP packet with an Ethernet header is present in the uip_buf buffer
- and that the length of the packet is in the uip_len variable. */
-/*void uip_arp_ipin(void);*/
-#define uip_arp_ipin()
-
-/* The uip_arp_arpin() should be called when an ARP packet is received
- by the Ethernet driver. This function also assumes that the
- Ethernet frame is present in the uip_buf buffer. When the
- uip_arp_arpin() function returns, the contents of the uip_buf
- buffer should be sent out on the Ethernet if the uip_len variable
- is > 0. */
-void uip_arp_arpin(void);
-
-/* The uip_arp_out() function should be called when an IP packet
- should be sent out on the Ethernet. This function creates an
- Ethernet header before the IP header in the uip_buf buffer. The
- Ethernet header will have the correct Ethernet MAC destination
- address filled in if an ARP table entry for the destination IP
- address (or the IP address of the default router) is present. If no
- such table entry is found, the IP packet is overwritten with an ARP
- request and we rely on TCP to retransmit the packet that was
- overwritten. In any case, the uip_len variable holds the length of
- the Ethernet frame that should be transmitted. */
-void uip_arp_out(void);
-
-/* The uip_arp_timer() function should be called every ten seconds. It
- is responsible for flushing old entries in the ARP table. */
-void uip_arp_timer(void);
-
-/** @} */
-
-/**
- * \addtogroup uipconffunc
- * @{
- */
-
-
-/**
- * Specifiy the Ethernet MAC address.
- *
- * The ARP code needs to know the MAC address of the Ethernet card in
- * order to be able to respond to ARP queries and to generate working
- * Ethernet headers.
- *
- * \note This macro only specifies the Ethernet MAC address to the ARP
- * code. It cannot be used to change the MAC address of the Ethernet
- * card.
- *
- * \param eaddr A pointer to a struct uip_eth_addr containing the
- * Ethernet MAC address of the Ethernet card.
- *
- * \hideinitializer
- */
-#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \
- uip_ethaddr.addr[1] = eaddr.addr[1];\
- uip_ethaddr.addr[2] = eaddr.addr[2];\
- uip_ethaddr.addr[3] = eaddr.addr[3];\
- uip_ethaddr.addr[4] = eaddr.addr[4];\
- uip_ethaddr.addr[5] = eaddr.addr[5];} while(0)
-
-/** @} */
-
-
-#endif /* __UIP_ARP_H__ */
-/** @} */
+/**
+ * \addtogroup uip
+ * @{
+ */
+
+/**
+ * \addtogroup uiparp
+ * @{
+ */
+
+/**
+ * \file
+ * Macros and definitions for the ARP module.
+ * \author Adam Dunkels <adam@dunkels.com>
+ */
+
+
+/*
+ * Copyright (c) 2001-2003, Adam Dunkels.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uip_arp.h,v 1.2 2006/08/26 23:58:45 oliverschmidt Exp $
+ *
+ */
+
+#ifndef __UIP_ARP_H__
+#define __UIP_ARP_H__
+
+#include "uip.h"
+
+
+extern struct uip_eth_addr uip_ethaddr;
+
+/**
+ * The Ethernet header.
+ */
+struct uip_eth_hdr {
+ struct uip_eth_addr dest;
+ struct uip_eth_addr src;
+ u16_t type;
+};
+
+#define UIP_ETHTYPE_ARP 0x0806
+#define UIP_ETHTYPE_IP 0x0800
+#define UIP_ETHTYPE_IPV6 0x86dd
+
+
+/* The uip_arp_init() function must be called before any of the other
+ ARP functions. */
+void uip_arp_init(void);
+
+/* The uip_arp_ipin() function should be called whenever an IP packet
+ arrives from the Ethernet. This function refreshes the ARP table or
+ inserts a new mapping if none exists. The function assumes that an
+ IP packet with an Ethernet header is present in the uip_buf buffer
+ and that the length of the packet is in the uip_len variable. */
+/*void uip_arp_ipin(void);*/
+#define uip_arp_ipin()
+
+/* The uip_arp_arpin() should be called when an ARP packet is received
+ by the Ethernet driver. This function also assumes that the
+ Ethernet frame is present in the uip_buf buffer. When the
+ uip_arp_arpin() function returns, the contents of the uip_buf
+ buffer should be sent out on the Ethernet if the uip_len variable
+ is > 0. */
+void uip_arp_arpin(void);
+
+/* The uip_arp_out() function should be called when an IP packet
+ should be sent out on the Ethernet. This function creates an
+ Ethernet header before the IP header in the uip_buf buffer. The
+ Ethernet header will have the correct Ethernet MAC destination
+ address filled in if an ARP table entry for the destination IP
+ address (or the IP address of the default router) is present. If no
+ such table entry is found, the IP packet is overwritten with an ARP
+ request and we rely on TCP to retransmit the packet that was
+ overwritten. In any case, the uip_len variable holds the length of
+ the Ethernet frame that should be transmitted. */
+void uip_arp_out(void);
+
+/* The uip_arp_timer() function should be called every ten seconds. It
+ is responsible for flushing old entries in the ARP table. */
+void uip_arp_timer(void);
+
+/** @} */
+
+/**
+ * \addtogroup uipconffunc
+ * @{
+ */
+
+
+/**
+ * Specifiy the Ethernet MAC address.
+ *
+ * The ARP code needs to know the MAC address of the Ethernet card in
+ * order to be able to respond to ARP queries and to generate working
+ * Ethernet headers.
+ *
+ * \note This macro only specifies the Ethernet MAC address to the ARP
+ * code. It cannot be used to change the MAC address of the Ethernet
+ * card.
+ *
+ * \param eaddr A pointer to a struct uip_eth_addr containing the
+ * Ethernet MAC address of the Ethernet card.
+ *
+ * \hideinitializer
+ */
+#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \
+ uip_ethaddr.addr[1] = eaddr.addr[1];\
+ uip_ethaddr.addr[2] = eaddr.addr[2];\
+ uip_ethaddr.addr[3] = eaddr.addr[3];\
+ uip_ethaddr.addr[4] = eaddr.addr[4];\
+ uip_ethaddr.addr[5] = eaddr.addr[5];} while(0)
+
+/** @} */
+
+
+#endif /* __UIP_ARP_H__ */
+/** @} */
diff --git a/Projects/Webserver/Lib/uip/uipopt.h b/Projects/Webserver/Lib/uip/uipopt.h
index 7b9d19092..244ce1df1 100644
--- a/Projects/Webserver/Lib/uip/uipopt.h
+++ b/Projects/Webserver/Lib/uip/uipopt.h
@@ -1,737 +1,737 @@
-/**
- * \addtogroup uip
- * @{
- */
-
-/**
- * \defgroup uipopt Configuration options for uIP
- * @{
- *
- * uIP is configured using the per-project configuration file
- * "uipopt.h". This file contains all compile-time options for uIP and
- * should be tweaked to match each specific project. The uIP
- * distribution contains a documented example "uipopt.h" that can be
- * copied and modified for each project.
- */
-
-/**
- * \file
- * Configuration options for uIP.
- * \author Adam Dunkels <adam@dunkels.com>
- *
- * This file is used for tweaking various configuration options for
- * uIP. You should make a copy of this file into one of your project's
- * directories instead of editing this example "uipopt.h" file that
- * comes with the uIP distribution.
- */
-
-/*
- * Copyright (c) 2001-2003, Adam Dunkels.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This file is part of the uIP TCP/IP stack.
- *
- * $Id: uipopt.h,v 1.11 2009/04/10 00:37:48 adamdunkels Exp $
- *
- */
-
-#ifndef __UIPOPT_H__
-#define __UIPOPT_H__
-
-#ifndef UIP_LITTLE_ENDIAN
-#define UIP_LITTLE_ENDIAN 3412
-#endif /* UIP_LITTLE_ENDIAN */
-#ifndef UIP_BIG_ENDIAN
-#define UIP_BIG_ENDIAN 1234
-#endif /* UIP_BIG_ENDIAN */
-
-/*------------------------------------------------------------------------------*/
-
-/**
- * \defgroup uipoptstaticconf Static configuration options
- * @{
- *
- * These configuration options can be used for setting the IP address
- * settings statically, but only if UIP_FIXEDADDR is set to 1. The
- * configuration options for a specific node includes IP address,
- * netmask and default router as well as the Ethernet address. The
- * netmask, default router and Ethernet address are applicable only
- * if uIP should be run over Ethernet.
- *
- * This options are meaningful only for the IPv4 code.
- *
- * All of these should be changed to suit your project.
- */
-
-/**
- * Determines if uIP should use a fixed IP address or not.
- *
- * If uIP should use a fixed IP address, the settings are set in the
- * uipopt.h file. If not, the macros uip_sethostaddr(),
- * uip_setdraddr() and uip_setnetmask() should be used instead.
- *
- * \hideinitializer
- */
-#define UIP_FIXEDADDR 0
-
-/**
- * Ping IP address assignment.
- *
- * uIP uses a "ping" packets for setting its own IP address if this
- * option is set. If so, uIP will start with an empty IP address and
- * the destination IP address of the first incoming "ping" (ICMP echo)
- * packet will be used for setting the hosts IP address.
- *
- * \note This works only if UIP_FIXEDADDR is 0.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_PINGADDRCONF
-#define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF
-#else /* UIP_CONF_PINGADDRCONF */
-#define UIP_PINGADDRCONF 0
-#endif /* UIP_CONF_PINGADDRCONF */
-
-
-/**
- * Specifies if the uIP ARP module should be compiled with a fixed
- * Ethernet MAC address or not.
- *
- * If this configuration option is 0, the macro uip_setethaddr() can
- * be used to specify the Ethernet address at run-time.
- *
- * \hideinitializer
- */
-#define UIP_FIXEDETHADDR 0
-
-/** @} */
-/*------------------------------------------------------------------------------*/
-/**
- * \defgroup uipoptip IP configuration options
- * @{
- *
- */
-/**
- * The IP TTL (time to live) of IP packets sent by uIP.
- *
- * This should normally not be changed.
- */
-#define UIP_TTL 64
-
-/**
- * The maximum time an IP fragment should wait in the reassembly
- * buffer before it is dropped.
- *
- */
-#define UIP_REASS_MAXAGE 60 /*60s*/
-
-/**
- * Turn on support for IP packet reassembly.
- *
- * uIP supports reassembly of fragmented IP packets. This features
- * requires an additional amount of RAM to hold the reassembly buffer
- * and the reassembly code size is approximately 700 bytes. The
- * reassembly buffer is of the same size as the uip_buf buffer
- * (configured by UIP_BUFSIZE).
- *
- * \note IP packet reassembly is not heavily tested.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_REASSEMBLY
-#define UIP_REASSEMBLY UIP_CONF_REASSEMBLY
-#else /* UIP_CONF_REASSEMBLY */
-#define UIP_REASSEMBLY 0
-#endif /* UIP_CONF_REASSEMBLY */
-/** @} */
-
-/*------------------------------------------------------------------------------*/
-/**
- * \defgroup uipoptipv6 IPv6 configuration options
- * @{
- *
- */
-
-/** The maximum transmission unit at the IP Layer*/
-#define UIP_LINK_MTU 1280
-
-#ifndef UIP_CONF_IPV6
-/** Do we use IPv6 or not (default: no) */
-#define UIP_CONF_IPV6 0
-#endif
-
-#ifndef UIP_CONF_IPV6_QUEUE_PKT
-/** Do we do per %neighbor queuing during address resolution (default: no) */
-#define UIP_CONF_IPV6_QUEUE_PKT 0
-#endif
-
-#ifndef UIP_CONF_IPV6_CHECKS
-/** Do we do IPv6 consistency checks (highly recommended, default: yes) */
-#define UIP_CONF_IPV6_CHECKS 1
-#endif
-
-#ifndef UIP_CONF_IPV6_REASSEMBLY
-/** Do we do IPv6 fragmentation (default: no) */
-#define UIP_CONF_IPV6_REASSEMBLY 0
-#endif
-
-#ifndef UIP_CONF_NETIF_MAX_ADDRESSES
-/** Default number of IPv6 addresses associated to the node's interface */
-#define UIP_CONF_NETIF_MAX_ADDRESSES 3
-#endif
-
-#ifndef UIP_CONF_ND6_MAX_PREFIXES
-/** Default number of IPv6 prefixes associated to the node's interface */
-#define UIP_CONF_ND6_MAX_PREFIXES 3
-#endif
-
-#ifndef UIP_CONF_ND6_MAX_NEIGHBORS
-/** Default number of neighbors that can be stored in the %neighbor cache */
-#define UIP_CONF_ND6_MAX_NEIGHBORS 4
-#endif
-
-#ifndef UIP_CONF_ND6_MAX_DEFROUTERS
-/** Minimum number of default routers */
-#define UIP_CONF_ND6_MAX_DEFROUTERS 2
-#endif
-/** @} */
-
-/*------------------------------------------------------------------------------*/
-/**
- * \defgroup uipoptudp UDP configuration options
- * @{
- *
- * \note The UDP support in uIP is still not entirely complete; there
- * is no support for sending or receiving broadcast or multicast
- * packets, but it works well enough to support a number of vital
- * applications such as DNS queries, though
- */
-
-/**
- * Toggles whether UDP support should be compiled in or not.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_UDP
-#define UIP_UDP UIP_CONF_UDP
-#else /* UIP_CONF_UDP */
-#define UIP_UDP 1
-#endif /* UIP_CONF_UDP */
-
-/**
- * Toggles if UDP checksums should be used or not.
- *
- * \note Support for UDP checksums is currently not included in uIP,
- * so this option has no function.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_UDP_CHECKSUMS
-#define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
-#else
-#define UIP_UDP_CHECKSUMS 0
-#endif
-
-/**
- * The maximum amount of concurrent UDP connections.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_UDP_CONNS
-#define UIP_UDP_CONNS UIP_CONF_UDP_CONNS
-#else /* UIP_CONF_UDP_CONNS */
-#define UIP_UDP_CONNS 10
-#endif /* UIP_CONF_UDP_CONNS */
-
-/**
- * The name of the function that should be called when UDP datagrams arrive.
- *
- * \hideinitializer
- */
-
-
-/** @} */
-/*------------------------------------------------------------------------------*/
-/**
- * \defgroup uipopttcp TCP configuration options
- * @{
- */
-
-/**
- * Toggles whether UDP support should be compiled in or not.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_TCP
-#define UIP_TCP UIP_CONF_TCP
-#else /* UIP_CONF_UDP */
-#define UIP_TCP 1
-#endif /* UIP_CONF_UDP */
-
-/**
- * Determines if support for opening connections from uIP should be
- * compiled in.
- *
- * If the applications that are running on top of uIP for this project
- * do not need to open outgoing TCP connections, this configuration
- * option can be turned off to reduce the code size of uIP.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_ACTIVE_OPEN
-#define UIP_ACTIVE_OPEN 1
-#else /* UIP_CONF_ACTIVE_OPEN */
-#define UIP_ACTIVE_OPEN UIP_CONF_ACTIVE_OPEN
-#endif /* UIP_CONF_ACTIVE_OPEN */
-
-/**
- * The maximum number of simultaneously open TCP connections.
- *
- * Since the TCP connections are statically allocated, turning this
- * configuration knob down results in less RAM used. Each TCP
- * connection requires approximately 30 bytes of memory.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_MAX_CONNECTIONS
-#define UIP_CONNS 10
-#else /* UIP_CONF_MAX_CONNECTIONS */
-#define UIP_CONNS UIP_CONF_MAX_CONNECTIONS
-#endif /* UIP_CONF_MAX_CONNECTIONS */
-
-
-/**
- * The maximum number of simultaneously listening TCP ports.
- *
- * Each listening TCP port requires 2 bytes of memory.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_MAX_LISTENPORTS
-#define UIP_LISTENPORTS 20
-#else /* UIP_CONF_MAX_LISTENPORTS */
-#define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS
-#endif /* UIP_CONF_MAX_LISTENPORTS */
-
-/**
- * Determines if support for TCP urgent data notification should be
- * compiled in.
- *
- * Urgent data (out-of-band data) is a rarely used TCP feature that
- * very seldom would be required.
- *
- * \hideinitializer
- */
-#if !defined(UIP_URGDATA)
-#define UIP_URGDATA 0
-#endif
-
-/**
- * The initial retransmission timeout counted in timer pulses.
- *
- * This should not be changed.
- */
-#if !defined(UIP_RTO)
-#define UIP_RTO 3
-#endif
-
-/**
- * The maximum number of times a segment should be retransmitted
- * before the connection should be aborted.
- *
- * This should not be changed.
- */
-#if !defined(UIP_MAXRTX)
-#define UIP_MAXRTX 8
-#endif
-
-/**
- * The maximum number of times a SYN segment should be retransmitted
- * before a connection request should be deemed to have been
- * unsuccessful.
- *
- * This should not need to be changed.
- */
-#if !defined(UIP_MAXSYNRTX)
-#define UIP_MAXSYNRTX 5
-#endif
-
-/**
- * The TCP maximum segment size.
- *
- * This is should not be to set to more than
- * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
- */
-#ifdef UIP_CONF_TCP_MSS
-#define UIP_TCP_MSS UIP_CONF_TCP_MSS
-#else
-#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
-#endif
-
-/**
- * The size of the advertised receiver's window.
- *
- * Should be set low (i.e., to the size of the uip_buf buffer) if the
- * application is slow to process incoming data, or high (32768 bytes)
- * if the application processes data quickly.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_RECEIVE_WINDOW
-#define UIP_RECEIVE_WINDOW UIP_TCP_MSS
-#else
-#define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
-#endif
-
-/**
- * How long a connection should stay in the TIME_WAIT state.
- *
- * This configuration option has no real implication, and it should be
- * left untouched.
- */
-#define UIP_TIME_WAIT_TIMEOUT 120
-
-
-/** @} */
-/*------------------------------------------------------------------------------*/
-/**
- * \defgroup uipoptarp ARP configuration options
- * @{
- */
-
-/**
- * The size of the ARP table.
- *
- * This option should be set to a larger value if this uIP node will
- * have many connections from the local network.
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_ARPTAB_SIZE
-#define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
-#else
-#define UIP_ARPTAB_SIZE 8
-#endif
-
-/**
- * The maximum age of ARP table entries measured in 10ths of seconds.
- *
- * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
- * default).
- */
-#define UIP_ARP_MAXAGE 120
-
-
-/** @} */
-
-/*------------------------------------------------------------------------------*/
-
-/**
- * \defgroup uipoptmac layer 2 options (for ipv6)
- * @{
- */
-
-#define UIP_DEFAULT_PREFIX_LEN 64
-
-/** @} */
-
-/*------------------------------------------------------------------------------*/
-
-/**
- * \defgroup uipoptsics 6lowpan options (for ipv6)
- * @{
- */
-/**
- * Timeout for packet reassembly at the 6lowpan layer
- * (should be < 60s)
- */
-#ifdef SICSLOWPAN_CONF_MAXAGE
-#define SICSLOWPAN_REASS_MAXAGE SICSLOWPAN_CONF_MAXAGE
-#else
-#define SICSLOWPAN_REASS_MAXAGE 20
-#endif
-
-/**
- * Do we compress the IP header or not (default: no)
- */
-#ifndef SICSLOWPAN_CONF_COMPRESSION
-#define SICSLOWPAN_CONF_COMPRESSION 0
-#endif
-
-/**
- * If we use IPHC compression, how many address contexts do we support
- */
-#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
-#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
-#endif
-
-/**
- * Do we support 6lowpan fragmentation
- */
-#ifndef SICSLOWPAN_CONF_FRAG
-#define SICSLOWPAN_CONF_FRAG 0
-#endif
-
-/** @} */
-
-/*------------------------------------------------------------------------------*/
-
-/**
- * \defgroup uipoptgeneral General configuration options
- * @{
- */
-
-/**
- * The size of the uIP packet buffer.
- *
- * The uIP packet buffer should not be smaller than 60 bytes, and does
- * not need to be larger than 1514 bytes. Lower size results in lower
- * TCP throughput, larger size results in higher TCP throughput.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_BUFFER_SIZE
-#define UIP_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN
-#else /* UIP_CONF_BUFFER_SIZE */
-#define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE
-#endif /* UIP_CONF_BUFFER_SIZE */
-
-
-/**
- * Determines if statistics support should be compiled in.
- *
- * The statistics is useful for debugging and to show the user.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_STATISTICS
-#define UIP_STATISTICS 0
-#else /* UIP_CONF_STATISTICS */
-#define UIP_STATISTICS UIP_CONF_STATISTICS
-#endif /* UIP_CONF_STATISTICS */
-
-/**
- * Determines if logging of certain events should be compiled in.
- *
- * This is useful mostly for debugging. The function uip_log()
- * must be implemented to suit the architecture of the project, if
- * logging is turned on.
- *
- * \hideinitializer
- */
-#ifndef UIP_CONF_LOGGING
-#define UIP_LOGGING 0
-#else /* UIP_CONF_LOGGING */
-#define UIP_LOGGING UIP_CONF_LOGGING
-#endif /* UIP_CONF_LOGGING */
-
-/**
- * Broadcast support.
- *
- * This flag configures IP broadcast support. This is useful only
- * together with UDP.
- *
- * \hideinitializer
- *
- */
-#ifndef UIP_CONF_BROADCAST
-#define UIP_BROADCAST 0
-#else /* UIP_CONF_BROADCAST */
-#define UIP_BROADCAST UIP_CONF_BROADCAST
-#endif /* UIP_CONF_BROADCAST */
-
-/**
- * Print out a uIP log message.
- *
- * This function must be implemented by the module that uses uIP, and
- * is called by uIP whenever a log message is generated.
- */
-void uip_log(char *msg);
-
-/**
- * The link level header length.
- *
- * This is the offset into the uip_buf where the IP header can be
- * found. For Ethernet, this should be set to 14. For SLIP, this
- * should be set to 0.
- *
- * \note we probably won't use this constant for other link layers than
- * ethernet as they have variable header length (this is due to variable
- * number and type of address fields and to optional security features)
- * E.g.: 802.15.4 -> 2 + (1/2*4/8) + 0/5/6/10/14
- * 802.11 -> 4 + (6*3/4) + 2
- * \hideinitializer
- */
-#ifdef UIP_CONF_LLH_LEN
-#define UIP_LLH_LEN UIP_CONF_LLH_LEN
-#else /* UIP_LLH_LEN */
-#define UIP_LLH_LEN 14
-#endif /* UIP_CONF_LLH_LEN */
-
-/** @} */
-/*------------------------------------------------------------------------------*/
-/**
- * \defgroup uipoptcpu CPU architecture configuration
- * @{
- *
- * The CPU architecture configuration is where the endianess of the
- * CPU on which uIP is to be run is specified. Most CPUs today are
- * little endian, and the most notable exception are the Motorolas
- * which are big endian. The BYTE_ORDER macro should be changed to
- * reflect the CPU architecture on which uIP is to be run.
- */
-
-/**
- * The byte order of the CPU architecture on which uIP is to be run.
- *
- * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or
- * UIP_LITTLE_ENDIAN (Intel byte order).
- *
- * \hideinitializer
- */
-#ifdef UIP_CONF_BYTE_ORDER
-#define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER
-#else /* UIP_CONF_BYTE_ORDER */
-#define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN
-#endif /* UIP_CONF_BYTE_ORDER */
-
-/** @} */
-/*------------------------------------------------------------------------------*/
-
-#include <ff.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "timer.h"
-
-typedef uint8_t u8_t;
-typedef uint16_t u16_t;
-typedef uint32_t u32_t;
-typedef uint32_t uip_stats_t;
-
-/**
- * \defgroup uipoptapp Application specific configurations
- * @{
- *
- * An uIP application is implemented using a single application
- * function that is called by uIP whenever a TCP/IP event occurs. The
- * name of this function must be registered with uIP at compile time
- * using the UIP_APPCALL definition.
- *
- * uIP applications can store the application state within the
- * uip_conn structure by specifying the type of the application
- * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.
- *
- * The file containing the definitions must be included in the
- * uipopt.h file.
- *
- * The following example illustrates how this can look.
- \code
-
- void httpd_appcall(void);
- #define UIP_APPCALL httpd_appcall
-
- struct httpd_state {
- u8_t state;
- u16_t count;
- char *dataptr;
- char *script;
- };
- typedef struct httpd_state uip_tcp_appstate_t
- \endcode
-*/
-#define UIP_UDP_APPCALL uIPManagement_UDPCallback
-void UIP_UDP_APPCALL(void);
-
-/**
- * \var #define UIP_APPCALL
- *
- * The name of the application function that uIP should call in
- * response to TCP/IP events.
- *
- */
-#define UIP_APPCALL uIPManagement_TCPCallback
-void UIP_APPCALL(void);
-
-/**
- * \var typedef uip_tcp_appstate_t
- *
- * The type of the application state that is to be stored in the
- * uip_conn structure. This usually is typedef:ed to a struct holding
- * application state information.
- */
-typedef union
-{
- struct
- {
- uint8_t CurrentState;
- uint8_t NextState;
-
- char FileName[MAX_URI_LENGTH];
- FIL FileHandle;
- bool FileOpen;
- uint32_t ACKedFilePos;
- uint16_t SentChunkSize;
- } HTTPServer;
-
- struct
- {
- uint8_t CurrentState;
- uint8_t NextState;
-
- uint8_t IssuedCommand;
- } TELNETServer;
-} uip_tcp_appstate_t;
-
-/**
- * \var typedef uip_udp_appstate_t
- *
- * The type of the application state that is to be stored in the
- * uip_conn structure. This usually is typedef:ed to a struct holding
- * application state information.
- */
-typedef union
-{
- struct
- {
- uint8_t CurrentState;
- struct timer Timeout;
-
- struct
- {
- uint8_t AllocatedIP[4];
- uint8_t Netmask[4];
- uint8_t GatewayIP[4];
- uint8_t ServerIP[4];
- } DHCPOffer_Data;
- } DHCPClient;
-} uip_udp_appstate_t;
-/** @} */
-
-#endif /* __UIPOPT_H__ */
-/** @} */
-/** @} */
+/**
+ * \addtogroup uip
+ * @{
+ */
+
+/**
+ * \defgroup uipopt Configuration options for uIP
+ * @{
+ *
+ * uIP is configured using the per-project configuration file
+ * "uipopt.h". This file contains all compile-time options for uIP and
+ * should be tweaked to match each specific project. The uIP
+ * distribution contains a documented example "uipopt.h" that can be
+ * copied and modified for each project.
+ */
+
+/**
+ * \file
+ * Configuration options for uIP.
+ * \author Adam Dunkels <adam@dunkels.com>
+ *
+ * This file is used for tweaking various configuration options for
+ * uIP. You should make a copy of this file into one of your project's
+ * directories instead of editing this example "uipopt.h" file that
+ * comes with the uIP distribution.
+ */
+
+/*
+ * Copyright (c) 2001-2003, Adam Dunkels.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uipopt.h,v 1.11 2009/04/10 00:37:48 adamdunkels Exp $
+ *
+ */
+
+#ifndef __UIPOPT_H__
+#define __UIPOPT_H__
+
+#ifndef UIP_LITTLE_ENDIAN
+#define UIP_LITTLE_ENDIAN 3412
+#endif /* UIP_LITTLE_ENDIAN */
+#ifndef UIP_BIG_ENDIAN
+#define UIP_BIG_ENDIAN 1234
+#endif /* UIP_BIG_ENDIAN */
+
+/*------------------------------------------------------------------------------*/
+
+/**
+ * \defgroup uipoptstaticconf Static configuration options
+ * @{
+ *
+ * These configuration options can be used for setting the IP address
+ * settings statically, but only if UIP_FIXEDADDR is set to 1. The
+ * configuration options for a specific node includes IP address,
+ * netmask and default router as well as the Ethernet address. The
+ * netmask, default router and Ethernet address are applicable only
+ * if uIP should be run over Ethernet.
+ *
+ * This options are meaningful only for the IPv4 code.
+ *
+ * All of these should be changed to suit your project.
+ */
+
+/**
+ * Determines if uIP should use a fixed IP address or not.
+ *
+ * If uIP should use a fixed IP address, the settings are set in the
+ * uipopt.h file. If not, the macros uip_sethostaddr(),
+ * uip_setdraddr() and uip_setnetmask() should be used instead.
+ *
+ * \hideinitializer
+ */
+#define UIP_FIXEDADDR 0
+
+/**
+ * Ping IP address assignment.
+ *
+ * uIP uses a "ping" packets for setting its own IP address if this
+ * option is set. If so, uIP will start with an empty IP address and
+ * the destination IP address of the first incoming "ping" (ICMP echo)
+ * packet will be used for setting the hosts IP address.
+ *
+ * \note This works only if UIP_FIXEDADDR is 0.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_PINGADDRCONF
+#define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF
+#else /* UIP_CONF_PINGADDRCONF */
+#define UIP_PINGADDRCONF 0
+#endif /* UIP_CONF_PINGADDRCONF */
+
+
+/**
+ * Specifies if the uIP ARP module should be compiled with a fixed
+ * Ethernet MAC address or not.
+ *
+ * If this configuration option is 0, the macro uip_setethaddr() can
+ * be used to specify the Ethernet address at run-time.
+ *
+ * \hideinitializer
+ */
+#define UIP_FIXEDETHADDR 0
+
+/** @} */
+/*------------------------------------------------------------------------------*/
+/**
+ * \defgroup uipoptip IP configuration options
+ * @{
+ *
+ */
+/**
+ * The IP TTL (time to live) of IP packets sent by uIP.
+ *
+ * This should normally not be changed.
+ */
+#define UIP_TTL 64
+
+/**
+ * The maximum time an IP fragment should wait in the reassembly
+ * buffer before it is dropped.
+ *
+ */
+#define UIP_REASS_MAXAGE 60 /*60s*/
+
+/**
+ * Turn on support for IP packet reassembly.
+ *
+ * uIP supports reassembly of fragmented IP packets. This features
+ * requires an additional amount of RAM to hold the reassembly buffer
+ * and the reassembly code size is approximately 700 bytes. The
+ * reassembly buffer is of the same size as the uip_buf buffer
+ * (configured by UIP_BUFSIZE).
+ *
+ * \note IP packet reassembly is not heavily tested.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_REASSEMBLY
+#define UIP_REASSEMBLY UIP_CONF_REASSEMBLY
+#else /* UIP_CONF_REASSEMBLY */
+#define UIP_REASSEMBLY 0
+#endif /* UIP_CONF_REASSEMBLY */
+/** @} */
+
+/*------------------------------------------------------------------------------*/
+/**
+ * \defgroup uipoptipv6 IPv6 configuration options
+ * @{
+ *
+ */
+
+/** The maximum transmission unit at the IP Layer*/
+#define UIP_LINK_MTU 1280
+
+#ifndef UIP_CONF_IPV6
+/** Do we use IPv6 or not (default: no) */
+#define UIP_CONF_IPV6 0
+#endif
+
+#ifndef UIP_CONF_IPV6_QUEUE_PKT
+/** Do we do per %neighbor queuing during address resolution (default: no) */
+#define UIP_CONF_IPV6_QUEUE_PKT 0
+#endif
+
+#ifndef UIP_CONF_IPV6_CHECKS
+/** Do we do IPv6 consistency checks (highly recommended, default: yes) */
+#define UIP_CONF_IPV6_CHECKS 1
+#endif
+
+#ifndef UIP_CONF_IPV6_REASSEMBLY
+/** Do we do IPv6 fragmentation (default: no) */
+#define UIP_CONF_IPV6_REASSEMBLY 0
+#endif
+
+#ifndef UIP_CONF_NETIF_MAX_ADDRESSES
+/** Default number of IPv6 addresses associated to the node's interface */
+#define UIP_CONF_NETIF_MAX_ADDRESSES 3
+#endif
+
+#ifndef UIP_CONF_ND6_MAX_PREFIXES
+/** Default number of IPv6 prefixes associated to the node's interface */
+#define UIP_CONF_ND6_MAX_PREFIXES 3
+#endif
+
+#ifndef UIP_CONF_ND6_MAX_NEIGHBORS
+/** Default number of neighbors that can be stored in the %neighbor cache */
+#define UIP_CONF_ND6_MAX_NEIGHBORS 4
+#endif
+
+#ifndef UIP_CONF_ND6_MAX_DEFROUTERS
+/** Minimum number of default routers */
+#define UIP_CONF_ND6_MAX_DEFROUTERS 2
+#endif
+/** @} */
+
+/*------------------------------------------------------------------------------*/
+/**
+ * \defgroup uipoptudp UDP configuration options
+ * @{
+ *
+ * \note The UDP support in uIP is still not entirely complete; there
+ * is no support for sending or receiving broadcast or multicast
+ * packets, but it works well enough to support a number of vital
+ * applications such as DNS queries, though
+ */
+
+/**
+ * Toggles whether UDP support should be compiled in or not.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_UDP
+#define UIP_UDP UIP_CONF_UDP
+#else /* UIP_CONF_UDP */
+#define UIP_UDP 1
+#endif /* UIP_CONF_UDP */
+
+/**
+ * Toggles if UDP checksums should be used or not.
+ *
+ * \note Support for UDP checksums is currently not included in uIP,
+ * so this option has no function.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_UDP_CHECKSUMS
+#define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
+#else
+#define UIP_UDP_CHECKSUMS 0
+#endif
+
+/**
+ * The maximum amount of concurrent UDP connections.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_UDP_CONNS
+#define UIP_UDP_CONNS UIP_CONF_UDP_CONNS
+#else /* UIP_CONF_UDP_CONNS */
+#define UIP_UDP_CONNS 10
+#endif /* UIP_CONF_UDP_CONNS */
+
+/**
+ * The name of the function that should be called when UDP datagrams arrive.
+ *
+ * \hideinitializer
+ */
+
+
+/** @} */
+/*------------------------------------------------------------------------------*/
+/**
+ * \defgroup uipopttcp TCP configuration options
+ * @{
+ */
+
+/**
+ * Toggles whether UDP support should be compiled in or not.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_TCP
+#define UIP_TCP UIP_CONF_TCP
+#else /* UIP_CONF_UDP */
+#define UIP_TCP 1
+#endif /* UIP_CONF_UDP */
+
+/**
+ * Determines if support for opening connections from uIP should be
+ * compiled in.
+ *
+ * If the applications that are running on top of uIP for this project
+ * do not need to open outgoing TCP connections, this configuration
+ * option can be turned off to reduce the code size of uIP.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_ACTIVE_OPEN
+#define UIP_ACTIVE_OPEN 1
+#else /* UIP_CONF_ACTIVE_OPEN */
+#define UIP_ACTIVE_OPEN UIP_CONF_ACTIVE_OPEN
+#endif /* UIP_CONF_ACTIVE_OPEN */
+
+/**
+ * The maximum number of simultaneously open TCP connections.
+ *
+ * Since the TCP connections are statically allocated, turning this
+ * configuration knob down results in less RAM used. Each TCP
+ * connection requires approximately 30 bytes of memory.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_MAX_CONNECTIONS
+#define UIP_CONNS 10
+#else /* UIP_CONF_MAX_CONNECTIONS */
+#define UIP_CONNS UIP_CONF_MAX_CONNECTIONS
+#endif /* UIP_CONF_MAX_CONNECTIONS */
+
+
+/**
+ * The maximum number of simultaneously listening TCP ports.
+ *
+ * Each listening TCP port requires 2 bytes of memory.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_MAX_LISTENPORTS
+#define UIP_LISTENPORTS 20
+#else /* UIP_CONF_MAX_LISTENPORTS */
+#define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS
+#endif /* UIP_CONF_MAX_LISTENPORTS */
+
+/**
+ * Determines if support for TCP urgent data notification should be
+ * compiled in.
+ *
+ * Urgent data (out-of-band data) is a rarely used TCP feature that
+ * very seldom would be required.
+ *
+ * \hideinitializer
+ */
+#if !defined(UIP_URGDATA)
+#define UIP_URGDATA 0
+#endif
+
+/**
+ * The initial retransmission timeout counted in timer pulses.
+ *
+ * This should not be changed.
+ */
+#if !defined(UIP_RTO)
+#define UIP_RTO 3
+#endif
+
+/**
+ * The maximum number of times a segment should be retransmitted
+ * before the connection should be aborted.
+ *
+ * This should not be changed.
+ */
+#if !defined(UIP_MAXRTX)
+#define UIP_MAXRTX 8
+#endif
+
+/**
+ * The maximum number of times a SYN segment should be retransmitted
+ * before a connection request should be deemed to have been
+ * unsuccessful.
+ *
+ * This should not need to be changed.
+ */
+#if !defined(UIP_MAXSYNRTX)
+#define UIP_MAXSYNRTX 5
+#endif
+
+/**
+ * The TCP maximum segment size.
+ *
+ * This is should not be to set to more than
+ * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
+ */
+#ifdef UIP_CONF_TCP_MSS
+#define UIP_TCP_MSS UIP_CONF_TCP_MSS
+#else
+#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
+#endif
+
+/**
+ * The size of the advertised receiver's window.
+ *
+ * Should be set low (i.e., to the size of the uip_buf buffer) if the
+ * application is slow to process incoming data, or high (32768 bytes)
+ * if the application processes data quickly.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_RECEIVE_WINDOW
+#define UIP_RECEIVE_WINDOW UIP_TCP_MSS
+#else
+#define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
+#endif
+
+/**
+ * How long a connection should stay in the TIME_WAIT state.
+ *
+ * This configuration option has no real implication, and it should be
+ * left untouched.
+ */
+#define UIP_TIME_WAIT_TIMEOUT 120
+
+
+/** @} */
+/*------------------------------------------------------------------------------*/
+/**
+ * \defgroup uipoptarp ARP configuration options
+ * @{
+ */
+
+/**
+ * The size of the ARP table.
+ *
+ * This option should be set to a larger value if this uIP node will
+ * have many connections from the local network.
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_ARPTAB_SIZE
+#define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
+#else
+#define UIP_ARPTAB_SIZE 8
+#endif
+
+/**
+ * The maximum age of ARP table entries measured in 10ths of seconds.
+ *
+ * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
+ * default).
+ */
+#define UIP_ARP_MAXAGE 120
+
+
+/** @} */
+
+/*------------------------------------------------------------------------------*/
+
+/**
+ * \defgroup uipoptmac layer 2 options (for ipv6)
+ * @{
+ */
+
+#define UIP_DEFAULT_PREFIX_LEN 64
+
+/** @} */
+
+/*------------------------------------------------------------------------------*/
+
+/**
+ * \defgroup uipoptsics 6lowpan options (for ipv6)
+ * @{
+ */
+/**
+ * Timeout for packet reassembly at the 6lowpan layer
+ * (should be < 60s)
+ */
+#ifdef SICSLOWPAN_CONF_MAXAGE
+#define SICSLOWPAN_REASS_MAXAGE SICSLOWPAN_CONF_MAXAGE
+#else
+#define SICSLOWPAN_REASS_MAXAGE 20
+#endif
+
+/**
+ * Do we compress the IP header or not (default: no)
+ */
+#ifndef SICSLOWPAN_CONF_COMPRESSION
+#define SICSLOWPAN_CONF_COMPRESSION 0
+#endif
+
+/**
+ * If we use IPHC compression, how many address contexts do we support
+ */
+#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
+#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
+#endif
+
+/**
+ * Do we support 6lowpan fragmentation
+ */
+#ifndef SICSLOWPAN_CONF_FRAG
+#define SICSLOWPAN_CONF_FRAG 0
+#endif
+
+/** @} */
+
+/*------------------------------------------------------------------------------*/
+
+/**
+ * \defgroup uipoptgeneral General configuration options
+ * @{
+ */
+
+/**
+ * The size of the uIP packet buffer.
+ *
+ * The uIP packet buffer should not be smaller than 60 bytes, and does
+ * not need to be larger than 1514 bytes. Lower size results in lower
+ * TCP throughput, larger size results in higher TCP throughput.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_BUFFER_SIZE
+#define UIP_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN
+#else /* UIP_CONF_BUFFER_SIZE */
+#define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE
+#endif /* UIP_CONF_BUFFER_SIZE */
+
+
+/**
+ * Determines if statistics support should be compiled in.
+ *
+ * The statistics is useful for debugging and to show the user.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_STATISTICS
+#define UIP_STATISTICS 0
+#else /* UIP_CONF_STATISTICS */
+#define UIP_STATISTICS UIP_CONF_STATISTICS
+#endif /* UIP_CONF_STATISTICS */
+
+/**
+ * Determines if logging of certain events should be compiled in.
+ *
+ * This is useful mostly for debugging. The function uip_log()
+ * must be implemented to suit the architecture of the project, if
+ * logging is turned on.
+ *
+ * \hideinitializer
+ */
+#ifndef UIP_CONF_LOGGING
+#define UIP_LOGGING 0
+#else /* UIP_CONF_LOGGING */
+#define UIP_LOGGING UIP_CONF_LOGGING
+#endif /* UIP_CONF_LOGGING */
+
+/**
+ * Broadcast support.
+ *
+ * This flag configures IP broadcast support. This is useful only
+ * together with UDP.
+ *
+ * \hideinitializer
+ *
+ */
+#ifndef UIP_CONF_BROADCAST
+#define UIP_BROADCAST 0
+#else /* UIP_CONF_BROADCAST */
+#define UIP_BROADCAST UIP_CONF_BROADCAST
+#endif /* UIP_CONF_BROADCAST */
+
+/**
+ * Print out a uIP log message.
+ *
+ * This function must be implemented by the module that uses uIP, and
+ * is called by uIP whenever a log message is generated.
+ */
+void uip_log(char *msg);
+
+/**
+ * The link level header length.
+ *
+ * This is the offset into the uip_buf where the IP header can be
+ * found. For Ethernet, this should be set to 14. For SLIP, this
+ * should be set to 0.
+ *
+ * \note we probably won't use this constant for other link layers than
+ * ethernet as they have variable header length (this is due to variable
+ * number and type of address fields and to optional security features)
+ * E.g.: 802.15.4 -> 2 + (1/2*4/8) + 0/5/6/10/14
+ * 802.11 -> 4 + (6*3/4) + 2
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_LLH_LEN
+#define UIP_LLH_LEN UIP_CONF_LLH_LEN
+#else /* UIP_LLH_LEN */
+#define UIP_LLH_LEN 14
+#endif /* UIP_CONF_LLH_LEN */
+
+/** @} */
+/*------------------------------------------------------------------------------*/
+/**
+ * \defgroup uipoptcpu CPU architecture configuration
+ * @{
+ *
+ * The CPU architecture configuration is where the endianess of the
+ * CPU on which uIP is to be run is specified. Most CPUs today are
+ * little endian, and the most notable exception are the Motorolas
+ * which are big endian. The BYTE_ORDER macro should be changed to
+ * reflect the CPU architecture on which uIP is to be run.
+ */
+
+/**
+ * The byte order of the CPU architecture on which uIP is to be run.
+ *
+ * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or
+ * UIP_LITTLE_ENDIAN (Intel byte order).
+ *
+ * \hideinitializer
+ */
+#ifdef UIP_CONF_BYTE_ORDER
+#define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER
+#else /* UIP_CONF_BYTE_ORDER */
+#define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN
+#endif /* UIP_CONF_BYTE_ORDER */
+
+/** @} */
+/*------------------------------------------------------------------------------*/
+
+#include <ff.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "timer.h"
+
+typedef uint8_t u8_t;
+typedef uint16_t u16_t;
+typedef uint32_t u32_t;
+typedef uint32_t uip_stats_t;
+
+/**
+ * \defgroup uipoptapp Application specific configurations
+ * @{
+ *
+ * An uIP application is implemented using a single application
+ * function that is called by uIP whenever a TCP/IP event occurs. The
+ * name of this function must be registered with uIP at compile time
+ * using the UIP_APPCALL definition.
+ *
+ * uIP applications can store the application state within the
+ * uip_conn structure by specifying the type of the application
+ * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.
+ *
+ * The file containing the definitions must be included in the
+ * uipopt.h file.
+ *
+ * The following example illustrates how this can look.
+ \code
+
+ void httpd_appcall(void);
+ #define UIP_APPCALL httpd_appcall
+
+ struct httpd_state {
+ u8_t state;
+ u16_t count;
+ char *dataptr;
+ char *script;
+ };
+ typedef struct httpd_state uip_tcp_appstate_t
+ \endcode
+*/
+#define UIP_UDP_APPCALL uIPManagement_UDPCallback
+void UIP_UDP_APPCALL(void);
+
+/**
+ * \var #define UIP_APPCALL
+ *
+ * The name of the application function that uIP should call in
+ * response to TCP/IP events.
+ *
+ */
+#define UIP_APPCALL uIPManagement_TCPCallback
+void UIP_APPCALL(void);
+
+/**
+ * \var typedef uip_tcp_appstate_t
+ *
+ * The type of the application state that is to be stored in the
+ * uip_conn structure. This usually is typedef:ed to a struct holding
+ * application state information.
+ */
+typedef union
+{
+ struct
+ {
+ uint8_t CurrentState;
+ uint8_t NextState;
+
+ char FileName[MAX_URI_LENGTH];
+ FIL FileHandle;
+ bool FileOpen;
+ uint32_t ACKedFilePos;
+ uint16_t SentChunkSize;
+ } HTTPServer;
+
+ struct
+ {
+ uint8_t CurrentState;
+ uint8_t NextState;
+
+ uint8_t IssuedCommand;
+ } TELNETServer;
+} uip_tcp_appstate_t;
+
+/**
+ * \var typedef uip_udp_appstate_t
+ *
+ * The type of the application state that is to be stored in the
+ * uip_conn structure. This usually is typedef:ed to a struct holding
+ * application state information.
+ */
+typedef union
+{
+ struct
+ {
+ uint8_t CurrentState;
+ struct timer Timeout;
+
+ struct
+ {
+ uint8_t AllocatedIP[4];
+ uint8_t Netmask[4];
+ uint8_t GatewayIP[4];
+ uint8_t ServerIP[4];
+ } DHCPOffer_Data;
+ } DHCPClient;
+} uip_udp_appstate_t;
+/** @} */
+
+#endif /* __UIPOPT_H__ */
+/** @} */
+/** @} */
diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c
index eecada91f..d6b76ec73 100644
--- a/Projects/Webserver/USBDeviceMode.c
+++ b/Projects/Webserver/USBDeviceMode.c
@@ -1,113 +1,113 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Mode management functions and variables. This file contains the LUFA code required to
- * manage the USB Mass Storage device mode.
- */
-
-#include "USBDeviceMode.h"
-
-/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
- * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_MS_Device_t Disk_MS_Interface =
- {
- .Config =
- {
- .InterfaceNumber = 0,
-
- .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
- .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
- .DataINEndpointDoubleBank = true,
-
- .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
- .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
- .DataOUTEndpointDoubleBank = true,
-
- .TotalLUNs = 1,
- },
- };
-
-
-/** USB device mode management task. This function manages the Mass Storage Device class driver when the device is
- * initialized in USB device mode.
- */
-void USBDeviceMode_USBTask(void)
-{
- if (USB_CurrentMode != USB_MODE_DEVICE)
- return;
-
- MS_Device_USBTask(&Disk_MS_Interface);
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- MS_Device_ProcessControlRequest(&Disk_MS_Interface);
-}
-
-/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
- *
- * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
- */
-bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
-{
- bool CommandSuccess;
-
- LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
- CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
- return CommandSuccess;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Mode management functions and variables. This file contains the LUFA code required to
+ * manage the USB Mass Storage device mode.
+ */
+
+#include "USBDeviceMode.h"
+
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
+ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_MS_Device_t Disk_MS_Interface =
+ {
+ .Config =
+ {
+ .InterfaceNumber = 0,
+
+ .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
+ .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .DataINEndpointDoubleBank = true,
+
+ .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
+ .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
+ .DataOUTEndpointDoubleBank = true,
+
+ .TotalLUNs = 1,
+ },
+ };
+
+
+/** USB device mode management task. This function manages the Mass Storage Device class driver when the device is
+ * initialized in USB device mode.
+ */
+void USBDeviceMode_USBTask(void)
+{
+ if (USB_CurrentMode != USB_MODE_DEVICE)
+ return;
+
+ MS_Device_USBTask(&Disk_MS_Interface);
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ MS_Device_ProcessControlRequest(&Disk_MS_Interface);
+}
+
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
+ *
+ * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
+ */
+bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
+{
+ bool CommandSuccess;
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
+ CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+
+ return CommandSuccess;
+}
diff --git a/Projects/Webserver/USBDeviceMode.h b/Projects/Webserver/USBDeviceMode.h
index 9b563c30a..2bd7c3818 100644
--- a/Projects/Webserver/USBDeviceMode.h
+++ b/Projects/Webserver/USBDeviceMode.h
@@ -1,57 +1,57 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 USBDeviceMode.c.
- */
-
-#ifndef _USBDEVICEMODE_H_
-#define _USBDEVICEMODE_H_
-
- /* Includes: */
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
-
- #include "Webserver.h"
- #include "Descriptors.h"
- #include "Lib/SCSI.h"
-
- /* Function Prototypes: */
- void USBDeviceMode_USBTask(void);
-
- void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
- void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
-
- bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 USBDeviceMode.c.
+ */
+
+#ifndef _USBDEVICEMODE_H_
+#define _USBDEVICEMODE_H_
+
+ /* Includes: */
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>
+
+ #include "Webserver.h"
+ #include "Descriptors.h"
+ #include "Lib/SCSI.h"
+
+ /* Function Prototypes: */
+ void USBDeviceMode_USBTask(void);
+
+ void EVENT_USB_Device_Connect(void);
+ void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+
+ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
+
+#endif
diff --git a/Projects/Webserver/USBHostMode.c b/Projects/Webserver/USBHostMode.c
index 14f33e07c..0eb5c6f4b 100644
--- a/Projects/Webserver/USBHostMode.c
+++ b/Projects/Webserver/USBHostMode.c
@@ -1,178 +1,178 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Host Mode management functions and variables. This file contains the LUFA code required to
- * manage the USB RNDIS host mode.
- */
-
-#include "USBHostMode.h"
-
-/** LUFA RNDIS Class driver interface configuration and state information. This structure is
- * passed to all RNDIS Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
- {
- .Config =
- {
- .DataINPipeNumber = 1,
- .DataINPipeDoubleBank = false,
-
- .DataOUTPipeNumber = 2,
- .DataOUTPipeDoubleBank = false,
-
- .NotificationPipeNumber = 3,
- .NotificationPipeDoubleBank = false,
-
- .HostMaxPacketSize = UIP_CONF_BUFFER_SIZE,
- },
- };
-
-
-/** USB host mode management task. This function manages the RNDIS Host class driver and uIP stack when the device is
- * initialized in USB host mode.
- */
-void USBHostMode_USBTask(void)
-{
- if (USB_CurrentMode != USB_MODE_HOST)
- return;
-
- switch (USB_HostState)
- {
- case HOST_STATE_Addressed:
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
- uint16_t ConfigDescriptorSize;
- uint8_t ConfigDescriptorData[512];
-
- if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
- sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface,
- ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST);
- if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,
- &PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,
- &MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- /* Initialize uIP stack */
- uIPManagement_Init();
-
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
- USB_HostState = HOST_STATE_Configured;
- break;
- case HOST_STATE_Configured:
- uIPManagement_ManageNetwork();
-
- break;
- }
-
- RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);
-}
-
-/** 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)
-{
- 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)
-{
- 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)
-{
- 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_ShutDown();
-
- 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)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Host Mode management functions and variables. This file contains the LUFA code required to
+ * manage the USB RNDIS host mode.
+ */
+
+#include "USBHostMode.h"
+
+/** LUFA RNDIS Class driver interface configuration and state information. This structure is
+ * passed to all RNDIS Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
+ {
+ .Config =
+ {
+ .DataINPipeNumber = 1,
+ .DataINPipeDoubleBank = false,
+
+ .DataOUTPipeNumber = 2,
+ .DataOUTPipeDoubleBank = false,
+
+ .NotificationPipeNumber = 3,
+ .NotificationPipeDoubleBank = false,
+
+ .HostMaxPacketSize = UIP_CONF_BUFFER_SIZE,
+ },
+ };
+
+
+/** USB host mode management task. This function manages the RNDIS Host class driver and uIP stack when the device is
+ * initialized in USB host mode.
+ */
+void USBHostMode_USBTask(void)
+{
+ if (USB_CurrentMode != USB_MODE_HOST)
+ return;
+
+ switch (USB_HostState)
+ {
+ case HOST_STATE_Addressed:
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+
+ uint16_t ConfigDescriptorSize;
+ uint8_t ConfigDescriptorData[512];
+
+ if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
+ sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface,
+ ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST);
+ if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,
+ &PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,
+ &MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)
+ {
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ /* Initialize uIP stack */
+ uIPManagement_Init();
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ USB_HostState = HOST_STATE_Configured;
+ break;
+ case HOST_STATE_Configured:
+ uIPManagement_ManageNetwork();
+
+ break;
+ }
+
+ RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);
+}
+
+/** 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)
+{
+ 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)
+{
+ 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)
+{
+ 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_ShutDown();
+
+ 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)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
diff --git a/Projects/Webserver/USBHostMode.h b/Projects/Webserver/USBHostMode.h
index b548e6b8d..1b30f6ad6 100644
--- a/Projects/Webserver/USBHostMode.h
+++ b/Projects/Webserver/USBHostMode.h
@@ -1,58 +1,58 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 USBHostMode.c.
- */
-
-#ifndef _USBHOSTMODE_H_
-#define _USBHOSTMODE_H_
-
- /* Includes: */
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/RNDIS.h>
-
- #include "Webserver.h"
- #include "Lib/uIPManagement.h"
-
- /* External Variables: */
- extern USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface;
-
- /* Function Prototypes: */
- void USBHostMode_USBTask(void);
-
- void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
- void EVENT_USB_Host_DeviceAttached(void);
- void EVENT_USB_Host_DeviceUnattached(void);
- void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
- void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 USBHostMode.c.
+ */
+
+#ifndef _USBHOSTMODE_H_
+#define _USBHOSTMODE_H_
+
+ /* Includes: */
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/RNDIS.h>
+
+ #include "Webserver.h"
+ #include "Lib/uIPManagement.h"
+
+ /* External Variables: */
+ extern USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface;
+
+ /* Function Prototypes: */
+ void USBHostMode_USBTask(void);
+
+ void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_Host_DeviceAttached(void);
+ void EVENT_USB_Host_DeviceUnattached(void);
+ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_Host_DeviceEnumerationComplete(void);
+
+#endif
diff --git a/Projects/Webserver/Webserver.c b/Projects/Webserver/Webserver.c
index cecd88168..9354ee34c 100644
--- a/Projects/Webserver/Webserver.c
+++ b/Projects/Webserver/Webserver.c
@@ -1,75 +1,75 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Webserver project. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-#include "Webserver.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();
-
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- sei();
-
- for (;;)
- {
- if (USB_CurrentMode == USB_MODE_HOST)
- USBHostMode_USBTask();
- else
- USBDeviceMode_USBTask();
-
- USB_USBTask();
- }
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
- Dataflash_Init();
- LEDs_Init();
- USB_Init(USB_MODE_UID);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Webserver project. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
+#include "Webserver.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();
+
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ sei();
+
+ for (;;)
+ {
+ if (USB_CurrentMode == USB_MODE_HOST)
+ USBHostMode_USBTask();
+ else
+ USBDeviceMode_USBTask();
+
+ USB_USBTask();
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
+ Dataflash_Init();
+ LEDs_Init();
+ USB_Init(USB_MODE_UID);
+}
diff --git a/Projects/Webserver/Webserver.h b/Projects/Webserver/Webserver.h
index 4fb5b37b4..0643c9b58 100644
--- a/Projects/Webserver/Webserver.h
+++ b/Projects/Webserver/Webserver.h
@@ -1,80 +1,80 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 Webserver.c.
- */
-
-#ifndef _WEBSERVER_H_
-#define _WEBSERVER_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/pgmspace.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/Board/Dataflash.h>
- #include <LUFA/Drivers/Peripheral/SPI.h>
- #include <LUFA/Drivers/USB/USB.h>
-
- #include "USBDeviceMode.h"
- #include "USBHostMode.h"
-
- /* 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_LED1 | LEDS_LED2)
-
- /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
- #define LEDMASK_USB_READY LEDS_LED2
-
- /** 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_LED1 | LEDS_LED3 | LEDS_LED4)
-
- /** LED mask for the uIP stack idling with no IP configuration */
- #define LEDMASK_UIP_READY_NOCONFIG LEDS_LED3
-
- /** LED mask for the uIP stack idling with a valid IP configuration */
- #define LEDMASK_UIP_READY_CONFIG LEDS_LED4
-
- /* Function Prototypes: */
- void SetupHardware(void);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 Webserver.c.
+ */
+
+#ifndef _WEBSERVER_H_
+#define _WEBSERVER_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/pgmspace.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/Board/Dataflash.h>
+ #include <LUFA/Drivers/Peripheral/SPI.h>
+ #include <LUFA/Drivers/USB/USB.h>
+
+ #include "USBDeviceMode.h"
+ #include "USBHostMode.h"
+
+ /* 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_LED1 | LEDS_LED2)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
+ #define LEDMASK_USB_READY LEDS_LED2
+
+ /** 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_LED1 | LEDS_LED3 | LEDS_LED4)
+
+ /** LED mask for the uIP stack idling with no IP configuration */
+ #define LEDMASK_UIP_READY_NOCONFIG LEDS_LED3
+
+ /** LED mask for the uIP stack idling with a valid IP configuration */
+ #define LEDMASK_UIP_READY_CONFIG LEDS_LED4
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+
+#endif
diff --git a/Projects/Webserver/Webserver.txt b/Projects/Webserver/Webserver.txt
index 3c0c48e35..f20189c62 100644
--- a/Projects/Webserver/Webserver.txt
+++ b/Projects/Webserver/Webserver.txt
@@ -1,113 +1,113 @@
-/** \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 uIP Powered Webserver Project
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - Series 7 USB AVRs
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>Dual Mode Host/Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>Communications Device Class (CDC) \n
- * Mass Storage Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard) \n
- * Bulk-Only Transport</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>Microsoft RNDIS Specification \n
- * USBIF Mass Storage Standard \n
- * USB Bulk-Only Transport Standard \n
- * SCSI Primary Commands Specification \n
- * SCSI Block Commands Specification</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * Simple HTTP webserver project. This project combines the LUFA library with the uIP TCP/IP full network stack and FatFS
- * library to create a RNDIS host capable of serving out HTTP webpages to multiple hosts simultaneously. This project
- * demonstrates how the libraries can be combined into a robust network enabled application, with the addition of a RNDIS
- * network device.
- *
- * To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load
- * HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called
- * <i>index.htm</i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total
- * requested file path must be equal to or less than the maximum URI length (\see \ref SSec_Options).
- *
- * When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the
- * appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET
- * connections on port 23. The device IP, netmask and default gateway IP must be set to values appropriate for the RNDIS
- * device being used for this project to work if the DHCP client is disabled (see \ref SSec_Options) - otherwise, the device
- * will query the network's DHCP server for these parameters automatically.
- *
- * When properly configured, the webserver can be accessed from any HTTP webrowser by typing in the device's statically or
- * dynamically allocated IP address. The TELNET client can be accessed via any network socket app by connecting to the device
- * on port 23 on the device's statically or dynamically allocated IP address.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>ENABLE_TELNET_SERVER</td>
- * <td>Makefile CDEFS</td>
- * <td>When defined, this enables the TELNET server in addition to the HTTP webserver, which listens for incomming connections
- * and processes user commands.</td>
- * </tr>
- * <tr>
- * <td>ENABLE_DHCP_CLIENT</td>
- * <td>Makefile CDEFS</td>
- * <td>When defined, this enables the DHCP client for dynamic IP allocation of the network settings from a DHCP server.</td>
- * </tr>
- * <tr>
- * <td>DEVICE_IP_ADDRESS</td>
- * <td>Lib/uIPManagement.h</td>
- * <td>IP address that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT is not defined).</td>
- * </tr>
- * <tr>
- * <td>DEVICE_NETMASK</td>
- * <td>Lib/uIPManagement.h</td>
- * <td>Netmask that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT is not defined).</td>
- * </tr>
- * <tr>
- * <td>DEVICE_GATEWAY</td>
- * <td>Lib/uIPManagement.h</td>
- * <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT
- * is not defined).</td>
- * </tr>
- * <tr>
- * <td>MAX_URI_LENGTH</td>
- * <td>Makefile CDEFS</td>
- * <td>Maximum length of a URI for the Webserver. This is the maximum file path, including subdirectories and seperators.</td>
- * </tr>
- * </table>
+/** \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 uIP Powered Webserver Project
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - Series 7 USB AVRs
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Dual Mode Host/Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Communications Device Class (CDC) \n
+ * Mass Storage Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard) \n
+ * Bulk-Only Transport</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>Microsoft RNDIS Specification \n
+ * USBIF Mass Storage Standard \n
+ * USB Bulk-Only Transport Standard \n
+ * SCSI Primary Commands Specification \n
+ * SCSI Block Commands Specification</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * Simple HTTP webserver project. This project combines the LUFA library with the uIP TCP/IP full network stack and FatFS
+ * library to create a RNDIS host capable of serving out HTTP webpages to multiple hosts simultaneously. This project
+ * demonstrates how the libraries can be combined into a robust network enabled application, with the addition of a RNDIS
+ * network device.
+ *
+ * To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load
+ * HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called
+ * <i>index.htm</i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total
+ * requested file path must be equal to or less than the maximum URI length (\see \ref SSec_Options).
+ *
+ * When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the
+ * appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET
+ * connections on port 23. The device IP, netmask and default gateway IP must be set to values appropriate for the RNDIS
+ * device being used for this project to work if the DHCP client is disabled (see \ref SSec_Options) - otherwise, the device
+ * will query the network's DHCP server for these parameters automatically.
+ *
+ * When properly configured, the webserver can be accessed from any HTTP webrowser by typing in the device's statically or
+ * dynamically allocated IP address. The TELNET client can be accessed via any network socket app by connecting to the device
+ * on port 23 on the device's statically or dynamically allocated IP address.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>ENABLE_TELNET_SERVER</td>
+ * <td>Makefile CDEFS</td>
+ * <td>When defined, this enables the TELNET server in addition to the HTTP webserver, which listens for incomming connections
+ * and processes user commands.</td>
+ * </tr>
+ * <tr>
+ * <td>ENABLE_DHCP_CLIENT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>When defined, this enables the DHCP client for dynamic IP allocation of the network settings from a DHCP server.</td>
+ * </tr>
+ * <tr>
+ * <td>DEVICE_IP_ADDRESS</td>
+ * <td>Lib/uIPManagement.h</td>
+ * <td>IP address that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT is not defined).</td>
+ * </tr>
+ * <tr>
+ * <td>DEVICE_NETMASK</td>
+ * <td>Lib/uIPManagement.h</td>
+ * <td>Netmask that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT is not defined).</td>
+ * </tr>
+ * <tr>
+ * <td>DEVICE_GATEWAY</td>
+ * <td>Lib/uIPManagement.h</td>
+ * <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT
+ * is not defined).</td>
+ * </tr>
+ * <tr>
+ * <td>MAX_URI_LENGTH</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Maximum length of a URI for the Webserver. This is the maximum file path, including subdirectories and seperators.</td>
+ * </tr>
+ * </table>
*/ \ No newline at end of file
diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile
index e3aaf3361..c0ddd40bd 100644
--- a/Projects/Webserver/makefile
+++ b/Projects/Webserver/makefile
@@ -1,762 +1,762 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = USBKEY
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = Webserver
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../
-
-
-# LUFA library compile-time options
-LUFA_OPTS = -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D FAST_STREAM_TRANSFERS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- Descriptors.c \
- USBDeviceMode.c \
- USBHostMode.c \
- Lib/SCSI.c \
- Lib/DataflashManager.c \
- Lib/uIPManagement.c \
- Lib/DHCPClientApp.c \
- Lib/HTTPServerApp.c \
- Lib/TELNETServerApp.c \
- Lib/uip/uip.c \
- Lib/uip/uip_arp.c \
- Lib/uip/timer.c \
- Lib/uip/clock.c \
- Lib/uip/uip-split.c \
- Lib/FATFs/diskio.c \
- Lib/FATFs/ff.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/RNDIS.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/RNDIS.c \
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/ Lib/uip/ Lib/uip/conf/ Lib/FATFs/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-CDEFS += -DENABLE_DHCP_CLIENT
-CDEFS += -DENABLE_TELNET_SERVER
-CDEFS += -DMAX_URI_LENGTH=50
-
-CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=3
-CDEFS += -DUIP_CONF_MAX_LISTENPORTS=5 -DUIP_URGDATA=0 -DUIP_CONF_BUFFER_SIZE=1514 -DUIP_ARCH_CHKSUM=0
-CDEFS += -DUIP_CONF_LL_802154=0 -DUIP_CONF_LL_80211=0 -DUIP_CONF_ROUTER=0 -DUIP_CONF_ICMP6=0
-CDEFS += -DUIP_ARCH_ADD32=0 -DUIP_CONF_ICMP_DEST_UNREACH=1 -DUIP_NEIGHBOR_CONF_ADDRTYPE=0
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = USBKEY
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = Webserver
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../
+
+
+# LUFA library compile-time options
+LUFA_OPTS = -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D FAST_STREAM_TRANSFERS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ Descriptors.c \
+ USBDeviceMode.c \
+ USBHostMode.c \
+ Lib/SCSI.c \
+ Lib/DataflashManager.c \
+ Lib/uIPManagement.c \
+ Lib/DHCPClientApp.c \
+ Lib/HTTPServerApp.c \
+ Lib/TELNETServerApp.c \
+ Lib/uip/uip.c \
+ Lib/uip/uip_arp.c \
+ Lib/uip/timer.c \
+ Lib/uip/clock.c \
+ Lib/uip/uip-split.c \
+ Lib/FATFs/diskio.c \
+ Lib/FATFs/ff.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/RNDIS.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/RNDIS.c \
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/ Lib/uip/ Lib/uip/conf/ Lib/FATFs/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+CDEFS += -DENABLE_DHCP_CLIENT
+CDEFS += -DENABLE_TELNET_SERVER
+CDEFS += -DMAX_URI_LENGTH=50
+
+CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=3
+CDEFS += -DUIP_CONF_MAX_LISTENPORTS=5 -DUIP_URGDATA=0 -DUIP_CONF_BUFFER_SIZE=1514 -DUIP_ARCH_CHKSUM=0
+CDEFS += -DUIP_CONF_LL_802154=0 -DUIP_CONF_LL_80211=0 -DUIP_CONF_ROUTER=0 -DUIP_CONF_ICMP6=0
+CDEFS += -DUIP_ARCH_ADD32=0 -DUIP_CONF_ICMP_DEST_UNREACH=1 -DUIP_NEIGHBOR_CONF_ADDRTYPE=0
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.c b/Projects/XPLAINBridge/AVRISPDescriptors.c
index 30e72e9e3..1f2e1677c 100644
--- a/Projects/XPLAINBridge/AVRISPDescriptors.c
+++ b/Projects/XPLAINBridge/AVRISPDescriptors.c
@@ -1,219 +1,219 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 "AVRISPDescriptors.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.
- */
-USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0xFF,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x2104,
- .ReleaseNumber = VERSION_BCD(02.00),
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = 0x03,
-
- .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.
- */
-AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
-{
- .Config =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
-
- .TotalConfigurationSize = sizeof(AVRISP_USB_Descriptor_Configuration_t),
- .TotalInterfaces = 1,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = USB_CONFIG_ATTR_SELFPOWERED,
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .AVRISP_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0xFF,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .AVRISP_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = AVRISP_DATA_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .AVRISP_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = AVRISP_DATA_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA AVRISP MkII Clone"
-};
-
-/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
- * series of uppercase hexadecimal digits.
- */
-USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
-{
- .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
- .UnicodeString = L"0000A00128255"
-};
-
-/** 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 AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&AVRISP_DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&AVRISP_ConfigurationDescriptor;
- Size = sizeof(AVRISP_USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&AVRISP_LanguageString;
- Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&AVRISP_ManufacturerString;
- Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&AVRISP_ProductString;
- Size = pgm_read_byte(&AVRISP_ProductString.Header.Size);
- break;
- case 0x03:
- Address = (void*)&AVRISP_SerialString;
- Size = pgm_read_byte(&AVRISP_SerialString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 "AVRISPDescriptors.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.
+ */
+USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0xFF,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x2104,
+ .ReleaseNumber = VERSION_BCD(02.00),
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = 0x03,
+
+ .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.
+ */
+AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
+{
+ .Config =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
+
+ .TotalConfigurationSize = sizeof(AVRISP_USB_Descriptor_Configuration_t),
+ .TotalInterfaces = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = USB_CONFIG_ATTR_SELFPOWERED,
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .AVRISP_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0xFF,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .AVRISP_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = AVRISP_DATA_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .AVRISP_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = AVRISP_DATA_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA AVRISP MkII Clone"
+};
+
+/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
+ * series of uppercase hexadecimal digits.
+ */
+USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
+{
+ .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
+
+ .UnicodeString = L"0000A00128255"
+};
+
+/** 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 AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&AVRISP_DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&AVRISP_ConfigurationDescriptor;
+ Size = sizeof(AVRISP_USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&AVRISP_LanguageString;
+ Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&AVRISP_ManufacturerString;
+ Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&AVRISP_ProductString;
+ Size = pgm_read_byte(&AVRISP_ProductString.Header.Size);
+ break;
+ case 0x03:
+ Address = (void*)&AVRISP_SerialString;
+ Size = pgm_read_byte(&AVRISP_SerialString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.h b/Projects/XPLAINBridge/AVRISPDescriptors.h
index 2fa18095d..7f190195e 100644
--- a/Projects/XPLAINBridge/AVRISPDescriptors.h
+++ b/Projects/XPLAINBridge/AVRISPDescriptors.h
@@ -1,78 +1,78 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 AVRISPDescriptors.c.
- */
-
-#ifndef _AVRISP_DESCRIPTORS_H_
-#define _AVRISP_DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
-
- /* Macros: */
- #if !defined(LIBUSB_FILTERDRV_COMPAT)
- /** Endpoint number of the AVRISP data OUT endpoint. */
- #define AVRISP_DATA_OUT_EPNUM 2
-
- /** Endpoint number of the AVRISP data IN endpoint. */
- #define AVRISP_DATA_IN_EPNUM 2
- #else
- /** Endpoint number of the AVRISP data OUT endpoint. */
- #define AVRISP_DATA_OUT_EPNUM 2
-
- /** Endpoint number of the AVRISP data IN endpoint. */
- #define AVRISP_DATA_IN_EPNUM 3
- #endif
-
- /** Size in bytes of the AVRISP data endpoint. */
- #define AVRISP_DATA_EPSIZE 64
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t AVRISP_Interface;
- USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
- USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint;
- } AVRISP_USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 AVRISPDescriptors.c.
+ */
+
+#ifndef _AVRISP_DESCRIPTORS_H_
+#define _AVRISP_DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+
+ /* Macros: */
+ #if !defined(LIBUSB_FILTERDRV_COMPAT)
+ /** Endpoint number of the AVRISP data OUT endpoint. */
+ #define AVRISP_DATA_OUT_EPNUM 2
+
+ /** Endpoint number of the AVRISP data IN endpoint. */
+ #define AVRISP_DATA_IN_EPNUM 2
+ #else
+ /** Endpoint number of the AVRISP data OUT endpoint. */
+ #define AVRISP_DATA_OUT_EPNUM 2
+
+ /** Endpoint number of the AVRISP data IN endpoint. */
+ #define AVRISP_DATA_IN_EPNUM 3
+ #endif
+
+ /** Size in bytes of the AVRISP data endpoint. */
+ #define AVRISP_DATA_EPSIZE 64
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t AVRISP_Interface;
+ USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
+ USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint;
+ } AVRISP_USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
+
+#endif
diff --git a/Projects/XPLAINBridge/Doxygen.conf b/Projects/XPLAINBridge/Doxygen.conf
index 95095df51..0d59f2fbd 100644
--- a/Projects/XPLAINBridge/Doxygen.conf
+++ b/Projects/XPLAINBridge/Doxygen.conf
@@ -1,1564 +1,1564 @@
-# Doxyfile 1.6.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "LUFA Library - XPLAIN Serial Bridge/PDI Programmer Device 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 = 0.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./Documentation/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ./
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.c \
- *.txt
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = Documentation/
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = __* \
- INCLUDE_FROM_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = YES
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = __DOXYGEN__
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = BUTTLOADTAG
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = NO
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = NO
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 15
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
+# Doxyfile 1.6.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "LUFA Library - XPLAIN Serial Bridge/PDI Programmer Device 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 = 0.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./Documentation/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ./
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.txt
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = Documentation/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = __* \
+ INCLUDE_FROM_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __DOXYGEN__
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = BUTTLOADTAG
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = NO
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 15
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf b/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf
index 9a0a0e418..5f9bc1a3d 100644
--- a/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf
+++ b/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf
@@ -1,106 +1,106 @@
-;************************************************************
-; Windows USB CDC ACM Setup File
-; Copyright (c) 2000 Microsoft Corporation
-
-
-[Version]
-Signature="$Windows NT$"
-Class=Ports
-ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
-Provider=%MFGNAME%
-LayoutFile=layout.inf
-CatalogFile=%MFGFILENAME%.cat
-DriverVer=11/15/2007,5.1.2600.0
-
-[Manufacturer]
-%MFGNAME%=DeviceList, NTamd64
-
-[DestinationDirs]
-DefaultDestDir=12
-
-
-;------------------------------------------------------------------------------
-; Windows 2000/XP/Vista-32bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.nt]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.nt
-AddReg=DriverInstall.nt.AddReg
-
-[DriverCopyFiles.nt]
-usbser.sys,,,0x20
-
-[DriverInstall.nt.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.nt.Services]
-AddService=usbser, 0x00000002, DriverService.nt
-
-[DriverService.nt]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-;------------------------------------------------------------------------------
-; Vista-64bit Sections
-;------------------------------------------------------------------------------
-
-[DriverInstall.NTamd64]
-include=mdmcpq.inf
-CopyFiles=DriverCopyFiles.NTamd64
-AddReg=DriverInstall.NTamd64.AddReg
-
-[DriverCopyFiles.NTamd64]
-%DRIVERFILENAME%.sys,,,0x20
-
-[DriverInstall.NTamd64.AddReg]
-HKR,,DevLoader,,*ntkern
-HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
-HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
-
-[DriverInstall.NTamd64.Services]
-AddService=usbser, 0x00000002, DriverService.NTamd64
-
-[DriverService.NTamd64]
-DisplayName=%SERVICE%
-ServiceType=1
-StartType=3
-ErrorControl=1
-ServiceBinary=%12%\%DRIVERFILENAME%.sys
-
-
-;------------------------------------------------------------------------------
-; Vendor and Product ID Definitions
-;------------------------------------------------------------------------------
-; When developing your USB device, the VID and PID used in the PC side
-; application program and the firmware on the microcontroller must match.
-; Modify the below line to use your VID and PID. Use the format as shown below.
-; Note: One INF file can be used for multiple devices with different VID and PIDs.
-; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
-;------------------------------------------------------------------------------
-[SourceDisksFiles]
-[SourceDisksNames]
-[DeviceList]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
-
-[DeviceList.NTamd64]
-%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
-
-
-;------------------------------------------------------------------------------
-; String Definitions
-;------------------------------------------------------------------------------
-;Modify these strings to customize your device
-;------------------------------------------------------------------------------
-[Strings]
-MFGFILENAME="CDC_vista"
-DRIVERFILENAME ="usbser"
-MFGNAME="http://www.fourwalledcubicle.com"
-INSTDISK="LUFA USB-RS232 CDC Driver Installer"
-DESCRIPTION="Communications Port"
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+; Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+; Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+; Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID. Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
+
+
+;------------------------------------------------------------------------------
+; String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="http://www.fourwalledcubicle.com"
+INSTDISK="LUFA USB-RS232 CDC Driver Installer"
+DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file
diff --git a/Projects/XPLAINBridge/Lib/RingBuff.c b/Projects/XPLAINBridge/Lib/RingBuff.c
index 2109f8cc0..91c61d06b 100644
--- a/Projects/XPLAINBridge/Lib/RingBuff.c
+++ b/Projects/XPLAINBridge/Lib/RingBuff.c
@@ -1,120 +1,120 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "RingBuff.h"
-
-void Buffer_Initialize(RingBuff_t* const Buffer)
-{
- BUFF_ATOMIC_BLOCK
- {
- Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- Buffer->Elements = 0;
- }
-}
-
-void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
-{
- BUFF_ATOMIC_BLOCK
- {
- #if defined(BUFF_DROPOLD)
- if (Buffer->Elements == BUFF_LENGTH)
- {
- Buffer->OutPtr++;
-
- if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
- else
- {
- Buffer->Elements++;
- }
- #elif defined(BUFF_DROPNEW)
- if (Buffer->Elements == BUFF_LENGTH)
- return;
-
- Buffer->Elements++;
- #elif defined(BUFF_NODROPCHECK)
- Buffer->Elements++;
- #endif
-
- *(Buffer->InPtr) = Data;
- Buffer->InPtr++;
-
- if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
-}
-
-RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
-{
- RingBuff_Data_t BuffData;
-
- BUFF_ATOMIC_BLOCK
- {
-#if defined(BUFF_EMPTYRETURNSZERO)
- if (!(Buffer->Elements))
- return 0;
-#elif !defined(BUFF_NOEMPTYCHECK)
- #error No empty buffer check behavior specified.
-#endif
-
- BuffData = *(Buffer->OutPtr);
-
- Buffer->OutPtr++;
- Buffer->Elements--;
-
- if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
- Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
- }
-
- return BuffData;
-}
-
-#if defined(BUFF_USEPEEK)
-RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
-{
- RingBuff_Data_t BuffData;
-
- BUFF_ATOMIC_BLOCK
- {
-#if defined(BUFF_EMPTYRETURNSZERO)
- if (!(Buffer->Elements))
- return 0;
-#elif !defined(BUFF_NOEMPTYCHECK)
- #error No empty buffer check behavior specified.
-#endif
-
- BuffData = *(Buffer->OutPtr);
- }
-
- return BuffData;
-}
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "RingBuff.h"
+
+void Buffer_Initialize(RingBuff_t* const Buffer)
+{
+ BUFF_ATOMIC_BLOCK
+ {
+ Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ Buffer->Elements = 0;
+ }
+}
+
+void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
+{
+ BUFF_ATOMIC_BLOCK
+ {
+ #if defined(BUFF_DROPOLD)
+ if (Buffer->Elements == BUFF_LENGTH)
+ {
+ Buffer->OutPtr++;
+
+ if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+ else
+ {
+ Buffer->Elements++;
+ }
+ #elif defined(BUFF_DROPNEW)
+ if (Buffer->Elements == BUFF_LENGTH)
+ return;
+
+ Buffer->Elements++;
+ #elif defined(BUFF_NODROPCHECK)
+ Buffer->Elements++;
+ #endif
+
+ *(Buffer->InPtr) = Data;
+ Buffer->InPtr++;
+
+ if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+}
+
+RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
+{
+ RingBuff_Data_t BuffData;
+
+ BUFF_ATOMIC_BLOCK
+ {
+#if defined(BUFF_EMPTYRETURNSZERO)
+ if (!(Buffer->Elements))
+ return 0;
+#elif !defined(BUFF_NOEMPTYCHECK)
+ #error No empty buffer check behavior specified.
+#endif
+
+ BuffData = *(Buffer->OutPtr);
+
+ Buffer->OutPtr++;
+ Buffer->Elements--;
+
+ if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
+ Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
+ }
+
+ return BuffData;
+}
+
+#if defined(BUFF_USEPEEK)
+RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
+{
+ RingBuff_Data_t BuffData;
+
+ BUFF_ATOMIC_BLOCK
+ {
+#if defined(BUFF_EMPTYRETURNSZERO)
+ if (!(Buffer->Elements))
+ return 0;
+#elif !defined(BUFF_NOEMPTYCHECK)
+ #error No empty buffer check behavior specified.
+#endif
+
+ BuffData = *(Buffer->OutPtr);
+ }
+
+ return BuffData;
+}
+#endif
diff --git a/Projects/XPLAINBridge/Lib/RingBuff.h b/Projects/XPLAINBridge/Lib/RingBuff.h
index 2e03a28be..b4933aa4d 100644
--- a/Projects/XPLAINBridge/Lib/RingBuff.h
+++ b/Projects/XPLAINBridge/Lib/RingBuff.h
@@ -1,116 +1,116 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/* Buffer Configuration: */
- /* Buffer length - select static size of created ring buffers: */
- #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
-
- /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
- #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
-
- /* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
- #define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
- // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
- // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
-
- /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
- //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
- #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
-
- /* Buffer storage type - set the datatype for the stored data */
- #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
-
- /* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
- //#define BUFF_USEPEEK
-
-#ifndef _RINGBUFF_H_
-#define _RINGBUFF_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/atomic.h>
- #include <limits.h>
-
- #include <LUFA/Common/Common.h>
-
- /* Defines and checks: */
- #if defined(BUFF_STATICSIZE)
- #define BUFF_LENGTH BUFF_STATICSIZE
- #else
- #error No buffer length specified!
- #endif
-
- #if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
- #error No buffer drop mode specified.
- #endif
-
- #if !defined(BUFF_DATATYPE)
- #error Ringbuffer storage data type not specified.
- #endif
-
- #if defined(BUFF_VOLATILE)
- #define BUFF_MODE volatile
- #define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- #else
- #define BUFF_MODE
- #define BUFF_ATOMIC_BLOCK
- #endif
-
- #if (BUFF_STATICSIZE > LONG_MAX)
- #define RingBuff_Elements_t uint64_t
- #elif (BUFF_STATICSIZE > INT_MAX)
- #define RingBuff_Elements_t uint32_t
- #elif (BUFF_STATICSIZE > CHAR_MAX)
- #define RingBuff_Elements_t uint16_t
- #else
- #define RingBuff_Elements_t uint8_t
- #endif
-
- /* Type Defines: */
- typedef BUFF_DATATYPE RingBuff_Data_t;
-
- typedef BUFF_MODE struct
- {
- RingBuff_Data_t Buffer[BUFF_LENGTH];
- RingBuff_Data_t* InPtr;
- RingBuff_Data_t* OutPtr;
- RingBuff_Elements_t Elements;
- } RingBuff_t;
-
- /* Function Prototypes: */
- void Buffer_Initialize(RingBuff_t* const Buff);
- void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
- RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
- #if defined(BUFF_USEPEEK)
- RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
- #endif
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/* Buffer Configuration: */
+ /* Buffer length - select static size of created ring buffers: */
+ #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
+
+ /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
+ #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
+
+ /* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
+ #define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
+ // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
+ // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
+
+ /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
+ //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
+ #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
+
+ /* Buffer storage type - set the datatype for the stored data */
+ #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
+
+ /* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
+ //#define BUFF_USEPEEK
+
+#ifndef _RINGBUFF_H_
+#define _RINGBUFF_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include <util/atomic.h>
+ #include <limits.h>
+
+ #include <LUFA/Common/Common.h>
+
+ /* Defines and checks: */
+ #if defined(BUFF_STATICSIZE)
+ #define BUFF_LENGTH BUFF_STATICSIZE
+ #else
+ #error No buffer length specified!
+ #endif
+
+ #if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
+ #error No buffer drop mode specified.
+ #endif
+
+ #if !defined(BUFF_DATATYPE)
+ #error Ringbuffer storage data type not specified.
+ #endif
+
+ #if defined(BUFF_VOLATILE)
+ #define BUFF_MODE volatile
+ #define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ #else
+ #define BUFF_MODE
+ #define BUFF_ATOMIC_BLOCK
+ #endif
+
+ #if (BUFF_STATICSIZE > LONG_MAX)
+ #define RingBuff_Elements_t uint64_t
+ #elif (BUFF_STATICSIZE > INT_MAX)
+ #define RingBuff_Elements_t uint32_t
+ #elif (BUFF_STATICSIZE > CHAR_MAX)
+ #define RingBuff_Elements_t uint16_t
+ #else
+ #define RingBuff_Elements_t uint8_t
+ #endif
+
+ /* Type Defines: */
+ typedef BUFF_DATATYPE RingBuff_Data_t;
+
+ typedef BUFF_MODE struct
+ {
+ RingBuff_Data_t Buffer[BUFF_LENGTH];
+ RingBuff_Data_t* InPtr;
+ RingBuff_Data_t* OutPtr;
+ RingBuff_Elements_t Elements;
+ } RingBuff_t;
+
+ /* Function Prototypes: */
+ void Buffer_Initialize(RingBuff_t* const Buff);
+ void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
+ RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
+ #if defined(BUFF_USEPEEK)
+ RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
+ #endif
+
+#endif
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.c b/Projects/XPLAINBridge/Lib/SoftUART.c
index 31b11c1cf..194481d0e 100644
--- a/Projects/XPLAINBridge/Lib/SoftUART.c
+++ b/Projects/XPLAINBridge/Lib/SoftUART.c
@@ -1,143 +1,143 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
- Copyright 2010 Peter Danneger
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#include "SoftUART.h"
-
-volatile uint8_t srx_done, stx_count;
-volatile uint8_t srx_data, srx_mask, srx_tmp, stx_data;
-
-uint8_t SoftUART_IsReady(void)
-{
- return !(stx_count);
-}
-
-uint8_t SoftUART_TxByte(uint8_t Byte)
-{
- while (stx_count);
-
- stx_data = ~Byte;
- stx_count = 10;
-
- return Byte;
-}
-
-uint8_t SoftUART_IsReceived(void)
-{
- return srx_done;
-}
-
-uint8_t SoftUART_RxByte(void)
-{
- while (!(srx_done));
-
- srx_done = 0;
-
- return srx_data;
-}
-
-void SoftUART_Init(void)
-{
- OCR2B = TCNT2 + 1; // force first compare
- TCCR2A = (1 << COM2B1) | (1 << COM2B0); // T1 mode 0
- TCCR2B = (1 << FOC2B) | (1 << CS21); // CLK/8, T1 mode 0
- TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
- EICRA = (1 << ISC01); // -ve edge
- EIMSK = (1 << INT0); // enable INT0 interrupt
-
- stx_count = 0; // nothing to send
- srx_done = 0; // nothing received
- STXPORT |= 1 << STX; // TX output
- STXDDR |= 1 << STX; // TX output
- SRXPORT |= (1 << SRX); // pullup on INT0
-}
-
-/* ISR to detect the start of a bit being sent from the transmitter. */
-ISR(INT0_vect)
-{
- OCR2A = TCNT2 + (BIT_TIME / 8 * 3 / 2); // scan 1.5 bits after start
-
- srx_tmp = 0; // clear bit storage
- srx_mask = 1; // bit mask
-
- TIFR2 = (1 << OCF2A); // clear pending interrupt
-
- if (!(SRXPIN & (1 << SRX))) // still low
- {
- TIMSK2 = (1 << OCIE2A) | (1 << OCIE2B); // wait for first bit
- EIMSK &= ~(1 << INT0);
- }
-}
-
-/* ISR to manage the reception of bits to the transmitter. */
-ISR(TIMER2_COMPA_vect)
-{
- if (srx_mask)
- {
- if (SRXPIN & (1 << SRX))
- srx_tmp |= srx_mask;
-
- srx_mask <<= 1;
-
- OCR2A += BIT_TIME / 8; // next bit slice
- }
- else
- {
- srx_done = 1; // mark rx data valid
- srx_data = srx_tmp; // store rx data
- TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
- EIMSK |= (1 << INT0); // enable START irq
- EIFR = (1 << INTF0); // clear any pending
- }
-}
-
-/* ISR to manage the transmission of bits to the receiver. */
-ISR(TIMER2_COMPB_vect)
-{
- OCR2B += BIT_TIME / 8; // next bit slice
-
- if (stx_count)
- {
- if (--stx_count != 9) // no start bit
- {
- if (!(stx_data & 1)) // test inverted data
- TCCR2A = (1 << COM2B1) | (1 << COM2B0);
- else
- TCCR2A = (1 << COM2B1);
-
- stx_data >>= 1; // shift zero in from left
- }
- else
- {
- TCCR2A = (1 << COM2B1); // START bit
- }
- }
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
+ Copyright 2010 Peter Danneger
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#include "SoftUART.h"
+
+volatile uint8_t srx_done, stx_count;
+volatile uint8_t srx_data, srx_mask, srx_tmp, stx_data;
+
+uint8_t SoftUART_IsReady(void)
+{
+ return !(stx_count);
+}
+
+uint8_t SoftUART_TxByte(uint8_t Byte)
+{
+ while (stx_count);
+
+ stx_data = ~Byte;
+ stx_count = 10;
+
+ return Byte;
+}
+
+uint8_t SoftUART_IsReceived(void)
+{
+ return srx_done;
+}
+
+uint8_t SoftUART_RxByte(void)
+{
+ while (!(srx_done));
+
+ srx_done = 0;
+
+ return srx_data;
+}
+
+void SoftUART_Init(void)
+{
+ OCR2B = TCNT2 + 1; // force first compare
+ TCCR2A = (1 << COM2B1) | (1 << COM2B0); // T1 mode 0
+ TCCR2B = (1 << FOC2B) | (1 << CS21); // CLK/8, T1 mode 0
+ TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
+ EICRA = (1 << ISC01); // -ve edge
+ EIMSK = (1 << INT0); // enable INT0 interrupt
+
+ stx_count = 0; // nothing to send
+ srx_done = 0; // nothing received
+ STXPORT |= 1 << STX; // TX output
+ STXDDR |= 1 << STX; // TX output
+ SRXPORT |= (1 << SRX); // pullup on INT0
+}
+
+/* ISR to detect the start of a bit being sent from the transmitter. */
+ISR(INT0_vect)
+{
+ OCR2A = TCNT2 + (BIT_TIME / 8 * 3 / 2); // scan 1.5 bits after start
+
+ srx_tmp = 0; // clear bit storage
+ srx_mask = 1; // bit mask
+
+ TIFR2 = (1 << OCF2A); // clear pending interrupt
+
+ if (!(SRXPIN & (1 << SRX))) // still low
+ {
+ TIMSK2 = (1 << OCIE2A) | (1 << OCIE2B); // wait for first bit
+ EIMSK &= ~(1 << INT0);
+ }
+}
+
+/* ISR to manage the reception of bits to the transmitter. */
+ISR(TIMER2_COMPA_vect)
+{
+ if (srx_mask)
+ {
+ if (SRXPIN & (1 << SRX))
+ srx_tmp |= srx_mask;
+
+ srx_mask <<= 1;
+
+ OCR2A += BIT_TIME / 8; // next bit slice
+ }
+ else
+ {
+ srx_done = 1; // mark rx data valid
+ srx_data = srx_tmp; // store rx data
+ TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
+ EIMSK |= (1 << INT0); // enable START irq
+ EIFR = (1 << INTF0); // clear any pending
+ }
+}
+
+/* ISR to manage the transmission of bits to the receiver. */
+ISR(TIMER2_COMPB_vect)
+{
+ OCR2B += BIT_TIME / 8; // next bit slice
+
+ if (stx_count)
+ {
+ if (--stx_count != 9) // no start bit
+ {
+ if (!(stx_data & 1)) // test inverted data
+ TCCR2A = (1 << COM2B1) | (1 << COM2B0);
+ else
+ TCCR2A = (1 << COM2B1);
+
+ stx_data >>= 1; // shift zero in from left
+ }
+ else
+ {
+ TCCR2A = (1 << COM2B1); // START bit
+ }
+ }
+}
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h
index d6b24320f..07187c24a 100644
--- a/Projects/XPLAINBridge/Lib/SoftUART.h
+++ b/Projects/XPLAINBridge/Lib/SoftUART.h
@@ -1,60 +1,60 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
- Copyright 2010 Peter Danneger
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#ifndef _SOFT_UART_
-#define _SOFT_UART_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include "SoftUART.h"
-
- /* Macros: */
- #define BAUD 9600
- #define BIT_TIME (uint16_t)((F_CPU + (BAUD / 2)) / BAUD)
-
- #define SRX PD0
- #define SRXPIN PIND
- #define SRXPORT PORTD
-
- #define STX PD1
- #define STXPORT PORTD
- #define STXDDR DDRD
-
- /* Function Prototypes: */
- uint8_t SoftUART_IsReady(void);
- uint8_t SoftUART_TxByte(uint8_t c);
- uint8_t SoftUART_IsReceived(void);
- uint8_t SoftUART_RxByte(void);
- void SoftUART_Init(void);
-
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
+ Copyright 2010 Peter Danneger
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#ifndef _SOFT_UART_
+#define _SOFT_UART_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+ #include "SoftUART.h"
+
+ /* Macros: */
+ #define BAUD 9600
+ #define BIT_TIME (uint16_t)((F_CPU + (BAUD / 2)) / BAUD)
+
+ #define SRX PD0
+ #define SRXPIN PIND
+ #define SRXPORT PORTD
+
+ #define STX PD1
+ #define STXPORT PORTD
+ #define STXDDR DDRD
+
+ /* Function Prototypes: */
+ uint8_t SoftUART_IsReady(void);
+ uint8_t SoftUART_TxByte(uint8_t c);
+ uint8_t SoftUART_IsReceived(void);
+ uint8_t SoftUART_RxByte(void);
+ void SoftUART_Init(void);
+
#endif \ No newline at end of file
diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c
index ca98b33a0..e0978847c 100644
--- a/Projects/XPLAINBridge/USARTDescriptors.c
+++ b/Projects/XPLAINBridge/USARTDescriptors.c
@@ -1,264 +1,264 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 "USARTDescriptors.h"
-
-/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
- * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
- * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
- * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
- * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
- * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
- * port location).
- */
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
-/** 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.
- */
-USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
-{
- .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
- .USBSpecification = VERSION_BCD(01.10),
- .Class = 0x02,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
- .VendorID = 0x03EB,
- .ProductID = 0x204B,
- .ReleaseNumber = 0x0000,
-
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
- .SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
- .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.
- */
-USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor =
-{
- .Config =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
-
- .TotalConfigurationSize = sizeof(USART_USB_Descriptor_Configuration_t),
- .TotalInterfaces = 2,
-
- .ConfigurationNumber = 1,
- .ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
- .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
- },
-
- .CDC_CCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 0,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 1,
-
- .Class = 0x02,
- .SubClass = 0x02,
- .Protocol = 0x01,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_Functional_IntHeader =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x00,
-
- .Data = {0x01, 0x10}
- },
-
- .CDC_Functional_AbstractControlManagement =
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
- .SubType = 0x02,
-
- .Data = {0x06}
- },
-
- .CDC_Functional_Union=
- {
- .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
- .SubType = 0x06,
-
- .Data = {0x00, 0x01}
- },
-
- .CDC_ManagementEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_NOTIFICATION_EPSIZE,
- .PollingIntervalMS = 0xFF
- },
-
- .CDC_DCI_Interface =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
-
- .InterfaceNumber = 1,
- .AlternateSetting = 0,
-
- .TotalEndpoints = 2,
-
- .Class = 0x0A,
- .SubClass = 0x00,
- .Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
- },
-
- .CDC_DataOutEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- },
-
- .CDC_DataInEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
- .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CDC_TXRX_EPSIZE,
- .PollingIntervalMS = 0x00
- }
-};
-
-/** 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.
- */
-USB_Descriptor_String_t PROGMEM USART_LanguageString =
-{
- .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
- .UnicodeString = {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.
- */
-USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = 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.
- */
-USB_Descriptor_String_t PROGMEM USART_ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA XPLAIN Bridge"
-};
-
-/** Descriptior retrieval function for the USART Bridge descriptors. This function is in turn called by the GetDescriptor
- * callback function in the main source file, to retrieve the device's descriptors when in USART bridge mode.
- */
-uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- const uint8_t DescriptorType = (wValue >> 8);
- const uint8_t DescriptorNumber = (wValue & 0xFF);
-
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
-
- switch (DescriptorType)
- {
- case DTYPE_Device:
- Address = (void*)&USART_DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
- break;
- case DTYPE_Configuration:
- Address = (void*)&USART_ConfigurationDescriptor;
- Size = sizeof(USART_USB_Descriptor_Configuration_t);
- break;
- case DTYPE_String:
- switch (DescriptorNumber)
- {
- case 0x00:
- Address = (void*)&USART_LanguageString;
- Size = pgm_read_byte(&USART_LanguageString.Header.Size);
- break;
- case 0x01:
- Address = (void*)&USART_ManufacturerString;
- Size = pgm_read_byte(&USART_ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = (void*)&USART_ProductString;
- Size = pgm_read_byte(&USART_ProductString.Header.Size);
- break;
- }
-
- break;
- }
-
- *DescriptorAddress = Address;
- return Size;
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 "USARTDescriptors.h"
+
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
+/** 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.
+ */
+USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(01.10),
+ .Class = 0x02,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x204B,
+ .ReleaseNumber = 0x0000,
+
+ .ManufacturerStrIndex = 0x01,
+ .ProductStrIndex = 0x02,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .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.
+ */
+USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor =
+{
+ .Config =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
+
+ .TotalConfigurationSize = sizeof(USART_USB_Descriptor_Configuration_t),
+ .TotalInterfaces = 2,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .CDC_CCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 0,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 1,
+
+ .Class = 0x02,
+ .SubClass = 0x02,
+ .Protocol = 0x01,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_Functional_IntHeader =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x00,
+
+ .Data = {0x01, 0x10}
+ },
+
+ .CDC_Functional_AbstractControlManagement =
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
+ .SubType = 0x02,
+
+ .Data = {0x06}
+ },
+
+ .CDC_Functional_Union=
+ {
+ .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
+ .SubType = 0x06,
+
+ .Data = {0x00, 0x01}
+ },
+
+ .CDC_ManagementEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .PollingIntervalMS = 0xFF
+ },
+
+ .CDC_DCI_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = 1,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0x0A,
+ .SubClass = 0x00,
+ .Protocol = 0x00,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .CDC_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ },
+
+ .CDC_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CDC_TXRX_EPSIZE,
+ .PollingIntervalMS = 0x00
+ }
+};
+
+/** 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.
+ */
+USB_Descriptor_String_t PROGMEM USART_LanguageString =
+{
+ .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
+
+ .UnicodeString = {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.
+ */
+USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
+{
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+ .UnicodeString = 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.
+ */
+USB_Descriptor_String_t PROGMEM USART_ProductString =
+{
+ .Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
+
+ .UnicodeString = L"LUFA XPLAIN Bridge"
+};
+
+/** Descriptior retrieval function for the USART Bridge descriptors. This function is in turn called by the GetDescriptor
+ * callback function in the main source file, to retrieve the device's descriptors when in USART bridge mode.
+ */
+uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = (void*)&USART_DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = (void*)&USART_ConfigurationDescriptor;
+ Size = sizeof(USART_USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case 0x00:
+ Address = (void*)&USART_LanguageString;
+ Size = pgm_read_byte(&USART_LanguageString.Header.Size);
+ break;
+ case 0x01:
+ Address = (void*)&USART_ManufacturerString;
+ Size = pgm_read_byte(&USART_ManufacturerString.Header.Size);
+ break;
+ case 0x02:
+ Address = (void*)&USART_ProductString;
+ Size = pgm_read_byte(&USART_ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
diff --git a/Projects/XPLAINBridge/USARTDescriptors.h b/Projects/XPLAINBridge/USARTDescriptors.h
index b91530102..269d3f5e0 100644
--- a/Projects/XPLAINBridge/USARTDescriptors.h
+++ b/Projects/XPLAINBridge/USARTDescriptors.h
@@ -1,82 +1,82 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 USARTDescriptors.c.
- */
-
-#ifndef _USART_DESCRIPTORS_H_
-#define _USART_DESCRIPTORS_H_
-
- /* Includes: */
- #include <avr/pgmspace.h>
-
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* Macros: */
- /** Endpoint number of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPNUM 2
-
- /** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
-
- /** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
-
- /** Size in bytes of the CDC device-to-host notification IN endpoint. */
- #define CDC_NOTIFICATION_EPSIZE 8
-
- /** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
-
- /* Type Defines: */
- /** Type define for the device configuration descriptor structure. This must be defined in the
- * application code, as the configuration descriptor contains several sub-descriptors which
- * vary between devices, and which describe the device's usage to the host.
- */
- typedef struct
- {
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t CDC_CCI_Interface;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
- CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
- CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
- USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
- USB_Descriptor_Interface_t CDC_DCI_Interface;
- USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
- USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
- } USART_USB_Descriptor_Configuration_t;
-
- /* Function Prototypes: */
- uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 USARTDescriptors.c.
+ */
+
+#ifndef _USART_DESCRIPTORS_H_
+#define _USART_DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* Macros: */
+ /** Endpoint number of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPNUM 2
+
+ /** Endpoint number of the CDC device-to-host data IN endpoint. */
+ #define CDC_TX_EPNUM 3
+
+ /** Endpoint number of the CDC host-to-device data OUT endpoint. */
+ #define CDC_RX_EPNUM 4
+
+ /** Size in bytes of the CDC device-to-host notification IN endpoint. */
+ #define CDC_NOTIFICATION_EPSIZE 8
+
+ /** Size in bytes of the CDC data IN and OUT endpoints. */
+ #define CDC_TXRX_EPSIZE 16
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t CDC_CCI_Interface;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
+ CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
+ CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
+ USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
+ USB_Descriptor_Interface_t CDC_DCI_Interface;
+ USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
+ USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
+ } USART_USB_Descriptor_Configuration_t;
+
+ /* Function Prototypes: */
+ uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
+
+#endif
diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c
index 5457a2283..5d7605206 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.c
+++ b/Projects/XPLAINBridge/XPLAINBridge.c
@@ -1,240 +1,240 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 XPLAINBridge project. This file contains the main tasks of
- * the demo and is responsible for the initial application hardware configuration.
- */
-
-#include "XPLAINBridge.h"
-
-/* Current firmware mode, making the device behave as either a programmer or a USART bridge */
-bool CurrentFirmwareMode = MODE_PDI_PROGRAMMER;
-
-/** LUFA CDC Class driver interface configuration and state information. This structure is
- * passed to all CDC Class driver functions, so that multiple instances of the same class
- * within a device can be differentiated from one another.
- */
-USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
- {
- .Config =
- {
- .ControlInterfaceNumber = 0,
-
- .DataINEndpointNumber = CDC_TX_EPNUM,
- .DataINEndpointSize = CDC_TXRX_EPSIZE,
- .DataINEndpointDoubleBank = true,
-
- .DataOUTEndpointNumber = CDC_RX_EPNUM,
- .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
- .DataOUTEndpointDoubleBank = true,
-
- .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
- .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
- .NotificationEndpointDoubleBank = false,
- },
- };
-
-/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
-RingBuff_t USBtoUART_Buffer;
-
-/** Circular buffer to hold data from the serial port before it is sent to the host. */
-RingBuff_t UARTtoUSB_Buffer;
-
-
-/** 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();
-
- Buffer_Initialize(&USBtoUART_Buffer);
- Buffer_Initialize(&UARTtoUSB_Buffer);
-
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- sei();
-
- for (;;)
- {
- if (CurrentFirmwareMode == MODE_USART_BRIDGE)
- USARTBridge_Task();
- else
- AVRISP_Task();
-
- USB_USBTask();
- }
-}
-
-void AVRISP_Task(void)
-{
- /* Must be in the configured state for the AVRISP code to process data */
- if (USB_DeviceState != DEVICE_STATE_Configured)
- return;
-
- Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
-
- /* Check to see if a V2 Protocol command has been received */
- if (Endpoint_IsOUTReceived())
- {
- LEDs_SetAllLEDs(LEDMASK_BUSY);
-
- /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
- V2Protocol_ProcessCommand();
-
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
- }
-}
-
-void USARTBridge_Task(void)
-{
- /* Must be in the configured state for the USART Bridge code to process data */
- if (USB_DeviceState != DEVICE_STATE_Configured)
- return;
-
- /* Read bytes from the USB OUT endpoint into the UART transmit buffer */
- for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
- {
- if (!(BUFF_STATICSIZE - USBtoUART_Buffer.Elements))
- break;
-
- Buffer_StoreElement(&USBtoUART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
- }
-
- /* Read bytes from the UART receive buffer into the USB IN endpoint */
- if (UARTtoUSB_Buffer.Elements)
- CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&UARTtoUSB_Buffer));
-
- /* Load bytes from the UART transmit buffer into the UART */
- if ((USBtoUART_Buffer.Elements) && SoftUART_IsReady())
- SoftUART_TxByte(Buffer_GetElement(&USBtoUART_Buffer));
-
- /* Load bytes from the UART into the UART receive buffer */
- if (SoftUART_IsReceived())
- Buffer_StoreElement(&UARTtoUSB_Buffer, SoftUART_RxByte());
-
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
-}
-
-/** Configures the board hardware and chip peripherals for the demo's functionality. */
-void SetupHardware(void)
-{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
- /* Hardware Initialization */
- SoftUART_Init();
- LEDs_Init();
- USB_Init();
- V2Protocol_Init();
-
- /* Disable JTAG debugging */
- MCUCR |= (1 << JTD);
- MCUCR |= (1 << JTD);
-
- /* Enable pullup on the JTAG TDI pin so we can use it to select the mode */
- PORTF |= (1 << 7);
- _delay_ms(10);
-
- /* Select the firmware mode based on the JTD pin's value */
- CurrentFirmwareMode = (PINF & (1 << 7)) ? MODE_USART_BRIDGE : MODE_PDI_PROGRAMMER;
-
- /* Re-enable JTAG debugging */
- MCUCR &= ~(1 << JTD);
- MCUCR &= ~(1 << JTD);
-}
-
-/** Event handler for the library USB Configuration Changed event. */
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- bool EndpointConfigSuccess = true;
-
- /* Configure the device endpoints according to the selected mode */
- if (CurrentFirmwareMode == MODE_USART_BRIDGE)
- {
- EndpointConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
- }
- else
- {
- EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,
- ENDPOINT_BANK_SINGLE);
-
- #if defined(LIBUSB_FILTERDRV_COMPAT)
- EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,
- ENDPOINT_BANK_SINGLE);
- #endif
- }
-
- if (EndpointConfigSuccess)
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
- else
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-}
-
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- if (CurrentFirmwareMode == MODE_USART_BRIDGE)
- CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
-}
-
-/** Event handler for the library USB Connection event. */
-void EVENT_USB_Device_Connect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-/** Event handler for the library USB Disconnection event. */
-void EVENT_USB_Device_Disconnect(void)
-{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
-/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
- * documentation) by the application code so that the address and size of a requested descriptor can be given
- * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
- * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
- * USB host.
- */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
-{
- /* Return the correct descriptors based on the selected mode */
- if (CurrentFirmwareMode == MODE_USART_BRIDGE)
- return USART_GetDescriptor(wValue, wIndex, DescriptorAddress);
- else
- return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress);
-}
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 XPLAINBridge project. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
+#include "XPLAINBridge.h"
+
+/* Current firmware mode, making the device behave as either a programmer or a USART bridge */
+bool CurrentFirmwareMode = MODE_PDI_PROGRAMMER;
+
+/** LUFA CDC Class driver interface configuration and state information. This structure is
+ * passed to all CDC Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
+USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
+ {
+ .Config =
+ {
+ .ControlInterfaceNumber = 0,
+
+ .DataINEndpointNumber = CDC_TX_EPNUM,
+ .DataINEndpointSize = CDC_TXRX_EPSIZE,
+ .DataINEndpointDoubleBank = true,
+
+ .DataOUTEndpointNumber = CDC_RX_EPNUM,
+ .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
+ .DataOUTEndpointDoubleBank = true,
+
+ .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
+ .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
+ .NotificationEndpointDoubleBank = false,
+ },
+ };
+
+/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
+RingBuff_t USBtoUART_Buffer;
+
+/** Circular buffer to hold data from the serial port before it is sent to the host. */
+RingBuff_t UARTtoUSB_Buffer;
+
+
+/** 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();
+
+ Buffer_Initialize(&USBtoUART_Buffer);
+ Buffer_Initialize(&UARTtoUSB_Buffer);
+
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ sei();
+
+ for (;;)
+ {
+ if (CurrentFirmwareMode == MODE_USART_BRIDGE)
+ USARTBridge_Task();
+ else
+ AVRISP_Task();
+
+ USB_USBTask();
+ }
+}
+
+void AVRISP_Task(void)
+{
+ /* Must be in the configured state for the AVRISP code to process data */
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
+
+ /* Check to see if a V2 Protocol command has been received */
+ if (Endpoint_IsOUTReceived())
+ {
+ LEDs_SetAllLEDs(LEDMASK_BUSY);
+
+ /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
+ V2Protocol_ProcessCommand();
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ }
+}
+
+void USARTBridge_Task(void)
+{
+ /* Must be in the configured state for the USART Bridge code to process data */
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
+ /* Read bytes from the USB OUT endpoint into the UART transmit buffer */
+ for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
+ {
+ if (!(BUFF_STATICSIZE - USBtoUART_Buffer.Elements))
+ break;
+
+ Buffer_StoreElement(&USBtoUART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
+ }
+
+ /* Read bytes from the UART receive buffer into the USB IN endpoint */
+ if (UARTtoUSB_Buffer.Elements)
+ CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&UARTtoUSB_Buffer));
+
+ /* Load bytes from the UART transmit buffer into the UART */
+ if ((USBtoUART_Buffer.Elements) && SoftUART_IsReady())
+ SoftUART_TxByte(Buffer_GetElement(&USBtoUART_Buffer));
+
+ /* Load bytes from the UART into the UART receive buffer */
+ if (SoftUART_IsReceived())
+ Buffer_StoreElement(&UARTtoUSB_Buffer, SoftUART_RxByte());
+
+ CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ /* Hardware Initialization */
+ SoftUART_Init();
+ LEDs_Init();
+ USB_Init();
+ V2Protocol_Init();
+
+ /* Disable JTAG debugging */
+ MCUCR |= (1 << JTD);
+ MCUCR |= (1 << JTD);
+
+ /* Enable pullup on the JTAG TDI pin so we can use it to select the mode */
+ PORTF |= (1 << 7);
+ _delay_ms(10);
+
+ /* Select the firmware mode based on the JTD pin's value */
+ CurrentFirmwareMode = (PINF & (1 << 7)) ? MODE_USART_BRIDGE : MODE_PDI_PROGRAMMER;
+
+ /* Re-enable JTAG debugging */
+ MCUCR &= ~(1 << JTD);
+ MCUCR &= ~(1 << JTD);
+}
+
+/** Event handler for the library USB Configuration Changed event. */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ bool EndpointConfigSuccess = true;
+
+ /* Configure the device endpoints according to the selected mode */
+ if (CurrentFirmwareMode == MODE_USART_BRIDGE)
+ {
+ EndpointConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
+ }
+ else
+ {
+ EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,
+ ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,
+ ENDPOINT_BANK_SINGLE);
+
+ #if defined(LIBUSB_FILTERDRV_COMPAT)
+ EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,
+ ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,
+ ENDPOINT_BANK_SINGLE);
+ #endif
+ }
+
+ if (EndpointConfigSuccess)
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ else
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the library USB Unhandled Control Request event. */
+void EVENT_USB_Device_UnhandledControlRequest(void)
+{
+ if (CurrentFirmwareMode == MODE_USART_BRIDGE)
+ CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
+}
+
+/** Event handler for the library USB Connection event. */
+void EVENT_USB_Device_Connect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+/** Event handler for the library USB Disconnection event. */
+void EVENT_USB_Device_Disconnect(void)
+{
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+{
+ /* Return the correct descriptors based on the selected mode */
+ if (CurrentFirmwareMode == MODE_USART_BRIDGE)
+ return USART_GetDescriptor(wValue, wIndex, DescriptorAddress);
+ else
+ return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress);
+}
diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h
index 877792d7f..9c90a8b3d 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.h
+++ b/Projects/XPLAINBridge/XPLAINBridge.h
@@ -1,94 +1,94 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- 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 XPLAINBridge.c.
- */
-
-#ifndef _XPLAIN_BRIDGE_H_
-#define _XPLAIN_BRIDGE_H_
-
- /* Includes: */
- #include <avr/io.h>
- #include <avr/wdt.h>
- #include <avr/power.h>
- #include <avr/interrupt.h>
-
- #include "AVRISPDescriptors.h"
- #include "USARTDescriptors.h"
-
- #include "Lib/RingBuff.h"
- #include "Lib/SoftUART.h"
- #include <Lib/V2Protocol.h>
-
- #include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
- #include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
-
- /* 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_LED1
-
- /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
- #define LEDMASK_USB_READY LEDS_NO_LEDS
-
- /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
- #define LEDMASK_USB_ERROR LEDS_LED1
-
- /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
- #define LEDMASK_BUSY LEDS_LED1
-
- /** Firmware mode define for the USART Bridge mode. */
- #define MODE_USART_BRIDGE false
-
- /** Firmware mode define for the AVRISP Programmer mode. */
- #define MODE_PDI_PROGRAMMER true
-
- /* External Variables: */
- extern bool CurrentFirmwareMode;
-
- /* Function Prototypes: */
- void SetupHardware(void);
- void AVRISP_Task(void);
- void USARTBridge_Task(void);
-
- void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
- void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
-
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
-
-#endif
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.fourwalledcubicle.com
+*/
+
+/*
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ 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 XPLAINBridge.c.
+ */
+
+#ifndef _XPLAIN_BRIDGE_H_
+#define _XPLAIN_BRIDGE_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+
+ #include "AVRISPDescriptors.h"
+ #include "USARTDescriptors.h"
+
+ #include "Lib/RingBuff.h"
+ #include "Lib/SoftUART.h"
+ #include <Lib/V2Protocol.h>
+
+ #include <LUFA/Version.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/USB/Class/CDC.h>
+
+ /* 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_LED1
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
+ #define LEDMASK_USB_READY LEDS_NO_LEDS
+
+ /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
+ #define LEDMASK_USB_ERROR LEDS_LED1
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_BUSY LEDS_LED1
+
+ /** Firmware mode define for the USART Bridge mode. */
+ #define MODE_USART_BRIDGE false
+
+ /** Firmware mode define for the AVRISP Programmer mode. */
+ #define MODE_PDI_PROGRAMMER true
+
+ /* External Variables: */
+ extern bool CurrentFirmwareMode;
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+ void AVRISP_Task(void);
+ void USARTBridge_Task(void);
+
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_Connect(void);
+ void EVENT_USB_Device_Disconnect(void);
+
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
+
+#endif
diff --git a/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt
index 40ea08e6a..0c5635ac7 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.txt
+++ b/Projects/XPLAINBridge/XPLAINBridge.txt
@@ -1,89 +1,89 @@
-/** \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 XPLAIN UART Bridge/PDI Programmer Project
- *
- * \section SSec_Compat Project Compatibility:
- *
- * The following list indicates what microcontrollers are compatible with this project.
- *
- * - AT90USB1287
- *
- * \section SSec_Info USB Information:
- *
- * The following table gives a rundown of the USB utilization of this project.
- *
- * <table>
- * <tr>
- * <td><b>USB Mode:</b></td>
- * <td>1) Device</td>
- * <td>2) Device</td>
- * </tr>
- * <tr>
- * <td><b>USB Class:</b></td>
- * <td>1) Communications Device Class (CDC)</td>
- * <td>2) Vendor Specific Class</td>
- * </tr>
- * <tr>
- * <td><b>USB Subclass:</b></td>
- * <td>1) Abstract Control Model (ACM)</td>
- * <td>2) N/A</td>
- * </tr>
- * <tr>
- * <td><b>Relevant Standards:</b></td>
- * <td>1) USBIF CDC Class Standard</td>
- * <td>2) Atmel AVRISP MKII Protocol Specification</td>
- * </tr>
- * <tr>
- * <td><b>Usable Speeds:</b></td>
- * <td>1) Full Speed Mode</td>
- * <td>2) Full Speed Mode</td>
- * </tr>
- * </table>
- *
- * \section SSec_Description Project Description:
- *
- * This project serves a dual purpose. When loaded into the USB AVR on the XPLAIN board, it will act as either a USB to Serial
- * converter for the XPLAIN's hardware USART (at a speed of 9600 baud), or an AVRStudio compaible PDI programmer for the XMEGA.
- * This project replaces the firmware preloaded onto the XPLAIN's onboard AT90USB1287 microcontroller.
- *
- * When power to the board is applied, the TDI pin (pin 9) of the USB AVR's JTAG port is read. If the pin is left high, the device
- * will enumerate as a regular COM port on the host, which can then be opened and data exchanged between the XMEGA and Host as if
- * the XMEGA was connected directly to the host's serial port. If the pin is pulled low by shorting it to GND (pin 10), the device
- * will enumerate as an AVRISP-MKII to the host, so that the XMEGA can be reprogrammed by AVRStudio or other compatible software
- * such as avrdude.
- *
- * After running this project for the first time on a new computer, you will need to supply the .INF file located in this project
- * project's directory as the device's driver when running under Windows. This will enable Windows to use its inbuilt CDC drivers,
- * negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM
- * drivers.
- *
- * This project relies on files from the LUFA AVRISP-MKII project for compilation.
- *
- * \section SSec_Options Project Options
- *
- * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
- *
- * <table>
- * <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>BUFF_STATICSIZE</td>
- * <td>RingBuff.h</td>
- * <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>
- * </tr>
- * <tr>
- * <td>LIBUSB_FILTERDRV_COMPAT</td>
- * <td>Makefile CDEFS</td>
- * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
- * the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this
- * option.
- * </tr>
- * </table>
+/** \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 XPLAIN UART Bridge/PDI Programmer Project
+ *
+ * \section SSec_Compat Project Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this project.
+ *
+ * - AT90USB1287
+ *
+ * \section SSec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this project.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>1) Device</td>
+ * <td>2) Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>1) Communications Device Class (CDC)</td>
+ * <td>2) Vendor Specific Class</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>1) Abstract Control Model (ACM)</td>
+ * <td>2) N/A</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>1) USBIF CDC Class Standard</td>
+ * <td>2) Atmel AVRISP MKII Protocol Specification</td>
+ * </tr>
+ * <tr>
+ * <td><b>Usable Speeds:</b></td>
+ * <td>1) Full Speed Mode</td>
+ * <td>2) Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section SSec_Description Project Description:
+ *
+ * This project serves a dual purpose. When loaded into the USB AVR on the XPLAIN board, it will act as either a USB to Serial
+ * converter for the XPLAIN's hardware USART (at a speed of 9600 baud), or an AVRStudio compaible PDI programmer for the XMEGA.
+ * This project replaces the firmware preloaded onto the XPLAIN's onboard AT90USB1287 microcontroller.
+ *
+ * When power to the board is applied, the TDI pin (pin 9) of the USB AVR's JTAG port is read. If the pin is left high, the device
+ * will enumerate as a regular COM port on the host, which can then be opened and data exchanged between the XMEGA and Host as if
+ * the XMEGA was connected directly to the host's serial port. If the pin is pulled low by shorting it to GND (pin 10), the device
+ * will enumerate as an AVRISP-MKII to the host, so that the XMEGA can be reprogrammed by AVRStudio or other compatible software
+ * such as avrdude.
+ *
+ * After running this project for the first time on a new computer, you will need to supply the .INF file located in this project
+ * project's directory as the device's driver when running under Windows. This will enable Windows to use its inbuilt CDC drivers,
+ * negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM
+ * drivers.
+ *
+ * This project relies on files from the LUFA AVRISP-MKII project for compilation.
+ *
+ * \section SSec_Options Project Options
+ *
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td><b>Define Name:</b></td>
+ * <td><b>Location:</b></td>
+ * <td><b>Description:</b></td>
+ * </tr>
+ * <tr>
+ * <td>BUFF_STATICSIZE</td>
+ * <td>RingBuff.h</td>
+ * <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>
+ * </tr>
+ * <tr>
+ * <td>LIBUSB_FILTERDRV_COMPAT</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
+ * the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this
+ * option.
+ * </tr>
+ * </table>
*/ \ No newline at end of file
diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile
index 9f48edd22..4931d2f38 100644
--- a/Projects/XPLAINBridge/makefile
+++ b/Projects/XPLAINBridge/makefile
@@ -1,757 +1,757 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
-# >> Modified for use with the LUFA project. <<
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-# Dean Camera
-# Opendous Inc.
-# Denver Gingerich
-#
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device, using avrdude.
-# Please customize the avrdude settings below first!
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make doxygen = Generate DoxyGen documentation for the project (must have
-# DoxyGen installed)
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-
-# MCU name
-MCU = at90usb1287
-
-
-# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
-# "Board" inside the application directory.
-BOARD = XPLAIN
-
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_CLOCK below, as it is sourced by
-# F_CLOCK after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 8000000
-
-
-# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = $(F_CPU)
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-
-# Target file name (without extension).
-TARGET = XPLAINBridge
-
-
-# Object files directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-OBJDIR = .
-
-
-# Path to the LUFA library
-LUFA_PATH = ../../
-
-# Path to the LUFA AVRISP-MKII project
-AVRISP_PATH = ../AVRISP-MKII/
-
-# LUFA library compile-time options
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC = $(TARGET).c \
- AVRISPDescriptors.c \
- USARTDescriptors.c \
- Lib/RingBuff.c \
- Lib/SoftUART.c \
- $(AVRISP_PATH)/Lib/V2Protocol.c \
- $(AVRISP_PATH)/Lib/V2ProtocolParams.c \
- $(AVRISP_PATH)/Lib/ISP/ISPProtocol.c \
- $(AVRISP_PATH)/Lib/ISP/ISPTarget.c \
- $(AVRISP_PATH)/Lib/XPROG/XPROGProtocol.c \
- $(AVRISP_PATH)/Lib/XPROG/XPROGTarget.c \
- $(AVRISP_PATH)/Lib/XPROG/XMEGANVM.c \
- $(AVRISP_PATH)/Lib/XPROG/TINYNVM.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
- $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
-
-
-# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
-
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
-# AVR Studio 4.10 requires dwarf-2.
-# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG = dwarf-2
-
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(LUFA_PATH)/ $(AVRISP_PATH)/
-
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
-CDEFS += -DAUX_LINE_PORT=PORTB
-CDEFS += -DAUX_LINE_PIN=PINB
-CDEFS += -DAUX_LINE_DDR=DDRB
-CDEFS += -DAUX_LINE_MASK="(1 << 4)"
-CDEFS += -DVTARGET_ADC_CHANNEL=2
-#CDEFS += -DLIBUSB_FILTERDRV_COMPAT
-
-
-# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU)
-
-
-# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL
-#CPPDEFS += -D__STDC_LIMIT_MACROS
-#CPPDEFS += -D__STDC_CONSTANT_MACROS
-
-
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-CFLAGS += -funsigned-char
-CFLAGS += -funsigned-bitfields
-CFLAGS += -ffunction-sections
-CFLAGS += -fno-inline-small-functions
-CFLAGS += -fpack-struct
-CFLAGS += -fshort-enums
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-CFLAGS += -Wundef
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-CFLAGS += $(CSTANDARD)
-
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-CPPFLAGS = -g$(DEBUG)
-CPPFLAGS += $(CPPDEFS)
-CPPFLAGS += -O$(OPT)
-CPPFLAGS += -funsigned-char
-CPPFLAGS += -funsigned-bitfields
-CPPFLAGS += -fpack-struct
-CPPFLAGS += -fshort-enums
-CPPFLAGS += -fno-exceptions
-CPPFLAGS += -Wall
-CFLAGS += -Wundef
-#CPPFLAGS += -mshort-calls
-#CPPFLAGS += -fno-unit-at-a-time
-#CPPFLAGS += -Wstrict-prototypes
-#CPPFLAGS += -Wunreachable-code
-#CPPFLAGS += -Wsign-compare
-CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-#CPPFLAGS += $(CSTANDARD)
-
-
-#---------------- Assembler Options ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
-
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-
-
-# List any extra directories to look for libraries here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
-
-
-
-#---------------- External Memory Options ----------------
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# used for variables (.data/.bss) and heap (malloc()).
-#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
-# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-# only used for heap (malloc()).
-#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
-
-EXTMEMOPTS =
-
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
-LDFLAGS += -Wl,--gc-sections
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-
-
-
-#---------------- Programming Options (avrdude) ----------------
-
-# Programming hardware: alf avr910 avrisp bascom bsd
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
-#
-# Type: avrdude -c ?
-# to get a full listing.
-#
-AVRDUDE_PROGRAMMER = jtagmkII
-
-# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = usb
-
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
-
-
-# Uncomment the following if you want avrdude's erase cycle counter.
-# Note that this counter needs to be initialized first using -Yn,
-# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
-
-# Uncomment the following if you do /not/ wish a verification to be
-# performed after programming the device.
-#AVRDUDE_NO_VERIFY = -V
-
-# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
-# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
-
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
-AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
-
-
-
-#---------------- Debugging Options ----------------
-
-# For simulavr only - target MCU frequency.
-DEBUG_MFREQ = $(F_CPU)
-
-# Set the DEBUG_UI to either gdb or insight.
-# DEBUG_UI = gdb
-DEBUG_UI = insight
-
-# Set the debugging back-end to either avarice, simulavr.
-DEBUG_BACKEND = avarice
-#DEBUG_BACKEND = simulavr
-
-# GDB Init Filename.
-GDBINIT_FILE = __avr_gdbinit
-
-# When using avarice settings for the JTAG
-JTAG_DEV = /dev/com1
-
-# Debugging port used to communicate between GDB / avarice / simulavr.
-DEBUG_PORT = 4242
-
-# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
-# avarice is running on a different computer.
-DEBUG_HOST = localhost
-
-
-
-#============================================================================
-
-
-# Define programs and commands.
-SHELL = sh
-CC = avr-gcc
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-SIZE = avr-size
-AR = avr-ar rcs
-NM = avr-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-REMOVEDIR = rm -rf
-COPY = cp
-WINSHELL = cmd
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_CPP = Compiling C++:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-
-
-
-
-# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
-
-# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
-
-
-# Compiler flags to generate dependency files.
-GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-
-
-
-# Default target.
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
-
-# Change the build target to build a HEX file or a library.
-build: elf hex eep lss sym
-#build: lib
-
-
-elf: $(TARGET).elf
-hex: $(TARGET).hex
-eep: $(TARGET).eep
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-
-
-# Eye candy.
-# AVR Studio 3.x does not check make's exit code but relies on
-# the following magic strings to be generated by the compile job.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
-MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-
-sizebefore:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-sizeafter:
- @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
- 2>/dev/null; echo; fi
-
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:
- @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
-
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
- @echo
- @echo Checking for invalid events...
- @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
- grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
- @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
- @if test -s InvalidEvents.tmp; then exit 1; fi
-
-showliboptions:
- @echo
- @echo ---- Compile Time Library Options ----
- @for i in $(LUFA_OPTS:-D%=%); do \
- echo $$i; \
- done
- @echo --------------------------------------
-
-showtarget:
- @echo
- @echo --------- Target Information ---------
- @echo AVR Model: $(MCU)
- @echo Board: $(BOARD)
- @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
- @echo --------------------------------------
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-
-# Program the device.
-program: $(TARGET).hex $(TARGET).eep
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
-
-flip: $(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
- dfu-programmer $(MCU) erase
- dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
- dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
- $(COPY) $(TARGET).eep $(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
- $(REMOVE) $(TARGET)eep.hex
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
- dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
- dfu-programmer $(MCU) reset
-
-
-# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
-# a breakpoint at main().
-gdb-config:
- @$(REMOVE) $(GDBINIT_FILE)
- @echo define reset >> $(GDBINIT_FILE)
- @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
- @echo end >> $(GDBINIT_FILE)
- @echo file $(TARGET).elf >> $(GDBINIT_FILE)
- @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
-ifeq ($(DEBUG_BACKEND),simulavr)
- @echo load >> $(GDBINIT_FILE)
-endif
- @echo break main >> $(GDBINIT_FILE)
-
-debug: gdb-config $(TARGET).elf
-ifeq ($(DEBUG_BACKEND), avarice)
- @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
- @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
- $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
- @$(WINSHELL) /c pause
-
-else
- @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
- $(DEBUG_MFREQ) --port $(DEBUG_PORT)
-endif
- @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
-
-
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT = $(OBJCOPY) --debugging
-COFFCONVERT += --change-section-address .data-0x800000
-COFFCONVERT += --change-section-address .bss-0x800000
-COFFCONVERT += --change-section-address .noinit-0x800000
-COFFCONVERT += --change-section-address .eeprom-0x810000
-
-
-
-coff: $(TARGET).elf
- @echo
- @echo $(MSG_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- @echo
- @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
- $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
-
-
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-%.eep: %.elf
- @echo
- @echo $(MSG_EEPROM) $@
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -z -S $< > $@
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-
-# Create library from object files.
-.SECONDARY : $(TARGET).a
-.PRECIOUS : $(OBJ)
-%.a: $(OBJ)
- @echo
- @echo $(MSG_CREATING_LIBRARY) $@
- $(AR) $@ $(OBJ)
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(OBJ)
-%.elf: $(OBJ)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
-
-
-# Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp
- @echo
- @echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files.
-%.s : %.c
- $(CC) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C++ source files.
-%.s : %.cpp
- $(CC) -S $(ALL_CPPFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list clean_binary end
-
-clean_binary:
- $(REMOVE) $(TARGET).hex
-
-clean_list:
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).eep
- $(REMOVE) $(TARGET)eep.hex
- $(REMOVE) $(TARGET).cof
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
- $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRC:.c=.i)
- $(REMOVE) InvalidEvents.tmp
- $(REMOVEDIR) .dep
-
-doxygen:
- @echo Generating Project Documentation...
- @doxygen Doxygen.conf
- @echo Documentation Generation Complete.
-
-clean_doxygen:
- rm -rf Documentation
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all checkinvalidevents showliboptions \
-showtarget begin finish end sizebefore sizeafter \
-gccversion build elf hex eep lss sym coff extcoff \
-program dfu flip flip-ee dfu-ee clean debug \
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+# >> Modified for use with the LUFA project. <<
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+# Dean Camera
+# Opendous Inc.
+# Denver Gingerich
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+# Please customize the avrdude settings below first!
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make doxygen = Generate DoxyGen documentation for the project (must have
+# DoxyGen installed)
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+
+# MCU name
+MCU = at90usb1287
+
+
+# Target board (see library "Board Types" documentation, NONE for projects not requiring
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# "Board" inside the application directory.
+BOARD = XPLAIN
+
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_CLOCK below, as it is sourced by
+# F_CLOCK after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 8000000
+
+
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = $(F_CPU)
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# Target file name (without extension).
+TARGET = XPLAINBridge
+
+
+# Object files directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+OBJDIR = .
+
+
+# Path to the LUFA library
+LUFA_PATH = ../../
+
+# Path to the LUFA AVRISP-MKII project
+AVRISP_PATH = ../AVRISP-MKII/
+
+# LUFA library compile-time options
+LUFA_OPTS = -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(TARGET).c \
+ AVRISPDescriptors.c \
+ USARTDescriptors.c \
+ Lib/RingBuff.c \
+ Lib/SoftUART.c \
+ $(AVRISP_PATH)/Lib/V2Protocol.c \
+ $(AVRISP_PATH)/Lib/V2ProtocolParams.c \
+ $(AVRISP_PATH)/Lib/ISP/ISPProtocol.c \
+ $(AVRISP_PATH)/Lib/ISP/ISPTarget.c \
+ $(AVRISP_PATH)/Lib/XPROG/XPROGProtocol.c \
+ $(AVRISP_PATH)/Lib/XPROG/XPROGTarget.c \
+ $(AVRISP_PATH)/Lib/XPROG/XMEGANVM.c \
+ $(AVRISP_PATH)/Lib/XPROG/TINYNVM.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
+ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
+
+
+# List C++ source files here. (C dependencies are automatically generated.)
+CPPSRC =
+
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+# AVR Studio 4.10 requires dwarf-2.
+# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = dwarf-2
+
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = $(LUFA_PATH)/ $(AVRISP_PATH)/
+
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
+CDEFS += -DAUX_LINE_PORT=PORTB
+CDEFS += -DAUX_LINE_PIN=PINB
+CDEFS += -DAUX_LINE_DDR=DDRB
+CDEFS += -DAUX_LINE_MASK="(1 << 4)"
+CDEFS += -DVTARGET_ADC_CHANNEL=2
+#CDEFS += -DLIBUSB_FILTERDRV_COMPAT
+
+
+# Place -D or -U options here for ASM sources
+ADEFS = -DF_CPU=$(F_CPU)
+
+
+# Place -D or -U options here for C++ sources
+CPPDEFS = -DF_CPU=$(F_CPU)UL
+#CPPDEFS += -D__STDC_LIMIT_MACROS
+#CPPDEFS += -D__STDC_CONSTANT_MACROS
+
+
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -ffunction-sections
+CFLAGS += -fno-inline-small-functions
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+CPPFLAGS = -g$(DEBUG)
+CPPFLAGS += $(CPPDEFS)
+CPPFLAGS += -O$(OPT)
+CPPFLAGS += -funsigned-char
+CPPFLAGS += -funsigned-bitfields
+CPPFLAGS += -fpack-struct
+CPPFLAGS += -fshort-enums
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -Wall
+CFLAGS += -Wundef
+#CPPFLAGS += -mshort-calls
+#CPPFLAGS += -fno-unit-at-a-time
+#CPPFLAGS += -Wstrict-prototypes
+#CPPFLAGS += -Wunreachable-code
+#CPPFLAGS += -Wsign-compare
+CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
+CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+#CPPFLAGS += $(CSTANDARD)
+
+
+#---------------- Assembler Options ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+
+
+# List any extra directories to look for libraries here.
+# Each directory must be seperated by a space.
+# Use forward slashes for directory separators.
+# For a directory that has spaces, enclose it in quotes.
+EXTRALIBDIRS =
+
+
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = jtagmkII
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+# just set to localhost unless doing some sort of crazy debugging when
+# avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_CPP = Compiling C++:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+
+
+
+
+# Define all object files.
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+
+# Define all listing files.
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
+
+# Change the build target to build a HEX file or a library.
+build: elf hex eep lss sym
+#build: lib
+
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
+MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+
+sizebefore:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+sizeafter:
+ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+ 2>/dev/null; echo; fi
+
+$(LUFA_PATH)/LUFA/LUFA_Events.lst:
+ @$(MAKE) -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
+
+checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
+ @echo
+ @echo Checking for invalid events...
+ @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
+ grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
+ @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
+ @if test -s InvalidEvents.tmp; then exit 1; fi
+
+showliboptions:
+ @echo
+ @echo ---- Compile Time Library Options ----
+ @for i in $(LUFA_OPTS:-D%=%); do \
+ echo $$i; \
+ done
+ @echo --------------------------------------
+
+showtarget:
+ @echo
+ @echo --------- Target Information ---------
+ @echo AVR Model: $(MCU)
+ @echo Board: $(BOARD)
+ @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+ @echo --------------------------------------
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+ $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+flip: $(TARGET).hex
+ batchisp -hardware usb -device $(MCU) -operation erase f
+ batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+dfu: $(TARGET).hex
+ dfu-programmer $(MCU) erase
+ dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
+ dfu-programmer $(MCU) reset
+
+flip-ee: $(TARGET).hex $(TARGET).eep
+ $(COPY) $(TARGET).eep $(TARGET)eep.hex
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
+ batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
+ batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(REMOVE) $(TARGET)eep.hex
+
+dfu-ee: $(TARGET).hex $(TARGET).eep
+ dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
+ dfu-programmer $(MCU) reset
+
+
+# Generate avr-gdb config/init file which does the following:
+# define the reset signal, load the target file, connect to target, and set
+# a breakpoint at main().
+gdb-config:
+ @$(REMOVE) $(GDBINIT_FILE)
+ @echo define reset >> $(GDBINIT_FILE)
+ @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+ @echo end >> $(GDBINIT_FILE)
+ @echo file $(TARGET).elf >> $(GDBINIT_FILE)
+ @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+ @echo load >> $(GDBINIT_FILE)
+endif
+ @echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+ @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+ @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+ $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+ @$(WINSHELL) /c pause
+
+else
+ @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+ $(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+ @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT = $(OBJCOPY) --debugging
+COFFCONVERT += --change-section-address .data-0x800000
+COFFCONVERT += --change-section-address .bss-0x800000
+COFFCONVERT += --change-section-address .noinit-0x800000
+COFFCONVERT += --change-section-address .eeprom-0x810000
+
+
+
+coff: $(TARGET).elf
+ @echo
+ @echo $(MSG_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+ @echo
+ @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+ @echo
+ @echo $(MSG_EEPROM) $@
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+ --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -z -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+
+# Create library from object files.
+.SECONDARY : $(TARGET).a
+.PRECIOUS : $(OBJ)
+%.a: $(OBJ)
+ @echo
+ @echo $(MSG_CREATING_LIBRARY) $@
+ $(AR) $@ $(OBJ)
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+$(OBJDIR)/%.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create object files from C++ source files.
+$(OBJDIR)/%.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILING_CPP) $<
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+ $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C++ source files.
+%.s : %.cpp
+ $(CC) -S $(ALL_CPPFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+$(OBJDIR)/%.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list clean_binary end
+
+clean_binary:
+ $(REMOVE) $(TARGET).hex
+
+clean_list:
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).eep
+ $(REMOVE) $(TARGET)eep.hex
+ $(REMOVE) $(TARGET).cof
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
+ $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRC:.c=.i)
+ $(REMOVE) InvalidEvents.tmp
+ $(REMOVEDIR) .dep
+
+doxygen:
+ @echo Generating Project Documentation...
+ @doxygen Doxygen.conf
+ @echo Documentation Generation Complete.
+
+clean_doxygen:
+ rm -rf Documentation
+
+# Create object files directory
+$(shell mkdir $(OBJDIR) 2>/dev/null)
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all checkinvalidevents showliboptions \
+showtarget begin finish end sizebefore sizeafter \
+gccversion build elf hex eep lss sym coff extcoff \
+program dfu flip flip-ee dfu-ee clean debug \
clean_list clean_binary gdb-config doxygen \ No newline at end of file