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