/*@@var:*/
variables
{
   /* -----------------------------------------------------------------------
   Common parameters for diagnosis via MOST

   This include file contains all assumed parameters for diagnosis via MOST.
   Change this file to use other parameters throughout the whole demo.
   -----------------------------------------------------------------------*/

   //This struct is used to identify the diagnosis 
   struct MostDiagParam {
     long connID; //any unique ID identifying the MOST diagnostics connection
     long instID; //InstanceID of the MOST diagnostics FBlock
     long devID;  //Address of the MOST device hosting the diagnostics FBlock
   };

   struct MostDiagParam gMDP1 = { connID = 27, instID = 1, devID = 0x101 }; // connID < 100 == AMS
   struct MostDiagParam gMDP2 = { connID = 110,instID = 2, devID = 0x102 }; // connID > 100 == MHP
   
   const long MD_FBLOCKID   = 0x06;  // Diagnosis
   const long MD_FUNCTIONID = 0x200; // DiagMsg
   const long MD_OPTYPE_REQ = 0x0;   // Set
   const long MD_OPTYPE_RES = 0xC;   // Status

   const long MD_MHP_FRAMES_PER_BLOCK = 5;
   const long MD_MHP_FRAME_SIZE = 821;
   const long MD_MHP_AIR = 5;
   const long MD_MHP_PRIO = 1;

   //DAP specific
   const long DAP_HEADER_SIZE        = 10;
   const long DAP_VERSION            = 0x01;
   const long DAP_TYPE_OF_SERVICE    = 0x01; //UDS
   const long DAP_SYS_INT_PART       = 0xFFFF;
   const long DAP_DEFAULT_TESTER_ADR = 0xFFFF;
}
/*@@end*/

/*@@caplFunc:FillDAPHeader(byte[],dword,word):*///function
FillDAPHeader(byte header[], dword dataLen, word testerAdr)
{
  header[0] = DAP_VERSION;
  header[1] = dataLen >> 24;
  header[2] = dataLen >> 16;
  header[3] = dataLen >> 8;
  header[4] = dataLen;
  header[5] = DAP_TYPE_OF_SERVICE;
  header[6] = DAP_SYS_INT_PART >> 8;
  header[7] = DAP_SYS_INT_PART;
  header[8] = testerAdr >> 8;
  header[9] = testerAdr;
}
/*@@end*/

