Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
Embed:
(wiki syntax)
Show/hide line numbers
t5utils.h
00001 00002 // t5utils.h - information and definitions needed for communicating with the T5 ECU 00003 00004 // (C) 2010, Sophie Dexter 00005 00006 #ifndef __T5UTILS_H__ 00007 #define __T5UTILS_H__ 00008 00009 #include "mbed.h" 00010 00011 #include "common.h" 00012 #include "canutils.h" 00013 00014 #define CMNDID 0x05 00015 #define ACK_ID 0x06 00016 #define RESPID 0x0C 00017 #define RSETID 0x08 00018 00019 #define T5_RDCMND {0xC4,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} // C4 Command template for reading something from the T5 ECU 00020 #define T5_WRCMND {0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C4 Command template for writing something to the T5 ECU 00021 #define T5ACKCMND {0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C6 Command for acknowledging receipt of last message from T5 ECU or 00022 // asking it to send some more data (e.g. symbol table) I'm not sure which :lol: 00023 #define T5_BTCMND {0xA5,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // A5 Command template for sending a bootloader to the T5 ECU 00024 #define T5JMPCMND {0xC1,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C1 Command template for starting a bootloader that has been sent to the T5 ECU 00025 #define T5EOFCMND {0xC3,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C3 Command for reading back the last address of FLASH in the T5 ECU 00026 #define T5A_DCMND {0xC5,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C5 Command for setting analogue to digital registers (don't know what this is for) 00027 #define T5RAMCMND {0xC7,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C7 Command for reading T5 RAM (all the symbols and adaption data is in RAM) 00028 00029 00030 #define T5ERACMND {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C0 Command for erasing T5 FLASH Chips !!! (Bootloader must be loaded before using) 00031 #define T5RSTCMND {0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C2 Command for exiting the Bootloader and restarting the T5 ECU (Bootloader must be loaded before using) 00032 #define T5SUMCMND {0xC8,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C8 Command for reading T5 FLASH Checksum (Bootloader must be loaded before using) 00033 #define T5TYPCMND {0xC9,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C9 Command for reading T5 FLASH Chip types (Bootloader must be loaded before using) 00034 00035 #define T5STARTMSG {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00} // T5 sends this message whenever the ignition is turned on? - message id is RESPID 00036 #define T5RESETMSG {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} // T5 sends this message to say that it has reset - message id is RSETID 00037 00038 #define T5MESSAGETIMEOUT 500 // 500 milliseconds (half a second) - Seems to be plenty of time to wait for messages on the CAN bus 00039 #define T5CHECKSUMTIMEOUT 2000 // 2 seconds (2,000 milliseconds) - Usually takes less than a second so allowing 2 is plenty 00040 #define T5ERASETIMEOUT 40000 // 40 seconds (60,000 milliseconds) - Usually takes less than 20 seconds so allowing 40 is plenty 00041 00042 extern bool T5Open(); 00043 extern bool T5Close(); 00044 extern char T5WaitResponse(); 00045 extern bool T5WaitResponsePrint(); 00046 extern char *T5GetSymbol(char *a_symbol); 00047 extern bool T5ReadCmnd(char c); 00048 extern bool T5WriteCmnd(uint32_t addr, char data); 00049 extern bool t5_can_read_data(char *data, uint32_t addr); 00050 extern bool T5Ack(); 00051 extern bool t5_can_send_boot_address(uint32_t addr, uint8_t len); 00052 extern bool t5_can_send_boot_frame(char *T5TxMsg); 00053 extern bool T5StartBootLoader (uint32_t addr); 00054 00055 extern bool t5_boot_checksum_command(uint32_t* result); 00056 extern bool t5_boot_reset_command(); 00057 extern bool t5_boot_get_flash_type(uint32_t* result, uint8_t* make, uint8_t* type); 00058 extern bool t5_boot_erase_command(); 00059 extern bool t5_boot_c3_command(uint32_t* result, uint16_t* mode); 00060 00061 #endif
Generated on Fri Jul 15 2022 00:43:05 by 1.7.2