Declaration api of flash loader.
Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries.
#include <eepromLoader.h>
Macros | |
#define | CMD_KEY 0xA5 |
#define | FLASH_MAIN_ADDRESS_SPACE (0x00) |
#define | FLASH_PAGESIZE 256u |
#define | MCU_EEPROM_START_ADDR 0x3F000 |
#define | MCU_PAGE_SIZE 64 |
#define | NO_OF_HALF_WORDS_PER_PAGE 32 |
#define | NO_OF_PAGES_PER_ROW 4 |
#define | PAGE_NUMBER_SHIFT 8 |
#define | PAGE_POSITION_OFFSET_MASK 0x000000FF |
#define | ROW_SIZE (4 * MCU_PAGE_SIZE) |
#define | ROW_SIZE_IN_HALF_WORDS (ROW_SIZE / 2) |
Functions | |
void | flashFlushPage (void) |
Flush unloaded data before exit from bootloader. More... | |
void | flashPacketToPage (void) |
Load received date to the flash. More... | |
void | flashUpdateAppStartAddr (void) |
Updates application start address in end of flash. More... | |
void | hwEraseFlashPage (uint32_t pageStartAddress) |
Erases specified flash page. More... | |
void | hwFillFlashPageBuffer (uint32_t startOffset, uint16_t length, uint8_t *data) |
Writes data to the page buffer. More... | |
INLINE uint8_t | hwFlashRead (uint16_t address) |
Reads byte from EEPROM. More... | |
void | hwFlashWriteEepromPage (HW_EepromParams_t *eeprom) |
Writes a page to the EEPROM. More... | |
void | hwWriteFlashPage (uint32_t pageStartAddress) |
Writes flash page buffer without erasing. More... | |
void | nvm_init (void) |
Variables | |
uint32_t | appStartAddr |
#define CMD_KEY 0xA5 |
#define FLASH_MAIN_ADDRESS_SPACE (0x00) |
#define FLASH_PAGESIZE 256u |
Referenced by flashFlushPage(), flashPacketToPage(), flashUpdateAppStartAddr(), memcopy(), update_boot_info(), and writeapp_infotable().
#define MCU_EEPROM_START_ADDR 0x3F000 |
Referenced by hwFlashRead().
#define MCU_PAGE_SIZE 64 |
Referenced by hwWriteFlashPage().
#define NO_OF_HALF_WORDS_PER_PAGE 32 |
#define NO_OF_PAGES_PER_ROW 4 |
Referenced by hwWriteFlashPage().
#define PAGE_NUMBER_SHIFT 8 |
#define PAGE_POSITION_OFFSET_MASK 0x000000FF |
Referenced by flashPacketToPage().
#define ROW_SIZE (4 * MCU_PAGE_SIZE) |
Referenced by hwFillFlashPageBuffer(), hwFlashWriteEepromPage(), and hwWriteFlashPage().
#define ROW_SIZE_IN_HALF_WORDS (ROW_SIZE / 2) |
Referenced by hwFillFlashPageBuffer().
void flashFlushPage | ( | void | ) |
Flush unloaded data before exit from bootloader.
References currentPage, FLASH_PAGESIZE, flashUpdateAppStartAddr(), hwEraseFlashPage(), hwFillFlashPageBuffer(), hwWriteFlashPage(), and temporaryPageBuffer.
Referenced by srecProtocol().
void flashPacketToPage | ( | void | ) |
Load received date to the flash.
References BootBuffer_t::address, appStartAddr, currentPage, BootBuffer_t::data, BootBuffer_t::dataSize, FLASH_PAGESIZE, hwEraseFlashPage(), hwFillFlashPageBuffer(), hwWriteFlashPage(), PAGE_POSITION_OFFSET_MASK, and temporaryPageBuffer.
Referenced by srecProtocol().
void flashUpdateAppStartAddr | ( | void | ) |
Updates application start address in end of flash.
References appStartAddr, FLASH_PAGESIZE, hwEraseFlashPage(), hwFillFlashPageBuffer(), hwWriteFlashPage(), and memcpy_P.
Referenced by clear_updateaction(), and flashFlushPage().
void hwEraseFlashPage | ( | uint32_t | pageStartAddress | ) |
Erases specified flash page.
[in] | pageStartAddress | - address within the target page |
References nvm_erase_row().
Referenced by flashFlushPage(), flashPacketToPage(), flashUpdateAppStartAddr(), hwFlashWriteEepromPage(), memcopy(), update_boot_info(), and writeapp_infotable().
void hwFillFlashPageBuffer | ( | uint32_t | startOffset, |
uint16_t | length, | ||
uint8_t * | data | ||
) |
Writes data to the page buffer.
[in] | startOffset | - start position for writing within the page |
[in] | length | - data to write length in bytes |
[in] | data | - pointer to data to write |
References pageBufferToFill, ROW_SIZE, and ROW_SIZE_IN_HALF_WORDS.
Referenced by flashFlushPage(), flashPacketToPage(), flashUpdateAppStartAddr(), hwFlashWriteEepromPage(), memcopy(), update_boot_info(), and writeapp_infotable().
INLINE uint8_t hwFlashRead | ( | uint16_t | address | ) |
Reads byte from EEPROM.
[in] | address | - address of a byte. |
References MCU_EEPROM_START_ADDR.
Referenced by eepromReadData().
void hwFlashWriteEepromPage | ( | HW_EepromParams_t * | eeprom | ) |
Writes a page to the EEPROM.
[in] | address | - address of data byte. |
[in] | data | - data for saving. |
[in] | length | - No of bytes. |
[in] | address | - address of data byte. |
[in] | data | - data for saving. |
References HW_EepromParams_t::address, HW_EepromParams_t::data, hwEraseFlashPage(), hwFillFlashPageBuffer(), hwWriteFlashPage(), HW_EepromParams_t::length, memcpy_P, and ROW_SIZE.
Referenced by eepromPacketToPage().
void hwWriteFlashPage | ( | uint32_t | pageStartAddress | ) |
Writes flash page buffer without erasing.
[in] | pageStartAddress | - address within the target page |
References MCU_PAGE_SIZE, NO_OF_PAGES_PER_ROW, nvm_write_buffer(), pageBufferToFill, and ROW_SIZE.
Referenced by flashFlushPage(), flashPacketToPage(), flashUpdateAppStartAddr(), hwFlashWriteEepromPage(), memcopy(), update_boot_info(), and writeapp_infotable().
void nvm_init | ( | void | ) |
References nvm_config::manual_page_write, nvm_get_config_defaults(), nvm_set_config(), and nvm_config::wait_states.
Referenced by FUOTA_NVM_Init(), lowLevelInit(), pal_init(), and pdsNvmInit().
uint32_t appStartAddr |
Referenced by clear_updateaction(), flashPacketToPage(), and flashUpdateAppStartAddr().