1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
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>.
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
14 * -------------------------------- Arctic Core ------------------------------*/
23 #ifndef CANIF_CFG_H_
\r
24 #define CANIF_CFG_H_
\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
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
45 typedef void (*CanIf_FuncTypeCanSpecial)(PduIdType, const uint8 *, uint8, Can_IdType);
\r
48 CANIF_PDU_TYPE_STATIC = 0,
\r
49 CANIF_PDU_TYPE_DYNAMIC // Not supported
\r
50 } CanIf_PduTypeType;
\r
53 CANIF_CAN_ID_TYPE_29 = 0,
\r
54 CANIF_CAN_ID_TYPE_11
\r
55 } CanIf_CanIdTypeType;
\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
72 //-------------------------------------------------------------------
\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
84 //-------------------------------------------------------------------
\r
86 * CanIfHrhRangeConfig container
\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
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
103 //-------------------------------------------------------------------
\r
105 * CanIfInitHrhConfig container
\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
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
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
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
128 // Defines the parameters required for configuraing multiple
\r
129 // CANID ranges for a given same HRH.
\r
130 const CanIf_HrhRangeConfigType *CanIfHrhRangeConfig;
\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
136 //-------------------------------------------------------------------
\r
138 * CanIfInitHthConfig container
\r
142 // Defines the HTH type i.e, whether its a BasicCan or FullCan.
\r
143 Can_EcoreHohType CanIfHthType;
\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
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
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
159 //-------------------------------------------------------------------
\r
161 * CanIfInitHohConfig container
\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
169 // This container contains contiguration parameters for each hardware receive object.
\r
170 const CanIf_HrhConfigType *CanIfHrhConfig;
\r
172 // This container contains parameters releated to each HTH
\r
173 const CanIf_HthConfigType *CanIfHthConfig;
\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
179 //-------------------------------------------------------------------
\r
181 * CanIfTxPduConfig container
\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
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
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
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
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
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
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
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
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
228 const CanIf_HthConfigType *CanIfCanTxPduHthRef;
\r
230 // Reference to the "global" Pdu structure to allow harmonization of handle
\r
231 // IDs in the COM-Stack. ..
\r
233 } CanIf_TxPduConfigType;
\r
235 //-------------------------------------------------------------------
\r
237 * CanIfRxPduConfig container
\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
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
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
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
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
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
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
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
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
290 // The HRH to which Rx L-PDU belongs to, is referred through this
\r
292 const CanIf_HrhConfigType *CanIfCanRxPduHrhRef;
\r
294 // Reference to the "global" Pdu structure to allow harmonization of handle
\r
295 // IDs in the COM-Stack.
\r
298 // Defines the type of software filtering that should be used
\r
299 // for this receive object.
\r
300 CanIf_SoftwareFilterTypeType CanIfSoftwareFilterType;
\r
302 // Acceptance filters, 1 - care, 0 - don't care.
\r
303 // Is enabled by the CanIfSoftwareFilterMask in CanIf_HrhConfigType
\r
305 uint32 CanIfCanRxPduCanIdMask;
\r
307 } CanIf_RxPduConfigType;
\r
309 //-------------------------------------------------------------------
\r
312 * CanIfControllerConfig container
\r
316 CANIF_WAKEUP_SUPPORT_CONTROLLER,
\r
317 CANIF_WAKEUP_SUPPORT_NO_WAKEUP,
\r
318 CANIF_WAKEUP_SUPPORT_TRANSCEIVER,
\r
319 } CanIf_WakeupSupportType;
\r
322 // This is the type supplied to CanIf_InitController()
\r
324 CanIf_WakeupSupportType WakeupSupport; // Not used
\r
326 CanControllerIdType CanIfControllerIdRef;
\r
328 const char CanIfDriverNameRef[8]; // Not used
\r
330 const Can_ControllerConfigType *CanIfInitControllerRef;
\r
331 } CanIf_ControllerConfigType;
\r
333 //-------------------------------------------------------------------
\r
335 * CanIfTransceiverDrvConfig container
\r
339 boolean TrcvWakeupNotification;
\r
341 } CanIf_TransceiverDrvConfigType;
\r
346 } CanIf_TransceiverConfigType;
\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
352 // Name of target BusOff notification services to target upper layers
\r
353 // (PduRouter, CanNm, CanTp and ComplexDeviceDrivers).
\r
355 void (*CanIfBusOffNotification)(uint8 Controller);
\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
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
366 // Multiplicity: 0..1
\r
367 void (*CanIfWakeupValidNotification)();
\r
370 void (*CanIfErrorNotificaton)(uint8,Can_EcoreErrorType);
\r
372 } CanIf_DispatchConfigType;
\r
374 // This container contains the references to the configuration setup of each
\r
375 // underlying CAN driver.
\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
383 uint32 CanIfNumberOfCanRxPduIds;
\r
384 uint32 CanIfNumberOfCanTXPduIds;
\r
385 uint32 CanIfNumberOfDynamicCanTXPduIds;
\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
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
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
407 // Multiplicity: 0..*
\r
408 const CanIf_TxPduConfigType *CanIfTxPduConfigPtr;
\r
410 } CanIf_InitConfigType;
\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
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
424 // This container contains the init parameters of the CAN
\r
426 // Multiplicity: 1..*
\r
427 const CanIf_InitConfigType *InitConfig;
\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
437 extern CanIf_ConfigType CanIf_Config;
\r