]> rtime.felk.cvut.cz Git - arc.git/blob - boards/ti_tms570ls/examples/tms570_hdk_can/config/Can_Cfg.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / boards / ti_tms570ls / examples / tms570_hdk_can / config / Can_Cfg.h
1 /*\r
2 * Configuration of module: Can (Can_Cfg.h)\r
3 *\r
4 * Created by:              ArcCore\r
5 * Copyright:               \r
6 *\r
7 * Configured for (MCU):    TMS570\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 */\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 #ifndef CAN_CFG_H_\r
21 #define CAN_CFG_H_\r
22 \r
23 // Number of controller configs\r
24 #define CAN_ARC_CTRL_CONFIG_CNT         2\r
25 \r
26 #define CAN_DEV_ERROR_DETECT                    STD_OFF\r
27 #define CAN_VERSION_INFO_API                    STD_OFF\r
28 #define CAN_MULTIPLEXED_TRANSMISSION    STD_OFF  // Not supported\r
29 #define CAN_WAKEUP_SUPPORT                              STD_OFF  // Not supported\r
30 #define CAN_HW_TRANSMIT_CANCELLATION    STD_OFF  // Not supported\r
31 \r
32 typedef enum {\r
33         DCAN1 = 0,\r
34 //      CAN_CTRL_1 = 0,\r
35         DCAN2 = 1,\r
36 //      CAN_CTRL_2 = 1,\r
37         DCAN3 = 2,\r
38 //      CAN_CTRL_3 = 2,\r
39         CAN_CONTROLLER_CNT = 3\r
40 } CanControllerIdType;\r
41 \r
42 typedef enum {\r
43         CAN_ID_TYPE_EXTENDED,\r
44         CAN_ID_TYPE_MIXED,\r
45         CAN_ID_TYPE_STANDARD\r
46 } Can_IdTypeType;\r
47 \r
48 typedef enum {\r
49         CAN_OBJECT_TYPE_RECEIVE  = 0x00000000,\r
50         CAN_OBJECT_TYPE_TRANSMIT = 0x20000000\r
51 } Can_ObjectTypeType;\r
52 \r
53 typedef enum {\r
54         CAN_ARC_HANDLE_TYPE_BASIC,\r
55         CAN_ARC_HANDLE_TYPE_FULL\r
56 } Can_Arc_HohType;              // the type (Full-CAN or Basic-CAN) of a hardware object\r
57 \r
58 typedef enum {\r
59         TxHwObject,\r
60         NUM_OF_HTHS\r
61 } Can_Arc_HTHType;              // the type of the Hardware Transmit Handle\r
62 \r
63 \r
64 typedef enum {\r
65         RxHwObject,\r
66         NUM_OF_HRHS\r
67 } Can_Arc_HRHType;              // the type of the Hardware Receive Handle\r
68 \r
69 \r
70 typedef struct {\r
71         //      Specifies the InstanceId of this module instance. If only one instance is\r
72         //      present it shall have the Id 0\r
73         uint8 CanIndex;\r
74 } Can_GeneralType;\r
75 \r
76 \r
77 // mc9s12 unique??\r
78 typedef enum {\r
79   CAN_ARC_IDAM_2_32BIT,\r
80   CAN_ARC_IDAM_4_16BIT,\r
81   CAN_ARC_IDAM_8_8BIT,\r
82   CAN_ARC_IDAM_FILTER_CLOSED,\r
83 } Can_Arc_IDAMType;             // IDAM = identifier acceptance bits\r
84 \r
85 typedef uint32 Can_FilterMaskType;\r
86 \r
87 typedef enum {\r
88         CAN_ARC_PROCESS_TYPE_INTERRUPT = 0x00000400,\r
89         CAN_ARC_PROCESS_TYPE_POLLING   = 0x00000000\r
90 } Can_Arc_ProcessType;\r
91 \r
92 // TODO: !\r
93 typedef struct {\r
94         void (*CancelTxConfirmation)( const Can_PduType * );\r
95         void (*RxIndication)( uint8, Can_IdType, uint8,  const uint8 * );\r
96         void (*ControllerBusOff)(uint8);\r
97         void (*TxConfirmation)(PduIdType);\r
98         void (*ControllerWakeup)(uint8);\r
99         void (*Arc_Error)(uint8, Can_Arc_ErrorType);\r
100 } Can_CallbackType;\r
101 \r
102 typedef struct Can_HardwareObjectStruct {\r
103         Can_Arc_HohType CanHandleType;          /* Specifies the type (Full-CAN or Basic-CAN) of a hardware object. */\r
104         Can_IdTypeType CanIdType;                       /* Specifies whether the IdValue is of type - standard identifier - extended identifier- mixed mode. ImplementationType: Can_IdType */\r
105         uint32 CanIdValue;                                      /* Specifies (together with the filter mask) the identifiers range that passes the hardware filter. */\r
106         uint16 CanObjectId;                                     /* Holds the handle ID of HRH or HTH. The value of this parameter is unique in a given CAN Driver, and it should start with 0 and continue without any gaps. */\r
107         Can_ObjectTypeType CanObjectType;       /* Specifies if the HardwareObject is used as Transmit or as Receive object. */\r
108         //CanControllerIdType   CanControllerRef; /* Reference to CAN Controller to which the HOH is associated to. */\r
109         Can_FilterMaskType *CanFilterMaskRef; /* Reference to the filter mask that is used for hardware filtering together with the CAN_ID_VALUE. */\r
110         uint32 Can_Arc_MbMask;                          /* A "1" in this mask tells the driver that that HW Message Box should be occupied by this Hoh. A "1" in bit 31(ppc) occupies Mb 0 in HW. */\r
111         boolean Can_Arc_EOL;\r
112 } Can_HardwareObjectType;\r
113 \r
114 typedef struct {\r
115         Can_Arc_ProcessType CanBusOffProcessing;        /* Enables / disables API Can_MainFunction_BusOff() for handling busoff events in polling mode. */\r
116         boolean CanControllerActivation;                        /* Defines if a CAN controller is used in the configuration. */\r
117         //uint32 CanControllerBaseAddress;                      /* Specifies the CAN controller base address. */\r
118         CanControllerIdType CanControllerId;            /* Provides the controller ID which is unique in a given CAN Driver. */\r
119         Can_Arc_ProcessType CanRxProcessing;            /* Enables / disables API Can_MainFunction_Read() for handling PDU reception events in polling mode. */\r
120         Can_Arc_ProcessType CanTxProcessing;            /* Enables / disables API Can_MainFunction_Write() for handling PDU transmission events in polling mode. */\r
121         Can_Arc_ProcessType CanWakeupProcessing;        /* Enables / disables API Can_MainFunction_Wakeup() for handling wakeup events in polling mode. */\r
122         uint32 CanCpuClockRef;                                          /* Reference to the CPU clock configuration, which is set in the MCU driver configuration. */\r
123         uint32 CanWakeupSourceRef;                                      /* Reference to the Wakeup Source for this controller as defined in the ECU State Manager. Implementation Type: reference to EcuM_WakeupSourceType */\r
124 \r
125         uint32 CanControllerBaudRate;                           /* Specifies the baudrate of the controller in kbps. */\r
126         uint32 CanControllerPropSeg;                            /* Specifies propagation delay in time quantas. (uint8 ??) */\r
127         uint32 CanControllerSeg1;                                       /* Specifies phase segment 1 in time quantas. (uint8 ??) */\r
128         uint32 CanControllerSeg2;                                       /* Specifies phase segment 2 in time quantas. (uint8 ??) */\r
129         uint32 CanControllerSyncJumpWidth;                      /* Specifies the synchronization jump width for the controller in time quantas. (uint8 ??) */\r
130         uint32 CanControllerTimeQuanta;                         /* Specifies the time quanta for the controller. The calculation of the resulting prescaler value depending on module clocking and time quanta shall be done offline Hardware specific. */\r
131 \r
132         // List of Hoh id's that belong to this controller\r
133         const Can_HardwareObjectType  *Can_Arc_Hoh;\r
134 \r
135         boolean Can_Arc_Loopback;\r
136         boolean Can_Arc_Fifo;   // set this to use the fifo\r
137 } Can_ControllerConfigType;\r
138 \r
139 typedef struct {\r
140         const Can_ControllerConfigType *CanController;  /* contains the configuration parameters of the CAN controller(s) */\r
141 \r
142         // Callbacks( Extension )\r
143         const Can_CallbackType *CanCallbacks;\r
144 } Can_ConfigSetType;\r
145 \r
146 /* The type of external data structure containing the overall initialization data for the CAN driver and SFR settings affecting all controllers. */\r
147 typedef struct {\r
148         const Can_ConfigSetType  *CanConfigSet;                 /* the multiple configuration set container for CAN Driver */\r
149         const Can_GeneralType    *CanGeneral;                   /* contains the parameters related each CAN Driver Unit. */\r
150 } Can_ConfigType;\r
151 \r
152 extern const Can_ConfigType CanConfigData;\r
153 extern const Can_ControllerConfigType CanControllerConfigData[];\r
154 extern const Can_ConfigSetType Can_ConfigSet;\r
155 \r
156 #endif /*CAN_CFG_H_*/\r