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