Interface for accessing an external SPI EEPROM. More...
#include "HardwareProfile.h"
Go to the source code of this file.
Macros | |
#define | XEE_SUCCESS FALSE |
#define | XEEInit xeeInit |
#define | XEEBeginWrite xeeBeginWrite |
#define | XEEWrite xeeWrite |
#define | XEEWriteArray xeeWriteArray |
#define | XEEEndWrite xeeEndWrite |
#define | XEEBeginRead xeeBeginRead |
#define | XEERead xeeRead |
#define | XEEReadArray xeeReadArray |
#define | XEEEndRead xeeEndRead |
#define | XEEIsBusy xeeIsBusy |
#define | xeeEndRead() |
Typedefs | |
typedef BOOL | XEE_RESULT |
Functions | |
void | xeeInit (void) |
BOOL | xeeBeginWrite (DWORD address) |
BOOL | xeeWrite (BYTE val) |
void | xeeWriteArray (BYTE *val, WORD wLen) |
BOOL | xeeEndWrite (void) |
BOOL | xeeBeginRead (DWORD address) |
BYTE | xeeRead (void) |
BOOL | xeeReadArray (DWORD address, BYTE *buffer, WORD length) |
BOOL | xeeIsBusy (void) |
Interface for accessing an external SPI EEPROM.
Code for reading and writing to and from a external EEPROM chip on the SPI bus. This file defines an interface for an external SPI EEPROM chip. The implementation has to be done in a separate c file by creating instances of these functions. The Netcruzer library contains a default implementations which can be used.
The following defines are used to configure this module, and should be placed in projdefs.h. Note that all items marked [-DEFAULT-] are defaults, and do not have to be placed in projdefs.h if they contain desired configuration! For details, see Project Configuration.
The following defines the hardware used for this module, and is located in the board specific file in the "netcruzer/lib" folder (brd_sbc66ec-r2.h for example). They should only be changed if the default EEPROM is replaced with a custom one.
The software supplied herewith is owned by Modtronix Engineering, and is protected under applicable copyright laws. The software supplied herewith is intended and supplied to you, the Company customer, for use solely and exclusively on products manufactured by Modtronix Engineering. The code may be modified and can be used free of charge for commercial and non commercial applications. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
File History
2011-12-10, David H. (DH):
#define xeeEndRead | ( | ) |
Ends read
BOOL xeeBeginRead | ( | DWORD | address) |
Sets internal address counter to given address.
address | Address at which read is to be performed. |
BOOL xeeBeginWrite | ( | DWORD | address) |
Modifies internal address counter of EEPROM.
address | address to be set for writing |
BOOL xeeEndWrite | ( | void | ) |
Commits any last uncommitted bytes in cache to physical storage. Call this function when you no longer need to write any more bytes at the selected address.
void xeeInit | ( | void | ) |
Initialize SPI module to communicate to serial EEPROM.
BOOL xeeIsBusy | ( | void | ) |
Indicates if the external EEPROM is busy
BYTE xeeRead | ( | void | ) |
Reads next byte from EEPROM; internal address is incremented by one.
BOOL xeeReadArray | ( | DWORD | address, |
BYTE * | buffer, | ||
WORD | length | ||
) |
Reads desired number of bytes in sequential mode. This function performs all necessary steps and releases the bus when finished.
address | Address from where array is to be read |
buffer | Caller supplied buffer to hold the data |
length | Number of bytes to read. |
BOOL xeeWrite | ( | BYTE | val) |
Writes a byte to the write cache, and if full, commits the write. Also, if a write boundary is reached the write is committed. When finished writing, xeeEndWrite() must be called to commit any unwritten bytes from the write cache.
val | Byte to be written |
void xeeWriteArray | ( | BYTE * | val, |
WORD | wLen | ||
) |
This function writes an array of bytes to the EEPROM at the address specified when xeeBeginWrite() was called. Page boundary crossing is handled internally.
Details: The internal write cache is flushed at completion, so it is unnecessary to call xeeEndWrite() after calling this function. However, if you do so, no harm will be done.
val | The array to write to the next memory location |
wLen | The length of the data to be written |