CORDET Framework - C2 Implementation
CrFwInRep.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include configuration files */
21 #include "CrFwCmpData.h"
22 /* Include framework files */
23 #include "CrFwConstants.h"
24 #include "CrFwRepErr.h"
26 #include "InRep/CrFwInRep.h"
27 #include "BaseCmp/CrFwBaseCmp.h"
28 #include "BaseCmp/CrFwInitProc.h"
29 #include "BaseCmp/CrFwResetProc.h"
32 #include "Pckt/CrFwPckt.h"
33 /* Include FW Profile files */
34 #include "FwPrConfig.h"
35 #include "FwPrDCreate.h"
36 #include "FwSmConfig.h"
37 #include "FwSmDCreate.h"
38 #include "FwPrCore.h"
39 
40 /* --------------------------------------------------------------------------------- */
41 CrFwDestSrc_t CrFwInRepGetSrc(FwSmDesc_t smDesc) {
42  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
43  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
44 
45  return CrFwPcktGetSrc(cmpSpecificData->pckt);
46 }
47 
48 /* --------------------------------------------------------------------------------- */
49 CrFwGroup_t CrFwInRepGetGroup(FwSmDesc_t smDesc) {
50  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
51  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
52 
53  return CrFwPcktGetGroup(cmpSpecificData->pckt);
54 }
55 
56 /* --------------------------------------------------------------------------------- */
58  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
59  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
60 
61  return CrFwPcktGetServType(cmpSpecificData->pckt);
62 }
63 
64 /* --------------------------------------------------------------------------------- */
66  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
67  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
68 
69  return CrFwPcktGetServSubType(cmpSpecificData->pckt);
70 }
71 
72 /* --------------------------------------------------------------------------------- */
74  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
75  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
76 
77  return CrFwPcktGetDiscriminant(cmpSpecificData->pckt);
78 }
79 
80 /* --------------------------------------------------------------------------------- */
81 CrFwSeqCnt_t CrFwInRepGetSeqCnt(FwSmDesc_t smDesc) {
82  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
83  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
84 
85  return CrFwPcktGetSeqCnt(cmpSpecificData->pckt);
86 }
87 
88 /* --------------------------------------------------------------------------------- */
89 CrFwPckt_t CrFwInRepGetParStart(FwSmDesc_t smDesc) {
90  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
91  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
92  return CrFwPcktGetParStart(cmpSpecificData->pckt);
93 }
94 
95 /* --------------------------------------------------------------------------------- */
97  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
98  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
99  return CrFwPcktGetParLength(cmpSpecificData->pckt);
100 }
101 
102 /* --------------------------------------------------------------------------------- */
103 void CrFwInRepConfigCheck(FwPrDesc_t prDesc) {
104  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwPrGetData(prDesc);
105  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
106 
107  if (cmpSpecificData->isValid(prDesc) == 1)
108  cmpData->outcome = 1;
109  else
110  cmpData->outcome = 0;
111 }
112 
113 /* --------------------------------------------------------------------------------- */
114 CrFwPckt_t CrFwInRepGetPckt(FwSmDesc_t smDesc) {
115  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
116  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
117  return cmpSpecificData->pckt;
118 }
119 
120 /* --------------------------------------------------------------------------------- */
122  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwPrGetData(prDesc);
123  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(cmpData->cmpSpecificData);
124  return cmpSpecificData->pckt;
125 
126 }
127 
128 /* --------------------------------------------------------------------------------- */
130  CrFwCmpData_t* cmpData = FwPrGetData(prDesc);
132  CrFwPckt_t pckt = inRepData->pckt;
133  return (CrFwPcktGetCrc(pckt) == CrFwPcktComputeCrc(pckt));
134 }
CrFwPcktLength_t CrFwInRepGetParLength(FwSmDesc_t smDesc)
Return the length in bytes of the parameter area of the InReport.
Definition: CrFwInRep.c:96
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
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
Definition of the Framework Component Data (FCD) Type.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
CrFwPckt_t CrFwPcktGetParStart(CrFwPckt_t pckt)
Return the start address of the packet&#39;s parameter area.
Definition: CrFwPckt.c:382
CrFwServType_t CrFwPcktGetServType(CrFwPckt_t pckt)
Return the service type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:291
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:327
CrFwSeqCnt_t CrFwPcktGetSeqCnt(CrFwPckt_t pckt)
Return the sequence counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:223
Definition of the OutFactory component.
CrFwSeqCnt_t CrFwInRepGetSeqCnt(FwSmDesc_t smDesc)
Return the sequence counter of the InReport.
Definition: CrFwInRep.c:81
CrFwServType_t CrFwInRepGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the InReport.
Definition: CrFwInRep.c:65
void CrFwInRepConfigCheck(FwPrDesc_t prDesc)
Configuration check for an InReport.
Definition: CrFwInRep.c:103
Type for the data describing an InReport.
Interface for creating and accessing a report or command packet.
CrFwCrc_t CrFwPcktGetCrc(CrFwPckt_t pckt)
Return the CRC of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:263
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
Dummy Component Execution Procedure (CEP) for the Base Component.
CrFwPckt_t pckt
Packet holding the InReport.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
CrFwGroup_t CrFwInRepGetGroup(FwSmDesc_t smDesc)
Return the group of the InReport.
Definition: CrFwInRep.c:49
CrFwCrc_t CrFwPcktComputeCrc(CrFwPckt_t pckt)
Compute the CRC in the command or report encapsulated in a packet.
Definition: CrFwPckt.c:247
Header file to define all invariant publicly available constants and types for the CORDET Framework...
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Interface for reporting an error detected by a framework component.
static CrFwCmpData_t inRepData[CR_FW_INFACTORY_MAX_NOF_INREP]
The base data for the pre-allocated InReport instances.
Definition: CrFwInFactory.c:70
Definition of the InReport Component of the framework.
CrFwPckt_t CrFwInRepGetParStart(FwSmDesc_t smDesc)
Return the start address of the parameter area of the InReport.
Definition: CrFwInRep.c:89
CrFwDiscriminant_t CrFwPcktGetDiscriminant(CrFwPckt_t pckt)
Return the discriminant of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:273
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Definition: CrFwCmpData.h:101
CrFwPckt_t CrFwInRepGetPckt(FwSmDesc_t smDesc)
Return the pointer to the packet which holds the InReport.
Definition: CrFwInRep.c:114
CrFwBool_t CrFwInRepDefValidityCheck(FwPrDesc_t prDesc)
Default implementation of the validity check of an InReport.
Definition: CrFwInRep.c:129
Definition of the utility functions for the CORDET Framework.
CrFwServSubType_t CrFwPcktGetServSubType(CrFwPckt_t pckt)
Return the service sub-type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:303
CrFwServType_t CrFwInRepGetServType(FwSmDesc_t smDesc)
Return the type of the InReport.
Definition: CrFwInRep.c:57
Definition of Base Component.
Component Initialization Procedure (CIP) for the Base Component.
CrFwDestSrc_t CrFwInRepGetSrc(FwSmDesc_t smDesc)
Return the source of the InReport.
Definition: CrFwInRep.c:41
CrFwGroup_t CrFwPcktGetGroup(CrFwPckt_t pckt)
Return the group of the command/report encapsulated in a packet.
Definition: CrFwPckt.c:398
unsigned short int CrFwPcktLength_t
Type for the packet length.
CrFwPcktLength_t CrFwPcktGetParLength(CrFwPckt_t pckt)
Return the length in bytes of the packet&#39;s parameter area.
Definition: CrFwPckt.c:387
CrFwInRepValidityCheck_t isValid
Function which implements the Validity Check for the InReport.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
CrFwDiscriminant_t CrFwInRepGetDiscriminant(FwSmDesc_t smDesc)
Return the discriminant of the InReport.
Definition: CrFwInRep.c:73
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
Component Reset Procedure (CRP) for the Base Component.
CrFwPckt_t CrFwInRepGetPcktFromPrDesc(FwPrDesc_t prDesc)
Convenience function to extract the InReport&#39;s packet from the descriptor of the InReport&#39;s execution...
Definition: CrFwInRep.c:121
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved