]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Merged with dem-dev
authorpete <devnull@localhost>
Fri, 18 Dec 2009 12:15:45 +0000 (13:15 +0100)
committerpete <devnull@localhost>
Fri, 18 Dec 2009 12:15:45 +0000 (13:15 +0100)
1  2 
arch/arm/arm_cm3/drivers/Mcu.c
arch/ppc/mpc55xx/drivers/Can.c
arch/ppc/mpc55xx/drivers/Fls.c
arch/ppc/mpc55xx/drivers/Mcu.c
boards/board_common.mk
communication/PduR/PduR.c
include/Can.h
peripherals/Fls_SST25xx.c
system/EcuM/EcuM_Callout_template.c

index 80c837961d2aa635834dc50ab333eec3062e685f,0ca26b49af38dd121eef1f6e1f8dc1e22744baa3..35105872982fb61c0b0bb00841db6cc4364ed033
  
  #include "Std_Types.h"\r
  #include "Mcu.h"\r
 -#include "Det.h"\r
 +#include "Det.h"
 +#if defined(USE_DEM)
 +#include "Dem.h"\r
 +#endif
  #include <assert.h>\r
  #include "cpu.h"\r
  #include <string.h>\r
@@@ -88,8 -85,11 +88,8 @@@ Mcu_GlobalType Mcu_Global 
  
  #if 0\r
  static void Mcu_LossOfLock( void  ) {\r
 -#if ( MCU_DEV_ERROR_DETECT == STD_ON )\r
 -      /* Should report MCU_E_CLOCK_FAILURE with DEM here.... but\r
 -       * we do the next best thing. Report with Det with API = 0\r
 -       */\r
 -      Det_ReportError(MODULE_ID_MCU,0,0,MCU_E_PLL_NOT_LOCKED);\r
 +#if defined(USE_DEM)
 +      Dem_ReportErrorStatus(MCU_E_CLOCK_FAILURE, DEM_EVENT_STATUS_FAILED);
  #endif\r
  \r
        Mcu_Global.stats.lossOfLockCnt++;\r
  #define SPR_PIR 286\r
  #define SPR_PVR 287\r
  \r
- #define CORE_PVR_E200Z1   0x81440000UL\r
- #define CORE_PVR_E200Z0   0x81710000UL\r
+ #define CORE_PVR_E200Z1       0x81440000UL\r
+ #define CORE_PVR_E200Z0       0x81710000UL
+ #define CORE_PVR_E200Z3       0x81120000UL\r
  \r
  \r
  typedef struct {\r
@@@ -124,7 -125,11 +125,11 @@@ cpu_info_t cpu_info_list[] = 
      {\r
      .name = "MPC5516",\r
      .pvr = CORE_PVR_E200Z0,\r
-     },\r
+     },
+     {
+     .name = "MPC563X",
+     .pvr = CORE_PVR_E200Z3,
+     },
  };\r
  \r
  core_info_t core_info_list[] = {\r
      .name = "CORE_E200Z1",\r
      .pvr = CORE_PVR_E200Z1,\r
      },\r
+     {
+     .name = "CORE_E200Z3",
+     .pvr = CORE_PVR_E200Z3,
+     },
  };\r
  \r
  // TODO: move\r
index ccdb7c932413469379d18db243e53ff71438e752,aeddc2eb446d0f0aab5909cf01be00d83dcca360..6037bbc0264c1bc7491045539d41021445034335
  #include "Cpu.h"\r
  #include "Mcu.h"\r
  #include "CanIf_Cbk.h"\r
 -#include "Det.h"\r
 +#include "Det.h"
 +#if defined(USE_DEM)
 +#include "Dem.h"\r
 +#endif
  #include <assert.h>\r
  #include <stdlib.h>\r
  #include <string.h>\r
  #if defined(USE_KERNEL)\r
