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
|
||||
|
@ -78,7 +78,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
while (TotalBlocks)
|
||||
{
|
||||
uint8_t BytesInBlockDiv16 = 0;
|
||||
|
||||
|
||||
/* Write an endpoint packet sized data block to the Dataflash */
|
||||
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
{
|
||||
/* Clear the current endpoint bank */
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
||||
/* Wait until the host has sent another packet */
|
||||
if (Endpoint_WaitUntilReady())
|
||||
return;
|
||||
|
@ -126,7 +126,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
|
||||
/* Send the Dataflash buffer write command */
|
||||
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
|
||||
Dataflash_SendAddressBytes(0, 0);
|
||||
Dataflash_SendAddressBytes(0, 0);
|
||||
}
|
||||
|
||||
/* Write one 16-byte chunk of data to the Dataflash */
|
||||
|
@ -146,7 +146,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
Dataflash_SendByte(Endpoint_Read_Byte());
|
||||
Dataflash_SendByte(Endpoint_Read_Byte());
|
||||
Dataflash_SendByte(Endpoint_Read_Byte());
|
||||
|
||||
|
||||
/* Increment the Dataflash page 16 byte block counter */
|
||||
CurrDFPageByteDiv16++;
|
||||
|
||||
|
@ -155,9 +155,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
|
||||
/* Check if the current command is being aborted by the host */
|
||||
if (MSInterfaceInfo->State.IsMassStoreReset)
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Decrement the blocks remaining counter and reset the sub block counter */
|
||||
TotalBlocks--;
|
||||
}
|
||||
|
@ -202,15 +202,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
Dataflash_SendByte(0x00);
|
||||
Dataflash_SendByte(0x00);
|
||||
Dataflash_SendByte(0x00);
|
||||
|
||||
|
||||
/* Wait until endpoint is ready before continuing */
|
||||
if (Endpoint_WaitUntilReady())
|
||||
return;
|
||||
|
||||
|
||||
while (TotalBlocks)
|
||||
{
|
||||
uint8_t BytesInBlockDiv16 = 0;
|
||||
|
||||
|
||||
/* Write an endpoint packet sized data block to the Dataflash */
|
||||
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
|
||||
{
|
||||
|
@ -219,12 +219,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
{
|
||||
/* Clear the endpoint bank to send its contents to the host */
|
||||
Endpoint_ClearIN();
|
||||
|
||||
|
||||
/* Wait until the endpoint is ready for more data */
|
||||
if (Endpoint_WaitUntilReady())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Check if end of Dataflash page reached */
|
||||
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
|
||||
/* Select the next Dataflash chip based on the new Dataflash page index */
|
||||
Dataflash_SelectChipFromPage(CurrDFPage);
|
||||
|
||||
|
||||
/* Send the Dataflash main memory page read command */
|
||||
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
|
||||
Dataflash_SendAddressBytes(CurrDFPage, 0);
|
||||
|
@ -242,7 +242,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
Dataflash_SendByte(0x00);
|
||||
Dataflash_SendByte(0x00);
|
||||
Dataflash_SendByte(0x00);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read one 16-byte chunk of data from the Dataflash */
|
||||
Endpoint_Write_Byte(Dataflash_ReceiveByte());
|
||||
|
@ -261,10 +261,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
Endpoint_Write_Byte(Dataflash_ReceiveByte());
|
||||
Endpoint_Write_Byte(Dataflash_ReceiveByte());
|
||||
Endpoint_Write_Byte(Dataflash_ReceiveByte());
|
||||
|
||||
|
||||
/* Increment the Dataflash page 16 byte block counter */
|
||||
CurrDFPageByteDiv16++;
|
||||
|
||||
|
||||
/* Increment the block 16 byte block counter */
|
||||
BytesInBlockDiv16++;
|
||||
|
||||
|
@ -272,11 +272,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
if (MSInterfaceInfo->State.IsMassStoreReset)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Decrement the blocks remaining counter */
|
||||
TotalBlocks--;
|
||||
}
|
||||
|
||||
|
||||
/* If the endpoint is full, send its contents to the host */
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
Endpoint_ClearIN();
|
||||
|
@ -316,11 +316,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
|||
/* Send the Dataflash buffer write command */
|
||||
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
|
||||
Dataflash_SendAddressBytes(0, CurrDFPageByte);
|
||||
|
||||
|
||||
while (TotalBlocks)
|
||||
{
|
||||
uint8_t BytesInBlockDiv16 = 0;
|
||||
|
||||
|
||||
/* Write an endpoint packet sized data block to the Dataflash */
|
||||
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
|
||||
{
|
||||
|
@ -360,18 +360,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
|||
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
|
||||
Dataflash_SendAddressBytes(0, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Write one 16-byte chunk of data to the Dataflash */
|
||||
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
|
||||
Dataflash_SendByte(*(BufferPtr++));
|
||||
|
||||
|
||||
/* Increment the Dataflash page 16 byte block counter */
|
||||
CurrDFPageByteDiv16++;
|
||||
|
||||
/* Increment the block 16 byte block counter */
|
||||
BytesInBlockDiv16++;
|
||||
BytesInBlockDiv16++;
|
||||
}
|
||||
|
||||
|
||||
/* Decrement the blocks remaining counter and reset the sub block counter */
|
||||
TotalBlocks--;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
|||
while (TotalBlocks)
|
||||
{
|
||||
uint8_t BytesInBlockDiv16 = 0;
|
||||
|
||||
|
||||
/* Write an endpoint packet sized data block to the Dataflash */
|
||||
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
|
||||
{
|
||||
|
@ -430,7 +430,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
|||
|
||||
/* Select the next Dataflash chip based on the new Dataflash page index */
|
||||
Dataflash_SelectChipFromPage(CurrDFPage);
|
||||
|
||||
|
||||
/* Send the Dataflash main memory page read command */
|
||||
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
|
||||
Dataflash_SendAddressBytes(CurrDFPage, 0);
|
||||
|
@ -438,19 +438,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
|||
Dataflash_SendByte(0x00);
|
||||
Dataflash_SendByte(0x00);
|
||||
Dataflash_SendByte(0x00);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read one 16-byte chunk of data from the Dataflash */
|
||||
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
|
||||
*(BufferPtr++) = Dataflash_ReceiveByte();
|
||||
|
||||
|
||||
/* Increment the Dataflash page 16 byte block counter */
|
||||
CurrDFPageByteDiv16++;
|
||||
|
||||
|
||||
/* Increment the block 16 byte block counter */
|
||||
BytesInBlockDiv16++;
|
||||
}
|
||||
|
||||
|
||||
/* Decrement the blocks remaining counter */
|
||||
TotalBlocks--;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ void DataflashManager_ResetDataflashProtections(void)
|
|||
/* Select first Dataflash chip, send the read status register command */
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
||||
Dataflash_SendByte(DF_CMD_GETSTATUS);
|
||||
|
||||
|
||||
/* Check if sector protection is enabled */
|
||||
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
|
||||
{
|
||||
|
@ -477,12 +477,12 @@ void DataflashManager_ResetDataflashProtections(void)
|
|||
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
|
||||
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
|
||||
}
|
||||
|
||||
|
||||
/* Select second Dataflash chip (if present on selected board), send read status register command */
|
||||
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP2);
|
||||
Dataflash_SendByte(DF_CMD_GETSTATUS);
|
||||
|
||||
|
||||
/* Check if sector protection is enabled */
|
||||
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
|
||||
{
|
||||
|
@ -495,7 +495,7 @@ void DataflashManager_ResetDataflashProtections(void)
|
|||
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Deselect current Dataflash chip */
|
||||
Dataflash_DeselectChip();
|
||||
}
|
||||
|
@ -529,7 +529,8 @@ bool DataflashManager_CheckDataflashOperation(void)
|
|||
if (ReturnByte != DF_MANUFACTURER_ATMEL)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
#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
|
||||
|
@ -32,13 +32,13 @@
|
|||
*
|
||||
* Header file for DataflashManager.c.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _DATAFLASH_MANAGER_H_
|
||||
#define _DATAFLASH_MANAGER_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
#include "StandaloneProgrammer.h"
|
||||
#include "Descriptors.h"
|
||||
|
||||
|
@ -59,12 +59,12 @@
|
|||
* storage media (Dataflash) using a different native block size. Do not change this value.
|
||||
*/
|
||||
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
|
||||
|
||||
|
||||
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
|
||||
* change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
|
||||
*/
|
||||
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
|
@ -84,3 +84,4 @@
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -34,3 +34,4 @@ AGREEMENTS
|
|||
REVISION HISTORY
|
||||
|
||||
Jun 15, 2010 R0.01a First release (Branched from FatFs R0.07b)
|
||||
|
||||
|
|
|
@ -34,3 +34,4 @@ BOOL assign_drives (int argc, char *argv[]);
|
|||
|
||||
#define _DISKIO
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,3 +35,4 @@ typedef enum { FALSE = 0, TRUE } BOOL;
|
|||
|
||||
#define _INTEGER
|
||||
#endif
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
|
|||
}
|
||||
dj->sclust =
|
||||
#if _FS_FAT32
|
||||
((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
|
||||
((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
|
||||
#endif
|
||||
LD_WORD(dir+DIR_FstClusLO);
|
||||
}
|
||||
|
|
|
@ -235,3 +235,4 @@ FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item */
|
|||
|
||||
|
||||
#endif /* _FATFS */
|
||||
|
||||
|
|
|
@ -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 @@ struct
|
|||
{
|
||||
uint16_t SigBytes[4];
|
||||
bool EnforceSigBytes;
|
||||
|
||||
|
||||
uint32_t ProgrammingSpeed;
|
||||
} ProgrammerConfig;
|
||||
|
||||
|
@ -47,14 +47,14 @@ bool ProgrammerConfig_ProcessConfiguration(void)
|
|||
puts(" >> ERROR: CONF.txt File Not Found.\r\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
char LineBuff[100];
|
||||
char* CurrentLine;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
CurrentLine = fgets(LineBuff, sizeof(LineBuff), &DiskStream);
|
||||
|
||||
|
||||
if (CurrentLine)
|
||||
{
|
||||
sscanf(CurrentLine, "SIGNATURE = %02x %02x %02x %02x", &ProgrammerConfig.SigBytes[0],
|
||||
|
@ -65,13 +65,14 @@ bool ProgrammerConfig_ProcessConfiguration(void)
|
|||
sscanf(CurrentLine, "SPEED = %lu", &ProgrammerConfig.ProgrammingSpeed);
|
||||
}
|
||||
} while (CurrentLine);
|
||||
|
||||
|
||||
printf(" >> *** Configuration: ***\r\n");
|
||||
printf(" >> Device Signature: 0x%02x 0x%02x 0x%02x 0x%02x\r\n", ProgrammerConfig.SigBytes[0],
|
||||
ProgrammerConfig.SigBytes[1],
|
||||
ProgrammerConfig.SigBytes[2],
|
||||
ProgrammerConfig.SigBytes[3]);
|
||||
printf(" >> Programming Speed: %lu Hz\r\n", ProgrammerConfig.ProgrammingSpeed);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -35,10 +35,11 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#include "../StandaloneProgrammer.h"
|
||||
|
||||
/* Function Prototypes: */
|
||||
bool ProgrammerConfig_ProcessConfiguration(void);
|
||||
|
||||
#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 @@
|
|||
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
|
||||
* which wrap around standard SCSI device commands for controlling the actual storage medium.
|
||||
*/
|
||||
|
||||
|
||||
#define INCLUDE_FROM_SCSI_C
|
||||
#include "SCSI.h"
|
||||
|
||||
|
@ -42,22 +42,22 @@
|
|||
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
|
||||
* features and capabilities.
|
||||
*/
|
||||
SCSI_Inquiry_Response_t InquiryData =
|
||||
SCSI_Inquiry_Response_t InquiryData =
|
||||
{
|
||||
.DeviceType = DEVICE_TYPE_BLOCK,
|
||||
.PeripheralQualifier = 0,
|
||||
|
||||
|
||||
.Removable = true,
|
||||
|
||||
|
||||
.Version = 0,
|
||||
|
||||
|
||||
.ResponseDataFormat = 2,
|
||||
.NormACA = false,
|
||||
.TrmTsk = false,
|
||||
.AERC = false,
|
||||
|
||||
.AdditionalLength = 0x1F,
|
||||
|
||||
|
||||
.SoftReset = false,
|
||||
.CmdQue = false,
|
||||
.Linked = false,
|
||||
|
@ -65,7 +65,7 @@ SCSI_Inquiry_Response_t InquiryData =
|
|||
.WideBus16Bit = false,
|
||||
.WideBus32Bit = false,
|
||||
.RelAddr = false,
|
||||
|
||||
|
||||
.VendorID = "LUFA",
|
||||
.ProductID = "Dataflash Disk",
|
||||
.RevisionID = {'0','.','0','0'},
|
||||
|
@ -97,13 +97,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
|||
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
|
||||
{
|
||||
case SCSI_CMD_INQUIRY:
|
||||
CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
|
||||
CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
|
||||
break;
|
||||
case SCSI_CMD_REQUEST_SENSE:
|
||||
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
|
||||
break;
|
||||
case SCSI_CMD_READ_CAPACITY_10:
|
||||
CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
|
||||
CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
|
||||
break;
|
||||
case SCSI_CMD_SEND_DIAGNOSTIC:
|
||||
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
|
||||
|
@ -135,7 +135,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
|||
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
|
||||
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -166,11 +166,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
|
||||
|
||||
uint8_t PadBytes[AllocationLength - BytesTransferred];
|
||||
|
||||
|
||||
/* Pad out remaining bytes with 0x00 */
|
||||
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
|
||||
|
||||
|
@ -179,7 +179,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
|
||||
/* Succeed the command and update the bytes transferred counter */
|
||||
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
|
|||
{
|
||||
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
|
||||
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
|
||||
|
||||
|
||||
uint8_t PadBytes[AllocationLength - BytesTransferred];
|
||||
|
||||
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
|
||||
|
@ -222,10 +222,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
|
|||
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
|
||||
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
|
||||
Endpoint_ClearIN();
|
||||
|
||||
|
||||
/* Succeed the command and update the bytes transferred counter */
|
||||
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -249,21 +249,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Check to see if all attached Dataflash ICs are functional */
|
||||
if (!(DataflashManager_CheckDataflashOperation()))
|
||||
{
|
||||
/* Update SENSE key with a hardware error condition and return command fail */
|
||||
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
|
||||
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Succeed the command and update the bytes transferred counter */
|
||||
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -281,13 +281,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
{
|
||||
uint32_t BlockAddress;
|
||||
uint16_t TotalBlocks;
|
||||
|
||||
|
||||
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
|
||||
BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
|
||||
|
||||
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
|
||||
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
|
||||
|
||||
|
||||
/* Check if the block address is outside the maximum allowable value for the LUN */
|
||||
if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
|
||||
if (IsDataRead == DATA_READ)
|
||||
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
|
||||
|
@ -307,7 +307,8 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
|
||||
/* Update the bytes transferred counter and succeed the command */
|
||||
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
#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
|
||||
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* Header file for SCSI.c.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SCSI_H_
|
||||
#define _SCSI_H_
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
#include "StandaloneProgrammer.h"
|
||||
#include "Descriptors.h"
|
||||
#include "DataflashManager.h"
|
||||
|
||||
|
||||
/* Macros: */
|
||||
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
|
||||
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
|
||||
|
@ -68,14 +68,14 @@
|
|||
|
||||
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
|
||||
#define DEVICE_TYPE_BLOCK 0x00
|
||||
|
||||
|
||||
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
|
||||
#define DEVICE_TYPE_CDROM 0x05
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
|
||||
|
||||
#if defined(INCLUDE_FROM_SCSI_C)
|
||||
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
|
@ -85,5 +85,6 @@
|
|||
const bool IsDataRead);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue