资源简介
OBD诊断协议代码,包含所有CAN,K,J1850下的诊断程序
代码片段和文件信息
/*
* freediag - Vehicle Diagnostic Utility
*
*
* Copyright (C) 2001 Richard Almeida & Ibex Ltd (rpa@ibex.co.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA.
*
*************************************************************************
*
*
* DTC handling routines
*
*/
#include
#include
#include “diag_os.h“ /* operating specific includes */
#include
#include
#include
#include “diag.h“
#include “diag_l1.h“
#include “diag_l2.h“
#include “diag_general.h“
#include “diag_dtc.h“
static char *cvsid = “$Id: diag_dtc.cv 1.3 2002/04/03 04:56:40 bjorn_helgaas Exp $“;
void diag_dtc_init(void)
{
}
/*
* DTC decoding routine
*
*
* Passed
* data len :- Data representing the DTC
* char *vehicle :- Vehicle name
* char *ecu :- ECU Name
* int protocol :- Protocol (see include file)
*/
char *
diag_dtc_decode(u_int8_t *data int len char *vehicle char *ecu int protocol)
{
static char buf[1024];
char area;
switch (protocol)
{
case DIAG_DTC_PROTOCOL_J2012:
if (len != 2)
return(“DTC too short for J1850 decode\n“);
switch ((data[0] >> 6) & 0x03) /* Top 2 bits are area */
{
case 0:
area = ‘P‘;
break;
case 1:
area = ‘C‘;
break;
case 2:
area = ‘B‘;
break;
case 3:
area = ‘U‘;
break;
}
sprintf(buf “%c%02x%02x “ area data[0] & 0x3f data[1]&0xff);
break;
default:
sprintf(buf “Unknown Protocol %d\n“ protocol);
break;
}
return(buf);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 52725 2003-04-21 06:43 OBD-全部\freediag-0.3\doc\Scantool-Manual.htm
文件 39957 2003-04-21 06:43 OBD-全部\freediag-0.3\doc\Supported-Interfaces.htm
文件 7100 2003-04-21 06:43 OBD-全部\freediag-0.3\doc\index.htm
文件 2895 2002-08-31 04:03 OBD-全部\freediag-0.3\src\Makefile.in
文件 2584 2003-04-21 06:42 OBD-全部\freediag-0.3\src\CHANGES
文件 563 2002-04-21 08:47 OBD-全部\freediag-0.3\src\config.h.in
文件 405 2002-06-12 19:12 OBD-全部\freediag-0.3\src\README
文件 336 2003-04-21 06:42 OBD-全部\freediag-0.3\src\TODO
文件 110217 2003-04-21 07:51 OBD-全部\freediag-0.3\src\configure
文件 568 2003-04-21 06:42 OBD-全部\freediag-0.3\src\configure.ac
文件 6230 2002-09-12 00:25 OBD-全部\freediag-0.3\src\diag.h
文件 2223 2002-04-03 12:56 OBD-全部\freediag-0.3\src\diag_dtc.c
文件 1222 2002-01-16 04:28 OBD-全部\freediag-0.3\src\diag_dtc.h
文件 2196 2002-04-30 05:12 OBD-全部\freediag-0.3\src\diag_err.h
文件 4007 2002-04-15 17:04 OBD-全部\freediag-0.3\src\diag_general.c
文件 1492 2002-01-16 04:28 OBD-全部\freediag-0.3\src\diag_general.h
文件 6043 2002-04-03 12:56 OBD-全部\freediag-0.3\src\diag_iso14230.h
文件 24849 2002-06-18 05:55 OBD-全部\freediag-0.3\src\diag_l0_br.c
文件 27 2002-09-12 00:28 OBD-全部\freediag-0.3\src\diag_l0_elm.c
文件 22045 2002-05-01 11:28 OBD-全部\freediag-0.3\src\diag_l0_me.c
文件 14336 2002-05-01 02:47 OBD-全部\freediag-0.3\src\diag_l0_se.c
文件 15311 2002-05-01 02:47 OBD-全部\freediag-0.3\src\diag_l0_vw.c
文件 10994 2002-06-18 04:58 OBD-全部\freediag-0.3\src\diag_l1.c
文件 6489 2002-06-18 04:56 OBD-全部\freediag-0.3\src\diag_l1.h
文件 22595 2002-06-17 06:26 OBD-全部\freediag-0.3\src\diag_l2.c
文件 10948 2002-04-03 12:56 OBD-全部\freediag-0.3\src\diag_l2.h
文件 24178 2002-07-20 03:42 OBD-全部\freediag-0.3\src\diag_l2_iso14230.c
文件 3740 2002-06-19 05:58 OBD-全部\freediag-0.3\src\diag_l2_iso14230.h
文件 13276 2002-08-24 02:55 OBD-全部\freediag-0.3\src\diag_l2_iso9141.c
文件 2644 2002-01-16 04:28 OBD-全部\freediag-0.3\src\diag_l2_iso9141.h
............此处省略50个文件信息
评论
共有 条评论