97 lines
2.4 KiB
C
97 lines
2.4 KiB
C
//
|
|
// Created by cfif on 20.01.2026.
|
|
//
|
|
|
|
#ifndef HVAC_M7_CANUDS_H
|
|
#define HVAC_M7_CANUDS_H
|
|
|
|
#include "CanSerialPortFrameTP.h"
|
|
#include "DeviceStorage.h"
|
|
|
|
#define CAN_US_QUEUE_SIZE 3
|
|
|
|
// Время (логарифмическая шкала)
|
|
// │
|
|
// ├── StMin (0.1-127 мс) ← Между КАДРАМИ
|
|
// │ │
|
|
// ├── N_As, N_Bs (до 1000 мс) ← Транспортные таймауты
|
|
// │ │
|
|
// ├── P2Server (до 50 мс) ← Между СООБЩЕНИЯМИ (UDS)
|
|
// │ │
|
|
// ├── P2*Server (до 5000 мс) ← Ожидание при ResponsePending
|
|
// │ │
|
|
// └── S3_Server (до 5000 мс) ← ТАЙМЕР ВСЕЙ СЕССИИ
|
|
|
|
typedef enum {
|
|
UDS_DiagnosticSessionControl = 0x10,
|
|
UDS_ReadDTCInformation = 0x19,
|
|
UDS_ClearDiagnosticInformation = 0x14,
|
|
UDS_TesterPresent = 0x3E,
|
|
UDS_ReadDataByIdentifier = 0x22,
|
|
UDS_WriteDataByIdentifier = 0x2E,
|
|
UDS_RoutineControl = 0x31,
|
|
UDS_ECUResetService = 0x11,
|
|
UDS_InputOutputControlByIdentifier = 0x2F,
|
|
UDS_SecurityAccess = 0x27
|
|
} eUdsServices;
|
|
|
|
typedef enum {
|
|
UDS_error_incorrectMessageLengthOrInvalidFormat = 0x13,
|
|
UDS_error_responseTooLong= 0x14,
|
|
UDS_error_requestOutOfRange= 0x31,
|
|
UDS_error_securityAccessDenied= 0x33,
|
|
UDS_error_sub_functionNotSupported = 0x12
|
|
} eUdsResponseError;
|
|
|
|
|
|
typedef enum {
|
|
UDS_session_defaultSession = 0x1,
|
|
UDS_session_programmingSession= 0x2,
|
|
UDS_session_extendedDiagnosticSession= 0x3
|
|
} eUdsSession;
|
|
|
|
typedef enum {
|
|
UDS_io_returnControlToECU = 0x0,
|
|
UDS_io_resetToDefault= 0x1,
|
|
UDS_io_shortTermAdjustment= 0x3
|
|
} eUdsIO;
|
|
|
|
|
|
typedef struct {
|
|
tCanSerialPortFrameTp canSerialPortFrameTp;
|
|
tLoggerInterface *logger;
|
|
tSerialPortFrameIO *CanIO;
|
|
tDeviceStorage *deviceStorage;
|
|
|
|
tCanTP_Ext_data canTP_Ext_data;
|
|
|
|
osMessageQueueId_t queue;
|
|
|
|
tCanTP_data data;
|
|
uint8_t dataResponse[256];
|
|
|
|
uint8_t filterIdCount;
|
|
uint32_t filterReqId[16];
|
|
uint32_t filterRespId[16];
|
|
uint8_t filterDirReq[16];
|
|
|
|
tStaticThreadBlock(512) T_can_Uds;
|
|
} tCanUds;
|
|
|
|
typedef uint8_t (*uds_func_ptr)(tCanUds *env);
|
|
|
|
typedef struct {
|
|
uds_func_ptr func;
|
|
char *desc;
|
|
} eUds_com;
|
|
|
|
void CanUds_Init(
|
|
tCanUds *env,
|
|
tSerialPortFrameIO *CanIO,
|
|
tDeviceStorage *deviceStorage,
|
|
tLoggerInterface *logger);
|
|
|
|
void CanSerialPortCanUds_Start(tCanUds *env);
|
|
|
|
#endif //HVAC_M7_CANUDS_H
|