]> rtime.felk.cvut.cz Git - arc.git/blob - include/Dem_Lcfg.h
realized I removed some stuff unnecessarely during mpc5606b port
[arc.git] / include / Dem_Lcfg.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 \r
17 \r
18 \r
19 \r
20 \r
21 \r
22 \r
23 /*\r
24  *  General requirements\r
25  */\r
26 /** @req DEM128 */\r
27 \r
28 \r
29 \r
30 #ifndef DEM_LCFG_H_\r
31 #define DEM_LCFG_H_\r
32 #include "Dem_Types.h"\r
33 #if defined(USE_DCM)\r
34 #include "Dcm_Types.h"   /** @req DEM176.Dcm */\r
35 #include "Dcm_Lcfg.h"            /** @req DEM136.Dcm */\r
36 #endif\r
37 //#if defined(USE_NVRam)\r
38 #include "NvM_ConfigTypes.h"     /** @req Dem147.Nvm */\r
39 //#endif\r
40 \r
41 /*\r
42  * Callback function prototypes\r
43  */\r
44 \r
45 // InitMonitorForEvent\r
46 typedef Std_ReturnType (*Dem_CallbackInitMonitorForEventFncType)(Dem_InitMonitorKindType InitMonitorKind); /** @req DEM256 */\r
47 \r
48 // InitMonitorForFunction\r
49 typedef Std_ReturnType (*Dem_CallbackInitMonitorForFunctionFncType)(void); /** @req DEM258 */\r
50 \r
51 // EventStatusChanged\r
52 typedef Std_ReturnType (*Dem_CallbackEventStatusChangedFncType)(Dem_EventStatusExtendedType EventStatusOld, Dem_EventStatusExtendedType EventStatusNew); /** @req DEM259 */\r
53 \r
54 // DTCStatusChanged\r
55 typedef Std_ReturnType (*Dem_CallbackDTCStatusChangedFncType)(uint8 DTCStatusOld, uint8 DTCStatusNew); /** @req DEM260 */\r
56 \r
57 // DIDServices /** @req DEM261 */\r
58 #if defined(USE_DCM)\r
59 typedef Std_ReturnType (*Dem_CallbackConditionCheckReadFncType)(Dcm_NegativeResponseCodeType *Nrc);\r
60 typedef Std_ReturnType (*Dem_CallbackReadDataFncType)(uint8 *Data);\r
61 typedef Std_ReturnType (*Dem_CallbackReadDataLength)(uint16 *DidLength);\r
62 #else\r
63 typedef Std_ReturnType (*Dem_CallbackConditionCheckReadFncType)(uint8 *Nrc);\r
64 typedef Std_ReturnType (*Dem_CallbackReadDataFncType)(uint8 *Data);\r
65 typedef Std_ReturnType (*Dem_CallbackReadDataLength)(uint16 *DidLength);\r
66 #endif\r
67 \r
68 // GetExtendedDataRecord\r
69 typedef Std_ReturnType (*Dem_CallbackGetExtDataRecordFncType)(uint8 *ExtendedDataRecord); /** @req DEM262 */\r
70 \r
71 // GetFaultDetectionCounter\r
72 typedef Std_ReturnType (*Dem_CallbackGetFaultDetectionCounterFncType)(sint8 *EventIdFaultDetectionCounter); /** @req DEM263 */\r
73 \r
74 // GetPIDValue\r
75 typedef Std_ReturnType (*Dem_CallbackGetPIDValueFncType)(uint8 *DataValueBuffer); /** @req DEM326 */\r
76 \r
77 typedef enum{\r
78         FF_STORAGE_CONDITION_WRONG = 0, //FF storage condition is wrong\r
79         PREFAILED = 1,                                          //store FF when the event status is prefailed\r
80         FAILED = 2                                                      //store FF when the event status is failed\r
81 }Dem_FreezeFrameStorageConditonType; /** @req Dem001_private */\r
82 /*\r
83  * DemGeneral types\r
84  */\r
85 /** @req DEM128 */\r
86 \r
87 // 10.2.25 DemEnableCondition\r
88 typedef struct {\r
89         boolean EnableConditionStatus;          //\r
90         // uint16       EnableConditionID;              // Optional\r
91 } Dem_EnableConditionType;\r
92 \r
93 // 10.2.30 DemExtendedDataRecordClass\r
94 typedef struct {\r
95         uint16  RecordNumber;                                           // (1)\r
96         uint16  DataSize;                                                       // (1)\r
97         Dem_CallbackGetExtDataRecordFncType     CallbackGetExtDataRecord;// (1)  /** @req DEM139 */\r
98 } Dem_ExtendedDataRecordClassType; /** @req DEM135 */\r
99 \r
100 // 10.2.13 DemExtendedDataClass\r
101 typedef struct {\r
102         const Dem_ExtendedDataRecordClassType *const ExtendedDataRecordClassRef[DEM_MAX_NR_OF_RECORDS_IN_EXTENDED_DATA+1]; // (1..253)\r
103 } Dem_ExtendedDataClassType; /** @req DEM135 */\r
104 \r
105 // 10.2.8 DemPidOrDid\r
106 typedef struct {\r
107         Dem_CallbackConditionCheckReadFncType           DidConditionCheckReadFnc;       // (0..1)\r
108         const uint16                                                            DidIdentifier;                          // (0..1)\r
109         Dem_CallbackReadDataLength                              DidReadDataLengthFnc;           // (0..1)\r
110         Dem_CallbackReadDataFncType                             DidReadFnc;                                     // (0..1)\r
111         const uint8                                                             PidIndentifier;                         // (0..1)\r
112         uint8                                                                   PidOrDidSize;                           // (1)\r
113         boolean                                                                 PidOrDidUsePort;                        // (1) Not used in current implementation       \r
114         Dem_CallbackGetPIDValueFncType                  PidReadFnc;                                     // (0..1)\r
115         boolean                                                                 Arc_EOL;\r
116 } Dem_PidOrDidType; /** @req DEM136 */\r
117 \r
118 // 10.2.18 DemFreezeFrameClass\r
119 typedef struct {\r
120         Dem_FreezeFrameKindType FFKind;                 // (1)\r
121         uint8                                   FFRecordNumber; // (1)/** @req DEM040 */\r
122         Dem_FreezeFrameStorageConditonType FFStorageCondition;/** @req Dem001_private */\r
123         const Dem_PidOrDidType  *FFIdClassRef;  // (1..255)/** @req DEM039 */\r
124 } Dem_FreezeFrameClassType; /** @req DEM136 */\r
125 \r
126 \r
127 // 10.2.4 DemIndicator\r
128 typedef struct {\r
129         uint16  Indicator;              // (1)\r
130 } Dem_IndicatorType; /** @req DEM129 */\r
131 \r
132 // 10.2.28 DemNvramBlockId\r
133 typedef struct {\r
134 \r
135 //#if defined(USE_NVRam)\r
136         const NvM_BlockDescriptorType *BlockDescriptor;/** @req FIM083 *//** @req Dem697_Conf AutoSAR 4.2.0*/\r
137 //#endif\r
138 \r
139 } Dem_NvramBlockIdType;/** @req Dem147 *//** @req Dem696_Conf AutoSAR 4.2.0*/\r
140 \r
141 /*\r
142  * DemConfigSetType types\r
143  */\r
144 \r
145 // 10.2.6 DemCallbackDTCStatusChanged\r
146 typedef struct {\r
147         Dem_CallbackDTCStatusChangedFncType CallbackDTCStatusChangedFnc;        // (0..1)\r
148 } Dem_CallbackDTCStatusChangedType; /** @req DEM140 */\r
149 \r
150 // 10.2.26 DemCallbackInitMForF\r
151 typedef struct {\r
152         Dem_CallbackInitMonitorForFunctionFncType       CallbackInitMForF;              // (0..1)\r
153 } Dem_CallbackInitMForFType;\r
154 \r
155 // 10.2.17 DemDTCClass\r
156 typedef struct {\r
157         uint32                                                                  DTC;                                            // (1)\r
158         uint8                                                                   DTCFunctionalUnit;                      // (1)\r
159         Dem_DTCKindType                                                 DTCKind;                                        // (1)\r
160         const Dem_CallbackDTCStatusChangedType  *CallbackDTCStatusChanged;      // (0..*)\r
161         const Dem_CallbackInitMForFType                 *CallbackInitMForF;                     // (0..*)\r
162         // Dem_DTCSeverityType                                  DTCSeverity                                     // (0..1)  Optional\r
163         boolean                                                                 Arc_EOL;\r
164 } Dem_DTCClassType; /** @req DEM132 */\r
165 \r
166 // 10.2.5 DemCallbackEventStatusChanged\r
167 typedef struct {\r
168         Dem_CallbackEventStatusChangedFncType   CallbackEventStatusChangedFnc;  // (0..1)\r
169 } Dem_CallbackEventStatusChangedType; /** @req DEM140 */\r
170 \r
171 // 10.2.27 DemCallbackInitMForE\r
172 typedef struct {\r
173         Dem_CallbackInitMonitorForEventFncType  CallbackInitMForEFnc;   // (0..1)\r
174 } Dem_CallbackInitMforEType; /** @req DEM130 */\r
175 \r
176 // 10.2.15\r
177 typedef struct {\r
178         Dem_IndicatorStatusType IndicatorBehaviour;                     // (1)\r
179         Dem_IndicatorType               *LinkedIndicator;                       // (1)\r
180 } Dem_IndicatorAttributeType; /** @req DEM133 */\r
181 \r
182 // 10.2.23 DemPreDebounceMonitorInternal\r
183 typedef struct {\r
184         Dem_CallbackGetFaultDetectionCounterFncType     CallbackGetFDCntFnc;    // (1)\r
185 } Dem_PreDebounceMonitorInternalType; /** @req DEM146 */\r
186 \r
187 // 10.2.21 DemPreDebounceCounterBased\r
188 typedef struct {\r
189         boolean JumpUp;\r
190         boolean JumpDown;\r
191         uint8   CountInStepSize;\r
192         uint8   CountOutStepSize;\r
193 } Dem_PreDebounceCounterBasedType; /** @req DEM144 */\r
194 \r
195 // 10.2.22 DemPreDebounceFrequencyBased\r
196 typedef struct {\r
197         // TODO: Fill out\r
198 } Dem_PreDebounceFrequencyBasedType;\r
199 \r
200 // 10.2.24 DemPreDebounceTimeBased\r
201 typedef struct {\r
202         // TODO: Fill out\r
203 } Dem_PreDebounceTimeBasedType;\r
204 \r
205 // 10.2.20\r
206 typedef struct {\r
207         Dem_PreDebounceNameType                                         PreDebounceName;                                // (1)\r
208         union {\r
209         const Dem_PreDebounceMonitorInternalType        *PreDebounceMonitorInternal;    // (0..1)\r
210         const Dem_PreDebounceCounterBasedType           *PreDebounceCounterBased;               // (0..1)\r
211         const Dem_PreDebounceFrequencyBasedType         *PreDebounceFrequencyBased;             // (0..1)\r
212         const Dem_PreDebounceTimeBasedType                      *PreDebounceTimeBased;                  // (0..1)\r
213         } PreDebounceAlgorithm;\r
214 } Dem_PreDebounceAlgorithmClassType;\r
215 \r
216 // 10.2.14 DemEventClass\r
217 typedef struct {\r
218         boolean                                         ConsiderPtoStatus;                                                                      // (1)\r
219         const Dem_DTCOriginType                 EventDestination[DEM_MAX_NR_OF_EVENT_DESTINATION+1];// (0..4)\r
220         uint8                                           EventPriority;                                                                          // (1)\r
221         boolean                                         FFPrestorageSupported;                                                          // (1)\r
222         boolean                                         HealingAllowed;                                                                         // (1)\r
223         Dem_OperationCycleIdType        OperationCycleRef;                                                                      // (1)\r
224         Dem_OperationCycleIdType        HealingCycleRef;                                                                        // (1)\r
225         uint8                                           HealingCycleCounter;                                                                    // (0..1) Optional\r
226 //      const Dem_EnableConditionType   *EnableConditionRef;                                                    // (0..*) Optional\r
227         const Dem_PreDebounceAlgorithmClassType *PreDebounceAlgorithmClass;                             // (0..255) (Only 0..1 supported)\r
228         const Dem_IndicatorAttributeType                *IndicatorAttribute;                                    // (0..255)\r
229 //      Dem_OEMSPecific\r
230 } Dem_EventClassType; /** @req DEM131 */\r
231 \r
232 // 10.2.12 DemEventParameter\r
233 typedef struct {\r
234         uint16                                                                          EventID;                                        // (1)\r
235         Dem_EventKindType                                                       EventKind;                                      // (1)\r
236         const Dem_EventClassType                                        *EventClass;                            // (1)\r
237         const Dem_ExtendedDataClassType                         *ExtendedDataClassRef;          // (0..1)\r
238         const Dem_FreezeFrameClassType                          *FreezeFrameClassRef[DEM_MAX_NR_OF_CLASSES_IN_FREEZEFRAME_DATA+1];              // (0..255) (Only 0..1 supported)/** @req DEM021 */\r
239         const Dem_CallbackInitMforEType                         *CallbackInitMforE;                     // (0..1)\r
240         const Dem_CallbackEventStatusChangedType        *CallbackEventStatusChanged;// (0..*)\r
241         const Dem_DTCClassType                                          *DTCClassRef;                           // (0..1)\r
242         boolean                                                                         Arc_EOL;\r
243 } Dem_EventParameterType; /** @req DEM130 */\r
244 \r
245 \r
246 \r
247 // 10.2.19 DemGroupOfDTC\r
248 typedef struct {\r
249         // TODO: Fill out\r
250 } Dem_GroupOfDtcType;\r
251 \r
252 // 10.2.10 DemOemIdClass\r
253 typedef struct {\r
254         uint8   OemID;\r
255 } Dem_OemIdClassType; /** @req DEM141 */\r
256 \r
257 // 10.2.9 DemConfigSet\r
258 typedef struct {\r
259         const Dem_EventParameterType    *EventParameter;        // (0..65535)\r
260         const Dem_DTCClassType                  *DTCClass;                      // (1..16777214)\r
261         const Dem_GroupOfDtcType                *GroupOfDtc;            // (1.16777214)\r
262         const Dem_OemIdClassType                *OemIdClass;            // (0..*)\r
263 } Dem_ConfigSetType; /** @req DEM130 */\r
264 \r
265 // 10.2.2 Dem\r
266 typedef struct {\r
267         const Dem_ConfigSetType *ConfigSet;     //      (1)\r
268 } Dem_ConfigType;\r
269 \r
270 \r
271 typedef uint16 ChecksumType;\r
272 typedef struct {\r
273         Dem_EventIdType         eventId;\r
274         uint16                          occurrence;\r
275     uint16                              dataSize;\r
276         uint8               recordNumber;\r
277     uint32              timeStamp;\r
278         uint8                           data[DEM_MAX_SIZE_FF_DATA];\r
279         ChecksumType            checksum;\r
280 } FreezeFrameRecType;\r
281 \r
282 // Types for storing different event aging counter\r
283 typedef struct {\r
284         Dem_EventIdType         eventId;\r
285         uint8                           agingCounter;/** @req Dem019 */\r
286         ChecksumType            checksum;\r
287 } HealingRecType;\r
288 \r
289 /*\r
290  * Make the DEM_Config visible for others.\r
291  */\r
292 extern const Dem_ConfigType DEM_Config;\r
293 \r
294 #endif /*DEM_LCFG_H_*/\r