Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
T5Utils.h
- Committer:
- Just4pLeisure
- Date:
- 2010-05-19
- Revision:
- 0:e0b964252a05
File content as of revision 0:e0b964252a05:
// T5Utils.h - information and definitions needed for communicating with the T5 ECU #include "mbed.h" #include "CANUtils.h" #define TRUE 1 #define FALSE 0 #define CMNDID 0x05 #define ACK_ID 0x06 #define RESPID 0x0C #define T5_RDCMND {0xC4,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} // C4 Command template for reading something from the T5 ECU #define T5_WRCMND {0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C4 Command template for writing something to the T5 ECU #define T5ACKCMND {0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C6 Command for acknowledging receipt of last message from T5 ECU or // asking it to send some more data (e.g. symbol table) I'm not sure which :lol: #define T5_BTCMND {0xA5,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // A5 Command template for sending a bootloader to the T5 ECU #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 #define T5EOFCMND {0xC3,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C3 Command for reading back the last address of FLASH in the T5 ECU #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) //#define T5RAMCMND {0xC7,0x00,0x00,0x00,0x00,0xFC,0xC4,0x77} // C7 Command for reading T5 RAM (all the symbols and adaption data is in RAM) #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) #define T5DMPCMND {0xA6,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // A6 Command for dumping the T5 FLASH BIN file (Bootloader must be loaded before using) #define T5ERACMND {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C0 Command for erasing T5 FLASH Chips !!! (Bootloader must be loaded before using) #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) #define T5SUMCMND {0xC8,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C8 Command for reading T5 FLASH Checksum (Bootloader must be loaded before using) #define T5TYPCMND {0xC9,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C9 Command for reading T5 FLASH Chip types (Bootloader must be loaded before using) #define T5MESSAGETIMEOUT 500 // 500 milliseconds (half a second) - Seems to be plenty of time to wait for messages on the CAN bus #define T5CHECKSUMTIMEOUT 60000 // 60 seconds (60,000 milliseconds) - Usually takes less than 2 seconds so allowing 10 is plenty // - Increased to 60 seconds for now because using it as erase timeout too extern bool T5Open(); extern bool T5Close(); extern char T5WaitResponse(); extern bool T5WaitResponsePrint(); extern char *T5GetSymbol(char *a_symbol); extern bool T5ReadCmnd(char c); extern bool T5WriteCmnd(unsigned int addr, char data); extern char *T5ReadRAM(char *data, unsigned int addr); extern char *T5ReadFLASH(char *data, unsigned int addr); extern bool T5RAMCmnd(unsigned int addr); extern char *T5WaitRAM(char *data); extern bool T5Ack(); extern bool T5SendBootAddress(unsigned int addr, int len); extern bool T5SendBootFrame (char *frame); extern bool T5StartBootLoader (unsigned int addr); extern bool T5BootCSumCmnd(); extern bool T5BootResetCmnd(); extern bool T5BootFLASHType(); extern bool T5BootEraseCmnd(); extern bool T5BootDumpFLASHCmnd(); extern char *T5WaitFLASH(char *data); extern bool T5BootC3Command();