]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Separated Com and PduR includes for easier testing. CanIf_Init now inits controllers...
authortojo <devnull@localhost>
Wed, 12 May 2010 09:34:23 +0000 (11:34 +0200)
committertojo <devnull@localhost>
Wed, 12 May 2010 09:34:23 +0000 (11:34 +0200)
14 files changed:
communication/CanIf/CanIf.c
communication/Com/Com.c
communication/Com/Com_Com.c
communication/Com/Com_RunTest.c
communication/Com/Com_misc.h
include/Com.h
include/Com_Com.h
include/PduR_CanIf.h [moved from communication/PduR/PduR_CanIf.h with 100% similarity]
include/PduR_CanTp.h [moved from communication/PduR/PduR_CanTp.h with 100% similarity]
include/PduR_Com.h [moved from communication/PduR/PduR_Com.h with 100% similarity]
include/PduR_Dcm.h [moved from communication/PduR/PduR_Dcm.h with 100% similarity]
include/PduR_If.h [moved from communication/PduR/PduR_If.h with 100% similarity]
include/PduR_LinIf.h [moved from communication/PduR/PduR_LinIf.h with 100% similarity]
include/PduR_Types.h [moved from communication/PduR/PduR_Types.h with 100% similarity]

index 0caf63e71dec6caeecaf51ca15a6a1c02fedf573..2cda282339cae665749e488e2e6dbb8de23213e3 100644 (file)
@@ -88,6 +88,8 @@ typedef struct
   CanIf_ChannelPrivateType channelData[CANIF_CHANNEL_CNT];
 } CanIf_GlobalType;
 
+void CanIf_PreInit_InitController(uint8 Controller, uint8 ConfigurationIndex);
+
 static CanIf_Arc_ChannelIdType CanIf_Arc_FindHrhChannel( Can_Arc_HRHType hrh )
 {
   const CanIf_HrhConfigType *hrhConfig;
@@ -120,11 +122,9 @@ void CanIf_Init(const CanIf_ConfigType *ConfigPtr)
   {
     CanIf_Global.channelData[i].ControllerMode = CANIF_CS_STOPPED;
     CanIf_Global.channelData[i].PduMode = CANIF_GET_OFFLINE;
+    CanIf_PreInit_InitController(i, CanIf_ConfigPtr->Arc_ChannelDefaultConfIndex[i]);
   }
 
-  for(uint8 i = 0; i < CANIF_CHANNEL_CNT; i++){
-         CanIf_InitController(i, CanIf_ConfigPtr->Arc_ChannelDefaultConfIndex[i]);
-  }
 
   CanIf_Global.initRun = TRUE;
 }
@@ -196,6 +196,19 @@ void CanIf_InitController(uint8 Controller, uint8 ConfigurationIndex)
   CanIf_SetControllerMode(channel, CANIF_CS_STOPPED);
 }
 
+void CanIf_PreInit_InitController(uint8 Controller, uint8 ConfigurationIndex){
+       // We call this a CanIf channel. Hopefully makes it easier to follow.
+       CanIf_Arc_ChannelIdType channel = Controller;
+       const CanControllerIdType canControllerId = ARC_GET_CHANNEL_CONTROLLER(channel);
+       // Validate that the configuration at the index match the right channel
+       VALIDATE_NO_RV(CanIf_ConfigPtr->ControllerConfig[ConfigurationIndex].CanIfControllerIdRef == channel, CANIF_INIT_CONTROLLER_ID, CANIF_E_PARAM_CONTROLLER);
+       const Can_ControllerConfigType *canConfig = CanIf_ConfigPtr->ControllerConfig[ConfigurationIndex].CanIfInitControllerRef;
+       // Validate that the CanIfControllerConfig points to configuration for the right Can Controller
+       VALIDATE_NO_RV(canConfig->CanControllerId == canControllerId, CANIF_INIT_CONTROLLER_ID, CANIF_E_PARAM_CONTROLLER);
+
+       Can_InitController(canControllerId, canConfig);
+}
+
 //-------------------------------------------------------------------
 
 Std_ReturnType CanIf_SetControllerMode(uint8 Controller,
index db193508c546189d9d470253fb0cb7b199b81a65..c57b59200e396dc38677ee8f15ffc1f4822453f6 100644 (file)
@@ -24,7 +24,8 @@
 #include <stdlib.h>\r
 //#include <stdio.h>\r
 #include <string.h>\r
-#include "Com.h"\r
+#include "Com.h"
+#include "Com_Arc_Types.h"\r
 #include "Com_Types.h"\r
 #include "debug.h"\r
 \r
index b764e89f28f8fc1ad4d78ee698c39272dd9cc89b..73c404e5ba9683f9fbc8bf5b1492bb517a661fe4 100644 (file)
 
 #include <stdlib.h>\r
 #include <string.h>\r
-#include "Com_Com.h"\r
+#include "Com_Com.h"
+#include "Com_misc.h"
 #include "debug.h"\r
 #include "CanIf.h"\r
 #include "PduR.h"\r
 #include "PduR_Com.h"\r
 #include "Byteorder.h"\r
+
+extern Com_Arc_Config_type Com_Arc_Config;
 \r
 uint8 Com_SendSignal(Com_SignalIdType SignalId, const void *SignalDataPtr) {\r
        COM_VALIDATE_SIGNAL(SignalId, 0x0a, E_NOT_OK);\r
index 259c0466803008c077c5d4f053ac96ba64e28b38..4d8d46148bb1f402f64c033e79bd174d00c1a8f4 100644 (file)
@@ -21,7 +21,8 @@
 
 
 #include "Com_RunTest.h"\r
-#include "Com.h"\r
+#include "Com.h"
+#include "Com_Arc_Types.h"\r
 #include "debug.h"\r
 #include <stdlib.h>\r
 \r
index 0cb28df361b5a0bb8556a8c8a77f367b1b3ee39f..a8c356ef38caba13ef97186e16cc12cebce629c1 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef COM_MISC_H_\r
 #define COM_MISC_H_\r
 \r
-#include "Com.h"\r
 /*\r
  * The following function are exported only for testing purposes.\r
  */\r
index d6e7eadf1f596acf5dd15609158a30451beadfd7..a6329d3653ffa2e33557f88855522e14882d409d 100644 (file)
@@ -25,7 +25,6 @@
 \r
 #include "Std_Types.h"\r
 #include "ComStack_Types.h"\r
-#include "Com_Arc_Types.h"\r
 \r
 \r
 #ifdef COM_DEV_ERROR_DETECT\r
@@ -44,8 +43,6 @@
 \r
 const Com_ConfigType * ComConfig;\r
 \r
-Com_Arc_Config_type Com_Arc_Config;\r
-\r
 \r
 \r
 #ifdef COM_DEV_ERROR_DETECT\r
index 0e9978ae5250458c4c5319c7e014532c2501dba7..b57a8bba95a52712a1d11addeb854cbe030b822a 100644 (file)
@@ -24,7 +24,6 @@
 #define COM_COM_H_\r
 \r
 #include "Com.h"\r
-#include "Com_misc.h"\r
 #include "PduR.h"\r
 \r
 uint8 Com_SendSignal(Com_SignalIdType SignalId, const void *SignalDataPtr);\r