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 ------------------------------*/
25 #include "CanIf_Cbk.h"
\r
27 /* CONFIGURATION TEMPLATE
\r
28 * ------------------------------------------------------------------
\r
30 * The following template configures:
\r
31 * - 2 CAN controllers, CAN_CTRL_A and CAN_CNTR_C
\r
32 * - Callbacks are configured to call standard CanIf callbacks
\r
36 * - Extended 11-bit ID's
\r
37 * - Rx/Tx are interrupt based
\r
38 * - Both Rx(MB 16->24) and Tx(MB 24->31) Hoh's are of type BASIC
\r
42 * - Standard 29-bit ID's
\r
43 * - Rx/Tx are interrupt based
\r
44 * - Both Rx(MB 16->24) and Tx(MB 24->31) Hoh's are of type BASIC
\r
48 // Accept everything = 0
\r
49 Can_FilterMaskType Can_FilterMaskConfigData = 0;
\r
51 // HOH:s for CAN_CTRL_A
\r
52 const Can_HardwareObjectType CanHardwareObjectConfig_CTRL_A[] =
\r
55 .CanHandleType = CAN_ECORE_HANDLE_TYPE_BASIC,
\r
56 .CanIdType = CAN_ID_TYPE_EXTENDED,
\r
57 .CanObjectType = CAN_OBJECT_TYPE_RECEIVE,
\r
58 .CanObjectId = CAN_HRH_A_1,
\r
59 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
61 .CanEcoreMbMask = 0x00ff0000,
\r
65 .CanHandleType = CAN_ECORE_HANDLE_TYPE_BASIC,
\r
66 .CanIdType = CAN_ID_TYPE_EXTENDED,
\r
67 .CanObjectType = CAN_OBJECT_TYPE_TRANSMIT,
\r
68 .CanObjectId = CAN_HTH_A_1,
\r
69 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
71 .CanEcoreMbMask = 0xff000000,
\r
76 // HOH:s for CAN_CTRL_C
\r
77 const Can_HardwareObjectType CanHardwareObjectConfig_CTRL_C[] =
\r
80 .CanHandleType = CAN_ECORE_HANDLE_TYPE_BASIC,
\r
81 .CanIdType = CAN_ID_TYPE_STANDARD,
\r
82 .CanObjectType = CAN_OBJECT_TYPE_RECEIVE,
\r
83 .CanObjectId = CAN_HRH_C_1,
\r
84 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
86 .CanEcoreMbMask = 0x00ff0000,
\r
90 .CanHandleType = CAN_ECORE_HANDLE_TYPE_BASIC,
\r
91 .CanIdType = CAN_ID_TYPE_STANDARD,
\r
92 .CanObjectType = CAN_OBJECT_TYPE_TRANSMIT,
\r
93 .CanObjectId = CAN_HTH_C_1,
\r
94 .CanFilterMaskRef = &Can_FilterMaskConfigData,
\r
96 .CanEcoreMbMask = 0xff000000,
\r
101 /* CAN controller data for ALL controllers that are to be configured
\r
102 * See Autosar release 3.0 specification for more info
\r
104 const Can_ControllerConfigType CanControllerConfigData[] =
\r
107 .CanControllerActivation = TRUE,
\r
108 .CanControllerBaudRate = 125,
\r
109 .CanControllerId = CAN_CTRL_A,
\r
110 .CanControllerPropSeg = 4,
\r
111 .CanControllerSeg1 = 4,
\r
112 .CanControllerSeg2 = 4,
\r
113 .CanBusOffProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
114 .CanRxProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
115 .CanTxProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
116 .CanWakeupProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
117 .CanCpuClockRef = PERIPHERAL_CLOCK_FLEXCAN_A,
\r
119 .CanEcoreHoh = &CanHardwareObjectConfig_CTRL_A[0],
\r
120 .CanEcoreLoopback = 0,
\r
124 .CanControllerActivation = TRUE,
\r
125 .CanControllerBaudRate = 125,
\r
126 .CanControllerId = CAN_CTRL_C,
\r
127 .CanControllerPropSeg = 4,
\r
128 .CanControllerSeg1 = 4,
\r
129 .CanControllerSeg2 = 4,
\r
130 .CanBusOffProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
131 .CanRxProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
132 .CanTxProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
133 .CanWakeupProcessing = CAN_ECORE_PROCESS_TYPE_INTERRUPT,
\r
134 .CanCpuClockRef = PERIPHERAL_CLOCK_FLEXCAN_C,
\r
136 .CanEcoreHoh = &CanHardwareObjectConfig_CTRL_C[0],
\r
137 .CanEcoreLoopback = 1,
\r
142 /* Callbacks for the can drivers
\r
143 * See Autosar release 3.0 specification for more info
\r
145 const Can_CallbackType CanCallbackConfigData = {
\r
146 NULL, //CanIf_CancelTxConfirmation,
\r
147 CanIf_RxIndication,
\r
148 CanIf_ControllerBusOff,
\r
149 CanIf_TxConfirmation,
\r
150 NULL, //CanIf_ControllerWakeup,
\r
154 /* Configset configuration information
\r
155 * See Autosar release 3.0 specification for more info
\r
157 const Can_ConfigSetType CanConfigSetData =
\r
159 .CanController = CanControllerConfigData,
\r
160 .CanCallbacks = &CanCallbackConfigData,
\r
163 /* Top config struct passed to Can_Init() */
\r
164 const Can_ConfigType CanConfigData = {
\r
165 .CanConfigSet = &CanConfigSetData,
\r