-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCan_PBcfg.c
119 lines (109 loc) · 4.52 KB
/
Can_PBcfg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Can_PBcfg.c
*
* Created on: Sep 20, 2019
* Author: Sad MultiVerse
*/
#include "Can.h"
McuClockReferencePoint Clk = CLOCK;
/*BaudRate Configuration For Controller 0*/
CanControllerBaudrateConfig CanControllerBaudrateConf[] =
{
{
500, /* BaudRate in Kbps */
CONTROLLER_0_BDR_ID, /* Baudrate Configuration ID */
3, /* propagation delay */
10, /* Phase1 */
2, /* Phase2 */
2 /* SJW */
}
};
/* Controller0 Configuration */
CanController CanControllerCfg[] =
{
{
0, /* Controller ID */
0x40040000, /* BASE Address */
&Clk, /* Reference to System clock in Hz */
&CanControllerBaudrateConf[0] /* Reference to Baudrate configuration */
},
{
1, /* Controller ID */
0x40041000, /* BASE Address */
&Clk, /* Reference to System clock in Hz */
&CanControllerBaudrateConf[0] /* Reference to Baudrate configuration */
}
};
/*Filter configuration for HOH0*/
CanHwFilter CanHwFilterHTH[] =
{
{
1, /* ID */
0x7FF /* Mask.not used as it's TRANSMIT HOH */
}
};
/*Filter configuration for HOH1*/
CanHwFilter CanHwFilterHRH[] =
{
{
2, /* ID */
0x7FF /* Mask filter */
}
,
{
3, /* ID */
0x7FF /* Mask filter */
}
};
/*Configuration FOR all used Hardware objects*/
CanHardwareObject HOHObj[] =
{
{ FULL, /* Can controller type for tm4c123gh6pm */
1, /* Number of FIFO elements for this HOH */
STANDARD, /* Arbitration ID type */
HTH0_0, /* HOH ID */
TRANSMIT, /* HOH Type */
&CanControllerCfg[0], /* Reference to the controller this HOH belongs to */
&CanHwFilterHTH[0], /* Reference to the Filter configuartion */
FALSE /* Enable or diasble using polling */
},
{
FULL, /* Can controller type for tm4c123gh6pm */
1, /* Number of FIFO elements for this HOH */
STANDARD, /* Arbitration ID type */
HRH0_0, /* HOH ID */
RECEIVE, /* HOH Type */
&CanControllerCfg[0], /* Reference to the controller this HOH belongs to */
&CanHwFilterHRH[0], /* Reference to the Filter configuartion */
FALSE /* Enable or diasble using polling */
},
{
FULL, /* Can controller type for tm4c123gh6pm */
1, /* Number of FIFO elements for this HOH */
STANDARD, /* Arbitration ID type */
HTH0_1, /* HOH ID */
TRANSMIT, /* HOH Type */
&CanControllerCfg[0], /* Reference to the controller this HOH belongs to */
&CanHwFilterHTH[0], /* Reference to the Filter configuartion */
TRUE /* Enable or diasble using polling */
},
{
FULL, /* Can controller type for tm4c123gh6pm */
1, /* Number of FIFO elements for this HOH */
STANDARD, /* Arbitration ID type */
HRH0_1, /* HOH ID */
RECEIVE, /* HOH Type */
&CanControllerCfg[0], /* Reference to the controller this HOH belongs to */
&CanHwFilterHRH[1], /* Reference to the Filter configuartion */
TRUE /* Enable or diasble using polling */
}
};
/*This is the type of the external data structure containing the overall initialization
data for the CAN driver and SFR settings affecting all controllers. Furthermore it
contains pointers to controller configuration structures. The contents of the
initialization data structure are CAN hardware specific. */
const Can_ConfigType Can_Configurations =
{
CanControllerCfg,
HOHObj
};