CORDET Framework - C2 Implementation
CrPsCmdPrgrFailFunc.c
Go to the documentation of this file.
1 
25 #include "CrPsCmdPrgrFailCreate.h"
26 
28 #include "FwPrConstants.h"
29 #include "FwPrDCreate.h"
30 #include "FwPrConfig.h"
31 #include "FwPrCore.h"
32 #include "FwSmConfig.h"
33 
34 #include "Pckt/CrFwPckt.h" /* --- interface to adaptation point CrFwPckt --- */
35 #include <CrFwCmpData.h>
38 #include <OutCmp/CrFwOutCmp.h>
39 
40 #include <CrPsRepErr.h>
46 
47 #include <stdlib.h>
48 #include <time.h>
49 
50 static FwSmDesc_t rep;
51 
52 
53 /* ----------------------------------------------------------------------------------------------------------------- */
54 
55 /* ------------------------------------------------------------------------------------ */
57 void CrPsCmdPrgrFailN2(FwPrDesc_t prDesc)
58 {
59  CRFW_UNUSED(prDesc);
60 
61  /* Retrieve an OutComponent of type (1,6) from the OutFactory */
62 
63  /* Create out component */
65 
66  return;
67 }
68 
69 /* ------------------------------------------------------------------------------------ */
71 void CrPsCmdPrgrFailN3(FwPrDesc_t prDesc)
72 {
73  CrPsRepErrCode_t errCode;
74 
75  CRFW_UNUSED(prDesc);
76 
77  /* Generate error report OUTFACTORY_FAIL */
78 
79  errCode = crOutfactoryFail;
81 
82  return;
83 }
84 
85 /* ------------------------------------------------------------------------------------ */
87 void CrPsCmdPrgrFailN4(FwPrDesc_t prDesc)
88 {
89  CrFwDestSrc_t source;
90  CrPsFailData_t VerFailData;
91  CrFwCmpData_t *inData;
92  CrFwInCmdData_t *inSpecificData;
93  CrFwPckt_t inPckt;
94  FwSmDesc_t smDesc;
95  prData_t *prData;
96  CrFwCmpData_t *cmpDataStart;
97  CrFwOutCmpData_t *cmpSpecificData;
98  CrFwPckt_t pckt;
99  CrPsRid_t Rid;
100 
101  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(rep);
102  cmpSpecificData = (CrFwOutCmpData_t *) cmpDataStart->cmpSpecificData;
103  pckt = cmpSpecificData->pckt;
104 
105  /* Configure report and load it in the OutLoader */
106 
107  /* Get procedure parameters */
108  prData = FwPrGetData(prDesc);
109 
110  smDesc = prData->smDesc;
111 
112  /* Get in packet */
113  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
114  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
115  inPckt = inSpecificData->pckt;
116 
117  /* set Packet request ID */
118  Rid = getPcktRid(inPckt);
119  setVerFailedPrgrRepRid(pckt, Rid);
120 
121  /* Set step Id */
122  setVerFailedPrgrRepStepId(pckt, (CrPsStepId_t)prData->ushortParam1);
123 
124  /* Set failCodeAccFailed = discriminant */
125  setVerFailedPrgrRepFailureCode(pckt, (CrPsFailCode_t)prData->ushortParam2);
126 
127  /* Set verFailData */
128  VerFailData = getDpverFailData();
129  setVerFailedPrgrRepFailureData(pckt, VerFailData);
130 
131  /* Set the destination of the report to the source of the in-coming packet */
132  source = CrFwPcktGetSrc(inPckt);
133  CrFwOutCmpSetDest(rep, source);
134 
135  /* Load report in the Outloader */
137 
138  return;
139 }
140 
141 /* ------------------------------------------------------------------------------------ */
143 void CrPsCmdPrgrFailN5(FwPrDesc_t prDesc)
144 {
145  CrFwCounterU4_t nOfPrgrFailed;
146 
147  CRFW_UNUSED(prDesc);
148 
149  /* Increment data pool variable nOfPrgrFailed */
150 
151  nOfPrgrFailed = getDpnOfPrgrFailed();
152  nOfPrgrFailed += 1;
153  setDpnOfPrgrFailed(nOfPrgrFailed);
154 
155  return;
156 }
157 
158 /* ------------------------------------------------------------------------------------ */
160 void CrPsCmdPrgrFailN6(FwPrDesc_t prDesc)
161 {
162  CrFwTypeId_t PacketId;
163  CrFwCmpData_t *inData;
164  CrFwInCmdData_t *inSpecificData;
165  CrFwPckt_t inPckt;
166  FwSmDesc_t smDesc;
167  prData_t *prData;
168 
169  /* Update data pool variable pcktIdPrgrFailed, failCodePrgrFailed and prgrStepFailed */
170 
171  /* Get procedure parameters */
172  prData = FwPrGetData(prDesc);
173  smDesc = prData->smDesc;
174 
175  /* Get in packet */
176  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
177  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
178  inPckt = inSpecificData->pckt;
179 
180  /* Set pcktIdPrgrFailed */
181  PacketId = CrFwPcktGetApid(inPckt); /* --- adaptation point CrFwPckt ---> */
182  setDppcktIdPrgrFailed(PacketId);
183 
184  /* Set failCodePrgrFailed */
185  setDpfailCodePrgrFailed(prData->ushortParam2);
186 
187  /* Set prgrStepFailed */
188  setDpstepPrgrFailed(prData->ushortParam1);
189 
190  return;
191 }
192 
193 /* ------------------------------------------------------------------------------------ */
194 /**************/
195 /*** GUARDS ***/
196 /**************/
197 
199 FwPrBool_t CrPsCmdPrgrFailG1(FwPrDesc_t prDesc)
200 {
201  CRFW_UNUSED(prDesc);
202 
203  /* [ OutFactory fails to generate OutComponent ] */
204 
205  if (rep == NULL)
206  {
207  return 1;
208  }
209  else
210  {
211  return 0;
212  }
213 
214 }
215 
216 /* ----------------------------------------------------------------------------------------------------------------- */
217 
Type for the Framework Component Data (FCD).
void CrPsCmdPrgrFailN5(FwPrDesc_t prDesc)
Action for node N5.
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
static void setDpfailCodePrgrFailed(CrPsFailCode_t failCodePrgrFailed)
Sets the value of the datapool item failCodePrgrFailed.
#define CRPS_REQVERIF_PROG_FAIL
Subtype identifier of the Request Verification Progress Failed out-going report packet.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
void CrPsCmdPrgrFailN4(FwPrDesc_t prDesc)
Action for node N4.
FwPrBool_t CrPsCmdPrgrFailG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to N3.
static CrPsFailData_t getDpverFailData()
Gets the value of the datapool item verFailData.
unsigned short int CrFwTypeId_t
Type used for the identifier of a component type.
Definition of the OutFactory component.
Type for the data describing an OutComponent.
CrFwPckt_t pckt
Packet holding the InCommand.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Header file to define all service and packet identifiers.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
static void setVerFailedPrgrRepStepId(void *p, CrPsStepId_t StepId)
Set "StepId" in "VerFailedPrgrRep" packet.
static void setDpnOfPrgrFailed(CrFwCounterU4_t nOfPrgrFailed)
Sets the value of the datapool item nOfPrgrFailed.
static void setVerFailedPrgrRepFailureData(void *p, CrPsFailData_t FailureData)
Set "FailureData" in "VerFailedPrgrRep" packet.
uint32_t CrPsStepId_t
Type used for the Step ID of a packet.
void CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
Interface for accessing fields in packets of service "ServReqVerif".
The Outfactory failed to make the component (see CrPsRepErr.h)
Interface for accessing data pool items.
CrPsRepErrCode_t
Identifier for the errors reported through the error reporting interface of CrFwRepErr.h.
generic Interface for accessing fields in packets.
static void setVerFailedPrgrRepFailureCode(void *p, CrPsFailCode_t FailureCode)
Set "FailureCode" in "VerFailedPrgrRep" packet.
uint32_t CrPsFailData_t
Type used for the Failure Data of a packet.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
static void setDpstepPrgrFailed(CrPsStepId_t stepPrgrFailed)
Sets the value of the datapool item stepPrgrFailed.
uint16_t CrPsFailCode_t
Type used for the Failure Code of a packet.
void CrPsRepErr(CrPsRepErrCode_t errCode, CrFwServType_t repType, CrFwServSubType_t repSubType, CrFwDiscriminant_t repDiscriminant)
Report an error which has no parameters attached to it.
Definition: CrPsRepErr.c:37
Create one instance of the CrPsCmdPrgrFail procedure.
Interface for reporting an error detected by a PUS Extension component.
auxiliary Interface for accessing fields in packets of service "ServReqVerif".
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
Definition of the OutComponent Component of the framework.
void CrPsCmdPrgrFailN3(FwPrDesc_t prDesc)
Action for node N3.
static CrPsRid_t getPcktRid(void *p)
Getter for the RequestId from a packet.
Definition: CrPsPkt.h:1067
void CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
Type for the data describing an InCommand.
static FwSmDesc_t rep
CrPsCmdPrgrFail function definitions.
static void setDppcktIdPrgrFailed(CrFwTypeId_t pcktIdPrgrFailed)
Sets the value of the datapool item pcktIdPrgrFailed.
void setVerFailedPrgrRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerFailedPrgrRep" packet.
Definition of the OutLoader component.
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
static CrFwCounterU4_t getDpnOfPrgrFailed()
Gets the value of the datapool item nOfPrgrFailed.
#define CRPS_REQVERIF
Type identifier of the Request Verification Service.
Definition: CrPsConstants.h:80
void CrPsCmdPrgrFailN2(FwPrDesc_t prDesc)
Action for node N2.
void CrPsCmdPrgrFailN6(FwPrDesc_t prDesc)
Action for node N6.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved