This file for Persistent Data Storage - Non-Volatile Memory management.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | block_header |
Block header, located before each block of item data. More... | |
struct | pds_env |
containing environment parameters of the NVM module. More... | |
struct | sector_header |
Sector header, located at sector start. More... | |
Macros | |
#define | NVM_MEMORY ((volatile uint16_t *)FLASH_ADDR) |
#define | PDS_BLOCK_ACTIVE_FLAG_Pos 7 |
#define | PDS_BLOCK_ACTIVE_MASK(value) ((0x1ul << PDS_BLOCK_ACTIVE_FLAG_Pos) & value) |
PDS_BLOCK_DELETE_FLAG_Pos Flag. More... | |
#define | PDS_BLOCK_DELETE_FLAG_Pos 5 |
#define | PDS_BLOCK_DELETE_MASK(value) ((0x1ul << PDS_BLOCK_DELETE_FLAG_Pos) & value) |
FLASH base address. More... | |
#define | PDS_EXTERNAL_EEPROM_ID (0x03) |
#define | PDS_EXTERNAL_FLASH_ID (0x02) |
#define | PDS_ID(main_id, sub_id) ((main_id << 8) | sub_id) |
PDS_BLOCK_ACTIVE_FLAG_Pos Flag. More... | |
#define | PDS_ID_MAINID(pds_id) (0x00FF & (pds_id >> 8)) |
#define | PDS_ID_SUBID(pds_id) (0x00FF & pds_id) |
#define | PDS_INTERNAL_EEPROM_ID (0x04) |
PDS Identifier. More... | |
#define | PDS_INTERNAL_FLASH_ID (0x01) |
#define | PDS_INVALID_SECTOR (0xFF) |
PDS Internal flash ID. More... | |
Typedefs | |
typedef struct block_header | block_header_t |
Block header, located before each block of item data. More... | |
typedef struct pds_env | pds_env_t |
containing environment parameters of the NVM module. More... | |
typedef enum pds_item_id | pds_item_id_t |
< More... | |
typedef enum pds_status | pds_status_t |
PDS Invalid sector identifier. More... | |
typedef struct sector_header | sector_header_t |
Sector header, located at sector start. More... | |
Functions | |
COMPILER_PACK_RESET () pds_status_t pds_nvm_init(pds_env_t *pds_instance) | |
Initialize the PDS NVM memory controller. More... | |
COMPILER_PACK_SET (1) typedef struct pds_item_type | |
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_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_item_type_t | |
#define NVM_MEMORY ((volatile uint16_t *)FLASH_ADDR) |
#define PDS_BLOCK_ACTIVE_FLAG_Pos 7 |
Referenced by pds_write().
#define PDS_BLOCK_ACTIVE_MASK | ( | value | ) | ((0x1ul << PDS_BLOCK_ACTIVE_FLAG_Pos) & value) |
PDS_BLOCK_DELETE_FLAG_Pos Flag.
Referenced by pds_compact_sector(), pds_item_exist(), pds_list_item(), and pds_read().
#define PDS_BLOCK_DELETE_FLAG_Pos 5 |
Referenced by pds_delete(), and pds_write().
#define PDS_BLOCK_DELETE_MASK | ( | value | ) | ((0x1ul << PDS_BLOCK_DELETE_FLAG_Pos) & value) |
FLASH base address.
Referenced by pds_compact_sector(), pds_item_exist(), pds_list_item(), and pds_read().
#define PDS_EXTERNAL_EEPROM_ID (0x03) |
#define PDS_EXTERNAL_FLASH_ID (0x02) |
#define PDS_ID | ( | main_id, | |
sub_id | |||
) | ((main_id << 8) | sub_id) |
PDS_BLOCK_ACTIVE_FLAG_Pos Flag.
Referenced by ble_remove_bonding_info(), ble_restore_bonding_info(), and ble_store_bonding_info().
#define PDS_ID_MAINID | ( | pds_id | ) | (0x00FF & (pds_id >> 8)) |
#define PDS_ID_SUBID | ( | pds_id | ) | (0x00FF & pds_id) |
#define PDS_INTERNAL_EEPROM_ID (0x04) |
PDS Identifier.
#define PDS_INTERNAL_FLASH_ID (0x01) |
Referenced by pds_nvm_erase(), pds_nvm_init(), pds_nvm_read(), and pds_nvm_write().
#define PDS_INVALID_SECTOR (0xFF) |
PDS Internal flash ID.
Referenced by pds_compact_sector(), and pds_init().
typedef struct block_header block_header_t |
Block header, located before each block of item data.
typedef enum pds_item_id pds_item_id_t |
<
list of PDS Item-ID's list of possible PDS status
typedef enum pds_status pds_status_t |
PDS Invalid sector identifier.
typedef struct sector_header sector_header_t |
Sector header, located at sector start.
enum pds_item_id |
enum pds_status |
COMPILER_PACK_RESET | ( | ) |
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 |
COMPILER_PACK_SET | ( | 1 | ) |
Item structure for faster search of item
< Id of an item.
< Location of the this item.
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_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_item_type_t |