Microchip® Advanced Software Framework

nvm.h File Reference

Non Volatile Memory controller driver.

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <ccp.h>

Data Structures

struct  nvm_device_id
 Structure containing the device ID. More...
 
struct  nvm_device_serial
 Structure containing the device serial. More...
 

Macros

#define FLASH_PAGE_SIZE
 
#define FLASH_SIZE
 Size of a flash page in bytes. More...
 
#define IAR_FLASH_PTR   __farflash
 Flash pointer type to use for accessing flash memory with IAR. More...
 
#define nvm_get_production_signature_row_offset(regname)   offsetof(NVM_PROD_SIGNATURES_t, regname)
 Get offset of calibration bytes in the production signature row. More...
 

Typedefs

typedef uint16_t eeprom_addr_t
 Data type for holding eeprom memory addresses. More...
 
typedef uint32_t flash_addr_t
 Data type for holding flash memory addresses. More...
 

Enumerations

enum  fuse_byte_t {
  FUSEBYTE0 = 0,
  FUSEBYTE1 = 1,
  FUSEBYTE2 = 2,
  FUSEBYTE3 = 3,
  FUSEBYTE4 = 4,
  FUSEBYTE5 = 5
}
 

Functions

static void eeprom_disable_mapping (void)
 Disable EEPROM mapping into data space. More...
 
static void eeprom_enable_mapping (void)
 Enable EEPROM mapping into data space. More...
 
static void nvm_blba_lock_bits_write (enum NVM_BLBA_enum blba_lock)
 Program the BLBA lock bits. More...
 
static void nvm_blbat_lock_bits_write (enum NVM_BLBAT_enum blbat_lock)
 Program the BLBAT lock bits. More...
 
static void nvm_blbb_lock_bits_write (enum NVM_BLBB_enum blbb_lock)
 Program the BLBB lock bits. More...
 
void nvm_common_spm (uint32_t addr, uint8_t nvm_cmd)
 Perform SPM write. More...
 
void nvm_eeprom_atomic_write_page (uint8_t page_addr)
 Erase and write bytes from page buffer into EEPROM. More...
 
void nvm_eeprom_erase_all (void)
 Erase entire EEPROM memory. More...
 
void nvm_eeprom_erase_and_write_buffer (eeprom_addr_t address, const void *buf, uint16_t len)
 Write buffer within the eeprom. More...
 
void nvm_eeprom_erase_bytes_in_all_pages (void)
 Erase bytes from all EEPROM pages. More...
 
void nvm_eeprom_erase_bytes_in_page (uint8_t page_addr)
 Erase bytes from EEPROM page. More...
 
void nvm_eeprom_erase_page (uint8_t page_addr)
 Erase EEPROM page. More...
 
void nvm_eeprom_fill_buffer_with_value (uint8_t value)
 Fill temporary EEPROM page buffer with value. More...
 
void nvm_eeprom_flush_buffer (void)
 Flush temporary EEPROM page buffer. More...
 
void nvm_eeprom_load_byte_to_buffer (uint8_t byte_addr, uint8_t value)
 Load single byte into temporary page buffer. More...
 
void nvm_eeprom_load_page_to_buffer (const uint8_t *values)
 Load entire page into temporary EEPROM page buffer. More...
 
void nvm_eeprom_read_buffer (eeprom_addr_t address, void *buf, uint16_t len)
 Read buffer within the eeprom. More...
 
uint8_t nvm_eeprom_read_byte (eeprom_addr_t addr)
 Read one byte from EEPROM using mapped access. More...
 
void nvm_eeprom_split_write_page (uint8_t page_addr)
 Write (without erasing) EEPROM page. More...
 
void nvm_eeprom_write_byte (eeprom_addr_t address, uint8_t value)
 Write one byte to EEPROM using IO mapping. More...
 
static void nvm_exec (void)
 Non-Volatile Memory Execute Command. More...
 
static void nvm_flash_atomic_write_app_page (flash_addr_t page_addr)
 Erase and write a page within the application section. More...
 
static void nvm_flash_atomic_write_boot_page (flash_addr_t page_addr)
 Erase and write a page within the boot section. More...
 
void nvm_flash_erase_and_write_buffer (flash_addr_t address, const void *buf, uint16_t len, bool b_blank_check)
 Erase and write specific parts of application flash section. More...
 
static void nvm_flash_erase_app (void)
 Erase entire application section. More...
 
static void nvm_flash_erase_app_page (flash_addr_t page_addr)
 Erase a page within the application section. More...
 
static void nvm_flash_erase_boot_page (flash_addr_t page_addr)
 Erase a page within the boot section. More...
 
static void nvm_flash_erase_user_section (void)
 Erase the user calibration section page. More...
 
static void nvm_flash_flush_buffer (void)
 Flush flash page buffer. More...
 
void nvm_flash_load_word_to_buffer (uint32_t word_addr, uint16_t data)
 Load word into flash page buffer. More...
 
void nvm_flash_read_buffer (flash_addr_t address, void *buf, uint16_t len)
 Read buffer within the application section. More...
 
static uint8_t nvm_flash_read_byte (flash_addr_t addr)
 Load byte from flash memory. More...
 
static uint16_t nvm_flash_read_word (flash_addr_t addr)
 Load word from flash memory. More...
 
static void nvm_flash_split_write_app_page (flash_addr_t page_addr)
 Write a page within the application section. More...
 
static void nvm_flash_split_write_boot_page (flash_addr_t page_addr)
 Write a page within the boot section. More...
 
static void nvm_flash_write_user_page (void)
 Write the user calibration section page. More...
 
uint8_t nvm_fuses_read (enum fuse_byte_t fuse)
 Read a fuse byte. More...
 
static void nvm_issue_command (NVM_CMD_t nvm_command)
 Non-Volatile Memory Execute Specific Command. More...
 
void nvm_issue_flash_range_crc (flash_addr_t start_addr, flash_addr_t end_addr)
 Issue flash range CRC command. More...
 
static void nvm_lb_lock_bits_write (enum NVM_LB_enum lb_lock)
 Program the LB lock bits. More...
 
static void nvm_lock_bits_write (enum NVM_BLBB_enum blbb_lock, enum NVM_BLBA_enum blba_lock, enum NVM_BLBAT_enum blbat_lock, enum NVM_LB_enum lb_lock)
 Program the lock bits. More...
 
uint8_t nvm_read_byte (uint8_t nvm_cmd, uint16_t address)
 Read one byte using the LDI instruction. More...
 
static void nvm_read_device_id (struct nvm_device_id *storage)
 Read the device id. More...
 
static uint8_t nvm_read_device_rev (void)
 Read the device revision. More...
 
void nvm_read_device_serial (struct nvm_device_serial *storage)
 Read the device serial. More...
 
static uint8_t nvm_read_production_signature_row (uint8_t address)
 Read one byte from the production signature row. More...
 
static uint8_t nvm_read_user_signature_row (uint16_t address)
 Read one byte from the user signature row. More...
 
void nvm_user_sig_read_buffer (flash_addr_t address, void *buf, uint16_t len)
 Read buffer within the user section. More...
 
void nvm_user_sig_write_buffer (flash_addr_t address, const void *buf, uint16_t len, bool b_blank_check)
 Write specific parts of user flash section. More...
 
static void nvm_wait_until_ready (void)
 Wait for any NVM access to finish. More...