CORDET Framework - C2 Implementation
CrPsRep3s25ReadyFunc.c
Go to the documentation of this file.
1 
24 #include "CrFwConstants.h"
26 #include "CrPsRep3s25ReadyCreate.h"
27 
28 /* CrFramework includes */
29 #include "OutCmp/CrFwOutCmp.h"
30 #include "CrFwCmpData.h"
31 #include "Pckt/CrFwPckt.h"
32 
34 #include "FwPrConstants.h"
35 #include "FwPrDCreate.h"
36 #include "FwPrConfig.h"
37 #include "FwPrCore.h"
38 #include "FwSmConfig.h"
39 
40 #include <CrPsUserConstants.h>
41 #include <CrPsUtilitiesServHk.h>
42 #include <DataPool/CrPsDpServHk.h>
44 
45 #include <stdlib.h>
46 #include <time.h>
47 
48 
49 /* ----------------------------------------------------------------------------------------------------------------- */
50 
52 void CrPsRep3s25ReadyN1(FwPrDesc_t prDesc)
53 {
54  prDataHkRepReadyCheck_t *prDataPtr;
55 
56  /* Set Cycle Counter to zero */
57 
58  /* Get prData */
59  prDataPtr = FwPrGetData(prDesc);
60 
61  setDpcycleCntItem(prDataPtr->rdlSlot, 0);
62 
63  return;
64 }
65 
67 void CrPsRep3s25ReadyN2(FwPrDesc_t prDesc)
68 {
69  prDataHkRepReadyCheck_t *prDataPtr;
70  CrFwCmpData_t *cmpData;
71 
72  /* Ready Check returns 'Ready' */
73  /* Get smDesc from OutCmp */
74  prDataPtr = FwPrGetData(prDesc);
75 
76  cmpData = (CrFwCmpData_t*) FwSmGetData(prDataPtr->smDesc);
77  cmpData->outcome = 1;
78  FwSmSetData(prDataPtr->smDesc, cmpData);
79 
80  return;
81 }
82 
84 void CrPsRep3s25ReadyN3(FwPrDesc_t prDesc)
85 {
86  prDataHkRepReadyCheck_t *prDataPtr;
87  CrFwCmpData_t *cmpData;
88 
89  /* Ready Check returns 'Not Ready' */
90  /* Get smDesc from OutCmp */
91  prDataPtr = FwPrGetData(prDesc);
92 
93  cmpData = (CrFwCmpData_t*) FwSmGetData(prDataPtr->smDesc);
94  cmpData->outcome = 0;
95  FwSmSetData(prDataPtr->smDesc, cmpData);
96 
97  return;
98 }
99 
101 void CrPsRep3s25ReadyN4(FwPrDesc_t prDesc)
102 {
103  CrFwCounterU4_t cycleCnt;
104  prDataHkRepReadyCheck_t *prDataPtr;
105 
106  /* Increment Cycle Counter */
107 
108  /* Get prData */
109  prDataPtr = FwPrGetData(prDesc);
110 
111  cycleCnt = getDpcycleCntItem(prDataPtr->rdlSlot);
112  cycleCnt++;
113  setDpcycleCntItem(prDataPtr->rdlSlot, cycleCnt);
114 
115  return;
116 }
117 
118 /**************/
119 /*** GUARDS ***/
120 /**************/
121 
123 FwPrBool_t CrPsRep3s25ReadyG1(FwPrDesc_t prDesc)
124 {
125  CrFwCounterU4_t cycleCnt;
126  CrFwBool_t rdlEnabled;
127  prDataHkRepReadyCheck_t *prDataPtr;
128 
129  /* Flag_1 */
130  /* [ (Cycle Counter != 0) || (SID is not enabled in RDL) ] */
131 
132  /* Get prData */
133  prDataPtr = FwPrGetData(prDesc);
134 
135  /* Get Cycle Counter from RDL */
136  cycleCnt = getDpcycleCntItem(prDataPtr->rdlSlot);
137 
138  /* Get isEnabled from RDL */
139  rdlEnabled = getDpisEnabledItem(prDataPtr->rdlSlot);
140 
141 
142 
143  if ((cycleCnt != 0) || (rdlEnabled == 0))
144  {
145  return 1;
146  }
147  else
148  {
149  return 0;
150  }
151 }
152 
154 FwPrBool_t CrPsRep3s25ReadyG2(FwPrDesc_t prDesc)
155 {
156  /* Next Execution */
157  if (FwPrGetNodeExecCnt(prDesc))
158  {
159  return 1;
160  }
161  else
162  {
163  return 0;
164  }
165 }
166 
168 FwPrBool_t CrIaReadyChk3s25ReadyGoToRst(FwPrDesc_t prDesc)
169 {
170  CrFwCounterU4_t cycleCnt;
171  CrPsCollectInterval_t period;
172  prDataHkRepReadyCheck_t *prDataPtr;
173 
174  /* (Cycle Counter == Period) && (SID is Defined) */
175 
176  /* Get prData */
177  prDataPtr = FwPrGetData(prDesc);
178 
179  /* Get Cycle Counter from RDL */
180  cycleCnt = getDpcycleCntItem(prDataPtr->rdlSlot);
181 
182  /* Get Period from RDL */
183  period = getDpperiodItem(prDataPtr->rdlSlot);
184 
185  if ((cycleCnt == period) && (prDataPtr->rdlSlot < HK_N_REP_DEF))
186  {
187  return 1;
188  }
189  else
190  {
191  return 0;
192  }
193 }
194 
196 FwPrBool_t CrPsRep3s25ReadyGoToFin(FwPrDesc_t prDesc)
197 {
198  prDataHkRepReadyCheck_t *prDataPtr;
199 
200  /* (SID is not Defined) */
201 
202  /* Get prData */
203  prDataPtr = FwPrGetData(prDesc);
204 
205  if (prDataPtr->rdlSlot == HK_N_REP_DEF)
206  {
207  return 1;
208  }
209  else
210  {
211  return 0;
212  }
213 }
214 
215 /* ----------------------------------------------------------------------------------------------------------------- */
216 
Type for the Framework Component Data (FCD).
static CrPsPeriod_t getDpperiodItem(int i)
Gets the value of the i-th element in the datapool array period.
Definition: CrPsDpServHk.h:259
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
Interface through which applications can initialize and execute framework PUS extension components...
Header file to define all user-configurable constants and types for the IASW Application.
Interface for accessing data pool items.
void CrPsRep3s25ReadyN2(FwPrDesc_t prDesc)
Action for node N2.
static CrPsFlag_t getDpisEnabledItem(int i)
Gets the value of the i-th element in the datapool array isEnabled.
Definition: CrPsDpServHk.h:229
Header file to define all service and packet identifiers.
Interface for creating and accessing a report or command packet.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
FwPrBool_t CrPsRep3s25ReadyG2(FwPrDesc_t prDesc)
Guard on the Control Flow from N4 to DECISION2.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
FwPrBool_t CrPsRep3s25ReadyG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N3.
static void setDpcycleCntItem(int i, CrFwCounterU4_t cycleCnt)
Sets the value of the i-th element in the datapool array cycleCnt.
Definition: CrPsDpServHk.h:330
uint32_t CrPsCollectInterval_t
Type used for the Collection Interval of a packet.
Create one instance of the CrPsRep3s25Ready procedure.
void CrPsRep3s25ReadyN3(FwPrDesc_t prDesc)
Action for node N3.
FwPrBool_t CrIaReadyChk3s25ReadyGoToRst(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to N1.
void CrPsRep3s25ReadyN1(FwPrDesc_t prDesc)
CrPsRep3s25Ready function definitions.
#define HK_N_REP_DEF
Number of Report Definitions in the Report Definition List (maximum number of housekeeping/diagnostic...
static CrFwCounterU4_t getDpcycleCntItem(int i)
Gets the value of the i-th element in the datapool array cycleCnt.
Definition: CrPsDpServHk.h:319
Definition of the OutComponent Component of the framework.
FwPrBool_t CrPsRep3s25ReadyGoToFin(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to Final Node.
void CrPsRep3s25ReadyN4(FwPrDesc_t prDesc)
Action for node N4.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved