]> rtime.felk.cvut.cz Git - arc.git/blob - boards/mpc551xsim/config/CanIf_Cfg.h
Initial commit.
[arc.git] / boards / mpc551xsim / config / CanIf_Cfg.h
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
6  * This source code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by the
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16
17
18
19
20
21
22
23 #ifndef CANIF_CFG_H_\r
24 #define CANIF_CFG_H_\r
25 \r
26 #include "Can.h"\r
27 \r
28 typedef enum {\r
29         CANIF_SOFTFILTER_TYPE_BINARY = 0,  // Not supported\r
30         CANIF_SOFTFILTER_TYPE_INDEX,  // Not supported\r
31         CANIF_SOFTFILTER_TYPE_LINEAR, // Not supported\r
32         CANIF_SOFTFILTER_TYPE_TABLE,  // Not supported\r
33         CANIF_SOFTFILTER_TYPE_MASK,  // CanIfCanRxPduCanIdMask in RxPduConfig is used for filtering\r
34 } CanIf_SoftwareFilterTypeType;\r
35 \r
36 typedef enum {\r
37         CANIF_USER_TYPE_CAN_NM,\r
38         CANIF_USER_TYPE_CAN_TP,\r
39         CANIF_USER_TYPE_CAN_PDUR,\r
40         CANIF_USER_TYPE_CAN_SPECIAL,\r
41 } CanIf_UserTypeType;\r
42 \r
43 \r
44 \r
45 typedef void (*CanIf_FuncTypeCanSpecial)(PduIdType, const uint8 *, uint8, Can_IdType);\r
46 \r
47 typedef enum {\r
48   CANIF_PDU_TYPE_STATIC = 0,\r
49   CANIF_PDU_TYPE_DYNAMIC       // Not supported\r
50 } CanIf_PduTypeType;\r
51 \r
52 typedef enum {\r
53   CANIF_CAN_ID_TYPE_29 = 0,\r
54   CANIF_CAN_ID_TYPE_11\r
55 } CanIf_CanIdTypeType;\r
56 \r
57 /*\r
58  * Public container\r
59  */\r
60 #define CANIF_VERSION_INFO_API            STD_ON\r
61 #define CANIF_DEV_ERROR_DETECT                              STD_ON\r
62 #define CANIF_DLC_CHECK                   STD_ON\r
63 #define CANIF_MULITPLE_DRIVER_SUPPORT     STD_OFF  // Not supported\r
64 #define CANIF_READRXPDU_DATA_API                            STD_OFF  // Not supported\r
65 #define CANIF_READRXPDU_NOTIFY_STATUS_API       STD_OFF  // Not supported\r
66 #define CANIF_READTXPDU_NOTIFY_STATUS_API       STD_OFF  // Not supported\r
67 #define CANIF_SETDYNAMICTXID_API          STD_OFF  // Not supported\r
68 #define CANIF_WAKEUP_EVENT_API                              STD_OFF  // Not supported\r
69 #define CANIF_TRANSCEIVER_API             STD_OFF  // Not supported\r
70 #define CANIF_TRANSMIT_CANCELLATION       STD_OFF  // Not supported\r
71 \r
72 //-------------------------------------------------------------------\r
73 \r
74 typedef struct {\r
75         void (*CancelTxConfirmation)( void *);  // (const Can_PduType *);\r
76         void (*RxIndication)(void *); //(const Can_PduType *);\r
77         void (*ControllerBusOff)(uint8);\r
78         void (*ControllerWakeup)(uint8);\r
79         void (*EcoreError)(uint8,uint32);\r
80 } CanIf_CallbackType;\r
81 \r
82 \r
83 \r
84 //-------------------------------------------------------------------\r
85 /*\r
86  * CanIfHrhRangeConfig container\r
87  */\r
88 \r
89 typedef struct {\r
90         //      Lower CAN Identifier of a receive CAN L-PDU for identifier range\r
91         //      definition, in which all CAN Ids shall pass the software filtering. Range: 11\r
92         //      Bit for Standard CAN Identifier 29 Bit for Extended CAN Identifer\r
93         uint32 CanIfRxPduLowerCanId;\r
94 \r
95         //      Upper CAN Identifier of a receive CAN L-PDU for identifier range\r
96         //      definition, in which all CAN Ids shall pass the software filtering. Range: 11\r
97         //      Bit for Standard CAN Identifier 29 Bit for Extended CAN Identifer\r
98         uint32 CanIfRxPduUpperCanId;\r
99 } CanIf_HrhRangeConfigType;\r
100 \r
101 \r
102 \r
103 //-------------------------------------------------------------------\r
104 /*\r
105  * CanIfInitHrhConfig container\r
106  */\r
107 typedef struct {\r
108         //      Defines the HRH type i.e, whether its a BasicCan or FullCan. If BasicCan is\r
109         //      configured, software filtering is enabled.\r
110   Can_EcoreHohType CanIfHrhType;\r
111 \r
112         //      Selects the hardware receive objects by using the HRH range/list from\r
113         //      CAN Driver configuration to define, for which HRH a software filtering has\r
114         //      to be performed at during receive processing. True: Software filtering is\r
115         //      enabled False: Software filtering is disabled\r
116         boolean  CanIfSoftwareFilterHrh;\r
117 \r
118         //      Reference to controller Id to which the HRH belongs to. A controller can\r
119         //      contain one or more HRHs.\r
120         uint8 CanIfCanControllerHrhIdRef;\r
121 \r
122         //      The parameter refers to a particular HRH object in the CAN Driver Module\r
123         //      configuration. The HRH id is unique in a given CAN Driver. The HRH Ids\r
124         //      are defined in the CAN Driver Module and hence it is derived from CAN\r
125         //      Driver Configuration.\r
126         Can_EcoreHRHType CanIfHrhIdSymRef ;\r
127 \r
128         //      Defines the parameters required for configuraing multiple\r
129         //      CANID ranges for a given same HRH.\r
130         const CanIf_HrhRangeConfigType *CanIfHrhRangeConfig;\r
131 \r
132   // End Of List. Set to TRUE is this is the last object in the list.\r
133   boolean CanIfEcoreEOL;\r
134 } CanIf_HrhConfigType;\r
135 \r
136 //-------------------------------------------------------------------\r
137 /*\r
138  * CanIfInitHthConfig container\r
139  */\r
140 \r
141 typedef struct {\r
142   //  Defines the HTH type i.e, whether its a BasicCan or FullCan.\r
143   Can_EcoreHohType CanIfHthType;\r
144 \r
145   // Reference to controller Id to which the HTH belongs to. A controller\r
146   // can contain one or more HTHs\r
147   uint8 CanIfCanControllerIdRef;\r
148 \r
149   //  The parameter refers to a particular HTH object in the CAN Driver Module\r
150   //  configuration. The HTH id is unique in a given CAN Driver. The HTH Ids\r
151   //  are defined in the CAN Driver Module and hence it is derived from CAN\r
152   //  Driver Configuration.\r
153   Can_EcoreHTHType CanIfHthIdSymRef ;\r
154 \r
155   // End Of List. Set to TRUE is this is the last object in the list.\r
156   boolean CanIfEcoreEOL;\r
157 } CanIf_HthConfigType;\r
158 \r
159 //-------------------------------------------------------------------\r
160 /*\r
161  * CanIfInitHohConfig container\r
162  */\r
163 typedef struct {\r
164   //  Selects the CAN interface specific configuration setup. This type of external\r
165   // data structure shall contain the post build initialization data for the\r
166   // CAN interface for all underlying CAN Drivers.\r
167   const Can_ConfigSetType   *CanConfigSet;\r
168 \r
169   // This container contains contiguration parameters for each hardware receive object.\r
170   const CanIf_HrhConfigType *CanIfHrhConfig;\r
171 \r
172   // This container contains parameters releated to each HTH\r
173   const CanIf_HthConfigType *CanIfHthConfig;\r
174 \r
175   // End Of List. Set to TRUE is this is the last object in the list.\r
176   boolean CanIfEcoreEOL;\r
177 } CanIf_InitHohConfigType;\r
178 \r
179 //-------------------------------------------------------------------\r
180 /*\r
181  * CanIfTxPduConfig container\r
182  */\r
183 \r
184 // This container contains the configuration (parameters) of each transmit\r
185 // CAN L-PDU. The SHORT-NAME of "CanIfTxPduConfig" container\r
186 // represents the symolic name of Transmit L-PDU.\r
187 typedef struct {\r
188         //      ECU wide unique, symbolic handle for transmit CAN L-PDU. The\r
189         //      CanIfCanTxPduId is configurable at pre-compile and post-built time.\r
190         //      Range: 0..max. number of CantTxPduIds   PduIdType       CanTxPduId;\r
191         PduIdType CanIfTxPduId;\r
192 \r
193         //      CAN Identifier of transmit CAN L-PDUs used by the CAN Driver for CAN L-\r
194         //      PDU transmission. Range: 11 Bit For Standard CAN Identifier ... 29 Bit For\r
195         //      Extended CAN identifier\r
196         uint32  CanIfCanTxPduIdCanId;\r
197 \r
198         //      Data length code (in bytes) of transmit CAN L-PDUs used by the CAN\r
199         //      Driver for CAN L-PDU transmission. The data area size of a CAN L-Pdu\r
200         //      can have a range from 0 to 8 bytes.\r
201         uint8           CanIfCanTxPduIdDlc;\r
202 \r
203         // Defines the type of each transmit CAN L-PDU.\r
204         // DYNAMIC  CAN ID is defined at runtime.\r
205         // STATIC  CAN ID is defined at compile-time.\r
206         CanIf_PduTypeType               CanIfCanTxPduType;\r
207 \r
208 #if ( CANIF_READTXPDU_NOTIFY_STATUS_API == STD_ON )\r
209         //      Enables and disables transmit confirmation for each transmit CAN L-PDU\r
210         //      for reading its notification status. True: Enabled False: Disabled\r
211         boolean         CanIfReadTxPduNotifyStatus;\r
212 #endif\r
213 \r
214         //      CAN Identifier of transmit CAN L-PDUs used by the CAN Driver for CAN L-\r
215         //      PDU transmission.\r
216         //  EXTENDED_CAN  The CANID is of type Extended (29 bits)\r
217         //  STANDARD_CAN  The CANID is of type Standard (11 bits)\r
218         CanIf_CanIdTypeType             CanIfTxPduIdCanIdType;\r
219 \r
220         //      Name of target confirmation services to target upper layers (PduR, CanNm\r
221         //      and CanTp. If parameter is not configured then no call-out function is\r
222         //      provided by the upper layer for this Tx L-PDU.\r
223         void (*CanIfUserTxConfirmation)(PduIdType);   /* CANIF 109 */\r
224 \r
225         //      Handle, that defines the hardware object or the pool of hardware objects\r
226         //      configured for transmission. The parameter refers HTH Id, to which the L-\r
227         //      PDU belongs to.\r
228         const CanIf_HthConfigType *CanIfCanTxPduHthRef;\r
229 \r
230         //      Reference to the "global" Pdu structure to allow harmonization of handle\r
231         //      IDs in the COM-Stack.  ..\r
232         void *PduIdRef;\r
233 } CanIf_TxPduConfigType;\r
234 \r
235 //-------------------------------------------------------------------\r
236 /*\r
237  * CanIfRxPduConfig container\r
238  */\r
239 \r
240 \r
241 // This container contains the configuration (parameters) of each receive\r
242 // CAN L-PDU. The SHORT-NAME of "CanIfRxPduConfig" container itself\r
243 // represents the symolic name of Receive L-PDU.\r
244 \r
245 typedef struct {\r
246   //  ECU wide unique, symbolic handle for receive CAN L-PDU. The\r
247   //  CanRxPduId is configurable at pre-compile and post-built time. It shall fulfill\r
248   //  ANSI/AUTOSAR definitions for constant defines. Range: 0..max. number\r
249   //  of defined CanRxPduIds\r
250   PduIdType CanIfCanRxPduId;\r
251 \r
252   //    CAN Identifier of Receive CAN L-PDUs used by the CAN Interface. Exa:\r
253         //      Software Filtering. Range: 11 Bit For Standard CAN Identifier ... 29 Bit For\r
254         //      Extended CAN identifier\r
255         uint32          CanIfCanRxPduCanId;\r
256 \r
257         //      Data Length code of received CAN L-PDUs used by the CAN Interface.\r
258         //      Exa: DLC check. The data area size of a CAN L-PDU can have a range\r
259         //      from 0 to 8 bytes.      uint8           CanIfCanRxPduDlc;\r
260         uint8           CanIfCanRxPduDlc;\r
261 \r
262 #if ( CANIF_CANPDUID_READDATA_API == STD_ON )\r
263         //      Enables and disables the Rx buffering for reading of received L-PDU data.\r
264         //      True: Enabled False: Disabled\r
265         boolean         CanIfReadRxPduData;\r
266 #endif\r
267 \r
268 #if ( CANIF_READRXPDU_NOTIF_STATUS_API == STD_ON )\r
269         //      CanIfReadRxPduNotifyStatus {CANIF_READRXPDU_NOTIFY_STATUS}\r
270         //      Enables and disables receive indication for each receive CAN L-PDU for\r
271         //      reading its' notification status. True: Enabled False: Disabled\r
272         boolean         CanIfReadRxPduNotifyStatus;\r
273 #endif\r
274 \r
275   //  CAN Identifier of receive CAN L-PDUs used by the CAN Driver for CAN L-\r
276   //  PDU transmission.\r
277   //  EXTENDED_CAN  The CANID is of type Extended (29 bits)\r
278   //  STANDARD_CAN  The CANID is of type Standard (11 bits)\r
279         CanIf_CanIdTypeType     CanIfRxPduIdCanIdType;\r
280 \r
281         //      This parameter defines the type of the receive indication call-outs called to\r
282         //      the corresponding upper layer the used TargetRxPduId belongs to.\r
283         CanIf_UserTypeType  CanIfRxUserType;\r
284 \r
285         //      Name of target indication services to target upper layers (PduRouter,\r
286         //      CanNm, CanTp and ComplexDeviceDrivers). If parameter is 0 no call-out\r
287         //      function is configured.\r
288         void *CanIfUserRxIndication;\r
289 \r
290         //      The HRH to which Rx L-PDU belongs to, is referred through this\r
291         //      parameter.\r
292         const CanIf_HrhConfigType *CanIfCanRxPduHrhRef;\r
293 \r
294         //      Reference to the "global" Pdu structure to allow harmonization of handle\r
295         //      IDs in the COM-Stack.\r
296         void *PduIdRef;\r
297 \r
298         // Defines the type of software filtering that should be used\r
299         // for this receive object.\r
300         CanIf_SoftwareFilterTypeType CanIfSoftwareFilterType;\r
301 \r
302         // Acceptance filters, 1 - care, 0 - don't care.\r
303         // Is enabled by the CanIfSoftwareFilterMask in CanIf_HrhConfigType\r
304         // Ecore exension\r
305         uint32 CanIfCanRxPduCanIdMask;\r
306 \r
307 } CanIf_RxPduConfigType;\r
308 \r
309 //-------------------------------------------------------------------\r
310 \r
311 /*\r
312  * CanIfControllerConfig container\r
313  */\r
314 \r
315 typedef enum {\r
316         CANIF_WAKEUP_SUPPORT_CONTROLLER,\r
317         CANIF_WAKEUP_SUPPORT_NO_WAKEUP,\r
318         CANIF_WAKEUP_SUPPORT_TRANSCEIVER,\r
319 } CanIf_WakeupSupportType;\r
320 \r
321 \r
322 // This is the type supplied to CanIf_InitController()\r
323 typedef struct {\r
324         CanIf_WakeupSupportType WakeupSupport;  // Not used\r
325 \r
326         CanControllerIdType CanIfControllerIdRef;\r
327 \r
328         const char CanIfDriverNameRef[8]; // Not used\r
329 \r
330         const Can_ControllerConfigType *CanIfInitControllerRef;\r
331 } CanIf_ControllerConfigType;\r
332 \r
333 //-------------------------------------------------------------------\r
334 /*\r
335  * CanIfTransceiverDrvConfig container\r
336  */\r
337 \r
338 typedef struct {\r
339         boolean TrcvWakeupNotification;\r
340         uint8   TrcvIdRef;\r
341 } CanIf_TransceiverDrvConfigType;\r
342 \r
343 \r
344 typedef struct {\r
345         uint32 todo;\r
346 } CanIf_TransceiverConfigType;\r
347 \r
348 // Callout functions with respect to the upper layers. This callout functions\r
349 // defined in this container are common to all configured underlying CAN\r
350 // Drivers / CAN Transceiver Drivers.\r
351 typedef struct {\r
352         //      Name of target BusOff notification services to target upper layers\r
353         //      (PduRouter, CanNm, CanTp and ComplexDeviceDrivers).\r
354         //  Multiplicity: 1\r
355         void (*CanIfBusOffNotification)(uint8 Controller);\r
356 \r
357         //      Name of target wakeup notification services to target upper layers\r
358         //      e.g Ecu_StateManager. If parameter is 0\r
359         //      no call-out function is configured.\r
360         //  Multiplicity: 0..1\r
361         void (*CanIfWakeUpNotification)();\r
362 \r
363         //      Name of target wakeup validation notification services to target upper\r
364         //      layers (ECU State Manager). If parameter is 0 no call-out function is\r
365         //      configured.\r
366         //  Multiplicity: 0..1\r
367         void (*CanIfWakeupValidNotification)();\r
368 \r
369         // Ecore ext.\r
370         void (*CanIfErrorNotificaton)(uint8,Can_EcoreErrorType);\r
371 \r
372 } CanIf_DispatchConfigType;\r
373 \r
374 // This container contains the references to the configuration setup of each\r
375 // underlying CAN driver.\r
376 \r
377 typedef struct {\r
378         //      Selects the CAN Interface specific configuration setup. This type of the\r
379         //      external data structure shall contain the post build initialization data for the\r
380         //      CAN Interface for all underlying CAN Dirvers. constant to CanIf_ConfigType\r
381         uint32 CanIfConfigSet;\r
382 \r
383         uint32 CanIfNumberOfCanRxPduIds;\r
384         uint32 CanIfNumberOfCanTXPduIds;\r
385         uint32 CanIfNumberOfDynamicCanTXPduIds;\r
386 \r
387         //\r
388         // Containers\r
389         //\r
390 \r
391   //  This container contains the reference to the configuration\r
392         //  setup of each underlying CAN driver.\r
393   //  Multiplicity: 0..*\r
394         const CanIf_InitHohConfigType *CanIfHohConfigPtr;\r
395 \r
396         //      This container contains the configuration (parameters) of each\r
397         //      receive CAN L-PDU. The SHORT-NAME of\r
398         //      "CanIfRxPduConfig" container itself represents the symolic\r
399         //      name of Receive L-PDU.\r
400         // Multiplicity: 0..*\r
401         const CanIf_RxPduConfigType *CanIfRxPduConfigPtr;\r
402 \r
403         //      This container contains the configuration (parameters) of each\r
404         //      transmit CAN L-PDU. The SHORT-NAME of\r
405         //      "CanIfTxPduConfig" container represents the symolic name of\r
406         //  Transmit L-PDU.\r
407         // Multiplicity: 0..*\r
408         const CanIf_TxPduConfigType *CanIfTxPduConfigPtr;\r
409 \r
410 } CanIf_InitConfigType;\r
411 \r
412 \r
413 typedef struct {\r
414         //      This container contains the configuration (parameters) of all\r
415         //      addressed CAN controllers by each underlying CAN driver.\r
416         //  Multiplicity: 1..*\r
417         const CanIf_ControllerConfigType        *ControllerConfig;\r
418 \r
419         //      Callout functions with respect to the upper layers. This callout\r
420         //      functions defined in this container are common to all\r
421         //      configured underlying CAN Drivers / CAN Transceiver Drivers\r
422         const CanIf_DispatchConfigType  *DispatchConfig;\r
423 \r
424         //      This container contains the init parameters of the CAN\r
425         //      Interface.\r
426         //  Multiplicity: 1..*\r
427         const CanIf_InitConfigType              *InitConfig;\r
428 \r
429         //      This container contains the configuration (parameters) of all\r
430         //      addressed CAN transceivers by each underlying CAN\r
431         //      Transceiver Driver.\r
432         //  Multiplicity: 1..*\r
433         const CanIf_TransceiverConfigType *TransceiverConfig;\r
434 } CanIf_ConfigType;\r
435 \r
436 \r
437 extern CanIf_ConfigType CanIf_Config;\r
438 \r
439 #endif\r
440 \r
441 \r