FW Profile - C1 Implementation
FwDaCurCheck.c
Go to the documentation of this file.
1 
10 #include "FwDaFDCheck.h"
11 #include "FwDaHwDev.h"
12 #include "FwDaCurCheck.h"
13 #include "FwDaCurRecAction.h"
14 #include "FwSmCore.h"
15 #include "FwSmConfig.h"
16 #include "FwSmDCreate.h"
17 #include "FwPrCore.h"
18 
19 /* --------------------------------------------------------------------- */
27 static void CurAnomalyDetCheck(FwSmDesc_t smDesc);
28 
29 /* --------------------------------------------------------------------- */
36 static void CurRecoveryAction(FwSmDesc_t smDesc);
37 
38 /* --------------------------------------------------------------------- */
40  static FwSmDesc_t curFdcSm = NULL;
41  static FDCheckData_t smData;
42  FwSmDesc_t esmEnabled;
43 
44  if (curFdcSm != NULL) /* Current FD Check SM was already created */
45  return curFdcSm;
46 
47  /* Extend the generic FD Check State Machine */
48  curFdcSm = FwSmCreateDer(GetFailDetCheckSm());
49 
50  /* Retrieve the SM embedded in state ENABLED */
51  esmEnabled = FwSmGetEmbSm(curFdcSm, FD_CHECK_ENABLED);
52 
53  /* Load the data into the outer SM and into the SM embedded in state ENABLED */
55  smData.fdCheckId = curFDCheckId;
56  FwSmSetData(curFdcSm, &smData);
57  FwSmSetData(esmEnabled, &smData);
58 
59  /* Override the Anomaly Detection Check in the outer SM */
60  FwSmOverrideAction(curFdcSm, &DefAnomalyDetCheck, &CurAnomalyDetCheck);
61 
62  /* Override the Recovery Action in the SM embedded in state ENABLED */
63  FwSmOverrideAction(esmEnabled, &DefRecoveryAction, &CurRecoveryAction);
64 
65  return curFdcSm;
66 }
67 
68 /* --------------------------------------------------------------------- */
69 static void CurAnomalyDetCheck(FwSmDesc_t smDesc) {
70  FDCheckData_t* cfdCheckData = GetFDCheckData(smDesc);
72  cfdCheckData->detectionCheckOutcome = anomalyDetected;
73  else
75 }
76 
77 /* --------------------------------------------------------------------- */
78 static void CurRecoveryAction(FwSmDesc_t smDesc) {
80 }
81 
82 
FDCheckOutcome_t detectionCheckOutcome
The outcome of the last call to the Anomaly Detection Check.
Definition: FwDaFDCheck.h:126
FwSmDesc_t GetFailDetCheckSm()
Retrieve the descriptor of the FD Check State Machine.
Definition: FwDaFDCheck.c:176
Outcome generated when the Anomaly Detection Check detects an anomaly.
Definition: FwDaFDCheck.h:96
#define FD_CHECK_ENABLED
Name of the ENABLED state in the FD Check State Machine.
Definition: FwDaFDCheck.h:66
Declaration of the dynamical creation interface for a FW State Machine.
Declaration of the execution interface for a FW State Machine.
void DefRecoveryAction(FwSmDesc_t smDesc)
Default implementation of the Recovery Action.
Definition: FwDaFDCheck.c:171
FwSmDesc_t GetCurCheckSm()
Retrieve the descriptor of the Current FD Check State Machine.
Definition: FwDaCurCheck.c:39
Definition of the Current Failure Detection (FD) Check.
void DefAnomalyDetCheck(FwSmDesc_t smDesc)
Default implementation of the Anomaly Detection Check.
Definition: FwDaFDCheck.c:164
Outcome generated when the Anomaly Detection Check detects no anomaly.
Definition: FwDaFDCheck.h:94
Declaration of the configuration interface for a FW State Machine.
Definition of the interface to access the Hardware Device.
int cntLimit
The number of consecutive anomalies which must be detected in order for the FD Check to enter state F...
Definition: FwDaFDCheck.h:122
#define HW_DEV_CUR_CNT_LIMIT
Counter limit for the Current FD Check.
Definition: FwDaCurCheck.h:40
Definition of the Current Failure Recovery Action (RA).
FDCheckId_t fdCheckId
Identity of the FD Check to which this data structure is attached.
Definition: FwDaFDCheck.h:112
void FwSmOverrideAction(FwSmDesc_t smDesc, FwSmAction_t oldAction, FwSmAction_t newAction)
Override an action (either a state action or a transition action) in a derived state machine...
Definition: FwSmConfig.c:456
FwSmDesc_t FwSmCreateDer(FwSmDesc_t smDesc)
Create the descriptor of a derived state machine.
Definition: FwSmDCreate.c:137
Type for the data of an FD Check State Machine.
Definition: FwDaFDCheck.h:108
FwSmDesc_t FwSmGetEmbSm(FwSmDesc_t smDesc, FwSmCounterS1_t i)
Return the state machine embedded in the i-th state of the argument state machine.
Definition: FwSmCore.c:217
float GetHwDevCur()
This function returns the current absorbed by the Hardware Device.
Definition: FwDaHwDev.c:129
#define HW_DEV_CUR_MAX_NOM
Maximum nominal current absorbed by the Hardware Device.
Definition: FwDaCurCheck.h:31
Structure representing a state machine descriptor.
Definition: FwSmPrivate.h:303
void FwSmSetData(FwSmDesc_t smDesc, void *smData)
Set the pointer to the state machine data in the state machine descriptor.
Definition: FwSmConfig.c:83
Definition of the Failure Detection (FD) Check State Machine.
FwPrDesc_t GetCurRecActionPr()
Retrieve the descriptor of the Current Recovery Action Procedure.
FDCheckData_t * GetFDCheckData(FwSmDesc_t smDesc)
Get the pointer to the state machine data of an FD Check State Machine.
Definition: FwDaFDCheck.c:159
Identifier of the Current FD Check (see FwDaCurCheck.h)
Definition: FwDaFDCheck.h:84
Declaration of the execution interface for a FW Procedure.
void FwPrStart(FwPrDesc_t prDesc)
Start a procedure.
Definition: FwPrCore.c:29
P&P Software GmbH, Copyright 2011, All Rights Reserved