- #include "Os.h"\r
+ #include "Os.h"
+ #include "int_ctrl.h"\r
  #endif\r
  \r
  \r
  /* CONFIGURATION NOTES\r
   * ------------------------------------------------------------------\r
-  * - CanHandleType must be CAN_ECORE_HANDLE_TYPE_BASIC\r
-  *   i.e. CanHandleType=CAN_ECORE_HANDLE_TYPE_FULL NOT supported\r
+  * - CanHandleType must be CAN_ARC_HANDLE_TYPE_BASIC\r
+  *   i.e. CanHandleType=CAN_ARC_HANDLE_TYPE_FULL NOT supported\r
   *   i.e CanIdValue is NOT supported\r
-  * - All CanXXXProcessing must be CAN_ECORE_PROCESS_TYPE_INTERRUPT\r
-  *   ie CAN_ECORE_PROCESS_TYPE_POLLED not supported\r
-  * - To select the Mailboxes to use in the CAN controller use CanEcoreMbMask\r
+  * - All CanXXXProcessing must be CAN_ARC_PROCESS_TYPE_INTERRUPT\r
+  *   ie CAN_ARC_PROCESS_TYPE_POLLED not supported\r
+  * - To select the Mailboxes to use in the CAN controller use Can_Arc_MbMask\r
   * - HOH's for Tx are global and Rx are for each controller\r
   * - CanControllerTimeQuanta is NOT used. The other CanControllerXXX selects\r
   *   the proper time-quanta\r
-  * - CanEcoreMbMask for Tx HOH must NOT overlap CanEcoreMbMask for Rx.\r
+  * - Can_Arc_MbMask for Tx HOH must NOT overlap Can_Arc_MbMask for Rx.\r
   * - ONLY global mask is supported( NOT 14,15 and individual )\r
   * - Numbering the CanObjectId for Tx:\r
   *     To do this correctly there are a number of things that are good to know\r
   *     1. HTH's have unique numbers.\r
   *     2. One HTH/HRH is maped to one HOH\r
-  *     3. The extension CanEcoreMbMask binds FULL CAN boxes together.\r
+  *     3. The extension Can_Arc_MbMask binds FULL CAN boxes together.\r
   *\r
   *     Example:\r
   *\r
@@@ -66,7 -64,7 +67,7 @@@
   *      1    F   0  1\r
   *      ..\r
   *      16   B   0  16  |\r
-  *                  17  |    The use of CanEcoreMbMask=0x000f0000 binds these to HTH 16\r
+  *                  17  |    The use of Can_Arc_MbMask=0x000f0000 binds these to HTH 16\r
   *                  18  |    ( bits 16 to 19 set here )\r
   *                  19  |\r
   *           ...\r
  #define VALIDATE_NO_RV(_exp,_api,_err )\r
  #define DET_REPORTERROR(_x,_y,_z,_q)\r
  #endif\r
 -\r
 +
 +#if defined(USE_DEM)
 +#define VALIDATE_DEM_NO_RV(_exp,_err ) \
 +        if( !(_exp) ) { \
 +          Dem_ReportErrorStatus(_err, DEM_EVENT_STATUS_FAILED); \
 +          return; \
 +        }
 +#else
 +#define VALIDATE_DEM_NO_RV(_exp,_err )
 +#endif
 +
  //-------------------------------------------------------------------\r
  \r
  // Message box status defines\r
@@@ -214,12 -202,12 +215,12 @@@ typedef struct FLEXCAN_tag flexcan_t
  #endif\r
  \r
  // Mapping between HRH and Controller//HOH\r
- typedef struct Can_EcoreObjectHOHMapStruct\r
+ typedef struct Can_Arc_ObjectHOHMapStruct\r
  {\r
    uint32 HxHRef;    // Reference to HRH or HTH\r
    CanControllerIdType CanControllerRef;    // Reference to controller\r
    const Can_HardwareObjectType* CanHOHRef;       // Reference to HOH.\r
- } Can_EcoreObjectHOHMapType;\r
+ } Can_Arc_ObjectHOHMapType;\r
  \r
  /* Type for holding global information used by the driver */\r
  typedef struct {\r
  \r
    // This is a map that maps the HTH:s with the controller and Hoh. It is built\r
    // during Can_Init and is used to make things faster during a transmit.\r
-   Can_EcoreObjectHOHMapType CanHTHMap[NUM_OF_HTHS];\r
+   Can_Arc_ObjectHOHMapType CanHTHMap[NUM_OF_HTHS];\r
  } Can_GlobalType;\r
  \r
  // Global config\r
@@@ -253,14 -241,14 +254,14 @@@ typedef struct 
    CanIf_ControllerModeType state;\r
    uint32              lock_cnt;\r
    // Interrupt masks that is for all Mb's in this controller\r
-   uint32              CanEcoreRxMbMask;\r
-   uint32              CanEcoreTxMbMask;\r
+   uint32              Can_Arc_RxMbMask;\r
+   uint32              Can_Arc_TxMbMask;\r
  \r
    // Used at IFLG in controller at startup\r
    uint32              iflagStart;\r
  \r
    // Statistics\r
-   Can_EcoreStatisticsType stats;\r
+   Can_Arc_StatisticsType stats;\r
  \r
    // Data stored for Txconfirmation callbacks to CanIf\r
    PduIdType swPduHandles[MAX_NUM_OF_MAILBOXES];\r
