MEGA FLASH DRIVER.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include "interrupt.h"
#include "compiler.h"
#include "parts.h"
#include "flash.h"
#include "sysclk.h"
#include "status_codes.h"
Functions | |
void | flash_erase_page (uint32_t page_number) |
void | flash_fill_page_buffer (uint32_t flash_addr, uint16_t length, uint8_t *data) |
void | flash_program_page (uint32_t page_start_addr) |
void | flash_read (uint32_t read_addr, uint32_t len, uint8_t *ret_buf) |
Reads data from the flash memory. More... | |
void | flash_write (uint32_t flash_addr, uint32_t length, uint8_t *data) |
Writes data to flash location : Performs all activities like filling the page buffer,erasing the flash page and pushing the data to the appropriate page address. More... | |
void flash_erase_page | ( | uint32_t | page_number | ) |
References cpu_irq_restore(), cpu_irq_save(), EEPROM_BUSY_WAIT, ENABLE_RWW_SECTION, FLASH_ERASE, and SPM_BUSY_WAIT.
Referenced by nvm_page_erase().
void flash_fill_page_buffer | ( | uint32_t | flash_addr, |
uint16_t | length, | ||
uint8_t * | data | ||
) |
References FLASH_PAGE_FILL, and PGM_READ_BYTE_FAR.
Referenced by flash_write().
void flash_program_page | ( | uint32_t | page_start_addr | ) |
References cpu_irq_restore(), cpu_irq_save(), EEPROM_BUSY_WAIT, ENABLE_RWW_SECTION, FLASH_ERASE, FLASH_PAGE_WRITE, and SPM_BUSY_WAIT.
Referenced by flash_write().
void flash_read | ( | uint32_t | , |
uint32_t | , | ||
uint8_t * | |||
) |
Reads data from the flash memory.
read_addr | Address in the Flash to be read |
len | Number of bytes to be read |
ret_buf | Pointer to the location of the read data |
References cpu_irq_restore(), cpu_irq_save(), and PGM_READ_BYTE_FAR.
Referenced by flash_write(), nvm_read(), and nvm_read_char().
void flash_write | ( | uint32_t | , |
uint32_t | , | ||
uint8_t * | |||
) |
Writes data to flash location : Performs all activities like filling the page buffer,erasing the flash page and pushing the data to the appropriate page address.
flash_addr | Flash address to be written |
length | Number of bytes to write |
data | Pointer to data location |
References flash_fill_page_buffer(), flash_program_page(), and flash_read().
Referenced by nvm_write(), and nvm_write_char().