![]() |
ParaLib 2.0.15-master SHA: 2e03d68caa
|
Flash parameter storage for Microchip / Atmel ATSAM70E Series. More...
#include <stdbool.h>#include <stdint.h>#include <string.h>#include <stdio.h>#include "flash_efc.h"#include "project_config.h"#include "lib/Para/PARA_Lib.h"#include "lib/Para/PARA_ID_System.h"#include "lib/Error/LogMessage.h"#include "lib/Error/Error_ID_System.h"#include "lib/Error/Error.h"Data Structures | |
| struct | t_ParaFlashDataset |
| Datastructure of one flash block. More... | |
| struct | tFlashInformation |
| Information stored in flash about the contents of the flash page. More... | |
Macros | |
| #define | NV_CMD_Successful 0 |
| #define | NV_CMD_SaveNV 1 |
| #define | NV_CMD_Bussy 2 |
| #define | NV_CMD_Failed 3 |
| #define | NV_CMD_ResetToDefault1 0x55AA |
| #define | NV_CMD_ResetToDefault2 0xAA55 |
| #define | NV_CMD_SaveFactoryNV 12345 |
| #define | NV_CMD_SaveUserregister 7319 |
| #define | PARAMETER_FLASH_MAX_SIZE ( 0x20000 ) |
| #define | PARA_FLASH_SIZE_DATA ( 24 ) |
| #define | PARA_FLASH_SIZE_BLOCK ( 32 ) |
| #define | PARAMETER_FLASH_VERSION ( 1 ) |
| #define | MAXIMUM_PARAMETER_DATAPOINTER ((PARAMETER_FLASH_MAX_SIZE - PARA_FLASH_SIZE_BLOCK) /PARA_FLASH_SIZE_BLOCK) |
Functions | |
| bool | RestoreParameterDefaults (uint16_t location, ParameterAccessSource Access, uint8_t AccessLevel) |
| Restores all Parameters with the given storage location to their default value. More... | |
| bool | IsInSaveState (void) |
| If save to flash is allowed return true. More... | |
| static bool | VerifyBackupArea (void *FlashData, tFlashInformation *FlashDataLocation) |
| The Backup-Area in flash is verified. More... | |
| void | PARA_FlashReadFromBackup (uint16_t location, ParameterAccessSource Access, uint8_t AccessLevel) |
| Reads backup-values from flash and stores them into parameter values. More... | |
| bool | PARA_FlashWriteToBackup (uint16_t location) |
| Writes backup-values into flash All parameters with storage-location selected in parameter location are processed, all others are ignored. More... | |
| void | PARA_FlashInit (void) |
| Initialization of parameter flash interface needs to be called before: More... | |
| static int32_t | WriteFunction_PARA_FlashCmd (Parameter *this, uint16_t SubID, void *data, int32_t MaxCount, uint32_t offset, ParameterAccessSource Access, unsigned char AccessLevel) |
Variables | |
| uint32_t | g_ui32NvCmd |
| Actual running Non-Volatile Memory command. More... | |
| static bool | g_bFlashParasetValid |
| Flag if the parameterset is read succerssful out of Flash. More... | |
| tFlashInformation | FlashData1 |
| Information about actual used Flash page. More... | |
Flash parameter storage for Microchip / Atmel ATSAM70E Series.
© Copyright 2017-2022 Copyright: Retostronik GmbH Stütingstraße 30 58285 Gevelsberg
| #define MAXIMUM_PARAMETER_DATAPOINTER ((PARAMETER_FLASH_MAX_SIZE - PARA_FLASH_SIZE_BLOCK) /PARA_FLASH_SIZE_BLOCK) |
| #define NV_CMD_Bussy 2 |
| #define NV_CMD_Failed 3 |
| #define NV_CMD_ResetToDefault1 0x55AA |
| #define NV_CMD_ResetToDefault2 0xAA55 |
| #define NV_CMD_SaveFactoryNV 12345 |
| #define NV_CMD_SaveNV 1 |
| #define NV_CMD_SaveUserregister 7319 |
| #define NV_CMD_Successful 0 |
| #define PARA_FLASH_SIZE_BLOCK ( 32 ) |
| #define PARA_FLASH_SIZE_DATA ( 24 ) |
| #define PARAMETER_FLASH_MAX_SIZE ( 0x20000 ) |
| #define PARAMETER_FLASH_VERSION ( 1 ) |
| bool IsInSaveState | ( | void | ) |
If save to flash is allowed return true.
Function must be defined in main project. Flash storage takes a long time, while no other function is allowed to call. Diue to this, the device must not run any time critical function.
| void PARA_FlashInit | ( | void | ) |
Initialization of parameter flash interface needs to be called before:
| void PARA_FlashReadFromBackup | ( | uint16_t | location, |
| ParameterAccessSource | Access, | ||
| uint8_t | AccessLevel | ||
| ) |
Reads backup-values from flash and stores them into parameter values.
All parameters with storage-location selected in parameter location are processed, all others are ignored. The parameter values are written with the OnWrite-function defined in the parameter itself. In case of an error, the default value is set.
| location | selects the storage location |
| Access | Source of access (see Access restrictions). |
| AccessLevel | Actual AccessLevel (see Access restrictions). |
| bool PARA_FlashWriteToBackup | ( | uint16_t | location | ) |
Writes backup-values into flash All parameters with storage-location selected in parameter location are processed, all others are ignored.
| location | selects the storage location |
| True | if successfull. |
| bool RestoreParameterDefaults | ( | uint16_t | location, |
| ParameterAccessSource | Access, | ||
| uint8_t | AccessLevel | ||
| ) |
Restores all Parameters with the given storage location to their default value.
All parameters with storage-location selected in parameter location are processed, all others are ignored. The parameter values are written with the OnWrite-function defined in the parameter itself. In case of an error, the default value is set.
| location | selects the storage location |
| Access | Source of access (see Access restrictions). |
| AccessLevel | Actual AccessLevel (see Access restrictions). |
|
static |
The Backup-Area in flash is verified.
A 32-Bit CRC is calculated and compared to the stored value in zhe stored flashInformation. If CRC is matching, true is returned.
| FlashData | Actual Address of Flash |
| FlashDataLocation | Pointer to the flash-information stored in flash. |
| True | if successfull. |
|
static |
| tFlashInformation FlashData1 |
Information about actual used Flash page.
|
static |
Flag if the parameterset is read succerssful out of Flash.
| uint32_t g_ui32NvCmd |
Actual running Non-Volatile Memory command.
The command is set by parameterinterface to trigger storage to NVRam. The store-procedure sets the result.