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
23 #warning "This default file may only be used as an example!"
\r
27 #include "CanIf_Cbk.h"
\r
29 /* CONFIGURATION TEMPLATE
\r
30 * ------------------------------------------------------------------
\r
32 * The following template configures:
\r
33 * - 2 CAN controllers, CAN_CTRL_A and CAN_CNTR_C
\r
34 * - Callbacks are configured to call standard CanIf callbacks
\r
38 * - Extended 11-bit ID's
\r
39 * - Rx/Tx are interrupt based
\r
40 * - Both Rx(MB 16->24) and Tx(MB 24->31) Hoh's are of type BASIC
\r
44 * - Standard 29-bit ID's
\r
45 * - Rx/Tx are interrupt based
\r
46 * - Both Rx(MB 16->24) and Tx(MB 24->31) Hoh's are of type BASIC
\r
50 // Accept everything = 0
\r
51 Can_FilterMaskType Can_FilterMaskConfigData = 0;
\r
53 // HOH:s for CAN_CTRL_A
\r
54 const Can_HardwareObjectType CanHardwareObjectConfig_CTRL_A[] =
\r
57 .CanHandleType = CAN_ARC_HANDLE_TYPE_BASIC,
\r
58 .CanIdType = CAN_ID_TYPE_EXTENDED,
\r
59 .CanObjectType = CAN_OBJECT_TYPE_RECEIVE,
\r
60 .CanObjectId = CAN_HRH_A_1,
\r
61 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
63 .Can_Arc_MbMask = 0x00ff0000,
\r
67 .CanHandleType = CAN_ARC_HANDLE_TYPE_BASIC,
\r
68 .CanIdType = CAN_ID_TYPE_EXTENDED,
\r
69 .CanObjectType = CAN_OBJECT_TYPE_TRANSMIT,
\r
70 .CanObjectId = CAN_HTH_A_1,
\r
71 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
73 .Can_Arc_MbMask = 0xff000000,
\r
78 // HOH:s for CAN_CTRL_C
\r
79 const Can_HardwareObjectType CanHardwareObjectConfig_CTRL_C[] =
\r
82 .CanHandleType = CAN_ARC_HANDLE_TYPE_BASIC,
\r
83 .CanIdType = CAN_ID_TYPE_STANDARD,
\r
84 .CanObjectType = CAN_OBJECT_TYPE_RECEIVE,
\r
85 .CanObjectId = CAN_HRH_C_1,
\r
86 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
88 .Can_Arc_MbMask = 0x00ff0000,
\r
92 .CanHandleType = CAN_ARC_HANDLE_TYPE_BASIC,
\r
93 .CanIdType = CAN_ID_TYPE_STANDARD,
\r
94 .CanObjectType = CAN_OBJECT_TYPE_TRANSMIT,
\r
95 .CanObjectId = CAN_HTH_C_1,
\r
96 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
98 .Can_Arc_MbMask = 0xff000000,
\r
103 /* CAN controller data for ALL controllers that are to be configured
\r
104 * See Autosar release 3.0 specification for more info
\r
106 const Can_ControllerConfigType CanControllerConfigData[] =
\r
109 .CanControllerActivation = TRUE,
\r
110 .CanControllerBaudRate = 125,
\r
111 .CanControllerId = CAN_CTRL_A,
\r
112 .CanControllerPropSeg = 4,
\r
113 .CanControllerSeg1 = 4,
\r
114 .CanControllerSeg2 = 4,
\r
115 .CanBusOffProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
116 .CanRxProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
117 .CanTxProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
118 .CanWakeupProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
119 .CanCpuClockRef = PERIPHERAL_CLOCK_FLEXCAN_A,
\r
121 .Can_Arc_Hoh = &CanHardwareObjectConfig_CTRL_A[0],
\r
122 .Can_Arc_Loopback = 0,
\r
126 .CanControllerActivation = TRUE,
\r
127 .CanControllerBaudRate = 125,
\r
128 .CanControllerId = CAN_CTRL_C,
\r
129 .CanControllerPropSeg = 4,
\r
130 .CanControllerSeg1 = 4,
\r
131 .CanControllerSeg2 = 4,
\r
132 .CanBusOffProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
133 .CanRxProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
134 .CanTxProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
135 .CanWakeupProcessing = CAN_ARC_PROCESS_TYPE_INTERRUPT,
\r
136 .CanCpuClockRef = PERIPHERAL_CLOCK_FLEXCAN_C,
\r
138 .Can_Arc_Hoh = &CanHardwareObjectConfig_CTRL_C[0],
\r
139 .Can_Arc_Loopback = 1,
\r
144 /* Callbacks for the can drivers
\r
145 * See Autosar release 3.0 specification for more info
\r
147 const Can_CallbackType CanCallbackConfigData = {
\r
148 NULL, //CanIf_CancelTxConfirmation,
\r
149 CanIf_RxIndication,
\r
150 CanIf_ControllerBusOff,
\r
151 CanIf_TxConfirmation,
\r
152 NULL, //CanIf_ControllerWakeup,
\r
156 /* Configset configuration information
\r
157 * See Autosar release 3.0 specification for more info
\r
159 const Can_ConfigSetType CanConfigSetData =
\r
161 .CanController = CanControllerConfigData,
\r
162 .CanCallbacks = &CanCallbackConfigData,
\r
165 /* Top config struct passed to Can_Init() */
\r
166 const Can_ConfigType CanConfigData = {
\r
167 .CanConfigSet = &CanConfigSetData,
\r