#include "compiler.h"
#include "pds_interface.h"
#include "common_nvm.h"
#include "nvm.h"
#include "conf_nvm.h"
Macros | |
#define | EEPROM_NUM_ROWS (EEPROM_SIZE/EEPROM_ROW_SIZE) |
#define | EEPROM_PAGE_PER_ROW (NVMCTRL_ROW_PAGES) |
#define | EEPROM_PAGE_SIZE (NVMCTRL_PAGE_SIZE) |
#define | EEPROM_ROW_SIZE (EEPROM_PAGE_SIZE*EEPROM_PAGE_PER_ROW) |
#define | EEPROM_SIZE 4096 |
Functions | |
PdsStatus_t | pdsNvmErase (uint16_t rowId) |
Will erase the contents of a row. More... | |
PdsStatus_t | pdsNvmEraseAll (void) |
Erases all the contents of NVM of all rows. More... | |
PdsStatus_t | pdsNvmInit (void) |
Initializes the NVM by checking the EEPROM size and calling nvm init. More... | |
PdsStatus_t | pdsNvmRead (uint16_t rowId, PdsMem_t *buffer, uint16_t size) |
This function will read the contents of NVM and verify the crc. More... | |
PdsStatus_t | pdsNvmWrite (uint16_t rowId, PdsMem_t *buffer, uint16_t size) |
This function will calculate the crc of the buffer contents and writes the buffer contents to nvm. More... | |
#define EEPROM_NUM_ROWS (EEPROM_SIZE/EEPROM_ROW_SIZE) |
Referenced by pdsNvmEraseAll(), pdsReturnFreeRowIdx(), pdsWlDeleteAll(), and pdsWlInit().
#define EEPROM_PAGE_PER_ROW (NVMCTRL_ROW_PAGES) |
#define EEPROM_PAGE_SIZE (NVMCTRL_PAGE_SIZE) |
#define EEPROM_ROW_SIZE (EEPROM_PAGE_SIZE*EEPROM_PAGE_PER_ROW) |
Referenced by pdsNvmRead(), and pdsWlInit().
#define EEPROM_SIZE 4096 |
Referenced by pdsNvmInit().
PdsStatus_t pdsNvmErase | ( | uint16_t | rowId | ) |
Will erase the contents of a row.
[in] | rowId | - The rowId to be erased. |
[out] | status | - The return status of the function's operation of type PdsStatus_t. |
References ERR_BUSY, nvm_erase_row(), nvmLogicalRowToPhysicalAddr(), PDS_ERROR, PDS_OK, and STATUS_OK.
Referenced by pdsNvmEraseAll().
PdsStatus_t pdsNvmEraseAll | ( | void | ) |
Erases all the contents of NVM of all rows.
[in] | none | |
[out] | status | - The return status of the function's operation of type PdsStatus_t. |
References EEPROM_NUM_ROWS, PDS_OK, and pdsNvmErase().
Referenced by pdsWlDeleteAll().
PdsStatus_t pdsNvmInit | ( | void | ) |
Initializes the NVM by checking the EEPROM size and calling nvm init.
[in] | none | |
[out] | status | - The return status of the function's operation of type PdsStatus_t. |
References EEPROM_SIZE, nvm_get_parameters(), nvm_init(), PDS_ERROR, PDS_NOT_ENOUGH_MEMORY, PDS_OK, nvm_parameters::rww_eeprom_number_of_pages, and STATUS_OK.
Referenced by pdsWlInit().
PdsStatus_t pdsNvmRead | ( | uint16_t | rowId, |
PdsMem_t * | buffer, | ||
uint16_t | size | ||
) |
This function will read the contents of NVM and verify the crc.
[in] | pdsFileItemIdx | - The file id to be read. |
[in] | buffer | - The buffer containing data to be read. |
[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 calculate_crc(), _PdsNvmHeader_t::crc, EEPROM_ROW_SIZE, _PdsNvm_t::NVM_Struct, nvmLogicalRowToPhysicalAddr(), PDS_CRC_ERROR, PDS_ERROR, PDS_OK, _PdsNvm_t::_NVM_Struct::pdsNvmData, _PdsNvm_t::_NVM_Struct::pdsNvmHeader, _PdsNvmHeader_t::size, STATUS_BUSY, and STATUS_OK.
Referenced by pdsNvmWrite(), pdsWlInit(), and pdsWlRead().
PdsStatus_t pdsNvmWrite | ( | uint16_t | rowId, |
PdsMem_t * | buffer, | ||
uint16_t | size | ||
) |
This function will calculate the crc of the buffer contents and writes the buffer contents to nvm.
It will also read the same content to verify if its written properly.
[in] | pdsFileItemIdx | - The file id to be written. |
[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 calculate_crc(), _PdsNvmHeader_t::crc, _PdsNvm_t::NVM_Struct, nvmLogicalRowToPhysicalAddr(), PDS_ERROR, PDS_NVM_VERSION, PDS_OK, _PdsNvm_t::_NVM_Struct::pdsNvmData, _PdsNvm_t::_NVM_Struct::pdsNvmHeader, pdsNvmRead(), _PdsNvmHeader_t::size, STATUS_OK, and _PdsNvmHeader_t::version.
Referenced by pdsWlWrite().