CORDET Framework - C2 Implementation
CrPsLptTestCases.c
Go to the documentation of this file.
1 
20 /* Include FW Profile files */
21 #include "FwSmConstants.h"
22 #include "FwSmConfig.h"
23 #include "FwSmCore.h"
24 #include "FwPrConfig.h"
25 #include "FwPrCore.h"
26 #include "FwPrConstants.h"
27 #include "FwPrDCreate.h"
28 /* Include framework files */
29 #include "CrFwCmpData.h"
31 #include "BaseCmp/CrFwBaseCmp.h"
32 #include "Pckt/CrFwPckt.h"
33 #include "InCmd/CrFwInCmd.h"
36 #include "InLoader/CrFwInLoader.h"
38 #include "InLoader/CrFwInLoader.h"
39 #include "CrFwTime.h"
40 
41 #include "CrFwRepErr.h"
43 #include <CrPsUtilitiesServLpt.h>
45 #include "config/CrFwOutFactoryUserPar.h"
58 #include <DataPool/CrPsDpServLpt.h>
59 #include "CrPsUserConstants.h"
60 #include "CrPsPkt.h" /* for data structures TmHeader_t and TcHeader_t */
61 
62 /* Include system files */
63 #include <stdlib.h>
64 #include <unistd.h>
65 #include <stdint.h>
66 
68 #define LPTSIZE 4000
69 
70 static uint8_t memArray2set[LPTSIZE*2]; /* NOTE: *2 because GCOV needs it wo work properly */
71 static uint8_t memArray2get[LPTSIZE*2];
72 
73 /* ---------------------------------------------------------------------------------------------*/
75 {
76  /* Check Service 13 (all standard functions to return outcome = 1) */
77  FwSmDesc_t inFactory, outFactory, outManager, outCmp, inCmd;
78  CrFwPckt_t pckt;
79  CrFwCmpData_t *cmpData;
80 
81  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
84 
85  /* Instantiate the OutFactory, InFactory and OutManager*/
86  outFactory = CrFwOutFactoryMake();
87  if (outFactory == NULL)
88  return 0;
89  if (FwSmCheckRec(outFactory) != smSuccess)
90  return 0;
91 
92  inFactory = CrFwInFactoryMake();
93  if (inFactory == NULL)
94  return 0;
95  if (FwSmCheckRec(inFactory) != smSuccess)
96  return 0;
97 
98  outManager = CrFwOutManagerMake(0);
99  if (outManager == NULL)
100  return 0;
101  if (FwSmCheckRec(outManager) != smSuccess)
102  return 0;
103 
104  /* Initialize and Configure OutFactory, InFactory and Outmanager and check success */
105  CrFwCmpInit(outFactory);
106  CrFwCmpReset(outFactory);
107  if (!CrFwCmpIsInConfigured(outFactory))
108  return 0;
109 
110  CrFwCmpInit(inFactory);
111  CrFwCmpReset(inFactory);
112  if (!CrFwCmpIsInConfigured(inFactory))
113  return 0;
114 
115  CrFwCmpInit(outManager);
116  CrFwCmpReset(outManager);
117  if (!CrFwCmpIsInConfigured(outManager))
118  return 0;
119 
120  /* Check if number of Allocated Packets = 0*/
121  if (CrFwPcktGetNOfAllocated() != 0)
122  return 0;
123 
124  /* Create a 13,1 OutComponent to get outcome success*/
125  outCmp = CrFwOutFactoryMakeOutCmp(13,1,0,80);
126 
127  /*run the Enable Check and Update Action */
129 
131  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
132  if (cmpData->outcome != 1)
133  {
134  return 0;
135  }
136 
137  /*Release the OutComponent*/
139 
140  /* Create a 13,2 OutComponent to get outcome success*/
141  outCmp = CrFwOutFactoryMakeOutCmp(13,2,0,80);
142 
143  /*run the Enable Check and Update Action */
145 
147 
149  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
150  if (cmpData->outcome != 1)
151  {
152  return 0;
153  }
154 
155  /*Release the OutComponent*/
157 
158  /* Create a 13,3 OutComponent to get outcome success*/
159  outCmp = CrFwOutFactoryMakeOutCmp(13,3,0,80);
160 
161  setDplptRemSizeItem(0, 10);
162 
163  /*run the Enable Check and Update Action */
165 
167  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
168  if (cmpData->outcome != 1)
169  {
170  return 0;
171  }
172 
173  /*Release the OutComponent*/
175 
176  /* Allocate a 13,9 Packet */
177  pckt = CrFwPcktMake(80);
178  CrFwPcktSetServType(pckt,13);
179  CrFwPcktSetServSubType(pckt,9);
181  CrFwPcktSetDiscriminant(pckt,0);
182  CrFwPcktSetSrc(pckt,0);
183  CrFwPcktSetDest(pckt,10);
184  CrFwPcktSetGroup(pckt,1);
185  CrFwPcktSetAckLevel(pckt,0,0,0,0);
186  CrFwPcktSetSeqCnt(pckt,0);
187  setLptUpFirstCmdTid(pckt, 0);
189  setLptUpFirstCmdPart(pckt, 1, 4);
190 
191  inCmd = CrFwInFactoryMakeInCmd(pckt);
192 
193  /* run the start action, the progress action and the termination action */
195  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
196  if (cmpData->outcome != 1)
197  {
198  return 0;
199  }
201  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
202  if (cmpData->outcome != 1)
203  {
204  return 0;
205  }
207  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
208  if (cmpData->outcome != 1)
209  {
210  return 0;
211  }
212 
213  /* Release the inCommand*/
215 
216  /* Allocate a 13,10 Packet */
217  pckt = CrFwPcktMake(80);
218  CrFwPcktSetServType(pckt,13);
219  CrFwPcktSetServSubType(pckt,10);
221  CrFwPcktSetDiscriminant(pckt,0);
222  CrFwPcktSetSrc(pckt,0);
223  CrFwPcktSetDest(pckt,10);
224  CrFwPcktSetGroup(pckt,1);
225  CrFwPcktSetAckLevel(pckt,0,0,0,0);
226  CrFwPcktSetSeqCnt(pckt,0);
227  setLptUpInterCmdTid(pckt, 0);
229  setLptUpInterCmdPart(pckt, 1, 4);
230 
231  inCmd = CrFwInFactoryMakeInCmd(pckt);
232 
233  /* run the start action, the progress action and the termination action */
235  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
236  if (cmpData->outcome != 1)
237  {
238  return 0;
239  }
241  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
242  if (cmpData->outcome != 1)
243  {
244  return 0;
245  }
247  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
248  if (cmpData->outcome != 1)
249  {
250  return 0;
251  }
252 
253  /* Release the inCommand*/
255 
256  /* Allocate a 13,11 Packet */
257  pckt = CrFwPcktMake(80);
258  CrFwPcktSetServType(pckt,13);
259  CrFwPcktSetServSubType(pckt,11);
261  CrFwPcktSetDiscriminant(pckt,0);
262  CrFwPcktSetSrc(pckt,0);
263  CrFwPcktSetDest(pckt,10);
264  CrFwPcktSetGroup(pckt,1);
265  CrFwPcktSetAckLevel(pckt,0,0,0,0);
266  CrFwPcktSetSeqCnt(pckt,0);
267  setLptUpLastCmdTid(pckt, 0);
268  setLptUpLastCmdPartSeqNmb(pckt, 3);
269  setLptUpLastCmdPart(pckt, 1, 4);
270  inCmd = CrFwInFactoryMakeInCmd(pckt);
271 
272  /* run the start action, the progress action and the termination action */
274  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
275  if (cmpData->outcome != 1)
276  {
277  return 0;
278  }
280  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
281  if (cmpData->outcome != 1)
282  {
283  return 0;
284  }
286  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
287  if (cmpData->outcome != 1)
288  {
289  return 0;
290  }
291 
292  /* Release the inCommand*/
294 
295  /* Create a 13,16 OutComponent to get outcome success*/
296  outCmp = CrFwOutFactoryMakeOutCmp(13,16,0,80);
297 
298  /*run the Enable Check and Update Action */
300  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
301  if (cmpData->outcome != 1)
302  {
303  return 0;
304  }
305 
306  /*Release the OutComponent*/
308 
309  /* Allocate a 13,129 Packet */
310  pckt = CrFwPcktMake(80);
311  CrFwPcktSetServType(pckt,13);
312  CrFwPcktSetServSubType(pckt,129);
314  CrFwPcktSetDiscriminant(pckt,0);
315  CrFwPcktSetSrc(pckt,0);
316  CrFwPcktSetDest(pckt,10);
317  CrFwPcktSetGroup(pckt,1);
318  CrFwPcktSetAckLevel(pckt,0,0,0,0);
319  CrFwPcktSetSeqCnt(pckt,0);
320 
321  inCmd = CrFwInFactoryMakeInCmd(pckt);
322 
323  /* run the start action, the progress action and the termination action */
325  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
326  if (cmpData->outcome != 1)
327  {
328  return 0;
329  }
331  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
332  if (cmpData->outcome != 1)
333  {
334  return 0;
335  }
337  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
338  if (cmpData->outcome != 1)
339  {
340  return 0;
341  }
342 
343  /* Release the inCommand*/
345 
346  /* Allocate a 13,130 Packet */
347  pckt = CrFwPcktMake(80);
348  CrFwPcktSetServType(pckt,13);
349  CrFwPcktSetServSubType(pckt,130);
351  CrFwPcktSetDiscriminant(pckt,0);
352  CrFwPcktSetSrc(pckt,0);
353  CrFwPcktSetDest(pckt,10);
354  CrFwPcktSetGroup(pckt,1);
355  CrFwPcktSetAckLevel(pckt,0,0,0,0);
356  CrFwPcktSetSeqCnt(pckt,0);
357 
358  inCmd = CrFwInFactoryMakeInCmd(pckt);
359 
360  /* run the start action, the progress action and the termination action */
362  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
363  if (cmpData->outcome != 1)
364  {
365  return 0;
366  }
368  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
369  if (cmpData->outcome != 1)
370  {
371  return 0;
372  }
374  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
375  if (cmpData->outcome != 1)
376  {
377  return 0;
378  }
379 
380  /* Release the inCommand*/
382 
383  /* Check application errors */
384  if (CrFwGetAppErrCode() != crNoAppErr)
385  return 0;
386 
387  /* Reset OutManager and check that all OutComponents are unloaded and released */
388  CrFwCmpReset(outManager);
389  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
390  return 0;
391 
392  /* Reset the OutFactory */
393  CrFwCmpReset(outFactory);
395  return 0;
396 
397  /* Reset the InFactory and check that no InCommands are allocated */
398  CrFwCmpReset(inFactory);
400  return 0;
401 
402  /* Check application errors */
403  if (CrFwGetAppErrCode() != crNoAppErr)
404  return 0;
405 
406  return 1;
407 }
408 
409 
410 
412 {
413  /* Check Service 13 Up-Transfer */
414  FwSmDesc_t inFactory, outFactory, outManager, inCmd;
415  CrFwPckt_t pckt;
416  CrFwCmpData_t *cmpData;
417  uint8_t* memptr;
418  uint32_t i, partsize, o, LptBuffer;
419  LptBuffer = 0;
420 
421  /* fill the memory Array with random Numbers for the Up-Transfer */
422  for (i=0;i<LPTSIZE;i++)
423  {
424  memArray2set[i] = rand() % 255;
425  }
426 
427  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
428  CrPsInitServLpt();
429 
430  /* Instantiate the OutFactory, InFactory and OutManager*/
431  outFactory = CrFwOutFactoryMake();
432  if (outFactory == NULL)
433  return 0;
434  if (FwSmCheckRec(outFactory) != smSuccess)
435  return 0;
436 
437  inFactory = CrFwInFactoryMake();
438  if (inFactory == NULL)
439  return 0;
440  if (FwSmCheckRec(inFactory) != smSuccess)
441  return 0;
442 
443  outManager = CrFwOutManagerMake(0);
444  if (outManager == NULL)
445  return 0;
446  if (FwSmCheckRec(outManager) != smSuccess)
447  return 0;
448 
449  /* Initialize and Configure OutFactory, InFactory and Outmanager and check success */
450  CrFwCmpInit(outFactory);
451  CrFwCmpReset(outFactory);
452  if (!CrFwCmpIsInConfigured(outFactory))
453  return 0;
454 
455  CrFwCmpInit(inFactory);
456  CrFwCmpReset(inFactory);
457  if (!CrFwCmpIsInConfigured(inFactory))
458  return 0;
459 
460  CrFwCmpInit(outManager);
461  CrFwCmpReset(outManager);
462  if (!CrFwCmpIsInConfigured(outManager))
463  return 0;
464 
465  /* Check if number of Allocated Packets = 0*/
466  if (CrFwPcktGetNOfAllocated() != 0)
467  return 0;
468 
469  /* Allocate a 13,9 Packet */
471  CrFwPcktSetServType(pckt,13);
472  CrFwPcktSetServSubType(pckt,9);
474  CrFwPcktSetDiscriminant(pckt,0);
475  CrFwPcktSetSrc(pckt,0);
476  CrFwPcktSetDest(pckt,10);
477  CrFwPcktSetGroup(pckt,1);
478  CrFwPcktSetAckLevel(pckt,0,0,0,0);
479  CrFwPcktSetSeqCnt(pckt,0);
480 
481  inCmd = CrFwInFactoryMakeInCmd(pckt);
482 
483  /* Set the Packet data content */
484  setLptUpFirstCmdTid(pckt, LptBuffer);
486  memptr = &memArray2set[0];
487  o=(sizeof(TcHeader_t)+sizeof(CrPsTid_t)+sizeof(CrPsNumberU4_t));
488  partsize = CR_FW_MAX_PCKT_LENGTH - o - CRC_LENGTH;
489  memcpy(&((uint8_t*)pckt)[o], memptr, partsize);
490 
491  /* run the start action, the progress action and the termination action */
493  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
494  if (cmpData->outcome != 1)
495  {
496  return 0;
497  }
499  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
500  if (cmpData->outcome != 1)
501  {
502  return 0;
503  }
505  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
506  if (cmpData->outcome != 1)
507  {
508  return 0;
509  }
510 
511  /* Execute the Statemachine */
513 
514  /* Release the inCommand */
516 
517  return 1;
518 
519  /*LOOP !!!! i = 1 to ??*/
520  for (i=1;i<LPTSIZE;i++)
521  {
522  /* Allocate a 13,10 Packet */
524  CrFwPcktSetServType(pckt,13);
525  CrFwPcktSetServSubType(pckt,10);
527  CrFwPcktSetDiscriminant(pckt,0);
528  CrFwPcktSetSrc(pckt,0);
529  CrFwPcktSetDest(pckt,10);
530  CrFwPcktSetGroup(pckt,1);
531  CrFwPcktSetAckLevel(pckt,0,0,0,0);
532  CrFwPcktSetSeqCnt(pckt,0);
533 
534  setLptUpInterCmdTid(pckt, LptBuffer);
535  setLptUpInterCmdPartSeqNmb(pckt, i+1);
536  memptr = &memArray2set[partsize * i];
537  o=(sizeof(TcHeader_t)+sizeof(CrPsTid_t)+sizeof(CrPsNumberU4_t));
538  partsize = CR_FW_MAX_PCKT_LENGTH - o - CRC_LENGTH;
539  memcpy(&((uint8_t*)pckt)[o], memptr, partsize);
540 
541  inCmd = CrFwInFactoryMakeInCmd(pckt);
542 
543  /* run the start action, the progress action and the termination action */
545  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
546  if (cmpData->outcome != 1)
547  {
548  return 0;
549  }
551  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
552  if (cmpData->outcome != 1)
553  {
554  return 0;
555  }
557  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
558  if (cmpData->outcome != 1)
559  {
560  return 0;
561  }
562 
563  /* Execute the Statemachine */
565 
566  /* Release the inCommand */
568  if ((partsize*(i+2)) >= (LPTSIZE))
569  {
570  /*end LOOP !!! when to few data left (break) */
571  break;
572  }
573  }
574 
575  i+=1;
576 
577  /* Allocate a 13,11 Packet */
579  CrFwPcktSetServType(pckt,13);
580  CrFwPcktSetServSubType(pckt,11);
582  CrFwPcktSetDiscriminant(pckt,0);
583  CrFwPcktSetSrc(pckt,0);
584  CrFwPcktSetDest(pckt,10);
585  CrFwPcktSetGroup(pckt,1);
586  CrFwPcktSetAckLevel(pckt,0,0,0,0);
587  CrFwPcktSetSeqCnt(pckt,0);
588 
589  setLptUpLastCmdTid(pckt, LptBuffer);
590  setLptUpLastCmdPartSeqNmb(pckt, i+1);
591 
592  memptr = &memArray2set[partsize * i];
593  o=(sizeof(TcHeader_t)+sizeof(CrPsTid_t)+sizeof(CrPsNumberU4_t));
594  partsize = LPTSIZE - partsize*i;
595  memcpy(&((uint8_t*)pckt)[o], memptr, partsize);
596 
597  inCmd = CrFwInFactoryMakeInCmd(pckt);
598 
599  /* run the start action, the progress action and the termination action */
601  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
602  if (cmpData->outcome != 1)
603  {
604  return 0;
605  }
607  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
608  if (cmpData->outcome != 1)
609  {
610  return 0;
611  }
613  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
614  if (cmpData->outcome != 1)
615  {
616  return 0;
617  }
618 
619  /* Execute the Statemachine */
621 
622  /* Release the inCommand */
624 
625  /* get the Data from the Buffer */
626  memcpy(&memArray2get, (uint8_t*)getLptMemStartAddr(LptBuffer), getLptMemSize(LptBuffer));
627 
628  /* Check if the Data is stored in the Buffer correctly*/
629  if (memcmp(memArray2set, memArray2get, LPTSIZE))
630  {
631  return 0;
632  }
633 
634  /* Check application errors */
635  if (CrFwGetAppErrCode() != crNoAppErr)
636  return 0;
637 
638  /* Reset OutManager and check that all OutComponents are unloaded and released */
639  CrFwCmpReset(outManager);
640  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
641  return 0;
642 
643  /* Reset the OutFactory */
644  CrFwCmpReset(outFactory);
646  return 0;
647 
648  /* Reset the InFactory and check that no InCommands are allocated */
649  CrFwCmpReset(inFactory);
651  return 0;
652 
653  /* Check application errors */
654  if (CrFwGetAppErrCode() != crNoAppErr)
655  return 0;
656 
657  return 1;
658 }
659 
660 
661 
663 {
664  /* Check Service 13 Down-Link*/
665  FwSmDesc_t inFactory, outFactory, outManager, inCmd, outCmp, outCmpArr[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP];
667  CrFwOutManagerData_t* outManagerCSData;
668  CrFwPckt_t pckt;
669  CrFwCmpData_t *cmpData;
671  CrFwOutCmpData_t* cmpSpecificData;
672  uint32_t i, PartSeqNmb, o, partsize, lptRemSize, LptBufferId;
673  LptBufferId = 0;
674 
675  /* empty the memory Array for getting the data from the Buffer (so i have to refill it with the contents of the incomming packets) */
676  for (i=0;i<LPTSIZE;i++)
677  {
678  memArray2get[i] = 0;
679  }
680 
681  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
682  CrPsInitServLpt();
683 
684  /* Instantiate the OutFactory, InFactory and OutManager*/
685  outFactory = CrFwOutFactoryMake();
686  if (outFactory == NULL)
687  return 0;
688  if (FwSmCheckRec(outFactory) != smSuccess)
689  return 0;
690 
691  inFactory = CrFwInFactoryMake();
692  if (inFactory == NULL)
693  return 0;
694  if (FwSmCheckRec(inFactory) != smSuccess)
695  return 0;
696 
697  outManager = CrFwOutManagerMake(0);
698  if (outManager == NULL)
699  return 0;
700  if (FwSmCheckRec(outManager) != smSuccess)
701  return 0;
702 
703  /* Initialize and Configure OutFactory, InFactory and Outmanager and check success */
704  CrFwCmpInit(outFactory);
705  CrFwCmpReset(outFactory);
706  if (!CrFwCmpIsInConfigured(outFactory))
707  return 0;
708 
709  CrFwCmpInit(inFactory);
710  CrFwCmpReset(inFactory);
711  if (!CrFwCmpIsInConfigured(inFactory))
712  return 0;
713 
714  CrFwCmpInit(outManager);
715  CrFwCmpReset(outManager);
716  if (!CrFwCmpIsInConfigured(outManager))
717  return 0;
718 
719  /* Check if number of Allocated Packets = 0*/
720  if (CrFwPcktGetNOfAllocated() != 0)
721  return 0;
722 
723  /* Allocate a 13,129 Packet */
724  pckt = CrFwPcktMake(80);
725  CrFwPcktSetServType(pckt,13);
726  CrFwPcktSetServSubType(pckt,129);
728  CrFwPcktSetDiscriminant(pckt,0);
729  CrFwPcktSetSrc(pckt,0);
730  CrFwPcktSetDest(pckt,10);
731  CrFwPcktSetGroup(pckt,1);
732  CrFwPcktSetAckLevel(pckt,0,0,0,0);
733  CrFwPcktSetSeqCnt(pckt,0);
734  setLptStartDownCmdTid(pckt, LptBufferId);
735 
736  inCmd = CrFwInFactoryMakeInCmd(pckt);
737 
738  /* Fill the outfactory so that an Error could occur (leave one free slot) */
739  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
740  {
741  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
742  }
743 
744  /* Execute the inCmd and the Statemachine */
745  CrFwCmpExecute(inCmd);
747 
748  /* Check if an OutComponent allocation error occures */
750  return 0;
751 
752  /* Reset application error Code */
754 
755  /* Release all outcomponents, that have been created to fill the outfactory */
756  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
757  {
758  CrFwOutFactoryReleaseOutCmp(outCmpArr[i]);
759  }
760 
761  /* Execute the inCmd and the Statemachine again to successfully create an 13,1 */
762  CrFwCmpExecute(inCmd);
764 
765  /* Release the inCommand */
767 
768  /* Get the Data from the out Manager */
769  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
770  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
771  outCmp = outManagerCSData->pocl[0];
772  outCmpData = (CrFwCmpData_t*)FwSmGetData(outCmp);
773  cmpSpecificData = (CrFwOutCmpData_t*)(outCmpData->cmpSpecificData);
774 
775  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
776  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
777  return 0;
778  if (CrFwOutCmpGetServType(outCmp) != 13)
779  return 0;
780  if (CrFwOutCmpGetServSubType(outCmp) != 1)
781  return 0;
782 
783  /* Fill the outfactory so that an error could occur (leave one free slot) */
784  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-2;i++)
785  {
786  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
787  }
788 
789  /* Get the PartSeqNmb and lptRemSize to reset it after the next packet fails*/
790  PartSeqNmb = getDppartSeqNmbItem(LptBufferId);
791  lptRemSize = getDplptRemSizeItem(LptBufferId);
792 
793  /* Execute the outCmp and the Statemachine */
794  CrFwCmpExecute(outCmp);
796 
797  /* Correct the PartSeqNmb and the lptRemSize - subtract the values of the failed packet*/
798  setDppartSeqNmbItem(LptBufferId, PartSeqNmb);
799  setDplptRemSizeItem(LptBufferId, lptRemSize);
800 
801  /*Check if an OutComponent allocation error occures*/
803  return 0;
804 
805  /*Reset application error Corde*/
807 
808  /* Release all outcomponents, that have been created to fill the outfactory */
809  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-2;i++)
810  {
811  CrFwOutFactoryReleaseOutCmp(outCmpArr[i]);
812  }
813 
814  /* Execute the OutComponent and the Statemachine */
815  CrFwCmpExecute(outCmp);
816 
818 
819  /* get the data from the outCmp (1st Packet)*/
820  o=(sizeof(TmHeader_t)+sizeof(CrPsTid_t)+sizeof(CrPsNumberU4_t));
821  partsize = CrFwPcktGetLength(cmpSpecificData->pckt) - o - CRC_LENGTH;
822  memcpy(&memArray2get[0], &((uint8_t*)cmpSpecificData->pckt)[o], partsize);
823 
824  /* Get the Data from the out Manager */
825  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
826  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
827  outCmp = outManagerCSData->pocl[1];
828  outCmpData = (CrFwCmpData_t*)FwSmGetData(outCmp);
829  cmpSpecificData = (CrFwOutCmpData_t*)(outCmpData->cmpSpecificData);
830 
831  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
832  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
833  return 0;
834  if (CrFwOutCmpGetServType(outCmp) != 13)
835  return 0;
836  if (CrFwOutCmpGetServSubType(outCmp) != 2)
837  return 0;
838 
839  /* Execute the OutComponent and the Statemachine */
840  CrFwCmpExecute(outCmp);
841  if (CrPsLptDownInterRepRepeatCheck(outCmp) != 1)
842  return 0;
844 
845  /* get the data from the outCmp (2nd Packet)*/
846  memcpy(&memArray2get[partsize], &((uint8_t*)cmpSpecificData->pckt)[o], partsize);
847 
848  /* Execute the OutComponent and the Statemachine */
849  CrFwCmpExecute(outCmp);
850  if (CrPsLptDownInterRepRepeatCheck(outCmp) != 1)
851  return 0;
853 
854  /* get the data from the outCmp (3rd Packet)*/
855  memcpy(&memArray2get[partsize*2], &((uint8_t*)cmpSpecificData->pckt)[o], partsize);
856 
857  CrFwCmpExecute(outCmp);
858  if (CrPsLptDownInterRepRepeatCheck(outCmp) != 0)
859  return 0;
861 
862  /* get the data from the outCmp (4th Packet)*/
863  memcpy(&memArray2get[partsize*3], &((uint8_t*)cmpSpecificData->pckt)[o], partsize);
864 
865  /* Get the Data from the out Manager */
866  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
867  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
868  outCmp = outManagerCSData->pocl[2];
869  outCmpData = (CrFwCmpData_t*)FwSmGetData(outCmp);
870  cmpSpecificData = (CrFwOutCmpData_t*)(outCmpData->cmpSpecificData);
871 
872  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
873  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
874  return 0;
875  if (CrFwOutCmpGetServType(outCmp) != 13)
876  return 0;
877  if (CrFwOutCmpGetServSubType(outCmp) != 3)
878  return 0;
879 
880  CrFwCmpExecute(outCmp);
881 
882  /* get the data from the outCmp (last Packet)*/
883  memcpy(&memArray2get[partsize*4], &((uint8_t*)cmpSpecificData->pckt)[o], (CrFwPcktGetLength(cmpSpecificData->pckt) - o - CRC_LENGTH));
884 
885  /* Test the memory */
886  /* Check if the Data is stored in the Buffer correctly*/
887  if (memcmp(memArray2set, memArray2get, LPTSIZE))
888  {
889  return 0;
890  }
891 
892  /* Allocate a 13,130 Packet */
893  pckt = CrFwPcktMake(80);
894  CrFwPcktSetServType(pckt,13);
895  CrFwPcktSetServSubType(pckt,130);
897  CrFwPcktSetDiscriminant(pckt,0);
898  CrFwPcktSetSrc(pckt,0);
899  CrFwPcktSetDest(pckt,10);
900  CrFwPcktSetGroup(pckt,1);
901  CrFwPcktSetAckLevel(pckt,0,0,0,0);
902  CrFwPcktSetSeqCnt(pckt,0);
903  /* set TID = 0 TODO*/
904 
905  inCmd = CrFwInFactoryMakeInCmd(pckt);
906 
907  /* run the start action, the progress action and the termination action */
909  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
910  if (cmpData->outcome != 1)
911  {
912  return 0;
913  }
915  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
916  if (cmpData->outcome != 1)
917  {
918  return 0;
919  }
921  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
922  if (cmpData->outcome != 1)
923  {
924  return 0;
925  }
926 
927  /* Release the inCommand*/
929 
930  /* Allocate a 13,129 Packet */
931  pckt = CrFwPcktMake(80);
932  CrFwPcktSetServType(pckt,13);
933  CrFwPcktSetServSubType(pckt,129);
935  CrFwPcktSetDiscriminant(pckt,0);
936  CrFwPcktSetSrc(pckt,0);
937  CrFwPcktSetDest(pckt,10);
938  CrFwPcktSetGroup(pckt,1);
939  CrFwPcktSetAckLevel(pckt,0,0,0,0);
940  CrFwPcktSetSeqCnt(pckt,0);
941  setLptStartDownCmdTid(pckt, LptBufferId);
942 
943  inCmd = CrFwInFactoryMakeInCmd(pckt);
944 
945  CrFwCmpExecute(inCmd);
947 
948  /* Release the inCommand*/
950 
951  /* Get the Data from the out Manager (there is only one Component) */
952  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
953  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
954  outCmp = outManagerCSData->pocl[0];
955 
956  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
957  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
958  return 0;
959  if (CrFwOutCmpGetServType(outCmp) != 13)
960  return 0;
961  if (CrFwOutCmpGetServSubType(outCmp) != 1)
962  return 0;
963 
964  /* Execute the inCmd */
965  CrFwCmpExecute(outCmp);
967 
968  /* Get the Data from the out Manager (there is only one Component) */
969  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
970  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
971  outCmp = outManagerCSData->pocl[1];
972 
973  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
974  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
975  return 0;
976  if (CrFwOutCmpGetServType(outCmp) != 13)
977  return 0;
978  if (CrFwOutCmpGetServSubType(outCmp) != 2)
979  return 0;
980 
981  /* Execute the OutComponent and the Statemachine */
982  CrFwCmpExecute(outCmp);
984 
985  /* Execute the OutComponent and the Åštatemachine */
986  CrFwCmpExecute(outCmp);
988 
989  /* Fill the outfactory so that an Error could occur (leave one free slot) */
990  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-6;i++)
991  {
992  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
993  }
994 
995  /* Execute the outCmp and the Statemachine */
996  CrFwCmpExecute(outCmp);
998 
999  /* Check if an OutComponent allocation error occures */
1001  return 0;
1002 
1003  /* Reset application error Corde */
1005 
1006  /* Release all outcomponents, that have been created to fill the outfactory */
1007  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-6;i++)
1008  {
1009  CrFwOutFactoryReleaseOutCmp(outCmpArr[i]);
1010  }
1011 
1012  /* Check application errors */
1013  if (CrFwGetAppErrCode() != crNoAppErr)
1014  return 0;
1015 
1016  /* Reset OutManager and check that all OutComponents are unloaded and released */
1017  CrFwCmpReset(outManager);
1018  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1019  return 0;
1020 
1021  /* Reset the OutFactory */
1022  CrFwCmpReset(outFactory);
1024  return 0;
1025 
1026  /* Reset the InFactory and check that no InCommands are allocated */
1027  CrFwCmpReset(inFactory);
1029  return 0;
1030 
1031  /* Check application errors */
1032  if (CrFwGetAppErrCode() != crNoAppErr)
1033  return 0;
1034 
1035  return 1;
1036 }
1037 
1039 {
1040  /* Check Service 13 Down-Link*/
1041  FwSmDesc_t inFactory, outFactory, outManager, outCmp, outCmpArr[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP], inCmd;
1043  CrFwOutManagerData_t* outManagerCSData;
1044  CrFwPckt_t pckt;
1045  uint32_t i;
1046  CrFwTimeStamp_t tim;
1047  uint32_t LptBufferId;
1048  LptBufferId = 0;
1049  tim.t[0]=255u;
1050  tim.t[1]=255u;
1051  tim.t[2]=255u;
1052  tim.t[3]=255u;
1053  tim.t[4]=255u;
1054  tim.t[5]=255u;
1055 
1056  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
1057  CrPsInitServLpt();
1058 
1059  /* Instantiate the OutFactory, InFactory and OutManager*/
1060  outFactory = CrFwOutFactoryMake();
1061  if (outFactory == NULL)
1062  return 0;
1063  if (FwSmCheckRec(outFactory) != smSuccess)
1064  return 0;
1065 
1066  inFactory = CrFwInFactoryMake();
1067  if (inFactory == NULL)
1068  return 0;
1069  if (FwSmCheckRec(inFactory) != smSuccess)
1070  return 0;
1071 
1072  outManager = CrFwOutManagerMake(0);
1073  if (outManager == NULL)
1074  return 0;
1075  if (FwSmCheckRec(outManager) != smSuccess)
1076  return 0;
1077 
1078  /* Initialize and Configure OutFactory, InFactory and Outmanager and check success */
1079  CrFwCmpInit(outFactory);
1080  CrFwCmpReset(outFactory);
1081  if (!CrFwCmpIsInConfigured(outFactory))
1082  return 0;
1083 
1084  CrFwCmpInit(inFactory);
1085  CrFwCmpReset(inFactory);
1086  if (!CrFwCmpIsInConfigured(inFactory))
1087  return 0;
1088 
1089  CrFwCmpInit(outManager);
1090  CrFwCmpReset(outManager);
1091  if (!CrFwCmpIsInConfigured(outManager))
1092  return 0;
1093 
1094  /* Check if number of Allocated Packets = 0*/
1095  if (CrFwPcktGetNOfAllocated() != 0)
1096  return 0;
1097 
1098  setDplptRemSizeItem(LptBufferId,0);
1099  if (CrPsLptIsTransferFinished(0) != 1)
1100  return 0;
1101  setDplptRemSizeItem(LptBufferId,2);
1102  if (CrPsLptIsTransferFinished(0) != 0)
1103  return 0;
1104  setDplptFailCodeItem(LptBufferId,1);
1105  if (CrPsLptIsFailed(0) != 1)
1106  return 0;
1107  setDplptFailCodeItem(LptBufferId,LPT_FAILCODE_NO_FAIL);
1108  if (CrPsLptIsFailed(0) != 0)
1109  return 0;
1110 
1111  setDplptTimeItem(LptBufferId, tim);
1113  if (getDplptFailCodeItem(LptBufferId) != LPT_FAILCODE_TIME_OUT)
1114  return 0;
1115 
1116  /* Allocate a 13,10 Packet */
1117  pckt = CrFwPcktMake(80);
1118  CrFwPcktSetServType(pckt,13);
1119  CrFwPcktSetServSubType(pckt,10);
1121  CrFwPcktSetDiscriminant(pckt,0);
1122  CrFwPcktSetSrc(pckt,0);
1123  CrFwPcktSetDest(pckt,10);
1124  CrFwPcktSetGroup(pckt,1);
1125  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1126  CrFwPcktSetSeqCnt(pckt,0);
1127  setLptUpInterCmdTid(pckt, 0);
1128  setLptUpInterCmdPartSeqNmb(pckt, 9);
1129  setLptUpInterCmdPart(pckt, 1, 4);
1130 
1131  inCmd = CrFwInFactoryMakeInCmd(pckt);
1132 
1133  CrFwCmpExecute(inCmd);
1134 
1135  /* Release the inCommand*/
1137 
1138  /*look if there is an 13,16 waiting*/
1139  /* Get the Data from the out Manager (there is only one Component) */
1140  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1141  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1142  outCmp = outManagerCSData->pocl[0];
1143 
1144  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
1145  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1146  return 0;
1147  if (CrFwOutCmpGetServType(outCmp) != 1)
1148  return 0;
1149  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1150  return 0;
1151 
1152  /* Allocate a 13,9 Packet */
1153  pckt = CrFwPcktMake(80);
1154  CrFwPcktSetServType(pckt,13);
1155  CrFwPcktSetServSubType(pckt,9);
1157  CrFwPcktSetDiscriminant(pckt,0);
1158  CrFwPcktSetSrc(pckt,0);
1159  CrFwPcktSetDest(pckt,10);
1160  CrFwPcktSetGroup(pckt,1);
1161  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1162  CrFwPcktSetSeqCnt(pckt,0);
1163  setLptUpFirstCmdTid(pckt, 0);
1164  setLptUpFirstCmdPartSeqNmb(pckt, 1);
1165  setLptUpFirstCmdPart(pckt, 1, 4);
1166 
1167  inCmd = CrFwInFactoryMakeInCmd(pckt);
1168 
1169  CrFwCmpExecute(inCmd);
1170 
1171  /* Release the inCommand*/
1173 
1174 /* Allocate a 13,129 Packet */
1175  pckt = CrFwPcktMake(80);
1176  CrFwPcktSetServType(pckt,13);
1177  CrFwPcktSetServSubType(pckt,129);
1179  CrFwPcktSetDiscriminant(pckt,0);
1180  CrFwPcktSetSrc(pckt,0);
1181  CrFwPcktSetDest(pckt,10);
1182  CrFwPcktSetGroup(pckt,1);
1183  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1184  CrFwPcktSetSeqCnt(pckt,0);
1185 
1186  inCmd = CrFwInFactoryMakeInCmd(pckt);
1187 
1188  CrFwCmpExecute(inCmd);
1189 
1190  /* Release the inCommand*/
1192 
1193  /*look if there is an 13,16 waiting*/
1194  /* Get the Data from the out Manager (there is only one Component) */
1195  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1196  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1197  outCmp = outManagerCSData->pocl[1];
1198 
1199  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
1200  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1201  return 0;
1202  if (CrFwOutCmpGetServType(outCmp) != 1)
1203  return 0;
1204  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1205  return 0;
1206 
1207  /* Allocate a 13,10 Packet */
1208  pckt = CrFwPcktMake(80);
1209  CrFwPcktSetServType(pckt,13);
1210  CrFwPcktSetServSubType(pckt,10);
1212  CrFwPcktSetDiscriminant(pckt,0);
1213  CrFwPcktSetSrc(pckt,0);
1214  CrFwPcktSetDest(pckt,10);
1215  CrFwPcktSetGroup(pckt,1);
1216  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1217  CrFwPcktSetSeqCnt(pckt,0);
1218  setLptUpInterCmdTid(pckt, 0);
1219  setLptUpInterCmdPartSeqNmb(pckt, 19);
1220  setLptUpInterCmdPart(pckt, 1, 4);
1221 
1222  inCmd = CrFwInFactoryMakeInCmd(pckt);
1223 
1224  CrFwCmpExecute(inCmd);
1225 
1226  /* Release the inCommand*/
1228 
1229  /*look if there is an 13,16 waiting*/
1230  /* Get the Data from the out Manager (there is only one Component) */
1231  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1232  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1233  outCmp = outManagerCSData->pocl[2];
1234 
1235  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
1236  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1237  return 0;
1238  if (CrFwOutCmpGetServType(outCmp) != 1)
1239  return 0;
1240  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1241  return 0;
1242 
1243  /* Allocate a 13,130 Packet */
1244  pckt = CrFwPcktMake(80);
1245  CrFwPcktSetServType(pckt,13);
1246  CrFwPcktSetServSubType(pckt,130);
1248  CrFwPcktSetDiscriminant(pckt,0);
1249  CrFwPcktSetSrc(pckt,0);
1250  CrFwPcktSetDest(pckt,10);
1251  CrFwPcktSetGroup(pckt,1);
1252  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1253  CrFwPcktSetSeqCnt(pckt,0);
1254 
1255  inCmd = CrFwInFactoryMakeInCmd(pckt);
1256 
1257  CrFwCmpExecute(inCmd);
1258 
1259  /* Release the inCommand*/
1261 
1262  /*look if there is an 13,16 waiting*/
1263  /* Get the Data from the out Manager (there is only one Component) */
1264  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1265  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1266  outCmp = outManagerCSData->pocl[3];
1267 
1268  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
1269  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1270  return 0;
1271  if (CrFwOutCmpGetServType(outCmp) != 1)
1272  return 0;
1273  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1274  return 0;
1275 
1276  /* Execute the CrPsLptLoadReport Function */
1277  CrPsLptLoadReport(0);
1278 
1279  /*look if there is an 13,16 waiting*/
1280  /* Get the Data from the out Manager (there is only one Component) */
1281  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1282  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1283  outCmp = outManagerCSData->pocl[4];
1284 
1285  /* Check if there is a 13,1 Command waitig in the OutManager (loaded) */
1286  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1287  return 0;
1288  if (CrFwOutCmpGetServType(outCmp) != 13)
1289  return 0;
1290  if (CrFwOutCmpGetServSubType(outCmp) != 16)
1291  return 0;
1292 
1293  /* Fill the outfactory so that an Error could occur (leave one free slot) */
1294  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-4;i++)
1295  {
1296  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
1297  }
1298 
1299  /* Execute the CrPsLptLoadReport Function */
1300  CrPsLptLoadReport(0);
1301 
1302  /* Check if an OutComponent allocation error occures */
1304  return 0;
1305 
1306  /* Reset application error Corde */
1308 
1309  CRFW_UNUSED(outCmpArr);
1310 
1311  /* Check application errors */
1312  if (CrFwGetAppErrCode() != crNoAppErr)
1313  return 0;
1314 
1315  /* Reset OutManager and check that all OutComponents are unloaded and released */
1316  CrFwCmpReset(outManager);
1317  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1318  return 0;
1319 
1320  /* Reset the OutFactory */
1321  CrFwCmpReset(outFactory);
1323  return 0;
1324 
1325  /* Reset the InFactory and check that no InCommands are allocated */
1326  CrFwCmpReset(inFactory);
1328  return 0;
1329 
1330  /* Check application errors */
1331  if (CrFwGetAppErrCode() != crNoAppErr)
1332  return 0;
1333 
1334  /* Create a 13,1 OutComponent to get outcome success*/
1335  outCmp = CrFwOutFactoryMakeOutCmp(13,1,0,80);
1336 
1337  /*run the Enable Check and Update Action */
1340 
1341  /*Release the OutComponent*/
1343 
1344  /* Create a 13,3 OutComponent to get outcome success*/
1345  outCmp = CrFwOutFactoryMakeOutCmp(13,3,0,80);
1346 
1347  setDplptRemSizeItem(0, 10);
1348 
1349  /*run the Enable Check and Update Action */
1351 
1352  /*Release the OutComponent*/
1354 
1355  /* Reset OutManager and check that all OutComponents are unloaded and released */
1356  CrFwCmpReset(outManager);
1357  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1358  return 0;
1359 
1360  /* Reset the OutFactory */
1361  CrFwCmpReset(outFactory);
1363  return 0;
1364 
1365  /* Reset the InFactory and check that no InCommands are allocated */
1366  CrFwCmpReset(inFactory);
1368  return 0;
1369 
1370  /* Check application errors */
1371  if (CrFwGetAppErrCode() != crNoAppErr)
1372  return 0;
1373 
1374  return 1;
1375 }
1376 
1377 
1378 
1379 
1380 
Implementation of TM(13,2) LptDownInterRep.
void CrPsLptDownFirstRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,1) LptDownFirstRep.
Type for the Framework Component Data (FCD).
Interface through which framework components access the current time.
void CrPsLptStartDownCmdStartAction(FwSmDesc_t smDesc)
Start action of TC(13,129) LptStartDownCmd.
CrFwBool_t CrPsLptDownInterRepRepeatCheck(FwSmDesc_t smDesc)
Repeat check of TM(13,2) LptDownInterRep.
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
Definition of the InLoader component.
CrFwCounterU4_t i
CrPsCmd5EidStart function definitions.
#define CR_FW_OUTCMP_TYPE
Type identifier for the OutComponent components.
Implementation of TC(13,130) LptAbortDownCmd.
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
Implementation of TC(13,9) LptUpFirstCmd.
FwSmBool_t CrPsLptIsTransferFinished(FwSmDesc_t smDesc)
Guard on the transition from DOWN_TRANSFER to INACTIVE.
Definition: CrPsLptFunc.c:238
Implementation of TM(13,1) LptDownFirstRep.
#define CR_FW_MAX_PCKT_LENGTH
The maximum size in number of bytes of a packet.
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
#define LPTSIZE
The maximum size in number of bytes of a packet.
Create one instance of the CrPsLptUpCmdStart procedure.
static FwSmDesc_t outCmp[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The pre-allocated OutComponent instances.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
static CrPsSize_t getDplptRemSizeItem(int i)
Gets the value of the i-th element in the datapool array lptRemSize.
#define CRC_LENGTH
The length of CRC.
static void setDplptFailCodeItem(int i, CrPsFailCode_t lptFailCode)
Sets the value of the i-th element in the datapool array lptFailCode.
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
Header file to define all user-configurable constants and types for the IASW Application.
Interface for accessing data pool items.
static void setLptUpFirstCmdPartSeqNmb(void *p, CrPsNumberU4_t PartSeqNmb)
Set "PartSeqNmb" in "LptUpFirstCmd" packet.
static FwSmDesc_t inFactory
The singleton instance of the InFactory.
void CrFwPcktSetSrc(CrFwPckt_t pckt, CrFwDestSrc_t src)
Set the source of the command or report encapsulated in a packet.
#define CR_FW_OUTFACTORY_MAX_NOF_OUTCMP
The maximum number of OutComponents which may be allocated at any one time.
void CrPsLptUpLastCmdStartAction(FwSmDesc_t smDesc)
Start action of TC(13,11) LptUpLastCmd.
Definition of the OutFactory component.
Type for the data describing an OutComponent.
uint32_t getLptMemSize(uint32_t LptBuffer)
Getter function to return the size of the Data.
An OutComponent allocation request has failed (see CrFwOutFactoryMakeOutCmp).
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
static void setDplptTimeItem(int i, CrFwTimeStamp_t lptTime)
Sets the value of the i-th element in the datapool array lptTime.
static CrFwCmpData_t outManagerData[CR_FW_NOF_OUTMANAGER]
The data structures for the OutManager State Machines and their Procedures.
FwSmDesc_t CrFwOutManagerMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th OutManager State Machine instance.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
void CrPsLptUpLastCmdTerminationAction(FwSmDesc_t smDesc)
Termination action of TC(13,11) LptUpLastCmd.
Interface through which applications can initialize and execute framework PUS extension components...
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
CrFwServType_t CrFwOutCmpGetServType(FwSmDesc_t smDesc)
Return the type of the OutComponent.
Definition: CrFwOutCmp.c:230
FwSmBool_t CrPsLptIsFailed(FwSmDesc_t smDesc)
Guard on the transition from UP_TRANSFER to INACTIVE.
Definition: CrPsLptFunc.c:281
void CrPsLptUpAbortRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,16) LptUpAbortRep.
Definition of the OutRegistry Component.
void CrFwPcktSetCmdRepType(CrFwPckt_t pckt, CrFwCmdRepType_t type)
Set the type of a packet (either a command packet or a report packet).
void CrPsLptStartDownCmdProgressAction(FwSmDesc_t smDesc)
Progress action of TC(13,129) LptStartDownCmd.
void CrPsLptAbortDownCmdTerminationAction(FwSmDesc_t smDesc)
Termination action of TC(13,130) LptAbortDownCmd.
Create one instance of the CrPsLpt state machine.
CrFwBool_t CrPsLptTestCase3()
Test the Service 13 EventReporting Service Down-Transfer.
static CrPsFailCode_t getDplptFailCodeItem(int i)
Gets the value of the i-th element in the datapool array lptFailCode.
void CrFwPcktSetSeqCnt(CrFwPckt_t pckt, CrFwSeqCnt_t seqCnt)
Set the sequence counter of the command or report encapsulated in a packet.
static void setDplptRemSizeItem(int i, CrPsSize_t lptRemSize)
Sets the value of the i-th element in the datapool array lptRemSize.
void CrPsLptUpInterCmdTerminationAction(FwSmDesc_t smDesc)
Termination action of TC(13,10) LptUpInterCmd.
Command type.
Definition: CrFwConstants.h:41
static void setLptUpLastCmdTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptUpLastCmd" packet.
static FwSmDesc_t outFactory
The singleton instance of the OutFactory.
Interface for reporting an error detected by a framework component.
CrFwPcktLength_t CrFwPcktGetLength(CrFwPckt_t pckt)
Return the length (in number of bytes) of a packet.
void CrPsLptUpLastCmdProgressAction(FwSmDesc_t smDesc)
Progress action of TC(13,11) LptUpLastCmd.
void CrPsLptUpTransferDoAction(FwSmDesc_t smDesc)
Do Action for the state UP_TRANSFER.
Definition: CrPsLptFunc.c:179
CrFwBool_t CrPsLptDownInterRepEnableCheck(FwSmDesc_t smDesc)
Enable check of TM(13,2) LptDownInterRep.
Implementation of TC(13,129) LptStartDownCmd.
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
void setLptUpLastCmdPart(void *p, CrPsPart_t Part, uint32_t o)
Set "Part" in "LptUpLastCmd" packet.
CrFwServType_t CrFwOutCmpGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the OutComponent.
Definition: CrFwOutCmp.c:244
void CrPsExecServLpt()
Execution of CORDET Framework PUS Extension components.
void CrPsLptAbortDownCmdStartAction(FwSmDesc_t smDesc)
Start action of TC(13,130) LptAbortDownCmd.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrFwPcktSetAckLevel(CrFwPckt_t pckt, CrFwBool_t accept, CrFwBool_t start, CrFwBool_t progress, CrFwBool_t term)
Set the acknowledge level for the command encapsulated in a packet.
Definition of the InFactory component.
Interface for accessing fields in packets of service "ServLPT".
Definition of the utility functions for the CORDET Framework.
Implementation of TM(13,3) LptDownLastRep.
void CrFwPcktSetServSubType(CrFwPckt_t pckt, CrFwServSubType_t servSubType)
Set the service sub-type of the command or report encapsulated in a packet.
void CrPsLptUpInterCmdProgressAction(FwSmDesc_t smDesc)
Progress action of TC(13,10) LptUpInterCmd.
Packet header definitions.
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
FwSmDesc_t * pocl
Pending OutComponent List (POCL) for the OutManager.
static void setLptUpFirstCmdTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptUpFirstCmd" packet.
CrFwBool_t CrPsLptDownLastRepEnableCheck(FwSmDesc_t smDesc)
Enable check of TM(13,3) LptDownLastRep.
void CrPsExecServLptSm()
Execution of CORDET Framework PUS Extension components.
void CrPsLptLoadReport(FwSmDesc_t smDesc)
Action on the transition from UP_TRANSFER to INACTIVE.
Definition: CrPsLptFunc.c:257
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
uint32_t * getLptMemStartAddr(uint32_t LptBuffer)
Getter function for the Address of the Data.
void CrPsLptDownInterRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,2) LptDownInterRep.
void CrFwCmpExecute(FwSmDesc_t smDesc)
Execute a framework component.
Definition: CrFwBaseCmp.c:127
void CrPsLptUpFirstCmdTerminationAction(FwSmDesc_t smDesc)
Termination action of TC(13,9) LptUpFirstCmd.
CrFwOutFactoryPoolIndex_t CrFwOutFactoryGetNOfAllocatedOutCmp()
Return the number of OutComponents which are currently allocated.
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
Definition of Base Component.
static void setLptStartDownCmdTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptStartDownCmd" packet.
FwSmDesc_t CrFwInFactoryMake()
Factory function for the singleton instance of the InFactory.
void CrPsLptStartDownCmdTerminationAction(FwSmDesc_t smDesc)
Termination action of TC(13,129) LptStartDownCmd.
Implementation of TC(13,11) LptUpLastCmd.
void CrFwOutFactoryReleaseOutCmp(FwSmDesc_t outCmpInstance)
Release function for an OutComponent.
void CrPsLptUpFirstCmdProgressAction(FwSmDesc_t smDesc)
Progress action of TC(13,9) LptUpFirstCmd.
void CrFwInFactoryReleaseInCmd(FwSmDesc_t inCmdInstance)
Release function for an InCommand.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
void setLptUpInterCmdPart(void *p, CrPsPart_t Part, uint32_t o)
Set "Part" in "LptUpInterCmd" packet.
CrFwBool_t CrPsLptTestCase2()
Test the Service 13 EventReporting Service Up-Transfer.
static void setLptUpInterCmdTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptUpInterCmd" packet.
static CrFwCounterU4_t getDppartSeqNmbItem(int i)
Gets the value of the i-th element in the datapool array partSeqNmb.
FwSmDesc_t CrFwOutFactoryMake()
Factory function for the singleton instance of the OutFactory.
static CrFwCmpData_t outCmpData[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The data for the pre-allocated OutComponent instances.
auxiliary Interface for accessing fields in packets of service "ServLPT".
CrFwBool_t CrPsLptDownFirstRepEnableCheck(FwSmDesc_t smDesc)
Enable check of TM(13,1) LptDownFirstRep.
void CrPsLptUpInterCmdStartAction(FwSmDesc_t smDesc)
Start action of TC(13,10) LptUpInterCmd.
Implementation of TC(13,10) LptUpInterCmd.
Interface through which applications can initialize and execute framework PUS extension components...
void setLptUpFirstCmdPart(void *p, CrPsPart_t Part, uint32_t o)
Set "Part" in "LptUpFirstCmd" packet.
int CrPsInitServLpt()
Initialization of CORDET Framework PUS Extension components.
void CrPsLptDownLastRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,3) LptDownLastRep.
static void setDppartSeqNmbItem(int i, CrFwCounterU4_t partSeqNmb)
Sets the value of the i-th element in the datapool array partSeqNmb.
static void setLptUpInterCmdPartSeqNmb(void *p, CrPsNumberU4_t PartSeqNmb)
Set "PartSeqNmb" in "LptUpInterCmd" packet.
CrFwCounterU1_t CrFwOutManagerGetNOfPendingOutCmp(FwSmDesc_t smDesc)
Return the number of OutComponents currently in the POCL of an OutManager.
CrFwInFactoryPoolIndex_t CrFwInFactoryGetNOfAllocatedInCmd()
Return the number of InCommands which are currently allocated.
No application errors have been detected.
static FwSmDesc_t inCmd[CR_FW_INFACTORY_MAX_NOF_INCMD]
The pre-allocated InCommand instances.
Definition: CrFwInFactory.c:58
void CrPsLptUpFirstCmdStartAction(FwSmDesc_t smDesc)
Start action of TC(13,9) LptUpFirstCmd.
Definition of the OutLoader component.
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
CrFwBool_t CrPsLptTestCase1()
Check Service 13 (all standard functions to return outcome = 1)
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.
void CrPsLptAbortDownCmdProgressAction(FwSmDesc_t smDesc)
Progress action of TC(13,130) LptAbortDownCmd.
Definition of the InCommand Component of the framework.
unsigned int CrFwTimeStamp_t
Type used for the time stamp of a command or report.
Type for the data describing an OutManager.
CrFwBool_t CrPsLptTestCase4()
Test the Service 13 EventReporting Service other stuff.
static void setLptUpLastCmdPartSeqNmb(void *p, CrPsNumberU4_t PartSeqNmb)
Set "PartSeqNmb" in "LptUpLastCmd" packet.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved