126 lines
3.8 KiB
C
126 lines
3.8 KiB
C
|
/*!
|
|||
|
* @file uds_services.h
|
|||
|
* @brief uds services handler.
|
|||
|
*
|
|||
|
*/
|
|||
|
|
|||
|
#ifndef UDS_SERVICES_H_
|
|||
|
#define UDS_SERVICES_H_
|
|||
|
|
|||
|
#include "uds_types.h"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define UDS_UP_FLG 0
|
|||
|
|
|||
|
#define CHECK_SIGN_MAX 1024
|
|||
|
|
|||
|
|
|||
|
#define UDS_P2Sever 50 //50ms
|
|||
|
#define UDS_P2SeverMax 500 //5s
|
|||
|
#define UDS_S3Sever 5000 //5s
|
|||
|
|
|||
|
#define UDS_ID0 0
|
|||
|
#define UDS_ID1 1
|
|||
|
|
|||
|
#define UDS_27SERVICE_ERR_NUM_MAX 2
|
|||
|
|
|||
|
/*!
|
|||
|
* Enum Type. Session Control Type.
|
|||
|
*/
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
UDS_SERVICE_10_DEFAULTSESSION = 1, /*!< Default Session */
|
|||
|
UDS_SERVICE_10_ECUPROGRAMMINGSESSION, /*!< Programming Session */
|
|||
|
UDS_SERVICE_10_ECUEXTENDEDSESSION, /*!< Extended Session */
|
|||
|
UDS_SERVICE_10_EOLSESSION /*!< Extended Session */
|
|||
|
}UDS_SERVICE_10_SESSION_CTRL_T;
|
|||
|
|
|||
|
/*!
|
|||
|
* Enum Type. Service 27 Type: Request Seed or send key
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
UDS_SERVICE_27_REQUEST_SEED = 0x05, /*!< Request Seed */
|
|||
|
UDS_SERVICE_27_SEND_KEY=0x06, /*!< Send Key */
|
|||
|
UDS_SERVICE_27_REQUEST_FBL_SEED = 0x03,
|
|||
|
UDS_SERVICE_27_SEND_FBL_KEY = 0x04
|
|||
|
}UDS_SERVICE_27_T;
|
|||
|
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SECURITY_LEVEL_NULL = 0,
|
|||
|
SECURITY_LEVEL_1 = 1,
|
|||
|
SECURITY_LEVEL_FBL = 2,
|
|||
|
}UDS_SERVICE_27_LEVEL;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
IO_CTRL_returnControlToECU = 0,
|
|||
|
IO_CTRL_resetToDefault = 1,
|
|||
|
IO_CTRL_freezeCurrentState = 2,
|
|||
|
IO_CTRL_shortTermAdjustment = 3,
|
|||
|
}UDS_SERVICE_2F_PARAM;
|
|||
|
|
|||
|
typedef enum {
|
|||
|
ERASE_MEMORY_STS_NONE,
|
|||
|
ERASE_MEMORY_STS_IN_PROGRESS,
|
|||
|
ERASE_MEMORY_STS_COMPLETED,
|
|||
|
ERASE_MEMORY_STS_FAILURE,
|
|||
|
}UDS_EraseMemoryStsTypeDef;
|
|||
|
|
|||
|
//<2F><><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD>
|
|||
|
#define DIAG_SERVE_SESSION_CONTROL 0x10 //<2F>Ự
|
|||
|
#define DIAG_SERVE_ECU_RESET 0x11 //ECU<43><55>λ
|
|||
|
#define DIAG_SERVE_CLEAR_DTC 0x14 //<2F><><EFBFBD><EFBFBD>DTC
|
|||
|
#define DIAG_SERVE_READ_DTC 0x19 //<2F><>ȡDTC
|
|||
|
#define DIAG_SERVE_READ_DATA 0x22 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_READ_MEMORY 0x23 //<2F><><EFBFBD>ڴ<EFBFBD>
|
|||
|
#define DIAG_SERVE_SECURITY_ACCESS 0x27 //<2F><>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_COMMUNICATION_CONTROL 0x28 //ͨ<>ſ<EFBFBD><C5BF><EFBFBD>
|
|||
|
#define DIAG_SERVE_WRITE_DATA 0x2E //д<><D0B4><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_IOPUT_CONTROL 0x2F //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_ROUTINE_CONTROL 0x31 //<2F><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>
|
|||
|
#define DIAG_SERVE_REQUEST_DOWNLOAD 0x34 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_TRANSFER_DATA 0x36 //<2F><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
|
|||
|
#define DIAG_SERVE_REQUEST_TRANSFER_EXIT 0x37 //<2F><><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_WRITE_MEMORY 0x3D //д<><D0B4><EFBFBD>ڴ<EFBFBD>
|
|||
|
#define DIAG_SERVE_TESTER_PRESENT 0x3E //<2F><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_NRC 0x7F //<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
#define DIAG_SERVE_CONTROL_DTC 0x85 //<2F><><EFBFBD><EFBFBD>DTC
|
|||
|
|
|||
|
|
|||
|
void UDS_Service_Init(void);
|
|||
|
void UDS_Service_34_Ack(uint8_t *pDst,uint16_t pLen);
|
|||
|
void UDS_Service_Transmit_Confirmed(void);
|
|||
|
void UDS_Service_Response_Handler(uint16_t TPReceivexMessageLength, uint8_t N_Result, uint8_t* Rec_Bufer);
|
|||
|
void UDS_Service_37(uint8_t *pdata,uint16_t length);
|
|||
|
void UDS_Service_36(uint8_t* dataBuf, uint16_t BufLen);
|
|||
|
void UDS_Service_34(uint8_t dataformat, uint8_t addrLenFormat, uint8_t* memBuf, uint8_t* sizeBuf);
|
|||
|
void UDS_Service_31(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_27(UDS_SERVICE_27_T in_service, uint8_t *requ, uint8_t* keyBuf);
|
|||
|
void UDS_Service_10_Response(uint8_t in_session);
|
|||
|
void UDS_Service_29(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
|
|||
|
void UDS_Service_0x19_Response(void);
|
|||
|
void UDS_Service_0x22_Response(void);
|
|||
|
void UDS_Service_0x2E_Response(INT8U *pIn,INT16U pLen);
|
|||
|
void UDS_Service_0x3E_Response(INT8U *pIn);
|
|||
|
void UDS_Service_28(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_20(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_85(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_14(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_11(uint8_t* routine_buf);
|
|||
|
void UDS_Service_NonSupport_Response(INT8U pIn);
|
|||
|
void UDS_Service_31(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_36_Ack(uint8_t* routine_buf, uint8_t bufLen);
|
|||
|
void UDS_Service_0x2F_Response(void);
|
|||
|
void UDS_Nrc78PostProcessing(void);
|
|||
|
|
|||
|
|
|||
|
#endif /* UDS_SERVICES_H_ */
|