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