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