Microchip® Advanced Software Framework

pds_wl.h File Reference

This is the Pds wear levelling header file which contains Pds wear levelling headers.

Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include "pds_nvm.h"
#include "pds_interface.h"

Data Structures

struct  _FileMap
 
struct  _RowMap
 
struct  _UpdateFileMap
 

Typedefs

typedef struct _FileMap FileMap_t
 
typedef struct _RowMap RowMap_t
 
typedef struct _UpdateFileMap UpdateFileMap_t
 

Functions

bool isFileFound (PdsFileItemIdx_t pdsFileItemIdx)
 This function checks if a file is found in the file map. More...
 
void pdsWlDeleteAll (void)
 This function Erases Filemap and Rowmap array in WL and Initiates NVM Erase all. More...
 
PdsStatus_t pdsWlInit (void)
 Initializes the WL PDS by updating the row and file map. More...
 
PdsStatus_t pdsWlRead (PdsFileItemIdx_t pdsFileItemIdx, PdsMem_t *buffer, uint16_t size)
 This function will find extract the row where the file is stored and read from NVM. More...
 
PdsStatus_t pdsWlWrite (PdsFileItemIdx_t pdsFileItemIdx, PdsMem_t *buffer, uint16_t size)
 This function will find the free row index to write to, updates the WL_Struct header and writes to NVM. More...
 

typedef struct _FileMap FileMap_t
typedef struct _RowMap RowMap_t

bool isFileFound ( PdsFileItemIdx_t  pdsFileItemIdx)

This function checks if a file is found in the file map.

Parameters
[out]-return true or false

References _FileMap::maxCounterRowIdx.

Referenced by PDS_IsRestorable().

void pdsWlDeleteAll ( void  )

This function Erases Filemap and Rowmap array in WL and Initiates NVM Erase all.

Parameters
[out]-void

References EEPROM_NUM_ROWS, PDS_MAX_FILE_IDX, and pdsNvmEraseAll().

Referenced by PDS_DeleteAll().

PdsStatus_t pdsWlRead ( PdsFileItemIdx_t  pdsFileItemIdx,
PdsMem_t buffer,
uint16_t  size 
)

This function will find extract the row where the file is stored and read from NVM.

Parameters
[in]pdsFileItemIdx- The file id to be read from.
[in]buffer- The buffer containing data to be written.
[in]size- The size of the data in the buffer.
[out]status- The return status of the function's operation of type PdsStatus_t.

References _FileMap::maxCounterRowIdx, PDS_NOT_FOUND, PDS_OK, and pdsNvmRead().

Referenced by PDS_Restore(), PDS_RestoreAll(), and pdsStoreDelete().

PdsStatus_t pdsWlWrite ( PdsFileItemIdx_t  pdsFileItemIdx,
PdsMem_t buffer,
uint16_t  size 
)

This function will find the free row index to write to, updates the WL_Struct header and writes to NVM.

If the nvm write is successful it updates the row and file map.

Parameters
[in]pdsFileItemIdx- The file id to be written to.
[in]buffer- The buffer containing data to be written.
[in]size- The size of the data in the buffer.
[out]status- The return status of the function's operation of type PdsStatus_t.

References _RowMap::counter, _UpdateFileMap::counter, _PdsWlHeader_t::counter, _PdsWlHeader_t::magicNo, _RowMap::memId, _PdsWlHeader_t::memId, _UpdateFileMap::memId, _PdsNvm_t::NVM_Struct, PDS_MAGIC, PDS_OK, PDS_WL_VERSION, _PdsNvm_t::_NVM_Struct::pdsNvmData, pdsNvmWrite(), pdsReturnFreeRowIdx(), pdsUpdateFileMap(), _PdsWl_t::_WL_Struct::pdsWlHeader, _RowMap::previousIdx, _UpdateFileMap::rowIdx, _PdsWlHeader_t::size, _PdsWlHeader_t::version, and _PdsWl_t::WL_Struct.

Referenced by pdsStoreDelete().