CORDET Framework - C2 Implementation
CrFwOutLoader.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include configuration files */
21 #include "CrFwOutLoaderUserPar.h"
22 #include "CrFwCmpData.h"
23 /* Include framework files */
24 #include "CrFwConstants.h"
25 #include "CrFwRepErr.h"
26 #include "CrFwTime.h"
27 #include "CrFwOutLoader.h"
28 #include "BaseCmp/CrFwBaseCmp.h"
29 #include "BaseCmp/CrFwInitProc.h"
30 #include "BaseCmp/CrFwResetProc.h"
32 #include "Pckt/CrFwPckt.h"
33 #include "Pckt/CrFwPcktQueue.h"
36 /* Include FW Profile files */
37 #include "FwSmConstants.h"
38 #include "FwSmDCreate.h"
39 #include "FwSmConfig.h"
40 #include "FwSmCore.h"
41 #include "FwPrConstants.h"
42 #include "FwPrDCreate.h"
43 #include "FwPrConfig.h"
44 #include "FwPrCore.h"
45 
47 static FwSmDesc_t outLoader = NULL;
48 
51 
54 
57 
59 static FwPrAction_t initCheck = CR_FW_OUTLOADER_INITCHECK;
60 
62 static FwPrAction_t initAction = CR_FW_OUTLOADER_INITACTION;
63 
66 
69 
72 
73 
74 /*-----------------------------------------------------------------------------------------*/
75 FwSmDesc_t CrFwOutLoaderMake() {
76  FwPrDesc_t resetPr, execPr, initPr;
77 
78  if (outLoader != NULL) {
79  return outLoader; /* The requested SM has already been created */
80  }
81 
82  /* Create the requested SM as an extension of the Base Component SM */
83  outLoader = FwSmCreateDer(CrFwBaseCmpMake());
84 
85  /* Create the Reset Procedure for the OutLoader Component */
86  resetPr = FwPrCreateDer(CrFwCmpGetResetProc());
87  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefConfigCheck, configCheck);
88  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefConfigAction, configAction);
89 
90  /* Create the Initialization Procedure for the OutLoader Component */
91  initPr = FwPrCreateDer(CrFwCmpGetInitProc());
92  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefInitCheck, initCheck);
93  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefInitAction, initAction);
94 
95  /* Get the Dummy Execution Procedure for the OutLoader Component */
96  execPr = CrFwBaseCmpGetDummyExecProc();
97 
98  /* Override the Shutdown Action for the OutStream Component */
100 
101  /* Initialize the data for the requested SM */
102  outLoaderData.outcome = 1;
103  outLoaderData.initProc = initPr;
104  outLoaderData.resetProc = resetPr;
105  outLoaderData.execProc = execPr;
106  outLoaderData.instanceId = 0;
107  outLoaderData.typeId = CR_FW_OUTLOADER_TYPE;
108 
109  /* Attach the data to the OutLoader state machine and to its procedures. */
110  FwSmSetData(outLoader, &outLoaderData);
111  FwPrSetData(outLoaderData.initProc, &outLoaderData);
112  FwPrSetData(outLoaderData.resetProc, &outLoaderData);
113 
114  /* Start the OutLoader */
115  FwSmStart(outLoader);
116 
117  return outLoader;
118 }
119 
120 /*-----------------------------------------------------------------------------------------*/
122  FwSmDesc_t selectedOutManager;
123 
124  selectedOutManager = outManagerSelect(outCmp);
125  if (CrFwOutManagerLoad(selectedOutManager, outCmp) == 1) {
126  outManagerActivate(selectedOutManager);
127  return 1;
128  } else
129  return 0;
130 }
131 
132 /*-----------------------------------------------------------------------------------------*/
133 FwSmDesc_t CrFwOutLoaderDefOutManagerSelect(FwSmDesc_t outCmp) {
134  CRFW_UNUSED(outCmp);
135  return CrFwOutManagerMake(0);
136 }
137 
138 /*-----------------------------------------------------------------------------------------*/
139 void CrFwOutLoadDefOutManagerActivate(FwSmDesc_t outManager) {
140  CRFW_UNUSED(outManager);
141  return;
142 }
143 
void(* CrFwOutManagerActivate_t)(FwSmDesc_t outManager)
Type for a pointer to a function implementing the OutManager Activation Operation.
Definition: CrFwOutLoader.h:92
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
Interface through which framework components access the current time.
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
Definition: CrFwCmpData.h:93
static FwPrAction_t initCheck
The function implementing the Initialization Check.
Definition: CrFwOutLoader.c:59
FwPrDesc_t CrFwCmpGetResetProc()
Retrieve the singleton instance of the CRP.
Definition: CrFwResetProc.c:45
Definition of the Framework Component Data (FCD) Type.
#define CR_FW_OUTLOADER_OUTMANAGER_SELECT
The function implementing the OutManager Selection Operation for the OutLoader.
static FwSmAction_t shutdownAction
The function implementing the Shutdown Action.
Definition: CrFwOutLoader.c:71
static FwSmDesc_t outCmp[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The pre-allocated OutComponent instances.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:29
static CrFwCmpData_t outLoaderData
The data structure for the OutLoader Singleton.
Definition: CrFwOutLoader.c:50
static FwPrAction_t initAction
The function implementing the Initialization Action.
Definition: CrFwOutLoader.c:62
FwSmDesc_t(* CrFwOutManagerSelect_t)(FwSmDesc_t outCmp)
Type for a pointer to a function implementing the OutManager Selection Operation. ...
Definition: CrFwOutLoader.h:84
void CrFwBaseCmpDefConfigCheck(FwPrDesc_t prDesc)
Function which performs the default Configuration Check of the CRP.
Definition: CrFwResetProc.c:33
#define CR_FW_OUTLOADER_SHUTDOWNACTION
The function implementing the Shutdown Action of the OutLoader component.
static FwSmDesc_t outLoader
Descriptor of the OutLoader Singleton.
Definition: CrFwOutLoader.c:47
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 CrFwBaseCmpDefShutdownAction(FwSmDesc_t smDesc)
Function which performs the Shutdown Action for the Base State Machine.
Definition: CrFwBaseCmp.c:217
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
FwPrDesc_t resetProc
The Component Reset Procedure (CRP) (see CrFwResetProc.h).
Definition: CrFwCmpData.h:97
Dummy Component Execution Procedure (CEP) for the Base Component.
void CrFwOutLoadDefOutManagerActivate(FwSmDesc_t outManager)
Default implementation of the OutManager Activation Operation.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
void CrFwBaseCmpDefInitCheck(FwPrDesc_t prDesc)
Function which performs the default Initialization Check of the CIP.
Definition: CrFwInitProc.c:36
#define CR_FW_OUTLOADER_TYPE
Type identifier for the OutLoader component.
CrFwInstanceId_t instanceId
The instance identifier of the framework component.
Definition: CrFwCmpData.h:81
void CrFwBaseCmpDefInitAction(FwPrDesc_t prDesc)
Function which performs the default Initialization Action of the CIP.
Definition: CrFwInitProc.c:42
Interface for reporting an error detected by a framework component.
static CrFwOutManagerActivate_t outManagerActivate
The function implementing the OutManager Activation Operation.
Definition: CrFwOutLoader.c:56
static CrFwOutManagerSelect_t outManagerSelect
The function implementing the OutManager Selection Operation.
Definition: CrFwOutLoader.c:53
Definition and management of packet queues.
FwSmDesc_t CrFwOutLoaderMake()
Factory function to retrieve the OutLoader State Machine instance.
Definition: CrFwOutLoader.c:75
void CrFwBaseCmpDefConfigAction(FwPrDesc_t prDesc)
Function which performs the default Configuration Action of the CRP.
Definition: CrFwResetProc.c:39
User-modifiable parameters for the OutLoader component (see CrFwOutLoader.h).
Definition of the utility functions for the CORDET Framework.
static FwPrAction_t configAction
The function implementing the Configuration Action.
Definition: CrFwOutLoader.c:68
FwPrDesc_t execProc
The Component Execution Procedure (CEP) (see CrFwBaseCmp.h).
Definition: CrFwCmpData.h:99
FwSmDesc_t CrFwBaseCmpMake()
Retrieve the singleton instance of the Base State Machine.
Definition: CrFwBaseCmp.c:77
FwPrDesc_t CrFwBaseCmpGetDummyExecProc()
Retrieve the singleton instance of the Dummy CEP.
static FwPrAction_t configCheck
The function implementing the Configuration Check.
Definition: CrFwOutLoader.c:65
#define CR_FW_OUTLOADER_INITCHECK
The function implementing the Initialization Check of the OutLoader component.
#define CR_FW_OUTLOADER_CONFIGACTION
The function implementing the Configuration Action of the OutLoader component.
Definition of Base Component.
Component Initialization Procedure (CIP) for the Base Component.
FwSmDesc_t CrFwOutLoaderDefOutManagerSelect(FwSmDesc_t outCmp)
Default implementation of the OutManager Selection Operation.
Definition of the OutManager component.
CrFwTypeId_t typeId
The type identifier of the framework component.
Definition: CrFwCmpData.h:83
#define CR_FW_OUTLOADER_INITACTION
The function implementing the Initialization Action of the OutLoader component.
#define CR_FW_OUTLOADER_OUTMANAGER_ACTIVATE
The function implementing the OutManager Activation Operation for the OutLoader.
CrFwBool_t CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
Definition of the OutLoader component.
FwPrDesc_t CrFwCmpGetInitProc()
Retrieve the singleton instance of the CIP.
Definition: CrFwInitProc.c:48
CrFwBool_t CrFwOutManagerLoad(FwSmDesc_t smDesc, FwSmDesc_t outCmp)
Load a new OutComponent into the OutManager.
Component Reset Procedure (CRP) for the Base Component.
FwPrDesc_t initProc
The Component Initialization Procedure (CIP) (see CrFwInitProc.h).
Definition: CrFwCmpData.h:95
#define CR_FW_OUTLOADER_CONFIGCHECK
The function implementing the Configuration Check of the OutLoader component.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved