Обновление

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; eUdsRequestRoutineResult udsRequestRoutineResult = UDS_routine_RoutineFinishSuccess;
if ((udsRoutineControlType == UDS_routine_StartRoutine) || (udsRoutineControlType == UDS_routine_StopRoutine)) { 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) { if (udsRoutineControlType == UDS_routine_RequestRoutineResults) {
@ -1546,6 +1553,8 @@ void CanUds_Init(
tDeviceStorage *deviceStorage, tDeviceStorage *deviceStorage,
tCanSpamTransmitter *canSpamTransmitter, tCanSpamTransmitter *canSpamTransmitter,
tAdcTask *adcTask0, tAdcTask *adcTask0,
uds_clear_flash_func *clear_flash_func,
uds_write_flash_func *write_flash_func,
tLoggerInterface *logger) { tLoggerInterface *logger) {
env->logger = logger; env->logger = logger;
@ -1555,6 +1564,8 @@ void CanUds_Init(
env->adcTask0 = adcTask0; env->adcTask0 = adcTask0;
env->filterIdCount = 2; env->filterIdCount = 2;
env->canSpamTransmitter = canSpamTransmitter; 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); env->queue = osMessageQueueNew(CAN_US_QUEUE_SIZE, sizeof(tCanTP_data), NULL);
setDefaultStatus(); setDefaultStatus();

View File

@ -55,7 +55,7 @@ typedef enum {
UDS_error_responseTooLong = 0x14, UDS_error_responseTooLong = 0x14,
UDS_error_requestOutOfRange = 0x31, UDS_error_requestOutOfRange = 0x31,
UDS_error_securityAccessDenied = 0x33, UDS_error_securityAccessDenied = 0x33,
UDS_error_invalidKey= 0x35, UDS_error_invalidKey = 0x35,
UDS_error_sub_functionNotSupported = 0x12, UDS_error_sub_functionNotSupported = 0x12,
UDS_error_conditionsNotCorrect = 0x22, UDS_error_conditionsNotCorrect = 0x22,
UDS_error_requestSequenceError = 0x24, UDS_error_requestSequenceError = 0x24,
@ -134,6 +134,10 @@ typedef struct {
uint8_t *data; uint8_t *data;
} tUdsServiceCommand; } 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 { typedef struct {
tCanSerialPortFrameTp canSerialPortFrameTp; tCanSerialPortFrameTp canSerialPortFrameTp;
tLoggerInterface *logger; tLoggerInterface *logger;
@ -170,6 +174,9 @@ typedef struct {
uint32_t time_counter_max_attempts_default; uint32_t time_counter_max_attempts_default;
} SA; } SA;
uds_clear_flash_func *clear_flash_func;
uds_write_flash_func *write_flash_func;
tStaticThreadBlock(384) T_can_Uds; tStaticThreadBlock(384) T_can_Uds;
} tCanUds; } tCanUds;
@ -180,6 +187,7 @@ typedef struct {
char *desc; char *desc;
} eUds_com; } eUds_com;
void CanUds_Init( void CanUds_Init(
tCanUds *env, tCanUds *env,
tDiagnostic *Diagnostic, tDiagnostic *Diagnostic,
@ -187,6 +195,8 @@ void CanUds_Init(
tDeviceStorage *deviceStorage, tDeviceStorage *deviceStorage,
tCanSpamTransmitter *canSpamTransmitter, tCanSpamTransmitter *canSpamTransmitter,
tAdcTask *adcTask0, tAdcTask *adcTask0,
uds_clear_flash_func *clear_flash_func,
uds_write_flash_func *write_flash_func,
tLoggerInterface *logger); tLoggerInterface *logger);
void CanSerialPortCanUds_Start(tCanUds *env); void CanSerialPortCanUds_Start(tCanUds *env);