SFBEeprom.h

Go to the documentation of this file.
00001 /*                                              -*- mode:C++; fill-column:100 -*-
00002   SFBEeprom.h - Support for I/O with the EEPROM
00003   Copyright (C) 2009 The Regents of the University of New Mexico.  All rights reserved.
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU General Public License
00016   along with this library; if not, write to the Free Software
00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
00018   USA
00019 */
00020 
00105 #ifndef SFBEEPROM_H_
00106 #define SFBEEPROM_H_
00107 
00108 #include "SFBTypes.h"
00109 
00127 extern void eepromWrite(u32 addr, const u8 * source, u32 length) ;
00128 
00144 extern void eepromRead(u32 addr, u8 * dest, u32 length) ;
00145 
00156 extern void eepromWait(bool busyWait = false) ;
00157 
00163 extern u32 eepromSize() ;
00164 
00165 #define EEPROM_SIZE_BYTES (1<<14)    
00166 #define EEPROM_BYTES_PER_PAGE 64     
00167 #define EEPROM_RESERVED_PAGES 2      
00168 #define EEPROM_RESERVED_BYTES (EEPROM_RESERVED_PAGES*EEPROM_BYTES_PER_PAGE) 
00190 extern void eepromWriteReserved(const u32 addr, const u8 * data, const u32 length) ;
00191 
00207 extern void eepromReadReserved(const u32 addr, u8 * data,const u32 length) ;
00208 
00215 extern void eeprom_startup_initialization() ;
00216 
00221 class SFBEeprom {
00222 public:
00224   void write(u32 addr, const u8 * source, u32 length) { eepromWrite(addr,source,length); }
00225 
00227   void read(u32 addr, u8 * dest, u32 length) { eepromRead(addr, dest, length); }
00228 
00230   void wait(bool busyWait = false) { eepromWait(busyWait); }
00231 
00235   u32 size() { return eepromSize(); }
00236 };
00237 
00241 extern SFBEeprom EEPROM; 
00242 
00243 
00244 #endif /*SFBEEPROM_H_*/

Generated on Fri Apr 22 06:54:11 2011 for SFB by doxygen 1.5.9