MEGA FLASH DRIVER.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <avr/boot.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
Macros | |
#define | EEPROM_BUSY_WAIT() eeprom_busy_wait() |
#define | ENABLE_RWW_SECTION() boot_rww_enable() |
#define | FLASH_ERASE(addr) boot_page_erase(addr) |
#define | FLASH_PAGE_FILL(addr, data) boot_page_fill(addr, data) |
#define | FLASH_PAGE_WRITE(addr) boot_page_write(addr) |
#define | PGM_READ_BYTE_FAR(x) pgm_read_byte_far(x) |
#define | SPM_BUSY_WAIT() boot_spm_busy_wait() |
Functions | |
void | flash_erase_page (uint32_t) |
Erases a page. More... | |
void | flash_fill_page_buffer (uint32_t, uint16_t, uint8_t *) |
Fills the temporary page buffer. More... | |
void | flash_program_page (uint32_t) |
Erases and Writes the actual flash page. More... | |
void | flash_read (uint32_t, uint32_t, uint8_t *) |
Reads data from the flash memory. More... | |
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. More... | |
Variables | |
void | noinline |
#define EEPROM_BUSY_WAIT | ( | ) | eeprom_busy_wait() |
#define ENABLE_RWW_SECTION | ( | ) | boot_rww_enable() |
#define FLASH_ERASE | ( | addr | ) | boot_page_erase(addr) |
#define FLASH_PAGE_WRITE | ( | addr | ) | boot_page_write(addr) |
#define PGM_READ_BYTE_FAR | ( | x | ) | pgm_read_byte_far(x) |
#define SPM_BUSY_WAIT | ( | ) | boot_spm_busy_wait() |
void flash_erase_page | ( | uint32_t | ) |
Erases a page.
page_number | The page that has to be erased |
void flash_fill_page_buffer | ( | uint32_t | , |
uint16_t | , | ||
uint8_t * | |||
) |
Fills the temporary page buffer.
This function fills the temporay flash page buffer.
flash_addr | address of flash to be written |
length | Length of provide data buffer |
data | Pointer to data buffer |
void flash_program_page | ( | uint32_t | ) |
Erases and Writes the actual flash page.
This function writes the data from the temporary flash page buffer to the actual flash page.
page_start_addr | Start address of the flash page |
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().
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 data, flash_fill_page_buffer(), flash_program_page(), and flash_read().
void noinline |