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