Clean up excessive whitespace at the end of each line using the wspurify tool made by Laszlo Monda
This commit is contained in:
parent
a8871c7fba
commit
5a4def7478
760 changed files with 12883 additions and 12164 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue