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,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ void DS1307_SetDate(const uint8_t Day,
|
|||
return;
|
||||
#endif
|
||||
|
||||
DS1307_DateRegs_t CurrentRTCDate;
|
||||
DS1307_DateRegs_t CurrentRTCDate;
|
||||
CurrentRTCDate.Byte1.Fields.TenDay = (Day / 10);
|
||||
CurrentRTCDate.Byte1.Fields.Day = (Day % 10);
|
||||
CurrentRTCDate.Byte2.Fields.TenMonth = (Month / 10);
|
||||
|
@ -29,7 +29,7 @@ void DS1307_SetDate(const uint8_t Day,
|
|||
TWI_SendByte(CurrentRTCDate.Byte1.IntVal);
|
||||
TWI_SendByte(CurrentRTCDate.Byte2.IntVal);
|
||||
TWI_SendByte(CurrentRTCDate.Byte3.IntVal);
|
||||
|
||||
|
||||
TWI_StopTransmission();
|
||||
}
|
||||
}
|
||||
|
@ -51,18 +51,18 @@ void DS1307_SetTime(const uint8_t Hour,
|
|||
CurrentRTCTime.Byte3.Fields.TenHour = (Hour / 10);
|
||||
CurrentRTCTime.Byte3.Fields.Hour = (Hour % 10);
|
||||
CurrentRTCTime.Byte3.Fields.TwelveHourMode = false;
|
||||
|
||||
|
||||
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
|
||||
{
|
||||
TWI_SendByte(DS1307_TIMEREG_START);
|
||||
TWI_SendByte(CurrentRTCTime.Byte1.IntVal);
|
||||
TWI_SendByte(CurrentRTCTime.Byte2.IntVal);
|
||||
TWI_SendByte(CurrentRTCTime.Byte3.IntVal);
|
||||
|
||||
|
||||
TWI_StopTransmission();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DS1307_GetDate(uint8_t* const Day,
|
||||
uint8_t* const Month,
|
||||
uint8_t* const Year)
|
||||
|
@ -77,7 +77,7 @@ void DS1307_GetDate(uint8_t* const Day,
|
|||
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
|
||||
{
|
||||
TWI_SendByte(DS1307_DATEREG_START);
|
||||
|
||||
|
||||
TWI_StopTransmission();
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void DS1307_GetDate(uint8_t* const Day,
|
|||
TWI_ReceiveByte(&CurrentRTCDate.Byte1.IntVal, false);
|
||||
TWI_ReceiveByte(&CurrentRTCDate.Byte2.IntVal, false);
|
||||
TWI_ReceiveByte(&CurrentRTCDate.Byte3.IntVal, true);
|
||||
|
||||
|
||||
TWI_StopTransmission();
|
||||
}
|
||||
|
||||
|
@ -111,10 +111,10 @@ void DS1307_GetTime(uint8_t* const Hour,
|
|||
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
|
||||
{
|
||||
TWI_SendByte(DS1307_TIMEREG_START);
|
||||
|
||||
|
||||
TWI_StopTransmission();
|
||||
}
|
||||
|
||||
|
||||
DS1307_TimeRegs_t CurrentRTCTime;
|
||||
|
||||
if (TWI_StartTransmission(DS1307_ADDRESS_READ, 10))
|
||||
|
@ -122,7 +122,7 @@ void DS1307_GetTime(uint8_t* const Hour,
|
|||
TWI_ReceiveByte(&CurrentRTCTime.Byte1.IntVal, false);
|
||||
TWI_ReceiveByte(&CurrentRTCTime.Byte2.IntVal, false);
|
||||
TWI_ReceiveByte(&CurrentRTCTime.Byte3.IntVal, true);
|
||||
|
||||
|
||||
TWI_StopTransmission();
|
||||
}
|
||||
|
||||
|
@ -130,3 +130,4 @@ void DS1307_GetTime(uint8_t* const Hour,
|
|||
*Minute = (CurrentRTCTime.Byte2.Fields.TenMin * 10) + CurrentRTCTime.Byte2.Fields.Min;
|
||||
*Hour = (CurrentRTCTime.Byte3.Fields.TenHour * 10) + CurrentRTCTime.Byte3.Fields.Hour;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
@ -24,10 +24,10 @@
|
|||
unsigned int TenSec : 3;
|
||||
unsigned int CH : 1;
|
||||
} Fields;
|
||||
|
||||
|
||||
uint8_t IntVal;
|
||||
} Byte1;
|
||||
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -36,10 +36,10 @@
|
|||
unsigned int TenMin : 3;
|
||||
unsigned int Reserved : 1;
|
||||
} Fields;
|
||||
|
||||
|
||||
uint8_t IntVal;
|
||||
} Byte2;
|
||||
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -49,7 +49,7 @@
|
|||
unsigned int TwelveHourMode : 1;
|
||||
unsigned int Reserved : 1;
|
||||
} Fields;
|
||||
|
||||
|
||||
uint8_t IntVal;
|
||||
} Byte3;
|
||||
} DS1307_TimeRegs_t;
|
||||
|
@ -64,7 +64,7 @@
|
|||
unsigned int TenDay : 2;
|
||||
unsigned int Reserved : 2;
|
||||
} Fields;
|
||||
|
||||
|
||||
uint8_t IntVal;
|
||||
} Byte1;
|
||||
|
||||
|
@ -76,10 +76,10 @@
|
|||
unsigned int TenMonth : 1;
|
||||
unsigned int Reserved : 3;
|
||||
} Fields;
|
||||
|
||||
|
||||
uint8_t IntVal;
|
||||
} Byte2;
|
||||
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -87,7 +87,7 @@
|
|||
unsigned int Year : 4;
|
||||
unsigned int TenYear : 4;
|
||||
} Fields;
|
||||
|
||||
|
||||
uint8_t IntVal;
|
||||
} Byte3;
|
||||
} DS1307_DateRegs_t;
|
||||
|
@ -95,7 +95,7 @@
|
|||
/* Macros: */
|
||||
#define DS1307_TIMEREG_START 0x00
|
||||
#define DS1307_DATEREG_START 0x04
|
||||
|
||||
|
||||
#define DS1307_ADDRESS_READ 0b11010001
|
||||
#define DS1307_ADDRESS_WRITE 0b11010000
|
||||
|
||||
|
@ -114,3 +114,4 @@
|
|||
uint8_t* const Second);
|
||||
|
||||
#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
|
||||
|
@ -77,7 +77,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))
|
||||
{
|
||||
|
@ -86,7 +86,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;
|
||||
|
@ -125,7 +125,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 */
|
||||
|
@ -145,7 +145,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++;
|
||||
|
||||
|
@ -154,9 +154,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--;
|
||||
}
|
||||
|
@ -201,15 +201,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))
|
||||
{
|
||||
|
@ -218,12 +218,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))
|
||||
{
|
||||
|
@ -233,7 +233,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);
|
||||
|
@ -241,7 +241,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());
|
||||
|
@ -260,10 +260,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++;
|
||||
|
||||
|
@ -271,11 +271,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();
|
||||
|
@ -315,11 +315,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))
|
||||
{
|
||||
|
@ -359,18 +359,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--;
|
||||
}
|
||||
|
@ -416,7 +416,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))
|
||||
{
|
||||
|
@ -429,7 +429,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);
|
||||
|
@ -437,19 +437,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--;
|
||||
}
|
||||
|
@ -464,7 +464,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)
|
||||
{
|
||||
|
@ -476,12 +476,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)
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
|
|||
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Deselect current Dataflash chip */
|
||||
Dataflash_DeselectChip();
|
||||
}
|
||||
|
@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
|
|||
if (ReturnByte != DF_MANUFACTURER_ATMEL)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
||||
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
|
||||
|
@ -32,13 +32,13 @@
|
|||
*
|
||||
* Header file for DataflashManager.c.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _DATAFLASH_MANAGER_H_
|
||||
#define _DATAFLASH_MANAGER_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
#include "TempDataLogger.h"
|
||||
#include "Descriptors.h"
|
||||
|
||||
|
@ -60,12 +60,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: */
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
|
@ -81,5 +81,6 @@
|
|||
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ResetDataflashProtections(void);
|
||||
bool DataflashManager_CheckDataflashOperation(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -115,3 +115,4 @@ REVISION HISTORY
|
|||
Changed some types on the API, XCHAR->TCHAR.
|
||||
Changed fname member in the FILINFO structure on Unicode cfg.
|
||||
String functions support UTF-8 encoding files on Unicode cfg.
|
||||
|
||||
|
|
|
@ -97,3 +97,4 @@ DWORD get_fattime (void)
|
|||
((DWORD)Minute << 5) |
|
||||
(((DWORD)Second >> 1) << 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,3 +69,4 @@ DRESULT disk_ioctl (BYTE, BYTE, void*);
|
|||
|
||||
#define _DISKIO
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2289,7 +2289,7 @@ FRESULT f_close (
|
|||
#if _FS_REENTRANT
|
||||
res = validate(fp->fs, fp->id);
|
||||
if (res == FR_OK) {
|
||||
res = dec_lock(fp->fs, fp->lockid);
|
||||
res = dec_lock(fp->fs, fp->lockid);
|
||||
unlock_fs(fp->fs, FR_OK);
|
||||
}
|
||||
#else
|
||||
|
@ -3539,7 +3539,7 @@ int f_printf (
|
|||
res++;
|
||||
}
|
||||
do {
|
||||
cc = f_putc(s[--i], fil);
|
||||
cc = f_putc(s[--i], fil);
|
||||
res++;
|
||||
} while (i && cc != EOF);
|
||||
if (cc != EOF) cc = 0;
|
||||
|
@ -3551,3 +3551,4 @@ int f_printf (
|
|||
|
||||
#endif /* !_FS_READONLY */
|
||||
#endif /* _USE_STRFUNC */
|
||||
|
||||
|
|
|
@ -611,3 +611,4 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
|||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
|
||||
|
|
|
@ -179,3 +179,4 @@
|
|||
|
||||
|
||||
#endif /* _FFCONFIG */
|
||||
|
||||
|
|
|
@ -37,3 +37,4 @@ typedef unsigned char BOOL;
|
|||
#endif
|
||||
|
||||
#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,29 +34,29 @@
|
|||
* 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"
|
||||
|
||||
/** 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,
|
||||
|
@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
|
|||
.WideBus16Bit = false,
|
||||
.WideBus32Bit = false,
|
||||
.RelAddr = false,
|
||||
|
||||
|
||||
.VendorID = "LUFA",
|
||||
.ProductID = "Dataflash Disk",
|
||||
.RevisionID = {'0','.','0','0'},
|
||||
|
@ -96,13 +96,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);
|
||||
|
@ -134,7 +134,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;
|
||||
}
|
||||
|
||||
|
@ -165,11 +165,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);
|
||||
|
||||
|
@ -178,7 +178,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;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,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);
|
||||
|
@ -221,10 +221,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;
|
||||
}
|
||||
|
||||
|
@ -248,21 +248,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;
|
||||
}
|
||||
|
||||
|
@ -280,13 +280,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)
|
||||
{
|
||||
|
@ -297,7 +297,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);
|
||||
|
@ -306,6 +306,7 @@ 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 "../TempDataLogger.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,13 +68,13 @@
|
|||
|
||||
/** 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: */
|
||||
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);
|
||||
|
@ -83,5 +83,6 @@
|
|||
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue