diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2012-02-12 20:34:33 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2012-02-12 20:34:33 +0000 |
| commit | 8d2c79867c8e6bd6b882ceeec55d46e363e96f2d (patch) | |
| tree | afb3191482a04b14a2d8c6b3086ab50a7798ce96 /LUFA/Drivers/Board | |
| parent | 2a871d1157f05c7d585511bf5363e9386d27a97e (diff) | |
Add new Master SPI Mode USART serial peripheral driver for the XMEGA and AVR8 architectures.
Modify board Dataflash drivers so that each individual board is responsible for including the correct peripheral driver (SPI or SerialSPI) based on the board connections to the Dataflash chip.
Complete A3BU-XPLAINED and B1-XPLAINED board Dataflash drivers.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@2047 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/Board')
| -rw-r--r-- | LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h | 1 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/AVR8/STK525/Dataflash.h | 1 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/AVR8/STK526/Dataflash.h | 1 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h | 1 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h | 1 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/Dataflash.h | 5 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h | 16 | ||||
| -rw-r--r-- | LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h | 16 |
8 files changed, 18 insertions, 24 deletions
diff --git a/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h b/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h index 007ef94f..595492fe 100644 --- a/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB321C.h" + #include "../../../Peripheral/SPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) diff --git a/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h b/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h index c9d6477f..67742977 100644 --- a/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB321C.h" + #include "../../../Peripheral/SPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) diff --git a/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h b/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h index ea4c0a02..ce20ff1e 100644 --- a/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB642D.h" + #include "../../../Peripheral/SPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) diff --git a/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h b/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h index 1e34a395..5b71d7d8 100644 --- a/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB642D.h" + #include "../../../Peripheral/SPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) diff --git a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h index 62532ced..c9bdbdc3 100644 --- a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h @@ -60,6 +60,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB642D.h" + #include "../../../Peripheral/SPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) diff --git a/LUFA/Drivers/Board/Dataflash.h b/LUFA/Drivers/Board/Dataflash.h index 2e1336bf..a5ae29dc 100644 --- a/LUFA/Drivers/Board/Dataflash.h +++ b/LUFA/Drivers/Board/Dataflash.h @@ -123,7 +123,6 @@ /* Includes: */ #include "../../Common/Common.h" - #include "../Peripheral/SPI.h" /* Enable C linkage for C++ Compilers: */ #if defined(__cplusplus) @@ -148,7 +147,9 @@ /* Inline Functions: */ /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. * - * \note The microcontroller's SPI driver must be initialized before any of the dataflash commands are used. + * \note The microcontroller's physical interface driver connected to the Dataflash IC must be initialized before + * any of the dataflash commands are used. This is usually a SPI hardware port, but on some devices/boards may + * be a USART operating in SPI Master mode. */ static inline void Dataflash_Init(void); diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h index c263853e..abc8d85d 100644 --- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h +++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB642D.h" + #include "../../../Peripheral/SerialSPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) @@ -100,9 +101,7 @@ static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) { - // TODO: USART in SPI mode on PORT D - #warning The Dataflash driver for the selected board is currently incomplete and non-functional. - return 0; + return SerialSPI_TransferByte(&USARTD0, Byte); } /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. @@ -112,7 +111,7 @@ static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Dataflash_SendByte(const uint8_t Byte) { - return; // TODO + SerialSPI_SendByte(&USARTD0, Byte); } /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. @@ -122,7 +121,7 @@ static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint8_t Dataflash_ReceiveByte(void) { - return 0; // TODO + return SerialSPI_ReceiveByte(&USARTD0); } /** Determines the currently selected dataflash chip. @@ -170,10 +169,7 @@ if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) return; - if (PageAddress & 0x01) - Dataflash_SelectChip(DATAFLASH_CHIP2); - else - Dataflash_SelectChip(DATAFLASH_CHIP1); + Dataflash_SelectChip(DATAFLASH_CHIP1); } /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive @@ -207,8 +203,6 @@ static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte) { - PageAddress >>= 1; - Dataflash_SendByte(PageAddress >> 5); Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); Dataflash_SendByte(BufferByte); diff --git a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h index 74a215b6..e12f969e 100644 --- a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h +++ b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB642D.h" + #include "../../../Peripheral/SerialSPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) @@ -100,9 +101,7 @@ static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) { - // TODO: USART in SPI mode on PORT C - #warning The Dataflash driver for the selected board is currently incomplete and non-functional. - return 0; + return SerialSPI_TransferByte(&USARTE0, Byte); } /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. @@ -112,7 +111,7 @@ static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Dataflash_SendByte(const uint8_t Byte) { - return; // TODO + SerialSPI_SendByte(&USARTE0, Byte); } /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. @@ -122,7 +121,7 @@ static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint8_t Dataflash_ReceiveByte(void) { - return 0; // TODO + return SerialSPI_ReceiveByte(&USARTE0); } /** Determines the currently selected dataflash chip. @@ -170,10 +169,7 @@ if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) return; - if (PageAddress & 0x01) - Dataflash_SelectChip(DATAFLASH_CHIP2); - else - Dataflash_SelectChip(DATAFLASH_CHIP1); + Dataflash_SelectChip(DATAFLASH_CHIP1); } /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive @@ -207,8 +203,6 @@ static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte) { - PageAddress >>= 1; - Dataflash_SendByte(PageAddress >> 5); Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); Dataflash_SendByte(BufferByte); |
