Atmel Dataflash storage IC board hardware driver.
More...
|
| A3BU_XPLAINED |
| Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained.
|
|
| B1_XPLAINED |
| Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained.
|
|
| EVK527 |
| Board specific Dataflash driver header for the Atmel EVK527.
|
|
| STK525 |
| Board specific Dataflash driver header for the Atmel STK525.
|
|
| STK526 |
| Board specific Dataflash driver header for the Atmel STK525.
|
|
| USBKEY |
| Board specific Dataflash driver header for the Atmel USBKEY.
|
|
| XPLAIN |
| Board specific Dataflash driver header for the original Atmel XPLAIN.
|
|
| XPLAIN_REV1 |
| Board specific Dataflash driver header for the original Atmel XPLAIN, revision 1.
|
|
Module Source Dependencies
The following files must be built with any user project that uses this module:
Module Description
Dataflash driver. This module provides an easy to use interface for the Dataflash ICs located on many boards, for the storage of large amounts of data into the Dataflash's non-volatile memory.
If the BOARD
value is set to BOARD_USER
, this will include the /Board/Dataflash
.h file in the user project directory. Otherwise, it will include the appropriate built-in board driver header file.
For possible BOARD
makefile values, see Board Types.
Example Usage
The following snippet is an example of how this module may be used within a typical application.
WriteBuffer[i] = (i & 0xFF);
printf("Writing data to first dataflash buffer:\r\n");
printf("Committing page to non-volatile memory page index 5:\r\n");
printf("Reading data into second dataflash buffer:\r\n");
#define DATAFLASH_CHIP_MASK |
( |
|
index | ) |
CONCAT_EXPANDED(DATAFLASH_CHIP, index) |
Retrieves the Dataflash chip select mask for the given Dataflash chip index.
- Attention
- This macro will only work correctly on chip index numbers that are compile-time constants defined by the preprocessor.
- Parameters
-
[in] | index | Index of the dataflash chip mask to retrieve. |
- Returns
- Mask for the given Dataflash chip's /CS pin
static void Dataflash_DeselectChip |
( |
void |
| ) |
|
|
inlinestatic |
Deselects the current dataflash chip, so that no dataflash is selected.
static uint8_t Dataflash_GetSelectedChip |
( |
void |
| ) |
|
|
inlinestatic |
Determines the currently selected dataflash chip.
- Returns
- Mask of the currently selected Dataflash chip, either DATAFLASH_NO_CHIP if no chip is selected or a
DATAFLASH_CHIPn
mask (where n is the chip number).
static void Dataflash_Init |
( |
void |
| ) |
|
|
inlinestatic |
Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
- 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 uint8_t Dataflash_ReceiveByte |
( |
void |
| ) |
|
|
inlinestatic |
Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
- Returns
- Last response byte from the dataflash
static void Dataflash_SelectChip |
( |
const uint8_t |
ChipMask | ) |
|
|
inlinestatic |
Selects the given dataflash chip.
- Parameters
-
[in] | ChipMask | Mask of the Dataflash IC to select, in the form of a DATAFLASH_CHIPn mask (where n is the chip number). |
static void Dataflash_SelectChipFromPage |
( |
const uint16_t |
PageAddress | ) |
|
|
inlinestatic |
Selects a dataflash IC from the given page number, which should range from 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside the total number of pages contained in the boards dataflash ICs, all dataflash ICs are deselected.
- Parameters
-
[in] | PageAddress | Address of the page to manipulate, ranging from 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). |
static void Dataflash_SendAddressBytes |
( |
uint16_t |
PageAddress, |
|
|
const uint16_t |
BufferByte |
|
) |
| |
|
inlinestatic |
Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with dataflash commands which require a complete 24-bit address.
- Parameters
-
[in] | PageAddress | Page address within the selected dataflash IC |
[in] | BufferByte | Address within the dataflash's buffer |
static void Dataflash_SendByte |
( |
const uint8_t |
Byte | ) |
|
|
inlinestatic |
Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
- Parameters
-
[in] | Byte | Byte of data to send to the dataflash |
static void Dataflash_ToggleSelectedChipCS |
( |
void |
| ) |
|
|
inlinestatic |
Toggles the select line of the currently selected dataflash IC, so that it is ready to receive a new command.
static uint8_t Dataflash_TransferByte |
( |
const uint8_t |
Byte | ) |
|
|
inlinestatic |
Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
- Parameters
-
[in] | Byte | Byte of data to send to the dataflash |
- Returns
- Last response byte from the dataflash
static void Dataflash_WaitWhileBusy |
( |
void |
| ) |
|
|
inlinestatic |
Spin-loops while the currently selected dataflash is busy executing a command, such as a main memory page program or main memory to buffer transfer.