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