X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cb779e3d7d32d7c43e0a45bb526de0a04135b0c7..1e05d46b663ded57a06f4d8773f40aea908f8622:/Projects/TempDataLogger/Lib/DataflashManager.c?ds=sidebyside diff --git a/Projects/TempDataLogger/Lib/DataflashManager.c b/Projects/TempDataLogger/Lib/DataflashManager.c index 48b4a75aa..e9f096009 100644 --- a/Projects/TempDataLogger/Lib/DataflashManager.c +++ b/Projects/TempDataLogger/Lib/DataflashManager.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2010. + Copyright (C) Dean Camera, 2016. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2016 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -18,7 +18,7 @@ advertising or publicity pertaining to distribution of the software without specific, written prior permission. - The author disclaim all warranties with regard to this + The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages @@ -129,22 +129,22 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn } /* Write one 16-byte chunk of data to the Dataflash */ - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); - Dataflash_SendByte(Endpoint_Read_Byte()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); + Dataflash_SendByte(Endpoint_Read_8()); /* Increment the Dataflash page 16 byte block counter */ CurrDFPageByteDiv16++; @@ -157,7 +157,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn return; } - /* Decrement the blocks remaining counter and reset the sub block counter */ + /* Decrement the blocks remaining counter */ TotalBlocks--; } @@ -210,7 +210,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf { uint8_t BytesInBlockDiv16 = 0; - /* Write an endpoint packet sized data block to the Dataflash */ + /* Read an endpoint packet sized data block from the Dataflash */ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) { /* Check if the endpoint is currently full */ @@ -244,22 +244,22 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf } /* Read one 16-byte chunk of data from the Dataflash */ - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); - Endpoint_Write_Byte(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); + Endpoint_Write_8(Dataflash_ReceiveByte()); /* Increment the Dataflash page 16 byte block counter */ CurrDFPageByteDiv16++; @@ -356,7 +356,7 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, /* Send the Dataflash buffer write command */ Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_BUFF1WRITE); + Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE); Dataflash_SendAddressBytes(0, 0); } @@ -371,7 +371,7 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, BytesInBlockDiv16++; } - /* Decrement the blocks remaining counter and reset the sub block counter */ + /* Decrement the blocks remaining counter */ TotalBlocks--; } @@ -417,7 +417,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, { uint8_t BytesInBlockDiv16 = 0; - /* Write an endpoint packet sized data block to the Dataflash */ + /* Read an endpoint packet sized data block from the Dataflash */ while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) { /* Check if end of Dataflash page reached */ @@ -501,7 +501,7 @@ void DataflashManager_ResetDataflashProtections(void) /** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working. * - * \return Boolean true if all media chips are working, false otherwise + * \return Boolean \c true if all media chips are working, \c false otherwise */ bool DataflashManager_CheckDataflashOperation(void) {