Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
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
TY
TianYing_ty100
Commits
5b37a388
Commit
5b37a388
authored
Aug 18, 2024
by
李茂军
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ZMY' into 'dev'
项目需求,将UUID写入的长度修改位21字节,增加写入长度的判断 See merge request
!76
parents
bed48f07
efb92275
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
22 deletions
+29
-22
UDS_ISO14229_Services.c
Firmware/Source/UDS/UDS_ISO14229_Services.c
+27
-21
UDS_ISO14229_Services.h
Firmware/Source/UDS/UDS_ISO14229_Services.h
+2
-1
No files found.
Firmware/Source/UDS/UDS_ISO14229_Services.c
View file @
5b37a388
...
@@ -194,7 +194,7 @@ void Data_Read_DiagPara(void)
...
@@ -194,7 +194,7 @@ void Data_Read_DiagPara(void)
{
{
uint8_t
i
;
uint8_t
i
;
Ser2EDFlashData
*
ReadSer2EDataForDFlash
=
(
Ser2EDFlashData
*
)
0x500600ul
;
Ser2EDFlashData
*
ReadSer2EDataForDFlash
=
(
Ser2EDFlashData
*
)
0x500600ul
;
for
(
i
=
0
;
i
<
32
;
i
++
)
for
(
i
=
0
;
i
<
21
;
i
++
)
{
{
Ser2EDataForDFlash
.
DID_F184
[
i
]
=
ReadSer2EDataForDFlash
->
DID_F184
[
i
];
Ser2EDataForDFlash
.
DID_F184
[
i
]
=
ReadSer2EDataForDFlash
->
DID_F184
[
i
];
}
}
...
@@ -857,11 +857,11 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A
...
@@ -857,11 +857,11 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A
break
;
break
;
case
0xF184
:
// UUID
case
0xF184
:
// UUID
for
(
i
=
0
;
i
<
32
;
i
++
)
for
(
i
=
0
;
i
<
21
;
i
++
)
{
{
UDS_ISO14229_Transfer
[
i
+
2
]
=
Ser2EDataForDFlash
.
DID_F184
[
i
];
UDS_ISO14229_Transfer
[
i
+
2
]
=
Ser2EDataForDFlash
.
DID_F184
[
i
];
}
}
UDS_Service_Response
(
0x22
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
+
32
,
UDS_ISO14229_Transfer
);
UDS_Service_Response
(
0x22
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
+
21
,
UDS_ISO14229_Transfer
);
break
;
break
;
case
0x2024
:
// ESP32内部版本号
case
0x2024
:
// ESP32内部版本号
...
@@ -903,7 +903,6 @@ void UDS_Service_2E_Indication ( uint16_t A_TA_type, uint16_t A_Length, uint8_t
...
@@ -903,7 +903,6 @@ void UDS_Service_2E_Indication ( uint16_t A_TA_type, uint16_t A_Length, uint8_t
{
{
uint16_t
i
;
uint16_t
i
;
uint16_t
DID
;
uint16_t
DID
;
uint8_t
Data
[
8
];
uint8_t
Service2EDiagDataLength
;
uint8_t
Service2EDiagDataLength
;
uint16_t
FunorPhy
=
0
;
uint16_t
FunorPhy
=
0
;
Service2EDiagDataLength
=
A_Length
;
Service2EDiagDataLength
=
A_Length
;
...
@@ -915,45 +914,52 @@ void UDS_Service_2E_Indication ( uint16_t A_TA_type, uint16_t A_Length, uint8_t
...
@@ -915,45 +914,52 @@ void UDS_Service_2E_Indication ( uint16_t A_TA_type, uint16_t A_Length, uint8_t
UDS_ISO14229_Transfer
[
i
]
=
*
(
A_Data
+
i
);
UDS_ISO14229_Transfer
[
i
]
=
*
(
A_Data
+
i
);
}
}
if
(
FunorPhy
==
0X7DF
)
if
(
FunorPhy
==
0X7DF
)
{
return
;
return
;
if
(
DiagLockFlag
==
0x00
)
}
if
(
(
SessionType
==
DefaultSession
)
||
(
SessionType
==
ProgrammingSession
))
{
{
NegRes
.
code
=
se
curityAccessDenied
;
//NRC33
NegRes
.
code
=
se
rviceNotSupportedInActiveSession
;
//NRC7F
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
return
;
return
;
}
}
if
(
Service2EDiagDataLength
<
3
)
if
(
Service2EDiagDataLength
<
3
)
{
{
NegRes
.
code
=
incorrectMessageLength
;
//NRC13
NegRes
.
code
=
incorrectMessageLength
;
//NRC13
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
return
;
return
;
}
}
if
(
(
SessionType
==
DefaultSession
)
||
(
SessionType
==
ProgrammingSession
))
if
(
DiagLockFlag
==
0x00
)
{
{
NegRes
.
code
=
se
rviceNotSupportedInActiveSession
;
//NRC7F
NegRes
.
code
=
se
curityAccessDenied
;
//NRC33
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
return
;
return
;
}
}
DID
=
((
uint16_t
)
UDS_ISO14229_Transfer
[
0
]
<<
8
)
|
((
uint16_t
)
UDS_ISO14229_Transfer
[
1
]);
DID
=
((
uint16_t
)
UDS_ISO14229_Transfer
[
0
]
<<
8
)
|
((
uint16_t
)
UDS_ISO14229_Transfer
[
1
]);
switch
(
DID
)
switch
(
DID
)
{
{
case
0xF184
:
//
读指纹数据标识符
case
0xF184
:
//
写入UUID
for
(
i
=
0
;
i
<
33
;
i
++
)
if
(
Service2EDiagDataLength
==
23
)
//限制最大长度
{
{
Data
[
i
]
=
UDS_ISO14229_Transfer
[
i
+
2
];
for
(
i
=
0
;
i
<
(
sizeof
(
Ser2EDataForDFlash
.
DID_F184
));
i
++
)
{
Ser2EDataForDFlash
.
DID_F184
[
i
]
=
UDS_ISO14229_Transfer
[
i
+
2
];
}
Ser2EDataForDFlash
.
Flag
=
0x5AA5A77Au
;
// 擦除扇区
EraseSector
(
0x500600ul
);
// App程序状态和22服务数据全写进去
ProgramPage
(
0x500600ul
,
sizeof
(
Ser2EDataForDFlash
),
(
uint8_t
*
)(
&
Ser2EDataForDFlash
));
UDS_Service_Response
(
0x2E
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
,
UDS_ISO14229_Transfer
);
}
}
else
for
(
i
=
0
;
i
<
(
sizeof
(
Ser2EDataForDFlash
.
DID_F184
));
i
++
)
{
{
Ser2EDataForDFlash
.
DID_F184
[
i
]
=
Data
[
i
];
NegRes
.
code
=
incorrectMessageLength
;
//NRC13
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
}
}
Ser2EDataForDFlash
.
Flag
=
0x5AA5A77Au
;
// memcpy(Ser2EDataForDFlash.DID_F184, Data, sizeof(Ser2EDataForDFlash.DID_F184));
//擦除扇区
EraseSector
(
0x500600ul
);
//App程序状态和22服务数据全写进去
ProgramPage
(
0x500600ul
,
sizeof
(
Ser2EDataForDFlash
),
(
uint8_t
*
)(
&
Ser2EDataForDFlash
));
UDS_Service_Response
(
0x2E
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
,
UDS_ISO14229_Transfer
);
break
;
break
;
default:
default:
if
(
FunorPhy
==
0x7df
)
if
(
FunorPhy
==
0x7df
)
...
...
Firmware/Source/UDS/UDS_ISO14229_Services.h
View file @
5b37a388
...
@@ -354,7 +354,8 @@ extern DiagDFlashData DiagDataForDFlash;
...
@@ -354,7 +354,8 @@ extern DiagDFlashData DiagDataForDFlash;
typedef
struct
typedef
struct
{
{
uint32_t
Flag
;
uint32_t
Flag
;
uint8_t
DID_F184
[
32
];
uint8_t
DID_F184
[
21
];
uint8_t
Filldata
[
11
];
}
Ser2EDFlashData
;
}
Ser2EDFlashData
;
extern
Ser2EDFlashData
Ser2EDataForDFlash
;
extern
Ser2EDFlashData
Ser2EDataForDFlash
;
...
...
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