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 ------------------------------*/
26 // Number of controller configs
\r
27 #define CAN_ECORE_CTRL_CONFIG_CNT 2
\r
29 #define CAN_DEV_ERROR_DETECT STD_ON
\r
30 #define CAN_VERSION_INFO_API STD_ON
\r
31 #define CAN_MULTIPLEXED_TRANSMISSION STD_ON // Makes no differens in the code
\r
32 #define CAN_WAKEUP_SUPPORT STD_OFF // Not supported
\r
33 #define CAN_HW_TRANSMIT_CANCELLATION STD_OFF // Not supported
\r
35 // loop cnt.. very strange timeout
\r
36 #define CAN_TIMEOUT_DURATION 100
\r
42 #define CAN_BUSOFF_PROCESSING INTERRUPT // INTERRUPT/POLLING
\r
43 #define CAN_CONTROLLER_ACTIVATION OFF
\r
44 #define CAN_CONTROLLER_BAUD_RATE 125000
\r
45 #define CAN_DRIVER_CONTROLLER_ID 0
\r
46 #define CAN_CONTROLLER_PROP_SEG 4
\r
47 #define CAN_CONTROLLER_PHASE1_SEG 4
\r
48 #define CAN_CONTROLLER_PHASE2_SEG 4
\r
49 #define CAN_CONTROLLER_TIME_QUANTA 4
\r
50 #define CAN_RX_PROCESSING INTERRUPT
\r
51 #define CAN_TX_PROCESSING INTERRUPT
\r
52 #define CAN_WAKEUP_PROCESSING INTERRUPT
\r
62 }CanControllerIdType;
\r
65 CAN_ID_TYPE_EXTENDED,
\r
67 CAN_ID_TYPE_STANDARD,
\r
71 CAN_OBJECT_TYPE_RECEIVE,
\r
72 CAN_OBJECT_TYPE_TRANSMIT,
\r
73 } Can_ObjectTypeType;
\r
76 CAN_ECORE_HANDLE_TYPE_BASIC,
\r
77 CAN_ECORE_HANDLE_TYPE_FULL
\r
81 // Due to effiency: Start with index 0 and don't use any holes in the enumeration
\r
89 // Due to effiency: Start with index 0 and don't use any holes in the enumeration
\r
96 // Non-standard type
\r
98 void (*CancelTxConfirmation)( const Can_PduType *);
\r
99 void (*RxIndication)( uint8 ,Can_IdType ,uint8 , const uint8 * );
\r
100 void (*ControllerBusOff)(uint8);
\r
101 void (*TxConfirmation)(PduIdType);
\r
102 void (*ControllerWakeup)(uint8);
\r
103 void (*EcoreError)(uint8,Can_EcoreErrorType);
\r
104 } Can_CallbackType;
\r
107 * CanGeneral Container
\r
110 // This container contains the parameters related each CAN Driver Unit.
\r
112 // Specifies the InstanceId of this module instance. If only one instance is
\r
113 // present it shall have the Id 0
\r
116 #if 0 // This is only used by the config tool
\r
117 // This parameter describes the period for cyclic call to
\r
118 // Can_MainFunction_Busoff. Unit is seconds.
\r
119 float CanMainFunctionBusoffPeriod;
\r
120 // This parameter describes the period for cyclic call to
\r
121 // Can_MainFunction_Read. Unit is seconds.
\r
122 float CanMainFunctionReadPeriod;
\r
123 // This parameter describes the period for cyclic call to
\r
124 // Can_MainFunction_Wakeup. Unit is seconds.
\r
125 float CanMainFunctionWakeupPeriod;
\r
126 // This parameter describes the period for cyclic call to
\r
127 // Can_MainFunction_Write. Unit is seconds.
\r
128 float CanMainFunctionWritePeriod;
\r
132 #if ( CAN_TIMEOUT_DURATION == STD_ON )
\r
133 // Specifies the maximum number of loops for blocking function until a
\r
134 // timeout is raised in short term wait loops.
\r
135 uint32 CanTimeoutDurationFactor;
\r
142 * CanFilterMask container
\r
144 typedef uint32 Can_FilterMaskType;
\r
147 * CanHardwareObject container
\r
150 //This container contains the configuration (parameters) of CAN Hardware
\r
152 typedef struct Can_HardwareObjectStruct {
\r
153 // Specifies the type (Full-CAN or Basic-CAN) of a hardware object.
\r
154 Can_EcoreHohType CanHandleType;
\r
156 // Specifies whether the IdValue is of type - standard identifier - extended
\r
157 // identifier - mixed mode ImplementationType: Can_IdType
\r
158 Can_IdTypeType CanIdType;
\r
160 // Specifies (together with the filter mask) the identifiers range that passes
\r
161 // the hardware filter.
\r
164 // Holds the handle ID of HRH or HTH. The value of this parameter is unique
\r
165 // in a given CAN Driver, and it should start with 0 and continue without any
\r
166 // gaps. The HRH and HTH Ids are defined under two different name-spaces.
\r
167 // Example: HRH0-0, HRH1-1, HTH0-2, HTH1-3
\r
168 uint32 CanObjectId;
\r
170 // Specifies if the HardwareObject is used as Transmit or as Receive object
\r
171 Can_ObjectTypeType CanObjectType;
\r
173 // Reference to the filter mask that is used for hardware filtering togerther
\r
174 // with the CAN_ID_VALUE
\r
175 Can_FilterMaskType *CanFilterMaskRef;
\r
177 // A "1" in this mask tells the driver that that HW Message Box should be
\r
178 // occupied by this Hoh. A "1" in bit 31(ppc) occupies Mb 0 in HW.
\r
179 uint32 CanEcoreMbMask;
\r
181 // End Of List. Set to TRUE is this is the last object in the list.
\r
182 boolean CanEcoreEOL;
\r
184 } Can_HardwareObjectType;
\r
188 * CanController container
\r
191 CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
192 CAN_ECORE_PROCESS_TYPE_POLLING,
\r
193 } Can_EcoreProcessType;
\r
197 // Enables / disables API Can_MainFunction_BusOff() for handling busoff
\r
198 // events in polling mode.
\r
199 // INTERRUPT or POLLING
\r
200 Can_EcoreProcessType CanBusOffProcessing;
\r
202 // Defines if a CAN controller is used in the configuration.
\r
203 boolean CanControllerActivation;
\r
205 // Specifies the buadrate of the controller in kbps.
\r
206 uint32 CanControllerBaudRate;
\r
208 // This parameter provides the controller ID which is unique in a given CAN
\r
209 // Driver. The value for this parameter starts with 0 and continue without any
\r
211 CanControllerIdType CanControllerId;
\r
213 // Specifies propagation delay in time quantas.
\r
214 uint32 CanControllerPropSeg;
\r
216 // Specifies phase segment 1 in time quantas.
\r
217 uint32 CanControllerSeg1;
\r
219 // Specifies phase segment 2 in time quantas.
\r
220 uint32 CanControllerSeg2;
\r
222 // Specifies the time quanta for the controller. The calculation of the resulting
\r
223 // prescaler value depending on module clocking and time quanta shall be
\r
224 // done offline Hardware specific.
\r
225 uint32 CanControllerTimeQuanta;
\r
227 // Enables / disables API Can_MainFunction_Read() for handling PDU
\r
228 // reception events in polling mode.
\r
229 Can_EcoreProcessType CanRxProcessing;
\r
231 // Enables / disables API Can_MainFunction_Write() for handling PDU
\r
232 // transmission events in polling mode.
\r
233 Can_EcoreProcessType CanTxProcessing;
\r
235 // Enables / disables API Can_MainFunction_Wakeup() for handling wakeup
\r
236 // events in polling mode.
\r
237 Can_EcoreProcessType CanWakeupProcessing;
\r
239 // Reference to the CPU clock configuration, which is set in the MCU driver
\r
241 uint32 CanCpuClockRef;
\r
243 // This parameter contains a reference to the Wakeup Source for this
\r
244 // controller as defined in the ECU State Manager. Implementation Type:
\r
245 // reference to EcuM_WakeupSourceType
\r
246 uint32 CanWakeupSourceRef;
\r
252 // List of Hoh id's that belong to this controller
\r
253 const Can_HardwareObjectType *CanEcoreHoh;
\r
255 boolean CanEcoreLoopback;
\r
257 // Set this to use the fifo
\r
258 boolean CanEcoreFifo;
\r
260 } Can_ControllerConfigType;
\r
265 * CanConfigSet container
\r
268 const Can_ControllerConfigType *CanController;
\r
270 // Callbacks( Extension )
\r
271 const Can_CallbackType *CanCallbacks;
\r
272 } Can_ConfigSetType;
\r
276 // This is the multiple configuration set container for CAN Driver
\r
277 // Multiplicity 1..*
\r
278 const Can_ConfigSetType *CanConfigSet;
\r
279 // This container contains the parameters related each CAN
\r
281 // Multiplicity 1..*
\r
282 const Can_GeneralType *CanGeneral;
\r
288 extern const Can_ConfigType CanConfigData;
\r
289 extern const Can_ControllerConfigType CanControllerConfigData[];
\r
290 extern const Can_ConfigSetType Can_ConfigSet;
\r
293 #endif /*CAN_CFG_H_*/
\r