2 * Copyright Droids Corporation (2008)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * Author : Julien LE GUEN - jlg@jleguen.info
25 * This file defines the memory map of the CC2420
26 * as well as all registers and bit names.
27 * Please refer to the DataSheet of your chip
28 * for more information.
32 #ifndef _CC2420_ARCH_H_
33 #define _CC2420_ARCH_H_
37 * Read/write and RAM/register bits
39 #define WRITE_BIT (0<<6)
40 #define READ_BIT (1<<6)
42 #define REG_BIT (0<<7)
43 #define RAM_BIT (1<<7)
45 #define RAM_READ_WRITE (0<<5)
46 #define RAM_READ (1<<5)
50 #define BANK_MASK 0xC0
56 #define RAM_NOT_USED 0x16C /* Not used */
57 #define RAM_SHORTADR 0x16A /* 16-bits Short address */
58 #define RAM_PANID 0x168 /* 16-bits PAN identifier */
59 #define RAM_IEEEADR 0x160 /* 64-bits IEEE address */
60 #define RAM_CBCSTATE 0x150 /* Temporary storage for CBC-MAC calculation*/
61 #define RAM_TXNONCE 0x140 /* TX nonce (in-line auth) */
62 #define RAM_TXCTR RAM_TXNONCE /* TX counter (in-line encrypt) */
63 #define RAM_KEY1 0x130 /* Encryption key 1 */
64 #define RAM_SABUF 0x120 /* Stand-alone encryption buffer */
65 #define RAM_RXNONCE 0x110 /* RX nonce (in-line auth) */
66 #define RAM_RXCTR RAM_RXNONCE /* RX counter (in-line encrypt) */
67 #define RAM_KEY0 0x100 /* Encryption key 0 */
68 #define RAM_RXFIFO 0x080 /* 128 bytes RX FIFO */
69 #define RAM_TXFIFO 0x000 /* 128 bytes TX FIFO */
72 * Configuration Registers
74 /* STROBE registers */
75 #define SNOP 0x00 /* No operation */
76 #define SXOSCON 0x01 /* Turn ON the crystal oscillator */
77 #define STXCAL 0x02 /* Enable & calibrate frequency synth for TX */
78 #define SRXON 0x03 /* Enable RX */
79 #define STXON 0x04 /* Enable TX after calibration */
80 #define STXONCCA 0x05 /* if CCA clear, then enable calibration and TX */
81 #define SRFOFF 0x06 /* Disable RX/TX and freq synth */
82 #define SXOSCOFF 0x07 /* Turn OFF oscillator and RF */
83 #define SFLUSHRX 0x08 /* Flush RX fifo */
84 #define SFLUSHTX 0x09 /* Flush TX fifo */
85 #define SACK 0x0A /* Send ACK frame */
86 #define SACKPEND 0x0B /* Send ACK frame with pending bit */
87 #define SRXDEC 0x0C /* Start RXFIFO decryption */
88 #define STXENC 0x0D /* Start TXFIFO encryption */
89 #define SAES 0x0E /* AES Stand alone encryption */
92 /* Read / Write registers */
93 #define MAIN 0x10 /* Main control */
94 #define MDMCTRL0 0x11 /* Modem control 0 */
95 #define MDMCTRL1 0x12 /* Modem control 1 */
96 #define RSSI 0x13 /* RSSI and CCA status and control */
97 #define SYNCWORD 0x14 /* Synchronization word control */
98 #define TXCTRL 0x15 /* Transmit control */
99 #define RXCTRL0 0x16 /* Receive control 0 */
100 #define RXCTRL1 0x17 /* Receive control 1 */
101 #define FSCTRL 0x18 /* Frequency control and status */
102 #define SECCTRL0 0x19 /* Security control 0 */
103 #define SECCTRL1 0x1A /* Security control 1 */
104 #define BATTMON 0x1B /* Battery monitor control and status */
105 #define IOCFG0 0x1C /* IO control 0 */
106 #define IOCFG1 0x1D /* IO control 1 */
107 #define MANFIDL 0x1E /* Manufacturer ID low 16 bits */
108 #define MANFIDH 0x1F /* Manufacturer ID high 16 bits */
109 #define FSMTC 0x20 /* Finite State Machine Time Constants */
110 #define MANAND 0x21 /* Manual AND override */
111 #define MANOR 0x22 /* Manual OR override */
112 #define AGCCTRL 0x23 /* Automatic Gain Control */
113 #define AGCTST0 0x24 /* AGC test 0 */
114 #define AGCTST1 0x25 /* AGC test 1 */
115 #define AGCTST2 0x26 /* AGC test 2 */
116 #define FSTST0 0x27 /* Frequency Synthetizer test 0 */
117 #define FSTST1 0x28 /* FS test 1 */
118 #define FSTST2 0x29 /* FS test 2 */
119 #define FSTST3 0x2A /* FS test 3 */
120 #define RXBPFTST 0x2B /* Receiver Bandpass Filter test */
121 #define FSMSTATE 0x2C /* FSM status */
122 #define ADCTST 0x2D /* ADC test */
123 #define DACTST 0x2E /* DAC test */
124 #define TOPTST 0x2F /* Top Level test */
126 #define RESERVED 0x30
127 /* 0x31 - 0x3D not used */
129 #define TXFIFO 0x3E /* TX FIFO byte */
130 #define RXFIFO 0x3F /* RX FIFO byte */
134 * Status byte bit names
137 #define XOSC16M_STABLE 6
138 #define TX_UNDERFLOW 5
149 #define ENC_RESETn 14
150 #define DEMOD_RESETn 13
151 #define MOD_RESETn 12
153 /* 10 - 1 reserved */
154 #define XOSC16M_BYPASS 0
159 /* 15 - 14 reserved */
160 #define RESERVED_FRAME_MODE 13
161 #define PAN_COORDINATOR 12
162 #define ADR_DECODE 11
170 #define PREAMBLE_LENGTH3 3
171 #define PREAMBLE_LENGTH2 2
172 #define PREAMBLE_LENGTH1 1
173 #define PREAMBLE_LENGTH0 0
178 /* 15 - 11 reserved */
184 #define DEMOD_AVG_MODE 5
185 #define MODULATION_MODE 4
200 #define TXMIXBUF_CUR1 15
201 #define TXMIXBUF_CUR0 14
202 #define TX_TURNAROUND 13
203 #define TXMIX_CAP_ARRAY1 12
204 #define TXMIX_CAP_ARRAY0 11
205 #define TXMIX_CURRENT1 10
206 #define TXMIX_CURRENT0 9
213 #define RXMIXBUF_CUR 13
214 #define HIGH_LNA_GAIN 11
215 #define MED_LNA_GAIN 9
216 #define LOW_LNA_GAIN 7
217 #define HIGH_LNA_CURRENT 5
218 #define MED_LNA_CURRENT 3
219 #define LOW_LNA_CURRENT 1
224 #define RXBPF_LOCUR 13
225 #define RXBPF_MIDCUR 12
226 #define LOW_LOWGAIN 11
227 #define MED_LOWGAIN 10
230 #define LNA_CAP_ARRAY 7
233 #define RXMIX_CURRENT 1
240 #define CAL_RUNNING 12
241 #define LOCK_LENGTH 11
242 #define LOCK_STATUS 10
248 #define RXFIFO_PROTECTION 9
249 #define SEC_CBC_HEAD 8
250 #define SEC_SAKEYSEL 7
251 #define SEC_TXKEYSEL 6
252 #define SEC_RXKEYSEL 5
267 #define BATTMON_VOLTAGE 4
272 #define BCN_ACCEPT 11
273 #define FIFO_POLARITY 10
274 #define FIFOP_POLARITY 9
275 #define SFD_POLARITY 8
276 #define CCA_POLARITY 7
301 #define TC_RXCHAIN2RX 15
302 #define TC_SWITCH2TX 12
304 #define TC_TXEND2SWITCH 5
305 #define TC_TXEND2PAOFF 2
310 #define VGA_RESET_N 15
312 #define BALUN_CTRL 13
319 #define RXBPF_CAL_PD 6
330 #define VGA_GAIN_OE 11
332 #define LNAMIX_GAINMODE_O 3
333 #define LNAMIX_GAINMODE 1
338 #define LNAMIX_HYST 15
339 #define LNAMIX_THR_H 11
340 #define LNAMIX_THR_L 5
345 #define AGC_BLANK_MOD 14
346 #define PEAKDET_CUR_BOOST 13
347 #define AGC_SETTLE_WAIT 12
348 #define AGC_PEAK_DET_MODE 10
349 #define AGC_WIN_SIZE 7
355 #define MED2HIGHGAIN 9
356 #define LOW2MEDGAIN 4
361 #define VCO_ARRAY_SETTLE_LONG 11
362 #define VCO_ARRAY_OE 10
363 #define VCO_ARRAY_O 9
364 #define VCO_ARRAY_RES 4
369 #define VCO_TX_NOCAL 15
370 #define VCO_ARRAY_CAL_LONG 14
371 #define VCO_CURRENT_REF 13
372 #define VCO_CURRENT_K 9
379 #define VCO_CURCAL_SPEED 14
380 #define VCO_CURRENT_OE 12
381 #define VCO_CURRENT_O 11
382 #define VCO_CURRENT_RES 5
387 #define CHP_CAL_DISABLE 15
388 #define CHP_CURRENT_OE 14
389 #define CHP_TEST_UP 13
390 #define CHP_TEST_DN 12
391 #define CHP_DISABLE 11
393 #define CHP_STEP_PERIOD 9
394 #define STOP_CHP_CURRENT 7
395 #define START_CHP_CURRENT 3
400 #define RXBPF_CAP_OE 14
401 #define RXBPF_CAP_O 13
402 #define RXBPF_CAP_RES 6
407 #define FSM_CUR_STATE 5
412 #define ADC_CLOCK_DISABLE 15
426 #define RAM_BIST_RUN 7
427 #define TEST_BATTMON_EN 6
428 #define VC_IN_TEST_EN 5
429 #define ATESTMOD_PD 4
430 #define ATESTMOD_MODE 3
434 #endif /* _CC2420_ARCH_H_ */