32 if ((data[0] == 0xFF && data[1] == 0xFF) || (data[0] == 0x00 && data[1] == 0x00))
56 UNS8 data[MAX_BYTES_PER_SUBINDEX];
63 for (i = 0; i <
sizeof(RestoreList); i++)
66 if (RestoreList[i] < 0x1018)
73 abortCode = readLocalDict( &ObjDict_Data, RestoreList[i], 0, &nSubIndices, &size, &type, 0);
80 for (
int k = 1; k <= nSubIndices; k++)
84 abortCode = readLocalDict( &ObjDict_Data, RestoreList[i], k, data, &size, &type, 0);
98 data[0] = (
UNS8) counter;
99 data[1] = (
UNS8)(counter >> 8);
123 UNS8 data[MAX_BYTES_PER_SUBINDEX];
124 UNS32 abortCode = 0;;
127 for (
int i = 0; i <
sizeof(RestoreList); i++)
130 if (RestoreList[i] < 0x1018)
137 abortCode = readLocalDict( &ObjDict_Data, RestoreList[i], 0, &nSubIndices, &size, &type, 0);
144 for (
int k = 1; k <= nSubIndices; k++)
148 abortCode = readLocalDict( &ObjDict_Data, RestoreList[i], k, data, &size, &type, 0);
159 abortCode = writeLocalDict( &ObjDict_Data, RestoreList[i], k, data, &size, 0);
207 if (nvAddress > 0x5000 && nvAddress < (0x3FFFF))
209 memcpy( data, (
UNS8 *)nvAddress , numData );
211 else if ( nvAddress <= 0x5000 )
213 memcpy( data, (
UNS8 *)nvAddress , numData );
267 FLASH_EraseInitTypeDef eraseInitStruct;
268 uint32_t PageError = 0;
277 eraseInitStruct.TypeErase = TYPEERASE_PAGES;
281 if (HAL_FLASHEx_Erase(&eraseInitStruct, &PageError) != HAL_OK) {
283 memset(page, 0,
sizeof(page));
292 if (HAL_FLASH_Program(TYPEPROGRAM_DOUBLEWORD,
EEPROM_START_ADDRESS + i, *(uint64_t *)(page + i)) != HAL_OK)
332 memcpy((page + address), data, length);
This file is generated by the NNP Tool – Object Dictionary Editor, as originally developed by CAN Fes...
#define UNS8
Unsigned int8 representation in CANFest.
#define UNS16
Unsigned int16 representation in CANFest.
#define UNS32
Unsigned int32 representation in CANFest.
#define MAX_EEPROM_MEMORY
(6KB)
#define EEPROM_ERASE_SIZE
must be divisible into 6144 (6KB) by factor of 2, defines size of chunks erased from EEPROM
#define EEPROM_START_ADDRESS
Loation of the start of the EEPROM in flash.
#define EEPROM_PAGE_SIZE
XXX: must match the page size in bootloader config.h.
UNS8 CheckRestoreFlag(void)
checks whether or not RestoreValues() should be run.
void EEPROM_write(UNS16 address, UNS8 *data, UNS16 length)
Writes bytes to a specified location in EEPROM.
void RestoreValues(void)
Restores the values of custom OD entries (specified in RestoreList OD index 0x2900) to the OD from EE...
void EEPROM_read(UNS16 address, UNS8 *data, UNS16 length)
Reads bytes from a specified location in EEPROM.
void ResetToODDefault(void)
invoked by nmt_master – writes 0's to size causing bypass of OD restore, then causes reset
void ResetModule(void)
resets module, called by ResetToODDefault()
UNS8 EEPROM_commit()
Commits edits to EEPROM from ram to flash.
void SaveValues(void)
Saves the values of custom OD entries (specified in RestoreList OD index 0x2900) to EEPROM from the O...
void EEPROM_erase(UNS8 space)
writes 0xFF to entire EEPROM (6KB).
UNS8 ReadLocalFlashData(UNS32 nvAddress, UNS8 *data, UNS8 numData)
reads CPU based flash data
UNS8 EEPROM_discard()
Discards current edits to EEPROM without committing to flash.
UNS8 EEPROM_open()
Copies the EEPROM into ram for modification by EEPROM_write()