Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# spieeprom.h

Go to the documentation of this file.

    00001 /*! \file spieeprom.h \brief Interface for standard SPI EEPROM memories. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'spieeprom.h'
    00005 // Title        : Interface for standard SPI EEPROM memories
    00006 // Author       : Pascal Stang - Copyright (C) 2004
    00007 // Created      : 2004.10.07
    00008 // Revised      : 2004.10.07
    00009 // Version      : 0.1
    00010 // Target MCU   : Atmel AVR series
    00011 // Editor Tabs  : 4
    00012 //
    00013 /// \ingroup driver_hw
    00014 /// \defgroup spieeprom Interface for standard SPI EEPROM memories (spieeprom.c)
    00015 /// \code #include "spieeprom.h" \endcode
    00016 /// \par Overview
    00017 ///     This library provides functions for reading and writing standard
    00018 /// 25Cxxx/25LCxxx SPI EEPROM memories.  Memory sizes up to 64Kbytes are
    00019 /// supported.  Future revisions may include page-write support.
    00020 ///
    00021 /// \Note Library not fully tested!
    00022 //
    00023 // This code is distributed under the GNU Public License
    00024 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00025 //
    00026 //*****************************************************************************
    00027
    00028 #ifndef SPIEEPROM_H
    00029 #define SPIEEPROM_H
    00030
    00031 #include "global.h"
    00032
    00033 // defines and constants
    00034 // commands
    00035 #define SPIEEPROM_CMD_READ      0x03    ///< Read byte(s)
    00036 #define SPIEEPROM_CMD_WRITE     0x02    ///< Write byte(s)
    00037 #define SPIEEPROM_CMD_WREN      0x06    ///< Write Enable
    00038 #define SPIEEPROM_CMD_WRDI      0x04    ///< Write Disable
    00039 #define SPIEEPROM_CMD_RDSR      0x05    ///< Read Status Register
    00040 #define SPIEEPROM_CMD_WRSR      0x01    ///< Write Status Register
    00041
    00042 // status register bit defines
    00043 #define SPIEEPROM_STATUS_WIP    0x01    ///< Write in progress
    00044 #define SPIEEPROM_STATUS_WEL    0x01    ///< Write enable
    00045 #define SPIEEPROM_STATUS_BP0    0x01    ///< Block Proection 0
    00046 #define SPIEEPROM_STATUS_BP1    0x01    ///< Block Proection 1
    00047 #define SPIEEPROM_STATUS_WPEN   0x01    ///< Write Protect Enable
    00048
    00049 // functions
    00050
    00051 //! Initialize SPI EEPROM interface
    00052 void spieepromInit(void);
    00053
    00054 //! In the SPI EEPROM read a byte from memory location [memAddr]
    00055 u08 spieepromReadByte(u32 memAddr);
    00056
    00057 //! In the SPI EEPROM write a byte [data] to the memory location [memAddr]
    00058 void spieepromWriteByte(u32 memAddr, u08 data);
    00059
    00060 void spieepromWriteEnable(void);
    00061 void spieepromWriteDisable(void);
    00062 u08 spieepromReadStatus(void);
    00063
    00064 #endif