This commit is contained in:
sunbeam 2024-05-23 20:06:34 +08:00
parent eea1f07eb2
commit d5aa8c6d59
117 changed files with 5627 additions and 35366 deletions

BIN
CAN_Bootloader/MSW.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,24 +1,28 @@
import win.ui;
/*DSG{{*/
var winform = win.form(text="诊断读取";right=679;bottom=319;border="thin";max=false;mode="popup")
var winform = win.form(text="诊断读取";right=679;bottom=499;border="thin";max=false;mode="popup")
winform.add(
btnDID_1701={cls="button";text="电机当前位置霍尔数";left=36;top=162;right=163;bottom=193;z=5};
btnDID_1702={cls="button";text="软止点位置霍尔数";left=36;top=203;right=163;bottom=234;z=6};
btnDID_1706={cls="button";text="软止点学习状态";left=178;top=40;right=305;bottom=71;z=7};
btnDID_1707={cls="button";text="座椅电机电流";left=178;top=80;right=305;bottom=111;z=8};
btnDID_1708={cls="button";text="模块输入信号状态";left=178;top=121;right=305;bottom=152;z=9};
btnDID_1709={cls="button";text="模块输出信号状态";left=178;top=162;right=305;bottom=193;z=11};
btnDID_170B={cls="button";text="系统供电电压";left=178;top=203;right=305;bottom=234;z=10};
btnDID_F187={cls="button";text="车辆备用零部件编号";left=36;top=40;right=163;bottom=71;z=2};
btnDID_F18A={cls="button";text="供应商公司名称代码";left=36;top=80;right=163;bottom=111;z=3};
btnDID_F010={cls="button";text="F010";left=178;top=162;right=305;bottom=193;z=11};
btnDID_F010w={cls="button";text="写F010";left=336;top=296;right=463;bottom=327;z=16};
btnDID_F101={cls="button";text="F101";left=178;top=203;right=305;bottom=234;z=10};
btnDID_F101w={cls="button";text="写F101";left=338;top=335;right=458;bottom=366;z=15};
btnDID_F159={cls="button";text="F159";left=36;top=162;right=163;bottom=193;z=5};
btnDID_F15A={cls="button";text="F15A";left=36;top=203;right=163;bottom=234;z=6};
btnDID_F180={cls="button";text="F180";left=178;top=40;right=305;bottom=71;z=7};
btnDID_F187={cls="button";text="零部件编号";left=36;top=40;right=163;bottom=71;z=2};
btnDID_F18A={cls="button";text="供应商名称";left=36;top=80;right=163;bottom=111;z=3};
btnDID_F18C={cls="button";text="F18C";left=178;top=80;right=305;bottom=111;z=8};
btnDID_F190={cls="button";text="F190 VIN";left=178;top=121;right=305;bottom=152;z=9};
btnDID_F197={cls="button";text="ECU 系统名称";left=36;top=121;right=163;bottom=152;z=4};
btn_1003={cls="button";text="扩展会话";left=22;top=296;right=126;bottom=323;z=14};
btn_2701={cls="button";text="解锁";left=158;top=296;right=262;bottom=323;z=13};
groupbox={cls="groupbox";text="DID";left=16;top=12;right=328;bottom=260;edge=1;z=1};
groupbox2={cls="groupbox";text="DTC";left=343;top=12;right=655;bottom=260;edge=1;z=12}
)
/*}}*/
winform.btnDID_F187.oncommand = function(id,event){
DiagReadDID(0xF187);
winform.btnDID_F180.oncommand = function(id,event){
DiagReadDID(0xF180);
}
winform.btnDID_F18A.oncommand = function(id,event){
@ -29,32 +33,28 @@ winform.btnDID_F197.oncommand = function(id,event){
DiagReadDID(0xF197);
}
winform.btnDID_1701.oncommand = function(id,event){
DiagReadDID(0x1701);
winform.btnDID_F159.oncommand = function(id,event){
DiagReadDID(0xF159);
}
winform.btnDID_1702.oncommand = function(id,event){
DiagReadDID(0x1702);
winform.btnDID_F15A.oncommand = function(id,event){
DiagReadDID(0xF15A);
}
winform.btnDID_1706.oncommand = function(id,event){
DiagReadDID(0x1706);
winform.btnDID_F18C.oncommand = function(id,event){
DiagReadDID(0xF18C);
}
winform.btnDID_1707.oncommand = function(id,event){
DiagReadDID(0x1707);
winform.btnDID_F190.oncommand = function(id,event){
DiagReadDID(0xF190);
}
winform.btnDID_1708.oncommand = function(id,event){
DiagReadDID(0x1708);
winform.btnDID_F010.oncommand = function(id,event){
DiagReadDID(0xF010);
}
winform.btnDID_1709.oncommand = function(id,event){
DiagReadDID(0x1709);
}
winform.btnDID_170B.oncommand = function(id,event){
DiagReadDID(0x170B);
winform.btnDID_F101.oncommand = function(id,event){
DiagReadDID(0xF101);
}
winform.onClose = function(hwnd,message,wParam,lParam){
@ -62,6 +62,26 @@ winform.onClose = function(hwnd,message,wParam,lParam){
return 0;
}
winform.btn_2701.oncommand = function(id,event){
::PostThreadMessage(thrdId,114,0x01,0)//自定义消息
}
winform.btn_1003.oncommand = function(id,event){
::PostThreadMessage(thrdId,111,0x00,0x03)//自定义消息
}
winform.btnDID_F187.oncommand = function(id,event){
DiagReadDID(0xF187);
}
winform.btnDID_F010w.oncommand = function(id,event){
::PostThreadMessage(thrdId,115,0xF010,0x00)//自定义消息
}
winform.btnDID_F101w.oncommand = function(id,event){
::PostThreadMessage(thrdId,115,0xF101,0x00)//自定义消息
}
winform.show();
win.loopMessage();
return winform;

View File

@ -137,7 +137,7 @@ namespace usb2canfd{
//加载DLL
LoadDll = function(){
try{
DllHandle = ..raw.loadDll("USB2XXX.dll")
DllHandle = ..raw.loadDll("\USB2XXX.dll")
}
catch(err)
{

View File

@ -25,7 +25,7 @@ static={cls="static";text="设备";left=1;top=28;right=61;bottom=52;align="cente
static2={cls="static";text="通道";left=1;top=66;right=61;bottom=90;align="center";center=1;transparent=1;z=7};
static3={cls="static";text="刷写进度";left=296;top=409;right=349;bottom=429;transparent=1;z=16};
static4={cls="static";text="烧录APP";left=13;top=108;right=85;bottom=132;center=1;transparent=1;z=17};
static5={cls="static";text="V0.1_20220707";left=451;top=1;right=595;bottom=17;align="right";center=1;transparent=1;z=18};
static5={cls="static";text="V0.1_20220518";left=451;top=1;right=595;bottom=17;align="right";center=1;transparent=1;z=18};
static6={cls="static";text="FlashDriver";left=13;top=195;right=101;bottom=218;transparent=1;z=23}
)
/*}}*/
@ -163,12 +163,12 @@ var DiagStopReq = function(){
}
mainForm.btnReadSw.oncommand = function(id,event){
DiagReadDID(0xF188);
DiagReadDID(0xF195);
}
mainForm.btnReadHw.oncommand = function(id,event){
DiagReadDID(0xF191);
DiagReadDID(0xF193);
}
mainForm.btnReadF186.oncommand = function(id,event){

View File

@ -9,6 +9,20 @@ DiagReqID = 0x751;//0x18dadff1;
DiagRespID = 0x759;//0x18daf1df;
DiagGloableID = 0x7DF;//0x18DB33F1;
stopflag = 0;
write2Etest = function(did){
select(did) {
case 0xF010 {
var data = {1,2,3,4, 0,0,0,0, 0,0,0,0, 0,0,0,0,};
FuncReq2E(did,data);
}
case 0xF101 {
var data = {1,2,3,4, 0,0,0,0, };
FuncReq2E(did,data);
}
}
}
//注册一个消息钩子函数
FuncLoopMsg = function(msg){
select(msg.message) {
@ -51,7 +65,7 @@ FuncLoopMsg = function(msg){
FuncReadDID(msg.wParam);
}
case 111 {
FuncReq10(msg.wParam);
FuncReq10(msg.wParam,msg.lParam);
}
case 112 {
FuncReq28(msg.wParam);
@ -62,8 +76,11 @@ FuncLoopMsg = function(msg){
case 114 {
FuncReq27(msg.wParam);
}
case 115 {
write2Etest(msg.wParam)
}
else {
}
}
}

View File

@ -23,11 +23,11 @@ FuncDiag22Pro = function(data){
case 0xF186 {
FuncDisplay("当前会话: " + data[3]);
}
case 0xF191 {
case 0xF193 {
FuncDisplay("硬件版本号");
FuncDisplay(string.pack(table.slice(data,3)));
}
case 0xF188 {
case 0xF195 {
FuncDisplay("软件版本号");
FuncDisplay(string.pack(table.slice(data,3)));
}

View File

@ -224,8 +224,8 @@ FuncBootSeq = function(){
FuncClearState();
}
else {
var ret = FuncWait(0x10);
nextstate(ret);
//var ret = FuncWait(0x10);
nextstate(0);
}
}
case 4 {
@ -234,8 +234,8 @@ FuncBootSeq = function(){
FuncClearState();
}
else {
var ret = FuncWait(0x85);
nextstate(ret);
//var ret = FuncWait(0x85);
nextstate(0);
}
}
case 5 {
@ -244,8 +244,8 @@ FuncBootSeq = function(){
FuncClearState();
}
else {
var ret = FuncWait(0x28);
nextstate(ret);
//var ret = FuncWait(0x28);
nextstate(0);
}
}
case 6 {

View File

@ -11,20 +11,43 @@ 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[3] = ((cal[0]&0x0F)<<4)|( cal[0]&0xF0);
key[2] = ((cal[2]&0x0F)<<4)|((cal[3]&0xF0)>>4);
key[1] = (cal[2]&0xF0)|((cal[1]&0xF0)>>4);
key[0] = ((cal[3]&0x0F)<<4)|( cal[1]&0x0F);
*/
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" );
//
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,0x01,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 0x03 {
/*

File diff suppressed because it is too large Load Diff

38
ECU_APP/OutPut/FlsDrv.s19 Normal file
View File

@ -0,0 +1,38 @@
S01100000000486578766965772056312E3009
S32500005A010102214E34FC0F009BFC0F00ADFC0F002CFD0F0071109008D70071189008D70050
S32500005A21C7C5C3C1712090088EFDC1410F36B4FA32B4FB34800A11ABB9A7A7A5A51743DFC1
S32500005A41F5C09EFDC0C2C4C6D700C7C5C3C1713090088EFDC1410F36B4FB3234FC34800B21
S32500005A61EED3FF00C7C5C3C1721516348008F6B9A5A53544C00835DFF68EFDC1629EFD3138
S32500005A8182A13DF1114E0261E8710091089F0308114E0061E8E19F010830800814BF040888
S32500005AA1118C0199410E114FE8FFDC1411F9E9FF6142DC0C5200FCF8FF0E71009008EF0258
S32500005AC15205C09EFDC062C2C4C6D7FFC35204EF0DC35200EF08C35202EF03C35206FE275F
S32500005AE10061F8EC800A0F511FC2D700C151FF500FEF1AC151475007EF13C151475007EFEE
S32500005B010CC151475047EF05C151F750075F90086148C0D7C7C5C18EFC758EFD74CEFC0FD3
S32500005B2169740B61CBFCC4080F624CFFDD4771489008717890088F9008315539510F9EFCF0
S32500005B41AF920861CB5203EF065206EF025208A80016410E11AFE6FF47DC1817312D9F02D9
S32500005B6108609F0108F50008F50308300004BF0608EF655205659EFC649EFDC062C4C6C2F9
S32500005B81D7A800168C00708C01BF04088C025C03DFE18C05D1DFDC8C06D1DDD74C41DED3F6
S32500005BA170F1312DBF0608B1B1C5148C02708C03BF000805358C049F02081C003516157064
S32500005BC1C4DCB0410E66113FDFFF67113FE0FF60113FE1FFDE9D520413FCF8FF0E624CFFD3
S32500005BE1DF938F910831031071409008604C0361F871709008EE7DFFFCC4080FEFDF0000E7
S32500005C010000000000000000B10AB50AB90AED0A910A0000C7C5C18EFC758EFD74CEFC0F8A
S32500005C2169F80B61CB308008BF04085210FCF8FF0ED2DF14635F80089F8008635C0161E8A0
S32500005C41710080085211EF1271589008659EFC649EFDC062C4C6C2D75213FCF8FF0E624C28
S32500005C61FFDF0C8F910831031571409008EFDD8F90083155D7510F9EFCAF920861CBFCC4FA
S32500005C81080FEFDA0000000000000000910BC40B00000000C1201414C80A0F8A2198008AFB
S32500005CA12298018A2398023024FAB808CEFC0FAEF8143624FA510F61FA9803D1DF3030D4AC
S32500005CC1F9B804C8060FCEFC0F36D4F961FACEFC0F30E0F9B810C8120F36E0F961FACEFC2D
S32500005CE10F300AFAB80CC80E0F360AFA61FAA814148803705110BA041016D7C1CEFC0F3665
S32500005D01DAF961FAC4C5300020BA04C6D7C1200814AA0E12316CAA0C1631AE0360980117F8
S32500005D215C036168DD058801819801AA0A12316CAA0831AE03609803F198008801708800B3
S32500005D416148DD45150414001615041200148B9EFCA91661FA3091FAB804C8060FCEFC0F83
S32500005D61C0C188036108318E3691FA61FA9802D1DF0DA80814300030BA04880081EFBAA839
S32500005D8108148802705130BA04100AD7C12012148A085C0361E8EEB000AA10B804B806AAF9
S32500005DA10AB800AA08B802B808A800B80AAA0E16440000AA0C1261F8440001DC250400FF08
S32500005DC1BA0C1761C8B1BA0EC80C40A804040001BA10A802040001BA08A80061D8A1BA0AF7
S32500005DE1EF191731ED1613312E0716625C03DD0317A11666980CF6BA0EBA0C15041400167A
S32500005E0115041200148B9EFCA91661FA309BFAB80EC8100FCEFC0F369BFAAEF804060061D6
S32500005E21FA9800D1DF1AA81214300040BA04AA0E6168AA0C61F8616861E8EE5CFF1014D71D
S32500005E41A81214C0C15140EF03300540BA04EFEDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6A
S32500005E61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3B
S705FFFFFFFFFE

File diff suppressed because it is too large Load Diff

View File

@ -912,7 +912,7 @@ S3150000D8968F289C9A08118F299C9A09E1D7E1D7E12E
S3150000D8A6D7C1FC2CC100734C01DF07C4C5CA0001F1
S3150000D8B6EF144C02DF07C4C5CA0002EF094C04DFA9
S3150000D8C605C4C5CA000383E161F8F1C2D714E1CAEB
S3150000D8D60061CA010ACA0231CA0332CA0433CA053A
S3150000D8D60061CA010BCA0231CA0332CA0433CA0539
S3150000D8E600CA0630CA0730CA0830D714CA0043CA67
S3150000D8F60134CA0230CA0320CA0420CA0520CA0651
S3150000D90620CA0720CA0820CA0920CA0A20CA0B202C
@ -1303,7 +1303,7 @@ S3150000F10680F0DD0D9F80F0D1DF07340603A95CFC95
S3150000F116B9D7D7148F7EF099D7C1C3C664318EA1ED
S3150000F12604FFFF12DD0BC4C58B99A7A5C0C513EF57
S3150000F136EFC0D7540832B4F0308AF0EFDC71230101
S3150000F146511F5F85F09F85F0302002BF82F0AF84A5
S3150000F146511F5F85F09F85F0300101BF82F0AF84C5
S3150000F156F0F05CE0BF84F051806F89F05C8F9F8988
S3150000F166F0AF88F0F05CF0BF88F0F6BF86F0540882
S3150000F17632B4F0308AF0EFA1D7FCF5EC00F6BF4EBC
@ -4038,7 +4038,7 @@ S31500019BD0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8E
S31500019BE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E
S31500019BF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6E
S31500019C0048573031303020202020202020202020AD
S31500019C103031170718003031202020202020202045
S31500019C1030313031202020202020202020202020FB
S31500019C20171A000B000017071820202020202020DB
S31500019C30FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2D
S31500019C40FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1D

View File

@ -1,9 +1,80 @@
QualityReport
2024年5月23日 13:59:33
2024年5月23日 19:59:11
------ Start build(ECU_APP, DefaultBuild) ------
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_timer_user.c r_cg_adc_user.c -cpu=S3 -obj_path=DefaultBuild "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10BBG.DVF" -g -g_line -I diagnose\DTC -I diagnose\CanTrcv -I sys -I . -I rscan_driver -I diagnose -I DataFlash -I CanNw -I diagnose\CanTp -I diagnose\CanIf -I user -D DEBUG1 -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe rscan_driver\r_rl78_can_irq.c r_main.c r_cg_timer_user.c CanNw\CanNw.c CanNw\CanNwConfig.c diagnose\Dcm_App.c diagnose\Dcm_App_Cfg.c diagnose\Dcm_Cfg.c diagnose\Dcm_DID_Cfg.c diagnose\extern.c diagnose\CanIf\CanIf_Cfg.c diagnose\CanTp\CanTp_Cfg.c diagnose\DTC\DCM_DTC.c diagnose\Dcm.c diagnose\CanTp\CanTp.c user\appTask.c user\can_user.c user\hwCtrl.c -cpu=S3 -obj_path=DefaultBuild "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10BBG.DVF" -g -g_line -I diagnose\DTC -I diagnose\CanTrcv -I sys -I . -I rscan_driver -I diagnose -I DataFlash -I CanNw -I diagnose\CanTp -I diagnose\CanIf -I user -D DEBUG1 -c -msg_lang=english
r_main.c(134):W0523076:Function declarations should have prototype
r_cg_timer_user.c(141):W0520167:Argument of type "uint16_t __near *" is incompatible with parameter of type "unsigned int *__near"
diagnose\Dcm_App.c(296):W0520549:Variable "DcmResetDelay" is used before its value is set
diagnose\Dcm_App.c(320):W0520177:Variable "ResetDelayCnt" was declared but never referenced
diagnose\Dcm_App.c(470):W0520177:Variable "ResetDelayCnt" was declared but never referenced
diagnose\Dcm_App.c(899):W0520549:Variable "LeDcm_u_Result" is used before its value is set
diagnose\Dcm_App.c(966):W0520549:Variable "LeDcm_u_Result" is used before its value is set
diagnose\Dcm_App.c(917):W0520177:Variable "LaDcm_u_TempBuffer" was declared but never referenced
diagnose\Dcm_App.c(1281):W0520940:Missing return statement at end of non-void function "MngDcm_RoutineF001Start"
diagnose\Dcm_App.c(1285):W0520940:Missing return statement at end of non-void function "MngDcm_RoutineF001Stop"
diagnose\Dcm_App.c(1289):W0520940:Missing return statement at end of non-void function "MngDcm_RoutineF001Result"
diagnose\Dcm_App.c(1559):W0520177:Variable "temp" was declared but never referenced
diagnose\Dcm_App.c(1906):W0520549:Variable "LeDcm_u_FinallyResult" is used before its value is set
diagnose\Dcm_App.c(1840):W0520177:Variable "LeDcm_u_dataFomatldentifier" was declared but never referenced
diagnose\Dcm_App.c(1841):W0520177:Variable "LeDcm_u_addressAndLengthFomatldentifier" was declared but never referenced
diagnose\Dcm_App.c(1842):W0520177:Variable "LeDcm_w_Address" was declared but never referenced
diagnose\Dcm_App.c(1843):W0520177:Variable "LeDcm_w_DataLength" was declared but never referenced
diagnose\Dcm_App.c(1844):W0520177:Variable "LeDcm_u_SidIndex" was declared but never referenced
diagnose\Dcm_App.c(1845):W0520177:Variable "LeDcm_u_SecurityAccessCheckResult" was declared but never referenced
diagnose\Dcm_App.c(1846):W0520177:Variable "LaDcm_u_TempBuffer" was declared but never referenced
diagnose\Dcm_App.c(2010):W0520549:Variable "LeDcm_u_FinallyResult" is used before its value is set
diagnose\Dcm_App.c(1926):W0520177:Variable "LeDcm_w_SingleTransmitDataCount" was declared but never referenced
diagnose\Dcm_App.c(1927):W0520177:Variable "LeDcm_u_BlockSequenceCount" was declared but never referenced
diagnose\Dcm_App.c(1928):W0520177:Variable "LeDcm_u_BlockExpect" was declared but never referenced
diagnose\Dcm_App.c(1929):W0520177:Variable "LaDcm_u_TempBuffer" was declared but never referenced
diagnose\Dcm_App.c(60):W0520177:Variable "CeDcm_w_SecurityAccessFBLMask" was declared but never referenced
diagnose\Dcm_App.c(63):W0520177:Variable "SeDcm_w_DownLoadDataLength" was declared but never referenced
diagnose\Dcm_App.c(64):W0520177:Variable "SeDcm_w_TransmitDataCount" was declared but never referenced
diagnose\Dcm_App.c(65):W0520177:Variable "SeDcm_u_BlockSequenceCountSts" was declared but never referenced
diagnose\Dcm_App.c(66):W0520177:Variable "CaDcm_w_SingleAllowDateLength" was declared but never referenced
diagnose\Dcm_App.c(71):W0520177:Variable "SeDcm_u_RidF001Sts" was declared but never referenced
diagnose\Dcm_Cfg.c(83):W0520144:A value of type "uint8 (__far *)(void)" cannot be used to initialize an entity of type "SubDealfunc"
diagnose\Dcm_Cfg.c(84):W0520144:A value of type "uint8 (__far *)(void)" cannot be used to initialize an entity of type "SubDealfunc"
diagnose\Dcm_Cfg.c(87):W0520144:A value of type "uint8 (__far *)(void)" cannot be used to initialize an entity of type "SubDealfunc"
diagnose\Dcm_Cfg.c(1157):W0520940:Missing return statement at end of non-void function "MngDcm_ReadMemoryDataService"
diagnose\Dcm_Cfg.c(1179):W0520167:Argument of type "const TsDcm_h_WithParaSubCheckType __near *" is incompatible with parameter of type "const TsDcm_h_SubCheckType __far *__near"
diagnose\Dcm_Cfg.c(1199):W0520167:Argument of type "const TsDcm_h_WithParaSubCheckType __near *" is incompatible with parameter of type "const TsDcm_h_SubCheckType __far *__near"
diagnose\Dcm_Cfg.c(1240):W0520167:Argument of type "const TsDcm_h_WithParaSubCheckType __near *" is incompatible with parameter of type "const TsDcm_h_SubCheckType __far *__near"
diagnose\Dcm_Cfg.c(1259):W0520167:Argument of type "const TsDcm_h_WithParaSubCheckType __near *" is incompatible with parameter of type "const TsDcm_h_SubCheckType __far *__near"
diagnose\Dcm_Cfg.c(1294):W0520177:Variable "i" was declared but never referenced
diagnose\Dcm_Cfg.c(1304):W0520177:Variable "LeDcm_u_CollectDataPost" was declared but never referenced
diagnose\Dcm_Cfg.c(1597):W0520177:Variable "LeDcm_u_DLCheckResult" was declared but never referenced
diagnose\Dcm_Cfg.c(1603):W0520177:Variable "LeDcm_u_CollectDataPost" was declared but never referenced
diagnose\Dcm_Cfg.c(509):W0520177:Function "MngDcm_2AReadDidCheckDL" was declared but never referenced
diagnose\Dcm_Cfg.c(551):W0520177:Function "MngDcm_IoDidCheckDL" was declared but never referenced
diagnose\Dcm_DID_Cfg.c(177):W0520144:A value of type "long" cannot be used to initialize an entity of type "uint8 __far *__near"
diagnose\Dcm_DID_Cfg.c(177):W0520152:Conversion of nonzero integer to pointer
diagnose\Dcm_DID_Cfg.c(307):W0520174:Expression has no effect
diagnose\Dcm_DID_Cfg.c(333):W0520144:A value of type "long" cannot be used to initialize an entity of type "uint8 __far *__near"
diagnose\Dcm_DID_Cfg.c(333):W0520152:Conversion of nonzero integer to pointer
diagnose\Dcm_DID_Cfg.c(365):W0520174:Expression has no effect
diagnose\extern.c(107):W0520940:Missing return statement at end of non-void function "GetVoltage"
diagnose\extern.c(135):W0520940:Missing return statement at end of non-void function "GetMotorLockStatus"
diagnose\extern.c(181):W0520111:Statement is unreachable
diagnose\extern.c(322):W0520111:Statement is unreachable
diagnose\extern.c(326):W0520111:Statement is unreachable
diagnose\extern.c(330):W0520111:Statement is unreachable
diagnose\extern.c(334):W0520111:Statement is unreachable
diagnose\extern.c(505):W0520940:Missing return statement at end of non-void function "GetCanBusOffErr"
diagnose\extern.c(523):W0520940:Missing return statement at end of non-void function "GetBcmCommFault"
diagnose\extern.c(540):W0520940:Missing return statement at end of non-void function "GetAcpCommFault"
diagnose\CanIf\CanIf_Cfg.c(33):W0520009:Nested comment is not allowed
diagnose\CanIf\CanIf_Cfg.c(43):W0520009:Nested comment is not allowed
diagnose\DTC\DCM_DTC.c(111):W0520167:Argument of type "uint32 __near *" is incompatible with parameter of type "unsigned char *__near"
diagnose\DTC\DCM_DTC.c(175):W0520167:Argument of type "uint8 __near (*)[2]" is incompatible with parameter of type "unsigned char *__near"
diagnose\DTC\DCM_DTC.c(166):W0520177:Variable "DtcSnapshotRecord" was declared but never referenced
diagnose\DTC\DCM_DTC.c(780):W0520167:Argument of type "uint8 __near (*)[28]" is incompatible with parameter of type "unsigned char *__near"
diagnose\DTC\DCM_DTC.c(97):W0520177:Function "ChkDiagVolt" was declared but never referenced
diagnose\DTC\DCM_DTC.c(107):W0520177:Function "GetLastSnapshotRecordNum" was declared but never referenced
diagnose\Dcm.c(69):W0520550:Variable "LeDcm_u_FinallyResult" was set but never used
diagnose\CanTp\CanTp.c(192):W0520069:Integer conversion resulted in truncation
diagnose\CanTp\CanTp.c(786):W0520188:Enumerated type mixed with another type
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\rlink.exe -subcommand=DefaultBuild\ECU_APP.clnk
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
RAMDATA SECTION: 00000bf3 Byte(s)
@ -12,7 +83,7 @@ PROGRAM SECTION: 00004dc0 Byte(s)
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
Renesas Optimizing Linker Completed
------ Build ended(Error:0, Warning:4)(ECU_APP, DefaultBuild) ------
------ Build ended(Error:0, Warning:75)(ECU_APP, DefaultBuild) ------
--- CommandFile 1 ---
DefaultBuild\ECU_APP.clnk :
@ -97,9 +168,9 @@ DefaultBuild\ECU_APP.clnk :
--- SHA1 hash value of output files ---
F:\FCB_project\temp\HS550\code\ECU_APP\DefaultBuild\ECU_APP.abs: ead2ac07fe9de18da2d71bb5d35e0dc3e70a09c0
F:\FCB_project\temp\HS550\code\ECU_APP\DefaultBuild\ECU_APP.mot: d78aacba1409b08a0bfa0ac3d420a02a0e485239
F:\FCB_project\temp\HS550\code\ECU_APP\output\ECU_APP.S19: 8544f1d360fa9f2af931fa882df65fd53f64d163
F:\FCB_project\temp\HS550\code\ECU_APP\DefaultBuild\ECU_APP.abs: f6bb349eab3330412e36ef94b09cec36f5be7c3f
F:\FCB_project\temp\HS550\code\ECU_APP\DefaultBuild\ECU_APP.mot: 2eeb385bb9bb72ba12f889cd97f4b9ae8e1d7e58
F:\FCB_project\temp\HS550\code\ECU_APP\output\ECU_APP.S19: aea5a432a46ab659438a5362d4fd0c3bce7b92b0
--- System Information ---
@ -127,11 +198,11 @@ F:\FCB_project\temp\HS550\code\ECU_APP\output\ECU_APP.S19: 8544f1d360fa9f2af931f
E:\Program Files (x86)\renesas\CS+\CC
*Memory Usage
*Private Working Set
418 MB
320 MB
*Number of GDI Objects
2438
2129
*Number of USER Objects
1166
1158
*Opened Files
5 editors, 5 files, 36 KB

View File

@ -22,15 +22,11 @@
#if NOW_BOARD == LEFT_BOARD
#define CANTP_ADDR_FUNC_REQ 0x7DF /* 诊断功能寻址 */
#define CANTP_ADDR_PHY_REQ 0x751//0x7C6 /* 诊断物理寻址 */
#define CANTP_RESP_CANID 0x759//0x7CE /* 诊断反馈 */
#else
#define CANTP_ADDR_FUNC_REQ 0x7DF /* 诊断功能寻址 */
#define CANTP_ADDR_PHY_REQ 0x752//0x7C6 /* 诊断物理寻址 */
#define CANTP_RESP_CANID 0x75A//0x7CE /* 诊断反馈 */
#endif
#define CANTP_ADDRFUNC_MF_FORBID DCM_FALSE

View File

@ -26,12 +26,12 @@ __far const unsigned char HD_VERSION[]={
__far const unsigned char SW_VERSION[]={
'0' , //AC_SW_VERSION_00
'1' , //AC_SW_VERSION_01
23 , //AC_SW_VERSION_02
7 , //AC_SW_VERSION_03
24 , //AC_SW_VERSION_04
0 , //AC_SW_VERSION_05
'0' , //AC_SW_VERSION_06
'1' , //AC_SW_VERSION_07
'0' , //AC_SW_VERSION_02
'1' , //AC_SW_VERSION_03
' ', //AC_SW_VERSION_04
' ', //AC_SW_VERSION_05
' ' , //AC_SW_VERSION_06
' ' , //AC_SW_VERSION_07
' ' , //AC_SW_VERSION_08
' ' , //AC_SW_VERSION_09
' ' , //AC_SW_VERSION_10

View File

@ -35,7 +35,7 @@ typedef enum
#define LEFT_BOARD 1
#define RIGHT_BOARD 2
#define NOW_BOARD LEFT_BOARD
#define NOW_BOARD RIGHT_BOARD
#endif

View File

@ -53,7 +53,11 @@ void Copy_Array_to_Array(unsigned char *dest, unsigned char *src, unsigned char
void Can_Msg_Change_Bcm(void)
{
#if NOW_BOARD == RIGHT_BOARD
Copy_Array_to_Array(TxCanMessage.DB, CAN_101.Msg_Byte, 8);
#else
Copy_Array_to_Array(TxCanMessage.DB, CAN_220.Msg_Byte, 8);
#endif
}
void CAN_TX_MESSAGE_INIT(void)

1
ECU_BOOT/.gitignore vendored
View File

@ -1 +0,0 @@
/DefaultBuild

View File

@ -1,5 +0,0 @@
{
"files.associations": {
"r_rl78_can_drv.h": "c"
}
}

View File

@ -1,144 +0,0 @@
/*******************************************************************************
* Library : Flash Data Library T04 (PicoFDL)
*
* File Name : $Source: pfdl.h $
* Lib. Version : $RL78_FDL_LIB_VERSION_T04_REN: V1.05 $
* Mod. Revision : $Revision: 1.8 $
* Mod. Date : $Date: 2013/06/10 22:04:41JST $
* Device(s) : RL78
* Description : C language API definition of the Flash Data Library
*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011-2013 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
#ifndef __PFDL_H_INCLUDED
#define __PFDL_H_INCLUDED
/*================================================================================================*/
/* include files list */
/*================================================================================================*/
#include "pfdl_types.h"
#define FLASH_START_ADDRESS (0xF1000) /* Start address of data flash */
#define TARGET_BLOCK (0) /* Block number of target(0 ~ 3) */
#define BLOCK_SIZE (0x400) /* Block size */
//#define WRITE_SIZE (1) /* Size of data to be written at once */
#define MAX_VALUE (0xFF) /* Maximum value of writing */
#define MAX_ADDRESS ((TARGET_BLOCK + 1) * BLOCK_SIZE - 1) /* Maximum address of writing */
#define PFDL_NG (1) /* Failure to Data Flash */
#define FDL_FRQ (32) /* Setting frequency (MHz) */
#define FDL_VOL (0x00) /* Voltage mode */
uint8_t WriteDataflash(uint8_t* buffer,uint32_t Addr,uint16_t lenth);
uint8_t WriteDataflash1(uint8_t* buffer,uint32_t Addr,uint16_t lenth);
void ReadFlashData(uint8_t* buffer,uint32_t Addr,uint16_t lenth);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Unconditional activation of the Data Flash Library. */
/* Based on the descriptor data: */
/* - the flash firmware will be initialized for data-flash access only */
/* - the internal timing and low-voltage capability will be configured according to the descriptor */
/* After successful initialization the data flash clock is ON and the PFDL is ready to use. */
/* */
/* CAUTION: */
/* Due to the code size minimization no plausibility checks are done by the PicoFDL. */
/* Neither configuration, frequency range nor data flash size will be checked by the library. */
/* */
/* Input: address of the PFDL descriptor variable (RAM only) */
/* Output: - */
/* Return: PFDL status */
/* ---------------------------------------------------------------------------------------------------------------*/
extern pfdl_status_t __far PFDL_Open(__near pfdl_descriptor_t* descriptor_pstr);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Disable data flash access unconditionally. */
/* If any command is just executed, PFDL_Close will stop it immediately. */
/* After return the data flash clock is switched OFF. */
/* Input: - */
/* Output: - */
/* Return: - */
/* ---------------------------------------------------------------------------------------------------------------*/
extern void __far PFDL_Close(void);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Initiating execution of the PFDL request related to the data flash. */
/* The corresponding request variable has to be parametrized before. */
/* */
/* request_pstr->index_u16 : byte-index or block-number within PFDL-pool */
/* request_pstr->data_pu08 : start address of the RAM data that should be read/written */
/* request_pstr->bytecount_u16 : number of bytes has to be read/written */
/* request_pstr->command_enu : command code */
/* */
/* CAUTION: */
/* Due to the code size minimization no plausibility checks are done by the PFDL. */
/* */
/* Input: &request_pstr - pointer to PFDL request variable */
/* Output: - */
/* Return: status of the request */
/* ---------------------------------------------------------------------------------------------------------------*/
extern pfdl_status_t __far PFDL_Execute(__near pfdl_request_t* request_pstr);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Continuation of command execution and status update of requests being under execution. */
/* Input: - */
/* Output: - */
/* Return: PFDL status = */
/* PFDL_IDLE - no request is processed by PFDL, PFDL is ready to receive new requests */
/* PFDL_OK - processed request/command finished without problems */
/* PFDL_BUSY - request/command is still being processed */
/* other - flash or firmware related errors */
/* ---------------------------------------------------------------------------------------------------------------*/
extern pfdl_status_t __far PFDL_Handler(void);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Returns the start address of the library version string */
/* */
/* Input: - */
/* Output: - */
/* Return: starting address of the zero-terminated version string */
/* ---------------------------------------------------------------------------------------------------------------*/
extern __far pfdl_u08* __far PFDL_GetVersionString(void);
#endif

Binary file not shown.

View File

@ -1,146 +0,0 @@
/*******************************************************************************
* Library : Flash Data Library T04 (PicoFDL)
*
* File Name : $Source: pfdl_types.h $
* Lib. Version : $RL78_FDL_LIB_VERSION_T04_REN: V1.05 $
* Mod. Revision : $Revision: 1.8 $
* Mod. Date : $Date: 2013/06/10 22:28:01JST $
* Device(s) : RL78
* Description : Type definitions used by the library
*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011-2013 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
#ifndef __PFDL_TYPES_H_INCLUDED
#define __PFDL_TYPES_H_INCLUDED
#ifndef __TYPEDEF__
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef unsigned short MD_STATUS;
#define __TYPEDEF__
#endif
/*==============================================================================================*/
/* unsigned type definitions */
/*==============================================================================================*/
typedef unsigned char pfdl_u08;
typedef unsigned int pfdl_u16;
typedef unsigned long int pfdl_u32;
/*==============================================================================================*/
/* global constant definitions */
/*==============================================================================================*/
/*==============================================================================================*/
/* global type definitions */
/*==============================================================================================*/
/* PFDL command code set */
typedef enum
{ /* ---------------------------------------------- */
PFDL_CMD_READ_BYTES = (0x00), /* 0x00, reads data from flash memory */
PFDL_CMD_IVERIFY_BYTES = (0x06), /* 0x06, verifies data if flash content is stable */
PFDL_CMD_BLANKCHECK_BYTES = (0x08), /* 0x08, checks if flash content is blank */
PFDL_CMD_WRITE_BYTES = (0x04), /* 0x04, writes data into flash memory */
PFDL_CMD_ERASE_BLOCK = (0x03) /* 0x03, erases one flash block */
} pfdl_command_t; /* ---------------------------------------------- */
/* PFDL error code set */
typedef enum
{
/* operation related status */ /* ---------------------------------------------- */
PFDL_IDLE = (0x30), /* 0x30, PFDL ready to receive requests */
PFDL_OK = (0x00), /* 0x00, command finished without problems */
PFDL_BUSY = (0xFF), /* 0xFF, command is being processed */
/* flash related status */ /* ---------------------------------------------- */
PFDL_ERR_PROTECTION = (0x10), /* 0x10, protection error (access right conflict) */
PFDL_ERR_ERASE = (0x1A), /* 0x1A, erase error */
PFDL_ERR_MARGIN = (0x1B), /* 0x1B, blankcheck or verify margin violated */
PFDL_ERR_WRITE = (0x1C), /* 0x1C, write error */
PFDL_ERR_PARAMETER = (0x05) /* 0x05, parameter error */
} pfdl_status_t; /* ---------------------------------------------- */
/* PFDL request type (base type for any PFDL access) */
typedef struct
{ /* ---------------------------------------------- */
pfdl_u16 index_u16; /* 2, W, virt. byte/block index inside PFDL-pool */
__near pfdl_u08* data_pu08; /* 2, W, pointer to the 1'st byte of data buffer */
pfdl_u16 bytecount_u16; /* 2, W, number of bytes to be transfered */
pfdl_command_t command_enu; /* 1, W, command code */
} pfdl_request_t; /*------------------------------------------------*/
/* 7 bytes in total */
/*------------------------------------------------*/
/* PFDL descriptor type */
typedef struct
{ /* ---------------------------------------------- */
pfdl_u08 fx_MHz_u08; /* 1, system frequency expressed in MHz */
pfdl_u08 wide_voltage_mode_u08; /* 1, programming voltage mode ( full/wide ) */
} pfdl_descriptor_t; /*------------------------------------------------*/
/* 2 bytes in total */
/*==============================================================================================*/
/* type definition plausibility check */
/*==============================================================================================*/
/* The following checks are implemented in order to check the correct size of the FDL type */
/* definitions at compile time. In case of a compilation error in the following lines, please */
/* check your compiler options for enumeration types and structures and contact your local */
/* support, if necessary. */
#define R_PFDLT04_ASSERT_CONCAT_(a, b) a##b
#define R_PFDLT04_ASSERT_CONCAT(a, b) R_PFDLT04_ASSERT_CONCAT_(a, b)
#define R_PFDLT04_STATIC_ASSERT(e) enum { R_PFDLT04_ASSERT_CONCAT(R_PFDLT04_ASSERT_LINE_, __LINE__) = 1/(!!(e)) }
/* assertion if unsigned data type size is not correct, please evaluate compiler settings for integer types */
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_u08)==1);
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_u16)==2);
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_u32)==4);
/* assertion if unsigned data type size is not correct, please evaluate compiler settings for enumeration types */
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_command_t)==1);
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_status_t)==1);
/* assertion if structure type size is not correct, please evaluate compiler settings for structure types */
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_request_t)>=7); /* sizeof(pfdl_request_t) == 7 for packed structures */
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_request_t)<=8); /* sizeof(pfdl_request_t) == 8 for unpacked structures */
R_PFDLT04_STATIC_ASSERT(sizeof(pfdl_descriptor_t)==2);
#endif

View File

@ -1,230 +0,0 @@
#include "boot_macrodriver.h"
#include "pfdl.h"
#include "pfdl_types.h"
#include "pfdl_user.h"
/***********************************************************************************************************************
* Function Name: WriteDataflash
* Description :
* Arguments : buffer: to be writed data; Addr:Target absolute address,must be check for different mcu;lenth:to be writed number,<=1024
* Return Value : PFDL_OK -
Success
PFDL_IDLE -
Idling statement
PFDL_ERR_MARGIN -
Blank check error
other//if(Addr>=FLASH_START_ADDRESS&&Addr<FLASH_END_ADDRESS){
***********************************************************************************************************************/
/************************************************************************************
// 获取data Flash数据存取索引号 //
// 输入参数 code : //
// 0 : 获取APP重编程请求标志索引号 //
// 1 : 获取2E服务0xF110的索引号 //
// 2 : 获取2E服务0xF190的索引号 //
// 3 : 获取2E服务0xF197的索引号 //
// 4 : 获取2E服务0xF198的索引号 //
// 5 : 获取2E服务0xF199的索引号 //
// 6 : 获取2E服务0xF19D的索引号 //
// 7 : 获取2E服务0xF112的索引号 //
// 8 : 获取19服务0xF00616的索引号
// 9 : 获取19服务0xF00617的索引号
// 10: 获取19服务0x918112的索引号
// 11: 获取19服务0x918114的索引号
// 12: 获取19服务0x918171的索引号
// 13: 获取19服务0x918312的索引号
// 14: 获取19服务0x918314的索引号
// 15: 获取19服务0x918371的索引号
// 16: 获取19服务0x918412的索引号
// 17: 获取19服务0x918414的索引号
// 18: 获取19服务0x918471的索引号
// 19: 获取19服务0x918611的索引号
// 20: 获取19服务0x918614的索引号
// 21: 获取19服务0xC07300的索引号
// 返回值: //
// 2E 服务数据索引号 //
// //
************************************************************************************/
const fdl_index_t DF_INDEX_TAB[]={
/*
{0x000F1000, 8 + 1,}, // byte Power lost memory 0
{0x000F1200, 4 + 1,},
{0x000F1400, 4 + 1,}, // byte APP REProgrammer Request 1
{0x000F1405, 8 + 1,}, // byte BLOCK_0xF110, 2
{0x000F1408, 17 + 1,}, // byte BLOCK_0xF190,Z 3
{0x000F1420, 8 + 1,}, // byte BLOCK_0xF197, 4
{0x000F1800, 16 + 1,}, // byte BLOCK_0xF198,Z 5
{0x000F1810, 4 + 1,}, // byte BLOCK_0xF199,Z 6
{0x000F1814, 4 + 1,}, // byte BLOCK_0xF19D,Z 7
{0x000F1444, 8 + 1,}, // byte BLOCK_0xF112,
*/
{0x000F1000, 8 + 1,}, // byte Power lost memory
{0x000F1400, 4 + 1,}, // byte APP REProgrammer Request
{0x000F1410, 8 + 1,}, // byte BLOCK_0xF110,
{0x000F1420, 17 + 1,}, // byte BLOCK_0xF190,
{0x000F1440, 8 + 1,}, // byte BLOCK_0xF197,
{0x000F1450, 16 + 1,}, // byte BLOCK_0xF198,
{0x000F1460, 4 + 1,}, // byte BLOCK_0xF199,
{0x000F1470, 4 + 1,}, // byte BLOCK_0xF19D,
{0x000F1480, 8 + 1,}, // byte BLOCK_0xF112,
{0x000F1803, 2 + 1,}, // byte 19服务0xF00616
{0x000F1806, 2 + 1,}, // byte 19服务0xF00617
{0x000F1809, 2 + 1,}, // byte 19服务0x918112
{0x000F180C, 2 + 1,}, // byte 19服务0x918114
{0x000F180F, 2 + 1,}, // byte 19服务0x918171
{0x000F1812, 2 + 1,}, // byte 19服务0x918312
{0x000F1815, 2 + 1,}, // byte 19服务0x918314
{0x000F1818, 2 + 1,}, // byte 19服务0x918371
{0x000F181B, 2 + 1,}, // byte 19服务0x918412
{0x000F181E, 2 + 1,}, // byte 19服务0x918414
{0x000F1821, 2 + 1,}, // byte 19服务0x918471
{0x000F1824, 2 + 1,}, // byte 19服务0x918611
{0x000F1827, 2 + 1,}, // byte 19服务0x918614
{0x000F182A, 2 + 1,}, // byte 19服务0xC07300
};
unsigned long GetDataFlashAddress(unsigned char code)
{
return(DF_INDEX_TAB[code].addr);
}
unsigned char DF_Write(unsigned char* write_buf,unsigned char data_num,unsigned char len)
{
unsigned char DF_Buf[128];
unsigned char block_num,block_use,buf_addr;
unsigned char sum,i = 0;
unsigned long addr;
addr = GetDataFlashAddress(data_num);
block_num = (unsigned char)((addr - 0xF1000)>>10);
if(0==block_num){
block_use = DF_BLOCK0_USE;
}
else if(1==block_num){
block_use = DF_BLOCK1_USE;
}
else if(2==block_num){
block_use = DF_BLOCK2_USE;
}
else{
block_use = 0xFF;
}
if(2 >= block_num){
ReadFlashData(DF_Buf,(0x000F1000 + block_num*0x400),block_use);
buf_addr = (unsigned char)(addr - (0x000F1000 + block_num*0x400));
for(sum=0,i=0;i<len;i++)
{
DF_Buf[buf_addr + i] = *(write_buf+i);
sum += *(write_buf+i);
}
sum = (sum^0xFF)+1;
DF_Buf[buf_addr + i] = sum;
if(WriteDataflash(DF_Buf,(0x000F1000 + block_num*0x400),block_use) == 0x11)
{
return 0;
}
else{
return 0xFF;
}
}
else{
return 0xFF;
}
}
unsigned char DF_Read(unsigned char* read_buf,unsigned char data_num,unsigned char len)
{
unsigned char DF_Buf[128];
unsigned char block_num,block_use,buf_addr;
unsigned char sum,i = 0;
unsigned long addr;
addr = GetDataFlashAddress(data_num);
block_num = (unsigned char)((addr - 0x000F1000)/0x400);
if(0==block_num){
block_use = DF_BLOCK0_USE;
}
else if(1==block_num){
block_use = DF_BLOCK1_USE;
}
else if(2==block_num){
block_use = DF_BLOCK2_USE;
}
else{
block_use = 0xFF;
}
if(2 >= block_num){
ReadFlashData(DF_Buf,(0x000F1000 + block_num*0x400),block_use);
buf_addr = (unsigned char)(addr - (0x000F1000 + block_num*0x400));
for(sum=0,i=0;i<len;i++)
{
sum += DF_Buf[buf_addr + i];
}
sum = (sum^0xFF)+1;
if(DF_Buf[buf_addr + i] == sum){
for(i=0;i<len;i++)
{
read_buf[i] = DF_Buf[buf_addr + i];
}
return 0;
}
else{
return 0xFF;
}
}
else{
return 0xFF;
}
}
unsigned char DF_Write_All_DTC(unsigned char* write_buf,unsigned long addr,unsigned char len)
{
uint8_t ret;
ret = WriteDataflash(write_buf,addr,len);
if(0x11 == ret){
return (0);
}
else{
return (ret);
}
}
unsigned char DF_Read_All_DTC(unsigned char* read_buf,unsigned long addr,unsigned char len)
{
ReadFlashData(read_buf,addr,len);
return 0;
}
unsigned char GetProgrammingCounter(void)
{
return *((__far uint8_t *)DID_0200_ADDR);
}
unsigned char GetProgrammingAttempCounter(void)
{
return *((__far uint8_t *)DID_0201_ADDR);
}

View File

@ -1,56 +0,0 @@
#ifndef __PFDL_USER_H_
#define __PFDL_USER_H_
/* PFDL request type (base type for any PFDL access) */
typedef struct
{ /* ---------------------------------------------- */
unsigned long addr; /* 2, W, virt. byte/block index inside PFDL-pool */
unsigned short size; /* 2, W, pointer to the 1'st byte of data buffer */
} fdl_index_t; /*------------------------------------------------*/
/* 7 bytes in total */
/*------------------------------------------------*/
/* BLOCK 0 */
#define INDEX_MEMORY 0 //8 Power lost memory
/* BLOCK 1 */
#define INDEX_REPROGMA 1 //4 byte 自编程标志 不常用
#define INDEX_APP_VALID 2 //4 byte 自编程标志 不常用
#define INDEX_0xF110 3 //8 汽车网络配置 一次写入
#define INDEX_0xF190 4 //17 车辆识别号码 一次写入
#define INDEX_0xF197 5 //8 系统名字或发动机类型 一次写入
#define INDEX_0xF198 6 //16 维修厂代码或检测仪串号 一次写入
#define INDEX_0xF199 7 //4 编程或配置日期 不常用
#define INDEX_0xF19D 8 //4 ECU安装日期 一次写入
#define INDEX_0xF112 9 //8 汽车名字 一次写入
/* BLOCK 2 */
#define INDEX_19_0xF00616 10 //2 19服务故障代码 //
#define INDEX_19_0xF00617 11 //2 19服务故障代码
#define INDEX_19_0x918112 12 //2 19服务故障代码
#define INDEX_19_0x918114 13 //2 19服务故障代码
#define INDEX_19_0x918171 14 //2 19服务故障代码
#define INDEX_19_0x918312 15 //2 19服务故障代码
#define INDEX_19_0x918314 16 //2 19服务故障代码
#define INDEX_19_0x918371 17 //2 19服务故障代码
#define INDEX_19_0x918412 18 //2 19服务故障代码
#define INDEX_19_0x918414 19 //2 19服务故障代码
#define INDEX_19_0x918471 20 //2 19服务故障代码
#define INDEX_19_0x918611 21 //2 19服务故障代码
#define INDEX_19_0x918614 22 //2 19服务故障代码
#define INDEX_19_0xC07300 23 //2 19服务故障代码
#define INDEX_19_BASE INDEX_19_0xF00616 //42 19服务故障代码起始位置 偶尔使用
#define DF_BLOCK0_USE (8+1) //
#define DF_BLOCK1_USE (69+8) //
#define DF_BLOCK2_USE (28+14) //
unsigned char DF_Write(unsigned char* write_buf,unsigned char data_num,unsigned char len);
unsigned char DF_Read(unsigned char* read_buf,unsigned char data_num,unsigned char len);
unsigned char DF_Write_All_DTC(unsigned char* write_buf,unsigned long addr,unsigned char len);
unsigned char DF_Read_All_DTC(unsigned char* read_buf,unsigned long addr,unsigned char len);
#endif

View File

@ -1,309 +0,0 @@
#pragma sfr
#pragma DI
#pragma EI
#pragma NOP
#include "pfdl.h"
#include "pfdl_types.h"
/***********************************************************************************************************************
* Function Name: WriteDataflash
* Description :
* Arguments : buffer: to be writed data; Addr:Target absolute address,must be check for different mcu;lenth:to be writed number,<=1024
* Return Value : PFDL_OK -
Success
PFDL_IDLE -
Idling statement
PFDL_ERR_MARGIN -
Blank check error
other//if(Addr>=FLASH_START_ADDRESS&&Addr<FLASH_END_ADDRESS){
***********************************************************************************************************************/
uint8_t WriteDataflash(uint8_t* buffer,uint32_t Addr,uint16_t lenth)
{
static unsigned char Wr_Status;
pfdl_status_t ret;
pfdl_descriptor_t descriptor;
pfdl_request_t requester;
if(Addr>=0x000F1000 && Addr<0x000F2000)
{
if(Wr_Status == 0)
{
/* ---- Setting for PFDL_Open ---- */
descriptor.fx_MHz_u08 = FDL_FRQ;
descriptor.wide_voltage_mode_u08 = FDL_VOL;
DI();
PFDL_Open(&descriptor);
/* ---- Setting for blank check ---- */
requester.command_enu = PFDL_CMD_BLANKCHECK_BYTES;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000);//g_write_address;0x0F1000 according to MCU
requester.bytecount_u16 = lenth;
ret = PFDL_Execute(&requester); /* Blank check */
EI();
Wr_Status = 1;
}
if(Wr_Status == 1)
{
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
}
if(ret != PFDL_BUSY)
{
/* **** When blank check error **** */
if(ret == PFDL_ERR_MARGIN)
{
/* ---- Setting for erase ---- */
requester.command_enu = PFDL_CMD_ERASE_BLOCK;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000)/0x400;//TARGET_BLOCK;
ret = PFDL_Execute(&requester); /* Erase block data */
Wr_Status = 2;
/* Erase data of target block */
}
/* **** When other than blank check error **** */
else
{
/* Do nothing */
}
/******When blank no check error***/
if(ret == PFDL_OK)
{
/* ---- Setting for write ---- */
requester.command_enu = PFDL_CMD_WRITE_BYTES;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000);//g_write_address;;
requester.bytecount_u16 = lenth;
requester.data_pu08 = buffer;//&g_write_value;
ret = PFDL_Execute(&requester); /* Execute write */
Wr_Status = 3;
}
}
}
if(Wr_Status == 2)
{
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
}
if(ret != PFDL_BUSY)
{
if(ret == PFDL_OK)
{
/* ---- Setting for write ---- */
requester.command_enu = PFDL_CMD_WRITE_BYTES;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000);//g_write_address;;
requester.bytecount_u16 = lenth;
requester.data_pu08 = buffer;//&g_write_value;
ret = PFDL_Execute(&requester); /* Execute write */
Wr_Status = 3;
}
/* **** When blank check or data erase is failure **** */
else
{
ret = PFDL_NG;
//PFDL_Close(); /* Close FDL */
//Wr_Status = 0;
return ret;
}
}
}
if(Wr_Status == 3)
{
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
}
if(ret != PFDL_BUSY)
{
/* ==== When write data is success ==== */
if(ret == PFDL_OK)
{
/* ---- Setting for verify ---- */
requester.command_enu = PFDL_CMD_IVERIFY_BYTES;
requester.index_u16 = (unsigned int)(Addr- 0x0F1000);//g_write_address;;
requester.bytecount_u16 = lenth;
ret = PFDL_Execute(&requester); /* Execute internal verify */
Wr_Status = 4;
}
/* ==== When writing data is failure ==== */
else
{
ret = PFDL_NG;
//PFDL_Close(); /* Close FDL */
//Wr_Status = 0;
return ret;
}
}
}
if(Wr_Status == 4)
{
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
}
if(ret != PFDL_BUSY)
{
PFDL_Close(); /* Close FDL */
Wr_Status = 0;
return 0x11;//write data flash finished
}
}
}
else
{
ret = PFDL_NG;
Wr_Status = 0;
return ret;
}
}
uint8_t WriteDataflash1(uint8_t* buffer,uint32_t Addr,uint16_t lenth)
{
pfdl_status_t ret;
pfdl_descriptor_t descriptor;
pfdl_request_t requester;
if(Addr>=0x000F1000&&Addr<0x000F2000){
/* ---- Setting for PFDL_Open ---- */
descriptor.fx_MHz_u08 = FDL_FRQ;
descriptor.wide_voltage_mode_u08 = FDL_VOL;
PFDL_Open(&descriptor);
/* ---- Setting for blank check ---- */
requester.command_enu = PFDL_CMD_BLANKCHECK_BYTES;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000);//g_write_address;0x0F1000 according to MCU
requester.bytecount_u16 = lenth;
ret = PFDL_Execute(&requester); /* Blank check */
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
}
/* **** When blank check error **** */
if(ret == PFDL_ERR_MARGIN)
{
/* ---- Setting for erase ---- */
requester.command_enu = PFDL_CMD_ERASE_BLOCK;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000)/0x400;//TARGET_BLOCK;
ret = PFDL_Execute(&requester); /* Erase block data */
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
} /* Erase data of target block */
}
/* **** When other than blank check error **** */
else
{
/* Do nothing */
}
if(ret == PFDL_OK)
{
/* ---- Setting for write ---- */
requester.command_enu = PFDL_CMD_WRITE_BYTES;
requester.index_u16 = (unsigned int)(Addr - 0x0F1000);//g_write_address;;
requester.bytecount_u16 = lenth;
requester.data_pu08 = buffer;//&g_write_value;
ret = PFDL_Execute(&requester); /* Execute write */
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler(); /* Status check process */
} /* Write data process */
/* ==== When write data is success ==== */
if(ret == PFDL_OK)
{
/* ---- Setting for verify ---- */
requester.command_enu = PFDL_CMD_IVERIFY_BYTES;
requester.index_u16 = (unsigned int)(Addr- 0x0F1000);//g_write_address;;
requester.bytecount_u16 = lenth;
ret = PFDL_Execute(&requester); /* Execute internal verify */
/* ---- Waiting for command finish ---- */
while(ret == PFDL_BUSY)
{
ret = PFDL_Handler();/* Status check process */
}
}
/* ==== When writing data is failure ==== */
else
{
ret = PFDL_NG;
}
}
/* **** When blank check or data erase is failure **** */
else
{
ret = PFDL_NG;
}
PFDL_Close(); /* Close FDL */
return ret;
}
else{
ret = PFDL_NG;
return ret;
}
}
/***********************************************************************************************************************
* Function Name: ReadFlashData
* Description :
* Arguments : buffer: to be read data;
Addr:Target absolute address,must be check for different mcu; Both codeflash & dataflash can be used
lenth:to be read number
* Return Value : None
***********************************************************************************************************************/
void ReadFlashData(uint8_t* buffer,uint32_t Addr,uint16_t lenth)
{
uint8_t temp;
volatile uint32_t w_count;
volatile uint8_t * snnumber;
/**** Only dataflash needed start*****/
if(0 == DFLEN)
{
DFLEN = 1U;
for (w_count = 0U; w_count < 15U; w_count++)//3U
{
NOP();
}
}
/**** Only dataflash needed end******/
snnumber = Addr;
for(temp = 0; temp < lenth; temp ++)
{
*buffer = *snnumber;
buffer ++;
snnumber ++;
}
//memcpy(buffer,snnumber,lenth);
}
/* End user code. Do not edit comment generated here */

View File

@ -1,10 +0,0 @@
内振32MHz
擦除 64Bytes和1024Bytes个00H时间一样为5.7mS
写入 1024Bytes个00H 需要46.8mS,写入时间和数据长度成线性关系
T04库的使用注意事项
1传参DMA对应的RAM地址都不要放到高速RAM区否则程序跑飞
2由于连续写入多个字节的时间较长建议不要采用提供函数中的死等的办法可以在主循环中查PFDL_Handler()
3读出可以直接用CPU指令不需要库
4输入的地址超出范围库的返回值有可能不报错镜像区不报错保留区跑飞

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
;MEMORY
MEMORY RAM : ( 000fe510H, 00001490H ) / REGULAR
MEMORY KAM : ( 000fe500H, 00000010H ) / REGULAR
MEMORY FSL_COD : ( 00ff9a0H, 00000480H ) / REGULAR
MEMORY SADDR : ( 000ffe20H, 000000c0H ) / REGULAR
MERGE KAM_SEG := KAM
MERGE FslSeg := FSL_COD

View File

@ -1,32 +0,0 @@
/*******************************************************************************
* File Name : BranchTable.h
* Version : 1.00
* Device(s) : RL78/F13( R5F10BLG )
* Tool-Chain : CS+ ( V4.00 )
* OS : none
* H/W Platform :
* Description :
* Operation :
* Limitations :
******************************************************************************/
/******************************************************************************
* History : Version Description
* : 07.29.2017 1.00 First Release
******************************************************************************/
/******************************************************************************
Include <System Includes>, "Project Includes"
******************************************************************************/
/*---------------------------------------------------------------------------*/
/* (#pragma) branch table functions (ext_func) */
/*---------------------------------------------------------------------------*/
#pragma ext_func GetVoltage 0
#pragma ext_func GetMotorLockStatus 1
#pragma ext_func GetIoParameter 2
#pragma ext_func WriteIoParameter 3
#pragma ext_func GetIgnVoltStatus 4
#pragma ext_func GetHardwareVersion 5
#pragma ext_func GetSoftwareVersion 6
#pragma ext_func GetManufacturingDate 7
#pragma ext_func Clear_DTC_Data 8

View File

@ -1,167 +0,0 @@
/*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
/*******************************************************************************
* File Name : r_fsl_praxis01_com.h
* Version : 1.00
* Device(s) : RL78/G13( R5F100LEA )
* Tool-Chain : CubeSuite+ ( V1.01 )
* OS : none
* H/W Platform : QB-R5F100LE-TB
* Description :
* Operation :
* Limitations : FSL AN-sample.
******************************************************************************/
/******************************************************************************
* History : Version Description
* : 09.29.2011 1.00 First Release
******************************************************************************/
/******************************************************************************
Include <System Includes>, "Project Includes"
******************************************************************************/
/**************************/
/* */
/**************************/
/*----------------------------------------------------------------------------*/
/* common prototype declarations ( public function ) */
/*----------------------------------------------------------------------------*/
/************************************************************************************/
/* 输入参数 ch : */
/* 0: KL30电压 KL15电 */
/* 1: 驾驶员侧温度调节电机反馈电压 */
/* 2: 出风模式电机电机反馈电压 */
/* 3: 循环风门调节电机反馈电压 */
/* 4蒸发器温度传感器电压 */
/* */
/* 返回值: */
/* 对应的电压*10即返回的电压值精度是0.1V的) */
/* */
/************************************************************************************/
unsigned char GetVoltage(unsigned char ch) ;
/************************************************************************************/
/* 输入参数 motor : */
/* 1: 驾驶员侧温度调节电机 */
/* 2: 出风模式电机电机 */
/* 3: 循环风门调节电机 */
/* */
/* 返回值: */
/* 0: 电机正常 1电机堵转 */
/* */
/************************************************************************************/
unsigned char GetMotorLockStatus(unsigned char motor) ;
/************************************************************************************/
/* 输入参数 p : */
/* 0: TEMP 驾驶员侧温度风门位置 */
/* 1: REC 内外循环模式 */
/* 2: FAN 鼓风机档位 */
/* 3: MODE 模式风门位置 */
/* 4: DEFROST 除霜开关 */
/* 5: REARDEF 后除霜控制 */
/* 6: AC A/C制冷按键按键 */
/* 7: K30 ECU Supplier voltage */
/* */
/* 返回值: */
/* 0: 对应的data,具体见222F服务 */
/************************************************************************************/
unsigned char GetIoParameter(unsigned char p);
/************************************************************************************/
/* 主函数查询 */
/*输入参数 p : */
/* 0: TEMP 驾驶员侧温度风门位置 */
/* 1: REC 内外循环模式 */
/* 2: FAN 鼓风机档位 */
/* 3: MODE 模式风门位置 */
/* 4: DEFROST 无效 */
/* 5: REARDEF 后除霜控制 */
/* 6: AC 无效 */
/* 7: K30 无效 */
/* 返回值: */
/* */
/************************************************************************************/
void WriteIoParameter(unsigned char p,unsigned char data);
/************************************************************************************/
/* 输入参数 p : */
/* */
/* */
/* 返回值: */
/* 0: IGN电源正常 1IGN > 16V 或 IGN < 9V */
/* */
/************************************************************************************/
unsigned char GetIgnVoltStatus(void);
/************************************************************************************
// 获取AC硬件版本 //
// 输入参数 hdv : //
// 指向读取数据存入的缓冲区的地址 //
// //
// 返回值: //
// //
// //
************************************************************************************/
void GetHardwareVersion(unsigned char* hdv);
/************************************************************************************
// 获取AC软件版本 //
// 输入参数 swv : //
// 指向读取数据存入的缓冲区的地址 //
// //
// 返回值: //
// //
// //
************************************************************************************/
void GetSoftwareVersion(unsigned char* swv);
/************************************************************************************
// 获取AC生产日期 //
// 输入参数 *date : //
// data[0] = YEAR //
// data[1] = MONTH //
// data[0] = DAY //
// //
// 返回值: //
// //
// //
************************************************************************************/
void GetManufacturingDate(unsigned char* date);
/******************************/
//获取can总线出错状态
//返回值
/******************************/
unsigned char GetCanBusOffErr(void);
/******************************/
//清除DTC
//目前仅BusOff
//
//返回值0
/******************************/
unsigned char Clear_DTC_Data(void);

View File

@ -1,198 +0,0 @@
/*******************************************************************************
* File Name : r_fsl_praxis01_boot_write.c
* Version : 1.00
* Device(s) : RL78/G13( R5F100LEA )
* Tool-Chain : CubeSuite+ ( V1.01 )
* OS : none
* H/W Platform : QB-R5F100LE-TB
* Description :
* Operation :
* Limitations : FSL AN-sample.
******************************************************************************/
/******************************************************************************
* History : Version Description
* : 09.29.2011 1.00 First Release
******************************************************************************/
/*----------------------------------------------------------------------------*/
/* (#pragma) Expanded functions */
/*----------------------------------------------------------------------------*/
#pragma sfr /* */
#pragma DI /* */
#pragma EI /* */
#pragma NOP /* */
/*----------------------------------------------------------------------------*/
/* Include files */
/*----------------------------------------------------------------------------*/
#include "fsl_user.h" /* */
/*----------------------------------------------------------------------------*/
/* Parameter */
/*----------------------------------------------------------------------------*/
/* */
static __far const fsl_descriptor_t fsl_descriptor_pstr = { 0x00, 0x20, 0x01 };
/*----------------------------------------------------------------------------*/
/* FSL functions */
/*----------------------------------------------------------------------------*/
/******************************************************************************
* Outline :
* Include : none
* Declaration : UB prFslStart(void)
* Function Name : prFslStart
* Description :
* Argument : none
* Return Value : processing result
* Calling Functions : prBootWriteProgram
******************************************************************************/
fsl_u08 prFslStart( void )
{
fsl_u08 dubRetCode;
/* Flash self-programming library initialization */
dubRetCode = FSL_Init( &fsl_descriptor_pstr );
/* When initialization has completed normally */
if( dubRetCode == FSL_OK )
{
/* Flash self-programming library start processing */
FSL_Open();
/* */
FSL_PrepareFunctions();
/* */
FSL_PrepareExtFunctions();
}
return dubRetCode;
}
/******************************************************************************
* Outline :
* Include : none
* Declaration : void prFslEnd(void)
* Function Name : prFslEnd
* Description :
* Argument : none
* Return Value : none
* Calling Functions : prBootWriteProgram
******************************************************************************/
void prFslEnd( void )
{
/* Flash self-programming library end processing */
FSL_Close();
}
/******************************************************************************
* Outline :
* Include : none
* Declaration : void prFslErase(void)
* Function Name : prFslErase
* Description :
* Argument : none
* Return Value : none
* Calling Functions :
******************************************************************************/
fsl_u08 prFslErase( fsl_u08 start_block,fsl_u08 num )
{
fsl_u08 ret_code,erase_cnt,erase_err;
if(APP_START_BLOCK <= start_block && 0 < num){
ret_code = prFslStart();
if(FSL_OK==ret_code){
erase_cnt = 0;
erase_err = 0;
while(erase_cnt<num){
DI();
ret_code = FSL_BlankCheck( start_block + erase_cnt );
/* If the target block is nonblank. */
if( ret_code == FSL_ERR_BLANKCHECK )
{
ret_code = FSL_Erase( start_block + erase_cnt );
}
EI();
if(FSL_OK==ret_code){
erase_cnt++;
erase_err = 0;
}
else{
erase_err++;
}
if(5<=erase_err){
break;
}
}
}
prFslEnd();
if(5<=erase_err){
return FSL_ERR_ERASE;
}
else{
return FSL_OK;
}
}
else{
return FSL_ERR_PARAMETER;
}
}
/******************************************************************************
* Outline :
* Include : none
* Declaration : void prFslWrite(void)
* Function Name : prFslErase
* Description :
* Argument : none
* Return Value : none
* Calling Functions :
******************************************************************************/
fsl_u32 prFslWrite(fsl_u32 start_addr,fsl_u08* buf,fsl_u16 write_num)
{
fsl_u08 ret_code,max_err,return_code;
fsl_write_t WriteConfig;
if((start_addr>=APP_START_ADDR && start_addr<=APP_END_ADDR && 0!=write_num && 0==(write_num%4)) || (start_addr>=DID_0200_ADDR && start_addr<= DID_0201_ADDR && 0!=write_num && 0==(write_num%4)) )
{
WriteConfig.fsl_data_buffer_p_u08 = buf;
WriteConfig.fsl_destination_address_u32 = start_addr;
WriteConfig.fsl_word_count_u08 = (fsl_u08)(write_num/4);
ret_code = prFslStart();
if(FSL_OK==ret_code){
DI();
ret_code = FSL_Write(&WriteConfig);
EI();
if(FSL_OK==ret_code){
return_code = FSL_OK;
}
else{
return_code = FSL_ERR_WRITE;
}
}
prFslEnd();
}
else{
return_code = FSL_ERR_PARAMETER;
}
return return_code;
}

View File

@ -1,30 +0,0 @@
#ifndef __FSL_USER_H_
#define __FSL_USER_H_
#include "boot_macrodriver.h"
#include "fsl.h" /* */
#include "fsl_types.h" /* */
#define APP_START_ADDR 0x0A000
#define APP_END_ADDR 0x19FFF
#define APP_SIZE (APP_END_ADDR - APP_START_ADDR + 1)
#define APP_START_BLOCK (fsl_u08)(APP_START_ADDR/0x400)
#define APP_TOTAL_BLOCK (fsl_u08)((APP_END_ADDR + 1 - APP_START_ADDR)/0x400)
#define FLASH_DRIVER_ADDR (0xFF9A0)
#define DM_FLASH_DRIVER_ADDR (0x5A01)
#define FLASH_DRIVER_SIZE (0x480)
/*----------------------------------------------------------------------------*/
/* Prototype declarations */
/*----------------------------------------------------------------------------*/
fsl_u08 prFslStart ( void ); /* */
void prFslEnd ( void ); /* */
fsl_u08 prFslErase( fsl_u08 start_block,fsl_u08 num );
fsl_u32 prFslWrite(fsl_u32 start_addr,fsl_u08* buf,fsl_u16 write_num);
#endif

View File

@ -1,513 +0,0 @@
/*==============================================================================================*/
/* Project = Flash self-programming library, MF3 single voltage flash */
/* Module = fsl.h */
/* Device: = RL78 */
/* Version = V2.20 */
/*==============================================================================================*/
/* COPYRIGHT */
/*==============================================================================================*/
/* Copyright(c) 2010,2011,2012 Renesas Electronics Corporation */
/*==============================================================================================*/
/* Purpose: */
/* constant and function prototype definitions used by the FSL */
/* */
/*==============================================================================================*/
/* */
/* RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY. */
/* This program must be used solely for the purpose for which it was furnished */
/* by Renesas Electronics Corporation. No part of this program may be reproduced or */
/* disclosed to others, in any form, without the prior written permission of */
/* Renesas Electronics Corporation. */
/* */
/*==============================================================================================*/
#ifndef __FSL_H_INCLUDED
#define __FSL_H_INCLUDED
/*==============================================================================================*/
/* include files list */
/*==============================================================================================*/
#include "fsl_types.h"
/*==============================================================================================*/
/* constant definitions */
/*==============================================================================================*/
/*status code definitions returned by the FSL functions */
#define FSL_OK 0x00 /* no problems */
#define FSL_ERR_PARAMETER 0x05 /* parameter error */
#define FSL_ERR_PROTECTION 0x10 /* protection error (access right conflict) */
#define FSL_ERR_ERASE 0x1A /* erase error */
#define FSL_ERR_BLANKCHECK 0x1B /* blankcheck error (MRG11) */
#define FSL_ERR_IVERIFY 0x1B /* internal verify error (MRG11) */
#define FSL_ERR_WRITE 0x1C /* write error */
#define FSL_ERR_FLOW 0x1F /* flow error (wrong timing calling) */
#define FSL_IDLE 0x30 /* idle state (any action is not running) */
#define FSL_SUSPEND 0x43 /* previous flash action is suspended */
#define FSL_BUSY 0xFF /* command is being processed */
/*==============================================================================================*/
/* global function prototypes */
/*==============================================================================================*/
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: initialization of flash environment */
/* */
/* Input: *descriptor_pstr - FSL descriptor */
/* Output: - */
/* Returned: fsl_u08, status_code */
/* = 0x00(FSL_OK), normal and means initialization OK */
/* = 0x05(FSL_ERR_PARAMETER), parameter error or HOCO isn't started */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_Init(__far fsl_descriptor_t* descriptor_pstr);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: opens flash environment */
/* Input: - */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_Open(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: closes flash environment */
/* Input: - */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_Close(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: prepares following functions to be called */
/* FSL_BlankCheck, FSL_Erase, FSL_Write, FSL_IVerify, FSL_StatusCheck */
/* Input: - */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_PrepareFunctions(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: prepares following functions to be called */
/* FSL_Set*ProtectFlag, FSL_InvertBootFlag, FSL_SetFlashShieldWindow, */
/* FSL_SwapBootCluster, FSL_SwapActiveBootCluster */
/* Input: - */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_PrepareExtFunctions(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: changes all vector addresses to specified address in RAM */
/* Input: fsl_interrupt_destination_u16 - vector address in RAM (Lower 16 bits address) */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_ChangeInterruptTable(fsl_u16 fsl_interrupt_destination_u16);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: restores all vector addresses to initial vector addresses */
/* Input: - */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_RestoreInterruptTable(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: checks if specified block is blank */
/* Input: block_u16 - block number has to be checked */
/* Output: - */
/* Returned: fsl_u08, status_code */
/* = 0x00(FSL_OK), normal and means "block is blank" */
/* = 0x05(FSL_ERR_PARAMETER), parameter error */
/* = 0x1B(FSL_ERR_BLANKCHECK), blank-check error, means "block is not blank" */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_BlankCheck(fsl_u16 block_u16);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: erase specified block */
/* Input: block_u16 - block number has to be erase */
/* Output: - */
/* Returned: fsl_u08, status_code */
/* = 0x00(FSL_OK), normal and means "block erased successfully" */
/* = 0x05(FSL_ERR_PARAMETER), parameter error */
/* = 0x10(FSL_ERR_PROTECTION), protection error */
/* = 0x1A(FSL_ERR_ERASE), erase error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_Erase(fsl_u16 block_u16);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: performs internal verify on specified block */
/* Input: block_u16 - block number has to be verified */
/* Output: - */
/* Returned: fsl_u08, status_code */
/* = 0x00(FSL_OK), normal and means "block is verified" */
/* = 0x05(FSL_ERR_PARAMETER), parameter error */
/* = 0x1B(FSL_ERR_IVERIFY), internal verify error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_IVerify(fsl_u16 block_u16);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: writes N words from the data buffer into flash */
/* Input: *write_pstr - struct fsl_write_t to write */
/* Output: - */
/* Condition: 1) (&fsl_destination_address MOD 4 == 0) */
/* 2) most significant byte (MSB) of fsl_destination_address_u32 has to be 0x00 */
/* Means: 0x00abcdef 24 bit flash address allowed */
/* 3) (0 < fsl_word_count_u08 <= 64) */
/* 4) (fsl_word_count_u08 <= sizeof(data buffer)) */
/* NOT CHECKED BY FSL */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x05(FSL_ERR_PARAMETER), parameter error */
/* = 0x10(FSL_ERR_PROTECTION), protection error */
/* = 0x1C(FSL_ERR_WRITE), write error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_Write(__near fsl_write_t* write_pstr);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: controls the flash action start/continue/check for the last called function */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x1A(FSL_ERR_ERASE), erase error */
/* = 0x1B(FSL_ERR_BLANKCHECK), blank-check error, means "block not blank" */
/* = 0x1B(FSL_ERR_IVERIFY), internal verify error */
/* = 0x1C(FSL_ERR_WRITE), write error */
/* = 0x1F(FSL_ERR_FLOW), violates the precondition. */
/* or FSL is suspending. */
/* = 0x30(FSL_IDLE), any action is not running */
/* = 0xFF(FSL_BUSY), normal and means "process was not finished" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_StatusCheck(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: suspends the flash action */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), previous flash action is OK. */
/* And the state is suspended. */
/* = 0x1A(FSL_ERR_ERASE), previous flash action is Erase error. */
/* And the state is suspended. */
/* = 0x1B(FSL_ERR_BLANKCHECK), previous flash action is Blank error. */
/* And the state is suspended. */
/* = 0x1B(FSL_ERR_IVERIFY), previous flash action is IVerify error. */
/* And the state is suspended. */
/* = 0x1C(FSL_ERR_WRITE), previous flash action is Write error. */
/* And the state is suspended. */
/* = 0x1F(FSL_ERR_FLOW), violates the precondition. */
/* or has been already suspending. */
/* = 0x30(FSL_IDLE), any action are not running. */
/* And the state is suspended. */
/* = 0x43(FSL_SUSPEND), OK, previous flash action is suspended. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_StandBy(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: resumes the flash action */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), resumed flash action is OK. */
/* And the state is resumed from the suspended state. */
/* = 0x1A(FSL_ERR_ERASE), resumed flash action is Erase error. */
/* And the state is resumed from the suspended state. */
/* = 0x1F(FSL_ERR_FLOW), violates the precondition. */
/* or FSL is not suspending. */
/* = 0xFF(FSL_BUSY), resumed flash action is BUSY. */
/* And the state is resumed from the suspended state. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_WakeUp(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: puts the security information into the destination variable */
/* Input: *data_destination_pu08 - destination variable of the security info */
/* The format of the security info is: "unsigned char" */
/* */
/* Format of the security info: */
/* bit_1 = 0 -> boot-area re-programming disabled, otherwise enabled */
/* bit_2 = 0 -> block erase command disabled, otherwise enabled */
/* bit_4 = 0 -> write command disabled, otherwise enabled */
/* other bits = 1 */
/* Output: data_destination_pu08 - security info */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_GetSecurityFlags(fsl_u08 __near *data_destination_pu08);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: puts the boot flag into the destination variable */
/* Input: *data_destination_pu08 - destination variable of the boot flag */
/* The format of the boot flag info is: "unsigned char" */
/* The value of the boot info is 0x00 for cluster 0 and 0x01 for cluster 1. */
/* Output: data_destination_pu08 - the boot flag info */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_GetBootFlag(fsl_u08 __near *data_destination_pu08);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: puts the state of swap boot clusters into the destination variable */
/* Input: *data_destination_pu08 - destination variable of the state of boot info */
/* The format of the state of boot info is: "unsigned char" */
/* The value of the state of boot info is 0x00 for cluster 0 */
/* and 0x01 for cluster 1. */
/* Output: data_destination_pu08 - the state of boot info */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_GetSwapState(fsl_u08 __near *data_destination_pu08);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: puts the last address of the specified block into fsl_destination_address_u32 */
/* Input: *getblockendaddr_pstr - struct fsl_getblockendaddr_t to get the last address */
/* Output: fsl_destination_address_u32 - the last address */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x05(FSL_ERR_PARAMETER), parameter error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_GetBlockEndAddr(__near fsl_getblockendaddr_t* getblockendaddr_pstr);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: puts the information about the protected flash area into fsl_*_block_u16 */
/* Input: *getfsw_pstr - struct fsl_fsw_t to get FSW */
/* Output: fsl_start_block_u16 - the start block of FSW */
/* fsl_end_block_u16 - the end block of FSW */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_GetFlashShieldWindow(__near fsl_fsw_t* getfsw_pstr);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: sets specified security flag by dedicated command-function. */
/* */
/* There are following security levels: */
/* a) block-erase protection */
/* b) write protection */
/* c) boot-cluster protection */
/* */
/* CAUTION: */
/* Each security flag can be written by the application only once */
/* */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x1A(FSL_ERR_ERASE), erase error */
/* = 0x1B(FSL_ERR_IVERIFY), internal verify error */
/* = 0x1C(FSL_ERR_WRITE), write error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_SetBlockEraseProtectFlag(void);
extern fsl_u08 FSL_SetWriteProtectFlag(void);
extern fsl_u08 FSL_SetBootClusterProtectFlag(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: inverts the boot flag. */
/* */
/* CAUTION: */
/* After reset, the boot clusters will be switched regarding this boot flag */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x10(FSL_ERR_PROTECTION), protection error */
/* = 0x1A(FSL_ERR_ERASE), erase error */
/* = 0x1B(FSL_ERR_IVERIFY), internal verify error */
/* = 0x1C(FSL_ERR_WRITE), write error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_InvertBootFlag(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: defines a new Flash Shield Window inside the flash memory */
/* Input: *setfsw_pstr - struct fsl_fsw_t to set FSW */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x05(FSL_ERR_PARAMETER), parameter error */
/* = 0x10(FSL_ERR_PROTECTION), protection error */
/* = 0x1A(FSL_ERR_ERASE), erase error */
/* = 0x1B(FSL_ERR_IVERIFY), internal verify error */
/* = 0x1C(FSL_ERR_WRITE), write error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_SetFlashShieldWindow(__near fsl_fsw_t* setfsw_pstr);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: swaps boot cluster 0 and boot cluster 1 physically without setting */
/* the boot flag. After swap the library jumps to the address of the */
/* reset vector. */
/* */
/* CAUTION: */
/* After reset, the boot cluster will be switched regarding the boot flag */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x10(FSL_ERR_PROTECTION), protection error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_SwapBootCluster(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: inverts the boot flag and swaps boot cluster 0 and boot cluster 1 physically */
/* */
/* CAUTION: */
/* After reset, the boot clusters will be switched regarding this boot flag */
/* Input: - */
/* Output: - */
/* Returned: fsl_u08, status code */
/* = 0x00(FSL_OK), normal */
/* = 0x10(FSL_ERR_PROTECTION), protection error */
/* = 0x1A(FSL_ERR_ERASE), erase error */
/* = 0x1B(FSL_ERR_IVERIFY), internal verify error */
/* = 0x1C(FSL_ERR_WRITE), write error */
/* = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet. */
/* or violates the precondition. */
/* or FSL is suspending. */
/* = 0xFF(FSL_BUSY), normal and means "process was started" */
/*----------------------------------------------------------------------------------------------*/
extern fsl_u08 FSL_SwapActiveBootCluster(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: forces a hardware reset via illegal instruction */
/* Input: - */
/* Output: - */
/* Returned: - */
/*----------------------------------------------------------------------------------------------*/
extern void FSL_ForceReset(void);
/*----------------------------------------------------------------------------------------------*/
/* Block type: FSL command function */
/*----------------------------------------------------------------------------------------------*/
/* Purpose: gets the internal version information of the used FSL */
/* Input: - */
/* Output: - */
/* Returned: pointer to version string */
/*----------------------------------------------------------------------------------------------*/
extern __far fsl_u08* FSL_GetVersionString(void);
#endif

View File

@ -1,513 +0,0 @@
;=================================================================================================
; Project = Flash self-programming library, MF3 single voltage flash
; Module = fsl.inc
; Device: = RL78
; Version = V2.20
;=================================================================================================
; COPYRIGHT
;=================================================================================================
; Copyright(c) 2010,2011,2012 Renesas Electronics Corporation
;=================================================================================================
; Purpose:
; implementation module of low-level flash memory access
; CAUTION: Please comment out unused function prototypes
; for code size reduction.
;
;=================================================================================================
;
; RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY.
; This program must be used solely for the purpose for which it was furnished
; by Renesas Electronics Corporation. No part of this program may be reproduced or
; disclosed to others, in any form, without the prior written permission of
; Renesas Electronics Corporation.
;
;=================================================================================================
$IF (__FSL_INC_INCLUDED)
$ELSE
$SET (__FSL_INC_INCLUDED)
;=================================================================================================
; constant definitions
;=================================================================================================
;status code definitions returned by the FSL functions
FSL_OK EQU (000H) ; no problems
FSL_ERR_PARAMETER EQU (005H) ; parameter error
FSL_ERR_PROTECTION EQU (010H) ; protection error (access right conflict)
FSL_ERR_ERASE EQU (01AH) ; erase error
FSL_ERR_BLANKCHECK EQU (01BH) ; blankcheck error (MRG11)
FSL_ERR_IVERIFY EQU (01BH) ; internal verify error (MRG11)
FSL_ERR_WRITE EQU (01CH) ; write error
FSL_ERR_FLOW EQU (01FH) ; flow error (wrong timing calling)
FSL_IDLE EQU (030H) ; idle state (any action is not running)
FSL_SUSPEND EQU (043H) ; previous flash action is suspended
FSL_BUSY EQU (0FFH) ; command is being processed
;=================================================================================================
; global function prototypes
;=================================================================================================
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: initialization of flash environment
;
; Input: AX,C - pointer to FSL descriptor
; Output: -
; Returned: C, status_code
; = 0x00(FSL_OK), normal and means initialization OK
; = 0x05(FSL_ERR_PARAMETER), parameter error or HOCO isn't started
;----------------------------------------------------------------------------------------------
EXTRN _FSL_Init
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: opens flash environment
; Input: -
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_Open
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: closes flash environment
; Input: -
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_Close
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: prepares following functions to be called
; FSL_BlankCheck, FSL_Erase, FSL_Write, FSL_IVerify, FSL_StatusCheck
; Input: -
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_PrepareFunctions
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: prepares following functions to be called
; FSL_Set*ProtectFlag, FSL_InvertBootFlag, FSL_SetFlashShieldWindow,
; FSL_SwapBootCluster, FSL_SwapActiveBootCluster
; Input: -
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_PrepareExtFunctions
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: changes all vector addresses to specified address in RAM
; Input: AX - vector address in RAM (Lower 16 bits address)
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_ChangeInterruptTable
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: restores all vector addresses to initial vector addresses
; Input: -
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_RestoreInterruptTable
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: checks if specified block is blank
; Input: AX - block number has to be checked
; Output: -
; Returned: C, status_code
; = 0x00(FSL_OK), normal and means "block is blank"
; = 0x05(FSL_ERR_PARAMETER), parameter error
; = 0x1B(FSL_ERR_BLANKCHECK), blank-check error, means "block is not blank"
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_BlankCheck
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: erase specified block
; Input: AX - block number has to be erase
; Output: -
; Returned: C, status_code
; = 0x00(FSL_OK), normal and means "block erased successfully"
; = 0x05(FSL_ERR_PARAMETER), parameter error
; = 0x10(FSL_ERR_PROTECTION), protection error
; = 0x1A(FSL_ERR_ERASE), erase error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_Erase
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: performs internal verify on specified block
; Input: AX - block number has to be verified
; Output: -
; Returned: C, status_code
; = 0x00(FSL_OK), normal and means "block is verified"
; = 0x05(FSL_ERR_PARAMETER), parameter error
; = 0x1B(FSL_ERR_IVERIFY), internal verify error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_IVerify
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: writes N words from the data buffer into flash
; Input: AX - pointer to struct fsl_write_str to write
; Output: -
; Condition: 1) (fsl_destination_address_u32 MOD 4 == 0)
; 2) most significant byte (MSB) of fsl_destination_address_u32 has to be 0x00
; Means: 0x00abcdef 24 bit flash address allowed
; 3) (0 < fsl_word_count_u08 <= 64)
; 4) (fsl_word_count_u08 <= sizeof(data buffer))
; NOT CHECKED BY FSL
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x05(FSL_ERR_PARAMETER), parameter error
; = 0x10(FSL_ERR_PROTECTION), protection error
; = 0x1C(FSL_ERR_WRITE), write error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_Write
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: controls the flash action start/continue/check for the last called function
; Input: -
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x1A(FSL_ERR_ERASE), erase error
; = 0x1B(FSL_ERR_BLANKCHECK), blank-check error, means "block not blank"
; = 0x1B(FSL_ERR_IVERIFY), internal verify error
; = 0x1C(FSL_ERR_WRITE), write error
; = 0x1F(FSL_ERR_FLOW), violates the precondition.
; or FSL is suspending.
; = 0x30(FSL_IDLE), any action is not running
; = 0xFF(FSL_BUSY), normal and means "process was not finished"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_StatusCheck
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: susdends the flash action
; Input: -
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), previous flash action is OK.
; And the state is suspended.
; = 0x1A(FSL_ERR_ERASE), previous flash action is Erase error.
; And the state is suspended.
; = 0x1B(FSL_ERR_BLANKCHECK), previous flash action is Blank error.
; And the state is suspended.
; = 0x1B(FSL_ERR_IVERIFY), previous flash action is IVerify error.
; And the state is suspended.
; = 0x1C(FSL_ERR_WRITE), previous flash action is Write error.
; And the state is suspended.
; = 0x1F(FSL_ERR_FLOW), violates the precondition.
; or has been already suspending.
; = 0x30(FSL_IDLE), any action are not running.
; And the state is suspended.
; = 0x43(FSL_SUSPEND), OK, previous flash action is suspended.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_StandBy
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: resumes the flash action
; Input: -
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), resumed flash action is OK.
; And the state is resumed from the suspended state.
; = 0x1A(FSL_ERR_ERASE), resumed flash action is Erase error.
; And the state is resumed from the suspended state.
; = 0x1F(FSL_ERR_FLOW), violates the precondition.
; or FSL is not suspending.
; = 0xFF(FSL_BUSY), resumed flash action is BUSY.
; And the state is resumed from the suspended state.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_WakeUp
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: puts the security information into the destination address
; Input: AX - destination address of the security info
; The format of the security info is: "unsigned char"
;
; Format of the security info:
; bit_1 = 0 -> boot-area re-programming disabled, otherwise enabled
; bit_2 = 0 -> block erase command disabled, otherwise enabled
; bit_4 = 0 -> write command disabled, otherwise enabled
; other bits = 1
; Output: data_destination_pu08 - security info
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_GetSecurityFlags
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: puts the boot flag into the destination address
; Input: AX - destination address of the boot flag
; The format of the boot flag info is: "unsigned char"
; The value of the boot info is 0x00 for cluster 0 and 0x01 for cluster 1.
; Output: data_destination_pu08 - the boot flag info
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_GetBootFlag
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: puts the state of swap boot clusters into the destination address
; Input: AX - destination address of the state of boot info
; The format of the state of boot info is: "unsigned char"
; The value of the state of boot info is 0x00 for cluster 0
; and 0x01 for cluster 1.
; Output: data_destination_pu08 - the state of boot info
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_GetSwapState
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: puts the last address of the specified block into fsl_destination_address_u32
; Input: AX - pointer to struct fsl_getblockendaddr_str to get the last address
; Output: fsl_destination_address_u32 - the last address
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x05(FSL_ERR_PARAMETER), parameter error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_GetBlockEndAddr
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: puts the information about the protected flash area into fsl_*_block_u16
; Input: AX - pointer to struct fsl_fsw_str to get FSW
; Output: fsl_start_block_u16 - the start block of FSW
; fsl_end_block_u16 - the end block of FSW
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_GetFlashShieldWindow
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: sets specified security flag by dedicated command-function.
;
; There are following security levels:
; a) block-erase protection
; b) write protection
; c) boot-cluster protection
;
; CAUTION:
; Each security flag can be written by the application only once
;
; Input: -
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x1A(FSL_ERR_ERASE), erase error
; = 0x1B(FSL_ERR_IVERIFY), internal verify error
; = 0x1C(FSL_ERR_WRITE), write error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_SetBlockEraseProtectFlag
EXTRN _FSL_SetWriteProtectFlag
EXTRN _FSL_SetBootClusterProtectFlag
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: inverts the boot flag.
;
; CAUTION:
; After reset, the boot clusters will be switched regarding this boot flag
; Input: -
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x10(FSL_ERR_PROTECTION), protection error
; = 0x1A(FSL_ERR_ERASE), erase error
; = 0x1B(FSL_ERR_IVERIFY), internal verify error
; = 0x1C(FSL_ERR_WRITE), write error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_InvertBootFlag
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: defines a new Flash Shield Window inside the flash memory
; Input: AX - pointer struct fsl_fsw_str to set FSW
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x05(FSL_ERR_PARAMETER), parameter error
; = 0x10(FSL_ERR_PROTECTION), protection error
; = 0x1A(FSL_ERR_ERASE), erase error
; = 0x1B(FSL_ERR_IVERIFY), internal verify error
; = 0x1C(FSL_ERR_WRITE), write error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_SetFlashShieldWindow
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: swaps boot cluster 0 and boot cluster 1 physically without setting
; the boot flag. After swap the library jumps to the address of the
; reset vector.
;
; CAUTION:
; After reset, the boot cluster will be switched regarding the boot flag
; Input: -
; Output: -
; Returned: C, status code
; = 0x10(FSL_ERR_PROTECTION), protection error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
;----------------------------------------------------------------------------------------------
EXTRN _FSL_SwapBootCluster
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: inverts the boot flag and swaps boot cluster 0 and boot cluster 1 physically
;
; CAUTION:
; After reset, the boot clusters will be switched regarding this boot flag
; Input: -
; Output: -
; Returned: C, status code
; = 0x00(FSL_OK), normal
; = 0x10(FSL_ERR_PROTECTION), protection error
; = 0x1A(FSL_ERR_ERASE), erase error
; = 0x1B(FSL_ERR_IVERIFY), internal verify error
; = 0x1C(FSL_ERR_WRITE), write error
; = 0x1F(FSL_ERR_FLOW), last operation has not finished, yet.
; or violates the precondition.
; or FSL is suspending.
; = 0xFF(FSL_BUSY), normal and means "process was started"
;----------------------------------------------------------------------------------------------
EXTRN _FSL_SwapActiveBootCluster
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: forces a hardware reset via illegal instruction
; Input: -
; Output: -
; Returned: -
;----------------------------------------------------------------------------------------------
EXTRN _FSL_ForceReset
;----------------------------------------------------------------------------------------------
; Block type: FSL command function
;----------------------------------------------------------------------------------------------
; Purpose: gets the internal version information of the used FSL
; Input: -
; Output: -
; Returned: BC, pointer to version string(L)
; DE, pointer to version string(H)
;----------------------------------------------------------------------------------------------
EXTRN _FSL_GetVersionString
$ENDIF

View File

@ -1,84 +0,0 @@
/*==============================================================================================*/
/* Project = Flash self-programming library, MF3 single voltage flash */
/* Module = fsl_types.h */
/* Device: = RL78 */
/* Version = V2.20 */
/*==============================================================================================*/
/* COPYRIGHT */
/*==============================================================================================*/
/* Copyright(c) 2010,2011,2012 Renesas Electronics Corporation */
/*==============================================================================================*/
/* Purpose: definition of types used by the library */
/*==============================================================================================*/
/* */
/* RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY. */
/* This program must be used solely for the purpose for which it was furnished */
/* by Renesas Electronics Corporation. No part of this program may be reproduced or */
/* disclosed to others, in any form, without the prior written permission of */
/* Renesas Electronics Corporation. */
/* */
/*==============================================================================================*/
#ifndef __FSL_TYPES_H_INCLUDED
#define __FSL_TYPES_H_INCLUDED
/*==============================================================================================*/
/* unsigned type definitions */
/*==============================================================================================*/
typedef unsigned char fsl_u08;
typedef unsigned int fsl_u16;
typedef unsigned long int fsl_u32;
/*==============================================================================================*/
/* global constant definitions */
/*==============================================================================================*/
/*==============================================================================================*/
/* global type definitions */
/*==============================================================================================*/
/* FSL descriptor type */
typedef struct { /* ---------------------------------------------- */
fsl_u08 fsl_flash_voltage_u08; /* 1, setting of flash voltage mode */
fsl_u08 fsl_frequency_u08; /* 1, CPU frequency (MHz) */
fsl_u08 fsl_auto_status_check_u08; /* 1, setting of status check mode */
} fsl_descriptor_t; /*------------------------------------------------*/
/* 3 bytes in total */
/*------------------------------------------------*/
/* FSL write type */
typedef struct { /* ---------------------------------------------- */
fsl_u08 __near *fsl_data_buffer_p_u08; /* 2, pointer to data buffer */
fsl_u32 fsl_destination_address_u32; /* 4, starting address to write data */
fsl_u08 fsl_word_count_u08; /* 1, number of words to write data */
} fsl_write_t; /*------------------------------------------------*/
/* 7 bytes in total */
/*------------------------------------------------*/
/* FSL get block end address type */
typedef struct { /* ---------------------------------------------- */
fsl_u32 fsl_destination_address_u32; /* 4, destination variable for the end address */
fsl_u16 fsl_block_u16; /* 2, block number */
} fsl_getblockendaddr_t; /*------------------------------------------------*/
/* 6 bytes in total */
/*------------------------------------------------*/
/* FSL get and set flash shield window type */
typedef struct { /* ---------------------------------------------- */
fsl_u16 fsl_start_block_u16; /* 2, start block number of FSW (destination) */
fsl_u16 fsl_end_block_u16; /* 2, end block number of FSW (destination) */
} fsl_fsw_t; /*------------------------------------------------*/
/* 4 bytes in total */
/*------------------------------------------------*/
#endif

Binary file not shown.

View File

@ -1,868 +0,0 @@
/*==============================================================================*/
/* */
/* Project = Sample program for flash self-programming library */
/* Module = r_fsl_sample_c.c */
/* Version = V1.01(Target FSL Version for CA78K0R is V2.20) */
/* Target CPU = RL78/G13 ( R5F100LEA / QB-R5F100LE-TB ) */
/* Environment = CS+ for CA[CA78K0R],CX (V3.00) */
/* */
/* Date = 12, 28, 2016 */
/* */
/*==============================================================================*/
/* COPYRIGHT */
/*==============================================================================*/
/* DISCLAIMER */
/* This software is supplied by Renesas Electronics Corporation and is only */
/* intended for use with Renesas products. No other uses are authorized. This */
/* software is owned by Renesas Electronics Corporation and is protected under */
/* all applicable laws, including copyright laws. */
/* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING */
/* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT */
/* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE */
/* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. */
/* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS */
/* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE */
/* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR */
/* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE */
/* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */
/* Renesas reserves the right, without notice, to make changes to this software */
/* and to discontinue the availability of this software. By using this software,*/
/* you agree to the additional terms and conditions found by accessing the */
/* following link: */
/* http://www.renesas.com/disclaimer */
/* */
/* Copyright (C) 2010-2016 Renesas Electronics Corporation. All rights reserved.*/
/*==============================================================================*/
/*------------------------------------------------------------------------------*/
/* Expanded functions */
/*------------------------------------------------------------------------------*/
#pragma sfr /* SFR (Special Function Register) area usage declaration */
#pragma DI /* Interrupt disable instruction usage declaration */
#pragma EI /* Interrupt enable instruction usage declaration */
#pragma NOP /* CPU control instruction (NOP) usage declaration */
/*------------------------------------------------------------------------------*/
/* interrupt function */
/*------------------------------------------------------------------------------*/
#pragma interrupt INTWDTI samIntWdt /* WDT interrupt */
/*------------------------------------------------------------------------------*/
/* section and switch */
/*------------------------------------------------------------------------------*/
/******************************************/
/* Setting of sections for sample program */
/******************************************/
/* Sets (changes) section names of code (program) */
#ifdef __RL78_SMALL__
#pragma section @@CODE SAM_CODE
#else
#pragma section @@CODEL SAM_CODE
#endif
/* Sets (changes) section names of fixed-value table (const) */
#ifdef __RL78_LARGE__
#pragma section @@CNSTL SAM_CNST
#else
#pragma section @@CNST SAM_CNST
#endif
/* Sets (changes) section names of data (variable) */
#ifdef __RL78_LARGE__
#pragma section @@DATAL SAM_DATA
#else
#pragma section @@DATA SAM_DATA
#endif
/***********************************************/
/* Symbol for program switch of sample program */
/***********************************************/
/* Can be set when QB-R5F100LE-TB is used alone */
#if 0
#define __QB_R5F100LE_TB__ /* */
/* Other boards (on-chip oscillator setting) */
#else
#define __NON_TARGET__ /* */
#endif
/*------------------------------------------------------------------------------*/
/* Include files */
/*------------------------------------------------------------------------------*/
/* Standard library (runtime library is used) */
#include <string.h> /* For memcpy */
/* Flash self-programming library */
#include "fsl.h" /* Library header file */
#include "fsl_types.h" /* Library header file */
/*------------------------------------------------------------------------------*/
/* structure */
/*------------------------------------------------------------------------------*/
/* Writing setting parameter structure for sample program */
typedef struct {
fsl_u08 *pubDataBuffer; /* Pointer to the start of data buffer */
fsl_u08 dubStartBlock; /* Writing start block number */
fsl_u08 *pubWriteData; /* Pointer to the beginning of write data */
fsl_u32 duwWriteDataSize; /* Write data size */
fsl_u08 dubEndOption; /* End option */
} SAM_FSL_PARM_T;
/*------------------------------------------------------------------------------*/
/* Constant definitions */
/*------------------------------------------------------------------------------*/
/*****************************************/
/* Symbol definitions for sample program */
/*****************************************/
/* Error code */
#define SAM_ERR_PARM 0x7F /* Parameter error */
#define SAM_ERR_OPT 0x80 /* Option execution error flag */
/* Basic data */
#define SAM_BLOCK_SIZE 0x400l /* Standard block size */
#define SAM_WORD_SIZE 4 /* Standard word size */
#define SAM_DUMYY_DATA 0xFF /* Dummy write data */
#define SAM_DATA_SIZE 0x490 /* Write data size */
#define SAM_BUFFER_SIZE 256 /* Write buffer size */
/* Option code for sample program */
#define SAM_OPT_NON 0x00 /* No options */
#define SAM_OPT_RST 0x01 /* Reset execution */
#define SAM_OPT_CBOOT 0x02 /* Boot flag change */
#define SAM_OPT_ACT_SWAP 0x03 /* Boot flag change + swapping (executable only in RAM) */
#define SAM_OPT_CBOOT_RST 0x04 /* Boot flag change + reset */
#define SAM_OPT_CBOOT_SUP 0x05 /* Boot flag change + swapping + return to start */
#define SAM_OPT_SUP 0x06 /* Swapping + return to start (no change in boot flag) */
/* Control macro for sample program */
#define SAM_WDT_RESET() WDTE = 0xAC /* Watchdog timer reset */
/**************************************************/
/* QB-R5F100LE-TB: Symbol definitions for writing */
/**************************************************/
#ifdef __QB_R5F100LE_TB__
#define SAM_START_BLOCK 0x04 /* Writing start block number (4: 1000H) */
#define SAM_SET_OPTION SAM_OPT_CBOOT /* After writing, the option to change the boot flag is set */
/* QB-R5F100LE-TB, LED control macros */
#define SAM_LED1_INIT() P6.2 = 1, PM6.2 = 0
/* Initializes on-board LED1 (turns off) */
#define SAM_LED1_ON() P6.2 = 0 /* Turns on on-board LED1 */
#define SAM_LED1_OFF() P6.2 = 1 /* Turns off on-board LED1 */
#define SAM_LED2_INIT() P6.3 = 1, PM6.3 = 0
/* Initializes on-board LED2 (turns off) */
#define SAM_LED2_ON() P6.3 = 0 /* Turns on on-board LED2 */
#define SAM_LED2_OFF() P6.3 = 1 /* Turns off on-board LED2 */
/*************************************************************/
/* Symbol definitions for making settings for normal writing */
/*************************************************************/
#else
#define SAM_START_BLOCK 0x0D /* Writing start block (D: address 3400) */
#define SAM_SET_OPTION SAM_OPT_NON /* No option setting */
/* No processes for LED (invalid code) */
#define SAM_LED1_INIT()
#define SAM_LED1_ON()
#define SAM_LED1_OFF()
#define SAM_LED2_INIT()
#define SAM_LED2_ON()
#define SAM_LED2_OFF()
#endif
/*------------------------------------------------------------------------------*/
/* external reference parameter */
/*------------------------------------------------------------------------------*/
/* Data buffer body */
fsl_u08 fsl_data_buffer[ SAM_BUFFER_SIZE ];
/* Fixed-value table for writing */
extern const fsl_u08 samDubWriteData[ SAM_DATA_SIZE ];
/*********************************************************/
/* QB-R5F100LE-TB, */
/*********************************************************/
#ifdef __QB_R5F100LE_TB__
/* Sets the operating clock to internal 32-MHz clock (external 20-MHz clock is not used because the clock setting is not confirmed) */
const __far fsl_descriptor_t fsl_descriptor_pstr = { 0x00, 0x20, 0x01 };
#else
/* Sets the operating clock to internal 32-MHz clock */
const __far fsl_descriptor_t fsl_descriptor_pstr = { 0x00, 0x20, 0x01 };
#endif
/*------------------------------------------------------------------------------*/
/* prototype declarations */
/*------------------------------------------------------------------------------*/
/* Sample functions for target */
void samTargetInit( void ); /* Target initialization processing */
void samTargetEnd ( void ); /* Target end processing */
/* Sample functions for writing program */
fsl_u08 samFslBlockWrite( SAM_FSL_PARM_T * ); /* Writing program body */
fsl_u08 samFslStart ( void ); /* Flash self-programming library start processing */
void samFslEnd ( void ); /* Flash self-programming library end processing */
/*##############################################################################*/
/*------------------------------------------------------------------------------*/
/* start-up : hdwinit functions */
/*------------------------------------------------------------------------------*/
/*==============================================================================*/
/* Function name : hdwinit */
/* IN : void */
/* OUT : void */
/* Description : Hardware initialization function for the start-up routine */
/* Note 1: The start-up routine should be executed before the */
/* main function. */
/* Note 2: Should be called in the DI(interrupt disabled) state.*/
/* Date : 04,28,2011 */
/*==============================================================================*/
void hdwinit( void )
{
/***********************************/
/* Setting of low-voltage detector */
/***********************************/
LVIM = 0x00; /* Initializes the voltage detection register setting */
LVIS = 0x00; /* Initializes the voltage detection level register setting */
/* Makes the setting to switch to external 20-MHz oscillator for QB-R5F100LE-TB */
#if 0
/* Deleted because the clock setting has not yet been confirmed. */
/***********************************************************************************************/
/* Initialization of clock control registers */
/* The operating clock is changed from on-chip oscillator to X1 oscillator (20 MHz is assumed) */
/* Note: When the above change is not made, set fsl_user.h to 20 MHz. */
/***********************************************************************************************/
/* Subsystem clock supply mode control register */
OSMC = 0b00000001; /* Specifies operation at a frequency exceeding 10 MHz */
/* Clock operation mode control register */
CMC = 0b01010001; /* Sets the oscillation modes for X1 and XT1 pins and sets the X1 frequency to 10 MHz < fx <= 20 MHz */
/* Clock operation status control register */
CSC = 0b00000000; /* Starts X1 and XT1 oscillators */
/* Oscillation stabilization time select register */
OSTS = 0b11110000; /* Sets the X1 oscillation stabilization time (102.4 us or more at fx = 20 MHz) */
/* Oscillation stabilization time counter status register */
while( OSTC == 0 ); /* Waits for the X1 oscillation stabilization time to pass (all 0) */
/* System clock control register */
CKC = 0b00011000; /* Changes the main system clock from on-chip oscillator to X1 oscillator */
while( MCS == 0 ); /* Confirms the main system clock (fMAIN) status */
/* Note: Oscillator switching is confirmed (MCS: bit 5 of CKC register) */
/* Clock operation status control register: Controls operation of the high-speed on-chip oscillator */
/* HIOSTOP = 1; */ /* CSC = 0b00000001: Stops the high-speed on-chip oscillator */
/* Since the high-speed on-chip oscillator is required to execute RL78 self-programming, */
/* the high-speed on-chip oscillator is not stopped. */
#endif
}
/*##############################################################################*/
/*------------------------------------------------------------------------------*/
/* main functions */
/*------------------------------------------------------------------------------*/
/*==============================================================================*/
/* Function name : main */
/* IN : void */
/* OUT : void */
/* Description : Main function */
/* Date : 04,28,2011 */
/*==============================================================================*/
void main( void )
{
fsl_u08 dubRetCode; /* Return code */
SAM_FSL_PARM_T dtyFslData; /* Parameter for writing program */
/* Target initialization processing */
samTargetInit();
/* Enables interrupts */
EI();
/* Parameter setting */
dtyFslData.pubDataBuffer = fsl_data_buffer; /* Start address of data buffer */
dtyFslData.dubStartBlock = SAM_START_BLOCK; /* Writing start block number */
dtyFslData.pubWriteData = samDubWriteData; /* Start address of write data */
dtyFslData.duwWriteDataSize = SAM_DATA_SIZE; /* Write data size */
dtyFslData.dubEndOption = SAM_SET_OPTION; /* End option of writing program */
/* Calls the sample writing program */
dubRetCode = samFslBlockWrite( &dtyFslData );
/* Normal termination */
if( dubRetCode == FSL_OK )
{ }
/* Abnormal termination */
else {
/* Abnormal determination process */
/* Error in parameter check or rewrite process */
if( ( dubRetCode & SAM_ERR_OPT ) != SAM_ERR_OPT )
{
/* Error check */
switch( dubRetCode )
{
/* Errors caused by flash self-programming library */
case FSL_ERR_PARAMETER: /* Parameter error */
case FSL_ERR_PROTECTION: /* Protect error */
case FSL_ERR_ERASE: /* Erasure error */
case FSL_ERR_IVERIFY: /* Internal verification error */
case FSL_ERR_WRITE: /* Writing error */
break;
/* Sample program error */
case SAM_ERR_PARM: /* Parameter error */
break;
/* Others */
default:
break;
}
}
/* Error caused by option execution */
else {
dubRetCode &= ~SAM_ERR_OPT; /* Option flag is false */
/* Error check */
switch( dubRetCode )
{
/* Errors caused by flash self-programming library */
case FSL_ERR_PARAMETER: /* Parameter error */
case FSL_ERR_PROTECTION: /* Protect error */
case FSL_ERR_ERASE: /* Erasure error */
case FSL_ERR_IVERIFY: /* Internal verification error */
case FSL_ERR_WRITE: /* Writing error */
break;
/* Others */
default:
break;
}
}
}
/* Target end processing */
samTargetEnd();
/* WDT reset execution process for QB_R5F100LE_TB */
#ifdef __QB_R5F100LE_TB__
/* Disables interrupts */
DI();
/* Resets the watchdog timer once */
SAM_WDT_RESET();
#endif
/* End loop (this is reset by watchdog timer) */
while( 1 )
{
NOP();
NOP();
}
}
/*##############################################################################*/
/*------------------------------------------------------------------------------*/
/* sub functions */
/*------------------------------------------------------------------------------*/
/*==============================================================================*/
/* Function name : samFslBlockWrite */
/* IN : SAM_FSL_PARM_T / Setting parameter group */
/* OUT : fsl_u08 / Return code */
/* Description : Sample program for flash self-programming */
/* Date : 04,28,2011 */
/*==============================================================================*/
fsl_u08 samFslBlockWrite( SAM_FSL_PARM_T *ptyFslData )
{
fsl_u08 dubRetCode; /* Return code */
fsl_u32 duwWriteBlockNum; /* Number of remaining blocks to be written */
fsl_u16 duhWriteBufSize; /* Size of data buffer for writing */
/*******************************************************/
/* Setting parameter check + Initialization processing */
/*******************************************************/
if( ( ptyFslData->duwWriteDataSize == 0 ) ||
( ptyFslData->pubDataBuffer == 0 ) )
{
dubRetCode = SAM_ERR_PARM; /* Parameter error */
}
else {
/* When the data buffer is not in word units (4 bytes), the remainder is */
/* rounded down to adjust the maximum write data length to be in word units. */
duhWriteBufSize = SAM_BUFFER_SIZE - SAM_BUFFER_SIZE % SAM_WORD_SIZE;
/* Flash self-programming library start processing */
dubRetCode = samFslStart();
}
/*******************/
/* Writing process */
/*******************/
/* Loops until all data has been written or an error has occurred */
for( duwWriteBlockNum = ( ( ptyFslData->duwWriteDataSize - 1 ) / SAM_BLOCK_SIZE ) + 1 ;
( duwWriteBlockNum != 0 ) && ( dubRetCode == FSL_OK ) ;
duwWriteBlockNum-- ,ptyFslData->dubStartBlock++ )
{
/* Confirms the state of the target block */
dubRetCode = FSL_BlankCheck( ptyFslData->dubStartBlock );
/* If the target block is not in the blank state */
if( dubRetCode == FSL_ERR_BLANKCHECK )
{
dubRetCode = FSL_Erase( ptyFslData->dubStartBlock );
}
/* Writing process (in block units) */
if( dubRetCode == FSL_OK )
{
fsl_u32 duwRemDataSize; /* Size of data not yet written */
fsl_u32 duwWriteAddress; /* Writing destination address */
fsl_u32 duwOneWriteSize; /* Write data length */
fsl_write_t dtyWriteBuff; /* */
/* Calculates the writing start address */
duwWriteAddress = ptyFslData->dubStartBlock * SAM_BLOCK_SIZE;
/* If this is not the last write block (data remains to be written to the next block) */
if( duwWriteBlockNum > 1 )
{
/* Sets the write data size for the block size */
duwRemDataSize = SAM_BLOCK_SIZE;
}
else {
/* When this is the last block, sets the remaining data for the write data size */
duwRemDataSize = ptyFslData->duwWriteDataSize;
}
/* Loops until all remaining data of the target block has been written or an error has occurred */
for( ; ( duwRemDataSize != 0 ) && ( dubRetCode == FSL_OK ) ;
duwWriteAddress += duhWriteBufSize )
{
/* If the remaining write data is the same size as the data buffer */
if( duwRemDataSize >= duhWriteBufSize )
{
/* Sets the buffer size as the unit for writing */
duwOneWriteSize = duhWriteBufSize;
}
else {
/* Sets the remaining write data size as the unit for writing */
duwOneWriteSize = ptyFslData->duwWriteDataSize;
}
/* Copies the write data to the data buffer */
memcpy( ptyFslData->pubDataBuffer ,
ptyFslData->pubWriteData ,
(unsigned int)duwOneWriteSize );
/* Re-calculates the remaining write data */
duwRemDataSize -= duwOneWriteSize;
ptyFslData->duwWriteDataSize -= duwOneWriteSize;
ptyFslData->pubWriteData += duwOneWriteSize;
/* When the write data is not in word units (4 bytes), the size is rounded up */
/* and dummy data is set for the remaining data */
for( ; ( duwOneWriteSize % SAM_WORD_SIZE ) != 0 ; duwOneWriteSize++ )
{
ptyFslData->pubDataBuffer[ duwOneWriteSize ] = SAM_DUMYY_DATA;
}
/* Sets the parameters */
dtyWriteBuff.fsl_data_buffer_p_u08 = ptyFslData->pubDataBuffer;
dtyWriteBuff.fsl_destination_address_u32 = duwWriteAddress;
dtyWriteBuff.fsl_word_count_u08 = (fsl_u08)( duwOneWriteSize / SAM_WORD_SIZE );
/* Executes data writing to the specified address */
dubRetCode = FSL_Write( &dtyWriteBuff );
}
}
/* If writing to the target block has completed normally */
if( dubRetCode == FSL_OK )
{
/* Executes internal verification of the target block */
dubRetCode = FSL_IVerify( ptyFslData->dubStartBlock );
}
}
/* If the error code is other than SAM_ERR_PARM (library is executed) */
if( dubRetCode != SAM_ERR_PARM )
{
/* If the writing process is completed normally, options are executed */
if( dubRetCode == FSL_OK )
{
/*************************************************************************/
/* Usage notes on boot swapping */
/* When executing boot swapping, the necessary settings for operation of */
/* the target microcontroller (e.g. option byte) must be written to also */
/* the area (1000H to 1FFFH) before swapping. If the settings are not */
/* made, the target microcontroller will not operate correctly. */
/*************************************************************************/
switch( ptyFslData->dubEndOption )
{
/* Reset processing */
case SAM_OPT_RST:
/* Forced reset processing */
/* Note: When debugging with the OCD or IECUBE, a reset cannot be generated */
/* with the FSL_ForceReset function. */
/* In such a case, generate a reset from the debugger manually, */
/* or use another method to generate a reset. */
FSL_ForceReset();
break;
/* Boot flag change process */
case SAM_OPT_CBOOT:
/* Boot flag change process (boot clusters are changed after a reset) */
/* Note: Since the address of a program located in boot cluster 0 (BCL0) or */
/* boot cluster 1 (BCL1) is changed, after a reset, execution of a program */
/* located at an address lower than 2000H in the debugger can no longer be */
/* correctly confirmed unless it is performed from the same program. */
dubRetCode = FSL_InvertBootFlag();
break;
/* Boot flag change process and boot swapping process */
case SAM_OPT_ACT_SWAP:
#if 0 /* This facility (function) is removed from the sample program because it is */
/* a facility (function) that can support only RAM location setting. */
do {
/* Boot flag change process and boot swapping process */
/* Note: When the rewriting program or library is in a boot cluster, if the */
/* FSL_SwapActiveBootCluster function is executed, the location address */
/* changes immediately after execution. Thus, correct operation is not */
/* possible. To achieve correct operation, locate this re-writing program */
/* or library at an area other than boot clusters. */
/* Since the address of a program located in BCL0 or BCL1 is changed, */
/* execution of a program located at an address lower than 2000H in the */
/* debugger can no longer be correctly confirmed unless it is performed */
/* from the same program. */
dubRetCode = FSL_SwapActiveBootCluster();
/* Re-executes the sample program when execution is terminated with an interrupt */
} while( dubRetCode == FSL_ERR_INTERRUPTION );
#endif
break;
/* Boot flag change process and reset processing */
case SAM_OPT_CBOOT_RST:
/* Boot flag change process (boot clusters are changed after a reset) */
/* Note: Since the address of a program located in BCL0 or BCL1 is changed, */
/* after a reset, execution of a program located at an address lower than */
/* 2000H in the debugger can no longer be correctly confirmed unless */
/* it is performed from the same program. */
dubRetCode = FSL_InvertBootFlag();
if( dubRetCode == FSL_OK )
{
/* Forced reset processing */
/* Note: When debugging with the OCD or IECUBE, a reset cannot be generated */
/* with the FSL_ForceReset function. */
/* In such a case, generate a reset from the debugger manually, or use */
/* another method to generate a reset. */
FSL_ForceReset();
}
break;
/* Boot flag change process, boot swapping process, and re-execution from the program start address */
case SAM_OPT_CBOOT_SUP:
/* Boot flag change process (boot clusters are changed after a reset) */
/* Note: Since the address of a program located in BCL0 or BCL1 is changed, */
/* after a reset, execution of a program located at an address lower than */
/* 2000H in the debugger can no longer be correctly confirmed unless */
/* it is performed from the same program. */
dubRetCode = FSL_InvertBootFlag();
if( dubRetCode == FSL_OK )
{
/* After boot swapping is executed, the program is re-executed from a new boot area */
/* Note: Since the address of a program located in BCL0 or BCL1 is changed, */
/* execution of a program located at an address lower than 2000H in */
/* the debugger can no longer be correctly confirmed unless it is performed */
/* from the same program. */
/* As swapping is performed in a state where no reset is executed and the */
/* process is re-executed from a new startup routine, operation differs from */
/* normal reset operation. */
/* Find out the status of RAM and interrupts so that execution can be carried */
/* out with no problems occurring on the user program side. */
dubRetCode = FSL_SwapBootCluster();
}
break;
/* Boot swapping process and re-execution from the program start address (no change in boot flag) */
case SAM_OPT_SUP:
/* After boot swapping is executed, the program is re-executed from a new boot area */
/* Note: Since the address of a program located in BCL0 or BCL1 is changed, */
/* execution of a program located at an address lower than 2000H in */
/* the debugger can no longer be correctly confirmed unless it is performed */
/* from the same program. However, after a reset, program execution can be */
/* re-confirmed in the debugger because the cluster locations are returned to */
/* the previous state. */
/* As swapping is performed in a state where no reset is executed and the */
/* process is re-executed from a new startup routine, operation differs from */
/* normal reset operation. */
/* Find out the status of RAM and interrupts so that execution can be carried */
/* out with no problems occurring on the user program side. */
dubRetCode = FSL_SwapBootCluster();
break;
/* Option is not executed */
default:
break;
}
/* Adds an option flag to an error occurring during execution of an option to */
/* differentiate it with an error occurring at writing. */
if( dubRetCode != FSL_OK )
{
dubRetCode |= SAM_ERR_OPT;
}
}
/* Flash self-programming library end processing */
samFslEnd();
}
return dubRetCode;
}
/*==============================================================================*/
/* Function name : samTargetInit */
/* IN : void */
/* OUT : void */
/* Description : Target initialization processing */
/* Date : 07,02,2010 */
/*==============================================================================*/
void samTargetInit( void )
{
/******************/
/* Watchdog timer */
/******************/
SAM_WDT_RESET(); /* Watchdog timer reset */
/*********************************/
/* LED initialization processing */
/*********************************/
SAM_LED1_INIT(); /* Initializes LED1 (turns off) */
SAM_LED2_INIT(); /* Initializes LED2 (turns off) */
SAM_LED1_ON(); /* Turns on LED1 */
SAM_LED2_ON(); /* Turns on LED2 */
}
/*==============================================================================*/
/* Function name : samTargetEnd */
/* IN : void */
/* OUT : void */
/* Description : Target end processing */
/* Date : 07,02,2010 */
/*==============================================================================*/
void samTargetEnd( void )
{
SAM_LED1_OFF(); /* Turns off LED1 */
SAM_LED2_OFF(); /* Turns off LED2 */
}
/*==============================================================================*/
/* Function name : samFslStart */
/* IN : void */
/* OUT : fsl_u08 / Return code */
/* Description : Sample program for flash self-programming */
/* Date : 04,28,2011 */
/*==============================================================================*/
fsl_u08 samFslStart( void )
{
fsl_u08 dubRetCode;
/* Flash self-programming library initialization */
dubRetCode = FSL_Init( &fsl_descriptor_pstr );
/* When initialization has completed normally */
if( dubRetCode == FSL_OK )
{
/* Flash self-programming library start processing */
FSL_Open();
/* */
FSL_PrepareFunctions();
/* */
FSL_PrepareExtFunctions();
}
return dubRetCode;
}
/*==============================================================================*/
/* Function name : samFslEnd */
/* IN : void */
/* OUT : void */
/* Description : Sample program for flash self-programming */
/* Date : 04,28,2011 */
/*==============================================================================*/
void samFslEnd( void )
{
/* Flash self-programming library end processing */
FSL_Close();
}
/*##############################################################################*/
/*------------------------------------------------------------------------------*/
/* interrupt functions */
/*------------------------------------------------------------------------------*/
/*==============================================================================*/
/* Function name : samIntWdt */
/* IN : void */
/* OUT : void */
/* Description : WDT reset function */
/* Date : 07,02,2010 */
/*==============================================================================*/
void samIntWdt( void )
{
SAM_WDT_RESET();
}
/********************************************************************************/
/********************************************************************************/
/* */
/* Program of LED lighting and swapping for QB-R5F100LE-TB */
/* */
/* Note: Two LEDs are lighted up alternately. When SW1 is pressed, the LED */
/* flashing method is changed and boot swapping is performed within */
/* a few seconds */
/* */
/* - Usage method (when used as an executable program instead of dummy data) */
/* When QB-R5F100LE-TB is used, change [#if 0] on the 75th line of this */
/* code to [#if 1] and enable symbols of [__QB_R5F100LE_TB__]. */
/* After that, register this code and the [sample_c.dr] file in a new */
/* project, enable the on-chip debugging settings, and create a load */
/* module. */
/* After the debugger is started, set a breakpoint near the beginning of */
/* the main program and execute the sample program to the end. A reset is */
/* generated at the watchdog timer, boot swapping is executed, */
/* and the program of LED lighting and swapping is executed. (LEDs start */
/* flashing alternately.) */
/* */
/*==============================================================================*/
/* At this time (period between changing the boot flag and returning it to */
/* its former state), do not execute a reset by the debugger. */
/* Since the program has already been changed, it may not operate correctly.*/
/*==============================================================================*/
/* */
/* If SW1 is pressed in this state, the LEDs are changed from flashing */
/* alternately to flashing simultaneously. Then, after a few seconds, */
/* a reset occurs again, boot swapping is executed, execution returns to */
/* the original sample program, and a break occurs (execution stops) at */
/* the set breakpoint. */
/* */
/* Note: This executable program is a sample program created for easily */
/* confirming boot swapping. It may not operate correctly in some */
/* cases depending on the project settings or operation status or */
/* connection state of QB-R5F100LE-TB. */
/* */
/********************************************************************************/
const fsl_u08 samDubWriteData[ SAM_DATA_SIZE ] =
{
/* 0000 */ 0xD0, 0x00, 0xFF, 0xFF, 0x00, 0x14, 0x01, 0x00, 0x84, 0x01, 0xC7, 0xC5, 0xC1, 0x16, 0x34, 0x80,
/* 0010 */ 0x08, 0xF6, 0xB9, 0xA5, 0xA5, 0x35, 0x44, 0xC0, 0x08, 0x35, 0xDF, 0xF6, 0x8E, 0xFD, 0xC1, 0x62,
/* 0020 */ 0x9E, 0xFD, 0x31, 0x82, 0xA1, 0x3D, 0xF1, 0x11, 0x4E, 0x02, 0x61, 0xE8, 0x71, 0x00, 0x91, 0x08,
/* 0030 */ 0x9F, 0x03, 0x08, 0x11, 0x4E, 0x00, 0x61, 0xE8, 0xE1, 0x9F, 0x01, 0x08, 0x30, 0x80, 0x08, 0x14,
/* 0040 */ 0xBF, 0x04, 0x08, 0x11, 0x8C, 0x01, 0x99, 0x41, 0x0E, 0x11, 0x4F, 0xE8, 0xFF, 0xDC, 0x14, 0x11,
/* 0050 */ 0xF9, 0xE9, 0xFF, 0x61, 0x42, 0xDC, 0x0C, 0x52, 0x00, 0xFC, 0xF8, 0xFF, 0x0E, 0x71, 0x00, 0x90,
/* 0060 */ 0x08, 0xEF, 0x02, 0x52, 0x05, 0xC0, 0x9E, 0xFD, 0xC0, 0xC4, 0xC6, 0xD7, 0x71, 0x10, 0x90, 0x08,
/* 0070 */ 0xD7, 0xFF, 0x71, 0x18, 0x90, 0x08, 0xD7, 0xFF, 0xC7, 0xC5, 0xC3, 0xC1, 0x71, 0x20, 0x90, 0x08,
/* 0080 */ 0x8E, 0xFD, 0xC1, 0x41, 0x00, 0x36, 0xBA, 0x02, 0x32, 0xB7, 0x03, 0x34, 0x80, 0x0A, 0x11, 0xAB,
/* 0090 */ 0xB9, 0xA7, 0xA7, 0xA5, 0xA5, 0x17, 0x43, 0xDC, 0xF5, 0xC0, 0x9E, 0xFD, 0xC0, 0xC2, 0xC4, 0xC6,
/* 00A0 */ 0xD7, 0xFF, 0xC7, 0xC5, 0xC3, 0xC1, 0x71, 0x30, 0x90, 0x08, 0x8E, 0xFD, 0xC1, 0x41, 0x00, 0x36,
/* 00B0 */ 0xB8, 0x03, 0x32, 0x33, 0x04, 0x34, 0x80, 0x0B, 0xEE, 0xD3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
/* 00C0 */ 0xFF, 0xFF, 0xEF, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x00,
/* 00D0 */ 0xEC, 0xFD, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x61, 0xCF, 0x51, 0x00, 0x71, 0x8C, 0x71, 0x09,
/* 00E0 */ 0xFE, 0xCB, 0xF8, 0x20, 0xFE, 0xFC, 0x72, 0x04, 0x00, 0xF6, 0xBF, 0x96, 0xFB, 0xBF, 0x80, 0xFB,
/* 00F0 */ 0xBF, 0x84, 0xFB, 0xE6, 0xBF, 0x82, 0xFB, 0x30, 0x9A, 0xFB, 0xBF, 0x98, 0xFB, 0x53, 0xC0, 0xF6,
/* 0100 */ 0x93, 0x93, 0x58, 0x20, 0xFE, 0xDF, 0xF9, 0x41, 0x00, 0x36, 0x02, 0x00, 0x34, 0xBA, 0xFC, 0xEF,
/* 0110 */ 0x05, 0x11, 0x8B, 0x99, 0xA7, 0xA5, 0x17, 0x44, 0x02, 0x00, 0xDF, 0xF5, 0x36, 0x02, 0x00, 0x34,
/* 0120 */ 0xBA, 0xFC, 0xEF, 0x0A, 0x41, 0x00, 0x11, 0x8B, 0x41, 0x0F, 0x11, 0x99, 0xA7, 0xA5, 0x17, 0x44,
/* 0130 */ 0x02, 0x00, 0xDF, 0xF0, 0x36, 0xBA, 0xFB, 0x30, 0xBA, 0xFC, 0xEF, 0x04, 0xCC, 0x00, 0x00, 0xA7,
/* 0140 */ 0x47, 0xDF, 0xF9, 0x41, 0x0F, 0x36, 0xBA, 0xFC, 0x30, 0xBA, 0xFC, 0xEF, 0x05, 0x11, 0xCC, 0x00,
/* 0150 */ 0x00, 0xA7, 0x47, 0xDF, 0xF8, 0x41, 0x00, 0x36, 0x02, 0x00, 0x34, 0xBA, 0xFC, 0xEF, 0x05, 0x11,
/* 0160 */ 0x8B, 0x99, 0xA7, 0xA5, 0x17, 0x44, 0x02, 0x00, 0xDF, 0xF5, 0x36, 0xBA, 0xFC, 0x30, 0xBA, 0xFC,
/* 0170 */ 0xEF, 0x04, 0xCC, 0x00, 0x00, 0xA7, 0x47, 0xDF, 0xF9, 0xFC, 0x31, 0x02, 0x00, 0xF6, 0xFC, 0x73,
/* 0180 */ 0x04, 0x00, 0xEF, 0xFE, 0x71, 0x7B, 0xFA, 0xC1, 0xC3, 0xC5, 0xC7, 0x52, 0x0C, 0x92, 0x92, 0x69,
/* 0190 */ 0xD4, 0xFE, 0xC1, 0xDF, 0xF8, 0x8E, 0xFD, 0x70, 0x8E, 0xFC, 0xC1, 0x20, 0x06, 0xFB, 0xF8, 0xFF,
/* 01A0 */ 0x30, 0x04, 0x00, 0x52, 0x00, 0xF3, 0xFC, 0x0A, 0x00, 0x00, 0x62, 0x9C, 0x01, 0xD1, 0xDF, 0x0C,
/* 01B0 */ 0xFC, 0x6C, 0x00, 0x00, 0xFC, 0x78, 0x00, 0x00, 0xFC, 0xA2, 0x00, 0x00, 0x8C, 0x01, 0xD1, 0xDF,
/* 01C0 */ 0x07, 0xFC, 0x34, 0x04, 0x00, 0x62, 0x9C, 0x01, 0x8C, 0x01, 0xD1, 0xDF, 0x43, 0xCE, 0xAB, 0xAC,
/* 01D0 */ 0xCC, 0x00, 0x01, 0x8B, 0xD1, 0xDF, 0x0B, 0xCC, 0x00, 0x01, 0x71, 0x23, 0x06, 0x71, 0x33, 0x06,
/* 01E0 */ 0xEF, 0x09, 0xCC, 0x00, 0x00, 0x71, 0x22, 0x06, 0x71, 0x32, 0x06, 0xF6, 0xBC, 0x02, 0xBC, 0x04,
/* 01F0 */ 0xF6, 0x61, 0x49, 0x04, 0xDF, 0x06, 0x30, 0x0F, 0x27, 0x61, 0x49, 0x02, 0xDC, 0xD5, 0xFC, 0xAF,
/* 0200 */ 0x02, 0x00, 0x61, 0x79, 0x02, 0xF6, 0x61, 0x49, 0x02, 0xDF, 0xE5, 0x61, 0x79, 0x04, 0xEF, 0xE0,
/* 0210 */ 0xFC, 0x72, 0x00, 0x00, 0x10, 0x06, 0xC0, 0x9E, 0xFC, 0x60, 0x9E, 0xFD, 0x34, 0xD4, 0xFE, 0x52,
/* 0220 */ 0x06, 0xC0, 0xB9, 0xA5, 0xA5, 0x92, 0xDF, 0xF9, 0xC6, 0xC4, 0xC2, 0xC0, 0x71, 0x7A, 0xFA, 0x61,
/* 0230 */ 0xFC, 0xC7, 0x20, 0x06, 0xFB, 0xF8, 0xFF, 0xF6, 0xBB, 0xFC, 0x81, 0x02, 0x00, 0xF6, 0x61, 0x49,
/* 0240 */ 0x00, 0xDF, 0x0A, 0xE6, 0xBB, 0x71, 0x23, 0x06, 0x71, 0x32, 0x06, 0xEF, 0x08, 0xF6, 0xBB, 0x71,
/* 0250 */ 0x22, 0x06, 0x71, 0x33, 0x06, 0xF6, 0xBC, 0x02, 0xBC, 0x04, 0xF6, 0x61, 0x49, 0x04, 0xDF, 0x06,
/* 0260 */ 0x30, 0x1F, 0x4E, 0x61, 0x49, 0x02, 0xDC, 0xD5, 0xFC, 0xAF, 0x02, 0x00, 0xCE, 0xAB, 0xAC, 0x61,
/* 0270 */ 0x79, 0x02, 0xF6, 0x61, 0x49, 0x02, 0xDF, 0xE2, 0x61, 0x79, 0x04, 0xEF, 0xDD, 0x10, 0x06, 0xC6,
/* 0280 */ 0xD7, 0xF5, 0xA9, 0xFF, 0xF5, 0xAA, 0xFF, 0x71, 0x22, 0x06, 0x71, 0x32, 0x06, 0x71, 0x22, 0x06,
/* 0290 */ 0x71, 0x2B, 0x26, 0x71, 0x32, 0x06, 0x71, 0x3B, 0x26, 0x71, 0x0B, 0x38, 0x71, 0x0A, 0x39, 0x71,
/* 02A0 */ 0x2B, 0xE8, 0x71, 0x2A, 0xEC, 0x71, 0x2B, 0xE0, 0x71, 0x2B, 0xE4, 0x71, 0x7A, 0xFA, 0xD7, 0x00,
/* 02B0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD7, 0xEF, 0x21, 0xEF, 0x23, 0xEF, 0x25,
/* 02C0 */ 0xEF, 0x27, 0xEF, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC7, 0xC5, 0xC1, 0x8E, 0xFC, 0x75,
/* 02D0 */ 0x8E, 0xFD, 0x74, 0xCE, 0xFC, 0x0F, 0x13, 0xF1, 0x04, 0x80, 0x0A, 0x61, 0xCB, 0x52, 0x03, 0xEF,
/* 02E0 */ 0x2D, 0x52, 0x06, 0xEF, 0x29, 0x52, 0x08, 0xEF, 0x25, 0xA8, 0x00, 0x16, 0xEF, 0x50, 0xFC, 0xC4,
/* 02F0 */ 0x08, 0x0F, 0x62, 0x4C, 0xFF, 0xDD, 0x3D, 0x71, 0x48, 0x90, 0x08, 0x71, 0x78, 0x90, 0x08, 0x8F,
/* 0300 */ 0x90, 0x08, 0x31, 0x55, 0x2F, 0x51, 0x0F, 0x9E, 0xFC, 0xAF, 0x92, 0x08, 0x61, 0xCB, 0xA8, 0x00,
/* 0310 */ 0x16, 0x41, 0x0E, 0x11, 0xAF, 0xE6, 0xFF, 0x47, 0xDC, 0x18, 0x17, 0x31, 0x2D, 0x9F, 0x02, 0x08,
/* 0320 */ 0x60, 0x9F, 0x01, 0x08, 0xF5, 0x00, 0x08, 0xF5, 0x03, 0x08, 0x30, 0x00, 0x04, 0xBF, 0x06, 0x08,
/* 0330 */ 0xEF, 0x60, 0x52, 0x05, 0x65, 0x9E, 0xFC, 0x64, 0x9E, 0xFD, 0xC0, 0xC4, 0xC6, 0xD7, 0x8C, 0x00,
/* 0340 */ 0x70, 0x8C, 0x01, 0xBF, 0x04, 0x08, 0x8C, 0x02, 0x5C, 0x03, 0xDF, 0xE6, 0x8C, 0x05, 0xD1, 0xDF,
/* 0350 */ 0xE1, 0x8C, 0x06, 0xD1, 0xDD, 0xDC, 0x4C, 0x41, 0xDE, 0xD8, 0x70, 0xF1, 0x31, 0x2D, 0xBF, 0x06,
/* 0360 */ 0x08, 0xB1, 0xB1, 0xC5, 0x14, 0x8C, 0x02, 0x70, 0x8C, 0x03, 0xBF, 0x00, 0x08, 0x05, 0x35, 0x8C,
/* 0370 */ 0x04, 0x9F, 0x02, 0x08, 0x1C, 0x00, 0x35, 0x16, 0x15, 0x70, 0xC4, 0xDC, 0xB5, 0x41, 0x0E, 0x66,
/* 0380 */ 0x11, 0x3F, 0xDF, 0xFF, 0x67, 0x11, 0x3F, 0xE0, 0xFF, 0x60, 0x11, 0x3F, 0xE1, 0xFF, 0xDE, 0xA2,
/* 0390 */ 0x52, 0x04, 0x13, 0xFC, 0xF8, 0xFF, 0x0E, 0x62, 0x4C, 0xFF, 0xDF, 0x98, 0x8F, 0x91, 0x08, 0x31,
/* 03A0 */ 0x03, 0x0F, 0x71, 0x40, 0x90, 0x08, 0x60, 0x4C, 0x03, 0x61, 0xF8, 0x71, 0x70, 0x90, 0x08, 0xEF,
/* 03B0 */ 0x83, 0xFC, 0xC4, 0x08, 0x0F, 0xEF, 0xE0, 0x00, 0xEF, 0x18, 0xEF, 0x3F, 0x00, 0x00, 0x00, 0x00,
/* 03C0 */ 0xC5, 0xC1, 0x8E, 0xFC, 0x75, 0x8E, 0xFD, 0x74, 0xCE, 0xFC, 0x0F, 0x13, 0xF1, 0x04, 0x80, 0x0B,
/* 03D0 */ 0x61, 0xCB, 0x30, 0x80, 0x08, 0xBF, 0x04, 0x08, 0x52, 0x10, 0xFC, 0xF8, 0xFF, 0x0E, 0xD2, 0xDF,
/* 03E0 */ 0x14, 0x67, 0x5F, 0x80, 0x08, 0x9F, 0x80, 0x08, 0x67, 0x5C, 0x01, 0x61, 0xE8, 0x71, 0x00, 0x80,
/* 03F0 */ 0x08, 0x52, 0x11, 0xEF, 0x0A, 0x71, 0x58, 0x90, 0x08, 0xEF, 0x2E, 0x52, 0x13, 0xEF, 0x00, 0xFC,
/* 0400 */ 0xF8, 0xFF, 0x0E, 0x62, 0x4C, 0xFF, 0xDF, 0x0C, 0x8F, 0x91, 0x08, 0x31, 0x03, 0x15, 0x71, 0x40,
/* 0410 */ 0x90, 0x08, 0xEF, 0x15, 0x8F, 0x90, 0x08, 0x31, 0x55, 0x0F, 0x51, 0x0F, 0x9E, 0xFC, 0xAF, 0x92,
/* 0420 */ 0x08, 0x61, 0xCB, 0xFC, 0xC4, 0x08, 0x0F, 0xEF, 0xDA, 0x65, 0x9E, 0xFC, 0x64, 0x9E, 0xFD, 0xC0,
/* 0430 */ 0xC4, 0xC6, 0xD7, 0x00, 0xC7, 0x57, 0xFE, 0x52, 0x00, 0xEE, 0x00, 0x00, 0xFE, 0x0B, 0x00, 0x61,
/* 0440 */ 0xF8, 0xEC, 0x88, 0x0B, 0x0F, 0x52, 0x1F, 0xC6, 0xD7, 0xFF, 0xC1, 0x51, 0xFF, 0x50, 0x0F, 0xEF,
/* 0450 */ 0x1A, 0xC1, 0x51, 0x47, 0x50, 0x07, 0xEF, 0x13, 0xC1, 0x51, 0x47, 0x50, 0x07, 0xEF, 0x0C, 0xC1,
/* 0460 */ 0x51, 0x47, 0x50, 0x47, 0xEF, 0x05, 0xC1, 0x51, 0xF7, 0x50, 0x07, 0x5F, 0x90, 0x08, 0x61, 0x48,
/* 0470 */ 0xC0, 0xD7, 0xD7, 0xFB, 0x80, 0xFB, 0xF6, 0x47, 0xDD, 0x13, 0xB7, 0xC7, 0x17, 0x31, 0x2D, 0x04,
/* 0480 */ 0x00, 0xFB, 0x16, 0x8C, 0x02, 0x9E, 0xFC, 0xAB, 0xC6, 0x61, 0xCA, 0xEF, 0xE9, 0xEF, 0xFE, 0xFF,
};

View File

@ -1,138 +0,0 @@
;==============================================================================
;
; Project = Sample program for flash self-programming library
; Module = r_fsl_sample_c.dr
; Version = V1.01(Target FSL Version for CA78K0R is V2.20)
; Target CPU = RL78/G13 ( R5F100LEA / QB-R5F100LE-TB )
; Environment = CS+ for CA[CA78K0R],CX (V3.00)
;
; Date = 12, 28, 2016
;
;==============================================================================
; COPYRIGHT
;==============================================================================
; DISCLAIMER
; This software is supplied by Renesas Electronics Corporation and is only
; intended for use with Renesas products. No other uses are authorized. This
; software is owned by Renesas Electronics Corporation and is protected under
; all applicable laws, including copyright laws.
; THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
; LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
; AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
; TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
; ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
; FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
; ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
; BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; Renesas reserves the right, without notice, to make changes to this software
; and to discontinue the availability of this software. By using this software,
; you agree to the additional terms and conditions found by accessing the
; following link:
; http://www.renesas.com/disclaimer
;
; Copyright (C) 2010-2016 Renesas Electronics Corporation. All rights reserved.
;==============================================================================
;***********************************************************
; Redefined ROM area
;***********************************************************
; ----------------------------------------------------------
; Define new memory entry for boot cluster 0
; ----------------------------------------------------------
MEMORY BCL0 : ( 000000H, 001000H )
; ----------------------------------------------------------
; Define new memory entry for boot cluster 1
; ----------------------------------------------------------
MEMORY BCL1 : ( 001000H, 001000H )
; ----------------------------------------------------------
; Redefined default code segment ROM
; ----------------------------------------------------------
MEMORY ROM : ( 002000H, 000800H )
; ----------------------------------------------------------
; Define new memory entry for fsl-code area
; ----------------------------------------------------------
MEMORY ROM_FSL : ( 002800H, 000400H )
; ----------------------------------------------------------
; Define new memory entry for write-data area
; ----------------------------------------------------------
MEMORY ROM_DATA : ( 002C00H, 000800H )
; ----------------------------------------------------------
; Define new memory entry for write-data area
; ----------------------------------------------------------
;MEMORY OCDROM : ( 00FE00H, 000200H )
;***********************************************************
; Redefined RAM area
;***********************************************************
; ----------------------------------------------------------
; Redefined default data segment RAM
; ----------------------------------------------------------
MEMORY RAM : ( 0FFB00H, 000320H )
; ----------------------------------------------------------
; Define new memory entry for saddr area
; ----------------------------------------------------------
MEMORY RAM_SADDR : ( 0FFE20H, 0000E0H )
;***********************************************************
; Library(fsl.lib) segment
;***********************************************************
; ----------------------------------------------------------
; Merge FSL_FCD segment
; ----------------------------------------------------------
MERGE FSL_FCD := ROM_FSL
; ----------------------------------------------------------
; Merge FSL_FECD segment
; ----------------------------------------------------------
;MERGE FSL_FECD := ROM_FSL
; ----------------------------------------------------------
; Merge FSL_RCD segment
; ----------------------------------------------------------
MERGE FSL_RCD := ROM_FSL
; ----------------------------------------------------------
; Merge FSL_BCD segment
; ----------------------------------------------------------
MERGE FSL_BCD := ROM_FSL
; ----------------------------------------------------------
; Merge FSL_BECD segment
; ----------------------------------------------------------
MERGE FSL_BECD := ROM_FSL
;***********************************************************
; sample_c.c segment
;***********************************************************
; ----------------------------------------------------------
; Merge SAM_CODE segment
; ----------------------------------------------------------
MERGE SAM_CODE := ROM
; ----------------------------------------------------------
; Merge SAM_CNST segment
; ----------------------------------------------------------
MERGE SAM_CNST := ROM_DATA
; ----------------------------------------------------------
; Merge SAM_DATA segment
; ----------------------------------------------------------
MERGE SAM_DATA := RAM
;***********************************************************
; run-time library segment ( 0000H - FFFFH )
;***********************************************************
; ----------------------------------------------------------
; Merge @@LCODE,@@LCODEL(run-time library) segment
; ----------------------------------------------------------
MERGE @@LCODE := BCL0
MERGE @@LCODEL := BCL0

View File

@ -1,7 +0,0 @@
#pragma interrupt INTTM02 r_tau0_channel2_interrupt
#include "BranchTable.h"

View File

@ -1,130 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2017 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_adc.c
* Version : CodeGenerator for RL78/F13 V2.03.00.02 [19 Apr 2017]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for ADC module.
* Creation Date: 2019/1/9
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_adc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_ADC_Create
* Description : This function initializes the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Create(void)
{
ADCEN = 1U; /* supply AD clock */
ADM0 = _00_AD_ADM0_INITIALVALUE; /* disable AD conversion and clear ADM0 register */
ADMK = 1U; /* disable INTAD interrupt */
ADIF = 0U; /* clear INTAD interrupt flag */
/* The reset status of ADPC is analog input, so it's unnecessary to set. */
/* Set ANI0 pin as analog input */
PM3 |= 0x08U;
ADM0 = _18_AD_CONVERSION_CLOCK_8 | _00_AD_TIME_MODE_NORMAL_1 | _00_AD_OPERMODE_SELECT;
ADM1 = _00_AD_TRIGGER_SOFTWARE | _20_AD_CONVMODE_ONESELECT;
ADM2 = _00_AD_POSITIVE_VDD | _00_AD_NEGATIVE_VSS | _00_AD_AREA_MODE_1 | _00_AD_RESOLUTION_10BIT;
ADUL = _FF_AD_ADUL_VALUE;
ADLL = _00_AD_ADLL_VALUE;
ADS = _00_AD_INPUT_CHANNEL_0;
}
/***********************************************************************************************************************
* Function Name: R_ADC_Start
* Description : This function starts the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Start(void)
{
ADCS = 1U; /* enable AD conversion */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Stop
* Description : This function stops the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Stop(void)
{
ADCS = 0U; /* disable AD conversion */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Set_OperationOn
* Description : This function enables comparator operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Set_OperationOn(void)
{
ADCE = 1U; /* enable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Set_OperationOff
* Description : This function stops comparator operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Set_OperationOff(void)
{
ADCE = 0U; /* disable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Get_Result
* Description : This function returns the conversion result in the buffer.
* Arguments : buffer -
* the address where to write the conversion result
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Get_Result(uint16_t * const buffer)
{
*buffer = (uint16_t)(ADCR >> 6U);
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,201 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2017 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_adc.h
* Version : CodeGenerator for RL78/F13 V2.03.00.02 [19 Apr 2017]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for ADC module.
* Creation Date: 2019/1/9
***********************************************************************************************************************/
#ifndef ADC_H
#define ADC_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Peripheral enable register 0 (PER0)
*/
/* Control of AD converter input clock (ADCEN) */
#define _00_AD_CLOCK_STOP (0x00U) /* stop supply of input clock */
#define _20_AD_CLOCK_SUPPLY (0x20U) /* supply input clock */
/*
AD converter mode register 0 (ADM0)
*/
#define _00_AD_ADM0_INITIALVALUE (0x00U)
/* AD conversion operation control (ADCS) */
#define _80_AD_CONVERSION_ENABLE (0x80U) /* enable AD conversion operation control */
#define _00_AD_CONVERSION_DISABLE (0x00U) /* disable AD conversion operation control */
/* Specification of AD conversion operation mode (ADMD) */
#define _00_AD_OPERMODE_SELECT (0x00U) /* select operation mode */
#define _40_AD_OPERMODE_SCAN (0x40U) /* scan operation mode */
/* AD conversion clock selection (FR2 - FR0) */
#define _00_AD_CONVERSION_CLOCK_64 (0x00U) /* fCLK/64 */
#define _08_AD_CONVERSION_CLOCK_32 (0x08U) /* fCLK/32 */
#define _10_AD_CONVERSION_CLOCK_16 (0x10U) /* fCLK/16 */
#define _18_AD_CONVERSION_CLOCK_8 (0x18U) /* fCLK/8 */
#define _20_AD_CONVERSION_CLOCK_6 (0x20U) /* fCLK/6 */
#define _28_AD_CONVERSION_CLOCK_5 (0x28U) /* fCLK/5 */
#define _30_AD_CONVERSION_CLOCK_4 (0x30U) /* fCLK/4 */
#define _38_AD_CONVERSION_CLOCK_2 (0x38U) /* fCLK/2 */
/* Specification AD conversion time mode (LV1, LV0) */
#define _00_AD_TIME_MODE_NORMAL_1 (0x00U) /* normal 1 mode */
#define _02_AD_TIME_MODE_NORMAL_2 (0x02U) /* normal 2 mode */
/* AD comparator operation control (ADCE) */
#define _01_AD_COMPARATOR_ENABLE (0x01U) /* enable comparator operation control */
#define _00_AD_COMPARATOR_DISABLE (0x00U) /* disable comparator operation control */
/*
Analog input channel specification register (ADS)
*/
/* Specification of analog input channel (ADISS, ADS4 - ADS0) */
/* Select mode */
#define _00_AD_INPUT_CHANNEL_0 (0x00U) /* ANI0 */
#define _01_AD_INPUT_CHANNEL_1 (0x01U) /* ANI1 */
#define _02_AD_INPUT_CHANNEL_2 (0x02U) /* ANI2 */
#define _03_AD_INPUT_CHANNEL_3 (0x03U) /* ANI3 */
#define _04_AD_INPUT_CHANNEL_4 (0x04U) /* ANI4 */
#define _05_AD_INPUT_CHANNEL_5 (0x05U) /* ANI5 */
#define _06_AD_INPUT_CHANNEL_6 (0x06U) /* ANI6 */
#define _07_AD_INPUT_CHANNEL_7 (0x07U) /* ANI7 */
#define _08_AD_INPUT_CHANNEL_8 (0x08U) /* ANI8 */
#define _09_AD_INPUT_CHANNEL_9 (0x09U) /* ANI9 */
#define _0A_AD_INPUT_CHANNEL_10 (0x0AU) /* ANI10 */
#define _0B_AD_INPUT_CHANNEL_11 (0x0BU) /* ANI11 */
#define _0C_AD_INPUT_CHANNEL_12 (0x0CU) /* ANI12 */
#define _0D_AD_INPUT_CHANNEL_13 (0x0DU) /* ANI13 */
#define _0E_AD_INPUT_CHANNEL_14 (0x0EU) /* ANI14 */
#define _0F_AD_INPUT_CHANNEL_15 (0x0FU) /* ANI15 */
#define _18_AD_INPUT_CHANNEL_24 (0x18U) /* ANI24 */
#define _19_AD_INPUT_CHANNEL_25 (0x19U) /* ANI25 */
#define _1A_AD_INPUT_CHANNEL_26 (0x1AU) /* ANI26 */
#define _80_AD_INPUT_TEMPERSENSOR_0 (0x80U) /* temperature sensor 0 output is used to be the input channel */
#define _81_AD_INPUT_INTERREFVOLT (0x81U) /* internal reference voltage output is used to be the input channel */
/* Scan mode */
#define _00_AD_INPUT_CHANNEL_0_3 (0x00U) /* ANI0 - ANI3 */
#define _01_AD_INPUT_CHANNEL_1_4 (0x01U) /* ANI1 - ANI4 */
#define _02_AD_INPUT_CHANNEL_2_5 (0x02U) /* ANI2 - ANI5 */
#define _03_AD_INPUT_CHANNEL_3_6 (0x03U) /* ANI3 - ANI6 */
#define _04_AD_INPUT_CHANNEL_4_7 (0x04U) /* ANI4 - ANI7 */
#define _05_AD_INPUT_CHANNEL_5_8 (0x05U) /* ANI5 - ANI8 */
#define _06_AD_INPUT_CHANNEL_6_9 (0x06U) /* ANI6 - ANI9 */
#define _07_AD_INPUT_CHANNEL_7_10 (0x07U) /* ANI7 - ANI10 */
#define _08_AD_INPUT_CHANNEL_8_11 (0x08U) /* ANI8 - ANI11 */
#define _09_AD_INPUT_CHANNEL_9_12 (0x09U) /* ANI9 - ANI12 */
#define _0A_AD_INPUT_CHANNEL_10_13 (0x0AU) /* ANI10 - ANI13 */
#define _0B_AD_INPUT_CHANNEL_11_14 (0x0BU) /* ANI11 - ANI14 */
#define _0C_AD_INPUT_CHANNEL_12_15 (0x0CU) /* ANI12 - ANI15 */
/*
AD converter mode register 1 (ADM1)
*/
/* AD trigger mode selection (ADTMD1, ADTMD0) */
#define _00_AD_TRIGGER_SOFTWARE (0x00U) /* software trigger mode */
#define _80_AD_TRIGGER_HARDWARE_NOWAIT (0x80U) /* hardware trigger mode (no wait) */
#define _C0_AD_TRIGGER_HARDWARE_WAIT (0xC0U) /* hardware trigger mode (wait) */
/* AD convertion mode selection (ADSCM) */
#define _00_AD_CONVMODE_CONSELECT (0x00U) /* continuous convertion mode */
#define _20_AD_CONVMODE_ONESELECT (0x20U) /* oneshot convertion mode */
/* Trigger signal selection (ADTRS1, ADTRS0) */
#define _00_AD_TRIGGER_INTTM01 (0x00U) /* INTTM01 */
#define _01_AD_TRIGGER_ELC (0x01U) /* ELC */
#define _01_AD_TRIGGER_TIMER (0x01U) /* INTTRD0,INTTRJ0 */
#define _02_AD_TRIGGER_INTRTC (0x02U) /* INTRTC */
/*
AD converter mode register 2 (ADM2)
*/
/* AD VREF(+) selection (ADREFP1, ADREFP0) */
#define _00_AD_POSITIVE_VDD (0x00U) /* use VDD as VREF(+) */
#define _40_AD_POSITIVE_AVREFP (0x40U) /* use AVREFP as VREF(+) */
#define _80_AD_POSITIVE_INTERVOLT (0x80U) /* use internal voltage as VREF(+) */
/* AD VREF(-) selection (ADREFM) */
#define _00_AD_NEGATIVE_VSS (0x00U) /* use VSS as VREF(-) */
#define _20_AD_NEGATIVE_AVREFM (0x20U) /* use AVREFM as VREF(-) */
/* AD conversion result upper/lower bound value selection (ADRCK) */
#define _00_AD_AREA_MODE_1 (0x00U) /* generates INTAD when ADLL <= ADCRH <= ADUL */
#define _08_AD_AREA_MODE_2_3 (0x08U) /* generates INTAD when ADUL < ADCRH or ADLL > ADCRH */
/* AD wakeup function selection (AWC) */
#define _00_AD_WAKEUP_OFF (0x00U) /* stop wakeup function */
#define _04_AD_WAKEUP_ON (0x04U) /* use wakeup function */
/* AD resolution selection (ADTYP) */
#define _00_AD_RESOLUTION_10BIT (0x00U) /* 10 bits */
#define _01_AD_RESOLUTION_8BIT (0x01U) /* 8 bits */
/*
AD test function register (ADTES)
*/
/* AD test mode signal (ADTES2 - ADTES0) */
#define _00_AD_NORMAL_INPUT (0x00U) /* normal mode */
#define _02_AD_TEST_AVREFM (0x02U) /* use AVREFM as test signal */
#define _03_AD_TEST_AVREFP (0x03U) /* use AVREFP as test signal */
/*
Format of A/D Converter Trigger Select Register 0 (ADTRGS0)(F13 only)
*/
/* Selection of the operation trigger of the A/D converter when the timer RD0 input capture B/compare match B
interrupt request is generated (ADTRGS00) */
#define _01_AD_TRIGGER_INTTRD0 (0x01U) /* A/D conversion is started when the interrupt request is generated */
/*
Format of A/D Converter Trigger Select Register 1 (ADTRGS1)(F13 only)
*/
/* Selection of the operation trigger of the A/D converter when the timer RJ0 interrupt request is generated (ADTRGS10) */
#define _01_AD_TRIGGER_INTTRJ0 (0x01U) /* A/D conversion is started when the interrupt request is generated */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/* Upper bound (ADUL) value */
#define _FF_AD_ADUL_VALUE (0xFFU)
/* Upper bound (ADLL) value */
#define _00_AD_ADLL_VALUE (0x00U)
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef enum
{
ADCHANNEL0, ADCHANNEL1, ADCHANNEL2, ADCHANNEL3, ADCHANNEL4, ADCHANNEL5, ADCHANNEL6,
ADCHANNEL7, ADCHANNEL8, ADCHANNEL9, ADCHANNEL10, ADCHANNEL11, ADCHANNEL12,
ADCHANNEL13, ADCHANNEL14, ADCHANNEL15, ADCHANNEL24 = 24U, ADCHANNEL25, ADCHANNEL26,
ADTEMPERSENSOR0 = 128U, ADINTERREFVOLT
} ad_channel_t;
typedef enum
{
ADNORMALINPUT,
ADAVREFM = 2U,
ADAVREFP
} test_channel_t;
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_ADC_Create(void);
void R_ADC_Start(void);
void R_ADC_Stop(void);
void R_ADC_Set_OperationOn(void);
void R_ADC_Set_OperationOff(void);
void R_ADC_Get_Result(uint16_t * const buffer);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

View File

@ -1,110 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_cgc.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for CGC module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_cgc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: Boot_CGC_Create
* Description : This function initializes the clock generator.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_CGC_Create(void)
{
volatile uint16_t w_count;
uint8_t temp_stab_set;
uint8_t temp_stab_wait;
/* Set fMX */
CMC = _40_CGC_HISYS_OSC | _00_CGC_SUB_PORT | _00_CGC_SYSOSC_UNDER10M | _00_CGC_SUBMODE_DEFAULT;
OSTS = _07_CGC_OSCSTAB_SEL18;
MSTOP = 0U;
temp_stab_set = _FF_CGC_OSCSTAB_STA18;
do
{
temp_stab_wait = OSTC;
temp_stab_wait &= temp_stab_set;
}
while (temp_stab_wait != temp_stab_set);
/* Set fMAIN */
MCM0 = 1U;
/* Set fPLL */
PLLCTL = _80_CGC_LOCKUP_WAIT_9 | _00_CGC_PLL_BELOW_32MHZ | _10_CGC_PLL_DIVISION_4 | _02_CGC_PLL_MULTIPLY_X16;
PLLON = 1U;
/* Change the waiting time according to the system */
for (w_count = 0U; w_count <= CGC_PLLWAITTIME; w_count++)
{
NOP();
}
while ((PLLSTS & 0x80) == 0U)
{
;
}
/* Set fMP to PLL clock select mode */
SELPLL = 1U;
/* Set fSUB */
XTSTOP = 1U;
/* Set fSL */
SELLOSC = 1U;
/* Set fCLK */
CSS = 0U;
MDIV = _00_CGC_FMP_DIV_DEFAULT;
/* Set fIH */
HIOSTOP = 0U;
/* Set RTC clock source */
RTCCL = _00_CGC_RTC_FMX | _42_CGC_RTC_DIV122;
/* Set Timer RD clock source to fCLK, fMP */
TRD_CKSEL = 0U;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,228 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_cgc.h
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for CGC module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
#ifndef CGC_H
#define CGC_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Clock operation mode control register (CMC)
*/
/* High-speed system clock pin operation mode (EXCLK, OSCSEL) */
#define _C0_CGC_HISYS_PIN (0xC0U)
#define _00_CGC_HISYS_PORT (0x00U) /* X1, X2 as I/O port */
#define _40_CGC_HISYS_OSC (0x40U) /* X1, X2 as crystal/ceramic resonator connection */
#define _80_CGC_HISYS_PORT1 (0x80U) /* X1, X2 as I/O port */
#define _C0_CGC_HISYS_EXT (0xC0U) /* X1 as I/O port, X2 as external clock input */
/* Subsystem clock pin operation mode (EXCLKS, OSCSELS) */
#define _30_CGC_SUB_PIN (0x30U)
#define _00_CGC_SUB_PORT (0x00U) /* XT1, XT2 as I/O port */
#define _10_CGC_SUB_OSC (0x10U) /* XT1, XT2 as crystal connection */
#define _20_CGC_SUB_PORT1 (0x20U) /* XT1, XT2 as I/O port */
#define _30_CGC_SUB_EXT (0x30U) /* XT1 as I/O port, XT2 as external clock input */
/* XT1 oscillator oscillation mode selection (AMPHS1, AMPHS0) */
#define _00_CGC_SUBMODE_DEFAULT (0x00U)
#define _00_CGC_SUBMODE_LOW (0x00U) /* low power consumption oscillation */
#define _02_CGC_SUBMODE_NORMAL (0x02U) /* normal oscillation */
#define _04_CGC_SUBMODE_ULOW (0x04U) /* ultra-low power consumption oscillation */
/* Control of X1 high-speed system clock oscillation frequency (AMPH) */
#define _00_CGC_SYSOSC_DEFAULT (0x00U)
#define _00_CGC_SYSOSC_UNDER10M (0x00U) /* fX <= 10MHz */
#define _01_CGC_SYSOSC_OVER10M (0x01U) /* fX > 10MHz */
/*
Clock operation status control register (CSC)
*/
/* Control of high-speed system clock operation (MSTOP) */
#define _00_CGC_HISYS_OPER (0x00U) /* X1 oscillator/external clock operating */
#define _80_CGC_HISYS_STOP (0x80U) /* X1 oscillator/external clock stopped */
/* Subsystem clock operation (XTSTOP) */
#define _00_CGC_SUB_OPER (0x00U) /* XT1 oscillator operating */
#define _40_CGC_SUB_STOP (0x40U) /* XT1 oscillator stopped */
/* High-speed OCO operation (HIOSTOP) */
#define _00_CGC_HIO_OPER (0x00U) /* high-speed OCO operating */
#define _01_CGC_HIO_STOP (0x01U) /* high-speed OCO stopped */
/*
Oscillation stabilization time counter status register (OSTC)
*/
/* Oscillation stabilization time status (MOST18 - MOST8) */
#define _00_CGC_OSCSTAB_STA0 (0x00U) /* < 2^8/fX */
#define _80_CGC_OSCSTAB_STA8 (0x80U) /* 2^8/fX */
#define _C0_CGC_OSCSTAB_STA9 (0xC0U) /* 2^9/fX */
#define _E0_CGC_OSCSTAB_STA10 (0xE0U) /* 2^10/fX */
#define _F0_CGC_OSCSTAB_STA11 (0xF0U) /* 2^11/fX */
#define _F8_CGC_OSCSTAB_STA13 (0xF8U) /* 2^13/fX */
#define _FC_CGC_OSCSTAB_STA15 (0xFCU) /* 2^15/fX */
#define _FE_CGC_OSCSTAB_STA17 (0xFEU) /* 2^17/fX */
#define _FF_CGC_OSCSTAB_STA18 (0xFFU) /* 2^18/fX */
/*
Oscillation stabilization time select register (OSTS)
*/
/* Oscillation stabilization time selection (OSTS2 - OSTS0) */
#define _00_CGC_OSCSTAB_SEL8 (0x00U) /* 2^8/fX */
#define _01_CGC_OSCSTAB_SEL9 (0x01U) /* 2^9/fX */
#define _02_CGC_OSCSTAB_SEL10 (0x02U) /* 2^10/fX */
#define _03_CGC_OSCSTAB_SEL11 (0x03U) /* 2^11/fX */
#define _04_CGC_OSCSTAB_SEL13 (0x04U) /* 2^13/fX */
#define _05_CGC_OSCSTAB_SEL15 (0x05U) /* 2^15/fX */
#define _06_CGC_OSCSTAB_SEL17 (0x06U) /* 2^17/fX */
#define _07_CGC_OSCSTAB_SEL18 (0x07U) /* 2^18/fX */
/*
PLL control register (PLLCTL)
*/
/* Lockup wait counter setting value */
#define _00_CGC_LOCKUP_WAIT_7 (0x00U) /* 2^7/fMAIN */
#define _40_CGC_LOCKUP_WAIT_8 (0x40U) /* 2^8/fMAIN */
#define _80_CGC_LOCKUP_WAIT_9 (0x80U) /* 2^9/fMAIN */
/* PLL output clock selection (PLLDIV1) */
#define _00_CGC_PLL_BELOW_32MHZ (0x00U) /* when fMAIN <= 32 MHz */
#define _20_CGC_PLL_ABOVE_32MHZ (0x20U) /* when fMAIN > 32 MHz */
/* PLL output clock division selection (PLLDIV0) */
#define _00_CGC_PLL_DIVISION_2 (0x00U) /* divides the clock frequency by 2 */
#define _10_CGC_PLL_DIVISION_4 (0x10U) /* divides the clock frequency by 4 */
/* Clock mode selection (SELPLL) */
#define _00_CGC_NOSEL_PLL (0x00U) /* clock through mode */
#define _04_CGC_SEL_PLL (0x04U) /* PLL clock select mode */
/* PLL output clock (fPLLO) multiplier selection (PLLMUL) */
#define _00_CGC_PLL_MULTIPLY_X12 (0x00U) /* clock through mode */
#define _02_CGC_PLL_MULTIPLY_X16 (0x02U) /* PLL clock select mode */
/* Operating or stopping PLL function (PLLON) */
#define _00_CGC_PLL_STOP (0x00U) /* PLL operating stopped */
#define _01_CGC_PLL_ENABLE (0x01U) /* PLL operating */
/*
PLL status register (PLLSTS)
*/
/* PLL lock state */
#define _00_CGC_PLL_UNLOCKED (0x00U) /* Unlocked state */
#define _80_CGC_PLL_LOCKED (0x80U) /* Locked state */
/*
FMP clock selection division register (MDIV)
*/
/* Division of PLL clock (fMP) */
#define _00_CGC_FMP_DIV_DEFAULT (0x00U) /* fMP (default) */
#define _01_CGC_FMP_DIV_1 (0x01U) /* fMP/2^1 */
#define _02_CGC_FMP_DIV_2 (0x02U) /* fMP/2^2 */
#define _03_CGC_FMP_DIV_3 (0x03U) /* fMP/2^3 */
#define _04_CGC_FMP_DIV_4 (0x04U) /* fMP/2^4 */
#define _05_CGC_FMP_DIV_5 (0x05U) /* fMP/2^5 */
#define _06_CGC_FMP_DIV_6 (0x06U) /* fMP/2^6 */
/*
System clock control register (CKC)
*/
/* Status of CPU/peripheral hardware clock fCLK (CLS) */
#define _00_CGC_CPUCLK_MAIN (0x00U) /* main system clock (fMAIN) */
#define _80_CGC_CPUCLK_SUB (0x80U) /* subsystem clock (fSUB) */
/* Selection of CPU/peripheral hardware clock fCLK (CSS) */
#define _00_CGC_CPUCLK_SELMAIN (0x00U) /* main system clock (fMAIN) */
#define _40_CGC_CPUCLK_SELSUB (0x40U) /* subsystem clock (fSUB) */
/* Status of Main system clock fMAIN (MCS) */
#define _00_CGC_MAINCLK_HIO (0x00U) /* high-speed OCO clock (fIH) */
#define _20_CGC_MAINCLK_HISYS (0x20U) /* high-speed system clock (fMX) */
/* Selection of Main system clock fMAIN (MCM0) */
#define _00_CGC_MAINCLK_SELHIO (0x00U) /* high-speed OCO clock (fIH) */
#define _10_CGC_MAINCLK_SELHISYS (0x10U) /* high-speed system clock (fMX) */
/*
Operation speed mode control register (OSMC)
*/
/* Setting in subsystem clock HALT mode (RTCLPC) */
#define _00_CGC_SUBINHALT_ON (0x00U) /* enables supply of subsystem clock to peripheral functions */
#define _80_CGC_SUBINHALT_OFF (0x80U) /* stops supply to peripheral functions other than RTC and interval timer */
/* RTC macro operation clock (WUTMMCK0) */
#define _00_CGC_RTC_CLK_OTHER (0x00U) /* Other than fIL */
#define _10_CGC_RTC_CLK_FIL (0x10U) /* use fIL clock */
/*
Illegal memory access detection control register (IAWCTL)
*/
/* Illegal memory access detection control (IAWEN) */
#define _00_CGC_ILLEGAL_ACCESS_OFF (0x00U) /* disables illegal memory access detection */
#define _80_CGC_ILLEGAL_ACCESS_ON (0x80U) /* enables illegal memory access detection */
/* RAM guard area (GRAM1, GRAM0) */
#define _00_CGC_RAM_GUARD_OFF (0x00U) /* invalid, it is possible to write RAM */
#define _10_CGC_RAM_GUARD_AREA0 (0x10U) /* 128 bytes from RAM bottom address */
#define _20_CGC_RAM_GUARD_AREA1 (0x20U) /* 256 bytes from RAM bottom address */
#define _30_CGC_RAM_GUARD_AREA2 (0x30U) /* 512 bytes from RAM bottom address */
/* PORT register guard (GPORT) */
#define _00_CGC_PORT_GUARD_OFF (0x00U) /* invalid, it is possible to write PORT register */
#define _04_CGC_PORT_GUARD_ON (0x04U) /* valid, it is impossible to write PORT register, but possible for read */
/* Interrupt register guard (GINT) */
#define _00_CGC_INT_GUARD_OFF (0x00U) /* invalid, it is possible to write interrupt register */
#define _02_CGC_INT_GUARD_ON (0x02U) /* valid, it is impossible to write , but possible for read */
/* CSC register guard (GCSC) */
#define _00_CGC_CSC_GUARD_OFF (0x00U) /* invalid, it is possible to write CSC register */
#define _01_CGC_CSC_GUARD_ON (0x01U) /* valid, it is impossible to write CSC register, but possible for read */
/*
RTC clock selection register (RTCCL)
*/
/* Operation clock source selection for RTC (RTCCL7) */
#define _00_CGC_RTC_FMX (0x00U) /* RTC uses External Main clock (fMX) */
#define _80_CGC_RTC_FIH (0x80U) /* RTC uses Internal high speed clock (fIH) */
/* Operation selection of RTC macro (RTCCL6,RTCCKS1 - RTCCKS0) */
#define _00_CGC_RTC_FSUB (0x00U) /* RTC uses sub clock */
#define _02_CGC_RTC_DIV128 (0x02U) /* RTC uses high-speed clock / 128 */
#define _03_CGC_RTC_DIV256 (0x03U) /* RTC uses high-speed clock / 256 */
#define _42_CGC_RTC_DIV122 (0x42U) /* RTC uses high-speed clock / 122 */
#define _43_CGC_RTC_DIV244 (0x43U) /* RTC uses high-speed clock / 244 */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#define CGC_PLLWAITTIME (800U) /* change the waiting time according to the system */
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef enum
{
HIOCLK,
SYSX1CLK,
SYSEXTCLK,
SUBXT1CLK,
SUBEXTCLK
} clock_mode_t;
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void Boot_CGC_Create(void);
void Boot_CGC_Get_ResetSource(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

View File

@ -1,59 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_cgc_user.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for CGC module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_cgc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: Boot_CGC_Get_ResetSource
* Description : This function process of Reset.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,121 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_macrodriver.h
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements general head file.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
#ifndef STATUS_H
#define STATUS_H
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#pragma sfr
#pragma DI
#pragma EI
#pragma NOP
#pragma HALT
#pragma STOP
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
/* Status list definition */
#define MD_STATUSBASE 0x00U
#define MD_OK (MD_STATUSBASE + 0x00U) /* register setting OK */
#define MD_SPT (MD_STATUSBASE + 0x01U) /* IIC stop */
#define MD_NACK (MD_STATUSBASE + 0x02U) /* IIC no ACK */
#define MD_BUSY1 (MD_STATUSBASE + 0x03U) /* busy 1 */
#define MD_BUSY2 (MD_STATUSBASE + 0x04U) /* busy 2 */
#define MD_OVERRUN (MD_STATUSBASE + 0x05U) /* IIC OVERRUN occur */
/* Error list definition */
#define MD_ERRORBASE 0x80U
#define MD_ERROR (MD_ERRORBASE + 0x00U) /* error */
#define MD_ARGERROR (MD_ERRORBASE + 0x01U) /* error agrument input error */
#define MD_ERROR1 (MD_ERRORBASE + 0x02U) /* error 1 */
#define MD_ERROR2 (MD_ERRORBASE + 0x03U) /* error 2 */
#define MD_ERROR3 (MD_ERRORBASE + 0x04U) /* error 3 */
#define MD_ERROR4 (MD_ERRORBASE + 0x05U) /* error 4 */
#define MD_DATAEXISTS (MD_ERRORBASE + 0x06U) /* data to be transferred next exists in TXBn register */
#endif
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef unsigned short MD_STATUS;
#define __TYPEDEF__
#endif
//typedef signed char int8;
//typedef unsigned char uint8;
//typedef signed short int16;
//typedef unsigned short uint16;
//typedef signed long int32;
//typedef unsigned long uint32;
typedef struct{
uint8_t RspData[8];
uint8_t AckReq;
uint8_t AckLenth;
uint8_t boot_enable;
uint8_t RunAir;
uint8_t RstSrc;
uint8_t KeyErrTimes;
uint8_t SeedReqTimes;
}KamData_t;
#define WDT_RST 0x10
#define RPRGRM_REQ_VALID 0xA5
#define RUN_IN_BOOT 0x00
#define RUN_IN_APP 0xA5
#define ACK_REQ 0xA5
#define GetAppValid() (*(__far uint32 *)0xA100)
#define GetAppEndValid() (*(__far uint32 *)0x19FF0)
#define DID_0200_ADDR 0x1A000
#define DID_0201_ADDR 0x1A008
#define DID_F180_ADDR 0x19C20
#define DID_F193_ADDR 0x19C00
#define DID_F195_ADDR 0x19C10
extern KamData_t KamData;
extern uint8_t fsl_code_buf[0x480];
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
#endif

View File

@ -1,234 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_main.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements main function.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_cgc.h"
#include "boot_port.h"
#include "boot_timer.h"
#include "boot_wdt.h"
/* Start user code for include. Do not edit comment generated here */
#include "r_rl78_can_drv.h"
#include "r_rl78_can_sfr.h"
#include "RL78_RCAN.h"
#include "boot_can_user.h"
#include "api.h"
#include "Dcm_extern.h"
#include "pfdl_user.h"
#include "CanTp.h"
#include "ftable.h"
#include "boot_adc.h"
#include "Dcm_App.h"
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
#include "CanTp_Cfg.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
#pragma section @@DATA KAM_SEG
KamData_t KamData;
#pragma section @@DATA @@DATA
#pragma section @@DATA FslSeg
uint8_t fsl_code_buf[0x480];
#pragma section @@DATA @@DATA
uint16 ADval_Power;
uint16 AdcSample(uint8 ch) ;
void AdScan(void);
/* End user code. Do not edit comment generated here */
void Boot_MAIN_UserInit(void);
void IGN_Scan(void);
extern unsigned char flag_100ms;
unsigned char time,IGN_State;
#define CAN_STB P1.2
/***********************************************************************************************************************
* Function Name: main
* Description : This function implements main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void boot_main(void)
{
uint8 i;
Boot_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
Boot_TAU0_Channel4_Start();
R_ADC_Start();
R_ADC_Set_OperationOn();
//P3.0 = 1; // 开启AD_Bat
CAN_STB = 0;
if(KamData.boot_enable != RPRGRM_REQ_VALID)
{
if((GetAppValid() == APP_VALID)&&(GetAppEndValid() == APP_VALID))
{
DI();
Boot_TAU0_Channel4_Stop();
KamData.boot_enable = 0;
KamData.RunAir = RUN_IN_APP;
while(1)
{
((__far void(*)(void))(*(__far unsigned long *)(FLASH_TABLE)))();
}
}
else
{
KamData.RunAir = RUN_IN_BOOT;
InitCanTp_Parameter();
InitDcm_Parameter();
Boot_CAN_Pin_init();
CanUserInit();
BootDefaultSessionDeal();
}
}
else
{
KamData.RunAir = RUN_IN_BOOT;
InitCanTp_Parameter();
InitDcm_Parameter();
Boot_CAN_Pin_init();
CanUserInit();
BootProgramSessionDeal();
}
#if 0
if(KamData.boot_enable == RPRGRM_REQ_VALID)
{
SetCanTp_TxBuffer(KamData.RspData[0],&KamData.RspData[1]);
}
#endif
if(KamData.AckReq == ACK_REQ)
{
TransmitCAN_Message(CANTP_RESP_CANID,8,&KamData.RspData[0]);
KamData.AckReq = 0;
}
while (1U)
{
Boot_WDT_Restart();
MngDcm_1ms_Sever();
i++;
if(i>100)
{
AdScan();
IGN_Scan();
i=0;
}
}
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: Boot_MAIN_UserInit
* Description : This function adds user code before implementing main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_MAIN_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
KamData.RstSrc = RESF;
if(KamData.RstSrc != WDT_RST)
{
KamData.boot_enable = 0;
KamData.RunAir = RUN_IN_BOOT;
KamData.AckReq = 0;
}
EI();
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
void Boot_CAN_Pin_init(void)
{
PM1.0 = 0;
P1.0 = 1;
PM1.1 = 1;
//PM1.3 = 0;//OUTPUT
CAN_STB = 0;
}
uint16 AdcSample(uint8 ch)
{
uint16 u2Temp;
ADS = ch; //模拟通道输入寄存器
ADCS = 1; // A/D转换运行的控制1为允许转换运行
while(!ADIF); //中断请求标志
u2Temp = ADCR>>6; //10 位 A/D 转换结果寄存器
ADCS = 0;
ADIF = 0;
return u2Temp;
}
void AdScan(void)
{
static uint8 FilterCounter;
static uint16 AD_temp[5];
uint8 i;
uint16 AD_cal=0;
AD_temp[FilterCounter] = AdcSample(0);
FilterCounter++;
if(FilterCounter >= 5)FilterCounter=0;
for(i=0;i<5;i++)
{
AD_cal += AD_temp[i];
}
//ADval_Power = AD_cal/5;
ADval_Power = 350;
}
void IGN_Scan(void)
{
/*
if(P1.7 == 1)
{
IGN_State = 0;
}
else
{
IGN_State = 1;
}
*/
IGN_State = 1;
}
/* End user code. Do not edit comment generated here */

View File

@ -1,89 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_port.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for PORT module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_port.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: Boot_PORT_Create
* Description : This function initializes the Port I/O.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_PORT_Create(void)
{
P0 = _00_Pn0_OUTPUT_0;
P1 = _00_Pn2_OUTPUT_0 | _00_Pn5_OUTPUT_0;
P3 = _00_Pn1_OUTPUT_0;
P5 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0 | _00_Pn2_OUTPUT_0;
P7 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _00_Pn6_OUTPUT_0 | _00_Pn7_OUTPUT_0;
P9 = _00_Pn0_OUTPUT_0 | _00_Pn2_OUTPUT_0 | _00_Pn6_OUTPUT_0;
P8 = 0;
P13 = _00_Pn0_OUTPUT_0;
P14 = _00_Pn0_OUTPUT_0;
PU4 = _01_PUn0_PULLUP_ON;
PMC9 = _00_PMCn6_DI_ON | _BF_PMC9_DEFAULT;
PMC12 = _01_PMCn0_NOT_USE | _00_PMCn5_DI_ON | _DE_PMC12_DEFAULT;
PSRSEL = _00_PSR140_NORMAL | _00_PSR12_NORMAL;
ADPC = 1;//_0B_ADPC_DI_ON;
PM0 = _00_PMn0_MODE_OUTPUT | _FE_PM0_DEFAULT;
PM1 = _01_PMn0_NOT_USE | _02_PMn1_NOT_USE | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT | _10_PMn4_NOT_USE |
_00_PMn5_MODE_OUTPUT | _40_PMn6_MODE_INPUT | _80_PMn7_MODE_INPUT;
PM3 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _04_PMn2_MODE_INPUT | _00_PMn3_MODE_OUTPUT | _10_PMn4_NOT_USE |
_E0_PM3_DEFAULT;
PM5 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT | _F0_PM5_DEFAULT;
PM6 = _01_PMn0_MODE_INPUT | _02_PMn1_NOT_USE | _04_PMn2_NOT_USE | _08_PMn3_MODE_INPUT | _F0_PM6_DEFAULT;
PM7 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _04_PMn2_MODE_INPUT | _00_PMn3_MODE_OUTPUT |
_10_PMn4_MODE_INPUT | _20_PMn5_MODE_INPUT | _00_PMn6_MODE_OUTPUT | _00_PMn7_MODE_OUTPUT;
PM8 = 0xFE;
PM9 = _00_PMn0_MODE_OUTPUT | _02_PMn1_MODE_INPUT | _00_PMn2_MODE_OUTPUT | _08_PMn3_MODE_INPUT | _10_PMn4_NOT_USE |
_20_PMn5_MODE_INPUT | _00_PMn6_MODE_OUTPUT | _80_PM9_DEFAULT;
PM12 = _01_PMn0_NOT_USE | _20_PMn5_MODE_INPUT | _DE_PM12_DEFAULT;
PM14 = _00_PMn0_MODE_OUTPUT | _FE_PM14_DEFAULT;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,262 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_port.h
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for PORT module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
#ifndef PORT_H
#define PORT_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Port Mode Register (PMm)
*/
/* Pmn pin I/O mode selection (PMm7 - PMm0) */
#define _01_PMn0_NOT_USE (0x01U) /* not use Pn0 as digital I/O */
#define _01_PMn0_MODE_INPUT (0x01U) /* use Pn0 as input mode */
#define _00_PMn0_MODE_OUTPUT (0x00U) /* use Pn0 as output mode */
#define _02_PMn1_NOT_USE (0x02U) /* not use Pn1 as digital I/O */
#define _02_PMn1_MODE_INPUT (0x02U) /* use Pn1 as input mode */
#define _00_PMn1_MODE_OUTPUT (0x00U) /* use Pn1 as output mode */
#define _04_PMn2_NOT_USE (0x04U) /* not use Pn2 as digital I/O */
#define _04_PMn2_MODE_INPUT (0x04U) /* use Pn2 as input mode */
#define _00_PMn2_MODE_OUTPUT (0x00U) /* use Pn2 as output mode */
#define _08_PMn3_NOT_USE (0x08U) /* not use Pn3 as digital I/O */
#define _08_PMn3_MODE_INPUT (0x08U) /* use Pn3 as input mode */
#define _00_PMn3_MODE_OUTPUT (0x00U) /* use Pn3 as output mode */
#define _10_PMn4_NOT_USE (0x10U) /* not use Pn4 as digital I/O */
#define _10_PMn4_MODE_INPUT (0x10U) /* use Pn4 as input mode */
#define _00_PMn4_MODE_OUTPUT (0x00U) /* use Pn4 as output mode */
#define _20_PMn5_NOT_USE (0x20U) /* not use Pn5 as digital I/O */
#define _20_PMn5_MODE_INPUT (0x20U) /* use Pn5 as input mode */
#define _00_PMn5_MODE_OUTPUT (0x00U) /* use Pn5 as output mode */
#define _40_PMn6_NOT_USE (0x40U) /* not use Pn6 as digital I/O */
#define _40_PMn6_MODE_INPUT (0x40U) /* use Pn6 as input mode */
#define _00_PMn6_MODE_OUTPUT (0x00U) /* use Pn6 as output mode */
#define _80_PMn7_NOT_USE (0x80U) /* not use Pn7 as digital I/O */
#define _80_PMn7_MODE_INPUT (0x80U) /* use Pn7 as input mode */
#define _00_PMn7_MODE_OUTPUT (0x00U) /* use Pn7 as output mode */
/*
Port Register (Pm)
*/
/* Pmn pin data (Pm0 to Pm7) */
#define _00_Pn0_OUTPUT_0 (0x00U) /* Pn0 output 0 */
#define _01_Pn0_OUTPUT_1 (0x01U) /* Pn0 output 1 */
#define _00_Pn1_OUTPUT_0 (0x00U) /* Pn1 output 0 */
#define _02_Pn1_OUTPUT_1 (0x02U) /* Pn1 output 1 */
#define _00_Pn2_OUTPUT_0 (0x00U) /* Pn2 output 0 */
#define _04_Pn2_OUTPUT_1 (0x04U) /* Pn2 output 1 */
#define _00_Pn3_OUTPUT_0 (0x00U) /* Pn3 output 0 */
#define _08_Pn3_OUTPUT_1 (0x08U) /* Pn3 output 1 */
#define _00_Pn4_OUTPUT_0 (0x00U) /* Pn4 output 0 */
#define _10_Pn4_OUTPUT_1 (0x10U) /* Pn4 output 1 */
#define _00_Pn5_OUTPUT_0 (0x00U) /* Pn5 output 0 */
#define _20_Pn5_OUTPUT_1 (0x20U) /* Pn5 output 1 */
#define _00_Pn6_OUTPUT_0 (0x00U) /* Pn6 output 0 */
#define _40_Pn6_OUTPUT_1 (0x40U) /* Pn6 output 1 */
#define _00_Pn7_OUTPUT_0 (0x00U) /* Pn7 output 0 */
#define _80_Pn7_OUTPUT_1 (0x80U) /* Pn7 output 1 */
/*
Pull-up Resistor Option Register (PUm)
*/
/* Pmn pin on-chip pull-up resistor selection (PUmn) */
#define _00_PUn0_PULLUP_OFF (0x00U) /* Pn0 pull-up resistor not connected */
#define _01_PUn0_PULLUP_ON (0x01U) /* Pn0 pull-up resistor connected */
#define _00_PUn1_PULLUP_OFF (0x00U) /* Pn1 pull-up resistor not connected */
#define _02_PUn1_PULLUP_ON (0x02U) /* Pn1 pull-up resistor connected */
#define _00_PUn2_PULLUP_OFF (0x00U) /* Pn2 Pull-up resistor not connected */
#define _04_PUn2_PULLUP_ON (0x04U) /* Pn2 pull-up resistor connected */
#define _00_PUn3_PULLUP_OFF (0x00U) /* Pn3 pull-up resistor not connected */
#define _08_PUn3_PULLUP_ON (0x08U) /* Pn3 pull-up resistor connected */
#define _00_PUn4_PULLUP_OFF (0x00U) /* Pn4 pull-up resistor not connected */
#define _10_PUn4_PULLUP_ON (0x10U) /* Pn4 pull-up resistor connected */
#define _00_PUn5_PULLUP_OFF (0x00U) /* Pn5 pull-up resistor not connected */
#define _20_PUn5_PULLUP_ON (0x20U) /* Pn5 pull-up resistor connected */
#define _00_PUn6_PULLUP_OFF (0x00U) /* Pn6 pull-up resistor not connected */
#define _40_PUn6_PULLUP_ON (0x40U) /* Pn6 pull-up resistor connected */
#define _00_PUn7_PULLUP_OFF (0x00U) /* Pn7 pull-up resistor not connected */
#define _80_PUn7_PULLUP_ON (0x80U) /* Pn7 pull-up resistor connected */
/*
Port Input Mode Register (PIMm)
*/
/* Pmn pin input buffer selection (PIMmn) */
#define _00_PIMn0_TTL_OFF (0x00U) /* set Pn0 normal input buffer */
#define _01_PIMn0_TTL_ON (0x01U) /* set Pn0 TTL input buffer */
#define _00_PIMn1_TTL_OFF (0x00U) /* set Pn1 normal input buffer */
#define _02_PIMn1_TTL_ON (0x02U) /* set Pn1 TTL input buffer */
#define _00_PIMn2_TTL_OFF (0x00U) /* set Pn2 normal input buffer */
#define _04_PIMn2_TTL_ON (0x04U) /* set Pn2 TTL input buffer */
#define _00_PIMn3_TTL_OFF (0x00U) /* set Pn3 normal input buffer */
#define _08_PIMn3_TTL_ON (0x08U) /* set Pn3 TTL input buffer */
#define _00_PIMn4_TTL_OFF (0x00U) /* set Pn4 normal input buffer */
#define _10_PIMn4_TTL_ON (0x10U) /* set Pn4 TTL input buffer */
#define _00_PIMn5_TTL_OFF (0x00U) /* set Pn5 normal input buffer */
#define _20_PIMn5_TTL_ON (0x20U) /* set Pn5 TTL input buffer */
#define _00_PIMn6_TTL_OFF (0x00U) /* set Pn6 normal input buffer */
#define _40_PIMn6_TTL_ON (0x40U) /* set Pn6 TTL input buffer */
#define _00_PIMn7_TTL_OFF (0x00U) /* set Pn7 normal input buffer */
#define _80_PIMn7_TTL_ON (0x80U) /* set Pn7 TTL input buffer */
/*
Port Input Threshold Control Register (PITHLm)
*/
/* Pmn pin input threshold selection (PITHLmn) */
#define _00_PITHLn0_SCHMITT3_OFF (0x00U) /* set Pn0 schmitt 1 input (default) */
#define _01_PITHLn0_SCHMITT3_ON (0x01U) /* set Pn0 schmitt 3 input */
#define _00_PITHLn1_SCHMITT3_OFF (0x00U) /* set Pn1 schmitt 1 input (default) */
#define _02_PITHLn1_SCHMITT3_ON (0x02U) /* set Pn1 schmitt 3 input */
#define _00_PITHLn2_SCHMITT3_OFF (0x00U) /* set Pn2 schmitt 1 input (default) */
#define _04_PITHLn2_SCHMITT3_ON (0x04U) /* set Pn2 schmitt 3 input */
#define _00_PITHLn3_SCHMITT3_OFF (0x00U) /* set Pn3 schmitt 1 input (default) */
#define _08_PITHLn3_SCHMITT3_ON (0x08U) /* set Pn3 schmitt 3 input */
#define _00_PITHLn4_SCHMITT3_OFF (0x00U) /* set Pn4 schmitt 1 input (default) */
#define _10_PITHLn4_SCHMITT3_ON (0x10U) /* set Pn4 schmitt 3 input */
#define _00_PITHLn5_SCHMITT3_OFF (0x00U) /* set Pn5 schmitt 1 input (default) */
#define _20_PITHLn5_SCHMITT3_ON (0x20U) /* set Pn5 schmitt 3 input */
#define _00_PITHLn6_SCHMITT3_OFF (0x00U) /* set Pn6 schmitt 1 input (default) */
#define _40_PITHLn6_SCHMITT3_ON (0x40U) /* set Pn6 schmitt 3 input */
#define _00_PITHLn7_SCHMITT3_OFF (0x00U) /* set Pn7 schmitt 1 input (default) */
#define _80_PITHLn7_SCHMITT3_ON (0x80U) /* set Pn7 schmitt 3 input */
/*
Port Output Mode Register (POMm)
*/
/* Pmn pin output mode selection (POMmn) */
#define _00_POMn0_NCH_OFF (0x00U) /* set Pn0 output normal mode */
#define _01_POMn0_NCH_ON (0x01U) /* set Pn0 output N-ch open-drain mode */
#define _00_POMn1_NCH_OFF (0x00U) /* set Pn1 output normal mode */
#define _02_POMn1_NCH_ON (0x02U) /* set Pn1 output N-ch open-drain mode */
#define _00_POMn2_NCH_OFF (0x00U) /* set Pn2 output normal mode */
#define _04_POMn2_NCH_ON (0x04U) /* set Pn2 output N-ch open-drain mode */
#define _00_POMn3_NCH_OFF (0x00U) /* set Pn3 output normal mode */
#define _08_POMn3_NCH_ON (0x08U) /* set Pn3 output N-ch open-drain mode */
#define _00_POMn4_NCH_OFF (0x00U) /* set Pn4 output normal mode */
#define _10_POMn4_NCH_ON (0x10U) /* set Pn4 output N-ch open-drain mode */
#define _00_POMn5_NCH_OFF (0x00U) /* set Pn5 output normal mode */
#define _20_POMn5_NCH_ON (0x20U) /* set Pn5 output N-ch open-drain mode */
#define _00_POMn6_NCH_OFF (0x00U) /* set Pn6 output normal mode */
#define _40_POMn6_NCH_ON (0x40U) /* set Pn6 output N-ch open-drain mode */
#define _00_POMn7_NCH_OFF (0x00U) /* set Pn7 output normal mode */
#define _80_POMn7_NCH_ON (0x80U) /* set Pn7 output N-ch open-drain mode */
/*
Port Operation Mode Register (PMCm)
*/
/* Pmn pin digital input buffer selection (PMCmn) */
#define _01_PMCn0_NOT_USE (0x01U) /* not use Pn0 digital input */
#define _00_PMCn0_DI_ON (0x00U) /* enable Pn0 digital input */
#define _02_PMCn1_NOT_USE (0x02U) /* not use Pn1 digital input */
#define _00_PMCn1_DI_ON (0x00U) /* enable Pn1 digital input */
#define _04_PMCn2_NOT_USE (0x04U) /* not use Pn2 digital input */
#define _00_PMCn2_DI_ON (0x00U) /* enable Pn2 digital input */
#define _08_PMCn3_NOT_USE (0x08U) /* not use Pn3 digital input */
#define _00_PMCn3_DI_ON (0x00U) /* enable Pn3 digital input */
#define _10_PMCn4_NOT_USE (0x10U) /* not use Pn4 digital input */
#define _00_PMCn4_DI_ON (0x00U) /* enable Pn4 digital input */
#define _20_PMCn5_NOT_USE (0x20U) /* not use Pn5 digital input */
#define _00_PMCn5_DI_ON (0x00U) /* enable Pn5 digital input */
#define _40_PMCn6_NOT_USE (0x40U) /* not use Pn6 digital input */
#define _00_PMCn6_DI_ON (0x00U) /* enable Pn6 digital input */
#define _80_PMCn7_NOT_USE (0x80U) /* not use Pn7 digital input */
#define _00_PMCn7_DI_ON (0x00U) /* enable Pn7 digital input */
/*
Port output slew rate select register (PSRSEL)
*/
/* P140/PCLBUZ0 pin output mode selection (PSR140) */
#define _00_PSR140_NORMAL (0x00U) /* normal mode (5 V/5 ns) */
#define _20_PSR140_SLOW (0x20U) /* slow mode (25 V/5 ns (target) (TYP.)) */
/* P14/SCK01/SCL01/TO06/TRDIOC0 pin output mode selection (PSR14) */
#define _00_PSR14_NORMAL (0x00U) /* normal mode (5 V/5 ns) */
#define _10_PSR14_SLOW (0x10U) /* slow mode (25 V/5 ns (target) (TYP.)) */
/* P120/SO01/TO07/TRDIOD0 pin output mode selection (PSR120) */
#define _00_PSR120_NORMAL (0x00U) /* normal mode (5 V/5 ns) */
#define _08_PSR120_SLOW (0x08U) /* slow mode (25 V/5 ns (target) (TYP.)) */
/* P30/TO01/TRDIOD1/SNZOUT0 pin output mode selection (PSR30) */
#define _00_PSR30_NORMAL (0x00U) /* normal mode (5 V/5 ns) */
#define _04_PSR30_SLOW (0x04U) /* slow mode (25 V/5 ns (target) (TYP.)) */
/* P12/SO10/TO11/(TRDIOD0)/TXD1/SNZOUT3 pin output mode selection (PSR12) */
#define _00_PSR12_NORMAL (0x00U) /* normal mode (5 V/5 ns) */
#define _02_PSR12_SLOW (0x02U) /* slow mode (25 V/5 ns (target) (TYP.)) */
/* P10/SCK10/TO13/TRJO0/SCL10/LTXD1/CTXD0 pin output mode selection (PSR10) */
#define _00_PSR10_NORMAL (0x00U) /* normal mode (5 V/5 ns) */
#define _01_PSR10_SLOW (0x01U) /* slow mode (25 V/5 ns (target) (TYP.)) */
/*
AD port configuration register (ADPC)
*/
/* Analog input/digital input switching (ADPC4 - ADPC0) */
#define _00_ADPC_DI_OFF (0x00U) /* use P33, P34, P80 - P87, P90 - P96 as analog input */
#define _11_ADPC_DI_ON (0x11U) /* use P96 as digital input */
#define _10_ADPC_DI_ON (0x10U) /* use P95 - P96 as digital input */
#define _0F_ADPC_DI_ON (0x0FU) /* use P94 - P96 as digital input */
#define _0E_ADPC_DI_ON (0x0EU) /* use P93 - P96 as digital input */
#define _0D_ADPC_DI_ON (0x0DU) /* use P92 - P96 as digital input */
#define _0C_ADPC_DI_ON (0x0CU) /* use P91 - P96 as digital input */
#define _0B_ADPC_DI_ON (0x0BU) /* use P90 - P96 as digital input */
#define _0A_ADPC_DI_ON (0x0AU) /* use P87, P90 - P96 as digital input */
#define _09_ADPC_DI_ON (0x09U) /* use P86 - P87, P90 - P96 as digital input */
#define _08_ADPC_DI_ON (0x08U) /* use P85 - P87, P90 - P96 as digital input */
#define _07_ADPC_DI_ON (0x07U) /* use P84 - P87, P90 - P96 as digital input */
#define _06_ADPC_DI_ON (0x06U) /* use P83 - P87, P90 - P96 as digital input */
#define _05_ADPC_DI_ON (0x05U) /* use P82 - P87, P90 - P96 as digital input */
#define _04_ADPC_DI_ON (0x04U) /* use P81 - P87, P90 - P96 as digital input */
#define _03_ADPC_DI_ON (0x03U) /* use P80 - P87, P90 - P96 as digital input */
#define _02_ADPC_DI_ON (0x02U) /* use P34, P80 - P87, P90 - P96 as digital input */
#define _01_ADPC_DI_ON (0x01U) /* use P33, P34, P80 - P87, P90 - P96 as digital input */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#define _FE_PM0_DEFAULT (0xFEU) /* PM0 default value */
#define _E0_PM3_DEFAULT (0xE0U) /* PM3 default value */
#define _F0_PM4_DEFAULT (0xF0U) /* PM4 default value */
#define _F0_PM5_DEFAULT (0xF0U) /* PM5 default value */
#define _F0_PM6_DEFAULT (0xF0U) /* PM6 default value */
#define _80_PM9_DEFAULT (0x80U) /* PM9 default value */
#define _DE_PM12_DEFAULT (0xDEU) /* PM12 default value */
#define _FE_PM14_DEFAULT (0xFEU) /* PM14 default value */
#define _BF_PMC9_DEFAULT (0xBFU) /* PMC9 default value */
#define _DE_PMC12_DEFAULT (0xDEU) /* PMC12 default value */
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void Boot_PORT_Create(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

View File

@ -1,51 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_port_user.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for PORT module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_port.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,92 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_systeminit.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements system initializing function.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_cgc.h"
#include "boot_port.h"
#include "boot_timer.h"
#include "boot_wdt.h"
#include "boot_adc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: Boot_Systeminit
* Description : This function initializes every macro.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_Systeminit(void)
{
/* Set periperal I/O redirection */
PIOR0 = 0x00U;
PIOR1 = 0x00U;
PIOR4 = 0x00U;
PIOR5 = 0x00U;
PIOR7 = 0x00U;
Boot_CGC_Create();
Boot_PORT_Create();
Boot_TAU0_Create();
Boot_WDT_Create();
R_ADC_Create();
/* Set invalid memory access detection control */
IAWCTL = 0x00U;
}
/***********************************************************************************************************************
* Function Name: hdwinit
* Description : This function initializes hardware setting.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void hdwinit(void)
{
DI();
Boot_Systeminit();
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,201 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_timer.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for TAU module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_timer.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: Boot_TAU0_Create
* Description : This function initializes the TAU0 module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Create(void)
{
TAU0EN = 1U; /* supplies input clock */
TPS0 = _0000_TAU_CKM0_FCLK_0 | _0000_TAU_CKM1_FCLK_0 | _0000_TAU_CKM2_FCLK_1 | _0000_TAU_CKM3_FCLK_8;
/* Stop all channels */
TT0 = _0001_TAU_CH0_STOP_TRG_ON | _0002_TAU_CH1_STOP_TRG_ON | _0004_TAU_CH2_STOP_TRG_ON |
_0008_TAU_CH3_STOP_TRG_ON | _0010_TAU_CH4_STOP_TRG_ON | _0020_TAU_CH5_STOP_TRG_ON |
_0040_TAU_CH6_STOP_TRG_ON | _0080_TAU_CH7_STOP_TRG_ON | _0200_TAU_CH1_H8_STOP_TRG_ON |
_0800_TAU_CH3_H8_STOP_TRG_ON;
PWMDLY1 = _0000_TAU_PWM_DELAY_CLEAR; /* clear PWM output delay */
/* Mask channel 0 interrupt */
TMMK00 = 1U; /* disable INTTM00 interrupt */
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
/* Mask channel 1 interrupt */
TMMK01 = 1U; /* disable INTTM01 interrupt */
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
/* Mask channel 1 higher 8 bits interrupt */
TMMK01H = 1U; /* disable INTTM01H interrupt */
TMIF01H = 0U; /* clear INTTM01H interrupt flag */
/* Mask channel 2 interrupt */
TMMK02 = 1U; /* disable INTTM02 interrupt */
TMIF02 = 0U; /* clear INTTM02 interrupt flag */
/* Mask channel 3 interrupt */
TMMK03 = 1U; /* disable INTTM03 interrupt */
TMIF03 = 0U; /* clear INTTM03 interrupt flag */
/* Mask channel 3 higher 8 bits interrupt */
TMMK03H = 1U; /* disable INTTM03H interrupt */
TMIF03H = 0U; /* clear INTTM03H interrupt flag */
/* Mask channel 4 interrupt */
TMMK04 = 1U; /* disable INTTM04 interrupt */
TMIF04 = 0U; /* clear INTTM04 interrupt flag */
/* Mask channel 5 interrupt */
TMMK05 = 1U; /* disable INTTM05 interrupt */
TMIF05 = 0U; /* clear INTTM05 interrupt flag */
/* Mask channel 6 interrupt */
TMMK06 = 1U; /* disable INTTM06 interrupt */
TMIF06 = 0U; /* clear INTTM06 interrupt flag */
/* Mask channel 7 interrupt */
TMMK07 = 1U; /* disable INTTM07 interrupt */
TMIF07 = 0U; /* clear INTTM07 interrupt flag */
/* Set INTTM02 low priority */
TMPR102 = 1U;
TMPR002 = 1U;
/* Set INTTM04 low priority */
TMPR104 = 1U;
TMPR004 = 1U;
/* Channel 2 used as interval timer */
TMR02 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE |
_0000_TAU_TRIGGER_SOFTWARE | _0000_TAU_MODE_INTERVAL_TIMER | _0000_TAU_START_INT_UNUSED;
TDR02 = _7CFF_TAU_TDR02_VALUE;
TOM0 &= ~_0004_TAU_CH2_OUTPUT_COMBIN;
TOL0 &= ~_0004_TAU_CH2_OUTPUT_LEVEL_L;
TO0 &= ~_0004_TAU_CH2_OUTPUT_VALUE_1;
TOE0 &= ~_0004_TAU_CH2_OUTPUT_ENABLE;
/* Channel 4 used as interval timer */
TMR04 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE |
_0000_TAU_TRIGGER_SOFTWARE | _0000_TAU_MODE_INTERVAL_TIMER | _0000_TAU_START_INT_UNUSED;
TDR04 = _7CFF_TAU_TDR04_VALUE;
TOM0 &= ~_0010_TAU_CH4_OUTPUT_COMBIN;
TOL0 &= ~_0010_TAU_CH4_OUTPUT_LEVEL_L;
TO0 &= ~_0010_TAU_CH4_OUTPUT_VALUE_1;
TOE0 &= ~_0010_TAU_CH4_OUTPUT_ENABLE;
/* Set TO01 pin */
P3 &= 0xFEU;
PM3 &= 0xFEU;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel0_Start
* Description : This function starts TAU0 channel 0 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Channel0_Start(void)
{
TOE0 |= _0002_TAU_CH1_OUTPUT_ENABLE;
TS0 |= _0001_TAU_CH0_START_TRG_ON | _0002_TAU_CH1_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel0_Stop
* Description : This function stops TAU0 channel 0 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Channel0_Stop(void)
{
TT0 |= _0001_TAU_CH0_STOP_TRG_ON | _0002_TAU_CH1_STOP_TRG_ON;
TOE0 &= ~_0002_TAU_CH1_OUTPUT_ENABLE;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel2_Start
* Description : This function starts TAU0 channel 2 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Channel2_Start(void)
{
TMIF02 = 0U; /* clear INTTM02 interrupt flag */
TMMK02 = 0U; /* enable INTTM02 interrupt */
TS0 |= _0004_TAU_CH2_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel2_Stop
* Description : This function stops TAU0 channel 2 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Channel2_Stop(void)
{
TT0 |= _0004_TAU_CH2_STOP_TRG_ON;
/* Mask channel 2 interrupt */
TMMK02 = 1U; /* disable INTTM02 interrupt */
TMIF02 = 0U; /* clear INTTM02 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: Boot_TAU0_Channel4_Start
* Description : This function starts TAU0 channel 4 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Channel4_Start(void)
{
TMIF04 = 0U; /* clear INTTM04 interrupt flag */
TMMK04 = 0U; /* enable INTTM04 interrupt */
TS0 |= _0010_TAU_CH4_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel4_Stop
* Description : This function stops TAU0 channel 4 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_TAU0_Channel4_Stop(void)
{
TT0 |= _0010_TAU_CH4_STOP_TRG_ON;
/* Mask channel 4 interrupt */
TMMK04 = 1U; /* disable INTTM04 interrupt */
TMIF04 = 0U; /* clear INTTM04 interrupt flag */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_timer_user.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for TAU module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_timer.h"
/* Start user code for include. Do not edit comment generated here */
#include "boot_can_user.h"
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
extern unsigned char DCM_1ms_flag;
unsigned long freedom_count_1ms;
unsigned char TimeTick,flag_100ms;
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_tau0_channel4_interrupt
* Description : This function is INTTM04 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void r_tau0_channel4_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
DCM_1ms_flag=1;
freedom_count_1ms++;
TimeTick++;
if(TimeTick >= 100){flag_100ms=1;TimeTick=0;}
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
unsigned long GetTimerCnt(void)
{
return (freedom_count_1ms ^ (((unsigned long)TCR04)<<16));
}
/* End user code. Do not edit comment generated here */

View File

@ -1,41 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_userdefine.h
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file includes user definition.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
#ifndef _USER_DEF_H
#define _USER_DEF_H
/***********************************************************************************************************************
User definitions
***********************************************************************************************************************/
/* Start user code for function. Do not edit comment generated here */
void hdwinit(void);
void Boot_CAN_Pin_init(void);
/* End user code. Do not edit comment generated here */
#endif

View File

@ -1,78 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_wdt.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for WDT module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: Boot_WDT_Create
* Description : This function initializes the watchdogtimer.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_WDT_Create(void)
{
WDTIMK = 1U; /* disable INTWDTI interrupt */
WDTIIF = 0U; /* clear INTWDTI interrupt flag */
/* Set INTWDTI low priority */
WDTIPR1 = 1U;
WDTIPR0 = 1U;
WDTIMK = 0U; /* enable INTWDTI interrupt */
}
/***********************************************************************************************************************
* Function Name: Boot_WDT_Restart
* Description : This function restarts the watchdog timer.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void Boot_WDT_Restart(void)
{
WDTE = 0xACU; /* restart watchdog timer */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,52 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_wdt.h
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for WDT module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
#ifndef WDT_H
#define WDT_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void Boot_WDT_Create(void);
void Boot_WDT_Restart(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

View File

@ -1,64 +0,0 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2015 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : boot_wdt_user.c
* Version : CodeGenerator for RL78/F13 V2.02.01.03 [30 Jan 2015]
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description : This file implements device driver for WDT module.
* Creation Date: 2017/7/4
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "boot_macrodriver.h"
#include "boot_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "boot_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_wdt_interrupt
* Description : This function is INTWDTI interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void r_wdt_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

View File

@ -1,85 +0,0 @@
#pragma nop
#include "crc.h"
unsigned long GetCrc32(unsigned long CrcInitValue,__far unsigned char *buffer,unsigned long size);
static const unsigned long Crc32Tble[256] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
//__far unsigned char *TBuf;
unsigned long GetCrc32(unsigned long CrcInitValue,__far unsigned char *buffer,unsigned long size)
{
unsigned long crcValue = CrcInitValue;
unsigned long CrcTempCnt,TBuf;
//static __far unsigned char *TBuf;
TBuf = buffer;
if (size != 0)
{
for(CrcTempCnt = 0;CrcTempCnt < size;CrcTempCnt++)
{
crcValue = (crcValue >> 8) ^ Crc32Tble[(crcValue ^ *(__far unsigned char *)TBuf) & 0xFF];
TBuf++;
}
}
crcValue = crcValue ^ 0xFFFFFFFF;
return crcValue;
}
unsigned long GetCrc32_Ram(unsigned long CrcInitValue,unsigned char *buffer,unsigned long size)
{
unsigned long crcValue = CrcInitValue;
unsigned long CrcTempCnt,TBuf;
//static __far unsigned char *TBuf;
TBuf = buffer;
if (size != 0)
{
for(CrcTempCnt = 0;CrcTempCnt < size;CrcTempCnt++)
{
crcValue = (crcValue >> 8) ^ Crc32Tble[(crcValue ^ *(unsigned char *)TBuf) & 0xFF];
TBuf++;
}
}
crcValue = crcValue ^ 0xFFFFFFFF;
return crcValue;
}

View File

@ -1,18 +0,0 @@
#ifndef __CRC32_H__
#define __CRC32_H__
#ifdef EXTERN
#undef EXTERN
#endif /* end of #ifdef EXTERN */
#ifdef __CRC32_C__
#define EXTERN
#else
#define EXTERN extern
#endif /* end of #ifdef __CRC32_C__*/
#define CRC_INIT_VALUE (0xFFFFFFFF)
EXTERN unsigned long GetCrc32(unsigned long CrcInitValue,__far unsigned char *buffer,unsigned long size);
EXTERN unsigned long GetCrc32_Ram(unsigned long CrcInitValue,unsigned char *buffer,unsigned long size) ;
#endif /* end of #ifndef __CRC32_H__ */

View File

@ -1,30 +0,0 @@
#if !defined(CANIF_H)
#define CANIF_H
/***°üº¬Í·Îļþ***/
#include "ComTypes.h"
#include "CanTrcv.h"
#include "CanIf_Cfg.h"
//#include "canhl.h"
/***API½Ó¿Ú***/
extern void ReInitCanIf_Parameter(void);
extern void CanIf_MainFunction(void);
extern void InitCanIf_Parameter(void);
extern void DeInitCanIf_Parameter(void);
extern ComStd_ReturnType SetCanIf_BusoffEvent(CanIf_ControllerErrorType LeCanIf_u_BusoffEvent);
extern ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType ClrCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType GetCanIf_WakeUpEvent(CanIf_WakeUpSourceType *LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_ControllerMode);
extern ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr);
extern ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr);
extern ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode);
extern void RxIndicationCanIf_Messages(CanIf_HwHandleType Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
extern ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr);
extern void ConfirmCanIf_TxOK(ComUint8 LeCanIf_e_Hrh,CanIf_CanIdType LeCanIf_t_TxCanID);
extern ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel);
#endif

View File

@ -1,577 +0,0 @@
/**------------------历史版本信息-------------------------------------------------------
** : fengshulin
** V1.0
** : 2015/03/12
** :
**-------------------------------------------------------------------------------------*/
#include "CanIf.h"
//#include "CanNM.h"
/***************************************************************************************/
static CanIf_ControllerModeType TeCanIf_e_ControllerMode;
static CanTrcv_WorkModeType TeCanTrcv_e_WorkMode;
static ComUint8 SeCanIf_u_IsInit;
static ComUint8 SeCanIf_u_WakeEvent;
static ComUint32 SeCanIf_u_TxQueueCounter;
static CanIf_TxQueueType TsCanIf_h_TxQueue[CANIF_CFG_MAX_TX_HANDLE];
extern unsigned char TransmitCAN_Message(unsigned int ID,unsigned char Dlc,unsigned char *Data);
/****************************************************************************************
@ : void ClearCanIf_Queue(void)
@ : void
@ : void
@ :
@ : 2015/04/08
@ : V1.0
@ :
*****************************************************************************************/
void ClearCanIf_Queue(void)
{
ComUint8 LeCanIf_u_Index;
SeCanIf_u_TxQueueCounter = 0;
for(LeCanIf_u_Index = 0; LeCanIf_u_Index < CANIF_CFG_MAX_TX_HANDLE; LeCanIf_u_Index++)
{
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_CanId = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_CanDlc = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eQueued = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[0] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[1] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[2] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[3] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[4] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[5] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[6] = 0x00;
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[7] = 0x00;
}
}
/****************************************************************************************
@ : void DeInitCanIf_Parameter(void)
@ : void
@ : void
@ :
@ : 2015/03/14
@ : V1.0
@ :
*****************************************************************************************/
void DeInitCanIf_Parameter(void)
{
SeCanIf_u_IsInit = COM_FALSE;
}
/****************************************************************************************
@ : void ReInitCanIf_Parameter(void)
@ : void
@ : void
@ :
@ : 2015/05/7
@ : V1.0
@ :
*****************************************************************************************/
void ReInitCanIf_Parameter(void)
{
SeCanIf_u_IsInit = COM_TRUE;
}
/****************************************************************************************
@ : void InitCanIf_Parameter(void)
@ : void
@ : void
@ :
@ : 2015/03/14
@ : V1.0
@ : called by main
*****************************************************************************************/
void InitCanIf_Parameter(void)
{
TeCanIf_e_ControllerMode = CANIF_CS_STOP;
TeCanTrcv_e_WorkMode = CANTRCV_STANDBY;
ClearCanIf_Queue();
SeCanIf_u_IsInit = COM_TRUE;
}
/****************************************************************************************
@ : ComStd_ReturnType SetCanIf_BusoffEvent(void)
@ : void
@ : ComStd_ReturnType
@ :
@ : 2015/03/14
@ : V1.0
@ : called by can module to indicator busoff event has happened
*****************************************************************************************/
#if 0
ComStd_ReturnType SetCanIf_BusoffEvent(CanIf_ControllerErrorType LeCanIf_u_BusoffEvent)
{
(void)LeCanIf_u_BusoffEvent;
SetCanSM_BusoffEvent(LeCanIf_u_BusoffEvent);
return COM_E_OK;
}
#endif
/****************************************************************************************
@ : ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel)
@ : LeCanIf_u_Channel
@ : ComStd_ReturnType
@ :
@ : 2015/04/13
@ : V1.0
@ : called by can module to indicator busoff event has happened
*****************************************************************************************/
ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel)
{
(void)LeCanIf_u_Channel;
#if 0
ResetCan_Controller();
#endif
return COM_E_OK;
}
/****************************************************************************************
@ : ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_u_WakeUpSource)
@ : CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource
@ : ComStd_ReturnType
@ :
@ : 2015/03/14
@ : V1.0
@ : called by can/cantrcv/ICU module to indicator wakeup event has happened
*****************************************************************************************/
ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource)
{
SeCanIf_u_WakeEvent |= LeCanIf_e_WakeUpSource;
//SetCanNM_NmMode(NMStatus_WAITCHECK,NoActiveLoad);
return COM_E_OK;
}
ComStd_ReturnType ClrCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource)
{
SeCanIf_u_WakeEvent &= ~LeCanIf_e_WakeUpSource;
return COM_E_OK;
}
ComStd_ReturnType GetCanIf_WakeUpEvent(CanIf_WakeUpSourceType *LeCanIf_e_WakeUpSource)
{
*LeCanIf_e_WakeUpSource = SeCanIf_u_WakeEvent;
return COM_E_OK;
}
/****************************************************************************************
@ : ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_RequestedMode)
@ : CanIf_ControllerModeType LeCanIf_e_RequestedMode
@ : ComStd_ReturnType
@ : Call by CanSM
@ : 2015/03/14
@ : V1.0
@ : CanIf Layer Set Controller RequestMode
*****************************************************************************************/
ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_RequestedMode)
{
#if 0
SetCan_ControllerMode(LeCanIf_e_RequestedMode);
TeCanIf_e_ControllerMode = LeCanIf_e_RequestedMode;
#endif
return COM_E_OK;
}
/****************************************************************************************
@ : ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr)
@ : CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr
@ : ComStd_ReturnType
@ :
@ : 2015/03/14
@ : V1.0
@ : Upper Layer Get Controller Mode
*****************************************************************************************/
ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr)
{
*LeCanIf_e_ControllerModePtr = TeCanIf_e_ControllerMode;
return COM_E_OK;
}
/****************************************************************************************
@ : ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr)
@ : CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr
@ : ComStd_ReturnType
@ :
@ : 2015/03/14
@ : V1.0
@ : Upper Layer Get Transceive Mode
*****************************************************************************************/
ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr)
{
*LeCanIf_e_WorkModePtr = TeCanTrcv_e_WorkMode;
return COM_E_OK;
}
/****************************************************************************************
@ : ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode)
@ : CanTrcv_WorkModeType LeCanIf_e_WorkMode
@ : ComStd_ReturnType
@ :
@ : 2015/03/14
@ : V1.0
@ :
*****************************************************************************************/
ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode)
{
SetCanTrcv_WorkMode(LeCanIf_e_WorkMode);
TeCanTrcv_e_WorkMode = LeCanIf_e_WorkMode;
return COM_E_OK;
}
/****************************************************************************************
@ : void RxIndicationCanIf_Messages(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, const CanIf_CanDataType* LeCanIf_e_CanSduPtr)
@ : CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, const CanIf_CanDataType* LeCanIf_e_CanSduPtr
@ : void
@ :
@ : 2015/03/16
@ : V1.0
@ :
*****************************************************************************************/
void RxIndicationCanIf_Messages(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr)
{
CanIf_PduIdType LeCanIf_e_RxPduId = 0;
uint16_t temp;
(void)LeCanIf_e_Hrh;
/* No Rx-Pdus or Ranges configured. Nothing to search. */
if (0 != CANIF_CFG_GENERIC(eMaxRxPDUHandle))
{
/* Checked for invalid RxPduId earlier */
for(LeCanIf_e_RxPduId = 0;LeCanIf_e_RxPduId < CANIF_CFG_GENERIC(eMaxRxPDUHandle);LeCanIf_e_RxPduId++)
{
temp = CANIF_CFG_GENERIC(eMaxRxPDUHandle);
temp = CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eRxCanId);
if( CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eRxCanId) == LeCanIf_e_CanId )
{
/* ID matches - Pdu identified */
/* DLC check - if configured DLC == 0 the following condition is always false and DLC check is deactivated */
CanIf_RxIndicationType rxIndicationFct;
if (LeCanIf_e_CanDlc != CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId, eRxCanDlc) )
{
/*DLC Error*/
rxIndicationFct = CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eCanIf_RxErrorFct);
if(COM_NULL_PTR != rxIndicationFct)
{
rxIndicationFct(LeCanIf_e_Hrh,LeCanIf_e_CanId,LeCanIf_e_CanDlc,LeCanIf_e_CanSduPtr);
}
else
{
/*Avoid Warning*/
}
}
else
{
rxIndicationFct = CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eCanIf_RxIndicationFct);
if(COM_NULL_PTR != rxIndicationFct)
{
rxIndicationFct(LeCanIf_e_Hrh,LeCanIf_e_CanId,LeCanIf_e_CanDlc,LeCanIf_e_CanSduPtr);
}
else
{
/*Avoid Warning*/
}
}
break;
}
else
{
/*Avoid Warning*/
}
}
}
else
{
/*Avoid Warning*/
}
}
/****************************************************************************************
@ : ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr)
@ : CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr
@ : ComStd_ReturnType
@ :
@ : 2015/03/14
@ : V1.0
@ :
*****************************************************************************************/
ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr)
{
Can_ReturnType txResult = CAN_OK; /*or CAN_OK*/
CanIf_EnterCritical();
txResult = TransmitCAN_Message(LeCanIf_t_TxCanID,LeCanIf_t_TxCanDlc,LeCanIf_t_TxCanDataPtr);
CanIf_LeaveCritical();
/*发送失败*/
if(CAN_NOT_OK == txResult)
{
CanIf_uint8Type LeCanIf_e_TxPduId;
for(LeCanIf_e_TxPduId = 0;LeCanIf_e_TxPduId < CANIF_CFG_GENERIC(eMaxTxPDUHandle);LeCanIf_e_TxPduId++)
{
if( CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eTxCanId) == LeCanIf_t_TxCanID )
{
CanIf_uint8Type LeCanIf_e_TxDataCycle;
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eCanIf_CanId = LeCanIf_t_TxCanID;
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eCanIf_CanDlc = LeCanIf_t_TxCanDlc;
for(LeCanIf_e_TxDataCycle = 0;LeCanIf_e_TxDataCycle < LeCanIf_t_TxCanDlc;LeCanIf_e_TxDataCycle++)
{
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eCanIf_Txdata[LeCanIf_e_TxDataCycle] = LeCanIf_t_TxCanDataPtr[LeCanIf_e_TxDataCycle];
}
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eQueued = 1;
SeCanIf_u_TxQueueCounter |= ( 1 << (CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)) );
break;
}
else
{
}
}
}
else
{
/*Tx OK == do nothing */
}
return (ComStd_ReturnType)txResult;
}
/****************************************************************************************
@ : void TreatCanIf_TxQueue(void)
@ : void
@ : void
@ :
@ : 2015/04/08
@ : V1.0
@ :
*****************************************************************************************/
#if 0
void TreatCanIf_TxQueue(void)
{
if(0 != SeCanIf_u_TxQueueCounter)
{
Can_ReturnType txResult = CAN_NOT_OK;
CanIf_uint8Type LeCanIf_e_Index = 0;
for(LeCanIf_e_Index = 0;LeCanIf_e_Index < CANIF_CFG_MAX_TX_HANDLE;LeCanIf_e_Index++)
{
if(0 != TsCanIf_h_TxQueue[LeCanIf_e_Index].eQueued)
{
txResult = TransmitCAN_Message(TsCanIf_h_TxQueue[LeCanIf_e_Index].eCanIf_CanId,TsCanIf_h_TxQueue[LeCanIf_e_Index].eCanIf_CanDlc,TsCanIf_h_TxQueue[LeCanIf_e_Index].eCanIf_Txdata);
if(CAN_OK == txResult)
{
TsCanIf_h_TxQueue[LeCanIf_e_Index].eQueued = 0;
SeCanIf_u_TxQueueCounter &= ~( 1 << LeCanIf_e_Index );
}
else
{
}
break;
}
else
{
}
}
}
else
{
}
}
#endif
/****************************************************************************************
@ : void ConfirmCanIf_TxOK(CanIf_CanIdType LeCanIf_t_TxCanID)
@ : LeCanIf_t_TxCanID
@ : void
@ :
@ : 2015/04/08
@ : V1.0
@ :
*****************************************************************************************/
#if 0
void ConfirmCanIf_TxOK(ComUint8 LeCanIf_e_Hrh,CanIf_CanIdType LeCanIf_t_TxCanID)
{
CanIf_PduIdType LeCanIf_e_TxPduId = 0;
if(0 != CANIF_CFG_MAX_TX_HANDLE)
{
/* Checked for invalid RxPduId earlier */
for(LeCanIf_e_TxPduId = 0;LeCanIf_e_TxPduId < CANIF_CFG_GENERIC(eMaxTxPDUHandle);LeCanIf_e_TxPduId++)
{
if( CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eTxCanId) == LeCanIf_t_TxCanID )
{
CanIf_TxConfirmationType TxConfirmationFct;
TxConfirmationFct = CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eCanIf_TxConfirmationFct);
if(COM_NULL_PTR != TxConfirmationFct)
{
TxConfirmationFct(LeCanIf_e_Hrh,LeCanIf_t_TxCanID);
}
else
{
/*Avoid Warning*/
}
break;
}
else
{
/*Avoid Warning*/
}
}
}
else
{
}
CanIf_EnterCritical();
TreatCanIf_TxQueue();
CanIf_LeaveCritical();
}
#endif
/****************************************************************************************
@ : void CanIf_MainFunction(void)
@ : void
@ : void
@ : 10ms周期调用
@ : 2015/03/14
@ : V1.0
@ : CanIf层TASK
*****************************************************************************************/
void CanIf_MainFunction(void)
{
if( COM_FALSE != SeCanIf_u_IsInit )
{
if( (CANIF_CS_STOP == TeCanIf_e_ControllerMode) && (CANTRCV_STANDBY == TeCanTrcv_e_WorkMode) )
{
/*有总线唤醒事件,在此增加代码*/
}
else
{
}
}
else
{
/*Avoid Warning*/
}
}

View File

@ -1,57 +0,0 @@
#if !defined(CANIF_H)
#define CANIF_H
/***°üº¬Í·Îļþ***/
//#include "global.h"
#include "ComTypes.h"
#include "CanTrcv.h"
#include "CanIf_Cfg.h"
//#include "canhl.h"
typedef struct
{
uint32_t Arb; //!<Arb data
uint8_t Data[8]; //!<data
uint8_t Dlc; //!<data length
uint8_t eob; //!<end of buffer
uint8_t newdt; //!<new data
}CAN_DataT;
typedef enum
{
CAN_OK = 0,
CAN_NOT_OK = 1
} Can_ReturnType;
typedef enum
{
CAN_NORMAL = 0,
CAN_STOP = 1
} ControllerModeType;
typedef enum
{
busoff = 0,
error_passive = 1,
error_active=2
} ErrorStatusType;
/***API½Ó¿Ú***/
extern void ReInitCanIf_Parameter(void);
extern void CanIf_MainFunction(void);
extern void InitCanIf_Parameter(void);
extern void DeInitCanIf_Parameter(void);
extern ComStd_ReturnType SetCanIf_BusoffEvent(CanIf_ControllerErrorType LeCanIf_u_BusoffEvent);
extern ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType ClrCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType GetCanIf_WakeUpEvent(CanIf_WakeUpSourceType *LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_ControllerMode);
extern ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr);
extern ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr);
extern ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode);
extern void RxIndicationCanIf_Messages(CanIf_HwHandleType Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
extern ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr);
extern void ConfirmCanIf_TxOK(ComUint8 LeCanIf_e_Hrh,CanIf_CanIdType LeCanIf_t_TxCanID);
extern ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel);
#endif

View File

@ -1,94 +0,0 @@
/**------------------历史版本信息-------------------------------------------------------
** : fengshulin
** V1.0
** : 2015/03/12
** :
**-------------------------------------------------------------------------------------*/
#pragma DI
#pragma EI
#include "CanIf_Cfg.h"
#include "CanTp.h"
#include "CanSm.h"
/***************************************************************************************/
const CanIf_ConfigType SeCanIf_t_Config =
{
CANIF_CFG_MAX_RX_HANDLE, /* eMaxRxPDUHandle; Number of Rx PDUs */
CANIF_CFG_MAX_TX_HANDLE, /* eMaxTxPDUHandle; Number of Tx PDUs */
CANIF_CFG_MAX_CONTROLLER /* eMaxController; Number of Controllers */
};
/***************************************************************************************/
/* CanIf Rx Config
/*********************************************************/
const CanIf_CanRxConfigTabeType SeCanIf_t_CanRxConfigTabe[CANIF_CFG_MAX_RX_HANDLE] =
{
/*CAN ID*/ /*CAN DLC*/ /*ControllerID*/ /*RxIndication Fct*/ /*RxIndication Fct*/
//{0x519, 5, 0, (CanIf_RxIndicationType)COM_NULL_PTR/*&RxIndicationCom_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCom_Message*/ },
//{0x280, 8, 0, (CanIf_RxIndicationType)COM_NULL_PTR/*&RxIndicationCom_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCom_Message*/ },
//{0x516, 8, 0, (CanIf_RxIndicationType)COM_NULL_PTR/*&RxIndicationCom_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCom_Message*/ },
//{0x392, 8, 0, (CanIf_RxIndicationType)COM_NULL_PTR/*&RxIndicationCom_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCom_Message*/ },
//{0x2C0, 7, 0, (CanIf_RxIndicationType)COM_NULL_PTR/*&RxIndicationCom_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCom_Message*/ },
//{0x600, 8, 0, (CanIf_RxIndicationType)COM_NULL_PTR/*&RxIndicationCanNM_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCanNM_Message*/ },
{CANTP_ADDR_PHY_REQ, 8, 0, (CanIf_RxIndicationType)&RxIndicationCanTP_AddrPhy_Message/*&RxIndicationCanTP_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCanTP_Message*/ },
{CANTP_ADDR_FUNC_REQ, 8, 0, (CanIf_RxIndicationType)&RxIndicationCanTP_AddrFunc_Message/*&RxIndicationCanTP_Message*/, (CanIf_RxErrorType)COM_NULL_PTR/*&RxErrorCanTP_Message*/ },
};
/***************************************************************************************/
/* CanIf Tx Config
/***************************************************************************************/
const CanIf_CanTxConfigTabeType SeCanIf_t_CanTxConfigTabe[CANIF_CFG_MAX_TX_HANDLE] =
{
/*CAN ID*/ /*CAN DLC*/ /*ControllerID*/ /*eCanTxCycleOffset*/ /*eSignalFilterMode*/ /*eCanTxMode*/ /*eEventCnt*/ /*eEventCycle*/ /*eCanTxCycle*/ /*eCanIf_TxConfirmationFct*/ /*eCanIf_TxErrorFct*/ /*eQueuedIndex*/
//{0x4F1, 8, 0, 0, SIGNAL_FILTER_ALWAYS, TX_MODE_EVENT, 1, 100, 0, (CanIf_TxConfirmationType)COM_NULL_PTR/*&TxConfirmationCom_Message*/, COM_NULL_PTR, 0 },
//{0x51A, 8, 0, 0, SIGNAL_FILTER_ALWAYS, TX_MODE_MIXED, 1, 100, 100, (CanIf_TxConfirmationType)COM_NULL_PTR/*&TxConfirmationCom_Message*/, COM_NULL_PTR, 1 },
//{0x620, 2, 0, 0, SIGNAL_FILTER_ALWAYS, TX_MODE_EVENT, 1, 100, 0, COM_NULL_PTR, COM_NULL_PTR, 2 },
{CANTP_RESP_CANID, 8, 0, 0, SIGNAL_FILTER_ALWAYS, TX_MODE_EVENT, 1, 100, 0, COM_NULL_PTR, COM_NULL_PTR, 3 }
};
/****************************************************************************************
@ : void DisableCanIf_Interrupt(void)
@ : void
@ : void
@ :
@ : 2015/04/11
@ : V1.0
@ :
*****************************************************************************************/
void DisableCanIf_Interrupt(void)
{
//SetMcu_InterruptDisable();
DI();
}
/****************************************************************************************
@ : void EnableCanIf_Interrupt(void)
@ : void
@ : void
@ :
@ : 2015/04/11
@ : V1.0
@ :
*****************************************************************************************/
void EnableCanIf_Interrupt(void)
{
//SetMcu_InterruptEnable();
EI();
}

View File

@ -1,156 +0,0 @@
#if !defined(CANIF_CFG_H)
#define CANIF_CFG_H
/***包含头文件***/
#include "ComTypes.h"
/*#include "Com.h"
#include "CanTP.h"
#include "CanNM.h"
#include "mcu.h"*/
/*----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------*/
#define CANIF_MAINFUCTION_CALL_CYCLE 10u /*ms*/
#define CAN_BUS_WAKE_MASK 0x01u
#define CAN_LOCAL_WAKE_MASK 0x02u
#define CANIF_CFG_MAX_RX_HANDLE (CanIf_PduIdType)2
#define CANIF_CFG_MAX_TX_HANDLE (CanIf_PduIdType)1
#define CANIF_CFG_MAX_CONTROLLER (CanIf_PduIdType)1
#define CANIF_CFG_NM_TX_HANDLE_INDEX (CANIF_CFG_MAX_TX_HANDLE - 2)
#define CANIF_CFG_DIAG_TX_HANDLE_INDEX (CANIF_CFG_MAX_TX_HANDLE - 1)
extern void DisableCanIf_Interrupt(void);
extern void EnableCanIf_Interrupt(void);
#define CanIf_EnterCritical() DisableCanIf_Interrupt()
#define CanIf_LeaveCritical() EnableCanIf_Interrupt()
/*----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------*/
/*****************************************************/
/***CanIf模块类据类型***/
typedef unsigned char CanIf_WakeUpSourceType; /*at most,support 8 wakeupsources*/
typedef unsigned char CanIf_PduIdType;
typedef unsigned char CanIf_HwHandleType;
typedef unsigned char CanIf_CanDlcType;
typedef unsigned char CanIf_CanDataType;
typedef unsigned int CanIf_CanIdType;
typedef unsigned char CanIf_uint8Type;
typedef unsigned int CanIf_CanTxCycleType;
typedef void (*CanIf_RxIndicationType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
typedef void (*CanIf_RxErrorType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
typedef void (*CanIf_TxConfirmationType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId);
typedef void (*CanIf_TxErrorType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId);
typedef enum
{
CANIF_ERROR_ACTIVE = 0,
CANIF_ERROR_PASSIVE,
CANIF_ERROR_BUSOFF
}CanIf_ControllerErrorType;
typedef enum
{
CANIF_CS_NORMAL = 0u,
CANIF_CS_STOP
}CanIf_ControllerModeType;
typedef enum
{
TX_MODE_NONE = 0u,
TX_MODE_PERIODIC,
TX_MODE_MIXED,
TX_MODE_EVENT
}CanIf_CanBoxTxModeType;
typedef enum
{
SIGNAL_FILTER_NONE = 0u,
SIGNAL_FILTER_ALWAYS
}CanIf_CanSignalFilterModeType;
typedef struct
{
CanIf_CanIdType eTxCanId; /* */
CanIf_CanDlcType eTxCanDlc; /* */
CanIf_HwHandleType eControllerID; /* Number of Controllers */
ComUint16 eCanTxCycleOffset;
CanIf_CanSignalFilterModeType eSignalFilterMode;
CanIf_CanBoxTxModeType eCanTxMode; /* Tx Mode */
CanIf_uint8Type eEventCnt;
CanIf_uint8Type eEventCycle;
CanIf_CanTxCycleType eCanTxCycle; /* Tx Cycle*/
CanIf_TxConfirmationType eCanIf_TxConfirmationFct; /* TxConfirmation Fct */
CanIf_TxErrorType eCanIf_TxErrorFct; /* TxError Fct */
CanIf_uint8Type eQueuedIndex;
}CanIf_CanTxConfigTabeType;
extern const CanIf_CanTxConfigTabeType SeCanIf_t_CanTxConfigTabe[CANIF_CFG_MAX_TX_HANDLE];
#define CANIF_CFG_CANTX_TABLE(index,field) (SeCanIf_t_CanTxConfigTabe[(index)].field)
typedef struct
{
CanIf_CanIdType eRxCanId; /* Number of Rx PDUs */
CanIf_CanDlcType eRxCanDlc; /* Number of Tx PDUs */
CanIf_HwHandleType eControllerID; /* Number of Controllers */
CanIf_RxIndicationType eCanIf_RxIndicationFct;/* Indication Fct */
CanIf_RxErrorType eCanIf_RxErrorFct;/* Indication Fct */
}CanIf_CanRxConfigTabeType;
extern const CanIf_CanRxConfigTabeType SeCanIf_t_CanRxConfigTabe[CANIF_CFG_MAX_RX_HANDLE];
#define CANIF_CFG_CANRX_TABLE(index,field) (SeCanIf_t_CanRxConfigTabe[(index)].field)
typedef struct
{
CanIf_CanIdType eCanIf_CanId;
CanIf_CanDlcType eCanIf_CanDlc;
CanIf_uint8Type eCanIf_Txdata[8];
CanIf_uint8Type eQueued;
}CanIf_TxQueueType;
typedef struct
{
CanIf_PduIdType eMaxRxPDUHandle; /* Number of Rx PDUs */
CanIf_PduIdType eMaxTxPDUHandle; /* Number of Tx PDUs */
CanIf_uint8Type eMaxController; /* Number of Controllers */
}CanIf_ConfigType;
extern const CanIf_ConfigType SeCanIf_t_Config;
#define CANIF_CFG_GENERIC(eMaxRxPDUHandle) (SeCanIf_t_Config.eMaxRxPDUHandle)
/*****************************************************/
#endif /* CANIF_CFG_H */

View File

@ -1,157 +0,0 @@
#if !defined(CANIF_CFG_H)
#define CANIF_CFG_H
/***包含头文件***/
#include "ComTypes.h"
//#include "global.h"
/*#include "Com.h"
#include "CanTP.h"
#include "CanNM.h"
#include "mcu.h"*/
/*----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------*/
#define CANIF_MAINFUCTION_CALL_CYCLE 10u /*ms*/
#define CAN_BUS_WAKE_MASK 0x01u
#define CAN_LOCAL_WAKE_MASK 0x02u
#define CANIF_CFG_MAX_RX_HANDLE (CanIf_PduIdType)2
#define CANIF_CFG_MAX_TX_HANDLE (CanIf_PduIdType)1
#define CANIF_CFG_MAX_CONTROLLER (CanIf_PduIdType)1
#define CANIF_CFG_NM_TX_HANDLE_INDEX (CANIF_CFG_MAX_TX_HANDLE - 2)
#define CANIF_CFG_DIAG_TX_HANDLE_INDEX (CANIF_CFG_MAX_TX_HANDLE - 1)
extern void DisableCanIf_Interrupt(void);
extern void EnableCanIf_Interrupt(void);
#define CanIf_EnterCritical() DisableCanIf_Interrupt()
#define CanIf_LeaveCritical() EnableCanIf_Interrupt()
/*----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------*/
/*****************************************************/
/***CanIf模块类据类型***/
typedef unsigned char CanIf_WakeUpSourceType; /*at most,support 8 wakeupsources*/
typedef unsigned char CanIf_PduIdType;
typedef unsigned char CanIf_HwHandleType;
typedef unsigned char CanIf_CanDlcType;
typedef unsigned char CanIf_CanDataType;
typedef unsigned int CanIf_CanIdType;
typedef unsigned char CanIf_uint8Type;
typedef unsigned int CanIf_CanTxCycleType;
typedef void (*CanIf_RxIndicationType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
typedef void (*CanIf_RxErrorType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
typedef void (*CanIf_TxConfirmationType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId);
typedef void (*CanIf_TxErrorType)(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId);
typedef enum
{
CANIF_ERROR_ACTIVE = 0,
CANIF_ERROR_PASSIVE,
CANIF_ERROR_BUSOFF
}CanIf_ControllerErrorType;
typedef enum
{
CANIF_CS_NORMAL = 0u,
CANIF_CS_STOP
}CanIf_ControllerModeType;
typedef enum
{
TX_MODE_NONE = 0u,
TX_MODE_PERIODIC,
TX_MODE_MIXED,
TX_MODE_EVENT
}CanIf_CanBoxTxModeType;
typedef enum
{
SIGNAL_FILTER_NONE = 0u,
SIGNAL_FILTER_ALWAYS
}CanIf_CanSignalFilterModeType;
typedef struct
{
CanIf_CanIdType eTxCanId; /* */
CanIf_CanDlcType eTxCanDlc; /* */
CanIf_HwHandleType eControllerID; /* Number of Controllers */
ComUint16 eCanTxCycleOffset;
CanIf_CanSignalFilterModeType eSignalFilterMode;
CanIf_CanBoxTxModeType eCanTxMode; /* Tx Mode */
CanIf_uint8Type eEventCnt;
CanIf_uint8Type eEventCycle;
CanIf_CanTxCycleType eCanTxCycle; /* Tx Cycle*/
CanIf_TxConfirmationType eCanIf_TxConfirmationFct; /* TxConfirmation Fct */
CanIf_TxErrorType eCanIf_TxErrorFct; /* TxError Fct */
CanIf_uint8Type eQueuedIndex;
}CanIf_CanTxConfigTabeType;
extern const CanIf_CanTxConfigTabeType SeCanIf_t_CanTxConfigTabe[CANIF_CFG_MAX_TX_HANDLE];
#define CANIF_CFG_CANTX_TABLE(index,field) (SeCanIf_t_CanTxConfigTabe[(index)].field)
typedef struct
{
CanIf_CanIdType eRxCanId; /* Number of Rx PDUs */
CanIf_CanDlcType eRxCanDlc; /* Number of Tx PDUs */
CanIf_HwHandleType eControllerID; /* Number of Controllers */
CanIf_RxIndicationType eCanIf_RxIndicationFct;/* Indication Fct */
CanIf_RxErrorType eCanIf_RxErrorFct;/* Indication Fct */
}CanIf_CanRxConfigTabeType;
extern const CanIf_CanRxConfigTabeType SeCanIf_t_CanRxConfigTabe[CANIF_CFG_MAX_RX_HANDLE];
#define CANIF_CFG_CANRX_TABLE(index,field) (SeCanIf_t_CanRxConfigTabe[(index)].field)
typedef struct
{
CanIf_CanIdType eCanIf_CanId;
CanIf_CanDlcType eCanIf_CanDlc;
CanIf_uint8Type eCanIf_Txdata[8];
CanIf_uint8Type eQueued;
}CanIf_TxQueueType;
typedef struct
{
CanIf_PduIdType eMaxRxPDUHandle; /* Number of Rx PDUs */
CanIf_PduIdType eMaxTxPDUHandle; /* Number of Tx PDUs */
CanIf_uint8Type eMaxController; /* Number of Controllers */
}CanIf_ConfigType;
extern const CanIf_ConfigType SeCanIf_t_Config;
#define CANIF_CFG_GENERIC(eMaxRxPDUHandle) (SeCanIf_t_Config.eMaxRxPDUHandle)
/*****************************************************/
#endif /* CANIF_CFG_H */

View File

@ -1,71 +0,0 @@
#if !defined (CAN_SM_H)
#define CAN_SM_H
/***********************************************************/
#include "CanSM_Cfg.h"
#include "CanIf_Cfg.h"
#include "CanIf.h"
#include "CanTp.h"
#include "CanTrcv.h"
/***********************************************************/
typedef CanIf_ControllerErrorType CanSM_BusErrorStatusType;
typedef unsigned char CanSM_BattModeType;
typedef CanIf_ControllerModeType Can_ControllerModeType;
typedef CanIf_CanDlcType Can_CanDlcType;
typedef CanIf_CanDataType Can_CanDataType;
typedef CanIf_CanIdType Can_CanIdType;
typedef CanIf_HwHandleType Can_HwHandleType;
typedef CanIf_ControllerErrorType Can_ErrorStatusType;
typedef enum
{
COMM_NO_COMMUNICATION = 0u,
COMM_SILENT_COMMUNICATION,
COMM_FULL_COMMUNICATION
}CanSM_CommuniocationStatusType;
typedef enum
{
BUS_TRAFFIC_OFFLINE = 0u,
BUS_TRAFFIC_TXONLINE,
BUS_TRAFFIC_RXONLINE,
BUS_TRAFFIC_ONLINE
}CanSM_BusTrafficType;
typedef struct
{
CanSM_BorTimerType eCanSm_BorTimer;
CanSM_BusErrorStatusType eCanSM_BusErrorStatus;
CanSM_BattModeType eCanSM_NewBattMode;
CanSM_BattModeType eCanSM_OldBattMode;
CanSM_CommuniocationStatusType eCanSm_RequestedNewComMode;
CanSM_CommuniocationStatusType eCanSm_RequestedOldComMode;
CanSM_BusTrafficType eCanSM_ComTraffic;
CanSM_BusTrafficType eCanSM_NMTraffic;
ComUint8 eCanSM_IsInit;
}CanSM_LocalClusterDataType;
extern CanSM_LocalClusterDataType TsCanSM_h_LocalClusterData;
#define GET_CANSM_LOCAL_DATA(field) (TsCanSM_h_LocalClusterData.field)
#define SET_CANSM_LOCAL_DATA(field,data) (TsCanSM_h_LocalClusterData.field = data)
/***********************************************************/
extern void CanSM_MainFunction(void);
extern void InitCanSM_Parameter(void);
extern void DeInitCanSM_Parameter(void);
extern void ReInitCanSM_Parameter(void);
extern void GetCanSM_ControllerBusoffStatus(CanSM_BusErrorStatusType *LeCanSM_u_BusoffStatus);
extern void SetCanSM_BusoffEvent(CanSM_BusErrorStatusType LeCanSM_u_BusoffEvent);
extern void GetCanSM_ComTrafficStatus(CanSM_BusTrafficType *LeCanSM_e_DataPtr);
extern void GetCanSM_NMTrafficStatus(CanSM_BusTrafficType *LeCanSM_e_DataPtr);
/***********************************************************/
#endif

View File

@ -1,40 +0,0 @@
#if !defined (CAN_SM_CFG_H)
#define CAN_SM_CFG_H
#include "ComTypes.h"
//#include "canhl.h"
/*----------------------------------------------------------------------------------
Ä£¿éÅäÖÃÏʼ
-----------------------------------------------------------------------------------*/
#define CANSM_MAINFUCTION_CALL_CYCLE 1u /*ms*/
#define CANSM_BATT_POWERON_MODE 0
#define CANSM_CAN_INIT COM_STD_ON
#define CANSM_TRCV_INIT COM_STD_ON
#define CANSM_CANIF_INIT COM_STD_ON
#define CANSM_CANTP_INIT COM_STD_ON
#define CANSM_CANSM_INIT COM_STD_ON
extern void CanSM_EnterCritical(void);
extern void CanSM_LeaveCritical(void);
/*----------------------------------------------------------------------------------
Ä£¿éÅäÖÃÏî½áÊø
-----------------------------------------------------------------------------------*/
typedef unsigned int CanSM_BorTimerType;
typedef struct
{
CanSM_BorTimerType eCanSM_BorFastTimer;
}CanSM_ConfigType;
extern const CanSM_ConfigType TeCanSM_h_Config;
#define CANSM_CFG_GENERIC(field) (TeCanSM_h_Config.field)
#endif

View File

@ -1,98 +0,0 @@
/* @ 处根据实际情况填写相关信息,将@字符以及这条提示语句去掉 */
#ifndef CANTP_H
#define CANTP_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "CanSm.h"
#include "CanTp_Cfg.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
typedef enum
{
CeCanTp_e_Empty = 0,
CeCanTp_e_Full = 1,
CeCanTp_e_SF_Full = 2,
}TeCanTp_e_RxBufferSts;
typedef enum
{
CeCanTp_e_Physical=0,
CeCanTp_e_Functional,
}TeCanTp_e_AddrMethod;
typedef enum
{
CeCanTp_e_Idel = 0,
CeCanTp_e_SF_Get,
CeCanTp_e_MF_FFGet,
CeCanTp_e_MF_CFTakein,
CeCanTp_e_MF_Get,
CeCanTp_e_Answer,
}TeCanTp_e_TpSts;
typedef enum
{
CeCanTp_e_TX_Idel = 0,
CeCanTp_e_TX_FCWaiting,
CeCanTp_e_TX_FCGet,
CeCanTp_e_TX_CFGaving,
}TeCanTp_e_MFTxSts;
typedef enum
{
CeCanTp_e_As = 0,
CeCanTp_e_Bs,
CeCanTp_e_Cs,
CeCanTp_e_Ar,
CeCanTp_e_Br,
CeCanTp_e_Cr,
}TeCanTp_e_MFTimerSwitch;
typedef enum
{
CeCanTp_e_Tx_Idle = 0,
CeCanTp_e_Tx_Busy,
}TeCanTp_e_TxSts;
typedef enum
{
CeCanTp_e_Tx_Succeed = 0,
CeCanTp_e_Tx_Wrong,
}TeCanTp_e_TxResult;
typedef enum
{
CeCanTp_e_S3_Start = 0,
CeCanTp_e_S3_Stop,
}TeCanTp_e_S3TimerSts;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
extern uint8 GetCanTp_u_S3Sts(void);/* 读取S3 */
extern void MngCanTp_MainFunction(void);/* 主调度函数 */
extern void InitCanTp_Parameter(void);/* 初始化 */
extern TeCanTp_e_TxResult SetCanTp_TxBuffer(uint16 LeCanTp_p_DL, const uint8 LeCanTp_p_DataAddr[]);/* 发送函数 */
extern TeCanTp_e_TxResult SetCanTp_Tx_78Neg(uint16 LeCanTp_p_DL , const uint8 LeCanTp_p_DataAddr[]);
extern void RxIndicationCanTP_AddrFunc_Message(CanIf_HwHandleType LeCanTp_e_Hrh, CanIf_CanIdType LeCanTp_e_CanId,CanIf_CanDlcType LeCanTp_e_CanDlc, const CanIf_CanDataType LeCanTp_e_CanSduPtr[]);/* 接收函数 */
extern void RxIndicationCanTP_AddrPhy_Message(CanIf_HwHandleType LeCanTp_e_Hrh, CanIf_CanIdType LeCanTp_e_CanId,CanIf_CanDlcType LeCanTp_e_CanDlc,const CanIf_CanDataType LeCanTp_e_CanSduPtr[]);/* 接收函数 */
extern TeCanTp_e_RxBufferSts GetCanTp_e_RxBufferSts(uint8* LeCanTp_p_AddrMethod , uint16* LeCanTp_p_DL , uint8** LeCanTp_p_DataAddr);/* 上层读取接收到得报文 */
#endif

View File

@ -1,35 +0,0 @@
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "CanTp_Cfg.h"
/******************************************************************************
* Description: : Global Variable Definition Section
******************************************************************************/
const unsigned char TP_DUMMY = 0xAA;
const CanIf_CanIdType CANTP_ADDR_PHY_REQ_const = CANTP_ADDR_PHY_REQ;
const CanIf_CanIdType CANTP_ADDR_FUNC_REQ_const = CANTP_ADDR_FUNC_REQ;
const CanIf_CanIdType CANTP_RESP_CANID_const = CANTP_RESP_CANID;
const uint8 CANTP_RX_STMIN = CANTP_RX_STMIN_DEFINE;
const uint16 CANTP_BS_TIMEOUT = CANTP_BS_TIMEOUT_DEFINE;
const uint16 CANTP_CR_TIMEOUT = CANTP_CR_TIMEOUT_DEFINE ;
const uint16 CANTP_APP_RESP_78NEG = CANTP_APP_RESP_78NEG_DEFINE;
/******************************************************************************
* Description: : Static Variable Definition Section
******************************************************************************/
/******************************************************************************
* Description: : Static Function Prototype Declaration
*****************************************************************************/
/******************************************************************************
* Description: : Write User Function Code
*****************************************************************************/

View File

@ -1,76 +0,0 @@
/*@处根据实际情况填写相关信息,将@字符以及这条提示语句去掉*/
#ifndef CANTP_CFG_H
#define CANTP_CFG_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "_Types.h"
#include "CanIf_Cfg.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
/*@define类型定义*/
#define CANTP_TASK 1
#define CANTP_MFLEN_MAX 1200 /* 多帧最大长度 */
#define LEFT_BOARD 0
#define RIGHT_BOARD 1
#define BOARD_CFG RIGHT_BOARD
#if BOARD_CFG == LEFT_BOARD
#define CANTP_ADDR_FUNC_REQ 0x7DF /* 诊断功能寻址 */
#define CANTP_ADDR_PHY_REQ 0x751 /* 诊断物理寻址 */
#define CANTP_RESP_CANID 0x759 /* 诊断反馈 */ //0x7AB
#else
#define CANTP_ADDR_FUNC_REQ 0x7DF /* 诊断功能寻址 */
#define CANTP_ADDR_PHY_REQ 0x752 /* 诊断物理寻址 */
#define CANTP_RESP_CANID 0x75A /* 诊断反馈 */ //0x7AB
#endif
#define CANTP_ADDRFUNC_MF_FORBID _FALSE
#define CANTP_RX_STMIN_DEFINE 0 /* STmin */
#define CANTP_AS_TIMEOUT_DEFINE 25u /* 25ms?*/
#define CANTP_BS_TIMEOUT_DEFINE 75u /* 75ms? */
#define CANTP_CS_TIMEOUT /*(N_Cs + N_As) < 0.9*N_Bs */
#define CANTP_AR_TIMEOUT 25u /* 25ms? */
#define CANTP_BR_TIMEOUT /* (N_Br + N_Ar) < 0.9*N_Cr */
#define CANTP_CR_TIMEOUT_DEFINE 150u /* 150ms */
#define CANTP_RESP_TIMEOUT 500u
#define CANTP_APP_RESP_TIMEOUT 500u /* APP响应时间 */
#define CANTP_APP_RESP_78NEG_DEFINE 5000u /* 78负相应 */
extern const unsigned char TP_DUMY;// = 0xAA ; /* TP空闲填充 */
extern const CanIf_CanIdType CANTP_ADDR_PHY_REQ_const ;
extern const CanIf_CanIdType CANTP_ADDR_FUNC_REQ_const ;
extern const CanIf_CanIdType CANTP_RESP_CANID_const ;
extern const uint8 CANTP_RX_STMIN;
extern const uint16 CANTP_BS_TIMEOUT;
extern const uint16 CANTP_CR_TIMEOUT;
extern const uint16 CANTP_APP_RESP_78NEG;
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/*@结构类型typedef定义*/
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
/*@全局变量声明extern*/
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
/*@接口函数声明extern*/
#endif

View File

@ -1,35 +0,0 @@
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "CanTp_Cfg.h"
/******************************************************************************
* Description: : Global Variable Definition Section
******************************************************************************/
const unsigned char TP_DUMY = 0;
const CanIf_CanIdType CANTP_ADDR_PHY_REQ_const = CANTP_ADDR_PHY_REQ;
const CanIf_CanIdType CANTP_ADDR_FUNC_REQ_const = CANTP_ADDR_FUNC_REQ;
const CanIf_CanIdType CANTP_RESP_CANID_const = CANTP_RESP_CANID;
const uint8 CANTP_RX_STMIN = CANTP_RX_STMIN_DEFINE;
const uint16 CANTP_BS_TIMEOUT = CANTP_BS_TIMEOUT_DEFINE;
const uint16 CANTP_CR_TIMEOUT CANTP_CR_TIMEOUT_DEFINE ;
const uint16 CANTP_APP_RESP_78NEG = CANTP_APP_RESP_78NEG_DEFINE;
/******************************************************************************
* Description: : Static Variable Definition Section
******************************************************************************/
/******************************************************************************
* Description: : Static Function Prototype Declaration
*****************************************************************************/
/******************************************************************************
* Description: : Write User Function Code
*****************************************************************************/

View File

@ -1,69 +0,0 @@
/*@处根据实际情况填写相关信息,将@字符以及这条提示语句去掉*/
#ifndef CANTP_CFG_H
#define CANTP_CFG_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "_Types.h"
#include "CanIf_Cfg.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
/*@define类型定义*/
#define CANTP_TASK 1
#define CANTP_MFLEN_MAX 1200 /* 多帧最大长度 */
#define CANTP_ADDR_FUNC_REQ 0x7DF /* 诊断功能寻址 */
#define CANTP_ADDR_PHY_REQ 0x760 /* 诊断物理寻址 */
#define CANTP_RESP_CANID 0x768 /* 诊断反馈 */ //0x7AB
#define CANTP_ADDRFUNC_MF_FORBID _FALSE
#define CANTP_RX_STMIN_DEFINE 2 /* STmin */
#define CANTP_AS_TIMEOUT_DEFINE 25u /* 25ms?*/
#define CANTP_BS_TIMEOUT_DEFINE 75u /* 75ms? */
#define CANTP_CS_TIMEOUT /*(N_Cs + N_As) < 0.9*N_Bs */
#define CANTP_AR_TIMEOUT 25u /* 25ms? */
#define CANTP_BR_TIMEOUT /* (N_Br + N_Ar) < 0.9*N_Cr */
#define CANTP_CR_TIMEOUT_DEFINE 150u /* 150ms */
#define CANTP_RESP_TIMEOUT 500u
#define CANTP_APP_RESP_TIMEOUT 500u /* APP响应时间 */
#define CANTP_APP_RESP_78NEG_DEFINE 5000u /* 78负相应 */
extern const unsigned char TP_DUMY;// = 0xAA ; /* TP空闲填充 */
extern const CanIf_CanIdType CANTP_ADDR_PHY_REQ_const ;
extern const CanIf_CanIdType CANTP_ADDR_FUNC_REQ_const ;
extern const CanIf_CanIdType CANTP_RESP_CANID_const ;
extern const uint8 CANTP_RX_STMIN;
extern const uint16 CANTP_BS_TIMEOUT;
extern const uint16 CANTP_CR_TIMEOUT;
extern const uint16 CANTP_APP_RESP_78NEG;
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/*@结构类型typedef定义*/
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
/*@全局变量声明extern*/
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
/*@接口函数声明extern*/
#endif

View File

@ -1,270 +0,0 @@
/**------------------历史版本信息-------------------------------------------------------
** : fengshulin
** V1.0
** : 2015/03/13
** : ,TJA1042T CAN收发器
**-------------------------------------------------------------------------------------*/
#include "CanTrcv.h"
/***************************************************************************************/
static CanTrcv_WorkModeType SeCanTrcv_e_WorkMode;
static CanTrcv_WakeReasonType SeCanTrcv_e_WakeReason;
static CanTrcv_WakeModeType SeCanTrcv_e_WakeMode;
static ComUint8 SeCanTrcv_u_IsInit;
/****************************************************************************************
@ : void DeInitCanTrcv_Parameter(void)
@ : void
@ : void
@ : CAN收发器模块所有参数
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void DeInitCanTrcv_Parameter(void)
{
SeCanTrcv_u_IsInit = COM_FALSE;
}
/****************************************************************************************
@ : void ReInitCanTrcv_Parameter(void)
@ : void
@ : void
@ : CAN收发器模块所有参数
@ : 2015/05/7
@ : V1.0
@ :
*****************************************************************************************/
void ReInitCanTrcv_Parameter(void)
{
SeCanTrcv_u_IsInit = COM_TRUE;
}
/****************************************************************************************
@ : void InitCanTrcv_Parameter(void)
@ : void
@ : void
@ : CAN收发器模块所有参数
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void InitCanTrcv_Parameter(void)
{
SeCanTrcv_e_WorkMode = CANTRCV_STANDBY;
SeCanTrcv_e_WakeReason = CANTRCV_WAKE_BY_NONE;
SeCanTrcv_e_WakeMode = CANTRCV_WAKE_VIA_BUS;
SeCanTrcv_u_IsInit = COM_TRUE;
}
/****************************************************************************************
@ : void GetCanTrcv_WorkMode(CanTrcv_WorkModeType *LeCanTrcv_e_WorkModePtr)
@ : CanTrcv_WorkModeType *LeCanTrcv_e_WorkModePtr
@ : void
@ : CAN发收器工作模式
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void GetCanTrcv_WorkMode(CanTrcv_WorkModeType *LeCanTrcv_e_WorkModePtr)
{
*LeCanTrcv_e_WorkModePtr = SeCanTrcv_e_WorkMode;
}
/****************************************************************************************
@ : void SetCanTrcv_WorkMode(CanTrcv_WorkModeType LeCanTrcv_e_WorkMode)
@ : CanTrcv_WorkModeType LeCanTrcv_e_WorkMode
@ : void
@ : CAN发收器工作模式
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void SetCanTrcv_WorkMode(CanTrcv_WorkModeType LeCanTrcv_e_WorkMode)
{
if( CANTRCV_NORMAL == LeCanTrcv_e_WorkMode)
{
SET_CANTRCV_NORMAL();
SeCanTrcv_e_WorkMode = LeCanTrcv_e_WorkMode;
}
else if( CANTRCV_STANDBY == LeCanTrcv_e_WorkMode)
{
SET_CANTRCV_STANDBY();
SeCanTrcv_e_WorkMode = LeCanTrcv_e_WorkMode;
}
else
{
/*Avoid Warning*/
}
}
/****************************************************************************************
@ : void GetCanTrcv_WakeReason(CanTrcv_WakeReasonType *LeCanTrcv_e_WakeReasonPtr)
@ : CanTrcv_WakeReasonType *LeCanTrcv_e_WakeReasonPtr
@ : void
@ : CAN发收器唤醒源
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void GetCanTrcv_WakeReason(CanTrcv_WakeReasonType *LeCanTrcv_e_WakeReasonPtr)
{
*LeCanTrcv_e_WakeReasonPtr = SeCanTrcv_e_WakeReason;
}
/****************************************************************************************
@ : void ClearCanTrcv_WakeReason(void)
@ : void
@ : void
@ : CAN发收器唤醒源
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void ClearCanTrcv_WakeReason(void)
{
SeCanTrcv_e_WakeReason = CANTRCV_WAKE_BY_NONE;
}
/****************************************************************************************
@ : void SetCanTrcv_WakeMode(CanTrcv_WakeModeType LeCanTrcv_e_WakeMode)
@ : CanTrcv_WakeModeType LeCanTrcv_e_WakeMode
@ : void
@ : CAN发收器唤醒模式
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void SetCanTrcv_WakeMode(CanTrcv_WakeModeType LeCanTrcv_e_WakeMode)
{
(void)LeCanTrcv_e_WakeMode;
}
/****************************************************************************************
@ : void GetCanTrcv_WakeMode(CanTrcv_WakeModeType *LeCanTrcv_e_WakeModePtr)
@ : CanTrcv_WakeModeType *LeCanTrcv_e_WakeModePtr
@ : void
@ : CAN发收器唤醒模式
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void GetCanTrcv_WakeMode(CanTrcv_WakeModeType *LeCanTrcv_e_WakeModePtr)
{
*LeCanTrcv_e_WakeModePtr = SeCanTrcv_e_WakeMode;
}
/****************************************************************************************
@ : void CanTrcv_MainFunction(void)
@ : void
@ : void
@ : CAN_TRCV_MAINFUCTION_CALL_CYCLE ms调用
@ : 2015/03/13
@ : V1.0
@ :
*****************************************************************************************/
void CanTrcv_MainFunction(void)
{
if( COM_FALSE != SeCanTrcv_u_IsInit )
{
}
else
{
/*Avoid Warning*/
}
}

View File

@ -1,49 +0,0 @@
#if !defined(CANTRCV_H)
#define CANTRCV_H
/***包含头文件***/
#include "CanTrcv_Cfg.h"
/***收发器模块类据类型***/
typedef enum
{
CANTRCV_UNINIT = 0u,
CANTRCV_NORMAL,
CANTRCV_STANDBY
}CanTrcv_WorkModeType;
typedef enum
{
CANTRCV_WAKE_BY_NONE = 0u,
CANTRCV_WAKE_BY_BUS,
CANTRCV_WAKE_BY_PIN,
CANTRCV_WAKE_BY_PIN_BUS
}CanTrcv_WakeReasonType;
typedef enum
{
CANTRCV_WAKE_VIA_NONE = 0u,
CANTRCV_WAKE_VIA_BUS,
CANTRCV_WAKE_VIA_PIN,
CANTRCV_WAKE_VIA_ALL
}CanTrcv_WakeModeType;
/***API接口***/
extern void ReInitCanTrcv_Parameter(void);
extern void CanTrcv_MainFunction(void);
extern void InitCanTrcv_Parameter(void);
extern void DeInitCanTrcv_Parameter(void);
extern void GetCanTrcv_WorkMode(CanTrcv_WorkModeType *LeCanTrcv_e_WorkModePtr);
extern void SetCanTrcv_WorkMode(CanTrcv_WorkModeType LeCanTrcv_e_WorkMode);
extern void GetCanTrcv_WakeReason(CanTrcv_WakeReasonType *LeCanTrcv_e_WakeReasonPtr);
extern void ClearCanTrcv_WakeReason(void);
extern void SetCanTrcv_WakeMode(CanTrcv_WakeModeType LeCanTrcv_e_WakeMode);
extern void GetCanTrcv_WakeMode(CanTrcv_WakeModeType *LeCanTrcv_e_WakeModePtr);
#endif

View File

@ -1,58 +0,0 @@
/**------------------历史版本信息-------------------------------------------------------
** : fengshulin
** V1.0
** : 2015/04/11
** :
**-------------------------------------------------------------------------------------*/
//#include "IO_cfg.h"
#include "CanTrcv_Cfg.h"
/****************************************************************************************
@ : void SetCanTrcvCfg_NormalMode(void)
@ : void
@ : void
@ :
@ : 2015/04/11
@ : V1.0
@ :
*****************************************************************************************/
void SetCanTrcvCfg_NormalMode(void)
{
// SetGpio_Channel_Level(CAN_STB/*CAN STB IO */,STD_LOW);
}
/****************************************************************************************
@ : void SetCanTrcvCfg_StandbyMode(void)
@ : void
@ : void
@ :
@ : 2015/04/11
@ : V1.0
@ :
*****************************************************************************************/
void SetCanTrcvCfg_StandbyMode(void)
{
// SetGpio_Channel_Level(CAN_STB/*CAN STB IO */,STD_HIGH);
}

View File

@ -1,29 +0,0 @@
#if !defined(CANTRCV_CFG_H)
#define CANTRCV_CFG_H
/**包含头文件**/
#include "ComTypes.h"
/*----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------*/
/***CanTrcv_MainFunction调度周期***/
#define CAN_TRCV_MAINFUCTION_CALL_CYCLE 5u /*ms*/
/***CAN 控制器模式控制宏函数***/
extern void SetCanTrcvCfg_StandbyMode(void);
extern void SetCanTrcvCfg_NormalMode(void);
#define SET_CANTRCV_STANDBY() SetCanTrcvCfg_StandbyMode()
#define SET_CANTRCV_NORMAL() SetCanTrcvCfg_NormalMode()
/*----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------*/
#endif

View File

@ -1,41 +0,0 @@
#if !defined(COM_TYPE_H)
#define COM_TYPE_H
typedef unsigned char ComUint8;
typedef unsigned short ComUint16;
typedef unsigned long ComUint32;
typedef unsigned char ComStd_ReturnType;
#define COM_E_OK 0U
#define COM_E_NOT_OK 1U
#define COM_E_PENDING 2U
#define COM_TRUE 1U
#define COM_FALSE 0U
#ifndef COM_NULL_PTR
#define COM_NULL_PTR 0L
#endif
#ifndef COM_STD_ON
#define COM_STD_ON 1U
#endif
#ifndef COM_STD_OFF
#define COM_STD_OFF 0U
#endif
#ifndef __TYPEDEF__
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef unsigned short MD_STATUS;
#define __TYPEDEF__
#endif
#endif

View File

@ -1,797 +0,0 @@
/************************************************************
| : DCM_DTC.c
| DTC相关服务函数
|
|
|
***********************************************************/
//DCM_DTC.c
#include "BranchTable.h"
#include "Dcm_App_Cfg.h"
#include "Dcm_App.h"
#include "can_drv.h"
//#include "can_task.h"
//#include "eel.h"
//#include "r_fdl_types.h"
#include "Dcm_extern.h"
#include "pfdl_user.h"
const TsDcm_h_DtcGroupType CaDcm_u_DtcTable[DCM_SUPDTC_COUNT]={
{ 0,0xF0,0x06,0x16},
{ 1,0xF0,0x06,0x17},
{ 2,0x91,0x81,0x12},
{ 3,0x91,0x81,0x14},
{ 4,0x91,0x81,0x71},
{ 5,0x91,0x83,0x12},
{ 6,0x91,0x83,0x14},
{ 7,0x91,0x83,0x71},
{ 8,0x91,0x84,0x12},
{ 9,0x91,0x84,0x14},
{10,0x91,0x84,0x71},
{11,0x91,0x86,0x11},
{12,0x91,0x86,0x14},
{13,0xC0,0x73,0x00},
};
DtcStutas_T DtcStutas[DCM_SUPDTC_COUNT]; // DTC 状态数组
static uint16 tDiagStart; //上电复位后网络诊断延迟时间
uint16 tDiagStartVolt; // 电源电压异常恢复后诊断延迟时间
/********************************************************/
void DtcStutasInit(void)
{
uint8 DtcIndex,checksum;
uint8 LastConfirmedDTC[42];
DF_Read_All_DTC(LastConfirmedDTC,GetDataFlashAddress(INDEX_19_BASE),42);
for(DtcIndex=0;DtcIndex<DCM_SUPDTC_COUNT;DtcIndex++)
{
checksum = (LastConfirmedDTC[DtcIndex*3+1]+LastConfirmedDTC[DtcIndex*3])^0xFF + 1;
if(LastConfirmedDTC[DtcIndex*3] != 0xFF && checksum == LastConfirmedDTC[DtcIndex*3+2])
{
DtcStutas[DtcIndex].DtcStutas = LastConfirmedDTC[DtcIndex*3];
if(0!=(LastConfirmedDTC[DtcIndex*3] & ConfirmedDTC)){
LastConfirmedDTC[DtcIndex*3+1]++;
LastConfirmedDTC[DtcIndex*3+2] = (LastConfirmedDTC[DtcIndex*3+1]+LastConfirmedDTC[DtcIndex*3])^0xFF + 1;
if(40<=LastConfirmedDTC[DtcIndex*3+1]){
LastConfirmedDTC[DtcIndex*3] = 0;
LastConfirmedDTC[DtcIndex*3+1] = 0xFF;
LastConfirmedDTC[DtcIndex*3+2] = (LastConfirmedDTC[DtcIndex*3+1]+LastConfirmedDTC[DtcIndex*3])^0xFF + 1;
ClearDtcStutas(DtcIndex);
DtcStutas[DtcIndex].EepWrtEnable = 1;
}
else{
DtcStutas[DtcIndex].EepWrtEnable = 0;
}
}
else{
DtcStutas[DtcIndex].EepWrtEnable = 1;
}
}
else{
DtcStutas[DtcIndex].EepWrtEnable = 1;
}
}
DF_Write_All_DTC(LastConfirmedDTC,GetDataFlashAddress(INDEX_19_BASE),42);
}
void DtcInit(void)
{
tDiagStart = 1500;
tDiagStartVolt = 500;
DtcStutasInit();
}
void DtcDiagConditionChk(void)
{
if(tDiagStart > 0)
tDiagStart --;
if(GetIgnVoltStatus() == 0)
{
if(tDiagStartVolt > 0)
tDiagStartVolt--;
}
else
tDiagStartVolt = 500;
}
static bool1 ChkDiagVolt(void)
{
return (tDiagStartVolt == 0);
}
static bool1 ChkNetDiagCondition(void)
{
return ((tDiagStart == 0)&&(tDiagStartVolt == 0));
}
static uint8 GetLastSnapshotRecordNum(uint8 DtcIndex)
{
uint8 temp,SnapshotRecordNum = 0;
uint32 DtcSnapshotRecord[32];
DF_Read(DtcSnapshotRecord,DtcIndex<<1,128);
for(temp=0;temp<=7;temp++)
{
if(DtcSnapshotRecord[(temp<<2)+3] != 0xFFFFFFFF)
SnapshotRecordNum |= 1<<temp;
}
switch(SnapshotRecordNum)
{
case 1:
case 0xF1:return 0;
case 3:
case 0xF3:return 1;
case 7:
case 0xF7:return 2;
case 15:return 3;
case 31:return 4;
case 63:return 5;
case 127:return 6;
case 255:return 7;
default:return 7;
}
}
#if 0
void GetSnapshotRecord(uint8 * Data)
{
uint16 Temp16;
(void *) Data;
Temp16 = GetModeFeedbackVoltage();
*Data++ = (uint8)(Temp16>>8);
*Data++ = (uint8)Temp16&0xFF;
Temp16 = GetRecFeedbackVoltage();
*Data++ = (uint8)(Temp16>>8);
*Data++ = (uint8)Temp16&0xFF;
Temp16 = EvaSensorFeedbackVoltage();
*Data++ = (uint8)(Temp16>>8);
*Data++ = (uint8)Temp16&0xFF;
Temp16 = GetPtcTmpSnsVolt();
*Data++ = (uint8)(Temp16>>8);
*Data++ = (uint8)Temp16&0xFF;
Temp16 = GetFanFeedBackVolt();
*Data++ = (uint8)(Temp16>>8);
*Data++ = (uint8)Temp16&0xFF;
Temp16 = GetCompSnsVolt();
*Data++ = (uint8)(Temp16>>8);
*Data++ = (uint8)Temp16&0xFF;
}
#endif
static void WriteDtcSnapshot(uint8 DtcIndex)
{
uint8 temp[2];
#if (defined (DTC_ONE_SNAPSHOT) && (DTC_ONE_SNAPSHOT == NO))
uint32 DtcSnapshotRecord[32];
#else
uint32 DtcSnapshotRecord[4];
#endif
DtcStutas[DtcIndex].DtcStutas |= (TestFailed | ConfirmedDTC);
// DtcStutas[DtcIndex].DtcStutas &= ~TestNotCompletedThisOperationCycle; //2017/7/2 11:52:01 spark del
if(DtcStutas[DtcIndex].EepWrtEnable)
{
DtcStutas[DtcIndex].EepWrtEnable = 0;
DF_Read(temp,(DtcIndex+INDEX_19_BASE),3);
temp[0] = DtcStutas[DtcIndex].DtcStutas & ConfirmedDTC;
DF_Write(&temp,(DtcIndex+INDEX_19_BASE),3);
}
}
void ClearDtcStutas(uint8 DtcIndex)
{
// DtcStutas[DtcIndex].EepWrtEnable = 1; //2017/7/4 15:19:34 spark del
// DtcStutas[DtcIndex].DtcStutas &= ~(TestNotCompletedThisOperationCycle | TestFailed); //2017/7/2 11:52:29 del
DtcStutas[DtcIndex].DtcStutas &= ~TestFailed; //2017/7/2 11:52:56 spark add
}
static void CanDTC_AcBusOffDetected(void)
{
// uint8 temp;
// uint32 DtcSnapshotRecord[32];
if(ChkNetDiagCondition() == 0) return;
if(0!=GetCanBusOffErr()) {
WriteDtcSnapshot(AC_BusOff);
}
else{
ClearDtcStutas(AC_BusOff);
}
#if 0
if((BusOffCnt < 10) && (BusOffCnt > 0))
DtcStutas[AC_BusOff].DtcStutas |= TestNotCompletedThisOperationCycle;
else if(BusOffCnt >= 10)
{
if(DtcStutas[AC_BusOff].EepWrtEnable)
{
WriteDtcSnapshot(AC_BusOff);
}
}
else if(BusOffCnt == 0)
{
ClearDtcStutas(AC_BusOff);
}
#endif
}
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
static void PowerVoltageChk(void)
{
static uint8 PowerOverVoltCnt,PowerUderVoltCnt;
if(GetVoltage(KL30_VOLTAGE) > 160)
{
if(PowerOverVoltCnt < 50) /* 50*40ms = 2s */
PowerOverVoltCnt++;
else
WriteDtcSnapshot(AC_OVER_VOLTAGE);
}
else
{
if(PowerOverVoltCnt > 0){
PowerOverVoltCnt--;
if(PowerOverVoltCnt>37){ /* 37*40ms = 1.48s */
PowerOverVoltCnt = 37;
}
}
else{
ClearDtcStutas(AC_OVER_VOLTAGE);
}
}
if(GetVoltage(KL30_VOLTAGE) < 90)
{
if(PowerUderVoltCnt < 50) /* 50*40ms = 2s */
PowerUderVoltCnt++;
else
WriteDtcSnapshot(AC_LOW_VOLTAGE);
}
else
{
if(PowerUderVoltCnt > 0){
PowerUderVoltCnt--;
if(PowerUderVoltCnt>37){ /* 37*40ms = 1.48s */
PowerUderVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_LOW_VOLTAGE);
}
}
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
static void TempMotorFeedbackChk(void)
{
static uint8 TempOverVoltCnt,TempUderVoltCnt;
if(GetVoltage(TEMP_MOTOR) >= 49)
{
if(TempOverVoltCnt < 50) /* 50*40ms = 2s */
TempOverVoltCnt++;
else
WriteDtcSnapshot(AC_TEMP_MOTOR_SHORT_CUT_TO_VCC);
}
else
{
if(TempOverVoltCnt > 0){
TempOverVoltCnt--;
if(TempOverVoltCnt>37){ /* 37*40ms = 1.48s */
TempOverVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_TEMP_MOTOR_SHORT_CUT_TO_VCC);
}
if(GetVoltage(TEMP_MOTOR) <= 1)
{
if(TempUderVoltCnt < 50) /* 50*40ms = 2s */
TempUderVoltCnt++;
else
WriteDtcSnapshot(AC_TEMP_MOTOR_SHORT_CUT_TO_GND);
}
else
{
if(TempUderVoltCnt > 0){
TempUderVoltCnt--;
if(TempUderVoltCnt>37){ /* 37*40ms = 1.48s */
TempUderVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_TEMP_MOTOR_SHORT_CUT_TO_GND);
}
}
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
static void ModeMotorFeedbackChk(void)
{
static uint8 ModeOverVoltCnt,ModeUderVoltCnt;
if(GetVoltage(MODE_MOTOR) >= 49)
{
if(ModeOverVoltCnt < 50) /* 50*40ms = 2s */
ModeOverVoltCnt++;
else
WriteDtcSnapshot(AC_MODE_MOTOR_SHORT_CUT_TO_VCC);
}
else
{
if(ModeOverVoltCnt > 0){
ModeOverVoltCnt--;
if(ModeOverVoltCnt>37){ /* 37*40ms = 1.48s */
ModeOverVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_MODE_MOTOR_SHORT_CUT_TO_VCC);
}
if(GetVoltage(MODE_MOTOR) <= 1)
{
if(ModeUderVoltCnt < 50) /* 50*40ms = 2s */
ModeUderVoltCnt++;
else
WriteDtcSnapshot(AC_MODE_MOTOR_SHORT_CUT_TO_GND);
}
else
{
if(ModeUderVoltCnt > 0){
ModeUderVoltCnt--;
if(ModeUderVoltCnt>37){ /* 37*40ms = 1.48s */
ModeUderVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_MODE_MOTOR_SHORT_CUT_TO_GND);
}
}
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
static void RecMotorFeedbackChk(void)
{
static uint8 RecOverVoltCnt,RecUderVoltCnt;
if(GetVoltage(REC_MOTOR) >= 49)
{
if(RecOverVoltCnt < 50) /* 50*40ms = 2s */
RecOverVoltCnt++;
else
WriteDtcSnapshot(AC_REC_MOTOR_SHORT_CUT_TO_VCC);
}
else
{
if(RecOverVoltCnt > 0){
RecOverVoltCnt--;
if(RecOverVoltCnt>37){ /* 37*40ms = 1.48s */
RecOverVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_REC_MOTOR_SHORT_CUT_TO_VCC);
}
if(GetVoltage(REC_MOTOR) <= 1)
{
if(RecUderVoltCnt < 50) /* 50*40ms = 2s */
RecUderVoltCnt++;
else
WriteDtcSnapshot(AC_REC_MOTOR_SHORT_CUT_TO_GND);
}
else
{
if(RecUderVoltCnt > 0){
RecUderVoltCnt--;
if(RecUderVoltCnt>37){ /* 37*40ms = 1.48s */
RecUderVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_REC_MOTOR_SHORT_CUT_TO_GND);
}
}
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
static void EvaSensorChk(void)
{
static uint8 EvaOverVoltCnt,EvaUderVoltCnt;
if(GetVoltage(EVA_SENSOR) >= 49)
{
if(EvaOverVoltCnt < 50) /* 50*40ms = 2s */
EvaOverVoltCnt++;
else
WriteDtcSnapshot(AC_EVA_SENSOR_SHORT_CUT_TO_VCC);
}
else
{
if(EvaOverVoltCnt > 0){
EvaOverVoltCnt--;
if(EvaOverVoltCnt>37){ /* 37*40ms = 1.48s */
EvaOverVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_EVA_SENSOR_SHORT_CUT_TO_VCC);
}
if(GetVoltage(EVA_SENSOR) <= 1)
{
if(EvaUderVoltCnt < 50) /* 50*40ms = 2s */
EvaUderVoltCnt++;
else
WriteDtcSnapshot(AC_EVA_SENSOR_SHORT_CUT_TO_GND);
}
else
{
if(EvaUderVoltCnt > 0){
EvaUderVoltCnt--;
if(EvaUderVoltCnt>37){ /* 37*40ms = 1.48s */
EvaUderVoltCnt = 37;
}
}
else
ClearDtcStutas(AC_EVA_SENSOR_SHORT_CUT_TO_GND);
}
}
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
/**************************************************************************************/
static void MotorLockChk(void)
{
if(GetMotorLockStatus(TEMP_MOTOR) != 0)
{
WriteDtcSnapshot(AC_TEMP_MOTOR_LOCK);
}
else
{
ClearDtcStutas(AC_TEMP_MOTOR_LOCK);
}
if(GetMotorLockStatus(MODE_MOTOR) != 0)
{
WriteDtcSnapshot(AC_MODE_MOTOR_LOCK);
}
else
{
ClearDtcStutas(AC_MODE_MOTOR_LOCK);
}
if(GetMotorLockStatus(REC_MOTOR) != 0)
{
WriteDtcSnapshot(AC_REC_MOTOR_LOCK);
}
else
{
ClearDtcStutas(AC_REC_MOTOR_LOCK);
}
}
static void CanDTC_CycChk(void)
{
PowerVoltageChk();
TempMotorFeedbackChk();
ModeMotorFeedbackChk();
RecMotorFeedbackChk();
EvaSensorChk();
}
extern uint8 GetNormalMsgSts(void);
void CanDTC_Task(void)
{
static uint8 DtcTestCycleTim;
//if(ChkDiagVolt()==0) return;
CanDTC_AcBusOffDetected();
if(GetNormalMsgSts() & 0x02)
{
//CanDTC_CanCommunicationLostDetected(HMI_ControlCommand_ID);
//CanDTC_CanCommunicationLostDetected(VCU_DisplayInfo_ID);
//CanDTC_CanCommunicationLostDetected(COMP_Information_ID);
//CanDTC_CompErrChk();
//CanDTC_MotorRunTimeChk();
MotorLockChk();
if(DtcTestCycleTim < DTC_TEST_CYCLE_TIM)
{
DtcTestCycleTim++;
}
else{
DtcTestCycleTim = 0;
CanDTC_CycChk();
}
}
}
uint8 GetDtcStutas(uint8 DtcIndex)
{
return DtcStutas[DtcIndex].DtcStutas;
}
uint8 GetDtcSnapshotRecord(uint8 Index,uint8 * Buf,uint8 * Length ,uint8 DtcSnapshotRecordNum)
{
uint8 SnapshotRecordBuf[16];
DF_Read(SnapshotRecordBuf,Index,16);
if((DtcSnapshotRecordNum >= 1)&&(DtcSnapshotRecordNum <=6))
{
*Buf++ = DtcSnapshotRecordNum;
*Buf++ = 1;
*Buf++ = 0x0A;
*Buf++ = DtcSnapshotRecordNum - 1;
*Buf++ = SnapshotRecordBuf[(DtcSnapshotRecordNum - 1)<<1];
*Buf++ = SnapshotRecordBuf[((DtcSnapshotRecordNum - 1)<<1)+1];
*Length += 6;
}
else if(DtcSnapshotRecordNum == 0xFF)
{
for(DtcSnapshotRecordNum = 1;DtcSnapshotRecordNum<=6;DtcSnapshotRecordNum++)
{
*Buf++ = DtcSnapshotRecordNum;
*Buf++ = 1;
*Buf++ = 0x0A;
*Buf++ = DtcSnapshotRecordNum - 1;
*Buf++ = SnapshotRecordBuf[(DtcSnapshotRecordNum - 1)<<1];
*Buf++ = SnapshotRecordBuf[((DtcSnapshotRecordNum - 1)<<1)+1];
*Length += 6;
}
}
else
return DCM_NORESULT;
return 0;
}
// 19 01
uint8 MngDcm_ReportNumberOfDTCByStatusMask(void)
{
uint8 LaDcm_u_TempBuffer[6];
TeDcm_h_ResultType LeDcm_u_Result;
uint8 DtcCnt,Index;
VeDcm_h_RqustInfo.StateMask = VeDcm_P_DataAddress[2];
if(VeDcm_h_RqustInfo.StateMask & DTC_STATUS_AVAILABILITY_MASK)
{
LaDcm_u_TempBuffer[0] = VeDcm_h_RqustInfo.Sid + 0x40;
LaDcm_u_TempBuffer[1] = VeDcm_h_RqustInfo.Sub;
LaDcm_u_TempBuffer[2] = DTC_STATUS_AVAILABILITY_MASK;
for(Index=0;Index<DCM_SUPDTC_COUNT;Index++)
{
if(GetDtcStutas(Index) & VeDcm_h_RqustInfo.StateMask)
DtcCnt++;
}
LaDcm_u_TempBuffer[3] = ISO_14229_1_DTC_FORMAT;
LaDcm_u_TempBuffer[4] = 0;
LaDcm_u_TempBuffer[5] = DtcCnt;
SetCanTp_TxBuffer(6U,LaDcm_u_TempBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultPosRsp;
}
else
{
/*设置NRC31*/
MngDcm_PrepareNegRsp(VeDcm_h_RqustInfo.Sid,CaDcm_u_NRCData[DCM_NRC31]); /*整理负响应数据*/
SetCanTp_TxBuffer(3U,VaDcm_u_NegRspTxBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultNegRsp;
}
return LeDcm_u_Result;
}
// 19 02
uint8 MngDcm_ReportDTCByStatusMask(void)
{
uint8 LaDcm_u_TempBuffer[DCM_TXBUFFER_LENGTH];
TeDcm_h_ResultType LeDcm_u_Result;
uint8 DtcIndex;
uint8 DtcReporLength;
VeDcm_h_RqustInfo.StateMask = VeDcm_P_DataAddress[2];
if(VeDcm_h_RqustInfo.StateMask & DTC_STATUS_AVAILABILITY_MASK)
{
LaDcm_u_TempBuffer[0] = VeDcm_h_RqustInfo.Sid + 0x40;
LaDcm_u_TempBuffer[1] = VeDcm_h_RqustInfo.Sub;
LaDcm_u_TempBuffer[2] = DTC_STATUS_AVAILABILITY_MASK;
DtcReporLength = 3;
for(DtcIndex=0;DtcIndex<DCM_SUPDTC_COUNT;DtcIndex++)
{
if(GetDtcStutas(DtcIndex) & VeDcm_h_RqustInfo.StateMask)
{
LaDcm_u_TempBuffer[DtcReporLength++] = CaDcm_u_DtcTable[DtcIndex].DtcHigh;
LaDcm_u_TempBuffer[DtcReporLength++] = CaDcm_u_DtcTable[DtcIndex].DtcMiddle;
LaDcm_u_TempBuffer[DtcReporLength++] = CaDcm_u_DtcTable[DtcIndex].DtcLow;
LaDcm_u_TempBuffer[DtcReporLength++] = GetDtcStutas(DtcIndex);
}
}
SetCanTp_TxBuffer(DtcReporLength,LaDcm_u_TempBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultPosRsp;
}
else
{
/*设置NRC31*/
MngDcm_PrepareNegRsp(VeDcm_h_RqustInfo.Sid,CaDcm_u_NRCData[DCM_NRC31]); /*整理负响应数据*/
SetCanTp_TxBuffer(3U,VaDcm_u_NegRspTxBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultNegRsp;
}
return LeDcm_u_Result;
}
#if 0
// 19 04
uint8 MngDcm_ReportDTCSnapshotRecordByDTCNumber(void)
{
uint8 LaDcm_u_TempBuffer[DCM_TXBUFFER_LENGTH];
TeDcm_h_ResultType LeDcm_u_Result;
uint8 DtcIndex;
uint8 DtcSnapshotRecordNum;
uint8 DtcReporLength = 0;
DtcSnapshotRecordNum = VeDcm_P_DataAddress[5];
for(DtcIndex=0;DtcIndex<DCM_SUPDTC_COUNT;DtcIndex++)
{
if((CaDcm_u_DtcTable[DtcIndex].DtcHigh == VeDcm_P_DataAddress[2]) && (CaDcm_u_DtcTable[DtcIndex].DtcMiddle == VeDcm_P_DataAddress[3]) && (CaDcm_u_DtcTable[DtcIndex].DtcLow == VeDcm_P_DataAddress[4]))
{
LaDcm_u_TempBuffer[0] = VeDcm_h_RqustInfo.Sid + 0x40;
LaDcm_u_TempBuffer[1] = VeDcm_h_RqustInfo.Sub;
LaDcm_u_TempBuffer[2] = VeDcm_P_DataAddress[2];
LaDcm_u_TempBuffer[3] = VeDcm_P_DataAddress[3];
LaDcm_u_TempBuffer[4] = VeDcm_P_DataAddress[4];
LaDcm_u_TempBuffer[5] = GetDtcStutas(DtcIndex);
DtcReporLength = 6;
if(GetDtcSnapshotRecord(DtcIndex,LaDcm_u_TempBuffer+6,&DtcReporLength,DtcSnapshotRecordNum) != DCM_NORESULT)
{
SetCanTp_TxBuffer(DtcReporLength,LaDcm_u_TempBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultPosRsp;
}
else
{
/*设置NRC31*/
MngDcm_PrepareNegRsp(VeDcm_h_RqustInfo.Sid,CaDcm_u_NRCData[DCM_NRC31]); /*整理负响应数据*/
SetCanTp_TxBuffer(3U,VaDcm_u_NegRspTxBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultNegRsp;
}
break;
}
}
if((DtcIndex == DCM_SUPDTC_COUNT) && (DtcReporLength == 0))
{
/*设置NRC31*/
MngDcm_PrepareNegRsp(VeDcm_h_RqustInfo.Sid,CaDcm_u_NRCData[DCM_NRC31]); /*整理负响应数据*/
SetCanTp_TxBuffer(3U,VaDcm_u_NegRspTxBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultNegRsp;
}
return LeDcm_u_Result;
}
// 19 06
uint8 MngDcm_ReportDTCExtendedDataRecordByDTCNumber(void)
{
uint8 LaDcm_u_TempBuffer[DCM_TXBUFFER_LENGTH];
TeDcm_h_ResultType LeDcm_u_Result;
uint8 DtcIndex;
uint8 DtcReporLength;
for(DtcIndex=0;DtcIndex<DCM_SUPDTC_COUNT;DtcIndex++)
{
if((CaDcm_u_DtcTable[DtcIndex].DtcHigh == VeDcm_P_DataAddress[2]) && (CaDcm_u_DtcTable[DtcIndex].DtcMiddle == VeDcm_P_DataAddress[3]) && (CaDcm_u_DtcTable[DtcIndex].DtcLow == VeDcm_P_DataAddress[4]))
{
LaDcm_u_TempBuffer[0] = VeDcm_h_RqustInfo.Sid + 0x40;
LaDcm_u_TempBuffer[1] = VeDcm_h_RqustInfo.Sub;
LaDcm_u_TempBuffer[2] = VeDcm_P_DataAddress[3];
LaDcm_u_TempBuffer[3] = VeDcm_P_DataAddress[4];
LaDcm_u_TempBuffer[4] = VeDcm_P_DataAddress[5];
LaDcm_u_TempBuffer[5] = GetDtcStutas(DtcIndex);
LaDcm_u_TempBuffer[6] = 1;
LaDcm_u_TempBuffer[7] = 0xFF;
LaDcm_u_TempBuffer[8] = 0xFF;
LaDcm_u_TempBuffer[9] = 0xFF;
LaDcm_u_TempBuffer[10] = 0xFF;
LaDcm_u_TempBuffer[11] = 2;
LaDcm_u_TempBuffer[12] = 0xFF;
LaDcm_u_TempBuffer[13] = 0xFF;
LaDcm_u_TempBuffer[14] = 0xFF;
LaDcm_u_TempBuffer[15] = 0xFF;
LaDcm_u_TempBuffer[16] = 3;
LaDcm_u_TempBuffer[17] = 0xFF;
LaDcm_u_TempBuffer[18] = 0xFF;
LaDcm_u_TempBuffer[19] = 0xFF;
LaDcm_u_TempBuffer[20] = 0xFF;
LaDcm_u_TempBuffer[21] = 4;
LaDcm_u_TempBuffer[22] = 0xFF;
LaDcm_u_TempBuffer[23] = 0xFF;
LaDcm_u_TempBuffer[24] = 0xFF;
LaDcm_u_TempBuffer[25] = 0xFF;
SetCanTp_TxBuffer(25,LaDcm_u_TempBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultPosRsp;
break;
}
}
return LeDcm_u_Result;
}
#endif
//19 0A
uint8 MngDcm_ReportSupportedDTC(void)
{
uint8 LaDcm_u_TempBuffer[DCM_TXBUFFER_LENGTH];
TeDcm_h_ResultType LeDcm_u_Result;
uint8 DtcIndex;
uint8 DtcReporLength;
LaDcm_u_TempBuffer[0] = VeDcm_h_RqustInfo.Sid + 0x40;
LaDcm_u_TempBuffer[1] = VeDcm_h_RqustInfo.Sub;
LaDcm_u_TempBuffer[2] = DTC_STATUS_AVAILABILITY_MASK;
DtcReporLength = 3;
for(DtcIndex=0;DtcIndex<DCM_SUPDTC_COUNT;DtcIndex++)
{
LaDcm_u_TempBuffer[DtcReporLength++] = CaDcm_u_DtcTable[DtcIndex].DtcHigh;
LaDcm_u_TempBuffer[DtcReporLength++] = CaDcm_u_DtcTable[DtcIndex].DtcMiddle;
LaDcm_u_TempBuffer[DtcReporLength++] = CaDcm_u_DtcTable[DtcIndex].DtcLow;
LaDcm_u_TempBuffer[DtcReporLength++] = DTC_STATUS_AVAILABILITY_MASK;
}
SetCanTp_TxBuffer(DtcReporLength,LaDcm_u_TempBuffer); /*调用接口发送响应数据*/
LeDcm_u_Result = CeDcm_e_ResultPosRsp;
return LeDcm_u_Result;
}
bool1 MngDcm_CleanDtc(void)
{
uint8 DtcIndex;
uint8 temp[42]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
uint8 t_we = 0;
for(DtcIndex=0;DtcIndex<DCM_SUPDTC_COUNT;DtcIndex++)
{
DtcStutas[DtcIndex].DtcStutas = 0;
}
if(0!=DF_Write_All_DTC(&temp,GetDataFlashAddress(INDEX_19_BASE),42)){
t_we++;
}
if(0 == t_we)
return _ACTIVE;
else
return _FALSE;
}

View File

@ -1,128 +0,0 @@
//DCM_DTC.h
#ifndef DCM_DTC_H
#define DCM_DTC_H
#include "_Types.h"
#define DCM_19SUPDTCEXTDATARECORD_COUNT (4U)
/* 19 06支持的DTCExtDataRecord 参数个数 */
#define DCM_SUPDTC_COUNT ( 14U )
/* 产品支持的DTC个数 */
#define DTC_TEST_CYCLE_TIM 40U // 40mS一个周期
#define ISO_15031_6_DTC_FORMAT 0U
#define ISO_14229_1_DTC_FORMAT 1U
#define DTC_STATUS_AVAILABILITY_MASK 0x09U
typedef uint8 (*ReportDTCExtDataFun)(uint8* LeDemDtcNum,uint8 LeDemParameter,uint8* LeDemDataRecord);
/*19 06 服务支持的 DTCExtDataRecordNumber 列表结构体 */
typedef struct
{
uint8 DTCExtDataRecordNumber; /* 扩展数据number */
ReportDTCExtDataFun Function; /* 扩展数据number 对应函数的处理函数 */
}DTCExtDataRecordType;
typedef struct
{
uint8 DtcIndex;
uint8 DtcHigh; /*DTC 高字节*/
uint8 DtcMiddle; /*DTC 中间字节*/
uint8 DtcLow; /*DTC 低字节*/
}TsDcm_h_DtcGroupType;
typedef enum
{
TestFailed = 0x01,
TestFailedThisOperationCycle = 0x02,
PendingDTC = 0x04,
ConfirmedDTC = 0x08,
TestNotCompletedSinceLastClea = 0x10,
TestFailedSinceLastClear = 0x20,
TestNotCompletedThisOperationCycle = 0x40,
WarningIndicatorRequested =0x80,
}StatusOfDtc_T;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
extern const TsDcm_h_DtcGroupType CaDcm_u_DtcTable[DCM_SUPDTC_COUNT];
extern const DTCExtDataRecordType CaDcm_h_19DTCExtDataRecordTable[DCM_19SUPDTCEXTDATARECORD_COUNT];
typedef struct{
uint8 DtcStutas;
bool1 EepWrtEnable;
}DtcStutas_T;
extern DtcStutas_T DtcStutas[DCM_SUPDTC_COUNT];
#if 0
#define AC_BusOff 0
#define AC_CommunicationLostWithHMI 1
#define AC_CommunicationLostWithVCU 2
#define AC_CommunicationLostWithComp 3
#define AC_PTC_PressureSensorShortCircuit 4
#define AC_PTC_PressureSensorOpenCircuit 5
#define AC_BlowermotorShortCircuit 6
#define AC_BlowermotorOpenCircuit 7
#define AC_PressureSensorShortCircuit 8
#define AC_PressureSensorOpenCircuit 9
#define AC_CoolingPressureTooHight 10
#define AC_CoolingPressureTooLow 11
#define AC_COMP_InternalVoltageFault 12
#define AC_COMP_UnderVoltageFault 13
#define AC_COMP_OverVoltageFault 14
#define AC_COMP_OverCurrentFault 15
#define AC_COMP_TemperatureFault 16
#define AC_COMP_BusOff 17
#define AC_COMP_LossCommunicationWithAC 18
#define AC_EvaporatorTemperatureSensorOpenCircuit 19
#define AC_EvaporatorTemperatureSensorShortCircuit 20
#define AC_ServoMotorShortCircuit 21
#define AC_ServoMotorPositionFault 22
#define AC_LoopMotorShortCircuit 23
#define AC_LoopMotorPositionFault 24
#endif
#define AC_LOW_VOLTAGE 0
#define AC_OVER_VOLTAGE 1
#define AC_TEMP_MOTOR_SHORT_CUT_TO_VCC 2
#define AC_TEMP_MOTOR_SHORT_CUT_TO_GND 3
#define AC_TEMP_MOTOR_LOCK 4
#define AC_MODE_MOTOR_SHORT_CUT_TO_VCC 5
#define AC_MODE_MOTOR_SHORT_CUT_TO_GND 6
#define AC_MODE_MOTOR_LOCK 7
#define AC_REC_MOTOR_SHORT_CUT_TO_VCC 8
#define AC_REC_MOTOR_SHORT_CUT_TO_GND 9
#define AC_REC_MOTOR_LOCK 10
#define AC_EVA_SENSOR_SHORT_CUT_TO_VCC 11
#define AC_EVA_SENSOR_SHORT_CUT_TO_GND 12
#define AC_BusOff 13
extern uint8_t BusOffCnt ;
extern void CanDTC_Task(void);
extern uint8 MngDcm_ReportNumberOfDTCByStatusMask(void);
extern uint8 MngDcm_ReportDTCByStatusMask(void);
//extern uint8 MngDcm_ReportDTCSnapshotRecordByDTCNumber(void);
//extern uint8 MngDcm_ReportDTCExtendedDataRecordByDTCNumber(void);
extern uint8 MngDcm_ReportSupportedDTC(void);
extern bool1 MngDcm_CleanDtc(void);
extern void DtcInit(void);
extern void DtcStutasInit(void);
extern void DtcDiagConditionChk(void);
void ClearDtcStutas(uint8 DtcIndex);
#endif

View File

@ -1,37 +0,0 @@
/******************************************************************************/
#ifndef DCM_H_
#define DCM_H_
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "Dcm_Cfg.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
//extern TsDcm_h_2APeriodicDidServe PeriodicDidServe[DCM_PERIODIC_DATA_COUNT];
//extern const TsDcm_h_DidCheckType CaDcm_h_2AReadDidCheckInfoTable[DCM_PERIODIC_DATA_COUNT];
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
extern void MngDcm_MainFunction(void);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,241 +0,0 @@
#ifndef DCM_APP_H
#define DCM_APP_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "Dcm_App_Cfg.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
#define SetMcu_SoftReset() do{WDTE = 0x00;}while(1)
#define DCM_PHYSICAL_ADDRESS 0x01 /* 宏定寻址方式 */
#define DCM_FUNCTIONAL_ADDRESS 0x02
#define DCM_DEFAULT_SESSION 0x01 /* 默认模式 */
#define DCM_PROGRAMME_SESSION 0x02 /* 编程模式 */
#define DCM_EXTEND_SESSION 0x04 /* 扩展模式 */
#define DCM_DIAGNOSTIC_SESSION_DEFAULT DCM_DEFAULT_SESSION /* 上电默认诊断会话模式 */
#define DCM_SECURITYACCESS_L2_UNLOCK 0x07 /*解锁状态*/
#define DCM_SECURITYACCESS_L1_UNLOCK 0x06 /*L1解锁状态*/
#define DCM_SECURITYACCESS_DEFAULT 0x04 /*默认安全状态状态*/
#define DCM_SECURITY_LEVEL_DEFAULT 0x07
#define DCM_SECURITYACCESS_LEVEL_L1 0x03
#define DCM_SECURITYACCESS_LEVEL_L2 0x01
#define DCM_SECURITYACCESS_LEVEL_L11 0x03
#define DCM_SECURITYACCESS_LEVEL_L12 0x01
#define DCM_19SUPMASK 0x09 /*19服务的有效掩码*/
#define DCM_15031_6_DTCFORMAT 0x00 /*DTC格式*/
#define DCM_DTCSET_ENABLE 1U /*DTC设置使能*/
#define DCM_DTCSET_DISENABLE 0U /*DTC设置关闭*/
#define DCM_MSGTXRX_ENABLE 1U /*报文收发状态 使能*/
#define DCM_MSGTXRX_DISENABLE 0U /*报文收发状态 关闭*/
#define DCM_SASERVERSTS_DEFAULT 0U /*27服务状态机 默认状态 初始状态*/
#define DCM_SASERVERSTS_REQUESTKEY (0x80)//1U /*27服务状态机 已请求种子*/
#define DCM_SASERVERSTS_UNLOCK 2U /*27服务状态机 已解锁*/
#define DCM_SASERVERSTS_ERROR 4U /*27服务状态机 密钥错误延时*/
#define DCM_S3SEVERTIMER_STOP 0U /*S3ServerTime 计时停止*/
#define DCM_S3SEVERTIMER_CONTINUE 1U /*S3ServerTime 计时继续*/
#define DCM_DTCDATA_MAXLENGTH 36 /*DTC列表最大数据量*/
#define DCM_TXBUFFER_LENGTH 105U /*发送buffer的长度*/
#define DCM_SASERVER_KEYLENGTH 4U /*密钥长度*/
#define DCM_SASERVER_KEYERRORCOUNT 3U /*允许密钥错误次数*/
#define DCM_RIDRESULT_SUCCESS 0x04 /*历程处理成功*/
#define DCM_RIDRESULT_FAILURE 0x05 /*历程处理失败*/
#define DCM_RIDRUNSTS_FINISH 0x01
#define DCM_RIDRUNSTS_IDLE 0x00
#define DCM_READDID_MAXNUMBER 5U /*22 一次性读取的DID 最大个数*/
#define DCM_WRITEDATA_MAXLENGTH 20U /*2E服务写入数据最大长度*/
#define DCM_SASERVERSTS_ERRORDELAY_COUNT 10000U /*密钥错误延时*/
#define DCM_SASERVERSTS_ERRORDELAY_COUNT_DEFAULT 10000U /*密钥错误延时 上电默认值*/
#define DCM_S3SEVERTIMEOUT 5000U /*S3ServerTime计时超时计数量标定*/
#define DCM_DATAFOMATLDENTIFER 0x00 /*34 服务参数 数据格式*/
#define DCM_ADDRESSANDLENGTHFOMATLDENTIFER 0x44 /*34 服务参数 地址和数据长度格式*/
#define DCM_DOWNLOAD_MINADDRESS 0x00000000 /*34 服务参数 最小地址*/
#define DCM_DOWNLOAD_MAXADDRESS 0xFFFFFFFF /*34 服务参数 最大地址*/
#define DCM_DOWNLOAD_MAXDATALENGTH 0xFFF /*34 服务参数 最长数据长度*/
#define DCM_LENGTHFOMATLDENTIFER 0x20 /*34 服务参数 正响应里的 数据长度格式*/
#define DCM_DOWNLOAD_RECEIVEDATALENGTH 0x0400 /*36 服务 接收数据缓存数组长度*/
/***************************************************/
#define DCM_DS_FLASHDOWNLOAD_COMPLETE 0x02
#define DCM_DS_FLASHCRC_COMPLETE 0x03
#define DCM_DS_ERASE_COMPLETE 0x04
#define DCM_DS_APPDOWNLOAD_REQUEST 0x05
#define DCM_DS_APPCRC_COMPLETE 0x06
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/*@结构类型typedef定义*/
/*34 36 37 数据下载相关服务处理状态*/
typedef enum
{
CeDcm_e_DownLoadRelax =0,
CeDcm_e_DownLoadRequested,
CeDcm_e_DownLoadDuringTransmit,
CeDcm_e_DownLoadTransmited
}TeDcm_e_DownLoadStsType;
/*例程控制状态*/
typedef enum
{
CeDcm_e_RidStart =0,
CeDcm_e_RidStop,
CeDcm_e_RidGetResult
}TeDcm_e_RidStsType;
typedef enum
{
Rid_Idle,
Rid_Finish
}RidRunSts_T;
/*TP数据分拣出的信息 完整信息*/
typedef struct
{
uint16 DL; /*有效字节长度*/
uint8 Sid; /*SID*/
uint8 RequstSty; /*请求方式*/
uint8 Sub; /*子服务*/
uint8 DtcGroup[3]; /*DTC组*/
uint8 StateMask; /*请求的 状态掩码*/
uint8 Key[DCM_SASERVER_KEYLENGTH]; /*密钥信息*/
uint8 CommType; /*通讯类型*/
uint8 Did[DCM_READDID_MAXNUMBER*2]; /*具体DID*/
uint8 DidCount; /*DID个数*/
uint16 Rid; /*RID*/
uint8 WriteData[DCM_WRITEDATA_MAXLENGTH]; /*写入的数据*/
}TsDcm_h_RquestInfo;
typedef enum{
DCM_RESET_NOTREADY,
DCM_RESET_READY
}DcmReset_T;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
/*调试暂用*/
extern uint8 TempTP[];
/*@全局变量声明extern*/
extern uint8* VeDcm_P_DataAddress; /*TP层数据地址*/
extern uint8 VeDcm_u_DL; /*TP层数据长度*/
extern uint8 VeDcm_u_RequstSty; /*TP层数据请求方式*/
extern uint8 VaDcm_u_NegRspTxBuffer[3];
extern TsDcm_h_RquestInfo VeDcm_h_RqustInfo;
extern uint16 VeDcm_w_S3ServerTime; /*S3ServerTime计数*/
extern uint8 VeDcm_u_S3ServerTimeSts;
extern uint8 VeDcm_u_DiagnosticSession; /*诊断会话模式*/
extern uint8 VeDcm_u_SecurityAccessState; /*安全权限状态*/
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
/*@接口函数声明extern*/
extern uint8 MngDcm_CollectRequstInfo(void);
extern TeDcm_h_ResultType MngDcm_DefaultSessionDeal(void);
extern TeDcm_h_ResultType MngDcm_ProgramSessionDeal(void);
extern TeDcm_h_ResultType MngDcm_ExtendedSessionDeal(void);
extern TeDcm_h_ResultType MngDcm_SoftResetDeal(void);
extern TeDcm_h_ResultType MngDcm_CleanDTC(uint32 Group);
extern TeDcm_h_ResultType MngDcm_DynamicaDefineNewDid(void);
extern TeDcm_h_ResultType MngDcm_ClearDynamicaDid(void);
extern TeDcm_h_ResultType MngDcm_RequestSeekDeal(uint8 SecurityLevel);
extern TeDcm_h_ResultType MngDcm_KeyCkeckDeal(uint8 dummy);
extern TeDcm_h_ResultType MngDcm_CtrlCommunication(uint8 CommunicationType);
extern TeDcm_h_ResultType MngDcm_DisenableCommunication(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF02Start(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF02Stop(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF02Result(void);
extern TeDcm_h_ResultType MngDcm_Routine0202Start(void) ;
extern TeDcm_h_ResultType MngDcm_Routine0202Stop(void) ;
extern TeDcm_h_ResultType MngDcm_Routine0202Result(void);
extern TeDcm_h_ResultType MngDcm_TesterPresentDeal(void);
extern TeDcm_h_ResultType MngDcm_DTCSettingEnable(void);
extern TeDcm_h_ResultType MngDcm_DTCSettingDisenable(void);
extern void MngDcm_ChangeToDefaltSession(void);
extern void MngDcmS3ServerCountCutDown(void);
extern void MngDcmKeyErrorDelayCountCutDown(void);
extern void MngDcm_PrepareNegRsp(uint8 Sid,uint8 Nrc);
extern void MngDcm_DataMoveDeal(uint8* TargetAddress,uint8 TargetPost,uint8* SourceAddress,uint8 SourcePost,uint8 DataLength);
extern TeDcm_h_ResultType MngDcm_RequestDownloadService(void);
extern TeDcm_h_ResultType MngDcm_TransmitDataService(void);
extern TeDcm_h_ResultType MngDcm_TransmitExitService(void);
extern void InitDcm_Parameter (void);
extern uint16 MngDcm_GetS3serverTime(void);
extern uint8 MngDcm_GetS3serverTimeSts(void);
extern uint8 MngDcm_GetDiagnosticSession(void);
extern uint8 MngDcm_GetSecurityAccessSts(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF00Start(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF01Start(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF00Stop(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF01Stop(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF00Result(void);
extern TeDcm_h_ResultType MngDcm_RoutineFF01Result(void);
extern uint8 GetDtcEnable(void);
extern void MngDcm_ResetS3serverTime(void);
extern void BootProgramSessionDeal(void);
extern void BootDefaultSessionDeal(void);
extern void resetS3Server(void);
#endif

View File

@ -1,20 +0,0 @@
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "Dcm_App_Cfg.h"
/******************************************************************************
* Description: : Global Variable Definition Section
******************************************************************************/
/******************************************************************************
* Description: : Static Variable Definition Section
******************************************************************************/

View File

@ -1,61 +0,0 @@
#ifndef DCM_APP_CFG_H
#define DCM_APP_CFG_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "_Types.h"
#include "Dcm_DID.h"
#include "CanTp.h"
//#include "FCC_Programing.h"
//#include "eel.h"
#include "Dcm_Key.h"
#include "DCM_DTC.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
//#define DCM_19SUPDTCEXTDATARECORD_COUNT (4U)
/* 19 06支持的DTCExtDataRecord 参数个数 */
//#define DCM_SUPDTC_COUNT ( 15U )
/* 产品支持的DTC个数 */
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/*结构类型typedef定义*/
/*响应类型*/
typedef enum
{
CeDcm_e_ResultNegRsp =0,
CeDcm_e_ResultPosRsp,
CeDcm_e_ResultNoRsp
}TeDcm_h_ResultType;
//typedef uint8 (*ReportDTCExtDataFun)(uint8* LeDemDtcNum,uint8 LeDemParameter,uint8* LeDemDataRecord);
/*19 06 服务支持的 DTCExtDataRecordNumber 列表结构体*/
//typedef struct
//{
// uint8 DTCExtDataRecordNumber; /*扩展数据number*/
// ReportDTCExtDataFun Function; /*扩展数据number 对应函数的处理函数*/
//}DTCExtDataRecordType;
//
//typedef struct
//{
// uint8 DtcHigh; /*DTC 高字节*/
// uint8 DtcMiddle; /*DTC 中间字节*/
// uint8 DtcLow; /*DTC 低字节*/
//}TsDcm_h_DtcGroupType;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
//extern const TsDcm_h_DtcGroupType CaDcm_u_DtcTable[DCM_SUPDTC_COUNT];
//extern const DTCExtDataRecordType CaDcm_h_19DTCExtDataRecordTable[DCM_19SUPDTCEXTDATARECORD_COUNT];
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,205 +0,0 @@
/*@ 处根据实际情况填写相关信息,将@字符以及这条提示语句去掉 */
#ifndef DCM_CFG_H
#define DCM_CFG_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include"Dcm_App.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
#define YES 1
#define NO 0
#define DID_RECORD ( NO ) /* 测试用记录DID请求列表 */
#define SID_RECORD ( NO ) /* 测试用记录SID请求列表 */
#define DAMING_CAN_BOOT ( NO ) /*大明只有CAN升级协议 */
#define DCM_SUPPORTSID_COUNT 16U /*支持的SID数目*/
#define DCM_10SUB_COUNT 3U /*10服务子服务个数*/
#define DCM_11SUB_COUNT 2U /*11服务子服务个数*/
#define DCM_19SUB_COUNT 3U /*19服务子服务个数*/
#define DCM_27SUB_COUNT 4U /*27服务子服务个数*/
#define DCM_28SUB_COUNT 3U /*28服务子服务个数*/
#define DCM_31RID_COUNT 4U /*31服务子服务个数*/
#define DCM_RIDFF02_SUB_COUNT 3U /*31 FF02 支持的子服务个数*/
#define DCM_RIDFF00_SUB_COUNT 3U /*31 FF00 支持的子服务个数*/
#define DCM_RIDFF01_SUB_COUNT 3U /*31 FF01 支持的子服务个数*/
#define DCM_RIDF001_SUB_COUNT 3U /* 31 F001 支持的子服务个数 */
#define DCM_3ESUB_COUNT 1U /*3E服务子服务个数*/
#define DCM_85SUB_COUNT 2U /*85服务子服务个数*/
#define DCM_2CSUB_COUNT 2U /*2C服务子服务个数*/
#define DCM_14DTCGROUP_COUNT 3U /*14服务支持的DTC组个数*/
#if (defined (DAMING_CAN_BOOT) && (DAMING_CAN_BOOT == YES))
#define DCM_READ_DIDSUP_COUNT 19U /*22 服务支持的DID 个数 */
#else
#define DCM_READ_DIDSUP_COUNT 14U /* 22 服务支持的DID 个数 */
#endif
#define DCM_IO_DIDSUP_COUNT 5U /*2F 服务支持的DID 个数*/
#define DCM_PERIODIC_DATA_COUNT 0U /*2A 服务支持DID个数 */
#define DCM_WRITE_DIDSUP_COUNT 2U /*2E 服务支持的DID 个数*/
#define DCM_ONEDID_MAXDATALENGTH 20U /*22 单个DID 数据最大长度*/
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
#define ROUTINECTRL_DID_CheckProgrammingIntegrity 0x0202
#define ROUTINECTRL_DID_CheckProgrammingPreconditions 0x0203
#define ROUTINECTRL_DID_CheckProgrammingDependencies 0xFF01
#define ROUTINECTRL_DID_EraseMemory 0xFF00
typedef TeDcm_h_ResultType (*ServerDealfunc)(void);
/*SID 条件检查项 */
typedef struct
{
uint8 SupportSession; /* 支持的会话 模式 */
uint8 SupportSecurityAccess; /* 支持的安全权限 */
uint8 SupportRequestAddress; /* 支持的请求方式 */
uint8 MinDL; /*SID 对应的最小DL*/
uint8 SubCount; /* 子服务个数 */
uint8 Sid; /*SID */
ServerDealfunc SidFunction;
}TsDcm_h_SidCheckInfoType;
typedef TeDcm_h_ResultType (*SubDealfunc)(void );
typedef TeDcm_h_ResultType (*SubDealfuncWithPara)(uint8 );
/* 子服务信息列表结构体 */
typedef struct
{
uint8 Sub; /* 子服务 */
uint8 DL; /* 子服务 对应的正确DL */
SubDealfunc SubFunction; /* 子服务 对应函数的处理函数 */
}TsDcm_h_SubCheckType;
typedef struct
{
uint8 Sub; /* 子服务 */
uint8 DL; /* 子服务 对应的正确DL */
SubDealfuncWithPara SubFunction; /* 子服务 对应函数的处理函数 */
}TsDcm_h_WithParaSubCheckType;
/* 子服务信息列表结构体 */
typedef struct
{
uint8 Sub; /* 子服务 */
uint8 DL; /* 子服务 对应的正确DL */
SubDealfunc SubFunction; /* 子服务 对应函数的处理函数 */
}TsDcm_h_DtcCheckType;
typedef uint8 (*DidDealfunc)(uint8* LeDcm_u_DataAddress,uint8* LeDcm_u_DataLength);
/* 22 2E 2A服务 DID 信息列表结构体 */
typedef struct
{
uint8 SupportSession; /* 支持的会话模式 */
uint8 SupportSecurityAccess; /* 支持的安全权限 */
uint8 DataLength; /* 数据长度 */
uint16 Did; /* 具体DID */
DidDealfunc Function; /* DID 对应函数的处理函数 */
}TsDcm_h_DidCheckType;
typedef struct
{
uint8 Did;
uint8 TransmissionMode;
uint16 TmCount;
}TsDcm_h_2APeriodicDidServe;
typedef TeDcm_h_ResultType (*DtcDealfunc)(uint32 LeDcm_DtcGroup);
/*14 服务信息列表结构体 */
#if 0
typedef struct
{
uint32 Dtc; /* DTC组 */
DtcDealfunc CleanFunction; /* 子服务 对应函数的处理函数 */
}TsDcm_h_DtcCheckType;
#endif
typedef TeDcm_h_ResultType (*RidDealfunc)(void);
/*Rid 支持的子服务及处理函数信息的列表结构体*/
typedef struct
{
uint8 Sub; /* 子服务 */
uint8 DL; /* 服务 对应的正确DL */
RidDealfunc Function; /* 服务 对应函数的处理函数 */
}TsDcm_h_RidSubCheckType;
/* 31服务 RID 信息列表结构体 */
typedef struct
{
uint8 SupportSession; /* 支持的会话模式 */
uint8 SupportSecurityAccess; /* 支持的安全权限 */
uint16 Rid; /* Rid*/
const TsDcm_h_RidSubCheckType* RidSubTable; /*Rid 支持的子服务列表 */
}TsDcm_h_RidCheckType;
typedef struct
{
uint8 write;
uint8 data;
}TsDcm_h_IO_parameter_t;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
extern const TsDcm_h_SidCheckInfoType CaDcm_h_SidCheckInfoTable[DCM_SUPPORTSID_COUNT];
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
extern uint8 MngDcm_SIDCheckAvailable(uint8 LeDcm_u_Sid);
extern uint8 MngDcm_SIDCheckSession(uint8 LeDcm_u_SidIndex);
extern uint8 MngDcm_SIDCheckSecurityAccess(uint8 LeDcm_u_SidIndex);
extern uint8 MngDcm_SIDFuncAddressAvailable(uint8 LeDcm_u_SidIndex);
extern uint8 MngDcm_SIDCheckMinDL(uint8 LeDcm_u_SidIndex,uint16 LeDcm_u_DL);
extern TeDcm_h_ResultType MngDcm_SessionControlService(void);
extern TeDcm_h_ResultType MngDcm_ECUResetService(void);
extern TeDcm_h_ResultType MngDcm_CleanDTCService(void);
extern TeDcm_h_ResultType MngDcm_ReportDTCService(void);
extern TeDcm_h_ResultType MngDcm_ReadDidDataService(void);
extern TeDcm_h_ResultType MngDcm_SecurityAccessService(void);
extern TeDcm_h_ResultType MngDcm_CommunicationControlService(void);
extern TeDcm_h_ResultType MngDcm_WriteDidDataService(void);
extern TeDcm_h_ResultType MngDcm_RoutineControlService(void);
extern TeDcm_h_ResultType MngDcm_TesterPresentService(void);
extern TeDcm_h_ResultType MngDcm_DTCSettingControlService(void);
extern TeDcm_h_ResultType MngDcm_ReadMemoryDataService(void);
extern TeDcm_h_ResultType MngDcm_SecurityAccessService(void);
extern TeDcm_h_ResultType MngDcm_WriteMemoryDataService(void);
extern TeDcm_h_ResultType MngDcm_ReadDataByIdentifier(void);
extern TeDcm_h_ResultType MngDcm_DynamicaDefineIdentifier(void);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +0,0 @@
#ifndef _DCM_DID_H
#define _DCM_DID_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "Dcm_DID_Cfg.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
extern uint8 Dcm_DidServices_0x0200_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x0201_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF110_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF110_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF112_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF112_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF113_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF15A_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF180_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF181_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF183_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
//extern uint8 Dcm_DidServices_0xF184_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF186_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF187_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF189_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength) ;
extern uint8 Dcm_DidServices_0xF18A_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF18B_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF18C_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF190_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF190_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF191_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF192_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF193_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF194_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF195_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF197_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF197_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF198_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF198_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF199_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF199_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF19D_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF19D_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A2_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A2_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A4_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A5_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A5_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A6_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF1A6_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x016B_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x016C_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x016D_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x016E_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x016F_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x0620_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x0621_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x0622_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x3A00(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x3A01(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF200_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF201_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF202_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF203_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF204_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF205_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xF206_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x6300_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x6308_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630B_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630C_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630D_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630F_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0xFD00_ReadData(uint8* LeDcm_u_data,uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x6300_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x6308_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630B_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630C_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
extern uint8 Dcm_DidServices_0x630E_WriteData(uint8* LeDcm_u_data, uint8* LeDcm_u_dataLength);
#endif

View File

@ -1,709 +0,0 @@
/* @<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>@<40>ַ<EFBFBD><D6B7>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ȥ<EFBFBD><C8A5> */
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
/* @<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> */
#include "BranchTable.h"
#include "boot_macrodriver.h"
#include "Dcm_DID_Cfg.h"
//#include "R_TypeDefs.h"
//#include "r_fdl_types.h"
//#include "eel.h"
//#include "user_define.h"
#include "Dcm_extern.h"
#include "CanTp_Cfg.h"
#include "pfdl_user.h"
unsigned char DF_Read(unsigned char* read_buf,unsigned char data_num,unsigned char len);
/******************************************************************************
* Description: : Global Variable Definition Section
******************************************************************************/
/*@ <20><><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD> */
extern uint16 adResult[7];
uint8 TempTxBuffer[40];
/******************************************************************************
* Description: : Static Variable Definition Section
******************************************************************************/
uint8 CaDcm_u_NRCData[DCM_NRCCOUNT] = {0x11,0x12,0x13,0x14,0x22,0x24,0x31,0x33,0x35,0x36,0x37,0x7F,0x72,0x71,0x73,0x78,0x7E,0x92,0x93,0x70}; /*27 <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
uint8 wBuf[20] = {0,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff,0};
/******************************************************************************
* Description: : Static Function Prototype Declaration
*****************************************************************************/
/*@<40><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
/******************************************************************************
* Description: : Write User Function Code
*****************************************************************************/
/*@<40><><EFBFBD><EFBFBD>ͷע<CDB7>͸<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>մ˸<D5B4>ʽע<CABD><D7A2>*/
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0x0200_ReadData(uint8* data)
{
data[0] = *(__far uint8 *)DID_0200_ADDR;
if(data[0] != 0xFF) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0x0201_ReadData(uint8* data)
{
data[0] = *(__far uint8 *)DID_0201_ADDR;
if(data[0] != 0xFF) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF110_ReadData(uint8* data)
{
if( 0 == DF_Read(data,INDEX_0xF110,8)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF112_ReadData(uint8* data)
{
if( 0 == DF_Read(data,INDEX_0xF112,8)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF113_ReadData(uint8* data)
{
(void)data;
data[0] = 0x03;
data[1] = 0x02;
data[2] = 0x01;
data[3] = 0x07;
return DCM_CHECK_OK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF15AWriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 30;temp++)
{
wBuf[temp] = data[temp];
}
// temp = DF_Write(wBuf,INDEX_0xF15A,30); //2017/8/7 10:18:15 spark del
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF180_ReadData(uint8* data)
{
__far uint8_t *p = DID_F180_ADDR;
(void)data;
data[0] = *p++;
data[1] = *p++;
data[2] = *p++;
data[3] = *p++;
data[4] = *p++;
data[5] = *p++;
data[6] = *p++;
data[7] = *p++;
data[8] = *p++;
data[9] = *p++;
return DCM_CHECK_OK;
}
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : @
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : @
*<EFBFBD>ʱ<EFBFBD><EFBFBD> : @
*<EFBFBD><EFBFBD>ע : @
*****************************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF181_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF183_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
#define DCM_DEFAULT_SESSION 0x01 /*Ĭ<><C4AC>ģʽ*/
#define DCM_PROGRAMME_SESSION 0x02 /*<2A><><EFBFBD>ģʽ*/
#define DCM_EXTEND_SESSION 0x04 /*<2A><>չģʽ*/
extern uint8 MngDcm_GetDiagnosticSession(void);
uint8 GetRTE_Dcm_DidServices_0xF186_ReadData(uint8* data)
{
uint8 temp = 0xFF;
temp = MngDcm_GetDiagnosticSession(); /* <20><>ǰ<EFBFBD>Ựģʽ */
if(temp == DCM_DEFAULT_SESSION){
*data = 0x01;
}
else if(temp == DCM_PROGRAMME_SESSION){
*data = 0x02;
}
else if(temp == DCM_EXTEND_SESSION){
*data = 0x03;
}
if( 0xFF != temp)
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF187_ReadData(uint8* data)
{
(void)data;
data[0] = 0x61;
#if BOARD_CFG == LEFT_BOARD
data[1] = 0x0A;
#else
data[1] = 0x0B;
#endif
data[2] = '1';
data[3] = '2';
data[4] = '3';
data[5] = 0x00;
data[6] = '0';
data[7] = '0';
data[8] = '0';
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF189_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF18A_ReadData(uint8* data)
{
(void)data;
data[0] = '5';
data[1] = '7';
data[2] = '4';
data[3] = '2';
data[4] = '2';
data[5] = '2';
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF18B_ReadData(uint8* data)
{
(void)data;
data[0] = 0x20;
data[1] = 0x18;
data[2] = 0X06;
data[3] = 0x15;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF190_ReadData(uint8* data)
{
(void *)data;
if(0 == DF_Read(data,INDEX_0xF190,17)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF191_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF192_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF193_ReadData(uint8* data)
{
__far uint8 *p = DID_F193_ADDR;
(void)data;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF194_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF195_ReadData(uint8* data)
{
__far uint8 *p = DID_F195_ADDR;
(void)data;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
*data++ = *p++;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF197_ReadData(uint8* data)
{
(void *)data;
if(0 == DF_Read(data,INDEX_0xF197,8)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF198_ReadData(uint8* data)
{
(void *)data;
if(0 == DF_Read(data,INDEX_0xF198,16)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF199_ReadData(uint8* data)
{
(void)data;
if(0 == DF_Read(data,INDEX_0xF199,4)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF19D_ReadData(uint8* data)
{
(void)data;
if(0 == DF_Read(data,INDEX_0xF19D,4)) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0x6300_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_TEMP);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x6308_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_REC);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x630B_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_FAN);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x630C_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_MODE);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x630D_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_DEFROST);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x630F_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_AC);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xFD00_ReadData(uint8* data)
{
(void)data;
*data = GetIoParameter(IO_K30);
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A2_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A2_WriteData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A4_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A5_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A5_WriteData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A6_ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0xF1A6_WriteData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x061BReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x061CReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x061DReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x061EReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x061FReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x0620ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x0621ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetRTE_Dcm_DidServices_0x0622ReadData(uint8* data)
{
(void)data;
return DCM_CHECK_OK;
}
uint8 GetVehicel_u_SpeedVal(void)
{
uint8 LeVehicle_U_Speed = 1;
return LeVehicle_U_Speed;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF110_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 8;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF110,8);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0xF112_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 8;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF112,8);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF190_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 17;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF190,17);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF197_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 8;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF197,8);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF198_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 16;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF198,16);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF199_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 4;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF199,4);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
uint8 GetRTE_Dcm_DidServices_0xF19D_WriteData(uint8* data)
{
uint8 temp;
for(temp = 0;temp < 4;temp++)
{
wBuf[temp] = data[temp];
}
temp = DF_Write(wBuf,INDEX_0xF19D,4);
if(temp == 0) //R_FDL_OK
return DCM_CHECK_OK;
else
return DCM_CHECK_NOK;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0x6300_WriteData(uint8* data)
{
uint8 temp;
temp = *(data+1);
WriteIoParameter(IO_TEMP,temp);
return DCM_CHECK_OK;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0x6308_WriteData(uint8* data)
{
uint8 temp;
temp = *(data+1);
WriteIoParameter(IO_REC,temp);
return DCM_CHECK_OK;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0x630B_WriteData(uint8* data)
{
uint8 temp;
temp = *(data+1);
WriteIoParameter(IO_FAN,temp);
return DCM_CHECK_OK;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0x630C_WriteData(uint8* data)
{
uint8 temp;
temp = *(data+1);
WriteIoParameter(IO_MODE,temp);
return DCM_CHECK_OK;
}
/****************************************************************/
uint8 GetRTE_Dcm_DidServices_0x630E_WriteData(uint8* data)
{
uint8 temp;
temp = *(data+1);
WriteIoParameter(IO_REARDEF,temp);
return DCM_CHECK_OK;
}

View File

@ -1,141 +0,0 @@
#ifndef _DCM_DID_CFG_H
#define _DCM_DID_CFG_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "_Types.h"
//#include "eel.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
#define DCM_CHECK_NOK 0U /*宏定义条件检查返回结果*/
#define DCM_CHECK_OK 1U
#define YES 1
#define BOOT_DEBUG NO
#define DCM_NORESULT 0xFF /*未找到目标返回宏定义值*/
#define DCM_NRCCOUNT 20U
#define DCM_NRC11 0U
#define DCM_NRC12 1U
#define DCM_NRC13 2U
#define DCM_NRC14 3U
#define DCM_NRC22 4U
#define DCM_NRC24 5U
#define DCM_NRC31 6U
#define DCM_NRC33 7U
#define DCM_NRC35 8U
#define DCM_NRC36 9U
#define DCM_NRC37 10U
#define DCM_NRC7F 11U
#define DCM_NRC72 12U
#define DCM_NRC71 13U
#define DCM_NRC73 14U
#define DCM_NRC78 15U
#define DCM_NRC7E 16U
#define DCM_NRC92 17U
#define DCM_NRC93 18U
#define DCM_NRC70 19U
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
extern uint8 TempTxBuffer[40];
extern uint8 CaDcm_u_NRCData[DCM_NRCCOUNT];
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
extern uint8 GetRTE_Dcm_DidServices_0x0200_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x0201_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF110_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF110_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF112_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF112_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF113_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF15AWriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF180_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF181_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF183_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF186_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF187_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF189_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF18A_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF18B_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF18C_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF190_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF190_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF191_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF192_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF193_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF194_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF195_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF197_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF197_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF198_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF198_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF199_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF199_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF19D_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF19D_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A2_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A2_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A4_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A5_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A5_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A6_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xF1A6_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x061BReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x061CReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x061DReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x061EReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x061FReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x0620ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x0621ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x0622ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x6300_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x6300_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x6308_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x6308_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630B_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630B_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630C_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630C_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630D_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630D_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630E_WriteData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0x630F_ReadData(uint8* data);
extern uint8 GetRTE_Dcm_DidServices_0xFD00_ReadData(uint8* data);
extern uint8 GetVehicel_u_SpeedVal(void);
#if 0
extern uint16 EvaSensorFeedbackVoltage(void);
extern uint16 GetModeFeedbackVoltage(void);
extern uint16 GetRecFeedbackVoltage(void);
extern uint16 GetPtcTmpSnsVolt(void);
extern uint16 GetCompSnsVolt(void);
extern uint16 GetFanFeedBackVolt(void);
extern uint8 GetAC_OutputSignal(void) ;
extern uint8 GetBlowerOn_Signal(void);
extern uint8 GetRec_Moto_Status(void);
extern uint8 GetFan_Degree(void);
extern uint8 GetMode_Moto_Status(void);
extern uint8 GetRec_Moto_Drive_Status(void) ;
extern uint8 GetMode_Moto_Drive_Status(void);
extern uint16 GetBattyVoltage(void) ;
extern uint16 GetEvaTemperature(void);
#endif
#endif

View File

@ -1,126 +0,0 @@
/******************************************************************************
| File Name : Dcm_App.c
| Description: <EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|------------------------------------------------------------------------------
*****************************************************************************/
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "Dcm_Key.h"
#include "Dcm_extern.h"
/******************************************************************************
* Description: : Global Variable Definition Section
******************************************************************************/
/******************************************************************************
* Description: : Static Variable Definition Section
******************************************************************************/
/******************************************************************************
* Description: : Write User Function Code
*****************************************************************************/
static const uint8 xorArray[4] = {0xAA,0x50,0x43,0x52};
uint32 GetSeed(void)
{
return (GetTimerCnt());
//return(0x0016CDB0); test
}
uint32 encypt(uint32 seed)
{
uint8 i,data[8];
uint32 seed_temp;
seed_temp = seed;//(uint32)(data[0])<<24 | (uint32)(data[1])<<16 | (uint32)(data[2])<<8 | (uint32)(data[3]);
if(seed_temp != 0)
{
for(i=0;i<35;i++)
{
if(seed_temp & 0x80000000)
{
if(seed_temp & 0x00000002)
{
seed_temp = ((seed_temp << 1)&0xFFFFFFFF);
seed_temp = (seed_temp^0xDFAF30B5)&0xFFFFFFFF;
}
else
{
seed_temp = (seed_temp << 1)&0xFFFFFFFF;
seed_temp = seed_temp^0x6F21EAAE;
}
}
else
seed_temp = (seed_temp << 1)&0xFFFFFFFF;
}
}
// data[0] = seed_temp>>24;
// data[1] = seed_temp>>16;
// data[2] = seed_temp>>8;
// data[3] = seed_temp;
// TransmitCAN_Message(0x701,8,data);
return seed_temp;
}
uint32 SecurityLevel_1(uint32 Seed)
{
return encypt(Seed);
}
uint32 SecurityLevel_3(uint32 Seed)
{
SeedSec_t cal,key,seed;
seed.word = Seed;
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);
return( key.word );
}
uint32 SecurityLevel_11(uint32 Seed)
{
SeedSec_t cal,key,seed,key_test;
seed.word = Seed;
cal.byte[0] = seed.byte[0]^xorArray[0];
cal.byte[1] = seed.byte[1]^xorArray[1];
cal.byte[2] = seed.byte[2]^xorArray[2];
cal.byte[3] = seed.byte[3]^xorArray[3];
#if 0
key.byte[0] = ((cal.byte[2]&0x03)<<6)|(( cal.byte[3]&0xFC)>>2);
key.byte[1] = ((cal.byte[3]&0x03)<<6)|(cal.byte[0]&0x3F);
key.byte[2] = (cal.byte[0]&0xFC)|((cal.byte[1]&0xC0)>>6);
key.byte[3] = (cal.byte[1]&0xFC)|( cal.byte[2]&0x03);
#else
key.byte[3] = ((cal.byte[1]&0x03)<<6)|(( cal.byte[0]&0xFC)>>2);
key.byte[2] = ((cal.byte[0]&0x03)<<6)|(cal.byte[3]&0x3F);
key.byte[1] = (cal.byte[3]&0xFC)|((cal.byte[2]&0xC0)>>6);
key.byte[0] = (cal.byte[2]&0xFC)|( cal.byte[1]&0x03);
#endif
return( key.word );
}
uint32 GENERIC_ALGORITHM(uint32 wSeed, uint8 SecurityLevel)
{
if(0x01==SecurityLevel){
return(SecurityLevel_1(wSeed));
}
else if(0x11==SecurityLevel){
return(SecurityLevel_11(wSeed));
}
}

View File

@ -1,32 +0,0 @@
#ifndef _DCM_KEY_H
#define _DCM_KEY_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "_Types.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
typedef uint32 UWord32;
typedef union{
uint32 word;
uint8 byte[4];
}SeedSec_t;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
extern UWord32 seedToKey(UWord32 seed,UWord32 MASK);
extern uint32 GENERIC_ALGORITHM(uint32 wSeed, uint8 SecurityLevel);
extern uint32 GetSeed(void);
extern uint32 GetTimerCnt(void);
#endif

View File

@ -1,237 +0,0 @@
typedef struct
{
unsigned char write;
unsigned char data;
}IO_parameter_t;
#define IO_TEMP 0
#define IO_REC 1
#define IO_FAN 2
#define IO_MODE 3
#define IO_DEFROST 4
#define IO_REARDEF 5
#define IO_AC 6
#define IO_K30 7
#define KL30_VOLTAGE 0
#define TEMP_MOTOR 1
#define MODE_MOTOR 2
#define REC_MOTOR 3
#define EVA_SENSOR 4
#define REPROGRAM_VALID 0xAA5555AA
#define APP_VALID 0xAA5555AA
/************************************************************************************
// 输入参数 ch : /
// 0: KL30电压 /
// 1: 驾驶员侧温度调节电机反馈电压 /
// 2: 出风模式电机电机反馈电压 /
// 3: 循环风门调节电机反馈电压 /
// 4蒸发器温度传感器电压 /
// /
// 返回值: /
// 对应的电压*10即返回的电压值精度是0.1V的) /
// /
************************************************************************************/
unsigned char GetVoltage(unsigned char ch);
/************************************************************************************
// 输入参数 motor : /
// 1: 驾驶员侧温度调节电机 /
// 2: 出风模式电机电机 /
// 3: 循环风门调节电机 /
// /
// 返回值: /
// 0: 电机正常 1电机堵转 /
// /
************************************************************************************/
unsigned char GetMotorLockStatus(unsigned char motor);
/************************************************************************************
// 输入参数 p : /
// 0: TEMP 驾驶员侧温度风门位置 /
// 1: REC 内外循环模式 /
// 2: FAN 鼓风机档位 /
// 3: MODE 模式风门位置 /
// 4: DEFROST 除霜开关 /
// 5: REARDEF 后除霜控制 /
// 6: AC A/C制冷按键按键 /
// 7: K30 ECU Supplier voltage /
// /
// 返回值: /
// 0: 对应的data,具体见222F服务 /
************************************************************************************/
unsigned char GetIoParameter(unsigned char p);
/************************************************************************************
// 输入参数 p : /
// 0: TEMP 驾驶员侧温度风门位置 /
// 1: REC 内外循环模式 /
// 2: FAN 鼓风机档位 /
// 3: MODE 模式风门位置 /
// 4: DEFROST 无效 /
// 5: REARDEF 后除霜控制 /
// 6: AC 无效 /
// 7: K30 无效 /
// 返回值: /
// /
************************************************************************************/
void WriteIoParameter(unsigned char p,unsigned char data);
/************************************************************************************
// 输入参数 p : /
// /
// /
// 返回值: /
// 0: IGN电源正常 1IGN > 16V 或 IGN < 9V /
// /
************************************************************************************/
unsigned char GetIgnVoltStatus(void);
/************************************************************************************
// 输入参数 ID : CAN ID //
// 输入参数 Dlc : CAN 发送数据长度 //
// 输入参数 *Data : 指向 CAN 发送数据缓冲区的指针 //
// //
// 返回值: //
// 0 发送成功 非0 :发送失败 //
************************************************************************************/
unsigned char TransmitCAN_Message(unsigned int ID,unsigned char Dlc,unsigned char *Data);
/************************************************************************************
// 输入参数 write_buf : 指向 需要写入数据缓冲区的地址 //
// 输入参数 data_num : 数据代号 //
// 输入参数 len : 写入数据长度 //
// //
// 返回值: //
// 0 写入成功 非0 :写入失败 //
************************************************************************************/
unsigned char DF_Write(unsigned char* write_buf,unsigned char data_num,unsigned char len);
/************************************************************************************
// 输入参数 read_buf : 指向读取数据存入的缓冲区的地址 //
// 输入参数 data_num : 数据代号 //
// 输入参数 len : 读取数据长度 //
// //
// 返回值: //
// 0 读取成功 非0 :读取失败 //
************************************************************************************/
unsigned char DF_Read(unsigned char* read_buf,unsigned char data_num,unsigned char len);
/************************************************************************************
// //
// 返回值: //
// 当前32bit 的 1ms计数的值 //
***********************************************************************************/
unsigned long GetTimerCnt(void);
/************************************************************************************
// 获取data Flash数据存取索引号 //
// 输入参数 code : //
// 0 : 获取APP重编程请求标志索引号 //
// 1 : 获取2E服务0xF110的索引号 //
// 2 : 获取2E服务0xF190的索引号 //
// 3 : 获取2E服务0xF197的索引号 //
// 4 : 获取2E服务0xF198的索引号 //
// 5 : 获取2E服务0xF199的索引号 //
// 6 : 获取2E服务0xF19D的索引号 //
// 7 : 获取2E服务0xF112的索引号 //
// 8 : 获取19服务0xF00616的索引号 //
// 9 : 获取19服务0xF00617的索引号 //
// 10 : 获取19服务0x918112的索引号 //
// 11 : 获取19服务0x918114的索引号 //
// 12 : 获取19服务0x918171的索引号 //
// 13 : 获取19服务0x918312的索引号 //
// 14 : 获取19服务0x918314的索引号 //
// 15 : 获取19服务0x918371的索引号 //
// 16 : 获取19服务0x918412的索引号 //
// 17 : 获取19服务0x918414的索引号 //
// 18 : 获取19服务0x918471的索引号 //
// 19 : 获取19服务0x918611的索引号 //
// 20 : 获取19服务0x918614的索引号 //
// 21 : 获取19服务0xC07300的索引号
// //
// 返回值: //
// 数据索引号 //
// //
************************************************************************************/
unsigned long GetDataFlashAddress(unsigned char code);
/************************************************************************************
// 获取AC硬件版本 //
// 输入参数 hdv : //
// 指向读取数据存入的缓冲区的地址 //
// //
// 返回值: //
// //
// //
************************************************************************************/
void GetHardwareVersion(unsigned char* hdv);
/************************************************************************************
// 获取AC软件版本 //
// 输入参数 swv : //
// 指向读取数据存入的缓冲区的地址 //
// //
// 返回值: //
// //
// //
************************************************************************************/
void GetSoftwareVersion(unsigned char* swv);
/************************************************************************************
// 获取AC生产日期 //
// 输入参数 *date : //
// data[0] = YEAR //
// data[1] = MONTH //
// data[0] = DAY //
// //
// 返回值: //
// //
// //
************************************************************************************/
void GetManufacturingDate(unsigned char* date);
/************************************************************************************
// 获取Can总线出错状态 //
// 输入参数 //
// //
// 返回值: Can总线出错状态 //
// //
// //
************************************************************************************/
unsigned char GetCanBusOffErr(void);
/************************************************************************************
// 获取历史成功编程次数 //
// 输入参数 //
// //
// 返回值: 历史成功编程次数 //
// //
// //
************************************************************************************/
unsigned char GetProgrammingCounter(void);
/************************************************************************************
// 获取历史编程次数 //
// 输入参数 //
// //
// 返回值: 历史编程次数 //
// //
// //
************************************************************************************/
unsigned char GetProgrammingAttempCounter(void);
/************************************************************************************
// 清除DTC数据 //
// 输入参数 //
// //
// 返回值: 状态 //
// //
// //
************************************************************************************/
unsigned char Clear_DTC_Data(void);

View File

@ -1,86 +0,0 @@
/******************************************************************************/
#ifndef _TYPES_H
#define _TYPES_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
typedef signed char int8;
typedef signed int int16;
typedef signed long int32;
typedef unsigned char uint8;
typedef unsigned int uint16;
typedef unsigned long uint32;
typedef unsigned char bool1;
typedef union{
uint32 word;
uint8 byte[4];
}long2char_t;
#ifndef _ON
# define _ON 1U
#endif
#ifndef _OFF
#define _OFF 0U
#endif
#ifndef _TRUE
# define _TRUE 1U
#endif
#ifndef _FALSE
# define _FALSE 0U
#endif
#ifndef _HIGH
# define _HIGH 1U
#endif
#ifndef _LOW
# define _LOW 0U
#endif
#ifndef _ACTIVE
# define _ACTIVE 1U
#endif
#ifndef _INACTIVE
# define _INACTIVE 0U
#endif
#ifndef _NULL
# define _NULL 0U
#endif
/* NULL_PTR define with a void pointer to zero definition*/
#ifndef _NULL_PTR
# define _NULL_PTR ((void *)0)
#endif
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
#endif

View File

@ -1,15 +0,0 @@
/***********************************************************************************************************************
* File Name : app_to_dcm.h
* Version :
* Device(s) : R5F10BLG
* Tool-Chain : CA78K0R
* Description :
* Creation Date:
***********************************************************************************************************************/
#ifndef APP_TO_DCM_H
#define APP_TO_DCM_H
#define DMK_A01_03_VERSION (5)
#endif

View File

@ -1,117 +0,0 @@
#ifndef CAN_DRV_H
#define CAN_DRV_H
/******************************************************************************
Macro definitions
******************************************************************************/
#define R_CAN_GRAMINIT_ON (0x8UL)
#define R_CAN_GSLPSTS_ON (0x4UL)
#define R_CAN_GRSTSTS_ON (0x1UL)
#define R_CAN_CSLPSTS_ON (0x4UL)
#define R_CAN_CHLTSTS_ON (0x2UL)
#define R_CAN_CRSTSTS_ON (0x1UL)
#define R_CAN_TMTRM_ON (0x8U)
#define R_CAN_TMTR_ON (0x1U)
#define R_CAN_AFLDAE_ON (0x100UL)
#define R_CAN_GSLPR_MASK (0x4UL)
#define R_CAN_GMDC_MASK (0x3UL)
#define R_CAN_CSLPR_MASK (0x4UL)
#define R_CAN_CHMDC_MASK (0x3UL)
/******************************************************************************
Exported global variables and functions (to be accessed by other files)
******************************************************************************/
//void R_CAN_Init( void );
//bool R_CAN_Send_TxBuf0(uint32_t can_id, uint8_t dlc, uint8_t msg[8]);
//bool R_CAN_Receive_RxBuf0(uint32_t * p_can_id, uint8_t * p_dlc, uint8_t msg[8]);
/***************************************************/
/*** Compressor CAN0 signals ****/
/***** RX *****/
/***** TX *****/
/***************************************************/
/*** MAIN CAN signals ****/
/***** TX *****/
/***** RX *****/
typedef struct
{
unsigned int RcvId:11;
unsigned int RcvDLC:4;
unsigned int VCU_AC_EnableCommand:1;
}VCU_DisplayInfo_t;
typedef struct
{
unsigned int RcvId:11;
unsigned int RcvDLC:4;
unsigned int HMI_AcKeyState:3;
unsigned int HMI_BlowerLevelKey:2;
unsigned int HMI_IntakeAirKey:1;
}HMI_ControlCommand_t;
typedef struct
{
unsigned int RcvId:11;
unsigned int RcvDLC:4;
unsigned char Data[8];
}TEST_AC_DiagReq_t;
typedef struct
{
unsigned int RcvId:11;
unsigned int RcvDLC:4;
unsigned char Data[8];
}TEST_Func_DiagReq_t;
typedef struct {
unsigned int lword[4];
}can_cre_type;
#define CAN_RX_RULE_NUM 5
#define CAN_PAGE_RX_RULE_IDX_MASK 0xfU
#define CAN_RX_RULE_PAGE_IDX_BIT_POS 4U
/***************************************************/
/**********************CAN FRAME********************/
typedef struct
{
unsigned int ID;
unsigned int * addr;
}Can_Frame_Format;
#define COMP_Information_ID 0x300
#define AC_CurrentStatus_ID 0x32B
#define AC_COMP_Information_ID 0x35B
#define VCU_DisplayInfo_ID 0x310
#define HMI_ControlCommand_ID 0x348
#define TEST_AC_DiagReq_ID 0x787//0x7C6
#define TEST_Func_DiagReq_ID 0x7DF
extern volatile VCU_DisplayInfo_t VCU_DisplayInfo ;
extern volatile HMI_ControlCommand_t HMI_ControlCommand ;
extern volatile TEST_AC_DiagReq_t TEST_AC_DiagReq ;
extern volatile TEST_Func_DiagReq_t TEST_Func_DiagReq ;
extern const Can_Frame_Format CanBufDsc[];
#endif

View File

@ -1,25 +0,0 @@
#ifndef DCM_API_H
#define DCM_API_H
typedef unsigned char CanIf_HwHandleType;
typedef unsigned char CanIf_CanDlcType;
typedef unsigned char CanIf_CanDataType;
typedef unsigned int CanIf_CanIdType;
/* 此函数在收到CAN数据后面调用 */
extern void RxIndicationCanIf_Messages(
CanIf_HwHandleType Hrh, /* 此参数暂时不明先置0 */
CanIf_CanIdType LeCanIf_e_CanId, /* CAN ID */
CanIf_CanDlcType LeCanIf_e_CanDlc, /* CAN数据长度 */
CanIf_CanDataType* LeCanIf_e_CanSduPtr); /* 指向CAN接收数据缓存 */
/* 初始化 上电调用 */
extern void InitCanTp_Parameter(void);
extern void InitDcm_Parameter (void);
/**下面函数在主程序调用,能否在中断里调用要具体处理时间,**/
extern void MngDcm_1ms_Sever(void);
void BootProgramSessionDeal(void);
#endif

Some files were not shown because too many files have changed in this diff Show More