更新boot

This commit is contained in:
sunbeam 2024-05-06 10:22:27 +08:00
parent 96b572d62c
commit 6d214b9b3b
24 changed files with 1452 additions and 1821 deletions

View File

@ -22,6 +22,5 @@
<file name="DiagBootcode.aardio" path="user\DiagBootcode.aardio" comment="user\DiagBootcode.aardio"/>
<file name="GeelySecurety.aardio" path="user\GeelySecurety.aardio" comment="user\GeelySecurety.aardio"/>
<file name="S19Decode.aardio" path="user\S19Decode.aardio" comment="user\S19Decode.aardio"/>
<file name="securety.aardio" path="user\securety.aardio" comment="user\securety.aardio"/>
</folder>
</project>

View File

@ -16,7 +16,7 @@ btnReadSw={cls="button";text="读取软件版本号";left=37;top=382;right=136;b
btnTest={cls="button";text="停止";left=149;top=316;right=248;bottom=344;z=11};
cbbChannel={cls="combobox";left=58;top=64;right=191;bottom=90;edge=1;items={};mode="dropdown";z=3};
cbbDev={cls="combobox";left=58;top=27;right=191;bottom=53;edge=1;items={};mode="dropdown";z=1};
checkbox={cls="checkbox";text="CANFD设备";left=151;top=101;right=248;bottom=120;z=21};
checkbox={cls="checkbox";text="CANFD设备";left=151;top=101;right=248;bottom=120;checked=1;z=21};
edFile={cls="richedit";left=8;top=131;right=288;bottom=187;border=1;disabled=1;edge=1;multiline=1;wrap=1;z=14};
edFile2={cls="richedit";left=8;top=213;right=288;bottom=269;border=1;disabled=1;edge=1;multiline=1;wrap=1;z=22};
edit={cls="edit";left=294;top=19;right=596;bottom=401;autovscroll=false;edge=1;multiline=1;vscroll=1;z=5};
@ -207,7 +207,7 @@ mainForm.btnFlash.oncommand = function(id,event){
}
mainForm.btnOpen.oncommand = function(id,event){
::PostThreadMessage(thrdId,104,1,0)//自定义消息-打开文件
::PostThreadMessage(thrdId,104,2,0)//自定义消息-打开文件
}
//程序关闭
@ -232,7 +232,7 @@ mainForm.btnReadF199.oncommand = function(id,event){
}
mainForm.btnOpenFlashdrv.oncommand = function(id,event){
::PostThreadMessage(thrdId,104,0,0)//自定义消息-打开flashdriver
::PostThreadMessage(thrdId,104,1,0)//自定义消息-打开flashdriver
}
var frmChild = win.loadForm("\dlg\诊断子窗口.aardio");
@ -246,7 +246,5 @@ mainForm.btnDiag.oncommand = function(id,event){
thrdHandle,thrdId = thread.create( CanThread )
mainForm.show();
return win.loopMessage();

View File

@ -5,8 +5,8 @@ import win.timer;
CANHw = usb2canfd.USB2CANHW();
CANHw.LoadDll();
DiagReqID = 0x748;//0x18dadff1;
DiagRespID = 0x7C8;//0x18daf1df;
DiagReqID = 0x732;//0x18dadff1;
DiagRespID = 0x7B2;//0x18daf1df;
DiagGloableID = 0x7DF;//0x18DB33F1;
stopflag = 0;
@ -41,11 +41,13 @@ FuncLoopMsg = function(msg){
FuncStopBoot();
}
case 104 {//打开s19文件
if(msg.wParam == 0){
if(msg.wParam == 1){
FuncDisplay("打开FlashDriver");
var ret = FuncOpenS19File(msg.wParam);
if(ret != null){
thread.command.$ShowFlashDrvPath(ret);
var crc32 = FuncGetFlashCRC(1);
FuncDisplay("CRC = " ++ string.format("%X",crc32));
}
}
else {
@ -53,6 +55,8 @@ FuncLoopMsg = function(msg){
var ret = FuncOpenS19File(msg.wParam);
if(ret != null){
thread.command.$ShowPath(ret);
var crc32 = FuncGetFlashCRC(2);
FuncDisplay("CRC = " ++ string.format("%X",crc32));
}
}
@ -200,7 +204,7 @@ var FuncSendPackage = function(){
data[i+1] = table.remove(Packdata);
}
CANHw.SendMsg(PackID,data);
sleep(2);
PackNext += 1;
if(PackNext > 0x2f){
PackNext = 0x20;
@ -277,6 +281,7 @@ timer1.onTimer = function(){
}
}
timer1.enable();
FuncDisplay("正在运行");

View File

@ -42,6 +42,10 @@ FuncReq31 = function(data){
//接收
FuncDiag31Pro = function(data){
//console.dumpJson(data);
if(#data < 3){
//FuncDisplay("31长度错误");
return;
}
var rid = (data[2]<<8) + data[3];
select(rid) {
case 0xFF00 {

View File

@ -30,6 +30,12 @@ FuncWait = function(sid){
return 2;//停止命令
}
bootcount += 1;
/*
if(bootcount > 20 && sid == 0x36){
bootcount = 0;
return 0;
}
*/
if(bootcount >= 400){
FuncDisplay("步骤" + bootstate + "超时 " + tostring(sid,16));
thread.command.$SendEnd(false);
@ -72,6 +78,7 @@ var blocknum = 1;
var alldata_blocknum = 0;
var block_sended = 0;
var sendFlashDriverState = 0;
var FuncSendBlockApp_sendflag = 0;
FuncSendBlockInit = function(id){
var len = 0;
alldata = FuncGetAllData(id);
@ -88,6 +95,8 @@ FuncSendBlockInit = function(id){
alldata_blocknum = len;
block_sended = 0;
sendblockstate = 0;
FuncSendBlockApp_sendflag = 0;
//console.log("发送数据初始化")
return 0;
}
nextstate = function(val){
@ -97,7 +106,7 @@ nextstate = function(val){
block_sended += 1;
}
}
var FuncSendBlockApp_sendflag = 0
FuncSendBlockApp = function(){
select(sendblockstate) {
case 0{
@ -195,7 +204,7 @@ FuncBootSeq = function(){
}
else {
var ret = FuncWait(0x22);
nextstate(ret);
nextstate(0);
}
}
case 1 {
@ -260,7 +269,7 @@ FuncBootSeq = function(){
}
case 7 {
if(sendstate == 0){
FuncReq27(0x11);//解密
FuncReq27(0x09);//解密
FuncClearState();
}
else {
@ -283,12 +292,12 @@ FuncBootSeq = function(){
case 9 {
if(sendstate == 0){
FuncClearState();
FuncDIDWriteStr(0xf198,"Daming ");//写入repair_shopcode
//FuncDIDWriteStr(0xf198,"Daming ");//写入repair_shopcode
}
else {
var ret = FuncWait(0x2E);
nextstate(ret);
//var ret = FuncWait(0x2E);
nextstate(0);
}
}
@ -298,18 +307,18 @@ FuncBootSeq = function(){
var year2 = BCD_Conv(time.now().year%100);
var month = BCD_Conv(time.now().month);
var day = BCD_Conv(time.now().day);
FuncReq2E(0XF199,{year1,year2,month,day})
//FuncReq2E(0XF199,{year1,year2,month,day})
FuncClearState();
//console.log("写入installation_date")
}
else {
var ret = FuncWait(0x2E);
nextstate(ret);
//var ret = FuncWait(0x2E);
nextstate(0);
}
}
case 11 {
if(sendstate == 0){//发送数据
FuncSendBlockInit(0);
FuncSendBlockInit(1);
FuncDisplay("开始发送FlashDrv数据");
FuncClearState();
}
@ -342,7 +351,7 @@ FuncBootSeq = function(){
case 14 {
if(sendstate == 0){//发送数据
FuncSendBlockInit(1);
FuncSendBlockInit(2);
FuncDisplay("开始发送App数据");
FuncClearState();
}

View File

@ -11,18 +11,7 @@ securetyKeyCalc = function(pucSeed,ucSecurityLevel){
seed[4]=pucSeed[1];
select(ucSecurityLevel) {
case 0x01 {
/*
cal[1] = seed[1]^xorArray[1];
cal[2] = seed[2]^xorArray[2];
cal[3] = seed[3]^xorArray[3];
cal[4] = seed[4]^xorArray[4];
key[4] = ((cal[1]&0x0F)<<4)|( cal[1]&0xF0);
key[3] = ((cal[3]&0x0F)<<4)|((cal[4]&0xF0)>>4);
key[2] = (cal[3]&0xF0)|((cal[2]&0xF0)>>4);
key[1] = ((cal[4]&0x0F)<<4)|( cal[2]&0x0F);
*/
var dll = raw.loadDll("/MSW.dll",,"cdecl" );
//
var dll = raw.loadDll("/DM_RP_SA.dll",,"cdecl" );
if(dll != null){
FuncDisplay("加载密钥dll成功");
var retlen = raw.buffer(4,0);
@ -49,27 +38,31 @@ securetyKeyCalc = function(pucSeed,ucSecurityLevel){
}
case 0x03 {
/*
cal.byte[0] = ((seed.byte[0]&0xF8)>>3)^xorArray[0];
cal.byte[1] = ((seed.byte[1]&0xF8)>>3)^xorArray[1];
cal.byte[2] = ((seed.byte[2]&0xF8)>>3)^xorArray[2];
cal.byte[3] = ((seed.byte[3]&0xF8)>>3)^xorArray[3];
key.byte[0] = ((cal.byte[3]&0x07)<<5)|(( cal.byte[0]&0xF8)>>3);
key.byte[1] = ((cal.byte[0]&0x07)<<5)|(cal.byte[2]&0x1F);
key.byte[2] = (cal.byte[1]&0xF8)|((cal.byte[3]&0xE0)>>5);
key.byte[3] = (cal.byte[2]&0xF8)|( cal.byte[1]&0x07);
*/
cal[1] = ((seed[1]&0xF8)>>3)^xorArray[1];
cal[2] = ((seed[2]&0xF8)>>3)^xorArray[2];
cal[3] = ((seed[3]&0xF8)>>3)^xorArray[3];
cal[4] = ((seed[4]&0xF8)>>3)^xorArray[4];
key[1] = ((cal[4]&0x07)<<5)|(( cal[1]&0xF8)>>3);
key[2] = ((cal[0]&0x07)<<5)|(cal[3]&0x1F);
key[3] = (cal[2]&0xF8)|((cal[4]&0xE0)>>5);
key[4] = (cal[3]&0xF8)|( cal[2]&0x07);
case 0x09 {
var dll = raw.loadDll("/DM_RP_SA.dll",,"cdecl" );
if(dll != null){
FuncDisplay("加载密钥dll成功");
var retlen = raw.buffer(4,0);
var seedraw = raw.buffer(4,0);
var iVariant = raw.buffer(20,0);
var keyraw = raw.buffer(4,0);
seedraw[1] = pucSeed[1];
seedraw[2] = pucSeed[2];
seedraw[3] = pucSeed[3];
seedraw[4] = pucSeed[4];
var ret = 0;
ret = dll.GenerateKeyEx(seedraw,4,0x09,iVariant,keyraw,4,retlen);
FuncDisplay("ret = " ++ ret );
key[1] = keyraw[1];
key[2] = keyraw[2];
key[3] = keyraw[3];
key[4] = keyraw[4];
return key;
}
else {
FuncDisplay("加载密钥dll失败");
}
}
case 0x11 {
/*

View File

@ -1,268 +0,0 @@
var g_aes128_cbc_mask =
{
{0x53, 0x57, 0x53, 0x45, 0x4D, 0x33, 0x31, 0x20, 0x20, 0x20, 0x20, 0x20} , //level1
{0x53, 0x57, 0x53, 0x45, 0x4D, 0x33, 0x33, 0x20, 0x20, 0x20, 0x20, 0x20} , //level3
{0x53, 0x57, 0x53, 0x45, 0x4D, 0x33, 0x35, 0x20, 0x20, 0x20, 0x20, 0x20} , //level5
{0x53, 0x57, 0x53, 0x45, 0x4D, 0x33, 0x37, 0x20, 0x20, 0x20, 0x20, 0x20} , //level7
{0x53, 0x57, 0x53, 0x45, 0x4D, 0x33, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20} , //level9
{0x53, 0x57, 0x53, 0x45, 0x4D, 0x33, 0x42, 0x20, 0x20, 0x20, 0x20, 0x20} , //levelb
};
var g_aes128_cbc_encrcon =
{
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39,
0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,
0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b,
0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,
0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35,
0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,
0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63,
0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb
};
var g_aes12_cbc_sbox =
{
/*0 1 2 3 4 5 6 7 8 9 A B C D E F
*/
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
};
var g_dll_Key_str = "56 44 4B 66 62 45 66 61 44 48 33 39 52 61 52 68";
var g_dll_Key = string.map(g_dll_Key_str,"\x\x",lambda(v) tonumber(v,16));
aes128_cbc_make_iv = function(seed,mask){
var ret = {};
for(i=1;4;1){
ret[i] = (seed[i] + 0x55)&0xff;
}
for(i=1;16-4;1){
ret[i+4] = mask[i];
}
return ret;
}
aes128_cbc_pcks7 = function(input,ouputsize){
var l_offset = 0;
var output = {};
if(#input <= ouputsize){
l_offset = ouputsize - #input;
}
for(i=1;#input;1){
output[i] = input[i];
}
for(i=1;l_offset;1){
output[i+#input] = l_offset;
}
return output;
}
aes128_cbc_encrypt_ext = function(iv,plain,key){
var l_out = {};
for(i=1;16;1){
plain[i]=plain[i] ^ iv[i];
}
g_aes128_cbc_enckey_expansion(key);
l_out = g_aes128_cbc_cipher(plain);
return l_out;
}
g_aes12_cbc_roundkey = {};
g_aes128_cbc_enckey_expansion = function(key){
var temp = {0,0,0,0};
for(i=1;16;1){
g_aes12_cbc_roundkey[i] = key[i];
}
for(i=5;(4*11);1){
for(j=1;4;1){
temp[j] = g_aes12_cbc_roundkey[(i-2) * 4 + j]
}
//showtab(temp,string.format("i=%d,temp=",i ));
if((i-1)&0x03 == 0){
var k = temp[1];
temp[1] = temp[2];
temp[2] = temp[3];
temp[3] = temp[4];
temp[4] = k;
//showtab(temp,string.format("i=%d,temp=",i ));
temp[1]=g_aes12_cbc_sbox[temp[1]+1];
temp[2]=g_aes12_cbc_sbox[temp[2]+1];
temp[3]=g_aes12_cbc_sbox[temp[3]+1];
temp[4]=g_aes12_cbc_sbox[temp[4]+1];
temp[1] = temp[1] ^ g_aes128_cbc_encrcon[((i-1)>>2) + 1];
}
g_aes12_cbc_roundkey[(i-1)*4+1] = g_aes12_cbc_roundkey[(i-5)*4+1] ^ temp[1];
g_aes12_cbc_roundkey[(i-1)*4+2] = g_aes12_cbc_roundkey[(i-5)*4+2] ^ temp[2];
g_aes12_cbc_roundkey[(i-1)*4+3] = g_aes12_cbc_roundkey[(i-5)*4+3] ^ temp[3];
g_aes12_cbc_roundkey[(i-1)*4+4] = g_aes12_cbc_roundkey[(i-5)*4+4] ^ temp[4];
}
//showtab(g_aes12_cbc_roundkey,"g_aes12_cbc_roundkey");
}
g_aes12_cbc_state = {{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
g_aes128_cbc_cipher = function(input){
var output = {};
for(i=1;4;1){
for(j=1;4;1){
g_aes12_cbc_state[j][i] = input[(i-1)*4 + j]
}
}
g_aes128_cbc_encadd_roundkey(0);
for(i=1;9;1){
g_aes128_cbc_enc_subbytes();
g_aes128_cbc_shift_rows();
g_aes128_cbc_mix_columns();
g_aes128_cbc_encadd_roundkey(i);
}
g_aes128_cbc_enc_subbytes();
g_aes128_cbc_shift_rows();
g_aes128_cbc_encadd_roundkey(10);
for(i=1;4;1){
for(j=1;4;1){
output[(i-1)*4+j]=g_aes12_cbc_state[j][i];
}
}
return output;
}
g_aes128_cbc_encadd_roundkey = function(round){
for(i=1;4;1){
for(j=1;4;1){
g_aes12_cbc_state[j][i] ^= g_aes12_cbc_roundkey[round * 16 + (i-1) * 4 + j];
}
}
}
g_aes128_cbc_enc_subbytes = function(){
for(i=1;4;1){
for(j=1;4;1){
//console.log("g_aes12_cbc_state[i][j] + 1 = " + (g_aes12_cbc_state[i][j] + 1))
g_aes12_cbc_state[i][j] = g_aes12_cbc_sbox[g_aes12_cbc_state[i][j] + 1];
}
}
}
g_aes128_cbc_shift_rows = function(){
var temp=0;
/* Rotate first row 1 columns to left
*/
temp=g_aes12_cbc_state[2][1];
g_aes12_cbc_state[2][1]=g_aes12_cbc_state[2][2];
g_aes12_cbc_state[2][2]=g_aes12_cbc_state[2][3];
g_aes12_cbc_state[2][3]=g_aes12_cbc_state[2][4];
g_aes12_cbc_state[2][4]=temp;
/* Rotate second row 2 columns to left
*/
temp=g_aes12_cbc_state[3][1];
g_aes12_cbc_state[3][1]=g_aes12_cbc_state[3][3];
g_aes12_cbc_state[3][3]=temp;
temp=g_aes12_cbc_state[3][2];
g_aes12_cbc_state[3][2]=g_aes12_cbc_state[3][4];
g_aes12_cbc_state[3][4]=temp;
/* Rotate third row 3 columns to left
*/
temp=g_aes12_cbc_state[4][1];
g_aes12_cbc_state[4][1]=g_aes12_cbc_state[4][4];
g_aes12_cbc_state[4][4]=g_aes12_cbc_state[4][3];
g_aes12_cbc_state[4][3]=g_aes12_cbc_state[4][2];
g_aes12_cbc_state[4][2]=temp;
}
g_aes128_cbc_mix_columns = function(){
var Tmp,Tm,t;
for(i=1;4;1)
{
t=g_aes12_cbc_state[1][i];
//console.dumpJson(g_aes12_cbc_state)
Tmp = g_aes12_cbc_state[1][i] ^ g_aes12_cbc_state[2][i] ^ g_aes12_cbc_state[3][i] ^ g_aes12_cbc_state[4][i] ;
Tm = g_aes12_cbc_state[1][i] ^ g_aes12_cbc_state[2][i] ;
Tm = AES128_CBC_XTIME(Tm);
g_aes12_cbc_state[1][i] ^= Tm ^ Tmp ;
Tm = g_aes12_cbc_state[2][i] ^ g_aes12_cbc_state[3][i] ;
Tm = AES128_CBC_XTIME(Tm);
g_aes12_cbc_state[2][i] ^= Tm ^ Tmp ;
Tm = g_aes12_cbc_state[3][i] ^ g_aes12_cbc_state[4][i] ;
Tm = AES128_CBC_XTIME(Tm);
g_aes12_cbc_state[3][i] ^= Tm ^ Tmp ;
Tm = g_aes12_cbc_state[4][i] ^ t ;
Tm = AES128_CBC_XTIME(Tm);
g_aes12_cbc_state[4][i] ^= Tm ^ Tmp ;
}
}
AES128_CBC_XTIME = function(x){
var ret = 0;
ret = (x<<1) ^ (((x>>7) & 1) * 0x1b);
return (ret&0xff);
}
showtab = function(tab,name){
var str = name + " = ";
for(k,v in tab){
str = string.format("[%d] = %x",k,v );
}
//console.log(str);
}
g_aes128_seed = {};
g_aes128_cbc_iv = {};
GenerateKeyEx = function(seed,level){
var l_id = 0;
if(level >= 0x01 && level <= 0x0C){
l_id = math.floor((level - 1)/2) + 1 ;
}
g_aes128_seed = {};
g_aes128_cbc_iv = {};
for(i=1;4;1){
g_aes128_seed[i] = seed[i];
}
g_aes128_cbc_iv = aes128_cbc_make_iv(g_aes128_seed,g_aes128_cbc_mask[l_id]);
var l_text = aes128_cbc_pcks7(g_aes128_seed,16);
var l_res = aes128_cbc_encrypt_ext(g_aes128_cbc_iv,l_text,g_dll_Key)
return l_res;
//console.log("l_id = " + l_id)
}

View File

@ -1,6 +1,7 @@
{
"files.associations": {
"uds_service27.h": "c",
"uds.h": "c"
"uds.h": "c",
"uds_user.h": "c"
}
}

View File

@ -68,7 +68,7 @@ void UdsService22_ReadDataByIdentifier(UdsType *obj, const uint8_t msgBuf[], uin
Uds_NegativeResponse(obj, 0x22, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT);
return;
}
rspBuffer[rspLen++] = UDS_GET_POSITIVE_RSP(0x22);
for(msgPos = 1; msgPos < msgLen; msgPos += 2)
@ -97,7 +97,7 @@ void UdsService22_ReadDataByIdentifier(UdsType *obj, const uint8_t msgBuf[], uin
Uds_NegativeResponse(obj, 0x22, NRC_CONDITIONS_NOT_CORRECT);
return;
}
obj->didTable[didIdx].function(obj, obj->didTable[didIdx].pBytes, obj->didTable[didIdx].length);
findDid = true;
rspBuffer[rspLen++] = msgBuf[msgPos];
rspBuffer[rspLen++] = msgBuf[msgPos + 1];

View File

@ -1,113 +0,0 @@
/*
** ###################################################################
** Processor: CVM0146
** Compiler: IAR ANSI C/C++ Compiler for ARM
**
** Abstract:
** Linker file for the IAR ANSI C/C++ Compiler for ARM
**
** Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD
** All rights reserved.
**
** Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use
** exclusively with CVA's microcontroller products. This file can be freely
** distributed within development tools that are supporting such microcontroller
** products.
**
** THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
** OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
** CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
** OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
**
** http: www.cvachip.com
**
** ###################################################################
*/
/* If symbol __flash_vector_table__=1 is defined at link time
* the interrupt vector will not be copied to RAM.
* Warning: Using the interrupt vector from FLASH will not allow
* INT_SYS_InstallHandler because the section is Read Only.
*/
define symbol __ram_vector_table_size__ = isdefinedsymbol(__flash_vector_table__) ? 0 : 0x00000400;
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__flash_vector_table__) ? 0 : 0x000003FF;
/* Flash */
define symbol m_interrupts_start = 0x00000000;
define symbol m_interrupts_end = 0x000003FF;
define symbol m_text_start = 0x00000400;
define symbol m_text_end = 0x000FFFFF;
/* SRAM_L */
define symbol m_interrupts_ram_start = 0x1FFF0000;
define symbol m_interrupts_ram_end = 0x1FFF0000 + __ram_vector_table_offset__;
define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
define symbol m_data_end = 0x1FFFFFFF;
/* SRAM_U */
define symbol m_data_2_start = 0x20000000;
define symbol m_data_2_end = 0x2000EFFF;
/* Sizes */
if (isdefinedsymbol(__stack_size__)) {
define symbol __size_cstack__ = __stack_size__;
} else {
define symbol __size_cstack__ = 0x00000800;
}
if (isdefinedsymbol(__heap_size__)) {
define symbol __size_heap__ = __heap_size__;
} else {
define symbol __size_heap__ = 0x00000100;
}
define exported symbol __VECTOR_TABLE = m_interrupts_start;
define exported symbol __VECTOR_RAM = isdefinedsymbol(__flash_vector_table__) ? m_interrupts_start : m_interrupts_ram_start;
define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__;
define exported symbol __RAM_START = m_interrupts_ram_start;
define exported symbol __RAM_END = m_data_2_end;
define memory mem with size = 4G;
define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end]
| mem:[from m_text_start to m_text_end];
define region DATA_region = mem:[from m_data_start to m_data_end];
define region DATA_region_2 = mem:[from m_data_2_start to m_data_2_end-__size_cstack__];
define region CSTACK_region = mem:[from m_data_2_end-__size_cstack__+1 to m_data_2_end];
define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end];
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block RW { readwrite };
define block ZI { zi };
/* Custom Section Block that can be used to place data at absolute address. */
/* Use __attribute__((section (".customSection"))) to place data here. */
define block customSectionBlock { section .customSection };
define block __CODE_ROM { section .textrw_init };
define block __CODE_RAM { section .textrw };
initialize manually { section .textrw };
initialize manually { section .bss };
initialize manually { section .customSection };
initialize manually { section .data };
initialize manually { section __DLIB_PERTHREAD };
do not initialize { section .noinit, section .bss, section .data, section __DLIB_PERTHREAD, section .customSection };
place at address mem: m_interrupts_start { readonly section .intvec };
place in TEXT_region { readonly };
place in TEXT_region { block __CODE_ROM };
place in DATA_region { block RW };
place in DATA_region { block __CODE_RAM };
place in DATA_region_2 { first block customSectionBlock };
place in DATA_region_2 { block ZI };
place in DATA_region_2 { last block HEAP };
place in CSTACK_region { block CSTACK };
place in m_interrupts_ram_region { section m_interrupts_ram };

View File

@ -1,91 +0,0 @@
/*
** ###################################################################
** Processor: CVM0146
** Compiler: IAR ANSI C/C++ Compiler for ARM
**
** Abstract:
** Linker file for the IAR ANSI C/C++ Compiler for ARM
**
** Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD
** All rights reserved.
**
** Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use
** exclusively with CVA's microcontroller products. This file can be freely
** distributed within development tools that are supporting such microcontroller
** products.
**
** THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
** OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
** CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
** OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
**
** http: www.cvachip.com
**
** ###################################################################
*/
/* SRAM_L */
define symbol m_interrupts_start = 0x1FFF0000;
define symbol m_interrupts_end = 0x1FFF03FF;
define symbol m_text_start = 0x1FFF0400;
define symbol m_text_end = 0x1FFFFFFF;
/* SRAM_U */
define symbol m_data_start = 0x20000000;
define symbol m_data_end = 0x2000EFFF;
/* Sizes */
if (isdefinedsymbol(__stack_size__)) {
define symbol __size_cstack__ = __stack_size__;
} else {
define symbol __size_cstack__ = 0x00000400;
}
if (isdefinedsymbol(__heap_size__)) {
define symbol __size_heap__ = __heap_size__;
} else {
define symbol __size_heap__ = 0x00000400;
}
define exported symbol __VECTOR_TABLE = m_interrupts_start;
define exported symbol __VECTOR_RAM = m_interrupts_start;
define exported symbol __RAM_VECTOR_TABLE_SIZE = 0x0;
define exported symbol __RAM_START = m_interrupts_start;
define exported symbol __RAM_END = m_data_end;
define memory mem with size = 4G;
define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end]
| mem:[from m_text_start to m_text_end];
define region DATA_region = mem:[from m_data_start to m_data_end-__size_cstack__];
define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_end];
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block RW { readwrite };
define block ZI { zi };
/* Custom Section Block that can be used to place data at absolute address. */
/* Use __attribute__((section (".customSection"))) to place data here. */
define block customSectionBlock { section .customSection };
define block __CODE_RAM { section .textrw };
define block __CODE_ROM { section .textrw_init };
initialize manually { section .bss };
initialize manually { section .customSection };
initialize manually { section .textrw };
initialize manually { section __DLIB_PERTHREAD };
do not initialize { section .noinit, section .bss, section __DLIB_PERTHREAD, section .customSection };
place at address mem: m_interrupts_start { readonly section .intvec };
place in TEXT_region { readonly };
place in TEXT_region { block __CODE_ROM };
place in DATA_region { first block customSectionBlock };
place in DATA_region { block RW };
place in DATA_region { block __CODE_RAM };
place in DATA_region { block ZI };
place in DATA_region { last block HEAP };
place in CSTACK_region { block CSTACK };

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,7 @@
</option>
<option>
<name>OGChipSelectEditMenu</name>
<state>CVM0146 CVM0146</state>
<state>CVM0144 CVM0144</state>
</option>
<option>
<name>GenLowLevelInterface</name>
@ -138,7 +138,7 @@
</option>
<option>
<name>GFPUDeviceSlave</name>
<state>CVM0146 CVM0146</state>
<state>CVM0144 CVM0144</state>
</option>
<option>
<name>FPU2</name>
@ -220,7 +220,7 @@
<debug>1</debug>
<option>
<name>CCDefines</name>
<state>MCU_CVM0146FMLQ</state>
<state>MCU_CVM0144FMLH</state>
</option>
<option>
<name>CCPreprocFile</name>

View File

@ -6,11 +6,11 @@
"-p"
"E:\IAR Systems\Embedded Workbench 8.3\arm\CONFIG\debugger\CVAChip\CVM0146.ddf"
"E:\IAR Systems\Embedded Workbench 8.3\arm\CONFIG\debugger\CVAChip\CVM0144.ddf"
"--semihosting"
"--device=CVM0146"
"--device=CVM0144"
"--drv_communication=USB0"

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
</JLinkDriver>
<DebugChecksum>
<Checksum>1667639413</Checksum>
<Checksum>2109377255</Checksum>
</DebugChecksum>
<Trace1>
<Enabled>0</Enabled>
@ -59,18 +59,9 @@
<ITMportsLogFile>0</ITMportsLogFile>
<ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile>
</SWOTraceHWSettings>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>1</Mode>
<Graph>0</Graph>
<Symbiont>0</Symbiont>
</DriverProfiling>
<CallStackLog>
<Enabled>0</Enabled>
</CallStackLog>
<CallStackStripe>
<ShowTiming>1</ShowTiming>
</CallStackStripe>
<array_types>
<Fmt0>uint8_t[2056] 4 0</Fmt0>
</array_types>
<Trace2>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
@ -125,12 +116,6 @@
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</EventLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
@ -140,13 +125,32 @@
<LogFile>_ ""</LogFile>
<Category>_ 0</Category>
</LogFile>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>1</Mode>
<Graph>0</Graph>
<Symbiont>0</Symbiont>
</DriverProfiling>
<CallStackLog>
<Enabled>0</Enabled>
</CallStackLog>
<CallStackStripe>
<ShowTiming>1</ShowTiming>
</CallStackStripe>
<PowerProbe>
<Frequency>10000</Frequency>
<Probe0>I0</Probe0>
<ProbeSetup0>2 1 1 2 0 0</ProbeSetup0>
</PowerProbe>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Bp0>_ 0 "EMUL_CODE" "0x00002C66" 0 0 1 "" 0 "" 0</Bp0>
<Count>1</Count>
</Breakpoints2>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
</settings>

File diff suppressed because one or more lines are too long

View File

@ -817,18 +817,20 @@ int main(void)
//FlexCanBoot_TxMessage(UDS_TEXT_TX_MSG_ID,testdata,8);
}
/* Handler user routine */
if(FlexCanBoot_ReadoutMsg(&rxMsg) == true)
{
if((rxMsg.id == UDS_PHYS_RECV_MSG_ID) || (rxMsg.id == UDS_FUNC_RECV_MSG_ID))
{
IsoTp_HandleIncomingCanMsg(&udsObj.isotp, rxMsg.id, rxMsg.data, rxMsg.len);
}
}
Bootloader_TimingProcess(1);
Uds_Run(&udsObj);
Bootloader_StateProc();
}
/* Handler user routine */
if(FlexCanBoot_ReadoutMsg(&rxMsg) == true)
{
if((rxMsg.id == UDS_PHYS_RECV_MSG_ID) || (rxMsg.id == UDS_FUNC_RECV_MSG_ID))
{
IsoTp_HandleIncomingCanMsg(&udsObj.isotp, rxMsg.id, rxMsg.data, rxMsg.len);
}
}
}
}

View File

@ -119,6 +119,8 @@
#define IsoTp_SetFCStmin(byte, STmin) (byte[2] = STmin)
#define IsoTp_GetFCStmin(byte) (byte[2])
#define TP_DUMMY 0xCC
/*******************************************************************************
* the typedefs
******************************************************************************/
@ -242,8 +244,9 @@ static int8_t IsoTp_SendSingleFrame(IsoTpType *obj)
/* All pad with 0 */
for(i = 0; i < 7 - obj->sendSize; ++i)
{
msg.byte[i + obj->sendSize + 1] = 0;
msg.byte[i + obj->sendSize + 1] = TP_DUMMY;
}
ret = obj->sendCanMsg(obj->sendArbitrationId, msg.byte, 8);
}
else
@ -306,7 +309,7 @@ static int8_t IsoTp_SendConsecutiveFrame(IsoTpType *obj)
uint8_t i = 0;
for(i = 0; i < 7 - dataLength; ++i)
{
msg.byte[i + 1 + dataLength] = 0;
msg.byte[i + 1 + dataLength] = TP_DUMMY;
}
ret = obj->sendCanMsg(obj->sendArbitrationId, msg.byte, 8);
}

View File

@ -85,7 +85,7 @@ extern "C" {
#define BYTES_OF(x) (sizeof(x) / sizeof(uint8_t))
#define UDS_RSP_LEN_MAX (512)
#define UDS_RSP_LEN_MAX (64)
/* DID type */
#define UDS_VAR_TYPE_NONVOL_STORAGE (1 << 0) /* set if non-volatile data */
@ -100,6 +100,12 @@ extern "C" {
* the typedefs
******************************************************************************/
/*! \brief Forward declaration of UDS object
*/
struct _UdsType_;
typedef struct _UdsType_ UdsType;
/*! \brief The Data-by-ID definition of UDS
*/
typedef struct _Uds_DidType_
@ -110,16 +116,13 @@ typedef struct _Uds_DidType_
uint8_t securityLevel;
uint8_t *pBytes;
uint16_t length;
void (*function)(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
} Uds_DidType;
/*! \brief The definition of UDS DID table
*/
typedef Uds_DidType *Uds_DidTable;
/*! \brief Forward declaration of UDS object
*/
struct _UdsType_;
typedef struct _UdsType_ UdsType;
/*! \brief UDS service definition
*/

View File

@ -89,10 +89,10 @@ static void Routine_ResultVerifyDataDependency(const uint8_t *pdata, uint16_t le
******************************************************************************/
Uds_RtnCtrl udsRtnCtrlTable[] = {
{RID_ERASE_MEMORY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartEreaseMemory, &Routine_StopEreaseMemory, &Routine_ResultEreaseMemory },
{RID_CHECK_FLSDRV_VALID, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartCheckFlsDriverValid, &Routine_StopCheckFlsDriverValid, &Routine_ResultCheckFlsDriverValid },
{RID_CHECK_DATA_VALIDITY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartValidityData, &Routine_StopValidityData, &Routine_ResultValidityData },
{RID_CHECK_DATA_DEPENDENCE, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_1, UDS_RTN_ST_IDLE, &Routine_StartVerifyDataDependency, &Routine_StopVerifyDataDependency, &Routine_ResultVerifyDataDependency},
{RID_ERASE_MEMORY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartEreaseMemory, &Routine_StopEreaseMemory, &Routine_ResultEreaseMemory },
{RID_CHECK_FLSDRV_VALID, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartCheckFlsDriverValid, &Routine_StopCheckFlsDriverValid, &Routine_ResultCheckFlsDriverValid },
{RID_CHECK_DATA_VALIDITY, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartValidityData, &Routine_StopValidityData, &Routine_ResultValidityData },
{RID_CHECK_DATA_DEPENDENCE, UDS_SESSION_PROGRAMMING, UDS_SA_LEVEL_09, UDS_RTN_ST_IDLE, &Routine_StartVerifyDataDependency, &Routine_StopVerifyDataDependency, &Routine_ResultVerifyDataDependency},
};
/*******************************************************************************

View File

@ -95,6 +95,7 @@ uint32_t Uds_GetRcvDataTotalLen(void)
void UdsService36_TransferData(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen)
{
uint8_t rspBuffer[10] = {0};
if(obj->session == UDS_SESSION_DEFAULT)
{
Uds_NegativeResponse(obj, 0x36, NRC_CONDITIONS_NOT_CORRECT);
@ -132,6 +133,10 @@ void UdsService36_TransferData(UdsType *obj, const uint8_t msgBuf[], uint16_t ms
}
s_lastRcvSqunce = s_curRcvSequence;
rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x36);
rspBuffer[1] = s_curRcvSequence;
Uds_PositiveResponse(obj, rspBuffer, 2);
}
break;
case UDS_TRANSFER_DIR_UPLOAD:

View File

@ -32,7 +32,10 @@
*/
typedef struct _Uds_DidBuffer_
{
uint8_t buffer_F113[4];
uint8_t buffer_F186[1];
uint8_t buffer_F180[4];
uint8_t buffer_F193[4];
uint8_t buffer_F195[8];
} Uds_DidBuffer;
/*******************************************************************************
@ -82,7 +85,10 @@ static const bool udsSecurityTable[UDS_SERVICE_NUM][UDS_SA_LEVEL_NUM] = {
};
Uds_DidType udsDidTable[] = {
{0xF113, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F113, BYTES_OF(udsDidBuf.buffer_F113)},
{0xF186, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F186, BYTES_OF(udsDidBuf.buffer_F186),DID_F186_func},
{0xF180, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F180, BYTES_OF(udsDidBuf.buffer_F180),DID_F180_func},
{0xF193, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F193, BYTES_OF(udsDidBuf.buffer_F193),DID_F193_func},
{0xF195, UDS_DID_TYPE_RAM_RW, UDS_SESSION_DEFAULT, UDS_SA_NONE, udsDidBuf.buffer_F195, BYTES_OF(udsDidBuf.buffer_F195),DID_F195_func},
};
/*******************************************************************************
@ -99,3 +105,23 @@ void Uds_UserInit(UdsType *obj, const Uds_ParamsType *pParams)
obj->didTable = udsDidTable;
obj->didNum = sizeof(udsDidTable) / sizeof(Uds_DidType);
}
/******************************DID FUNC****************************************/
void DID_F180_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
uint8_t * pdata;
pdata = (uint8_t *)0x0000400;
memcpy(dataBuf, pdata, dataLen);
}
void DID_F186_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
dataBuf[0] = obj->session;
}
void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
}
void DID_F195_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen)
{
}

View File

@ -69,6 +69,11 @@ extern "C" {
*/
extern void Uds_UserInit(UdsType *obj, const Uds_ParamsType *pParams);
extern void DID_F180_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
extern void DID_F186_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
extern void DID_F193_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
extern void DID_F195_func(UdsType *obj,uint8_t dataBuf[], uint8_t dataLen);
#ifdef __cplusplus
}
#endif /* extern "C" */