1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\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
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
14 * -------------------------------- Arctic Core ------------------------------*/
\r
16 /** @addtogroup CanIf CAN Interface
\r
19 /** @file CanIf_ConfigTypes.h
\r
20 * Definitions of configuration parameters for CAN Interface.
\r
23 #ifndef CANIF_CONFIGTYPES_H_
\r
24 #define CANIF_CONFIGTYPES_H_
\r
27 /** Software filtering type */
\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
36 /** Type of the upper layer interfacing this module */
\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
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
48 /** Defines if PDU Can id can be changed at runtime. */
\r
50 CANIF_PDU_TYPE_STATIC = 0,
\r
51 CANIF_PDU_TYPE_DYNAMIC /**< Not supported */
\r
52 } CanIf_PduTypeType;
\r
54 /** PDU Can id type */
\r
56 CANIF_CAN_ID_TYPE_29 = 0,
\r
57 CANIF_CAN_ID_TYPE_11
\r
58 } CanIf_CanIdTypeType;
\r
60 //-------------------------------------------------------------------
\r
62 * CanIfHrhRangeConfig container
\r
65 /** Parameters for configuring Can id ranges. Not supported. */
\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
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
79 //-------------------------------------------------------------------
\r
81 * CanIfInitHrhConfig container
\r
83 /** Definition of Hardware Receive Handle */
\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
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
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
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
105 /** Defines the parameters required for configuraing multiple
\r
106 * CANID ranges for a given same HRH. */
\r
107 const CanIf_HrhRangeConfigType *CanIfHrhRangeConfig;
\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
113 //-------------------------------------------------------------------
\r
115 * CanIfInitHthConfig container
\r
117 /** Definition of Hardware Transmit Handle */
\r
119 /** Defines the HTH type i.e, whether its a BasicCan or FullCan. */
\r
120 Can_Arc_HohType CanIfHthType;
\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
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
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
136 //-------------------------------------------------------------------
\r
138 * CanIfInitHohConfig container
\r
140 /** Definition of Hardware Object Handle. */
\r
142 /** Reference to the CAN Driver controller config. */
\r
143 const Can_ConfigSetType *CanConfigSet;
\r
145 /** This container contains contiguration parameters for each hardware receive object. */
\r
146 const CanIf_HrhConfigType *CanIfHrhConfig;
\r
148 /** This container contains parameters releated to each HTH */
\r
149 const CanIf_HthConfigType *CanIfHthConfig;
\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
155 //-------------------------------------------------------------------
\r
157 * CanIfTxPduConfig container
\r
160 /** Definition of Tx PDU (Protocol Data Unit). */
\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
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
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
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
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
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
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
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
204 /** Reference to the "global" Pdu structure to allow harmonization of handle
\r
205 * IDs in the COM-Stack. */
\r
207 } CanIf_TxPduConfigType;
\r
209 //-------------------------------------------------------------------
\r
211 * CanIfRxPduConfig container
\r
215 /** Definition of Rx PDU (Protocol Data Unit). */
\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
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
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
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
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
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
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
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
261 /** The HRH to which Rx L-PDU belongs to, is referred through this
\r
263 const CanIf_HrhConfigType *CanIfCanRxPduHrhRef;
\r
265 /** Reference to the "global" Pdu structure to allow harmonization of handle
\r
266 * IDs in the COM-Stack. */
\r
269 /** Defines the type of software filtering that should be used
\r
270 * for this receive object. */
\r
271 CanIf_SoftwareFilterTypeType CanIfSoftwareFilterType;
\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
278 } CanIf_RxPduConfigType;
\r
280 //-------------------------------------------------------------------
\r
283 * CanIfControllerConfig container
\r
285 /** Not supported. */
\r
287 CANIF_WAKEUP_SUPPORT_CONTROLLER,
\r
288 CANIF_WAKEUP_SUPPORT_NO_WAKEUP,
\r
289 CANIF_WAKEUP_SUPPORT_TRANSCEIVER
\r
290 } CanIf_WakeupSupportType;
\r
293 /** Container used to create channel init configurations.
\r
294 * @see CanIf_Arc_ConfigurationIndexType
\r
295 * @see CanIf_Arc_ChannelIdType */
\r
298 CanIf_WakeupSupportType WakeupSupport;
\r
300 /** CanIf-specific id of the controller */
\r
301 CanIf_Arc_ChannelIdType CanIfControllerIdRef;
\r
304 const char CanIfDriverNameRef[8];
\r
306 /** Reference to */
\r
307 const Can_ControllerConfigType *CanIfInitControllerRef;
\r
308 } CanIf_ControllerConfigType;
\r
310 //-------------------------------------------------------------------
\r
312 * CanIfTransceiverDrvConfig container
\r
316 boolean TrcvWakeupNotification;
\r
318 } CanIf_TransceiverDrvConfigType;
\r
323 } CanIf_TransceiverConfigType;
\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
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
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
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
341 void (*CanIfWakeupValidNotification)();
\r
343 /** ArcCore ext. */
\r
344 void (*CanIfErrorNotificaton)(uint8,Can_Arc_ErrorType);
\r
346 } CanIf_DispatchConfigType;
\r
348 /** This container contains the references to the configuration setup of each
\r
349 * underlying CAN driver. */
\r
352 uint32 CanIfConfigSet;
\r
354 /** Size of Rx PDU list. */
\r
355 uint32 CanIfNumberOfCanRxPduIds;
\r
356 /** Size of Tx PDU list. */
\r
357 uint32 CanIfNumberOfCanTXPduIds;
\r
359 uint32 CanIfNumberOfDynamicCanTXPduIds;
\r
365 /** Hardware Object Handle list */
\r
366 const CanIf_InitHohConfigType *CanIfHohConfigPtr;
\r
368 /** Rx PDU's list */
\r
369 const CanIf_RxPduConfigType *CanIfRxPduConfigPtr;
\r
371 /** Tx PDU's list */
\r
372 const CanIf_TxPduConfigType *CanIfTxPduConfigPtr;
\r
374 } CanIf_InitConfigType;
\r
376 /** Top level config container. */
\r
378 /** Reference to the list of channel init configurations. */
\r
379 const CanIf_ControllerConfigType *ControllerConfig;
\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
386 /** This container contains the init parameters of the CAN Interface. */
\r
387 const CanIf_InitConfigType *InitConfig;
\r
390 const CanIf_TransceiverConfigType *TransceiverConfig;
\r
392 /** ArcCore: Contains the mapping from CanIf-specific Channels to Can Controllers */
\r
393 const CanControllerIdType *Arc_ChannelToControllerMap;
\r
395 const uint8 *Arc_ChannelDefaultConfIndex;
\r
396 } CanIf_ConfigType;
\r
399 #endif /* CANIF_CONFIGTYPES_H_ */
\r