regs.h


1
/*
2
 * regs.h
3
 *
4
 *  Created on: Feb 26, 2011
5
 *      Author: toti
6
 */
7
8
#ifndef REGS_H_
9
#define REGS_H_
10
11
12
#endif /* REGS_H_ */
13
14
15
#define SPI_RESET    0xC0
16
#define  SPI_READ    0x03
17
#define  SPI_READ_RX    0x90
18
#define  SPI_WRITE    0x02
19
#define  SPI_WRITE_TX  0x40
20
#define  SPI_RTS      0x80
21
#define SPI_READ_STATUS  0xA0
22
#define  SPI_RX_STATUS  0xB0
23
#define  SPI_BIT_MODIFY  0x05
24
/*@}*/
25
26
/** \name  Adressen der Register des MCP2515
27
 *
28
 * Die Redundanten Adressen von z.B. dem Register CANSTAT
29
 * (0x0E, 0x1E, 0x2E, ...) wurden dabei nicht mit aufgelistet.
30
 */
31
/*@{*/
32
#define RXF0SIDH  0x00
33
#define RXF0SIDL  0x01
34
#define RXF0EID8  0x02
35
#define RXF0EID0  0x03
36
#define RXF1SIDH  0x04
37
#define RXF1SIDL  0x05
38
#define RXF1EID8  0x06
39
#define RXF1EID0  0x07
40
#define RXF2SIDH  0x08
41
#define RXF2SIDL  0x09
42
#define RXF2EID8  0x0A
43
#define RXF2EID0  0x0B
44
#define BFPCTRL    0x0C
45
#define TXRTSCTRL  0x0D
46
#define CANSTAT    0x0E
47
#define CANCTRL    0x0F
48
49
#define RXF3SIDH  0x10
50
#define RXF3SIDL  0x11
51
#define RXF3EID8  0x12
52
#define RXF3EID0  0x13
53
#define RXF4SIDH  0x14
54
#define RXF4SIDL  0x15
55
#define RXF4EID8  0x16
56
#define RXF4EID0  0x17
57
#define RXF5SIDH  0x18
58
#define RXF5SIDL  0x19
59
#define RXF5EID8  0x1A
60
#define RXF5EID0  0x1B
61
#define TEC      0x1C
62
#define REC         0x1D
63
64
#define RXM0SIDH  0x20
65
#define RXM0SIDL  0x21
66
#define RXM0EID8  0x22
67
#define RXM0EID0  0x23
68
#define RXM1SIDH  0x24
69
#define RXM1SIDL  0x25
70
#define RXM1EID8  0x26
71
#define RXM1EID0  0x27
72
#define CNF3    0x28
73
#define CNF2    0x29
74
#define CNF1    0x2A
75
#define CANINTE    0x2B
76
#define CANINTF    0x2C
77
#define EFLG    0x2D
78
79
#define TXB0CTRL  0x30
80
#define TXB0SIDH  0x31
81
#define TXB0SIDL  0x32
82
#define TXB0EID8  0x33
83
#define TXB0EID0  0x34
84
#define TXB0DLC    0x35
85
#define TXB0D0    0x36
86
#define TXB0D1    0x37
87
#define TXB0D2    0x38
88
#define TXB0D3    0x39
89
#define TXB0D4    0x3A
90
#define TXB0D5    0x3B
91
#define TXB0D6    0x3C
92
#define TXB0D7    0x3D
93
94
#define TXB1CTRL  0x40
95
#define TXB1SIDH  0x41
96
#define TXB1SIDL  0x42
97
#define TXB1EID8  0x43
98
#define TXB1EID0  0x44
99
#define TXB1DLC    0x45
100
#define TXB1D0    0x46
101
#define TXB1D1    0x47
102
#define TXB1D2    0x48
103
#define TXB1D3    0x49
104
#define TXB1D4    0x4A
105
#define TXB1D5    0x4B
106
#define TXB1D6    0x4C
107
#define TXB1D7    0x4D
108
109
#define TXB2CTRL  0x50
110
#define TXB2SIDH  0x51
111
#define TXB2SIDL  0x52
112
#define TXB2EID8  0x53
113
#define TXB2EID0  0x54
114
#define TXB2DLC    0x55
115
#define TXB2D0    0x56
116
#define TXB2D1    0x57
117
#define TXB2D2    0x58
118
#define TXB2D3    0x59
119
#define TXB2D4    0x5A
120
#define TXB2D5    0x5B
121
#define TXB2D6    0x5C
122
#define TXB2D7    0x5D
123
124
#define RXB0CTRL  0x60
125
#define RXB0SIDH  0x61
126
#define RXB0SIDL  0x62
127
#define RXB0EID8  0x63
128
#define RXB0EID0  0x64
129
#define RXB0DLC    0x65
130
#define RXB0D0    0x66
131
#define RXB0D1    0x67
132
#define RXB0D2    0x68
133
#define RXB0D3    0x69
134
#define RXB0D4    0x6A
135
#define RXB0D5    0x6B
136
#define RXB0D6    0x6C
137
#define RXB0D7    0x6D
138
139
#define RXB1CTRL  0x70
140
#define RXB1SIDH  0x71
141
#define RXB1SIDL  0x72
142
#define RXB1EID8  0x73
143
#define RXB1EID0  0x74
144
#define RXB1DLC    0x75
145
#define RXB1D0    0x76
146
#define RXB1D1    0x77
147
#define RXB1D2    0x78
148
#define RXB1D3    0x79
149
#define RXB1D4    0x7A
150
#define RXB1D5    0x7B
151
#define RXB1D6    0x7C
152
#define RXB1D7    0x7D
153
/*@}*/
154
155
/** \name  Bitdefinition der verschiedenen Register */
156
/*@{*/
157
158
/** \brief  Bitdefinition von BFPCTRL */
159
#define B1BFS    5
160
#define B0BFS    4
161
#define B1BFE    3
162
#define B0BFE    2
163
#define B1BFM    1
164
#define B0BFM    0
165
166
/** \brief  Bitdefinition von TXRTSCTRL */
167
#define B2RTS    5
168
#define B1RTS    4
169
#define B0RTS    3
170
#define B2RTSM    2
171
#define B1RTSM    1
172
#define B0RTSM    0
173
174
/** \brief  Bitdefinition von CANSTAT */
175
#define OPMOD2    7
176
#define OPMOD1    6
177
#define OPMOD0    5
178
#define ICOD2    3
179
#define ICOD1    2
180
#define ICOD0    1
181
182
/** \brief  Bitdefinition von CANCTRL */
183
#define REQOP2    7
184
#define REQOP1    6
185
#define REQOP0    5
186
#define ABAT    4
187
#define CLKEN    2
188
#define CLKPRE1    1
189
#define CLKPRE0    0
190
191
/** \brief  Bitdefinition von CNF3 */
192
#define WAKFIL    6
193
#define PHSEG22    2
194
#define PHSEG21    1
195
#define PHSEG20    0
196
197
/** \brief  Bitdefinition von CNF2 */
198
#define BTLMODE    7
199
#define SAM      6
200
#define PHSEG12    5
201
#define PHSEG11    4
202
#define PHSEG10    3
203
#define PHSEG2    2
204
#define PHSEG1    1
205
#define PHSEG0    0
206
207
/** \brief  Bitdefinition von CNF1 */
208
#define SJW1    7
209
#define SJW0    6
210
#define BRP5    5
211
#define BRP4    4
212
#define BRP3    3
213
#define BRP2    2
214
#define BRP1    1
215
#define BRP0    0
216
217
/** \brief  Bitdefinition von CANINTE */
218
#define MERRE    7
219
#define WAKIE    6
220
#define ERRIE    5
221
#define TX2IE    4
222
#define TX1IE    3
223
#define TX0IE    2
224
#define RX1IE    1
225
#define RX0IE    0
226
227
/** \brief  Bitdefinition von CANINTF */
228
#define MERRF    7
229
#define WAKIF    6
230
#define ERRIF    5
231
#define TX2IF    4
232
#define TX1IF    3
233
#define TX0IF    2
234
#define RX1IF    1
235
#define RX0IF    0
236
237
/** \brief  Bitdefinition von EFLG */
238
#define RX1OVR    7
239
#define RX0OVR    6
240
#define TXB0    5
241
#define TXEP    4
242
#define RXEP    3
243
#define TXWAR    2
244
#define RXWAR    1
245
#define EWARN    0
246
247
/** \brief  Bitdefinition von TXBnCTRL (n = 0, 1, 2) */
248
#define ABTF    6
249
#define MLOA    5
250
#define TXERR    4
251
#define TXREQ    3
252
#define TXP1    1
253
#define TXP0    0
254
255
/** \brief  Bitdefinition von RXB0CTRL */
256
#define RXM1    6
257
#define RXM0    5
258
#define RXRTR    3
259
#define BUKT    2
260
#define BUKT1    1
261
#define FILHIT0    0
262
263
/** \brief  Bitdefinition von TXBnSIDL (n = 0, 1) */
264
#define  EXIDE    3
265
266
/**
267
 * \brief  Bitdefinition von RXB1CTRL
268
 * \see    RXM1, RXM0, RXRTR und FILHIT0 sind schon fuer RXB0CTRL definiert
269
 */
270
#define FILHIT2    2
271
#define FILHIT1    1
272
273
/** \brief  Bitdefinition von RXBnSIDL (n = 0, 1) */
274
#define  SRR      4
275
#define  IDE      3
276
277
/**
278
 * \brief  Bitdefinition von RXBnDLC (n = 0, 1)
279
 * \see    TXBnDLC   (gleiche Bits)
280
 */
281
#define  RTR      6
282
#define  DLC3    3
283
#define  DLC2    2
284
#define  DLC1    1
285
#define DLC0    0
286
287
/*@}*/