CORDET Framework - C2 Implementation
cordetfw/tests/config/CrFwRepErr.c
Go to the documentation of this file.
1 
32 #include <stdlib.h>
33 /* Include Framework Files */
34 #include "CrFwConstants.h"
35 #include "CrFwRepErr.h"
36 /* Include Configuration Files */
37 #include "CrFwRepErrStub.h"
38 
40 #define CR_FW_ERR_REP_ARRAY_SIZE 100
41 
43 #define CR_FW_ERR_REP_PAR_SIZE 12
44 
53 typedef struct {
62 } CrFwErrRep_t;
63 
66 
69 
70 /*-----------------------------------------------------------------------------------------*/
72  return errRepPos;
73 }
74 
75 /*-----------------------------------------------------------------------------------------*/
77  errRepPos = 0;
78 }
79 
80 /*-----------------------------------------------------------------------------------------*/
81 void CrFwRepErr(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId) {
83 
84  errRepArray[errRepPos].errCode = errCode;
85  errRepArray[errRepPos].instanceId = instanceId;
86  errRepArray[errRepPos].typeId = typeId;
87  for (i=0; i<CR_FW_ERR_REP_PAR_SIZE; i++)
88  errRepArray[errRepPos].par[i] = 0;
89 
91 }
92 
93 /*-----------------------------------------------------------------------------------------*/
95  CrFwDestSrc_t destSrc) {
97 
98  errRepArray[errRepPos].errCode = errCode;
99  errRepArray[errRepPos].instanceId = instanceId;
100  errRepArray[errRepPos].typeId = typeId;
101  errRepArray[errRepPos].par[0] = destSrc;
102  for (i=1; i<CR_FW_ERR_REP_PAR_SIZE; i++)
103  errRepArray[errRepPos].par[i] = 0;
104 
106 }
107 
108 /*-----------------------------------------------------------------------------------------*/
110  CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId,
112  CrFwCounterU1_t i;
113 
114  errRepArray[errRepPos].errCode = errCode;
115  errRepArray[errRepPos].instanceId = instanceId;
116  errRepArray[errRepPos].typeId = typeId;
117  errRepArray[errRepPos].par[0] = dest;
118  errRepArray[errRepPos].par[1] = (CrFwCounterU1_t)(secondaryInstanceId % 256);
119  errRepArray[errRepPos].par[2] = (CrFwCounterU1_t)(secondaryInstanceId >> 8);
120  for (i=3; i<CR_FW_ERR_REP_PAR_SIZE; i++)
121  errRepArray[errRepPos].par[i] = pckt[i];
122 
123 
125 }
126 
127 /*-----------------------------------------------------------------------------------------*/
129  CrFwGroup_t group) {
130  CrFwCounterU1_t i;
131 
132  errRepArray[errRepPos].errCode = errCode;
133  errRepArray[errRepPos].instanceId = instanceId;
134  errRepArray[errRepPos].typeId = typeId;
135  errRepArray[errRepPos].par[0] = group;
136  for (i=1; i<CR_FW_ERR_REP_PAR_SIZE; i++)
137  errRepArray[errRepPos].par[i] = 0;
138 
140 }
141 
142 /*-----------------------------------------------------------------------------------------*/
144  CrFwSeqCnt_t expSeqCnt, CrFwSeqCnt_t actSeqCnt, CrFwPckt_t pckt) {
145  CrFwCounterU1_t i;
146  CrFwSeqCnt_t temp;
147 
148  errRepArray[errRepPos].errCode = errCode;
149  errRepArray[errRepPos].instanceId = instanceId;
150  errRepArray[errRepPos].typeId = typeId;
151  temp = expSeqCnt;
152  errRepArray[errRepPos].par[0] = temp % 256;
153  temp = temp >> 8;
154  errRepArray[errRepPos].par[1] = temp % 256;
155  temp = temp >> 8;
156  errRepArray[errRepPos].par[2] = temp % 256;
157  temp = temp >> 8;
158  errRepArray[errRepPos].par[3] = temp % 256;
159  temp = actSeqCnt;
160  errRepArray[errRepPos].par[4] = temp % 256;
161  temp = temp >> 8;
162  errRepArray[errRepPos].par[5] = temp % 256;
163  temp = temp >> 8;
164  errRepArray[errRepPos].par[6] = temp % 256;
165  temp = temp >> 8;
166  errRepArray[errRepPos].par[7] = temp % 256;
167 
168  for (i=8; i<CR_FW_ERR_REP_PAR_SIZE; i++)
169  errRepArray[errRepPos].par[i] = pckt[i];
170 
172 }
173 
174 /*-----------------------------------------------------------------------------------------*/
176  CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId,
177  CrFwOutcome_t outcome) {
178  CrFwCounterU1_t i;
179 
180  errRepArray[errRepPos].errCode = errCode;
181  errRepArray[errRepPos].instanceId = instanceId;
182  errRepArray[errRepPos].typeId = typeId;
183  errRepArray[errRepPos].par[0] = outcome;
184  errRepArray[errRepPos].par[1] = (CrFwCounterU1_t)(secondaryInstanceId % 256);
185  errRepArray[errRepPos].par[2] = (CrFwCounterU1_t)(secondaryInstanceId >> 8);
186  for (i=3; i<CR_FW_ERR_REP_PAR_SIZE; i++)
187  errRepArray[errRepPos].par[i] = 255;
188 
190 }
191 
192 /*-----------------------------------------------------------------------------------------*/
194  CrFwInstanceId_t instanceId, CrFwPckt_t pckt) {
195  CrFwCounterU1_t i;
196 
197  errRepArray[errRepPos].errCode = errCode;
198  errRepArray[errRepPos].instanceId = instanceId;
199  errRepArray[errRepPos].typeId = typeId;
200  for (i=0; i<CR_FW_ERR_REP_PAR_SIZE; i++)
201  errRepArray[errRepPos].par[i] = pckt[i];
202 
204 }
205 
206 /*-----------------------------------------------------------------------------------------*/
208  CrFwInstanceId_t instanceId, FwSmDesc_t rep) {
209  CrFwCounterU1_t i;
210  FwSmDesc_t* temp = NULL;
211 
212  errRepArray[errRepPos].errCode = errCode;
213  errRepArray[errRepPos].instanceId = instanceId;
214  errRepArray[errRepPos].typeId = typeId;
215  temp = (FwSmDesc_t*)&errRepArray[errRepPos].par[0]; /* Load address of rep in first 4 elements of par[] */
216  *temp = rep;
217  for (i=4; i<CR_FW_ERR_REP_PAR_SIZE; i++)
218  errRepArray[errRepPos].par[i] = 255;
219 
221 }
222 
223 /*-----------------------------------------------------------------------------------------*/
225  CrFwInstanceId_t instanceId, FwSmDesc_t cmd) {
226  CrFwCounterU1_t i;
227  FwSmDesc_t* temp = NULL;
228 
229  errRepArray[errRepPos].errCode = errCode;
230  errRepArray[errRepPos].instanceId = instanceId;
231  errRepArray[errRepPos].typeId = typeId;
232  temp = (FwSmDesc_t*)&errRepArray[errRepPos].par[0]; /* Load address of cmd in first 4 elements of par[] */
233  *temp = cmd;
234  for (i=4; i<CR_FW_ERR_REP_PAR_SIZE; i++)
235  errRepArray[errRepPos].par[i] = 255;
236 
238 }
239 
240 /*-----------------------------------------------------------------------------------------*/
244  CrFwCounterU1_t i;
245 
246  errRepArray[errRepPos].errCode = errCode;
247  errRepArray[errRepPos].instanceId = instanceId;
248  errRepArray[errRepPos].typeId = typeId;
249  errRepArray[errRepPos].par[0] = (CrFwCounterU1_t)(servType % 256);;
250  errRepArray[errRepPos].par[1] = (CrFwCounterU1_t)(servSubType % 256);
251  errRepArray[errRepPos].par[2] = (CrFwCounterU1_t)(disc % 256);
252  for (i=3; i<CR_FW_ERR_REP_PAR_SIZE; i++)
253  errRepArray[errRepPos].par[i] = 255;
254 
256 }
257 
258 /*-----------------------------------------------------------------------------------------*/
260  return errRepArray[errRepPos].errCode;
261 }
262 
263 /*-----------------------------------------------------------------------------------------*/
265  return errRepArray[errRepPos].typeId;
266 }
267 
268 /*-----------------------------------------------------------------------------------------*/
270  return errRepArray[errRepPos].instanceId;
271 }
272 
273 /*-----------------------------------------------------------------------------------------*/
275  return errRepArray[errRepPos].par;
276 }
277 
278 /*-----------------------------------------------------------------------------------------*/
280  return errRepArray[errRepPos].par[0];
281 }
282 
283 /*-----------------------------------------------------------------------------------------*/
285  return (CrFwSeqCnt_t)(errRepArray[errRepPos].par[0]+errRepArray[errRepPos].par[1]*256+
286  errRepArray[errRepPos].par[2]*(65536)+errRepArray[errRepPos].par[3]*(16777216));
287 }
288 
289 /*-----------------------------------------------------------------------------------------*/
291  return (CrFwSeqCnt_t)(errRepArray[errRepPos].par[4]+errRepArray[errRepPos].par[5]*256+
292  errRepArray[errRepPos].par[6]*(65536)+errRepArray[errRepPos].par[7]*(16777216));
293 }
294 
295 /*-----------------------------------------------------------------------------------------*/
297  return (CrFwInstanceId_t)(errRepArray[errRepPos].par[1]+256*errRepArray[errRepPos].par[2]);
298 }
299 
300 /*-----------------------------------------------------------------------------------------*/
302  return errRepArray[errRepPos].par[0];
303 }
304 
static CrFwCounterU2_t errRepPos
The position in the error report array at which the next error report will be written.
CrFwDestSrc_t CrFwRepErrStubGetDest(CrFwCounterU2_t errRepPos)
Return the destination associated to the error report at position errRepPos.
CrFwPckt_t * pckt
The list of packets in the PQ.
CrFwInstanceId_t CrFwRepErrStubGetInstanceId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
unsigned short int CrFwTypeId_t
Type used for the identifier of a component type.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
CrFwInstanceId_t CrFwRepErrStubGetSecondatyInstanceId(CrFwCounterU2_t errRepPos)
Return the secondary instance identifier associated to the error report at position errRepPos...
CrFwSeqCnt_t CrFwRepErrStubGetExpSeqCnt(CrFwCounterU2_t errRepPos)
Return the expected sequence counter associated to the error report at position errRepPos.
CrFwRepErrCode_t errCode
The error code.
CrFwCounterU1_t par[CR_FW_ERR_REP_PAR_SIZE]
The parameters associated to the error report.
static CrFwServSubType_t servSubType
Service sub-type.
void CrFwRepErrRep(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, FwSmDesc_t rep)
Report an error which has one parameter attached to it representing an report component.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
void CrFwRepErrInstanceIdAndDest(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId, CrFwDestSrc_t dest, CrFwPckt_t pckt)
Report an error which has three parameters attached to it representing the instance identifier of a c...
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...
Header file to define all invariant publicly available constants and types for the CORDET Framework...
void CrFwRepErrInstanceIdAndOutcome(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId, CrFwOutcome_t outcome)
Report an error which has two parameters attached to it representing the instance identifier of a com...
The structure for an error report.
void CrFwRepErr(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId)
Report an error which has no parameters attached to it.
Interface for reporting an error detected by a framework component.
static CrFwDiscriminant_t disc
Discriminant.
void CrFwRepErrKind(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwServType_t servType, CrFwServSubType_t servSubType, CrFwDiscriminant_t disc)
Report an error which has three parameters attached to it representing the kind of a report or comman...
CrFwRepErrCode_t
Identifier for the errors reported through the error reporting interface of CrFwRepErr.h.
CrFwRepErrCode_t CrFwRepErrStubGetErrCode(CrFwCounterU2_t errRepPos)
Return the error code of the error report at position errRepPos.
CrFwSeqCnt_t CrFwRepErrStubGetActualSeqCnt(CrFwCounterU2_t errRepPos)
Return the actual sequence counter associated to the error report at position errRepPos.
CrFwInstanceId_t instanceId
The instance identifier of the component which generates the error report.
#define CR_FW_ERR_REP_PAR_SIZE
The size in number of bytes of the parameter part of an error report.
unsigned char CrFwOutcome_t
Type used for the outcome of a check (see CrFwCmpData).
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
static CrFwErrRep_t errRepArray[CR_FW_ERR_REP_ARRAY_SIZE]
The error report array.
static CrFwServType_t servType
The InCommand type as computed in the Validity Check.
static CrFwDestSrc_t dest
Destination.
void CrFwRepErrDestSrc(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwDestSrc_t destSrc)
Report an error which has one single parameter attached to it representing a command or report destin...
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr.h).
void CrFwRepErrCmd(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, FwSmDesc_t cmd)
Report an error which has one parameter attached to it representing a command component.
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...
CrFwOutcome_t CrFwRepErrStubGetOutcome(CrFwCounterU2_t errRepPos)
Return the outcome associated to the error report at position errRepPos.
CrFwTypeId_t typeId
The type identifier of the component which generates the error report.
void CrFwRepErrPckt(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwPckt_t pckt)
Report an error which has one parameter attached to it representing a command or report packet...
#define CR_FW_ERR_REP_ARRAY_SIZE
The size of the error report array.
CrFwCounterU1_t * CrFwRepErrStubGetParArray(CrFwCounterU2_t errRepPos)
Return the array holding the parameters associated to the error report at position errRepPos...
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
CrFwCounterU2_t CrFwRepErrStubGetPos()
Return the position in the error report array at which the next error report will be written...
unsigned short CrFwCounterU2_t
Type used for unsigned integers with a "medium" range.
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
CrFwTypeId_t CrFwRepErrStubGetTypeId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
void CrFwRepErrStubReset()
Reset the error reporting interface.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved