CORDET Framework - C2 Implementation
cordetfw/pustests/config/CrFwRepErr.c
1 
37 #include <stdlib.h>
38 #include <stdio.h>
39 /* Include Framework Files */
40 #include "CrFwConstants.h"
41 #include "CrFwRepErr.h"
42 /* Include Configuration Files */
43 #include "CrFwRepErrStub.h"
44 
46 #define CR_FW_ERR_REP_ARRAY_SIZE 100
47 
49 #define CR_FW_ERR_REP_PAR_SIZE 12
50 
59 typedef struct {
61  CrFwRepErrCode_t errCode;
63  CrFwTypeId_t typeId;
65  CrFwInstanceId_t instanceId;
68 } CrFwErrRep_t;
69 
72 
74 static CrFwCounterU2_t errRepPos = 0;
75 
76 /*-----------------------------------------------------------------------------------------*/
78  return errRepPos;
79 }
80 
81 /*-----------------------------------------------------------------------------------------*/
82 void CrFwRepErrStubReset() {
83  errRepPos = 0;
84 }
85 
86 /*-----------------------------------------------------------------------------------------*/
87 void CrFwRepErr(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId) {
89 
90  errRepArray[errRepPos].errCode = errCode;
91  errRepArray[errRepPos].instanceId = instanceId;
92  errRepArray[errRepPos].typeId = typeId;
93  for (i=0; i<CR_FW_ERR_REP_PAR_SIZE; i++)
94  errRepArray[errRepPos].par[i] = 0;
95 
97 }
98 
99 /*-----------------------------------------------------------------------------------------*/
100 void CrFwRepErrDestSrc(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId,
101  CrFwDestSrc_t destSrc) {
103 
104  errRepArray[errRepPos].errCode = errCode;
105  errRepArray[errRepPos].instanceId = instanceId;
106  errRepArray[errRepPos].typeId = typeId;
107  errRepArray[errRepPos].par[0] = destSrc;
108  for (i=1; i<CR_FW_ERR_REP_PAR_SIZE; i++)
109  errRepArray[errRepPos].par[i] = 0;
110 
112 }
113 #if 0
114 diese Funktion gibts bereits in der src CrPsRepErr.c
115 /*-----------------------------------------------------------------------------------------*/
117  CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId, CrFwDestSrc_t dest) {
119 
120  errRepArray[errRepPos].errCode = errCode;
121  errRepArray[errRepPos].instanceId = instanceId;
122  errRepArray[errRepPos].typeId = typeId;
123  errRepArray[errRepPos].par[0] = dest;
124  errRepArray[errRepPos].par[1] = (CrFwCounterU1_t)(secondaryInstanceId % 256);
125  errRepArray[errRepPos].par[2] = (CrFwCounterU1_t)(secondaryInstanceId >> 8);
126  for (i=3; i<CR_FW_ERR_REP_PAR_SIZE; i++)
127  errRepArray[errRepPos].par[i] = 255;
128 
130 }
131 #endif
132 
133 /*-----------------------------------------------------------------------------------------*/
134 void CrFwRepErrGroup(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId,
135  CrFwGroup_t group) {
137 
138  errRepArray[errRepPos].errCode = errCode;
139  errRepArray[errRepPos].instanceId = instanceId;
140  errRepArray[errRepPos].typeId = typeId;
141  errRepArray[errRepPos].par[0] = group;
142  for (i=1; i<CR_FW_ERR_REP_PAR_SIZE; i++)
143  errRepArray[errRepPos].par[i] = 0;
144 
146 }
147 
148 /*-----------------------------------------------------------------------------------------*/
149 void CrFwRepErrSeqCnt(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId,
150  CrFwSeqCnt_t expSeqCnt, CrFwSeqCnt_t actSeqCnt) {
152  CrFwSeqCnt_t temp;
153 
154  errRepArray[errRepPos].errCode = errCode;
155  errRepArray[errRepPos].instanceId = instanceId;
156  errRepArray[errRepPos].typeId = typeId;
157  temp = expSeqCnt;
158  errRepArray[errRepPos].par[0] = temp % 256;
159  temp = temp >> 8;
160  errRepArray[errRepPos].par[1] = temp % 256;
161  temp = temp >> 8;
162  errRepArray[errRepPos].par[2] = temp % 256;
163  temp = temp >> 8;
164  errRepArray[errRepPos].par[3] = temp % 256;
165  temp = actSeqCnt;
166  errRepArray[errRepPos].par[4] = temp % 256;
167  temp = temp >> 8;
168  errRepArray[errRepPos].par[5] = temp % 256;
169  temp = temp >> 8;
170  errRepArray[errRepPos].par[6] = temp % 256;
171  temp = temp >> 8;
172  errRepArray[errRepPos].par[7] = temp % 256;
173 
174  for (i=8; i<CR_FW_ERR_REP_PAR_SIZE; i++)
175  errRepArray[errRepPos].par[i] = 255;
176 
178 }
179 
180 /*-----------------------------------------------------------------------------------------*/
182  CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId, CrFwOutcome_t outcome) {
184 
185  errRepArray[errRepPos].errCode = errCode;
186  errRepArray[errRepPos].instanceId = instanceId;
187  errRepArray[errRepPos].typeId = typeId;
188  errRepArray[errRepPos].par[0] = outcome;
189  errRepArray[errRepPos].par[1] = (CrFwCounterU1_t)(secondaryInstanceId % 256);
190  errRepArray[errRepPos].par[2] = (CrFwCounterU1_t)(secondaryInstanceId >> 8);
191  for (i=3; i<CR_FW_ERR_REP_PAR_SIZE; i++)
192  errRepArray[errRepPos].par[i] = 255;
193 
195 }
196 
197 /*-----------------------------------------------------------------------------------------*/
199  return errRepArray[errRepPos].errCode;
200 }
201 
202 /*-----------------------------------------------------------------------------------------*/
204  return errRepArray[errRepPos].typeId;
205 }
206 
207 /*-----------------------------------------------------------------------------------------*/
209  return errRepArray[errRepPos].instanceId;
210 }
211 
212 /*-----------------------------------------------------------------------------------------*/
214  return errRepArray[errRepPos].par;
215 }
216 
217 /*-----------------------------------------------------------------------------------------*/
219  return errRepArray[errRepPos].par[0];
220 }
221 
222 /*-----------------------------------------------------------------------------------------*/
224  return (CrFwSeqCnt_t)(errRepArray[errRepPos].par[0]+errRepArray[errRepPos].par[1]*256+
225  errRepArray[errRepPos].par[2]*(65536)+errRepArray[errRepPos].par[3]*(16777216));
226 }
227 
228 /*-----------------------------------------------------------------------------------------*/
230  return (CrFwSeqCnt_t)(errRepArray[errRepPos].par[4]+errRepArray[errRepPos].par[5]*256+
231  errRepArray[errRepPos].par[6]*(65536)+errRepArray[errRepPos].par[7]*(16777216));
232 }
233 
234 /*-----------------------------------------------------------------------------------------*/
236  return (CrFwInstanceId_t)(errRepArray[errRepPos].par[1]+256*errRepArray[errRepPos].par[2]);
237 }
238 
239 /*-----------------------------------------------------------------------------------------*/
241  return errRepArray[errRepPos].par[0];
242 }
243 
244 /*-----------------------------------------------------------------------------------------*/
245 void CrFwRepErrPckt(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwPckt_t pckt)
246 {
247  CRFW_UNUSED(pckt);
248  printf("CrFwRepErrPckt: error %d generated by component %d of type %d\n",errCode,instanceId,typeId);
249  printf(" pckt: \n");
250  return;
251 }
252 
253 /*-----------------------------------------------------------------------------------------*/
254 void CrFwRepErrRep(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, FwSmDesc_t rep)
255 {
256  CRFW_UNUSED(rep);
257  printf("CrFwRepErrRep: error %d generated by component %d of type %d\n",errCode,instanceId,typeId);
258  printf(" rep: \n");
259  return;
260 }
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.
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...
CrFwCounterU4_t i
CrPsCmd5EidStart function definitions.
CrFwInstanceId_t CrFwRepErrStubGetInstanceId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
void CrFwRepErrInstanceIdAndDest(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwInstanceId_t secondaryInstanceId, CrFwDestSrc_t dest)
Report an error which has two parameters attached to it representing the instance identifier of a com...
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
FwSmDesc_t rep
CrPsCmd3s9Prgr function definitions.
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.
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...
CrFwCounterU1_t par[CR_FW_ERR_REP_PAR_SIZE]
The parameters associated to the error report.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
The structure for an 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...
Interface for reporting an error detected by a framework component.
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...
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).
static CrFwDestSrc_t dest
Destination.
void CrPsRepErr(CrPsRepErrCode_t errCode, CrFwServType_t repType, CrFwServSubType_t repSubType, CrFwDiscriminant_t repDiscriminant)
Report an error which has no parameters attached to it.
Definition: CrPsRepErr.c:37
static CrFwErrRep_t errRepArray[CR_FW_ERR_REP_ARRAY_SIZE]
The error report array.
void CrFwRepErrSeqCnt(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId, CrFwSeqCnt_t expSeqCnt, CrFwSeqCnt_t actSeqCnt)
Report an error which has two parameters attached to it representing expected and actual sequence cou...
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
void CrFwRepErr(CrFwRepErrCode_t errCode, CrFwTypeId_t typeId, CrFwInstanceId_t instanceId)
Report an error which has no parameters attached to it.
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 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.
#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