@@ -43,6 +43,9 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
4343
4444// 5 step is to print fmon source file
4545Gen_FMonSource ();
46+
47+ // 6 step is to print template for drv-config.h
48+ Gen_ConfigHeader ();
4649}
4750
4851void CiMainGenerator::Gen_MainHeader ()
@@ -254,6 +257,73 @@ void CiMainGenerator::Gen_MainSource()
254257 fwriter->Flush (fdesc->core_c .fpath );
255258}
256259
260+ void CiMainGenerator::Gen_ConfigHeader ()
261+ {
262+ fwriter->AppendLine (" #pragma once" ,2 );
263+
264+ fwriter->AppendLine (" /* include common dbccode configurations */" );
265+ fwriter->AppendLine (" #include\" dbccodeconf.h\" " ,3 );
266+ fwriter->AppendLine (" /* ----------------------------------------------------------------------------------- */" );
267+ fwriter->AppendLine (" /* To enable using messaged typedefs based on bit-fields" );
268+ fwriter->AppendLine (" uncomment define below. (Note(!): bit-feild was not tested" );
269+ fwriter->AppendLine (" properly, so using is up to user). */" ,2 );
270+ fwriter->AppendLine (StrPrint (" // #define %s" , fdesc->usebits_def .c_str ()),3 );
271+ fwriter->AppendLine (" /* ----------------------------------------------------------------------------------- */" );
272+ fwriter->AppendLine (" /* By default signature of pack function intakes a few simple typed params" );
273+ fwriter->AppendLine (" for loading data, len, etc. To enable specific struct based signature" );
274+ fwriter->AppendLine (" uncomment define below. */" ,2 );
275+ fwriter->AppendLine (StrPrint (" // #define %s" , fdesc->usesruct_def .c_str ()),3 );
276+ fwriter->AppendLine (" /* ----------------------------------------------------------------------------------- */" );
277+ fwriter->AppendLine (" /* To enable phys values handling uncomment define below. It will:" );
278+ fwriter->AppendLine (" - adds additional members to message struct with name extension *_phys" );
279+ fwriter->AppendLine (" which have user defined type @sigfloat_t (must be defined by user in" );
280+ fwriter->AppendLine (" dbccodeconf.h)" );
281+ fwriter->AppendLine (" - in unpack function these signal will be loaded by the converted" );
282+ fwriter->AppendLine (" value (with factor and offset)" );
283+ fwriter->AppendLine (" - in pack function the CAN frame signal values will be loaded from" );
284+ fwriter->AppendLine (" *_phys value with factor and offset conversion. */" ,2 );
285+ fwriter->AppendLine (StrPrint (" // #define %s" , fdesc->usesigfloat_def .c_str ()),3 );
286+
287+ fwriter->AppendLine (" /* ----------------------------------------------------------------------------------- */" );
288+ fwriter->AppendLine (" /* To enable monitor functions uncomment define below." );
289+ fwriter->AppendLine (" /* (Note(!): the\" canmonitorutil.h\" must be accessed in include path):" );
290+ fwriter->AppendLine (" It will:" );
291+ fwriter->AppendLine (" - bring to message struct special monitor member @mon1" );
292+ fwriter->AppendLine (" - calling function FMon_*** function inside unpack function" );
293+ fwriter->AppendLine (" which is empty by default and must be filled by user code" );
294+ fwriter->AppendLine (" to check if any fault state detected. */" ,2 );
295+ fwriter->AppendLine (StrPrint (" // #define %s" , fdesc->usemon_def .c_str ()),3 );
296+
297+ fwriter->AppendLine (StrPrint (" /* When monitor using is enabled (%s)" , fdesc->usemon_def .c_str ()));
298+ fwriter->AppendLine (" and define below uncommented, additional signal will be added" );
299+ fwriter->AppendLine (" to message struct. ***_expt - expected rolling counter, to" );
300+ fwriter->AppendLine (" perform monitoring rolling counter sequence automatically. */" ,2 );
301+ fwriter->AppendLine (StrPrint (" // #define %s" , fdesc->useroll_def .c_str ()),3 );
302+
303+ fwriter->AppendLine (" /* ----------------------------------------------------------------------------------- */" );
304+ fwriter->AppendLine (StrPrint (" /* When monitor using is enabled (%s)" , fdesc->usemon_def .c_str ()));
305+ fwriter->AppendLine (" and define below uncommented, checksum calculation in unpack" );
306+ fwriter->AppendLine (" function will be performed. in pack function checksum signal will" );
307+ fwriter->AppendLine (" be calculated automatically too." ,2 );
308+ fwriter->AppendLine (" The signal that can be selected as checksum must have in comment substring with next format:" );
309+ fwriter->AppendLine (" <Checksum:XOR8:3> where:" );
310+ fwriter->AppendLine (" - Checksum : constant marker word" );
311+ fwriter->AppendLine (" - XOR8 : type of method, this text will be passed to GetFrameHash function as is," );
312+ fwriter->AppendLine (" so the best use case is to pre-define enum collection which have value from this position" );
313+ fwriter->AppendLine (" - 3 : optional value that will be passed to GetFrameHash as integer value" ,2 );
314+ fwriter->AppendLine (" To this case user must define specific function" ,2 );
315+ fwriter->AppendLine (" function: uint8_t GetFrameHash(data_ptr, len, msgid, type, option)" ,2 );
316+ fwriter->AppendLine (" where:" );
317+ fwriter->AppendLine (" - data_ptr : pointer to payload" );
318+ fwriter->AppendLine (" - len : message dlc or payload len" );
319+ fwriter->AppendLine (" - msgid : CAN Message ID" );
320+ fwriter->AppendLine (" - type : method of algorythm" );
321+ fwriter->AppendLine (" - option : optional integer param */" ,2 );
322+ fwriter->AppendLine (StrPrint (" // #define %s" , fdesc->usecsm_def .c_str ()),2 );
323+
324+ fwriter->Flush (fdesc->core_c .dir +' /' + fdesc->drvname +" -config.h" );
325+ }
326+
257327void CiMainGenerator::Gen_FMonHeader ()
258328{
259329 fwriter->AppendLine (" #pragma once" ,2 );
@@ -461,7 +531,8 @@ void CiMainGenerator::WriteUnpackBody(const CiExpr_t* sgs)
461531 {
462532// Put checksum check function call here
463533 fwriter->AppendLine (StrPrint (" #ifdef %s" , fdesc->usecsm_def .c_str ()));
464- fwriter->AppendLine (StrPrint (" _m->mon1.csm_error = ((uint8_t)GetFrameCRC(_d, %s_DLC, %s_CANID, %s, %d)) != (_m->%s))" ,
534+ fwriter->AppendLine (
535+ StrPrint (" _m->mon1.csm_error = ((uint8_t)GetFrameHash(_d, %s_DLC, %s_CANID, %s, %d)) != (_m->%s))" ,
465536 sgs->msg .Name .c_str (), sgs->msg .Name .c_str (), sgs->msg .CsmMethod .c_str (),
466537 sgs->msg .CsmOp , sgs->msg .CsmSig ->Name .c_str ()));
467538 fwriter->AppendLine (StrPrint (" #endif // %s" , fdesc->usecsm_def .c_str ()),2 );