CORDET Framework - C2 Implementation
CrFwInitProc.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include framework files */
21 #include "CrFwInitProc.h"
22 #include "CrFwBaseCmp.h"
24 /* Include configuration files */
25 #include "CrFwCmpData.h"
26 /* Include FW Profile files */
27 #include "FwPrConstants.h"
28 #include "FwPrDCreate.h"
29 #include "FwPrConfig.h"
30 #include "FwPrCore.h"
31 
33 static FwPrDesc_t initPrDesc = NULL;
34 
35 /*-----------------------------------------------------------------------------------------*/
36 void CrFwBaseCmpDefInitCheck(FwPrDesc_t prDesc) {
37  CrFwSetPrOutcome(prDesc, 1);
38  return;
39 }
40 
41 /*-----------------------------------------------------------------------------------------*/
42 void CrFwBaseCmpDefInitAction(FwPrDesc_t prDesc) {
43  CrFwSetPrOutcome(prDesc, 1);
44  return;
45 }
46 
47 /*-----------------------------------------------------------------------------------------*/
48 FwPrDesc_t CrFwCmpGetInitProc() {
49  const FwPrCounterS1_t nOfANodes = 2; /* Number of action nodes */
50  const FwPrCounterS1_t nOfDNodes = 1; /* Number of decision nodes */
51  const FwPrCounterS1_t nOfFlows = 5; /* Number of control flows */
52  const FwPrCounterS1_t nOfActions = 2; /* Number of actions */
53  const FwPrCounterS1_t nOfGuards = 1; /* Number of guards */
54  const FwPrCounterS1_t N1 = 1; /* Identifier of first action node */
55  const FwPrCounterS1_t N2 = 2; /* Identifier of second action node */
56  const FwPrCounterS1_t D1 = 1; /* Identifier of first decision node */
57 
58  if (initPrDesc != NULL)
59  return initPrDesc;
60 
61  /* Create the initialization procedure */
62  initPrDesc = FwPrCreate(nOfANodes, nOfDNodes, nOfFlows, nOfActions, nOfGuards);
63 
64  /* Configure the initialization procedure */
65  FwPrAddActionNode(initPrDesc, N1, &CrFwBaseCmpDefInitCheck);
66  FwPrAddActionNode(initPrDesc, N2, &CrFwBaseCmpDefInitAction);
67  FwPrAddDecisionNode(initPrDesc, D1, 2);
68  FwPrAddFlowIniToAct(initPrDesc, N1, NULL);
69  FwPrAddFlowActToDec(initPrDesc, N1, D1, NULL);
70  FwPrAddFlowDecToAct(initPrDesc, D1, N2, &CrFwIsPrOutcomeOne);
71  FwPrAddFlowDecToFin(initPrDesc, D1, NULL); /* Else branch */
72  FwPrAddFlowActToFin(initPrDesc, N2, NULL);
73 
74  return initPrDesc;
75 }
76 
77 
78 
79 
80 
Definition of the Framework Component Data (FCD) Type.
static FwPrDesc_t initPrDesc
The singleton instance of the CIP.
Definition: CrFwInitProc.c:33
void CrFwSetPrOutcome(FwPrDesc_t prDesc, CrFwOutcome_t outcome)
Convenience function to set the outcome field of the component data of a procedure.
void CrFwBaseCmpDefInitCheck(FwPrDesc_t prDesc)
Function which performs the default Initialization Check of the CIP.
Definition: CrFwInitProc.c:36
void CrFwBaseCmpDefInitAction(FwPrDesc_t prDesc)
Function which performs the default Initialization Action of the CIP.
Definition: CrFwInitProc.c:42
Definition of the utility functions for the CORDET Framework.
Definition of Base Component.
Component Initialization Procedure (CIP) for the Base Component.
FwPrBool_t CrFwIsPrOutcomeOne(FwPrDesc_t prDesc)
Convenience function to check whether the outcome of the last check or action is equal to 1 ("true" o...
FwPrDesc_t CrFwCmpGetInitProc()
Retrieve the singleton instance of the CIP.
Definition: CrFwInitProc.c:48
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved