added setting extended address during init
[mrf-link.git] / fw / mrf / defs.h
blob7848b5068974f4282a32c89544054196539d945c
1 /*
2 * Copyright 2010 Grygoriy Fuchedzhy <grygoriy.fuchedzhy@gmail.com>
4 * This file is part of mrf-link.
6 * mrf-link is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * mrf-link is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with mrf-link. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __MRF_DEFS__
21 #define __MRF_DEFS__
23 // BUF_ means buffer address
24 // RV_ means recommended value
25 // R_ means address register
26 // B_ means bit
27 // V_ means value
29 #define MRF_EXT_ADDR_LENGTH 8
30 #define MRF_SHORT_ADDR_LENGTH 2
32 #define MRF_BUF_TX_NORMAL 0x0
33 #define MRF_BUF_TX_BEACON 0x80
34 #define MRF_BUF_TX_GTS1 0x100
35 #define MRF_BUF_TX_GTS2 0x180
36 #define MRF_BUF_SECURITY 0x280
37 #define MRF_BUF_RX 0x300
39 // short address registers
40 #define MRF_R_RXMCR 0x00
41 #define MRF_R_PANIDL 0x01
42 #define MRF_R_PANIDH 0x02
43 #define MRF_R_SADRL 0x03
44 #define MRF_R_SADRH 0x04
45 #define MRF_R_EADR0 0x05
46 #define MRF_R_EADR1 0x06
47 #define MRF_R_EADR2 0x07
48 #define MRF_R_EADR3 0x08
49 #define MRF_R_EADR4 0x09
50 #define MRF_R_EADR5 0x0A
51 #define MRF_R_EADR6 0x0B
52 #define MRF_R_EADR7 0x0C
53 #define MRF_R_RXFLUSH 0x0D
54 #define MRF_R_ORDER 0x10
55 #define MRF_R_TXMCR 0x11
56 #define MRF_R_ACKTMOUT 0x12
57 #define MRF_R_ESLOTG1 0x13
58 #define MRF_R_SYMTICKL 0x14
59 #define MRF_R_SYMTICKH 0x15
60 #define MRF_R_PACON0 0x16
61 #define MRF_R_PACON1 0x17
62 #define MRF_R_PACON2 0x18
63 #define MRF_R_TXBCON0 0x1A
64 #define MRF_R_TXNCON 0x1B
65 #define MRF_R_TXG1CON 0x1C
66 #define MRF_R_TXG2CON 0x1D
67 #define MRF_R_ESLOTG23 0x1E
68 #define MRF_R_ESLOTG45 0x1F
69 #define MRF_R_ESLOTG67 0x20
70 #define MRF_R_TXPEND 0x21
71 #define MRF_R_WAKECON 0x22
72 #define MRF_R_FRMOFFSET 0x23
73 #define MRF_R_TXSTAT 0x24
74 #define MRF_R_TXBCON1 0x25
75 #define MRF_R_GATECLK 0x26
76 #define MRF_R_TXTIME 0x27
77 #define MRF_R_HSYMTMRL 0x28
78 #define MRF_R_HSYMTMRH 0x29
79 #define MRF_R_SOFTRST 0x2A
80 #define MRF_R_SECCON0 0x2C
81 #define MRF_R_SECCON1 0x2D
82 #define MRF_R_TXSTBL 0x2E
83 #define MRF_R_RXSR 0x30
84 #define MRF_R_INTSTAT 0x31
85 #define MRF_R_INTCON 0x32
86 #define MRF_R_GPIO 0x33
87 #define MRF_R_TRISGPIO 0x34
88 #define MRF_R_SLPACK 0x35
89 #define MRF_R_RFCTL 0x36
90 #define MRF_R_SECCR2 0x37
91 #define MRF_R_BBREG0 0x38
92 #define MRF_R_BBREG1 0x39
93 #define MRF_R_BBREG2 0x3A
94 #define MRF_R_BBREG3 0x3B
95 #define MRF_R_BBREG4 0x3C
96 #define MRF_R_BBREG6 0x3E
97 #define MRF_R_CCAEDTH 0x3F
99 // long address registers
100 #define MRF_R_RFCON0 0x200
101 #define MRF_R_RFCON1 0x201
102 #define MRF_R_RFCON2 0x202
103 #define MRF_R_RFCON3 0x203
104 #define MRF_R_RFCON5 0x205
105 #define MRF_R_RFCON6 0x206
106 #define MRF_R_RFCON7 0x207
107 #define MRF_R_RFCON8 0x208
108 #define MRF_R_SLPCAL0 0x209
109 #define MRF_R_SLPCAL1 0x20A
110 #define MRF_R_SLPCAL2 0x20B
111 #define MRF_R_RFSTATE 0x20F
112 #define MRF_R_RSSI 0x210
113 #define MRF_R_SLPCON0 0x211
114 #define MRF_R_SLPCON1 0x220
115 #define MRF_R_WAKETIMEL 0x222
116 #define MRF_R_WAKETIMEH 0x223
117 #define MRF_R_REMCNTL 0x224
118 #define MRF_R_REMCNTH 0x225
119 #define MRF_R_MAINCNT0 0x226
120 #define MRF_R_MAINCNT1 0x227
121 #define MRF_R_MAINCNT2 0x228
122 #define MRF_R_MAINCNT3 0x229
123 #define MRF_R_TESTMODE 0x22F
124 #define MRF_R_ASSOEADR0 0x230
125 #define MRF_R_ASSOEADR1 0x231
126 #define MRF_R_ASSOEADR2 0x232
127 #define MRF_R_ASSOEADR3 0x233
128 #define MRF_R_ASSOEADR4 0x234
129 #define MRF_R_ASSOEADR5 0x235
130 #define MRF_R_ASSOEADR6 0x236
131 #define MRF_R_ASSOEADR7 0x237
132 #define MRF_R_ASSOSADR0 0x238
133 #define MRF_R_ASSOSADR1 0x239
134 #define MRF_R_UPNONCE0 0x240
135 #define MRF_R_UPNONCE1 0x241
136 #define MRF_R_UPNONCE2 0x242
137 #define MRF_R_UPNONCE3 0x243
138 #define MRF_R_UPNONCE4 0x244
139 #define MRF_R_UPNONCE5 0x245
140 #define MRF_R_UPNONCE6 0x246
141 #define MRF_R_UPNONCE7 0x247
142 #define MRF_R_UPNONCE8 0x248
143 #define MRF_R_UPNONCE9 0x249
144 #define MRF_R_UPNONCE10 0x24A
145 #define MRF_R_UPNONCE11 0x24B
146 #define MRF_R_UPNONCE12 0x24C
148 // bits and values for registers
149 // MRF_R_RXMCR
150 #define MRF_B_NOACKRSP 5
151 #define MRF_B_PANCOORD 3
152 #define MRF_B_COORD 2
153 #define MRF_B_ERRPKT 1
154 #define MRF_B_PROMI 0
156 // MRF_R_RXFLUSH
157 #define MRF_B_WAKEPOL 6
158 #define MRF_B_WAKEPAD 5
159 #define MRF_B_CMDONLY 3
160 #define MRF_B_DATAONLY 2
161 #define MRF_B_BCNONLY 1
162 #define MRF_B_RXFLUSH 0
164 // MRF_R_TXMCR
165 #define MRF_B_NOCSMA 7
166 #define MRF_B_BATLIFEXT 6
167 #define MRF_B_SLOTTED 5
169 // MRF_R_ACKTMOUT
170 #define MRF_B_DRPACK 7
172 // MRF_R_PACON2
173 #define MRF_B_FIFOEN 7
174 #define MRF_RV_TXONTS (0x6<<2)
176 // MRF_R_TXNCON
177 #define MRF_B_FPSTAT 4
178 #define MRF_B_INDIRECT 3
180 // MRF_R_TXNCON
181 // MRF_R_TXG1CON
182 // MRF_R_TXG2CON
183 #define MRF_B_ACKREQ 2
185 // MRF_R_TXNCON
186 // MRF_R_TXG1CON
187 // MRF_R_TXG2CON
188 // MRF_R_TXBCON0
189 #define MRF_B_SECEN 1
190 #define MRF_B_TRIG 0
192 // MRF_R_TXPEND
193 #define MRF_B_GTSSWITCH 1
194 #define MRF_B_FPACK 0
196 // MRF_R_WAKECON
197 #define MRF_B_IMMWAKE 7
198 #define MRF_B_REGWAKE 6
200 // MRF_R_TXSTAT
201 #define MRF_B_CCAFAIL 5
202 #define MRF_B_TXG2FNT 4
203 #define MRF_B_TXG1FNT 3
204 #define MRF_B_TXG2STAT 2
205 #define MRF_B_TXG1STAT 1
206 #define MRF_B_TXNSTAT 0
208 // MRF_R_TXBCON1
209 #define MRF_B_TXBMSK 7
210 #define MRF_B_WU_BCN 6
212 // MRF_R_GATECLK
213 #define MRF_B_GTSON 3
215 // MRF_R_SOFTRST
216 #define MRF_B_RSTPWR 2
217 #define MRF_B_RSTBB 1
218 #define MRF_B_RSTMAC 0
220 // MRF_R_SECCON0
221 #define MRF_B_SECIGNORE 7
222 #define MRF_B_SECSTART 6
223 #define MRF_V_TXNCIPHER_AES_CBC_MAC_32 0x7
224 #define MRF_V_TXNCIPHER_AES_CBC_MAC_64 0x6
225 #define MRF_V_TXNCIPHER_AES_CBC_MAC_128 0x5
226 #define MRF_V_TXNCIPHER_AES_CCM_32 0x4
227 #define MRF_V_TXNCIPHER_AES_CCM_64 0x3
228 #define MRF_V_TXNCIPHER_AES_CCM_128 0x2
229 #define MRF_V_TXNCIPHER_AES_CTR 0x1
230 #define MRF_V_TXNCIPHER_NONE 0x0
231 #define MRF_V_RXCIPHER_AES_CBC_MAC_32 (0x7<<3)
232 #define MRF_V_RXCIPHER_AES_CBC_MAC_64 (0x6<<3)
233 #define MRF_V_RXCIPHER_AES_CBC_MAC_128 (0x5<<3)
234 #define MRF_V_RXCIPHER_AES_CCM_32 (0x4<<3)
235 #define MRF_V_RXCIPHER_AES_CCM_64 (0x3<<3)
236 #define MRF_V_RXCIPHER_AES_CCM_128 (0x2<<3)
237 #define MRF_V_RXCIPHER_AES_CTR (0x1<<3)
238 #define MRF_V_RXCIPHER_NONE (0x0<<3)
240 // MRF_R_SECCON1
241 #define MRF_B_DISDEC 1
242 #define MRF_B_DISENC 0
243 #define MRF_V_TXBCIPHER_AES_CBC_MAC_32 (0x7<<4)
244 #define MRF_V_TXBCIPHER_AES_CBC_MAC_64 (0x6<<4)
245 #define MRF_V_TXBCIPHER_AES_CBC_MAC_128 (0x5<<4)
246 #define MRF_V_TXBCIPHER_AES_CCM_32 (0x4<<4)
247 #define MRF_V_TXBCIPHER_AES_CCM_64 (0x3<<4)
248 #define MRF_V_TXBCIPHER_AES_CCM_128 (0x2<<4)
249 #define MRF_V_TXBCIPHER_AES_CTR (0x1<<4)
250 #define MRF_V_TXBCIPHER_NONE (0x0<<4)
252 // MRF_R_TXSTBL
253 #define MRF_RV_RFSTBL (0x9<<4)
254 #define MRF_RV_MSIFS 0x3
256 // MRF_R_RXSR
257 #define MRF_B_UPSECERR 6
258 #define MRF_B_BATIND 5
260 // MRF_R_INTSTAT
261 // MRF_R_INTCON
262 #define MRF_B_SLP 7
263 #define MRF_B_WAKE 6
264 #define MRF_B_HSYMTMR 5
265 #define MRF_B_SEC 4
266 #define MRF_B_RX 3
267 #define MRF_B_TXG2 2
268 #define MRF_B_TXG1 1
269 #define MRF_B_TXN 0
271 // MRF_R_GPIO
272 // MRF_R_TRISGPIO
273 #define MRF_B_GP5 5
274 #define MRF_B_GP4 4
275 #define MRF_B_GP3 3
276 #define MRF_B_GP2 2
277 #define MRF_B_GP1 1
278 #define MRF_B_GP0 0
280 // MRF_R_SLPACK
281 #define MRF_B_SLPACK 7
283 // MRF_R_RFCTL
284 #define MRF_B_RFRST 2
286 // MRF_R_SECCR2
287 #define MRF_B_UPDEC 7
288 #define MRF_B_UPENC 6
289 #define MRF_V_TXG1CIPHER_AES_CBC_MAC_32 0x7
290 #define MRF_V_TXG1CIPHER_AES_CBC_MAC_64 0x6
291 #define MRF_V_TXG1CIPHER_AES_CBC_MAC_128 0x5
292 #define MRF_V_TXG1CIPHER_AES_CCM_32 0x4
293 #define MRF_V_TXG1CIPHER_AES_CCM_64 0x3
294 #define MRF_V_TXG1CIPHER_AES_CCM_128 0x2
295 #define MRF_V_TXG1CIPHER_AES_CTR 0x1
296 #define MRF_V_TXG1CIPHER_NONE 0x0
297 #define MRF_V_TXG2CIPHER_AES_CBC_MAC_32 (0x7<<3)
298 #define MRF_V_TXG2CIPHER_AES_CBC_MAC_64 (0x6<<3)
299 #define MRF_V_TXG2CIPHER_AES_CBC_MAC_128 (0x5<<3)
300 #define MRF_V_TXG2CIPHER_AES_CCM_32 (0x4<<3)
301 #define MRF_V_TXG2CIPHER_AES_CCM_64 (0x3<<3)
302 #define MRF_V_TXG2CIPHER_AES_CCM_128 (0x2<<3)
303 #define MRF_V_TXG2CIPHER_AES_CTR (0x1<<3)
304 #define MRF_V_TXG2CIPHER_NONE (0x0<<3)
306 // MRF_R_BBREG0
307 #define MRF_B_TURBO 0
309 // MRF_R_BBREG1
310 #define MRF_B_RXDECINV 2
312 // MRF_R_BBREG2
313 #define MRF_V_CCAMODE_CARRIER_SENSE 0x40
314 #define MRF_V_CCAMODE_ENERGY_ABOVE_THRESHOLD 0x80
315 #define MRF_V_CCAMODE_CARRIER_SENSE_WITH_ENERGY_ABOVE_THRESHOLD 0xC0
317 // MRF_R_BBREG6
318 #define MRF_B_RSSIMODE1 7
319 #define MRF_B_RSSIMODE2 6
320 #define MRF_B_RSSIRDY 0
322 // MRF_R_CCAEDTH
323 #define MRF_RV_CCAEDTH 0x69
325 // MRF_R_RFCON0
326 #define MRF_B_RFRST 2
328 // MRF_R_RFCON1
329 #define MRF_RV_VCOOPT 0x1
331 // MRF_R_RFCON2
332 #define MRF_B_PLLEN 7
334 // MRF_R_RFCON6
335 #define MRF_B_TXFIL 7
336 #define MRF_B_20MRECVR 4
337 #define MRF_B_BATEN 3
339 // MRF_R_RFCON7
340 #define MRF_V_SLPCLKSEL_100kHz 0x80
341 #define MRF_V_SLPCLKSEL_32kHz 0x40
343 // MRF_R_RFCON8
344 #define MRF_B_RFVCO 4
346 // MRF_R_SLPCAL2
347 #define MRF_B_SLPCALRDY 7
348 #define MRF_B_SLPCALEN 4
350 // MRF_R_RFSTATE
351 #define MRF_V_RFSTATE_RTSEL2 0xE0
352 #define MRF_V_RFSTATE_RTSEL1 0xC0
353 #define MRF_V_RFSTATE_RX 0xA0
354 #define MRF_V_RFSTATE_TX 0x80
355 #define MRF_V_RFSTATE_CALVCO 0x60
356 #define MRF_V_RFSTATE_SLEEP 0x40
357 #define MRF_V_RFSTATE_CALFIL 0x20
358 #define MRF_V_RFSTATE_RESET 0x00
360 // MRF_R_SLPCON0
361 #define MRF_B_INTEDGE 1
362 #define MRF_B_SLPCLKEN 0
364 // MRF_R_SLPCON1
365 #define MRF_B_CLKOUTEN 5
367 // MRF_R_MAINCNT3
368 #define MRF_B_STARTCNT 7
370 // MRF_R_TESTMODE
371 #define MRF_V_TESTMODE_CONTROL_EXT_PA_LNA 0xF
372 #define MRF_V_TESTMODE_SINGLE_TONE 0xD
373 #define MRF_V_TESTMODE_NORMAL 0x8
375 #endif // __MRF_DEFS__