| 1 | #ifndef _DIAG_ISO14230_H_ |
| 2 | #define _DIAG_ISO14230_H_ |
| 3 | |
| 4 | /* |
| 5 | * freediag - Vehicle Diagnostic Utility |
| 6 | * |
| 7 | * |
| 8 | * Copyright (C) 2001 Richard Almeida & Ibex Ltd ([email protected]) |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 23 | * |
| 24 | ************************************************************************* |
| 25 | * |
| 26 | * ISO 14230 (Keyword Protocol 2000) layer 3 |
| 27 | * |
| 28 | * (c) 2001 R.P.Almeida |
| 29 | * |
| 30 | * This is NOT freely distributable |
| 31 | * Once it is complete it will be released under the Gnu public |
| 32 | * licence |
| 33 | * |
| 34 | * Read in conjunction with the ISO document, and the Swedish |
| 35 | * recommended practice documents |
| 36 | */ |
| 37 | |
| 38 | /***** ISO 14230-3, application interface *****/ |
| 39 | |
| 40 | #if defined(__cplusplus) |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
| 44 | /* |
| 45 | * Service Identifier (request) codes, names made up. |
| 46 | * Note : the strings are associated with the codes in diag_l3_iso14230.c |
| 47 | * Entries marked "SSF only !" are SIDs not defined in ISO 14230-3 but |
| 48 | * in the Swedish SSF 14230-3 document. |
| 49 | */ |
| 50 | |
| 51 | /* 00->0F SAE J1979 Diagnostic Test Modes */ |
| 52 | #define DIAG_KW2K_SI_STADS 0x10 /* startDiagnosticSession */ |
| 53 | #define DIAG_KW2K_SI_ER 0x11 /* ecuReset */ |
| 54 | #define DIAG_KW2K_SI_RDFFD 0x12 /* readFreezeFrameData */ |
| 55 | #define DIAG_KW2K_SI_RDTC 0x13 /* readDiagnosticTroubleCodes */ |
| 56 | #define DIAG_KW2K_SI_CDI 0x14 /* clearDiagnosticInformation */ |
| 57 | |
| 58 | #define DIAG_KW2K_SI_RDSODTC 0x17 /* readStatusOfDiagnosticTroubleCodes */ |
| 59 | #define DIAG_KW2K_SI_RDTCBS 0x18 /* readDiagnosticTroubleCodesByStatus */ |
| 60 | |
| 61 | #define DIAG_KW2K_SI_REID 0x1A /* readEcuId */ |
| 62 | |
| 63 | #define DIAG_KW2K_SI_STODS 0x20 /* stopDiagnosticSession */ |
| 64 | #define DIAG_KW2K_SI_RDDBLI 0x21 /* readDataByLocalId */ |
| 65 | #define DIAG_KW2K_SI_RDDBCI 0x22 /* readDataByCommonId */ |
| 66 | #define DIAG_KW2K_SI_RDMBA 0x23 /* readMemoryByAddress */ |
| 67 | |
| 68 | #define DIAG_KW2K_SI_SRDT 0x25 /* stopRepeatedDataTransmission - SSF only! */ |
| 69 | #define DIAG_KW2K_SI_SDR 0x26 /* setDataRates - SSF only!*/ |
| 70 | #define DIAG_KW2K_SI_SA 0x27 /* securityAccess */ |
| 71 | |
| 72 | #define DIAG_KW2K_SI_DDLI 0x2C /* dynamicallyDefineLocalId */ |
| 73 | #define DIAG_KW2K_SI_WRDBCI 0x2E /* writeDataByCommonId */ |
| 74 | #define DIAG_KW2K_SI_IOCBCI 0x2F /* inputOutputControlByCommonId */ |
| 75 | #define DIAG_KW2K_SI_IOCBLI 0x30 /* inputOutputControlByLocalId */ |
| 76 | #define DIAG_KW2K_SI_STARBLI 0x31 /* startRoutineByLocalID */ |
| 77 | #define DIAG_KW2K_SI_STORBLI 0x32 /* stopRoutineByLocalID */ |
| 78 | #define DIAG_KW2K_SI_RRRBLI 0x33 /* requestRoutineResultsByLocalId */ |
| 79 | #define DIAG_KW2K_SI_RD 0x34 /* requestDownload */ |
| 80 | #define DIAG_KW2K_SI_RU 0x35 /* requestUpload */ |
| 81 | #define DIAG_KW2K_SI_TD 0x36 /* transfer data */ |
| 82 | #define DIAG_KW2K_SI_RTE 0x37 /* request transfer exit */ |
| 83 | #define DIAG_KW2K_SI_STARBA 0x38 /* startRoutineByAddress */ |
| 84 | #define DIAG_KW2K_SI_STORBA 0x39 /* stopRoutineByAddress */ |
| 85 | #define DIAG_KW2K_SI_RRRBA 0x3A /* requestRoutineResultsByAddress */ |
| 86 | #define DIAG_KW2K_SI_WRDBLI 0x3B /* writeDataByLocalId */ |
| 87 | |
| 88 | #define DIAG_KW2K_SI_WRMBA 0x3D /* writeMemoryByAddress */ |
| 89 | #define DIAG_KW2K_SI_TP 0x3E /* testerPresent */ |
| 90 | #define DIAG_KW2K_SI_ESC 0x80 /* EscCode */ |
| 91 | |
| 92 | #define DIAG_KW2K_SI_SCR 0x81 /* startCommunication */ |
| 93 | #define DIAG_KW2K_SI_SPR 0x82 /* stopCommunication */ |
| 94 | #define DIAG_KW2K_SI_ATP 0x83 /* accessTimingParameters */ |
| 95 | |
| 96 | |
| 97 | /* |
| 98 | * Responses |
| 99 | * |
| 100 | * Positive responses are service ID + 0x40 |
| 101 | */ |
| 102 | #define DIAG_KW2K_RC_NR 0x7F /* negative Response */ |
| 103 | |
| 104 | |
| 105 | /* |
| 106 | * Service response codes |
| 107 | * names from ISO book |
| 108 | */ |
| 109 | |
| 110 | /* Negative Responses */ |
| 111 | |
| 112 | #define DIAG_KW2K_RC_GR 0x10 /* generalReject */ |
| 113 | #define DIAG_KW2K_RC_SNS 0x11 /* serviceNotSupported */ |
| 114 | #define DIAG_KW2K_RC_SFNS_IF 0x12 /* subFunctionNotSupported-Invalid Format */ |
| 115 | #define DIAG_KW2K_RC_B_RR 0x21 /* busy-repeatRequest */ |
| 116 | #define DIAG_KW2K_RC_CNCORSE 0x22 /* conditionsNoteCorrectOrRequestSequenceError */ |
| 117 | #define DIAG_KW2K_RC_RNC 0x23 /* routineNotCompleteOrServiceInProgress */ |
| 118 | #define DIAG_KW2K_RC_ROOT 0x31 /* requestOutOfRange */ |
| 119 | #define DIAG_KW2K_RC_SAD_SAR 0x33 /* securityAccessDenied-securityAccessRequested */ |
| 120 | #define DIAG_KW2K_RC_IK 0x35 /* invalidKey */ |
| 121 | #define DIAG_KW2K_RC_ENOA 0x36 /* exceedNumberOfAttempts */ |
| 122 | #define DIAG_KW2K_RC_RTDNE 0x37 /* requiredTimeDelayNotExpired */ |
| 123 | #define DIAG_KW2K_RC_DNA 0x40 /* downloadNotAccepted */ |
| 124 | #define DIAG_KW2K_RC_IDT 0x41 /* improperDownloadType */ |
| 125 | |
| 126 | #define DIAG_KW2K_RC_CNDTSA 0x42 /* canNotDownloadToSpecifiedAddress */ |
| 127 | #define DIAG_KW2K_RC_CNDNOBR 0x43 /* canNotDownloadNumberOfBytesRequested */ |
| 128 | #define DIAG_KW2K_RC_UNA 0x50 /* uploadNotAccepted */ |
| 129 | #define DIAG_KW2K_RC_IUT 0x51 /* improperUploadType */ |
| 130 | #define DIAG_KW2K_RC_CNUFSA 0x52 /* canNotUploadFromSpecifiedAddress */ |
| 131 | #define DIAG_KW2K_RC_CNUNOBR 0x53 /* canNotUploadNumberOfBytesRequested */ |
| 132 | #define DIAG_KW2K_RC_TS 0x71 /* transferSuspended */ |
| 133 | #define DIAG_KW2K_RC_TA 0x72 /* transferAborted */ |
| 134 | #define DIAG_KW2K_RC_IAIBT 0x74 /* illegalAddressInBlockTransfer */ |
| 135 | #define DIAG_KW2K_RC_IBCIBT 0x75 /* illegalByteCountInBlockTransfer */ |
| 136 | #define DIAG_KW2K_RC_IBTT 0x76 /* illegalBlockTrasnferType */ |
| 137 | #define DIAG_KW2K_RC_BTCDE 0x77 /* blockTransferDataChecksumError */ |
| 138 | #define DIAG_KW2K_RC_RCR_RP 0x78 /* requestCorrectyRcvd-RspPending */ |
| 139 | #define DIAG_KW2K_RC_IBCDBT 0x79 /* incorrectByteCountDuringBlockTransfer */ |
| 140 | #define DIAG_KW2K_RC_SNSIADS 0x80 /* serviceNotSupportedInActiveDiagnosticMode - SSF only !*/ |
| 141 | // Note : responses >= 0x80 are MfgSpecifiCodes in ISO14230 ! |
| 142 | |
| 143 | /* Positive Responses */ |
| 144 | |
| 145 | /* 81-8F reserved */ |
| 146 | /* 90-F9 vehicle manufacturer specific */ |
| 147 | #define DIAG_KW2K_RC_SCRPR 0xC1 /* StartComms +ve response */ |
| 148 | #define DIAG_KW2K_RC_SPRPR 0xC2 /* StopComms +ve response */ |
| 149 | #define DIAG_KW2K_RC_ATPPR 0xC3 /* AccessTimingParams +ve response */ |
| 150 | /* FA-FE system supplier specific */ |
| 151 | /* FF reserved by document */ |
| 152 | |
| 153 | /* Exports */ |
| 154 | char *diag_l3_iso14230_decode_response(struct diag_msg *, char *, const size_t); |
| 155 | |
| 156 | #if defined(__cplusplus) |
| 157 | } |
| 158 | #endif |
| 159 | #endif /* _DIAG_ISO14230_H_ */ |
| 160 | |