]> rtime.felk.cvut.cz Git - arc.git/blob - boards/mpc5606s/examples/can_node/config/Can_Cfg.h
Cleanup of some drivers. Re-generated examples for mpc551xsim
[arc.git] / boards / mpc5606s / examples / can_node / config / Can_Cfg.h
1 /*\r
2 * Configuration of module: Can (Can_Cfg.h)\r
3 *\r
4 * Created by:              \r
5 * Copyright:               \r
6 *\r
7 * Configured for (MCU):    MPC551x\r
8 *\r
9 * Module vendor:           ArcCore\r
10 * Generator version:       2.0.2\r
11 *\r
12 * Generated by Arctic Studio (http://arccore.com) \r
13 *           on Tue May 10 13:36:20 CEST 2011\r
14 */\r
15 \r
16
17 #if !(((CAN_SW_MAJOR_VERSION == 1) && (CAN_SW_MINOR_VERSION == 0)) )
18 #error Can: Configuration file expected BSW module version to be 1.0.*
19 #endif
20
21         \r
22 \r
23 #ifndef CAN_CFG_H_\r
24 #define CAN_CFG_H_\r
25 \r
26 // Number of controller configs\r
27 #define CAN_ARC_CTRL_CONFIG_CNT         1\r
28 \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_OFF  // Not supported\r
32 #define CAN_WAKEUP_SUPPORT                              STD_OFF  // Not supported\r
33 #define CAN_HW_TRANSMIT_CANCELLATION    STD_OFF  // Not supported\r
34 \r
35 typedef enum {\r
36         FLEXCAN_A = 0,\r
37         CAN_CTRL_A = 0,\r
38         FLEXCAN_B = 1,\r
39         CAN_CTRL_B = 1,\r
40         FLEXCAN_C = 2,\r
41         CAN_CTRL_C = 2,\r
42         FLEXCAN_D = 3,\r
43         CAN_CTRL_D = 3,\r
44         FLEXCAN_E = 4,\r
45         CAN_CTRL_E = 4,\r
46         FLEXCAN_F = 5,\r
47         CAN_CTRL_F = 5,\r
48         CAN_CONTROLLER_CNT = 6\r
49 }CanControllerIdType;\r
50 \r
51 \r
52 typedef enum {\r
53         CAN_ID_TYPE_EXTENDED,\r
54         CAN_ID_TYPE_MIXED,\r
55         CAN_ID_TYPE_STANDARD\r
56 } Can_IdTypeType;\r
57 \r
58 typedef enum {\r
59         CAN_OBJECT_TYPE_RECEIVE,\r
60         CAN_OBJECT_TYPE_TRANSMIT\r
61 } Can_ObjectTypeType;\r
62 \r
63 \r
64 typedef enum {\r
65         CAN_ARC_HANDLE_TYPE_BASIC,\r
66         CAN_ARC_HANDLE_TYPE_FULL\r
67 } Can_Arc_HohType;\r
68 \r
69 \r
70 typedef enum {\r
71         HWObj_2,\r
72         NUM_OF_HTHS\r
73 } Can_Arc_HTHType;\r
74 \r
75 \r
76 typedef enum {\r
77         HWObj_1,\r
78         NUM_OF_HRHS\r
79 } Can_Arc_HRHType;\r
80 \r
81 \r
82 typedef struct {\r
83         void (*CancelTxConfirmation)( const Can_PduType *);\r
84         void (*RxIndication)( uint8 ,Can_IdType ,uint8 , const uint8 * );\r
85         void (*ControllerBusOff)(uint8);\r
86         void (*TxConfirmation)(PduIdType);\r
87         void (*ControllerWakeup)(uint8);\r
88         void (*Arc_Error)(uint8,Can_Arc_ErrorType);\r
89 } Can_CallbackType;\r
90 \r
91 \r
92 typedef struct {\r
93         //      Specifies the InstanceId of this module instance. If only one instance is\r
94         //      present it shall have the Id 0\r
95         uint8 CanIndex;\r
96 } Can_GeneralType;\r
97 \r
98 // Start mc9s12 unique\r
99 typedef enum {\r
100   CAN_ARC_IDAM_2_32BIT,\r
101   CAN_ARC_IDAM_4_16BIT,\r
102   CAN_ARC_IDAM_8_8BIT,\r
103   CAN_ARC_IDAM_FILTER_CLOSED,\r
104 } Can_Arc_IDAMType;\r
105 \r
106 typedef uint32 Can_FilterMaskType;\r
107 \r
108 typedef struct Can_HardwareObjectStruct {\r
109         // Specifies the type (Full-CAN or Basic-CAN) of a hardware object.\r
110         Can_Arc_HohType CanHandleType;\r
111 \r
112         // Specifies whether the IdValue is of type - standard identifier - extended\r
113         // identifier - mixed mode ImplementationType: Can_IdType\r
114         Can_IdTypeType CanIdType;\r
115 \r
116         //      Specifies (together with the filter mask) the identifiers range that passes\r
117         //      the hardware filter.\r
118         uint32 CanIdValue;\r
119 \r
120         //      Holds the handle ID of HRH or HTH. The value of this parameter is unique\r
121         //      in a given CAN Driver, and it should start with 0 and continue without any\r
122         //      gaps. The HRH and HTH Ids are defined under two different name-spaces.\r
123         //      Example: HRH0-0, HRH1-1, HTH0-2, HTH1-3\r
124         uint32 CanObjectId;\r
125 \r
126         // Specifies if the HardwareObject is used as Transmit or as Receive object\r
127         Can_ObjectTypeType CanObjectType;\r
128 \r
129         // Reference to the filter mask that is used for hardware filtering togerther\r
130         // with the CAN_ID_VALUE\r
131         Can_FilterMaskType *CanFilterMaskRef;\r
132 \r
133         // A "1" in this mask tells the driver that that HW Message Box should be\r
134         // occupied by this Hoh. A "1" in bit 31(ppc) occupies Mb 0 in HW.\r
135         uint32 Can_Arc_MbMask;  \r
136         \r
137         // End Of List. Set to TRUE is this is the last object in the list.\r
138         boolean Can_Arc_EOL;\r
139 } Can_HardwareObjectType;\r
140 \r
141 typedef enum {\r
142         CAN_ARC_PROCESS_TYPE_INTERRUPT,\r
143         CAN_ARC_PROCESS_TYPE_POLLING\r
144 } Can_Arc_ProcessType;\r
145 \r
146 typedef struct {\r
147 \r
148         //      Enables / disables API Can_MainFunction_BusOff() for handling busoff\r
149         //      events in polling mode.\r
150         // INTERRUPT or POLLING\r
151         Can_Arc_ProcessType CanBusOffProcessing;\r
152 \r
153         // Defines if a CAN controller is used in the configuration.\r
154         boolean CanControllerActivation;\r
155 \r
156         // Specifies the buadrate of the controller in kbps.\r
157         uint32 CanControllerBaudRate;\r
158 \r
159         //      This parameter provides the controller ID which is unique in a given CAN\r
160         //      Driver. The value for this parameter starts with 0 and continue without any\r
161         //      gaps.\r
162         CanControllerIdType CanControllerId;\r
163 \r
164         // Specifies propagation delay in time quantas.\r
165         uint32 CanControllerPropSeg;\r
166 \r
167         // Specifies phase segment 1 in time quantas.\r
168         uint32 CanControllerSeg1;\r
169 \r
170         // Specifies phase segment 2 in time quantas.\r
171         uint32 CanControllerSeg2;\r
172 \r
173         //      Specifies the time quanta for the controller. The calculation of the resulting\r
174         //      prescaler value depending on module clocking and time quanta shall be\r
175         //      done offline Hardware specific.\r
176         uint32 CanControllerTimeQuanta;\r
177 \r
178         //      Enables / disables API Can_MainFunction_Read() for handling PDU\r
179         //      reception events in polling mode.\r
180         Can_Arc_ProcessType CanRxProcessing;\r
181 \r
182         //      Enables / disables API Can_MainFunction_Write() for handling PDU\r
183         //      transmission events in polling mode.\r
184         Can_Arc_ProcessType CanTxProcessing;\r
185 \r
186         //      Enables / disables API Can_MainFunction_Wakeup() for handling wakeup\r
187         //      events in polling mode.\r
188         Can_Arc_ProcessType CanWakeupProcessing;\r
189 \r
190         //      Reference to the CPU clock configuration, which is set in the MCU driver\r
191         //      configuration\r
192         uint32 CanCpuClockRef;\r
193 \r
194         //      This parameter contains a reference to the Wakeup Source for this\r
195         //      controller as defined in the ECU State Manager. Implementation Type:\r
196         //      reference to EcuM_WakeupSourceType\r
197         uint32 CanWakeupSourceRef;\r
198 \r
199         // List of Hoh id's that belong to this controller\r
200         const Can_HardwareObjectType  *Can_Arc_Hoh;\r
201 \r
202         boolean Can_Arc_Loopback;\r
203 \r
204         // Set this to use the fifo\r
205         boolean Can_Arc_Fifo;\r
206 } Can_ControllerConfigType;\r
207 \r
208 \r
209 typedef struct {\r
210         const Can_ControllerConfigType *CanController;\r
211         \r
212         // Callbacks( Extension )\r
213         const Can_CallbackType *CanCallbacks;\r
214 } Can_ConfigSetType;\r
215 \r
216 \r
217 typedef struct {\r
218         // This is the multiple configuration set container for CAN Driver\r
219         // Multiplicity 1..*\r
220         const Can_ConfigSetType  *CanConfigSet;\r
221         // This container contains the parameters related each CAN\r
222         // Driver Unit.\r
223         // Multiplicity 1..*\r
224         const Can_GeneralType    *CanGeneral;\r
225 } Can_ConfigType;\r
226 \r
227 \r
228 extern const Can_ConfigType CanConfigData;\r
229 extern const Can_ControllerConfigType CanControllerConfigData[];\r
230 extern const Can_ConfigSetType Can_ConfigSet;\r
231 \r
232 #endif /*CAN_CFG_H_*/\r