From f201f6697b7f99b63389509b42112026b8f6f76f Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 23 Dec 2011 01:51:39 +0000 Subject: Run wspurify script on /trunk/ and /branches/ C source files, to remove any trailing whitespace at the end of each line. --- Bootloaders/HID/BootloaderHID.c | 29 ++++++------ Bootloaders/HID/BootloaderHID.h | 23 +++++----- Bootloaders/HID/Descriptors.c | 53 +++++++++++----------- Bootloaders/HID/Descriptors.h | 19 ++++---- Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c | 6 +-- 5 files changed, 67 insertions(+), 63 deletions(-) (limited to 'Bootloaders/HID') diff --git a/Bootloaders/HID/BootloaderHID.c b/Bootloaders/HID/BootloaderHID.c index f4cb0f1a1..500d3fecb 100644 --- a/Bootloaders/HID/BootloaderHID.c +++ b/Bootloaders/HID/BootloaderHID.c @@ -9,13 +9,13 @@ /* 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 - 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 @@ * * Main source file for the HID class bootloader. This file contains the complete bootloader logic. */ - + #include "BootloaderHID.h" /** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run @@ -41,20 +41,20 @@ */ 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. */ int main(void) { /* Setup hardware required for the bootloader */ SetupHardware(); - + /* Enable global interrupts so that the USB stack can function */ sei(); while (RunBootloader) USB_USBTask(); - + /* Disconnect from the host - USB interface will be reset later along with the AVR */ USB_Detach(); @@ -108,17 +108,17 @@ void EVENT_USB_Device_ControlRequest(void) { case HID_REQ_SetReport: Endpoint_ClearSETUP(); - + /* Wait until the command has been sent by the host */ while (!(Endpoint_IsOUTReceived())); - + /* Read in the write destination address */ #if (FLASHEND > 0xFFFF) uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8); #else uint16_t PageAddress = Endpoint_Read_16_LE(); #endif - + /* Check if the command is a program page command, or a start application command */ #if (FLASHEND > 0xFFFF) if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION) @@ -133,9 +133,9 @@ void EVENT_USB_Device_ControlRequest(void) /* Erase the given FLASH page, ready to be programmed */ boot_page_erase(PageAddress); boot_spm_busy_wait(); - + /* 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 */ if (!(Endpoint_BytesInEndpoint())) @@ -162,3 +162,4 @@ void EVENT_USB_Device_ControlRequest(void) break; } } + diff --git a/Bootloaders/HID/BootloaderHID.h b/Bootloaders/HID/BootloaderHID.h index 190dff857..e0f648f59 100644 --- a/Bootloaders/HID/BootloaderHID.h +++ b/Bootloaders/HID/BootloaderHID.h @@ -8,14 +8,14 @@ /* 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 - 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 TeensyHID.c. */ - + #ifndef _TEENSYHID_H_ #define _TEENSYHID_H_ @@ -47,15 +47,16 @@ #include "Descriptors.h" #include - - /* Macros: */ + + /* Macros: */ /** Bootloader special address to start the user application */ #define COMMAND_STARTAPPLICATION 0xFFFF - + /* Function Prototypes: */ void SetupHardware(void); void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_UnhandledControlRequest(void); - + #endif + diff --git a/Bootloaders/HID/Descriptors.c b/Bootloaders/HID/Descriptors.c index bbb821491..48ef78e79 100644 --- a/Bootloaders/HID/Descriptors.c +++ b/Bootloaders/HID/Descriptors.c @@ -8,14 +8,14 @@ /* 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 - 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" @@ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t HIDReport[] = HID_RI_LOGICAL_MINIMUM(8, 0x00), HID_RI_LOGICAL_MAXIMUM(8, 0xFF), 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_END_COLLECTION(0), }; @@ -91,49 +91,49 @@ const USB_Descriptor_Device_t DeviceDescriptor = */ const USB_Descriptor_Configuration_t 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) }, - - .HID_Interface = + + .HID_Interface = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, .InterfaceNumber = 0x00, .AlternateSetting = 0x00, - + .TotalEndpoints = 1, - + .Class = HID_CSCP_HIDClass, .SubClass = HID_CSCP_NonBootSubclass, .Protocol = HID_CSCP_NonBootProtocol, - + .InterfaceStrIndex = NO_DESCRIPTOR }, - .HID_VendorHID = - { + .HID_VendorHID = + { .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(HIDReport) }, - - .HID_ReportINEndpoint = + + .HID_ReportINEndpoint = { .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, @@ -158,17 +158,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const void* Address = NULL; uint16_t Size = NO_DESCRIPTOR; - + /* If/Else If chain compiles slightly smaller than a switch case */ if (DescriptorType == DTYPE_Device) { Address = &DeviceDescriptor; - Size = sizeof(USB_Descriptor_Device_t); + Size = sizeof(USB_Descriptor_Device_t); } else if (DescriptorType == DTYPE_Configuration) { Address = &ConfigurationDescriptor; - Size = sizeof(USB_Descriptor_Configuration_t); + Size = sizeof(USB_Descriptor_Configuration_t); } else if (DescriptorType == HID_DTYPE_HID) { @@ -184,3 +184,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, *DescriptorAddress = Address; return Size; } + diff --git a/Bootloaders/HID/Descriptors.h b/Bootloaders/HID/Descriptors.h index eb231f03f..ac9d08705 100644 --- a/Bootloaders/HID/Descriptors.h +++ b/Bootloaders/HID/Descriptors.h @@ -8,14 +8,14 @@ /* 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 - 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 @@ -47,18 +47,18 @@ typedef struct { USB_Descriptor_Configuration_Header_t Config; - + // Generic HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_VendorHID; USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; - + /* Macros: */ /** Endpoint number of the HID data IN endpoint. */ #define HID_IN_EPNUM 1 - /** Size in bytes of the HID reporting IN endpoint. */ + /** Size in bytes of the HID reporting IN endpoint. */ #define HID_IN_EPSIZE 64 /* Function Prototypes: */ @@ -68,3 +68,4 @@ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); #endif + diff --git a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c index e22d39404..e1f2ea03d 100644 --- a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c +++ b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c @@ -710,10 +710,10 @@ int teensy_open(void) { teensy_close(); uhid_teensy_fd = open_usb_device(0x16C0, 0x0478); - + if (uhid_teensy_fd < 0) uhid_teensy_fd = open_usb_device(0x03eb, 0x2067); - + if (uhid_teensy_fd < 0) return 0; return 1; } @@ -826,7 +826,7 @@ parse_hex_line(char *line) int addr, code, num; int sum, len, cksum, i; char *ptr; - + num = 0; if (line[0] != ':') return 0; if (strlen(line) < 11) return 0; -- cgit v1.2.3