aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/StillImageHost
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-10-13 14:05:35 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-10-13 14:05:35 +0000
commit5a4def747897c1c6ffbe465506d846c7c686d3e9 (patch)
treee5a9ca31ab554e993f1a9041e44976cf7b253921 /Demos/Host/LowLevel/StillImageHost
parenta8871c7fba73307226bd13e2cad4c840c850e6f1 (diff)
downloadlufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.tar.gz
lufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.tar.bz2
lufa-5a4def747897c1c6ffbe465506d846c7c686d3e9.zip
Clean up excessive whitespace at the end of each line using the wspurify tool made by Laszlo Monda
Diffstat (limited to 'Demos/Host/LowLevel/StillImageHost')
-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
9 files changed, 155 insertions, 146 deletions
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
+