Dataflash.h File Reference

#include "../AT90USBXXX/SPI.h"
#include "../../Common/Common.h"

Defines

#define Dataflash_GetSelectedChip()   (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK)
#define Dataflash_SelectChip(mask)
#define Dataflash_DeselectChip()   Dataflash_SelectChip(DATAFLASH_NO_CHIP)

Functions

static uint8_t Dataflash_TransferByte (const uint8_t Byte) ATTR_ALWAYS_INLINE
static void Dataflash_SendByte (const uint8_t Byte) ATTR_ALWAYS_INLINE
static uint8_t Dataflash_ReceiveByte (void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
static void Dataflash_Init (const uint8_t PrescalerMask)
static void Dataflash_ToggleSelectedChipCS (void)
static void Dataflash_WaitWhileBusy (void)
static void Dataflash_SelectChipFromPage (const uint16_t PageAddress)
static void Dataflash_SendAddressBytes (uint16_t PageAddress, const uint16_t BufferByte)

Detailed Description

This file is the master dispatch header file for the board-specific dataflash driver, for boards containing dataflash ICs for external non-volatile storage.

User code should include this file, which will in turn include the correct dataflash driver header file for the currently selected board.

If the BOARD value is set to BOARD_USER, this will include the /Board/Dataflash.h file in the user project directory.


Define Documentation

 
#define Dataflash_DeselectChip (  )     Dataflash_SelectChip(DATAFLASH_NO_CHIP)

Deselects the current dataflash chip, so that no dataflash is selected.

 
#define Dataflash_GetSelectedChip (  )     (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK)

Returns the mask of the currently selected Dataflash chip, either DATAFLASH_NO_CHIP or a DATAFLASH_CHIPn mask (where n is the chip number).

#define Dataflash_SelectChip ( mask   ) 

Value:

MACROS{ DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT \
                                                         & ~DATAFLASH_CHIPCS_MASK) | mask);              }MACROE
Selects the dataflash chip given as a chip mask, in the form of DATAFLASH_CHIPn (where n is the chip number).


Function Documentation

static void Dataflash_Init ( const uint8_t  PrescalerMask  )  [inline, static]

Initializes the dataflash driver (including the SPI driver) so that commands and data may be sent to an attached dataflash IC.

Parameters:
PrescalerMask SPI prescaler mask, see SPI.h documentation

static uint8_t Dataflash_ReceiveByte ( void   )  [inline, static]

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_SelectChipFromPage ( const uint16_t  PageAddress  )  [inline, static]

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:
PageAddress Address of the page to manipulate, ranging from ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1).

static void Dataflash_SendAddressBytes ( uint16_t  PageAddress,
const uint16_t  BufferByte 
) [inline, static]

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-byte address.

Parameters:
PageAddress Page address within the selected dataflash IC
BufferByte Address within the dataflash's buffer

static void Dataflash_SendByte ( const uint8_t  Byte  )  [inline, static]

Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.

Parameters:
Byte of data to send to the dataflash

static void Dataflash_ToggleSelectedChipCS ( void   )  [inline, static]

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  )  [inline, static]

Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.

Parameters:
Byte of data to send to the dataflash
Returns:
Last response byte from the dataflash

static void Dataflash_WaitWhileBusy ( void   )  [inline, static]

Spinloops while the currently selected dataflash is busy executing a command, such as a main memory page program or main memory to buffer transfer.


Generated on Wed Apr 1 16:39:51 2009 for LUFA Library by  doxygen 1.5.7.1