27 28服务更新

This commit is contained in:
sunbeam 2024-03-08 11:27:12 +08:00
parent f6b96f7156
commit ff4b4c51bc
3 changed files with 19 additions and 13 deletions

View File

@ -55,7 +55,7 @@ static uint8 SeDcm_u_SecurityAccessServerSts; /*27
static uint16 CeDcm_u_P2serverTime = 0x0032; /* P2server 时间 标定量*/
static uint16 CeDcm_u_P2ExtserverTime = 0x01F4; /* P2*server 时间 标定量*/
static uint32 SeDcm_w_SecurityAccessSeed = 0x12345678; /*27 ·þÎñ ÖÖ×Ó*/
static uint32 SeDcm_w_SecurityAccessSeed = 0x00;//0x12345678; /*27 服务 种子*/
static uint32 SeDcm_u_SecurityAccessKey; /*27 服务密钥*/
static uint32 CeDcm_w_SecurityAccessFBLMask = 0xAC856D89; /*27 服务掩码*/
@ -426,7 +426,7 @@ uint8 MngDcm_ExtDataRecordAvailableCheck(uint8 LeDcm_u_ExtDataRecord,const DTCEx
}
SeDcm_u_SecurityAccessState = DCM_SECURITYACCESS_DEFAULT; /*安全模式 锁定*/
SeDcm_u_SecurityAccessServerSts = DCM_SASERVERSTS_DEFAULT;
if(DCM_FALSE == (VeDcm_h_RqustInfo.Sub&0x80)) /*判断正响应抑制位*/
{
LaDcm_u_TempBuffer[0] = VeDcm_h_RqustInfo.Sid + 0x40;
@ -556,21 +556,25 @@ TeDcm_h_ResultType MngDcm_SoftResetDeal(void)
TeDcm_h_ResultType LeDcm_u_Result;
//SeDcm_u_KeyErrorDelayCount = 0;
if(SaDcm_u_RequestCounter < 5)
if(SaDcm_u_RequestCounter < 3)
{
SaDcm_u_RequestCounter++;
KamData.SeedReqTimes = SaDcm_u_RequestCounter | 0x10;
if(SaDcm_u_RequestCounter == 5)
if(SaDcm_u_RequestCounter == 3)
{
SaDcm_u_RequestDelayCount = DCM_SASERVERSTS_ERRORDELAY_COUNT;
SeDcm_u_KeyErrorCount = 3;
KamData.KeyErrTimes = SeDcm_u_KeyErrorCount | 0x10;
MngDcm_PrepareNegRsp(VeDcm_h_RqustInfo.Sid,CaDcm_u_NRCData[DCM_NRC36]); /*整理负响应数据*/
SetCanTp_TxBuffer(3U,VaDcm_u_NegRspTxBuffer); /*调用接口发送响应数据*/
return CeDcm_e_ResultNegRsp;
}
ReadFlashData(savebuf,0x000F1800,4);
//ReadFlashData(savebuf,0x000F1800,4);
savebuf[0] = SaDcm_u_RequestCounter;
savebuf[1] = SeDcm_u_KeyErrorCount;
WriteDataflash(savebuf,0x000F1800,4);
//WriteDataflash(savebuf,0x000F1800,4);
}//fcb
@ -601,7 +605,10 @@ TeDcm_h_ResultType MngDcm_SoftResetDeal(void)
}
else
{
SeDcm_w_SecurityAccessSeed = GetSeed();
if (SeDcm_w_SecurityAccessSeed == 0)
{
SeDcm_w_SecurityAccessSeed = GetSeed();
}
LaDcm_u_TempBuffer[2] = (uint8)(SeDcm_w_SecurityAccessSeed>>24)&0xFF;
LaDcm_u_TempBuffer[3] = (uint8)(SeDcm_w_SecurityAccessSeed>>16)&0xFF;
LaDcm_u_TempBuffer[4] = (uint8)(SeDcm_w_SecurityAccessSeed>>8)&0xFF;
@ -671,10 +678,10 @@ TeDcm_h_ResultType MngDcm_SoftResetDeal(void)
SeDcm_u_KeyErrorCount++; /*密钥不符合 密钥错误数加1*/
KamData.KeyErrTimes = SeDcm_u_KeyErrorCount | 0x10;
ReadFlashData(savebuf,0x000F1800,4);
//ReadFlashData(savebuf,0x000F1800,4);
savebuf[0] = SaDcm_u_RequestCounter;
savebuf[1] = SeDcm_u_KeyErrorCount;
WriteDataflash(savebuf,0x000F1800,4);
//WriteDataflash(savebuf,0x000F1800,4);
}
else /*密钥验证通过*/
@ -682,10 +689,10 @@ TeDcm_h_ResultType MngDcm_SoftResetDeal(void)
SeDcm_u_KeyErrorCount = 0U; /*密钥错误次数清零*/
KamData.KeyErrTimes = SeDcm_u_KeyErrorCount;
ReadFlashData(savebuf,0x000F1800,4);
//ReadFlashData(savebuf,0x000F1800,4);
savebuf[0] = SaDcm_u_RequestCounter;
savebuf[1] = SeDcm_u_KeyErrorCount;
WriteDataflash(savebuf,0x000F1800,4);
//WriteDataflash(savebuf,0x000F1800,4);
if(dummy == 0x02)
SeDcm_u_SecurityAccessState = DCM_SECURITYACCESS_L1_UNLOCK; /*置安全权限为 解锁状态 */

View File

@ -99,7 +99,6 @@ const TsDcm_h_WithParaSubCheckType CaDcm_h_27SubCheckTable[DCM_27SUB_COUNT]={
/*28服务 子服务信息列表*/
const TsDcm_h_WithParaSubCheckType CaDcm_h_28SubCheckTable[DCM_28SUB_COUNT]={
{0x00,3,&MngDcm_CtrlCommunication},
{0x01,3,&MngDcm_CtrlCommunication},
{0x03,3,&MngDcm_CtrlCommunication},
};

View File

@ -31,7 +31,7 @@
#define DCM_27SUB_COUNT 2U /*27服务子服务个数*/
#define DCM_28SUB_COUNT 3U /*28服务子服务个数*/
#define DCM_28SUB_COUNT 2U /*28服务子服务个数*/
#define DCM_31RID_COUNT 1U /*31服务子服务个数*/
#define DCM_RIDFF02_SUB_COUNT 3U /*31 FF02 支持的子服务个数*/