![]() |
NHS31xx storage - Maximizing storage for equisized samples
|
Go to the source code of this file.
When a full backward search is performed during data recovery, we rely on the length of the marker to eliminate false positives, i.e. to ensure no bit sequence exists that looks like a valid marker but are in reality one or more samples stored in EEPROM. The comments near the code in FindMarker explain the length and value of the marker avoid finding false positives. Yet, although extremely improbable, there is still a very tiny possibility that real-life data being stored in EEPROM results in such a false positive. Even then, most applications will never have the need to perform a full backward search, evading this problem. If your application is more likely to hit this, due to the use case being sufficiently different, and due to the samples being sufficiently similar, this module can be adapted to erase the full EEPROM after moving all data to FLASH - see MoveSamplesFromEepromToFlash. During our continuous tests using randomized data of different lengths, we have never encountered this problem and therefore decided not to suffer the extra cost (time and power consumption) of implementing this.
aaa
, bbb
, ... fff:
samples, with bitsize STORAGE_BITSIZEAA:
ALON register, formatted according to RecoverInfo_tHH:
hint, formatted according to Hint_tMMMMMMM:
marker, formatted according to Marker_tBB:
block info, of size FLASH_DATA_HEADER_SIZExxxx:
block bytes, the (compressed) data bytes moved from EEPROM and now stored in FLASHThe ALON register will then point to the new location of the marker; while the hint will not be updated and will for sure contain faulty information.
When power gets lost, the ALON register contents is reset to 0
, and will then point to a faulty location as well.
Only the marker will then still be correct, which can be recovered only through a full backward search. When that is done, after leaving Storage_DeInit, all three recovery structures will be correctly linked.
After a hard reset, the general purpose registers are reset to 0, and the samples temporarily stored there are also lost. This brings the total number of minimum lost samples to STORAGE_WRITE_RECOVERY_EVERY_X_SAMPLES + STORAGE_SAMPLE_ALON_CACHE_COUNT - both are diversity settings the application can set.
The memory content changes are visually depicted below. If writing a new sample would increase the size to equal to or higher than STORAGE_BLOCK_SIZE_IN_SAMPLES, first the EEPROM contents are moved, then the new sample is written.
Definition in file storage.c.
Data Structures | |
struct | RecoverInfo_t |
struct | Hint_t |
struct | Marker_t |
struct | Storage_Instance_t |
Enumerations | |
enum | LOCATION_T { LOCATION_UNKNOWN, LOCATION_CACHE, LOCATION_EEPROM, LOCATION_FLASH } |
Functions | |
int | STORAGE_COMPRESS_CB (int eepromByteOffset, int bitCount, void *pOut) |
int | STORAGE_DECOMPRESS_CB (const uint8_t *pData, int bitCount, void *pOut) |
int | Storage_DummyCompressCb (int eepromByteOffset, int bitCount, void *pOut) |
int | Storage_DummyDecompressCb (const uint8_t *pData, int bitCount, void *pOut) |
static void | ResetInstance (void) |
static void | ShiftAlignedData (uint8_t *pTo, const uint8_t *pFrom, const int bitAlignment, const int bitCount) |
static void | ShiftUnalignedData (uint8_t *pTo, const uint8_t *pFrom, const int bitAlignment, const int bitCount) |
static bool | CacheSample (const STORAGE_TYPE *pSample) |
static bool | GetCachedSample (const int n, void *pData) |
static void | WriteToEeprom (const int bitCursor, const void *pData, const int bitCount) |
static void | ReadFromEeprom (const unsigned int bitCursor, void *pData, const int bitCount) |
static unsigned int | FindMarker (Marker_t *pMarker) |
static int | GetEepromCount (void) |
static int | GetFlashCount (void) |
static int | StoreSamplesInEeprom (const STORAGE_TYPE *pSamples, int n) |
static bool | MoveSamplesFromEepromToFlash (void) |
static int | ReadAndCacheSamplesFromFlash (int readCursor) |
static bool | ValidateRecoverInfo (void) |
static bool | ValidateMarker (const Marker_t *pMarker, int expectedFlashByteCursor) |
static bool | ValidateHint (const Hint_t *pHint) |
static void | WriteHint (void) |
static void | WriteMarker (void) |
void | Storage_Init (void) |
void | Storage_DeInit (void) |
int | Storage_GetCount (void) |
void | Storage_Reset (bool checkFlash) |
int | Storage_Write (STORAGE_TYPE *samples, int n) |
bool | Storage_Seek (int n) |
int | Storage_Read (STORAGE_TYPE *samples, int n) |
Variables | |
const int | _etext |
const int | _data |
const int | _edata |
static int | sStorageFlashFirstPage |
int | checkSizeOfSampleType [(sizeof(STORAGE_TYPE) *8< STORAGE_BITSIZE) ? -1 :1] |
int | checkSizeOfHint [(SIZE_OF_HINT==sizeof(Hint_t)) ? 1 :-1] |
int | checkSizeOfMarker [(SIZE_OF_MARKER==sizeof(Marker_t)) ? 1 :-1] |
int | checkSizeOfRecoverInfo [sizeof(RecoverInfo_t)==4 ? 1 :-1] |
static Storage_Instance_t | sInstance |
static uint8_t | sCache [4 *(5 - STORAGE_FIRST_ALON_REGISTER)] |
static RecoverInfo_t * | spRecoverInfo |
static bool | sEepromBitCursorChanged = false |
uint8_t | sStorage_Workarea [STORAGE_WORKAREA_SIZE] |
uint8_t | STORAGE_WORKAREA [STORAGE_WORKAREA_SIZE] |
struct RecoverInfo_t |
An instance of this structure is stored in the designated register of the ALON domain, and points to where to find Marker_t. This structure is stored in ALON and allows for the fastest initialization. If all these values are 0, either no logging is ongoing, or the battery has gone empty. To discover which case holds true, first Hint_t is checked; if that fails too, the EEPROM is checked backwards for the location of a stored instance of type Marker_t (which is time consuming). Once found, the correct values for this structure can be reconstructed.
Data Fields | ||
---|---|---|
unsigned int | eepromBitCursor: 15 | |
unsigned int | sampleCacheCount: 4 |
The number of samples that are cached in the general purpose registers. These are stored starting from |
unsigned int | firstBitsOfCache: FIRST_BITS_OF_CACHE_SIZE |
A filler. It allows to perform a sanity check at compile time on the size of RecoverInfo_s. |
struct Hint_t |
An instance of this structure is stored at the fixed location HINT_ABSOLUTE_BYTE_OFFSET, and points to where to find Marker_t. If all the information contained is correct (which may not be the case) it still allows for a fast initialization.
eepromBitCursor
may contain correct information. If not, the EEPROM is checked backwards for the location of a stored instance of type Marker_t (which is time consuming) and this hint structure is adapted (so a next initialization under the same circumstances is done quickly).Data Fields | ||
---|---|---|
uint16_t | eepromBitCursor | |
uint16_t | flashByteCursor |
struct Marker_t |
An instance of this structure is stored in EEPROM, right after the end of the last sample in EEPROM. It is used to re-create sInstance upon initialization. Since a number of false candidates may be proposed, it contains a header
and a footer
to have a near 100% chance of detecting erroneous information.
Data Fields | ||
---|---|---|
const int | header |
Must equal MARKER_HEADER, or |
int | flashByteCursor |
|
const int | footer |
Must equal MARKER_FOOTER, or |
struct Storage_Instance_t |
Stores all meta data to perform the requested reads and writes in FLASH and EEPROM. Upon de-initialization, an updated instance of Marker_t is updated and stored in EEPROM, and an updated instance of RecoverInfo_t is stored in the ALON domain, using the information in this structure.
Data Fields | ||
---|---|---|
int | eepromBitCursor |
The position of the first bit where new data can be stored in EEPROM, relative to STORAGE_EEPROM_FIRST_ROW. This doubles up as the start position of a stored instance of type Marker_t in EEPROM. There are at most |
int | flashByteCursor |
The position of the first byte where new data can be stored in FLASH, relative to STORAGE_FLASH_FIRST_PAGE.
|
LOCATION_T | readLocation |
Indicates the type of memory to |
int | readCursor |
|
int | readSequence |
A sequence number to help identify where the next sample, which must be read out, is located.
|
int | targetSequence |
The sequence number that was requested in the last call to Storage_Seek.
|
int | cachedBlockOffset |
Determines what contents are available in STORAGE_WORKAREA.
|
#define EEPROM_ABSOLUTE_FIRST_BYTE_OFFSET (STORAGE_EEPROM_FIRST_ROW * EEPROM_ROW_SIZE) |
The absolute offset to the very first byte of the assigned EEPROM region.
Definition at line 310 of file storage.c.
Referenced by FindMarker(), MoveSamplesFromEepromToFlash(), ReadFromEeprom(), Storage_Init(), ValidateHint(), WriteHint(), and WriteToEeprom().
#define EEPROM_ABSOLUTE_LAST_BYTE_OFFSET (((STORAGE_EEPROM_LAST_ROW + 1) * EEPROM_ROW_SIZE) - 1) |
The absolute offset to the very last byte of the assigned EEPROM region.
Definition at line 314 of file storage.c.
Referenced by FindMarker().
#define FLASH_CURSOR_TO_BYTE_ADDRESS | ( | flashByteCursor | ) | ((uint8_t *)(FLASH_START + (STORAGE_FLASH_FIRST_PAGE * FLASH_PAGE_SIZE) + (flashByteCursor))) |
Translates a flash byte cursor relative to assigned FLASH region to a byte address.
Definition at line 317 of file storage.c.
Referenced by GetFlashCount(), MoveSamplesFromEepromToFlash(), ReadAndCacheSamplesFromFlash(), Storage_Seek(), and ValidateMarker().
#define FLASH_CURSOR_TO_PAGE | ( | flashByteCursor | ) | (STORAGE_FLASH_FIRST_PAGE + ((flashByteCursor) / FLASH_PAGE_SIZE)) |
Translates a FLASH byte cursor relative to assigned FLASH region to the number of the page the cursor refers to.
Definition at line 321 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash().
#define FLASH_PAGE_TO_ADDRESS | ( | type, | |
flashPage | |||
) | ((type)(FLASH_START + ((flashPage) * FLASH_PAGE_SIZE))) |
#define FLASH_FIRST_BYTE_ADDRESS FLASH_PAGE_TO_ADDRESS(uint8_t *, STORAGE_FLASH_FIRST_PAGE) |
#define FLASH_LAST_BYTE_ADDRESS (FLASH_PAGE_TO_ADDRESS(uint8_t *, STORAGE_FLASH_LAST_PAGE + 1) - 1) |
The very last byte address of the assigned FLASH region.
Definition at line 330 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash(), and ValidateMarker().
#define FLASH_FIRST_WORD_ADDRESS FLASH_PAGE_TO_ADDRESS(uint32_t *, STORAGE_FLASH_FIRST_PAGE) |
The very first 32-bit word address of the assigned FLASH region.
Definition at line 333 of file storage.c.
Referenced by Storage_Reset().
#define FLASH_LAST_WORD_ADDRESS (FLASH_PAGE_TO_ADDRESS(uint32_t *, STORAGE_FLASH_LAST_PAGE + 1) - 1) |
The very last WORD address of the assigned FLASH region.
Definition at line 336 of file storage.c.
Referenced by Storage_Reset().
#define FLASH_DATA_HEADER_SIZE STORAGE_BLOCK_HEADER_SIZE |
The size in bytes of the meta data stored just in front of the (compressed) data block in FLASH. The LSBit of the first byte after these header size contains the start of the (compressed) data block. This header is used to give the decompress callback the correct arguments, and to deduce where to find the next block.
Definition at line 349 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash(), and ReadAndCacheSamplesFromFlash().
#define FLASH_BLOCK_SIZE | ( | bitCount | ) | (4 * STORAGE_IDIVUP((bitCount) + FLASH_DATA_HEADER_SIZE * 8, 32)) |
Given the header value of a (compressed) data block in FLASH, calculates the size in bytes of the complete block, including FLASH_DATA_HEADER_SIZE. The start of a new block must always
be stored on a 32-bit word boundary: this allows to continue writing the same page without erasing. As a consequence, up to 31 padding bits after the end of previous (compressed) data block are lost.
bitCount | The size in bits of the (compressed) data block, excluding FLASH_DATA_HEADER_SIZE. |
Definition at line 373 of file storage.c.
Referenced by GetFlashCount(), MoveSamplesFromEepromToFlash(), ReadAndCacheSamplesFromFlash(), and Storage_Seek().
#define MARKER_HEADER ((int)0x0000FFFF) |
The first of two special values that are used in Marker_t to be able to reconstruct the EEPROM and FLASH bit cursor in case the battery has died - and thus the register value has been reset to zero.
Definition at line 381 of file storage.c.
Referenced by ValidateMarker(), and WriteMarker().
#define MARKER_FOOTER ((int)0x7FFFFFFF) |
The second special value.
Definition at line 382 of file storage.c.
Referenced by ValidateMarker(), and WriteMarker().
#define MARKER_CURSOR_ZERO_MASK 0xFFFF8003 |
The mask to use to zero out all possible 1 bits in Marker_t.flashByteCursor
Definition at line 385 of file storage.c.
Referenced by ValidateMarker().
#define STORAGE_FLASH_FIRST_PAGE sStorageFlashFirstPage |
Definition at line 396 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash(), and Storage_Reset().
#define FIRST_BITS_OF_CACHE_SIZE 13 |
The size of the first bits of the cache, in the same general purpose register where RecoverInfo_t is stored.
Definition at line 412 of file storage.c.
Referenced by CacheSample(), and GetCachedSample().
#define SIZE_OF_HINT 4 |
Byte size of Hint_t. Checked at compile time using checkSizeOfHint.
#define INVERSE_HINT_ABSOLUTE_BYTE_OFFSET ((EEPROM_ABSOLUTE_LAST_BYTE_OFFSET + 1 - SIZE_OF_HINT)) |
The absolute offset to a copy of the hint structure, to validate its contents.
Definition at line 440 of file storage.c.
Referenced by ValidateHint(), and WriteHint().
#define HINT_ABSOLUTE_BYTE_OFFSET (INVERSE_HINT_ABSOLUTE_BYTE_OFFSET - SIZE_OF_HINT) |
The absolute offset to Hint_t at the end of the assigned EEPROM region.
Definition at line 443 of file storage.c.
Referenced by Storage_DeInit(), Storage_Init(), Storage_Reset(), and WriteHint().
#define SIZE_OF_DUPLICATE_DATA 64 |
Byte size of the duplicate information.
Definition at line 452 of file storage.c.
Referenced by Storage_Init(), and WriteHint().
#define DUPLICATE_DATA_ABSOLUTE_BYTE_OFFSET (EEPROM_ABSOLUTE_LAST_BYTE_OFFSET + 1 - (2 * EEPROM_ROW_SIZE)) |
The absolute offset to the recovery information at the end of the assigned EEPROM region.
Definition at line 459 of file storage.c.
Referenced by Storage_Init(), and WriteHint().
#define SIZE_OF_MARKER 12 |
The total number of bytes in EEPROM consumed by meta-data, to be able to keep track of what is stored in FLASH and EEPROM, even after a power-off. Apart from Marker_t, there is an additional bit that marks whether the storage in FLASH and EEPROM is empty or at least one sample is stored in EEPROM -
#define EEPROM_OVERHEAD_IN_BITS ((SIZE_OF_MARKER + 2 * EEPROM_ROW_SIZE) * 8) |
The assigned EEPROM region cannot be used fully: there must be always room for Marker_t and the last couple of bytes are used to Hint_t. To avoid corruption in both the marker and the hint, the hint is placed in a separate row. The total overhead is summed up here.
Definition at line 600 of file storage.c.
Referenced by FindMarker().
enum LOCATION_T |
Enumerator | |
---|---|
LOCATION_UNKNOWN | A successful call to Storage_Seek is required. |
LOCATION_CACHE | Memory in the assigned general purpose registers is targeted. |
LOCATION_EEPROM | Memory in the assigned EEPROM region is targeted. |
LOCATION_FLASH | Memory in the assigned FLASH region is targeted. |
int STORAGE_COMPRESS_CB | ( | int | eepromByteOffset, |
int | bitCount, | ||
void * | pOut | ||
) |
Referenced by MoveSamplesFromEepromToFlash().
int STORAGE_DECOMPRESS_CB | ( | const uint8_t * | pData, |
int | bitCount, | ||
void * | pOut | ||
) |
Referenced by ReadAndCacheSamplesFromFlash().
int Storage_DummyCompressCb | ( | int | eepromByteOffset, |
int | bitCount, | ||
void * | pOut | ||
) |
This is a dummy implementation to provoke fallback behavior: a plain copy from EEPROM to FLASH. It is only used when STORAGE_COMPRESS_CB is not overridden in an application specific app_sel.h
header file
eepromByteOffset | unused |
bitCount | unused |
pOut | unused |
0
int Storage_DummyDecompressCb | ( | const uint8_t * | pData, |
int | bitCount, | ||
void * | pOut | ||
) |
This is a dummy implementation to provoke a failure; it should normally never be called, since the dummy compression implementation will provoke the fallback behavior: a plain copy from EEPROM to FLASH, and vice-versa while reading. It is only used when STORAGE_COMPRESS_CB is not overridden in an application specific app_sel.h
header file
pData | unused |
bitCount | unused |
pOut | unused |
0
|
static |
Re-initializes sInstance with default values.
Definition at line 735 of file storage.c.
Referenced by Storage_Init(), and Storage_Reset().
|
static |
Copies a number of bits of byte aligned data to a buffer, non-byte aligned.
pTo | The location to copy to. A number of LSBits of the first byte are not touched. |
pFrom | The location to copy from. The first bit to copy will become the LSBit of the first byte in this buffer. |
bitAlignment | The number of bits to disregard in to . Must be less than 8 . |
bitCount | The number of bits to copy. |
from
. to
. bitAlignment
bits of the first byte written to are not touched. -
indicating not touched or don't care,bitAlignment
equal to 5
, andbitCount
equal to 14
:Definition at line 762 of file storage.c.
Referenced by CacheSample(), and WriteToEeprom().
|
static |
Copies a number of bits of non-byte aligned data to a buffer, byte aligned.
pTo | The location to copy to. The first bit to copy will become the LSBit of the first byte in this buffer. |
pFrom | The location to copy from. A number of LSBits are disregarded. |
bitAlignment | The number of bits to disregard in from . Must be less than 8 . |
bitCount | The number of bits to copy. |
from
. to
. to
after bitCount
bits is set to 0
. -
indicating not touched or don't care,bitAlignment
equal to 5
, andbitCount
equal to 14
:Definition at line 817 of file storage.c.
Referenced by GetCachedSample(), ReadFromEeprom(), and Storage_Read().
|
static |
Stores data in sCache.
pSample | May not be NULL . The data to cache. |
true
when the sample was copied; false
when it did not fit and no changes were made. Definition at line 868 of file storage.c.
Referenced by Storage_Write().
|
static |
Retrieves a sample cached in an earlier call to CacheSample.
n | A relative index. Determines the sample to copy. A value of 0 indicates the oldest sample that is present in sCache. |
pData | May not be NULL . The sample is copied to the array pointed to. |
true
if a sample was copied; false
if less than n
samples are stored in sCache Definition at line 890 of file storage.c.
Referenced by Storage_Read(), and Storage_Write().
|
static |
bitCursor
bitCursor | Must be positive. The first bit where to start writing. |
pData | May not be NULL . |
bitCount | Must be strict positive. |
Definition at line 912 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash(), Storage_Reset(), StoreSamplesInEeprom(), and WriteMarker().
|
static |
bitCursor
bitCursor | Must be strict positive. The bit position in EEPROM to start reading: 0 means to start reading from the very first EEPROM bit assigned for bit storage, and so on. |
pData | May not be NULL . All bits are copied in the array pointed to. |
bitCount | Must be strict positive. When not a multiple of 8, the remainder MSBits of the last byte are set to 0 . |
Definition at line 942 of file storage.c.
Referenced by FindMarker(), Storage_Init(), and Storage_Read().
|
static |
Search backwards in the assigned EEPROM region, looking for a valid marker.
[out] | pMarker | : Where to copy the found marker data to. If 0 is returned, this will contain an invalid marker. |
0
if the marker could not be found. Definition at line 966 of file storage.c.
Referenced by Storage_Init().
|
static |
Definition at line 1027 of file storage.c.
Referenced by Storage_GetCount(), Storage_Seek(), and StoreSamplesInEeprom().
|
static |
Definition at line 1034 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash(), and Storage_GetCount().
|
static |
Stores n
samples in EEPROM. If necessary, the oldest data is moved to FLASH.
pSamples | May not be NULL . Pointer to the start of the array where to copy the samples from. |
n | The size of the array |
n
indicates insufficient storage capacity. Definition at line 1110 of file storage.c.
Referenced by Storage_Write().
|
static |
Clear the assigned EEPROM region, by moving all data to assigned FLASH region. Before moving the data, the application is given the opportunity to compress the data. The (compressed) data block is then appended to the existing data in FLASH. Steps:
true
when the compression was successful and the data has been moved to FLASH, false
when the compression callback function returned false
or when the FLASH storage is full: nothing has been changed in FLASH or EEPROM in that case. Definition at line 1160 of file storage.c.
Referenced by StoreSamplesInEeprom().
|
static |
Reads a block of compressed data containing STORAGE_BLOCK_SIZE_IN_SAMPLES samples, decompresses the data and stores the result in the workspace given by the application.
readCursor | The offset in bytes relative to FLASH_FIRST_BYTE_ADDRESS to the header preceding the (compressed) data block that must be read. |
0
when the FLASH contents were invalid, or when the decompression callback function returned false:
nothing has been changed in that case.Definition at line 1300 of file storage.c.
Referenced by Storage_Read().
|
static |
Checks whether spRecoverInfo contains possible correct information.
true
when the information contained in the structure spRecoverInfo points to can be used. Definition at line 1336 of file storage.c.
Referenced by Storage_Init().
|
static |
Checks whether the given structure contains possible correct information.
pMarker | : May not be NULL. Points to the structure to check. |
expectedFlashByteCursor | : Ignored when negative. When zero or positive, provides an additional constraint on the marker structure. |
true
when the information contained in the structure can be used. Definition at line 1351 of file storage.c.
Referenced by FindMarker(), and Storage_Init().
|
static |
Checks whether the given structure contains possible correct information.
pHint | : May not be NULL. Points to the structure to check. |
true
when the information contained in the structure can be used. Definition at line 1369 of file storage.c.
Referenced by Storage_DeInit(), and Storage_Init().
|
static |
Uses the information of sInstance to create a Hint_t structure, and writes it to EEPROM.
Definition at line 1397 of file storage.c.
Referenced by MoveSamplesFromEepromToFlash(), Storage_DeInit(), and Storage_Init().
|
static |
Uses the information of sInstance to create a Marker_t structure, and writes it to EEPROM.
Definition at line 1417 of file storage.c.
Referenced by Storage_DeInit(), and Storage_Init().
const int _etext |
Generated by the linker, used to calculate STORAGE_FLASH_FIRST_PAGE
Referenced by Storage_Init().
const int _data |
Generated by the linker, used to calculate STORAGE_FLASH_FIRST_PAGE
Referenced by Storage_Init().
const int _edata |
Generated by the linker, used to calculate STORAGE_FLASH_FIRST_PAGE
Referenced by Storage_Init().
|
static |
Definition at line 394 of file storage.c.
Referenced by Storage_Init().
int checkSizeOfSampleType[(sizeof(STORAGE_TYPE) *8< STORAGE_BITSIZE) ? -1 :1] |
If this construct doesn't compile, STORAGE_TYPE can not hold STORAGE_BITSIZE bits.
int checkSizeOfHint[(SIZE_OF_HINT==sizeof(Hint_t)) ? 1 :-1] |
If this construct doesn't compile, the define SIZE_OF_MARKER is no longer equal to sizeof
(Hint_t)
int checkSizeOfMarker[(SIZE_OF_MARKER==sizeof(Marker_t)) ? 1 :-1] |
If this construct doesn't compile, the define SIZE_OF_MARKER is no longer equal to sizeof
(Marker_t)
int checkSizeOfRecoverInfo[sizeof(RecoverInfo_t)==4 ? 1 :-1] |
If this construct doesn't compile, adjust FIRST_BITS_OF_CACHE_SIZE. RecoverInfo_t must be exactly 32 bits in size
|
static |
The module's instance information, where recovered information is copied to, and where all updates are stored. In Storage_DeInit, this information is copied to more permanent storage.
Definition at line 637 of file storage.c.
Referenced by GetEepromCount(), GetFlashCount(), MoveSamplesFromEepromToFlash(), ReadAndCacheSamplesFromFlash(), ResetInstance(), Storage_DeInit(), Storage_Init(), Storage_Read(), Storage_Reset(), Storage_Seek(), Storage_Write(), StoreSamplesInEeprom(), WriteHint(), and WriteMarker().
|
static |
To reduce the call count to Chip_PMU_GetRetainedData
and Chip_PMU_SetRetainedData
, data is copied to SRAM in Storage_Init once, and copied back to GPREG in Storage_DeInit once.
Definition at line 644 of file storage.c.
Referenced by CacheSample(), GetCachedSample(), Storage_DeInit(), and Storage_Init().
|
static |
Initialized in Storage_Init to points to the recovery structure in sCache.
Definition at line 650 of file storage.c.
Referenced by CacheSample(), GetCachedSample(), Storage_DeInit(), Storage_GetCount(), Storage_Init(), Storage_Reset(), Storage_Write(), and ValidateRecoverInfo().
|
static |
Set to true
after writing a new sample in EEPROM, used in Storage_DeInit to know when to write the marker. Not set when resetting the module; as there is no need for a marker in that case.
Definition at line 658 of file storage.c.
Referenced by Storage_DeInit(), and StoreSamplesInEeprom().
uint8_t sStorage_Workarea[STORAGE_WORKAREA_SIZE] |
uint8_t STORAGE_WORKAREA[STORAGE_WORKAREA_SIZE] |
Referenced by MoveSamplesFromEepromToFlash(), ReadAndCacheSamplesFromFlash(), and Storage_Read().