Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
Embed:
(wiki syntax)
Show/hide line numbers
common.h
00001 /******************************************************************************* 00002 00003 common.h - information and definitions needed by parts of Just4Trionic 00004 (c) by 2010 Sophie Dexter 00005 portions (c) 2009, 2010 by Janis Silins (johnc) 00006 00007 ******************************************************************************** 00008 00009 WARNING: Use at your own risk, sadly this software comes with no guarantees. 00010 This software is provided 'free' and in good faith, but the author does not 00011 accept liability for any damage arising from its use. 00012 00013 *******************************************************************************/ 00014 00015 #ifndef __COMMON_H__ 00016 #define __COMMON_H__ 00017 00018 //#include <stdint.h> 00019 //#include <stdbool.h> 00020 00021 #undef DEBUG 00022 #ifndef DEBUG 00023 //#define DEBUG 1 00024 //#define DEBUG 00025 #endif 00026 00027 #include "mbed.h" 00028 00029 #include "sizedefs.h" 00030 #include "strings.h" 00031 #include "interfaces.h" 00032 #include "t8bootloaders.h" 00033 #include "t5bootloaders.h" 00034 00035 // build configuration 00036 //#define IGNORE_VCC_PIN ///< uncomment to ignore the VCC pin 00037 00038 // constants 00039 #define FW_VERSION_MAJOR 0x1 ///< firmware version 00040 #define FW_VERSION_MINOR 0x6 00041 00042 #define CR 0x0D 00043 #define NL 0x0A 00044 #define BELL 0x07 00045 00046 #define TRUE 1 00047 #define FALSE 0 00048 00049 00050 // bit macros 00051 #define SETBIT(x,y) (x |= (y)) ///< set bit y in byte x 00052 #define CLEARBIT(x,y) (x &= (~(y))) ///< clear bit y in byte x 00053 #define CHECKBIT(x,y) (((x) & (y)) == (y)) ///< check bit y in byte x 00054 00055 // command return flags and character constants 00056 #define TERM_OK 13 ///< command terminator or success flag 00057 #define TERM_ERR 7 ///< error flag 00058 #define TERM_BREAK 0x1b ///< command break flag 00059 00060 #define ERR_COUNT 255 ///< maximum error cycles 00061 00062 #define FILE_BUF_LENGTH 0x1000 ///< file buffer size 00063 static char file_buffer[FILE_BUF_LENGTH]; ///< file buffer 00064 00065 static const uint8_t T8BootloaderRead[] = T8_BOOTLOADER_DUMP; 00066 static const uint8_t T8BootLoaderWrite[] = T8_BOOTLOADER_PROG; 00067 00068 static const uint8_t T5BootLoader[] = MYBOOTY; 00069 00070 // FLASH chip manufacturer id values 00071 #define AMD 0x01 00072 #define CSI 0x31 00073 #define INTEL 0x89 00074 #define ATMEL 0x1F 00075 #define SST 0xBF 00076 #define ST 0x20 00077 #define AMIC 0x37 00078 00079 // FLASH chip type values 00080 #define INTEL28F512 0xB8 00081 #define AMD28F512 0x25 00082 #define INTEL28F010 0xB4 // and CSI 00083 #define AMD28F010 0xA7 00084 #define AMD29F010 0x20 // and ST 00085 #define ATMEL29C512 0x5D 00086 #define ATMEL29C010 0xD5 00087 #define SST39SF010 0xB5 00088 #define ST29F010 0x20 00089 #define AMICA29010L 0xA4 00090 #define AMD29F400T 0x23 00091 #define AMD29F400B 0xAB // !!! NOT USED IN T7 !!! 00092 //#define 29F400T 0x2223 00093 //#define 29F400B 0x22AB 00094 #define AMD29BL802C 0x81 00095 //#define AMD29BL802C 0x2281 00096 00097 00098 // TRIONIC ECU Start addresses 00099 #define T52FLASHSTART 0x60000 00100 #define T55FLASHSTART 0x40000 00101 #define T7FLASHSTART 0x00000 00102 #define T8FLASHSTART 0x00000 00103 00104 // TRIONIC ECU FLASH sizes 00105 #define T52FLASHSIZE 0x20000 00106 #define T55FLASHSIZE 0x40000 00107 #define T7FLASHSIZE 0x80000 00108 #define T8FLASHSIZE 0x100000 00109 00110 // TRIONIC ECU Last address 00111 #define TRIONICLASTADDR 0x7FFFF 00112 00113 // TRIONIC ECU RAM sizes 00114 #define T5RAMSIZE 0x8000 00115 #define T7RAMSIZE 0x8000 00116 00117 // Initial Stack pointer values used by Trionic (1st 4 bytes of BIN file) 00118 #define T5POINTER 0xFFFFF7FC 00119 #define T7POINTER 0xFFFFEFFC 00120 #define T8POINTER 0x00100C00 00121 00122 // public functions 00123 void led_on(uint8_t led); 00124 bool ascii2int(uint32_t* val, const char* str, uint8_t length); 00125 00126 #endif // __COMMON_H__ 00127 00128 //----------------------------------------------------------------------------- 00129 // EOF 00130 //-----------------------------------------------------------------------------
Generated on Fri Jul 15 2022 00:43:05 by 1.7.2