aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Host/LowLevel')
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c33
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h23
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c45
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h25
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt9
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/makefile49
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c25
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h19
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c19
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h25
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c58
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h17
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt11
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/makefile49
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c23
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c43
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h23
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt13
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/makefile49
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c31
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c17
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h23
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c49
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h19
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt13
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/makefile49
-rw-r--r--Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c27
-rw-r--r--Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h27
-rw-r--r--Demos/Host/LowLevel/MIDIHost/MIDIHost.c51
-rw-r--r--Demos/Host/LowLevel/MIDIHost/MIDIHost.h29
-rw-r--r--Demos/Host/LowLevel/MIDIHost/MIDIHost.txt7
-rw-r--r--Demos/Host/LowLevel/MIDIHost/makefile49
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c23
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h23
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c95
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h43
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h15
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c77
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h19
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt9
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/makefile49
-rw-r--r--Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c23
-rw-r--r--Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/MouseHost/MouseHost.c41
-rw-r--r--Demos/Host/LowLevel/MouseHost/MouseHost.h23
-rw-r--r--Demos/Host/LowLevel/MouseHost/MouseHost.txt15
-rw-r--r--Demos/Host/LowLevel/MouseHost/makefile49
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c33
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c19
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h27
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c64
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h17
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt11
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/makefile49
-rw-r--r--Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c27
-rw-r--r--Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h23
-rw-r--r--Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c30
-rw-r--r--Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h21
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.c41
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.h21
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.txt11
-rw-r--r--Demos/Host/LowLevel/PrinterHost/makefile49
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c29
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h27
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c55
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h41
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h27
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c50
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h23
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt9
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/makefile49
-rw-r--r--Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c21
-rw-r--r--Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h15
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c55
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h27
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.c81
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.h23
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.txt9
-rw-r--r--Demos/Host/LowLevel/StillImageHost/makefile49
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c29
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h27
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c33
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h23
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt11
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/makefile49
-rw-r--r--Demos/Host/LowLevel/makefile3
90 files changed, 1426 insertions, 1340 deletions
diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
index 093c7db65..83eb30101 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/GenericHIDHost/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,17 +87,17 @@ 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);
/* Clear any found endpoints */
DataOUTEndpoint = NULL;
-
+
/* 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/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
index e5a39479d..bde951439 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/GenericHIDHost/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,19 +38,19 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "GenericHIDHost.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
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
enum GenericHIDHost_GetConfigDescriptorDataCodes_t
@@ -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/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
index 66a5b8e7e..ba182607b 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.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 GenericHIDHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "GenericHIDHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -137,10 +137,10 @@ void ReadNextReport(void)
{
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Ensure pipe contains data before trying to read from it */
if (Pipe_IsReadWriteAllowed())
{
@@ -148,17 +148,17 @@ void ReadNextReport(void)
/* Read in HID report data */
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
-
+
/* Print report data through the serial port */
for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
printf_P(PSTR("0x%02X "), ReportINData[CurrByte]);
-
+
puts_P(PSTR("\r\n"));
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
-
+
/* Refreeze HID data IN pipe */
Pipe_Freeze();
}
@@ -177,7 +177,7 @@ void WriteNextReport(uint8_t* ReportOUTData,
{
/* Select the 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() && (ReportType == REPORT_TYPE_OUT))
@@ -189,17 +189,17 @@ void WriteNextReport(uint8_t* ReportOUTData,
{
/* Refreeze the data OUT pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* If the report index is used, send it before the report data */
if (ReportIndex)
Pipe_Write_Byte(ReportIndex);
/* 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();
@@ -238,7 +238,7 @@ void HID_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -248,7 +248,7 @@ void HID_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -265,12 +265,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;
}
-
+
puts_P(PSTR("HID Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
@@ -281,3 +281,4 @@ void HID_Host_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
index 489fba896..e3fc32135 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.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
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.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
@@ -67,7 +67,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)
-
+
/** HID Report Type to indicate an IN report. */
#define REPORT_TYPE_IN 1
@@ -76,11 +76,11 @@
/** HID Report Type to indicate a FEATURE report. */
#define REPORT_TYPE_FEATURE 3
-
+
/* Function Prototypes: */
void SetupHardware(void);
void HID_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -93,5 +93,6 @@
const uint8_t ReportIndex,
const uint8_t ReportType,
uint16_t ReportLength);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt
index e176507de..a82a77830 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.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 Generic HID Host Demo
*
* \section SSec_Compat Demo 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>
@@ -41,14 +41,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Generic HID host demonstration application. This gives a simple reference
* application for implementing a Generic HID USB host, for any device implementing
* the HID profile.
*
* Received reports from the attached device are printed to the serial port.
- *
+ *
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
@@ -61,3 +61,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/makefile b/Demos/Host/LowLevel/GenericHIDHost/makefile
index b7342e007..d39f7e6d4 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/makefile
+++ b/Demos/Host/LowLevel/GenericHIDHost/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
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,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
@@ -261,7 +261,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
@@ -274,7 +274,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)
@@ -286,7 +286,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)
@@ -298,7 +298,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 =
@@ -321,7 +321,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))
@@ -355,7 +355,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
@@ -389,7 +389,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
@@ -418,7 +418,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:
@@ -437,10 +437,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.
@@ -505,11 +505,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)
@@ -536,9 +536,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)
@@ -636,14 +636,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.
@@ -665,7 +665,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.
@@ -709,3 +709,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/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
index 3eaf7d960..20eaec7c9 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/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_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -95,12 +95,12 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
/* 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);
@@ -108,7 +108,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(JOYSTICK_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -140,7 +140,7 @@ uint8_t DComp_NextJoystickInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -181,5 +181,6 @@ uint8_t DComp_NextHID(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
- return DESCRIPTOR_SEARCH_NotFound;
+ return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
index 58c63f9e5..5aafe7d39 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/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,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "HIDReport.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define JOYSTICK_CLASS 0x03
@@ -53,7 +53,7 @@
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
-
+
/** Pipe number for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE 1
@@ -78,3 +78,4 @@
uint8_t DComp_NextHID(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c
index bda99bdd0..76e26a0d5 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.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
@@ -46,7 +46,7 @@ uint8_t GetHIDReportData(void)
{
/* Create a buffer big enough to hold the entire returned HID report */
uint8_t HIDReportData[HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -66,7 +66,7 @@ uint8_t GetHIDReportData(void)
/* Send the HID report to the parser for processing */
if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful)
return ParseError;
-
+
return ParseSuccessful;
}
@@ -100,7 +100,7 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
/* If a collection with the joystick usage was not found, indicate that we are not interested in this item */
if (!IsJoystick)
return false;
-
+
/* Check the attributes of the current joystick item - see if we are interested in it or not;
* only store BUTTON and GENERIC_DESKTOP_CONTROL items into the Processed HID Report
* structure to save RAM and ignore the rest
@@ -108,3 +108,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
}
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h
index da73ff823..0808806f7 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.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/Host/HIDParser.h>
-
+
#include "JoystickHostWithParser.h"
/* Macros: */
@@ -66,16 +66,16 @@
ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
-
+
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
-
+
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
-
+
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
@@ -88,7 +88,8 @@
/* Function Prototypes: */
uint8_t GetHIDReportData(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c
index c7739e97f..3bd27da11 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.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 JoystickHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "JoystickHostWithParser.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -64,7 +64,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
SerialStream_Init(9600, false);
LEDs_Init();
@@ -118,7 +118,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -134,7 +134,7 @@ void Joystick_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -144,7 +144,7 @@ void Joystick_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -152,7 +152,7 @@ void Joystick_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -161,12 +161,12 @@ void Joystick_HID_Task(void)
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);
/* Get and process the device's first HID report descriptor */
@@ -178,21 +178,21 @@ void Joystick_HID_Task(void)
puts_P(PSTR("Not a valid Joystick." ESC_FG_WHITE));
else
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
{
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
+
uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
@@ -211,9 +211,9 @@ void Joystick_HID_Task(void)
break;
case HOST_STATE_Configured:
/* Select and unfreeze joystick data pipe */
- Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
+ Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
@@ -225,11 +225,11 @@ void Joystick_HID_Task(void)
/* Load in the joystick report */
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe());
-
+
/* Process the read in joystick report from the device */
ProcessJoystickReport(JoystickReport);
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
@@ -254,7 +254,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
{
/* Create a temporary item pointer to the next report item */
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
-
+
bool FoundData;
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
@@ -262,7 +262,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
{
/* Get the joystick button value */
FoundData = USB_GetHIDReportItemInfo(JoystickReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
@@ -278,13 +278,13 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
{
/* Get the joystick relative position value */
FoundData = USB_GetHIDReportItemInfo(JoystickReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
-
+
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
/* Check to see if a (non-zero) delta movement has been indicated */
if (DeltaMovement)
{
@@ -296,7 +296,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
}
}
}
-
+
/* Display the button information on the board LEDs */
LEDs_SetAllLEDs(LEDMask);
-} \ No newline at end of file
+}
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h
index 5f34dba03..403465fbe 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.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
@@ -49,7 +49,7 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "ConfigDescriptor.h"
#include "HIDReport.h"
@@ -69,7 +69,7 @@
/* Function Prototypes: */
void Joystick_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -80,3 +80,4 @@
void ProcessJoystickReport(uint8_t* JoystickReport);
#endif
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt
index 055890b70..0fa97f868 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.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 Joystick Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo 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>
@@ -41,19 +41,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Joystick host demonstration application. This gives a simple reference
* application for implementing a USB Joystick host, for USB joysticks using
* the standard joystick HID profile. It uses a HID parser for the HID
* reports, allowing for correct operation across all USB joysticks. This
* demo supports joysticks with a single HID report.
- *
+ *
* Joystick movement and button presses are displayed on the board LEDs.
* On connection to a USB joystick, the report items will be processed and
* printed as a formatted list through the USART before the joystick is
* fully enumerated.
- *
+ *
* Currently only single interface joysticks are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/makefile b/Demos/Host/LowLevel/JoystickHostWithParser/makefile
index 39b13ed36..ec35eeb38 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/makefile
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/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/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
index e1e32ed7c..ea42a28ab 100644
--- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/KeyboardHost/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;
@@ -66,7 +66,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -88,7 +88,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);
@@ -96,7 +96,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -125,7 +125,7 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -152,3 +152,4 @@ uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
index f8fed3e58..14f691b68 100644
--- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/KeyboardHost/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 "KeyboardHost.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define KEYBOARD_CLASS 0x03
/** Interface Protocol value for a Boot Protocol Keyboard compliant device. */
#define KEYBOARD_PROTOCOL 0x01
-
+
/** Pipe number for the keyboard data IN pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
@@ -64,8 +64,9 @@
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
-
+
uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);
uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
index 0c24bc9e2..269fe2779 100644
--- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
+++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.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 KeyboardHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -129,9 +129,9 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
void ReadNextReport(void)
{
USB_KeyboardReport_Data_t KeyboardReport;
-
+
/* Select keyboard data pipe */
- Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
+ Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
@@ -141,10 +141,10 @@ void ReadNextReport(void)
{
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Ensure pipe contains data before trying to read from it */
if (Pipe_IsReadWriteAllowed())
{
@@ -153,13 +153,13 @@ void ReadNextReport(void)
/* Indicate if the modifier byte is non-zero (special key such as shift is being pressed) */
LEDs_ChangeLEDs(LEDS_LED1, (KeyboardReport.Modifier) ? LEDS_LED1 : 0);
-
+
/* Check if a key has been pressed */
if (KeyboardReport.KeyCode)
{
/* Toggle status LED to indicate keypress */
LEDs_ToggleLEDs(LEDS_LED2);
-
+
char PressedKey = 0;
/* Retrieve pressed key character if alphanumeric */
@@ -168,16 +168,16 @@ void ReadNextReport(void)
else if ((KeyboardReport.KeyCode[0] >= 0x1E) && (KeyboardReport.KeyCode[0] <= 0x27))
PressedKey = (KeyboardReport.KeyCode[0] - 0x1E) + '0';
else if (KeyboardReport.KeyCode[0] == 0x2C)
- PressedKey = ' ';
+ PressedKey = ' ';
else if (KeyboardReport.KeyCode[0] == 0x28)
PressedKey = '\n';
-
+
/* Print the pressed key character out through the serial port if valid */
if (PressedKey)
putchar(PressedKey);
}
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
@@ -196,7 +196,7 @@ void Keyboard_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -206,7 +206,7 @@ void Keyboard_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -214,7 +214,7 @@ void Keyboard_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -228,7 +228,7 @@ void Keyboard_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* HID class request to set the keyboard protocol to the Boot Protocol */
USB_ControlRequest = (USB_Request_Header_t)
{
@@ -250,7 +250,7 @@ void Keyboard_HID_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
@@ -267,3 +267,4 @@ void Keyboard_HID_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h
index 0c6075330..63d6c06b5 100644
--- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h
+++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.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
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class Specific request to set the report protocol mode. */
#define REQ_SetProtocol 0x0B
@@ -76,11 +76,11 @@
uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */
uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys */
} USB_KeyboardReport_Data_t;
-
+
/* Function Prototypes: */
void Keyboard_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -89,5 +89,6 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt
index 397150175..810634dcd 100644
--- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt
+++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.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 Keyboard Host Demo
*
* \section SSec_Compat Demo 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>
@@ -41,21 +41,21 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
* application for implementing a USB keyboard, for USB keyboards using
* the standard keyboard HID profile.
- *
+ *
* Pressed alpha-numeric, enter or space key is transmitted through the serial
* USART at serial settings 9600, 8, N, 1.
- *
+ *
* This uses a naive method where the keyboard is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* KeyboardHostWithParser demo application.
- *
+ *
* Currently only single interface keyboards are supported.
*
* \section SSec_Options Project Options
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/makefile b/Demos/Host/LowLevel/KeyboardHost/makefile
index 6d8634ce1..13bf64d63 100644
--- a/Demos/Host/LowLevel/KeyboardHost/makefile
+++ b/Demos/Host/LowLevel/KeyboardHost/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
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,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
@@ -261,7 +261,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
@@ -274,7 +274,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)
@@ -286,7 +286,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)
@@ -298,7 +298,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 =
@@ -321,7 +321,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))
@@ -355,7 +355,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
@@ -389,7 +389,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
@@ -418,7 +418,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:
@@ -437,10 +437,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.
@@ -505,11 +505,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)
@@ -536,9 +536,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)
@@ -636,14 +636,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.
@@ -665,7 +665,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.
@@ -709,3 +709,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/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
index 74817a2f1..fe35d95b7 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/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_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -82,7 +82,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);
@@ -93,14 +93,14 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
-
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+
/* 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);
@@ -108,7 +108,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -140,7 +140,7 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -183,5 +183,6 @@ uint8_t DComp_NextHID(void* CurrentDescriptor)
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
return DESCRIPTOR_SEARCH_Fail;
else
- return DESCRIPTOR_SEARCH_NotFound;
+ return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
index a7bc1d34c..d23c89dd0 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/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,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "HIDReport.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define KEYBOARD_CLASS 0x03
@@ -53,7 +53,7 @@
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
-
+
/** Pipe number for the keyboard report data pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
@@ -74,5 +74,6 @@
uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);
uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor);
uint8_t DComp_NextHID(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
index 6b4df377d..d2dde64bd 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.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
@@ -46,7 +46,7 @@ uint8_t GetHIDReportData(void)
{
/* Create a buffer big enough to hold the entire returned HID report */
uint8_t HIDReportData[HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -66,7 +66,7 @@ uint8_t GetHIDReportData(void)
/* Send the HID report to the parser for processing */
if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful)
return ParseError;
-
+
return ParseSuccessful;
}
@@ -87,3 +87,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
*/
return (CurrentItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD);
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
index 09cace965..e18ad3aae 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.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/Host/HIDParser.h>
-
+
#include "KeyboardHostWithParser.h"
/* Macros: */
@@ -54,16 +54,16 @@
ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
-
+
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
-
+
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
-
+
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
@@ -78,5 +78,6 @@
uint8_t GetHIDReportData(void);
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
index 15bc94061..bdf4a2830 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.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 KeyboardHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardHostWithParser.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -134,7 +134,7 @@ void Keyboard_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -144,7 +144,7 @@ void Keyboard_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -167,9 +167,9 @@ void Keyboard_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);
-
+
/* Get and process the device's first HID report descriptor */
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
{
@@ -179,13 +179,13 @@ void Keyboard_HID_Task(void)
puts_P(PSTR("Not a valid Keyboard." ESC_FG_WHITE));
else
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
@@ -193,7 +193,7 @@ void Keyboard_HID_Task(void)
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
{
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
+
uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
@@ -212,7 +212,7 @@ void Keyboard_HID_Task(void)
break;
case HOST_STATE_Configured:
/* Select and unfreeze keyboard data pipe */
- Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
+ Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Check to see if a packet has been received */
@@ -226,11 +226,11 @@ void Keyboard_HID_Task(void)
/* Load in the keyboard report */
Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe());
-
+
/* Process the read in keyboard report from the device */
ProcessKeyboardReport(KeyboardReport);
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
@@ -262,11 +262,11 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
{
/* Retrieve the keyboard scan-code from the report data retrieved from the device */
bool FoundData = USB_GetHIDReportItemInfo(KeyboardReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
-
+
/* Key code is an unsigned char in length, cast to the appropriate type */
uint8_t KeyCode = (uint8_t)ReportItem->Value;
@@ -284,17 +284,18 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))
PressedKey = (KeyCode - 0x1E) + '0';
else if (KeyCode == 0x2C)
- PressedKey = ' ';
+ PressedKey = ' ';
else if (KeyCode == 0x28)
PressedKey = '\n';
-
+
/* Print the pressed key character out through the serial port if valid */
if (PressedKey)
putchar(PressedKey);
}
-
+
/* Once a scan-code is found, stop scanning through the report items */
break;
}
}
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h
index 4aaea382f..3a5f138a1 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.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
@@ -44,7 +44,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
#include "HIDReport.h"
@@ -60,7 +60,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 Keyboard_HID_Task(void);
void SetupHardware(void);
@@ -73,5 +73,6 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ProcessKeyboardReport(uint8_t* KeyboardReport);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt
index 5e122a38f..50f6c861d 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.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 Keyboard Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo 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>
@@ -41,20 +41,20 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
* application for implementing a USB Keyboard host, for USB keyboards using
* the standard Keyboard HID profile. It uses a HID parser for the HID reports,
* allowing for correct operation across all USB keyboards. This demo supports
* keyboards with a single HID report.
- *
+ *
* Pressed alpha-numeric, enter or space key is transmitted through the serial
* USART at serial settings 9600, 8, N, 1. On connection to a USB keyboard, the
* report items will be processed and printed as a formatted list through the
* USART before the keyboard is fully enumerated.
- *
- * Currently only single interface keyboards are supported.
+ *
+ * Currently only single interface keyboards are supported.
*
* \section SSec_Options Project Options
*
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile
index db8f91911..04bb9ab79 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/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/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
index 7feb31251..874fa7a3a 100644
--- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MIDIHost/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
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* MIDIInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -67,7 +67,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -93,7 +93,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);
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the MIDI data IN pipe */
Pipe_ConfigurePipe(MIDI_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -136,7 +136,7 @@ uint8_t DComp_NextMIDIStreamingInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -155,7 +155,7 @@ uint8_t DComp_NextMIDIStreamingDataEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
/* Check the endpoint type, break out if correct BULK type endpoint found */
if (EndpointType == EP_TYPE_BULK)
return DESCRIPTOR_SEARCH_Found;
@@ -167,3 +167,4 @@ uint8_t DComp_NextMIDIStreamingDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
index 80a05667d..57a36d924 100644
--- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MIDIHost/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,19 +38,19 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MIDIHost.h"
-
+
/* Macros: */
/** Interface Class value for the MIDI Audio class. */
#define MIDI_STREAMING_CLASS 0x01
-
+
/** Interface Class value for the MIDI Audio Streaming subclass. */
#define MIDI_STREAMING_SUBCLASS 0x03
/** Interface Class value for the MIDI Audio Streaming protocol. */
#define MIDI_STREAMING_PROTOCOL 0x00
-
+
/** Pipe number for the MIDI data IN pipe. */
#define MIDI_DATA_IN_PIPE 1
@@ -69,9 +69,10 @@
};
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
+ uint8_t ProcessConfigurationDescriptor(void);
+
uint8_t DComp_NextMIDIStreamingInterface(void* CurrentDescriptor);
uint8_t DComp_NextMIDIStreamingDataEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.c b/Demos/Host/LowLevel/MIDIHost/MIDIHost.c
index 7725f5d8a..63ed6da25 100644
--- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.c
+++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.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 MIDIHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MIDIHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -121,7 +121,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -137,7 +137,7 @@ void MIDI_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -147,7 +147,7 @@ void MIDI_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -155,7 +155,7 @@ void MIDI_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -176,16 +176,16 @@ void MIDI_Host_Task(void)
break;
case HOST_STATE_Configured:
Pipe_SelectPipe(MIDI_DATA_IN_PIPE);
-
+
if (Pipe_IsINReceived())
{
USB_MIDI_EventPacket_t MIDIEvent;
-
+
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-
+
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
-
+
if (NoteOnEvent || NoteOffEvent)
{
printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off",
@@ -195,19 +195,19 @@ void MIDI_Host_Task(void)
Pipe_ClearIN();
}
-
+
Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
-
+
static uint8_t PrevJoystickStatus;
if (Pipe_IsOUTReady())
{
uint8_t MIDICommand = 0;
uint8_t MIDIPitch;
-
+
uint8_t JoystickStatus = Joystick_GetStatus();
uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
-
+
/* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
@@ -228,7 +228,7 @@ void MIDI_Host_Task(void)
MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3E;
}
-
+
if (JoystickChanges & JOY_DOWN)
{
MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -248,19 +248,19 @@ void MIDI_Host_Task(void)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
-
+
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,
- .Data3 = MIDI_STANDARD_VELOCITY,
+ .Data3 = MIDI_STANDARD_VELOCITY,
};
-
+
/* Write the MIDI event packet to the pipe */
Pipe_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-
+
/* Send the data in the pipe to the device */
Pipe_ClearOUT();
}
-
+
/* Save previous joystick value for next joystick change detection */
PrevJoystickStatus = JoystickStatus;
}
@@ -268,3 +268,4 @@ void MIDI_Host_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.h b/Demos/Host/LowLevel/MIDIHost/MIDIHost.h
index 507f0787c..f7fb57a91 100644
--- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.h
+++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.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
@@ -51,19 +51,19 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/Joystick.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** MIDI command for a note on (activation) event. */
#define MIDI_COMMAND_NOTE_ON 0x90
/** MIDI command for a note off (deactivation) event. */
#define MIDI_COMMAND_NOTE_OFF 0x80
-
+
/** Standard key press velocity value used for all note events, as no pressure sensor is mounted. */
#define MIDI_STANDARD_VELOCITY 64
-
+
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
@@ -89,21 +89,22 @@
{
unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
-
+
uint8_t Data1; /**< First byte of data in the MIDI event */
uint8_t Data2; /**< Second byte of data in the MIDI event */
- uint8_t Data3; /**< Third byte of data in the MIDI event */
+ uint8_t Data3; /**< Third byte of data in the MIDI event */
} USB_MIDI_EventPacket_t;
/* Function Prototypes: */
void SetupHardware(void);
void MIDI_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt b/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt
index a90ae04d3..337dba72e 100644
--- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt
+++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.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 MIDI Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>MIDI Subclass</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* MIDI host demonstration application. This demo will enumerate an attached USB-MIDI device, and print incoming MIDI note
* on and off messages on any channel to the serial port. Pressing the board joystick will send note on and off messages to
@@ -57,3 +57,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MIDIHost/makefile b/Demos/Host/LowLevel/MIDIHost/makefile
index 36b231598..2940c5468 100644
--- a/Demos/Host/LowLevel/MIDIHost/makefile
+++ b/Demos/Host/LowLevel/MIDIHost/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
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,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
@@ -261,7 +261,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
@@ -274,7 +274,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)
@@ -286,7 +286,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)
@@ -298,7 +298,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 =
@@ -321,7 +321,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))
@@ -355,7 +355,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
@@ -389,7 +389,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
@@ -418,7 +418,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:
@@ -437,10 +437,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.
@@ -505,11 +505,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)
@@ -536,9 +536,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)
@@ -636,14 +636,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.
@@ -665,7 +665,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.
@@ -709,3 +709,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/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c
index 3468e0db9..f336d62bf 100644
--- a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MassStorageHost/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
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* MSInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -93,7 +93,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);
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the Mass Storage data IN pipe */
Pipe_ConfigurePipe(MASS_STORE_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -136,7 +136,7 @@ uint8_t DComp_NextMSInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -167,3 +167,4 @@ uint8_t DComp_NextMSInterfaceBulkDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h
index d75789192..92c984068 100644
--- a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MassStorageHost/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,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MassStorageHost.h"
-
+
/* Macros: */
/** Interface Class value for the Mass Storage Device class. */
#define MASS_STORE_CLASS 0x08
@@ -67,11 +67,12 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
uint8_t DComp_NextMSInterface(void* CurrentDescriptor);
uint8_t DComp_NextMSInterfaceBulkDataEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
index c86e51b0c..712589660 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.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
@@ -46,7 +46,7 @@
* larger value in the project makefile and passing it to the compiler
* via the -D switch.
*/
-
+
#define INCLUDE_FROM_MASSSTORE_COMMANDS_C
#include "MassStoreCommands.h"
@@ -85,13 +85,13 @@ static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlo
/* Send the data in the OUT pipe to the attached device */
Pipe_ClearOUT();
-
+
/* Wait until command has been sent */
Pipe_WaitUntilReady();
/* Freeze pipe after use */
Pipe_Freeze();
-
+
/* Send data if any */
if ((BufferPtr != NULL) &&
((ErrorCode = MassStore_SendReceiveData(SCSICommandBlock, BufferPtr)) != PIPE_READYWAIT_NoError))
@@ -99,7 +99,7 @@ static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlo
Pipe_Freeze();
return ErrorCode;
}
-
+
return ErrorCode;
}
@@ -116,12 +116,12 @@ static uint8_t MassStore_WaitForDataReceived(void)
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Wait until data received in the IN pipe */
while (!(Pipe_IsINReceived()))
{
uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
-
+
/* Check to see if a new frame has been issued (1ms elapsed) */
if (CurrentFrameNumber != PreviousFrameNumber)
{
@@ -133,7 +133,7 @@ static uint8_t MassStore_WaitForDataReceived(void)
if (!(TimeoutMSRem))
return PIPE_RWSTREAM_Timeout;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(MASS_STORE_DATA_OUT_PIPE);
Pipe_Unfreeze();
@@ -146,7 +146,7 @@ static uint8_t MassStore_WaitForDataReceived(void)
return PIPE_RWSTREAM_PipeStalled;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
@@ -159,15 +159,15 @@ static uint8_t MassStore_WaitForDataReceived(void)
return PIPE_RWSTREAM_PipeStalled;
}
-
+
/* Check to see if the device was disconnected, if so exit function */
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
};
-
+
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Freeze();
-
+
Pipe_SelectPipe(MASS_STORE_DATA_OUT_PIPE);
Pipe_Freeze();
@@ -194,11 +194,11 @@ static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSIComman
/* Wait until the device has replied with some data */
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Read in the block data from the pipe */
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -218,14 +218,14 @@ static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSIComman
/* Acknowledge the packet */
Pipe_ClearOUT();
-
+
while (!(Pipe_IsOUTReady()))
{
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
}
}
-
+
/* Freeze used pipe after use */
Pipe_Freeze();
@@ -249,21 +249,21 @@ static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICom
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Load in the CSW from the attached device */
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
/* Clear the data ready for next reception */
Pipe_ClearIN();
-
+
/* Freeze the IN pipe after use */
Pipe_Freeze();
-
+
/* Check to see if command failed */
if (SCSICommandStatus->Status != Command_Pass)
ErrorCode = MASS_STORE_SCSI_COMMAND_FAILED;
-
+
return ErrorCode;
}
@@ -282,7 +282,7 @@ uint8_t MassStore_MassStorageReset(void)
.wIndex = 0,
.wLength = 0,
};
-
+
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -312,7 +312,7 @@ uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)
.wIndex = 0,
.wLength = 1,
};
-
+
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -320,14 +320,14 @@ uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)
{
/* Clear the pipe stall */
Pipe_ClearStall();
-
+
/* Some faulty Mass Storage devices don't implement the GET_MAX_LUN request, so assume a single LUN */
*MaxLUNIndex = 0;
-
+
/* Clear the error, and pretend the request executed correctly if the device STALLed it */
ErrorCode = HOST_SENDCONTROL_Successful;
}
-
+
return ErrorCode;
}
@@ -362,7 +362,7 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -371,7 +371,7 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -413,7 +413,7 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -422,7 +422,7 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -474,7 +474,7 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -483,7 +483,7 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -535,7 +535,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -544,7 +544,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -564,7 +564,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
*/
uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
{
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue TEST UNIT READY command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
@@ -584,7 +584,7 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -593,7 +593,7 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -639,7 +639,7 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -648,11 +648,11 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Endian-correct the read data */
CapacityPtr->Blocks = SwapEndian_32(CapacityPtr->Blocks);
CapacityPtr->BlockSize = SwapEndian_32(CapacityPtr->BlockSize);
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -695,7 +695,7 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -704,7 +704,7 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -714,3 +714,4 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
return ErrorCode;
}
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h
index 628066363..8fcffe424 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.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 MassStoreCommands.c.
*/
-
+
#ifndef _MASS_STORE_COMMANDS_H_
#define _MASS_STORE_COMMANDS_H_
@@ -56,16 +56,16 @@
/** Command Static Wrapper signature byte, for verification of valid CSW blocks. */
#define CSW_SIGNATURE 0x53425355UL
-
+
/** Data direction mask for the Flags field of a CBW, indicating Host-to-Device transfer direction. */
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)
/** Data direction mask for the Flags field of a CBW, indicating Device-to-Host transfer direction. */
#define COMMAND_DIRECTION_DATA_IN (1 << 7)
-
+
/** Timeout period between the issuing of a CBW to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
-
+
/** Additional error code for Mass Storage functions when a device returns a logical command failure. */
#define MASS_STORE_SCSI_COMMAND_FAILED 0xC0
@@ -83,7 +83,7 @@
uint8_t SCSICommandLength; /**< Length of the SCSI command in the CBW */
uint8_t SCSICommandData[16]; /**< SCSI command to issue to the device */
} CommandBlockWrapper_t;
-
+
/** Type define for a Mass Storage class Command Status Wrapper, used to wrap SCSI
* responses for transport over the USB bulk endpoints from the device.
*/
@@ -94,7 +94,7 @@
uint32_t DataTransferResidue; /**< Length of data not transferred */
uint8_t Status; /**< Command status, a value from the MassStorageHost_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
-
+
/** Type define for a SCSI Sense structure. Structures of this type are filled out by the
* device via the \ref MassStore_RequestSense() function, indicating the current sense data of the
* device (giving explicit error codes for the last issued command). For details of the
@@ -105,13 +105,13 @@
uint8_t ResponseCode;
uint8_t SegmentNumber;
-
+
unsigned char SenseKey : 4;
unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
-
+
uint8_t Information[4];
uint8_t AdditionalLength;
uint8_t CmdSpecificInformation[4];
@@ -129,12 +129,12 @@
{
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
-
+
unsigned char Reserved : 7;
unsigned char Removable : 1;
-
+
uint8_t Version;
-
+
unsigned char ResponseDataFormat : 4;
unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
@@ -152,12 +152,12 @@
unsigned char WideBus16Bit : 1;
unsigned char WideBus32Bit : 1;
unsigned char RelAddr : 1;
-
+
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
} SCSI_Inquiry_Response_t;
-
+
/** SCSI capacity structure, to hold the total capacity of the device in both the number
* of blocks in the current LUN, and the size of each block. This structure is filled by
* the device when the \ref MassStore_ReadCapacity() function is called.
@@ -176,7 +176,7 @@
Command_Fail = 1, /**< Command failed to complete successfully */
Phase_Error = 2 /**< Phase error while processing the issued command */
};
-
+
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MASSSTORE_COMMANDS_C)
static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlock,
@@ -186,7 +186,7 @@
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICommandStatus) ATTR_NON_NULL_PTR_ARG(1);
#endif
-
+
uint8_t MassStore_MassStorageReset(void);
uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex);
uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
@@ -210,3 +210,4 @@
const bool PreventRemoval);
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h b/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h
index a69aa56fe..6bcd5780f 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.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
@@ -34,7 +34,7 @@
* the SCSI standard documentation for more information on each SCSI command and
* the SENSE data.
*/
-
+
#ifndef _SCSI_CODES_H_
#define _SCSI_CODES_H_
@@ -84,3 +84,4 @@
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c
index 985aeeb08..93c62e74f 100644
--- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c
+++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.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
@@ -124,7 +124,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -139,7 +139,7 @@ void MassStorage_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -149,7 +149,7 @@ void MassStorage_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -171,7 +171,7 @@ void MassStorage_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Mass Storage Disk Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
@@ -179,28 +179,28 @@ void MassStorage_Task(void)
case HOST_STATE_Configured:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
/* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = MassStore_GetMaxLUN(&MassStore_MaxLUNIndex)) != HOST_SENDCONTROL_Successful)
- {
+ {
ShowDiskReadError(PSTR("Get Max LUN"), ErrorCode);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Print number of LUNs detected in the attached device */
printf_P(PSTR("Total LUNs: %d - Using first LUN in device.\r\n"), (MassStore_MaxLUNIndex + 1));
-
+
/* Reset the Mass Storage device interface, ready for use */
if ((ErrorCode = MassStore_MassStorageReset()) != HOST_SENDCONTROL_Successful)
{
ShowDiskReadError(PSTR("Mass Storage Reset"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Get sense data from the device - many devices will not accept any other commands until the sense data
* is read - both on start-up and after a failed command */
SCSI_Request_Sense_Response_t SenseData;
@@ -210,12 +210,12 @@ void MassStorage_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the prevent removal flag for the device, allowing it to be accessed */
if ((ErrorCode = MassStore_PreventAllowMediumRemoval(0, true)) != 0)
{
ShowDiskReadError(PSTR("Prevent/Allow Medium Removal"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -225,14 +225,14 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_Inquiry(0, &InquiryData)) != 0)
{
ShowDiskReadError(PSTR("Inquiry"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
/* Print vendor and product names of attached device */
printf_P(PSTR("Vendor \"%.8s\", Product \"%.16s\"\r\n"), InquiryData.VendorID, InquiryData.ProductID);
-
+
/* Wait until disk ready */
puts_P(PSTR("Waiting until ready.."));
@@ -246,7 +246,7 @@ void MassStorage_Task(void)
/* Check to see if the attached device is ready for new commands */
ErrorCode = MassStore_TestUnitReady(0);
-
+
/* If attached device is ready, abort the loop */
if (!(ErrorCode))
break;
@@ -270,11 +270,11 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_ReadCapacity(0, &DiskCapacity)) != 0)
{
ShowDiskReadError(PSTR("Read Capacity"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Display the disk capacity in blocks * block size bytes */
printf_P(PSTR("%lu blocks of %lu bytes.\r\n"), DiskCapacity.Blocks, DiskCapacity.BlockSize);
@@ -285,11 +285,11 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_ReadDeviceBlock(0, 0x00000000, 1, DiskCapacity.BlockSize, BlockBuffer)) != 0)
{
ShowDiskReadError(PSTR("Read Device Block"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("\r\nContents of first block:\r\n"));
/* Print out the first block in both HEX and ASCII, 16 bytes per line */
@@ -297,30 +297,30 @@ void MassStorage_Task(void)
{
/* Pointer to the start of the current 16-byte chunk in the read block of data */
uint8_t* ChunkPtr = &BlockBuffer[Chunk << 4];
-
+
/* Print out the 16 bytes of the chunk in HEX format */
for (uint8_t ByteOffset = 0; ByteOffset < (1 << 4); ByteOffset++)
{
char CurrByte = *(ChunkPtr + ByteOffset);
-
+
printf_P(PSTR("%.2X "), CurrByte);
}
-
+
puts_P(PSTR(" "));
/* Print out the 16 bytes of the chunk in ASCII format */
for (uint8_t ByteOffset = 0; ByteOffset < (1 << 4); ByteOffset++)
{
char CurrByte = *(ChunkPtr + ByteOffset);
-
+
putchar(isprint(CurrByte) ? CurrByte : '.');
}
-
+
puts_P(PSTR("\r\n"));
}
-
+
puts_P(PSTR("\r\n\r\nPress board button to read entire ASCII contents of disk...\r\n\r\n"));
-
+
/* Wait for the board button to be pressed */
while (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
{
@@ -332,7 +332,7 @@ void MassStorage_Task(void)
/* Abort if device removed */
if (USB_HostState == HOST_STATE_Unattached)
break;
-
+
/* Print out the entire disk contents in ASCII format */
for (uint32_t CurrBlockAddress = 0; CurrBlockAddress < DiskCapacity.Blocks; CurrBlockAddress++)
{
@@ -340,7 +340,7 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_ReadDeviceBlock(0, CurrBlockAddress, 1, DiskCapacity.BlockSize, BlockBuffer)) != 0)
{
ShowDiskReadError(PSTR("Read Device Block"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -349,7 +349,7 @@ void MassStorage_Task(void)
for (uint16_t Byte = 0; Byte < DiskCapacity.BlockSize; Byte++)
{
char CurrByte = BlockBuffer[Byte];
-
+
putchar(isprint(CurrByte) ? CurrByte : '.');
}
@@ -357,10 +357,10 @@ void MassStorage_Task(void)
if (USB_HostState == HOST_STATE_Unattached)
break;
}
-
+
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
@@ -386,7 +386,7 @@ void ShowDiskReadError(char* CommandString,
{
/* Display the error code */
printf_P(PSTR(ESC_FG_RED "Command error (%S).\r\n"), CommandString);
- printf_P(PSTR(" -- Error Code: %d" ESC_FG_WHITE), ErrorCode);
+ printf_P(PSTR(" -- Error Code: %d" ESC_FG_WHITE), ErrorCode);
}
Pipe_Freeze();
@@ -394,3 +394,4 @@ void ShowDiskReadError(char* CommandString,
/* Indicate device error via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h
index 7aabe9f7d..ef937b7be 100644
--- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h
+++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.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 MassStoreHost.c.
*/
-
+
#ifndef _MASS_STORE_HOST_H_
#define _MASS_STORE_HOST_H_
@@ -72,11 +72,11 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Function Prototypes: */
void MassStorage_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -88,3 +88,4 @@
const uint8_t ErrorCode);
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt
index 23f083dea..45d78c43b 100644
--- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt
+++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.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 Mass Storage Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bulk Only</td>
* </tr>
@@ -42,12 +42,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mass Storage host demonstration application. This gives a simple reference
* application for implementing a USB Mass Storage host, for USB storage devices
* using the standard Mass Storage USB profile.
- *
+ *
* The first 512 bytes (boot sector) of an attached disk's memory will be dumped
* out of the serial port in HEX and ASCII form when it is attached to the AT90USB1287
* AVR. The device will then wait for HWB to be pressed, whereupon the entire ASCII contents
@@ -65,3 +65,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/makefile b/Demos/Host/LowLevel/MassStorageHost/makefile
index 15db4bd67..7d8352351 100644
--- a/Demos/Host/LowLevel/MassStorageHost/makefile
+++ b/Demos/Host/LowLevel/MassStorageHost/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
@@ -136,7 +136,7 @@ SRC = $(TARGET).c \
# 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/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
index b5d62236e..83e0c5338 100644
--- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MouseHost/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;
@@ -88,7 +88,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);
@@ -96,12 +96,12 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
+
/* Valid data found, return success */
return SuccessfulConfigRead;
}
@@ -127,7 +127,7 @@ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -162,3 +162,4 @@ uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor)
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
index 71fbadedd..57d71e692 100644
--- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MouseHost/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,19 +38,19 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MouseHost.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define MOUSE_CLASS 0x03
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define MOUSE_PROTOCOL 0x02
-
+
/** Pipe number for the mouse data IN pipe. */
#define MOUSE_DATA_IN_PIPE 1
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
enum MouseHost_GetConfigDescriptorDataCodes_t
@@ -69,3 +69,4 @@
uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.c b/Demos/Host/LowLevel/MouseHost/MouseHost.c
index 05efa25c5..a7bda5ae5 100644
--- a/Demos/Host/LowLevel/MouseHost/MouseHost.c
+++ b/Demos/Host/LowLevel/MouseHost/MouseHost.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 MouseHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MouseHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -64,7 +64,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
SerialStream_Init(9600, false);
LEDs_Init();
@@ -132,7 +132,7 @@ void ReadNextReport(void)
uint8_t LEDMask = LEDS_NO_LEDS;
/* Select mouse data pipe */
- Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
+ Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
@@ -142,10 +142,10 @@ void ReadNextReport(void)
{
/* No packet received (no movement), turn off LEDs */
LEDs_SetAllLEDs(LEDS_NO_LEDS);
-
+
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
@@ -153,14 +153,14 @@ void ReadNextReport(void)
if (Pipe_IsReadWriteAllowed())
{
/* Read in mouse report data */
- Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
+ Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
/* Alter status LEDs according to mouse X movement */
if (MouseReport.X > 0)
LEDMask |= LEDS_LED1;
else if (MouseReport.X < 0)
LEDMask |= LEDS_LED2;
-
+
/* Alter status LEDs according to mouse Y movement */
if (MouseReport.Y > 0)
LEDMask |= LEDS_LED3;
@@ -170,9 +170,9 @@ void ReadNextReport(void)
/* Alter status LEDs according to mouse button position */
if (MouseReport.Button)
LEDMask = LEDS_ALL_LEDS;
-
+
LEDs_SetAllLEDs(LEDMask);
-
+
/* Print mouse report data through the serial port */
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
MouseReport.Y,
@@ -198,7 +198,7 @@ void Mouse_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -208,7 +208,7 @@ void Mouse_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -225,12 +225,12 @@ void Mouse_HID_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* HID class request to set the mouse protocol to the Boot Protocol */
USB_ControlRequest = (USB_Request_Header_t)
{
@@ -252,7 +252,7 @@ void Mouse_HID_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
@@ -269,3 +269,4 @@ void Mouse_HID_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.h b/Demos/Host/LowLevel/MouseHost/MouseHost.h
index 8947436e6..dc75013f8 100644
--- a/Demos/Host/LowLevel/MouseHost/MouseHost.h
+++ b/Demos/Host/LowLevel/MouseHost/MouseHost.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
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class Specific request to set the report protocol mode. */
#define REQ_SetProtocol 0x0B
@@ -76,11 +76,11 @@
int8_t X; /**< Current delta X movement of the mouse */
int8_t Y; /**< Current delta Y movement on the mouse */
} USB_MouseReport_Data_t;
-
+
/* Function Prototypes: */
void Mouse_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -89,5 +89,6 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.txt b/Demos/Host/LowLevel/MouseHost/MouseHost.txt
index be608db2f..b659abada 100644
--- a/Demos/Host/LowLevel/MouseHost/MouseHost.txt
+++ b/Demos/Host/LowLevel/MouseHost/MouseHost.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 Mouse Host Demo
*
* \section SSec_Compat Demo 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>
@@ -41,23 +41,23 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host demonstration application. This gives a simple reference
* application for implementing a USB Mouse host, for USB mice using
* the standard mouse HID profile.
- *
+ *
* Mouse movement and button presses are displayed on the board LEDs,
* as well as printed out the serial terminal as formatted dY, dY and
* button status information.
- *
+ *
* This uses a naive method where the mouse is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* MouseHostWithParser demo application.
- *
- * Currently only single interface mice are supported.
+ *
+ * Currently only single interface mice are supported.
*
* \section SSec_Options Project Options
*
@@ -71,3 +71,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MouseHost/makefile b/Demos/Host/LowLevel/MouseHost/makefile
index 1369db77d..d35b1da5c 100644
--- a/Demos/Host/LowLevel/MouseHost/makefile
+++ b/Demos/Host/LowLevel/MouseHost/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
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,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
@@ -261,7 +261,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
@@ -274,7 +274,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)
@@ -286,7 +286,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)
@@ -298,7 +298,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 =
@@ -321,7 +321,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))
@@ -355,7 +355,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
@@ -389,7 +389,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
@@ -418,7 +418,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:
@@ -437,10 +437,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.
@@ -505,11 +505,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)
@@ -536,9 +536,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)
@@ -636,14 +636,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.
@@ -665,7 +665,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.
@@ -709,3 +709,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/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
index dc8ada879..7a1a6faaa 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/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_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -67,7 +67,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -82,7 +82,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);
@@ -93,14 +93,14 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
-
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+
/* 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);
@@ -108,7 +108,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -140,7 +140,7 @@ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -181,5 +181,6 @@ uint8_t DComp_NextHID(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
- return DESCRIPTOR_SEARCH_NotFound;
+ return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
index b2a2e3890..504bc0b76 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/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 "HIDReport.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define MOUSE_CLASS 0x03
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define MOUSE_PROTOCOL 0x02
-
+
/** Descriptor header type constant for a HID descriptor. */
#define DTYPE_HID 0x21
@@ -56,7 +56,7 @@
/** Pipe number for the mouse report data pipe. */
#define MOUSE_DATA_IN_PIPE 1
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
enum MouseHostWithParser_GetConfigDescriptorDataCodes_t
@@ -76,3 +76,4 @@
uint8_t DComp_NextHID(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c
index 327ae45ec..18799c27f 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.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
@@ -46,7 +46,7 @@ uint8_t GetHIDReportData(void)
{
/* Create a buffer big enough to hold the entire returned HID report */
uint8_t HIDReportData[HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -66,7 +66,7 @@ uint8_t GetHIDReportData(void)
/* Send the HID report to the parser for processing */
if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful)
return ParseError;
-
+
return ParseSuccessful;
}
@@ -100,7 +100,7 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
/* If a collection with the mouse usage was not found, indicate that we are not interested in this item */
if (!IsMouse)
return false;
-
+
/* Check the attributes of the current mouse item - see if we are interested in it or not;
* only store BUTTON and GENERIC_DESKTOP_CONTROL items into the Processed HID Report
* structure to save RAM and ignore the rest
@@ -108,3 +108,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
}
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h
index bd12a39c1..19cfd753c 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.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/Host/HIDParser.h>
-
+
#include "MouseHostWithParser.h"
/* Macros: */
@@ -60,7 +60,7 @@
/** HID Report Descriptor Usage value for a Scroll Wheel movement. */
#define USAGE_SCROLL_WHEEL 0x38
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
enum MouseHostWithParser_GetHIDReportDataCodes_t
@@ -69,16 +69,16 @@
ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
-
+
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
-
+
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
-
+
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
@@ -91,7 +91,8 @@
/* Function Prototypes: */
uint8_t GetHIDReportData(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
index a0240b04a..185871d4a 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.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 MouseHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MouseHostWithParser.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -64,7 +64,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
SerialStream_Init(9600, false);
LEDs_Init();
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -135,7 +135,7 @@ void Mouse_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -145,7 +145,7 @@ void Mouse_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -153,7 +153,7 @@ void Mouse_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -162,12 +162,12 @@ void Mouse_HID_Task(void)
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);
/* Get and process the device's first HID report descriptor */
@@ -179,21 +179,21 @@ void Mouse_HID_Task(void)
puts_P(PSTR("Not a valid Mouse." ESC_FG_WHITE));
else
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
{
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
+
uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
@@ -212,9 +212,9 @@ void Mouse_HID_Task(void)
break;
case HOST_STATE_Configured:
/* Select and unfreeze mouse data pipe */
- Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
+ Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
@@ -226,11 +226,11 @@ void Mouse_HID_Task(void)
/* Load in the mouse report */
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe());
-
+
/* Process the read in mouse report from the device */
ProcessMouseReport(MouseReport);
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
@@ -255,7 +255,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
{
/* Create a temporary item pointer to the next report item */
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
-
+
bool FoundData;
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
@@ -263,7 +263,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
{
/* Get the mouse button value */
FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
@@ -276,14 +276,14 @@ void ProcessMouseReport(uint8_t* MouseReport)
(ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) &&
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
- /* Get the mouse wheel value if it is contained within the current
+ /* Get the mouse wheel value if it is contained within the current
* report, if not, skip to the next item in the parser list
*/
if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))
- continue;
+ continue;
int16_t WheelDelta = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
if (WheelDelta)
LEDMask = (LEDS_LED1 | LEDS_LED2 | ((WheelDelta > 0) ? LEDS_LED3 : LEDS_LED4));
}
@@ -294,13 +294,13 @@ void ProcessMouseReport(uint8_t* MouseReport)
{
/* Get the mouse relative position value */
FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
-
+
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
/* Check to see if a (non-zero) delta movement has been indicated */
if (DeltaMovement)
{
@@ -312,7 +312,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
}
}
}
-
+
/* Display the button information on the board LEDs */
LEDs_SetAllLEDs(LEDMask);
-} \ No newline at end of file
+}
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h
index a51b7a25d..4e492f61c 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.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
@@ -49,7 +49,7 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "ConfigDescriptor.h"
#include "HIDReport.h"
@@ -69,7 +69,7 @@
/* Function Prototypes: */
void Mouse_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -80,3 +80,4 @@
void ProcessMouseReport(uint8_t* MouseReport);
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt
index febd4a939..fdcdb6153 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.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 Mouse Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo 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>
@@ -41,19 +41,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host demonstration application. This gives a simple reference
* application for implementing a USB Mouse host, for USB mice using
* the standard mouse HID profile. It uses a HID parser for the HID
* reports, allowing for correct operation across all USB mice. This
* demo supports mice with a single HID report.
- *
+ *
* Mouse and scroll wheel movement and button presses are displayed
* on the board LEDs. On connection to a USB mouse, the report items
* will be processed and printed as a formatted list through the USART
* before the mouse is fully enumerated.
- *
+ *
* Currently only single interface mice are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/makefile b/Demos/Host/LowLevel/MouseHostWithParser/makefile
index cd1907272..9ea09fa0c 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/makefile
+++ b/Demos/Host/LowLevel/MouseHostWithParser/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/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
index 89bf488be..b269820e4 100644
--- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/PrinterHost/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
@@ -49,7 +49,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* PrinterInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -66,7 +66,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -81,7 +81,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 */
PrinterInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
@@ -92,7 +92,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);
@@ -102,10 +102,10 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Save Printer interface details for later use */
PrinterInterfaceNumber = PrinterInterface->InterfaceNumber;
- PrinterAltSetting = PrinterInterface->AlternateSetting;
+ PrinterAltSetting = PrinterInterface->AlternateSetting;
/* Configure the Printer data IN pipe */
Pipe_ConfigurePipe(PRINTER_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
@@ -140,7 +140,7 @@ uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -171,3 +171,4 @@ uint8_t DComp_NextPrinterInterfaceBulkDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
index b0cd56b19..b25f3bdc7 100644
--- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/PrinterHost/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
@@ -33,10 +33,10 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "PrinterHost.h"
#include "Lib/PrinterCommands.h"
-
+
/* Macros: */
/** Interface Class value for the Printer Device class. */
#define PRINTER_CLASS 0x07
@@ -63,22 +63,23 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* External Variables: */
/** Interface index of the Bidirectional Printer interface within the device, once the Configuration
* Descriptor has been processed.
*/
uint8_t PrinterInterfaceNumber;
-
+
/** Interface Alternate Setting index of the Bidirectional Printer interface within the device, once
* the Configuration Descriptor has been processed.
*/
uint8_t PrinterAltSetting;
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor);
uint8_t DComp_NextPrinterInterfaceBulkDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
index 0b75d7507..da79e03cc 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.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
@@ -51,14 +51,14 @@ uint8_t Printer_SendData(const void* const PrinterCommands,
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
Pipe_Unfreeze();
-
+
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, CommandSize)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();
-
+
Pipe_WaitUntilReady();
-
+
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
@@ -86,33 +86,33 @@ uint8_t Printer_GetDeviceID(char* DeviceIDString,
.wIndex = PrinterInterfaceNumber,
.wLength = sizeof(DeviceIDStringLength),
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
if (!(DeviceIDStringLength))
{
DeviceIDString[0] = 0x00;
return HOST_SENDCONTROL_Successful;
}
-
+
DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength);
if (DeviceIDStringLength > BufferSize)
DeviceIDStringLength = BufferSize;
USB_ControlRequest.wLength = DeviceIDStringLength;
-
+
if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
/* Move string back two characters to remove the string length value from the start of the array */
memmove(&DeviceIDString[0], &DeviceIDString[2], DeviceIDStringLength - 2);
DeviceIDString[DeviceIDStringLength - 2] = 0x00;
-
+
return HOST_SENDCONTROL_Successful;
}
diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
index 9cd768efa..812ff7e5a 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.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 PrinterCommands.c.
*/
-
+
#ifndef _PRINTER_COMMANDS_H_
#define _PRINTER_COMMANDS_H_
@@ -41,7 +41,7 @@
#include <string.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../PrinterHost.h"
/* Macros: */
@@ -53,7 +53,7 @@
/** Printer class-specific request to soft-reset the device. */
#define REQ_SoftReset 2
-
+
/* Function Prototypes: */
uint8_t Printer_SendData(const void* const PrinterCommands,
const uint16_t CommandSize);
@@ -61,5 +61,6 @@
const uint16_t BufferSize);
uint8_t Printer_GetPortStatus(uint8_t* const PortStatus);
uint8_t Printer_SoftReset(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
index f12c95ef9..88a1a8c43 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.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
@@ -47,7 +47,7 @@ int main(void)
puts_P(PSTR(ESC_FG_CYAN "Printer Host Demo running.\r\n" ESC_FG_WHITE));
sei();
-
+
for (;;)
{
USB_Printer_Host();
@@ -134,10 +134,10 @@ void USB_Printer_Host(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Select the control pipe for the request transfer */
- Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -147,7 +147,7 @@ void USB_Printer_Host(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n"), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -155,7 +155,7 @@ void USB_Printer_Host(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -169,7 +169,7 @@ void USB_Printer_Host(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Some printers use alternate settings to determine the communication protocol used - if so, send a SetInterface
* request to switch to the interface alternate setting with the Bidirectional protocol */
if (PrinterAltSetting)
@@ -182,7 +182,7 @@ void USB_Printer_Host(void)
.wIndex = PrinterInterfaceNumber,
.wLength = 0,
};
-
+
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Control Error (Set Interface).\r\n"
@@ -193,12 +193,12 @@ void USB_Printer_Host(void)
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
}
-
+
puts_P(PSTR("Retrieving Device ID...\r\n"));
-
+
char DeviceIDString[300];
if ((ErrorCode = Printer_GetDeviceID(DeviceIDString, sizeof(DeviceIDString))) != HOST_SENDCONTROL_Successful)
{
@@ -222,10 +222,10 @@ void USB_Printer_Host(void)
case HOST_STATE_Configured:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
char TestPageData[] = "\033%-12345X\033E" "LUFA PCL Test Page" "\033E\033%-12345X";
uint16_t TestPageLength = strlen(TestPageData);
-
+
printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), TestPageLength);
if ((ErrorCode = Printer_SendData(&TestPageData, TestPageLength)) != PIPE_RWSTREAM_NoError)
@@ -242,7 +242,7 @@ void USB_Printer_Host(void)
}
puts_P(PSTR("Test Page Sent.\r\n"));
-
+
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -250,3 +250,4 @@ void USB_Printer_Host(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
index 2ba270f7d..1825d9f17 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.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 PrinterHost.c.
*/
-
+
#ifndef _MASS_STORE_HOST_H_
#define _MASS_STORE_HOST_H_
@@ -66,13 +66,13 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* External Variables: */
extern uint8_t PrinterInterfaceNumber;
-
+
/* Function Prototypes: */
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -86,3 +86,4 @@
void USB_Printer_Host(void);
#endif
+
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt b/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
index 92d43310b..e6b810dbc 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.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 Printer Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Printer Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bidirectional Protocol</td>
* </tr>
@@ -38,16 +38,16 @@
* Full Speed Mode</td>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Printer host demonstration application. This gives a simple reference
* application for implementing a USB Printer host, for USB printers using
* the bidirectional data encapsulation protocol and PCL language.
- *
+ *
* Upon connection of a compatible printer, the printer's device ID is sent
* to the AVR's serial port, and a simple test page is printed using the PCL
* printer language.
- *
+ *
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/PrinterHost/makefile b/Demos/Host/LowLevel/PrinterHost/makefile
index b8c162522..f64184ba0 100644
--- a/Demos/Host/LowLevel/PrinterHost/makefile
+++ b/Demos/Host/LowLevel/PrinterHost/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/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
index 58e1408c1..1190d28b7 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/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
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* RNDISControlInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -85,7 +85,7 @@ uint8_t ProcessConfigurationDescriptor(void)
{
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
- }
+ }
/* Clear any found endpoints */
DataINEndpoint = NULL;
@@ -111,7 +111,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);
@@ -129,7 +129,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the RNDIS data IN pipe */
Pipe_ConfigurePipe(RNDIS_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -167,7 +167,7 @@ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -191,7 +191,7 @@ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -211,7 +211,7 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
@@ -222,3 +222,4 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
index 834493742..b4a056f85 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/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,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "RNDISEthernetHost.h"
-
+
/* Macros: */
/** Interface Class value for the CDC class. */
#define CDC_CONTROL_CLASS 0x02
@@ -50,7 +50,7 @@
/** Interface Class value for the CDC RNDIS vendor specific protocol. */
#define CDC_CONTROL_PROTOCOL 0xFF
-
+
/** Interface Class value for the CDC data class. */
#define CDC_DATA_CLASS 0x0A
@@ -59,7 +59,7 @@
/** Interface Class value for the CDC data protocol. */
#define CDC_DATA_PROTOCOL 0x00
-
+
/** Pipe number for the RNDIS data IN pipe. */
#define RNDIS_DATA_IN_PIPE 1
@@ -81,10 +81,11 @@
};
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
+ uint8_t ProcessConfigurationDescriptor(void);
+
uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c
index 64cfc3ce6..661762b8b 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.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
@@ -83,7 +83,7 @@ uint8_t RNDIS_GetEncapsulatedResponse(void* const Buffer,
.wIndex = 0,
.wLength = Length,
};
-
+
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -102,7 +102,7 @@ uint8_t RNDIS_SendKeepAlive(void)
RNDIS_KeepAlive_Message_t KeepAliveMessage;
RNDIS_KeepAlive_Complete_t KeepAliveMessageResponse;
-
+
KeepAliveMessage.MessageType = REMOTE_NDIS_KEEPALIVE_MSG;
KeepAliveMessage.MessageLength = sizeof(RNDIS_KeepAlive_Message_t);
KeepAliveMessage.RequestId = RequestID++;
@@ -112,13 +112,13 @@ uint8_t RNDIS_SendKeepAlive(void)
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&KeepAliveMessageResponse,
sizeof(RNDIS_KeepAlive_Complete_t))) != HOST_SENDCONTROL_Successful)
{
return ErrorCode;
}
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -145,13 +145,13 @@ uint8_t RNDIS_InitializeDevice(const uint16_t HostMaxPacketSize,
InitMessage.MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
InitMessage.MinorVersion = REMOTE_NDIS_VERSION_MINOR;
InitMessage.MaxTransferSize = HostMaxPacketSize;
-
+
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(&InitMessage,
sizeof(RNDIS_Initialize_Message_t))) != HOST_SENDCONTROL_Successful)
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&InitMessageResponse,
sizeof(RNDIS_Initialize_Complete_t))) != HOST_SENDCONTROL_Successful)
{
@@ -160,9 +160,9 @@ uint8_t RNDIS_InitializeDevice(const uint16_t HostMaxPacketSize,
if (InitMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
return RNDIS_COMMAND_FAILED;
-
+
*DeviceMaxPacketSize = InitMessageResponse.MaxTransferSize;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -186,18 +186,18 @@ uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid,
RNDIS_Set_Message_t SetMessage;
uint8_t ContiguousBuffer[Length];
} SetMessageData;
-
+
RNDIS_Set_Complete_t SetMessageResponse;
-
+
SetMessageData.SetMessage.MessageType = REMOTE_NDIS_SET_MSG;
SetMessageData.SetMessage.MessageLength = sizeof(RNDIS_Set_Message_t) + Length;
SetMessageData.SetMessage.RequestId = RequestID++;
-
+
SetMessageData.SetMessage.Oid = Oid;
SetMessageData.SetMessage.InformationBufferLength = Length;
SetMessageData.SetMessage.InformationBufferOffset = (sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t));
SetMessageData.SetMessage.DeviceVcHandle = 0;
-
+
memcpy(&SetMessageData.ContiguousBuffer, Buffer, Length);
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(&SetMessageData,
@@ -205,7 +205,7 @@ uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid,
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&SetMessageResponse,
sizeof(RNDIS_Set_Complete_t))) != HOST_SENDCONTROL_Successful)
{
@@ -214,7 +214,7 @@ uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid,
if (SetMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
return RNDIS_COMMAND_FAILED;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -244,7 +244,7 @@ uint8_t RNDIS_QueryRNDISProperty(const uint32_t Oid,
QueryMessage.MessageType = REMOTE_NDIS_QUERY_MSG;
QueryMessage.MessageLength = sizeof(RNDIS_Query_Message_t);
QueryMessage.RequestId = RequestID++;
-
+
QueryMessage.Oid = Oid;
QueryMessage.InformationBufferLength = 0;
QueryMessage.InformationBufferOffset = 0;
@@ -255,7 +255,7 @@ uint8_t RNDIS_QueryRNDISProperty(const uint32_t Oid,
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&QueryMessageResponseData,
sizeof(QueryMessageResponseData))) != HOST_SENDCONTROL_Successful)
{
@@ -284,7 +284,7 @@ uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength)
Pipe_SelectPipe(RNDIS_DATA_IN_PIPE);
Pipe_SetPipeToken(PIPE_TOKEN_IN);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
*PacketLength = 0;
@@ -293,17 +293,18 @@ uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength)
}
RNDIS_Packet_Message_t DeviceMessage;
-
+
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t))) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
*PacketLength = (uint16_t)DeviceMessage.DataLength;
-
+
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)));
-
+
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h
index 56b4946e6..f474c9bd8 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.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,9 +40,9 @@
#include <avr/io.h>
#include <stdio.h>
#include <string.h>
-
+
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "RNDISConstants.h"
#include "../RNDISEthernetHost.h"
@@ -69,19 +69,19 @@
uint32_t VcHandle;
uint32_t Reserved;
} RNDIS_Packet_Message_t;
-
+
/** Type define for a RNDIS Initialize command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t MaxTransferSize;
} RNDIS_Initialize_Message_t;
-
+
/** Type define for a RNDIS Initialize complete response message. */
typedef struct
{
@@ -89,7 +89,7 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t DeviceFlags;
@@ -100,7 +100,7 @@
uint32_t AFListOffset;
uint32_t AFListSize;
} RNDIS_Initialize_Complete_t;
-
+
/** Type define for a RNDIS Keep-alive command message. */
typedef struct
{
@@ -127,14 +127,14 @@
uint32_t AddressingReset;
} RNDIS_Reset_Complete_t;
-
+
/** Type define for a RNDIS Set command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
@@ -149,20 +149,20 @@
uint32_t RequestId;
uint32_t Status;
} RNDIS_Set_Complete_t;
-
+
/** Type define for a RNDIS Query command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_Query_Message_t;
-
+
/** Type define for a RNDIS Query complete response message. */
typedef struct
{
@@ -170,7 +170,7 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
} RNDIS_Query_Complete_t;
@@ -187,7 +187,7 @@
/** Implemented RNDIS Version Minor. */
#define REMOTE_NDIS_VERSION_MINOR 0x00
-
+
/** Additional error code for RNDIS functions when a device returns a logical command failure. */
#define RNDIS_COMMAND_FAILED 0xC0
@@ -209,3 +209,4 @@
uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength);
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h
index efe22b699..273fdb81e 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.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
@@ -33,7 +33,7 @@
* RNDIS specification related constants. For more information on these
* constants, please refer to the Microsoft RNDIS specification.
*/
-
+
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
@@ -52,19 +52,19 @@
#define REMOTE_NDIS_SET_CMPLT 0x80000005UL
#define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
-
+
#define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
#define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
#define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
#define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
#define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
-
+
#define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
-
+
#define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
-
+
#define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
@@ -79,8 +79,8 @@
#define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
#define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
- #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
-
+ #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
+
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
@@ -110,3 +110,4 @@
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c
index 1da5b4dbf..302eddb66 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.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 RNDISEthernetHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "RNDISEthernetHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -133,13 +133,13 @@ void PrintIncomingPackets(void)
if ((ErrorCode = RNDIS_GetPacketLength(&PacketLength)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Packet Reception Error.\r\n"
- " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
+ " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
return;
}
-
+
if (!(PacketLength))
return;
-
+
Pipe_Unfreeze();
printf_P(PSTR("***PACKET (Size %d)***\r\n"), PacketLength);
@@ -152,13 +152,13 @@ void PrintIncomingPackets(void)
else
{
uint8_t PacketBuffer[PacketLength];
-
+
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength);
-
+
for (uint16_t i = 0; i < PacketLength; i++)
printf("0x%02x ", PacketBuffer[i]);
}
-
+
Pipe_ClearIN();
Pipe_Freeze();
@@ -178,7 +178,7 @@ void RNDIS_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -188,7 +188,7 @@ void RNDIS_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -196,7 +196,7 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -210,7 +210,7 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
uint16_t DeviceMaxPacketSize;
if ((ErrorCode = RNDIS_InitializeDevice(1024, &DeviceMaxPacketSize)) != HOST_SENDCONTROL_Successful)
{
@@ -222,11 +222,11 @@ void RNDIS_Host_Task(void)
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
-
+
printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), DeviceMaxPacketSize);
-
+
/* We set the default filter to only receive packets we would be interested in */
uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST | REMOTE_NDIS_PACKET_ALL_MULTICAST);
if ((ErrorCode = RNDIS_SetRNDISProperty(OID_GEN_CURRENT_PACKET_FILTER,
@@ -242,7 +242,7 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
uint32_t VendorID;
if ((ErrorCode = RNDIS_QueryRNDISProperty(OID_GEN_VENDOR_ID,
&VendorID, sizeof(VendorID))) != HOST_SENDCONTROL_Successful)
@@ -257,16 +257,16 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Device Vendor ID: 0x%08lX\r\n"), VendorID);
-
+
puts_P(PSTR("RNDIS Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
PrintIncomingPackets();
-
+
break;
}
}
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h
index 08187f9fa..c52fe6b9c 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.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
@@ -49,11 +49,11 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "Lib/RNDISCommands.h"
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -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 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
@@ -87,12 +87,13 @@
void SetupHardware(void);
void PrintIncomingPackets(void);
void RNDIS_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt
index 9fec00bec..a989bc51a 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.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 RNDIS Host Demo
*
* \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>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard)</td>
* </tr>
@@ -39,12 +39,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* RNDIS host demonstration application. This gives a simple reference
* application for implementing a RNDIS Ethernet host, for USB devices such as
* modems.
- *
+ *
* This demo will enumerate an attached USB RNDIS device, print out its vendor ID
* and any received packets in raw form through the serial USART.
*
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/makefile b/Demos/Host/LowLevel/RNDISEthernetHost/makefile
index b2faa5be5..d9821c6db 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/makefile
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/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/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
index d11dee038..2a00a7361 100644
--- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/StillImageHost/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* StillImageInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -113,7 +113,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the Still Image data IN pipe */
Pipe_ConfigurePipe(SIMAGE_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -151,7 +151,7 @@ uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -170,7 +170,7 @@ uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
@@ -181,3 +181,4 @@ uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
index 929d658cd..bd31c6bf2 100644
--- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/StillImageHost/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,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "StillImageHost.h"
-
+
/* Macros: */
/** Interface Class value for the Still Image Device class. */
#define SIMAGE_CLASS 0x06
@@ -50,7 +50,7 @@
/** Interface Class value for the Still Image Device protocol. */
#define SIMAGE_PROTOCOL 0x01
-
+
/** Pipe number of the Still Image data IN pipe. */
#define SIMAGE_DATA_IN_PIPE 1
@@ -70,7 +70,7 @@
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);
@@ -78,3 +78,4 @@
uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h b/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h
index 7bd8d4fe8..692b1fae8 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.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,7 +40,7 @@
#define PIMA_OPERATION_GETDEVICEINFO 0x1001
#define PIMA_OPERATION_OPENSESSION 0x1002
#define PIMA_OPERATION_CLOSESESSION 0x1003
-
+
#define PIMA_RESPONSE_OK 0x2001
#define PIMA_RESPONSE_GENERALERROR 0x2002
#define PIMA_RESPONSE_SESSIONNOTOPEN 0x2003
@@ -49,3 +49,4 @@
#define PIMA_RESPONSE_PARAMETERNOTSUPPORTED 0x2006
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
index 861f55b5d..9d6828e32 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.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
@@ -56,7 +56,7 @@ void SImage_SendBlockHeader(void)
/* Write the PIMA block to the data OUT pipe */
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0));
-
+
/* If the block type is a command, send its parameters (if any) */
if (PIMA_SendBlock.Type == CType_CommandBlock)
{
@@ -69,11 +69,11 @@ void SImage_SendBlockHeader(void)
/* Write the PIMA parameters to the data OUT pipe */
Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes);
}
-
+
/* Send the PIMA command block to the attached device */
Pipe_ClearOUT();
}
-
+
/* Freeze pipe after use */
Pipe_Freeze();
}
@@ -89,16 +89,16 @@ uint8_t SImage_ReceiveEventHeader(void)
/* Unfreeze the events pipe */
Pipe_SelectPipe(SIMAGE_EVENTS_PIPE);
Pipe_Unfreeze();
-
+
/* Read in the event data into the global structure */
ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock));
-
+
/* Clear the pipe after read complete to prepare for next event */
Pipe_ClearIN();
-
+
/* Freeze the event pipe again after use */
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -114,7 +114,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
/* Unfreeze the data IN pipe */
Pipe_SelectPipe(SIMAGE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Wait until data received on the IN pipe */
while (!(Pipe_IsINReceived()))
{
@@ -131,7 +131,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
if (!(TimeoutMSRem))
return PIPE_RWSTREAM_Timeout;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE);
Pipe_Unfreeze();
@@ -159,15 +159,15 @@ uint8_t SImage_ReceiveBlockHeader(void)
/* Return error code */
return PIPE_RWSTREAM_PipeStalled;
}
-
+
/* Check to see if the device was disconnected, if so exit function */
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
}
-
+
/* Load in the response from the attached device */
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0));
-
+
/* Check if the returned block type is a response block */
if (PIMA_ReceivedBlock.Type == CType_ResponseBlock)
{
@@ -180,14 +180,14 @@ uint8_t SImage_ReceiveBlockHeader(void)
/* Read the PIMA parameters from the data IN pipe */
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock.Params, ParamBytes);
}
-
+
/* Clear pipe bank after use */
Pipe_ClearIN();
}
-
+
/* Freeze the IN pipe after use */
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -206,7 +206,7 @@ uint8_t SImage_SendData(void* const Buffer,
/* Unfreeze the data OUT pipe */
Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE);
Pipe_Unfreeze();
-
+
/* Write the data contents to the pipe */
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes);
@@ -215,7 +215,7 @@ uint8_t SImage_SendData(void* const Buffer,
/* Freeze the pipe again after use */
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -240,7 +240,7 @@ uint8_t SImage_ReadData(void* const Buffer,
/* Freeze the pipe again after use */
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -255,13 +255,14 @@ bool SImage_IsEventReceived(void)
/* Unfreeze the Event pipe */
Pipe_SelectPipe(SIMAGE_EVENTS_PIPE);
Pipe_Unfreeze();
-
+
/* If the pipe contains data, an event has been received */
if (Pipe_BytesInPipe())
IsEventReceived = true;
-
+
/* Freeze the pipe after use */
Pipe_Freeze();
-
+
return IsEventReceived;
}
+
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
index f2bb18953..2ab36c2ba 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.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,17 +32,17 @@
*
* Header file for StillImageCommands.c.
*/
-
+
#ifndef _STILL_IMAGE_COMMANDS_H_
#define _STILL_IMAGE_COMMANDS_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "PIMACodes.h"
#include "../StillImageHost.h"
- /* Macros: */
+ /* Macros: */
/** Length in bytes of a given Unicode string's character length.
*
* \param[in] chars Total number of Unicode characters in the string
@@ -51,7 +51,7 @@
/** Timeout period between the issuing of a command to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
-
+
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container.
*
@@ -79,7 +79,7 @@
uint32_t TransactionID; /**< Unique container ID to link blocks together */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */
} PIMA_Container_t;
-
+
/* Enums: */
/** Enum for the possible PIMA contains types. */
enum PIMA_Container_Types_t
@@ -90,12 +90,12 @@
CType_ResponseBlock = 3, /**< Response container type */
CType_EventBlock = 4, /**< Event Block container type */
};
-
+
/* External Variables: */
extern PIMA_Container_t PIMA_SendBlock;
extern PIMA_Container_t PIMA_ReceivedBlock;
extern PIMA_Container_t PIMA_EventBlock;
-
+
/* Function Prototypes: */
void SImage_SendBlockHeader(void);
uint8_t SImage_ReceiveBlockHeader(void);
@@ -107,3 +107,4 @@
bool SImage_IsEventReceived(void);
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
index 73f0c2c76..aa139e225 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.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
@@ -120,7 +120,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -135,7 +135,7 @@ void StillImage_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -145,7 +145,7 @@ void StillImage_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -167,16 +167,16 @@ void StillImage_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Still Image Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
puts_P(PSTR("Retrieving Device Info...\r\n"));
-
+
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(0),
@@ -185,34 +185,34 @@ void StillImage_Task(void)
.TransactionID = 0x00000000,
.Params = {},
};
-
+
/* Send the GETDEVICEINFO block */
SImage_SendBlockHeader();
-
+
/* Receive the response data block */
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Calculate the size of the returned device info data structure */
uint16_t DeviceInfoSize = (PIMA_ReceivedBlock.DataLength - PIMA_COMMAND_SIZE(0));
-
+
/* Create a buffer large enough to hold the entire device info */
uint8_t DeviceInfo[DeviceInfoSize];
/* Read in the data block data (containing device info) */
SImage_ReadData(DeviceInfo, DeviceInfoSize);
-
+
/* Once all the data has been read, the pipe must be cleared before the response can be sent */
Pipe_ClearIN();
-
+
/* Create a pointer for walking through the info dataset */
uint8_t* DeviceInfoPos = DeviceInfo;
-
+
/* Skip over the data before the unicode device information strings */
DeviceInfoPos += 8; // Skip to VendorExtensionDesc String
DeviceInfoPos += (1 + UNICODE_STRING_LENGTH(*DeviceInfoPos)); // Skip over VendorExtensionDesc String
@@ -222,7 +222,7 @@ void StillImage_Task(void)
DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over Supported Device Properties Array
DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over Capture Formats Array
DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over Image Formats Array
-
+
/* Extract and convert the Manufacturer Unicode string to ASCII and print it through the USART */
char Manufacturer[*DeviceInfoPos];
UnicodeToASCII(DeviceInfoPos, Manufacturer);
@@ -246,22 +246,22 @@ void StillImage_Task(void)
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Opening Session...\r\n"));
-
+
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(1),
@@ -270,24 +270,24 @@ void StillImage_Task(void)
.TransactionID = 0x00000000,
.Params = {0x00000001},
};
-
+
/* Send the OPENSESSION block, open a session with an ID of 0x0001 */
SImage_SendBlockHeader();
-
+
/* Receive the response block from the device */
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -302,15 +302,15 @@ void StillImage_Task(void)
.TransactionID = 0x00000001,
.Params = {0x00000001},
};
-
+
/* Send the CLOSESESSION block, close the session with an ID of 0x0001 */
SImage_SendBlockHeader();
-
+
/* Receive the response block from the device */
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -319,7 +319,7 @@ void StillImage_Task(void)
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -328,7 +328,7 @@ void StillImage_Task(void)
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -345,17 +345,17 @@ void UnicodeToASCII(uint8_t* UnicodeString,
{
/* Get the number of characters in the string, skip to the start of the string data */
uint8_t CharactersRemaining = *(UnicodeString++);
-
+
/* Loop through the entire unicode string */
while (CharactersRemaining--)
{
/* Load in the next unicode character (only the lower byte, as only Unicode coded ASCII is supported) */
*(Buffer++) = *UnicodeString;
-
+
/* Jump to the next unicode character */
UnicodeString += 2;
}
-
+
/* Null terminate the string */
*Buffer = 0;
}
@@ -372,7 +372,8 @@ void ShowCommandError(uint8_t ErrorCode,
printf_P(PSTR(ESC_FG_RED "Command Error (%S).\r\n"
" -- Error Code %d\r\n" ESC_FG_WHITE), FailureType, ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h
index 61e5eb5b5..9c88f71f0 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.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 "ConfigDescriptor.h"
#include "Lib/PIMACodes.h"
@@ -52,7 +52,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -68,11 +68,11 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Function Prototypes: */
void StillImage_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -84,5 +84,6 @@
char* Buffer);
void ShowCommandError(uint8_t ErrorCode,
bool ResponseCodeError);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt b/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt
index 95a2e14b5..2dc3b662b 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.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 Still Image Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Still Image Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -40,12 +40,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Still Image host demonstration application. This gives a simple reference
* application for implementing a Still Image host, for USB devices such as
* digital cameras.
- *
+ *
* This demo will enumerate an attached USB Still Image device, print out its
* information structure, open a session with the device and finally close the
* session.
@@ -62,3 +62,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/StillImageHost/makefile b/Demos/Host/LowLevel/StillImageHost/makefile
index 087802248..2947de859 100644
--- a/Demos/Host/LowLevel/StillImageHost/makefile
+++ b/Demos/Host/LowLevel/StillImageHost/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/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
index 7d9fb38c0..54eb99c84 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/VirtualSerialHost/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
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* CDCControlInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -85,7 +85,7 @@ uint8_t ProcessConfigurationDescriptor(void)
{
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
- }
+ }
/* Clear any found endpoints */
DataINEndpoint = NULL;
@@ -111,7 +111,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);
@@ -129,7 +129,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the CDC data IN pipe */
Pipe_ConfigurePipe(CDC_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -167,7 +167,7 @@ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -191,7 +191,7 @@ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -211,7 +211,7 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
@@ -222,3 +222,4 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
index 2e4730c55..270e130ae 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/VirtualSerialHost/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,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "VirtualSerialHost.h"
-
+
/* Macros: */
/** Interface Class value for the CDC class. */
#define CDC_CONTROL_CLASS 0x02
@@ -50,7 +50,7 @@
/** Interface Class value for the CDC protocol. */
#define CDC_CONTROL_PROTOCOL 0x01
-
+
/** Interface Class value for the CDC data class. */
#define CDC_DATA_CLASS 0x0A
@@ -59,7 +59,7 @@
/** Interface Class value for the CDC data protocol. */
#define CDC_DATA_PROTOCOL 0x00
-
+
/** Pipe number for the CDC data IN pipe. */
#define CDC_DATA_IN_PIPE 1
@@ -81,10 +81,11 @@
};
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
+ uint8_t ProcessConfigurationDescriptor(void);
+
uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c
index 91775b7a4..f5fcdb10b 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c
+++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.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 VirtualSerialHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "VirtualSerialHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -134,7 +134,7 @@ void CDC_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -144,7 +144,7 @@ void CDC_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -152,7 +152,7 @@ void CDC_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -188,10 +188,10 @@ void CDC_Host_Task(void)
/* Get the length of the pipe data, and create a new buffer to hold it */
uint16_t BufferLength = Pipe_BytesInPipe();
uint8_t Buffer[BufferLength];
-
+
/* Read in the pipe data to the temporary buffer */
Pipe_Read_Stream_LE(Buffer, BufferLength);
-
+
/* Print out the buffer contents to the USART */
for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)
putchar(Buffer[BufferByte]);
@@ -207,17 +207,18 @@ void CDC_Host_Task(void)
/* Select and unfreeze the notification pipe */
Pipe_SelectPipe(CDC_NOTIFICATION_PIPE);
Pipe_Unfreeze();
-
+
/* Check if a packet has been received */
if (Pipe_IsINReceived())
{
/* Discard the unused event notification */
Pipe_ClearIN();
}
-
+
/* Freeze notification IN pipe after use */
Pipe_Freeze();
-
+
break;
}
}
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h
index d55fa68af..fb3b3f187 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h
+++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.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
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.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,16 +64,17 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt
index d771b7976..80a470818 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt
+++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.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 CDC Host Demo
*
* \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,13 +39,13 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* CDC host demonstration application. This gives a simple reference application
* for implementing a USB CDC host, for CDC devices using the standard ACM profile.
- *
+ *
* This demo prints out received CDC data through the serial port.
- *
+ *
* Not that this demo is only compatible with devices which report the correct CDC
* and ACM class, subclass and protocol values. Most USB-Serial cables have vendor
* specific features, thus use vendor-specific class/subclass/protocol codes to force
@@ -63,3 +63,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/makefile b/Demos/Host/LowLevel/VirtualSerialHost/makefile
index 43677949d..09a245808 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/makefile
+++ b/Demos/Host/LowLevel/VirtualSerialHost/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
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,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
@@ -261,7 +261,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
@@ -274,7 +274,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)
@@ -286,7 +286,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)
@@ -298,7 +298,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 =
@@ -321,7 +321,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))
@@ -355,7 +355,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
@@ -389,7 +389,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
@@ -418,7 +418,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:
@@ -437,10 +437,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.
@@ -505,11 +505,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)
@@ -536,9 +536,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)
@@ -636,14 +636,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.
@@ -665,7 +665,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.
@@ -709,3 +709,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/Demos/Host/LowLevel/makefile b/Demos/Host/LowLevel/makefile
index 2dec7c85b..9a7c46578 100644
--- a/Demos/Host/LowLevel/makefile
+++ b/Demos/Host/LowLevel/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -60,3 +60,4 @@ all:
$(MAKE) -C RNDISEthernetHost $@
$(MAKE) -C StillImageHost $@
$(MAKE) -C VirtualSerialHost $@
+