@@@ -311,10 -299,10 +312,10 @@@ Can_UnitType CanUnit[CAN_CONTROLLER_CNT
   * @param hth The transmit handle\r
   * @returns Ptr to the Hoh\r
   */\r
- static const Can_HardwareObjectType * Can_FindHoh( Can_EcoreHTHType hth , uint32* controller)\r
+ static const Can_HardwareObjectType * Can_FindHoh( Can_Arc_HTHType hth , uint32* controller)\r
  {\r
    const Can_HardwareObjectType *hohObj;\r
-   const Can_EcoreObjectHOHMapType *map;\r
+   const Can_Arc_ObjectHOHMapType *map;\r
    const Can_ControllerConfigType *canHwConfig;\r
  \r
    map = &Can_Global.CanHTHMap[hth];\r
@@@ -387,7 -375,7 +388,7 @@@ void Can_F_BusOff( void  ) {       Can_BusOff
  \r
  static void Can_Err( int unit ) {\r
    flexcan_t *canHw = GET_CONTROLLER(unit);\r
-   Can_EcoreErrorType err;\r
+   Can_Arc_ErrorType err;\r
    ESRType esr;\r
    err.R = 0;\r
  \r
    err.B.RXWRN = esr.B.RXWRN;\r
    err.B.TXWRN = esr.B.TXWRN;\r
  \r
-   if (GET_CALLBACKS()->EcoreError != NULL)\r
+   if (GET_CALLBACKS()->Arc_Error != NULL)\r
    {\r
-     GET_CALLBACKS()->EcoreError(unit, err );\r
+     GET_CALLBACKS()->Arc_Error(unit, err );\r
    }\r
    // Clear ERRINT\r
    canHw->ESR.B.ERRINT = 1;\r
@@@ -417,7 -405,7 +418,7 @@@ static void Can_AbortTx( flexcan_t *can
    uint8 mbNr;\r
  \r
        // Find our Tx boxes.\r
-   mbMask = canUnit->CanEcoreTxMbMask;\r
+   mbMask = canUnit->Can_Arc_TxMbMask;\r
  \r
    // Loop over the Mb's set to abort\r
    for (; mbMask; mbMask&=~(1<<mbNr)) {\r
    }\r
  \r
    // Ack tx interrupts\r
-   canHw->IFRL.R = canUnit->CanEcoreTxMbMask;\r
-   canUnit->iflagStart = canUnit->CanEcoreTxMbMask;\r
+   canHw->IFRL.R = canUnit->Can_Arc_TxMbMask;\r
+   canUnit->iflagStart = canUnit->Can_Arc_TxMbMask;\r
  }\r
  \r
  //-------------------------------------------------------------------\r
  static void Can_BusOff( int unit ) {\r
    flexcan_t *canHw = GET_CONTROLLER(unit);\r
    Can_UnitType *canUnit = GET_PRIVATE_DATA(unit);\r
-   Can_EcoreErrorType err;\r
+   Can_Arc_ErrorType err;\r
    err.R = 0;\r
  \r
    if ( canHw->ESR.B.TWRNINT )\r
  \r
    if (err.R != 0)\r
    {\r
-     if (GET_CALLBACKS()->EcoreError != NULL)\r
+     if (GET_CALLBACKS()->Arc_Error != NULL)\r
      {\r
-       GET_CALLBACKS()->EcoreError( unit, err );\r
+       GET_CALLBACKS()->Arc_Error( unit, err );\r
      }\r
    }\r
  \r
@@@ -557,12 -545,12 +558,12 @@@ static void Can_Isr(int unit) 
        //\r
  \r
        // Rx\r
-       hohObj= canHwConfig->CanEcoreHoh;\r
+       hohObj= canHwConfig->Can_Arc_Hoh;\r
        --hohObj;\r
        do {\r
          ++hohObj;\r
  \r
-         mbMask = hohObj->CanEcoreMbMask & iFlagLow;\r
+         mbMask = hohObj->Can_Arc_MbMask & iFlagLow;\r
  \r
          if (hohObj->CanObjectType == CAN_OBJECT_TYPE_RECEIVE)\r
          {\r
              canHw->IFRL.R = (1<<mbNr);\r
            }\r
          }\r
-       } while ( !hohObj->CanEcoreEOL);\r
+       } while ( !hohObj->Can_Arc_EOL);\r
  \r
        // Tx\r
-       hohObj= canHwConfig->CanEcoreHoh;\r
+       hohObj= canHwConfig->Can_Arc_Hoh;\r
        --hohObj;\r
        do {\r
          ++hohObj;\r
  \r
          if (hohObj->CanObjectType == CAN_OBJECT_TYPE_TRANSMIT)\r
          {\r
-           mbMask = hohObj->CanEcoreMbMask & iFlagLow;\r
+           mbMask = hohObj->Can_Arc_MbMask & iFlagLow;\r
  \r
            // Loop over the Mb's for this Hoh\r
            for (; mbMask; mbMask&=~(1<<mbNr)) {\r
              canHw->IFRL.R = (1<<mbNr);\r
            }\r
          }\r
-       } while ( !hohObj->CanEcoreEOL);\r
+       } while ( !hohObj->Can_Arc_EOL);\r
  #if defined(CFG_MPC5516) || defined(CFG_MPC5517)\r
      } // FIFO code\r
  #endif\r
      // - Interupt on a masked box\r
    }\r
  \r
