HVAC_M7_CAN_UDS/CanUds.h

70 lines
1.5 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
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_SecurityAccess = 0x27
} eUdsServices;
typedef enum {
UDS_error_incorrectMessageLengthOrInvalidFormat = 0x13,
UDS_error_responseTooLong= 0x14,
UDS_error_requestOutOfRange= 0x31,
UDS_error_securityAccessDenied= 0x33
} eUdsResponseError;
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