Persistent Storage NVM management.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
#include "pds_nvm.h"
#include "conf_nvm.h"
#include "ble_utils.h"
Functions | |
pds_status_t | pds_nvm_erase (pds_env_t *pds_instance, uint32_t mem_address, uint16_t len) |
PDS NVM erase operation. More... | |
pds_status_t | pds_nvm_init (pds_env_t *pds_instance) |
Initialize the PDS NVM memory controller. More... | |
pds_status_t | pds_nvm_read (pds_env_t *pds_instance, uint32_t mem_address, uint8_t *buffer, uint16_t len) |
PDS NVM read operation. More... | |
pds_status_t | pds_nvm_write (pds_env_t *pds_instance, uint32_t mem_address, uint8_t *buffer, uint16_t len) |
PDS NVM write operation. More... | |
Variables | |
pds_env_t | pds_env_cfg |
pds_status_t pds_nvm_erase | ( | pds_env_t * | pds_instance, |
uint32_t | mem_address, | ||
uint16_t | len | ||
) |
PDS NVM erase operation.
Erase the PDS data from NVM address location for the given size
[in] | pds_instance | Initialized PDS environment structure |
[in] | mem_address | NVM address location |
[in] | len | NVM erase size |
PDS_SUCCESS | NVM erase procedure is completed |
for | other return values check pds_status_t enum values |
References pds_env::flash_id, nvm_erase_row(), PDS_INTERNAL_FLASH_ID, PDS_INVALID_FLASH_ID, PDS_SUCCESS, status, system_interrupt_enter_critical_section(), and system_interrupt_leave_critical_section().
Referenced by pds_compact_sector(), and pds_delete_all().
pds_status_t pds_nvm_init | ( | pds_env_t * | pds_instance | ) |
Initialize the PDS NVM memory controller.
Initialize the NVM memory controller, based on the NVM id the respective driver API's must be called, If any errors in the initialization will result in PDS Initialization error
[in] | pds_instance | Initialized PDS environment structure |
PDS_SUCCESS | PDS Initialize procedure is completed |
PDS_INIT_ERROR | PDS initialization failed, due to inactive sector or NVM Init failures |
for | other return values check pds_status_t enum values |
References Assert, pds_env::flash_id, nvm_config::manual_page_write, nvm_get_config_defaults(), nvm_set_config(), PDS_INTERNAL_FLASH_ID, PDS_INVALID_FLASH_ID, PDS_NVM_INIT_ERROR, PDS_SUCCESS, STATUS_OK, and nvm_config::wait_states.
Referenced by pds_init().
pds_status_t pds_nvm_read | ( | pds_env_t * | pds_instance, |
uint32_t | mem_address, | ||
uint8_t * | buffer, | ||
uint16_t | len | ||
) |
PDS NVM read operation.
Read the PDS data from NVM address location for the given size
[in] | pds_instance | Initialized PDS environment structure |
[in] | mem_address | NVM address location |
[in] | buffer | NVM read buffer |
[in] | len | NVM read buffer size |
PDS_SUCCESS | NVM read procedure is completed |
for | other return values check pds_status_t enum values |
References Assert, data, pds_env::flash_id, len, nvm_is_ready(), NVM_MEMORY, PDS_INTERNAL_FLASH_ID, PDS_INVALID_FLASH_ID, PDS_NVM_READ_ERROR, and PDS_SUCCESS.
Referenced by pds_compact_sector(), pds_delete(), pds_init(), pds_item_exist(), pds_list_item(), pds_read(), and pds_write().
pds_status_t pds_nvm_write | ( | pds_env_t * | pds_instance, |
uint32_t | mem_address, | ||
uint8_t * | buffer, | ||
uint16_t | len | ||
) |
PDS NVM write operation.
Write the PDS data into NVM address location
[in] | pds_instance | Initialized PDS environment structure |
[in] | mem_address | NVM address location |
[in] | buffer | NVM write buffer |
[in] | len | NVM write buffer size |
PDS_SUCCESS | NVM write procedure is completed |
for | other return values check pds_status_t enum values |
References buffer, pds_env::flash_id, i, nvm_erase_row(), nvm_read_buffer(), nvm_write_buffer(), PDS_INTERNAL_FLASH_ID, PDS_INVALID_FLASH_ID, PDS_NVM_WRITE_ERROR, PDS_SUCCESS, STATUS_BUSY, STATUS_OK, system_interrupt_enter_critical_section(), and system_interrupt_leave_critical_section().
Referenced by pds_compact_sector(), pds_delete(), pds_delete_all(), and pds_write().
pds_env_t pds_env_cfg |