Commit f201f669 authored by Dean Camera's avatar Dean Camera

Run wspurify script on /trunk/ and /branches/ C source files, to remove any...

Run wspurify script on /trunk/ and /branches/ C source files, to remove any trailing whitespace at the end of each line.
parent 77f35460
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
#include <avr/io.h> #include <avr/io.h>
#include <avr/boot.h> #include <avr/boot.h>
#include <stdbool.h> #include <stdbool.h>
#include <LUFA/Common/Common.h> #include <LUFA/Common/Common.h>
/* Function Prototypes: */ /* Function Prototypes: */
void BootloaderAPI_ErasePage(const uint32_t Address); void BootloaderAPI_ErasePage(const uint32_t Address);
void BootloaderAPI_WritePage(const uint32_t Address); void BootloaderAPI_WritePage(const uint32_t Address);
......
...@@ -104,10 +104,10 @@ void SetupHardware(void) ...@@ -104,10 +104,10 @@ void SetupHardware(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
LEDs_Init(); LEDs_Init();
/* Bootloader active LED toggle timer initialization */ /* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1); TIMSK1 = (1 << TOIE1);
TCCR1B = ((1 << CS11) | (1 << CS10)); TCCR1B = ((1 << CS11) | (1 << CS10));
} }
/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */ /** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
...@@ -266,7 +266,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command) ...@@ -266,7 +266,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
{ {
LowByte = FetchNextCommandByte(); LowByte = FetchNextCommandByte();
} }
HighByte = !HighByte; HighByte = !HighByte;
} }
else else
...@@ -365,7 +365,7 @@ void CDC_Task(void) ...@@ -365,7 +365,7 @@ void CDC_Task(void)
if (Command == 'E') if (Command == 'E')
{ {
RunBootloader = false; RunBootloader = false;
/* Send confirmation byte back to the host */ /* Send confirmation byte back to the host */
WriteNextResponseByte('\r'); WriteNextResponseByte('\r');
} }
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "Descriptors.h" #include "Descriptors.h"
#include "BootloaderAPI.h" #include "BootloaderAPI.h"
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
......
...@@ -115,14 +115,14 @@ ...@@ -115,14 +115,14 @@
typedef struct typedef struct
{ {
USB_Descriptor_Configuration_Header_t Config; USB_Descriptor_Configuration_Header_t Config;
// CDC Control Interface // CDC Control Interface
USB_Descriptor_Interface_t CDC_CCI_Interface; USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface // CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface; USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
......
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
#include <avr/io.h> #include <avr/io.h>
#include <avr/boot.h> #include <avr/boot.h>
#include <stdbool.h> #include <stdbool.h>
#include <LUFA/Common/Common.h> #include <LUFA/Common/Common.h>
/* Function Prototypes: */ /* Function Prototypes: */
void BootloaderAPI_ErasePage(const uint32_t Address); void BootloaderAPI_ErasePage(const uint32_t Address);
void BootloaderAPI_WritePage(const uint32_t Address); void BootloaderAPI_WritePage(const uint32_t Address);
......
...@@ -113,10 +113,10 @@ int main(void) ...@@ -113,10 +113,10 @@ int main(void)
/* If the TCK pin is not jumpered to ground, start the user application instead */ /* If the TCK pin is not jumpered to ground, start the user application instead */
RunBootloader = (!(PINF & (1 << 4))); RunBootloader = (!(PINF & (1 << 4)));
/* Re-enable JTAG debugging */ /* Re-enable JTAG debugging */
MCUCR &= ~(1 << JTD); MCUCR &= ~(1 << JTD);
MCUCR &= ~(1 << JTD); MCUCR &= ~(1 << JTD);
#endif #endif
/* Turn on first LED on the board to indicate that the bootloader has started */ /* Turn on first LED on the board to indicate that the bootloader has started */
...@@ -153,7 +153,7 @@ void SetupHardware(void) ...@@ -153,7 +153,7 @@ void SetupHardware(void)
/* Initialize the USB subsystem */ /* Initialize the USB subsystem */
USB_Init(); USB_Init();
LEDs_Init(); LEDs_Init();
/* Bootloader active LED toggle timer initialization */ /* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1); TIMSK1 = (1 << TOIE1);
TCCR1B = ((1 << CS11) | (1 << CS10)); TCCR1B = ((1 << CS11) | (1 << CS10));
...@@ -181,7 +181,7 @@ ISR(TIMER1_OVF_vect, ISR_BLOCK) ...@@ -181,7 +181,7 @@ ISR(TIMER1_OVF_vect, ISR_BLOCK)
* internally. * internally.
*/ */
void EVENT_USB_Device_ControlRequest(void) void EVENT_USB_Device_ControlRequest(void)
{ {
/* Ignore any requests that aren't directed to the DFU interface */ /* Ignore any requests that aren't directed to the DFU interface */
if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) !=
(REQTYPE_CLASS | REQREC_INTERFACE)) (REQTYPE_CLASS | REQREC_INTERFACE))
...@@ -742,3 +742,4 @@ static void ProcessReadCommand(void) ...@@ -742,3 +742,4 @@ static void ProcessReadCommand(void)
else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Read signature byte else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Read signature byte
ResponseByte = SignatureInfo[DataIndexToRead - 0x30]; ResponseByte = SignatureInfo[DataIndexToRead - 0x30];
} }
...@@ -159,11 +159,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, ...@@ -159,11 +159,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor; Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = &ConfigurationDescriptor; Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
if (!(DescriptorNumber)) if (!(DescriptorNumber))
{ {
Address = &LanguageString; Address = &LanguageString;
...@@ -174,10 +174,10 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, ...@@ -174,10 +174,10 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &ProductString; Address = &ProductString;
Size = ProductString.Header.Size; Size = ProductString.Header.Size;
} }
break; break;
} }
*DescriptorAddress = Address; *DescriptorAddress = Address;
return Size; return Size;
} }
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
typedef struct typedef struct
{ {
USB_Descriptor_Configuration_Header_t Config; USB_Descriptor_Configuration_Header_t Config;
// DFU Interface // DFU Interface
USB_Descriptor_Interface_t DFU_Interface; USB_Descriptor_Interface_t DFU_Interface;
USB_Descriptor_DFU_Functional_t DFU_Functional; USB_Descriptor_DFU_Functional_t DFU_Functional;
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
/* /*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) Copyright 2011 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 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 all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the advertising or publicity pertaining to distribution of the
software without specific, written prior permission. software without specific, written prior permission.
The author disclaim all warranties with regard to this The author disclaim all warranties with regard to this
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* *
* Main source file for the HID class bootloader. This file contains the complete bootloader logic. * Main source file for the HID class bootloader. This file contains the complete bootloader logic.
*/ */
#include "BootloaderHID.h" #include "BootloaderHID.h"
/** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run /** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run
...@@ -41,20 +41,20 @@ ...@@ -41,20 +41,20 @@
*/ */
static bool RunBootloader = true; static bool RunBootloader = true;
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit. * runs the bootloader processing routine until instructed to soft-exit.
*/ */
int main(void) int main(void)
{ {
/* Setup hardware required for the bootloader */ /* Setup hardware required for the bootloader */
SetupHardware(); SetupHardware();
/* Enable global interrupts so that the USB stack can function */ /* Enable global interrupts so that the USB stack can function */
sei(); sei();
while (RunBootloader) while (RunBootloader)
USB_USBTask(); USB_USBTask();
/* Disconnect from the host - USB interface will be reset later along with the AVR */ /* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach(); USB_Detach();
...@@ -108,17 +108,17 @@ void EVENT_USB_Device_ControlRequest(void) ...@@ -108,17 +108,17 @@ void EVENT_USB_Device_ControlRequest(void)
{ {
case HID_REQ_SetReport: case HID_REQ_SetReport:
Endpoint_ClearSETUP(); Endpoint_ClearSETUP();
/* Wait until the command has been sent by the host */ /* Wait until the command has been sent by the host */
while (!(Endpoint_IsOUTReceived())); while (!(Endpoint_IsOUTReceived()));
/* Read in the write destination address */ /* Read in the write destination address */
#if (FLASHEND > 0xFFFF) #if (FLASHEND > 0xFFFF)
uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8); uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8);
#else #else
uint16_t PageAddress = Endpoint_Read_16_LE(); uint16_t PageAddress = Endpoint_Read_16_LE();
#endif #endif
/* Check if the command is a program page command, or a start application command */ /* Check if the command is a program page command, or a start application command */
#if (FLASHEND > 0xFFFF) #if (FLASHEND > 0xFFFF)
if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION) if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION)
...@@ -133,9 +133,9 @@ void EVENT_USB_Device_ControlRequest(void) ...@@ -133,9 +133,9 @@ void EVENT_USB_Device_ControlRequest(void)
/* Erase the given FLASH page, ready to be programmed */ /* Erase the given FLASH page, ready to be programmed */
boot_page_erase(PageAddress); boot_page_erase(PageAddress);
boot_spm_busy_wait(); boot_spm_busy_wait();
/* Write each of the FLASH page's bytes in sequence */ /* Write each of the FLASH page's bytes in sequence */
for (uint8_t PageWord = 0; PageWord < (SPM_PAGESIZE / 2); PageWord++) for (uint8_t PageWord = 0; PageWord < (SPM_PAGESIZE / 2); PageWord++)
{ {
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */ /* Check if endpoint is empty - if so clear it and wait until ready for next packet */
if (!(Endpoint_BytesInEndpoint())) if (!(Endpoint_BytesInEndpoint()))
...@@ -162,3 +162,4 @@ void EVENT_USB_Device_ControlRequest(void) ...@@ -162,3 +162,4 @@ void EVENT_USB_Device_ControlRequest(void)
break; break;
} }
} }
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
/* /*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) Copyright 2011 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 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 all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the advertising or publicity pertaining to distribution of the
software without specific, written prior permission. software without specific, written prior permission.
The author disclaim all warranties with regard to this The author disclaim all warranties with regard to this
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* *
* Header file for TeensyHID.c. * Header file for TeensyHID.c.
*/ */
#ifndef _TEENSYHID_H_ #ifndef _TEENSYHID_H_
#define _TEENSYHID_H_ #define _TEENSYHID_H_
...@@ -47,15 +47,16 @@ ...@@ -47,15 +47,16 @@
#include "Descriptors.h" #include "Descriptors.h"
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
/* Macros: */ /* Macros: */
/** Bootloader special address to start the user application */ /** Bootloader special address to start the user application */
#define COMMAND_STARTAPPLICATION 0xFFFF #define COMMAND_STARTAPPLICATION 0xFFFF
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
/* /*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) Copyright 2011 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 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 all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the advertising or publicity pertaining to distribution of the
software without specific, written prior permission. software without specific, written prior permission.
The author disclaim all warranties with regard to this The author disclaim all warranties with regard to this
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
/** \file /** \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 * 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" #include "Descriptors.h"
...@@ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t HIDReport[] = ...@@ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
HID_RI_LOGICAL_MINIMUM(8, 0x00), HID_RI_LOGICAL_MINIMUM(8, 0x00),
HID_RI_LOGICAL_MAXIMUM(8, 0xFF), HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
HID_RI_REPORT_SIZE(8, 0x08), HID_RI_REPORT_SIZE(8, 0x08),
HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)), HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)),
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
HID_RI_END_COLLECTION(0), HID_RI_END_COLLECTION(0),
}; };
...@@ -91,49 +91,49 @@ const USB_Descriptor_Device_t DeviceDescriptor = ...@@ -91,49 +91,49 @@ const USB_Descriptor_Device_t DeviceDescriptor =
*/ */
const USB_Descriptor_Configuration_t ConfigurationDescriptor = const USB_Descriptor_Configuration_t ConfigurationDescriptor =
{ {
.Config = .Config =
{ {
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1, .TotalInterfaces = 1,
.ConfigurationNumber = 1, .ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR, .ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED, .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100) .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
}, },
.HID_Interface = .HID_Interface =
{ {
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00, .InterfaceNumber = 0x00,
.AlternateSetting = 0x00, .AlternateSetting = 0x00,
.TotalEndpoints = 1, .TotalEndpoints = 1,
.Class = HID_CSCP_HIDClass,