aboutsummaryrefslogtreecommitdiff
path: root/LUFA/Drivers/Board/Dataflash.h
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-06-29 09:30:06 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-06-29 09:30:06 +0000
commit0d8d6ffe55b2b15948f3eaa4a209a8a082e605dc (patch)
treec88ca4fe635839b0ad5014674aa015d9c61ff30d /LUFA/Drivers/Board/Dataflash.h
parent5f7f945c823b4de1f7ae70e239f426ba54573b2d (diff)
Dataflash_WaitWhileBusy() now always ensures that the dataflash is ready for the next command immediately after returning, no need to call Dataflash_ToggleSelectedChipCS() afterwards.
Added new DATAFLASH_CHIP_MASK() macro to the Dataflash driver, which returns the Dataflash select mask for the given chip index. Updated MassStorage device block write routines to use ping-pong Dataflash buffering to increase throughput by around 30%. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@637 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/Board/Dataflash.h')
-rw-r--r--LUFA/Drivers/Board/Dataflash.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/LUFA/Drivers/Board/Dataflash.h b/LUFA/Drivers/Board/Dataflash.h
index 57ce92d4..e58828c5 100644
--- a/LUFA/Drivers/Board/Dataflash.h
+++ b/LUFA/Drivers/Board/Dataflash.h
@@ -75,6 +75,18 @@
#endif
/* Public Interface - May be used in end-application: */
+ /* Macros: */
+ #if !defined(__DOXYGEN__)
+ #define __GET_DATAFLASH_MASK2(x, y) x ## y
+ #define __GET_DATAFLASH_MASK(x) __GET_DATAFLASH_MASK2(DATAFLASH_CHIP,x)
+ #endif
+
+ /* Retrieves the Dataflash chip select mask for the given Dataflash chip index.
+ *
+ * \param index Index of the dataflash chip mask to retrieve
+ */
+ #define DATAFLASH_CHIP_MASK(index) __GET_DATAFLASH_MASK(index)
+
/* Pseudo-Function Macros: */
#if defined(__DOXYGEN__)
/** Determines the currently selected dataflash chip.
@@ -149,7 +161,7 @@
#else
#error The selected board does not contain a dataflash IC.
#endif
-
+
/* Inline Functions: */
/** Initializes the dataflash driver (including the SPI driver) so that commands and data may be
* sent to an attached dataflash IC.
@@ -183,6 +195,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
+ Dataflash_ToggleSelectedChipCS();
}
/** Selects a dataflash IC from the given page number, which should range from 0 to