-   if (canHwConfig->CanEcoreFifo) {\r
+   if (canHwConfig->Can_Arc_Fifo) {\r
        /* Note\r
         * NOT tested at all\r
         */\r
@@@ -693,7 -681,7 +694,7 @@@ void Can_Init( const Can_ConfigType *co
    Can_Global.initRun = CAN_READY;\r
  \r
  \r
-   for (int configId=0; configId < CAN_ECORE_CTRL_CONFIG_CNT; configId++) {\r
+   for (int configId=0; configId < CAN_ARC_CTRL_CONFIG_CNT; configId++) {\r
      canHwConfig = GET_CONTROLLER_CONFIG(configId);\r
      ctlrId = canHwConfig->CanControllerId;\r
  \r
      canUnit->lock_cnt = 0;\r
  \r
      // Clear stats\r
-     memset(&canUnit->stats, 0, sizeof(Can_EcoreStatisticsType));\r
+     memset(&canUnit->stats, 0, sizeof(Can_Arc_StatisticsType));\r
  \r
      Can_InitController(ctlrId, canHwConfig);\r
  \r
      // Loop through all Hoh:s and map them into the HTHMap\r
      const Can_HardwareObjectType* hoh;\r
-     hoh = canHwConfig->CanEcoreHoh;\r
+     hoh = canHwConfig->Can_Arc_Hoh;\r
      hoh--;\r
      do\r
      {\r
          Can_Global.CanHTHMap[hoh->CanObjectId].CanHOHRef = hoh;\r
          Can_Global.CanHTHMap[hoh->CanObjectId].HxHRef = hoh->CanObjectId;\r
        }\r
-     } while (!hoh->CanEcoreEOL);\r
+     } while (!hoh->Can_Arc_EOL);\r
  \r
      // Note!\r
      // Could install handlers depending on HW objects to trap more errors\r
@@@ -774,7 -762,7 +775,7 @@@ void Can_DeInit(
    const Can_ControllerConfigType *canHwConfig;\r
    uint32 ctlrId;\r
  \r
-   for (int configId=0; configId < CAN_ECORE_CTRL_CONFIG_CNT; configId++) {\r
+   for (int configId=0; configId < CAN_ARC_CTRL_CONFIG_CNT; configId++) {\r
      canHwConfig = GET_CONTROLLER_CONFIG(configId);\r
      ctlrId = canHwConfig->CanControllerId;\r
  \r
      canUnit->lock_cnt = 0;\r
  \r
      // Clear stats\r
-     memset(&canUnit->stats, 0, sizeof(Can_EcoreStatisticsType));\r
+     memset(&canUnit->stats, 0, sizeof(Can_Arc_StatisticsType));\r
    }\r
  \r
    Can_Global.config = NULL;\r
@@@ -835,7 -823,7 +836,7 @@@ void Can_InitController( uint8 controll
  #if defined(CFG_MPC5516) || defined(CFG_MPC5517)\r
    // Note!\r
    // FIFO implemenation not tested\r
-   if( config->CanEcoreFifo ) {\r
+   if( config->Can_Arc_Fifo ) {\r
      canHw->MCR.B.FEN = 1;     // Enable FIFO\r
      canHw->MCR.B.IDAM = 0;    // We want extended id's to match with\r
    }\r
    canHw->MCR.B.MAXMB = MAX_NUM_OF_MAILBOXES - 1;\r
  \r
    /* Disable selfreception */\r
-   canHw->MCR.B.SRXDIS = !config->CanEcoreLoopback;\r
+   canHw->MCR.B.SRXDIS = !config->Can_Arc_Loopback;\r
  \r
    // Clock calucation\r
    // -------------------------------------------------------------------\r
    tq2 = (config->CanControllerSeg2 + 1);\r
    tq = 1 + tq1 + tq2;\r
  \r
 -  // Check TQ limitations..\r
 -  VALIDATE_NO_RV(( (tq1>=4) && (tq1<=16)), 0x2, CAN_E_TIMEOUT ); // Actually should be sent to DEM\r
 -  VALIDATE_NO_RV(( (tq2>=2) && (tq2<=8)), 0x2, CAN_E_TIMEOUT );  // but this is the next best thing\r
 -  VALIDATE_NO_RV(( (tq>8) && (tq<25 )), 0x2, CAN_E_TIMEOUT );\r
 +  // Check TQ limitations..
 +  VALIDATE_DEM_NO_RV(( (tq1>=4) && (tq1<=16)), CAN_E_TIMEOUT );\r
 +  VALIDATE_DEM_NO_RV(( (tq2>=2) && (tq2<=8)), CAN_E_TIMEOUT );\r
 +  VALIDATE_DEM_NO_RV(( (tq>8) && (tq<25 )), CAN_E_TIMEOUT );\r
  \r
    // Assume we're using the peripheral clock instead of the crystal.\r
    clock = McuE_GetPeripheralClock(config->CanCpuClockRef);\r
    canHw->CR.B.PSEG1 = config->CanControllerSeg1;\r
    canHw->CR.B.PSEG2 = config->CanControllerSeg2;\r
    canHw->CR.B.SMP =   1;      // 3 samples better than 1 ??\r
-   canHw->CR.B.LPB =   config->CanEcoreLoopback;\r
+   canHw->CR.B.LPB =   config->Can_Arc_Loopback;\r
    canHw->CR.B.BOFFREC = 1;  // Disable bus off recovery\r
  \r
  #if defined(CFG_MPC5516) || defined(CFG_MPC5517)\r
    // Check if we use individual masks. If so accept anything(=0) for now\r
    if( canHw->MCR.B.BCC ) {\r
-     i = (config->CanEcoreFifo ? 8 : 0 );\r
+     i = (config->Can_Arc_Fifo ? 8 : 0 );\r
      for(;i<63;i++) {\r
        canHw->RXIMR[i].R = 0;\r
      }\r
  #else\r
  #endif\r
    // Set the id's\r
-   if( config->CanEcoreFifo ) {\r
+   if( config->Can_Arc_Fifo ) {\r
      // Clear ID's in FIFO also, MUST set extended bit here\r
      uint32_t *fifoId = (uint32_t*)(((uint8_t *)canHw)+0xe0);\r
      for(int k=0;k<8;k++) {\r
    }\r
  \r
    // Mark all slots as inactive( depending on fifo )\r
-   i = (config->CanEcoreFifo ? 8 : 0 );\r
+   i = (config->Can_Arc_Fifo ? 8 : 0 );\r
    for(; i < 63; i++) {\r
      //canHw->BUF[i].CS.B.CODE = 0;\r
      canHw->BUF[i].CS.R = 0;\r
      Can_FilterMaskType mask = 0xffffffff;\r
  \r
      // Rx\r
-     hohObj = canHwConfig->CanEcoreHoh;\r
+     hohObj = canHwConfig->Can_Arc_Hoh;\r
      --hohObj;\r
      do {\r
        ++hohObj;\r
  \r
-       mbMask = hohObj->CanEcoreMbMask;\r
+       mbMask = hohObj->Can_Arc_MbMask;\r
        mbNr = 0;\r
  \r
        if (hohObj->CanObjectType == CAN_OBJECT_TYPE_RECEIVE)\r
          }\r
  \r
          // Add to global mask\r
-         canUnit->CanEcoreRxMbMask |= hohObj->CanEcoreMbMask;\r
+         canUnit->Can_Arc_RxMbMask |= hohObj->Can_Arc_MbMask;\r
          if( hohObj->CanFilterMaskRef != NULL  ) {\r
            mask &= *hohObj->CanFilterMaskRef;\r
          }\r
        }\r
        else\r
        {\r
-         canUnit->CanEcoreTxMbMask |= hohObj->CanEcoreMbMask;\r
+         canUnit->Can_Arc_TxMbMask |= hohObj->Can_Arc_MbMask;\r
        }\r
-     } while( !hohObj->CanEcoreEOL );\r
+     } while( !hohObj->Can_Arc_EOL );\r
  \r
  \r
      // Set global mask\r
      canHw->RX15MASK.R = 0;\r
    }\r
  \r
-   canUnit->iflagStart = canUnit->CanEcoreTxMbMask;\r
+   canUnit->iflagStart = canUnit->Can_Arc_TxMbMask;\r
  \r
    canUnit->state = CANIF_CS_STOPPED;\r
    Can_EnableControllerInterrupts(cId);\r
@@@ -1077,18 -1065,18 +1078,18 @@@ void Can_EnableControllerInterrupts( ui
    canHw->IMRH.R = 0;\r
    canHw->IMRL.R = 0;\r
  \r
-   if( canHwConfig->CanRxProcessing == CAN_ECORE_PROCESS_TYPE_INTERRUPT ) {\r
+   if( canHwConfig->CanRxProcessing == CAN_ARC_PROCESS_TYPE_INTERRUPT ) {\r
      /* Turn on the interrupt mailboxes */\r
-     canHw->IMRL.R = canUnit->CanEcoreRxMbMask;\r
+     canHw->IMRL.R = canUnit->Can_Arc_RxMbMask;\r
    }\r
  \r
-   if( canHwConfig->CanTxProcessing == CAN_ECORE_PROCESS_TYPE_INTERRUPT ) {\r
+   if( canHwConfig->CanTxProcessing == CAN_ARC_PROCESS_TYPE_INTERRUPT ) {\r
      /* Turn on the interrupt mailboxes */\r
-     canHw->IMRL.R |= canUnit->CanEcoreTxMbMask;\r
+     canHw->IMRL.R |= canUnit->Can_Arc_TxMbMask;\r
    }\r
  \r
    // BusOff here represents all errors and warnings\r
-   if( canHwConfig->CanBusOffProcessing == CAN_ECORE_PROCESS_TYPE_INTERRUPT ) {\r
+   if( canHwConfig->CanBusOffProcessing == CAN_ARC_PROCESS_TYPE_INTERRUPT ) {\r
      canHw->MCR.B.WRNEN = 1;   /* Turn On warning int */\r
  \r
      canHw->CR.B.ERRMSK = 1;   /* Enable error interrupt */\r
    return;\r
  }\r
  \r
- Can_ReturnType Can_Write( Can_EcoreHTHType hth, Can_PduType *pduInfo ) {\r
+ Can_ReturnType Can_Write( Can_Arc_HTHType hth, Can_PduType *pduInfo ) {\r
    uint16_t timer;\r
    uint32_t iflag;\r
    Can_ReturnType rv = CAN_OK;\r
  \r
    canHw = GET_CONTROLLER(controller);\r
    oldMsr = McuE_EnterCriticalSection();\r
-   iflag = canHw->IFRL.R & canUnit->CanEcoreTxMbMask;\r
+   iflag = canHw->IFRL.R & canUnit->Can_Arc_TxMbMask;\r
  \r
    // check for any free box\r
    // Normally we would just use the iflag to get the free box\r
@@@ -1206,7 -1194,7 +1207,7 @@@ void Can_MainFunction_Wakeup( void ) 
   * @param stats Pointer to data to copy statistics to\r
   */\r
  \r
- void Can_EcoreGetStatistics( uint8 controller, Can_EcoreStatisticsType *stats)\r
+ void Can_Arc_GetStatistics( uint8 controller, Can_Arc_StatisticsType *stats)\r
  {\r
    Can_UnitType *canUnit = GET_PRIVATE_DATA(controller);\r
    *stats = canUnit->stats;\r
@@@ -1234,7 -1222,7 +1235,7 @@@ Can_ReturnType Can_SetControllerMode( u
        return E_OK;\r
  }\r
  \r
- Can_ReturnType Can_Write( Can_EcoreHTHType hth, Can_PduType *pduInfo )\r
+ Can_ReturnType Can_Write( Can_Arc_HTHType hth, Can_PduType *pduInfo )\r
  {\r
        // Write to mailbox on controller here.\r
        DEBUG(DEBUG_MEDIUM, "Can_Write(stub): Received data ");\r
@@@ -1274,7 -1262,7 +1275,7 @@@ void Can_MainFunction_Read( void ){
  void Can_MainFunction_BusOff( void ){}\r
  void Can_MainFunction_Wakeup( void ){}\r
  \r
- void Can_EcoreGetStatistics( uint8 controller, Can_EcoreStatisticsType * stat){}\r
+ void Can_Arc_GetStatistics( uint8 controller, Can_Arc_StatisticsType * stat){}\r
  \r
  #endif\r
  \r
index 1813c9af758878e58c1e34dbe474a502893a12ce,5e2537dd897b54f6fadfd817566c12f04bff62df..68d21727326ab31616919a2183451ae52c668e41
@@@ -59,9 -59,6 +59,9 @@@
  #include <assert.h>
  #include <string.h>
  #include "Det.h"
 +#if defined(USE_DEM)
 +#include "Dem.h"
 +#endif
  #include "h7f_types.h"
  #include "Cpu.h"
  #include "mpc55xx.h"
@@@ -316,13 -313,13 +316,13 @@@ typedef enum 
    FLS_JOB_ERASE,
    FLS_JOB_READ,
    FLS_JOB_WRITE,
- } Fls_EcoreJobType;
+ } Fls_Arc_JobType;
  
  #if 0
  typedef struct {
    MemIf_StatusType    status;
    MemIf_JobResultType jobResultType;
-   Fls_EcoreJobType    jobType;
+   Fls_Arc_JobType     jobType;
    MemIf_AddressType   sourceAddr;
    uint8 *targetAddr;
    MemIf_LengthType length;
@@@ -354,7 -351,7 +354,7 @@@ typedef struct 
  
    MemIf_StatusType    status;
    MemIf_JobResultType jobResultType;
-   Fls_EcoreJobType    jobType;
+   Fls_Arc_JobType     jobType;
    MemIf_AddressType   sourceAddr;
    uint8 *targetAddr;
    MemIf_LengthType length;
@@@ -667,9 -664,7 +667,9 @@@ void Fls_MainFunction( void 
          Fls_Global.jobResultType = MEMIF_JOB_FAILED;
          Fls_Global.jobType = FLS_JOB_NONE;
          Fls_Global.status = MEMIF_IDLE;
 -        DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_WRITE_FAILED );
 +#if defined(USE_DEM)
 +              Dem_ReportErrorStatus(FLS_E_WRITE_FAILED, DEM_EVENT_STATUS_FAILED);
 +#endif
          FEE_JOB_ERROR_NOTIFICATION();
        }
        break;
          Fls_Global.jobResultType = MEMIF_JOB_FAILED;
          Fls_Global.jobType = FLS_JOB_NONE;
          Fls_Global.status = MEMIF_IDLE;
 -        DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_WRITE_FAILED );
 -        FEE_JOB_ERROR_NOTIFICATION();
 +#if defined(USE_DEM)
 +              Dem_ReportErrorStatus(FLS_E_WRITE_FAILED, DEM_EVENT_STATUS_FAILED);
 +#endif
 +              FEE_JOB_ERROR_NOTIFICATION();
        }
  
        break;
index 38682f64e78597c11400da82d753467a37fd22f8,900fd5a1bcc69f70fe2bdd46321a57e6cabf08e1..77a654ba675a4adc8acef0a08ae9b7ea6f7c3319
  #include <string.h>\r
  #include "Std_Types.h"\r
  #include "Mcu.h"\r
 -#include "Det.h"\r
 +#include "Det.h"
 +#if defined(USE_DEM)
 +#include "Dem.h"
 +#endif
  #include "mpc55xx.h"\r
  #include "Cpu.h"\r
  #include "Ramlog.h"\r
@@@ -104,8 -101,11 +104,8 @@@ Mcu_GlobalType Mcu_Global 
  //-------------------------------------------------------------------\r
  \r
  static void Mcu_LossOfLock( void  ) {\r
 -#if ( MCU_DEV_ERROR_DETECT == STD_ON )\r
 -      /* Should report MCU_E_CLOCK_FAILURE with DEM here.... but\r
 -       * we do the next best thing. Report with Det with API = 0\r
 -       */\r
 -      Det_ReportError(MODULE_ID_MCU,0,0,MCU_E_PLL_NOT_LOCKED);\r
 +#if defined(USE_DEM)
 +      Dem_ReportErrorStatus(MCU_E_CLOCK_FAILURE, DEM_EVENT_STATUS_FAILED);
  #endif\r
  \r
        Mcu_Global.stats.lossOfLockCnt++;\r
@@@ -128,9 -128,10 +128,10 @@@ static void Mcu_LossOfCLock( void  ) 
  #define SPR_PIR 286\r
  #define SPR_PVR 287\r
  \r
- #define CORE_PVR_E200Z1   0x81440000UL\r
- #define CORE_PVR_E200Z0   0x81710000UL\r
- #define CORE_PVR_E200Z6   0x81170000UL\r
+ #define CORE_PVR_E200Z1       0x81440000UL\r
+ #define CORE_PVR_E200Z0       0x81710000UL
+ #define CORE_PVR_E200Z3       0x81120000UL\r
+ #define CORE_PVR_E200Z6       0x81170000UL\r
  \r
  \r
  typedef struct {\r
@@@ -153,12 -154,17 +154,17 @@@ cpu_info_t cpu_info_list[] 
      {\r
      .name = "MPC5516",\r
      .pvr = CORE_PVR_E200Z0,\r
-     },\r
+     },
  #elif defined(CFG_MPC5567)\r
      {\r
        .name = "MPC5567",\r
        .pvr = CORE_PVR_E200Z6,\r
-     }\r
+     }
+ #elif defined(CFG_MPC5633)
+     {
+     .name = "MPC563X",
+     .pvr = CORE_PVR_E200Z3,
+     },
  #endif\r
  };\r
  \r
@@@ -176,7 -182,12 +182,12 @@@ core_info_t core_info_list[] = 
      {\r
        .name = "CORE_E200Z6",\r
        .pvr = CORE_PVR_E200Z6,\r
-     }\r
+     }
+ #elif defined(CFG_MPC5633)
+     {
+     .name = "CORE_E200Z3",
+     .pvr = CORE_PVR_E200Z3,
+     },\r
  #endif\r
  };\r
  \r
@@@ -488,13 -499,14 +499,14 @@@ uint32_t McuE_GetSystemClock(void
     * System clock calculation\r
     *\r
     * 5516 -  f_sys = extal * (emfd+16) / ( (eprediv+1) * ( erfd+1 ));\r
-    * 5567 -  f_sys = extal * (emfd+4) / ( (eprediv+1) * ( 2^erfd ));\r
+    * 5567 -  f_sys = extal * (emfd+4) / ( (eprediv+1) * ( 2^erfd ));
+    * 563x -  We run in legacy mode = 5567
     */\r
  #if defined(CFG_MPC5516)\r
    uint32_t eprediv = FMPLL.ESYNCR1.B.EPREDIV;\r
    uint32_t emfd = FMPLL.ESYNCR1.B.EMFD;\r
    uint32_t erfd = FMPLL.ESYNCR2.B.ERFD;\r
- #elif defined(CFG_MPC5554) || defined(CFG_MPC5567)\r
+ #elif defined(CFG_MPC5554) || defined(CFG_MPC5567) || defined(CFG_MPC5633)\r
    uint32_t eprediv = FMPLL.SYNCR.B.PREDIV;\r
    uint32_t emfd = FMPLL.SYNCR.B.MFD;\r
    uint32_t erfd = FMPLL.SYNCR.B.RFD;\r
    uint32_t f_sys;\r
    uint32  extal = Mcu_Global.config->McuClockSettingConfig[Mcu_Global.clockSetting].McuClockReferencePoint;\r
  \r
-   f_sys =  CALC_SYSTEM_CLOCK(extal,emfd,eprediv,erfd);\r
+   f_sys =  CALC_SYSTEM_CLOCK(extal,emfd,eprediv,erfd);
  \r
    return f_sys;\r
  }\r
diff --combined boards/board_common.mk
index 4f36f58c5310b7a4f3c236be2660372a2ee11c8d,8905c59e3e2278e6de1896f0d9dda0cc3a6cdf8e..9bed78fb7fc25df8be33057c70e05bffe938bca4
@@@ -41,8 -41,12 +41,12 @@@ inc-$(CFG_MPC55XX) +=  $(ROOTDIR)/$(ARC
  # Can\r
  obj-$(USE_CAN) += Can.o\r
  obj-$(USE_CAN) += Can_Lcfg.o\r
\r
+ # CanIf\r
  obj-$(USE_CANIF) += CanIf.o\r
  obj-$(USE_CANIF) += CanIf_Cfg.o\r
+ vpath-$(USE_CANIF) += $(ROOTDIR)/communication/CanIf\r
+ inc-$(USE_CANIF) += $(ROOTDIR)/communication/CanIf\r
  \r
  obj-$(USE_DIO) += Dio.o\r
  obj-$(USE_DIO) += Dio_Lcfg.o\r
@@@ -128,13 -132,6 +132,13 @@@ inc-$(USE_PDUR) += $(ROOTDIR)/communica
  inc-$(USE_COM) += $(ROOTDIR)/communication/PduR\r
  vpath-$(USE_PDUR) += $(ROOTDIR)/communication/PduR\r
  \r
 +#Dem\r
 +obj-$(USE_DEM) += Dem.o\r
 +obj-$(USE_DEM) += Dem_LCfg.o\r
 +inc-$(USE_DEM) += $(ROOTDIR)/diagnostic/Dem\r
 +vpath-$(USE_DEM) += $(ROOTDIR)/diagnostic/Dem\r
 +\r
 +\r
  #tests\r
  #obj-y += RunTests.o\r
  #obj-$(USE_CAN) += can_test.o\r
@@@ -207,4 -204,4 +211,4 @@@ inc-y += $(ROOTDIR)/drivers/tes
  # And last the generic board\r
  #\r
  inc-y += $(ROOTDIR)/boards/generic\r
 -\r
 +vpath-y += $(ROOTDIR)/boards/generic\r
index bd3860579e549535bdcd061de2f65ae44f0aae31,0780504e134b0e41809a92d00dfa4717511f2c4c..caf66f38b5ad0ed90e2442ebf673228e3b161fa6
  #include <string.h>\r
  \r
  \r
 -#include "Det.h"\r
 +#include "Det.h"
 +#if defined(USE_DEM)
 +#include "Dem.h"\r
 +#endif
  #include "PduR.h"\r
  #include "PduR_Com.h"\r
  #include "PduR_CanIf.h"\r
@@@ -85,7 -82,7 +85,7 @@@ void PduR_Init (const PduR_PBConfigType
        int bufferNr = 0;\r
        int i = 0;\r
        PduRRoutingPath_type *path;\r
-       for (i = 0; !PduRConfig->PduRRoutingTable->PduRRoutingPath[i].PduREcoreEOL && !failed; i++) {\r
+       for (i = 0; !PduRConfig->PduRRoutingTable->PduRRoutingPath[i].PduR_Arc_EOL && !failed; i++) {\r
                PduRConfig->PduRRoutingTable->NRoutingPaths++;\r
                path = &PduRConfig->PduRRoutingTable->PduRRoutingPath[i];\r
  \r
@@@ -155,9 -152,8 +155,9 @@@ void PduR_BufferQueue(PduRTxBuffer_typ
  \r
        if (PduR_BufferIsFull(Buffer)) { // Buffer is full\r
                PduR_BufferFlush(Buffer);\r
 -              DET_REPORTERROR(PDUR_MODULE_ID, PDUR_INSTANCE_ID, 0x00, PDUR_E_PDU_INSTANCE_LOST);\r
 -\r
 +#if defined(USE_DEM)
 +              Dem_ReportErrorStatus(PDUR_E_PDU_INSTANCE_LOST, DEM_EVENT_STATUS_FAILED);\r
 +#endif\r
  \r
        } else {\r
                // Copy data to last place in buffer\r
diff --combined include/Can.h
index a03b57771816ced323bab6fa0ce82bb7fc4148b6,3fd1f2f9ee0261174277c74b3eb390aa39d2db56..a61abb39bcb5b7a4e45d693c64b3e513ed22ae10
@@@ -42,6 -42,8 +42,6 @@@
  // Init transition for current mode\r
  #define CAN_E_TRANSITION       0x06\r
  \r
 -#define CAN_E_TIMEOUT          0x10  // Should be defined by DEM\r
 -\r
  \r
  #include "Std_Types.h"\r
  #include "CanIf_Types.h"\r
@@@ -56,7 -58,7 +56,7 @@@ typedef struct 
        uint32 boffCnt;\r
        uint32 fifoOverflow;\r
        uint32 fifoWarning;\r
- } Can_EcoreStatisticsType;\r
+ } Can_Arc_StatisticsType;\r
  \r
  \r
  // uint16: if only Standard IDs are used\r
@@@ -109,7 -111,7 +109,7 @@@ typedef union 
           volatile uint32_t TXWRN:1;\r
           volatile uint32_t RXWRN:1;\r
       } B;\r
-  } Can_EcoreErrorType;\r
+  } Can_Arc_ErrorType;\r
  \r
  // Each controller has 32 hth's, so the division of 32 will give the\r
  // controller.\r
@@@ -131,7 -133,7 +131,7 @@@ void Can_EnableControllerInterrupts( ui
  // Hth - for Flexcan, the hardware message box number... .We don't care\r
  \r
  \r
- Can_ReturnType Can_Write( Can_EcoreHTHType hth, Can_PduType *pduInfo );\r
+ Can_ReturnType Can_Write( Can_Arc_HTHType hth, Can_PduType *pduInfo );\r
  \r
  void Can_Cbk_CheckWakeup( uint8 controller );\r
  void Can_MainFunction_Write( void );\r
@@@ -139,6 -141,6 +139,6 @@@ void Can_MainFunction_Read( void )
  void Can_MainFunction_BusOff( void );\r
  void Can_MainFunction_Wakeup( void );\r
  \r
- void Can_EcoreGetStatistics( uint8 controller, Can_EcoreStatisticsType * stat);\r
+ void Can_Arc_GetStatistics( uint8 controller, Can_Arc_StatisticsType * stat);\r
  \r
  #endif /*CAN_H_*/\r
index abaa2221e0d2f2f418569e0d6f10e5aee0d30d26,ac1308076227f672f7f7c577ae8989d7187a85fe..e1eec7e1c744cac8ccb2b2d43a0f645163934a84
  #include "Fls.h"\r
  #include "Fls_SST25xx.h"\r
  #include "Spi.h"\r
 -//#include "Dem.h"\r
  #include "Det.h"\r
 +#if defined(USE_DEM)
 +#include "Dem.h"
 +#endif
  #include <stdlib.h>\r
  #include <assert.h>\r
  //#include <stdio.h>\r
@@@ -263,7 -261,7 +263,7 @@@ typedef enum 
    FLS_SST25XX_ERASE,\r
    FLS_SST25XX_READ,\r
    FLS_SST25XX_WRITE,\r
- } Fls_SST25xx_EcoreJobType;\r
+ } Fls_SST25xx_Arc_JobType;\r
  \r
  /* Spi job state */\r
  typedef enum {\r
@@@ -278,7 -276,7 +278,7 @@@ typedef struct 
        Fls_AddressType flsAddr;\r
        uint32 left;\r
        Job_StateType state;\r
-       Fls_SST25xx_EcoreJobType mainState;\r
+       Fls_SST25xx_Arc_JobType mainState;\r
        Spi_SequenceType currSeq;\r
        uint32 chunkSize;\r
  } Fls_SST25xx_JobInfoType;\r
@@@ -292,7 -290,7 +292,7 @@@ typedef struct 
    // Status of driver\r
    MemIf_StatusType status;\r
    MemIf_JobResultType jobResultType;\r
-   Fls_SST25xx_EcoreJobType jobType;\r
+   Fls_SST25xx_Arc_JobType jobType;\r
  \r
    // Saved information from API calls.\r
    Fls_AddressType flsAddr;\r
@@@ -727,9 -725,7 +727,9 @@@ void Fls_SST25xx_MainFunction( void 
                        } else if( jobResult == SPI_SEQ_OK ) {\r
  \r
                                if( memcmp(Fls_SST25xx_CompareBuffer,gJob->targetAddr, readSize) != 0 ) {\r
 -                                      DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_COMPARE_FAILED );\r
 +#if defined(USE_DEM)
 +                                      Dem_ReportErrorStatus(FLS_E_COMPARE_FAILED, DEM_EVENT_STATUS_FAILED);\r
 +#endif
                                        FEE_JOB_ERROR_NOTIFICATION();\r
                                        return;\r
                                }\r
          Fls_SST25xx_Global.jobType = FLS_SST25XX_NONE;\r
          Fls_SST25xx_Global.status = MEMIF_IDLE;\r
  \r
 -                              DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_COMPARE_FAILED );\r
 +#if defined(USE_DEM)
 +                              Dem_ReportErrorStatus(FLS_E_COMPARE_FAILED, DEM_EVENT_STATUS_FAILED);
 +#endif
                                FEE_JOB_ERROR_NOTIFICATION();\r
                        }\r
                }\r
  \r
                switch(Fls_SST25xx_Global.jobType) {\r
                case FLS_SST25XX_ERASE:\r
 -                                      DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_ERASED_FAILED );\r
 +#if defined(USE_DEM)
 +                                      Dem_ReportErrorStatus(FLS_E_ERASED_FAILED, DEM_EVENT_STATUS_FAILED);\r
 +#endif
                                        break;\r
                case FLS_SST25XX_READ:\r
 -                                      DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_READ_FAILED );\r
 +#if defined(USE_DEM)
 +                                      Dem_ReportErrorStatus(FLS_E_READ_FAILED, DEM_EVENT_STATUS_FAILED);\r
 +#endif
                                        break;\r
                case FLS_SST25XX_WRITE:\r
 -                                      DET_REPORTERROR(MODULE_ID_FLS,0, 0x6, FLS_E_WRITE_FAILED );\r
 +#if defined(USE_DEM)
 +                                      Dem_ReportErrorStatus(FLS_E_WRITE_FAILED, DEM_EVENT_STATUS_FAILED);\r
 +#endif
                                        break;\r
                default:\r
                        assert(0);\r
index fcd9bd057545a1dfd1ccd366570e92c08fbe99a7,15c88eb354b8cfb6b8ac952a098bb1671644a0ef..d57f160ba9255afdbbbf9ecb7045203bb1cadf1c
@@@ -26,9 -26,6 +26,9 @@@
  \r
  #include "EcuM.h"\r
  #include "Det.h"\r
 +#if defined(USE_DEM)
 +#include "Dem.h"
 +#endif
  #if defined(USE_MCU)\r
  #include "Mcu.h"\r
  #endif\r
@@@ -55,12 -52,6 +55,12 @@@ void EcuM_AL_DriverInitZero(
  {\r
        Det_Init();\r
      Det_Start();\r
 +
 +#if defined(USE_DEM)
 +      // Preinitialize DEM
 +      Dem_PreInit();
 +#endif
 +
  }\r
  \r
  EcuM_ConfigType* EcuM_DeterminePbConfiguration()\r
@@@ -161,18 -152,13 +161,18 @@@ void EcuM_AL_DriverInitTwo(const EcuM_C
        Com_Init(ConfigPtr->ComConfig);\r
  #endif\r
  \r
 +#if defined(USE_DEM)
 +      // Initialize DEM
 +      Dem_Init();
 +#endif
 +
  }\r
  \r
  void EcuM_AL_DriverInitThree(const EcuM_ConfigType ConfigPtr)\r
  {\r
  #if defined(USE_CANIF)\r
-       // Startup the CAN interafce; due to the missing COM manager\r
-       CanIf_InitController(CAN_CTRL_A, 0);\r
-       CanIf_SetControllerMode(CAN_CTRL_A, CANIF_CS_STARTED);\r
+       // Startup the CAN interface; due to the missing COM manager\r
+       CanIf_InitController(CANIF_CHANNEL_0, CANIF_CHANNEL_0_CONFIG_0);\r
+       CanIf_SetControllerMode(CANIF_CHANNEL_0, CANIF_CS_STARTED);\r
  #endif\r
  }\r