Обновление после командировки 30.06.2026
This commit is contained in:
parent
796427dcf7
commit
bd4283c398
|
|
@ -3,11 +3,18 @@
|
|||
//
|
||||
#include "InternalFlashPage.h"
|
||||
#include "StorageOnFlashFlagchip.h"
|
||||
#include "crc32_m7.h"
|
||||
|
||||
#define LOGGER env->logger
|
||||
#define LOG_SIGN "Storage"
|
||||
|
||||
static uint32_t xStorageOnFlashArtery_Crc(uint8_t *data, size_t len) {
|
||||
|
||||
uint32_t crc = UdsCrc32Update_Hardware(0xFFFFFFFF, data, len, NULL, NULL, 0);
|
||||
|
||||
return crc;
|
||||
|
||||
/*
|
||||
uint32_t crc = 0;
|
||||
|
||||
uint8_t *end = data + len;
|
||||
|
|
@ -17,9 +24,14 @@ static uint32_t xStorageOnFlashArtery_Crc(uint8_t *data, size_t len) {
|
|||
}
|
||||
|
||||
return crc;
|
||||
*/
|
||||
}
|
||||
|
||||
static uint32_t xStorageOnFlashArtery_CrcFlash(tStorageOnFlashFlagchip *env, uint8_t *addressOnFlash, size_t len) {
|
||||
uint32_t crc = UdsCrc32Update_Hardware(0xFFFFFFFF, addressOnFlash, len, NULL, NULL, 0);
|
||||
|
||||
return crc;
|
||||
/*
|
||||
uint32_t crc = 0;
|
||||
|
||||
size_t left = len;
|
||||
|
|
@ -42,6 +54,7 @@ static uint32_t xStorageOnFlashArtery_CrcFlash(tStorageOnFlashFlagchip *env, uin
|
|||
}
|
||||
|
||||
return crc;
|
||||
*/
|
||||
}
|
||||
|
||||
static eStorageStatus
|
||||
|
|
@ -61,9 +74,9 @@ xStorageOnFlashFlagchip_DumpOn(
|
|||
|
||||
size_t dataSizeOnFlash;
|
||||
if (env->TypeStorageOnFlashFlagchip == STORAGE_TYPE_D_DATA) {
|
||||
dataSizeOnFlash = D_bInternalFlashPage_DumpFromRam(pageAddress, data, size);
|
||||
dataSizeOnFlash = D_bInternalFlashPage_DumpFromRam(pageAddress, data, size);
|
||||
} else {
|
||||
dataSizeOnFlash = P_bInternalFlashPage_DumpFromRam(pageAddress, data, size);
|
||||
dataSizeOnFlash = P_bInternalFlashPage_DumpFromRam(pageAddress, data, size);
|
||||
}
|
||||
|
||||
if (dataSizeOnFlash < size) {
|
||||
|
|
@ -87,9 +100,9 @@ xStorageOnFlashFlagchip_DumpOn(
|
|||
|
||||
uint32_t flashReedCrc;
|
||||
if (env->TypeStorageOnFlashFlagchip == STORAGE_TYPE_D_DATA) {
|
||||
flashReedCrc = D_iInternalFlashPage_ReadWord(pageAddress + dataSizeOnFlash);
|
||||
flashReedCrc = D_iInternalFlashPage_ReadWord(pageAddress + dataSizeOnFlash);
|
||||
} else {
|
||||
flashReedCrc = P_iInternalFlashPage_ReadWord(pageAddress + dataSizeOnFlash);
|
||||
flashReedCrc = P_iInternalFlashPage_ReadWord(pageAddress + dataSizeOnFlash);
|
||||
}
|
||||
|
||||
if ((flashCalcCrc == flashReedCrc) && (flashCalcCrc == dataCrc)) {
|
||||
|
|
@ -124,13 +137,14 @@ eStorageStatus xStorageOnFlashFlagchip_Load(tStorageOnFlashFlagchip *env, void *
|
|||
|
||||
size_t offset_crc = size - 8;
|
||||
|
||||
uint32_t recoveryCrcCalc = xStorageOnFlashArtery_CrcFlash(env, (uint8_t *) env->recoveryFlashPageAddress, offset_crc);
|
||||
uint32_t recoveryCrcCalc = xStorageOnFlashArtery_CrcFlash(env, (uint8_t *) env->recoveryFlashPageAddress,
|
||||
offset_crc);
|
||||
|
||||
uint32_t recoveryCrcReed;
|
||||
if (env->TypeStorageOnFlashFlagchip == STORAGE_TYPE_D_DATA) {
|
||||
recoveryCrcReed = D_iInternalFlashPage_ReadWord(env->recoveryFlashPageAddress + offset_crc);
|
||||
recoveryCrcReed = D_iInternalFlashPage_ReadWord(env->recoveryFlashPageAddress + offset_crc);
|
||||
} else {
|
||||
recoveryCrcReed = P_iInternalFlashPage_ReadWord(env->recoveryFlashPageAddress + offset_crc);
|
||||
recoveryCrcReed = P_iInternalFlashPage_ReadWord(env->recoveryFlashPageAddress + offset_crc);
|
||||
}
|
||||
|
||||
LoggerFormatInfo(LOGGER, LOG_SIGN, "Crc recovery page (calc): 0x%08X", recoveryCrcCalc)
|
||||
|
|
@ -140,9 +154,9 @@ eStorageStatus xStorageOnFlashFlagchip_Load(tStorageOnFlashFlagchip *env, void *
|
|||
|
||||
uint32_t mainCrcReed;
|
||||
if (env->TypeStorageOnFlashFlagchip == STORAGE_TYPE_D_DATA) {
|
||||
mainCrcReed = D_iInternalFlashPage_ReadWord(env->mainFlashPageAddress + offset_crc);
|
||||
mainCrcReed = D_iInternalFlashPage_ReadWord(env->mainFlashPageAddress + offset_crc);
|
||||
} else {
|
||||
mainCrcReed = P_iInternalFlashPage_ReadWord(env->mainFlashPageAddress + offset_crc);
|
||||
mainCrcReed = P_iInternalFlashPage_ReadWord(env->mainFlashPageAddress + offset_crc);
|
||||
}
|
||||
|
||||
LoggerFormatInfo(LOGGER, LOG_SIGN, "Crc main page (calc): 0x%08X", mainCrcCalc)
|
||||
|
|
|
|||
Loading…
Reference in New Issue