Simulated EEPROM system for wear leveling token storage across flash. See Simulated EEPROM 2 for documentation.

License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

/***************************************************************************/
#ifndef __PLAT_SIM_EEPROM_H__
#define __PLAT_SIM_EEPROM_H__

#include "hal/micro/cortexm3/memmap.h"
#include "hal/micro/cortexm3/flash.h"

#ifndef DOXYGEN_SHOULD_SKIP_THIS

// See the sim-eeprom-size.h file for the logic used to determine the ultimate
// size of the simeeprom.
#include "hal/plugin/sim-eeprom/sim-eeprom-size.h"

//This is confusing, so pay attention...  :-)
//The actual SimEE storage lives inside of simulatedEepromStorage and begins
//at the very bottom of simulatedEepromStorage and fills the entirety of
//this storage array.  The SimEE code, though, uses 16bit addresses for
//everything since it was originally written for the XAP2b.  On a 250,
//the base address was 0xF000 since this corresponded to the actual absolute
//address that was used in flash.  On a non-250, though, the base address
//is largely irrelevant since there is a translation shim layer that converts
//SimEE 16bit addresses into the real 32bit addresses needed to access flash.
//If you look at the translation shim layer in
//sim-eeprom-internal.c you'll see that the address used by the SimEE is
//subtracted by VPA_BASE (which is the same as SIMEE_BASE_ADDR_HW) to
//return back to the bottom of the simulatedEepromStorage area.
//[BugzId:14448 fix removes need for this to be anything but 0x0000]
#define SIMEE_BASE_ADDR_HW  0x0000

//Define a variable that holds the actual SimEE storage the linker will
//place at the proper location in flash.
extern uint8_t simulatedEepromStorage[SIMEE_SIZE_B];
//Define a pointer to the actual SimEE storage in flash.
extern uint8_t *simulatedEepromAddress;

//these parameters frame the sim-eeprom and are derived from the location
//of the sim-eeprom as defined in memmap.h

extern const uint16_t REAL_PAGE_SIZE;

extern const uint16_t VIRTUAL_PAGE_SIZE;

extern const uint8_t REAL_PAGES_PER_VIRTUAL;

extern const uint16_t LEFT_BASE;

extern const uint16_t LEFT_TOP;

extern const uint16_t RIGHT_BASE;

extern const uint16_t RIGHT_TOP;

extern const uint16_t VPA_BASE;

extern const uint16_t VPA_TOP;

extern const uint16_t VPB_BASE;

extern const uint16_t VPB_TOP;

extern const uint16_t VPC_BASE;

extern const uint16_t VPC_TOP;

extern const uint16_t ERASE_CRITICAL_THRESHOLD;

void halInternalSimEeGetPtr(void *ptr, uint8_t compileId, uint8_t index, uint8_t len);

#endif //__PLAT_SIM_EEPROM_H__

#endif //DOXYGEN_SHOULD_SKIP_THIS