CORDET Framework - C2 Implementation
CrPsHkTestCases.c
1 
21 /* Include FW Profile files */
22 #include "FwSmConstants.h"
23 #include "FwSmConfig.h"
24 #include "FwSmCore.h"
25 #include "FwPrConfig.h"
26 #include "FwPrCore.h"
27 #include "FwPrConstants.h"
28 #include "FwPrDCreate.h"
29 /* Include framework files */
30 #include "CrFwCmpData.h"
32 #include "BaseCmp/CrFwBaseCmp.h"
33 #include "Pckt/CrFwPckt.h"
34 #include "InCmd/CrFwInCmd.h"
37 #include "InLoader/CrFwInLoader.h"
39 #include "InLoader/CrFwInLoader.h"
40 #include "CrFwTime.h"
41 
42 #include "CrFwRepErr.h"
44 #include <CrPsUtilitiesServHk.h>
46 #include "config/CrFwOutFactoryUserPar.h"
53 
54 #include <DataPool/CrPsDp.h>
55 #include <DataPool/CrPsDpServHk.h>
56 
59 
60 /* Include system files */
61 #include <stdlib.h>
62 #include <unistd.h>
63 #include <stdint.h>
64 
65 #define datapool8bit_ID 54 /* there is non yet (DpIdOnBoardConnectDest .. CrPsDestSrc_t)*/
66 #define datapool16bit_ID 53 /* DpIdAreYouAliveSrc .. CrPsDestSrc_t */
67 #define datapool32bit_ID 6 /* DpIdAreYouAliveTimeOut .. CrPsTimeOut_t */
68 #define datapool8bitarray_ID 3 /* DpIdisEnabled .. CrPsFlag_t Array */
69 #define datapool16bitarray_ID 7 /* DpIdOnBoardConnectDestLst .. CrPsDestSrc_t Array */
70 #define datapool32bitarray_ID 29 /* DpIdcycleCnt .. CrFwCounterU4_t Array */
71 
72 #define datapool32bit_IDa 41 /* DpIdnOfAccFailed .. CrFwCounterU4_t */
73 #define datapool32bit_IDb 42 /* DpIdnOfPrgrFailed .. CrFwCounterU4_t */
74 #define datapool32bit_IDc 43 /* DpIdnOfReroutingFailed .. CrFwCounterU4_t */
75 #define datapool32bit_IDd 44 /* DpIdnOfStartFailed .. CrFwCounterU4_t */
76 #define datapool32bit_IDe 45 /* DpIdnOfTermFailed .. CrFwCounterU4_t */
77 
78 
79 /* ---------------------------------------------------------------------------------------------*/
80 CrFwBool_t CrPsHkTestCase1() /*for the Create command*/
81 {
82  /* Check Service 3 */
83  FwSmDesc_t inFactory, outFactory, outManager, inCmd, outCmp, outCmpArr[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP];
84  CrFwPckt_t pckt;
85  CrFwCmpData_t *cmpData;
87  CrFwOutManagerData_t* outManagerCSData;
88  uint32_t i;
89 
90  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
94 
95  /* manually delete all sid's in the Datapool*/
96  for (i = 0; i < HK_N_REP_DEF; i++)
97  {
98  setDpsidItem(i, 0);
99  }
100 
101  /* Instantiate the OutFactory, InFactory and OutManager*/
102  outFactory = CrFwOutFactoryMake();
103  if (outFactory == NULL)
104  return 0;
105  if (FwSmCheckRec(outFactory) != smSuccess)
106  return 0;
107 
108  inFactory = CrFwInFactoryMake();
109  if (inFactory == NULL)
110  return 0;
111  if (FwSmCheckRec(inFactory) != smSuccess)
112  return 0;
113 
114  outManager = CrFwOutManagerMake(0);
115  if (outManager == NULL)
116  return 0;
117  if (FwSmCheckRec(outManager) != smSuccess)
118  return 0;
119 
120  /* Initialize and Configure OutFactory, InFactory and Outmanager and check success */
121  CrFwCmpInit(outFactory);
122  CrFwCmpReset(outFactory);
123  if (!CrFwCmpIsInConfigured(outFactory))
124  return 0;
125 
126  CrFwCmpInit(inFactory);
127  CrFwCmpReset(inFactory);
128  if (!CrFwCmpIsInConfigured(inFactory))
129  return 0;
130 
131  CrFwCmpInit(outManager);
132  CrFwCmpReset(outManager);
133  if (!CrFwCmpIsInConfigured(outManager))
134  return 0;
135 
136  /* Check if number of Allocated Packets = 0*/
137  if (CrFwPcktGetNOfAllocated() != 0)
138  return 0;
139 
140  /* Allocate a 3,1 Packet to get outcome success*/
141  pckt = CrFwPcktMake(80);
142  CrFwPcktSetServType(pckt,3);
143  CrFwPcktSetServSubType(pckt,1);
145  CrFwPcktSetDiscriminant(pckt,3);
146  CrFwPcktSetSrc(pckt,0);
147  CrFwPcktSetDest(pckt,10);
148  CrFwPcktSetGroup(pckt,1);
149  CrFwPcktSetAckLevel(pckt,0,0,0,0);
150  CrFwPcktSetSeqCnt(pckt,0);
151 
153  setHkCreateCmdN1(pckt, 1);
154  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
155  setHkCreateCmdNFA(pckt, 2);
157  setHkCreateCmdN2(pckt, 1, 3);
158  setHkCreateCmdN2ParamIdItem(pckt, 1, 1, datapool32bit_IDa);
159  setHkCreateCmdN2ParamIdItem(pckt, 1, 2, datapool32bit_IDb);
160  setHkCreateCmdN2ParamIdItem(pckt, 1, 3, datapool32bit_IDc);
161 
163  setHkCreateCmdN2(pckt, 2, 3);
164  setHkCreateCmdN2ParamIdItem(pckt, 2, 1, datapool32bit_ID);
165  setHkCreateCmdN2ParamIdItem(pckt, 2, 2, datapool8bitarray_ID);
166  setHkCreateCmdN2ParamIdItem(pckt, 2, 3, datapool32bitarray_ID);
167 
168  /* Check if number of Allocated Packets now is 1*/
169  if (CrFwPcktGetNOfAllocated() != 1)
170  return 0;
171 
172  /* Check if number of Allocated InCommands = 0*/
174  return 0;
175 
176  /*Creating an InCommand out of the 3,1 packet*/
177  inCmd = CrFwInFactoryMakeInCmd(pckt);
178 
179  /*Check if number of Allocated InCommands is now 1*/
181  return 0;
182 
183  /* Check the type identifier */
185  return 0;
186 
187  /* Check type and sub-type of the InCommand*/
188  if (CrFwInCmdGetServType(inCmd) != 3)
189  return 0;
190  if (CrFwInCmdGetServSubType(inCmd) != 1)
191  return 0;
192 
193  /*check that the InCommand is in ACCEPTED state*/
194  if (!CrFwInCmdIsInAccepted(inCmd))
195  return 0;
196 
197  /* Call the Start Action of the 3,1 command and check the outcome = success */
199  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
200  if (cmpData->outcome != 1)
201  {
202  return 0;
203  }
204 
205  /* Get the Data from the out Manager (there is only one Component) */
206  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
207  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
208  outCmp = outManagerCSData->pocl[0];
209 
210  /* Check if there is a 3,25 Command waitig in the OutManager (loaded) */
211  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
212  return 0;
213  if (CrFwOutCmpGetServType(outCmp) != 3)
214  return 0;
215  if (CrFwOutCmpGetServSubType(outCmp) != 25)
216  return 0;
217  if (CrFwOutCmpGetDiscriminant(outCmp) != 3)
218  return 0;
219 
220  /*Release the OutComponent and reset the outmanager*/
222  CrFwCmpReset(outManager);
223  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
224  return 0;
225 
226  /*Check if an OutComponent Release Error occures*/
228  return 0;
229 
230  /*Reset application error Corde*/
232 
233  /* Call the Progress Action of the 3,1 command and check the outcome = success */
235  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
236  if (cmpData->outcome !=1)
237  {
238  return 0;
239  }
240 
241  /* Call the Termination Action of the 3,1 command and check the outcome = success */
243  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
244  if (cmpData->outcome !=1)
245  {
246  return 0;
247  }
248 
249  /*Check if SID is now in the Datapool */
250  if (getDpsidItem(0) != 3)
251  return 0;
252 
253  /* Release the inCommand*/
255 
256  /*Check if number of Allocated InCommands is now 0*/
258  return 0;
259 
260  /* Check that there are no allocated packets */
261  if (CrFwPcktGetNOfAllocated() != 0)
262  return 0;
263 
264  /* Check application errors */
265  if (CrFwGetAppErrCode() != crNoAppErr)
266  return 0;
267 
268  /* Allocate a 3,1 Packet with a wrong sid (0) to get outcome VER_RDL_CONSTR */
269  pckt = CrFwPcktMake(80);
270  CrFwPcktSetServType(pckt,3);
271  CrFwPcktSetServSubType(pckt,1);
273  CrFwPcktSetDiscriminant(pckt,0);
274  CrFwPcktSetSrc(pckt,0);
275  CrFwPcktSetDest(pckt,10);
276  CrFwPcktSetGroup(pckt,1);
277  CrFwPcktSetAckLevel(pckt,0,0,0,0);
278  CrFwPcktSetSeqCnt(pckt,0);
279 
281  setHkCreateCmdN1(pckt, 1);
282  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
283  setHkCreateCmdNFA(pckt, 2);
285  setHkCreateCmdN2(pckt, 1, 3);
286  setHkCreateCmdN2ParamIdItem(pckt, 1, 1, datapool32bit_IDa);
287  setHkCreateCmdN2ParamIdItem(pckt, 1, 2, datapool32bit_IDb);
288  setHkCreateCmdN2ParamIdItem(pckt, 1, 3, datapool32bit_IDc);
289 
291  setHkCreateCmdN2(pckt, 2, 3);
292  setHkCreateCmdN2ParamIdItem(pckt, 2, 1, datapool32bit_ID);
293  setHkCreateCmdN2ParamIdItem(pckt, 2, 2, datapool8bitarray_ID);
294  setHkCreateCmdN2ParamIdItem(pckt, 2, 3, datapool32bitarray_ID);
295 
296  /* Check if number of Allocated Packets now is 1*/
297  if (CrFwPcktGetNOfAllocated() != 1)
298  return 0;
299 
300  /* Check if number of Allocated InCommands = 0*/
302  return 0;
303 
304  /*Creating an InCommand out of the 3,1 packet*/
305  inCmd = CrFwInFactoryMakeInCmd(pckt);
306 
307  /*Check if number of Allocated InCommands is now 1*/
309  return 0;
310 
311  /* Check the type identifier */
313  return 0;
314 
315  /* Check type and sub-type of the InCommand*/
316  if (CrFwInCmdGetServType(inCmd) != 3)
317  return 0;
318  if (CrFwInCmdGetServSubType(inCmd) != 1)
319  return 0;
320 
321  /*check that the InCommand is in ACCEPTED state*/
322  if (!CrFwInCmdIsInAccepted(inCmd))
323  return 0;
324 
325  /* Call the Start Action of the 3,1 command and check the outcome = VER_RDL_CONSTR because of the wrong SID*/
327  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
328  if (cmpData->outcome != VER_RDL_CONSTR)
329  {
330  return 0;
331  }
332 
333  /* Release the inCommand*/
335 
336  /*Check if number of Allocated InCommands is now 0*/
338  return 0;
339 
340  /* Check that there are no allocated packets */
341  if (CrFwPcktGetNOfAllocated() != 0)
342  return 0;
343 
344  /* Check application errors */
345  if (CrFwGetAppErrCode() != crNoAppErr)
346  return 0;
347 
348  /*manually delete the sid*/
349  setDpsidItem(0, 0);
350 
351  /* Allocate a 3,2 Packet to get outcome success*/
352  pckt = CrFwPcktMake(80);
353  CrFwPcktSetServType(pckt,3);
354  CrFwPcktSetServSubType(pckt,2);
356  CrFwPcktSetDiscriminant(pckt,3);
357  CrFwPcktSetSrc(pckt,0);
358  CrFwPcktSetDest(pckt,10);
359  CrFwPcktSetGroup(pckt,1);
360  CrFwPcktSetAckLevel(pckt,0,0,0,0);
361  CrFwPcktSetSeqCnt(pckt,0);
362 
364  setHkCreateCmdN1(pckt, 1);
365  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
366  setHkCreateCmdNFA(pckt, 2);
368  setHkCreateCmdN2(pckt, 1, 3);
369  setHkCreateCmdN2ParamIdItem(pckt, 1, 1, datapool32bit_IDa);
370  setHkCreateCmdN2ParamIdItem(pckt, 1, 2, datapool32bit_IDb);
371  setHkCreateCmdN2ParamIdItem(pckt, 1, 3, datapool32bit_IDc);
372 
374  setHkCreateCmdN2(pckt, 2, 3);
375  setHkCreateCmdN2ParamIdItem(pckt, 2, 1, datapool32bit_ID);
376  setHkCreateCmdN2ParamIdItem(pckt, 2, 2, datapool8bitarray_ID);
377  setHkCreateCmdN2ParamIdItem(pckt, 2, 3, datapool32bitarray_ID);
378 
379  /* Check if number of Allocated Packets now is 1*/
380  if (CrFwPcktGetNOfAllocated() != 1)
381  return 0;
382 
383  /* Check if number of Allocated InCommands = 0*/
385  return 0;
386 
387  /*Creating an InCommand out of the 3,2 packet*/
388  inCmd = CrFwInFactoryMakeInCmd(pckt);
389 
390  /*Check if number of Allocated InCommands is now 1*/
392  return 0;
393 
394  /* Check the type identifier */
396  return 0;
397 
398  /* Check type and sub-type of the InCommand*/
399  if (CrFwInCmdGetServType(inCmd) != 3)
400  return 0;
401  if (CrFwInCmdGetServSubType(inCmd) != 2)
402  return 0;
403 
404  /*check that the InCommand is in ACCEPTED state*/
405  if (!CrFwInCmdIsInAccepted(inCmd))
406  return 0;
407 
408  /* Call the Start Action of the 3.2 command and check the outcome = success */
410  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
411  if (cmpData->outcome != 1)
412  {
413  return 0;
414  }
415 
416  /* Get the Data from the out Manager (there is only one Component) */
417  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
418  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
419  outCmp = outManagerCSData->pocl[0];
420 
421  /* Check if there is a 3,25 Command waitig in the OutManager (loaded) */
422  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
423  return 0;
424  if (CrFwOutCmpGetServType(outCmp) != 3)
425  return 0;
426  if (CrFwOutCmpGetServSubType(outCmp) != 26)
427  return 0;
428  if (CrFwOutCmpGetDiscriminant(outCmp) != 3)
429  return 0;
430 
431  /*Release the OutComponent and reset the outmanager*/
433  CrFwCmpReset(outManager);
434  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
435  return 0;
436 
437  /*Check if an OutComponent Release Error occures*/
439  return 0;
440 
441  /*Reset application error Corde*/
443 
444  /* Call the Progress Action of the 3,2 command and check the outcome = success */
446  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
447  if (cmpData->outcome != 1)
448  {
449  return 0;
450  }
451 
452  /* Call the Termination Action of the 3,2 command and check the outcome = success */
454  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
455  if (cmpData->outcome != 1)
456  {
457  return 0;
458  }
459 
460  /*Check if SID is now in the Datapool */
461  if (getDpsidItem(0) != 3)
462  return 0;
463 
464  /* Release the inCommand*/
466 
467  /*Check if number of Allocated InCommands is now 0*/
469  return 0;
470 
471  /* Check that there are no allocated packets */
472  if (CrFwPcktGetNOfAllocated() != 0)
473  return 0;
474 
475  /* Check application errors */
476  if (CrFwGetAppErrCode() != crNoAppErr)
477  return 0;
478 
479  /* Allocate the a 3,1 Packet to trigger an Error! (SID in USE)*/
480  pckt = CrFwPcktMake(80);
481  CrFwPcktSetServType(pckt,3);
482  CrFwPcktSetServSubType(pckt,1);
484  CrFwPcktSetDiscriminant(pckt,3);
485  CrFwPcktSetSrc(pckt,0);
486  CrFwPcktSetDest(pckt,10);
487  CrFwPcktSetGroup(pckt,1);
488  CrFwPcktSetAckLevel(pckt,0,0,0,0);
489  CrFwPcktSetSeqCnt(pckt,0);
490 
492  setHkCreateCmdN1(pckt, 1);
493  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
494  setHkCreateCmdNFA(pckt, 0);
495 
496  /* Check if number of Allocated Packets now is 1*/
497  if (CrFwPcktGetNOfAllocated() != 1)
498  return 0;
499 
500  /* Check if number of Allocated InCommands = 0*/
502  return 0;
503 
504  /*Creating an InCommand out of the 3,1 packet*/
505  inCmd = CrFwInFactoryMakeInCmd(pckt);
506 
507  /*Check if number of Allocated InCommands is now 1*/
509  return 0;
510 
511  /* Check the type identifier */
513  return 0;
514 
515  /* Check type and sub-type of the InCommand*/
516  if (CrFwInCmdGetServType(inCmd) != 3)
517  return 0;
518  if (CrFwInCmdGetServSubType(inCmd) != 1)
519  return 0;
520 
521  /*check that the InCommand is in ACCEPTED state*/
522  if (!CrFwInCmdIsInAccepted(inCmd))
523  return 0;
524 
525  /* Call the Start Action of the 3,1 command and check the outcome = VER_SID_IN_USE, because this sid is already in the database */
527  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
528  if (cmpData->outcome != VER_SID_IN_USE) /* SID in USE*/
529  {
530  return 0;
531  }
532 
533  /* Release the inCommand*/
535 
536  /* Check that there are no allocated packets */
537  if (CrFwPcktGetNOfAllocated() != 0)
538  return 0;
539 
540  /* Check application errors */
541  if (CrFwGetAppErrCode() != crNoAppErr)
542  return 0;
543 
544  /* manually set all sid's in the Datapool*/
545  for (i = 0; i < HK_N_REP_DEF; i++)
546  {
547  setDpsidItem(i, i+1);
548  }
549 
550  /* Allocate the same 3,1 Packet to trigger an Error! (Full RDL) no slot available*/
551  pckt = CrFwPcktMake(80);
552  CrFwPcktSetServType(pckt,3);
553  CrFwPcktSetServSubType(pckt,1);
555  CrFwPcktSetDiscriminant(pckt,3);
556  CrFwPcktSetSrc(pckt,0);
557  CrFwPcktSetDest(pckt,10);
558  CrFwPcktSetGroup(pckt,1);
559  CrFwPcktSetAckLevel(pckt,0,0,0,0);
560  CrFwPcktSetSeqCnt(pckt,0);
561 
563  setHkCreateCmdN1(pckt, 1);
564  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
565  setHkCreateCmdNFA(pckt, 0);
566 
567  /* Check if number of Allocated Packets now is 1*/
568  if (CrFwPcktGetNOfAllocated() != 1)
569  return 0;
570 
571  /* Check if number of Allocated InCommands = 0*/
573  return 0;
574 
575  /*Creating an InCommand out of the 3,1 packet*/
576  inCmd = CrFwInFactoryMakeInCmd(pckt);
577 
578  /*Check if number of Allocated InCommands is now 1*/
580  return 0;
581 
582  /* Check the type identifier */
584  return 0;
585 
586  /* Check type and sub-type of the InCommand*/
587  if (CrFwInCmdGetServType(inCmd) != 3)
588  return 0;
589  if (CrFwInCmdGetServSubType(inCmd) != 1)
590  return 0;
591 
592  /*check that the InCommand is in ACCEPTED state*/
593  if (!CrFwInCmdIsInAccepted(inCmd))
594  return 0;
595 
596  /* Call the Start Action of the 3,1 command and check the outcome = VER_FULL_RDL because now all SIDS where set in the DataPool */
598 
599  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
600  if (cmpData->outcome != VER_FULL_RDL)
601  {
602  return 0;
603  }
604 
605  /* Release the inCommand*/
607 
608  /* Check that there are no allocated packets */
609  if (CrFwPcktGetNOfAllocated() != 0)
610  return 0;
611 
612  /* Check application errors */
613  if (CrFwGetAppErrCode() != crNoAppErr)
614  return 0;
615 
616  /* manually set all sid's in the Datapool to 0 */
617  for (i = 0; i < HK_N_REP_DEF; i++)
618  {
619  setDpsidItem(i, 0);
620  }
621 
622  /* Allocate a 3,1 Packet to trigger an Error! (Error in the Construction) min. one constraint from table 9.1 is not satisfied*/
623  pckt = CrFwPcktMake(80);
624  CrFwPcktSetServType(pckt,3);
625  CrFwPcktSetServSubType(pckt,1);
627  CrFwPcktSetDiscriminant(pckt,3);
628  CrFwPcktSetSrc(pckt,0);
629  CrFwPcktSetDest(pckt,10);
630  CrFwPcktSetGroup(pckt,1);
631  CrFwPcktSetAckLevel(pckt,0,0,0,0);
632  CrFwPcktSetSeqCnt(pckt,0);
633 
635  setHkCreateCmdN1(pckt, HK_N_REP_DEF+2);
636  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
637  setHkCreateCmdNFA(pckt, 0);
638 
639  /* Check if number of Allocated Packets now is 1*/
640  if (CrFwPcktGetNOfAllocated() != 1)
641  return 0;
642 
643  /* Check if number of Allocated InCommands = 0*/
645  return 0;
646 
647  /*Creating an InCommand out of the 3,1 packet*/
648  inCmd = CrFwInFactoryMakeInCmd(pckt);
649 
650  /*Check if number of Allocated InCommands is now 1*/
652  return 0;
653 
654  /* Check the type identifier */
656  return 0;
657 
658  /* Check type and sub-type of the InCommand*/
659  if (CrFwInCmdGetServType(inCmd) != 3)
660  return 0;
661  if (CrFwInCmdGetServSubType(inCmd) != 1)
662  return 0;
663 
664  /*check that the InCommand is in ACCEPTED state*/
665  if (!CrFwInCmdIsInAccepted(inCmd))
666  return 0;
667 
668  /* Call the Start Action of the 3,1 command and check the outcome = VER_RDL_CONSTR Error in the Construction of the RDL */
670  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
671  if (cmpData->outcome != VER_RDL_CONSTR)
672  {
673  return 0;
674  }
675 
676  /* Release the inCommand*/
678 
679  /* Check that there are no allocated packets */
680  if (CrFwPcktGetNOfAllocated() != 0)
681  return 0;
682 
683  /* Check application errors */
684  if (CrFwGetAppErrCode() != crNoAppErr)
685  return 0;
686 
687  /* Allocate a 3,1 Packet to trigger an Error! The same data item identifier appears twice*/
688  pckt = CrFwPcktMake(80);
689  CrFwPcktSetServType(pckt,3);
690  CrFwPcktSetServSubType(pckt,1);
692  CrFwPcktSetDiscriminant(pckt,3);
693  CrFwPcktSetSrc(pckt,0);
694  CrFwPcktSetDest(pckt,10);
695  CrFwPcktSetGroup(pckt,1);
696  CrFwPcktSetAckLevel(pckt,0,0,0,0);
697  CrFwPcktSetSeqCnt(pckt,0);
698 
700  setHkCreateCmdN1(pckt, 2);
701  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
702  setHkCreateCmdN1ParamIdItem(pckt, 2, datapool16bit_ID);
703  setHkCreateCmdNFA(pckt, 0);
704 
705  /* Check if number of Allocated Packets now is 1*/
706  if (CrFwPcktGetNOfAllocated() != 1)
707  return 0;
708 
709  /* Check if number of Allocated InCommands = 0*/
711  return 0;
712 
713  /*Creating an InCommand out of the 3,1 packet*/
714  inCmd = CrFwInFactoryMakeInCmd(pckt);
715 
716  /*Check if number of Allocated InCommands is now 1*/
718  return 0;
719 
720  /* Check the type identifier */
722  return 0;
723 
724  /* Check type and sub-type of the InCommand*/
725  if (CrFwInCmdGetServType(inCmd) != 3)
726  return 0;
727  if (CrFwInCmdGetServSubType(inCmd) != 1)
728  return 0;
729 
730  /*check that the InCommand is in ACCEPTED state*/
731  if (!CrFwInCmdIsInAccepted(inCmd))
732  return 0;
733 
734  /* Call the Start Action of the 3,1 command and check the outcome = VER_DUPL_DI because the parameter id exists 2 times in the packet */
736  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
737  if (cmpData->outcome != VER_DUPL_DI)
738  {
739  return 0;
740  }
741 
742  /* Release the inCommand*/
744 
745  /* Check that there are no allocated packets */
746  if (CrFwPcktGetNOfAllocated() != 0)
747  return 0;
748 
749  /* Check application errors */
750  if (CrFwGetAppErrCode() != crNoAppErr)
751  return 0;
752 
753  /* manually set all sid's in the Datapool to 0*/
754  for (i = 0; i < HK_N_REP_DEF; i++)
755  {
756  setDpsidItem(i, 0);
757  }
758 
759  /* Allocate a 3,1 Packet to trigger an Error! (OutFactory full)*/
760  pckt = CrFwPcktMake(80);
761  CrFwPcktSetServType(pckt,3);
762  CrFwPcktSetServSubType(pckt,1);
764  CrFwPcktSetDiscriminant(pckt,3);
765  CrFwPcktSetSrc(pckt,0);
766  CrFwPcktSetDest(pckt,10);
767  CrFwPcktSetGroup(pckt,1);
768  CrFwPcktSetAckLevel(pckt,0,0,0,0);
769  CrFwPcktSetSeqCnt(pckt,0);
770 
772  setHkCreateCmdN1(pckt, 1);
773  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
774  setHkCreateCmdNFA(pckt, 0);
775 
776  /* Check if number of Allocated Packets now is 1*/
777  if (CrFwPcktGetNOfAllocated() != 1)
778  return 0;
779 
780  /* Check if number of Allocated InCommands = 0*/
782  return 0;
783 
784  /*Creating an InCommand out of the 3,1 packet*/
785  inCmd = CrFwInFactoryMakeInCmd(pckt);
786 
787  /*Check if number of Allocated InCommands is now 1*/
789  return 0;
790 
791  /* Check the type identifier */
793  return 0;
794 
795  /* Check type and sub-type of the InCommand*/
796  if (CrFwInCmdGetServType(inCmd) != 3)
797  return 0;
798  if (CrFwInCmdGetServSubType(inCmd) != 1)
799  return 0;
800 
801  /*check that the InCommand is in ACCEPTED state*/
802  if (!CrFwInCmdIsInAccepted(inCmd))
803  return 0;
804 
805  /* Fill the outfactory so that an Error could occur (leave one free slot) */
806  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
807  {
808  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
809  }
810 
811  /* Call the Start Action of the 3,1 command and check the outcome = VER_REP_CR_FD the Outfactory cannot create on more component */
813  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
814  if (cmpData->outcome != VER_REP_CR_FD)
815  {
816  return 0;
817  }
818 
819  /* Release all outcomponents, that have been created to fill the outfactory */
820  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
821  {
822  CrFwOutFactoryReleaseOutCmp(outCmpArr[i]);
823  }
824 
825  /* Release the inCommand*/
827 
828  /* Check that there are no allocated packets */
829  if (CrFwPcktGetNOfAllocated() != 0)
830  return 0;
831 
832  /* Check application errors */
834  return 0;
835 
836  /*Reset application error Corde*/
838 
839  /* Allocate a 3,1 Packet to trigger an Error! VER_OUTLOADER_FD .. but this is not implemented now*/
840  pckt = CrFwPcktMake(80);
841  CrFwPcktSetServType(pckt,3);
842  CrFwPcktSetServSubType(pckt,1);
844  CrFwPcktSetDiscriminant(pckt,3);
845  CrFwPcktSetSrc(pckt,0);
846  CrFwPcktSetDest(pckt,10);
847  CrFwPcktSetGroup(pckt,1);
848  CrFwPcktSetAckLevel(pckt,0,0,0,0);
849  CrFwPcktSetSeqCnt(pckt,0);
850 
852  setHkCreateCmdN1(pckt, 2);
853  setHkCreateCmdN1ParamIdItem(pckt, 1, datapool16bit_ID);
854  setHkCreateCmdN1ParamIdItem(pckt, 2, datapool16bit_ID);
855  setHkCreateCmdNFA(pckt, 0);
856 
857  /* Check if number of Allocated Packets now is 1*/
858  if (CrFwPcktGetNOfAllocated() != 1)
859  return 0;
860 
861  /* Check if number of Allocated InCommands = 0*/
863  return 0;
864 
865  /*Creating an InCommand out of the 3,1 packet*/
866  inCmd = CrFwInFactoryMakeInCmd(pckt);
867 
868  /*Check if number of Allocated InCommands is now 1*/
870  return 0;
871 
872  /* Check the type identifier */
874  return 0;
875 
876  /* Check type and sub-type of the InCommand*/
877  if (CrFwInCmdGetServType(inCmd) != 3)
878  return 0;
879  if (CrFwInCmdGetServSubType(inCmd) != 1)
880  return 0;
881 
882  /*check that the InCommand is in ACCEPTED state*/
883  if (!CrFwInCmdIsInAccepted(inCmd))
884  return 0;
885 
886  /* TODO: triger else guard of G6 to get Error: VER_OUTLOADER_FD */
888 
889  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
890  if (cmpData->outcome != VER_DUPL_DI) /*TODO: VER_OUTLOADER_FD */
891  {
892  return 0;
893  }
894 
895  /* Release the inCommand*/
897 
898  /* Check that there are no allocated packets */
899  if (CrFwPcktGetNOfAllocated() != 0)
900  return 0;
901 
902  /* Check application errors */
903  if (CrFwGetAppErrCode() != crNoAppErr)
904  return 0;
905 
906  return 1;
907 }
908 
909 /*--------------------------------------------------------------------------------*/
910 CrFwBool_t CrPsHkTestCase2() /*for the Delete, Enable and Disable commands*/
911 {
912  /* Check Service 3*/
913  FwSmDesc_t inFactory, outFactory, outManager, inCmd, outCmp;
914  CrFwPckt_t pckt;
915  CrFwCmpData_t *cmpData;
917  CrFwOutManagerData_t* outManagerCSData;
918  uint32_t i;
919 
920  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
922  CrPsInitServHk();
923 
924  /* manually delete all sid's in the Datapool*/ /*TODO remove after the init function does this*/
925  for (i = 0; i < HK_N_REP_DEF; i++)
926  {
927  setDpsidItem(i, 0);
928  }
929 
930  /* Instantiate the OutFactory, InFactory and OutManager*/
931  outFactory = CrFwOutFactoryMake();
932  if (outFactory == NULL)
933  return 0;
934  if (FwSmCheckRec(outFactory) != smSuccess)
935  return 0;
936 
937  inFactory = CrFwInFactoryMake();
938  if (inFactory == NULL)
939  return 0;
940  if (FwSmCheckRec(inFactory) != smSuccess)
941  return 0;
942 
943  outManager = CrFwOutManagerMake(0);
944  if (outManager == NULL)
945  return 0;
946  if (FwSmCheckRec(outManager) != smSuccess)
947  return 0;
948 
949  /* Initialize and Configure OutFactory, InFactory and OutManager and check success */
950  CrFwCmpInit(outFactory);
951  CrFwCmpReset(outFactory);
952  if (!CrFwCmpIsInConfigured(outFactory))
953  return 0;
954 
955  CrFwCmpInit(inFactory);
956  CrFwCmpReset(inFactory);
957  if (!CrFwCmpIsInConfigured(inFactory))
958  return 0;
959 
960  CrFwCmpInit(outManager);
961  CrFwCmpReset(outManager);
962  if (!CrFwCmpIsInConfigured(outManager))
963  return 0;
964 
965  /* Check if number of Allocated Packets = 0*/
966  if (CrFwPcktGetNOfAllocated() != 0)
967  return 0;
968 
969  /* manually set a sid in the Datapool and check if it is reset by the 3,3 command*/
970  setDpsidItem(0, 3);
971  setDpisEnabledItem(0,0);
972 
973  /* Allocate a 3,3 Packet to get outcome success*/
974  pckt = CrFwPcktMake(80);
975  CrFwPcktSetServType(pckt,3);
976  CrFwPcktSetServSubType(pckt,3);
978  CrFwPcktSetDiscriminant(pckt,3);
979  CrFwPcktSetSrc(pckt,0);
980  CrFwPcktSetDest(pckt,10);
981  CrFwPcktSetGroup(pckt,1);
982  CrFwPcktSetAckLevel(pckt,0,0,0,0);
983  CrFwPcktSetSeqCnt(pckt,0);
984 
985  setHkDeleteCmdN(pckt, 2);
986  setHkDeleteCmdRepStrucIdItem(pckt, 1, 1);
987  setHkDeleteCmdRepStrucIdItem(pckt, 1, 3);
988 
989  /* Check if number of Allocated Packets now is 1*/
990  if (CrFwPcktGetNOfAllocated() != 1)
991  return 0;
992 
993  /* Check if number of Allocated InCommands = 0*/
995  return 0;
996 
997  /*Creating an InCommand out of the 3,3 packet*/
998  inCmd = CrFwInFactoryMakeInCmd(pckt);
999 
1000  /*Check if number of Allocated InCommands is now 1*/
1002  return 0;
1003 
1004  /* Check the type identifier */
1005  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1006  return 0;
1007 
1008  /* Check type and sub-type of the InCommand*/
1009  if (CrFwInCmdGetServType(inCmd) != 3)
1010  return 0;
1011  if (CrFwInCmdGetServSubType(inCmd) != 3)
1012  return 0;
1013 
1014  /*check that the InCommand is in ACCEPTED state*/
1015  if (!CrFwInCmdIsInAccepted(inCmd))
1016  return 0;
1017 
1018  /* Call the Start, progress and termination Action of the 3,3 command and check the outcome = success */
1020  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1021  if (cmpData->outcome != 1)
1022  {
1023  return 0;
1024  }
1025 
1027  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1028  if (cmpData->outcome != 1)
1029  {
1030  return 0;
1031  }
1032 
1034  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1035  if (cmpData->outcome != 1)
1036  {
1037  return 0;
1038  }
1039 
1040  /*Check if SID is now gone in the Datapool */
1041  if (getDpsidItem(0) != 0)
1042  return 0;
1043 
1044  /* Release the inCommand*/
1046 
1047  /*Check if number of Allocated InCommands is now 0*/
1049  return 0;
1050 
1051  /* Check that there are no allocated packets */
1052  if (CrFwPcktGetNOfAllocated() != 0)
1053  return 0;
1054 
1055  /* Check application errors */
1056  if (CrFwGetAppErrCode() != crNoAppErr)
1057  return 0;
1058 
1059  /* manually set a sid in the Datapool and check if it is reset by the 3,4 command*/
1060  setDpsidItem(0, 3);
1061 
1062  /* Allocate a 3,4 Packet to get outcome success*/
1063  pckt = CrFwPcktMake(80);
1064  CrFwPcktSetServType(pckt,3);
1065  CrFwPcktSetServSubType(pckt,4);
1067  CrFwPcktSetDiscriminant(pckt,3);
1068  CrFwPcktSetSrc(pckt,0);
1069  CrFwPcktSetDest(pckt,10);
1070  CrFwPcktSetGroup(pckt,1);
1071  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1072  CrFwPcktSetSeqCnt(pckt,0);
1073 
1074  setHkDeleteCmdN(pckt, 2);
1075  setHkDeleteCmdRepStrucIdItem(pckt, 1, 1);
1076  setHkDeleteCmdRepStrucIdItem(pckt, 1, 3);
1077 
1078  /* Check if number of Allocated Packets now is 1*/
1079  if (CrFwPcktGetNOfAllocated() != 1)
1080  return 0;
1081 
1082  /* Check if number of Allocated InCommands = 0*/
1084  return 0;
1085 
1086  /*Creating an InCommand out of the 3,4 packet*/
1087  inCmd = CrFwInFactoryMakeInCmd(pckt);
1088 
1089  /*Check if number of Allocated InCommands is now 1*/
1091  return 0;
1092 
1093  /* Check the type identifier */
1094  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1095  return 0;
1096 
1097  /* Check type and sub-type of the InCommand*/
1098  if (CrFwInCmdGetServType(inCmd) != 3)
1099  return 0;
1100  if (CrFwInCmdGetServSubType(inCmd) != 4)
1101  return 0;
1102 
1103  /*check that the InCommand is in ACCEPTED state*/
1104  if (!CrFwInCmdIsInAccepted(inCmd))
1105  return 0;
1106 
1107  /* Call the Start, progress and termination Action of the 3,4 command and check the outcome = success */
1109  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1110  if (cmpData->outcome != 1)
1111  {
1112  return 0;
1113  }
1114 
1116  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1117  if (cmpData->outcome != 1)
1118  {
1119  return 0;
1120  }
1121 
1123  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1124  if (cmpData->outcome != 1)
1125  {
1126  return 0;
1127  }
1128 
1129  /*Check if SID is now gone in the Datapool */
1130  if (getDpsidItem(0) != 0)
1131  return 0;
1132 
1133  /* Release the inCommand*/
1135 
1136  /*Check if number of Allocated InCommands is now 0*/
1138  return 0;
1139 
1140  /* Check that there are no allocated packets */
1141  if (CrFwPcktGetNOfAllocated() != 0)
1142  return 0;
1143 
1144  /* Check application errors */
1145  if (CrFwGetAppErrCode() != crNoAppErr)
1146  return 0;
1147 
1148  /* Allocate a 3,3 Packet to get Error All SID's are invalid and a 1,4 is created! */
1149  pckt = CrFwPcktMake(80);
1150  CrFwPcktSetServType(pckt,3);
1151  CrFwPcktSetServSubType(pckt,3);
1153  CrFwPcktSetDiscriminant(pckt,3);
1154  CrFwPcktSetSrc(pckt,0);
1155  CrFwPcktSetDest(pckt,10);
1156  CrFwPcktSetGroup(pckt,1);
1157  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1158  CrFwPcktSetSeqCnt(pckt,0);
1159 
1160  setHkDeleteCmdN(pckt, 1);
1161  setHkDeleteCmdRepStrucIdItem(pckt, 1, 3);
1162 
1163  /* Check if number of Allocated Packets now is 1*/
1164  if (CrFwPcktGetNOfAllocated() != 1)
1165  return 0;
1166 
1167  /* Check if number of Allocated InCommands = 0*/
1169  return 0;
1170 
1171  /*Creating an InCommand out of the 3,3 packet*/
1172  inCmd = CrFwInFactoryMakeInCmd(pckt);
1173 
1174  /*Check if number of Allocated InCommands is now 1*/
1176  return 0;
1177 
1178  /* Check the type identifier */
1179  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1180  return 0;
1181 
1182  /* Check type and sub-type of the InCommand*/
1183  if (CrFwInCmdGetServType(inCmd) != 3)
1184  return 0;
1185  if (CrFwInCmdGetServSubType(inCmd) != 3)
1186  return 0;
1187 
1188  /*check that the InCommand is in ACCEPTED state*/
1189  if (!CrFwInCmdIsInAccepted(inCmd))
1190  return 0;
1191 
1192  /* Call the Start Action of the 3,3 command and check the outcome = VER_S3S_START_FD -> all Sids are invalid */
1194 
1195  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1196  if (cmpData->outcome != VER_S3S_START_FD)
1197  {
1198  return 0;
1199  }
1200 
1201  /* Release the inCommand*/
1203 
1204  /*Check if number of Allocated InCommands is now 0*/
1206  return 0;
1207 
1208  /* Get the Data from the out Manager (there is only one Component) */
1209  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1210  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1211  outCmp = outManagerCSData->pocl[0];
1212 
1213  /* Check if there is a 1,4 Command waitig in the OutManager (loaded) */
1214  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1215  return 0;
1216  if (CrFwOutCmpGetServType(outCmp) != 1)
1217  return 0;
1218  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1219  return 0;
1220  if (CrFwOutCmpGetDiscriminant(outCmp) != VER_ILL_SID)
1221  return 0;
1222 
1223  /*Release the OutComponent and reset the outmanager*/
1225  CrFwCmpReset(outManager);
1226  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1227  return 0;
1228 
1229  /*Check if an OutComponent Release Error occures*/
1231  return 0;
1232 
1233  /*Reset application error Corde*/
1235 
1236  /* Check that there are no allocated packets */
1237  if (CrFwPcktGetNOfAllocated() != 0)
1238  return 0;
1239 
1240  /* Check application errors */
1241  if (CrFwGetAppErrCode() != crNoAppErr)
1242  return 0;
1243 
1244  /* manually set a sid in the Datapool*/
1245  setDpsidItem(0, 3);
1246  setDpisEnabledItem(0,1);
1247 
1248  /* Allocate a 3,3 Packet to get Error one cannot delete an enabled sid !*/
1249  pckt = CrFwPcktMake(80);
1250  CrFwPcktSetServType(pckt,3);
1251  CrFwPcktSetServSubType(pckt,3);
1253  CrFwPcktSetDiscriminant(pckt,3);
1254  CrFwPcktSetSrc(pckt,0);
1255  CrFwPcktSetDest(pckt,10);
1256  CrFwPcktSetGroup(pckt,1);
1257  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1258  CrFwPcktSetSeqCnt(pckt,0);
1259 
1260  setHkDeleteCmdN(pckt, 1);
1261  setHkDeleteCmdRepStrucIdItem(pckt, 1, 3);
1262 
1263  /* Check if number of Allocated Packets now is 1*/
1264  if (CrFwPcktGetNOfAllocated() != 1)
1265  return 0;
1266 
1267  /* Check if number of Allocated InCommands = 0*/
1269  return 0;
1270 
1271  /*Creating an InCommand out of the 3,3 packet*/
1272  inCmd = CrFwInFactoryMakeInCmd(pckt);
1273 
1274  /*Check if number of Allocated InCommands is now 1*/
1276  return 0;
1277 
1278  /* Check the type identifier */
1279  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1280  return 0;
1281 
1282  /* Check type and sub-type of the InCommand*/
1283  if (CrFwInCmdGetServType(inCmd) != 3)
1284  return 0;
1285  if (CrFwInCmdGetServSubType(inCmd) != 3)
1286  return 0;
1287 
1288  /*check that the InCommand is in ACCEPTED state*/
1289  if (!CrFwInCmdIsInAccepted(inCmd))
1290  return 0;
1291 
1292  /* Call the Start Action of the 3,3 command and check the outcome = VER_S3S_START_FD -> SID is enabled */
1294 
1295  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1296  if (cmpData->outcome != VER_S3S_START_FD)
1297  {
1298  return 0;
1299  }
1300 
1301  /* Release the inCommand*/
1303 
1304  /*Check if number of Allocated InCommands is now 0*/
1306  return 0;
1307 
1308  /* Get the Data from the out Manager (there is only one Component) */
1309  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1310  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1311  outCmp = outManagerCSData->pocl[0];
1312 
1313  /* Check if there is a 1,4 Command waitig in the OutManager (loaded) */
1314  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1315  return 0;
1316  if (CrFwOutCmpGetServType(outCmp) != 1)
1317  return 0;
1318  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1319  return 0;
1320  if (CrFwOutCmpGetDiscriminant(outCmp) != VER_ENABLED_SID)
1321  return 0;
1322 
1323  /*Release the OutComponent and reset the outmanager*/
1325  CrFwCmpReset(outManager);
1326  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1327  return 0;
1328 
1329  /*Check if an OutComponent Release Error occures*/
1331  return 0;
1332 
1333  /*Reset application error Corde*/
1335 
1336  /* Check that there are no allocated packets */
1337  if (CrFwPcktGetNOfAllocated() != 0)
1338  return 0;
1339 
1340  /* Check application errors */
1341  if (CrFwGetAppErrCode() != crNoAppErr)
1342  return 0;
1343 
1344  /* manually set a sid in the Datapool*/
1345  setDpsidItem(0, 3);
1346  setDpsidItem(1, 1);
1347  setDpisEnabledItem(0,0);
1348  setDpisEnabledItem(1,0);
1349 
1350  /* Allocate a 3,5 Packet to get outcome success and enable a SID*/
1351  pckt = CrFwPcktMake(80);
1352  CrFwPcktSetServType(pckt,3);
1353  CrFwPcktSetServSubType(pckt,5);
1355  CrFwPcktSetDiscriminant(pckt,3);
1356  CrFwPcktSetSrc(pckt,0);
1357  CrFwPcktSetDest(pckt,10);
1358  CrFwPcktSetGroup(pckt,1);
1359  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1360  CrFwPcktSetSeqCnt(pckt,0);
1361 
1362  setHkEnableCmdN(pckt, 2);
1363  setHkEnableCmdRepStrucIdItem(pckt, 1, 3);
1364  setHkEnableCmdRepStrucIdItem(pckt, 2, 1);
1365 
1366  /* Check if number of Allocated Packets now is 1*/
1367  if (CrFwPcktGetNOfAllocated() != 1)
1368  return 0;
1369 
1370  /* Check if number of Allocated InCommands = 0*/
1372  return 0;
1373 
1374  /*Creating an InCommand out of the 3,5 packet*/
1375  inCmd = CrFwInFactoryMakeInCmd(pckt);
1376 
1377  /*Check if number of Allocated InCommands is now 1*/
1379  return 0;
1380 
1381  /* Check the type identifier */
1382  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1383  return 0;
1384 
1385  /* Check type and sub-type of the InCommand*/
1386  if (CrFwInCmdGetServType(inCmd) != 3)
1387  return 0;
1388  if (CrFwInCmdGetServSubType(inCmd) != 5)
1389  return 0;
1390 
1391  /*check that the InCommand is in ACCEPTED state*/
1392  if (!CrFwInCmdIsInAccepted(inCmd))
1393  return 0;
1394 
1395  /* Call the Start, progress and termination Action of the 3,5 command and check the outcome = success */
1397  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1398  if (cmpData->outcome != 1)
1399  {
1400  return 0;
1401  }
1402 
1404  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1405  if (cmpData->outcome != 1)
1406  {
1407  return 0;
1408  }
1409 
1411  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1412  if (cmpData->outcome != 1)
1413  {
1414  return 0;
1415  }
1416 
1417  /*Check if SID is enabled in the Datapool */
1418  if (getDpisEnabledItem(0) != 1)
1419  return 0;
1420 
1421  /* Release the inCommand*/
1423 
1424  /*Check if number of Allocated InCommands is now 0*/
1426  return 0;
1427 
1428  /* Check that there are no allocated packets */
1429  if (CrFwPcktGetNOfAllocated() != 0)
1430  return 0;
1431 
1432  /* Check application errors */
1433  if (CrFwGetAppErrCode() != crNoAppErr)
1434  return 0;
1435 
1436 /* manually set a sid in the Datapool*/
1437  setDpsidItem(0, 3);
1438  setDpisEnabledItem(0,0);
1439 
1440  /* Allocate a 3,7 Packet to get outcome success and enable a SID*/
1441  pckt = CrFwPcktMake(80);
1442  CrFwPcktSetServType(pckt,3);
1443  CrFwPcktSetServSubType(pckt,7);
1445  CrFwPcktSetDiscriminant(pckt,3);
1446  CrFwPcktSetSrc(pckt,0);
1447  CrFwPcktSetDest(pckt,10);
1448  CrFwPcktSetGroup(pckt,1);
1449  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1450  CrFwPcktSetSeqCnt(pckt,0);
1451 
1452  setHkEnableCmdN(pckt, 2);
1453  setHkEnableCmdRepStrucIdItem(pckt, 1, 3);
1454  setHkEnableCmdRepStrucIdItem(pckt, 2, 1);
1455 
1456  /* Check if number of Allocated Packets now is 1*/
1457  if (CrFwPcktGetNOfAllocated() != 1)
1458  return 0;
1459 
1460  /* Check if number of Allocated InCommands = 0*/
1462  return 0;
1463 
1464  /*Creating an InCommand out of the 3,7 packet*/
1465  inCmd = CrFwInFactoryMakeInCmd(pckt);
1466 
1467  /*Check if number of Allocated InCommands is now 1*/
1469  return 0;
1470 
1471  /* Check the type identifier */
1472  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1473  return 0;
1474 
1475  /* Check type and sub-type of the InCommand*/
1476  if (CrFwInCmdGetServType(inCmd) != 3)
1477  return 0;
1478  if (CrFwInCmdGetServSubType(inCmd) != 7)
1479  return 0;
1480 
1481  /*check that the InCommand is in ACCEPTED state*/
1482  if (!CrFwInCmdIsInAccepted(inCmd))
1483  return 0;
1484 
1485  /* Call the Start, progress and termination Action of the 3,7 command and check the outcome = success */
1487  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1488  if (cmpData->outcome !=1)
1489  {
1490  return 0;
1491  }
1492 
1494  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1495  if (cmpData->outcome !=1)
1496  {
1497  return 0;
1498  }
1499 
1501  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1502  if (cmpData->outcome !=1)
1503  {
1504  return 0;
1505  }
1506 
1507  /*Check if SID is enabled in the Datapool */
1508  if (getDpisEnabledItem(0) != 1)
1509  return 0;
1510 
1511  /* Release the inCommand*/
1513 
1514  /*Check if number of Allocated InCommands is now 0*/
1516  return 0;
1517 
1518  /* Check that there are no allocated packets */
1519  if (CrFwPcktGetNOfAllocated() != 0)
1520  return 0;
1521 
1522  /* Check application errors */
1523  if (CrFwGetAppErrCode() != crNoAppErr)
1524  return 0;
1525 
1526  /* manually delete a sid in the Datapool*/
1527  setDpsidItem(0, 0);
1528  setDpisEnabledItem(0,0);
1529 
1530  /* Allocate a 3,5 Packet to get outcome VER_SID_START_FD .. wrong SID (sid not in RDL)*/
1531  pckt = CrFwPcktMake(80);
1532  CrFwPcktSetServType(pckt,3);
1533  CrFwPcktSetServSubType(pckt,5);
1535  CrFwPcktSetDiscriminant(pckt,3);
1536  CrFwPcktSetSrc(pckt,0);
1537  CrFwPcktSetDest(pckt,10);
1538  CrFwPcktSetGroup(pckt,1);
1539  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1540  CrFwPcktSetSeqCnt(pckt,0);
1541 
1542  setHkEnableCmdN(pckt, 1);
1543  setHkEnableCmdRepStrucIdItem(pckt, 1, 3);
1544 
1545  /* Check if number of Allocated Packets now is 1*/
1546  if (CrFwPcktGetNOfAllocated() != 1)
1547  return 0;
1548 
1549  /* Check if number of Allocated InCommands = 0*/
1551  return 0;
1552 
1553  /*Creating an InCommand out of the 3,5 packet*/
1554  inCmd = CrFwInFactoryMakeInCmd(pckt);
1555 
1556  /*Check if number of Allocated InCommands is now 1*/
1558  return 0;
1559 
1560  /* Check the type identifier */
1561  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1562  return 0;
1563 
1564  /* Check type and sub-type of the InCommand*/
1565  if (CrFwInCmdGetServType(inCmd) != 3)
1566  return 0;
1567  if (CrFwInCmdGetServSubType(inCmd) != 5)
1568  return 0;
1569 
1570  /*check that the InCommand is in ACCEPTED state*/
1571  if (!CrFwInCmdIsInAccepted(inCmd))
1572  return 0;
1573 
1574  /* Call the Start Action of the 3,5 command and check the outcome = VER_S3S_START_FD -> VER_ILL_SID -> sid is not in RDL*/
1576 
1577  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1578  if (cmpData->outcome != VER_SID_START_FD)
1579  {
1580  return 0;
1581  }
1582 
1583  /* Release the inCommand*/
1585 
1586  /*Check if number of Allocated InCommands is now 0*/
1588  return 0;
1589 
1590  /* Get the Data from the out Manager (there is only one Component) */
1591  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1592  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1593  outCmp = outManagerCSData->pocl[0];
1594 
1595  /* Check if there is a 1,4 Command waitig in the OutManager (loaded) */
1596  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1597  return 0;
1598  if (CrFwOutCmpGetServType(outCmp) != 1)
1599  return 0;
1600  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1601  return 0;
1602  if (CrFwOutCmpGetDiscriminant(outCmp) != VER_ILL_SID)
1603  return 0;
1604 
1605  /*Release the OutComponent and reset the outmanager*/
1607  CrFwCmpReset(outManager);
1608  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1609  return 0;
1610 
1611  /*Check if an OutComponent Release Error occures*/
1613  return 0;
1614 
1615  /*Reset application error Corde*/
1617 
1618  /* Check that there are no allocated packets */
1619  if (CrFwPcktGetNOfAllocated() != 0)
1620  return 0;
1621 
1622  /* Check application errors */
1623  if (CrFwGetAppErrCode() != crNoAppErr)
1624  return 0;
1625 
1626  /* manually set a sid in the Datapool*/
1627  setDpsidItem(0, 3);
1628  setDpisEnabledItem(0,1);
1629 
1630  /* Allocate a 3,6 Packet to get outcome success*/
1631  pckt = CrFwPcktMake(80);
1632  CrFwPcktSetServType(pckt,3);
1633  CrFwPcktSetServSubType(pckt,6);
1635  CrFwPcktSetDiscriminant(pckt,3);
1636  CrFwPcktSetSrc(pckt,0);
1637  CrFwPcktSetDest(pckt,10);
1638  CrFwPcktSetGroup(pckt,1);
1639  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1640  CrFwPcktSetSeqCnt(pckt,0);
1641 
1642  setHkDisableCmdN(pckt, 2);
1643  setHkDisableCmdRepStrucIdItem(pckt, 1, 3);
1644  setHkDisableCmdRepStrucIdItem(pckt, 2, 1);
1645 
1646  /* Check if number of Allocated Packets now is 1*/
1647  if (CrFwPcktGetNOfAllocated() != 1)
1648  return 0;
1649 
1650  /* Check if number of Allocated InCommands = 0*/
1652  return 0;
1653 
1654  /*Creating an InCommand out of the 3,6 packet*/
1655  inCmd = CrFwInFactoryMakeInCmd(pckt);
1656 
1657  /*Check if number of Allocated InCommands is now 1*/
1659  return 0;
1660 
1661  /* Check the type identifier */
1662  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1663  return 0;
1664 
1665  /* Check type and sub-type of the InCommand*/
1666  if (CrFwInCmdGetServType(inCmd) != 3)
1667  return 0;
1668  if (CrFwInCmdGetServSubType(inCmd) != 6)
1669  return 0;
1670 
1671  /*check that the InCommand is in ACCEPTED state*/
1672  if (!CrFwInCmdIsInAccepted(inCmd))
1673  return 0;
1674 
1675  /* Call the Start, progress and termination Action of the 3,6 command and check the outcome = success */
1677  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1678  if (cmpData->outcome != 1)
1679  {
1680  return 0;
1681  }
1682 
1684  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1685  if (cmpData->outcome != 1)
1686  {
1687  return 0;
1688  }
1689 
1691  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1692  if (cmpData->outcome != 1)
1693  {
1694  return 0;
1695  }
1696 
1697  /*Check if SID is disabled in the Datapool */
1698  if (getDpisEnabledItem(0) != 0)
1699  return 0;
1700 
1701  /* Release the inCommand*/
1703 
1704  /*Check if number of Allocated InCommands is now 0*/
1706  return 0;
1707 
1708  /* Check that there are no allocated packets */
1709  if (CrFwPcktGetNOfAllocated() != 0)
1710  return 0;
1711 
1712  /* Check application errors */
1713  if (CrFwGetAppErrCode() != crNoAppErr)
1714  return 0;
1715 
1716  /* manually set a sid in the Datapool*/
1717  setDpsidItem(0, 3);
1718  setDpisEnabledItem(0,1);
1719 
1720  /* Allocate a 3,8 Packet to get outcome success*/
1721  pckt = CrFwPcktMake(80);
1722  CrFwPcktSetServType(pckt,3);
1723  CrFwPcktSetServSubType(pckt,8);
1725  CrFwPcktSetDiscriminant(pckt,3);
1726  CrFwPcktSetSrc(pckt,0);
1727  CrFwPcktSetDest(pckt,10);
1728  CrFwPcktSetGroup(pckt,1);
1729  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1730  CrFwPcktSetSeqCnt(pckt,0);
1731 
1732  setHkDisableCmdN(pckt, 2);
1733  setHkDisableCmdRepStrucIdItem(pckt, 1, 3);
1734  setHkDisableCmdRepStrucIdItem(pckt, 2, 1);
1735 
1736  /* Check if number of Allocated Packets now is 1*/
1737  if (CrFwPcktGetNOfAllocated() != 1)
1738  return 0;
1739 
1740  /* Check if number of Allocated InCommands = 0*/
1742  return 0;
1743 
1744  /*Creating an InCommand out of the 3,8 packet*/
1745  inCmd = CrFwInFactoryMakeInCmd(pckt);
1746 
1747  /*Check if number of Allocated InCommands is now 1*/
1749  return 0;
1750 
1751  /* Check the type identifier */
1752  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1753  return 0;
1754 
1755  /* Check type and sub-type of the InCommand*/
1756  if (CrFwInCmdGetServType(inCmd) != 3)
1757  return 0;
1758  if (CrFwInCmdGetServSubType(inCmd) != 8)
1759  return 0;
1760 
1761  /*check that the InCommand is in ACCEPTED state*/
1762  if (!CrFwInCmdIsInAccepted(inCmd))
1763  return 0;
1764 
1765  /* Call the Start, progress and termination Action of the 3,8 command and check the outcome = success */
1767  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1768  if (cmpData->outcome != 1)
1769  {
1770  return 0;
1771  }
1772 
1774  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1775  if (cmpData->outcome != 1)
1776  {
1777  return 0;
1778  }
1779 
1781  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1782  if (cmpData->outcome != 1)
1783  {
1784  return 0;
1785  }
1786 
1787  /*Check if SID is disabled in the Datapool */
1788  if (getDpisEnabledItem(0) != 0)
1789  return 0;
1790 
1791  /* Release the inCommand*/
1793 
1794  /*Check if number of Allocated InCommands is now 0*/
1796  return 0;
1797 
1798  /* Check that there are no allocated packets */
1799  if (CrFwPcktGetNOfAllocated() != 0)
1800  return 0;
1801 
1802  /* Check application errors */
1803  if (CrFwGetAppErrCode() != crNoAppErr)
1804  return 0;
1805 
1806  /* manually delete a sid in the Datapool*/
1807  setDpsidItem(0, 0);
1808  setDpisEnabledItem(0,0);
1809 
1810  /* Allocate a 3,6 Packet to get outcome failed*/
1811  pckt = CrFwPcktMake(80);
1812  CrFwPcktSetServType(pckt,3);
1813  CrFwPcktSetServSubType(pckt,6);
1815  CrFwPcktSetDiscriminant(pckt,3);
1816  CrFwPcktSetSrc(pckt,0);
1817  CrFwPcktSetDest(pckt,10);
1818  CrFwPcktSetGroup(pckt,1);
1819  CrFwPcktSetAckLevel(pckt,0,0,0,0);
1820  CrFwPcktSetSeqCnt(pckt,0);
1821 
1822  setHkEnableCmdN(pckt, 1);
1823  setHkEnableCmdRepStrucIdItem(pckt, 1, 3);
1824 
1825  /* Check if number of Allocated Packets now is 1*/
1826  if (CrFwPcktGetNOfAllocated() != 1)
1827  return 0;
1828 
1829  /* Check if number of Allocated InCommands = 0*/
1831  return 0;
1832 
1833  /*Creating an InCommand out of the 3,6 packet*/
1834  inCmd = CrFwInFactoryMakeInCmd(pckt);
1835 
1836  /*Check if number of Allocated InCommands is now 1*/
1838  return 0;
1839 
1840  /* Check the type identifier */
1841  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
1842  return 0;
1843 
1844  /* Check type and sub-type of the InCommand*/
1845  if (CrFwInCmdGetServType(inCmd) != 3)
1846  return 0;
1847  if (CrFwInCmdGetServSubType(inCmd) != 6)
1848  return 0;
1849 
1850  /*check that the InCommand is in ACCEPTED state*/
1851  if (!CrFwInCmdIsInAccepted(inCmd))
1852  return 0;
1853 
1854  /* Call the Start Action of the 3,6 command and check the outcome = VER_S3S_START_FD -> VER_ILL_SID -> sid is not in RDL*/
1856  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
1857  if (cmpData->outcome != VER_SID_START_FD)
1858  {
1859  return 0;
1860  }
1861 
1862  /* Release the inCommand*/
1864 
1865  /*Check if number of Allocated InCommands is now 0*/
1867  return 0;
1868 
1869  /* Get the Data from the out Manager (there is only one Component) */
1870  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
1871  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
1872  outCmp = outManagerCSData->pocl[0];
1873 
1874  /* Check if there is a 1,4 Command waitig in the OutManager (loaded) */
1875  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
1876  return 0;
1877  if (CrFwOutCmpGetServType(outCmp) != 1)
1878  return 0;
1879  if (CrFwOutCmpGetServSubType(outCmp) != 4)
1880  return 0;
1881  if (CrFwOutCmpGetDiscriminant(outCmp) != VER_ILL_SID)
1882  return 0;
1883 
1884  /*Release the OutComponent and reset the outmanager*/
1886  CrFwCmpReset(outManager);
1887  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
1888  return 0;
1889 
1890  /*Check if an OutComponent Release Error occures*/
1892  return 0;
1893 
1894  /*Reset application error Corde*/
1896 
1897  /* Check that there are no allocated packets */
1898  if (CrFwPcktGetNOfAllocated() != 0)
1899  return 0;
1900 
1901  /* Check application errors */
1902  if (CrFwGetAppErrCode() != crNoAppErr)
1903  return 0;
1904 
1905  return 1;
1906 }
1907 
1908 /*--------------------------------------------------------------------------------*/
1909 CrFwBool_t CrPsHkTestCase3() /*for the Structure Rep and OneShor commands*/
1910 {
1911  /* Check Service 3 */
1912  FwSmDesc_t inFactory, outFactory, outManager, inCmd, outCmp, outCmpArr[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP];
1913  CrFwPckt_t pckt;
1914  CrFwCmpData_t *cmpData;
1916  CrFwOutManagerData_t* outManagerCSData;
1917  uint32_t i;
1918 
1919  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
1921  CrPsInitServHk();
1922 
1923  /* manually delete all sid's in the Datapool*/ /*TODO remove after the init function does this*/
1924  for (i = 0; i < HK_N_REP_DEF; i++)
1925  {
1926  setDpsidItem(i, 0);
1927  }
1928 
1929  /* Instantiate the OutFactory, InFactory and OutManager*/
1930  outFactory = CrFwOutFactoryMake();
1931  if (outFactory == NULL)
1932  return 0;
1933  if (FwSmCheckRec(outFactory) != smSuccess)
1934  return 0;
1935 
1936  inFactory = CrFwInFactoryMake();
1937  if (inFactory == NULL)
1938  return 0;
1939  if (FwSmCheckRec(inFactory) != smSuccess)
1940  return 0;
1941 
1942  outManager = CrFwOutManagerMake(0);
1943  if (outManager == NULL)
1944  return 0;
1945  if (FwSmCheckRec(outManager) != smSuccess)
1946  return 0;
1947 
1948  /* Initialize and Configure OutFactory, InFactory and OutManager and check success */
1949  CrFwCmpInit(outFactory);
1950  CrFwCmpReset(outFactory);
1951  if (!CrFwCmpIsInConfigured(outFactory))
1952  return 0;
1953 
1954  CrFwCmpInit(inFactory);
1955  CrFwCmpReset(inFactory);
1956  if (!CrFwCmpIsInConfigured(inFactory))
1957  return 0;
1958 
1959  CrFwCmpInit(outManager);
1960  CrFwCmpReset(outManager);
1961  if (!CrFwCmpIsInConfigured(outManager))
1962  return 0;
1963 
1964  /* Check if number of Allocated Packets = 0*/
1965  if (CrFwPcktGetNOfAllocated() != 0)
1966  return 0;
1967 
1968  /* manually set a sid in the Datapool*/
1969  setDpsidItem(0, 1);
1970  setDpsidItem(1, 3);
1971  setDpsidItem(2, 0);
1972 
1973  /*SID 1*/
1974  setDpperiodItem(0, 8);
1975  setDpisEnabledItem(0,1);
1976  setDpnSimpleItem(0, 0); /*N1*/
1977  setDplstSampleRepItem(0, 4);
1978  setDplstNSampRepItem(0, 3);
1979  setDplstIdItem(0, datapool32bit_ID);
1980  setDplstIdItem(1, datapool16bit_ID);
1981  setDplstIdItem(2, datapool8bit_ID);
1982 
1983  /*SID 3*/
1984  setDpperiodItem(1, 8);
1985  setDpisEnabledItem(1,1);
1986  setDpnSimpleItem(1, 3); /*N1*/
1987  setDplstIdItem(HK_MAX_N_ITEMS + 0, datapool32bitarray_ID);
1988  setDplstIdItem(HK_MAX_N_ITEMS + 1, datapool16bitarray_ID);
1989  setDplstIdItem(HK_MAX_N_ITEMS + 2, datapool8bitarray_ID);
1991  setDplstNSampRepItem(HK_MAX_N_GR, 2); /*N2*/
1992  setDplstIdItem(HK_MAX_N_ITEMS + 3, datapool32bit_ID);
1993  setDplstIdItem(HK_MAX_N_ITEMS + 4, datapool16bit_ID);
1994  setDplstIdItem(HK_MAX_N_ITEMS + 5, datapool8bit_ID);
1995 
1996  /* Allocate a 3,9 Packet to get outcome success*/
1997  pckt = CrFwPcktMake(80);
1998  CrFwPcktSetServType(pckt,3);
1999  CrFwPcktSetServSubType(pckt,9);
2001  CrFwPcktSetDiscriminant(pckt,3);
2002  CrFwPcktSetSrc(pckt,0);
2003  CrFwPcktSetDest(pckt,10);
2004  CrFwPcktSetGroup(pckt,1);
2005  CrFwPcktSetAckLevel(pckt,0,0,0,0);
2006  CrFwPcktSetSeqCnt(pckt,0);
2007 
2008  setHkRepStructCmdN(pckt, 2);
2009  setHkRepStructCmdRepStrucIdItem(pckt, 1, 1);
2010  setHkRepStructCmdRepStrucIdItem(pckt, 2, 3);
2011 
2012  /* Check if number of Allocated Packets now is 1*/
2013  if (CrFwPcktGetNOfAllocated() != 1)
2014  return 0;
2015 
2016  /* Check if number of Allocated InCommands = 0*/
2018  return 0;
2019 
2020  /*Creating an InCommand out of the 3,9 packet*/
2021  inCmd = CrFwInFactoryMakeInCmd(pckt);
2022 
2023  /*Check if number of Allocated InCommands is now 1*/
2025  return 0;
2026 
2027  /* Check the type identifier */
2028  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
2029  return 0;
2030 
2031  /* Check type and sub-type of the InCommand*/
2032  if (CrFwInCmdGetServType(inCmd) != 3)
2033  return 0;
2034  if (CrFwInCmdGetServSubType(inCmd) != 9)
2035  return 0;
2036 
2037  /*check that the InCommand is in ACCEPTED state*/
2038  if (!CrFwInCmdIsInAccepted(inCmd))
2039  return 0;
2040 
2041  /* Call the Start progress and termination Action of the 3,9 command and check the outcome = continue and then success */
2043  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2044  if (cmpData->outcome != 1)
2045  {
2046  return 0;
2047  }
2048 
2050  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2051  if (cmpData->outcome != 2) /*CONTINUE*/
2052  {
2053  return 0;
2054  }
2055 
2057  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2058  if (cmpData->outcome != 2) /*CONTINUE*/
2059  {
2060  return 0;
2061  }
2062 
2064  if (cmpData->outcome != 1) /*SUCCESS*/
2065  {
2066  return 0;
2067  }
2068 
2070  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2071  if (cmpData->outcome != 1) /*SUCCESS*/
2072  {
2073  return 0;
2074  }
2075 
2076  /* Release the inCommand*/
2078 
2079  /*Check if number of Allocated InCommands is now 0*/
2081  return 0;
2082 
2083  /* Get the Data from the out Manager (there is only one Component) */
2084  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
2085  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
2086  outCmp = outManagerCSData->pocl[0];
2087 
2088  /* Check if there is a 3,10 Command waitig in the OutManager (loaded) */
2089  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
2090  return 0;
2091  if (CrFwOutCmpGetServType(outCmp) != 3)
2092  return 0;
2093  if (CrFwOutCmpGetServSubType(outCmp) != 10)
2094  return 0;
2095 
2096  /*Release the OutComponent and reset the OutManager*/
2098  CrFwCmpReset(outManager);
2099  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
2100  return 0;
2101 
2102  /*Check if an OutComponent Release Error occures*/
2104  return 0;
2105 
2106  /*Reset application error Corde*/
2108 
2109  /* Check that there are no allocated packets */
2110  if (CrFwPcktGetNOfAllocated() != 0)
2111  return 0;
2112 
2113  /* Check application errors */
2114  if (CrFwGetAppErrCode() != crNoAppErr)
2115  return 0;
2116 
2117  /* Allocate a 3,11 Packet to get outcome success*/
2118  pckt = CrFwPcktMake(80);
2119  CrFwPcktSetServType(pckt,3);
2120  CrFwPcktSetServSubType(pckt,11);
2122  CrFwPcktSetDiscriminant(pckt,3);
2123  CrFwPcktSetSrc(pckt,0);
2124  CrFwPcktSetDest(pckt,10);
2125  CrFwPcktSetGroup(pckt,1);
2126  CrFwPcktSetAckLevel(pckt,0,0,0,0);
2127  CrFwPcktSetSeqCnt(pckt,0);
2128 
2129  setHkRepStructCmdN(pckt, 2);
2130  setHkRepStructCmdRepStrucIdItem(pckt, 1, 1);
2131  setHkRepStructCmdRepStrucIdItem(pckt, 2, 3);
2132 
2133  /* Check if number of Allocated Packets now is 1*/
2134  if (CrFwPcktGetNOfAllocated() != 1)
2135  return 0;
2136 
2137  /* Check if number of Allocated InCommands = 0*/
2139  return 0;
2140 
2141  /*Creating an InCommand out of the 3,9 packet*/
2142  inCmd = CrFwInFactoryMakeInCmd(pckt);
2143 
2144  /*Check if number of Allocated InCommands is now 1*/
2146  return 0;
2147 
2148  /* Check the type identifier */
2149  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
2150  return 0;
2151 
2152  /* Check type and sub-type of the InCommand*/
2153  if (CrFwInCmdGetServType(inCmd) != 3)
2154  return 0;
2155  if (CrFwInCmdGetServSubType(inCmd) != 11)
2156  return 0;
2157 
2158  /*check that the InCommand is in ACCEPTED state*/
2159  if (!CrFwInCmdIsInAccepted(inCmd))
2160  return 0;
2161 
2162  /* Call the Start progress and termination Action of the 3,9 command and check the outcome = continue and then success */
2164  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2165  if (cmpData->outcome != 1) /*SUCCESS*/
2166  {
2167  return 0;
2168  }
2169 
2171  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2172  if (cmpData->outcome != 2) /*CONTINUE*/
2173  {
2174  return 0;
2175  }
2176 
2178  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2179  if (cmpData->outcome != 2) /*CONTINUE*/
2180  {
2181  return 0;
2182  }
2183 
2184  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2186  if (cmpData->outcome != 1) /*SUCCESS*/
2187  {
2188  return 0;
2189  }
2190 
2192  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2193  if (cmpData->outcome !=1) /*SUCCESS*/
2194  {
2195  return 0;
2196  }
2197 
2198  /* Release the inCommand*/
2200 
2201  /*Check if number of Allocated InCommands is now 0*/
2203  return 0;
2204 
2205  /* Get the Data from the out Manager (there is only one Component) */
2206  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
2207  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
2208  outCmp = outManagerCSData->pocl[0];
2209 
2210  /* Check if there is a 3,12 Command waitig in the OutManager (loaded) */
2211  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
2212  return 0;
2213  if (CrFwOutCmpGetServType(outCmp) != 3)
2214  return 0;
2215  if (CrFwOutCmpGetServSubType(outCmp) != 12)
2216  return 0;
2217 
2218  /*Release the OutComponent and Reset the OutManager*/
2220  CrFwCmpReset(outManager);
2221  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
2222  return 0;
2223 
2224  /*Check if an OutComponent Release Error occures*/
2226  return 0;
2227 
2228  /*Reset application error Corde*/
2230 
2231  /* Check that there are no allocated packets */
2232  if (CrFwPcktGetNOfAllocated() != 0)
2233  return 0;
2234 
2235  /* Check application errors */
2236  if (CrFwGetAppErrCode() != crNoAppErr)
2237  return 0;
2238 
2239  /* Allocate a 3,9 Packet to get OutFactory Fail*/
2240  pckt = CrFwPcktMake(80);
2241  CrFwPcktSetServType(pckt,3);
2242  CrFwPcktSetServSubType(pckt,9);
2244  CrFwPcktSetDiscriminant(pckt,3);
2245  CrFwPcktSetSrc(pckt,0);
2246  CrFwPcktSetDest(pckt,10);
2247  CrFwPcktSetGroup(pckt,1);
2248  CrFwPcktSetAckLevel(pckt,0,0,0,0);
2249  CrFwPcktSetSeqCnt(pckt,0);
2250 
2251  setHkRepStructCmdN(pckt, 1);
2252  setHkRepStructCmdRepStrucIdItem(pckt, 1, 3);
2253 
2254  /* Check if number of Allocated Packets now is 1*/
2255  if (CrFwPcktGetNOfAllocated() != 1)
2256  return 0;
2257 
2258  /* Check if number of Allocated InCommands = 0*/
2260  return 0;
2261 
2262  /*Creating an InCommand out of the 3,9 packet*/
2263  inCmd = CrFwInFactoryMakeInCmd(pckt);
2264 
2265  /*Check if number of Allocated InCommands is now 1*/
2267  return 0;
2268 
2269  /* Check the type identifier */
2270  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
2271  return 0;
2272 
2273  /* Check type and sub-type of the InCommand*/
2274  if (CrFwInCmdGetServType(inCmd) != 3)
2275  return 0;
2276  if (CrFwInCmdGetServSubType(inCmd) != 9)
2277  return 0;
2278 
2279  /*check that the InCommand is in ACCEPTED state*/
2280  if (!CrFwInCmdIsInAccepted(inCmd))
2281  return 0;
2282 
2283  /* Fill the outfactory so that an Error could occur (leave one free slot) */
2284  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
2285  {
2286  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
2287  }
2288 
2290 
2291  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2292  if (cmpData->outcome != 1)
2293  {
2294  return 0;
2295  }
2296 
2298 
2299  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2300  if (cmpData->outcome != 1) /*SUCCESS*/
2301  {
2302  return 0;
2303  }
2304 
2305  /* Check Application Error! (crOutCmpAllocationFail) */
2307  return 0;
2308 
2309  /* Reset the Application Error */
2311 
2313 
2314  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2315  if (cmpData->outcome != 1)
2316  {
2317  return 0;
2318  }
2319 
2320  /* Release the inCommand*/
2322 
2323  /*Check if number of Allocated InCommands is now 0*/
2325  return 0;
2326 
2327  /* Release all outcomponents, that have been created to fill the outfactory */
2328  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
2329  {
2330  CrFwOutFactoryReleaseOutCmp(outCmpArr[i]);
2331  }
2332 
2333  /* Check that there are no allocated packets */
2334  if (CrFwPcktGetNOfAllocated() != 0)
2335  return 0;
2336 
2337  /* Check application errors */
2338  if (CrFwGetAppErrCode() != crNoAppErr)
2339  return 0;
2340 
2341  /* Allocate a 3,27 Packet to get outcome success*/
2342  pckt = CrFwPcktMake(80);
2343  CrFwPcktSetServType(pckt,3);
2344  CrFwPcktSetServSubType(pckt,27);
2346  CrFwPcktSetDiscriminant(pckt,0);
2347  CrFwPcktSetSrc(pckt,0);
2348  CrFwPcktSetDest(pckt,10);
2349  CrFwPcktSetGroup(pckt,1);
2350  CrFwPcktSetAckLevel(pckt,0,0,0,0);
2351  CrFwPcktSetSeqCnt(pckt,0);
2352 
2353  setHkOneShotCmdN(pckt, 2);
2354  setHkOneShotCmdRepStrucIdItem(pckt, 1, 1);
2355  setHkOneShotCmdRepStrucIdItem(pckt, 2, 3);
2356 
2357  /* Check if number of Allocated Packets now is 1*/
2358  if (CrFwPcktGetNOfAllocated() != 1)
2359  return 0;
2360 
2361  /* Check if number of Allocated InCommands = 0*/
2363  return 0;
2364 
2365  /*Creating an InCommand out of the 3,27 packet*/
2366  inCmd = CrFwInFactoryMakeInCmd(pckt);
2367 
2368  /*Check if number of Allocated InCommands is now 1*/
2370  return 0;
2371 
2372  /* Check the type identifier */
2373  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
2374  return 0;
2375 
2376  /* Check type and sub-type of the InCommand*/
2377  if (CrFwInCmdGetServType(inCmd) != 3)
2378  return 0;
2379  if (CrFwInCmdGetServSubType(inCmd) != 27)
2380  return 0;
2381 
2382  /*check that the InCommand is in ACCEPTED state*/
2383  if (!CrFwInCmdIsInAccepted(inCmd))
2384  return 0;
2385 
2386  /* Call the Termination Action early to get outcome = 0 */
2388 
2389  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2390  if (cmpData->outcome != 0)
2391  {
2392  return 0;
2393  }
2394 
2395  /* Call the Start progress and termination Action of the 3,27 command and check the outcome = success */
2397  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2398  if (cmpData->outcome != 1)
2399  {
2400  return 0;
2401  }
2402 
2404  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2405  if (cmpData->outcome != 1)
2406  {
2407  return 0;
2408  }
2409 
2411  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2412  if (cmpData->outcome != 1)
2413  {
2414  return 0;
2415  }
2416 
2417  /* Release the inCommand*/
2419 
2420  /*Check if number of Allocated InCommands is now 0*/
2422  return 0;
2423 
2424 
2425  /* Check that there are no allocated packets */
2426  if (CrFwPcktGetNOfAllocated() != 0)
2427  return 0;
2428 
2429  /* Check application errors */
2430  if (CrFwGetAppErrCode() != crNoAppErr)
2431  return 0;
2432 
2433  /* Allocate a 3,28 Packet to get outcome success*/
2434  pckt = CrFwPcktMake(80);
2435  CrFwPcktSetServType(pckt,3);
2436  CrFwPcktSetServSubType(pckt,28);
2438  CrFwPcktSetDiscriminant(pckt,0);
2439  CrFwPcktSetSrc(pckt,0);
2440  CrFwPcktSetDest(pckt,10);
2441  CrFwPcktSetGroup(pckt,1);
2442  CrFwPcktSetAckLevel(pckt,0,0,0,0);
2443  CrFwPcktSetSeqCnt(pckt,0);
2444 
2445  setHkOneShotCmdN(pckt, 2);
2446  setHkOneShotCmdRepStrucIdItem(pckt, 1, 1);
2447  setHkOneShotCmdRepStrucIdItem(pckt, 2, 3);
2448 
2449  /* Check if number of Allocated Packets now is 1*/
2450  if (CrFwPcktGetNOfAllocated() != 1)
2451  return 0;
2452 
2453  /* Check if number of Allocated InCommands = 0*/
2455  return 0;
2456 
2457  /*Creating an InCommand out of the 3,28 packet*/
2458  inCmd = CrFwInFactoryMakeInCmd(pckt);
2459 
2460  /*Check if number of Allocated InCommands is now 1*/
2462  return 0;
2463 
2464  /* Check the type identifier */
2465  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
2466  return 0;
2467 
2468  /* Check type and sub-type of the InCommand*/
2469  if (CrFwInCmdGetServType(inCmd) != 3)
2470  return 0;
2471  if (CrFwInCmdGetServSubType(inCmd) != 28)
2472  return 0;
2473 
2474  /*check that the InCommand is in ACCEPTED state*/
2475  if (!CrFwInCmdIsInAccepted(inCmd))
2476  return 0;
2477 
2478  /* Call the Start progress and termination Action of the 3,27 command and check the outcome = success */
2480  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2481  if (cmpData->outcome != 1)
2482  {
2483  return 0;
2484  }
2485 
2487  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2488  if (cmpData->outcome != 1)
2489  {
2490  return 0;
2491  }
2492 
2494  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2495  if (cmpData->outcome != 1)
2496  {
2497  return 0;
2498  }
2499 
2500  /* Release the inCommand*/
2502 
2503  /*Check if number of Allocated InCommands is now 0*/
2505  return 0;
2506 
2507 
2508  /* Check that there are no allocated packets */
2509  if (CrFwPcktGetNOfAllocated() != 0)
2510  return 0;
2511 
2512  /* Check application errors */
2513  if (CrFwGetAppErrCode() != crNoAppErr)
2514  return 0;
2515 
2516  /* Allocate a 3,1 Packet to trigger an error*/
2517  pckt = CrFwPcktMake(80);
2518  CrFwPcktSetServType(pckt,3);
2519  CrFwPcktSetServSubType(pckt,1);
2521  CrFwPcktSetSrc(pckt,0);
2522  CrFwPcktSetDest(pckt,10);
2523  CrFwPcktSetGroup(pckt,1);
2524  CrFwPcktSetAckLevel(pckt,0,0,0,0);
2525  CrFwPcktSetSeqCnt(pckt,0);
2526 
2527  setHkOneShotCmdN(pckt, 2);
2528  setHkOneShotCmdRepStrucIdItem(pckt, 1, 1);
2529  setHkOneShotCmdRepStrucIdItem(pckt, 2, 3);
2530 
2531  /* Check if number of Allocated Packets now is 1*/
2532  if (CrFwPcktGetNOfAllocated() != 1)
2533  return 0;
2534 
2535  /* Check if number of Allocated InCommands = 0*/
2537  return 0;
2538 
2539  /*Creating an InCommand out of the 3,1 packet*/
2540  inCmd = CrFwInFactoryMakeInCmd(pckt);
2541 
2542  /*Check if number of Allocated InCommands is now 1*/
2544  return 0;
2545 
2546  /* Check the type identifier */
2547  if (CrFwCmpGetTypeId(inCmd) != CR_FW_INCOMMAND_TYPE)
2548  return 0;
2549 
2550  /* Check type and sub-type of the InCommand*/
2551  if (CrFwInCmdGetServType(inCmd) != 3)
2552  return 0;
2553  if (CrFwInCmdGetServSubType(inCmd) != 1)
2554  return 0;
2555 
2556  /*check that the InCommand is in ACCEPTED state*/
2557  if (!CrFwInCmdIsInAccepted(inCmd))
2558  return 0;
2559 
2560  /* Call the Start Action of the 3,27 command and check the outcome ?? */
2562  cmpData = (CrFwCmpData_t*) FwSmGetData(inCmd);
2563  if (cmpData->outcome != 1)
2564  {
2565  return 0;
2566  }
2567 
2568  /* Release the inCommand*/
2570 
2571  /*Check if number of Allocated InCommands is now 0*/
2573  return 0;
2574 
2575  /* Check that there are no allocated packets */
2576  if (CrFwPcktGetNOfAllocated() != 0)
2577  return 0;
2578 
2579  /* Check application errors */
2580  if (CrFwGetAppErrCode() != crNoAppErr)
2581  return 0;
2582 
2583  return 1;
2584 }
2585 
2586 
2587 /*--------------------------------------------------------------------------------*/
2588 CrFwBool_t CrPsHkTestCase4() /*for all the reports*/
2589 {
2590  /* Check Service 3 */
2591  FwSmDesc_t inFactory, outFactory, outManager, outCmp;
2592  CrFwCmpData_t *cmpData;
2593  uint32_t i;
2594 
2595  /* Instantiate all relevant CORDET Framework PUS Extension components, e.g. all the procedures and state machines */
2597  CrPsInitServHk();
2598 
2599  /* manually delete all sid's in the Datapool*/
2600  for (i = 0; i < HK_N_REP_DEF; i++)
2601  {
2602  setDpsidItem(i, 0);
2603  }
2604 
2605  /* Instantiate the OutFactory, InFactory and OutManager*/
2606  outFactory = CrFwOutFactoryMake();
2607  if (outFactory == NULL)
2608  return 0;
2609  if (FwSmCheckRec(outFactory) != smSuccess)
2610  return 0;
2611 
2612  inFactory = CrFwInFactoryMake();
2613  if (inFactory == NULL)
2614  return 0;
2615  if (FwSmCheckRec(inFactory) != smSuccess)
2616  return 0;
2617 
2618  outManager = CrFwOutManagerMake(0);
2619  if (outManager == NULL)
2620  return 0;
2621  if (FwSmCheckRec(outManager) != smSuccess)
2622  return 0;
2623 
2624  /* Initialize and Configure OutFactory, InFactory and OutManager and check success */
2625  CrFwCmpInit(outFactory);
2626  CrFwCmpReset(outFactory);
2627  if (!CrFwCmpIsInConfigured(outFactory))
2628  return 0;
2629 
2630  CrFwCmpInit(inFactory);
2631  CrFwCmpReset(inFactory);
2632  if (!CrFwCmpIsInConfigured(inFactory))
2633  return 0;
2634 
2635  CrFwCmpInit(outManager);
2636  CrFwCmpReset(outManager);
2637  if (!CrFwCmpIsInConfigured(outManager))
2638  return 0;
2639 
2640  /* Check if number of Allocated Packets = 0*/
2641  if (CrFwPcktGetNOfAllocated() != 0)
2642  return 0;
2643 
2644  /* manually set a sid in the Datapool*/
2645  setDpsidItem(0, 1);
2646  setDpsidItem(1, 3);
2647  setDpsidItem(2, 0);
2648 
2649  /*SID 1*/
2650  setDpperiodItem(0, 8);
2651  setDpisEnabledItem(0,1);
2652  setDpnSimpleItem(0, 0); /*N1*/
2653  setDplstSampleRepItem(0, 4);
2654  setDplstNSampRepItem(0, 3);
2655  setDplstIdItem(0, datapool32bit_ID);
2656  setDplstIdItem(1, datapool16bit_ID);
2657  setDplstIdItem(2, datapool8bit_ID);
2658 
2659  /*SID 3*/
2660  setDpperiodItem(1, 8);
2661  setDpisEnabledItem(1,1);
2662  setDpnSimpleItem(1, 3); /*N1*/
2663  setDplstIdItem(HK_MAX_N_ITEMS + 0, datapool32bitarray_ID);
2664  setDplstIdItem(HK_MAX_N_ITEMS + 1, datapool16bitarray_ID);
2665  setDplstIdItem(HK_MAX_N_ITEMS + 2, datapool8bitarray_ID);
2667  setDplstNSampRepItem(HK_MAX_N_GR, 2); /*N2*/
2668  setDplstIdItem(HK_MAX_N_ITEMS + 3, datapool32bit_ID);
2669  setDplstIdItem(HK_MAX_N_ITEMS + 4, datapool16bit_ID);
2670  setDplstIdItem(HK_MAX_N_ITEMS + 5, datapool8bit_ID);
2671 
2672  /* Create a 3,25 Packet to test the housekeeping report and the report structure report with SID = 1*/
2673  outCmp = CrFwOutFactoryMakeOutCmp(3,25,1,80);
2674  CrPsHkRepEnableCheck(outCmp);
2675  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2676  if (cmpData->outcome != 1)
2677  {
2678  return 0;
2679  }
2680 
2681  CrPsHkRepReadyCheck(outCmp);
2682  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2683  if (cmpData->outcome != 1)
2684  {
2685  return 0;
2686  }
2687 
2688  CrPsHkRepUpdateAction(outCmp);
2689  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2690  if (cmpData->outcome != 1)
2691  {
2692  return 0;
2693  }
2694 
2695  outCmp = CrFwOutFactoryMakeOutCmp(3,10,1,80);
2697  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2698  if (cmpData->outcome != 1)
2699  {
2700  return 0;
2701  }
2702 
2703  /* Create a 3,26 Packet to test the housekeeping report and the report structure report with SID = 3 for more coverage*/
2704  outCmp = CrFwOutFactoryMakeOutCmp(3,26,3,80);
2705 
2706  CrPsHkRepEnableCheck(outCmp);
2707  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2708  if (cmpData->outcome !=1)
2709  {
2710  return 0;
2711  }
2712 
2713  CrPsHkRepReadyCheck(outCmp);
2714  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2715  if (cmpData->outcome !=1)
2716  {
2717  return 0;
2718  }
2719 
2720  CrPsHkRepUpdateAction(outCmp);
2721  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2722  if (cmpData->outcome !=1)
2723  {
2724  return 0;
2725  }
2726 
2727  outCmp = CrFwOutFactoryMakeOutCmp(3,12,3,80);
2729  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2730  if (cmpData->outcome !=1)
2731  {
2732  return 0;
2733  }
2734 
2735  /* Create a 3,25 Packet to test the housekeeping report and the report structure report with SID = 2 to trigger an error (sid does not exist)*/
2736  outCmp = CrFwOutFactoryMakeOutCmp(3,25,2,80);
2737 
2738  CrPsHkRepEnableCheck(outCmp);
2739  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2740  if (cmpData->outcome != 1)
2741  {
2742  return 0;
2743  }
2744 
2745  CrPsHkRepReadyCheck(outCmp);
2746  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2747  if (cmpData->outcome != 1)
2748  {
2749  return 0;
2750  }
2751 
2752  CrPsHkRepUpdateAction(outCmp);
2753  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2754  if (cmpData->outcome != 1)
2755  {
2756  return 0;
2757  }
2758 
2759  outCmp = CrFwOutFactoryMakeOutCmp(3,10,2,80);
2761  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2762  if (cmpData->outcome != 1)
2763  {
2764  return 0;
2765  }
2766 
2767  /* Disable a SID so the readycheck fails*/
2768  setDpisEnabledItem(1,0);
2769 
2770  /* Create a 3,25 Packet to test the housekeeping report for the readycheck to fail!*/
2771  outCmp = CrFwOutFactoryMakeOutCmp(3,25,3,80);
2772 
2773  CrPsHkRepEnableCheck(outCmp);
2774  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2775  if (cmpData->outcome !=1)
2776  {
2777  return 0;
2778  }
2779 
2780  CrPsHkRepReadyCheck(outCmp);
2781  cmpData = (CrFwCmpData_t*) FwSmGetData(outCmp);
2782  if (cmpData->outcome !=0)
2783  {
2784  return 0;
2785  }
2786 
2787  /* call the ready check again for some coverage */
2788  CrPsHkRepReadyCheck(outCmp);
2789  CrPsHkRepReadyCheck(outCmp);
2790  CrPsHkRepReadyCheck(outCmp);
2791  CrPsHkRepReadyCheck(outCmp);
2792  CrPsHkRepReadyCheck(outCmp);
2793  CrPsHkRepReadyCheck(outCmp);
2794  CrPsHkRepReadyCheck(outCmp);
2795  CrPsHkRepReadyCheck(outCmp);
2796 
2797  /* Reset OutManager and check that all OutComponents are unloaded and released */
2798  CrFwCmpReset(outManager);
2799  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
2800  return 0;
2801 
2802  /* Reset the OutFactory */
2803  CrFwCmpReset(outFactory);
2805  return 0;
2806 
2807  /* Reset the InFactory and check that no InCommands are allocated */
2808  CrFwCmpReset(inFactory);
2810  return 0;
2811 
2812  /* Check application errors */
2813  if (CrFwGetAppErrCode() != crNoAppErr)
2814  return 0;
2815 
2816  return 1;
2817 }
2818 
2819 
Type for the Framework Component Data (FCD).
Interface through which framework components access the current time.
CrFwBool_t CrPsHkTestCase2()
Test the Service 3 Housekeeping Service Test all the 3,3 3,4 3,5 3,6 3,7 and 3,8 actions and procedur...
void setHkEnableCmdRepStrucIdItem(void *p, CrFwCounterU4_t N, CrPsSid_t RepStrucId)
Set "RepStrucId" in "HkEnableCmd" packet.
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.
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
Interface through which applications can initialize and execute framework PUS extension components...
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
static FwSmDesc_t outCmp[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The pre-allocated OutComponent instances.
void setHkRepStructCmdRepStrucIdItem(void *p, CrFwCounterU4_t N, CrPsSid_t RepStrucId)
Set "RepStrucId" in "HkRepStructCmd" packet.
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).
Command (3,27) to Generate One-Shot Housekeeping Report.
static void setHkRepStructCmdN(void *p, CrFwCounterU4_t N)
Set "N" in "HkRepStructCmd" packet.
void CrPsHkRepUpdateAction(FwSmDesc_t smDesc)
Update action of the Periodic Housekeeping Report (3,25) out-going report packet. ...
Definition: CrPsHkRep.c:129
static FwSmDesc_t inFactory
The singleton instance of the InFactory.
void setHkDeleteCmdRepStrucIdItem(void *p, CrFwCounterU4_t N, CrPsSid_t RepStrucId)
Set "RepStrucId" in "HkDeleteCmd" packet.
void CrPsHkRepStructCmdStartAction(FwSmDesc_t smDesc)
FW Profile function definitions.
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.
Interface for accessing data pool items.
static void setHkDisableCmdN(void *p, CrFwCounterU4_t N)
Set "N" in "HkDisableCmd" packet.
Definition of the OutFactory component.
void setHkDisableCmdRepStrucIdItem(void *p, CrFwCounterU4_t N, CrPsSid_t RepStrucId)
Set "RepStrucId" in "HkDisableCmd" packet.
An OutComponent allocation request has failed (see CrFwOutFactoryMakeOutCmp).
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
static CrPsFlag_t getDpisEnabledItem(int i)
Gets the value of the i-th element in the datapool array isEnabled.
Definition: CrPsDpServHk.h:229
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.
Interface for creating and accessing a report or command packet.
void CrPsExecServHk()
Execution of CORDET Framework PUS Extension components.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
void CrPsHkOneShotCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,27) to Generate One-Shot Housekeeping Report in-coming command pack...
CrFwServType_t CrFwOutCmpGetServType(FwSmDesc_t smDesc)
Return the type of the OutComponent.
Definition: CrFwOutCmp.c:230
void setHkOneShotCmdRepStrucIdItem(void *p, CrFwCounterU4_t N, CrPsSid_t RepStrucId)
Set "RepStrucId" in "HkOneShotCmd" packet.
An OutComponent release request has encountered an error (see CrFwOutFactoryReleaseOutCmp).
void setHkCreateCmdN1ParamIdItem(void *p, CrFwCounterU4_t N, CrPsParamId_t N1ParamId)
Set "N1ParamId" arrayItem in "HkCreateCmd" packet.
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).
Command (3,3) to Delete a Housekeeping Report Structure.
void setHkCreateCmdN2ParamIdItem(void *p, CrFwCounterU4_t NFA, CrFwCounterU4_t N2, CrPsParamId_t N2ParamId)
Set "N2ParamID" in "HkCreateCmd" packet.
void CrFwPcktSetSeqCnt(CrFwPckt_t pckt, CrFwSeqCnt_t seqCnt)
Set the sequence counter of the command or report encapsulated in a packet.
void CrPsHkDisableCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,6) to Disable Periodic Generation of a Housekeeping Report Structur...
Command type.
Definition: CrFwConstants.h:41
CrFwServType_t CrFwInCmdGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the InCommand.
Definition: CrFwInCmd.c:344
static void setDplstNSampRepItem(int i, CrPsNumberU2_t lstNSampRep)
Sets the value of the i-th element in the datapool array lstNSampRep.
Definition: CrPsDpServHk.h:420
static CrPsSid_t getDpsidItem(int i)
Gets the value of the i-th element in the datapool array sid.
Definition: CrPsDpServHk.h:289
static void setDpsidItem(int i, CrPsSid_t sid)
Sets the value of the i-th element in the datapool array sid.
Definition: CrPsDpServHk.h:300
static FwSmDesc_t outFactory
The singleton instance of the OutFactory.
Command (3,6) to Disable Periodic Generation of a Housekeeping Report Structure.
CrFwBool_t CrFwInCmdIsInAccepted(FwSmDesc_t smDesc)
Return true if the argument InCommand is in state ACCEPTED.
Definition: CrFwInCmd.c:164
Interface for reporting an error detected by a framework component.
CrFwBool_t CrPsHkRepEnableCheck(FwSmDesc_t smDesc)
Enable check of the Periodic Housekeeping Report (3,25) out-going report packet.
Definition: CrPsHkRep.c:50
void CrPsHkEnableCmdStartAction(FwSmDesc_t smDesc)
Start action of the Command (3,5) to Enable Periodic Generation of a Housekeeping Report Structure in...
static void setDpisEnabledItem(int i, CrPsFlag_t isEnabled)
Sets the value of the i-th element in the datapool array isEnabled.
Definition: CrPsDpServHk.h:240
auxiliary Interface for accessing fields in packets of service "ServHk".
void CrPsHkDeleteCmdStartAction(FwSmDesc_t smDesc)
CR Framework function definitions.
void CrPsHkRepStructCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,9) to Report Structure of a Housekeeping Report in-coming comman...
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
static void setDplstSampleRepItem(int i, CrPsRepetition_t lstSampleRep)
Sets the value of the i-th element in the datapool array lstSampleRep.
Definition: CrPsDpServHk.h:450
CrFwServType_t CrFwOutCmpGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the OutComponent.
Definition: CrFwOutCmp.c:244
CrFwBool_t CrPsHkTestCase4()
Test the Service 3 Housekeeping service Test all the 3,10 3,12 3,25 and 3,26 actions and procedures...
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrPsHkDisableCmdStartAction(FwSmDesc_t smDesc)
Start action of the Command (3,6) to Disable Periodic Generation of a Housekeeping Report Structure i...
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.
#define CR_FW_INCOMMAND_TYPE
Type identifier for the InCommand component.
void CrPsHkCreateCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,1) to Create a Housekeeping Report Structure in-coming command pack...
static void setHkCreateCmdN1(void *p, CrFwCounterU4_t N1)
Set "N1" in "HkCreateCmd" packet.
Definition of the utility functions for the CORDET Framework.
static void setDpnSimpleItem(int i, CrPsNumberU2_t nSimple)
Sets the value of the i-th element in the datapool array nSimple.
Definition: CrPsDpServHk.h:480
void CrFwPcktSetServSubType(CrFwPckt_t pckt, CrFwServSubType_t servSubType)
Set the service sub-type of the command or report encapsulated in a packet.
void setHkCreateCmdN2(void *p, CrFwCounterU4_t NFA, CrFwCounterU4_t N2)
Set "N2" in "HkCreateCmd" packet.
CrFwBool_t CrPsHkRepReadyCheck(FwSmDesc_t smDesc)
Ready check of the Periodic Housekeeping Report (3,25) out-going report packet.
Definition: CrPsHkRep.c:87
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
static void setHkEnableCmdN(void *p, CrFwCounterU4_t N)
Set "N" in "HkEnableCmd" packet.
FwSmDesc_t * pocl
Pending OutComponent List (POCL) for the OutManager.
CrFwBool_t CrPsHkTestCase1()
Test the Service 3 Housekeeping Service Part 1 Test all the 3,1 and 3,2 actions and procedures...
void CrPsHkEnableCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,5) to Enable Periodic Generation of a Housekeeping Report Structure...
CrFwDiscriminant_t CrFwOutCmpGetDiscriminant(FwSmDesc_t smDesc)
Return the discriminant of the OutComponent.
Definition: CrFwOutCmp.c:251
static void setHkOneShotCmdN(void *p, CrFwCounterU4_t N)
Set "N" in "HkOneShotCmd" packet.
Command (3,1) to Create a Housekeeping Report Structure.
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
void CrPsHkDisableCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the DCommand (3,6) to Disable Periodic Generation of a Housekeeping Report Stru...
CrFwOutFactoryPoolIndex_t CrFwOutFactoryGetNOfAllocatedOutCmp()
Return the number of OutComponents which are currently allocated.
void CrPsHkDeleteCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,3) to Delete a Housekeeping Report Structure in-coming command pack...
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
Definition of Base Component.
void CrPsHkDeleteCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,3) to Delete a Housekeeping Report Structure in-coming command p...
FwSmDesc_t CrFwInFactoryMake()
Factory function for the singleton instance of the InFactory.
int CrPsInitServHk()
Initialization of CORDET Framework PUS Extension components.
#define HK_N_REP_DEF
Number of Report Definitions in the Report Definition List (maximum number of housekeeping/diagnostic...
void CrFwOutFactoryReleaseOutCmp(FwSmDesc_t outCmpInstance)
Release function for an OutComponent.
static void setHkCreateCmdCollectionInterval(void *p, CrPsCollectInterval_t CollectionInterval)
Set "CollectionInterval" in "HkCreateCmd" packet.
static void setDpperiodItem(int i, CrPsPeriod_t period)
Sets the value of the i-th element in the datapool array period.
Definition: CrPsDpServHk.h:270
void CrPsHkRepStructCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,9) to Report Structure of a Housekeeping Report in-coming command p...
void CrFwInFactoryReleaseInCmd(FwSmDesc_t inCmdInstance)
Release function for an InCommand.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
#define HK_MAX_N_GR
Maximum number of super-commutated groups in a house- keeping/diagnostic report.
void CrPsHkOneShotCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,27) to Generate One-Shot Housekeeping Report in-coming command p...
void CrPsHkEnableCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,5) to Enable Periodic Generation of a Housekeeping Report Struct...
void CrPsHkCreateCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,1) to Create a Housekeeping Report Structure in-coming command p...
CrFwBool_t CrPsHkTestCase3()
Test the Service 3 Housekeeping service Test all the 3,9 3,11 3,27 and 3,28 actions and procedures...
Command (3,5) to Enable Periodic Generation of a Housekeeping Report Structure.
FwSmDesc_t CrFwOutFactoryMake()
Factory function for the singleton instance of the OutFactory.
Command (3,9) to Report Structure of a Housekeeping Report.
static void setDplstIdItem(int i, CrPsParamId_t lstId)
Sets the value of the i-th element in the datapool array lstId.
Definition: CrPsDpServHk.h:390
Interface through which applications can initialize and execute framework PUS extension components...
int CrPsInitServReqVerif()
Initialization of CORDET Framework PUS Extension components.
Interface for accessing fields in packets of service "ServHk".
void setHkCreateCmdNFA(void *p, CrFwCounterU4_t NFA)
Set "NFA" in "HkCreateCmd" packet.
#define VER_FULL_RDL
Outcome Failure Codes for Service 3 (Housekeeping)
void CrPsHkRepStructRepUpdateAction(FwSmDesc_t smDesc)
Update action of the Housekeeping Structure Report (3,10) out-going report 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 CrPsHkOneShotCmdStartAction(FwSmDesc_t smDesc)
Start action of the Command (3,27) to Generate One-Shot Housekeeping Report in-coming command packet...
#define VER_ILL_SID
Failure Codes of Service 3 (Housekeeping) for Service 1 (Request Verification)
Interface for accessing data pool items.
CrFwServType_t CrFwInCmdGetServType(FwSmDesc_t smDesc)
Return the type of the InCommand.
Definition: CrFwInCmd.c:337
Definition of the OutLoader component.
void setHkCreateCmdSCSampleRepNumItem(void *p, CrFwCounterU4_t NFA, CrPsRepNum_t SCSampleRepNum)
Set "SCSampleRepNum" in "HkCreateCmd" packet.
void CrPsHkCreateCmdStartAction(FwSmDesc_t smDesc)
Start action of the Command (3,1) to Create a Housekeeping Report Structure in-coming command packet...
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
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.
Definition of the InCommand Component of the framework.
Type for the data describing an OutManager.
static void setHkDeleteCmdN(void *p, CrFwCounterU4_t N)
Set "N" in "HkDeleteCmd" packet.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved