CORDET Framework - C2 Implementation
CrFwOutLoaderTestCases.c
Go to the documentation of this file.
1 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include "CrFwOutLoaderTestCases.h"
22 /* Include FW Profile files */
23 #include "FwSmConstants.h"
24 #include "FwSmConfig.h"
25 #include "FwSmCore.h"
26 #include "FwPrConfig.h"
27 #include "FwPrCore.h"
28 #include "FwPrConstants.h"
29 /* Include framework files */
31 #include "BaseCmp/CrFwBaseCmp.h"
32 #include "Pckt/CrFwPckt.h"
33 #include "OutCmp/CrFwOutCmp.h"
36 #include "CrFwTime.h"
37 #include "CrFwRepErr.h"
39 /* Include configuration files */
40 #include "CrFwOutRegistryUserPar.h"
41 #include "CrFwOutManagerUserPar.h"
42 #include "CrFwRepErrStub.h"
43 #include "CrFwOutFactoryUserPar.h"
44 #include "CrFwCmpData.h"
45 
46 /* ---------------------------------------------------------------------------------------------*/
48  FwSmDesc_t outManager1, outLoader, outFactory, outLoader2;
49  FwSmDesc_t outCmp, outCmp1, outCmp2, outCmp3, outCmp4;
51 
52  /* Instantiate the OutLoader */
54 
55  /* Check current state of OutLoader */
57  return 0;
58 
59  /* Initialize and Configure OutLoader and check success */
62  return 0;
65  return 0;
66 
67  /* Instantiate OutLoader a second time and check that it is the same as the first instance */
68  outLoader2 = CrFwOutLoaderMake();
69  if (outLoader != outLoader2)
70  return 0;
71 
72  /* Check Instance and Type Identifiers */
74  return 0;
76  return 0;
77 
78  /* Initialize and Configure OutManager and check success */
79  outManager1 = CrFwOutManagerMake(0);
80  CrFwCmpInit(outManager1);
81  CrFwCmpReset(outManager1);
82  if (!CrFwCmpIsInConfigured(outManager1))
83  return 0;
84 
86  return 0;
87 
88  /* Initialize and Configure OutFactory and check success */
93  return 0;
94 
95  /* Allocate an OutComponent */
97 
98  /* Check that there are no pending OutComponents in OutManager */
99  if (CrFwOutManagerGetNOfPendingOutCmp(outManager1) != 0)
100  return 0;
101 
102  /* Load OutComponent in OutLoader and check success */
103  if (CrFwOutLoaderLoad(outCmp) != 1)
104  return 0;
105  if (CrFwOutManagerGetNOfPendingOutCmp(outManager1) != 1)
106  return 0;
107 
108  if (CrFwGetAppErrCode() != crNoAppErr)
109  return 0;
110 
111  /* Fill up the OutManager so that its POCL becomes full
112  * (we assume the POCL to have a size of 4, see: CR_FW_NOF_OUTMANAGER) */
113  outCmp1 = CrFwOutFactoryMakeOutCmp(1,1,0,0);
114  outCmp2 = CrFwOutFactoryMakeOutCmp(1,1,0,0);
115  outCmp3 = CrFwOutFactoryMakeOutCmp(1,1,0,0);
116  CrFwOutManagerLoad(outManager1, outCmp1);
117  CrFwOutManagerLoad(outManager1, outCmp2);
118  CrFwOutManagerLoad(outManager1, outCmp3);
119 
120  /* Create one more OutComponent and attempt to load it and then verify
121  * that the attempt fails and the OutComponent is released */
122  outCmp4 = CrFwOutFactoryMakeOutCmp(1,1,0,0);
124  if (CrFwOutLoaderLoad(outCmp4) != 0)
125  return 0;
127  return 0;
128 
129  /* Reset OutManager */
130  CrFwCmpReset(outManager1);
131 
132  /* Check that there are no allocated OutComponents */
134  return 0;
135 
136  /* Check that there are no allocated packets */
137  if (CrFwPcktGetNOfAllocated() != 0)
138  return 0;
139 
140  /* Check application errors */
141  if (CrFwGetAppErrCode() != crNoAppErr)
142  return 0;
143 
144  return 1;
145 }
146 
147 
CrFwInstanceId_t CrFwCmpGetInstanceId(FwSmDesc_t smDesc)
Return the instance identifier of the argument component.
Definition: CrFwBaseCmp.c:150
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
CrFwBool_t CrFwCmpIsInInitialized(FwSmDesc_t smDesc)
Return true if the argument component is in state INITIALIZED.
Definition: CrFwBaseCmp.c:172
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
CrFwBool_t CrFwCmpIsInCreated(FwSmDesc_t smDesc)
Return true if the argument component is in state CREATED.
Definition: CrFwBaseCmp.c:167
CrFwTypeId_t CrFwCmpGetTypeId(FwSmDesc_t smDesc)
Return the type identifier of the argument component.
Definition: CrFwBaseCmp.c:156
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
#define CR_FW_OUTLOADER_TYPE
Type identifier for the OutLoader component.
Definition of the OutComponent Component of the framework.
CrFwOutFactoryPoolIndex_t CrFwOutFactoryGetNOfAllocatedOutCmp()
Return the number of OutComponents which are currently allocated.
static FwSmDesc_t outFactory
The singleton instance of the OutFactory.
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
FwSmDesc_t CrFwOutFactoryMake()
Factory function for the singleton instance of the OutFactory.
static FwSmDesc_t outCmp[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The pre-allocated OutComponent instances.
Definition of the OutFactory component.
User-modifiable parameters for the OutFactory component (see CrFwOutFactory.h).
static FwSmDesc_t outLoader
Descriptor of the OutLoader Singleton.
Definition: CrFwOutLoader.c:47
FwSmDesc_t CrFwOutLoaderMake()
Factory function to retrieve the OutLoader State Machine instance.
Definition: CrFwOutLoader.c:75
CrFwBool_t CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
Definition of the OutLoader component.
CrFwBool_t CrFwOutLoaderTestCase1()
Check the configuration and operation of the OutLoader.
Declaration of the test cases for the OutLoader Component (see CrFwOutLoader.h).
CrFwCounterU1_t CrFwOutManagerGetNOfPendingOutCmp(FwSmDesc_t smDesc)
Return the number of OutComponents currently in the POCL of an OutManager.
CrFwBool_t CrFwOutManagerLoad(FwSmDesc_t smDesc, FwSmDesc_t outCmp)
Load a new OutComponent into the OutManager.
FwSmDesc_t CrFwOutManagerMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th OutManager State Machine instance.
User-modifiable parameters for the OutManager components (see CrFwOutManager.h).
Definition of the OutRegistry Component.
User-modifiable parameters for the OutRegistry component (see CrFwOutRegistry.h).
Interface for creating and accessing a report or command packet.
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
Definition: CrFwPckt.c:214
Interface for reporting an error detected by a framework component.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr....
Interface through which framework components access the current time.
unsigned char CrFwOutFactoryPoolIndex_t
Type for the index in the pool of pre-allocated OutComponents in the OutFactory (see CrFwOutFactory....
@ crNoAppErr
No application errors have been detected.
CrFwAppErrCode_t CrFwGetAppErrCode()
Return the value of the application error code.
Definition of the utility functions for the CORDET Framework.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved