Commit 3d903a46 authored by 崔立宝's avatar 崔立宝

Merge branch 'LBW' into 'dev'

Lbw

See merge request !7
parents cb75a710 071055e0
/code/EF01_Data
/code/bin
......@@ -58,7 +58,7 @@ These capabilities are defined as follows.
to send, before waiting for an authorization to continue transmission of the
following N_PDUs.
-----------------------------------------------------------------------------*/
#define N_MAX_BS 8
#define N_MAX_BS 0
/*-----------------------------------------------------------------------------
— SeparationTime minimum (STmin): The minimum time the sender is to wait
......
......@@ -198,7 +198,7 @@ RoutineControl
#define stopRoutine 0x02
#define requestRoutineResults 0x03
#define MaintenanceReset 0x62F1
#define MaintenanceReset 0xE420
#define CheckMemory 0x0202
#define CheckProgrammingPreconditions 0x0203
#define ECU_selftest 0xDF01
......@@ -385,7 +385,7 @@ typedef union
#define DTCNoTestThisCycle 0x40
#define DTCNoError 0xFE
#define AgeingCount 39
#define AgeingCount 40
typedef union
{
......@@ -489,4 +489,6 @@ uint8_t Write_Base_DATA_FROM_FLASH(uint32_t Adrr, uint8_t *Data,uint8_t len);
uint8_t ReadDFlashData(uint32_t u8BlockNum, uint32_t u32Data[], uint16_t u16Len, InitFunction initFunction);
void Ser2EToDFlashInfoInit(void);
void ReadAllDflashData(void);
void DTCAgeing(void);
void UDS_KL15_init(void);
#endif
\ No newline at end of file
/******************************************************************************
文 件 名:CLOCK.c
功能描述:时钟系统初始化库文件
作 者:张暄
版 本:V1.0
日 期:2016.11.2
?? ?? ????CLOCK.c
?????????????????????????
?? ???????
?? ????V1.0
?? ???2016.11.2
******************************************************************************/
#include "CRG.h"
......@@ -23,24 +23,24 @@ extern void Data_Mileage_Rolling_Counter_Update_ISR(void);
extern void Data_Fuel_Consumption_Count_ISR(void);
/******************************************************************************
函数名:WDT_Init
功 能:看门狗初始化
参 数:无
返回值:无
????????WDT_Init
?? ?????????????
?? ??????
?????????
******************************************************************************/
void WDT_Init(void)
{
//配置看门狗
//????????
wdt_reset();
COPCTL = WDT_PERIOD; //配置看门狗定时周期
// PLLCTL_PCE = 1; //看门狗在Pseudo Stop模式下持续运行
COPCTL = WDT_PERIOD; //???????????????
// PLLCTL_PCE = 1; //???????Pseudo Stop???????????
}
/******************************************************************************
函数名:Clock_Init
功 能:时钟系统初始化
参 数:无
返回值:无
????????Clock_Init
?? ?????????????
?? ??????
?????????
******************************************************************************/
void Clock_Init(void)
{
......@@ -53,10 +53,10 @@ void Clock_Init(void)
uint8_t Result; ;
//使用OSCCLK作为系统时钟
//???OSCCLK????????
CLKSEL = 0x00;
//计算时钟配置寄存器值
//???????????????
Result = 0;
REFDIVVal = 0;
while ((REFDIVVal < 64) && (Result == 0))
......@@ -88,7 +88,7 @@ void Clock_Init(void)
if (POSTDIVVal == 0)
{
/*========================================================
当POSTDIV为0时,fPLL等于fVCO
??POSTDIV?0?,fPLL????fVCO
fPLL fVCO
fPLL = fVCO fBUS = ------ = ------
2 2
......@@ -101,7 +101,7 @@ void Clock_Init(void)
else
{
/*========================================================
当POSTDIV不为0时
??POSTDIV???0?
fVCO fPLL fVCO
fPLL = ------------- fBUS = ------ = -------------
2 x POSTDIV 2 4 x POSTDIV
......@@ -123,9 +123,9 @@ void Clock_Init(void)
REFDIVVal++;
}
while (Result == 0); //无法生成所需的BUSCLK,在这里停机
while (Result == 0); //????????????BUSCLK,?????????
//设置时钟配置寄存器
//??????????????
PLLCTL_SCME = 0;
PLLCTL_CME = 1;
......@@ -147,7 +147,7 @@ void Clock_Init(void)
POSTDIV = POSTDIVVal;
while (!CRGFLG_LOCK); //等待 fVCO 输出稳定
while (!CRGFLG_LOCK); //??? fVCO ??????
while (!FSTAT_CCIF); /* wait for FTM reset to complete */
......@@ -157,33 +157,33 @@ void Clock_Init(void)
//FPROT = 0x9C; // Protect 0x7F_C000 to 0x7F_FFFF (pages FD and FF)
DFPROT = 0xFF; /* Disable any protection set on DFlash */
CLKSEL_PLLSEL = 1; //选择PLLCLK作为系统时钟
CLKSEL_PLLSEL = 1; //???PLLCLK????????
#if CRG_USE_PSEUDO_STOP_MODE
CLKSEL_PSTP = 1; //Oscillator在Stop模式下持续运行(Pseudo Stop)
CLKSEL_PSTP = 1; //Oscillator??Stop???????????(Pseudo Stop)
#else
CLKSEL_PSTP = 0; //Oscillator在Stop模式下停止运行(Full Stop)
CLKSEL_PSTP = 0; //Oscillator??Stop??????????(Full Stop)
#endif
CRG_STOP_MODE = 0; //系统正常运行,不在停机模式
CRG_STOP_MODE = 0; //??????????,?????????
}
/******************************************************************************
函数名:Enter_Stop_Mode
功 能:进入停机模式
参 数:无
返回值:无
????????Enter_Stop_Mode
?? ????????????
?? ??????
?????????
******************************************************************************/
void Enter_Stop_Mode(void)
{
CRG_STOP_MODE = 1; //进入停机模式
CRG_STOP_MODE = 1; //?????????
asm ANDCC #0x7F;
asm STOP;
}
/******************************************************************************
函数名:RTI_Init
功 能:初始化RTI
参 数:无
返回值:无
????????RTI_Init
?? ????????RTI
?? ??????
?????????
******************************************************************************/
void RTI_Init(void)
{
......@@ -199,25 +199,25 @@ void RTI_Init(void)
RealTimeClock.LeapYear = Determine_Leap_Year(RealTimeClock.Year);
PLLCTL_PRE = 1; //1 RTI continues running during Pseudo Stop Mode.
//Real Time 时钟频率设置
//Real Time ??????????
RTICTL = 0xDF; //Real Time = 8M / 800000 = 10HZ (100MS)
CRGINT_RTIE = 1; //开Real Time 中断
CRGINT_RTIE = 1; //??Real Time ??
}
/******************************************************************************
函数名:RTI_Timing_Service
功 能:RTI实时计时服务
参 数:无
返回值:无
????????RTI_Timing_Service
?? ???RTI?????????
?? ??????
?????????
*******************************************************************************
注 意:该服务函数必须每100ms被调用一次
? ?????????????100ms?????????
******************************************************************************/
void RTI_Timing_Service(void)
{
uint16_t Counter;
uint16_t SecInc;
if (RealTimeClock.Year != RealTimeClock.BackupYear) //曾经修改过年
if (RealTimeClock.Year != RealTimeClock.BackupYear) //??????????
{
RealTimeClock.LeapYear = Determine_Leap_Year(RealTimeClock.Year);
RealTimeClock.BackupYear = RealTimeClock.Year;
......@@ -309,10 +309,10 @@ void RTI_Timing_Service(void)
}
/******************************************************************************
函数名:Determine_Leap_Year
功 能:闰年检测
参 数:Year:年
返回值:1 - 是闰年 0 -不是闰年
????????Determine_Leap_Year
?? ?????????
?? ????Year????
???????1 - ?????? 0 -????????
******************************************************************************/
uint8_t Determine_Leap_Year(uint16_t Year)
{
......@@ -333,12 +333,12 @@ extern uint8_t DiagnosticReceived;
#pragma CODE_SEG __NEAR_SEG NON_BANKED
/******************************************************************************
函数名:RTI_ISR
功 能:RTI中断服务函数
RTI每100ms发生中断后,其滚动计数器会自动加1
RTI中断还可以将处理器从睡眠中唤醒
参 数:无
返回值:无 2017年5月27日16:47:20
????????RTI_ISR
?? ???RTI???????
RTI?100ms???????,??????????????????1
RTI???????????????????????
?? ??????
????????? 2017??5??27??16:47:20
******************************************************************************/
void interrupt RTI_ISR(void)
......@@ -363,6 +363,6 @@ void interrupt RTI_ISR(void)
DiagnosticReceived--;
Data_Mileage_Rolling_Counter_Update_ISR();
CRGFLG_RTIF = 1; //通过写1清0中断标
CRGFLG_RTIF = 1; //???1??0???
}
#pragma CODE_SEG DEFAULT
/******************************************************************************
文 件 名:Communication_Over_CAN.h
功能描述:基于CAN总线的信号收发函数库头文件
作 者:张暄
版 本:V1.3
日 期:2017.5.31
?? ?? ????Communication_Over_CAN.h
??????????????CAN?????????????????????
?? ???????
?? ????V1.3
?? ???2017.5.31
******************************************************************************/
#ifndef _COMMUNICATION_OVER_CAN_
......@@ -15,35 +15,35 @@
#include "CAN_Communication_Matrix.h"
/******************************************************************************
CAN通信参数配置
CAN??????????
******************************************************************************/
#define CoCAN_RX_MSG_FIFO_MAX_DEPTH 16 //接收FIFO深度
#define CoCAN_MSG_NUM_CHECK 0 //报文数量检查(Debug用)
#define CoCAN_RX_MSG_FIFO_MAX_DEPTH 16 //????FIFO???
#define CoCAN_MSG_NUM_CHECK 0 //???????????(Debug??)
#define CoCAN_TOTAL_MSG_NUM (sizeof(CANMsgAttrTable) / sizeof(CANMsgAttrStruct))
/******************************************************************************
CAN通信收发使能状态
CAN???????????
******************************************************************************/
#define CoCAN_DISABLE 0
#define COCAN_PSEUDO_DISABLE 1
#define CoCAN_ENABLE 2
/******************************************************************************
CAN报文发送请求状态
CAN?????????????
******************************************************************************/
#define CoCAN_TX_IDLE 0
#define CoCAN_TX_REQ 1
#define CoCAN_TX_ON 2
/******************************************************************************
CAN报文发送请求状态
CAN?????????????
******************************************************************************/
#define CoCAN_MODE_NORMAL 0
#define CoCAN_MODE_INIT 1
/******************************************************************************
CAN报文发送FIFO结构
CAN???????FIFO??
******************************************************************************/
typedef struct
{
......@@ -54,7 +54,7 @@ typedef struct
} CoCANTxMsgFIFOStruct;
/******************************************************************************
CAN报文接收FIFO结构
CAN???????FIFO??
******************************************************************************/
typedef struct
{
......@@ -66,61 +66,61 @@ typedef struct
typedef struct
{
CoCANMsgStruct Msg[CoCAN_RX_MSG_FIFO_MAX_DEPTH];
uint8_t Iptr; //进队列位置
uint8_t Optr; //出队列位置
uint8_t Iptr; //????????
uint8_t Optr; //????????
uint8_t Depth;
} CoCANRxMsgFIFOStruct;
/******************************************************************************
CAN报文快速查找表结构
CAN?????????????
******************************************************************************/
/*** 发送报文查找表结构 ***/
/*** ????????????? ***/
typedef struct
{
uint32_t Identifier; //报文ID
uint16_t Offset; //报文发送时间偏移
uint16_t Cycle; //报文发送周期
uint8_t Rsvd; //保留
uint8_t Index; //发送报文对应在周期性报文表中的序号,0xFF表示非周期性报文
uint8_t TxReq; //发送请求
uint8_t DLC; //报文长度
volatile uint8_t *pMsg; //报文寄存器
const uint8_t *pInit; //报文初始化值
volatile uint8_t *pStatus; //状态寄存器
uint32_t Identifier; //????ID
uint16_t Offset; //?????????????
uint16_t Cycle; //???????????
uint8_t Rsvd; //????
uint8_t Index; //??????????????????????????,0xFF??????????????
uint8_t TxReq; //????????
uint8_t DLC; //???????
volatile uint8_t *pMsg; //????????
const uint8_t *pInit; //?????????
volatile uint8_t *pStatus; //???????
} CoCANTxMsgIDLookupStruct;
/*** 接收报文查找表结构 ***/
/*** ????????????? ***/
typedef struct
{
uint32_t Identifier; //报文ID
uint16_t Cycle; //报文超时周期,用于掉线判断
uint8_t Rsvd; //保留
uint8_t Index; //接收报文对应在周期性报文表中的序号,0xFF表示非周期性报文
uint8_t DLCMax; //报文最大长度
uint8_t DLCMin; //报文最小长度
volatile uint8_t *pMsg; //报文寄存器
const uint8_t *pInit; //报文初始化值
const uint8_t *pTimeOut; //报文掉线值
const uint8_t *pMask; //报文屏蔽位(决定某一位在掉线时是否更新为掉线值)
volatile uint8_t *pStatus; //状态寄存器
uint32_t Identifier; //????ID
uint16_t Cycle; //??????????,?????????
uint8_t Rsvd; //????
uint8_t Index; //??????????????????????????,0xFF??????????????
uint8_t DLCMax; //????????
uint8_t DLCMin; //??????????
volatile uint8_t *pMsg; //????????
const uint8_t *pInit; //?????????
const uint8_t *pTimeOut; //????????
const uint8_t *pMask; //????????(????????????????????????)
volatile uint8_t *pStatus; //???????
} CoCANRxMsgIDLookupStruct;
/******************************************************************************
CAN周期性报文管理结构
CAN??????????????
******************************************************************************/
typedef struct
{
uint8_t TxNum; //周期性发送报文数量
uint8_t TxIndex[CAN_TX_MSG_NUM]; //报文对应在发送报文查找表中的序号
uint16_t TxTimer[CAN_TX_MSG_NUM]; //发送报文定时器
uint8_t TxNum; //????????????????
uint8_t TxIndex[CAN_TX_MSG_NUM]; //?????????????????????????
uint16_t TxTimer[CAN_TX_MSG_NUM]; //???????????
uint8_t RxNum; //周期性发送报文数量
uint8_t RxIndex[CAN_RX_MSG_NUM]; //报文对应在发送报文查找表中的序号
uint16_t RxTimer[CAN_RX_MSG_NUM]; //接收报文定时器,用于掉线判断
uint8_t RxNum; //????????????????
uint8_t RxIndex[CAN_RX_MSG_NUM]; //???????????????????????
uint16_t RxTimer[CAN_RX_MSG_NUM]; //???????????,?????????
} CoCANCycleMsgStruct;
/******************************************************************************
CAN通信控制结构
CAN???????
******************************************************************************/
typedef struct
{
......@@ -132,9 +132,9 @@ typedef struct
}CoCANCtrlStruct;
extern CoCANCtrlStruct CoCANCtrl;
/******************************************************************************
函数声明
????????
******************************************************************************/
void CoCAN_L_Data_Indication(uint32_t Identifier, uint8_t DLC, uint8_t *Data); //必须由下一层函数引用
void CoCAN_L_Data_Indication(uint32_t Identifier, uint8_t DLC, uint8_t *Data); //?????????????????
#define CoCAN_L_Data_Request(Identifier, DLC, Data) MSCAN0_L_Data_Request(Identifier, DLC, Data, 2)
......@@ -147,7 +147,7 @@ void CoCAN_Tx_Enable(uint8_t En);
uint8_t CoCAN_Search_Tx_Msg(uint32_t Identifier);
uint8_t CoCAN_Search_Rx_Msg(uint32_t Identifier);
void CoCAN_Signal_Update_Service(void); //必须每1ms被调用一次
void CoCAN_Signal_Update_Service(void); //?????1ms?????????
void CoCAN_Transmit_Message(uint32_t Identifier);
void CoCAN_Modify_Tx_Msg_Cycle(uint32_t Identifier, uint16_t Cycle);
......
This diff is collapsed.
......@@ -110,10 +110,10 @@ Search15=GUI_ADAS_Display
[Recent Applications File List]
File0=H:\EF01\\原程序\bin\WuZhengProject7.0.abs
File1=H:\EF01\\新建文件夹\W3_EF01_BootApp_BV1.2_SV00.10_HV1.07_FV0.08.s19
File0=H:\EF01\������\bin\WuZhengProject7.0.abs
File1=H:\EF01\��\�½��ļ���\W3_EF01_BootApp_BV1.2_SV00.10_HV1.07_FV0.08.s19
File2=I:\GIT\DEV\WZ-EF01\s19\W3_EF01_20231206_BV1.01(500k)_SVa00.09_HV1.07_FV0.08-12V_ALL.s19
File3=H:\EF01\源\03-程序源码\wuzheng_a901-master\原程序\bin\WuZhengProject7.0.abs
File3=H:\EF01��\03-����Դ��\wuzheng_a901-master����\bin\WuZhengProject7.0.abs
LoadFlags0=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
LoadFlags1=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
LoadFlags2=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment