36 #include "FwSmConstants.h" 37 #include "FwSmDCreate.h" 38 #include "FwSmConfig.h" 40 #include "FwPrConstants.h" 41 #include "FwPrDCreate.h" 42 #include "FwPrConfig.h" 109 static void DoActionA(FwSmDesc_t smDesc);
117 static void DoActionB(FwSmDesc_t smDesc);
122 const FwSmCounterS1_t nOfStates = 2;
123 const FwSmCounterS1_t nOfChoicePseudoStates = 2;
124 const FwSmCounterS1_t nOfTrans = 8;
125 const FwSmCounterS1_t nOfActions = 2;
126 const FwSmCounterS1_t nOfGuards = 2;
127 const FwSmCounterS1_t CPS_1 = 1;
128 const FwSmCounterS1_t CPS_2 = 2;
130 FwPrDesc_t resetPr, execPr, initPr;
142 esm = FwSmCreate(nOfStates, nOfChoicePseudoStates, nOfTrans, nOfActions, nOfGuards);
145 FwSmAddChoicePseudoState(esm, CPS_1, 2);
146 FwSmAddChoicePseudoState(esm, CPS_2, 2);
147 FwSmAddTransIpsToCps(esm, CPS_1, NULL);
201 FwPrSetData(inStreamData[i].initProc, &inStreamData[i]);
202 FwPrSetData(inStreamData[i].resetProc, &inStreamData[i]);
214 if (inStreamCmpSpecificData[i].src == src)
235 cmpSpecificData->
pckt = NULL;
237 return cmpSpecificData->
pckt;
249 return cmpSpecificData->
src;
256 return cmpSpecificData->
seqCnt[group];
264 cmpSpecificData->
seqCnt[group] = seqCnt;
294 cmpSpecificData->
pckt = NULL;
296 cmpSpecificData->
seqCnt[i] = 0;
306 free(cmpSpecificData->
seqCnt);
307 cmpSpecificData->
seqCnt = NULL;
308 cmpSpecificData->
pckt = NULL;
344 if (cmpSpecificData->
seqCnt[group] != 0)
345 if ((cmpSpecificData->
seqCnt[group]+1) != seqCnt)
347 (cmpSpecificData->
seqCnt[group]+1), seqCnt, pckt);
349 cmpSpecificData->
seqCnt[group] = seqCnt;
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
CrFwPcktCollect_t collectPckt
Function which implements the Packet Collect Operation.
Type for the Framework Component Data (FCD).
CrFwCounterU1_t CrFwInStreamGetPcktQueueSize(FwSmDesc_t smDesc)
Return the size of the packet queue of the InStream.
Interface through which framework components access the current time.
void CrFwRepErrGroup(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwGroup_t group)
Report an error which has one single parameter attached to it representing a command or report group...
void CrFwPcktQueueReset(CrFwPcktQueue_t pcktQueue)
Reset the packet queue.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
CrFwBool_t CrFwPcktQueueIsEmpty(CrFwPcktQueue_t pcktQueue)
Return 1 if the packet queue is empty and 0 otherwise.
CrFwPckt_t CrFwPcktQueuePop(CrFwPcktQueue_t pcktQueue)
Pop a packet from the packet queue.
FwPrDesc_t CrFwCmpGetResetProc()
Retrieve the singleton instance of the CRP.
Definition of the Framework Component Data (FCD) Type.
CrFwDestSrc_t CrFwInStreamGetSrc(FwSmDesc_t smDesc)
Get the currently defined packet source of an InStream.
struct CrFwPcktQueue pcktQueue
Packet queue associated to the InStream.
#define CR_FW_INSTREAM_TR_GET_PCKT
Identifier for transition command "GetPacket" in the InStream State Machine.
static CrFwCmpData_t inStreamData[CR_FW_NOF_INSTREAM]
The data structures for the InStream State Machines and their Procedures.
CrFwBool_t CrFwInStreamIsInWaiting(FwSmDesc_t smDesc)
Return true if the argument InStream is in state WAITING.
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
#define CR_FW_HOST_APP_ID
The identifier of the host application.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
static FwPrAction_t inStreamInitAction[CR_FW_NOF_INSTREAM]
The functions implementing the initialization actions for the InStream components.
CrFwSeqCnt_t CrFwPcktGetSeqCnt(CrFwPckt_t pckt)
Return the sequence counter of the command or report encapsulated in a packet.
CrFwBool_t CrFwPcktQueuePush(CrFwPcktQueue_t pcktQueue, CrFwPckt_t pckt)
Push a packet onto the packet queue.
CrFwPckt_t(* CrFwPcktCollect_t)(CrFwDestSrc_t)
Type for a pointer to a function implementing the Packet Collect Operation of an InStream.
void CrFwBaseCmpDefConfigCheck(FwPrDesc_t prDesc)
Function which performs the default Configuration Check of the CRP.
void CrFwRepErrSeqCnt(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwSeqCnt_t expSeqCnt, CrFwSeqCnt_t actSeqCnt, CrFwPckt_t pckt)
Report an error which has two parameters attached to it representing expected and actual sequence cou...
static void DoActionA(FwSmDesc_t smDesc)
Function which performs Action A in the InStream State Machine.
void CrFwPcktQueueInit(CrFwPcktQueue_t pcktQueue, CrFwCounterU1_t size)
Initializes the packet queue.
#define CR_FW_INSTREAM_CONFIGCHECK
The functions implementing the Configuration Check of the InStream components.
#define CR_FW_INSTREAM_TYPE
Type identifier for the InStream components.
CrFwDestSrc_t CrFwPcktGetDest(CrFwPckt_t pckt)
Return the destination of the command or report encapsulated in a packet.
Type for the data describing an InStream.
Interface for creating and accessing a report or command packet.
static CrFwInStreamData_t inStreamCmpSpecificData[CR_FW_NOF_INSTREAM]
The component-specific data for the InStream State Machines and their Procedures. ...
Definition of the InStream component.
static CrFwPcktAvailCheck_t inStreamPcktAvailCheck[CR_FW_NOF_INSTREAM]
The functions implementing the packet available check operations for the InStream components...
#define CR_FW_INSTREAM_CONFIGACTION
The functions implementing the Configuration Action of the InStream components.
void CrFwBaseCmpDefShutdownAction(FwSmDesc_t smDesc)
Function which performs the Shutdown Action for the Base State Machine.
CrFwBool_t CrFwInStreamIsInPcktAvail(FwSmDesc_t smDesc)
Return true if the argument InStream is in state PCKT_AVAIL.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
FwPrDesc_t resetProc
The Component Reset Procedure (CRP) (see CrFwResetProc.h).
CrFwBool_t(* CrFwPcktAvailCheck_t)(CrFwDestSrc_t)
Type for a pointer to a function implementing the Packet Available Check Operation of an InStream...
CrFwSeqCnt_t * seqCnt
Array holding sequence counters for the groups associated to the InStream.
Dummy Component Execution Procedure (CEP) for the Base Component.
CrFwCounterU1_t CrFwInStreamGetNOfPendingPckts(FwSmDesc_t smDesc)
Return the number of packets currently in the packet queue of an InStream.
#define CR_FW_INSTREAM_NOF_GROUPS
The number of groups of the InStream components.
#define CR_FW_INSTREAM_PCKTCOLLECT
The functions implementing the Packet Collect Operations of the InStream components.
CrFwGroup_t CrFwInStreamGetNOfGroups(FwSmDesc_t smDesc)
Return the number of groups associated to the InStream.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
CrFwSeqCnt_t CrFwInStreamGetSeqCnt(FwSmDesc_t smDesc, CrFwGroup_t group)
Return the value of the sequence counter of the last packet successfully collected by the InStream fo...
static FwPrAction_t inStreamConfigCheck[CR_FW_NOF_INSTREAM]
The functions implementing the configuration checks for the InStream components.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
void CrFwPcktRelease(CrFwPckt_t pckt)
Release function for command or report packets.
void CrFwBaseCmpDefInitCheck(FwPrDesc_t prDesc)
Function which performs the default Initialization Check of the CIP.
CrFwCounterU1_t CrFwPcktQueueGetSize(CrFwPcktQueue_t pcktQueue)
Return the size of the packet queue.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
CrFwInstanceId_t instanceId
The instance identifier of the framework component.
void CrFwBaseCmpDefInitAction(FwPrDesc_t prDesc)
Function which performs the default Initialization Action of the CIP.
#define CR_FW_INSTREAM_TR_PACKET_AVAILABLE
Identifier for transition command "PacketAvailable" in the InStream State Machine.
CrFwPcktAvailCheck_t isPcktAvail
Function which implements the Packet Available Check Operation.
Interface for reporting an error detected by a framework component.
void CrFwInStreamDefInitAction(FwPrDesc_t prDesc)
Default initialization action for an InStream.
CrFwDestSrc_t src
Source associated to the InStream.
static FwSmDesc_t inStreamDesc[CR_FW_NOF_INSTREAM]
The descriptors of the InStream State Machines.
static FwSmAction_t inStreamShutdownAction[CR_FW_NOF_INSTREAM]
The functions implementing the shutdown actions for the InStream components.
#define CR_FW_INSTREAM_SRC
The packet source which is managed by the InStream component.
CrFwCounterU1_t CrFwPcktQueueGetNOfPckts(CrFwPcktQueue_t pcktQueue)
Return the number of packets currently in the packet queue.
Definition and management of packet queues.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrFwBaseCmpDefConfigAction(FwPrDesc_t prDesc)
Function which performs the default Configuration Action of the CRP.
An InStream has encountered a sequence counter error (see CrFwInStream.h)
Definition of the utility functions for the CORDET Framework.
static CrFwPcktCollect_t inStreamPcktCollect[CR_FW_NOF_INSTREAM]
The functions implementing the packet hand-over operations for the InStream components.
FwPrDesc_t execProc
The Component Execution Procedure (CEP) (see CrFwBaseCmp.h).
#define CR_FW_INSTREAM_SHUTDOWNACTION
The functions implementing the Shutdown Action of the InStream components.
FwSmDesc_t CrFwBaseCmpMake()
Retrieve the singleton instance of the Base State Machine.
static CrFwCounterU1_t inStreamPcktQueueSize[CR_FW_NOF_INSTREAM]
The sizes of the packet queues in the InStream components.
FwPrDesc_t CrFwBaseCmpGetDummyExecProc()
Retrieve the singleton instance of the Dummy CEP.
A framework function has been called with an illegal InStream identifier.
void CrFwInStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an InStream.
void CrFwInStreamSetSeqCnt(FwSmDesc_t smDesc, CrFwGroup_t group, CrFwSeqCnt_t seqCnt)
Overwrites the sequence counter value of the last packet for a group.
CrFwPckt_t pckt
The last packet to have been collected from the middleware.
static void DoActionB(FwSmDesc_t smDesc)
Function which performs Action b in the InStream State Machine.
#define CR_FW_NOF_INSTREAM
The number of InStream components in the application.
FwSmDesc_t CrFwInStreamGet(CrFwDestSrc_t src)
Getter function for the InStream corresponding to the argument source.
Definition of Base Component.
The packet queue of an InStream is full (see CrFwInStream.h)
void CrFwRepErr(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId)
Report an error which has no parameters attached to it.
#define CR_FW_INSTREAM_INITACTION
The functions implementing the Initialization Action of the InStream components.
static CrFwGroup_t inStreamNOfGroups[CR_FW_NOF_INSTREAM]
The number of groups associated to the InStream components.
Component Initialization Procedure (CIP) for the Base Component.
CrFwGroup_t CrFwPcktGetGroup(CrFwPckt_t pckt)
Return the group of the command/report encapsulated in a packet.
#define CR_FW_INSTREAM_PCKTAVAILCHECK
The functions implementing the Packet Available Check Operations of the InStream components.
#define CR_FW_INSTREAM_STATE_WAITING
State identifier for state WAITING in the InStream State Machine.
FwSmDesc_t CrFwInStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InStream State Machine instance.
CrFwTypeId_t typeId
The type identifier of the framework component.
void CrFwInStreamDefConfigAction(FwPrDesc_t prDesc)
Default configuration action for an InStream.
static int IsPcktQueueEmpty(FwSmDesc_t smDesc)
Function which checks if the packet queue is empty.
void CrFwInStreamPcktAvail(FwSmDesc_t smDesc)
Query the middleware for available packets and collect them if they are available.
#define CR_FW_BASE_STATE_CONFIGURED
State identifier for state CONFIGURED in the Base State Machine.
#define CR_FW_INSTREAM_STATE_PCKT_AVAIL
State identifier for state PCKT_AVAIL in the InStream State Machine.
CrFwPckt_t CrFwInStreamGetPckt(FwSmDesc_t smDesc)
Retrieve a packet from the InStream.
A framework function has been called with a source attribute which is not associated to any InStream...
User-modifiable parameters for the InStream components (see CrFwInStream.h).
static FwPrAction_t inStreamConfigAction[CR_FW_NOF_INSTREAM]
The functions implementing the configuration actions for the InStream components. ...
FwPrDesc_t CrFwCmpGetInitProc()
Retrieve the singleton instance of the CIP.
void CrFwPcktQueueShutdown(CrFwPcktQueue_t pcktQueue)
Shutdown the packet queue.
static FwPrAction_t inStreamInitCheck[CR_FW_NOF_INSTREAM]
The functions implementing the initialization checks for the InStream components. ...
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
#define CR_FW_INSTREAM_PQSIZE
The sizes of the packet queues in the InStream components.
static FwSmDesc_t baseInStreamSmDesc
Base InStream from which all other InStreams are derived.
Component Reset Procedure (CRP) for the Base Component.
An incoming command or report has an illegal group.
FwPrDesc_t initProc
The Component Initialization Procedure (CIP) (see CrFwInitProc.h).
static CrFwDestSrc_t inStreamSrc[CR_FW_NOF_INSTREAM]
The sources associated to the InStream components.
#define CR_FW_INSTREAM_INITCHECK
The functions implementing the Initialization Check of the InStream components.
static int IsPcktAvail(FwSmDesc_t smDesc)
Function which checks if a packet is available.