/*=========================================================================*/ /* File: c:\cproj\UPT_xx\logtypes.h */ /* Purpose: Definition of the file structure in MKT's CAN-LOG-FILES . */ /* Author: Wolfgang Buescher (for MKT Systemtechnik) */ /* Revision: 2017-10-19 (YYYY-MM-DD) */ /* */ /* Caution: This file is used by */ /* - the CAN LOGGER FIRMWARE */ /* - the CAN LOGGER CONFIGURATION / FILE CONVERSION UTILITY */ /* This file is PUBLISHED as c:\cbproj\CanLoggerUtility\Help\logtypes.txt, */ /* so keep it clean & tidy ! */ /* */ /* Excerpt from the CAN logger revision history (latest entry first) : */ /* */ /* 2017-10-19: Modified the 'BULK' object (CANLOG_UNION_TYPE_BULK) : */ /* Shorter size in the logfile, up to 3 variables per 16-byte */ /* block. Removed CANLOG_UNION_TYPE_BULK_SIZE4 for that. */ /* */ /* 2014-12-09: Added T_CanLog_BinaryHeader512.dwFirmwareArticleNumber */ /* to tell logfiles produced by MKT-View II/III/IV/etc */ /* from each other. */ /* */ /* 2014-01-29: Added the 'BULK' object (CANLOG_UNION_TYPE_BULK) . */ /* First used to log SCRIPT VARIABLES declared as 'logged:' . */ /* */ /* 2014-01-20: Added the option CANLOG_TRIGOPT_DONT_STOP_ON_NOT_START . */ /* Note the 'inversion' for the sake of compatibility ! */ /* */ /* 2011-02-02: Added the option 'fReceiveErrorFrames', only usable if the */ /* CAN driver supports the interrupt-driven reception of */ /* CAN error frames (aka violations of the BIT STUFFING rule) */ /* */ /* 2008-01-24: Adapted the CAN-Logger for ARM7 CPUs (LPC2468) . */ /* 'LWORD' was renamed to 'DWORD' (32-bit unsigned integer) . */ /* */ /* 2006-07-21: Added support for 64-BIT(!)-signals because someone */ /* said they would return all their terminals to the manufacturer */ /* if MKT didn't add support for 64bit-CANdb-signals . */ /* These mods can be undone (if they don't work properly) by undefining */ /* USE_64BIT_SIGNALS under "Project..Options....Conditionals" . */ /* */ /* 2005-11-03 : Added a few new structs for logging GPS DATA . */ /* */ /* 2005-10-12 : Added wMsgRateLimit_10ms in T_CanLog_MsgDef . */ /* */ /* 2004-08-19 : Clarified the relation between TIMESTAMP and ABSOLUTE TIME:*/ /* The "ABSOLUTE TIME" in a "tim" entry in the logfile */ /* must be added to the "TIMESTAMP" (in seconds of course). */ /* */ /* 2004-05-17 : Removed the SIGNAL DEFINITION TABLE from T_CanLog_CFG */ /* and put them into an own struct named T_CanLog_SigTab */ /* to support a view more signals (140 instead of 95) */ /* */ /* 2004-05-13 : Added sz80DatabaseBus1 + sz80DatabaseBus2 in the config, */ /* had to reduce CANLOG_MAX_LOGGED_SIGNALS to 95 to keep */ /* sizeof( T_CanLog_CFG ) < 16384 . */ /* */ /* 2004-05-12 : Someone wanted to have more loggable SIGNALS . */ /* -> increased CANLOG_MAX_LOGGED_SIGNALS from 48 to 96 . */ /* MESSAGE- and NODE NAME had to be removed from T_CanLog_SigDef */ /* because the T_CanLog_CFG structure grew above 16 kByte */ /* which cannot be handled by Tasking C166 (and the C167 itself). */ /* */ /* 2004-05-10 : Implemented a few 'extras' for DC; most important: */ /* - A new BINARY HEADER between TEXT HEADER and LOG DATA, */ /* named 'T_CanLog_BinaryHeader512' . */ /* The analysis tool must skip this header when detected */ /* by the presence of the string "BinaryLogfileHeader" */ /* at the begin of a new disk sector */ /* (file position divideable by 512) . */ /* - Clarified the coding of the BUS NUMBER in T_CanLog_MsgData . */ /* */ /* */ /* */ /*=========================================================================*/ #ifndef _LOGTYPES_H_ #define _LOGTYPES_H_ #include // Contains data types like BYTE, WORD, DWORD, BLONG, INT16... // (BLONG is a byte-addressable 32-bit integer value, defined as // typedef union { // byte- und word- adressierbarer Datentyp "long" // BYTE b[4]; // als Index **NUR** BL_LO, BL_ML, BL_MH oder BL_HI verwenden !! // BWORD w[2]; // als "zwei BYTE-ADRESSIERBARE WORDs [BL_LW] [BL_HW] // signed long l; // unsigned long ul; // float flt; // added 2004-04-01, use this to combine 4 bytes // // into a 32-bit-FLOAT value a la IEE 754-1985 . // } BLONG; // Today, for ARM & Co, little endian: BL_LO=0, BL_ML=1, BL_MH=2, BL_HI=3 . // Long ago, for 8051-compatible CPUs: BL_LO=3, BL_ML=2, BL_MH=1, BL_HI=0 . // < end of info about the BLONG type > //--------------------------------------------------------------------------- // CONSTANTS //--------------------------------------------------------------------------- // Max number of different LOGGED MESSAGE IDENTIFIERS and/or SIGNALS, shared by all buses. // Must be less than CANLOG_MAX_RX_IDENTIFIERS ! // This limitation is published in the description of the CAN Logger Utility, // master copy in C:\cbproj\CanLoggerUtility\help\logutlXX.htm . // To compile the CAN LOGGER UTILITY / CAN LOGFILE CONVERTER from the same // sourcecode, the following definitions may be overridden by earlier def's // in SWITCHES.H (at MKT, SWITCHES.H contains PROJECT-SPECIFIC switches). // When changing these definitions (only allowed for NEW logger 'families'), // also modify CanLog_GetMaxNumberOfSignals() + CanLog_GetMaxNumberOfMessages(). #ifndef CANLOG_MAX_LOGGED_MESSAGES # error "CANLOG_MAX_LOGGED_MESSAGES should be defined in SWITCHES.H now !" # define CANLOG_MAX_LOGGED_MESSAGES 48 #endif #ifndef CANLOG_MAX_LOGGED_SIGNALS # error "CANLOG_MAX_LOGGED_SIGNALS should be defined in SWITCHES.H now !" # define CANLOG_MAX_LOGGED_SIGNALS 140 /* <- firmware-specific; this is the MAXIMUM */ #endif // Max number of "flexible numeric expressions" which shall be logged. // See definition of T_CanLog_ExprDef . // These expressions are evaluated in the MAIN LOOP, so don't expect // a high resolution in the time domain ! // 2014-01-29 : SCRIPT-VARIABLES declared as 'logged' are also // treated like a 'logged expression', thus we need // more of these for the MKT-View II / III / IV: // CANLOG_MAX_LOGGED_EXPRESSIONS increased from 8 to 64, // after the introduction of the 'BULK' object for storage // which uses only ONE timestamp per sampling point, // and allows an almost unlimited number of channels per sample. #define CANLOG_MAX_LOGGED_EXPRESSIONS 64 #define CANLOG_MAX_LOGGED_STRINGS 8 /* <- only applies to firmware w/o dynamic string allocation */ // Max number of "GPS OUTPUT COLUMNS" in the exported file. // The contents of the GPS-columns are defined on the // tabsheet "GPS Converter Output Options" of the conversion utility. #define CANLOG_MAX_GPS_OUTPUT_COLUMNS 8 // Max number of trigger signals. Originally 4 as in Kvaser's "Memorator" . // Can NOT easily be changed due to the fixed dialog screen in the config tool. // In 2008-06, when development of the MKT-View II (with ARM-7 CPU) began, // the number of trigger signals was increased to 10, but ONLY for the // programming tool (which shall support BOTH MKT-Views) ! // If the compiler is for the Infineon C166, we know we're compiling // the "old" MKT-View I firmware . // In 2008-11, CanLog_GetMaxNumberOfTriggerSignals() was implemented to retrieve // this information (depending on T_CanLog_Config.iLoggerDeviceFamily) . // (Motivation: Who knows how many different 'families' we will have // in future; all of them shall be supported by ONE configuration utility) #if(defined _C166) || (defined __C166__) /* C166 by Tasking, or by Keil ? */ # define CANLOG_N_TRIGGER_SIGNALS 4 #else /* we're compiling the config tool, or the MKT-View II/III/IV firmware: */ # define CANLOG_N_TRIGGER_SIGNALS 10 #endif // Trigger COMPARE operators . Must match the COMBO LISTS in the config tool ! // DO NOT CHANGE (only extend if needed) TO REMAIN COMPATIBLE WITH "logger.clc" ! #define CANLOG_COMPARE_LESS 0 /* < */ #define CANLOG_COMPARE_LESS_EQUAL 1 /* <= */ #define CANLOG_COMPARE_GREATER 2 /* > */ #define CANLOG_COMPARE_GREATER_EQUAL 3 /* >= */ #define CANLOG_COMPARE_EQUAL 4 /* == , ONLY for MKT-View II since 2009 */ #define CANLOG_COMPARE_NOTEQUAL 5 /* != , ONLY for MKT-View II since 2009 */ #define CANLOG_COMPARE_BITWISE_AND 6 /* & , ONLY for MKT-View II since 2009 */ // Trigger COMBINE operators . Must match the COMBO LISTS in the config tool ! // When modifying these values, also modify CanLog_CombineTriggerConditions() ! #define CANLOG_COMBINE_NONE 0 // in MKT-VIEW I, this marks an UNUSED entry #define CANLOG_COMBINE_NEW_START 0 // in MKT-VIEW II, this begins a new STOP-condition ! #define CANLOG_COMBINE_AND 1 #define CANLOG_COMBINE_OR 2 #define CANLOG_COMBINE_NEW_STOP 4 // in MKT-VIEW II, this begins a new STOP-condition ! #define CANLOG_COMBINE_UNUSED -1 // for MKT-VIEW II, added 2010-02-11 // Trigger OPTIONS : Bitmasks for T_CanLog_CFG.wTriggerOptions . Since 2004-12 #define CANLOG_TRIGOPT_NORMAL 0x0000 /* .. means STATE- not EDGE-triggered */ #define CANLOG_TRIGOPT_START_P_EDGE 0x0001 /* start on positive EDGE of combined start-cond's */ #define CANLOG_TRIGOPT_START_N_EDGE 0x0002 /* start on negative EDGE of combined start-cond's */ #define CANLOG_TRIGOPT_STOP_P_EDGE 0x0004 /* stop on positive EDGE of combined stop-cond's */ #define CANLOG_TRIGOPT_STOP_N_EDGE 0x0008 /* stop on negative EDGE of combined stop-cond's */ #define CANLOG_TRIGOPT_PRE_AND_POST_ONLY 0x0010 /* no endless recording, only PRE-and POST-trigger-phase */ #define CANLOG_TRIGOPT_DONT_STOP_ON_NOT_START 0x0020 /* when cleared, if NO STOP CONDITION IS DEFINED, stop when the start condition is FALSE */ // Since 2014-01-20, evaluated in c:\cproj\UPT_xx\canlog2.C :: CanLog_CalculateTriggerCondition() . // Note the 'inversion' (.._DONT_..) for the sake of compatibility ! // Data types and structures for buffering and disk storage. // Note on the struct sizes (important for old MKT-View "Plus"): // There are 512 bytes in a disk sector, which is the smallest // unit which can be written. // 512 divided by sizeof(T_CanLog_BUFFERED_MSG) must be a round number. // The only realistic size is 16 byte, which means 32 CAN-messages per sector. // The next "possible" size would be 32 byte/message or 16 messages/sector // which would be an enormous waste of disk space and CPU time . // For later devices (MKT-View II, III with ARM-CPU and new file system), // crossing disk sector boundaries when writing blocks doesn't affect // performance (as long as fseek operations are avoided), // thus 'objects' embedded in the logged data stream larger than 16 bytes // are allowed now (since 2014, NOT for older MKT-Views) . // Bits 7+6 of the 1st byte [=LSByte] in every T_CanLog_LoggingUnion (bTypeFlags) // indicates the type of data actually present in there : #define CANLOG_UNION_TYPE_MSG 0x00 // it's a CAN-message or error-frame (bus number coded in 32-bit-ID-field) #define CANLOG_UNION_TYPE_HDR 0x40 // it's a HEADER ( -> an UPPER CASE LETTER or '@') of a different block #define CANLOG_UNION_TYPE_DATA 0x80 // some 'other 16-byte object' (not a CAN message, but EVAL'd EXPRESSION, GPS, Dummy, etc) #define CANLOG_UNION_TYPE_BULK 0xC0 // it's a 'bulky' data object, size N*16 bytes, with different encodings #define CANLOG_UNION_TYPE_MASK 0xC0 // mask to check the two 'TYPE'-bits (b7+b6) // The meaning of bits 5+4 depend on the 'TYPE' as defined above ............ // If bits 7+6 = 10b = DATA, in this case bit 5+4 define WHAT KIND of datum : #define CANLOG_UNION_TYPE_DATA_MASK 0x30 // mask for T_CanLog_LoggingUnion.msg.bTypeFlags, bit 5+4 ... #define CANLOG_UNION_TYPE_DATA_EXPR 0x10 // DATA, here: "evaluated expression" from interpreter, may be an emty dummy #define CANLOG_UNION_TYPE_DATA_GPS 0x20 // DATA, here: "data from a GPS receiver" // If bits 7+6 = 11b = 'BULK' data, then bits 5+4 may be used to tell different structures; // the actual length of the 'bulk' block may be encoded in the lower 4 bits // (for up to FIFTEEN times 16 bytes), or follows in the 2nd, 3rd, and 4th byte (for 'very large' blocks): #define CANLOG_UNION_TYPE_BULK_T_MASK 0x30 // actually the same bits as for CANLOG_UNION_TYPE_DATA_MASK #define CANLOG_UNION_TYPE_BULK_T_EXPR 0x10 // BULK, here: "evaluated expressions" or logged SCRIPT VARIABLES (plural!) #define CANLOG_UNION_TYPE_BULK_T_RSV1 0x20 // reserved for future use of the 'BULK' object #define CANLOG_UNION_TYPE_BULK_T_RSV2 0x30 // reserved for future use of the 'BULK' object #define CANLOG_UNION_TYPE_BULK_T_OTHER 0x00 // "other" type of BULK data (encoded in the block itself, future plan) #define CANLOG_UNION_TYPE_BULK_S_MASK 0x0F // lower 4 bits of the first byte is used as SIZE indicator: // 0000bin = "the size of the BULK block follows in the 2nd and 3rd byte, measured in BYTES" (for 'large' blocks, up to 65535 Byte) // 0001bin = "the BULK block consists of 16 bytes" (shortest possible block) // 0010bin = "the BULK block consists of TWO times 16 bytes" (=32 bytes) // 0011bin = "the BULK block consists of THREE times 16 bytes" (=48 bytes), etc etc, ... // 1111bin = "the BULK block consists of FIFTEEN * 16 bytes" (=240 bytes). # define CANLOG_UNION_TYPE_BULK_SIZE2 0x00 /* bulk size measured in bytes, as TWO-BYTE FIELD after the header */ // ex:define CANLOG_UNION_TYPE_BULK_SIZE4 0x01 /* bulk size measured in bytes, as FOUR-BYTE FIELD after the header */ // |-> removed 2017-10-19 in favour of 16-byte bulk blocks. // Anything after the above 4-bit or 2-byte size indicator // depends on the BULK-type. For CANLOG_UNION_TYPE_BULK_T_EXPR, // the next element will be a 32-bit timestamp . Details in // C:\cproj\UPT_xx\canlog2.c :: CanLog_FlushExprResultsToBuffer() . // If bits 7+6 = 00b = (CAN-)MSG, then bits 5+4 may be used to indicate 'special' CAN messages: #define CANLOG_UNION_TYPE_MSG_SUBMASK 0x30 #define CANLOG_UNION_TYPE_MSG_RTR 0x10 // not a normal CAN message but an "RTR" (Remote Transm. Request) #define CANLOG_UNION_TYPE_MSG_ERROR 0x20 // not a normal CAN message but an "ERROR FRAME" #define CANLOG_UNION_TYPE_MSG_RSV 0x30 // not a normal CAN message but "something else" // The lower nibble is the count of data bytes for CAN messages (CANLOG_UNION_TYPE_MSG), // or (here for CANLOG_UNION_TYPE_DATA:) identifies a CANopen data type // or some "other specials" which may be logged. // The same data type codes (CANLOG_UNION_DATA_TYPE_..) are also // used internally, at least in C:\cproj\UPT_xx\canlog2.c . // Subcodes in bTypeFlags, for bit 7..4 = 1001b = "DATA, evaluated expressions" : #define CANLOG_UNION_DATA_TYPE_UNKNOWN 0x00 #define CANLOG_UNION_DATA_TYPE_BOOLEAN 0x01 #define CANLOG_UNION_DATA_TYPE_INTEGER8 0x02 #define CANLOG_UNION_DATA_TYPE_INTEGER16 0x03 #define CANLOG_UNION_DATA_TYPE_INTEGER32 0x04 #define CANLOG_UNION_DATA_TYPE_UNSIGNED8 0x05 #define CANLOG_UNION_DATA_TYPE_UNSIGNED16 0x06 #define CANLOG_UNION_DATA_TYPE_UNSIGNED32 0x07 #define CANLOG_UNION_DATA_TYPE_REAL32 0x08 /* aka 'single precision floating point' */ #define CANLOG_UNION_DATA_TYPE_REAL64 0x11 /* aka 'double precision floating point' */ #define CANLOG_UNION_DATA_TYPE_VISIBLE_STRING 0x09 #define CANLOG_UNION_DATA_TYPE_OCTET_STRING 0x0A // data types 0x0B .. 0x0F are reserved for "future use" (not CANopen compatible) // Subcodes in bTypeFlags, for bit 7..4 = 1010b = "something from a GPS receiver" : #define CANLOG_UNION_GPS_1 0x01 /* */ #define CANLOG_UNION_GPS_2 0x02 /* */ #ifndef C_CAN_29_BIT_ID_FLAG /* usually defined in MKT's universal CAN driver: */ #define C_CAN_29_BIT_ID_FLAG 0x20000000L /* Maske fuer 29-Bit-Flag */ #define C_CAN_ALL_ID_BITS 0x1FFFFFFFL /* Maske fuer "alle ID-Bits" */ #define C_CAN_ID_MASK_BUS2 0x40000000L /* Bitmaske fuer "Messages von Bus 2" */ #define C_CAN_ID_MASK_BUS3 0x80000000L /* Bitmaske fuer "Messages von Bus 3/4 (Reserve) */ #endif //--------------------------------------------------------------------------- // DATA TYPES //--------------------------------------------------------------------------- #ifdef __WIN32__ // WINDOZE, most likely compiling the logfile converter... use DOUBLE PRECISION floats: #define LOGHDR_FLOAT double #else // not WINDOZE, but a real microcontroller... use SINGLE PRECISION floats: #define LOGHDR_FLOAT float #endif //------------------ Data types ------------------------------------------ // 2006-07-21: Tried to support the conversion of 64-BIT(!)-signals because // someone said they would return all their terminals to the manufacturer // if MKT didn't add support for 64bit-CANdb-signals . // These mods can be "undone" (if they don't work) by undefining // USE_64BIT_SIGNALS under "Project..Options....Conditionals" // ( various modules, like logtypes.h, CanLogU1.cpp, and Cmsg2raw.c, // test if USE_64BIT_SIGNALS is defined or undefined ). #ifndef USE_64BIT_SIGNALS // Since 2017-08, if the UPT firmware is compiled with support for 'double', // tRawSignalValue must support 64-bit because it's used for some tricky // data type conversions in UptProt2_MapVariableIntoTxMessage() : # ifdef SWI_CLI_FLOAT_CALCULATION /* 0=no float, 1=single precision, 2=double precision ? */ # if( SWI_CLI_FLOAT_CALCULATION == 2 ) // if the command line interpreter supports 'double', # define USE_64BIT_SIGNALS // tRawSignalValue must be a 64-bit type ! # endif // CLI supports 64-bit floating point ("double precision") ? # endif // def'd SWI_CLI_FLOAT_CALCULATION ? #endif // ndef USE_64BIT_SIGNALS ? #ifndef tRawSignalValue #ifdef USE_64BIT_SIGNALS #define tRawSignalValue __int64 #else /* older variant which only supported 32-bit... */ #define tRawSignalValue long #endif // ndef USE_64BIT_SIGNALS #endif // ndef tRawSignalValue #ifdef __WIN32__ // only for the LOGGER TOOL : typedef struct // T_CLT_LoggedValue : Data for ONE COLUMN in the output file { BOOL fValid; // TRUE='value is valid', FALSE=not valid . int iDataType; // CANLOG_UNION_DATA_TYPE_UNKNOWN, // CANLOG_UNION_DATA_TYPE_UNSIGNED32, // CANLOG_UNION_DATA_TYPE_REAL32, // CANLOG_UNION_DATA_TYPE_REAL64, // CANLOG_UNION_DATA_TYPE_VISIBLE_STRING , struct // became utterly complicated since we must support INTEGER (ex-)or FLOATING POINT here ! { union { tRawSignalValue ii; // up to 64 bit INTEGER double dbl; // or a 64-bit DOUBLE (single float converted into this) } u; BOOL is_float; // FALSE=use iiDecoded.u.i64; TRUE=use iiDecoded.u.dbl } iiDecoded; // raw signal value, 32- or 64-bit-integer, or even float ! ! // (ex: "i32Decoded" until 2006-07-21) char sz255[256]; // added 2014-02-03 for LOGGED SCRIPT VARIABLES (which may be strings) double dblScaled; double dblScaledMin; double dblScaledMax; } T_CLT_LoggedValue; typedef struct // T_CLT_LoggedValues : for ALL DATA COLUMNS in the output file { int idxFirstSignal; // kind of "directory" for the array below.. int idxLastSignal; int idxFirstExpression; int idxLastExpression; int idxFirstGpsColumn; int idxLastGpsColumn; #define CANLOG_MAX_TOTAL_COLUMNS (CANLOG_MAX_LOGGED_SIGNALS+CANLOG_MAX_LOGGED_EXPRESSIONS+CANLOG_MAX_GPS_OUTPUT_COLUMNS) T_CLT_LoggedValue val[CANLOG_MAX_TOTAL_COLUMNS]; // CanLogCvt_LoggedValues.val[] contains *ALL* 'current' values, inluding // CAN-signals, evaluated expressions, and GPS data (but not the two time channels yet). // Array Index Range into CanLogCvt_LoggedValues[] : // col[idxLoggedValueFirstSignal..idxLoggedValueLastSignal] // are ALWAYS CAN-Signals (some of them may be "unused"); // col[idxLoggedValueFirstExpression .. idxLoggedValueLastExpression] // are values from EVALUATED EXPRESSIONS; // col[idxLoggedValueFirstGpsColumn .. idxLoggedValueLastGpsColumn ] // are scaled GPS-VALUES (any sequence, any scaling, as // defined on the tabsheet "GPS Converter Output Options") } T_CLT_LoggedValues; // ... still in the conditional part with __WIN32__ ... # define CANLOG_USE_64BIT_UNIX_SECONDS 1 /* dare to use 64 bit integer here ? Yes, of course ! */ # ifndef LONGLONG // Yet another shabby non-standardized data type. // When compiling 'for windows', LONGLONG is defined // in WINNT.H as follows: typedef __int64 LONGLONG; # endif // ndef LONGLONG ? # define T_CANLOG_UNIX_SECONDS LONGLONG #else // ! __WIN32__, i.e. not compiling the CAN LOGGER UTILITY but the DEVICE FIRMWARE: # define CANLOG_USE_64BIT_UNIX_SECONDS 0 /* dare to use 64 bit integer here ? Better don't ! */ # define T_CANLOG_UNIX_SECONDS unsigned long #endif // __WIN32__ ? typedef union // T_CanLog_IEEE754_SGL = SINGLE PRECISION FLOAT, IEEE-754 { // More info in CANLOG2.C ! float flt; BYTE b[4]; DWORD dw; // If the CPU uses a 'good' byte order, the value can be 'transported' as a DWORD. // For example, in C:\cproj\UPT_xx\canlog2.c :: CanLog_FlushExprResultsToBuffer(). } T_CanLog_IEEE754_SGL; typedef union // T_CanLog_IEEE754_DBL = DOUBLE PRECISION FLOAT, IEEE-754 { // More info in CANLOG2.C ! double dbl; BYTE b[8]; DWORD dw[2]; // ARM/Cortex prefer moving data in 2 * 32 bit units } T_CanLog_IEEE754_DBL; // Don't rely on the proper implementation of 'NaN' (some embedded compilers don't), // instead use the following to mark a floating-point value as 'invalid' : #define CANLOG_ILLEGAL_FLOAT_VALUE -9999999999E9 /* added 2014-01-23 for logging SCRIPT variables */ // Definitions for the BYTE ORDER when placing FLOATS in memory : #ifdef _C166 // nur TASKING C166 : // Caution, TASKING's "float" is IEE-754 with a very strange byte order ! // A test with C166 showed: 1.00196 = 0x3F804020 = 0x80 3F 20 40 (!) #define IEEE_SGL_MANTISSA_HI 0 #define IEEE_SGL_EXPONENT 1 #define IEEE_SGL_MANTISSA_LO 2 #define IEEE_SGL_MANTISSA_MID 3 #else // nicht TASKING sondern vermutlich BORLAND C++ Builder: // Borland: Couldn't find a detailed description of a 'float' in memory, // but it seems to follow INTELs little-endian way ('low-byte first'). // The same format is also used by CANopen, data type 0x08 . // AND, THIS 'LOGICAL' BYTE ORDER IS ALSO USED IN THE LOGFILES ! // (not Tasking's strange stuff, though the CPU in the logger is a C166) #define IEEE_SGL_MANTISSA_LO 0 #define IEEE_SGL_MANTISSA_MID 1 #define IEEE_SGL_MANTISSA_HI 2 #define IEEE_SGL_EXPONENT 3 #endif // Borland C++ , INTEL CPU, also used in CANopen and MKT's logfiles typedef struct // T_CanLog_MsgData : total size MUST be exactly 16 byte . { // This data type defines the basic structure // of the 16-byte-entries in the BINARY SECTION // in all 'primary' LOGFILES (e.g. files with extension "cld") ! // The first byte must have identic meaning for all components of T_CanLog_LoggingUnion ! BYTE bTypeFlags; // Bit 7,6 : Union Type Code. CANLOG_UNION_TYPE_MSG, CANLOG_UNION_TYPE_HDR, etc. // Bit 5,4 : Union type extension, ignore for CANLOG_UNION_TYPE_MSG , // used as "subtype" if union code = CANLOG_UNION_TYPE_EXPR. // Bit 3..0 : Count of received data bytes (= data length code, 4 bit!) // or data type for .dat union (if union type = ..UNION_TYPE_DATA) // Note: INTEL-BYTE-ORDER = least significant byte FIRST ! ... // ( fortunately, this byte order is also used in ARM7-CPUs ) BYTE bTimeL; // timestamp, low byte ("sometimes" 1st of 3-letter-code) BYTE bTimeM; // timestamp, medium byte ("sometimes" 2nd of 3-letter-code) BYTE bTimeH; // timestamp, high byte ("sometimes" 3rd of 3-letter-code) // ("sometimes" means if (bTypeFlags&CANLOG_UNION_TYPE_MASK)==CANLOG_UNION_TYPE_HDR ) // The remaining 12 bytes in a 16-byte-struct are UNION-TYPE-specific components, // here : a CAN MESSAGE ... BLONG blBusAndId; // 4 byte: BusNr + 29BitFlag + 11..29-bit Message-ID . // Note: a BLONG is a byte-adressable 32-bit integer value. // Some bitmasks to extract the bus-number and the extended-flag, // copied from MKT's CAN driver (\drivers1\can\can.h) : // #define C_CAN_29_BIT_ID_FLAG 0x20000000L /* Maske fuer 29-Bit-Flag */ // #define C_CAN_ID_MASK_BUS2 0x40000000L /* Bitmaske fuer "Messages von Bus 2" */ // #define C_CAN_ID_MASK_BUS3 0x80000000L /* Bitmaske fuer "Messages von Bus 3/4 (Reserve) */ // #define C_CAN_ALL_ID_BITS 0x1FFFFFFFL /* Maske fuer "alle ID-Bits" */ BYTE bData[8]; // 8 byte raw message data // Note: For union types CANLOG_UNION_TYPE_HDR, blBusAndId.b[0..3] // and bData[0..7] may be used for something 'completely different' . // Details in the logger firmware: c:\cproj\UPT_xx\CanLog1.c (warning, LARGE). // In many HDR-entries, blBusAndId.l is used as a 32-bit(!) timestamp . } T_CanLog_MsgData; // used for "fast" and "large" logging buffers, filled in IRQ typedef struct t_CanLog_ARM7MsgData // 2nd alternative for a log-buffer-entry... { // same as T_CanLog_MsgData, but better suited for ARM7 (LPC2468) BLONG blTypeFlagsAndTime; // 32 bit value: // Bit 3..0 = DATA LENGTH CODE // Bit 7..4 = type flags (CANLOG_UNION_TYPE_MSG etc) // Bit 31..8 = 24-bit timestamp BLONG blBusAndId; // 4 byte: BusNr + 29BitFlag + 11..29-bit Message-ID . BLONG blData[2]; // 8 byte raw message data, adressable as 2 * 32 bit } T_CanLog_ARM7MsgData; // same as T_CanLog_MsgData, but better for ARM7 firmware typedef struct // T_CanLog_Gps1 : first in a sequence of GPS-data.... { // Used in the logfile to log data from a GPS receiver (parsed NMEA data). // The first byte must have identic meaning for all components of T_CanLog_LoggingUnion ! BYTE bTypeFlags; // Here (in T_CanLog_Gps1) this must be the following : // 0xA1 = CANLOG_UNION_TYPE_DATA | CANLOG_UNION_TYPE_DATA_GPS | CANLOG_UNION_GPS_1 // The next byte [1] contains status-flags from various NMEA-0183 sentences, mainly // from GPRMC (recommended minimum navigation info) and GPGGA (GPS system fix data). BYTE bStatusAndQuality; // bits 3..0: number of satellites in view (0..12) // bit 4: 0=ok, 1=receiver warning // bit 5: reserved // bits 7..6: 00=no fix, 01=GPS quality, 10=DGPS BYTE bHDOP_10; // byte[2]: horizontal dilution of precision (from GPGGA, multiplied by ten) BYTE bRsvd3 ; // byte[3]: reserved // The next 4(!) DWORD-aligned bytes contain the LOGGER'S INTERNAL TIMESTAMP, // to correlate 'internal' and GPS-time. See notes in TCanLogForm1::ConvertLogfile() ! BLONG blLocalTimestamp; // byte[4..7]: local timestamp, same scale as in @tim-entries, 32 bit. // The next 4 DWORD-aligned bytes contain the current GPS-time-of-day (UTC), // with a 10 milliseconds resolution, combined in a 32-bit integer as follows: // 360000*Hour + 6000*Minute + 100*Second + (Milliseconds/10[0..99]) . // (max value: 360000*23+6000*59+100*59+99 = 8639999; 8639999 / 2^24 = 0.515) BLONG blGpsTimeOfDay; // byte[ 8..11] = time of day as described above, in 0.01-sec-units // Current GPS-Date (year, month, day); like the time-of-day in UTC ("GMT") : WORD wGpsCalendarDate; // byte[12..13] = calendar date: 7 bit year + 4 bit month + 5 bit day // Note: add 2000(!) to the year number to get the full 4-digit number ! // This will work properly until year 2127, no one will care about MKT then :o) INT16 i16Speed_01kmh; // byte [14..15] = speed over ground in 0.1 km/h - units ( NOT KNOTS ! ) } T_CanLog_Gps1; // used in the "large" logging buffer only ! typedef struct // T_CanLog_Gps2 : second in a sequence of GPS-data.... { // The first byte must have identic meaning for all components of T_CanLog_LoggingUnion ! BYTE bTypeFlags; // Here (in T_CanLog_Gps2) this must be the following : // 0xA2 = CANLOG_UNION_TYPE_DATA | CANLOG_UNION_TYPE_DATA_GPS | CANLOG_UNION_GPS_2 BYTE bValue3Usage; // byte[1] tells what the 3rd 32-bit value is used for at the moment INT16 i16HeightASL_01m; // b[2..3] = height above sea level in 0.1-meter-units long i32Lat; // byte[4..7]: latitude, positive=north, negative=south, unit= 0.01 arcseconds long i32Lon; // byte[8..11]: longitude, positive=east(!), negative=west(!), unit= 0.01 arcseconds long i32Value3; // byte[12..15]: reserved for future applications, possibly 'multiplexed' } T_CanLog_Gps2; // used in the "large" logging buffer only ! typedef struct tCanLog_OtherData // the total size MUST be exactly 16 byte ! { // Used in the logfile to log everything which is neither a HEADER nor a CAN-MESSAGE // nor a 'bulk block' (CANLOG_UNION_TYPE_BULK was added much later) . // The first byte must have identic meaning for all components of T_CanLog_LoggingUnion ! BYTE bTypeFlags; // Same as explained under "T_CanLog_MsgData" (above) // Here (in T_CanLog_OtherData) this is typically a bit-combination like : // CANLOG_UNION_TYPE_DATA | CANLOG_UNION_TYPE_EXPR | CANLOG_UNION_DATA_TYPE_REAL32 // BYTE bSubindex; // Parameter subindex. MUST FILL THE BYTE GAP because a WORD follows. // Used for CANopen-like objects (with bwIndex.w != 0) // or as the index into T_CanLog_Config.Expr[bSubindex] . // BWORD bwIndex; // Parameter index. May be the reference to a CANopen dictionary entry ! // ZERO for 'evaluated expressions' from the interpreter . // Caution: always 'low byte first' (little-endian format like 8086) // Note: a 'BWORD' is a byte-adressable WORD (16 bit unsigned). // The remaining 12 bytes in this 16-byte-struct are UNION-TYPE-specific components ... BLONG blTimestamp; // Timestamp of "when these data have been collected" . // Caution: always 'low byte first' (little-endian format like 8086) // Here : a DATA FIELD FOR 'SPECIAL PURPOSES', for example the result of // an evaluated numeric expression. union // data field, max. 8 byte { BYTE bData[8]; // 8 byte raw data, OR ... T_CanLog_IEEE754_SGL sglFloat[2]; // two 32-bit SINGLE PRECISION FLOATS a la IEEE-754, OR ... DWORD dwData[2]; // two 32-bit unsigned 'doublewords' (best for ARM7 & Co) T_CanLog_IEEE754_SGL dblFloat; // one 64-bit DOUBLE PRECISION FLOAT a la IEEE-754 } dat; } T_CanLog_OtherData; // used in the "large" logging buffer only ! // Combination of all possible contents in a 16-byte LOGFILE ENTRY . // Which of the union types must actually be used, can be told from // bits 7 + 6 in ( T_CanLog_LoggingUnion.msg.bTypeFlags & CANLOG_UNION_TYPE_MASK ) . // The meaning of the lower bits in the 1st byte of this structure depends on that . typedef union tCanLog_LoggingUnion // the total size MUST be exactly 16 byte ! { // T_CanLog_HeaderData hdr; // for union type code = CANLOG_UNION_TYPE_HDR T_CanLog_MsgData msg; // for union type code = CANLOG_UNION_TYPE_MSG // (T_CanLog_MsgData is defined in LOGTYPES.H which is included // by both firmware AND the CAN-Logger File Conversion Utility !) T_CanLog_ARM7MsgData msg2; // same as msg, but better suited for ARM7 firmware T_CanLog_OtherData dat; // usually one or two single-precision FLOATS T_CanLog_Gps1 gps1; // GPS-data, part one : date, time, velocity T_CanLog_Gps2 gps2; // GPS-data, part two : position data DWORD dw4[4]; // debugger-friendly alternative (for hex-dump): 4 * 32-bit "DWORD" BYTE b16[16]; // yet another alternative, for example to analyse and skip 'bulk'-blocks // (with different 'size'-encodings, see CANLOG_UNION_TYPE_BULK_S_MASK) } T_CanLog_LoggingUnion; // << part of UNION CanLog_LargeBuffer #ifdef __BORLANDC__ // Bei BORLAND funktioniert sizeof() auch im Preprozessor . // Andere Compiler (z.B. Tasking) sind leider "zu dumm" dazu, // sie koennen den sizeof-operator NICHT in einem Preprozessor-Ausdruck // auswerten . Grrrr . #if(sizeof(T_CanLog_MsgData) != 16) #error "sizeof(T_CanLog_MsgData) must be exactly 16 byte !" #endif #if(sizeof(T_CanLog_Gps1) != 16) #error "sizeof(T_CanLog_Gps1) must be exactly 16 byte !" #endif #if(sizeof(T_CanLog_LoggingUnion) != 16) #error "sizeof(T_CanLog_LoggingUnion) must be exactly 16 byte !" #endif #endif // smart compiler ? // Configuration parameters for a particular "logging job". // The following structures are written into a LOGGER CONFIGURATION FILE (*.lcf) // as plain ASCII text; possibly with some additional info for signal decoding. typedef struct // T_CanLog_MsgDef : Definition of a CAN MESSAGE { DWORD dwBusAndId; // BUS-NUMBER+29bitFlag+MessageId, 0xFFFF FFFFL means "invalid" or "unused" // also used as link between T_CanLog_SigDef and T_CanLog_MsgDef ! char sz40NodeName[41]; // kompletter 'Sender-KNOTEN-Name' aus CANdb-File char sz40MessageName[41]; // kompletter 'Message-Name' aus CANdb-File WORD wMsgRateLimit_10ms; // Limited "logging-rate" of this individual message // (unit is TEN MILLISECONDS, which is the logger's timer-interrupt-rate) } T_CanLog_MsgDef; // used in the CAN LOGGER CONFIGURATION structure //----- end of the structures for the BINARY SECTION in a CAN LOGFILE ------ // (the rest is configuration stuff, internally used in the logger firmware) // Structures for the logger CONFIGURATION. // The config must contain everything which is needed to decode // the contents of a logfile into signals and physical values. // This includes .... // - The description of all signals (including their names), // - Information how to unmap a signal from a CAN message, // - conversion formula from raw signal value into physical units, // - the physical unit itself, // etc etc etc... this is utterly complicated, but c'est la vie ! typedef struct t_CanLog_CANdbMuxDef // part of T_CanLog_SigDef { // Definition eines MULTIPLEXORs a la CANdb . INT16 iMultiplexorLength; // length of MULTIPLEXOR ("mode signal") in BITs (0=signal is not multiplexed) INT16 iLSBitPosInMessage; // MESSAGE-BIT-INDEX of multiplexor's LSB char cMotorolaOrIntel; // (M)otorola, (I)ntel ? tRawSignalValue iiMuxValue; // MULTIPLEX VALUE to be compared (for validity of a mux'ed signal) // since 'raw signal values' may be 32- or 64-bit integers // (depending on USE_64BIT_SIGNALS), WoBu renamed "i32MuxValue" to "iiMuxValue", // where 'ii' meany "some integer type; 32 or 64 bit" ). } T_CanLog_CANdbMuxDef; typedef struct t_CanLog_SigDef // Definition of single SIGNAL which may travel in a CAN MESSAGE { // Ex: // char szVarName[UPT_MAX_VAR_NAME_LENGTH+1]; // UPT-Variablenname als Klartext // char sz40NodeName[41]; // kompletter 'Sender-KNOTEN-Name' aus CANdb-File // char sz40MessageName[41]; // kompletter 'Message-Name' aus CANdb-File // Removed - Why ? // sz40NodeName+sz40MessageName had to be removed from T_CanLog_SigDef in 2004-05-12, // when someone wanted to have more SIGNALS. That caused a memory problem, // because the crippled old C166 (compi+CPU) only allows a max struct size // of 16 kByte . With more than 48 signals, sizeof(T_CanLog_CFG) would explode ! // If necessary, a signal's SENDING NODE and the MESSAGE NAME can be reconstructed // by searching for the CAN-Identifier (dwBusAndId) in the MESSAGE DEFINITION LIST // ( i.e. T_CanLog_Config.T_CanLog_MsgDef Msg[CANLOG_MAX_LOGGED_MESSAGES] ) char sz40SignalName[41]; // kompletter 'Signalname' aus CANdb-File (*.dbc) char cType; // (U)nsigned, (S)igned, (F)loat, or (I)nvalid ? char cMotorolaOrIntel; // (M)otorola, (I)ntel ? char sz8Unit[10]; // physikalische Einheit, z.B. "mBarA" ** ACHTUNG: ANSI-ZEICHEN ** !!! LOGHDR_FLOAT fltFactor; // Skalierungsfaktor etc ALS FLIESSKOMMAZAHL LOGHDR_FLOAT fltOffset; // CANdb_SCALED := (RAW * fltFactor) + fltOffset LOGHDR_FLOAT fltMinValue; // Used for SCALING in the "preview" window LOGHDR_FLOAT fltMaxValue; INT16 iLSBitPosInMessage; // Bitposition des LSBits im CAN-Telegramm INT16 iDataBitsInMessage; // Anzahl Datenbits die das Signal im CAN-Telegramm belegt DWORD dwBusAndId; // BUS-NUMBER+29bitFlag+MessageId, 0xFFFF FFFFL means "invalid" or "unused" // also used as link between T_CanLog_SigDef and T_CanLog_MsgDef ! T_CanLog_CANdbMuxDef Mux; // the utterly complicated "MULTIPLEXOR"(+) alias "Mode Signal"(-) } T_CanLog_SigDef; // used in the CAN LOGGER CONFIGURATION structure typedef struct t_CanLog_ExprDef // structure to describe 'any other thingy' which may be logged { // This could be // - name of a UPT VARIABLE (updated by the interpreter once every XXX milliseconds) // - short numeric EXPRESSION (evaluated and calculated by the interpreter in the main loop) // The expressions are evaluated periodically every milliseconds, // but not faster than every 100 milliseconds ! char sz40Expression[41]; // variable or function or any numeric expression char sz40Name[41]; // NAME which shall appear in the exported data file LOGHDR_FLOAT fltMinValue; // Used for SCALING in the "preview" window LOGHDR_FLOAT fltMaxValue; } T_CanLog_ExprDef; // used in the CAN LOGGER CONFIGURATION structure typedef struct t_CanLog_CFG // CAN Logger configuration ... { char sz40InfoString[42]; // Info string can be displayed on the terminal screen by command char sz40Password[42]; // If password is not empty, files will be SCRAMBLED when saving char sz40PwdHint[42]; // Hint, may guide the user to one of many passwords (optional) char sz80DatabaseBus1[82]; // full path + file name of a database for BUS 1 char sz80DatabaseBus2[82]; // full path + file name of a database for BUS 2 // ( These 'databases' are often CANdb-files where all SIGNAL DEFINITIONS // have been taken from. Since 2004-05-14, the tool may automatically // reload these files if they can be found on the PC ) int iLoggerDeviceFamily; // Added 2008-02: Which "family" of CAN-Logger-Devices ? # define CAN_LOGGER_FAMILY_MKTVIEW_C167 0 /* old MKT-View with Infineon C167 (poor 16-bitter)*/ # define CAN_LOGGER_FAMILY_LPC2468_V1 1 /* 1st generation of terminals with LPC2468 (ARM7) */ # define CAN_LOGGER_FAMILY_LPC1788_V1 2 /* similar terminals with LPC1788 (Cortex-M3) */ # define CAN_LOGGER_FAMILY_LPC4357_V1 3 /* similar terminals with LPC4357 (Cortex-M4) */ # define CAN_LOGGER_FAMILY_FUTURE 4 /* don't know what this will be.. one fine day... */ // Depending on the "logger family", the number of trigger signals // and the availability of certain "special features" may vary ! // Required especially inside the logger configuration utility. // Any logger- *FIRMWARE* will always set iLoggerDeviceFamily // to a constant value. In the logger *UTILITY*, it's a variable . BOOL fReceiveAll; // 0= log registered messages only; 1=receive everything BOOL fReceiveAppl; // 0= log registered messages only; // 1= also log the signals received by the TERMINAL APPLICATION BOOL fReceiveErrorFrames; // 0= don't log received CAN ERROR FRAMES, 1=receive and log them // (which may be helpful as long we don't have a Logger-Configurator) BOOL fReceiveGpsData; // 0=don't receive/log GPS data, 1=receive and log GPS data BOOL fLogScriptVars; // 0=don't log any script variable, 1=log script variables declared as 'logged' [2014-01-23] BOOL fFifoMode; // 0=do not overwrite, 1=overwrite very old data (FIFO) // How to realize the DaimlerChrysler modes (with funny names): // See c:\cproj\UPT_xx\canlog1.c ! BOOL fNewFileOnStartup; // ex: !fReopenToAppend; // 0=do not reopen existing file to append data // (instead, create a new filename when beginning to log AFTER POWER-ON) // 1=open existing logfile upon start, and continue writing to it . // (new since 2004-05-11, not really functionable yet) // Before 2005-08-11, the "Reopen To Append"-flag controlled... // A - powering up the terminal (fReopenToAppend=TRUE) // B - behaviour after detecting a trigger event . // In the documentation, fReopenToAppend was called "Re-open and overwrite old logfile on start" // Since 2005-08-11, two different flags are used to give more control: // A - fNewFileOnStartup ONLY controls the behaviour on power-up ! // B - fNewFileOnTrigger (new since 2005-08-11) : see below // C - fKeepFileOpened (new since 2005-08-11) : tradeoff "speed" versus "safety", see below BOOL fNewFileOnTrigger; // 1=produce a new logfile for each new trigger cycle (OFF-ON-OFF) // 0=write multiple trigger events into a single logfile BOOL fKeepFileOpened; // 1=keep logfile open, even after trigger turned OFF // 0=close logfile immediately when the trigger is OFF // (see comments in CanLog_Run() about pros and cons of 'fKeepFileOpened' ) LWORD lwFileSizeLimitKB; // Limit of the log file size in kByte (0=unlimited) LWORD lwMsgRateLimit; // Limit "logging-rate" of every message ("global", millisec, 0=unlimited) // Properties of the logging device (not really an adjustable parameter yet !) LOGHDR_FLOAT fltTimestampFrequency; // see \drivers1\TIM\timestmp.c : 39065.5 Hz for "MKT-View PLUS" // List of messages (and signals) to be logged . // The SIGNAL defs are required to decode the logged data . T_CanLog_MsgDef Msg[CANLOG_MAX_LOGGED_MESSAGES]; // most important: Msg[].dwBusAndId // T_CanLog_SigDef Sig[CANLOG_MAX_LOGGED_SIGNALS]; // most important: Sig[].dwBusAndId // 2004-05-17: moved T_CanLog_SigDef Sig[] from T_CanLog_CFG to T_CanLog_SigTab ! // List of 'any other things' to be logged , for example (since 2004-02) : // - name of a UPT VARIABLE (updated by the interpreter once every XXX milliseconds) // - short numeric EXPRESSION (evaluated and calculated by the interpreter in the main loop) T_CanLog_ExprDef Expr[CANLOG_MAX_LOGGED_EXPRESSIONS]; // Trigger section. Some ideas from 2003-06-20 by WoBu, similar like KVASER's "Memorator". // Will be utterly complicated to implement all this one fine day ! WORD wInitialTriggerState; // 0=off, 1=engaged, 2=triggered after power-on // (must never change, ever; see notes in CANLOG.H ) WORD wPretrigger10ms; // 'wanted' position of pretrigger point in N * 10 MILLISECONDS (0=no pretrigger) WORD wPosttrigger10ms; // 'wanted' length of post-trigger in N * 10 MILLISECONDS (0=no post-trigger-logging) int iTriggerOnDigitalInput; // 0=off, 1=on rising edge of digital input 2=falling edge LWORD dwTriggerOnMsgReception; // 0=off, 1=on (trigger on reception of a certain message ID) WORD wTriggerOptions; // bitcombination of CANLOG_TRIGOPT_ xxx - values // ( includes EDGE TRIGGER / FLANKENTRIGGER since 2005-01 ) // Trigger Conditions ... char sz40TrigSigName[CANLOG_N_TRIGGER_SIGNALS][42]; // definitions of up to 4 signals used for TRIGGERING int iTrigComparation[2*CANLOG_N_TRIGGER_SIGNALS]; // CANLOG_COMPARE_xxxxx LOGHDR_FLOAT fltTrigValue[2*CANLOG_N_TRIGGER_SIGNALS]; // numeric values to compare against.. int iTrigActionOrCombination[CANLOG_N_TRIGGER_SIGNALS]; // CANLOG_COMBINE_xxxxx /* ONLY USED FOR THE "OLDER" MKT-View (I) with C167 and FOUR trigger signals: */ int iTrigOuterCombination[2]; // CANLOG_COMBINE_xxxxx [0] for start, [1] for stop BOOL fTrigUseStopAsStart2; // FALSE=normal mode, TRUE=use "STOP" as 2nd "START" condition } T_CanLog_Config; //#ifdef __BORLANDC__ // #if(sizeof(T_CanLog_Config) > 16384) // #error "sizeof(T_CanLog_Config) must not exceed 16384 byte ..." // // ... otherwise C166 won't be able to compile this properly ! ! // #endif //#endif // smart compiler ? typedef struct t_CanLog_SigTab // once part of T_CanLog_Config which got too large.. { T_CanLog_SigDef Sig[CANLOG_MAX_LOGGED_SIGNALS]; // most important: Sig[].dwBusAndId } T_CanLog_SigTab; //#ifdef __BORLANDC__ // #if(sizeof(T_CanLog_Config) > 16384) // #error "sizeof(T_CanLog_Config) must not exceed 16384 byte ..." // // ... otherwise C166 won't be able to compile this properly ! ! // #endif //#endif // smart compiler ? typedef struct t_CanLog_CalendarDateAndTime { int iYear, iMonth, iDayOfMonth; int iHour, iMinute, iSecond; } T_CanLog_CalendarDateAndTime; typedef struct t_CanLog_FileInfo // info about a particular LOGFILE, incl. start date etc. { // NOT saved 'in binary form' in any file ! T_CanLog_CalendarDateAndTime StartDate; T_CANLOG_UNIX_SECONDS uStartDate; // Year+month+day+hour+minute+second, combined and CALCULATABLE ("UNIX seconds") . LWORD lwStartTimestamp; // Value of the CAN logger's timestamp generator, when 'i32StartDate' was read from the RTC, // measured in hardware-specific timer ticks ! // To scale this into seconds, divide by T_CanLog_Config.fltTimestampFrequency ! // > To convert a given timestamp ( e.g. from T_CanLog_MsgData.bTimeL,M,H ) // > into an ABSOLUTE time (Unix seconds), use the following formula : // > t_Unix := i32StartDate + ( timestamp - lwStartTimestamp ) / fltTimestampFrequency . } T_CanLog_FileInfo; typedef struct t_CanLog_BinaryHeader512 // implemented 2004-05-10 as explained in canlog1.c . { // Required to save the "current writing position" and some more. //------------- Information about the header itself [ 64 byte ] -------- char sz40Magic[40]; // magic string, DO NOT MODIFY, must contain ... #define CANLOG_BIN_HEADER_MAGIC "BinaryLogfileHeader\r\nSize=512 byte\r\n\0\0" // Note: // All following components in T_CanLog_BinaryHeader512 are SUBJECT TO CHANGE, // but you don't need them to skip the header in your software. // If you find the string "BinaryLogfileHeader" at a file offset // which can be divided by 512 [bytes per sector], you can skip this header // by jumping to the NEXT 512-byte-boundary inside the file ! // Caution: All BYTE ORDER of WORDS and DOUBLEWORDS in this structure // is hardware-dependent. Here is some "test data" for the CAN LOGGER UTILITY // to find out if the producing CPU is a little- or big-endian machine. // MKT initially used an Infineon C166 which uses the little-endian format // (like many "Intel" CPU's), which means LEAST SIGNIFICANT BYTE FIRST . DWORD dw12345678; // [40..43] to let the analysis tool find out the BYTE ORDER in a DWORD : contains 0x12345678 WORD w1234; // [44..45] to let the analysis tool find out the BYTE ORDER in a WORD : contains 0x1234 WORD wStructVers; // [46..47] Version of the T_CanLog_BinaryHeader512 header, contains... #define CANLOG_BIN_HEADER_STRUCT_VERSION 1 /* increment this when appending new components ! */ // Revision history of CANLOG_BIN_HEADER_STRUCT_VERSION : // 1 (2004-05-10) : Implementation of this header as a dummy. Written by firmware, skipped by analysis tool. WORD wReserved1[(64-48)/2]; // [48..63] fill the rest of this section with dummies //------------- Information about the logfile [ 64 byte ] --------------- // ( These are mostly 'counters' etc which may change while logging. // All 'constant info' is placed in the TEXT-HEADER of the logger ! ) DWORD dwFilePosForNextWrite; // [64..67] required by firmware when re-opening // an old logfile to continue writing into it. Usually used for the // configuration "treat file as ring-buffer" // AND "append to old logfile after restart" . DWORD dwCountWrittenEntries; // [68..71] Total count of entries written to this logfile.. // since it was created (may have WRAPPED AROUND if its a circular buffer, // so the 'count of entries in the file' may be much less than this !) // If a new telegram is received every millisecond, this counter // may overflow from 2^32 to zero after 2^32 * 1E-3 / (60*60*24) = 49.7 days. WORD wReserved2[(128-72)/2]; // [72..127] fill the rest of this section with dummies //------------- Debugging stuff [ 64 byte ] ----------------------------- DWORD dwCountReceivedMsgs; // [128..131] Count of CAN messages received by logger. // Intended for debugging purposes. Also incremented when NOT writing to logfile ! DWORD dwCountCanIRQs; // [132..135] Count of CAN INTERRUPTS fired by controller. // Intended for debugging purposes. May contain zero if not needed any longer. DWORD dwCountLostMessages; // [136..139] Count of "lost" messages (received but not logged). // Note : there may be "lost" messages due to the trigger state in the current firmware. DWORD dwLastMessageLostInLine; // [140..143] Only for debugging, error location, line of sourcecode // in which the firmware noticed that something has been lost WORD wCpuLoadIndicators[8]; // [144..159] CPU load percentage, // copied from CanLog_PerformanceAnalyzer. Indices defined in canlogX.h (CANLOG_PERF_ID_xxx) char sz16FirmwareCompilationDate[16]; // [160..175] for example "May 10 2004" // (produced by the C compiler, unfortunately not ISO8601-compatible, // .. but can be parsed by c:\cproj\CanLogUtility\FormatDate.c :: ParseCompilerDateString() ) DWORD dwFirmwareArticleNumber; // [176..179] for example #11314 for MKT-View II, // #11392 for MKT-View III, // #11532 for MKT-View IV , ... . // Set to SWI_SOFTWARE_ART_NR when compiling the DEVICE FIRMWARE // which 'produced' the logfile. Listed in file:///M:/artikel.htm . WORD wReserved3[(192-180)/2]; // [180..191] fill the rest of this section with dummies //------------- Future sections [ + fill the rest ] ---------------------- WORD wReservedEnd[(480-192)/2]; // [192..479] fill the rest of the DISK SECTOR with dummies char sz32EndMarker[32]; // [480..511] end marker as string, contains ... : #define CANLOG_BIN_HEADER_END "\r\n\r\n\0\0" /* 2+26+2+2 byte */ // (useful when examining a logfile with a text editor !) } T_CanLog_BinaryHeader512; #ifdef __BORLANDC__ #if(sizeof(T_CanLog_BinaryHeader512) != 512) #error "sizeof(T_CanLog_BinaryHeader512) must be exactly 512 byte !" #endif #endif // smart compiler ? //------------ Prototypes ------------------------------------------------- #ifdef __cplusplus #define CPROT extern "C" #else #define CPROT #endif /* nicht "cplusplus" */ CPROT void CanLog_InitStruct_MsgDef(T_CanLog_MsgDef *pMsgDef); CPROT void CanLog_InitStruct_SigDef(T_CanLog_SigDef *pSigDef); CPROT void CanLog_InitStruct_ExprDef(T_CanLog_ExprDef *pExprDef); CPROT void CanLog_SetDefaultConfig(T_CanLog_Config *pConfig, T_CanLog_SigTab *pSignals, int iLoggerDeviceFamily); // CAN_LOGGER_FAMILY_MKTVIEW_C167, etc CPROT T_CanLog_MsgDef * CanLog_GetMessageOfSignal( T_CanLog_Config *pConfig, T_CanLog_SigDef *pSigDef ); CPROT char* CanLog_GetNodeNameOfSignal( T_CanLog_Config *pConfig, T_CanLog_SigDef *pSigDef ); CPROT char* CanLog_GetMessageNameOfSignal( T_CanLog_Config *pConfig, T_CanLog_SigDef *pSigDef ); #if (defined __WIN32__) //--------------------------------------------------------------------------- // Functions only present in the CAN LOGGER UTILITY (a PC software) ... //--------------------------------------------------------------------------- CPROT int CanLog_GetMaxNumberOfSignals( int iLoggerDeviceFamily ); CPROT int CanLog_GetMaxNumberOfMessages( int iLoggerDeviceFamily ); CPROT int CanLog_GetMaxNumberOfTriggerSignals( int iLoggerDeviceFamily ); #endif // defined __WIN32__ #endif // _LOGTYPES_H_