Commit c477b0fe authored by hu's avatar hu

调整硬线消抖时间

parent c73e1db2
......@@ -43,39 +43,39 @@ LINE_IN_TriggerLevel_en_t LINE_IN_Get_A20(void); /*A20 */
const Line_In_Attribute_st_t g_stLineInAttribute[LINE_IN_MAX] =
{
/*指示灯信号 硬线输入*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ABS,}, /*A22 ABS*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_PARK_BRAKE,}, /*A23 PARK BRAKE*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ABS,}, /*A22 ABS*/
{ LINE_IN_LEVEL_LOW, 500U, 0U, LINE_IN_IG_ON, LINE_IN_Get_PARK_BRAKE,}, /*A23 PARK BRAKE*/
{ LINE_IN_LEVEL_HIGH, 60U, 0U, LINE_IN_IG_ON, LINE_IN_Get_HI_BEAM,}, /*A25 HI BEAM*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_BRAKE_AIR_EBS,}, /*A28 BRAKE AIR/EBS*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_SEAT_BELT,}, /*A30 SEAT BELT*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_MIL,}, /*A31 MIL*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ENG_OIL,}, /*A32 ENG OIL*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_CHARGE,}, /*A34 CHARGE*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_ABS_INFO,}, /*B03 TRAILER ABS INFO*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_Rr_FOG_LAMP,}, /*B14 Rr FOG LAMP*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ACC_AIR,}, /*B15 ACC AIR*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_AIR_SUS,}, /*B30 AIR SUS*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_BRAKE,}, /*B31 TRAILER BRAKE*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_ABS,}, /*B33 TRAILER ABS*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_RR_DIFF_LOCK,}, /*B36 RR DIFF LOCK*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_WEAR_IND,}, /*B38 WEAR IND*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_BRAKE_AIR_EBS,}, /*A28 BRAKE AIR/EBS*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_SEAT_BELT,}, /*A30 SEAT BELT*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_MIL,}, /*A31 MIL*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ENG_OIL,}, /*A32 ENG OIL*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_CHARGE,}, /*A34 CHARGE*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_ABS_INFO,}, /*B03 TRAILER ABS INFO*/
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_Rr_FOG_LAMP,}, /*B14 Rr FOG LAMP*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ACC_AIR,}, /*B15 ACC AIR*/
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_AIR_SUS,}, /*B30 AIR SUS*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_BRAKE,}, /*B31 TRAILER BRAKE*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_ABS,}, /*B33 TRAILER ABS*/
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_RR_DIFF_LOCK,}, /*B36 RR DIFF LOCK*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_WEAR_IND,}, /*B38 WEAR IND*/
/*非指示灯信号 硬线输入*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ILLUMINATION,}, /*A06 ILLUMINATION 背光有效*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_RET_BLENDING,}, /*A10 RET_BLENDING*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_BRAKE,}, /*A21 BRAKE*/
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ILLUMINATION,}, /*A06 ILLUMINATION 背光有效*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_RET_BLENDING,}, /*A10 RET_BLENDING*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_BRAKE,}, /*A21 BRAKE*/
{ LINE_IN_LEVEL_HIGH, 20U, 0U, LINE_IN_IG_ONOFF, LINE_IN_Get_TURN_R,}, /*A26 TURN_R*/
{ LINE_IN_LEVEL_HIGH, 20U, 0U, LINE_IN_IG_ONOFF, LINE_IN_Get_TURN_L,}, /*A27 TURN_L*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ABS_DETECT,}, /*A33 ABS_DETECT*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_PTO,}, /*B01 PTO*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_GLOW,}, /*B05 GLOW*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_CONNECT,}, /*B06 TRAILER_CONNECT*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ABS_DETECT,}, /*A33 ABS_DETECT*/
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_PTO,}, /*B01 PTO*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_GLOW,}, /*B05 GLOW*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_TRAILER_CONNECT,}, /*B06 TRAILER_CONNECT*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_LOW_COOLANT,}, /*B32 LOW_COOLANT*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ACC,}, /*B39 ACC*/
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_WEAR2,}, /*B40 WEAR2*/
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_A19,}, /*A19 */
{ LINE_IN_LEVEL_HIGH, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_A03,}, /*A03 */
{ LINE_IN_LEVEL_LOW, 200U, 0U, LINE_IN_IG_ON, LINE_IN_Get_A20,}, /*A20 */
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_ACC,}, /*B39 ACC*/
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_WEAR2,}, /*B40 WEAR2*/
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_A19,}, /*A19 */
{ LINE_IN_LEVEL_HIGH, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_A03,}, /*A03 */
{ LINE_IN_LEVEL_LOW, 100U, 0U, LINE_IN_IG_ON, LINE_IN_Get_A20,}, /*A20 */
};
/*A22 ABS*/
......
......@@ -4,39 +4,44 @@
static unsigned int SwapData_32(unsigned int Data)
{
unsigned int RetVal = Data;
RetVal = ((RetVal >> 1) & 0x55555555) | ((RetVal << 1) & 0xaaaaaaaa);
RetVal = ((RetVal >> 2) & 0x33333333) | ((RetVal << 2) & 0xcccccccc);
RetVal = ((RetVal >> 4) & 0x0f0f0f0f) | ((RetVal << 4) & 0xf0f0f0f0);
RetVal = ((RetVal >> 8) & 0x00ff00ff) | ((RetVal << 8) & 0xff00ff00);
RetVal = ((RetVal >> 16) & 0x0000ffff) | ((RetVal << 16) & 0xffff0000);
unsigned int RetVal = Data;
RetVal = ((RetVal >> 1) & 0x55555555) | ((RetVal << 1) & 0xaaaaaaaa);
RetVal = ((RetVal >> 2) & 0x33333333) | ((RetVal << 2) & 0xcccccccc);
RetVal = ((RetVal >> 4) & 0x0f0f0f0f) | ((RetVal << 4) & 0xf0f0f0f0);
RetVal = ((RetVal >> 8) & 0x00ff00ff) | ((RetVal << 8) & 0xff00ff00);
RetVal = ((RetVal >> 16) & 0x0000ffff) | ((RetVal << 16) & 0xffff0000);
return RetVal;
return RetVal;
}
unsigned int CRC32_VAL;
static void CheckCrc32(unsigned char *buf, int len)
{
int i;
int n = 0;
unsigned char tmp = 0;
unsigned int crc = CRC32_VAL; // Initial value
for (n = 0; n < len; n++) {
tmp = buf[n];
tmp = (tmp >> 4) | (tmp << 4);
tmp = (((tmp & 0xcc) >> 2) | ((tmp & 0x33) << 2));
tmp = (((tmp & 0xaa) >> 1) | ((tmp & 0x55) << 1));
crc ^= (unsigned int)(tmp) << 24;
for (i = 0; i < 8; ++i) {
if (crc & 0x80000000L) {
crc = (crc << 1) ^ 0x04C11DB7;
} else {
crc <<= 1;
}
}
}
int i;
int n = 0;
unsigned char tmp = 0;
unsigned int crc = CRC32_VAL; // Initial value
for (n = 0; n < len; n++)
{
tmp = buf[n];
tmp = (tmp >> 4) | (tmp << 4);
tmp = (((tmp & 0xcc) >> 2) | ((tmp & 0x33) << 2));
tmp = (((tmp & 0xaa) >> 1) | ((tmp & 0x55) << 1));
crc ^= (unsigned int)(tmp) << 24;
for (i = 0; i < 8; ++i)
{
if (crc & 0x80000000L)
{
crc = (crc << 1) ^ 0x04C11DB7;
}
else
{
crc <<= 1;
}
}
}
CRC32_VAL = crc;
return;
return;
}
......@@ -63,15 +68,16 @@ unsigned char CheckSpiFlashCRC(void)
CheckCrc = DCRA0COUT;
}
tmp = *((unsigned int *)(CheckCrcAddr + (i * 4)));
if (BinCrcLen % 4 != 0u) {
if (BinCrcLen % 4 != 0u)
{
CheckCrc = CheckCrc ^ 0xffffffff;
CheckCrc = SwapData_32(CheckCrc);
CRC32_VAL = CheckCrc;
CheckCrc32(&tmp, BinCrcLen % 4);
CheckCrc = SwapData_32(CRC32_VAL);
CheckCrc = CheckCrc ^ 0xffffffff;
CheckCrc = SwapData_32(CRC32_VAL);
CheckCrc = CheckCrc ^ 0xffffffff;
}
if (CheckCrc == BinCrc)
{
TmpRet = 1;
......
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