| 1 | #include <stdlib.h> |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | #include "../diag.h" |
| 5 | #include "ecu.h" |
| 6 | |
| 7 | const struct ecu_info *ecu_info_by_addr(uint8_t addr) { |
| 8 | const struct ecu_info *ecu_entry; |
| 9 | for (ecu_entry = ecu_list; ecu_entry->name != NULL; ecu_entry++) { |
| 10 | if (addr == ecu_entry->addr) { |
| 11 | return ecu_entry; |
| 12 | } |
| 13 | } |
| 14 | return NULL; |
| 15 | } |
| 16 | |
| 17 | |
| 18 | const struct ecu_info *ecu_info_by_name(const char *name) { |
| 19 | const struct ecu_info *ecu; |
| 20 | |
| 21 | for (ecu = ecu_list; ecu->name != NULL; ecu++) { |
| 22 | if (strcasecmp(name, ecu->name) == 0) { |
| 23 | return ecu; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | return NULL; |
| 28 | } |
| 29 | |
| 30 | |
| 31 | |
| 32 | const struct ecu_info ecu_list[] = { |
| 33 | {0x01, "abs", "antilock brakes", "ABS"}, |
| 34 | #if 0 |
| 35 | /* |
| 36 | * Don't have an M4.3 ECU to test. Will probably need separate DTC and |
| 37 | * live data tables for M4.3. |
| 38 | */ |
| 39 | {0x10, "m43", "Motronic M4.3 engine management (DLC pin 3)", "EFI"}, /* 12700bps, KWP71 */ |
| 40 | #endif |
| 41 | {0x10, "m44old", "Motronic M4.4 engine management (old protocol)", "EFI"}, |
| 42 | {0x11, "msa", "MSA 15.7 engine management (diesel vehicles)","EFI"}, |
| 43 | /* 0x13 - Volvo Scan Tool tester address */ |
| 44 | #if 0 |
| 45 | {0x15, "m18", "Motronic M1.8 engine management (960)", "EFI"}, /* 4800bps, KWP71 */ |
| 46 | #endif |
| 47 | {0x18, "add", "912-D fuel-driven heater (cold climate option)", "HEA"}, |
| 48 | {0x29, "ecc", "electronic climate control", "ECC"}, |
| 49 | {0x2d, "vgla", "alarm", "GLA"}, |
| 50 | {0x2e, "psl", "left power seat", "PSL"}, |
| 51 | {0x2f, "psr", "right power seat", "PSR"}, |
| 52 | /* 0x33 - J1979 OBD2 */ |
| 53 | {0x41, "immo", "immobilizer", "IMM"}, |
| 54 | {0x51, "combi", "combined instrument panel", "CI"}, |
| 55 | {0x58, "srs", "airbags", "SRS"}, |
| 56 | {0x6e, "aw50", "AW50-42 transmission", "AT"}, |
| 57 | {0x7a, "m44", "Motronic M4.4 engine management", "EFI"}, |
| 58 | {0, NULL, NULL, NULL} |
| 59 | }; |
| 60 | |
| 61 | |