CORDET Framework - C2 Implementation
tests/CrFwInLoaderTestCases.c
Go to the documentation of this file.
1 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include "CrFwInLoaderTestCases.h"
22 #include "CrFwInCmdSample1.h"
23 #include "CrFwInRepSample1.h"
24 #include "CrFwRepInCmdOutcomeStub.h"
25 /* Include FW Profile files */
26 #include "FwSmConstants.h"
27 #include "FwSmConfig.h"
28 #include "FwSmCore.h"
29 #include "FwPrConfig.h"
30 #include "FwPrCore.h"
31 #include "FwPrConstants.h"
32 /* Include framework files */
34 #include "BaseCmp/CrFwBaseCmp.h"
35 #include "Pckt/CrFwPckt.h"
36 #include "InRep/CrFwInRep.h"
37 #include "InCmd/CrFwInCmd.h"
38 #include "InStream/CrFwInStream.h"
41 #include "CrFwTime.h"
42 #include "CrFwRepErr.h"
44 /* Include configuration files */
45 #include "CrFwInRegistryUserPar.h"
46 #include "CrFwInLoaderUserPar.h"
47 #include "CrFwInStreamStub.h"
48 #include "CrFwOutStreamStub.h"
49 #include "CrFwRepErrStub.h"
50 #include "CrFwInFactoryUserPar.h"
51 #include "CrFwOutFactoryUserPar.h"
52 #include "CrFwCmpData.h"
53 #include "CrFwRepInCmdOutcome.h"
54 
57 
58 /* ---------------------------------------------------------------------------------------------*/
64  reroutingDest = retValue;
65 }
66 
67 /* ---------------------------------------------------------------------------------------------*/
69  (void)(pcktDest);
70  return reroutingDest;
71 }
72 
73 /* ---------------------------------------------------------------------------------------------*/
75  FwSmDesc_t inLoader;
76 
77  /* Instantiate the InLoader */
78  inLoader = CrFwInLoaderMake();
79 
80  /* Check current state of InLoader */
81  if (!CrFwCmpIsInCreated(inLoader))
82  return 0;
83 
84  /* Initialize and Configure InLoader and check success */
85  CrFwCmpInit(inLoader);
86  if (!CrFwCmpIsInInitialized(inLoader))
87  return 0;
88  CrFwCmpReset(inLoader);
89  if (!CrFwCmpIsInConfigured(inLoader))
90  return 0;
91 
92  /* Check Instance and Type Identifiers */
93  if (CrFwCmpGetInstanceId(inLoader) != 0)
94  return 0;
95  if (CrFwCmpGetTypeId(inLoader) != CR_FW_INLOADER_TYPE)
96  return 0;
97 
98  /* Check default implementation of function which re-routes a destination */
100  return 0;
102  return 0;
104  return 0;
105 
106  /* Check default implementation of function which re-routes a destination */
107  if (CrFwInLoaderDefNoRerouting(1) != 0)
108  return 0;
109  if (CrFwInLoaderDefNoRerouting(0) != 0)
110  return 0;
111  if (CrFwInLoaderDefNoRerouting(2) != 0)
112  return 0;
113 
114  /* Check default implementation of function which selects the InManager */
115  if (CrFwInLoaderDefGetInManager(0,0,0,crCmdType) != 0)
116  return 0;
117  if (CrFwInLoaderDefGetInManager(0,0,0,crRepType) != 1)
118  return 0;
119 
120  /* Check that there are no allocated packets */
121  if (CrFwPcktGetNOfAllocated() != 0)
122  return 0;
123 
124  /* Check application errors */
125  if (CrFwGetAppErrCode() != crNoAppErr)
126  return 0;
127 
128  return 1;
129 }
130 
131 /* ---------------------------------------------------------------------------------------------*/
133  FwSmDesc_t inLoader, inStream;
134  CrFwCounterU2_t errRepPosLocal;
135 
136  /* Store the current value of the error report counter */
137  errRepPosLocal = CrFwRepErrStubGetPos();
138 
139  /* Instantiate, initialize and configure the InLoader */
140  inLoader = CrFwInLoaderMake();
141  CrFwCmpInit(inLoader);
142  CrFwCmpReset(inLoader);
143  if (!CrFwCmpIsInConfigured(inLoader))
144  return 0;
145 
146  /* Create InStream and configure it to have no pending packet */
147  inStream = CrFwInStreamMake(0);
149  CrFwCmpInit(inStream);
150  CrFwCmpReset(inStream);
151  if (!CrFwCmpIsInConfigured(inStream))
152  return 0;
153 
154  /* Configure InLoader to return "destination invalid" */
156 
157  /* Load InStream in the InLoader and execute InLoader*/
158  CrFwInLoaderSetInStream(inStream);
159  CrFwCmpExecute(inLoader);
160 
161  /* Check that no error report has been generated */
162  if (CrFwRepErrStubGetPos() != errRepPosLocal)
163  return 0;
164 
165  /* Check that there are no allocated packets */
166  if (CrFwPcktGetNOfAllocated() != 0)
167  return 0;
168 
169  /* Check application errors */
170  if (CrFwGetAppErrCode() != crNoAppErr)
171  return 0;
172 
173  return 1;
174 }
175 
176 /* ---------------------------------------------------------------------------------------------*/
178  FwSmDesc_t inLoader, inStream;
179  CrFwCounterU2_t errRepPosLocal;
180 
181  /* Store the current value of the error report counter */
182  errRepPosLocal = CrFwRepErrStubGetPos();
183 
184  /* Instantiate, initialize and configure the InLoader */
185  inLoader = CrFwInLoaderMake();
186  CrFwCmpInit(inLoader);
187  CrFwCmpReset(inLoader);
188  if (!CrFwCmpIsInConfigured(inLoader))
189  return 0;
190 
191  /* Create InStream and configure it to have one pending packet for another application */
192  inStream = CrFwInStreamMake(0);
193  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID+1); /* Packet destination is not the host application */
194  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
195  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
196  CrFwCmpInit(inStream);
197  CrFwCmpReset(inStream);
198  if (!CrFwCmpIsInConfigured(inStream))
199  return 0;
200 
201  /* Configure InLoader to return "destination invalid" */
203 
204  /* Load InStream in the InLoader and execute InLoader*/
205  CrFwInLoaderSetInStream(inStream);
206  CrFwCmpExecute(inLoader);
207 
208  /* Check that an error report has been generated */
209  if (CrFwRepErrStubGetPos() != errRepPosLocal + 1)
210  return 0;
212  return 0;
214  return 0;
216  return 0;
218  return 0;
220  return 0;
221 
222  /* Check that there are no allocated packets */
223  if (CrFwPcktGetNOfAllocated() != 0)
224  return 0;
225 
226  /* Check application errors */
227  if (CrFwGetAppErrCode() != crNoAppErr)
228  return 0;
229 
230  return 1;
231 }
232 
233 /* ---------------------------------------------------------------------------------------------*/
235  FwSmDesc_t inLoader, inStream, outStream;
236  CrFwCounterU2_t errRepPosLocal;
237  CrFwCounterU1_t handoverCnt;
238 
239  /* Store the current value of the OutStream packet handover counter */
240  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
241 
242  /* Store the current value of the error report counter */
243  errRepPosLocal = CrFwRepErrStubGetPos();
244 
245  /* Instantiate, initialize and configure the InLoader */
246  inLoader = CrFwInLoaderMake();
247  CrFwCmpInit(inLoader);
248  CrFwCmpReset(inLoader);
249  if (!CrFwCmpIsInConfigured(inLoader))
250  return 0;
251 
252  /* Create InStream and configure it to be in state AVAIL with one pending packet */
253  inStream = CrFwInStreamMake(0);
255  CrFwCmpInit(inStream);
256  CrFwCmpReset(inStream);
257  if (!CrFwCmpIsInConfigured(inStream))
258  return 0;
259  if (!CrFwInStreamIsInPcktAvail(inStream))
260  return 0;
261  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
262  return 0;
263 
264  /* Create OutStream */
265  outStream = CrFwOutStreamMake(0);
266  FwSmStart(outStream);
267  CrFwCmpInit(outStream);
268  CrFwCmpReset(outStream);
269  if (!CrFwCmpIsInConfigured(outStream))
270  return 0;
271  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
272  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
273  return 0;
274 
275  /* Configure InLoader to return destination associated to OutStream */
277 
278  /* Load InStream in the InLoader and execute InLoader*/
279  CrFwInLoaderSetInStream(inStream);
280  CrFwCmpExecute(inLoader);
281 
282  /* Check that a packet was loaded into the OutStream and was passed on to the middleware */
283  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt + 1)
284  return 0;
285  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
286  return 0;
287 
288  /* Check that no error report has been generated */
289  if (CrFwRepErrStubGetPos() != errRepPosLocal)
290  return 0;
291 
292  /* Check that there are no allocated packets */
293  if (CrFwPcktGetNOfAllocated() != 0)
294  return 0;
295 
296  /* Check application errors */
297  if (CrFwGetAppErrCode() != crNoAppErr)
298  return 0;
299 
300  return 1;
301 }
302 
303 /* ---------------------------------------------------------------------------------------------*/
305  FwSmDesc_t inLoader, inStream, outStream, inFactory;
306  CrFwCounterU2_t errRepPosLocal;
307  CrFwCounterU1_t handoverCnt;
308  CrFwCounterU2_t cmdRepPos;
309 
310  /* Store the current value of the command report counter */
311  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
312 
313  /* Store the current value of the OutStream packet handover counter */
314  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
315 
316  /* Store the current value of the error report counter */
317  errRepPosLocal = CrFwRepErrStubGetPos();
318 
319  /* Instantiate, initialize and configure the InLoader */
320  inLoader = CrFwInLoaderMake();
321  CrFwCmpInit(inLoader);
322  CrFwCmpReset(inLoader);
323  if (!CrFwCmpIsInConfigured(inLoader))
324  return 0;
325 
326  /* Create InStream and configure it to be in state AVAIL with one pending packet */
327  inStream = CrFwInStreamMake(0);
328  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
329  CrFwInStreamStubSetPcktType(0,0,0); /* Set packet type to invalid */
330  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
331  CrFwInStreamStubSetPcktCmdRepType(crRepType); /* Define packet as InReport */
332  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
333  CrFwCmpInit(inStream);
334  CrFwCmpReset(inStream);
335  if (!CrFwCmpIsInConfigured(inStream))
336  return 0;
337  if (!CrFwInStreamIsInPcktAvail(inStream))
338  return 0;
339  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
340  return 0;
341 
342  /* Create OutStream */
343  outStream = CrFwOutStreamMake(0);
344  FwSmStart(outStream);
345  CrFwCmpInit(outStream);
346  CrFwCmpReset(outStream);
347  if (!CrFwCmpIsInConfigured(outStream))
348  return 0;
349  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
350  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
351  return 0;
352 
353  /* Create InFactory */
354  inFactory = CrFwInFactoryMake();
355  CrFwCmpInit(inFactory);
356  CrFwCmpReset(inFactory);
357  if (!CrFwCmpIsInConfigured(inFactory))
358  return 0;
359 
360  /* Load InStream in the InLoader and execute InLoader*/
361  CrFwInLoaderSetInStream(inStream);
362  CrFwCmpExecute(inLoader);
363 
364  /* Check that no packet was loaded into the OutStream */
365  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
366  return 0;
367  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
368  return 0;
369 
370  /* Check application error */
372  return 0;
374 
375  /* Check that error report has been generated */
376  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
377  return 0;
379  return 0;
381  return 0;
383  return 0;
385  return 0;
387  return 0;
388 
389  /* Load the InStream with a packet representing an InCommand */
390  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
391  CrFwInStreamStubSetPcktType(0,1,2); /* Set packet type to invalid */
392  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
393  CrFwInStreamStubSetPcktCmdRepType(crCmdType); /* Define packet as InReport */
394  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
395  CrFwCmpReset(inStream);
396 
397  /* Execute InLoader*/
398  CrFwCmpExecute(inLoader);
399 
400  /* Check that no packet was loaded into the OutStream */
401  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
402  return 0;
403  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
404  return 0;
405 
406  /* Check application error */
408  return 0;
410 
411  /* Check that acceptance failure report has been generated */
412  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos+1)
413  return 0;
415  return 0;
416  if (CrFwRepInCmdOutcomeStubGetFailCode(cmdRepPos) != 0)
417  return 0;
418  if (CrFwRepInCmdOutcomeStubGetServType(cmdRepPos) != 0)
419  return 0;
420  if (CrFwRepInCmdOutcomeStubGetServSubType(cmdRepPos) != 1)
421  return 0;
422  if (CrFwRepInCmdOutcomeStubGetDiscriminant(cmdRepPos) != 2)
423  return 0;
424 
425  /* Check that no error reports were generated */
426  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
427  return 0;
428 
429  /* Check that there are no allocated packets */
430  if (CrFwPcktGetNOfAllocated() != 0)
431  return 0;
432 
433  /* Check application errors */
434  if (CrFwGetAppErrCode() != crNoAppErr)
435  return 0;
436 
437  return 1;
438 }
439 
440 /* ---------------------------------------------------------------------------------------------*/
442  FwSmDesc_t inLoader, inStream, outStream, inFactory;
443  CrFwCounterU2_t errRepPosLocal;
444  CrFwCounterU1_t handoverCnt;
445  CrFwCounterU2_t cmdRepPos;
447  CrFwPckt_t inRepPckt, inCmdPckt;
448  FwSmDesc_t inRepArray[CR_FW_INFACTORY_MAX_NOF_INREP];
449  FwSmDesc_t inCmdArray[CR_FW_INFACTORY_MAX_NOF_INCMD];
450 
451  /* Store the current value of the command report counter */
452  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
453 
454  /* Store the current value of the OutStream packet handover counter */
455  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
456 
457  /* Store the current value of the error report counter */
458  errRepPosLocal = CrFwRepErrStubGetPos();
459 
460  /* Instantiate, initialize and configure the InLoader */
461  inLoader = CrFwInLoaderMake();
462  CrFwCmpInit(inLoader);
463  CrFwCmpReset(inLoader);
464  if (!CrFwCmpIsInConfigured(inLoader))
465  return 0;
466 
467  /* Create InStream and configure it to be in state AVAIL with one pending packet */
468  inStream = CrFwInStreamMake(0);
469  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
470  CrFwInStreamStubSetPcktType(5,1,1); /* Set packet type to a valid value */
471  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
472  CrFwInStreamStubSetPcktCmdRepType(crRepType); /* Define packet as InReport */
473  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
474  CrFwCmpInit(inStream);
475  CrFwCmpReset(inStream);
476  if (!CrFwCmpIsInConfigured(inStream))
477  return 0;
478  if (!CrFwInStreamIsInPcktAvail(inStream))
479  return 0;
480  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
481  return 0;
482 
483  /* Create OutStream */
484  outStream = CrFwOutStreamMake(0);
485  FwSmStart(outStream);
486  CrFwCmpInit(outStream);
487  CrFwCmpReset(outStream);
488  if (!CrFwCmpIsInConfigured(outStream))
489  return 0;
490  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
491  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
492  return 0;
493 
494  /* Create InFactory */
495  inFactory = CrFwInFactoryMake();
496  CrFwCmpInit(inFactory);
497  CrFwCmpReset(inFactory);
498  if (!CrFwCmpIsInConfigured(inFactory))
499  return 0;
500 
501  /* Configure InFactory to have no spare InReports */
502  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INREP; i++) {
503  inRepPckt = CrFwPcktMake(100);
504  CrFwPcktSetServType(inRepPckt,5);
505  CrFwPcktSetServSubType(inRepPckt,1);
506  CrFwPcktSetDiscriminant(inRepPckt,1);
507  inRepArray[i] = CrFwInFactoryMakeInRep(inRepPckt);
508  if (inRepArray[i]==NULL)
509  return 0;
510  }
511 
512  /* Load InStream in the InLoader and execute InLoader*/
513  CrFwInLoaderSetInStream(inStream);
514  CrFwCmpExecute(inLoader);
515 
516  /* Check that no packet was loaded into the OutStream */
517  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
518  return 0;
519  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
520  return 0;
521 
522  /* Check application error */
524  return 0;
526 
527  /* Check that error report has been generated */
528  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
529  return 0;
531  return 0;
533  return 0;
535  return 0;
537  return 0;
539  return 0;
540 
541  /* Release all InReports */
542  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INREP; i++)
543  CrFwInFactoryReleaseInRep(inRepArray[i]);
544 
545  /* Load the InStream with a packet representing an InCommand */
546  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
547  CrFwInStreamStubSetPcktType(8,1,1); /* Set packet type to invalid */
548  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
549  CrFwInStreamStubSetPcktCmdRepType(crCmdType); /* Define packet as InReport */
550  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
551  CrFwCmpReset(inStream);
552 
553  /* Configure InFactory to have no spare InReports */
554  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INCMD; i++) {
555  inCmdPckt = CrFwPcktMake(100);
556  CrFwPcktSetServType(inCmdPckt,8);
557  CrFwPcktSetServSubType(inCmdPckt,1);
558  CrFwPcktSetDiscriminant(inCmdPckt,1);
559  inCmdArray[i] = CrFwInFactoryMakeInCmd(inCmdPckt);
560  if (inCmdArray[i]==NULL)
561  return 0;
562  }
563 
564  /* Execute InLoader*/
565  CrFwCmpExecute(inLoader);
566 
567  /* Check that no packet was loaded into the OutStream */
568  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
569  return 0;
570  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
571  return 0;
572 
573  /* Check application error */
575  return 0;
577 
578  /* Check that acceptance failure report has been generated */
579  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos+1)
580  return 0;
582  return 0;
583  if (CrFwRepInCmdOutcomeStubGetFailCode(cmdRepPos) != 0)
584  return 0;
585  if (CrFwRepInCmdOutcomeStubGetServType(cmdRepPos) != 8)
586  return 0;
587  if (CrFwRepInCmdOutcomeStubGetServSubType(cmdRepPos) != 1)
588  return 0;
589  if (CrFwRepInCmdOutcomeStubGetDiscriminant(cmdRepPos) != 1)
590  return 0;
591 
592  /* Check that no error reports were generated */
593  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
594  return 0;
595 
596  /* Release all InCommands */
597  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INCMD; i++)
598  CrFwInFactoryReleaseInCmd(inCmdArray[i]);
599 
600  /* Check that there are no allocated packets */
601  if (CrFwPcktGetNOfAllocated() != 0)
602  return 0;
603 
604  /* Check application errors */
605  if (CrFwGetAppErrCode() != crNoAppErr)
606  return 0;
607 
608  return 1;
609 }
610 
611 /* ---------------------------------------------------------------------------------------------*/
613  FwSmDesc_t inLoader, inStream, outStream, inFactory;
614  CrFwCounterU2_t errRepPosLocal;
615  CrFwCounterU1_t handoverCnt;
616  CrFwCounterU2_t cmdRepPos;
617 
618  /* Store the current value of the command report counter */
619  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
620 
621  /* Store the current value of the OutStream packet handover counter */
622  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
623 
624  /* Store the current value of the error report counter */
625  errRepPosLocal = CrFwRepErrStubGetPos();
626 
627  /* Instantiate, initialize and configure the InLoader */
628  inLoader = CrFwInLoaderMake();
629  CrFwCmpInit(inLoader);
630  CrFwCmpReset(inLoader);
631  if (!CrFwCmpIsInConfigured(inLoader))
632  return 0;
633 
634  /* Create InStream and configure it to be in state AVAIL with one pending packet */
635  inStream = CrFwInStreamMake(0);
636  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
637  CrFwInStreamStubSetPcktType(40,1,0); /* Set packet type to be Sample 1 InReport */
638  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
639  CrFwInStreamStubSetPcktCmdRepType(crRepType); /* Define packet as InReport */
640  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
641  CrFwInRepSample1SetValidityFlag(0); /* Validity Check of InReport will fail */
642  CrFwCmpInit(inStream);
643  CrFwCmpReset(inStream);
644  if (!CrFwCmpIsInConfigured(inStream))
645  return 0;
646  if (!CrFwInStreamIsInPcktAvail(inStream))
647  return 0;
648  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
649  return 0;
650 
651  /* Create OutStream */
652  outStream = CrFwOutStreamMake(0);
653  FwSmStart(outStream);
654  CrFwCmpInit(outStream);
655  CrFwCmpReset(outStream);
656  if (!CrFwCmpIsInConfigured(outStream))
657  return 0;
658  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
659  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
660  return 0;
661 
662  /* Create InFactory */
663  inFactory = CrFwInFactoryMake();
664  CrFwCmpInit(inFactory);
665  CrFwCmpReset(inFactory);
666  if (!CrFwCmpIsInConfigured(inFactory))
667  return 0;
668 
669  /* Load InStream in the InLoader and execute InLoader*/
670  CrFwInLoaderSetInStream(inStream);
671  CrFwCmpExecute(inLoader);
672 
673  /* Check that no packet was loaded into the OutStream */
674  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
675  return 0;
676  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
677  return 0;
678 
679  /* Check that error report has been generated */
680  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
681  return 0;
683  return 0;
685  return 0;
687  return 0;
689  return 0;
690 
691  /* Load the InStream with a packet representing an InCommand */
692  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
693  CrFwInStreamStubSetPcktType(50,1,0); /* Set packet type to Sample 1 InCommand */
694  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
695  CrFwInStreamStubSetPcktCmdRepType(crCmdType); /* Define packet as InReport */
696  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
697  CrFwInCmdSample1SetValidityFlag(0); /* Validity Check of InCommand will fail */
698  CrFwCmpReset(inStream);
699 
700  /* Execute InLoader*/
701  CrFwCmpExecute(inLoader);
702 
703  /* Check that no packet was loaded into the OutStream */
704  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
705  return 0;
706  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
707  return 0;
708 
709  /* Check that acceptance failure report has been generated */
710  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos+1)
711  return 0;
713  return 0;
714  if (CrFwRepInCmdOutcomeStubGetFailCode(cmdRepPos) != 0)
715  return 0;
716  if (CrFwRepInCmdOutcomeStubGetServType(cmdRepPos) != 50)
717  return 0;
718  if (CrFwRepInCmdOutcomeStubGetServSubType(cmdRepPos) != 1)
719  return 0;
720  if (CrFwRepInCmdOutcomeStubGetDiscriminant(cmdRepPos) != 0)
721  return 0;
722 
723  /* Check that no error reports were generated */
724  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
725  return 0;
726 
727  /* Check that there are no allocated packets */
728  if (CrFwPcktGetNOfAllocated() != 0)
729  return 0;
730 
731  /* Check application errors */
732  if (CrFwGetAppErrCode() != crNoAppErr)
733  return 0;
734 
735  return 1;
736 }
737 
738 /* ---------------------------------------------------------------------------------------------*/
740  FwSmDesc_t inLoader, inStream, outStream, inFactory, inManager;
741  CrFwCounterU2_t errRepPosLocal;
742  CrFwCounterU1_t handoverCnt;
743  CrFwCounterU2_t cmdRepPos;
745  CrFwPckt_t pckt;
746 
747  /* Store the current value of the command report counter */
748  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
749 
750  /* Store the current value of the OutStream packet handover counter */
751  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
752 
753  /* Store the current value of the error report counter */
754  errRepPosLocal = CrFwRepErrStubGetPos();
755 
756  /* Instantiate, initialize and configure the InLoader */
757  inLoader = CrFwInLoaderMake();
758  CrFwCmpInit(inLoader);
759  CrFwCmpReset(inLoader);
760  if (!CrFwCmpIsInConfigured(inLoader))
761  return 0;
762 
763  /* Create InStream and configure it to be in state AVAIL with one pending packet */
764  inStream = CrFwInStreamMake(0);
765  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
766  CrFwInStreamStubSetPcktType(40,1,0); /* Set packet type to be Sample 1 InReport */
767  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
768  CrFwInStreamStubSetPcktCmdRepType(crRepType); /* Define packet as InReport */
769  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
770  CrFwInRepSample1SetValidityFlag(1); /* Validity Check of InReport will succeed */
771  CrFwCmpInit(inStream);
772  CrFwCmpReset(inStream);
773  if (!CrFwCmpIsInConfigured(inStream))
774  return 0;
775  if (!CrFwInStreamIsInPcktAvail(inStream))
776  return 0;
777  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
778  return 0;
779 
780  /* Create OutStream */
781  outStream = CrFwOutStreamMake(0);
782  FwSmStart(outStream);
783  CrFwCmpInit(outStream);
784  CrFwCmpReset(outStream);
785  if (!CrFwCmpIsInConfigured(outStream))
786  return 0;
787  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
788  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
789  return 0;
790 
791  /* Create InFactory */
792  inFactory = CrFwInFactoryMake();
793  CrFwCmpInit(inFactory);
794  CrFwCmpReset(inFactory);
795  if (!CrFwCmpIsInConfigured(inFactory))
796  return 0;
797 
798  /* Create InManager for InReports and configure it to be full */
799  inManager = CrFwInManagerMake(1); /* InManager for InReports */
800  CrFwCmpInit(inManager);
801  CrFwCmpReset(inManager);
802  if (!CrFwCmpIsInConfigured(inManager))
803  return 0;
804  for (i=0; i<CrFwInManagerGetPCRLSize(inManager); i++) {
805  pckt = CrFwPcktMake(100);
806  CrFwPcktSetServType(pckt,5);
807  CrFwPcktSetServSubType(pckt,1);
808  CrFwPcktSetDiscriminant(pckt,1);
809  CrFwInManagerLoad(inManager, CrFwInFactoryMakeInRep(pckt));
810  }
811 
812  /* Load InStream in the InLoader and execute InLoader*/
813  CrFwInLoaderSetInStream(inStream);
814  CrFwCmpExecute(inLoader);
815 
816  /* Check that no packet was loaded into the OutStream */
817  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
818  return 0;
819  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
820  return 0;
821 
822  /* Check that error reports have been generated (one by the Load operation of the InManager
823  * and one by the InLoader) */
824  if (CrFwRepErrStubGetPos() != errRepPosLocal+2)
825  return 0;
827  return 0;
829  return 0;
831  return 0;
833  return 0;
834 
835  /* Reset the InManager (this should clear the PCRL and release all loaded components) */
836  CrFwCmpReset(inManager);
837 
838  /* Create InManager for InCommands and configure it to be full */
839  inManager = CrFwInManagerMake(0); /* InManager for InCommands */
840  CrFwCmpInit(inManager);
841  CrFwCmpReset(inManager);
842  if (!CrFwCmpIsInConfigured(inManager))
843  return 0;
844  for (i=0; i<CrFwInManagerGetPCRLSize(inManager); i++) {
845  pckt = CrFwPcktMake(100);
846  CrFwPcktSetServType(pckt,8);
847  CrFwPcktSetServSubType(pckt,1);
848  CrFwPcktSetDiscriminant(pckt,1);
849  CrFwInManagerLoad(inManager, CrFwInFactoryMakeInCmd(pckt));
850  }
851 
852  /* Load the InStream with a packet representing an InCommand */
853  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
854  CrFwInStreamStubSetPcktType(50,1,0); /* Set packet type to Sample 1 InCommand */
855  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
856  CrFwInStreamStubSetPcktCmdRepType(crCmdType); /* Define packet as InReport */
857  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
858  CrFwInCmdSample1SetValidityFlag(1); /* Validity Check of InCommand will succeed */
859  CrFwCmpReset(inStream);
860 
861  /* Execute InLoader*/
862  CrFwCmpExecute(inLoader);
863 
864  /* Check that no packet was loaded into the OutStream */
865  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
866  return 0;
867  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
868  return 0;
869 
870  /* Check that acceptance failure report has been generated */
871  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos+1)
872  return 0;
874  return 0;
875  if (CrFwRepInCmdOutcomeStubGetFailCode(cmdRepPos) != 0)
876  return 0;
877  if (CrFwRepInCmdOutcomeStubGetServType(cmdRepPos) != 50)
878  return 0;
879  if (CrFwRepInCmdOutcomeStubGetServSubType(cmdRepPos) != 1)
880  return 0;
881  if (CrFwRepInCmdOutcomeStubGetDiscriminant(cmdRepPos) != 0)
882  return 0;
883 
884  /* Check that no error reports were generated (other than the one generated by the load
885  * operation on the InManager) */
886  if (CrFwRepErrStubGetPos() != errRepPosLocal+3)
887  return 0;
889  return 0;
890 
891  /* Reset the InManager (this should clear the PCRL and release all loaded components) */
892  CrFwCmpReset(inManager);
893 
894  /* Check that there are no allocated packets */
895  if (CrFwPcktGetNOfAllocated() != 0)
896  return 0;
897 
898  /* Check application errors */
899  if (CrFwGetAppErrCode() != crNoAppErr)
900  return 0;
901 
902  return 1;
903 }
904 
905 /* ---------------------------------------------------------------------------------------------*/
907  FwSmDesc_t inLoader, inStream, outStream, inFactory, inManager;
908  CrFwCounterU2_t errRepPosLocal;
909  CrFwCounterU1_t handoverCnt;
910  CrFwCounterU2_t cmdRepPos;
911 
912  /* Store the current value of the command report counter */
913  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
914 
915  /* Store the current value of the OutStream packet handover counter */
916  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
917 
918  /* Store the current value of the error report counter */
919  errRepPosLocal = CrFwRepErrStubGetPos();
920 
921  /* Instantiate, initialize and configure the InLoader */
922  inLoader = CrFwInLoaderMake();
923  CrFwCmpInit(inLoader);
924  CrFwCmpReset(inLoader);
925  if (!CrFwCmpIsInConfigured(inLoader))
926  return 0;
927 
928  /* Create InStream and configure it to be in state AVAIL with one pending packet */
929  inStream = CrFwInStreamMake(0);
930  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
931  CrFwInStreamStubSetPcktType(40,1,0); /* Set packet type to be Sample 1 InReport */
932  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
933  CrFwInStreamStubSetPcktCmdRepType(crRepType); /* Define packet as InReport */
934  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
935  CrFwInRepSample1SetValidityFlag(1); /* Validity Check of InReport will succeed */
936  CrFwCmpInit(inStream);
937  CrFwCmpReset(inStream);
938  if (!CrFwCmpIsInConfigured(inStream))
939  return 0;
940  if (!CrFwInStreamIsInPcktAvail(inStream))
941  return 0;
942  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
943  return 0;
944 
945  /* Create OutStream */
946  outStream = CrFwOutStreamMake(0);
947  FwSmStart(outStream);
948  CrFwCmpInit(outStream);
949  CrFwCmpReset(outStream);
950  if (!CrFwCmpIsInConfigured(outStream))
951  return 0;
952  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
953  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
954  return 0;
955 
956  /* Create InFactory */
957  inFactory = CrFwInFactoryMake();
958  CrFwCmpInit(inFactory);
959  CrFwCmpReset(inFactory);
960  if (!CrFwCmpIsInConfigured(inFactory))
961  return 0;
962 
963  /* Create InManager for InReports */
964  inManager = CrFwInManagerMake(1); /* InManager for InReports */
965  CrFwCmpInit(inManager);
966  CrFwCmpReset(inManager);
967  if (!CrFwCmpIsInConfigured(inManager))
968  return 0;
969 
970  /* Load InStream in the InLoader and execute InLoader*/
971  CrFwInLoaderSetInStream(inStream);
972  CrFwCmpExecute(inLoader);
973 
974  /* Check that no packet was loaded into the OutStream */
975  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
976  return 0;
977  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
978  return 0;
979 
980  /* Check that one component has been loaded in the InManager */
981  if (CrFwInManagerGetNOfPendingInCmp(inManager) != 1)
982  return 0;
983 
984  /* Reset the InManager (this should clear the PCRL and release all loaded components) */
985  CrFwCmpReset(inManager);
986 
987  /* Check that no command reports were generated */
988  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos)
989  return 0;
990 
991  /* Check that no error reports were generated */
992  if (CrFwRepErrStubGetPos() != errRepPosLocal)
993  return 0;
995  return 0;
996 
997  /* Check that there are no allocated packets */
998  if (CrFwPcktGetNOfAllocated() != 0)
999  return 0;
1000 
1001  /* Check application errors */
1002  if (CrFwGetAppErrCode() != crNoAppErr)
1003  return 0;
1004 
1005  return 1;
1006 }
1007 
1008 /* ---------------------------------------------------------------------------------------------*/
1010  FwSmDesc_t inLoader, inStream, outStream, inFactory, inManager;
1011  CrFwCounterU2_t errRepPosLocal;
1012  CrFwCounterU1_t handoverCnt;
1013  CrFwCounterU2_t cmdRepPos;
1014 
1015  /* Store the current value of the command report counter */
1016  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
1017 
1018  /* Store the current value of the OutStream packet handover counter */
1019  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
1020 
1021  /* Store the current value of the error report counter */
1022  errRepPosLocal = CrFwRepErrStubGetPos();
1023 
1024  /* Instantiate, initialize and configure the InLoader */
1025  inLoader = CrFwInLoaderMake();
1026  CrFwCmpInit(inLoader);
1027  CrFwCmpReset(inLoader);
1028  if (!CrFwCmpIsInConfigured(inLoader))
1029  return 0;
1030 
1031  /* Create InStream and configure it to be in state AVAIL with one pending packet */
1032  inStream = CrFwInStreamMake(0);
1033  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
1034  CrFwInStreamStubSetPcktType(50,1,0); /* Set packet type to Sample 1 InCommand */
1035  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
1036  CrFwInStreamStubSetPcktCmdRepType(crCmdType); /* Define packet as InReport */
1037  CrFwInStreamStubSetPcktAckLevel(0,0,0,0); /* Do not acknolwedge */
1038  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
1039  CrFwInCmdSample1SetValidityFlag(1); /* Validity Check of InCommand will succeed */
1040 
1041  CrFwCmpInit(inStream);
1042  CrFwCmpReset(inStream);
1043  if (!CrFwCmpIsInConfigured(inStream))
1044  return 0;
1045  if (!CrFwInStreamIsInPcktAvail(inStream))
1046  return 0;
1047  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
1048  return 0;
1049 
1050  /* Create OutStream */
1051  outStream = CrFwOutStreamMake(0);
1052  FwSmStart(outStream);
1053  CrFwCmpInit(outStream);
1054  CrFwCmpReset(outStream);
1055  if (!CrFwCmpIsInConfigured(outStream))
1056  return 0;
1057  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
1058  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
1059  return 0;
1060 
1061  /* Create InFactory */
1062  inFactory = CrFwInFactoryMake();
1063  CrFwCmpInit(inFactory);
1064  CrFwCmpReset(inFactory);
1065  if (!CrFwCmpIsInConfigured(inFactory))
1066  return 0;
1067 
1068  /* Create InManager for InCommands */
1069  inManager = CrFwInManagerMake(0); /* InManager for InCommands */
1070  CrFwCmpInit(inManager);
1071  CrFwCmpReset(inManager);
1072  if (!CrFwCmpIsInConfigured(inManager))
1073  return 0;
1074 
1075  /* Load InStream in the InLoader and execute InLoader*/
1076  CrFwInLoaderSetInStream(inStream);
1077  CrFwCmpExecute(inLoader);
1078 
1079  /* Check that no packet was loaded into the OutStream */
1080  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
1081  return 0;
1082  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
1083  return 0;
1084 
1085  /* Check that one component has been loaded in the InManager */
1086  if (CrFwInManagerGetNOfPendingInCmp(inManager) != 1)
1087  return 0;
1088 
1089  /* Reset the InManager (this should clear the PCRL and release all loaded components) */
1090  CrFwCmpReset(inManager);
1091 
1092  /* Check that no command reports were generated */
1093  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos)
1094  return 0;
1095 
1096  /* Check that no error reports were generated */
1097  if (CrFwRepErrStubGetPos() != errRepPosLocal)
1098  return 0;
1100  return 0;
1101 
1102  /* Check that there are no allocated packets */
1103  if (CrFwPcktGetNOfAllocated() != 0)
1104  return 0;
1105 
1106  /* Check application errors */
1107  if (CrFwGetAppErrCode() != crNoAppErr)
1108  return 0;
1109 
1110  return 1;
1111 }
1112 
1113 /* ---------------------------------------------------------------------------------------------*/
1115  FwSmDesc_t inLoader, inStream, outStream, inFactory, inManager;
1116  CrFwCounterU2_t errRepPosLocal;
1117  CrFwCounterU1_t handoverCnt;
1118  CrFwCounterU2_t cmdRepPos;
1119 
1120  /* Store the current value of the command report counter */
1121  cmdRepPos = CrFwRepInCmdOutcomeStubGetPos();
1122 
1123  /* Store the current value of the OutStream packet handover counter */
1124  handoverCnt = CrFwOutStreamStubGetHandoverCnt();
1125 
1126  /* Store the current value of the error report counter */
1127  errRepPosLocal = CrFwRepErrStubGetPos();
1128 
1129  /* Instantiate, initialize and configure the InLoader */
1130  inLoader = CrFwInLoaderMake();
1131  CrFwCmpInit(inLoader);
1132  CrFwCmpReset(inLoader);
1133  if (!CrFwCmpIsInConfigured(inLoader))
1134  return 0;
1135 
1136  /* Create InStream and configure it to be in state AVAIL with one pending packet */
1137  inStream = CrFwInStreamMake(0);
1138  CrFwInStreamStubSetPcktCollectionCnt(1); /* One pending packet in InStream */
1139  CrFwInStreamStubSetPcktType(50,1,0); /* Set packet type to Sample 1 InCommand */
1140  CrFwInStreamStubSetPcktDest(CR_FW_HOST_APP_ID); /* Set packet destination to current destination */
1141  CrFwInStreamStubSetPcktCmdRepType(crCmdType); /* Define packet as InReport */
1142  CrFwInStreamStubSetPcktAckLevel(1,0,0,0); /* Acknolwedge acceptance */
1143  CrFwInStreamStubSetPcktCmdRepId(111); /* Define command/report identifier */
1144  CrFwInCmdSample1SetValidityFlag(1); /* Validity Check of InCommand will succeed */
1145 
1146  CrFwCmpInit(inStream);
1147  CrFwCmpReset(inStream);
1148  if (!CrFwCmpIsInConfigured(inStream))
1149  return 0;
1150  if (!CrFwInStreamIsInPcktAvail(inStream))
1151  return 0;
1152  if (CrFwInStreamGetNOfPendingPckts(inStream) != 1)
1153  return 0;
1154 
1155  /* Create OutStream */
1156  outStream = CrFwOutStreamMake(0);
1157  FwSmStart(outStream);
1158  CrFwCmpInit(outStream);
1159  CrFwCmpReset(outStream);
1160  if (!CrFwCmpIsInConfigured(outStream))
1161  return 0;
1162  CrFwOutStreamStubSetHandoverFlag(1); /* Configure Packet Hand-Over Operation to return "hand-over successful" */
1163  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0) /* Check that there are no pending packets */
1164  return 0;
1165 
1166  /* Create InFactory */
1167  inFactory = CrFwInFactoryMake();
1168  CrFwCmpInit(inFactory);
1169  CrFwCmpReset(inFactory);
1170  if (!CrFwCmpIsInConfigured(inFactory))
1171  return 0;
1172 
1173  /* Create InManager for InCommands */
1174  inManager = CrFwInManagerMake(0); /* InManager for InCommands */
1175  CrFwCmpInit(inManager);
1176  CrFwCmpReset(inManager);
1177  if (!CrFwCmpIsInConfigured(inManager))
1178  return 0;
1179 
1180  /* Load InStream in the InLoader and execute InLoader*/
1181  CrFwInLoaderSetInStream(inStream);
1182  CrFwCmpExecute(inLoader);
1183 
1184  /* Check that no packet was loaded into the OutStream */
1185  if (CrFwOutStreamStubGetHandoverCnt() != handoverCnt)
1186  return 0;
1187  if (CrFwOutStreamGetNOfPendingPckts(outStream) != 0)
1188  return 0;
1189 
1190  /* Check that one component has been loaded in the InManager */
1191  if (CrFwInManagerGetNOfPendingInCmp(inManager) != 1)
1192  return 0;
1193 
1194  /* Reset the InManager (this should clear the PCRL and release all loaded components) */
1195  CrFwCmpReset(inManager);
1196 
1197  /* Check that command acceptance acknowledge report was generated */
1198  if (CrFwRepInCmdOutcomeStubGetPos() != cmdRepPos+1)
1199  return 0;
1201  return 0;
1202  if (CrFwRepInCmdOutcomeStubGetServType(cmdRepPos) != 50)
1203  return 0;
1204  if (CrFwRepInCmdOutcomeStubGetServSubType(cmdRepPos) != 1)
1205  return 0;
1206  if (CrFwRepInCmdOutcomeStubGetDiscriminant(cmdRepPos) != 0)
1207  return 0;
1208 
1209  /* Check that no error reports were generated */
1210  if (CrFwRepErrStubGetPos() != errRepPosLocal)
1211  return 0;
1213  return 0;
1214 
1215  /* Check that there are no allocated packets */
1216  if (CrFwPcktGetNOfAllocated() != 0)
1217  return 0;
1218 
1219  /* Check application errors */
1220  if (CrFwGetAppErrCode() != crNoAppErr)
1221  return 0;
1222 
1223  return 1;
1224 }
1225 
void CrFwInStreamStubSetPcktAckLevel(CrFwBool_t acc, CrFwBool_t str, CrFwBool_t prg, CrFwBool_t trm)
Set the value of the acknowledge level of the next packet collected (see CrFwInStreamStubPcktCollect)...
CrFwDestSrc_t CrFwRepErrStubGetDest(CrFwCounterU2_t errRepPos)
Return the destination associated to the error report at position errRepPos.
CrFwCounterU2_t CrFwRepInCmdOutcomeStubGetPos()
Return the position in the InCommand Outcome Report array at which the next outcome report will be wr...
Interface through which framework components access the current time.
static void CrFwInLoaderTestCaseSetReroutingDest(CrFwDestSrc_t retValue)
Function to set the return value of function CrFwInLoaderTestCaseGetReroutingDestination.
CrFwInstanceId_t CrFwInLoaderDefGetInManager(CrFwServType_t servType, CrFwServSubType_t servSubType, CrFwDiscriminant_t discriminant, CrFwCmdRepType_t cmdRepFlag)
Default implementation of the function which selects the InManager to which an incoming InReport or I...
Definition: CrFwInLoader.c:244
CrFwCounterU4_t i
CrPsCmd5EidStart function definitions.
Allocation request for a packet for an InCommand has failed (see CrFwInFactoryMakeInCmd).
CrFwTypeId_t CrFwCmpGetTypeId(FwSmDesc_t smDesc)
Return the type identifier of the argument component.
Definition: CrFwBaseCmp.c:156
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
Report type.
Definition: CrFwConstants.h:43
void CrFwInCmdSample1SetValidityFlag(CrFwBool_t flag)
Set the value of the Validity Flag (see CrFwInCmdSample1ValidityCheck).
CrFwInstanceId_t CrFwRepErrStubGetInstanceId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
CrFwCounterU1_t CrFwOutStreamGetNOfPendingPckts(FwSmDesc_t smDesc)
Return the number of packets currently in the packet queue of an OutStream.
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
#define CR_FW_INFACTORY_MAX_NOF_INCMD
The maximum number of components representing an incoming command which may be allocated at any one t...
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
CrFwBool_t CrFwCmpIsInCreated(FwSmDesc_t smDesc)
Return true if the argument component is in state CREATED.
Definition: CrFwBaseCmp.c:167
CrFwInstanceId_t CrFwCmpGetInstanceId(FwSmDesc_t smDesc)
Return the instance identifier of the argument component.
Definition: CrFwBaseCmp.c:150
static FwSmDesc_t inFactory
The singleton instance of the InFactory.
An InReport or InCommand has failed its acceptance check.
The Pending Command/Report List (PCRL) of an InManager is full (see CrFwInManager.h)
Definition of the OutStream component.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
CrFwInstanceId_t CrFwRepErrStubGetSecondatyInstanceId(CrFwCounterU2_t errRepPos)
Return the secondary instance identifier associated to the error report at position errRepPos...
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
CrFwCounterU1_t CrFwInManagerGetPCRLSize(FwSmDesc_t smDesc)
Return the size of the PCRL of an InManager.
Acceptance failure.
Interface for creating and accessing a report or command packet.
Definition of the InStream component.
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:30
CrFwDestSrc_t CrFwInLoaderDefNoRerouting(CrFwDestSrc_t pcktDest)
Default implementation of the function which checks the legality of a destination and returns the re-...
Definition: CrFwInLoader.c:238
CrFwBool_t CrFwInLoaderTestCase2()
Check the execution function of an InLoader for the case where there are no pending packet in the InS...
CrFwCounterU1_t CrFwInStreamGetNOfPendingPckts(FwSmDesc_t smDesc)
Return the number of packets currently in the packet queue of an InStream.
Definition: CrFwInStream.c:268
Allocation request for an InReport has failed (see CrFwInFactoryMakeInRep).
CrFwBool_t CrFwInLoaderTestCase3()
Check the execution function of an InLoader for the case where the packet destination is invalid...
Definition of the InRegistry Component.
CrFwDestSrc_t CrFwInLoaderTestCaseGetReroutingDestination(CrFwDestSrc_t pcktDest)
Test implementation of the function which checks the legality of a destination and returns the re-rou...
CrFwBool_t CrFwCmpIsInInitialized(FwSmDesc_t smDesc)
Return true if the argument component is in state INITIALIZED.
Definition: CrFwBaseCmp.c:172
Command type.
Definition: CrFwConstants.h:41
CrFwBool_t CrFwInLoaderTestCase10()
Check the execution function of an InLoader for the case where the packet destination is the host app...
CrFwBool_t CrFwInLoaderTestCase4()
Check the execution function of an InLoader for the case where the packet must be re-routed to anothe...
Interface for reporting an error detected by a framework component.
static CrFwDestSrc_t reroutingDest
Return value of function CrFwInLoaderDefGetReroutingDestination.
CrFwRepInCmdOutcome_t CrFwRepInCmdOutcomeStubGetOutcome(CrFwCounterU2_t repPos)
Return the outcome of the InCommand Outcome Report at position repPos.
void CrFwInStreamStubSetPcktCmdRepType(CrFwCmdRepType_t type)
Set the type (command or report) of the next packet collected (see CrFwInStreamStubPcktCollect).
CrFwCounterU1_t CrFwOutStreamStubGetHandoverCnt()
Return the value of the handover counter which is incremented by the packet handover function in CrFw...
Definition of the InReport Component of the framework.
The InLoader has retrieved a packet with an invalid destination (see CrFwInLoader.h)
Acceptance success.
FwSmDesc_t CrFwInLoaderMake()
Factory function to retrieve the state machine implementing the InLoader singleton component...
Definition: CrFwInLoader.c:89
CrFwBool_t CrFwInLoaderTestCase8()
Check the execution function of an InLoader for the case where the packet destination is the host app...
FwSmDesc_t CrFwInManagerMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InManager State Machine instance.
Definition: CrFwInManager.c:96
CrFwBool_t CrFwInLoaderTestCase1()
Check the configuration of a newly created InLoader.
Definition of the InFactory component.
CrFwRepErrCode_t CrFwRepErrStubGetErrCode(CrFwCounterU2_t errRepPos)
Return the error code of the error report at position errRepPos.
Definition of the utility functions for the CORDET Framework.
CrFwServSubType_t CrFwRepInCmdOutcomeStubGetServSubType(CrFwCounterU2_t repPos)
Return the service sub-type of the InCommand Outcome Report at position repPos.
static FwSmDesc_t inLoader
The InLoader singleton.
Definition: CrFwInLoader.c:56
void CrFwPcktSetServSubType(CrFwPckt_t pckt, CrFwServSubType_t servSubType)
Set the service sub-type of the command or report encapsulated in a packet.
#define CR_FW_INFACTORY_MAX_NOF_INREP
The maximum number of InReports which may be allocated at any one time.
CrFwBool_t CrFwInManagerLoad(FwSmDesc_t smDesc, FwSmDesc_t inCmp)
Load a new InReport or InCommand into the InManager.
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
A framework function was called with an illegal type/sub-type/discriminant triplet for an InReport...
CrFwBool_t CrFwInLoaderTestCase11()
Check the execution function of an InLoader for the case where the packet destination is the host app...
Interface for reporting the outcome of the processing of an InCommand.
void CrFwInStreamStubSetPcktType(CrFwServType_t sType, CrFwServSubType_t sSubType, CrFwDiscriminant_t d)
Set the value of the service type, sub-type and discriminant of the next packet collected (see CrFwIn...
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
void CrFwCmpExecute(FwSmDesc_t smDesc)
Execute a framework component.
Definition: CrFwBaseCmp.c:127
void CrFwInFactoryReleaseInRep(FwSmDesc_t inRepInstance)
Release function for an InReport.
CrFwBool_t CrFwInLoaderTestCase9()
Check the execution function of an InLoader for the case where the packet destination is the host app...
void CrFwInStreamStubSetPcktCollectionCnt(CrFwCounterU1_t cnt)
Set the value of the packet collection counter which defines the number of packets available at the m...
Definition of Base Component.
A framework function was called with an illegal type/sub-type/discriminant triplet for an InCommand...
CrFwBool_t CrFwInLoaderTestCase6()
Check the execution function of an InLoader for the case where the packet destination is the host app...
FwSmDesc_t CrFwInFactoryMake()
Factory function for the singleton instance of the InFactory.
void CrFwInStreamStubSetPcktDest(CrFwDestSrc_t d)
Set the value of the destination of the next packet collected (see CrFwInStreamStubPcktCollect).
void CrFwInLoaderSetInStream(FwSmDesc_t inStream)
Set the InStream from which the packets will be retrieved the next time the InLoader is executed...
Definition: CrFwInLoader.c:131
CrFwServType_t CrFwRepInCmdOutcomeStubGetServType(CrFwCounterU2_t repPos)
Return the service type of the InCommand Outcome Report at position repPos.
void CrFwInFactoryReleaseInCmd(FwSmDesc_t inCmdInstance)
Release function for an InCommand.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
void CrFwInStreamStubSetPcktCmdRepId(CrFwInstanceId_t id)
Set the value of the command or report identifier of the next packet collected (see CrFwInStreamStubP...
CrFwBool_t CrFwInLoaderTestCase7()
Check the execution function of an InLoader for the case where the packet destination is the host app...
#define CR_FW_INLOADER_TYPE
Type identifier for the InLoader component.
CrFwOutcome_t CrFwRepErrStubGetOutcome(CrFwCounterU2_t errRepPos)
Return the outcome associated to the error report at position errRepPos.
CrFwDestSrc_t CrFwOutStreamGetDest(FwSmDesc_t smDesc)
Get the destination for an OutStream.
FwSmDesc_t CrFwInFactoryMakeInRep(CrFwPckt_t pckt)
Make function for a component encapsulating an incoming report (InReport).
FwSmDesc_t CrFwOutStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th OutStream State Machine instance.
void CrFwInRepSample1SetValidityFlag(CrFwBool_t flag)
Set the value of the Validity Flag (see CrFwInRepSample1ValidityCheck).
Sample InReport used in the Test Suite.
FwSmDesc_t CrFwInStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InStream State Machine instance.
Definition: CrFwInStream.c:121
CrFwBool_t CrFwInLoaderTestCase5()
Check the execution function of an InLoader for the case where the packet destination is the host app...
CrFwDestSrc_t CrFwInLoaderDefGetReroutingDestination(CrFwDestSrc_t pcktDest)
Default implementation of the function which checks the legality of a destination and returns the re-...
Definition: CrFwInLoader.c:233
CrFwDiscriminant_t CrFwRepInCmdOutcomeStubGetDiscriminant(CrFwCounterU2_t repPos)
Return the discriminant of the InCommand Outcome Report at position repPos.
#define CR_FW_HOST_APP_ID
The identifier of the Master Application of the CORDET Demo.
No application errors have been detected.
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
CrFwCounterU2_t CrFwRepErrStubGetPos()
Return the position in the error report array at which the next error report will be written...
unsigned short CrFwCounterU2_t
Type used for unsigned integers with a "medium" range.
void CrFwOutStreamStubSetHandoverFlag(CrFwBool_t flag)
Set the value of the handover flag which determines the outcome of the packet handover in CrFwOutStre...
FwSmDesc_t CrFwInFactoryMakeInCmd(CrFwPckt_t pckt)
Make function for a component encapsulating an incoming command (InCommand).
CrFwAppErrCode_t CrFwGetAppErrCode()
Return the value of the application error code.
void CrFwPcktSetDiscriminant(CrFwPckt_t pckt, CrFwDiscriminant_t discriminant)
Set the discriminant of the command or report encapsulated in a packet.
CrFwTypeId_t CrFwRepErrStubGetTypeId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
CrFwCounterU1_t CrFwInManagerGetNOfPendingInCmp(FwSmDesc_t smDesc)
Return the number of InReport or InCommands currently in the PCRL of an InManager.
CrFwOutcome_t CrFwRepInCmdOutcomeStubGetFailCode(CrFwCounterU2_t repPos)
Return the failure code of the InCommand Outcome Report at position repPos.
Sample InCommand used in the Test Suite.
Definition of the InCommand Component of the framework.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved