Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
VC66_7C
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISUZU
VC66_7C
Commits
5bffea87
Commit
5bffea87
authored
Mar 25, 2022
by
hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加故障码收发协议
parent
e53f6b3e
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
3077 additions
and
10 deletions
+3077
-10
Application.gpj
ghs/group/Application.gpj
+11
-0
project.gpj
ghs/project.gpj
+1
-0
PowerManagement_user.c
...ce/Application/APP/PowerManagement/PowerManagement_user.c
+2
-1
CAN_FUNC.c
source/Application/CAN_APP_NM/CAN_App/CAN_FUNC.c
+1
-1
CAN_FUNC.h
source/Application/CAN_APP_NM/CAN_App/CAN_FUNC.h
+5
-0
RTE_CAN.c
source/Application/RTE/RTE_CAN.c
+9
-6
Link_Layer.c
source/Application/UDS_M/Link_Layer.c
+49
-0
Link_Layer.h
source/Application/UDS_M/Link_Layer.h
+17
-0
TP_Layer.c
source/Application/UDS_M/TP_Layer.c
+897
-0
TP_Layer.h
source/Application/UDS_M/TP_Layer.h
+59
-0
UDS_CFG.h
source/Application/UDS_M/UDS_CFG.h
+25
-0
UDS_def.h
source/Application/UDS_M/UDS_def.h
+105
-0
app_Service.c
source/Application/UDS_M/app_Service.c
+1459
-0
app_Service.h
source/Application/UDS_M/app_Service.h
+49
-0
app_ServiceProc.c
source/Application/UDS_M/app_ServiceProc.c
+168
-0
app_ServiceProc.h
source/Application/UDS_M/app_ServiceProc.h
+18
-0
uds_includes.h
source/Application/UDS_M/uds_includes.h
+198
-0
RSCAN_Table.c
source/Driver/CAN/RSCAN_Table.c
+1
-1
RSCAN_Table.h
source/Driver/CAN/RSCAN_Table.h
+1
-1
tasks.c
source/System/tasks.c
+2
-0
No files found.
ghs/group/Application.gpj
View file @
5bffea87
...
@@ -252,3 +252,14 @@
...
@@ -252,3 +252,14 @@
.\K_BUS\kwp2000_service.h
.\K_BUS\kwp2000_service.h
.\K_BUS\kwp2000_tp.c
.\K_BUS\kwp2000_tp.c
.\K_BUS\kwp2000_tp.h
.\K_BUS\kwp2000_tp.h
.\UDS_M\app_Service.c
.\UDS_M\app_Service.h
.\UDS_M\app_ServiceProc.c
.\UDS_M\app_ServiceProc.h
.\UDS_M\Link_Layer.c
.\UDS_M\Link_Layer.h
.\UDS_M\TP_Layer.c
.\UDS_M\TP_Layer.h
.\UDS_M\UDS_CFG.h
.\UDS_M\UDS_def.h
.\UDS_M\uds_includes.h
ghs/project.gpj
View file @
5bffea87
...
@@ -215,6 +215,7 @@ primaryTarget=v800_standalone.tgt
...
@@ -215,6 +215,7 @@ primaryTarget=v800_standalone.tgt
-I..\source\Application\UDS\
-I..\source\Application\UDS\
-I..\source\Application\UDS\TP
-I..\source\Application\UDS\TP
-I..\source\Application\K_BUS
-I..\source\Application\K_BUS
-I..\source\Application\UDS_M
-MD
-MD
-Mn
-Mn
...
...
source/Application/APP/PowerManagement/PowerManagement_user.c
View file @
5bffea87
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "GUI.h"
#include "GUI.h"
#include "Data_Fuel_User.h"
#include "Data_Fuel_User.h"
#include "app_Service.h"
#include "UART.h"
#include "UART.h"
#include "kwp2000_tp.h"
#include "kwp2000_tp.h"
#include "kwp2000_protocol.h"
#include "kwp2000_protocol.h"
...
@@ -219,7 +220,7 @@ void Power_IG_OFF_Init(void)
...
@@ -219,7 +220,7 @@ void Power_IG_OFF_Init(void)
void
Power_IG_ON_Init
(
void
)
void
Power_IG_ON_Init
(
void
)
{
{
Kwp2000_Init
();
Kwp2000_Init
();
DiagnosisInit_main
();
Data_ODO_Clear_KL15Init
();
Data_ODO_Clear_KL15Init
();
Telltales_KL15_Init
();
Telltales_KL15_Init
();
Line_In_KL15_ON_Init
();
Line_In_KL15_ON_Init
();
...
...
source/Application/CAN_APP_NM/CAN_App/CAN_FUNC.c
View file @
5bffea87
...
@@ -1156,4 +1156,4 @@ void Common_SetTXNum_18033317(void)
...
@@ -1156,4 +1156,4 @@ void Common_SetTXNum_18033317(void)
uint8_t
Common_GetTXNum_18033317
(
void
)
uint8_t
Common_GetTXNum_18033317
(
void
)
{
{
return
TXNum_18033317
;
return
TXNum_18033317
;
}
}
\ No newline at end of file
source/Application/CAN_APP_NM/CAN_App/CAN_FUNC.h
View file @
5bffea87
...
@@ -65,4 +65,9 @@ void Id18033317_Send_Service(void);
...
@@ -65,4 +65,9 @@ void Id18033317_Send_Service(void);
void
MSG_18021733_REC_COPY
(
uint8_t
copy
[]);
void
MSG_18021733_REC_COPY
(
uint8_t
copy
[]);
void
DoCan_Data_Indicatiom
(
uint32_t
Identifier
,
uint8_t
dlc
,
uint8_t
pData
[]
);
void
DoCAN_GetEngineDUC_N_PDU
(
void
);
#endif
#endif
\ No newline at end of file
source/Application/RTE/RTE_CAN.c
View file @
5bffea87
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "RTE_CAN.h"
#include "RTE_CAN.h"
#include "CAN_Communication_Matrix.h"
#include "CAN_Communication_Matrix.h"
#include "CAN_FUNC.h"
#include "CAN_Lib.h"
#include "CAN_Lib.h"
//#include "CAN_Signal_Tx.h"
//#include "CAN_Signal_Tx.h"
#include "AlarmGeneralFilie.h"
#include "AlarmGeneralFilie.h"
...
@@ -14,6 +15,8 @@
...
@@ -14,6 +15,8 @@
#include "Watchdog.h"
#include "Watchdog.h"
#include "RSCAN.h"
#include "RSCAN.h"
#include "Link_Layer.h"
static
uint16_t
Can_Init_Lock
=
0U
;
static
uint16_t
Can_Init_Lock
=
0U
;
...
@@ -144,14 +147,14 @@ void Can_Read_Msg(uint32_t m_id, uint8_t m_dlc, uint8_t m_Msg[])
...
@@ -144,14 +147,14 @@ void Can_Read_Msg(uint32_t m_id, uint8_t m_dlc, uint8_t m_Msg[])
void
Can_Read_Msg2
(
uint32_t
m_id
,
uint8_t
m_dlc
,
uint8_t
m_Msg
[])
void
Can_Read_Msg2
(
uint32_t
m_id
,
uint8_t
m_dlc
,
uint8_t
m_Msg
[])
{
{
ReceivedMsg
(
m_id
,
m_dlc
);
if
(
m_id
==
DIAG_ID_Rx_PHY
)
//Co_Can_Buff_Set(Co_Can_ConvertSubID(m_id), m_dlc, m_Msg);
if
((
m_id
==
DIAG_ID_Rx_FUN
)
||
(
m_id
==
DIAG_ID_Rx_PHY
))
{
{
DoCAN_L_Data_Indication
(
m_id
,
m_dlc
,
m_Msg
);
LK_Link_main
(
DIAG_ID_Rx_PHY
,
(
uint8_t
*
)
m_Msg
,
(
m_dlc
&
0x0f
)
);
}
}
//if ((m_id == DIAG_ID_Rx_FUN) || (m_id == DIAG_ID_Rx_PHY))
//{
// DoCAN_L_Data_Indication(m_id, m_dlc, m_Msg);
//}
}
}
void
Can_Confirm
(
uint32_t
Identifier
,
uint8_t
TransferStatus
)
void
Can_Confirm
(
uint32_t
Identifier
,
uint8_t
TransferStatus
)
...
...
source/Application/UDS_M/Link_Layer.c
0 → 100644
View file @
5bffea87
#define GLOBALS_LK_DIAGNO
#include "Link_Layer.h"
#include <string.h>
volatile
_LinkData
LinkDataBuf
[
2
];
volatile
_LinkData
LinkData
;
/*-------------------------------------------------------------------------
* Function Name : LK_Link_main
* Description :
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
LK_Link_main
(
uint16_t
PDU_addr
,
uint8_t
*
CAN_BufAddr
,
uint8_t
dlc
)
{
if
(
LinkDataBuf
[
0
].
TransferStatus
==
empoty
)
{
LinkDataBuf
[
0
].
Identifier
=
PDU_addr
;
//
(
void
)
memcpy
((
uint8_t
*
)
&
LinkDataBuf
[
0
].
Data
[
0
],
CAN_BufAddr
,
dlc
);
LinkDataBuf
[
0
].
DLC
=
dlc
;
LinkDataBuf
[
0
].
TransferStatus
=
full
;
}
else
if
(
LinkDataBuf
[
1
].
TransferStatus
==
empoty
)
{
LinkDataBuf
[
1
].
Identifier
=
PDU_addr
;
(
void
)
memcpy
((
uint8_t
*
)
&
LinkDataBuf
[
1
].
Data
[
0
],
CAN_BufAddr
,
dlc
);
LinkDataBuf
[
1
].
DLC
=
dlc
;
LinkDataBuf
[
1
].
TransferStatus
=
full
;
}
}
/*-------------------------------------------------------------------------
* Function Name : LK_FillMsg
* Description :
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
LK_FillMsg
(
uint8_t
*
data
,
uint8_t
FillData
,
uint8_t
dlc
)
{
uint8_t
i
;
for
(
i
=
dlc
;
i
<
8
;
i
++
)
{
*
(
data
+
i
)
=
FillData
;
}
}
source/Application/UDS_M/Link_Layer.h
0 → 100644
View file @
5bffea87
#ifdef GLOBALS_LK_DIAGNO
#define EXTERN_LK_DIAGNO
#else
#define EXTERN_LK_DIAGNO extern
#endif
#include "uds_includes.h"
#ifndef LK_DIAGNO_H_
#define LK_DIAGNO_H_
EXTERN_LK_DIAGNO
volatile
_LinkData
LinkDataBuf
[
2
];
EXTERN_LK_DIAGNO
volatile
_LinkData
LinkData
;
EXTERN_LK_DIAGNO
void
LK_FillMsg
(
uint8_t
*
data
,
uint8_t
FillData
,
uint8_t
dlc
);
EXTERN_LK_DIAGNO
void
LK_Link_main
(
uint16_t
PDU_addr
,
uint8_t
*
CAN_BufAddr
,
uint8_t
dlc
);
#endif
/* LK_DIAGNO_H_ */
source/Application/UDS_M/TP_Layer.c
0 → 100644
View file @
5bffea87
This diff is collapsed.
Click to expand it.
source/Application/UDS_M/TP_Layer.h
0 → 100644
View file @
5bffea87
#ifdef GLOBALS_TP_DIAGNO
#define EXTERN_TP_DIAGNO
#else
#define EXTERN_TP_DIAGNO extern
#endif
#ifndef _TP_DIAGNO_H_
#define _TP_DIAGNO_H_
#include "uds_includes.h"
#define SingleFrame 0x00
#define FirstFrame 0x10
#define ConsecutiveFrame 0x20
#define FlowControlFrame 0x30
#define FC_WAIT 0x31
typedef
struct
{
uint32_t
id
;
uint8_t
msg
[
8
];
uint8_t
dlc
;
}
_SendCanMsg
;
EXTERN_TP_DIAGNO
volatile
_SendCanMsg
g_txCanMsg
;
extern
volatile
_N_USData
N_US_R_MultiData
;
extern
volatile
_N_USData
N_US_S_MultiData
;
extern
volatile
_N_RSPData
N_RSPData
;
extern
volatile
_N_US_Data_FF
N_US_R_Data_FF
;
extern
volatile
_N_US_Data_FF
N_US_S_Data_FF
;
extern
volatile
_N_USSFData
N_USSFData
[
2
];
extern
volatile
uint16_t
N_RecLen
;
EXTERN_TP_DIAGNO
uint8_t
TP_CalMsgLen
(
uint16_t
BIT_DATA
,
uint8_t
SnLoop
);
EXTERN_TP_DIAGNO
void
TP_AbnormalInResSF_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_AbnormalInResFC_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_AbnormalInResCF_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_AbnormalInReqFC_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_NormalRecFC_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_Buffer_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_UnknownlPDU_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_ReciveSF_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_ReciveMultiF_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_AbnormalInReqFF_handle
(
void
);
EXTERN_TP_DIAGNO
void
TP_NormalSendFC_Fun
(
void
);
EXTERN_TP_DIAGNO
void
TP_TooShortDLC_handle
(
_LinkData
*
LK_Data
);
EXTERN_TP_DIAGNO
void
TP_TransmitPDU
(
void
);
EXTERN_TP_DIAGNO
void
TP_TransmitNegatePDU
(
_ErrorFrame
*
Err
);
EXTERN_TP_DIAGNO
void
TP_SetSTminTimer
(
uint32_t
Second
,
_DiagClock
*
T
);
EXTERN_TP_DIAGNO
uint8_t
TP_STminTimerOver
(
_DiagClock
*
T
);
EXTERN_TP_DIAGNO
void
TP_SetBsTimer
(
uint32_t
Second
,
_DiagClock
*
T
);
EXTERN_TP_DIAGNO
uint8_t
TP_BsTimerOver
(
_DiagClock
*
T
);
EXTERN_TP_DIAGNO
void
TP_SetCrTimer
(
uint32_t
Second
,
_DiagClock
*
T
);
EXTERN_TP_DIAGNO
uint8_t
TP_CrTimerOver
(
_DiagClock
*
T
);
#endif
/* _TP_DIAGNO_H_ */
source/Application/UDS_M/UDS_CFG.h
0 → 100644
View file @
5bffea87
#ifdef GLOBALS_UDS_CFG
#define EXTERN_UDS_CFG
#else
#define EXTERN_UDS_CFG extern
#endif
#ifndef _UDS_CFG_H_
#define _UDS_CFG_H_
#define N_Unlock 10000
#define N_SequenceOut 500
#define N_Session 5000
#define N_Cr 150
#define N_Bs 150
#define ID_BCM_PhyAddr 0x7E0
#define ID_BCM_ResAddr 0x7E8 //BCM物理响应
#define ID_PhyAddr 0x701
#define ID_ResAddr 0x709 //物理响应
#define ID_FunAddr 0x7df
#define N_FILL 0x00
#endif
source/Application/UDS_M/UDS_def.h
0 → 100644
View file @
5bffea87
#ifndef _UDS_DEF_H_
#define _UDS_DEF_H_
///////////------------------------////////////////////////////
#define SubDefSession 0x01
#define SubProgSession 0x02
#define SubExtSession 0x03
#define SubHardReset 1
#define SubKeyOffOnReset 2
#define SubSoftReset 3
#define SubZeroFun0 0
#define SubReqSeed1 1
#define SubReqSeed3 3
#define SubReqSeed5 5
#define SubReqSeed7 7
#define SubSendKey2 2
#define SubSendKey4 4
#define SubSendKey6 6
#define SubSendKey8 8
#define SubEnableRxAndTx 0 //使能接收发送
#define SubEnableRxAndDisTx 1 //使能接收
#define SubDisableRxAndEnTx 2 //使能发送
#define SubDisableRxAndTx 3 //关闭
#define NOR_Message 1
#define NM_Message 2
#define NOR_NM_Message 3
#define UnLockLv4 4
#define UnLockLv3 3
#define UnLockLv2 2
#define UnLockLv1 1 //解锁
#define Lock 0
#define DefSession 0x01 //默认会话
#define ProgSession 0x02 //编程会话
#define ExtSession 0x03 //扩展会话
#define NegativeId 0x7f //否定响应ID
//-- Request Service Id(服务列表) --//
#define ReqSessionCtlId 0x10
#define ReqECUResetId 0x11
#define ReqClrDiagInfoId 0x14
#define ReqReadDtcId 0x59
#define ReqReadDataId 0x62
#define ReqAccessId 0x27
#define ReqCommCtlId 0x28
#define ReqWriteDataId 0x2e
#define ReqRoutineControlId 0x31
#define ReqDownloadId 0x34
#define ReqMessageId 0x36
#define RequestTransferExitId 0x37
#define ReqTesterId 0x3E //
#define ReqInAndOutCtlId 0x2F
#define ReqCtlDTCSetId 0x85
#define ReqProgModeId 0xA5
#define ReqProgMilId 0x41
//-- N_R否定响应 --//
#define ServiceNotSupported 0x11 //服务不支持 99 Exct_USData.ind.MsgData[0]
#define SubFunctionNotSupported 0x12 //子功能不支持 10 04 SubFunBit0_6
#define ErrFormatLength 0x13 //长度不对 ind.Length
#define RequestOutOfRange 0x31 //超出范围 28 03 04 ind.MsgData[2]
#define FlashEraseFailed 0x32 //31
#define SecurityAccessDenied 0x33 //31
#define InvalidKey 0x35 //秘钥错误
#define ExceedNumberOfAttempts 0x36 //27
#define ReqTimeDelayNotExpired 0x37 //27
#define SubFunctionNotSupportedInActiceSession 0x7e //----------空
#define NotSuppInActiveSession 0x7f //此会话不支持功能
#define ConditNotCorrect 0x22 //----------空
#define ReqSequenceError 0x24 //
#define voltageTooHigh 0x92 //----------空
#define voltageTooLow 0x93 //----------空
#define DtcSetOn 1
#define DtcSetOff 2
//19
#define RepNumByStatusMask 1 //reportNumberOfDTCByStatusMask
#define RepDTCByStatusMask 2 //reportDTCByStatusMask
#define RepSnapRecordDTCNum 4 //reportDTCSnapshotRecordByDTCNumber
#define RepExtDataRecordNum 6 //reportDTCExtendedDataRecordByDTCNumber
#define RepSupportedDTC 0xa //reportSupportedDTC
//A5
#define VerifyProgCondition 1
#define EnableProgMode 3
//2F
#define ReturnControlToECU 0
#define ShortTermAdjustment 3
//
#define UDS_TRUE 1
#define UDS_FALSE 0
#endif
source/Application/UDS_M/app_Service.c
0 → 100644
View file @
5bffea87
This diff is collapsed.
Click to expand it.
source/Application/UDS_M/app_Service.h
0 → 100644
View file @
5bffea87
#ifdef GLOBALS_SER_DIAGNO
#define EXTERN_SER_DIAGNO
#else
#define EXTERN_SER_DIAGNO extern
#endif
#ifndef SER_DIAGNO_H_
#define SER_DIAGNO_H_
#include "uds_includes.h"
#define DID0005 0x0005
extern
volatile
_N_USData
Exct_USData
;
extern
volatile
_DiagnoCtl
DiagnoCtl
;
extern
volatile
_DiagClock
DiagClock
;
extern
volatile
_ErrorFrame
Error
;
extern
void
App_SetSequenceTimer
(
uint32_t
Second
,
_DiagClock
*
T
);
extern
uint8_t
App_SequenceTimerOver
(
_DiagClock
*
T
);
extern
void
App_SetSessionTimer
(
uint32_t
Second
,
_DiagClock
*
T
);
extern
uint8_t
App_SessionTimerOver
(
_DiagClock
*
T
);
extern
void
App_SetReUnlockTimer
(
uint32_t
Second
,
_DiagClock
*
T
);
extern
uint8_t
App_ReUnlockTimerOver
(
_DiagClock
*
T
);
extern
void
App_10_service
(
_N_USData
*
AppUSData
);
//会话模式
extern
void
App_11_service
(
_N_USData
*
AppUSData
);
//复位模式
extern
void
App_14_service
(
_N_USData
*
AppUSData
);
//清除-故障码(DTC)
extern
void
App_59_service
(
_N_USData
*
AppUSData
);
//读-故障码(DTC)
extern
void
App_62_service
(
_N_USData
*
AppUSData
);
//读
extern
void
App_27_service
(
_N_USData
*
AppUSData
);
//解锁
extern
void
App_28_service
(
_N_USData
*
AppUSData
);
//RxTx
extern
void
App_2E_service
(
_N_USData
*
AppUSData
);
//写
extern
void
App_2F_service
(
_N_USData
*
AppUSData
);
//IO
extern
void
App_31_service
(
_N_USData
*
AppUSData
);
//Boot
extern
void
App_34_service
(
_N_USData
*
AppUSData
);
//Boot
extern
void
App_36_service
(
_N_USData
*
AppUSData
);
//Boot
extern
void
App_37_service
(
_N_USData
*
AppUSData
);
//Boot
extern
void
App_3E_service
(
_N_USData
*
AppUSData
);
//Boot
extern
void
App_85_service
(
_N_USData
*
AppUSData
);
//开关-故障码(DTC)
extern
void
App_01_service
(
_N_USData
*
AppUSData
);
extern
void
DiagnosisInit_main
(
void
);
extern
void
Diagnosis_main
(
void
);
#endif
/* SER_DIAGNO_H_ */
source/Application/UDS_M/app_ServiceProc.c
0 → 100644
View file @
5bffea87
#define GLOBALS_SERPROC_DIAGNO
#include "app_Service.h"
#include "TP_Layer.h"
#include "UDS_def.h"
#include "app_ServiceProc.h"
/*-------------------------------------------------------------------------
* Function Name : App_CreateCRCCheckSum
* Description :
* Input : uint8_t *p ,uint8_t Nub
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
uint8_t
App_CreateCRCCheckSum
(
uint8_t
*
p
,
uint8_t
Nub
)
{
uint8_t
bCheckSun
;
uint8_t
i
;
bCheckSun
=
0
;
while
(
Nub
--
)
{
bCheckSun
^=
*
p
++
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
bCheckSun
&
0x01
)
{
bCheckSun
=
(
bCheckSun
>>
1
)
^
0x8C
;
}
else
bCheckSun
>>=
1
;
}
}
return
(
bCheckSun
);
}
/*-------------------------------------------------------------------------
* Function Name : App_CopyRam
* Description : ran copy
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
App_CopyRam
(
uint8_t
*
Dp
,
uint8_t
*
Sp
,
uint16_t
Nub
)
{
uint16_t
b
;
for
(
b
=
0
;
b
<
Nub
;
b
++
)
{
*
Dp
++
=
*
Sp
++
;
}
}
/*-------------------------------------------------------------------------
* Function Name : App_Load_DID
* Description :
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
App_Load_DID
(
uint16_t
*
DID
,
uint8_t
*
data
)
{
(
*
DID
)
=
data
[
0
];
(
*
DID
)
=
(
*
DID
)
<<
8
;
(
*
DID
)
|=
data
[
1
];
}
/*-------------------------------------------------------------------------
* Function Name : App_ErrorInfoInit
* Description :
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
App_ErrorInfoInit
(
_N_USData
*
AppUSData
)
{
Error
.
RespSerId
=
AppUSData
->
ind
.
MsgData
[
0
];
Error
.
N_TAtype
=
AppUSData
->
ind
.
N_TAtype
;
Error
.
FrameErr
=
0
;
}
/*-------------------------------------------------------------------------
* Function Name : App_11_Reset_handle
* Description :
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
App_11_Reset_handle
(
void
)
{
if
(
N_RSPData
.
ind
.
N_Result
==
STATE0
)
{
switch
(
DiagnoCtl
.
SubFunction
)
{
case
SubHardReset
:
while
(
1
)
;
case
SubSoftReset
:
break
;
case
SubKeyOffOnReset
:
break
;
default:
;
}
DiagnoCtl
.
SubFunction
=
0
;
}
}
/*-------------------------------------------------------------------------
* Function Name : App_2F_IOCtl_handle
* Description :
* Input :
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void
Diagno_Tick
(
uint16_t
DiagnoTimeCn
)
{
//
if
(
DiagClock
.
TT_STminEnable
)
{
if
(
DiagClock
.
STminTime
<
DiagClock
.
OverSTminTime
)
{
DiagClock
.
STminTime
+=
DiagnoTimeCn
;
}
}
if
(
DiagClock
.
TT_BsEnable
)
{
if
(
DiagClock
.
BsTime
<
DiagClock
.
OverBsTime
)
{
DiagClock
.
BsTime
+=
DiagnoTimeCn
;
}
}
if
(
DiagClock
.
TT_CrEnable
)
{
if
(
DiagClock
.
CrTime
<
DiagClock
.
OverCrTime
)
{
DiagClock
.
CrTime
+=
DiagnoTimeCn
;
}
}
if
(
DiagClock
.
TT_SequenceEnable
)
{
if
(
DiagClock
.
SequenceTime
<
DiagClock
.
OverSequenceTime
)
{
DiagClock
.
SequenceTime
+=
DiagnoTimeCn
;
}
}
if
(
DiagClock
.
TT_SessionEnable
)
{
if
(
DiagClock
.
SessionTime
<
DiagClock
.
OverSessionTime
)
{
DiagClock
.
SessionTime
+=
DiagnoTimeCn
;
}
}
if
(
DiagClock
.
TT_UnlockEnable
)
{
if
(
DiagClock
.
UnlockTime
<
DiagClock
.
OverUnlockTime
)
{
DiagClock
.
UnlockTime
+=
DiagnoTimeCn
;
}
}
}
source/Application/UDS_M/app_ServiceProc.h
0 → 100644
View file @
5bffea87
#ifdef GLOBALS_SERPROC_DIAGNO
#define EXTERN_SERPROC_DIAGNO
#else
#define EXTERN_SERPROC_DIAGNO extern
#endif
#include "uds_includes.h"
#ifndef SERPROC_DIAGNO_H_
#define SERPROC_DIAGNO_H_
extern
void
App_ErrorInfoInit
(
_N_USData
*
AppUSData
);
extern
void
App_Load_DID
(
uint16_t
*
DID
,
uint8_t
*
data
);
extern
void
App_CopyRam
(
uint8_t
*
Dp
,
uint8_t
*
Sp
,
uint16_t
Nub
);
extern
uint8_t
App_CreateCRCCheckSum
(
uint8_t
*
p
,
uint8_t
Nub
);
extern
void
App_11_Reset_handle
(
void
);
void
Diagno_Tick
(
uint16_t
DiagnoTimeCn
);
#endif
/* SERPROC_DIAGNO_H_ */
source/Application/UDS_M/uds_includes.h
0 → 100644
View file @
5bffea87
/*
* includes.h
*
* Created on: 2014-7-31
* Author: qitiancun
*/
#ifndef _UDS_INCLUDES_H_
#define _UDS_INCLUDES_H_
#include "TYW_stdint.h"
/*
#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
*/
#define MaxBuff 266
typedef
enum
{
STATE0
=
1
,
N_OK_2
,
CTS
,
WAIT
,
OVFLW
,
N_TIMEOUT_Bs_6
,
N_ERROR_7
,
N_INVALID_FS_8
,
N_WRONG_SN_9
}
Enum_Result
;
typedef
enum
{
empoty
,
full
}
TransSt
;
typedef
struct
{
uint16_t
Identifier
;
//Fun--PGN--
uint8_t
DLC
;
uint8_t
Data
[
8
];
TransSt
TransferStatus
;
}
_LinkData
;
typedef
struct
{
struct
{
uint16_t
pos
;
uint16_t
Length
;
uint16_t
N_FC_Num
;
uint16_t
N_RecSN_L
;
uint8_t
N_SendSN
;
uint8_t
N_BS_CNT
;
uint8_t
N_BS
;
uint8_t
N_SA
;
uint8_t
N_TA
;
uint8_t
N_PCI
;
uint8_t
N_SID
;
}
ind
;
}
_N_US_Data_FF
;
typedef
struct
{
struct
{
uint16_t
N_TAtype
;
uint16_t
Length
;
uint8_t
N_SA
;
uint8_t
N_TA
;
uint8_t
N_AE
;
uint8_t
N_PCI
;
uint8_t
MsgData
[
8
];
Enum_Result
N_Result
;
}
ind
;
}
_N_USSFData
;
typedef
struct
{
struct
{
uint16_t
N_TAtype
;
//PGN 55808--0xDA00
uint16_t
Length
;
uint8_t
N_SA
;
uint8_t
N_TA
;
uint8_t
N_AE
;
uint8_t
N_PCI
;
uint8_t
MsgData
[
MaxBuff
];
Enum_Result
N_Result
;
}
ind
;
}
_N_USData
;
typedef
struct
{
struct
{
uint8_t
len
;
uint8_t
MsgData
[
8
];
uint8_t
N_Result
;
}
ind
;
}
_N_RSPData
;
typedef
union
{
struct
{
uint8_t
SubFunBit0_6
:
7
;
uint8_t
SubFunBit7_7
:
1
;
}
SubBits
;
uint8_t
SubData
;
}
_SubFun
;
typedef
struct
{
uint8_t
SessionType
;
uint8_t
AccessLock
;
uint8_t
AccessCount
;
uint8_t
key
[
4
];
uint8_t
SubFunction
;
uint8_t
w27_Sequence
;
uint8_t
A5_Sequence
;
uint8_t
DTCSettingType
;
uint8_t
tDiagStart
;
uint8_t
tDiagKL30ONStart
;
uint8_t
N_STmin_0
;
uint8_t
N_REV_MAX_BS
;
uint8_t
CommType
;
uint8_t
CommCtl
;
uint8_t
DTCByStatusMask
;
}
_DiagnoCtl
;
typedef
struct
{
uint16_t
N_TAtype
;
//PGN--55808--DA00
uint8_t
FrameErr
;
uint8_t
RespSerId
;
}
_ErrorFrame
;
typedef
struct
{
uint32_t
OverBsTime
;
uint32_t
BsTime
;
uint32_t
OverSTminTime
;
uint32_t
STminTime
;
uint32_t
OverCrTime
;
uint32_t
CrTime
;
uint32_t
OverSessionTime
;
uint32_t
SessionTime
;
uint32_t
OverSequenceTime
;
uint32_t
SequenceTime
;
uint32_t
OverUnlockTime
;
uint32_t
UnlockTime
;
uint8_t
TT_BsEnable
;
uint8_t
TT_STminEnable
;
uint8_t
TT_CrEnable
;
uint8_t
TT_SessionEnable
;
uint8_t
TT_SequenceEnable
;
uint8_t
TT_UnlockEnable
;
uint8_t
E2_WriteTime
;
}
_DiagClock
;
typedef
union
{
struct
{
uint32_t
StructDTC
[
25
];
}
SubDTC
;
uint8_t
UnionDTC
[
100
];
}
_DiagReciveDTC
;
typedef
struct
{
uint8_t
CoolantTemp
[
20
];
uint8_t
MilLamp
;
}
_DiagReciveGaugePara
;
#include "UDS_Def.h"
#include "UDS_CFG.h"
#include "TP_Layer.h"
#include "Link_Layer.h"
#include "app_ServiceProc.h"
#include "app_Service.h"
extern
_DiagReciveDTC
DiagReciveDTC
;
extern
_DiagReciveGaugePara
DiagReciveGaugePara
;
#endif
/* _UDS_INCLUDES_H_ */
source/Driver/CAN/RSCAN_Table.c
View file @
5bffea87
...
@@ -41,5 +41,5 @@ const RSCANFD_Filter_st_t CANFD_RX_RULE_TABLE_LIST[CANFD0_RX_RULE_SIZE] =
...
@@ -41,5 +41,5 @@ const RSCANFD_Filter_st_t CANFD_RX_RULE_TABLE_LIST[CANFD0_RX_RULE_SIZE] =
{
0x98DBFFFAul
,
0xDFFFFFFFUL
,
0x80000000ul
,
CANFD0_CH0_RX_SELECT
},
/*24*/
{
0x98DBFFFAul
,
0xDFFFFFFFUL
,
0x80000000ul
,
CANFD0_CH0_RX_SELECT
},
/*24*/
{
0x000007E8ul
,
0xDFFFFFFFUL
,
0x80000000ul
,
CANFD0_CH2_RX_SELECT
},
/* 1*/
{
0x000007E8ul
,
0xDFFFFFFFUL
,
0x80000000ul
,
CANFD0_CH2_RX_SELECT
},
/* 1*/
{
0x00000111ul
,
0xDFFFFFFFUL
,
0x80000000ul
,
CANFD0_CH2_RX_SELECT
},
/* 2*/
//
{0x00000111ul, 0xDFFFFFFFUL, 0x80000000ul, CANFD0_CH2_RX_SELECT},/* 2*/
};
};
\ No newline at end of file
source/Driver/CAN/RSCAN_Table.h
View file @
5bffea87
...
@@ -13,7 +13,7 @@ typedef struct
...
@@ -13,7 +13,7 @@ typedef struct
#define CANFD0_CH0_RX_RULE_SIZE 24u
#define CANFD0_CH0_RX_RULE_SIZE 24u
#define CANFD0_CH1_RX_RULE_SIZE 0U
#define CANFD0_CH1_RX_RULE_SIZE 0U
#define CANFD0_CH2_RX_RULE_SIZE
2
U
#define CANFD0_CH2_RX_RULE_SIZE
1
U
#define CANFD0_RX_RULE_SIZE (CANFD0_CH0_RX_RULE_SIZE + \
#define CANFD0_RX_RULE_SIZE (CANFD0_CH0_RX_RULE_SIZE + \
...
...
source/System/tasks.c
View file @
5bffea87
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "Graphic.h"
#include "Graphic.h"
#include "CAN_Communication_Matrix.h"
#include "CAN_Communication_Matrix.h"
#include "CAN_FUNC.h"
#include "PowerManagement.h"
#include "PowerManagement.h"
#include "System_Monitor.h"
#include "System_Monitor.h"
...
@@ -110,6 +111,7 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
...
@@ -110,6 +111,7 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
UDS_Server_Application_Service
();
UDS_Server_Application_Service
();
IS31_Service
();
IS31_Service
();
BU98R10_Update_Service
();
BU98R10_Update_Service
();
}
}
/*============================================================================*/
/*============================================================================*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment