CORDET Framework - C2 Implementation
CrFwOutCmpTestCases.c
Go to the documentation of this file.
1 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include "CrFwOutCmpTestCases.h"
22 #include "CrFwOutStreamStub.h"
23 /* Include FW Profile files */
24 #include "FwSmConstants.h"
25 #include "FwSmConfig.h"
26 #include "FwSmCore.h"
27 #include "FwPrConfig.h"
28 #include "FwPrCore.h"
29 #include "FwPrConstants.h"
30 /* Include framework files */
31 #include "CrFwOutRegistryUserPar.h"
33 #include "BaseCmp/CrFwBaseCmp.h"
34 #include "Pckt/CrFwPckt.h"
35 #include "OutCmp/CrFwOutCmp.h"
37 #include "CrFwTime.h"
38 #include "CrFwRepErr.h"
40 /* Include configuration files */
41 #include "CrFwRepErrStub.h"
42 #include "CrFwOutFactoryUserPar.h"
43 #include "CrFwCmpData.h"
44 
45 /* ---------------------------------------------------------------------------------------------*/
47  FwSmDesc_t outFactory, outCmp1, outCmp2;
49  CrFwOutCmpData_t* cmpSpecificData;
50  CrFwPckt_t pckt;
52 
53  /* Instantiate the OutFactory */
55 
56  /* Initialize and Configure OutFactory and check success */
60  return 0;
61 
62  /* Allocate two OutComponents */
63  outCmp1 = CrFwOutFactoryMakeOutCmp(1,1,0,0);
64  outCmp2 = CrFwOutFactoryMakeOutCmp(5,4,5,0);
65 
66  /* Perform a configuration check on one of the OutComponents */
67  if (FwSmCheckRec(outCmp1) != smSuccess)
68  return 0;
69 
70  /* Check the instance identifiers and the type identifier */
71  if (CrFwCmpGetInstanceId(outCmp1) != apidInstanceId + 1)
72  return 0;
73  if (CrFwCmpGetInstanceId(outCmp2) != apidInstanceId + 2)
74  return 0;
75  if (CrFwCmpGetTypeId(outCmp1) != CR_FW_OUTCMP_TYPE)
76  return 0;
77  if (CrFwCmpGetTypeId(outCmp2) != CR_FW_OUTCMP_TYPE)
78  return 0;
79 
80  /* Check the group */
81  if (CrFwOutCmpGetGroup(outCmp1) != 0)
82  return 0;
83 
84  /* Check OutComponent state */
85  if (!CrFwCmpIsInConfigured(outCmp1))
86  return 0;
87  if (!CrFwOutCmpIsInLoaded(outCmp1))
88  return 0;
89 
90  /* Check type, sub-type and discriminant */
91  if (CrFwOutCmpGetServType(outCmp1) != 1)
92  return 0;
93  if (CrFwOutCmpGetServType(outCmp2) != 5)
94  return 0;
95 
96  if (CrFwOutCmpGetServSubType(outCmp1) != 1)
97  return 0;
98  if (CrFwOutCmpGetServSubType(outCmp2) != 4)
99  return 0;
100 
101  if (CrFwOutCmpGetDiscriminant(outCmp1) != 0)
102  return 0;
103  if (CrFwOutCmpGetDiscriminant(outCmp2) != 5)
104  return 0;
105 
106  /* Check group set and read-back */
107  CrFwOutCmpSetGroup(outCmp1, 12);
108  if (CrFwOutCmpGetGroup(outCmp1) != 12)
109  return 0;
110 
111  /* Check destination set and read-back */
112  CrFwOutCmpSetDest(outCmp1, 4);
113  if (CrFwOutCmpGetDest(outCmp1) != 4)
114  return 0;
115 
116  /* Check discriminant set and read-back */
117  CrFwOutCmpSetDiscriminant(outCmp1, 7);
118  if (CrFwOutCmpGetDiscriminant(outCmp1) != 7)
119  return 0;
120 
121  /* Check time stamp set and read-back */
122  CrFwOutCmpSetTimeStamp(outCmp1, 33);
123  if (CrFwOutCmpGetTimeStamp(outCmp1) != 33)
124  return 0;
125 
126  /* Check acknowledge level set and read-back */
127  CrFwOutCmpSetAckLevel(outCmp1, 1, 0, 0, 0);
128  if (CrFwOutCmpIsAcceptAck(outCmp1) != 1)
129  return 0;
130  if (CrFwOutCmpIsStartAck(outCmp1) != 0)
131  return 0;
132  if (CrFwOutCmpIsProgressAck(outCmp1) != 0)
133  return 0;
134  if (CrFwOutCmpIsTermAck(outCmp1) != 0)
135  return 0;
136 
137  CrFwOutCmpSetAckLevel(outCmp1, 0, 1, 0, 0);
138  if (CrFwOutCmpIsAcceptAck(outCmp1) != 0)
139  return 0;
140  if (CrFwOutCmpIsStartAck(outCmp1) != 1)
141  return 0;
142  if (CrFwOutCmpIsProgressAck(outCmp1) != 0)
143  return 0;
144  if (CrFwOutCmpIsTermAck(outCmp1) != 0)
145  return 0;
146 
147  CrFwOutCmpSetAckLevel(outCmp1, 0, 0, 1, 0);
148  if (CrFwOutCmpIsAcceptAck(outCmp1) != 0)
149  return 0;
150  if (CrFwOutCmpIsStartAck(outCmp1) != 0)
151  return 0;
152  if (CrFwOutCmpIsProgressAck(outCmp1) != 1)
153  return 0;
154  if (CrFwOutCmpIsTermAck(outCmp1) != 0)
155  return 0;
156 
157  CrFwOutCmpSetAckLevel(outCmp1, 0, 0, 0, 1);
158  if (CrFwOutCmpIsAcceptAck(outCmp1) != 0)
159  return 0;
160  if (CrFwOutCmpIsStartAck(outCmp1) != 0)
161  return 0;
162  if (CrFwOutCmpIsProgressAck(outCmp1) != 0)
163  return 0;
164  if (CrFwOutCmpIsTermAck(outCmp1) != 1)
165  return 0;
166 
167  /* Check functions to get parameter area */
168  outCmpData = (CrFwCmpData_t*)FwSmGetData(outCmp1);
169  cmpSpecificData = (CrFwOutCmpData_t*)(outCmpData->cmpSpecificData);
170  if (CrFwOutCmpGetParStart(outCmp1) != CrFwPcktGetParStart(cmpSpecificData->pckt))
171  return 0;
172  if (CrFwOutCmpGetParLength(outCmp1) != CrFwPcktGetParLength(cmpSpecificData->pckt))
173  return 0;
174 
175  /* Check the function to get the OutComponent packets */
176  pckt = CrFwOutCmpGetPckt(outCmp1);
177  if (CrFwPcktGetServType(pckt)!=1)
178  return 0;
179  if (CrFwPcktGetServSubType(pckt)!=1)
180  return 0;
181 
182  pckt = CrFwOutCmpGetPckt(outCmp2);
183  if (CrFwPcktGetServType(pckt)!=5)
184  return 0;
185  if (CrFwPcktGetServSubType(pckt)!=4)
186  return 0;
187 
188  /* Release the OutComponents */
191 
192  /* Check that there are no allocated packets */
193  if (CrFwPcktGetNOfAllocated() != 0)
194  return 0;
195 
196  /* Check application errors */
197  if (CrFwGetAppErrCode() != crNoAppErr)
198  return 0;
199 
200  return 1;
201 }
202 
203 /* ---------------------------------------------------------------------------------------------*/
205  FwSmDesc_t outFactory, outCmp;
206 
207  /* Instantiate the OutFactory */
209 
210  /* Initialize and Configure OutFactory and check success */
214  return 0;
215 
216  /* Allocate a Sample 1 OutComponent instance */
217  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
219  return 0;
220 
221  /* Set up enable, repeat and ready check of sample OutComponent */
225 
226  /* Execute the sample OutComponent and check it is aborted */
229  return 0;
230 
231  /* Release the OutComponent */
233 
234  /* Allocate another Sample 1 OutComponent instance */
235  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
237  return 0;
238 
239  /* Set up enable, repeat and ready check of sample OutComponent */
243 
244  /* Execute the sample OutComponent and check it is aborted */
247  return 0;
248 
249  /* Release the OutComponent */
251 
252  /* Check that there are no allocated packets */
253  if (CrFwPcktGetNOfAllocated() != 0)
254  return 0;
255 
256  /* Check application errors */
257  if (CrFwGetAppErrCode() != crNoAppErr)
258  return 0;
259 
260  return 1;
261 }
262 
263 /* ---------------------------------------------------------------------------------------------*/
265  FwSmDesc_t outFactory, outCmp;
266  CrFwCounterU2_t errRepPosLocal;
267 
268  /* Reset error reporting interface */
270 
271  /* Instantiate the OutFactory */
273 
274  /* Initialize and Configure OutFactory and check success */
278  return 0;
279 
280  /* Allocate a Sample1 OutComponent instance */
281  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
283  return 0;
284 
285  /* Set up enable, repeat and ready check of sample OutComponent */
289 
290  /* Set destination to an invalid value */
292 
293  /* Store the current value of the error report counter */
294  errRepPosLocal = CrFwRepErrStubGetPos();
295 
296  /* Execute and terminate the sample OutComponent and check it is terminated */
300  return 0;
301 
302  /* Check generation of error report */
303  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
304  return 0;
305  if (CrFwRepErrStubGetErrCode(errRepPosLocal) != crOutCmpSendPcktInvDest)
306  return 0;
307  if (CrFwRepErrStubGetTypeId(errRepPosLocal) != CR_FW_OUTCMP_TYPE)
308  return 0;
310  return 0;
311 
312  /* Check and reset application error code */
314  return 0;
316 
317  /* Release the OutComponent */
319 
320  /* Check that there are no allocated packets */
321  if (CrFwPcktGetNOfAllocated() != 0)
322  return 0;
323 
324  /* Check application errors */
325  if (CrFwGetAppErrCode() != crNoAppErr)
326  return 0;
327 
328  return 1;
329 }
330 
331 /* ---------------------------------------------------------------------------------------------*/
333  FwSmDesc_t outFactory, outCmp;
334  CrFwCounterU2_t errRepPosLocal;
336  CrFwPckt_t pckt;
337  CrFwBool_t acceptAck, startAck, progressAck, termAck;
338  unsigned char counter = 90;
339  CrFwTimeStamp_t curTimeStamp;
340  CrFwTime_t curTime;
341  CrFwTimeCyc_t cycTime;
342 
343  /* Reset error reporting interface */
345 
346  /* Start, initialize and reset OutStream to which OutComponent will be sent (just to clear effect of previous tests) */
347  dest = 2;
348  FwSmStart(CrFwOutStreamGet(dest));
352  return 0;
353 
354  /* Configure OutStream to hold packets in its internal packet queue */
356 
357  /* Instantiate the OutFactory */
359 
360  /* Initialize and Configure OutFactory and check success */
364  return 0;
365 
366  /* Retrieve a Sample1 OutComponent instance */
367  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
369  return 0;
370 
371  /* Set the Sample1 OutComponent acknowledge level */
372  acceptAck = 0;
373  startAck = 1;
374  progressAck = 0;
375  termAck = 1;
376  CrFwOutCmpSetAckLevel(outCmp, acceptAck, startAck, progressAck, termAck);
377 
378  /* Get the packet associated to the Sample1 OutComponent */
380 
381  /* Set up enable, repeat and ready check of sample OutComponent */
385 
386  /* Store the current value of the error report counter */
387  errRepPosLocal = CrFwRepErrStubGetPos();
388 
389  /* Set destination of OutComponent */
391 
392  /* Set Sample1 Counter */
394 
395  /* Retrieve the current time in all its 3 formats and verify that they are equivalent */
396  curTimeStamp = CrFwGetCurrentTimeStamp();
397  curTime = CrFwGetCurrentTime();
398  cycTime = CrFwGetCurrentCycTime();
399  if (curTime != CrFwTimeStampToStdTime(curTimeStamp))
400  return 0;
401 
402  if (curTimeStamp != CrFwStdTimeToTimeStamp(curTime))
403  return 0;
404 
405  if (cycTime != curTimeStamp)
406  return 0;
407 
408  /* Execute and terminate the sample OutComponent and check it is terminated */
412  return 0;
413 
414  /* Check that time stamp is correctly set */
415  if (CrFwOutCmpGetTimeStamp(outCmp) != curTime+1)
416  return 0;
417 
418  /* Check that no error report was generated */
419  if (CrFwRepErrStubGetPos() != errRepPosLocal)
420  return 0;
421 
422  /* Check that number of pending out-going packets in OutStream has increased */
424  return 0;
425 
426  /* Check that the OutComponent state was correctly serialized to its packet */
427  if (CrFwPcktGetServType(pckt) != 50)
428  return 0;
429  if (CrFwPcktGetServSubType(pckt) != 1)
430  return 0;
431  if (CrFwPcktGetDiscriminant(pckt) != 0)
432  return 0;
434  return 0;
435  if (CrFwPcktGetCmdRepType(pckt) != crCmdType)
436  return 0;
437  if (CrFwPcktGetDest(pckt) != dest)
438  return 0;
439  if (CrFwPcktIsAcceptAck(pckt) != 0)
440  return 0;
441  if (CrFwPcktIsStartAck(pckt) != 1)
442  return 0;
443  if (CrFwPcktIsProgressAck(pckt) != 0)
444  return 0;
445  if (CrFwPcktIsTermAck(pckt) != 1)
446  return 0;
447  if (CrFwPcktGetCrc(pckt) != 0xFFFF)
448  return 0;
449  if (pckt[CrFwPcktGetMaxLength()-3] != counter+1)
450  return 0;
451 
452  /* Reset the OutStream (this will also release the OutComponent packet) */
454 
455  /* Release the OutComponent */
457 
458  /* Check that there are no allocated packets */
459  if (CrFwPcktGetNOfAllocated() != 0)
460  return 0;
461 
462  /* Check application errors */
463  if (CrFwGetAppErrCode() != crNoAppErr)
464  return 0;
465 
466  return 1;
467 }
468 
469 /* ---------------------------------------------------------------------------------------------*/
471  FwSmDesc_t outFactory, outCmp;
472  CrFwCounterU2_t errRepPosLocal;
474  CrFwPckt_t pckt;
475  CrFwBool_t acceptAck, startAck, progressAck, termAck;
476  unsigned char counter = 89;
477 
478  /* Reset error reporting interface */
480 
481  /* Start, initialize and reset OutStream to which OutComponent will be sent (just to clear effect of previous tests) */
482  dest = 2;
483  FwSmStart(CrFwOutStreamGet(dest));
487  return 0;
488 
489  /* Configure OutStream to hold packets in its internal packet queue */
491 
492  /* Instantiate the OutFactory */
494 
495  /* Initialize and Configure OutFactory and check success */
499  return 0;
500 
501  /* Retrieve a Sample1 OutComponent instance */
502  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
504  return 0;
505 
506  /* Set the Sample1 OutComponent acknowledge level */
507  acceptAck = 1;
508  startAck = 0;
509  progressAck = 1;
510  termAck = 0;
511  CrFwOutCmpSetAckLevel(outCmp, acceptAck, startAck, progressAck, termAck);
512 
513  /* Get the packet associated to the Sample1 OutComponent */
515 
516  /* Set up enable, repeat and ready check of sample OutComponent */
520 
521  /* Store the current value of the error report counter */
522  errRepPosLocal = CrFwRepErrStubGetPos();
523 
524  /* Set destination of OutComponent */
526 
527  /* Set Sample1 Counter */
529 
530  /* Execute/terminate the sample OutComponent and check it is left pending */
534  return 0;
535 
536  /* Execute it again and check that it remains pending */
542  return 0;
543 
544  /* Configure the ready check to return "ready" */
546 
547  /* Execute the sample OutComponent and check it is terminated */
551  return 0;
552 
553  /* Check that no error report was generated */
554  if (CrFwRepErrStubGetPos() != errRepPosLocal)
555  return 0;
556 
557  /* Check that number of pending packets in OutStream has increased */
559  return 0;
560 
561  /* Check that the OutComponent state was correctly serialized to its packet */
562  if (CrFwPcktGetServType(pckt) != 50)
563  return 0;
564  if (CrFwPcktGetServSubType(pckt) != 1)
565  return 0;
566  if (CrFwPcktGetDiscriminant(pckt) != 0)
567  return 0;
569  return 0;
570  if (CrFwPcktGetCmdRepType(pckt) != crCmdType)
571  return 0;
572  if (CrFwPcktGetDest(pckt) != dest)
573  return 0;
574  if (CrFwPcktIsAcceptAck(pckt) != 1)
575  return 0;
576  if (CrFwPcktIsStartAck(pckt) != 0)
577  return 0;
578  if (CrFwPcktIsProgressAck(pckt) != 1)
579  return 0;
580  if (CrFwPcktIsTermAck(pckt) != 0)
581  return 0;
582  if (CrFwPcktGetCrc(pckt) != 0xFFFF)
583  return 0;
584  if (pckt[CrFwPcktGetMaxLength()-3] != counter + 1)
585  return 0;
586 
587  /* Reset the OutStream */
589 
590  /* Release the OutComponent */
592 
593  /* Check that there are no allocated packets */
594  if (CrFwPcktGetNOfAllocated() != 0)
595  return 0;
596 
597  /* Check application errors */
598  if (CrFwGetAppErrCode() != crNoAppErr)
599  return 0;
600 
601  return 1;
602 }
603 
604 /* ---------------------------------------------------------------------------------------------*/
606  FwSmDesc_t outFactory, outCmp1, outCmp2;
607  CrFwCounterU2_t errRepPosLocal;
609  CrFwPckt_t pckt;
610  CrFwBool_t acceptAck, startAck, progressAck, termAck;
611 
612  /* Reset error reporting interface */
614 
615  /* Start, initialize and reset OutStream to which OutComponent will be sent (just to clear effect of previous tests) */
616  dest = 2;
617  FwSmStart(CrFwOutStreamGet(dest));
621  return 0;
622 
623  /* Configure OutStream to hold packets in its internal packet queue */
625 
626  /* Instantiate the OutFactory */
628 
629  /* Initialize and Configure OutFactory and check success */
633  return 0;
634 
635  /* Retrieve two OutComponent instances */
636  outCmp1 = CrFwOutFactoryMakeOutCmp(5,1,2,0);
637  outCmp2 = CrFwOutFactoryMakeOutCmp(25,3,0,0);
638  if (!CrFwOutCmpIsInLoaded(outCmp1))
639  return 0;
640  if (!CrFwOutCmpIsInLoaded(outCmp2))
641  return 0;
642 
643  /* Set the acknowledge level of the second OutComponent */
644  acceptAck = 0;
645  startAck = 1;
646  progressAck = 0;
647  termAck = 1;
648  CrFwOutCmpSetAckLevel(outCmp2, acceptAck, startAck, progressAck, termAck);
649 
650  /* Set destination of second OutComponent */
651  CrFwOutCmpSetDest(outCmp2, dest);
652 
653  /* Get the packet associated to the second OutComponent */
654  pckt = CrFwOutCmpSample1GetPckt(outCmp2);
655 
656  /* Store the current value of the error report counter */
657  errRepPosLocal = CrFwRepErrStubGetPos();
658 
659  /* Disable the first type of OutComponent */
660  CrFwOutRegistrySetEnable(5, 0, 0, 0);
661 
662  /* Disable the second type of OutComponent */
663  CrFwOutRegistrySetEnable(25, 0, 0, 1);
664 
665  /* Execute/terminate the first OutComponent and check it is aborted */
666  CrFwCmpExecute(outCmp1);
667  CrFwOutCmpTerminate(outCmp1);
668  if (!CrFwOutCmpIsInAborted(outCmp1))
669  return 0;
670 
671  /* Execute the second OutComponent and check it is terminated */
672  CrFwCmpExecute(outCmp2);
673  CrFwOutCmpTerminate(outCmp2);
674  if (!CrFwOutCmpIsInTerminated(outCmp2))
675  return 0;
676 
677  /* Check that no error report was generated */
678  if (CrFwRepErrStubGetPos() != errRepPosLocal)
679  return 0;
680 
681  /* Check that number of pending OutComponents in OutStream has increased */
683  return 0;
684 
685  /* Check that the state of the second OutComponent was correctly serialized to its packet */
686  if (CrFwPcktGetServType(pckt) != 25)
687  return 0;
688  if (CrFwPcktGetServSubType(pckt) != 3)
689  return 0;
690  if (CrFwPcktGetDiscriminant(pckt) != 0)
691  return 0;
692  if (CrFwPcktGetCmdRepId(pckt) != CrFwCmpGetInstanceId(outCmp2))
693  return 0;
694  if (CrFwPcktGetCmdRepType(pckt) != crRepType)
695  return 0;
696  if (CrFwPcktGetDest(pckt) != dest)
697  return 0;
698  if (CrFwPcktIsAcceptAck(pckt) != 0)
699  return 0;
700  if (CrFwPcktIsStartAck(pckt) != 1)
701  return 0;
702  if (CrFwPcktIsProgressAck(pckt) != 0)
703  return 0;
704  if (CrFwPcktIsTermAck(pckt) != 1)
705  return 0;
706 
707  /* Reset the OutStream (this will also release the OutComponent packet) */
709 
710  /* Release the two OutComponent */
713 
714  /* Check that no components are allocated in the OutFactory */
716  return 0;
717 
718  /* Check that there are no allocated packets */
719  if (CrFwPcktGetNOfAllocated() != 0)
720  return 0;
721 
722  /* Check application errors */
723  if (CrFwGetAppErrCode() != crNoAppErr)
724  return 0;
725 
726  return 1;
727 }
728 
729 /* ---------------------------------------------------------------------------------------------*/
731  FwSmDesc_t outFactory, outCmp;
733  CrFwPckt_t pckt;
734  unsigned char counter = 22;
735 
736  /* Reset error reporting interface */
738 
739  /* Start, initialize and reset OutStream to which OutComponent will be sent (just to clear effect of previous tests) */
740  dest = 2;
741  FwSmStart(CrFwOutStreamGet(dest));
745  return 0;
746 
747  /* Configure OutStream to hold packets in its internal packet queue */
749 
750  /* Instantiate the OutFactory */
752 
753  /* Initialize and Configure OutFactory and check success */
757  return 0;
758 
759  /* Allocate a Sample 1 OutComponent instance */
760  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
762  return 0;
763 
764  /* Set destination of OutComponent */
766 
767  /* Set Sample1 Counter */
769 
770  /* Get the packet associated to the Sample1 OutComponent */
772 
773  /* Set up enable, repeat and ready check of sample OutComponent */
777 
778  /* Execute/terminate the sample OutComponent and check it is in PENDING */
782  return 0;
783 
784  /* Check that the OutComponent was updated */
785  if (pckt[CrFwPcktGetMaxLength()-3] != counter+1)
786  return 0;
787 
788  /* Execute/terminate the sample OutComponent and check it is still in PENDING */
792  return 0;
793 
794  /* Check that the OutComponent was updated */
795  if (pckt[CrFwPcktGetMaxLength()-3] != counter+2)
796  return 0;
797 
798  /* Set up repeat check of sample OutComponent to return "no repeat" */
800 
801  /* Execute/terminate the sample OutComponent and check it is still in TERMINATED */
805  return 0;
806 
807  /* Check that the OutComponent was updated */
808  if (pckt[CrFwPcktGetMaxLength()-3] != counter+3)
809  return 0;
810 
811  /* Reset the OutStream (this will also release the OutComponent packet) */
813 
814  /* Release the OutComponent */
816 
817  /* Check that there are no allocated packets */
818  if (CrFwPcktGetNOfAllocated() != 0)
819  return 0;
820 
821  /* Check application errors */
822  if (CrFwGetAppErrCode() != crNoAppErr)
823  return 0;
824 
825  return 1;
826 }
827 
828 /* ---------------------------------------------------------------------------------------------*/
830  FwSmDesc_t outFactory, outCmp;
832  unsigned char counter = 22;
833 
834  /* Reset error reporting interface */
836 
837  /* Set destination to an invalid value */
838  dest = 100;
839 
840  /* Instantiate the OutFactory */
842 
843  /* Initialize and Configure OutFactory and check success */
847  return 0;
848 
849  /* Allocate a Sample 1 OutComponent instance */
850  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
852  return 0;
853 
854  /* Set destination of OutComponent */
856 
857  /* Set Sample1 Counter */
859 
860  /* Set up enable, repeat and ready check of sample OutComponent */
864 
865  /* Execute/terminate the sample OutComponent and check it is in TERMINATED */
869  return 0;
870 
871  /* Reset and reconfigure sample OutComponent */
874  return 0;
878 
879  /* Execute/terminate the sample OutComponent twice and check it remains in PENDING */
885  return 0;
886 
887  /* Reconfigure sample OutComponent to be ready */
889 
890  /* Execute/terminate the sample OutComponent and check it is in TERMINATED */
894  return 0;
895 
896  /* Release the OutComponent */
898 
899  /* Check that there are no allocated packets */
900  if (CrFwPcktGetNOfAllocated() != 0)
901  return 0;
902 
903  /* Check and reset application error code */
905  return 0;
907 
908  /* Check application errors */
909  if (CrFwGetAppErrCode() != crNoAppErr)
910  return 0;
911 
912  return 1;
913 }
914 
915 /* ---------------------------------------------------------------------------------------------*/
917  FwSmDesc_t outFactory, outCmp;
919  unsigned char counter = 22;
920 
921  /* Reset error reporting interface */
923 
924  /* Start, initialize and reset OutStream to which OutComponent will be sent (just to clear effect of previous tests) */
925  dest = 2;
926  FwSmStart(CrFwOutStreamGet(dest));
930  return 0;
931 
932  /* Instantiate the OutFactory */
934 
935  /* Initialize and Configure OutFactory and check success */
939  return 0;
940 
941  /* Allocate a Sample 1 OutComponent instance */
942  outCmp = CrFwOutFactoryMakeOutCmp(50,1,0,0);
944  return 0;
945 
946  /* Set destination of OutComponent */
948 
949  /* Set Sample1 Counter */
951 
952  /* Set up enable, repeat and ready check of sample OutComponent */
956 
957  /* Execute/terminate the sample OutComponent and check it is in PENDING */
961  return 0;
962 
963  /* Set up enable, repeat and ready check of sample OutComponent */
967 
968  /* Execute/terminate the sample OutComponent and check it is in ABORTED */
972  return 0;
973 
974  /* Reset and reconfigure sample OutComponent */
977  return 0;
981 
982  /* Execute/terminate the sample OutComponent and check it is in PENDING */
986  return 0;
987 
988  /* Set up enable, repeat and ready check of sample OutComponent */
992 
993  /* Execute/terminate the sample OutComponent and check it is in ABORTED */
997  return 0;
998 
999  /* Release the OutComponent */
1001 
1002  /* Check that there are no allocated packets */
1003  if (CrFwPcktGetNOfAllocated() != 0)
1004  return 0;
1005 
1006  /* Check application errors */
1007  if (CrFwGetAppErrCode() != crNoAppErr)
1008  return 0;
1009 
1010  return 1;
1011 }
CrFwInstanceId_t CrFwCmpGetInstanceId(FwSmDesc_t smDesc)
Return the instance identifier of the argument component.
Definition: CrFwBaseCmp.c:150
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
void CrFwCmpExecute(FwSmDesc_t smDesc)
Execute a framework component.
Definition: CrFwBaseCmp.c:127
CrFwTypeId_t CrFwCmpGetTypeId(FwSmDesc_t smDesc)
Return the type identifier of the argument component.
Definition: CrFwBaseCmp.c:156
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
@ crRepType
Report type.
Definition: CrFwConstants.h:45
@ crCmdType
Command type.
Definition: CrFwConstants.h:43
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
#define CR_FW_OUTCMP_TYPE
Type identifier for the OutComponent components.
static CrFwDestSrc_t dest
Destination.
void CrFwOutCmpSetDiscriminant(FwSmDesc_t smDesc, CrFwDiscriminant_t discriminant)
Set the discriminant of the OutComponent.
Definition: CrFwOutCmp.c:258
CrFwTimeStamp_t CrFwOutCmpGetTimeStamp(FwSmDesc_t smDesc)
Return the time stamp attribute of the OutComponent.
Definition: CrFwOutCmp.c:215
CrFwPckt_t CrFwOutCmpGetParStart(FwSmDesc_t smDesc)
Return the start address of the parameter area of the OutComponent.
Definition: CrFwOutCmp.c:381
CrFwDestSrc_t CrFwOutCmpGetDest(FwSmDesc_t smDesc)
Return the destination of the OutComponent.
Definition: CrFwOutCmp.c:185
CrFwBool_t CrFwOutCmpIsStartAck(FwSmDesc_t smDesc)
Return the acknowledge level for command start for the command encapsulated in the OutComponent.
Definition: CrFwOutCmp.c:281
CrFwBool_t CrFwOutCmpIsInPending(FwSmDesc_t smDesc)
Return true if the argument OutComponent is in state PENDING.
Definition: CrFwOutCmp.c:158
void CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
CrFwBool_t CrFwOutCmpIsTermAck(FwSmDesc_t smDesc)
Return the acknowledge level for command termination for the command encapsulated in the OutComponent...
Definition: CrFwOutCmp.c:295
CrFwBool_t CrFwOutCmpIsInLoaded(FwSmDesc_t smDesc)
Return true if the argument OutComponent is in state LOADED.
Definition: CrFwOutCmp.c:148
void CrFwOutCmpSetGroup(FwSmDesc_t smDesc, CrFwGroup_t group)
Set the group of the OutComponent.
Definition: CrFwOutCmp.c:207
CrFwServType_t CrFwOutCmpGetServType(FwSmDesc_t smDesc)
Return the type of the OutComponent.
Definition: CrFwOutCmp.c:230
CrFwBool_t CrFwOutCmpIsAcceptAck(FwSmDesc_t smDesc)
Return the acknowledge level for command acceptance for the command encapsulated in the OutComponent.
Definition: CrFwOutCmp.c:274
CrFwGroup_t CrFwOutCmpGetGroup(FwSmDesc_t smDesc)
Return the group of the OutComponent.
Definition: CrFwOutCmp.c:200
CrFwDiscriminant_t CrFwOutCmpGetDiscriminant(FwSmDesc_t smDesc)
Return the discriminant of the OutComponent.
Definition: CrFwOutCmp.c:251
CrFwPckt_t CrFwOutCmpGetPckt(FwSmDesc_t smDesc)
Return the pointer to the packet which holds the OutComponent.
Definition: CrFwOutCmp.c:402
void CrFwOutCmpSetAckLevel(FwSmDesc_t smDesc, CrFwBool_t accept, CrFwBool_t start, CrFwBool_t progress, CrFwBool_t term)
Set the acknowledge level for the command encapsulated in the OutComponent.
Definition: CrFwOutCmp.c:265
CrFwBool_t CrFwOutCmpIsInAborted(FwSmDesc_t smDesc)
Return true if the argument OutComponent is in state ABORTED.
Definition: CrFwOutCmp.c:153
CrFwServType_t CrFwOutCmpGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the OutComponent.
Definition: CrFwOutCmp.c:244
void CrFwOutCmpSetTimeStamp(FwSmDesc_t smDesc, CrFwTimeStamp_t timeStamp)
Set the time stamp attribute of the OutComponent.
Definition: CrFwOutCmp.c:222
CrFwBool_t CrFwOutCmpIsInTerminated(FwSmDesc_t smDesc)
Return true if the argument OutComponent is in state TERMINATED.
Definition: CrFwOutCmp.c:163
void CrFwOutCmpTerminate(FwSmDesc_t smDesc)
Send command Terminate to the argument OutComponent.
Definition: CrFwOutCmp.c:143
CrFwPcktLength_t CrFwOutCmpGetParLength(FwSmDesc_t smDesc)
Return the length in bytes of the parameter area of the OutComponent.
Definition: CrFwOutCmp.c:388
CrFwBool_t CrFwOutCmpIsProgressAck(FwSmDesc_t smDesc)
Return the acknowledge level for command progress for the command encapsulated in the OutComponent.
Definition: CrFwOutCmp.c:288
Definition of the OutComponent Component of the framework.
void CrFwOutCmpSample1SetCounter(unsigned char cnt)
Set the value of Sample 1 Counter (see CrFwOutCmpSample1Serialize).
void CrFwOutCmpSample1SetReadyFlag(CrFwBool_t flag)
Set the value of Ready Flag (see CrFwOutCmpSample1ReadyCheck).
static unsigned char counter
The Sample 1 Counter.
void CrFwOutCmpSample1SetRepeatFlag(CrFwBool_t flag)
Set the value of Repeat Flag (see CrFwOutCmpSample1RepeatCheck).
CrFwPckt_t CrFwOutCmpSample1GetPckt(FwSmDesc_t smDesc)
Return the packet associated to the Sample 1 OutComponent.
void CrFwOutCmpSample1SetEnableFlag(CrFwBool_t flag)
Set the value of Enable Flag (see CrFwOutCmpSample1EnableCheck).
CrFwBool_t CrFwOutCmpTestCase6()
Check the default Enable Check Operation and Ready Check Operation of an OutComponent.
CrFwBool_t CrFwOutCmpTestCase7()
Check the execution of a "repeat" OutComponent.
CrFwBool_t CrFwOutCmpTestCase8()
Check the execution of a "repeat" OutComponent with an invalid destination.
CrFwBool_t CrFwOutCmpTestCase4()
Check the execution of a "ready" OutComponent with a valid destination.
CrFwBool_t CrFwOutCmpTestCase5()
Check the execution of a "pending" OutComponent with a valid destination.
CrFwBool_t CrFwOutCmpTestCase2()
Check the abort function of an OutComponent.
CrFwBool_t CrFwOutCmpTestCase1()
Check the configuration of a newly created OutComponent.
CrFwBool_t CrFwOutCmpTestCase9()
Check the transition from state PENDING to state ABORTED.
CrFwBool_t CrFwOutCmpTestCase3()
Check the execution of a "ready" OutComponent with an invalid destination.
Declaration of the test cases for the OutComponent Component (see CrFwOutCmp.h).
CrFwOutFactoryPoolIndex_t CrFwOutFactoryGetNOfAllocatedOutCmp()
Return the number of OutComponents which are currently allocated.
static CrFwCmpData_t outCmpData[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The data for the pre-allocated OutComponent instances.
static FwSmDesc_t outFactory
The singleton instance of the OutFactory.
static CrFwInstanceId_t apidInstanceId
The part of the command or report identifier which depends on the application identifier.
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
FwSmDesc_t CrFwOutFactoryMake()
Factory function for the singleton instance of the OutFactory.
static FwSmDesc_t outCmp[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The pre-allocated OutComponent instances.
void CrFwOutFactoryReleaseOutCmp(FwSmDesc_t outCmpInstance)
Release function for an OutComponent.
Definition of the OutFactory component.
User-modifiable parameters for the OutFactory component (see CrFwOutFactory.h).
void CrFwOutRegistrySetEnable(CrFwServType_t servType, CrFwServSubType_t servSubType, CrFwDiscriminant_t discriminant, CrFwBool_t isEnabled)
Set the enable state of a set of out-going commands or reports.
Definition of the OutRegistry Component.
User-modifiable parameters for the OutRegistry component (see CrFwOutRegistry.h).
FwSmDesc_t CrFwOutStreamGet(CrFwDestSrc_t dest)
Getter function for the OutStream corresponding to the argument destination.
CrFwCounterU1_t CrFwOutStreamGetNOfPendingPckts(FwSmDesc_t smDesc)
Return the number of packets currently in the packet queue of an OutStream.
void CrFwOutStreamStubSetHandoverFlag(CrFwBool_t flag)
Set the value of the handover flag which determines the outcome of the packet handover in CrFwOutStre...
Interface for the OutStream stub.
Interface for creating and accessing a report or command packet.
CrFwPckt_t CrFwPcktGetParStart(CrFwPckt_t pckt)
Return the start address of the packet's parameter area.
Definition: CrFwPckt.c:412
CrFwBool_t CrFwPcktIsProgressAck(CrFwPckt_t pckt)
Return the acknowledge level for command progress for the command encapsulated in the packet.
Definition: CrFwPckt.c:400
CrFwBool_t CrFwPcktIsTermAck(CrFwPckt_t pckt)
Return the acknowledge level for command termination for the command encapsulated in the packet.
Definition: CrFwPckt.c:406
CrFwCmdRepType_t CrFwPcktGetCmdRepType(CrFwPckt_t pckt)
Return the type of a packet (either a command packet or a report packet).
Definition: CrFwPckt.c:229
CrFwPcktLength_t CrFwPcktGetParLength(CrFwPckt_t pckt)
Return the length in bytes of the packet's parameter area.
Definition: CrFwPckt.c:417
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
Definition: CrFwPckt.c:214
CrFwServSubType_t CrFwPcktGetServSubType(CrFwPckt_t pckt)
Return the service sub-type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:333
CrFwDestSrc_t CrFwPcktGetDest(CrFwPckt_t pckt)
Return the destination of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:345
CrFwInstanceId_t CrFwPcktGetCmdRepId(CrFwPckt_t pckt)
Return the command or report identifier of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:369
CrFwBool_t CrFwPcktIsAcceptAck(CrFwPckt_t pckt)
Return the acknowledge level for command acceptance for the command encapsulated in the packet.
Definition: CrFwPckt.c:388
CrFwPcktLength_t CrFwPcktGetMaxLength()
Return the maximum length of a packet in number of bytes.
Definition: CrFwPckt.c:219
CrFwBool_t CrFwPcktIsStartAck(CrFwPckt_t pckt)
Return the acknowledge level for command start for the command encapsulated in the packet.
Definition: CrFwPckt.c:394
CrFwCrc_t CrFwPcktGetCrc(CrFwPckt_t pckt)
Return the CRC of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:293
CrFwDiscriminant_t CrFwPcktGetDiscriminant(CrFwPckt_t pckt)
Return the discriminant of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:303
CrFwServType_t CrFwPcktGetServType(CrFwPckt_t pckt)
Return the service type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:321
void CrFwRepErrStubReset()
Reset the error reporting interface.
Definition: CrFwRepErr.c:84
CrFwInstanceId_t CrFwRepErrStubGetInstanceId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
Definition: CrFwRepErr.c:277
CrFwCounterU2_t CrFwRepErrStubGetPos()
Return the position in the error report array at which the next error report will be written.
Definition: CrFwRepErr.c:79
CrFwTypeId_t CrFwRepErrStubGetTypeId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
Definition: CrFwRepErr.c:272
CrFwRepErrCode_t CrFwRepErrStubGetErrCode(CrFwCounterU2_t errRepPos)
Return the error code of the error report at position errRepPos.
Definition: CrFwRepErr.c:267
Interface for reporting an error detected by a framework component.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr....
Interface through which framework components access the current time.
CrFwTime_t CrFwGetCurrentTime()
Return the current application time in standard format.
Definition: CrFwTime.c:48
CrFwTime_t CrFwTimeStampToStdTime(CrFwTimeStamp_t timeStamp)
Convert a time value from time-stamp format to standard time format.
Definition: CrFwTime.c:63
CrFwTimeStamp_t CrFwGetCurrentTimeStamp()
Return the current time in the format used for the command and report time-stamp.
Definition: CrFwTime.c:42
CrFwTimeCyc_t CrFwGetCurrentCycTime()
Return the current time in "cycle format" (integer number of cycles elapsed since some event).
Definition: CrFwTime.c:53
CrFwTimeStamp_t CrFwStdTimeToTimeStamp(CrFwTime_t stdTime)
Convert a time value from standard time format to time-stamp format.
Definition: CrFwTime.c:58
unsigned int CrFwTimeStamp_t
Type used for the time stamp of a command or report.
float CrFwTime_t
Type used for the application time.
unsigned int CrFwTimeCyc_t
Type used for the number of elapsed cycles.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
unsigned short CrFwCounterU2_t
Type used for unsigned integers with a "medium" range.
#define CR_FW_NBITS_APP_ID
The number of bits reserved for the application identifier in a command or report identifier.
@ crOutCmpSendPcktInvDest
An OutComponent has an invalid destination (see CrFwOutCmp.h)
@ crNoAppErr
No application errors have been detected.
@ crOutStreamUndefDest
A framework function has been called with a destination attribute which is not associated to any OutS...
#define CR_FW_HOST_APP_ID
The identifier of the host application (i.e.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
CrFwAppErrCode_t CrFwGetAppErrCode()
Return the value of the application error code.
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
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Definition: CrFwCmpData.h:101
Type for the data describing an OutComponent.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved