CORDET Framework - C2 Implementation
CrFwInStream.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include configuration files */
21 #include "CrFwInStreamUserPar.h"
22 #include "CrFwCmpData.h"
23 /* Include framework files */
24 #include "CrFwConstants.h"
26 #include "CrFwRepErr.h"
27 #include "CrFwTime.h"
28 #include "BaseCmp/CrFwBaseCmp.h"
29 #include "CrFwInStream.h"
30 #include "BaseCmp/CrFwInitProc.h"
31 #include "BaseCmp/CrFwResetProc.h"
33 #include "Pckt/CrFwPckt.h"
34 #include "Pckt/CrFwPcktQueue.h"
35 /* Include FW Profile files */
36 #include "FwSmConstants.h"
37 #include "FwSmDCreate.h"
38 #include "FwSmConfig.h"
39 #include "FwSmCore.h"
40 #include "FwPrConstants.h"
41 #include "FwPrDCreate.h"
42 #include "FwPrConfig.h"
43 #include "FwPrCore.h"
44 
46 static FwSmDesc_t baseInStreamSmDesc = NULL;
47 
50 
53 
56 
59 
62 
65 
68 
71 
74 
77 
79 static FwSmDesc_t inStreamDesc[CR_FW_NOF_INSTREAM];
80 
83 
86 
93 static int IsPcktQueueEmpty(FwSmDesc_t smDesc);
94 
101 static int IsPcktAvail(FwSmDesc_t smDesc);
102 
109 static void DoActionA(FwSmDesc_t smDesc);
110 
117 static void DoActionB(FwSmDesc_t smDesc);
118 
119 
120 /*-----------------------------------------------------------------------------------------*/
122  const FwSmCounterS1_t nOfStates = 2; /* Number of states */
123  const FwSmCounterS1_t nOfChoicePseudoStates = 2; /* Number of choice pseudo-states */
124  const FwSmCounterS1_t nOfTrans = 8; /* Number of transitions */
125  const FwSmCounterS1_t nOfActions = 2; /* Number of actions */
126  const FwSmCounterS1_t nOfGuards = 2; /* Number of guards */
127  const FwSmCounterS1_t CPS_1 = 1; /* Identifier of first choice pseudo-state */
128  const FwSmCounterS1_t CPS_2 = 2; /* Identifier of second choice pseudo-state */
129  FwSmDesc_t esm;
130  FwPrDesc_t resetPr, execPr, initPr;
131 
132  if (i >= CR_FW_NOF_INSTREAM) {
134  return NULL;
135  }
136 
137  /* If not yet done, create the base InStream SM */
138  if (baseInStreamSmDesc == NULL) {
139  /* Extend the Base Component */
140  baseInStreamSmDesc = FwSmCreateDer(CrFwBaseCmpMake());
141  /* Create the InStream SM and then embed it in state CONFIGURED of the Base Component */
142  esm = FwSmCreate(nOfStates, nOfChoicePseudoStates, nOfTrans, nOfActions, nOfGuards);
143  FwSmAddState(esm, CR_FW_INSTREAM_STATE_WAITING, 1, NULL, NULL, NULL, NULL);
144  FwSmAddState(esm, CR_FW_INSTREAM_STATE_PCKT_AVAIL, 2, NULL, NULL, NULL, NULL);
145  FwSmAddChoicePseudoState(esm, CPS_1, 2);
146  FwSmAddChoicePseudoState(esm, CPS_2, 2);
147  FwSmAddTransIpsToCps(esm, CPS_1, NULL);
148  FwSmAddTransCpsToSta(esm, CPS_1, CR_FW_INSTREAM_STATE_PCKT_AVAIL, &DoActionB, &IsPcktAvail);
149  FwSmAddTransCpsToSta(esm, CPS_1, CR_FW_INSTREAM_STATE_WAITING, NULL, NULL); /* Else Transition */
153  CPS_2, &DoActionB, NULL);
155  CPS_2, &DoActionA, NULL);
156  FwSmAddTransCpsToSta(esm, CPS_2, CR_FW_INSTREAM_STATE_WAITING, NULL, &IsPcktQueueEmpty);
157  FwSmAddTransCpsToSta(esm, CPS_2, CR_FW_INSTREAM_STATE_PCKT_AVAIL, NULL, NULL); /* Else Transition */
159  }
160 
161  if (inStreamDesc[i] != NULL) {
162  return inStreamDesc[i]; /* The requested SM has already been created */
163  }
164 
165  /* Create the requested SM as an extension of the base InStream SM */
166  inStreamDesc[i] = FwSmCreateDer(baseInStreamSmDesc);
167 
168  /* Create the Reset Procedure for the InStream Component */
169  resetPr = FwPrCreateDer(CrFwCmpGetResetProc());
170  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefConfigCheck, inStreamConfigCheck[i]);
171  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefConfigAction, inStreamConfigAction[i]);
172 
173  /* Create the Initialization Procedure for the InStream Component */
174  initPr = FwPrCreateDer(CrFwCmpGetInitProc());
175  FwPrOverrideAction(initPr, &CrFwBaseCmpDefInitCheck, inStreamInitCheck[i]);
176  FwPrOverrideAction(initPr, &CrFwBaseCmpDefInitAction, inStreamInitAction[i]);
177 
178  /* Override the Shutdown Action for the InStream Component */
180 
181  /* Get the Dummy Execution Procedure for the InStream Component */
182  execPr = CrFwBaseCmpGetDummyExecProc();
183 
184  /* Initialize the data for the requested InStream Component */
185  inStreamData[i].outcome = 1;
186  inStreamData[i].initProc = initPr;
187  inStreamData[i].resetProc = resetPr;
188  inStreamData[i].execProc = execPr;
189  inStreamData[i].instanceId = i;
190  inStreamData[i].typeId = CR_FW_INSTREAM_TYPE;
191  inStreamCmpSpecificData[i].collectPckt = inStreamPcktCollect[i];
192  inStreamCmpSpecificData[i].isPcktAvail = inStreamPcktAvailCheck[i];
193  inStreamCmpSpecificData[i].src = inStreamSrc[i];
194  inStreamData[i].cmpSpecificData = &inStreamCmpSpecificData[i];
195 
196  /* Attach the data to the InStream state machine and to its procedures.
197  * The data is attached to the outer SM and to the SM embedded in state CONFIGURED
198  * and to the Initialization and Reset Procedures. */
199  FwSmSetData(inStreamDesc[i], &inStreamData[i]);
200  FwSmSetData(FwSmGetEmbSm(inStreamDesc[i], CR_FW_BASE_STATE_CONFIGURED), &inStreamData[i]);
201  FwPrSetData(inStreamData[i].initProc, &inStreamData[i]);
202  FwPrSetData(inStreamData[i].resetProc, &inStreamData[i]);
203 
204  /* Start the InStream */
205  FwSmStart(inStreamDesc[i]);
206 
207  return inStreamDesc[i];
208 }
209 
210 /*-----------------------------------------------------------------------------------------*/
213  for (i=0; i<CR_FW_NOF_INSTREAM; i++)
214  if (inStreamCmpSpecificData[i].src == src)
215  return inStreamDesc[i];
216 
218  return NULL;
219 }
220 
221 /*-----------------------------------------------------------------------------------------*/
223  return (FwSmGetCurStateEmb(smDesc) == CR_FW_INSTREAM_STATE_WAITING);
224 }
225 
226 /*-----------------------------------------------------------------------------------------*/
228  return (FwSmGetCurStateEmb(smDesc) == CR_FW_INSTREAM_STATE_PCKT_AVAIL);
229 }
230 
231 /*-----------------------------------------------------------------------------------------*/
232 CrFwPckt_t CrFwInStreamGetPckt(FwSmDesc_t smDesc) {
233  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
234  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
235  cmpSpecificData->pckt = NULL;
236  FwSmMakeTrans(smDesc, CR_FW_INSTREAM_TR_GET_PCKT);
237  return cmpSpecificData->pckt;
238 }
239 
240 /*-----------------------------------------------------------------------------------------*/
241 void CrFwInStreamPcktAvail(FwSmDesc_t smDesc) {
242  FwSmMakeTrans(smDesc, CR_FW_INSTREAM_TR_PACKET_AVAILABLE);
243 }
244 
245 /*-----------------------------------------------------------------------------------------*/
246 CrFwDestSrc_t CrFwInStreamGetSrc(FwSmDesc_t smDesc) {
247  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
248  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
249  return cmpSpecificData->src;
250 }
251 
252 /*-----------------------------------------------------------------------------------------*/
253 CrFwSeqCnt_t CrFwInStreamGetSeqCnt(FwSmDesc_t smDesc, CrFwGroup_t group) {
254  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
255  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
256  return cmpSpecificData->seqCnt[group];
257 }
258 
259 /*-----------------------------------------------------------------------------------------*/
260 void CrFwInStreamSetSeqCnt(FwSmDesc_t smDesc, CrFwGroup_t group, CrFwSeqCnt_t seqCnt)
261 {
262  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
263  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
264  cmpSpecificData->seqCnt[group] = seqCnt;
265 }
266 
267 /*-----------------------------------------------------------------------------------------*/
269  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
270  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
271  return CrFwPcktQueueGetNOfPckts(&(cmpSpecificData->pcktQueue));
272 }
273 
274 /*-----------------------------------------------------------------------------------------*/
276  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
277  return inStreamNOfGroups[inStreamBaseData->instanceId];
278 }
279 
280 /*-----------------------------------------------------------------------------------------*/
282  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
283  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
284  return CrFwPcktQueueGetSize(&(cmpSpecificData->pcktQueue));
285 }
286 
287 /*-----------------------------------------------------------------------------------------*/
288 void CrFwInStreamDefConfigAction(FwPrDesc_t prDesc) {
289  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwPrGetData(prDesc);
290  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
291  CrFwGroup_t i;
292 
293  CrFwPcktQueueReset(&(cmpSpecificData->pcktQueue));
294  cmpSpecificData->pckt = NULL;
295  for (i=0; i<inStreamNOfGroups[inStreamBaseData->instanceId]; i++)
296  cmpSpecificData->seqCnt[i] = 0;
297  inStreamData->outcome = 1;
298 }
299 
300 /*-----------------------------------------------------------------------------------------*/
301 void CrFwInStreamDefShutdownAction(FwSmDesc_t smDesc) {
302  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
303  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
304 
305  CrFwPcktQueueShutdown(&(cmpSpecificData->pcktQueue));
306  free(cmpSpecificData->seqCnt);
307  cmpSpecificData->seqCnt = NULL;
308  cmpSpecificData->pckt = NULL;
309 }
310 
311 /*-----------------------------------------------------------------------------------------*/
312 void CrFwInStreamDefInitAction(FwPrDesc_t prDesc) {
313  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwPrGetData(prDesc);
314  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
315  CrFwInstanceId_t i = inStreamBaseData->instanceId;
316 
317  cmpSpecificData->seqCnt = malloc(sizeof(CrFwSeqCnt_t)*inStreamNOfGroups[i]);
318  CrFwPcktQueueInit(&(cmpSpecificData->pcktQueue), inStreamPcktQueueSize[i]);
319 }
320 
321 /*-----------------------------------------------------------------------------------------*/
322 static void DoActionA(FwSmDesc_t smDesc) {
323  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
324  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
325  cmpSpecificData->pckt = CrFwPcktQueuePop(&(cmpSpecificData->pcktQueue));
326 }
327 
328 /*-----------------------------------------------------------------------------------------*/
329 static void DoActionB(FwSmDesc_t smDesc) {
330  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
331  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
332  CrFwDestSrc_t src = cmpSpecificData->src;
333  CrFwPckt_t pckt;
334  CrFwSeqCnt_t seqCnt;
335  CrFwGroup_t group;
336 
337  while (cmpSpecificData->isPcktAvail(src)) {
338  pckt = cmpSpecificData->collectPckt(src);
339 
340  if (CrFwPcktGetDest(pckt) == CR_FW_HOST_APP_ID) {
341  seqCnt = CrFwPcktGetSeqCnt(pckt);
342  group = CrFwPcktGetGroup(pckt);
343  if (group < inStreamNOfGroups[inStreamBaseData->instanceId]) {
344  if (cmpSpecificData->seqCnt[group] != 0)
345  if ((cmpSpecificData->seqCnt[group]+1) != seqCnt)
346  CrFwRepErrSeqCnt(crInStreamSCErr, inStreamData->typeId, inStreamData->instanceId,
347  (cmpSpecificData->seqCnt[group]+1), seqCnt, pckt);
348 
349  cmpSpecificData->seqCnt[group] = seqCnt;
350  } else
351  CrFwRepErrGroup(crInStreamIllGroup, inStreamBaseData->typeId,
352  inStreamBaseData->instanceId, group);
353  }
354 
355  if (CrFwPcktQueuePush(&(cmpSpecificData->pcktQueue), pckt) == 0) {
356  CrFwRepErr(crInStreamPQFull, inStreamData->typeId, inStreamData->instanceId);
357  CrFwPcktRelease(pckt);
358  }
359  }
360 }
361 
362 /*-----------------------------------------------------------------------------------------*/
363 static int IsPcktAvail(FwSmDesc_t smDesc) {
364  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
365  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
366  CrFwDestSrc_t src = cmpSpecificData->src;
367  return cmpSpecificData->isPcktAvail(src);
368 }
369 
370 /*-----------------------------------------------------------------------------------------*/
371 static int IsPcktQueueEmpty(FwSmDesc_t smDesc) {
372  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwSmGetData(smDesc);
373  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
374  return CrFwPcktQueueIsEmpty(&(cmpSpecificData->pcktQueue));
375 }
376 
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
CrFwPcktCollect_t collectPckt
Function which implements the Packet Collect Operation.
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
CrFwCounterU1_t CrFwInStreamGetPcktQueueSize(FwSmDesc_t smDesc)
Return the size of the packet queue of the InStream.
Definition: CrFwInStream.c:281
Interface through which framework components access the current time.
void CrFwRepErrGroup(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwGroup_t group)
Report an error which has one single parameter attached to it representing a command or report group...
Definition: CrFwRepErr.c:128
void CrFwPcktQueueReset(CrFwPcktQueue_t pcktQueue)
Reset the packet queue.
Definition: CrFwPcktQueue.c:73
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
Definition: CrFwCmpData.h:93
CrFwBool_t CrFwPcktQueueIsEmpty(CrFwPcktQueue_t pcktQueue)
Return 1 if the packet queue is empty and 0 otherwise.
CrFwPckt_t CrFwPcktQueuePop(CrFwPcktQueue_t pcktQueue)
Pop a packet from the packet queue.
Definition: CrFwPcktQueue.c:25
FwPrDesc_t CrFwCmpGetResetProc()
Retrieve the singleton instance of the CRP.
Definition: CrFwResetProc.c:45
Definition of the Framework Component Data (FCD) Type.
CrFwDestSrc_t CrFwInStreamGetSrc(FwSmDesc_t smDesc)
Get the currently defined packet source of an InStream.
Definition: CrFwInStream.c:246
struct CrFwPcktQueue pcktQueue
Packet queue associated to the InStream.
#define CR_FW_INSTREAM_TR_GET_PCKT
Identifier for transition command "GetPacket" in the InStream State Machine.
static CrFwCmpData_t inStreamData[CR_FW_NOF_INSTREAM]
The data structures for the InStream State Machines and their Procedures.
Definition: CrFwInStream.c:82
CrFwBool_t CrFwInStreamIsInWaiting(FwSmDesc_t smDesc)
Return true if the argument InStream is in state WAITING.
Definition: CrFwInStream.c:222
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
#define CR_FW_HOST_APP_ID
The identifier of the host application.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
static FwPrAction_t inStreamInitAction[CR_FW_NOF_INSTREAM]
The functions implementing the initialization actions for the InStream components.
Definition: CrFwInStream.c:64
CrFwSeqCnt_t CrFwPcktGetSeqCnt(CrFwPckt_t pckt)
Return the sequence counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:223
CrFwBool_t CrFwPcktQueuePush(CrFwPcktQueue_t pcktQueue, CrFwPckt_t pckt)
Push a packet onto the packet queue.
Definition: CrFwPcktQueue.c:52
CrFwPckt_t(* CrFwPcktCollect_t)(CrFwDestSrc_t)
Type for a pointer to a function implementing the Packet Collect Operation of an InStream.
void CrFwBaseCmpDefConfigCheck(FwPrDesc_t prDesc)
Function which performs the default Configuration Check of the CRP.
Definition: CrFwResetProc.c:33
void CrFwRepErrSeqCnt(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwSeqCnt_t expSeqCnt, CrFwSeqCnt_t actSeqCnt, CrFwPckt_t pckt)
Report an error which has two parameters attached to it representing expected and actual sequence cou...
Definition: CrFwRepErr.c:143
static void DoActionA(FwSmDesc_t smDesc)
Function which performs Action A in the InStream State Machine.
Definition: CrFwInStream.c:322
void CrFwPcktQueueInit(CrFwPcktQueue_t pcktQueue, CrFwCounterU1_t size)
Initializes the packet queue.
Definition: CrFwPcktQueue.c:95
#define CR_FW_INSTREAM_CONFIGCHECK
The functions implementing the Configuration Check of the InStream components.
#define CR_FW_INSTREAM_TYPE
Type identifier for the InStream components.
CrFwDestSrc_t CrFwPcktGetDest(CrFwPckt_t pckt)
Return the destination of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:315
Type for the data describing an InStream.
Interface for creating and accessing a report or command packet.
static CrFwInStreamData_t inStreamCmpSpecificData[CR_FW_NOF_INSTREAM]
The component-specific data for the InStream State Machines and their Procedures. ...
Definition: CrFwInStream.c:85
Definition of the InStream component.
static CrFwPcktAvailCheck_t inStreamPcktAvailCheck[CR_FW_NOF_INSTREAM]
The functions implementing the packet available check operations for the InStream components...
Definition: CrFwInStream.c:58
#define CR_FW_INSTREAM_CONFIGACTION
The functions implementing the Configuration Action of the InStream components.
void CrFwBaseCmpDefShutdownAction(FwSmDesc_t smDesc)
Function which performs the Shutdown Action for the Base State Machine.
Definition: CrFwBaseCmp.c:217
CrFwBool_t CrFwInStreamIsInPcktAvail(FwSmDesc_t smDesc)
Return true if the argument InStream is in state PCKT_AVAIL.
Definition: CrFwInStream.c:227
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
FwPrDesc_t resetProc
The Component Reset Procedure (CRP) (see CrFwResetProc.h).
Definition: CrFwCmpData.h:97
CrFwBool_t(* CrFwPcktAvailCheck_t)(CrFwDestSrc_t)
Type for a pointer to a function implementing the Packet Available Check Operation of an InStream...
CrFwSeqCnt_t * seqCnt
Array holding sequence counters for the groups associated to the InStream.
Dummy Component Execution Procedure (CEP) for the Base Component.
CrFwCounterU1_t CrFwInStreamGetNOfPendingPckts(FwSmDesc_t smDesc)
Return the number of packets currently in the packet queue of an InStream.
Definition: CrFwInStream.c:268
#define CR_FW_INSTREAM_NOF_GROUPS
The number of groups of the InStream components.
#define CR_FW_INSTREAM_PCKTCOLLECT
The functions implementing the Packet Collect Operations of the InStream components.
CrFwGroup_t CrFwInStreamGetNOfGroups(FwSmDesc_t smDesc)
Return the number of groups associated to the InStream.
Definition: CrFwInStream.c:275
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
CrFwSeqCnt_t CrFwInStreamGetSeqCnt(FwSmDesc_t smDesc, CrFwGroup_t group)
Return the value of the sequence counter of the last packet successfully collected by the InStream fo...
Definition: CrFwInStream.c:253
static FwPrAction_t inStreamConfigCheck[CR_FW_NOF_INSTREAM]
The functions implementing the configuration checks for the InStream components.
Definition: CrFwInStream.c:67
Header file to define all invariant publicly available constants and types for the CORDET Framework...
void CrFwPcktRelease(CrFwPckt_t pckt)
Release function for command or report packets.
Definition: CrFwPckt.c:156
void CrFwBaseCmpDefInitCheck(FwPrDesc_t prDesc)
Function which performs the default Initialization Check of the CIP.
Definition: CrFwInitProc.c:36
CrFwCounterU1_t CrFwPcktQueueGetSize(CrFwPcktQueue_t pcktQueue)
Return the size of the packet queue.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
CrFwInstanceId_t instanceId
The instance identifier of the framework component.
Definition: CrFwCmpData.h:81
void CrFwBaseCmpDefInitAction(FwPrDesc_t prDesc)
Function which performs the default Initialization Action of the CIP.
Definition: CrFwInitProc.c:42
#define CR_FW_INSTREAM_TR_PACKET_AVAILABLE
Identifier for transition command "PacketAvailable" in the InStream State Machine.
CrFwPcktAvailCheck_t isPcktAvail
Function which implements the Packet Available Check Operation.
Interface for reporting an error detected by a framework component.
void CrFwInStreamDefInitAction(FwPrDesc_t prDesc)
Default initialization action for an InStream.
Definition: CrFwInStream.c:312
CrFwDestSrc_t src
Source associated to the InStream.
static FwSmDesc_t inStreamDesc[CR_FW_NOF_INSTREAM]
The descriptors of the InStream State Machines.
Definition: CrFwInStream.c:79
static FwSmAction_t inStreamShutdownAction[CR_FW_NOF_INSTREAM]
The functions implementing the shutdown actions for the InStream components.
Definition: CrFwInStream.c:73
#define CR_FW_INSTREAM_SRC
The packet source which is managed by the InStream component.
CrFwCounterU1_t CrFwPcktQueueGetNOfPckts(CrFwPcktQueue_t pcktQueue)
Return the number of packets currently in the packet queue.
Definition and management of packet queues.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Definition: CrFwCmpData.h:101
void CrFwBaseCmpDefConfigAction(FwPrDesc_t prDesc)
Function which performs the default Configuration Action of the CRP.
Definition: CrFwResetProc.c:39
An InStream has encountered a sequence counter error (see CrFwInStream.h)
Definition of the utility functions for the CORDET Framework.
static CrFwPcktCollect_t inStreamPcktCollect[CR_FW_NOF_INSTREAM]
The functions implementing the packet hand-over operations for the InStream components.
Definition: CrFwInStream.c:55
FwPrDesc_t execProc
The Component Execution Procedure (CEP) (see CrFwBaseCmp.h).
Definition: CrFwCmpData.h:99
#define CR_FW_INSTREAM_SHUTDOWNACTION
The functions implementing the Shutdown Action of the InStream components.
FwSmDesc_t CrFwBaseCmpMake()
Retrieve the singleton instance of the Base State Machine.
Definition: CrFwBaseCmp.c:77
static CrFwCounterU1_t inStreamPcktQueueSize[CR_FW_NOF_INSTREAM]
The sizes of the packet queues in the InStream components.
Definition: CrFwInStream.c:49
FwPrDesc_t CrFwBaseCmpGetDummyExecProc()
Retrieve the singleton instance of the Dummy CEP.
A framework function has been called with an illegal InStream identifier.
void CrFwInStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an InStream.
Definition: CrFwInStream.c:301
void CrFwInStreamSetSeqCnt(FwSmDesc_t smDesc, CrFwGroup_t group, CrFwSeqCnt_t seqCnt)
Overwrites the sequence counter value of the last packet for a group.
Definition: CrFwInStream.c:260
CrFwPckt_t pckt
The last packet to have been collected from the middleware.
static void DoActionB(FwSmDesc_t smDesc)
Function which performs Action b in the InStream State Machine.
Definition: CrFwInStream.c:329
#define CR_FW_NOF_INSTREAM
The number of InStream components in the application.
FwSmDesc_t CrFwInStreamGet(CrFwDestSrc_t src)
Getter function for the InStream corresponding to the argument source.
Definition: CrFwInStream.c:211
Definition of Base Component.
The packet queue of an InStream is full (see CrFwInStream.h)
void CrFwRepErr(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId)
Report an error which has no parameters attached to it.
Definition: CrFwRepErr.c:81
#define CR_FW_INSTREAM_INITACTION
The functions implementing the Initialization Action of the InStream components.
static CrFwGroup_t inStreamNOfGroups[CR_FW_NOF_INSTREAM]
The number of groups associated to the InStream components.
Definition: CrFwInStream.c:52
Component Initialization Procedure (CIP) for the Base Component.
CrFwGroup_t CrFwPcktGetGroup(CrFwPckt_t pckt)
Return the group of the command/report encapsulated in a packet.
Definition: CrFwPckt.c:398
#define CR_FW_INSTREAM_PCKTAVAILCHECK
The functions implementing the Packet Available Check Operations of the InStream components.
#define CR_FW_INSTREAM_STATE_WAITING
State identifier for state WAITING in the InStream State Machine.
FwSmDesc_t CrFwInStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InStream State Machine instance.
Definition: CrFwInStream.c:121
CrFwTypeId_t typeId
The type identifier of the framework component.
Definition: CrFwCmpData.h:83
void CrFwInStreamDefConfigAction(FwPrDesc_t prDesc)
Default configuration action for an InStream.
Definition: CrFwInStream.c:288
static int IsPcktQueueEmpty(FwSmDesc_t smDesc)
Function which checks if the packet queue is empty.
Definition: CrFwInStream.c:371
void CrFwInStreamPcktAvail(FwSmDesc_t smDesc)
Query the middleware for available packets and collect them if they are available.
Definition: CrFwInStream.c:241
#define CR_FW_BASE_STATE_CONFIGURED
State identifier for state CONFIGURED in the Base State Machine.
#define CR_FW_INSTREAM_STATE_PCKT_AVAIL
State identifier for state PCKT_AVAIL in the InStream State Machine.
CrFwPckt_t CrFwInStreamGetPckt(FwSmDesc_t smDesc)
Retrieve a packet from the InStream.
Definition: CrFwInStream.c:232
A framework function has been called with a source attribute which is not associated to any InStream...
User-modifiable parameters for the InStream components (see CrFwInStream.h).
static FwPrAction_t inStreamConfigAction[CR_FW_NOF_INSTREAM]
The functions implementing the configuration actions for the InStream components. ...
Definition: CrFwInStream.c:70
FwPrDesc_t CrFwCmpGetInitProc()
Retrieve the singleton instance of the CIP.
Definition: CrFwInitProc.c:48
void CrFwPcktQueueShutdown(CrFwPcktQueue_t pcktQueue)
Shutdown the packet queue.
static FwPrAction_t inStreamInitCheck[CR_FW_NOF_INSTREAM]
The functions implementing the initialization checks for the InStream components. ...
Definition: CrFwInStream.c:61
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
#define CR_FW_INSTREAM_PQSIZE
The sizes of the packet queues in the InStream components.
static FwSmDesc_t baseInStreamSmDesc
Base InStream from which all other InStreams are derived.
Definition: CrFwInStream.c:46
Component Reset Procedure (CRP) for the Base Component.
An incoming command or report has an illegal group.
FwPrDesc_t initProc
The Component Initialization Procedure (CIP) (see CrFwInitProc.h).
Definition: CrFwCmpData.h:95
static CrFwDestSrc_t inStreamSrc[CR_FW_NOF_INSTREAM]
The sources associated to the InStream components.
Definition: CrFwInStream.c:76
#define CR_FW_INSTREAM_INITCHECK
The functions implementing the Initialization Check of the InStream components.
static int IsPcktAvail(FwSmDesc_t smDesc)
Function which checks if a packet is available.
Definition: CrFwInStream.c:363
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved