FW Profile - C1 Implementation
FwDaCurRecAction.c
Go to the documentation of this file.
1 
10 #include <stdlib.h>
11 #include "FwDaCurRecAction.h"
12 #include "FwDaHwDev.h"
13 #include "FwDaCurCheck.h"
14 #include "FwPrCore.h"
15 #include "FwPrConfig.h"
16 #include "FwPrDCreate.h"
17 
18 /* --------------------------------------------------------------------- */
24 static void HwDevSwitchOff(FwPrDesc_t prDesc);
25 
26 /* --------------------------------------------------------------------- */
33 static void HwDevToStandBy(FwPrDesc_t prDesc);
34 
35 /* --------------------------------------------------------------------- */
45 static FwPrBool_t WaitN1Cycle(FwPrDesc_t prDesc);
46 
47 /* --------------------------------------------------------------------- */
49  static FwPrDesc_t curRecAction = NULL;
50  const FwPrCounterS1_t nOfANodes = 2; /* Number of action nodes */
51  const FwPrCounterS1_t nOfDNodes = 0; /* Number of decision nodes */
52  const FwPrCounterS1_t nOfFlows = 3; /* Number of control flows */
53  const FwPrCounterS1_t nOfActions = 2; /* Number of actions */
54  const FwPrCounterS1_t nOfGuards = 1; /* Number of guards */
55 
56  if (curRecAction != NULL) /* Current Recovery Action was already created */
57  return curRecAction;
58 
59  /* Create and configure the procedure */
60  curRecAction = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
61 
62  FwPrAddActionNode(curRecAction, 1, &HwDevToStandBy);
63  FwPrAddActionNode(curRecAction, 2, &HwDevSwitchOff);
64 
65  FwPrAddFlowIniToAct(curRecAction, 1, NULL);
66  FwPrAddFlowActToAct(curRecAction, 1, 2, &WaitN1Cycle);
67  FwPrAddFlowActToFin(curRecAction, 2, NULL);
68 
69  return curRecAction;
70 }
71 
72 /* --------------------------------------------------------------------- */
73 static void HwDevSwitchOff(FwPrDesc_t prDesc) {
75 }
76 
77 /* --------------------------------------------------------------------- */
78 static void HwDevToStandBy(FwPrDesc_t prDesc) {
80 }
81 
82 /* --------------------------------------------------------------------- */
83 static FwPrBool_t WaitN1Cycle(FwPrDesc_t prDesc) {
85  return 1;
86  else
87  return 0;
88 }
FwPrCounterU3_t FwPrGetNodeExecCnt(FwPrDesc_t prDesc)
Return the Node Execution Counter.
Definition: FwPrCore.c:141
Declaration of the configuration interface for a FW Procedure.
Definition of the Current Failure Detection (FD) Check.
Definition of the interface to access the Hardware Device.
int FwPrBool_t
Type used for booleans (0 is "false" and 1 is "true").
Definition: FwPrConstants.h:48
#define TR_HW_DEV_SBY
Name of the transition from OPERATIONAL to STANDBY in the HW Device State Machine.
Definition: FwDaHwDev.h:44
void FwPrAddFlowActToFin(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrGuard_t cfGuard)
Create a control flow from an action node to the final node and add it to a procedure.
Definition: FwPrConfig.c:205
void FwPrAddFlowActToAct(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from an action node to another action node and add it to a procedure.
Definition: FwPrConfig.c:185
Definition of the Current Failure Recovery Action (RA).
FwPrDesc_t FwPrCreate(FwPrCounterS1_t nOfANodes, FwPrCounterS1_t nOfDNodes, FwPrCounterS1_t nOfFlows, FwPrCounterS1_t nOfActions, FwPrCounterS1_t nOfGuards)
Create a new procedure descriptor.
Definition: FwPrDCreate.c:23
#define CUR_REC_ACTION_N1
Number of wait cycles between the command sending the Hardware Device to Stand-By and the command swi...
#define TR_HW_DEV_OFF
Name of the transition from ON to OFF in the HW Device State Machine.
Definition: FwDaHwDev.h:40
void FwSmMakeTrans(FwSmDesc_t smDesc, FwSmCounterU2_t transId)
Trigger a transition in a state machine.
Definition: FwSmCore.c:92
signed char FwPrCounterS1_t
Type used for signed counters with a "short" range.
Definition: FwPrConstants.h:78
Structure representing a procedure descriptor.
Definition: FwPrPrivate.h:254
FwSmDesc_t GetHwDevSm()
Retrieve the descriptor of the Hardware Device State Machine.
Definition: FwDaHwDev.c:92
void FwPrAddFlowIniToAct(FwPrDesc_t prDesc, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from the initial node to an action node and add it to a procedure.
Definition: FwPrConfig.c:175
Declaration of the dynamical creation interface for a FW Procedure.
void FwPrAddActionNode(FwPrDesc_t prDesc, FwPrCounterS1_t nodeId, FwPrAction_t action)
Create an action node with the given characteristics and add it to a procedure.
Definition: FwPrConfig.c:92
FwPrDesc_t GetCurRecActionPr()
Retrieve the descriptor of the Current Recovery Action Procedure.
Declaration of the execution interface for a FW Procedure.
P&P Software GmbH, Copyright 2011, All Rights Reserved