Обновление

This commit is contained in:
cfif 2026-04-14 16:20:17 +03:00
parent fb2a822060
commit 829e5627cd
2 changed files with 23 additions and 2 deletions

View File

@ -959,7 +959,14 @@ static uint16_t vUDS_routine_Erase_Memory(tCanUds *env, eUdsRoutineControlType u
eUdsRequestRoutineResult udsRequestRoutineResult = UDS_routine_RoutineFinishSuccess;
if ((udsRoutineControlType == UDS_routine_StartRoutine) || (udsRoutineControlType == UDS_routine_StopRoutine)) {
env->dataResponse[4] = udsStartStopRoutineResult;
bool result = env->clear_flash_func(0x01010000, 512 * 1024);
if (result) {
env->dataResponse[4] = UDS_routine_RoutineStartStopSuccess;
} else {
env->dataResponse[4] = UDS_routine_RoutineStartStopFailure;
}
}
if (udsRoutineControlType == UDS_routine_RequestRoutineResults) {
@ -1546,6 +1553,8 @@ void CanUds_Init(
tDeviceStorage *deviceStorage,
tCanSpamTransmitter *canSpamTransmitter,
tAdcTask *adcTask0,
uds_clear_flash_func *clear_flash_func,
uds_write_flash_func *write_flash_func,
tLoggerInterface *logger) {
env->logger = logger;
@ -1555,6 +1564,8 @@ void CanUds_Init(
env->adcTask0 = adcTask0;
env->filterIdCount = 2;
env->canSpamTransmitter = canSpamTransmitter;
env->clear_flash_func = clear_flash_func;
env->write_flash_func = write_flash_func;
env->queue = osMessageQueueNew(CAN_US_QUEUE_SIZE, sizeof(tCanTP_data), NULL);
setDefaultStatus();

View File

@ -134,6 +134,10 @@ typedef struct {
uint8_t *data;
} tUdsServiceCommand;
typedef bool (uds_clear_flash_func)(uint32_t firstPageAddr, uint32_t totalSize);
typedef bool (uds_write_flash_func)(uint32_t beginPageAddr, void *sourceRamAddr, uint32_t size);
typedef struct {
tCanSerialPortFrameTp canSerialPortFrameTp;
tLoggerInterface *logger;
@ -170,6 +174,9 @@ typedef struct {
uint32_t time_counter_max_attempts_default;
} SA;
uds_clear_flash_func *clear_flash_func;
uds_write_flash_func *write_flash_func;
tStaticThreadBlock(384) T_can_Uds;
} tCanUds;
@ -180,6 +187,7 @@ typedef struct {
char *desc;
} eUds_com;
void CanUds_Init(
tCanUds *env,
tDiagnostic *Diagnostic,
@ -187,6 +195,8 @@ void CanUds_Init(
tDeviceStorage *deviceStorage,
tCanSpamTransmitter *canSpamTransmitter,
tAdcTask *adcTask0,
uds_clear_flash_func *clear_flash_func,
uds_write_flash_func *write_flash_func,
tLoggerInterface *logger);
void CanSerialPortCanUds_Start(tCanUds *env);