Non volatile memories management.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | IFLASH_ADDR IFLASH0_ADDR |
#define | IFLASH_PAGE_SIZE IFLASH0_PAGE_SIZE |
Enumerations | |
enum | mem_type_t { INT_FLASH } |
Functions | |
status_code_t | nvm_get_page_size (mem_type_t mem, uint32_t *size) |
Get the size of a page in the non volatile memory specified. More... | |
status_code_t | nvm_get_pagenumber (mem_type_t mem, uint32_t address, uint32_t *num) |
Get the page number from the byte address address. More... | |
status_code_t | nvm_get_size (mem_type_t mem, uint32_t *size) |
Get the size of whole non volatile memory specified. More... | |
status_code_t | nvm_init (mem_type_t mem) |
Initialize the non volatile memory specified. More... | |
status_code_t | nvm_page_erase (mem_type_t mem, uint32_t page_number) |
Erase a page in the non volatile memory. More... | |
status_code_t | nvm_read (mem_type_t mem, uint32_t address, void *buffer, uint32_t len) |
Read len number of bytes from address address in non volatile memory mem and store it in the buffer buffer. More... | |
status_code_t | nvm_read_char (mem_type_t mem, uint32_t address, uint8_t *data) |
Read single byte of data. More... | |
status_code_t | nvm_set_security_bit (void) |
Enable security bit which blocks external read and write access to the device. More... | |
status_code_t | nvm_write (mem_type_t mem, uint32_t address, void *buffer, uint32_t len) |
Write len number of bytes at address address in non volatile memory mem from the buffer buffer. More... | |
status_code_t | nvm_write_char (mem_type_t mem, uint32_t address, uint8_t data) |
Write single byte of data. More... | |
#define IFLASH_ADDR IFLASH0_ADDR |
Referenced by nvm_read(), and nvm_read_char().
#define IFLASH_PAGE_SIZE IFLASH0_PAGE_SIZE |
Referenced by nvm_get_page_size(), nvm_get_pagenumber(), nvm_get_size(), nvm_page_erase(), nvm_read(), and nvm_read_char().
enum mem_type_t |
status_code_t nvm_get_page_size | ( | mem_type_t | mem, |
uint32_t * | size | ||
) |
Get the size of a page in the non volatile memory specified.
mem | Type of non volatile memory |
size | Pointer to where to store the size |
References ERR_INVALID_ARG, IFLASH_PAGE_SIZE, INT_FLASH, and STATUS_OK.
status_code_t nvm_get_pagenumber | ( | mem_type_t | mem, |
uint32_t | address, | ||
uint32_t * | num | ||
) |
Get the page number from the byte address address.
mem | Type of non volatile memory |
address | Byte address of the non volatile memory |
num | Pointer to where to store the page number |
References ERR_INVALID_ARG, IFLASH_PAGE_SIZE, INT_FLASH, and STATUS_OK.
status_code_t nvm_get_size | ( | mem_type_t | mem, |
uint32_t * | size | ||
) |
Get the size of whole non volatile memory specified.
mem | Type of non volatile memory |
size | Pointer to where to store the size |
References ERR_INVALID_ARG, IFLASH_PAGE_SIZE, INT_FLASH, and STATUS_OK.
status_code_t nvm_init | ( | mem_type_t | mem | ) |
Initialize the non volatile memory specified.
mem | Type of non volatile memory to initialize |
References ERR_INVALID_ARG, ERR_NO_MEMORY, INT_FLASH, and STATUS_OK.
Referenced by pal_init().
status_code_t nvm_page_erase | ( | mem_type_t | mem, |
uint32_t | page_number | ||
) |
Erase a page in the non volatile memory.
mem | Type of non volatile memory to erase |
page_number | Page number to erase |
References ERR_INVALID_ARG, IFLASH_PAGE_SIZE, INT_FLASH, and STATUS_OK.
status_code_t nvm_read | ( | mem_type_t | mem, |
uint32_t | address, | ||
void * | buffer, | ||
uint32_t | len | ||
) |
Read len number of bytes from address address in non volatile memory mem and store it in the buffer buffer.
mem | Type of non volatile memory to read |
address | Address to read |
buffer | Pointer to destination buffer |
len | Number of bytes to read |
References ERR_BAD_ADDRESS, ERR_INVALID_ARG, IFLASH_ADDR, IFLASH_PAGE_SIZE, INT_FLASH, and STATUS_OK.
Referenced by pal_ps_get().
status_code_t nvm_read_char | ( | mem_type_t | mem, |
uint32_t | address, | ||
uint8_t * | data | ||
) |
Read single byte of data.
mem | Type of non volatile memory to read |
address | Address to read |
data | Pointer to where to store the read data |
References ERR_BAD_ADDRESS, ERR_INVALID_ARG, IFLASH_ADDR, IFLASH_PAGE_SIZE, INT_FLASH, and STATUS_OK.
status_code_t nvm_set_security_bit | ( | void | ) |
Enable security bit which blocks external read and write access to the device.
References ERR_INVALID_ARG, and STATUS_OK.
status_code_t nvm_write | ( | mem_type_t | mem, |
uint32_t | address, | ||
void * | buffer, | ||
uint32_t | len | ||
) |
Write len number of bytes at address address in non volatile memory mem from the buffer buffer.
mem | Type of non volatile memory to write |
address | Address to write |
buffer | Pointer to source buffer |
len | Number of bytes to write |
References ERR_BAD_ADDRESS, ERR_INVALID_ARG, flashcalw_memcpy(), INT_FLASH, and STATUS_OK.
Referenced by pal_ps_set().
status_code_t nvm_write_char | ( | mem_type_t | mem, |
uint32_t | address, | ||
uint8_t | data | ||
) |
Write single byte of data.
mem | Type of non volatile memory to write |
address | Address to write |
data | Data to be written |
References ERR_BAD_ADDRESS, ERR_INVALID_ARG, INT_FLASH, and STATUS_OK.