aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-06-29 11:11:51 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-06-29 11:11:51 +0000
commitb462f2d457ec2f0cfa22a1c3db198cb22f6809a1 (patch)
tree5b527a289d471436ded93d5c9ead94bc5c36385d /Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
parent86e6ed7f31d29fa3d2aea1f6c40aa4647fce2690 (diff)
downloadlufa-b462f2d457ec2f0cfa22a1c3db198cb22f6809a1.tar.gz
lufa-b462f2d457ec2f0cfa22a1c3db198cb22f6809a1.tar.bz2
lufa-b462f2d457ec2f0cfa22a1c3db198cb22f6809a1.zip
Minor correction to MagStripe demo to fix build problems.
Diffstat (limited to 'Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c')
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
index 6dc549599..fdc91dd5d 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
+++ b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
@@ -53,16 +53,17 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
bool UsingSecondBuffer = false;
- /* Copy selected dataflash's current page contents to the dataflash buffer */
+ /* Select the correct starting Dataflash IC for the block requested */
Dataflash_SelectChipFromPage(CurrDFPage);
+
#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
Dataflash_SendAddressBytes(CurrDFPage, 0);
-#endif
Dataflash_WaitWhileBusy();
+#endif
/* Send the dataflash buffer write command */
- Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
@@ -182,8 +183,10 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- /* Send the dataflash main memory page read command */
+ /* Select the correct starting Dataflash IC for the block requested */
Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
Dataflash_SendByte(0x00);
@@ -287,16 +290,17 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t Tota
uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
bool UsingSecondBuffer = false;
- /* Copy selected dataflash's current page contents to the dataflash buffer */
+ /* Select the correct starting Dataflash IC for the block requested */
Dataflash_SelectChipFromPage(CurrDFPage);
+
#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)
+ /* Copy selected dataflash's current page contents to the dataflash buffer */
Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);
Dataflash_SendAddressBytes(CurrDFPage, 0);
-#endif
Dataflash_WaitWhileBusy();
+#endif
/* Send the dataflash buffer write command */
- Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
@@ -384,8 +388,10 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t Total
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
uint8_t CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);
- /* Send the dataflash main memory page read command */
+ /* Select the correct starting Dataflash IC for the block requested */
Dataflash_SelectChipFromPage(CurrDFPage);
+
+ /* Send the dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);
Dataflash_SendByte(0x00);