Non volatile memories management for SAM devices.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include "nvm.h"
#include "common_nvm.h"
#include "conf_board.h"
#include "system_interrupt.h"
#include "string.h"
Macros | |
#define | NVM_MEMORY ((volatile uint16_t *)FLASH_ADDR) |
Functions | |
status_code_t | nvm_init (mem_type_t mem) |
Initialize the non volatile memory specified. More... | |
static enum status_code | nvm_memcpy (const uint32_t destination_address, uint8_t *const buffer, uint16_t length, bool erase_flag) |
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... | |
static status_code_t | nvm_sam0_read (mem_type_t mem, uint32_t address, uint8_t *const buffer, uint32_t len) |
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... | |
#define NVM_MEMORY ((volatile uint16_t *)FLASH_ADDR) |
Pointer to the NVM MEMORY region start address
Referenced by nvm_sam0_read().
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, INT_FLASH, nvm_config::manual_page_write, nvm_get_config_defaults(), nvm_set_config(), STATUS_OK, and nvm_config::wait_states.
Referenced by main().
|
static |
References i, nvm_erase_row(), nvm_read_buffer(), nvm_write_buffer(), STATUS_BUSY, STATUS_OK, system_interrupt_enter_critical_section(), and system_interrupt_leave_critical_section().
Referenced by nvm_write().
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 nvm_sam0_read().
|
static |
References ERR_INVALID_ARG, i, INT_FLASH, nvm_is_ready(), NVM_MEMORY, STATUS_BUSY, and STATUS_OK.
Referenced by nvm_read().
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_INVALID_ARG, INT_FLASH, nvm_memcpy(), and STATUS_OK.