]> rtime.felk.cvut.cz Git - arc.git/blob - include/CanIf_ConfigTypes.h
Starting 'pdur2' branch with copied content from remote repository.
[arc.git] / include / CanIf_ConfigTypes.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 /** @addtogroup CanIf CAN Interface\r
17  *  @{ */\r
18 \r
19 /** @file CanIf_ConfigTypes.h\r
20  *  Definitions of configuration parameters for CAN Interface.\r
21  */\r
22 \r
23 #ifndef CANIF_CONFIGTYPES_H_\r
24 #define CANIF_CONFIGTYPES_H_\r
25 \r
26 \r
27 /** Software filtering type */\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 /** Type of the upper layer interfacing this module */\r
37 typedef enum {\r
38         CANIF_USER_TYPE_CAN_NM,\r
39         CANIF_USER_TYPE_CAN_TP,\r
40         CANIF_USER_TYPE_CAN_PDUR,\r
41         CANIF_USER_TYPE_CAN_SPECIAL\r
42 } CanIf_UserTypeType;\r
43 \r
44 /** Notification function for CANIF_USER_TYPE_CAN_SPECIAL */\r
45 typedef void (*CanIf_FuncTypeCanSpecial)(uint8 channel, PduIdType pduId, const uint8 *sduPtr, uint8 dlc, Can_IdType canId);\r
46 \r
47 /** Defines if PDU Can id can be changed at runtime. */\r
48 typedef enum {\r
49   CANIF_PDU_TYPE_STATIC = 0,\r
50   CANIF_PDU_TYPE_DYNAMIC       /**< Not supported */\r
51 } CanIf_PduTypeType;\r
52 \r
53 /** PDU Can id type */\r
54 typedef enum {\r
55   CANIF_CAN_ID_TYPE_29 = 0,\r
56   CANIF_CAN_ID_TYPE_11\r
57 } CanIf_CanIdTypeType;\r
58 \r
59 //-------------------------------------------------------------------\r
60 /*\r
61  * CanIfHrhRangeConfig container\r
62  */\r
63 \r
64 /** Parameters for configuring Can id ranges. Not supported. */\r
65 typedef struct {\r
66         /** Lower CAN Identifier of a receive CAN L-PDU for identifier range\r
67          *  definition, in which all CAN Ids shall pass the software filtering. Range: 11\r
68      *  Bit for Standard CAN Identifier 29 Bit for Extended CAN Identifer */\r
69         uint32 CanIfRxPduLowerCanId;\r
70 \r
71         /** Upper CAN Identifier of a receive CAN L-PDU for identifier range\r
72          *  definition, in which all CAN Ids shall pass the software filtering. Range: 11\r
73          *  Bit for Standard CAN Identifier 29 Bit for Extended CAN Identifer */\r
74         uint32 CanIfRxPduUpperCanId;\r
75 } CanIf_HrhRangeConfigType;\r
76 \r
77 \r
78 //-------------------------------------------------------------------\r
79 /*\r
80  * CanIfInitHrhConfig container\r
81  */\r
82 /** Definition of Hardware Receive Handle */\r
83 typedef struct {\r
84         /** Defines the HRH type i.e, whether its a BasicCan or FullCan. If BasicCan is\r
85          *  configured, software filtering is enabled. */\r
86   Can_Arc_HohType CanIfHrhType;\r
87 \r
88         /** Selects the hardware receive objects by using the HRH range/list from\r
89          *  CAN Driver configuration to define, for which HRH a software filtering has\r
90          *  to be performed at during receive processing. True: Software filtering is\r
91          *  enabled False: Software filtering is disabled */\r
92         boolean  CanIfSoftwareFilterHrh;\r
93 \r
94         /** Reference to controller Id to which the HRH belongs to. A controller can\r
95          *  contain one or more HRHs. */\r
96         CanIf_Arc_ChannelIdType CanIfCanControllerHrhIdRef;\r
97 \r
98         /** The parameter refers to a particular HRH object in the CAN Driver Module\r
99          *  configuration. The HRH id is unique in a given CAN Driver. The HRH Ids\r
100          *  are defined in the CAN Driver Module and hence it is derived from CAN\r
101          *  Driver Configuration. */\r
102         Can_Arc_HRHType CanIfHrhIdSymRef ;\r
103 \r
104         /** Defines the parameters required for configuraing multiple\r
105          *  CANID ranges for a given same HRH. */\r
106         const CanIf_HrhRangeConfigType *CanIfHrhRangeConfig;\r
107 \r
108   /** End Of List. Set to TRUE if this is the last object in the list. */\r
109   boolean CanIf_Arc_EOL;\r
110 } CanIf_HrhConfigType;\r
111 \r
112 //-------------------------------------------------------------------\r
113 /*\r
114  * CanIfInitHthConfig container\r
115  */\r
116 /** Definition of Hardware Transmit Handle */\r
117 typedef struct {\r
118   /** Defines the HTH type i.e, whether its a BasicCan or FullCan. */\r
119   Can_Arc_HohType CanIfHthType;\r
120 \r
121   /** Reference to controller Id to which the HTH belongs to. A controller\r
122    *  can contain one or more HTHs */\r
123   CanIf_Arc_ChannelIdType CanIfCanControllerIdRef;\r
124 \r
125   /** The parameter refers to a particular HTH object in the CAN Driver Module\r
126    *  configuration. The HTH id is unique in a given CAN Driver. The HTH Ids\r
127    *  are defined in the CAN Driver Module and hence it is derived from CAN\r
128    *  Driver Configuration. */\r
129   Can_Arc_HTHType CanIfHthIdSymRef ;\r
130 \r
131   /** End Of List. Set to TRUE if this is the last object in the list. */\r
132   boolean CanIf_Arc_EOL;\r
133 } CanIf_HthConfigType;\r
134 \r
135 //-------------------------------------------------------------------\r
136 /*\r
137  * CanIfInitHohConfig container\r
138  */\r
139 /** Definition of Hardware Object Handle. */\r
140 typedef struct {\r
141   /** Reference to the CAN Driver controller config. */\r
142   const Can_ConfigSetType   *CanConfigSet;\r
143 \r
144   /** This container contains contiguration parameters for each hardware receive object. */\r
145   const CanIf_HrhConfigType *CanIfHrhConfig;\r
146 \r
147   /** This container contains parameters releated to each HTH */\r
148   const CanIf_HthConfigType *CanIfHthConfig;\r
149 \r
150   /** End Of List. Set to TRUE if this is the last object in the list. */\r
151   boolean CanIf_Arc_EOL;\r
152 } CanIf_InitHohConfigType;\r
153 \r
154 //-------------------------------------------------------------------\r
155 /*\r
156  * CanIfTxPduConfig container\r
157  */\r
158 \r
159 /** Definition of Tx PDU (Protocol Data Unit). */\r
160 typedef struct {\r
161         /** ECU wide unique, symbolic handle for transmit CAN L-PDU. The\r
162          *  CanIfCanTxPduId is configurable at pre-compile and post-built time.\r
163          *  Range: 0..max. number of CantTxPduIds       PduIdType       CanTxPduId; */\r
164         PduIdType CanIfTxPduId;\r
165 \r
166         /** CAN Identifier of transmit CAN L-PDUs used by the CAN Driver for CAN L-\r
167          *  PDU transmission. Range: 11 Bit For Standard CAN Identifier ... 29 Bit For\r
168          *  Extended CAN identifier */\r
169         uint32  CanIfCanTxPduIdCanId;\r
170 \r
171         /** Data length code (in bytes) of transmit CAN L-PDUs used by the CAN\r
172          *  Driver for CAN L-PDU transmission. The data area size of a CAN L-Pdu\r
173          *  can have a range from 0 to 8 bytes. */\r
174         uint8           CanIfCanTxPduIdDlc;\r
175 \r
176         /** Defines the type of each transmit CAN L-PDU.\r
177          *  DYNAMIC  CAN ID is defined at runtime.\r
178          *  STATIC  CAN ID is defined at compile-time. */\r
179         CanIf_PduTypeType               CanIfCanTxPduType;\r
180 \r
181 #if ( CANIF_READTXPDU_NOTIFY_STATUS_API == STD_ON )\r
182         /** Enables and disables transmit confirmation for each transmit CAN L-PDU\r
183          *  for reading its notification status. True: Enabled False: Disabled */\r
184         boolean         CanIfReadTxPduNotifyStatus;\r
185 #endif\r
186 \r
187         /** CAN Identifier of transmit CAN L-PDUs used by the CAN Driver for CAN L-\r
188          *  PDU transmission.\r
189          *  EXTENDED_CAN  The CANID is of type Extended (29 bits).\r
190          *  STANDARD_CAN  The CANID is of type Standard (11 bits). */\r
191         CanIf_CanIdTypeType             CanIfTxPduIdCanIdType;\r
192 \r
193         /** Name of target confirmation services to target upper layers (PduR, CanNm\r
194          *  and CanTp. If parameter is not configured then no call-out function is\r
195          *  provided by the upper layer for this Tx L-PDU. */\r
196         void (*CanIfUserTxConfirmation)(PduIdType);   /* CANIF 109 */\r
197 \r
198         /** Handle, that defines the hardware object or the pool of hardware objects\r
199          *  configured for transmission. The parameter refers HTH Id, to which the L-\r
200          *  PDU belongs to. */\r
201         const CanIf_HthConfigType *CanIfCanTxPduHthRef;\r
202 \r
203         /** Reference to the "global" Pdu structure to allow harmonization of handle\r
204          *  IDs in the COM-Stack. */\r
205         void *PduIdRef;\r
206 } CanIf_TxPduConfigType;\r
207 \r
208 //-------------------------------------------------------------------\r
209 /*\r
210  * CanIfRxPduConfig container\r
211  */\r
212 \r
213 \r
214 /** Definition of Rx PDU (Protocol Data Unit). */\r
215 typedef struct {\r
216   /** ECU wide unique, symbolic handle for receive CAN L-PDU. The\r
217    *  CanRxPduId is configurable at pre-compile and post-built time. It shall fulfill\r
218    *  ANSI/AUTOSAR definitions for constant defines. Range: 0..max. number\r
219    *  of defined CanRxPduIds */\r
220   PduIdType CanIfCanRxPduId;\r
221 \r
222   /** CAN Identifier of Receive CAN L-PDUs used by the CAN Interface. Exa:\r
223    *  Software Filtering. Range: 11 Bit For Standard CAN Identifier ... 29 Bit For\r
224    *  Extended CAN identifier */\r
225         uint32          CanIfCanRxPduCanId;\r
226 \r
227   /** Data Length code of received CAN L-PDUs used by the CAN Interface.\r
228    *  Exa: DLC check. The data area size of a CAN L-PDU can have a range\r
229    *  from 0 to 8 bytes.        uint8           CanIfCanRxPduDlc; */\r
230         uint8           CanIfCanRxPduDlc;\r
231 \r
232 #if ( CANIF_CANPDUID_READDATA_API == STD_ON )\r
233   /** Enables and disables the Rx buffering for reading of received L-PDU data.\r
234    *  True: Enabled False: Disabled */\r
235         boolean         CanIfReadRxPduData;\r
236 #endif\r
237 \r
238 #if ( CANIF_READRXPDU_NOTIF_STATUS_API == STD_ON )\r
239   /** CanIfReadRxPduNotifyStatus {CANIF_READRXPDU_NOTIFY_STATUS}\r
240    *  Enables and disables receive indication for each receive CAN L-PDU for\r
241    *  reading its' notification status. True: Enabled False: Disabled */\r
242         boolean         CanIfReadRxPduNotifyStatus;\r
243 #endif\r
244 \r
245   /** CAN Identifier of receive CAN L-PDUs used by the CAN Driver for CAN L-\r
246    *  PDU transmission.\r
247    *  EXTENDED_CAN  The CANID is of type Extended (29 bits)\r
248    *  STANDARD_CAN  The CANID is of type Standard (11 bits) */\r
249         CanIf_CanIdTypeType     CanIfRxPduIdCanIdType;\r
250 \r
251   /** This parameter defines the type of the receive indication call-outs called to\r
252    *  the corresponding upper layer the used TargetRxPduId belongs to. */\r
253         CanIf_UserTypeType  CanIfRxUserType;\r
254 \r
255   /** Name of target indication services to target upper layers (PduRouter,\r
256    *  CanNm, CanTp and ComplexDeviceDrivers). If parameter is 0 no call-out\r
257    *  function is configured. */\r
258         void *CanIfUserRxIndication;\r
259 \r
260   /** The HRH to which Rx L-PDU belongs to, is referred through this\r
261    *  parameter. */\r
262         const CanIf_HrhConfigType *CanIfCanRxPduHrhRef;\r
263 \r
264   /** Reference to the "global" Pdu structure to allow harmonization of handle\r
265    *  IDs in the COM-Stack. */\r
266         void *PduIdRef;\r
267 \r
268   /** Defines the type of software filtering that should be used\r
269    *  for this receive object. */\r
270         CanIf_SoftwareFilterTypeType CanIfSoftwareFilterType;\r
271 \r
272   /** Acceptance filters, 1 - care, 0 - don't care.\r
273    *  Is enabled by the CanIfSoftwareFilterMask in CanIf_HrhConfigType\r
274    *  ArcCore exension */\r
275         uint32 CanIfCanRxPduCanIdMask;\r
276 \r
277 } CanIf_RxPduConfigType;\r
278 \r
279 //-------------------------------------------------------------------\r
280 \r
281 /*\r
282  * CanIfControllerConfig container\r
283  */\r
284 /** Not supported. */\r
285 typedef enum {\r
286         CANIF_WAKEUP_SUPPORT_CONTROLLER,\r
287         CANIF_WAKEUP_SUPPORT_NO_WAKEUP,\r
288         CANIF_WAKEUP_SUPPORT_TRANSCEIVER\r
289 } CanIf_WakeupSupportType;\r
290 \r
291 \r
292 /** Container used to create channel init configurations.\r
293  *  @see CanIf_Arc_ConfigurationIndexType\r
294  *  @see CanIf_Arc_ChannelIdType */\r
295 typedef struct {\r
296     /** Not used */\r
297         CanIf_WakeupSupportType WakeupSupport;\r
298 \r
299         /** CanIf-specific id of the controller */\r
300         CanIf_Arc_ChannelIdType CanIfControllerIdRef;\r
301 \r
302         /** Not used */\r
303         const char CanIfDriverNameRef[8];\r
304 \r
305         /** Reference to */\r
306         const Can_ControllerConfigType *CanIfInitControllerRef;\r
307 } CanIf_ControllerConfigType;\r
308 \r
309 //-------------------------------------------------------------------\r
310 /*\r
311  * CanIfTransceiverDrvConfig container\r
312  */\r
313 \r
314 typedef struct {\r
315         boolean TrcvWakeupNotification;\r
316         uint8   TrcvIdRef;\r
317 } CanIf_TransceiverDrvConfigType;\r
318 \r
319 \r
320 typedef struct {\r
321         uint32 todo;\r
322 } CanIf_TransceiverConfigType;\r
323 \r
324 /** Callout functions with respect to the upper layers. This callout functions\r
325  *  defined in this container are common to all configured underlying CAN\r
326  *  Drivers / CAN Transceiver Drivers. */\r
327 typedef struct {\r
328         /** Name of target BusOff notification services to target upper layers\r
329          *  (PduRouter, CanNm, CanTp and ComplexDeviceDrivers). */\r
330         void (*CanIfBusOffNotification)(uint8 Controller);\r
331 \r
332         /** Name of target wakeup notification services to target upper layers\r
333          *  e.g Ecu_StateManager. If parameter is 0\r
334          *  no call-out function is configured. */\r
335         void (*CanIfWakeUpNotification)();\r
336 \r
337         /** Name of target wakeup validation notification services to target upper\r
338          *  layers (ECU State Manager). If parameter is 0 no call-out function is\r
339          *  configured. */\r
340         void (*CanIfWakeupValidNotification)();\r
341 \r
342         /** ArcCore ext. */\r
343         void (*CanIfErrorNotificaton)(uint8,Can_Arc_ErrorType);\r
344 \r
345 } CanIf_DispatchConfigType;\r
346 \r
347 /** This container contains the references to the configuration setup of each\r
348  *  underlying CAN driver. */\r
349 typedef struct {\r
350         /** Not used. */\r
351         uint32 CanIfConfigSet;\r
352 \r
353         /** Size of Rx PDU list. */\r
354         uint32 CanIfNumberOfCanRxPduIds;\r
355         /** Size of Tx PDU list. */\r
356         uint32 CanIfNumberOfCanTXPduIds;\r
357         /** Not used */\r
358         uint32 CanIfNumberOfDynamicCanTXPduIds;\r
359 \r
360         //\r
361         // Containers\r
362         //\r
363 \r
364   /** Hardware Object Handle list */\r
365         const CanIf_InitHohConfigType *CanIfHohConfigPtr;\r
366 \r
367   /** Rx PDU's list */\r
368         const CanIf_RxPduConfigType *CanIfRxPduConfigPtr;\r
369 \r
370   /** Tx PDU's list */\r
371         const CanIf_TxPduConfigType *CanIfTxPduConfigPtr;\r
372 \r
373 } CanIf_InitConfigType;\r
374 \r
375 /** Top level config container. */\r
376 typedef struct {\r
377         /** Reference to the list of channel init configurations. */\r
378         const CanIf_ControllerConfigType        *ControllerConfig;\r
379 \r
380         /** Callout functions with respect to the upper layers. This callout\r
381          *  functions defined in this container are common to all\r
382          *  configured underlying CAN Drivers / CAN Transceiver Drivers */\r
383         const CanIf_DispatchConfigType  *DispatchConfig;\r
384 \r
385         /** This container contains the init parameters of the CAN Interface. */\r
386         const CanIf_InitConfigType              *InitConfig;\r
387 \r
388         /** Not used */\r
389         const CanIf_TransceiverConfigType *TransceiverConfig;\r
390 \r
391         /** ArcCore: Contains the mapping from CanIf-specific Channels to Can Controllers */\r
392         const CanControllerIdType                       *Arc_ChannelToControllerMap;\r
393 \r
394         const uint8                                                     *Arc_ChannelDefaultConfIndex;\r
395 } CanIf_ConfigType;\r
396 \r
397 \r
398 #endif /* CANIF_CONFIGTYPES_H_ */\r
399 /** @} */\r
400 \r