Microchip® Advanced Software Framework

flash.c File Reference

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)
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)
void flash_read ( uint32_t  ,
uint32_t  ,
uint8_t *   
)

Reads data from the flash memory.

Parameters
read_addrAddress in the Flash to be read
lenNumber of bytes to be read
ret_bufPointer 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.

Parameters
flash_addrFlash address to be written
lengthNumber of bytes to write
dataPointer to data location

References data, flash_fill_page_buffer(), flash_program_page(), and flash_read().

Referenced by nvm_write(), and nvm_write_char().