aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-10-13 14:05:35 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-10-13 14:05:35 +0000
commit5a4def747897c1c6ffbe465506d846c7c686d3e9 (patch)
treee5a9ca31ab554e993f1a9041e44976cf7b253921 /Projects
parenta8871c7fba73307226bd13e2cad4c840c850e6f1 (diff)
downloadlufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.tar.gz
lufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.tar.bz2
lufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.zip
Clean up excessive whitespace at the end of each line using the wspurify tool made by Laszlo Monda
Diffstat (limited to 'Projects')
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.c24
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.h23
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.txt21
-rw-r--r--Projects/AVRISP-MKII/Descriptors.c77
-rw-r--r--Projects/AVRISP-MKII/Descriptors.h15
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c132
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h19
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c31
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h19
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.c41
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.h24
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h13
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolParams.c29
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolParams.h20
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c31
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h23
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c63
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h27
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c105
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h33
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c21
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h37
-rw-r--r--Projects/AVRISP-MKII/makefile49
-rw-r--r--Projects/Benito/Benito.c49
-rw-r--r--Projects/Benito/Benito.h21
-rw-r--r--Projects/Benito/Benito.txt7
-rw-r--r--Projects/Benito/Descriptors.c103
-rw-r--r--Projects/Benito/Descriptors.h19
-rw-r--r--Projects/Benito/Lib/LightweightRingBuff.h39
-rw-r--r--Projects/Benito/makefile49
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.c69
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.h25
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskDevice.c17
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskDevice.h15
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.c35
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.h17
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c81
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h21
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c2
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c25
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h15
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c63
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h25
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c21
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h23
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/makefile49
-rw-r--r--Projects/LEDNotifier/Descriptors.c85
-rw-r--r--Projects/LEDNotifier/Descriptors.h15
-rw-r--r--Projects/LEDNotifier/LEDNotifier.c29
-rw-r--r--Projects/LEDNotifier/LEDNotifier.h17
-rw-r--r--Projects/LEDNotifier/LEDNotifier.txt7
-rw-r--r--Projects/LEDNotifier/makefile49
-rw-r--r--Projects/Magstripe/Descriptors.c69
-rw-r--r--Projects/Magstripe/Descriptors.h17
-rw-r--r--Projects/Magstripe/Lib/CircularBitBuffer.c35
-rw-r--r--Projects/Magstripe/Lib/CircularBitBuffer.h31
-rw-r--r--Projects/Magstripe/Lib/MagstripeHW.h11
-rw-r--r--Projects/Magstripe/Magstripe.c29
-rw-r--r--Projects/Magstripe/Magstripe.h25
-rw-r--r--Projects/Magstripe/Magstripe.txt13
-rw-r--r--Projects/Magstripe/makefile49
-rw-r--r--Projects/MissileLauncher/ConfigDescriptor.c31
-rw-r--r--Projects/MissileLauncher/ConfigDescriptor.h21
-rw-r--r--Projects/MissileLauncher/MissileLauncher.c39
-rw-r--r--Projects/MissileLauncher/MissileLauncher.h23
-rw-r--r--Projects/MissileLauncher/MissileLauncher.txt7
-rw-r--r--Projects/MissileLauncher/makefile49
-rw-r--r--Projects/RelayBoard/Descriptors.c1
-rw-r--r--Projects/RelayBoard/Descriptors.h1
-rw-r--r--Projects/RelayBoard/RelayBoard.c7
-rw-r--r--Projects/RelayBoard/RelayBoard.h1
-rw-r--r--Projects/RelayBoard/RelayBoard.txt2
-rw-r--r--Projects/RelayBoard/makefile49
-rw-r--r--Projects/TempDataLogger/Descriptors.c95
-rw-r--r--Projects/TempDataLogger/Descriptors.h19
-rw-r--r--Projects/TempDataLogger/Lib/DS1307.c23
-rw-r--r--Projects/TempDataLogger/Lib/DS1307.h23
-rw-r--r--Projects/TempDataLogger/Lib/DataflashManager.c81
-rw-r--r--Projects/TempDataLogger/Lib/DataflashManager.h23
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/00readme.txt1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/diskio.c1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/diskio.h1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/ff.c5
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/ff.h1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/ffconf.h1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/integer.h1
-rw-r--r--Projects/TempDataLogger/Lib/SCSI.c63
-rw-r--r--Projects/TempDataLogger/Lib/SCSI.h25
-rw-r--r--Projects/TempDataLogger/TempDataLogger.c41
-rw-r--r--Projects/TempDataLogger/TempDataLogger.h25
-rw-r--r--Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt5
-rw-r--r--Projects/TempDataLogger/TempLogHostApp/COPYING.txt1
-rw-r--r--Projects/TempDataLogger/TempLogHostApp/README.txt1
-rw-r--r--Projects/TempDataLogger/TemperatureDataLogger.txt7
-rw-r--r--Projects/TempDataLogger/makefile49
-rw-r--r--Projects/USBtoSerial/Descriptors.c103
-rw-r--r--Projects/USBtoSerial/Descriptors.h21
-rw-r--r--Projects/USBtoSerial/Lib/LightweightRingBuff.h39
-rw-r--r--Projects/USBtoSerial/USBtoSerial.c31
-rw-r--r--Projects/USBtoSerial/USBtoSerial.h17
-rw-r--r--Projects/USBtoSerial/USBtoSerial.txt9
-rw-r--r--Projects/USBtoSerial/makefile51
-rw-r--r--Projects/Webserver/Descriptors.c71
-rw-r--r--Projects/Webserver/Descriptors.h25
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.c63
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.h37
-rw-r--r--Projects/Webserver/Lib/DataflashManager.c81
-rw-r--r--Projects/Webserver/Lib/DataflashManager.h23
-rw-r--r--Projects/Webserver/Lib/FATFs/00readme.txt1
-rw-r--r--Projects/Webserver/Lib/FATFs/diskio.c1
-rw-r--r--Projects/Webserver/Lib/FATFs/diskio.h1
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.c5
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.h1
-rw-r--r--Projects/Webserver/Lib/FATFs/ffconf.h1
-rw-r--r--Projects/Webserver/Lib/FATFs/integer.h1
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.c61
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.h25
-rw-r--r--Projects/Webserver/Lib/SCSI.c63
-rw-r--r--Projects/Webserver/Lib/SCSI.h25
-rw-r--r--Projects/Webserver/Lib/TELNETServerApp.c31
-rw-r--r--Projects/Webserver/Lib/TELNETServerApp.h25
-rw-r--r--Projects/Webserver/Lib/uIPManagement.c31
-rw-r--r--Projects/Webserver/Lib/uIPManagement.h29
-rw-r--r--Projects/Webserver/Lib/uip/clock.c1
-rw-r--r--Projects/Webserver/Lib/uip/clock.h1
-rw-r--r--Projects/Webserver/Lib/uip/timer.c1
-rw-r--r--Projects/Webserver/Lib/uip/timer.h1
-rw-r--r--Projects/Webserver/Lib/uip/uip-split.c13
-rw-r--r--Projects/Webserver/Lib/uip/uip-split.h51
-rw-r--r--Projects/Webserver/Lib/uip/uip.c153
-rw-r--r--Projects/Webserver/Lib/uip/uip.h29
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.c27
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.h5
-rw-r--r--Projects/Webserver/Lib/uip/uipopt.h23
-rw-r--r--Projects/Webserver/USBDeviceMode.c19
-rw-r--r--Projects/Webserver/USBDeviceMode.h17
-rw-r--r--Projects/Webserver/USBHostMode.c35
-rw-r--r--Projects/Webserver/USBHostMode.h21
-rw-r--r--Projects/Webserver/Webserver.c15
-rw-r--r--Projects/Webserver/Webserver.h21
-rw-r--r--Projects/Webserver/Webserver.txt7
-rw-r--r--Projects/Webserver/makefile53
-rw-r--r--Projects/XPLAINBridge/AVRISPDescriptors.c77
-rw-r--r--Projects/XPLAINBridge/AVRISPDescriptors.h19
-rw-r--r--Projects/XPLAINBridge/Lib/LightweightRingBuff.h39
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.c17
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.h20
-rw-r--r--Projects/XPLAINBridge/USARTDescriptors.c103
-rw-r--r--Projects/XPLAINBridge/USARTDescriptors.h21
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.c23
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.h19
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.txt7
-rw-r--r--Projects/XPLAINBridge/makefile49
-rw-r--r--Projects/makefile7
158 files changed, 2396 insertions, 2245 deletions
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.c b/Projects/AVRISP-MKII/AVRISP-MKII.c
index 8f27a9b22..b7e551e99 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.c
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,7 +43,7 @@ int main(void)
{
SetupHardware();
V2Protocol_Init();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -54,7 +54,7 @@ int main(void)
mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
LEDs_ChangeLEDs(LEDMASK_VBUSPOWER, (PIND & (1 << 0)) ? 0 : LEDMASK_VBUSPOWER);
#endif
-
+
AVRISP_Task();
USB_USBTask();
}
@@ -72,7 +72,7 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
- USB_Init();
+ USB_Init();
}
/** Event handler for the library USB Connection event. */
@@ -100,9 +100,9 @@ void EVENT_USB_Device_ConfigurationChanged(void)
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
-
+
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Processes incoming V2 Protocol commands from the host, returning a response when required. */
@@ -115,7 +115,7 @@ void AVRISP_Task(void)
V2Params_UpdateParamValues();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
-
+
/* Check to see if a V2 Protocol command has been received */
if (Endpoint_IsOUTReceived())
{
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.h b/Projects/AVRISP-MKII/AVRISP-MKII.h
index 3491abf0c..6e7f12edb 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.h
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,11 +45,11 @@
#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 "Descriptors.h"
#include "Lib/V2Protocol.h"
@@ -68,16 +68,17 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)
-
+
/** LED mask for the library LED driver, to indicate that the target is being powered by VBUS. */
#define LEDMASK_VBUSPOWER LEDS_LED3
/* Function Prototypes: */
void SetupHardware(void);
void AVRISP_Task(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-MKII.txt b/Projects/AVRISP-MKII/AVRISP-MKII.txt
index eb6431477..e36ffe231 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.txt
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.txt
@@ -3,7 +3,7 @@
* 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:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Vendor Specific Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -42,7 +42,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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
@@ -240,31 +240,31 @@
* <td>VTARGET_ADC_CHANNEL</td>
* <td>Makefile LUFA_OPTS</td>
* <td>ADC channel number (on supported AVRs) to use for VTARGET level detection, if NO_VTARGET_DETECT is not defined.
- * <i>Ignored when compiled for targets lacking an ADC.</i></td>
+ * <i>Ignored when compiled for targets lacking an ADC.</i></td>
* </tr>
* <tr>
* <td>ENABLE_ISP_PROTOCOL</td>
* <td>Makefile LUFA_OPTS</td>
- * <td>Define to enable SPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></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 LUFA_OPTS</td>
- * <td>Define to enable PDI and TPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></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 LUFA_OPTS</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. <i>Ignored when compiled for
- * targets lacking an ADC.</i></td>
+ * targets lacking an ADC.</i></td>
* </tr>
* <tr>
* <td>VTARGET_REF_VOLTS</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Indicates the programmer AVR's AVCC reference voltage when measuring the target's supply voltage. Note that the supply
* voltage should never exceed the reference voltage on the programmer AVR without some form of protection to prevent damage
- * to the ADC. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
+ * to the ADC. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
* </tr>
* <tr>
* <td>VTARGET_SCALE_FACTOR</td>
@@ -272,8 +272,8 @@
* <td>Indicates the target's supply voltage scale factor when applied to the ADC. A simple resistive divider can be used on the
* ADC pin for measuring the target's supply voltage, so that voltages above the programmer AVR's AVCC reference voltage can be
* measured. This should be the reciprocal of the division performed - e.g. if the VTARGET voltage is halved, this should be set
- * to 2. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
- * </tr>
+ * to 2. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
+ * </tr>
* <tr>
* <td>LIBUSB_DRIVER_COMPAT</td>
* <td>Makefile LUFA_OPTS</td>
@@ -282,3 +282,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/AVRISP-MKII/Descriptors.c b/Projects/AVRISP-MKII/Descriptors.c
index 5559bc11e..01a93cb64 100644
--- a/Projects/AVRISP-MKII/Descriptors.c
+++ b/Projects/AVRISP-MKII/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -45,22 +45,22 @@
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
};
@@ -71,41 +71,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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)
},
- .AVRISP_Interface =
+ .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 =
+ .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,
@@ -115,7 +115,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.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,
@@ -130,7 +130,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -141,7 +141,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -152,7 +152,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA AVRISP MkII Clone"
};
@@ -162,7 +162,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
USB_Descriptor_String_t PROGMEM SerialString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
+
.UnicodeString = L"0000A00128255"
};
@@ -181,41 +181,42 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
-
+
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
case 0x03:
Address = &SerialString;
Size = pgm_read_byte(&SerialString.Header.Size);
- break;
+ break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/AVRISP-MKII/Descriptors.h b/Projects/AVRISP-MKII/Descriptors.h
index 6c0e0d163..b707e7f26 100644
--- a/Projects/AVRISP-MKII/Descriptors.h
+++ b/Projects/AVRISP-MKII/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -79,3 +79,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
index aff84a962..8821ac991 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -53,7 +53,7 @@ void ISPProtocol_EnterISPMode(void)
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();
@@ -61,9 +61,9 @@ void ISPProtocol_EnterISPMode(void)
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ResponseStatus = STATUS_CMD_FAILED;
-
+
CurrentAddress = 0;
-
+
/* Set up the synchronous USART to generate the .5MHz recovery clock on XCK pin */
UBRR1 = (F_CPU / 500000UL);
UCSR1B = (1 << TXEN1);
@@ -71,7 +71,7 @@ void ISPProtocol_EnterISPMode(void)
DDRD |= (1 << 5);
/* Perform execution delay, initialize SPI bus */
- ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
+ ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
ISPTarget_Init();
/* Continuously attempt to synchronize with the target until either the number of attempts specified
@@ -88,7 +88,7 @@ void ISPProtocol_EnterISPMode(void)
ISPProtocol_DelayMS(Enter_ISP_Params.ByteDelay);
ResponseBytes[RByte] = ISPTarget_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))
{
@@ -116,7 +116,7 @@ void ISPProtocol_LeaveISPMode(void)
} 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);
@@ -155,13 +155,13 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
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();
@@ -173,14 +173,14 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
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;
+ 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;
@@ -190,7 +190,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_WRITES_MASK)
{
uint16_t StartAddress = (CurrentAddress & 0xFFFF);
-
+
/* Check to see if we need to send a LOAD EXTENDED ADDRESS command to the target */
if (MustLoadExtendedAddress)
{
@@ -203,12 +203,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
{
bool IsOddByte = (CurrentByte & 0x01);
uint8_t ByteToWrite = *(NextWriteByte++);
-
+
ISPTarget_SendByte(Write_Memory_Params.ProgrammingCommands[0]);
ISPTarget_SendByte(CurrentAddress >> 8);
ISPTarget_SendByte(CurrentAddress & 0xFF);
ISPTarget_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)
@@ -220,14 +220,14 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
- PollAddress = (CurrentAddress & 0xFFFF);
- }
+ PollAddress = (CurrentAddress & 0xFFFF);
+ }
/* EEPROM increments the address on each byte, flash needs to increment on each word */
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)
{
@@ -235,12 +235,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
ISPTarget_SendByte(StartAddress >> 8);
ISPTarget_SendByte(StartAddress & 0xFF);
ISPTarget_SendByte(0x00);
-
+
/* Check if polling is possible and enabled, 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_VALUE_MASK;
- Write_Memory_Params.ProgrammingMode |= PROG_MODE_PAGED_TIMEDELAY_MASK;
+ Write_Memory_Params.ProgrammingMode |= PROG_MODE_PAGED_TIMEDELAY_MASK;
}
ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
@@ -248,7 +248,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
/* Check to see if the FLASH address has crossed the extended address boundary */
if ((V2Command == CMD_PROGRAM_FLASH_ISP) && !(CurrentAddress & 0xFFFF))
- MustLoadExtendedAddress = true;
+ MustLoadExtendedAddress = true;
}
}
else
@@ -258,7 +258,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
{
bool IsOddByte = (CurrentByte & 0x01);
uint8_t ByteToWrite = *(NextWriteByte++);
-
+
/* Check to see if we need to send a LOAD EXTENDED ADDRESS command to the target */
if (MustLoadExtendedAddress)
{
@@ -270,12 +270,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
ISPTarget_SendByte(CurrentAddress >> 8);
ISPTarget_SendByte(CurrentAddress & 0xFF);
ISPTarget_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;
-
+
/* Save previous programming mode in case we modify it for the current word */
uint8_t PreviousProgrammingMode = Write_Memory_Params.ProgrammingMode;
@@ -283,18 +283,18 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
{
if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
-
+
PollAddress = (CurrentAddress & 0xFFFF);
}
else if (!(Write_Memory_Params.ProgrammingMode & PROG_MODE_WORD_READYBUSY_MASK))
{
Write_Memory_Params.ProgrammingMode &= ~PROG_MODE_WORD_VALUE_MASK;
- Write_Memory_Params.ProgrammingMode |= PROG_MODE_WORD_TIMEDELAY_MASK;
+ Write_Memory_Params.ProgrammingMode |= PROG_MODE_WORD_TIMEDELAY_MASK;
}
-
+
ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
-
+
/* Restore previous programming mode mask in case the current word needed to change it */
Write_Memory_Params.ProgrammingMode = PreviousProgrammingMode;
@@ -308,9 +308,9 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if ((CurrentByte & 0x01) || (V2Command == CMD_PROGRAM_EEPROM_ISP))
{
CurrentAddress++;
-
+
if ((V2Command != CMD_PROGRAM_EEPROM_ISP) && !(CurrentAddress & 0xFFFF))
- MustLoadExtendedAddress = true;
+ MustLoadExtendedAddress = true;
}
}
}
@@ -332,14 +332,14 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
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);
@@ -358,28 +358,28 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
ISPTarget_SendByte(CurrentAddress >> 8);
ISPTarget_SendByte(CurrentAddress & 0xFF);
Endpoint_Write_Byte(ISPTarget_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;
-
+
/* EEPROM just increments the address each byte, flash needs to increment on each word and
* also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
* address boundary has been crossed */
if ((CurrentByte & 0x01) || (V2Command == CMD_READ_EEPROM_ISP))
{
CurrentAddress++;
-
+
if ((V2Command != CMD_READ_EEPROM_ISP) && !(CurrentAddress & 0xFFFF))
- MustLoadExtendedAddress = true;
+ MustLoadExtendedAddress = true;
}
}
@@ -387,13 +387,13 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
Endpoint_ClearIN();
-
+
/* Ensure last packet is a short packet to terminate the transfer */
if (IsEndpointFull)
{
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
}
}
@@ -406,15 +406,15 @@ void ISPProtocol_ChipErase(void)
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++)
ISPTarget_SendByte(Erase_Chip_Params.EraseCommandBytes[SByte]);
@@ -424,7 +424,7 @@ void ISPProtocol_ChipErase(void)
ISPProtocol_DelayMS(Erase_Chip_Params.EraseDelayMS);
else
ResponseStatus = ISPTarget_WaitWhileTargetBusy();
-
+
Endpoint_Write_Byte(CMD_CHIP_ERASE_ISP);
Endpoint_Write_Byte(ResponseStatus);
Endpoint_ClearIN();
@@ -442,7 +442,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
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();
@@ -454,7 +454,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
/* 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] = ISPTarget_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]);
@@ -473,7 +473,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
{
uint8_t WriteCommandBytes[4];
} Write_FuseLockSig_Params;
-
+
Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
@@ -483,7 +483,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
/* 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++)
ISPTarget_SendByte(Write_FuseLockSig_Params.WriteCommandBytes[SByte]);
-
+
Endpoint_Write_Byte(V2Command);
Endpoint_Write_Byte(STATUS_CMD_OK);
Endpoint_Write_Byte(STATUS_CMD_OK);
@@ -500,14 +500,14 @@ void ISPProtocol_SPIMulti(void)
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);
@@ -521,7 +521,7 @@ void ISPProtocol_SPIMulti(void)
ISPTarget_SendByte(SPI_Multi_Params.TxData[CurrTxPos]);
else
ISPTarget_SendByte(0);
-
+
CurrTxPos++;
}
@@ -532,28 +532,28 @@ void ISPProtocol_SPIMulti(void)
Endpoint_Write_Byte(ISPTarget_TransferByte(SPI_Multi_Params.TxData[CurrTxPos++]));
else
Endpoint_Write_Byte(ISPTarget_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_WaitUntilReady();
Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
}
}
@@ -567,4 +567,4 @@ void ISPProtocol_DelayMS(uint8_t DelayMS)
_delay_ms(1);
}
-#endif \ No newline at end of file
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
index bc6bb5de1..c7058f5b5 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,15 +39,15 @@
/* 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
@@ -77,3 +77,4 @@
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 6fea24435..0aa0c6986 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -132,10 +132,10 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
TCCR1B = 0;
if (PINB & (1 << 3))
- SoftSPI_Data |= 0x01;
+ SoftSPI_Data |= 0x01;
}
- PORTB ^= (1 << 1);
+ PORTB ^= (1 << 1);
}
/** Initialises the appropriate SPI driver (hardware or software, depending on the selected ISP speed) ready for
@@ -155,7 +155,7 @@ void ISPTarget_Init(void)
else
{
HardwareSPIMode = false;
-
+
DDRB |= ((1 << 1) | (1 << 2));
PORTB |= ((1 << 0) | (1 << 3));
@@ -176,7 +176,7 @@ void ISPTarget_ShutDown(void)
else
{
DDRB &= ~((1 << 1) | (1 << 2));
- PORTB &= ~((1 << 0) | (1 << 3));
+ PORTB &= ~((1 << 0) | (1 << 3));
}
}
@@ -200,7 +200,7 @@ uint8_t ISPTarget_TransferSoftSPIByte(const uint8_t Byte)
TCCR1B = ((1 << WGM12) | (1 << CS11));
while (SoftSPI_BitsRemaining && TimeoutTicksRemaining);
TCCR1B = 0;
-
+
return SoftSPI_Data;
}
@@ -214,7 +214,7 @@ 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
@@ -254,7 +254,7 @@ void ISPTarget_LoadExtendedAddress(void)
ISPTarget_SendByte(LOAD_EXTENDED_ADDRESS_CMD);
ISPTarget_SendByte(0x00);
ISPTarget_SendByte((CurrentAddress & 0x00FF0000) >> 16);
- ISPTarget_SendByte(0x00);
+ ISPTarget_SendByte(0x00);
}
/** Waits until the last issued target memory programming command has completed, via the check mode given and using
@@ -296,8 +296,8 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode,
if (!(TimeoutTicksRemaining))
ProgrammingStatus = STATUS_CMD_TOUT;
-
- break;
+
+ break;
case PROG_MODE_WORD_READYBUSY_MASK:
case PROG_MODE_PAGED_READYBUSY_MASK:
ProgrammingStatus = ISPTarget_WaitWhileTargetBusy();
@@ -308,3 +308,4 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode,
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
index 967849abd..dfcf7ee8b 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,13 +43,13 @@
#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
@@ -58,7 +58,7 @@
/* Macros: */
/** Low level device command to issue an extended FLASH address, for devices with other 128KB of FLASH. */
#define LOAD_EXTENDED_ADDRESS_CMD 0x4D
-
+
/** Macro to convert an ISP frequency to a number of timer clock cycles for the software SPI driver */
#define TIMER_COMP(freq) ((((F_CPU / 8) / freq) / 2) - 1)
@@ -121,3 +121,4 @@
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.c b/Projects/AVRISP-MKII/Lib/V2Protocol.c
index 4ef1b94a1..3ee3ebd54 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.c
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,12 +59,12 @@ void V2Protocol_Init(void)
ADC_SetupChannel(VTARGET_ADC_CHANNEL);
ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK);
#endif
-
+
/* Timeout timer initialization (10ms period) */
OCR0A = ((F_CPU / 1024) / 100);
TCCR0A = (1 << WGM01);
TIMSK0 = (1 << OCIE0A);
-
+
V2Params_LoadNonVolatileParamValues();
}
@@ -75,11 +75,11 @@ void V2Protocol_Init(void)
void V2Protocol_ProcessCommand(void)
{
uint8_t V2Command = Endpoint_Read_Byte();
-
+
/* Start the timeout management timer */
TimeoutTicksRemaining = COMMAND_TIMEOUT_TICKS;
TCCR0B = ((1 << CS02) | (1 << CS00));
-
+
switch (V2Command)
{
case CMD_SIGN_ON:
@@ -104,7 +104,7 @@ void V2Protocol_ProcessCommand(void)
break;
case CMD_PROGRAM_FLASH_ISP:
case CMD_PROGRAM_EEPROM_ISP:
- ISPProtocol_ProgramMemory(V2Command);
+ ISPProtocol_ProgramMemory(V2Command);
break;
case CMD_READ_FLASH_ISP:
case CMD_READ_EEPROM_ISP:
@@ -139,7 +139,7 @@ void V2Protocol_ProcessCommand(void)
V2Protocol_UnknownCommand(V2Command);
break;
}
-
+
/* Disable the timeout management timer */
TCCR0B = 0;
@@ -193,10 +193,10 @@ 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();
+ Endpoint_ClearIN();
}
@@ -209,18 +209,18 @@ 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);
@@ -232,7 +232,7 @@ static void V2Protocol_GetSetParam(const uint8_t V2Command)
Endpoint_Write_Byte(V2Params_GetParameterValue(ParamID));
}
else
- {
+ {
Endpoint_Write_Byte(STATUS_CMD_FAILED);
}
@@ -250,7 +250,7 @@ static void V2Protocol_LoadAddress(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
if (CurrentAddress & (1UL << 31))
MustLoadExtendedAddress = true;
@@ -258,3 +258,4 @@ static void V2Protocol_LoadAddress(void)
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 8cbd45531..48dc78733 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.h
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../Descriptors.h"
#include "V2ProtocolConstants.h"
#include "V2ProtocolParams.h"
@@ -48,12 +48,12 @@
/* 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
-
+
#if defined(USB_SERIES_4_AVR) && ((VTARGET_ADC_CHANNEL == 2) || (VTARGET_ADC_CHANNEL == 3))
#error The U4 AVR chips do not contain ADC channels 2 or 3. Please change VTARGET_ADC_CHANNEL or define NO_VTARGET_DETECT in the makefile.
#endif
@@ -66,10 +66,10 @@
/** 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 (in 10ms ticks). */
#define COMMAND_TIMEOUT_TICKS 100
-
+
/** Command timeout counter register, GPIOR for speed. */
#define TimeoutTicksRemaining GPIOR1
@@ -83,7 +83,7 @@
/* Function Prototypes: */
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);
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h b/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
index 94c60766b..107daa360 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -86,3 +86,4 @@
#define PARAM_DISCHARGEDELAY 0xA4
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
index 31303c77d..1982fb90f 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,7 +40,7 @@
uint8_t EEMEM EEPROM_Rest_Polarity = 0x00;
/* Volatile Parameter Values for RAM storage */
-static ParameterItem_t ParameterTable[] =
+static ParameterItem_t ParameterTable[] =
{
{ .ParamID = PARAM_BUILD_NUMBER_LOW,
.ParamPrivileges = PARAM_PRIV_READ,
@@ -109,11 +109,11 @@ void V2Params_UpdateParamValues(void)
* \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;
@@ -129,14 +129,14 @@ uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID)
* \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;
}
@@ -163,7 +163,7 @@ void V2Params_SetParameterValue(const uint8_t ParamID,
/* The target RESET line polarity is a non-volatile parameter, save to EEPROM when changed */
if (ParamID == PARAM_RESET_POLARITY)
- eeprom_update_byte(&EEPROM_Rest_Polarity, Value);
+ eeprom_update_byte(&EEPROM_Rest_Polarity, Value);
}
/** Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given
@@ -182,9 +182,10 @@ static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID)
{
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 4b7e18913..2336f686f 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@
#if defined(ADC)
#include <LUFA/Drivers/Peripheral/ADC.h>
#endif
-
+
#include "V2Protocol.h"
#include "V2ProtocolConstants.h"
#include "ISP/ISPTarget.h"
@@ -56,7 +56,7 @@
/** 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]))
@@ -72,12 +72,12 @@
/* 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
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
index d45e42a1a..7522dc81f 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -138,17 +138,17 @@ bool TINYNVM_ReadMemory(const uint16_t ReadAddress,
/* 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-- && TimeoutTicksRemaining)
{
/* Read the byte of data from the target */
XPROGTarget_SendByte(TPI_CMD_SLD | TPI_POINTER_INDIRECT_PI);
*(ReadBuffer++) = XPROGTarget_ReceiveByte();
}
-
+
return (TimeoutTicksRemaining != 0);
}
@@ -167,7 +167,7 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* 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;
@@ -175,10 +175,10 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* 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 */
@@ -188,7 +188,7 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* 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++));
@@ -196,7 +196,7 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* Need to decrement the write length twice, since we read out a whole word */
WriteLength -= 2;
}
-
+
return true;
}
@@ -226,8 +226,9 @@ bool TINYNVM_EraseMemory(const uint8_t EraseCommand,
/* 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 cbb2c27aa..339b299d2 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,16 +40,16 @@
#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
@@ -61,7 +61,7 @@
#define TINY_NVM_CMD_SECTIONERASE 0x14
#define TINY_NVM_CMD_WORDWRITE 0x1D
- /* Function Prototypes: */
+ /* Function Prototypes: */
bool TINYNVM_WaitWhileNVMBusBusy(void);
bool TINYNVM_WaitWhileNVMControllerBusy(void);
bool TINYNVM_ReadMemory(const uint16_t ReadAddress,
@@ -80,3 +80,4 @@
#endif
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
index 22f4e93e0..322f2ea80 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -76,13 +76,13 @@ bool XMEGANVM_WaitWhileNVMBusBusy(void)
{
/* 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 (!(TimeoutTicksRemaining))
return false;
-
+
/* Check the status register read response to see if the NVM bus is enabled */
if (StatusRegister & PDI_STATUS_NVM)
return true;
@@ -102,7 +102,7 @@ bool XMEGANVM_WaitWhileNVMControllerBusy(void)
/* 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 */
@@ -127,7 +127,7 @@ 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);
@@ -145,7 +145,7 @@ 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;
-
+
/* 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);
@@ -153,12 +153,12 @@ bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
/* 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 (TimeoutTicksRemaining != 0);
}
@@ -175,7 +175,7 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16
/* 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);
@@ -188,12 +188,12 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16
/* 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 post-increment to read out the bytes */
XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
while (ReadSize-- && TimeoutTicksRemaining)
*(ReadBuffer++) = XPROGTarget_ReceiveByte();
-
+
return (TimeoutTicksRemaining != 0);
}
@@ -215,12 +215,12 @@ bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAd
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 of the target */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendAddress(WriteAddress);
XPROGTarget_SendByte(Byte);
-
+
return true;
}
@@ -275,13 +275,13 @@ bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t Eras
/* 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 post-increment 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 */
@@ -292,7 +292,7 @@ bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t Eras
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);
@@ -322,11 +322,11 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(EraseCommand);
-
+
/* Set CMDEX bit in NVM CTRLA register to start the erase sequence */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
+ XPROGTarget_SendByte(1 << 0);
}
else if (EraseCommand == XMEGA_NVM_CMD_ERASEEEPROM)
{
@@ -356,21 +356,21 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
/* Send the REPEAT command with the specified number of bytes to write */
XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
XPROGTarget_SendByte(XPROG_Param_EEPageSize - 1);
-
+
/* Send a ST command with indirect access and post-increment to tag each byte in the EEPROM page buffer */
XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
for (uint8_t PageByte = 0; PageByte < XPROG_Param_EEPageSize; PageByte++)
XPROGTarget_SendByte(0x00);
-
+
/* 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);
-
+
/* Set CMDEX bit in NVM CTRLA register to start the EEPROM erase sequence */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
+ XPROGTarget_SendByte(1 << 0);
}
else
{
@@ -378,18 +378,19 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(EraseCommand);
-
+
/* 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 af38afdac..f65e88ad8 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,16 +40,16 @@
#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
@@ -57,7 +57,7 @@
/* Defines: */
#define XMEGA_CRC_LENGTH 3
-
+
#define XMEGA_NVM_REG_ADDR0 0x00
#define XMEGA_NVM_REG_ADDR1 0x01
#define XMEGA_NVM_REG_ADDR2 0x02
@@ -70,7 +70,7 @@
#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
@@ -118,7 +118,8 @@
#if defined(INCLUDE_FROM_XMEGANVM_C)
static void XMEGANVM_SendNVMRegAddress(const uint8_t Register);
- static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress);
+ 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 85820fd31..edd362b48 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -61,18 +61,18 @@ void XPROGProtocol_SetMode(void)
{
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();
+ Endpoint_ClearIN();
}
/** Handler for the CMD_XPROG command, which wraps up XPROG commands in a V2 wrapper which need to be
@@ -81,7 +81,7 @@ void XPROGProtocol_SetMode(void)
void XPROGProtocol_Command(void)
{
uint8_t XPROGCommand = Endpoint_Read_Byte();
-
+
switch (XPROGCommand)
{
case XPRG_CMD_ENTER_PROGMODE:
@@ -114,7 +114,7 @@ static void XPROGProtocol_EnterXPROGMode(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
bool NVMBusEnabled = false;
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
@@ -123,11 +123,11 @@ static void XPROGProtocol_EnterXPROGMode(void)
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_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(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 */
@@ -142,20 +142,20 @@ static void XPROGProtocol_EnterXPROGMode(void)
{
/* 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);
+ 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);
@@ -170,17 +170,17 @@ 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(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(PDI_CMD_STCS | PDI_RESET_REG);
XPROGTarget_SendByte(0x00);
XPROGTarget_DisableTargetPDI();
@@ -190,12 +190,12 @@ static void XPROGProtocol_LeaveXPROGMode(void)
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(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);
@@ -219,11 +219,11 @@ static void XPROGProtocol_Erase(void)
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)
{
@@ -255,7 +255,7 @@ static void XPROGProtocol_Erase(void)
EraseCommand = XMEGA_NVM_CMD_NOOP;
break;
}
-
+
/* Erase the target memory, indicate timeout if occurred */
if (!(XMEGANVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
ReturnStatus = XPRG_ERR_TIMEOUT;
@@ -266,16 +266,16 @@ static void XPROGProtocol_Erase(void)
EraseCommand = TINY_NVM_CMD_CHIPERASE;
else
EraseCommand = TINY_NVM_CMD_SECTIONERASE;
-
+
/* Erase the target memory, indicate timeout if occurred */
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();
+ Endpoint_ClearIN();
}
/** Handler for the XPROG WRITE_MEMORY command to write to a specific memory space within the attached device. */
@@ -291,7 +291,7 @@ static void XPROGProtocol_WriteMemory(void)
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);
@@ -309,7 +309,7 @@ static void XPROGProtocol_WriteMemory(void)
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:
@@ -321,7 +321,7 @@ static void XPROGProtocol_WriteMemory(void)
case XPRG_MEM_TYPE_EEPROM:
WriteCommand = XMEGA_NVM_CMD_ERASEWRITEEEPROMPAGE;
WriteBuffCommand = XMEGA_NVM_CMD_LOADEEPROMPAGEBUFF;
- EraseBuffCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF;
+ EraseBuffCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF;
break;
case XPRG_MEM_TYPE_USERSIG:
WriteCommand = XMEGA_NVM_CMD_WRITEUSERSIG;
@@ -335,9 +335,9 @@ static void XPROGProtocol_WriteMemory(void)
PagedMemory = false;
break;
}
-
+
/* Send the appropriate memory write commands to the device, indicate timeout if occurred */
- if ((PagedMemory && !(XMEGANVM_WritePageMemory(WriteBuffCommand, EraseBuffCommand, WriteCommand,
+ 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,
@@ -355,10 +355,10 @@ static void XPROGProtocol_WriteMemory(void)
ReturnStatus = XPRG_ERR_TIMEOUT;
}
}
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_WRITE_MEM);
- Endpoint_Write_Byte(ReturnStatus);
+ Endpoint_Write_Byte(ReturnStatus);
Endpoint_ClearIN();
}
@@ -375,7 +375,7 @@ static void XPROGProtocol_ReadMemory(void)
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);
@@ -385,7 +385,7 @@ static void XPROGProtocol_ReadMemory(void)
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 */
@@ -402,10 +402,10 @@ static void XPROGProtocol_ReadMemory(void)
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();
}
@@ -415,18 +415,18 @@ static void XPROGProtocol_ReadMemory(void)
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)
@@ -446,7 +446,7 @@ static void XPROGProtocol_ReadCRC(void)
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;
@@ -456,18 +456,18 @@ static void XPROGProtocol_ReadCRC(void)
/* 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_Write_Word_LE(MemoryCRC & 0xFFFF);
}
-
- Endpoint_ClearIN();
+
+ Endpoint_ClearIN();
}
/** Handler for the XPROG SET_PARAM command to set a XPROG parameter for use when communicating with the
@@ -478,7 +478,7 @@ 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)
{
@@ -502,7 +502,7 @@ static void XPROGProtocol_SetParam(void)
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);
@@ -510,3 +510,4 @@ static void XPROGProtocol_SetParam(void)
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
index 978a5a2ab..a4a7a8413 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,10 +40,10 @@
#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"
@@ -52,12 +52,12 @@
/* 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
@@ -100,25 +100,25 @@
#define XPRG_PARAM_EEPPAGESIZE 0x02
#define XPRG_PARAM_NVMCMD_REG 0x03
#define XPRG_PARAM_NVMCSR_REG 0x04
-
+
#define XPRG_PROTOCOL_PDI 0x00
#define XPRG_PROTOCOL_JTAG 0x01
#define XPRG_PROTOCOL_TPI 0x02
-
+
#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) && defined(ENABLE_XPROG_PROTOCOL))
static void XPROGProtocol_EnterXPROGMode(void);
static void XPROGProtocol_LeaveXPROGMode(void);
@@ -128,5 +128,6 @@
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 2e5200561..28cb6abca 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,11 +49,11 @@ void XPROGTarget_EnableTargetPDI(void)
/* 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);
@@ -77,7 +77,7 @@ void XPROGTarget_EnableTargetTPI(void)
/* 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);
@@ -133,7 +133,7 @@ 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);
@@ -202,3 +202,4 @@ static void XPROGTarget_SetRxMode(void)
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
index 0e5d373ef..6aedea6fb 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,27 +40,27 @@
#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 500000
/** 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
@@ -69,11 +69,11 @@
#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
@@ -83,7 +83,7 @@
#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
@@ -100,14 +100,14 @@
#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);
@@ -117,10 +117,11 @@
uint8_t XPROGTarget_ReceiveByte(void);
void XPROGTarget_SendBreak(void);
bool XPROGTarget_WaitWhileNVMBusBusy(void);
-
+
#if (defined(INCLUDE_FROM_XPROGTARGET_C) && defined(ENABLE_XPROG_PROTOCOL))
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 fad461aa3..6c6e11708 100644
--- a/Projects/AVRISP-MKII/makefile
+++ b/Projects/AVRISP-MKII/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -158,7 +158,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -171,7 +171,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -285,7 +285,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -298,7 +298,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -310,7 +310,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -322,7 +322,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -345,7 +345,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -379,7 +379,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -413,7 +413,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -442,7 +442,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -461,10 +461,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -529,11 +529,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -560,9 +560,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -660,14 +660,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -689,7 +689,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -733,3 +733,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c
index a9afda4a3..735d7346b 100644
--- a/Projects/Benito/Benito.c
+++ b/Projects/Benito/Benito.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@ uint8_t FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS;
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
- .Config =
+ .Config =
{
.ControlInterfaceNumber = 0,
@@ -84,9 +84,9 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
int main(void)
{
SetupHardware();
-
+
RingBuffer_InitBuffer(&Tx_Buffer);
-
+
sei();
for (;;)
@@ -98,9 +98,9 @@ int main(void)
UDR1 = ReceivedByte;
LEDs_TurnOnLEDs(LEDMASK_TX);
- PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
+ PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
}
-
+
/* Check if the millisecond timer has elapsed */
if (TIFR0 & (1 << OCF0A))
{
@@ -110,14 +110,14 @@ int main(void)
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);
@@ -139,14 +139,14 @@ int main(void)
LEDs_TurnOnLEDs(LEDMASK_RX);
PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS;
}
-
+
FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS;
}
/* Clear the millisecond timer CTC flag (cleared by writing logic one to the register) */
- TIFR0 |= (1 << OCF0A);
+ TIFR0 |= (1 << OCF0A);
}
-
+
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
@@ -167,7 +167,7 @@ void SetupHardware(void)
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;
@@ -216,10 +216,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
{
case CDC_PARITY_Odd:
- ConfigMask = ((1 << UPM11) | (1 << UPM10));
+ ConfigMask = ((1 << UPM11) | (1 << UPM10));
break;
case CDC_PARITY_Even:
- ConfigMask = (1 << UPM11);
+ ConfigMask = (1 << UPM11);
break;
}
@@ -238,7 +238,7 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10));
break;
}
-
+
/* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */
UCSR1B = 0;
UCSR1A = 0;
@@ -246,10 +246,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
/* Set the new baud rate before configuring the USART */
UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
-
+
/* Reconfigure the USART in double speed mode for a wider baud rate range at the expense of accuracy */
UCSR1C = ConfigMask;
- UCSR1A = (1 << U2X1);
+ UCSR1A = (1 << U2X1);
UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
}
@@ -276,10 +276,11 @@ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const C
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 34bc797ed..974956993 100644
--- a/Projects/Benito/Benito.h
+++ b/Projects/Benito/Benito.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,10 +56,10 @@
/** 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)
@@ -70,8 +70,9 @@
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 d7bf870e2..60d77cd4a 100644
--- a/Projects/Benito/Benito.txt
+++ b/Projects/Benito/Benito.txt
@@ -3,7 +3,7 @@
* 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:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -43,7 +43,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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
@@ -103,3 +103,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/Benito/Descriptors.c b/Projects/Benito/Descriptors.c
index fc9d5aba3..f4c68bab7 100644
--- a/Projects/Benito/Descriptors.c
+++ b/Projects/Benito/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -45,22 +45,22 @@
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,102 +71,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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 =
+
+ .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_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.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 =
+ .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 =
+ .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 =
+
+ .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,
@@ -181,7 +181,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -192,7 +192,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -203,7 +203,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(25), .Type = DTYPE_String},
-
+
.UnicodeString = L"Benito Arduino Programmer"
};
@@ -225,34 +225,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &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 361fe9032..ddd9495ea 100644
--- a/Projects/Benito/Descriptors.h
+++ b/Projects/Benito/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -47,10 +47,10 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #define CDC_RX_EPNUM 4
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Benito/Lib/LightweightRingBuff.h b/Projects/Benito/Lib/LightweightRingBuff.h
index 768e49a50..2fbc164cb 100644
--- a/Projects/Benito/Lib/LightweightRingBuff.h
+++ b/Projects/Benito/Lib/LightweightRingBuff.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,20 +39,20 @@
* or deletions) must not overlap. If there is possibility of two or more of the same kind of
* operating occuring at the same point in time, atomic (mutex) locking should be used.
*/
-
+
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
-
+
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 255
-
+
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
@@ -76,7 +76,7 @@
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
-
+
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
@@ -92,7 +92,7 @@
Buffer->Out = Buffer->Buffer;
}
}
-
+
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
@@ -109,15 +109,15 @@
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
-
+
return Count;
}
-
+
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
@@ -125,7 +125,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
@@ -142,7 +142,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -161,7 +161,7 @@
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
-
+
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
@@ -184,7 +184,7 @@
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
-
+
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
@@ -192,8 +192,9 @@
{
Buffer->Count--;
}
-
+
return Data;
}
#endif
+
diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile
index b6432599e..535bdbdbb 100644
--- a/Projects/Benito/makefile
+++ b/Projects/Benito/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -144,7 +144,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -157,7 +157,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -271,7 +271,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -284,7 +284,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -296,7 +296,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -308,7 +308,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -331,7 +331,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -365,7 +365,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -399,7 +399,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -428,7 +428,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -447,10 +447,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -515,11 +515,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -546,9 +546,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -646,14 +646,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -675,7 +675,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -719,3 +719,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
index eda170cee..5dbb0b0b6 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -59,22 +59,22 @@
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -85,38 +85,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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 =
+ .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 =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -126,7 +126,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -144,7 +144,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -155,7 +155,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -166,7 +166,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(26), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Standalone Programmer"
};
@@ -188,36 +188,37 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &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 4065209b4..62399db30 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -60,15 +60,15 @@
#define CDC_TXRX_EPSIZE 16
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* 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.
@@ -80,7 +80,7 @@
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,
@@ -88,3 +88,4 @@
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 3a0ff53d7..b18de1057 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -93,11 +93,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
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 85977522b..76e528e5e 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <avr/io.h>
-
+
#include "Descriptors.h"
#include "StandaloneProgrammer.h"
@@ -59,3 +59,4 @@
#endif
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
index e7831cd71..696c7ad33 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -41,7 +41,7 @@ USB_ClassInfo_MS_Host_t DiskHost_MS_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
},
@@ -52,7 +52,7 @@ void DiskHost_USBTask(void)
if (USB_HostState == HOST_STATE_Addressed)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -71,14 +71,14 @@ void DiskHost_USBTask(void)
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))
{
@@ -86,17 +86,17 @@ void DiskHost_USBTask(void)
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
+
+ /* 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)
@@ -105,13 +105,13 @@ void DiskHost_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
return;
}
-
+
pf_mount(&DiskFATState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
- MS_Host_USBTask(&DiskHost_MS_Interface);
+ MS_Host_USBTask(&DiskHost_MS_Interface);
}
void EVENT_USB_Host_DeviceAttached(void)
@@ -125,3 +125,4 @@ void EVENT_USB_Host_DeviceUnattached(void)
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.h b/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
index 72c4f621b..cbb63577a 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <avr/io.h>
-
+
#include "Descriptors.h"
#include "StandaloneProgrammer.h"
@@ -54,9 +54,10 @@
/* 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 af6c865a6..033bc805c 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -78,7 +78,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -87,7 +87,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -126,7 +126,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -146,7 +146,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -155,9 +155,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -202,15 +202,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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))
{
@@ -219,12 +219,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* 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))
{
@@ -234,7 +234,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* 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);
@@ -242,7 +242,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -261,10 +261,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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++;
@@ -272,11 +272,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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();
@@ -316,11 +316,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* 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))
{
@@ -360,18 +360,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
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++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -417,7 +417,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -430,7 +430,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* 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);
@@ -438,19 +438,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
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--;
}
@@ -465,7 +465,7 @@ 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)
{
@@ -477,12 +477,12 @@ void DataflashManager_ResetDataflashProtections(void)
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)
{
@@ -495,7 +495,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -529,7 +529,8 @@ bool DataflashManager_CheckDataflashOperation(void)
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 406ae62af..b42b13297 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "StandaloneProgrammer.h"
#include "Descriptors.h"
@@ -59,12 +59,12 @@
* 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,
@@ -84,3 +84,4 @@
#endif
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
index ee8effcf4..b8a001cdc 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
@@ -34,3 +34,4 @@ AGREEMENTS
REVISION HISTORY
Jun 15, 2010 R0.01a First release (Branched from FatFs R0.07b)
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
index 43ba78403..b1a09855b 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
@@ -34,3 +34,4 @@ BOOL assign_drives (int argc, char *argv[]);
#define _DISKIO
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
index 851a78da2..5ecedd9a9 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
@@ -35,3 +35,4 @@ typedef enum { FALSE = 0, TRUE } BOOL;
#define _INTEGER
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
index 85b88e6e1..cfc050f76 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
@@ -400,7 +400,7 @@ FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
}
dj->sclust =
#if _FS_FAT32
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
#endif
LD_WORD(dir+DIR_FstClusLO);
}
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
index bdf1f9485..87ac2dff2 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
@@ -235,3 +235,4 @@ FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item */
#endif /* _FATFS */
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
index 63beb1d21..47dd02fab 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@ struct
{
uint16_t SigBytes[4];
bool EnforceSigBytes;
-
+
uint32_t ProgrammingSpeed;
} ProgrammerConfig;
@@ -47,14 +47,14 @@ bool ProgrammerConfig_ProcessConfiguration(void)
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],
@@ -65,13 +65,14 @@ bool ProgrammerConfig_ProcessConfiguration(void)
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 ba6e9add6..736d0becd 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,10 +35,11 @@
#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 1ca22a50e..bfc1098b3 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* 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"
@@ -42,22 +42,22 @@
/** 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 =
+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,
@@ -65,7 +65,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -97,13 +97,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -135,7 +135,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -166,11 +166,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
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, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -179,7 +179,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -194,7 +194,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
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);
@@ -222,10 +222,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
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;
-
+
return true;
}
@@ -249,21 +249,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* 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);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -281,13 +281,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
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(*(uint16_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)
{
@@ -298,7 +298,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
return false;
}
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -307,7 +307,8 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
index 6a90cb962..75d281414 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -46,7 +46,7 @@
#include "StandaloneProgrammer.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
@@ -68,14 +68,14 @@
/** 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* const MSInterfaceInfo);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -85,5 +85,6 @@
const bool IsDataRead);
#endif
#endif
-
+
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
index 4b019bd37..9627d1b04 100644
--- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
+++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -67,7 +67,7 @@ void EVENT_USB_UIDChange(void)
}
#endif
-/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
+/** 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)
@@ -80,7 +80,7 @@ void Programmer_Task(void)
HasAttempted = true;
else
return;
-
+
puts("==== PROGRAMMING CYCLE STARTED ====\r\n");
#if defined(USB_CAN_BE_BOTH)
@@ -113,7 +113,7 @@ int main(void)
for (;;)
{
Programmer_Task();
-
+
if (USB_CurrentMode == USB_MODE_HOST)
{
#if defined(USB_CAN_BE_HOST)
@@ -126,7 +126,7 @@ int main(void)
DiskDevice_USBTask();
#endif
}
-
+
USB_USBTask();
}
}
@@ -159,3 +159,4 @@ void SetupHardware(void)
DataflashManager_ResetDataflashProtections();
#endif
}
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
index dfb8a9f3a..c0edc5166 100644
--- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
+++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -70,19 +70,20 @@
/** 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 022cbd259..aecad74e6 100644
--- a/Projects/Incomplete/StandaloneProgrammer/makefile
+++ b/Projects/Incomplete/StandaloneProgrammer/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -144,7 +144,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -157,7 +157,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -271,7 +271,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -284,7 +284,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -296,7 +296,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -308,7 +308,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -331,7 +331,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -365,7 +365,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -399,7 +399,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -428,7 +428,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -447,10 +447,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -515,11 +515,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -546,9 +546,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -646,14 +646,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -675,7 +675,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -719,3 +719,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c
index 38f6e34ac..f31f42828 100644
--- a/Projects/LEDNotifier/Descriptors.c
+++ b/Projects/LEDNotifier/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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 =
+
+ .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_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.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 =
+ .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 =
+ .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 =
+
+ .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,
@@ -241,30 +241,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &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 159d8d265..ddd9495ea 100644
--- a/Projects/LEDNotifier/Descriptors.h
+++ b/Projects/LEDNotifier/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c
index d1f4451e7..591d1e3e6 100644
--- a/Projects/LEDNotifier/LEDNotifier.c
+++ b/Projects/LEDNotifier/LEDNotifier.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* 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
@@ -89,7 +89,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
if (SoftPWM_Count >= SoftPWM_Channel3_Duty)
LEDMask &= ~LEDS_LED3;
-
+
LEDs_SetAllLEDs(LEDMask);
}
@@ -104,24 +104,24 @@ static FILE USBSerialStream;
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 ColourUpdate = fgetc(&USBSerialStream);
-
+
/* Top 3 bits select the LED, bottom 5 control the brightness */
uint8_t Channel = (ColourUpdate & 0b11100000);
uint8_t Duty = (ColourUpdate & 0b00011111);
-
+
if (Channel & (1 << 5))
SoftPWM_Channel1_Duty = Duty;
-
+
if (Channel & (1 << 6))
SoftPWM_Channel2_Duty = Duty;
@@ -146,7 +146,7 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
USB_Init();
-
+
/* Timer Initialization */
OCR0A = 100;
TCCR0A = (1 << WGM01);
@@ -165,3 +165,4 @@ 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 3565e8bed..f91fa6e95 100644
--- a/Projects/LEDNotifier/LEDNotifier.h
+++ b/Projects/LEDNotifier/LEDNotifier.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,11 +50,12 @@
#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 dae6b6f2f..b5eadbabb 100644
--- a/Projects/LEDNotifier/LEDNotifier.txt
+++ b/Projects/LEDNotifier/LEDNotifier.txt
@@ -3,7 +3,7 @@
* 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:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/LEDNotifier/makefile b/Projects/LEDNotifier/makefile
index d07dfec72..3292e5ad1 100644
--- a/Projects/LEDNotifier/makefile
+++ b/Projects/LEDNotifier/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = BUI
# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c
index 46ee69fee..2a04e5f26 100644
--- a/Projects/Magstripe/Descriptors.c
+++ b/Projects/Magstripe/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,11 +31,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * 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
@@ -79,22 +79,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -105,49 +105,49 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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 =
+
+ .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 =
- {
+ .HID_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID_ReportINEndpoint =
+
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -160,11 +160,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
/** 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. */
+ * 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}
};
@@ -175,7 +175,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(32), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera and Denver Gingerich"
};
@@ -186,7 +186,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(20), .Type = DTYPE_String},
-
+
.UnicodeString = L"Magnetic Card Reader"
};
@@ -232,7 +232,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
@@ -243,7 +243,8 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(KeyboardReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/Magstripe/Descriptors.h b/Projects/Magstripe/Descriptors.h
index 7180bf3e7..963aaac09 100644
--- a/Projects/Magstripe/Descriptors.h
+++ b/Projects/Magstripe/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -55,11 +55,11 @@
USB_HID_Descriptor_HID_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
@@ -70,3 +70,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.c b/Projects/Magstripe/Lib/CircularBitBuffer.c
index c1b21039c..3b0ca6cd5 100644
--- a/Projects/Magstripe/Lib/CircularBitBuffer.c
+++ b/Projects/Magstripe/Lib/CircularBitBuffer.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -41,7 +41,7 @@ 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);
@@ -56,10 +56,10 @@ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
/* 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))
{
@@ -68,8 +68,8 @@ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
Buffer->In.CurrentByte++;
else
Buffer->In.CurrentByte = Buffer->Data;
-
- /* Reset the storage bit mask in the current buffer byte to the first bit */
+
+ /* Reset the storage bit mask in the current buffer byte to the first bit */
Buffer->In.ByteMask = (1 << 0);
}
else
@@ -81,7 +81,7 @@ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
/** 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);
@@ -90,17 +90,17 @@ bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
/* Decrement the number of stored bits in the buffer counter */
Buffer->Elements--;
-
- /* Check if the current buffer byte is empty of stored bits */
+
+ /* 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.CurrentByte = Buffer->Data;
+
+ /* Reset the retrieval bit mask in the current buffer byte to the first bit */
Buffer->Out.ByteMask = (1 << 0);
}
else
@@ -112,3 +112,4 @@ bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
/* Return the retrieved bit from the buffer */
return Bit;
}
+
diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.h b/Projects/Magstripe/Lib/CircularBitBuffer.h
index 04322fbe9..7a04694db 100644
--- a/Projects/Magstripe/Lib/CircularBitBuffer.h
+++ b/Projects/Magstripe/Lib/CircularBitBuffer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,7 +40,7 @@
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
-
+
#include <LUFA/Common/Common.h>
/* Macros: */
@@ -51,7 +51,7 @@
#else
#define MAX_BITS 1024
#endif
-
+
/* Type Defines: */
/** Type define for a pointer to a bit in a bit buffer. */
typedef struct
@@ -65,18 +65,18 @@
{
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: */
+
+ /* Function Prototypes: */
/** Initialises 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
@@ -84,7 +84,7 @@
*/
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
@@ -92,5 +92,6 @@
* \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 5b20fc433..5b709a89e 100644
--- a/Projects/Magstripe/Lib/MagstripeHW.h
+++ b/Projects/Magstripe/Lib/MagstripeHW.h
@@ -2,13 +2,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -98,3 +98,4 @@
}
#endif
+
diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c
index 9a551a18a..50ca3cab3 100644
--- a/Projects/Magstripe/Magstripe.c
+++ b/Projects/Magstripe/Magstripe.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -28,13 +28,13 @@
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
@@ -73,10 +73,10 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
int main(void)
{
SetupHardware();
-
+
for (uint8_t Buffer = 0; Buffer < TOTAL_TRACKS; Buffer++)
BitBuffer_Init(&TrackDataBuffers[Buffer]);
-
+
sei();
for (;;)
@@ -113,7 +113,7 @@ void ReadMagstripeData(void)
const struct
{
uint8_t ClockMask;
- uint8_t DataMask;
+ uint8_t DataMask;
} TrackInfo[] = {{MAG_T1_CLOCK, MAG_T1_DATA},
{MAG_T2_CLOCK, MAG_T2_DATA},
{MAG_T3_CLOCK, MAG_T3_DATA}};
@@ -128,7 +128,7 @@ void ReadMagstripeData(void)
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);
@@ -137,7 +137,7 @@ void ReadMagstripeData(void)
Magstripe_Prev = Magstripe_LCL;
Magstripe_LCL = Magstripe_GetStatus();
}
-
+
CurrentTrackBuffer = &TrackDataBuffers[0];
}
@@ -200,7 +200,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
/* 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;
}
@@ -221,3 +221,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
{
// 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 946ef2ebf..58f3f2373 100644
--- a/Projects/Magstripe/Magstripe.h
+++ b/Projects/Magstripe/Magstripe.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,10 +54,10 @@
/* 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
@@ -66,11 +66,11 @@
/** 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);
@@ -81,9 +81,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
-
+
#endif
+
diff --git a/Projects/Magstripe/Magstripe.txt b/Projects/Magstripe/Magstripe.txt
index 29258ed49..54715b042 100644
--- a/Projects/Magstripe/Magstripe.txt
+++ b/Projects/Magstripe/Magstripe.txt
@@ -3,7 +3,7 @@
* 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:
@@ -26,7 +26,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Keyboard</td>
* </tr>
@@ -40,18 +40,18 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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>
@@ -162,3 +162,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/Magstripe/makefile b/Projects/Magstripe/makefile
index aed7a1938..2eea2cbd6 100644
--- a/Projects/Magstripe/makefile
+++ b/Projects/Magstripe/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = NONE
# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 16000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -147,7 +147,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -160,7 +160,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -274,7 +274,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -287,7 +287,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -299,7 +299,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -311,7 +311,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -334,7 +334,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -368,7 +368,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -402,7 +402,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -431,7 +431,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -450,10 +450,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -518,11 +518,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -549,9 +549,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -649,14 +649,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -678,7 +678,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -722,3 +722,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/MissileLauncher/ConfigDescriptor.c b/Projects/MissileLauncher/ConfigDescriptor.c
index 7ee2449c2..c7ddbcbd5 100644
--- a/Projects/MissileLauncher/ConfigDescriptor.c
+++ b/Projects/MissileLauncher/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -79,7 +79,7 @@ uint8_t ProcessConfigurationDescriptor(void)
* but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */
if (DataINEndpoint)
break;
-
+
/* Get the next HID interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
@@ -87,7 +87,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the interface in case we need to refer back to it later */
HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
@@ -97,7 +97,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -107,20 +107,20 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
+
/* Check if the HID interface contained an optional OUT data endpoint */
if (DataOUTEndpoint)
{
/* Configure the HID data OUT pipe */
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
- }
-
+ }
+
/* Valid data found, return success */
return SuccessfulConfigRead;
}
@@ -145,7 +145,7 @@ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -176,3 +176,4 @@ uint8_t DComp_NextHIDInterfaceDataEndpoint(void* CurrentDescriptor)
/* 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 5cddada1d..3a745e3b2 100644
--- a/Projects/MissileLauncher/ConfigDescriptor.h
+++ b/Projects/MissileLauncher/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,16 +38,16 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MissileLauncher.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define HID_CLASS 0x03
/** 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
@@ -60,7 +60,7 @@
DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
- };
+ };
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
@@ -69,3 +69,4 @@
uint8_t DComp_NextHIDInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Projects/MissileLauncher/MissileLauncher.c b/Projects/MissileLauncher/MissileLauncher.c
index c76dc52f4..6b22df82e 100644
--- a/Projects/MissileLauncher/MissileLauncher.c
+++ b/Projects/MissileLauncher/MissileLauncher.c
@@ -2,7 +2,7 @@
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
*/
@@ -11,13 +11,13 @@
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
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
* 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 */
@@ -103,7 +103,7 @@ int main(void)
for (;;)
{
Read_Joystick_Status();
-
+
HID_Host_Task();
USB_USBTask();
}
@@ -173,7 +173,7 @@ void Send_Command(uint8_t* const Command)
Send_Command_Report(CMD_INITB, 8);
Send_Command_Report(Command, LAUNCHER_CMD_BUFFER_SIZE);
}
-
+
CmdState = Command;
}
@@ -231,13 +231,13 @@ void DiscardNextReport(void)
{
/* 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();
}
@@ -252,7 +252,7 @@ void WriteNextReport(uint8_t* const ReportOUTData,
{
/* 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())
@@ -264,13 +264,13 @@ void WriteNextReport(uint8_t* const ReportOUTData,
{
/* Refreeze the data OUT pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Write out HID report data */
- Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
-
+ Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
+
/* Clear the OUT endpoint, send last data packet */
Pipe_ClearOUT();
@@ -324,12 +324,12 @@ void HID_Host_Task(void)
{
/* 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:
@@ -338,3 +338,4 @@ void HID_Host_Task(void)
break;
}
}
+
diff --git a/Projects/MissileLauncher/MissileLauncher.h b/Projects/MissileLauncher/MissileLauncher.h
index 6bff6af8b..080d568f9 100644
--- a/Projects/MissileLauncher/MissileLauncher.h
+++ b/Projects/MissileLauncher/MissileLauncher.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,9 +50,9 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
@@ -68,10 +68,10 @@
/** 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);
@@ -92,5 +92,6 @@
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 3b344281a..49918d411 100644
--- a/Projects/MissileLauncher/MissileLauncher.txt
+++ b/Projects/MissileLauncher/MissileLauncher.txt
@@ -3,7 +3,7 @@
* 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:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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
@@ -57,3 +57,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/MissileLauncher/makefile b/Projects/MissileLauncher/makefile
index 0bdb51c1e..6a811e864 100644
--- a/Projects/MissileLauncher/makefile
+++ b/Projects/MissileLauncher/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -132,7 +132,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -145,7 +145,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -259,7 +259,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -272,7 +272,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -284,7 +284,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -296,7 +296,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -319,7 +319,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -353,7 +353,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -387,7 +387,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -416,7 +416,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -435,10 +435,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -503,11 +503,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -534,9 +534,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -634,14 +634,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -663,7 +663,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -707,3 +707,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c
index d05de457e..2fa95bde8 100644
--- a/Projects/RelayBoard/Descriptors.c
+++ b/Projects/RelayBoard/Descriptors.c
@@ -200,3 +200,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h
index 2cf2e8d69..554c361e9 100644
--- a/Projects/RelayBoard/Descriptors.h
+++ b/Projects/RelayBoard/Descriptors.h
@@ -58,3 +58,4 @@
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c
index 7bba1bad4..b71b3535a 100644
--- a/Projects/RelayBoard/RelayBoard.c
+++ b/Projects/RelayBoard/RelayBoard.c
@@ -44,7 +44,7 @@
int main(void)
{
SetupHardware();
-
+
sei();
for (;;)
@@ -103,7 +103,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
}
}
-
+
break;
case 0x01:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
ControlData[1] = (PORTC & RELAY4) ? 2 : 3;
break;
}
-
+
if (ControlData[1])
Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData));
@@ -140,3 +140,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
}
}
+
diff --git a/Projects/RelayBoard/RelayBoard.h b/Projects/RelayBoard/RelayBoard.h
index cfd75794d..f3814b299 100644
--- a/Projects/RelayBoard/RelayBoard.h
+++ b/Projects/RelayBoard/RelayBoard.h
@@ -62,3 +62,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Projects/RelayBoard/RelayBoard.txt b/Projects/RelayBoard/RelayBoard.txt
index bb484be7e..357f780b3 100644
--- a/Projects/RelayBoard/RelayBoard.txt
+++ b/Projects/RelayBoard/RelayBoard.txt
@@ -92,4 +92,4 @@
* </tr>
* </table>
*
- */ \ No newline at end of file
+ */
diff --git a/Projects/RelayBoard/makefile b/Projects/RelayBoard/makefile
index d4434bc4b..ec4c68292 100644
--- a/Projects/RelayBoard/makefile
+++ b/Projects/RelayBoard/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/TempDataLogger/Descriptors.c b/Projects/TempDataLogger/Descriptors.c
index 16a6581d2..5dde04c19 100644
--- a/Projects/TempDataLogger/Descriptors.c
+++ b/Projects/TempDataLogger/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -83,22 +83,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -109,38 +109,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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)
},
-
- .MS_Interface =
+
+ .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 =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -150,7 +150,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -159,27 +159,27 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x00,
.Protocol = HID_BOOTP_NonBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_GenericHID =
+ .HID_GenericHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -187,15 +187,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(GenericReport)
},
- .HID_ReportINEndpoint =
+ .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
@@ -205,7 +205,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -216,7 +216,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -227,7 +227,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"Temperature Datalogger"
};
@@ -249,42 +249,43 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_GenericHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &GenericReport;
Size = sizeof(GenericReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/TempDataLogger/Descriptors.h b/Projects/TempDataLogger/Descriptors.h
index a4916ace1..3b5e78ea3 100644
--- a/Projects/TempDataLogger/Descriptors.h
+++ b/Projects/TempDataLogger/Descriptors.h
@@ -1,11 +1,11 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -15,15 +15,15 @@
#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
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
@@ -33,11 +33,11 @@
/** 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 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.
@@ -52,7 +52,7 @@
USB_HID_Descriptor_HID_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,
@@ -60,3 +60,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/TempDataLogger/Lib/DS1307.c b/Projects/TempDataLogger/Lib/DS1307.c
index a85aa6176..270dbbaa9 100644
--- a/Projects/TempDataLogger/Lib/DS1307.c
+++ b/Projects/TempDataLogger/Lib/DS1307.c
@@ -1,6 +1,6 @@
/*
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -15,7 +15,7 @@ void DS1307_SetDate(const uint8_t Day,
return;
#endif
- DS1307_DateRegs_t CurrentRTCDate;
+ DS1307_DateRegs_t CurrentRTCDate;
CurrentRTCDate.Byte1.Fields.TenDay = (Day / 10);
CurrentRTCDate.Byte1.Fields.Day = (Day % 10);
CurrentRTCDate.Byte2.Fields.TenMonth = (Month / 10);
@@ -29,7 +29,7 @@ void DS1307_SetDate(const uint8_t Day,
TWI_SendByte(CurrentRTCDate.Byte1.IntVal);
TWI_SendByte(CurrentRTCDate.Byte2.IntVal);
TWI_SendByte(CurrentRTCDate.Byte3.IntVal);
-
+
TWI_StopTransmission();
}
}
@@ -51,18 +51,18 @@ void DS1307_SetTime(const uint8_t Hour,
CurrentRTCTime.Byte3.Fields.TenHour = (Hour / 10);
CurrentRTCTime.Byte3.Fields.Hour = (Hour % 10);
CurrentRTCTime.Byte3.Fields.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* const Day,
uint8_t* const Month,
uint8_t* const Year)
@@ -77,7 +77,7 @@ void DS1307_GetDate(uint8_t* const Day,
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
{
TWI_SendByte(DS1307_DATEREG_START);
-
+
TWI_StopTransmission();
}
@@ -88,7 +88,7 @@ void DS1307_GetDate(uint8_t* const Day,
TWI_ReceiveByte(&CurrentRTCDate.Byte1.IntVal, false);
TWI_ReceiveByte(&CurrentRTCDate.Byte2.IntVal, false);
TWI_ReceiveByte(&CurrentRTCDate.Byte3.IntVal, true);
-
+
TWI_StopTransmission();
}
@@ -111,10 +111,10 @@ void DS1307_GetTime(uint8_t* const Hour,
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))
@@ -122,7 +122,7 @@ void DS1307_GetTime(uint8_t* const Hour,
TWI_ReceiveByte(&CurrentRTCTime.Byte1.IntVal, false);
TWI_ReceiveByte(&CurrentRTCTime.Byte2.IntVal, false);
TWI_ReceiveByte(&CurrentRTCTime.Byte3.IntVal, true);
-
+
TWI_StopTransmission();
}
@@ -130,3 +130,4 @@ void DS1307_GetTime(uint8_t* const Hour,
*Minute = (CurrentRTCTime.Byte2.Fields.TenMin * 10) + CurrentRTCTime.Byte2.Fields.Min;
*Hour = (CurrentRTCTime.Byte3.Fields.TenHour * 10) + CurrentRTCTime.Byte3.Fields.Hour;
}
+
diff --git a/Projects/TempDataLogger/Lib/DS1307.h b/Projects/TempDataLogger/Lib/DS1307.h
index c9fe43c3d..3212dd3c9 100644
--- a/Projects/TempDataLogger/Lib/DS1307.h
+++ b/Projects/TempDataLogger/Lib/DS1307.h
@@ -1,6 +1,6 @@
/*
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -24,10 +24,10 @@
unsigned int TenSec : 3;
unsigned int CH : 1;
} Fields;
-
+
uint8_t IntVal;
} Byte1;
-
+
union
{
struct
@@ -36,10 +36,10 @@
unsigned int TenMin : 3;
unsigned int Reserved : 1;
} Fields;
-
+
uint8_t IntVal;
} Byte2;
-
+
union
{
struct
@@ -49,7 +49,7 @@
unsigned int TwelveHourMode : 1;
unsigned int Reserved : 1;
} Fields;
-
+
uint8_t IntVal;
} Byte3;
} DS1307_TimeRegs_t;
@@ -64,7 +64,7 @@
unsigned int TenDay : 2;
unsigned int Reserved : 2;
} Fields;
-
+
uint8_t IntVal;
} Byte1;
@@ -76,10 +76,10 @@
unsigned int TenMonth : 1;
unsigned int Reserved : 3;
} Fields;
-
+
uint8_t IntVal;
} Byte2;
-
+
union
{
struct
@@ -87,7 +87,7 @@
unsigned int Year : 4;
unsigned int TenYear : 4;
} Fields;
-
+
uint8_t IntVal;
} Byte3;
} DS1307_DateRegs_t;
@@ -95,7 +95,7 @@
/* Macros: */
#define DS1307_TIMEREG_START 0x00
#define DS1307_DATEREG_START 0x04
-
+
#define DS1307_ADDRESS_READ 0b11010001
#define DS1307_ADDRESS_WRITE 0b11010000
@@ -114,3 +114,4 @@
uint8_t* const Second);
#endif
+
diff --git a/Projects/TempDataLogger/Lib/DataflashManager.c b/Projects/TempDataLogger/Lib/DataflashManager.c
index 3cabda776..b7bc2f41c 100644
--- a/Projects/TempDataLogger/Lib/DataflashManager.c
+++ b/Projects/TempDataLogger/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -86,7 +86,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -125,7 +125,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -145,7 +145,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -154,9 +154,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -201,15 +201,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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))
{
@@ -218,12 +218,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* 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))
{
@@ -233,7 +233,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* 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);
@@ -241,7 +241,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -260,10 +260,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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++;
@@ -271,11 +271,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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();
@@ -315,11 +315,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* 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))
{
@@ -359,18 +359,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
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++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -416,7 +416,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -429,7 +429,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* 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);
@@ -437,19 +437,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
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--;
}
@@ -464,7 +464,7 @@ 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)
{
@@ -476,12 +476,12 @@ void DataflashManager_ResetDataflashProtections(void)
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)
{
@@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
+
diff --git a/Projects/TempDataLogger/Lib/DataflashManager.h b/Projects/TempDataLogger/Lib/DataflashManager.h
index 70dd88d21..cd1c460cd 100644
--- a/Projects/TempDataLogger/Lib/DataflashManager.h
+++ b/Projects/TempDataLogger/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "TempDataLogger.h"
#include "Descriptors.h"
@@ -60,12 +60,12 @@
* 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,
@@ -81,5 +81,6 @@
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ResetDataflashProtections(void);
bool DataflashManager_CheckDataflashOperation(void);
-
+
#endif
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/00readme.txt b/Projects/TempDataLogger/Lib/FATFs/00readme.txt
index a34c951c9..97951fc3d 100644
--- a/Projects/TempDataLogger/Lib/FATFs/00readme.txt
+++ b/Projects/TempDataLogger/Lib/FATFs/00readme.txt
@@ -115,3 +115,4 @@ REVISION HISTORY
Changed some types on the API, XCHAR->TCHAR.
Changed fname member in the FILINFO structure on Unicode cfg.
String functions support UTF-8 encoding files on Unicode cfg.
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/diskio.c b/Projects/TempDataLogger/Lib/FATFs/diskio.c
index 68c2aeb97..c18151284 100644
--- a/Projects/TempDataLogger/Lib/FATFs/diskio.c
+++ b/Projects/TempDataLogger/Lib/FATFs/diskio.c
@@ -97,3 +97,4 @@ DWORD get_fattime (void)
((DWORD)Minute << 5) |
(((DWORD)Second >> 1) << 0);
}
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/diskio.h b/Projects/TempDataLogger/Lib/FATFs/diskio.h
index 5feb82f83..3459da351 100644
--- a/Projects/TempDataLogger/Lib/FATFs/diskio.h
+++ b/Projects/TempDataLogger/Lib/FATFs/diskio.h
@@ -69,3 +69,4 @@ DRESULT disk_ioctl (BYTE, BYTE, void*);
#define _DISKIO
#endif
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/ff.c b/Projects/TempDataLogger/Lib/FATFs/ff.c
index 3da658e97..ab53ea598 100644
--- a/Projects/TempDataLogger/Lib/FATFs/ff.c
+++ b/Projects/TempDataLogger/Lib/FATFs/ff.c
@@ -2289,7 +2289,7 @@ FRESULT f_close (
#if _FS_REENTRANT
res = validate(fp->fs, fp->id);
if (res == FR_OK) {
- res = dec_lock(fp->fs, fp->lockid);
+ res = dec_lock(fp->fs, fp->lockid);
unlock_fs(fp->fs, FR_OK);
}
#else
@@ -3539,7 +3539,7 @@ int f_printf (
res++;
}
do {
- cc = f_putc(s[--i], fil);
+ cc = f_putc(s[--i], fil);
res++;
} while (i && cc != EOF);
if (cc != EOF) cc = 0;
@@ -3551,3 +3551,4 @@ int f_printf (
#endif /* !_FS_READONLY */
#endif /* _USE_STRFUNC */
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/ff.h b/Projects/TempDataLogger/Lib/FATFs/ff.h
index 19b6a15b6..c5a6a0b5e 100644
--- a/Projects/TempDataLogger/Lib/FATFs/ff.h
+++ b/Projects/TempDataLogger/Lib/FATFs/ff.h
@@ -611,3 +611,4 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
#endif
#endif /* _FATFS */
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/ffconf.h b/Projects/TempDataLogger/Lib/FATFs/ffconf.h
index a217b0bf8..48edc4aed 100644
--- a/Projects/TempDataLogger/Lib/FATFs/ffconf.h
+++ b/Projects/TempDataLogger/Lib/FATFs/ffconf.h
@@ -179,3 +179,4 @@
#endif /* _FFCONFIG */
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/integer.h b/Projects/TempDataLogger/Lib/FATFs/integer.h
index 1bc381cc0..c27d79d35 100644
--- a/Projects/TempDataLogger/Lib/FATFs/integer.h
+++ b/Projects/TempDataLogger/Lib/FATFs/integer.h
@@ -37,3 +37,4 @@ typedef unsigned char BOOL;
#endif
#endif
+
diff --git a/Projects/TempDataLogger/Lib/SCSI.c b/Projects/TempDataLogger/Lib/SCSI.c
index a98731957..5e2eec5d7 100644
--- a/Projects/TempDataLogger/Lib/SCSI.c
+++ b/Projects/TempDataLogger/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* 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 =
+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,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -96,13 +96,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -134,7 +134,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -165,11 +165,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
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, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -178,7 +178,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -193,7 +193,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
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);
@@ -221,10 +221,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
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;
-
+
return true;
}
@@ -248,21 +248,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* 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);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -280,13 +280,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
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(*(uint16_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)
{
@@ -297,7 +297,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
return false;
}
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -306,6 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Projects/TempDataLogger/Lib/SCSI.h b/Projects/TempDataLogger/Lib/SCSI.h
index f3aea7222..39c9aee46 100644
--- a/Projects/TempDataLogger/Lib/SCSI.h
+++ b/Projects/TempDataLogger/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -46,7 +46,7 @@
#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
@@ -68,13 +68,13 @@
/** 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 bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -83,5 +83,6 @@
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead);
#endif
-
+
#endif
+
diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c
index bf5fd3940..3d6a9e933 100644
--- a/Projects/TempDataLogger/TempDataLogger.c
+++ b/Projects/TempDataLogger/TempDataLogger.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -74,7 +74,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
.ReportINEndpointNumber = GENERIC_IN_EPNUM,
.ReportINEndpointSize = GENERIC_EPSIZE,
.ReportINEndpointDoubleBank = false,
-
+
.PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
},
@@ -104,12 +104,12 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
/* Check to see if the logging interval has expired */
if (CurrentLoggingTicks++ < LoggingInterval500MS_SRAM)
return;
-
+
/* Reset log tick counter to prepare for next logging interval */
CurrentLoggingTicks = 0;
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
/* Only log when not connected to a USB host */
if (USB_DeviceState == DEVICE_STATE_Unattached)
{
@@ -128,7 +128,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
f_write(&TempLogFile, LineBuffer, BytesWritten, &BytesWritten);
f_sync(&TempLogFile);
}
-
+
LEDs_SetAllLEDs(LEDMask);
}
@@ -141,7 +141,7 @@ int main(void)
/* Fetch logging interval from EEPROM */
LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);
-
+
/* Check if the logging interval is invalid (0xFF) indicating that the EEPROM is blank */
if (LoggingInterval500MS_SRAM == 0xFF)
LoggingInterval500MS_SRAM = DEFAULT_LOG_INTERVAL;
@@ -155,7 +155,7 @@ int main(void)
/* 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);
@@ -206,7 +206,7 @@ void SetupHardware(void)
Dataflash_Init();
USB_Init();
TWI_Init();
-
+
/* 500ms logging interval timer configuration */
OCR1A = ((F_CPU / 1024) / 2);
TCCR1B = (1 << WGM12) | (1 << CS12) | (1 << CS10);
@@ -229,7 +229,7 @@ void EVENT_USB_Device_Connect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-
+
/* Mount and open the log file on the Dataflash FAT partition */
OpenLogFile();
}
@@ -259,18 +259,18 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
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
+ * \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 HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
* \param[out] ReportData Pointer to a buffer where the created report should be stored
@@ -288,7 +288,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
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);
@@ -310,10 +310,10 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
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)
{
@@ -321,3 +321,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
eeprom_update_byte(&LoggingInterval500MS_EEPROM, LoggingInterval500MS_SRAM);
}
}
+
diff --git a/Projects/TempDataLogger/TempDataLogger.h b/Projects/TempDataLogger/TempDataLogger.h
index 45cb3bec1..ce79670a2 100644
--- a/Projects/TempDataLogger/TempDataLogger.h
+++ b/Projects/TempDataLogger/TempDataLogger.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdio.h>
-
+
#include "Descriptors.h"
#include "Lib/SCSI.h"
@@ -73,13 +73,13 @@
/** 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"
-
+
/** Default log interval when the EEPROM is blank, in 500ms ticks. */
#define DEFAULT_LOG_INTERVAL 20
-
+
/* Type Defines: */
typedef struct
{
@@ -90,7 +90,7 @@
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
-
+
uint8_t LogInterval500MS;
} Device_Report_t;
@@ -111,9 +111,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt b/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt
index fc8a5de7e..bdf8db0ee 100644
--- a/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt
+++ b/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 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
@@ -111,7 +111,7 @@ the following:
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.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,3 +163,4 @@ 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/TempDataLogger/TempLogHostApp/COPYING.txt b/Projects/TempDataLogger/TempLogHostApp/COPYING.txt
index 94a9ed024..10926e87f 100644
--- a/Projects/TempDataLogger/TempLogHostApp/COPYING.txt
+++ b/Projects/TempDataLogger/TempLogHostApp/COPYING.txt
@@ -672,3 +672,4 @@ 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/TempDataLogger/TempLogHostApp/README.txt b/Projects/TempDataLogger/TempLogHostApp/README.txt
index 34f85533e..60387afe7 100644
--- a/Projects/TempDataLogger/TempLogHostApp/README.txt
+++ b/Projects/TempDataLogger/TempLogHostApp/README.txt
@@ -19,3 +19,4 @@ 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/TempDataLogger/TemperatureDataLogger.txt b/Projects/TempDataLogger/TemperatureDataLogger.txt
index 1bf38dc7e..41fb2c320 100644
--- a/Projects/TempDataLogger/TemperatureDataLogger.txt
+++ b/Projects/TempDataLogger/TemperatureDataLogger.txt
@@ -3,7 +3,7 @@
* 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:
@@ -28,7 +28,7 @@
* <td>Mass Storage Device \n
* Human Interface Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclasses:</b></td>
* <td>Bulk-Only Transport \n
* Keyboard Subclass</td>
@@ -47,7 +47,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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
@@ -83,3 +83,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/TempDataLogger/makefile b/Projects/TempDataLogger/makefile
index 9f4942251..ec0153f5f 100644
--- a/Projects/TempDataLogger/makefile
+++ b/Projects/TempDataLogger/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -146,7 +146,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -159,7 +159,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -273,7 +273,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -286,7 +286,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -298,7 +298,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -310,7 +310,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -333,7 +333,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -367,7 +367,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -401,7 +401,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -430,7 +430,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -449,10 +449,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -517,11 +517,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -548,9 +548,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -648,14 +648,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -677,7 +677,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -721,3 +721,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/USBtoSerial/Descriptors.c b/Projects/USBtoSerial/Descriptors.c
index d42235dd4..630a5aa0e 100644
--- a/Projects/USBtoSerial/Descriptors.c
+++ b/Projects/USBtoSerial/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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 =
+
+ .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_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.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 =
+ .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 =
+ .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 =
+
+ .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,
@@ -193,7 +193,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -204,7 +204,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -215,7 +215,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA USB-RS232 Adapter"
};
@@ -237,34 +237,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &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 787796bc8..ddd9495ea 100644
--- a/Projects/USBtoSerial/Descriptors.h
+++ b/Projects/USBtoSerial/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -47,16 +47,16 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #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
+ #define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/USBtoSerial/Lib/LightweightRingBuff.h b/Projects/USBtoSerial/Lib/LightweightRingBuff.h
index 768e49a50..2fbc164cb 100644
--- a/Projects/USBtoSerial/Lib/LightweightRingBuff.h
+++ b/Projects/USBtoSerial/Lib/LightweightRingBuff.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,20 +39,20 @@
* or deletions) must not overlap. If there is possibility of two or more of the same kind of
* operating occuring at the same point in time, atomic (mutex) locking should be used.
*/
-
+
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
-
+
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 255
-
+
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
@@ -76,7 +76,7 @@
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
-
+
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
@@ -92,7 +92,7 @@
Buffer->Out = Buffer->Buffer;
}
}
-
+
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
@@ -109,15 +109,15 @@
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
-
+
return Count;
}
-
+
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
@@ -125,7 +125,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
@@ -142,7 +142,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -161,7 +161,7 @@
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
-
+
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
@@ -184,7 +184,7 @@
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
-
+
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
@@ -192,8 +192,9 @@
{
Buffer->Count--;
}
-
+
return Data;
}
#endif
+
diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c
index 845c2a51c..05b4f8aff 100644
--- a/Projects/USBtoSerial/USBtoSerial.c
+++ b/Projects/USBtoSerial/USBtoSerial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,7 +48,7 @@ RingBuff_t USARTtoUSB_Buffer;
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
- .Config =
+ .Config =
{
.ControlInterfaceNumber = 0,
@@ -72,7 +72,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
int main(void)
{
SetupHardware();
-
+
RingBuffer_InitBuffer(&USBtoUSART_Buffer);
RingBuffer_InitBuffer(&USARTtoUSB_Buffer);
@@ -84,8 +84,8 @@ int main(void)
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUSART_Buffer)))
- RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
-
+ RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
+
/* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */
RingBuff_Count_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer);
if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200))
@@ -96,11 +96,11 @@ int main(void)
while (BufferCount--)
CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_Remove(&USARTtoUSB_Buffer));
}
-
+
/* Load the next byte from the USART transmit buffer into the USART */
if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer)))
Serial_TxByte(RingBuffer_Remove(&USBtoUSART_Buffer));
-
+
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
@@ -174,10 +174,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
{
case CDC_PARITY_Odd:
- ConfigMask = ((1 << UPM11) | (1 << UPM10));
+ ConfigMask = ((1 << UPM11) | (1 << UPM10));
break;
case CDC_PARITY_Even:
- ConfigMask = (1 << UPM11);
+ ConfigMask = (1 << UPM11);
break;
}
@@ -204,9 +204,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
/* Set the new baud rate before configuring the USART */
UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
-
+
/* Reconfigure the USART in double speed mode for a wider baud rate range at the expense of accuracy */
UCSR1C = ConfigMask;
UCSR1A = (1 << U2X1);
UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
}
+
diff --git a/Projects/USBtoSerial/USBtoSerial.h b/Projects/USBtoSerial/USBtoSerial.h
index b3c3e9846..9233ba203 100644
--- a/Projects/USBtoSerial/USBtoSerial.h
+++ b/Projects/USBtoSerial/USBtoSerial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,7 +64,7 @@
/** 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);
@@ -72,7 +72,8 @@
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 7f5644296..30a2833a5 100644
--- a/Projects/USBtoSerial/USBtoSerial.txt
+++ b/Projects/USBtoSerial/USBtoSerial.txt
@@ -3,7 +3,7 @@
* 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:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -42,7 +42,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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
@@ -54,7 +54,7 @@
* 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
@@ -80,3 +80,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/USBtoSerial/makefile b/Projects/USBtoSerial/makefile
index a30b0fc1e..7fb678d05 100644
--- a/Projects/USBtoSerial/makefile
+++ b/Projects/USBtoSerial/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -133,10 +133,10 @@ SRC = $(TARGET).c \
Descriptors.c \
$(LUFA_SRC_USB) \
$(LUFA_SRC_USBCLASS)
-
+
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -149,7 +149,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -263,7 +263,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -276,7 +276,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -288,7 +288,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -300,7 +300,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -323,7 +323,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -357,7 +357,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -391,7 +391,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -420,7 +420,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -439,10 +439,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -507,11 +507,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -538,9 +538,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -638,14 +638,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -667,7 +667,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -711,3 +711,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c
index 7578a598b..e92596139 100644
--- a/Projects/Webserver/Descriptors.c
+++ b/Projects/Webserver/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,38 +83,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .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 =
+
+ .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 =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -124,7 +124,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -142,7 +142,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -153,7 +153,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -164,7 +164,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Webserver"
};
@@ -186,34 +186,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &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 1b40df159..c816e2383 100644
--- a/Projects/Webserver/Descriptors.h
+++ b/Projects/Webserver/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -44,15 +44,15 @@
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* 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.
@@ -64,7 +64,7 @@
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,
@@ -72,3 +72,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Webserver/Lib/DHCPClientApp.c b/Projects/Webserver/Lib/DHCPClientApp.c
index 2260b5089..da11fa6b8 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.c
+++ b/Projects/Webserver/Lib/DHCPClientApp.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,13 +44,13 @@ 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;
@@ -58,8 +58,8 @@ void DHCPClientApp_Init(void)
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
+
+/** 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)
@@ -67,7 +67,7 @@ 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:
@@ -77,19 +77,19 @@ void DHCPClientApp_Callback(void)
/* 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);
-
+ 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;
-
+ AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForOffer;
+
break;
case DHCP_STATE_WaitForOffer:
if (!(uip_newdata()))
@@ -97,10 +97,10 @@ void DHCPClientApp_Callback(void)
/* 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) &&
@@ -111,7 +111,7 @@ void DHCPClientApp_Callback(void)
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;
}
@@ -131,7 +131,7 @@ void DHCPClientApp_Callback(void)
/* 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;
@@ -143,10 +143,10 @@ void DHCPClientApp_Callback(void)
/* 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) &&
@@ -156,13 +156,13 @@ void DHCPClientApp_Callback(void)
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;
+ AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
}
-
+
break;
}
}
@@ -196,13 +196,13 @@ static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
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);
}
@@ -231,7 +231,7 @@ static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList,
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);
}
@@ -256,16 +256,17 @@ static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList,
{
/* 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 710f4b61a..e305f932a 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.h
+++ b/Projects/Webserver/Lib/DHCPClientApp.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,11 +38,11 @@
/* Includes: */
#include <stdio.h>
-
+
#include <uip.h>
-
+
#include "../Webserver.h"
-
+
/* Macros: */
/** UDP listen port for a BOOTP server. */
#define DHCPC_SERVER_PORT 67
@@ -58,10 +58,10 @@
/** 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
@@ -106,8 +106,8 @@
/** DHCP message option for the DHCP message type. */
#define DHCP_OPTION_MSG_TYPE 53
-
- /** DHCP message option for the DHCP server IP. */
+
+ /** 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. */
@@ -129,18 +129,18 @@
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;
@@ -158,7 +158,7 @@
/* 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,
@@ -172,3 +172,4 @@
void* const Destination);
#endif
#endif
+
diff --git a/Projects/Webserver/Lib/DataflashManager.c b/Projects/Webserver/Lib/DataflashManager.c
index 3cabda776..b7bc2f41c 100644
--- a/Projects/Webserver/Lib/DataflashManager.c
+++ b/Projects/Webserver/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -86,7 +86,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -125,7 +125,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -145,7 +145,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -154,9 +154,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -201,15 +201,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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))
{
@@ -218,12 +218,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* 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))
{
@@ -233,7 +233,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* 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);
@@ -241,7 +241,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -260,10 +260,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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++;
@@ -271,11 +271,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
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();
@@ -315,11 +315,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* 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))
{
@@ -359,18 +359,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
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++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -416,7 +416,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -429,7 +429,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* 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);
@@ -437,19 +437,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
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--;
}
@@ -464,7 +464,7 @@ 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)
{
@@ -476,12 +476,12 @@ void DataflashManager_ResetDataflashProtections(void)
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)
{
@@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
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 20f21c65d..3351922ab 100644
--- a/Projects/Webserver/Lib/DataflashManager.h
+++ b/Projects/Webserver/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* 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>
@@ -59,12 +59,12 @@
* 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,
@@ -80,5 +80,6 @@
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 a34c951c9..97951fc3d 100644
--- a/Projects/Webserver/Lib/FATFs/00readme.txt
+++ b/Projects/Webserver/Lib/FATFs/00readme.txt
@@ -115,3 +115,4 @@ REVISION HISTORY
Changed some types on the API, XCHAR->TCHAR.
Changed fname member in the FILINFO structure on Unicode cfg.
String functions support UTF-8 encoding files on Unicode cfg.
+
diff --git a/Projects/Webserver/Lib/FATFs/diskio.c b/Projects/Webserver/Lib/FATFs/diskio.c
index 59ec70765..64daad9cd 100644
--- a/Projects/Webserver/Lib/FATFs/diskio.c
+++ b/Projects/Webserver/Lib/FATFs/diskio.c
@@ -62,3 +62,4 @@ DRESULT disk_write (
return RES_OK;
}
#endif /* _READONLY */
+
diff --git a/Projects/Webserver/Lib/FATFs/diskio.h b/Projects/Webserver/Lib/FATFs/diskio.h
index 81044d12e..fc18b9a50 100644
--- a/Projects/Webserver/Lib/FATFs/diskio.h
+++ b/Projects/Webserver/Lib/FATFs/diskio.h
@@ -70,3 +70,4 @@ DRESULT disk_ioctl (BYTE, BYTE, void*);
#define _DISKIO
#endif
+
diff --git a/Projects/Webserver/Lib/FATFs/ff.c b/Projects/Webserver/Lib/FATFs/ff.c
index 31340df89..cb2b42508 100644
--- a/Projects/Webserver/Lib/FATFs/ff.c
+++ b/Projects/Webserver/Lib/FATFs/ff.c
@@ -2289,7 +2289,7 @@ FRESULT f_close (
#if _FS_REENTRANT
res = validate(fp->fs, fp->id);
if (res == FR_OK) {
- res = dec_lock(fp->fs, fp->lockid);
+ res = dec_lock(fp->fs, fp->lockid);
unlock_fs(fp->fs, FR_OK);
}
#else
@@ -3539,7 +3539,7 @@ int f_printf (
res++;
}
do {
- cc = f_putc(s[--i], fil);
+ cc = f_putc(s[--i], fil);
res++;
} while (i && cc != EOF);
if (cc != EOF) cc = 0;
@@ -3551,3 +3551,4 @@ int f_printf (
#endif /* !_FS_READONLY */
#endif /* _USE_STRFUNC */
+
diff --git a/Projects/Webserver/Lib/FATFs/ff.h b/Projects/Webserver/Lib/FATFs/ff.h
index 19b6a15b6..c5a6a0b5e 100644
--- a/Projects/Webserver/Lib/FATFs/ff.h
+++ b/Projects/Webserver/Lib/FATFs/ff.h
@@ -611,3 +611,4 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
#endif
#endif /* _FATFS */
+
diff --git a/Projects/Webserver/Lib/FATFs/ffconf.h b/Projects/Webserver/Lib/FATFs/ffconf.h
index c28694af1..491a97b1e 100644
--- a/Projects/Webserver/Lib/FATFs/ffconf.h
+++ b/Projects/Webserver/Lib/FATFs/ffconf.h
@@ -179,3 +179,4 @@
#endif /* _FFCONFIG */
+
diff --git a/Projects/Webserver/Lib/FATFs/integer.h b/Projects/Webserver/Lib/FATFs/integer.h
index 1bc381cc0..c27d79d35 100644
--- a/Projects/Webserver/Lib/FATFs/integer.h
+++ b/Projects/Webserver/Lib/FATFs/integer.h
@@ -37,3 +37,4 @@ typedef unsigned char BOOL;
#endif
#endif
+
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
index 6378ebe44..3ab3003d0 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.c
+++ b/Projects/Webserver/Lib/HTTPServerApp.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* 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"
@@ -86,7 +86,7 @@ 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);
}
@@ -127,7 +127,7 @@ void HTTPServerApp_Callback(void)
if (uip_rexmit())
{
/* Return file pointer to the last ACKed position */
- f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
+ f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
}
if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
@@ -147,15 +147,15 @@ void HTTPServerApp_Callback(void)
/* 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
@@ -165,27 +165,27 @@ 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);
@@ -198,7 +198,7 @@ static void HTTPServerApp_OpenRequestedFile(void)
/* 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);
@@ -224,13 +224,13 @@ static void HTTPServerApp_SendResponseHeader(void)
{
/* 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);
+ 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);
@@ -242,11 +242,11 @@ static void HTTPServerApp_SendResponseHeader(void)
{
if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
{
- strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
+ strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
FoundMIMEType = true;
break;
}
- }
+ }
}
/* Check if a MIME type was found and copied to the output buffer */
@@ -255,13 +255,13 @@ static void HTTPServerApp_SendResponseHeader(void)
/* 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;
}
@@ -279,11 +279,12 @@ static void HTTPServerApp_SendData(void)
/* 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 b30922a76..8991b9445 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.h
+++ b/Projects/Webserver/Lib/HTTPServerApp.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,12 +39,12 @@
/* 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
@@ -55,7 +55,7 @@
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
@@ -63,7 +63,7 @@
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
@@ -71,11 +71,12 @@
/* 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 a98731957..5e2eec5d7 100644
--- a/Projects/Webserver/Lib/SCSI.c
+++ b/Projects/Webserver/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* 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 =
+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,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -96,13 +96,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -134,7 +134,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -165,11 +165,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
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, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -178,7 +178,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -193,7 +193,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
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);
@@ -221,10 +221,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
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;
-
+
return true;
}
@@ -248,21 +248,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* 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);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -280,13 +280,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
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(*(uint16_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)
{
@@ -297,7 +297,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
return false;
}
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -306,6 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Projects/Webserver/Lib/SCSI.h b/Projects/Webserver/Lib/SCSI.h
index 01afd373e..2ff6d05dc 100644
--- a/Projects/Webserver/Lib/SCSI.h
+++ b/Projects/Webserver/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -45,7 +45,7 @@
#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
@@ -67,13 +67,13 @@
/** 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 bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -82,5 +82,6 @@
static bool 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 da9108676..eed24c801 100644
--- a/Projects/Webserver/Lib/TELNETServerApp.c
+++ b/Projects/Webserver/Lib/TELNETServerApp.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,7 +35,7 @@
* 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"
@@ -50,7 +50,7 @@ const char PROGMEM TELNETMenu[] = "\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";
@@ -78,7 +78,7 @@ void TELNETServerApp_Callback(void)
if (uip_acked())
{
/* Progress to the next state once the current state's data has been ACKed */
- AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
+ AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
}
if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
@@ -89,14 +89,14 @@ void TELNETServerApp_Callback(void)
/* 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:
@@ -105,7 +105,7 @@ void TELNETServerApp_Callback(void)
/* Save the issued command for later processing */
AppState->TELNETServer.IssuedCommand = AppData[0];
-
+
AppState->TELNETServer.CurrentState = TELNET_STATE_SendResponse;
break;
case TELNET_STATE_SendResponse:
@@ -124,7 +124,7 @@ void TELNETServerApp_Callback(void)
AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
break;
}
- }
+ }
}
/** Sends a list of active TCP connections to the TELNET client. */
@@ -133,7 +133,7 @@ static void TELNETServerApp_DisplayTCPConnections(void)
char* const AppData = (char*)uip_appdata;
strcpy_P(AppData, CurrentConnectionsHeader);
-
+
uint16_t ResponseLen = strlen(AppData);
uint8_t ActiveConnCount = 0;
@@ -141,7 +141,7 @@ static void TELNETServerApp_DisplayTCPConnections(void)
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)
{
@@ -160,3 +160,4 @@ static void TELNETServerApp_DisplayTCPConnections(void)
}
#endif
+
diff --git a/Projects/Webserver/Lib/TELNETServerApp.h b/Projects/Webserver/Lib/TELNETServerApp.h
index 80d48af3b..abd90fbba 100644
--- a/Projects/Webserver/Lib/TELNETServerApp.h
+++ b/Projects/Webserver/Lib/TELNETServerApp.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,13 +40,13 @@
#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
@@ -55,14 +55,15 @@
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 1270e18df..2c60d74e6 100644
--- a/Projects/Webserver/Lib/uIPManagement.c
+++ b/Projects/Webserver/Lib/uIPManagement.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@ void uIPManagement_Init(void)
/* uIP Timing Initialization */
clock_init();
timer_set(&ConnectionTimer, CLOCK_SECOND / 2);
- timer_set(&ARPTimer, CLOCK_SECOND * 10);
+ timer_set(&ARPTimer, CLOCK_SECOND * 10);
/* uIP Stack Initialization */
uip_init();
@@ -75,10 +75,10 @@ void uIPManagement_Init(void)
uip_setnetmask(&Netmask);
uip_setdraddr(&GatewayIPAddress);
#endif
-
+
/* HTTP Webserver Initialization */
HTTPServerApp_Init();
-
+
/* TELNET Server Initialization */
#if defined(ENABLE_TELNET_SERVER)
TELNETServerApp_Init();
@@ -136,7 +136,7 @@ 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 */
@@ -162,16 +162,16 @@ static void uIPManagement_ProcessIncomingPacket(void)
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;
}
}
@@ -204,7 +204,7 @@ static void uIPManagement_ManageConnections(void)
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 */
@@ -220,7 +220,7 @@ static void uIPManagement_ManageConnections(void)
uip_split_output();
}
}
-
+
#if defined(ENABLE_DHCP_CLIENT)
for (uint8_t i = 0; i < UIP_UDP_CONNS; i++)
{
@@ -249,3 +249,4 @@ static void uIPManagement_ManageConnections(void)
uip_arp_timer();
}
}
+
diff --git a/Projects/Webserver/Lib/uIPManagement.h b/Projects/Webserver/Lib/uIPManagement.h
index 37c54e9ad..f5ac26e55 100644
--- a/Projects/Webserver/Lib/uIPManagement.h
+++ b/Projects/Webserver/Lib/uIPManagement.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,18 +43,18 @@
#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).
*/
@@ -62,18 +62,19 @@
/* 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 046b6e344..86322966e 100644
--- a/Projects/Webserver/Lib/uip/clock.c
+++ b/Projects/Webserver/Lib/uip/clock.c
@@ -36,3 +36,4 @@ clock_time_t clock_time()
return time;
}
+
diff --git a/Projects/Webserver/Lib/uip/clock.h b/Projects/Webserver/Lib/uip/clock.h
index 05d30386b..bbfa4ac0e 100644
--- a/Projects/Webserver/Lib/uip/clock.h
+++ b/Projects/Webserver/Lib/uip/clock.h
@@ -10,3 +10,4 @@ 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 3c5fd202e..0e5e59147 100644
--- a/Projects/Webserver/Lib/uip/timer.c
+++ b/Projects/Webserver/Lib/uip/timer.c
@@ -125,3 +125,4 @@ timer_expired(struct timer *t)
/*---------------------------------------------------------------------------*/
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/timer.h b/Projects/Webserver/Lib/uip/timer.h
index 057bea49c..04917e4c5 100644
--- a/Projects/Webserver/Lib/uip/timer.h
+++ b/Projects/Webserver/Lib/uip/timer.h
@@ -84,3 +84,4 @@ 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 5fac6d53b..87dbd7e1f 100644
--- a/Projects/Webserver/Lib/uip/uip-split.c
+++ b/Projects/Webserver/Lib/uip/uip-split.c
@@ -47,7 +47,7 @@ uip_split_output(void)
/* 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. */
@@ -68,7 +68,7 @@ uip_split_output(void)
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());
@@ -78,14 +78,14 @@ uip_split_output(void)
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
@@ -101,7 +101,7 @@ uip_split_output(void)
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);
@@ -109,7 +109,7 @@ uip_split_output(void)
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());
@@ -139,3 +139,4 @@ uip_split_output(void)
}
/*-----------------------------------------------------------------------------*/
+
diff --git a/Projects/Webserver/Lib/uip/uip-split.h b/Projects/Webserver/Lib/uip/uip-split.h
index c7274c36a..2243355d6 100644
--- a/Projects/Webserver/Lib/uip/uip-split.h
+++ b/Projects/Webserver/Lib/uip/uip-split.h
@@ -1,33 +1,33 @@
/*
* Copyright (c) 2004, Swedish Institute of Computer Science.
- * All rights reserved.
+ * 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.
+ * 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 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 $
@@ -63,7 +63,7 @@
/**
* \file
* Module for splitting outbound TCP segments in two to avoid the
- * delayed ACK throughput degradation.
+ * delayed ACK throughput degradation.
* \author
* Adam Dunkels <adam@sics.se>
*
@@ -101,3 +101,4 @@ void uip_add32(u8_t *op32, u16_t op16);
/** @} */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip.c b/Projects/Webserver/Lib/uip/uip.c
index 36053029a..afa19f750 100644
--- a/Projects/Webserver/Lib/uip/uip.c
+++ b/Projects/Webserver/Lib/uip/uip.c
@@ -245,15 +245,15 @@ uip_add32(u8_t *op32, u16_t op16)
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) {
@@ -278,7 +278,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
dataptr = data;
last_byte = data + len - 1;
-
+
while(dataptr < last_byte) { /* At least two more bytes */
t = (dataptr[0] << 8) + dataptr[1];
sum += t;
@@ -287,7 +287,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
}
dataptr += 2;
}
-
+
if(dataptr == last_byte) {
t = (dataptr[0] << 8) + 0;
sum += t;
@@ -323,15 +323,15 @@ 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. */
@@ -340,7 +340,7 @@ upper_layer_chksum(u8_t proto)
/* 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);
}
/*---------------------------------------------------------------------------*/
@@ -349,7 +349,7 @@ u16_t
uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
-
+
}
#endif /* UIP_CONF_IPV6 */
/*---------------------------------------------------------------------------*/
@@ -386,7 +386,7 @@ uip_init(void)
uip_udp_conns[c].lport = 0;
}
#endif /* UIP_UDP */
-
+
/* IPv4 initialization. */
#if UIP_FIXEDADDR == 0
@@ -400,7 +400,7 @@ 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;
@@ -437,7 +437,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
if(conn == 0) {
return 0;
}
-
+
conn->tcpstateflags = UIP_SYN_SENT;
conn->snd_nxt[0] = iss[0];
@@ -446,7 +446,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
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. */
@@ -456,7 +456,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
conn->lport = htons(lastport);
conn->rport = rport;
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
-
+
return conn;
}
#endif /* UIP_ACTIVE_OPEN */
@@ -466,7 +466,7 @@ 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;
@@ -474,7 +474,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
if(lastport >= 32000) {
lastport = 4096;
}
-
+
for(c = 0; c < UIP_UDP_CONNS; ++c) {
if(uip_udp_conns[c].lport == htons(lastport)) {
goto again;
@@ -493,7 +493,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
if(conn == 0) {
return 0;
}
-
+
conn->lport = HTONS(lastport);
conn->rport = rport;
if(ripaddr == NULL) {
@@ -502,7 +502,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
}
conn->ttl = UIP_TTL;
-
+
return conn;
}
#endif /* UIP_UDP */
@@ -587,12 +587,12 @@ uip_reass(void)
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];
@@ -608,7 +608,7 @@ uip_reass(void)
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
@@ -619,7 +619,7 @@ uip_reass(void)
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. */
@@ -681,7 +681,7 @@ uip_process(u8_t flag)
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
@@ -695,7 +695,7 @@ uip_process(u8_t flag)
goto appsend;
}
goto drop;
-
+
/* Check if we were invoked because of the periodic timer firing. */
} else if(flag == UIP_TIMER) {
#if UIP_REASSEMBLY
@@ -754,7 +754,7 @@ uip_process(u8_t flag)
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
@@ -767,14 +767,14 @@ uip_process(u8_t flag)
/* 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
@@ -783,19 +783,19 @@ uip_process(u8_t flag)
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_len = uip_slen = 0;
uip_flags = UIP_POLL;
UIP_APPCALL();
goto appsend;
@@ -822,7 +822,7 @@ uip_process(u8_t flag)
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. */
@@ -840,7 +840,7 @@ uip_process(u8_t flag)
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
@@ -910,7 +910,7 @@ uip_process(u8_t flag)
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)) {
@@ -1028,14 +1028,14 @@ uip_process(u8_t flag)
/* 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 solicitation 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;
@@ -1043,9 +1043,9 @@ uip_process(u8_t flag)
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) {
@@ -1054,12 +1054,12 @@ uip_process(u8_t flag)
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 {
@@ -1071,7 +1071,7 @@ uip_process(u8_t flag)
}
/* End of IPv6 ICMP processing. */
-
+
#endif /* !UIP_CONF_IPV6 */
#if UIP_UDP
@@ -1147,7 +1147,7 @@ uip_process(u8_t flag)
#else /* UIP_CONF_ICMP_DEST_UNREACH */
goto drop;
#endif /* UIP_CONF_ICMP_DEST_UNREACH */
-
+
udp_found:
uip_conn = NULL;
uip_flags = UIP_NEWDATA;
@@ -1182,7 +1182,7 @@ uip_process(u8_t flag)
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
@@ -1192,16 +1192,16 @@ uip_process(u8_t flag)
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);
@@ -1209,7 +1209,7 @@ uip_process(u8_t flag)
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];
@@ -1229,7 +1229,7 @@ uip_process(u8_t flag)
if((BUF->flags & TCP_CTL) != TCP_SYN) {
goto reset;
}
-
+
tmp16 = BUF->destport;
/* Next, check listening connections. */
for(c = 0; c < UIP_LISTENPORTS; ++c) {
@@ -1237,7 +1237,7 @@ uip_process(u8_t flag)
goto found_listen;
}
}
-
+
/* No matching connection found, so we send a RST packet. */
UIP_STAT(++uip_stat.tcp.synrst);
@@ -1248,7 +1248,7 @@ uip_process(u8_t flag)
}
UIP_STAT(++uip_stat.tcp.rst);
-
+
BUF->flags = TCP_RST | TCP_ACK;
uip_len = UIP_IPTCPH_LEN;
BUF->tcpoffset = 5 << 4;
@@ -1257,15 +1257,15 @@ uip_process(u8_t flag)
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;
@@ -1280,16 +1280,16 @@ uip_process(u8_t flag)
}
}
}
-
+
/* 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;
@@ -1326,7 +1326,7 @@ uip_process(u8_t flag)
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;
@@ -1367,7 +1367,7 @@ uip_process(u8_t flag)
(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 {
@@ -1382,19 +1382,19 @@ uip_process(u8_t flag)
}
}
}
-
+
/* 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;
@@ -1458,7 +1458,7 @@ uip_process(u8_t flag)
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;
@@ -1482,7 +1482,7 @@ uip_process(u8_t flag)
/* Reset length of outstanding data. */
uip_connr->len = 0;
}
-
+
}
/* Do different things depending on in what state the connection is. */
@@ -1570,7 +1570,7 @@ uip_process(u8_t flag)
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
@@ -1672,7 +1672,7 @@ uip_process(u8_t flag)
UIP_APPCALL();
appsend:
-
+
if(uip_flags & UIP_ABORT) {
uip_slen = 0;
uip_connr->tcpstateflags = UIP_CLOSED;
@@ -1724,7 +1724,7 @@ uip_process(u8_t flag)
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) {
@@ -1753,7 +1753,7 @@ uip_process(u8_t flag)
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
@@ -1782,7 +1782,7 @@ uip_process(u8_t flag)
goto tcp_send_ack;
}
goto drop;
-
+
case UIP_FIN_WAIT_2:
if(uip_len > 0) {
uip_add_rcv_nxt(uip_len);
@@ -1802,7 +1802,7 @@ uip_process(u8_t flag)
case UIP_TIME_WAIT:
goto tcp_send_ack;
-
+
case UIP_CLOSING:
if(uip_flags & UIP_ACKDATA) {
uip_connr->tcpstateflags = UIP_TIME_WAIT;
@@ -1810,7 +1810,7 @@ uip_process(u8_t flag)
}
}
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:
@@ -1831,14 +1831,14 @@ uip_process(u8_t flag)
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;
@@ -1867,7 +1867,7 @@ uip_process(u8_t flag)
#endif /* UIP_CONF_IPV6 */
BUF->urgp[0] = BUF->urgp[1] = 0;
-
+
/* Calculate TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());
@@ -1888,14 +1888,14 @@ uip_process(u8_t flag)
BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum());
DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());
-#endif /* UIP_CONF_IPV6 */
+#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;
@@ -1936,3 +1936,4 @@ uip_send(const void *data, int len)
/*---------------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */
+
diff --git a/Projects/Webserver/Lib/uip/uip.h b/Projects/Webserver/Lib/uip/uip.h
index 83a08a8a0..10f20de6b 100644
--- a/Projects/Webserver/Lib/uip/uip.h
+++ b/Projects/Webserver/Lib/uip/uip.h
@@ -145,7 +145,7 @@ typedef struct uip_eth_addr uip_lladdr_t;
uip_ipaddr(&addr, 192,168,1,2);
uip_sethostaddr(&addr);
-
+
\endcode
* \param addr A pointer to an IP address of type uip_ipaddr_t;
*
@@ -805,7 +805,7 @@ void uip_send(const void *data, int len);
\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) {
@@ -866,7 +866,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* These functions can be used for converting between different data
* formats used by uIP.
*/
-
+
/**
* Convert an IP address to four bytes separated by commas.
*
@@ -892,7 +892,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
\code
uip_ipaddr_t ipaddr;
struct uip_conn *c;
-
+
uip_ipaddr(&ipaddr, 192,168,1,2);
c = uip_connect(&ipaddr, HTONS(80));
\endcode
@@ -1281,11 +1281,11 @@ extern u16_t uip_urglen, uip_surglen;
*/
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
@@ -1398,7 +1398,7 @@ struct uip_stats {
layer. */
uip_stats_t sent; /**< Number of sent packets at the IP
layer. */
- uip_stats_t forwarded;/**< Number of forwarded packets at the IP
+ uip_stats_t forwarded;/**< Number of forwarded packets at the IP
layer. */
uip_stats_t drop; /**< Number of dropped packets at the IP
layer. */
@@ -1527,14 +1527,14 @@ uip_ext_hdr_options_process(); */
* 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
@@ -1561,7 +1561,7 @@ void uip_process(u8_t flag);
#define UIP_TIME_WAIT 7
#define UIP_LAST_ACK 8
#define UIP_TS_MASK 15
-
+
#define UIP_STOPPED 16
/* The TCP and IP headers. */
@@ -1586,7 +1586,7 @@ struct uip_tcpip_hdr {
u16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
-
+
/* TCP header. */
u16_t srcport,
destport;
@@ -1622,7 +1622,7 @@ struct uip_icmpip_hdr {
u16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
-
+
/* ICMP header. */
u8_t type, icode;
u16_t icmpchksum;
@@ -1655,7 +1655,7 @@ struct uip_udpip_hdr {
u16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
-
+
/* UDP header. */
u16_t srcport,
destport;
@@ -2023,7 +2023,7 @@ extern uip_lladdr_t uip_lladdr;
(((a)->u8[13]) == (m)->addr[3]) && \
(((a)->u8[14]) == (m)->addr[4]) && \
(((a)->u8[15]) == (m)->addr[5]))
-
+
#endif /*UIP_CONF_LL_802154*/
/**
@@ -2127,3 +2127,4 @@ u16_t uip_icmp6chksum(void);
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip_arp.c b/Projects/Webserver/Lib/uip/uip_arp.c
index b7e3b7342..fcb783b14 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.c
+++ b/Projects/Webserver/Lib/uip/uip_arp.c
@@ -16,7 +16,7 @@
*
* \note This ARP implementation only supports Ethernet.
*/
-
+
/**
* \file
* Implementation of the ARP Address Resolution Protocol.
@@ -150,7 +150,7 @@ void
uip_arp_timer(void)
{
struct arp_entry *tabptr = NULL;
-
+
++arptime;
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
@@ -178,7 +178,7 @@ uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr)
/* 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;
@@ -240,7 +240,7 @@ 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]) !=
@@ -252,7 +252,7 @@ uip_arp_ipin(void)
return;
}
uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
-
+
return;
}
#endif /* 0 */
@@ -287,7 +287,7 @@ uip_arp_arpin(void)
return;
}
uip_len = 0;
-
+
switch(BUF->opcode) {
case HTONS(ARP_REQUEST):
/* ARP request. If it asked for our address, we send out a
@@ -304,14 +304,14 @@ uip_arp_arpin(void)
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);
@@ -362,7 +362,7 @@ 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 address isn't on the
local network, we use the default router's IP address instead.
@@ -384,7 +384,7 @@ uip_arp_out(void)
/* 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)) {
@@ -400,7 +400,7 @@ uip_arp_out(void)
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. */
@@ -411,7 +411,7 @@ uip_arp_out(void)
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
-
+
uip_len = sizeof(struct arp_hdr);
return;
}
@@ -420,7 +420,7 @@ uip_arp_out(void)
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);
@@ -429,3 +429,4 @@ uip_arp_out(void)
/** @} */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip_arp.h b/Projects/Webserver/Lib/uip/uip_arp.h
index 114d4310c..4e78ce7b7 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.h
+++ b/Projects/Webserver/Lib/uip/uip_arp.h
@@ -7,13 +7,13 @@
* \addtogroup uiparp
* @{
*/
-
+
/**
* \file
* Macros and definitions for the ARP module.
* \author Adam Dunkels <adam@dunkels.com>
*/
-
+
/*
* Copyright (c) 2001-2003, Adam Dunkels.
@@ -143,3 +143,4 @@ void uip_arp_timer(void);
#endif /* __UIP_ARP_H__ */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uipopt.h b/Projects/Webserver/Lib/uip/uipopt.h
index 244ce1df1..b61a7b4a8 100644
--- a/Projects/Webserver/Lib/uip/uipopt.h
+++ b/Projects/Webserver/Lib/uip/uipopt.h
@@ -189,12 +189,12 @@
#define UIP_CONF_IPV6_QUEUE_PKT 0
#endif
-#ifndef UIP_CONF_IPV6_CHECKS
+#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
+#ifndef UIP_CONF_IPV6_REASSEMBLY
/** Do we do IPv6 fragmentation (default: no) */
#define UIP_CONF_IPV6_REASSEMBLY 0
#endif
@@ -204,14 +204,14 @@
#define UIP_CONF_NETIF_MAX_ADDRESSES 3
#endif
-#ifndef UIP_CONF_ND6_MAX_PREFIXES
+#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
+#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
+#define UIP_CONF_ND6_MAX_NEIGHBORS 4
#endif
#ifndef UIP_CONF_ND6_MAX_DEFROUTERS
@@ -485,14 +485,14 @@
/**
* If we use IPHC compression, how many address contexts do we support
*/
-#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
+#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
#endif
/**
* Do we support 6lowpan fragmentation
*/
-#ifndef SICSLOWPAN_CONF_FRAG
+#ifndef SICSLOWPAN_CONF_FRAG
#define SICSLOWPAN_CONF_FRAG 0
#endif
@@ -690,19 +690,19 @@ typedef union
{
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;
@@ -720,7 +720,7 @@ typedef union
{
uint8_t CurrentState;
struct timer Timeout;
-
+
struct
{
uint8_t AllocatedIP[4];
@@ -735,3 +735,4 @@ typedef union
#endif /* __UIPOPT_H__ */
/** @} */
/** @} */
+
diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c
index 43b5b5dc4..eed6a4ffe 100644
--- a/Projects/Webserver/USBDeviceMode.c
+++ b/Projects/Webserver/USBDeviceMode.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* 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
@@ -105,10 +105,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
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 2bd7c3818..ec3e71390 100644
--- a/Projects/Webserver/USBDeviceMode.h
+++ b/Projects/Webserver/USBDeviceMode.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
-
+
#include "Webserver.h"
#include "Descriptors.h"
#include "Lib/SCSI.h"
@@ -53,5 +53,6 @@
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 d3caa4078..02be2b8f6 100644
--- a/Projects/Webserver/USBHostMode.c
+++ b/Projects/Webserver/USBHostMode.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* 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
@@ -52,7 +52,7 @@ USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
.NotificationPipeNumber = 3,
.NotificationPipeDoubleBank = false,
-
+
.HostMaxPacketSize = UIP_CONF_BUFFER_SIZE,
},
};
@@ -70,7 +70,7 @@ void USBHostMode_USBTask(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -89,21 +89,21 @@ void USBHostMode_USBTask(void)
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;
+ 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)
@@ -112,7 +112,7 @@ void USBHostMode_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,
&MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)
{
@@ -120,16 +120,16 @@ void USBHostMode_USBTask(void)
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;
}
@@ -176,3 +176,4 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Projects/Webserver/USBHostMode.h b/Projects/Webserver/USBHostMode.h
index ab2be1217..e05c600f2 100644
--- a/Projects/Webserver/USBHostMode.h
+++ b/Projects/Webserver/USBHostMode.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,21 +39,22 @@
/* 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 b76d687e9..7c6ab22e9 100644
--- a/Projects/Webserver/Webserver.c
+++ b/Projects/Webserver/Webserver.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* 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
@@ -73,3 +73,4 @@ void SetupHardware(void)
LEDs_Init();
USB_Init(USB_MODE_UID);
}
+
diff --git a/Projects/Webserver/Webserver.h b/Projects/Webserver/Webserver.h
index 970efa26f..c34279187 100644
--- a/Projects/Webserver/Webserver.h
+++ b/Projects/Webserver/Webserver.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,10 +48,10 @@
#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
@@ -64,7 +64,7 @@
/** 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)
@@ -76,5 +76,6 @@
/* Function Prototypes: */
void SetupHardware(void);
-
+
#endif
+
diff --git a/Projects/Webserver/Webserver.txt b/Projects/Webserver/Webserver.txt
index 34b542e23..3fae431c2 100644
--- a/Projects/Webserver/Webserver.txt
+++ b/Projects/Webserver/Webserver.txt
@@ -3,7 +3,7 @@
* 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:
@@ -26,7 +26,7 @@
* <td>Communications Device Class (CDC) \n
* Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard) \n
* Bulk-Only Transport</td>
@@ -45,7 +45,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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 web pages to multiple hosts simultaneously. This project
@@ -111,3 +111,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile
index ac9d8ffcf..fe14e8c5f 100644
--- a/Projects/Webserver/makefile
+++ b/Projects/Webserver/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -131,9 +131,9 @@ LUFA_OPTS += -D UIP_CONF_TCP=1
LUFA_OPTS += -D UIP_CONF_UDP_CONNS=1
LUFA_OPTS += -D UIP_CONF_MAX_CONNECTIONS=3
LUFA_OPTS += -D UIP_CONF_MAX_LISTENPORTS=5
-LUFA_OPTS += -D UIP_URGDATA=0
+LUFA_OPTS += -D UIP_URGDATA=0
LUFA_OPTS += -D UIP_CONF_BUFFER_SIZE=1514
-LUFA_OPTS += -D UIP_ARCH_CHKSUM=0
+LUFA_OPTS += -D UIP_ARCH_CHKSUM=0
LUFA_OPTS += -D UIP_CONF_LL_802154=0
LUFA_OPTS += -D UIP_CONF_LL_80211=0
LUFA_OPTS += -D UIP_CONF_ROUTER=0
@@ -170,7 +170,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -183,7 +183,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -297,7 +297,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -310,7 +310,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -322,7 +322,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -334,7 +334,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -357,7 +357,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -391,7 +391,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -425,7 +425,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -454,7 +454,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -473,10 +473,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -541,11 +541,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -572,9 +572,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -672,14 +672,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -701,7 +701,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -745,3 +745,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.c b/Projects/XPLAINBridge/AVRISPDescriptors.c
index e8f9f8d88..7c4d1a82a 100644
--- a/Projects/XPLAINBridge/AVRISPDescriptors.c
+++ b/Projects/XPLAINBridge/AVRISPDescriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "AVRISPDescriptors.h"
@@ -45,22 +45,22 @@
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
};
@@ -71,41 +71,41 @@ USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
*/
AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
{
- .Config =
+ .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_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .AVRISP_Interface =
+ .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 =
+ .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,
@@ -115,7 +115,7 @@ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
.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,
@@ -130,7 +130,7 @@ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -141,7 +141,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -152,7 +152,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA AVRISP MkII Clone"
};
@@ -162,7 +162,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
+
.UnicodeString = L"0000A00128255"
};
@@ -181,41 +181,42 @@ uint16_t AVRISP_GetDescriptor(const uint16_t wValue,
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
-
+
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &AVRISP_DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &AVRISP_ConfigurationDescriptor;
Size = sizeof(AVRISP_USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &AVRISP_LanguageString;
Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &AVRISP_ManufacturerString;
Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &AVRISP_ProductString;
Size = pgm_read_byte(&AVRISP_ProductString.Header.Size);
break;
case 0x03:
Address = &AVRISP_SerialString;
Size = pgm_read_byte(&AVRISP_SerialString.Header.Size);
- break;
+ break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.h b/Projects/XPLAINBridge/AVRISPDescriptors.h
index edfb37dbe..8c9bc29eb 100644
--- a/Projects/XPLAINBridge/AVRISPDescriptors.h
+++ b/Projects/XPLAINBridge/AVRISPDescriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for AVRISPDescriptors.c.
*/
-
+
#ifndef _AVRISP_DESCRIPTORS_H_
#define _AVRISP_DESCRIPTORS_H_
@@ -55,9 +55,9 @@
/** 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
+ #define AVRISP_DATA_EPSIZE 64
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
@@ -78,3 +78,4 @@
const void** const DescriptorAddress);
#endif
+
diff --git a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
index 768e49a50..2fbc164cb 100644
--- a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
+++ b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,20 +39,20 @@
* or deletions) must not overlap. If there is possibility of two or more of the same kind of
* operating occuring at the same point in time, atomic (mutex) locking should be used.
*/
-
+
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
-
+
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 255
-
+
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
@@ -76,7 +76,7 @@
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
-
+
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
@@ -92,7 +92,7 @@
Buffer->Out = Buffer->Buffer;
}
}
-
+
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
@@ -109,15 +109,15 @@
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
-
+
return Count;
}
-
+
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
@@ -125,7 +125,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
@@ -142,7 +142,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -161,7 +161,7 @@
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
-
+
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
@@ -184,7 +184,7 @@
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
-
+
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
@@ -192,8 +192,9 @@
{
Buffer->Count--;
}
-
+
return Data;
}
#endif
+
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.c b/Projects/XPLAINBridge/Lib/SoftUART.c
index 12fdf96bc..00bb38320 100644
--- a/Projects/XPLAINBridge/Lib/SoftUART.c
+++ b/Projects/XPLAINBridge/Lib/SoftUART.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -11,13 +11,13 @@
Copyright 2010 Peter Danneger
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -79,7 +79,7 @@ ISR(INT0_vect, ISR_BLOCK)
{
/* Reset the number of reception bits remaining counter */
RX_BitsRemaining = 8;
-
+
/* Reset the bit reception timer */
TCNT1 = 0;
@@ -120,7 +120,7 @@ ISR(TIMER1_CAPT_vect, ISR_BLOCK)
/* Reception complete, store the received byte if stop bit valid */
if (SRX_Cached)
- RingBuffer_Insert(&XMEGAtoUSB_Buffer, RX_Data);
+ RingBuffer_Insert(&XMEGAtoUSB_Buffer, RX_Data);
}
}
@@ -150,3 +150,4 @@ ISR(TIMER3_CAPT_vect, ISR_BLOCK)
TX_BitsRemaining = 9;
}
}
+
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h
index 923631b50..9dd81ad35 100644
--- a/Projects/XPLAINBridge/Lib/SoftUART.h
+++ b/Projects/XPLAINBridge/Lib/SoftUART.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -11,13 +11,13 @@
Copyright 2010 Peter Danneger
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include "../XPLAINBridge.h"
#include "LightweightRingBuff.h"
@@ -55,11 +55,11 @@
#define STXPORT PORTD
#define STXDDR DDRD
- /* Inline Functions: */
+ /* Inline Functions: */
static inline void SoftUART_SetBaud(const uint32_t Baud)
{
uint16_t BitTime = ((F_CPU / Baud) - 1);
-
+
ICR1 = BitTime;
ICR3 = BitTime;
}
@@ -67,4 +67,4 @@
/* Function Prototypes: */
void SoftUART_Init(void);
-#endif \ No newline at end of file
+#endif
diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c
index 266c8f3c2..2b1fc6293 100644
--- a/Projects/XPLAINBridge/USARTDescriptors.c
+++ b/Projects/XPLAINBridge/USARTDescriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * 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.
+ * the device's capabilities and functions.
*/
#include "USARTDescriptors.h"
@@ -57,22 +57,22 @@
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 = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
*/
USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor =
{
- .Config =
+ .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,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .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_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.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 =
+ .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 =
+ .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 =
+
+ .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,
@@ -193,7 +193,7 @@ USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM USART_LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -204,7 +204,7 @@ USB_Descriptor_String_t PROGMEM USART_LanguageString =
USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -215,7 +215,7 @@ USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
USB_Descriptor_String_t PROGMEM USART_ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA XPLAIN Bridge"
};
@@ -234,34 +234,35 @@ uint16_t USART_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &USART_DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &USART_ConfigurationDescriptor;
Size = sizeof(USART_USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &USART_LanguageString;
Size = pgm_read_byte(&USART_LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &USART_ManufacturerString;
Size = pgm_read_byte(&USART_ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &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 cac0a987d..0287e81ae 100644
--- a/Projects/XPLAINBridge/USARTDescriptors.h
+++ b/Projects/XPLAINBridge/USARTDescriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for USARTDescriptors.c.
*/
-
+
#ifndef _USART_DESCRIPTORS_H_
#define _USART_DESCRIPTORS_H_
@@ -47,17 +47,17 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #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
@@ -82,3 +82,4 @@
const void** const DescriptorAddress);
#endif
+
diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c
index 0764bb9a8..24aa383db 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.c
+++ b/Projects/XPLAINBridge/XPLAINBridge.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@ bool CurrentFirmwareMode = MODE_USART_BRIDGE;
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
- .Config =
+ .Config =
{
.ControlInterfaceNumber = 0,
@@ -100,7 +100,7 @@ void AVRISP_Task(void)
V2Params_UpdateParamValues();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
-
+
/* Check to see if a V2 Protocol command has been received */
if (Endpoint_IsOUTReceived())
{
@@ -123,7 +123,7 @@ void UARTBridge_Task(void)
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUART_Buffer)))
RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte);
-
+
/* Check if the UART receive buffer flush timer has expired or buffer is nearly full */
RingBuff_Count_t BufferCount = RingBuffer_GetCount(&UARTtoUSB_Buffer);
if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200))
@@ -185,7 +185,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
/* Initialize ring buffers used to hold serial data between USB and software UART interfaces */
RingBuffer_InitBuffer(&USBtoUART_Buffer);
RingBuffer_InitBuffer(&UARTtoUSB_Buffer);
-
+
/* Start the software USART */
SoftUART_Init();
}
@@ -198,7 +198,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
-
+
/* Configure the V2 protocol packet handler */
V2Protocol_Init();
}
@@ -257,3 +257,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
else
return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress);
}
+
diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h
index 74fa4458d..ac4378dc7 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.h
+++ b/Projects/XPLAINBridge/XPLAINBridge.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -66,7 +66,7 @@
/** 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
@@ -80,7 +80,7 @@
extern bool CurrentFirmwareMode;
extern RingBuff_t UARTtoUSB_Buffer;
extern RingBuff_t USBtoUART_Buffer;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void AVRISP_Task(void);
@@ -89,7 +89,7 @@
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_Disconnect(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
@@ -99,3 +99,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt
index fe7e739f1..42943101f 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.txt
+++ b/Projects/XPLAINBridge/XPLAINBridge.txt
@@ -3,7 +3,7 @@
* 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:
@@ -27,7 +27,7 @@
* <td>1) Communications Device Class (CDC)</td>
* <td>2) Vendor Specific Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>1) Abstract Control Model (ACM)</td>
* <td>2) N/A</td>
@@ -44,7 +44,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \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 compatible PDI programmer for the XMEGA.
@@ -91,3 +91,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile
index 542b928e4..1416f8133 100644
--- a/Projects/XPLAINBridge/makefile
+++ b/Projects/XPLAINBridge/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# 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.
@@ -64,14 +64,14 @@ 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
+# 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
+# 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.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# 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
@@ -161,7 +161,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -174,7 +174,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# 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
@@ -288,7 +288,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# 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
+# -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
@@ -301,7 +301,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
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 = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -313,7 +313,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
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 = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -325,7 +325,7 @@ MATH_LIB = -lm
# 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 =
+EXTRALIBDIRS =
@@ -348,7 +348,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -382,7 +382,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -416,7 +416,7 @@ JTAG_DEV = /dev/com1
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
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -445,7 +445,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -464,10 +464,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+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)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -532,11 +532,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -563,9 +563,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -663,14 +663,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(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 $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -692,7 +692,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -736,3 +736,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/makefile b/Projects/makefile
index 321086428..19e3d3e99 100644
--- a/Projects/makefile
+++ b/Projects/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -37,7 +37,7 @@ all:
$(MAKE) -C USBtoSerial clean
$(MAKE) -C USBtoSerial all
-
+
$(MAKE) -C Webserver clean
$(MAKE) -C Webserver all
@@ -47,7 +47,7 @@ all:
%:
$(MAKE) -C AVRISP-MKII $@
$(MAKE) -C Benito $@
- $(MAKE) -C LEDNotifier $@
+ $(MAKE) -C LEDNotifier $@
$(MAKE) -C Magstripe $@
$(MAKE) -C MissileLauncher $@
$(MAKE) -C RelayBoard $@
@@ -55,3 +55,4 @@ all:
$(MAKE) -C USBtoSerial $@
$(MAKE) -C Webserver $@
$(MAKE) -C XPLAINBridge $@
+