/*                                             ; fill-column:100 -*- mode:C++ -*-
  SFBEepromRAMImpl.cpp - Stubs for maximally-portable 'non-persistent EEPROM' (gah!)
  Copyright (C) 2009 The Regents of the University of New Mexico.  All rights reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
  USA
*/

#include "SFBEeprom.h"

void eeprom_set_directoryImpl(const char *) {  /* We don't need no stinkin path */  } 

void eepromWaitImpl(bool) {  /* We don't need to stinkin wait */  }

static u8 eepromData[EEPROM_SIZE_BYTES]; 

void eeprom_startup_initializationImpl() {
  for (u32 i = 0; i < EEPROM_SIZE_BYTES; ++i)
    eepromData[i] = 0xff;        /* Make it look like stinkin fresh NOR flash */
}

void eepromWriteImpl(u32 addr, const u8 * dataSrc, u32 length, bool ) {
  for (u32 i = 0; i < length; ++i) {
    if (addr+i < EEPROM_SIZE_BYTES)
      eepromData[addr+i] = dataSrc[i];
  }
}

void eepromReadImpl(u32 addr, u8 * dataDest, u32 length) {
  for (u32 i = 0; i < length; ++i) {
    if (addr+i < EEPROM_SIZE_BYTES)
      dataDest[i] = eepromData[addr+i];
  }
} 
