EEPROM_Emulation
Functions | |
void | BusFault_Handler (void) |
This function handles Bus Fault exception. | |
void | DebugMon_Handler (void) |
This function handles Debug Monitor exception. | |
static uint16_t | EE_FindValidPage (uint8_t Operation) |
Find valid Page for write or read operation. | |
static FLASH_Status | EE_Format (void) |
Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0. | |
uint16_t | EE_Init (void) |
Restore the pages to a known good state in case of page's status corruption after a power loss. | |
static uint16_t | EE_PageTransfer (uint16_t VirtAddress, uint16_t Data) |
Transfers last updated variables data from the full Page to an empty one. | |
uint16_t | EE_ReadVariable (uint16_t VirtAddress, uint16_t *Data) |
Returns the last stored variable data, if found, which correspond to the passed virtual address. | |
static uint16_t | EE_VerifyPageFullWriteVariable (uint16_t VirtAddress, uint16_t Data) |
Verify if active page is full and Writes variable in EEPROM. | |
uint16_t | EE_WriteVariable (uint16_t VirtAddress, uint16_t Data) |
Writes/upadtes variable data in EEPROM. | |
void | HardFault_Handler (void) |
This function handles Hard Fault exception. | |
int | main (void) |
Main program. | |
void | MemManage_Handler (void) |
This function handles Memory Manage exception. | |
void | NMI_Handler (void) |
This function handles NMI exception. | |
void | PendSV_Handler (void) |
This function handles PendSVC exception. | |
void | SVC_Handler (void) |
This function handles SVCall exception. | |
void | SysTick_Handler (void) |
This function handles SysTick Handler. | |
void | UsageFault_Handler (void) |
This function handles Usage Fault exception. | |
Variables | |
uint16_t | DataVar = 0 |
FLASH_Status | FlashStatus |
ErrorStatus | HSEStartUpStatus |
uint16_t | VarValue = 0 |
uint16_t | VirtAddVarTab [NumbOfVar] = {0x5555, 0x6666, 0x7777} |
uint16_t | VirtAddVarTab [NumbOfVar] |
Function Documentation
void BusFault_Handler | ( | void | ) |
void DebugMon_Handler | ( | void | ) |
static uint16_t EE_FindValidPage | ( | uint8_t | Operation | ) | [static] |
Find valid Page for write or read operation.
Definition at line 388 of file eeprom.c.
References NO_VALID_PAGE, PAGE0, PAGE0_BASE_ADDRESS, PAGE1, PAGE1_BASE_ADDRESS, READ_FROM_VALID_PAGE, RECEIVE_DATA, VALID_PAGE, and WRITE_IN_VALID_PAGE.
Referenced by EE_PageTransfer(), EE_ReadVariable(), and EE_VerifyPageFullWriteVariable().
static FLASH_Status EE_Format | ( | void | ) | [static] |
Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0.
Definition at line 350 of file eeprom.c.
References FlashStatus, PAGE0_BASE_ADDRESS, PAGE1_BASE_ADDRESS, and VALID_PAGE.
Referenced by EE_Init().
uint16_t EE_Init | ( | void | ) |
Restore the pages to a known good state in case of page's status corruption after a power loss.
Definition at line 52 of file eeprom.c.
References DataVar, EE_Format(), EE_ReadVariable(), EE_VerifyPageFullWriteVariable(), ERASED, FlashStatus, NumbOfVar, PAGE0_BASE_ADDRESS, PAGE1_BASE_ADDRESS, RECEIVE_DATA, VALID_PAGE, and VirtAddVarTab.
Referenced by main().
static uint16_t EE_PageTransfer | ( | uint16_t | VirtAddress, | |
uint16_t | Data | |||
) | [static] |
Transfers last updated variables data from the full Page to an empty one.
Definition at line 521 of file eeprom.c.
References DataVar, EE_FindValidPage(), EE_ReadVariable(), EE_VerifyPageFullWriteVariable(), FlashStatus, NO_VALID_PAGE, NumbOfVar, PAGE0, PAGE0_BASE_ADDRESS, PAGE1, PAGE1_BASE_ADDRESS, READ_FROM_VALID_PAGE, RECEIVE_DATA, VALID_PAGE, and VirtAddVarTab.
Referenced by EE_WriteVariable().
uint16_t EE_ReadVariable | ( | uint16_t | VirtAddress, | |
uint16_t * | Data | |||
) |
Returns the last stored variable data, if found, which correspond to the passed virtual address.
Definition at line 267 of file eeprom.c.
References EE_FindValidPage(), EEPROM_START_ADDRESS, NO_VALID_PAGE, PAGE0, and READ_FROM_VALID_PAGE.
Referenced by EE_Init(), and EE_PageTransfer().
static uint16_t EE_VerifyPageFullWriteVariable | ( | uint16_t | VirtAddress, | |
uint16_t | Data | |||
) | [static] |
Verify if active page is full and Writes variable in EEPROM.
Definition at line 460 of file eeprom.c.
References EE_FindValidPage(), EEPROM_START_ADDRESS, FlashStatus, NO_VALID_PAGE, PAGE0, PAGE_FULL, and WRITE_IN_VALID_PAGE.
Referenced by EE_Init(), EE_PageTransfer(), and EE_WriteVariable().
uint16_t EE_WriteVariable | ( | uint16_t | VirtAddress, | |
uint16_t | Data | |||
) |
Writes/upadtes variable data in EEPROM.
Definition at line 326 of file eeprom.c.
References EE_PageTransfer(), EE_VerifyPageFullWriteVariable(), and PAGE_FULL.
Referenced by main().
void HardFault_Handler | ( | void | ) |
int main | ( | void | ) |
Main program.
Definition at line 47 of file main.c.
References EE_Init(), EE_WriteVariable(), VarValue, and VirtAddVarTab.
void MemManage_Handler | ( | void | ) |
void NMI_Handler | ( | void | ) |
void PendSV_Handler | ( | void | ) |
void SVC_Handler | ( | void | ) |
void SysTick_Handler | ( | void | ) |
void UsageFault_Handler | ( | void | ) |
Variable Documentation
uint16_t DataVar = 0 |
FLASH_Status FlashStatus |
Definition at line 33 of file main.c.
Referenced by EE_Format(), EE_Init(), EE_PageTransfer(), and EE_VerifyPageFullWriteVariable().
ErrorStatus HSEStartUpStatus |
uint16_t VirtAddVarTab[NumbOfVar] = {0x5555, 0x6666, 0x7777} |
uint16_t VirtAddVarTab[NumbOfVar] |
|