CORDET Framework - C2 Implementation
CrPsCmd17s3PrgrFunc.c
Go to the documentation of this file.
1 
25 #include "CrPsCmd17s3PrgrCreate.h"
26 #include "CrPsCmd17s3StartCreate.h" /* including global variables: rep */
27 
29 #include "FwPrConstants.h"
30 #include "FwPrDCreate.h"
31 #include "FwPrConfig.h"
32 #include "FwPrCore.h"
33 #include "FwSmConfig.h"
34 
35 /* Framework function definitions */
37 #include "OutCmp/CrFwOutCmp.h"
39 #include "CrFwCmpData.h"
40 
41 #include <DataPool/CrPsDp.h>
45 #include <Services/Test/InCmd/CrPsTestOnBoardConnection.h> /* for global handles */
46 #include "CrPsUserConstants.h"
47 
48 
49 /* ------------------------------------------------------------------------------------ */
50 /* Action for node N1. */
51 void CrPsTestOnBoardConnectionPrgrN1(FwPrDesc_t prDesc)
52 {
53  CrFwDestSrc_t destId;
54  CrPsApid_t appId;
55  FwSmDesc_t rep;
56  prDataPrgrAction_t *prDataPrgrActionPtr;
57  CrFwCmpData_t *cmpDataStart;
58  CrFwOutCmpData_t *cmpSpecificData;
59  CrFwPckt_t pckt;
60 
61  /* Configure the (17,4) report with a destination equal to the source of the (17,3),
62  load it in the Outloader and set action outcome to 'completed' */
63 
64  /* The (17,4) report has been retrieved from the OutFactory by the Start Action of the (17,3) */
65 
66  /* Get application ID with which the test was performed */
67  appId = getDpAreYouAliveSrc();
68 
69  /* Get the source and rep identifier of the InCmd from prData and set the destination equal to the source of the (17,3) */
70  prDataPrgrActionPtr = FwPrGetData(prDesc);
71  destId = prDataPrgrActionPtr->source;
72  rep = prDataPrgrActionPtr->smDesc;
73 
74  /* Get TM(17,4) packet */
75  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(rep);
76  cmpSpecificData = (CrFwOutCmpData_t *) cmpDataStart->cmpSpecificData;
77  pckt = cmpSpecificData->pckt;
78 
79  /* Set out component parameters */
80  setOnBoardConnectRepDest(pckt, appId);
81 
82  /* Set destination */
83  CrFwOutCmpSetDest(rep, destId);
84 
85  /* Load the (17,4) report in the Outloader */
86  CrFwOutLoaderLoad(rep);
87 
88  /* Set action outcome to 'completed' */
89  prDataPrgrActionPtr->outcome = 1;
90  FwPrSetData(prDesc, prDataPrgrActionPtr);
91 
92  return;
93 }
94 
95 /* ------------------------------------------------------------------------------------ */
96 /* Action for node N2. */
97 void CrPsTestOnBoardConnectionPrgrN2(FwPrDesc_t prDesc)
98 {
99  prDataPrgrAction_t *prDataPrgrActionPtr;
100 
101  /* Set action outcome to 'continue' */
102 
103  prDataPrgrActionPtr = FwPrGetData(prDesc);
104 
105  prDataPrgrActionPtr->outcome = 2;
106  FwPrSetData(prDesc, prDataPrgrActionPtr);
107 
108  return;
109 }
110 
111 /* ------------------------------------------------------------------------------------ */
112 /* Action for node N3. */
113 void CrPsTestOnBoardConnectionPrgrN3(FwPrDesc_t prDesc)
114 {
115  prDataPrgrAction_t *prDataPrgrActionPtr;
116 
117  /* Set action outcome to 'failed' */
118 
119  prDataPrgrActionPtr = FwPrGetData(prDesc);
120 
121  prDataPrgrActionPtr->outcome = 4;
122  FwPrSetData(prDesc, prDataPrgrActionPtr);
123 
124  return;
125 }
126 
127 /* ------------------------------------------------------------------------------------ */
128 /* Action for node N4. */
129 void CrPsTestOnBoardConnectionPrgrN4(FwPrDesc_t prDesc)
130 {
131  FwSmDesc_t rep;
132  prDataPrgrAction_t *prDataPrgrActionPtr;
133 
134  CRFW_UNUSED(prDesc);
135 
136  /* Release (17,4) report */
137  /* The (17,4) report has been retrieved from the OutFactory by the Start Action of the (17,3) */
138 
139  /* Get the rep identifier from prData */
140  prDataPrgrActionPtr = FwPrGetData(prDesc);
141  rep = prDataPrgrActionPtr->smDesc;
142 
144 
145  return;
146 }
147 
148 /* ------------------------------------------------------------------------------------ */
149 /**************/
150 /*** GUARDS ***/
151 /**************/
152 
153 /* Guard on the Control Flow from DECISION1 to N1. */
154 FwPrBool_t CrPsTestOnBoardConnectionPrgrG11(FwPrDesc_t prDesc)
155 {
156  CrPsApid_t appId;
157  CrPsTimeOut_t timeOut;
158 
159  CRFW_UNUSED(prDesc);
160 
161  /* [ (areYouAliveSrc > 0) &&
162  (time elapsed since command execution started smaller than areYouAliveTimeOut) ] */
163 
164  /* Get areYouAliveSrc from data pool */
165  appId = getDpAreYouAliveSrc();
166 
167  /* Get areYouAliveTimeOut from data pool */
168  timeOut = getDpAreYouAliveTimeOut();
169 
170  if (appId > 0 && timeOut_cnt < timeOut)
171  {
172  return 1;
173  }
174  else
175  {
176  return 0;
177  }
178 }
179 
180 /* ------------------------------------------------------------------------------------ */
181 /* Guard on the Control Flow from DECISION1 to N2. */
182 FwPrBool_t CrPsTestOnBoardConnectionPrgrG12(FwPrDesc_t prDesc)
183 {
184  CrPsApid_t appId;
185  CrPsTimeOut_t timeOut;
186 
187  CRFW_UNUSED(prDesc);
188 
189  /* [ (areYouAliveSrc == 0) &&
190  (time elapsed since command execution started smaller than areYouAliveTimeOut) ] */
191 
192  /* Get areYouAliveSrc from data pool */
193  appId = getDpAreYouAliveSrc();
194 
195  /* Get areYouAliveTimeOut from data pool */
196  timeOut = getDpAreYouAliveTimeOut();
197 
198  if (appId == 0 && timeOut_cnt < timeOut)
199  {
200  return 1;
201  }
202  else
203  {
204  return 0;
205  }
206 }
207 
208 /* ------------------------------------------------------------------------------------ */
209 /* Guard on the Control Flow from DECISION1 to N3. */
210 FwPrBool_t CrPsTestOnBoardConnectionPrgrG13(FwPrDesc_t prDesc)
211 {
212  CrPsTimeOut_t timeOut;
213 
214  CRFW_UNUSED(prDesc);
215 
216  /* [ (time elapsed since command execution started equal or greater than areYouAliveTimeOut) ] */
217 
218  /* Get areYouAliveTimeOut from data pool */
219  timeOut = getDpAreYouAliveTimeOut();
220 
221  if (timeOut_cnt >= timeOut)
222  {
223  return 1;
224  }
225  else
226  {
227  return 0;
228  }
229 }
Type for the Framework Component Data (FCD).
static void setOnBoardConnectRepDest(void *p, CrPsDestSrc_t Dest)
Set "Dest" in "OnBoardConnectRep" packet.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
Header file to define all user-configurable constants and types for the IASW Application.
Interface for accessing data pool items.
FwSmDesc_t rep
CrPsCmd3s9Prgr function definitions.
Definition of the OutFactory component.
Type for the data describing an OutComponent.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Create one instance of the CrPsCmd17s3Prgr procedure.
void CrPsTestOnBoardConnectionPrgrN2(FwPrDesc_t prDesc)
Action for node N2.
Header file to define all service and packet identifiers.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
uint16_t CrPsApid_t
Type used for the Application ID of a packet.
Declaration of the Perform Connection Test in-coming command packet.
void CrPsTestOnBoardConnectionPrgrN3(FwPrDesc_t prDesc)
Action for node N3.
Interface for accessing fields in packets of service "ServTest".
Create one instance of the CrPsCmd17s3Start procedure.
void CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
FwPrBool_t CrPsTestOnBoardConnectionPrgrG11(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N1.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrPsTestOnBoardConnectionPrgrN1(FwPrDesc_t prDesc)
CrPsCmd17s3Prgr function definitions.
FwPrBool_t CrPsTestOnBoardConnectionPrgrG12(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N2.
void CrFwOutFactoryReleaseOutCmp(FwSmDesc_t outCmpInstance)
Release function for an OutComponent.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
Definition of the OutComponent Component of the framework.
static CrPsDestSrc_t getDpAreYouAliveSrc()
Gets the value of the datapool item AreYouAliveSrc.
void CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
uint32_t CrPsTimeOut_t
Type used for the Timeout for packets.
FwPrBool_t CrPsTestOnBoardConnectionPrgrG13(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N3.
static CrPsTimeOut_t getDpAreYouAliveTimeOut()
Gets the value of the datapool item AreYouAliveTimeOut.
Interface for accessing data pool items.
Definition of the OutLoader component.
void CrPsTestOnBoardConnectionPrgrN4(FwPrDesc_t prDesc)
Action for node N4.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved