Commit e81147a3 authored by hu's avatar hu

调整K-LINE调用

parent 3763c3c0
......@@ -43,6 +43,9 @@ unsigned char DTCstatusCHGFFK_Line;
unsigned char AccessMode2701KeyTimeFlag;
unsigned char AccessMode2701KeyTime;
unsigned long EOLSeedRandomNumber = 0x6879716169716872ul;
/*
*********************************************************************
* function
......@@ -1124,9 +1127,10 @@ unsigned char kwp_readDataAccessMode(unsigned char *TxData, unsigned char *Reque
if (0)
{
/*密钥随机数生成*/
// SeedKey = (unsigned long)RealTimeClock.RollingCounter;
// SeedKey = SeedKey << 16;
// SeedKey |= (unsigned long)(~RealTimeClock.RollingCounter);
EOLSeedRandomNumber = EOLSeedRandomNumber * 1024 + 520;
SeedKey = (unsigned long)EOLSeedRandomNumber;
SeedKey = SeedKey << 16;
SeedKey |= (unsigned long)(~EOLSeedRandomNumber);
Seed1 = (unsigned char)(SeedKey >> 24);
Seed2 = (unsigned char)(SeedKey >> 16);
......
......@@ -467,7 +467,7 @@
#endif
static const uint32_t u32TimerBClockArray[12U] =
{
{
TIMERB_0_CK0,
TIMERB_0_CK1,
TIMERB_0_CK2,
......@@ -564,7 +564,8 @@ void TimerB_PWM_Init(void)
do
{
u16TimeCount++;
} while (((TAUB0TE) || (TAUB1TE) || (TAUB2TE)) && (u16TimeCount < TIMERB_TIMEROUT_MAX));
}
while (((TAUB0TE) || (TAUB1TE) || (TAUB2TE)) && (u16TimeCount < TIMERB_TIMEROUT_MAX));
if (u16TimeCount < TIMERB_TIMEROUT_MAX)
{
/*CLK0~3 =PCLK */
......@@ -922,8 +923,8 @@ void TimerB_Input_Channel_Stop(TIMERB_Channel_en_t enTimerBChannel)
(*((uint16_t *)u32TimerBRegAddrChannel)) = u16TimerBbit;
/*TAUB0TT = (u16TimerBbit);*/
}
uint32_t u32YZHDTest4=0;
uint32_t u32YZHDTest5=0;
uint32_t u32YZHDTest4 = 0;
uint32_t u32YZHDTest5 = 0;
/*捕获中断*/
void TimerB_Input_Isr(TIMERB_Channel_en_t enTimerBChannel)
{
......@@ -940,7 +941,7 @@ void TimerB_Input_Isr(TIMERB_Channel_en_t enTimerBChannel)
uint32_t u32TimerBChannelClock = 0UL;
uint32_t u32TimerBChannelData = 0UL;
uint32_t i=0;
uint32_t i = 0;
u32TimerBRegAddrChannel = u32TimerBRegBaseAddr + (4U * (u8TimerBChannel));
......@@ -954,7 +955,7 @@ uint32_t i=0;
TimerB_Cal_Fre(enTimerBChannel, u32TimerBChannelClock, u32TimerBChannelData);
R_DEV_IntClearFlag(R_DEV_INT_TAUB0I0+enTimerBChannel);
R_DEV_IntClearFlag(R_DEV_INT_TAUB0I0 + enTimerBChannel);
for ( i = 0; i < 600; i++)
{
u32YZHDTest4++;
......@@ -986,12 +987,12 @@ void TimerB_Cal_Fre(TIMERB_Channel_en_t enTimerBChannel, uint32_t u32TimerBClock
{
u32TimeOut = 0 ;
if(N_Count < 2)
if (N_Count < 2)
{
N_Count ++ ;
}
u32TimerBInputData = u16TimerBCount;
if(N_Count > 1)
if (N_Count > 1)
{
Fre_Event = 1 ;
if (u32TimerBInputDataLast < u32TimerBInputData)
......@@ -1023,7 +1024,7 @@ void TimerB_Cal_Fre(TIMERB_Channel_en_t enTimerBChannel, uint32_t u32TimerBClock
void TimerB_Fre_Timeout(uint8_t Time)
{
if(u32TimeOut < FRE_VEH_TIMEOUT)
if (u32TimeOut < FRE_VEH_TIMEOUT)
{
u32TimeOut += Time ;
}
......
......@@ -3,6 +3,8 @@
#include "init.h"
#include "Sys_Scheduler.h"
#include "Sys_Tick.h"
#include "kwp2000_tp.h"
#include "kwp2000_protocol.h"
typedef struct
{
......@@ -25,6 +27,8 @@ Sys_Scheduling_st_t SysScheduling;
static void Sys_Exact_50us_Task_Handler(void);
static void Sys_Exact_100ms_Task_Handler(void);
static uint8_t u08_1ms_count;
void Sys_Init(void)
{
......@@ -98,6 +102,16 @@ void Sys_Scheduling_Service(void)
static void Sys_Exact_50us_Task_Handler(void)
{
Sys_Exact_50us_Tasks();
/*----K_Line----*/
u08_1ms_count ++;
if (u08_1ms_count >= 20)
{
u08_1ms_count = 0;
Kwp2000_ComInit_Handle();
Kwp2000_Handle(); /* qitiancun */
Kwp2000_Timeout();
}
}
......
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