1a72f7ea6Sql147931 /* 2*9aa73b68SQin Michael Li * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 3a72f7ea6Sql147931 * Use is subject to license terms. 4a72f7ea6Sql147931 */ 5a72f7ea6Sql147931 /* 6a72f7ea6Sql147931 * Copyright (c) 2005 David Young. All rights reserved. 7a72f7ea6Sql147931 * 8a72f7ea6Sql147931 * This code was written by David Young. 9a72f7ea6Sql147931 * 10a72f7ea6Sql147931 * Redistribution and use in source and binary forms, with or without 11a72f7ea6Sql147931 * modification, are permitted provided that the following conditions 12a72f7ea6Sql147931 * are met: 13a72f7ea6Sql147931 * 1. Redistributions of source code must retain the above copyright 14a72f7ea6Sql147931 * notice, this list of conditions and the following disclaimer. 15a72f7ea6Sql147931 * 2. Redistributions in binary form must reproduce the above copyright 16a72f7ea6Sql147931 * notice, this list of conditions and the following disclaimer in the 17a72f7ea6Sql147931 * documentation and/or other materials provided with the distribution. 18a72f7ea6Sql147931 * 3. Neither the name of the author nor the names of any co-contributors 19a72f7ea6Sql147931 * may be used to endorse or promote products derived from this software 20a72f7ea6Sql147931 * without specific prior written permission. 21a72f7ea6Sql147931 * 22a72f7ea6Sql147931 * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY 23a72f7ea6Sql147931 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24a72f7ea6Sql147931 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25a72f7ea6Sql147931 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David 26a72f7ea6Sql147931 * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27a72f7ea6Sql147931 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28a72f7ea6Sql147931 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29a72f7ea6Sql147931 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30a72f7ea6Sql147931 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31a72f7ea6Sql147931 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32a72f7ea6Sql147931 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33a72f7ea6Sql147931 * OF SUCH DAMAGE. 34a72f7ea6Sql147931 */ 35a72f7ea6Sql147931 #ifndef _SA2400REG_H_ 36a72f7ea6Sql147931 #define _SA2400REG_H_ 37a72f7ea6Sql147931 38*9aa73b68SQin Michael Li #ifdef __cplusplus 39*9aa73b68SQin Michael Li extern "C" { 40*9aa73b68SQin Michael Li #endif 41*9aa73b68SQin Michael Li 42a72f7ea6Sql147931 /* 43a72f7ea6Sql147931 * Serial bus format for Philips SA2400 Single-chip Transceiver. 44a72f7ea6Sql147931 */ 45a72f7ea6Sql147931 #define SA2400_TWI_DATA_MASK BITS(31, 8) 46a72f7ea6Sql147931 #define SA2400_TWI_WREN BIT(7) /* enable write */ 47a72f7ea6Sql147931 #define SA2400_TWI_ADDR_MASK BITS(6, 0) 48a72f7ea6Sql147931 49a72f7ea6Sql147931 /* 50a72f7ea6Sql147931 * Registers for Philips SA2400 Single-chip Transceiver. 51a72f7ea6Sql147931 */ 52a72f7ea6Sql147931 #define SA2400_SYNA 0 /* Synthesizer Register A */ 53a72f7ea6Sql147931 /* 54a72f7ea6Sql147931 * fractional modulus select, 55a72f7ea6Sql147931 * 0: /8 (default) 56a72f7ea6Sql147931 * 1: /5 57a72f7ea6Sql147931 */ 58a72f7ea6Sql147931 #define SA2400_SYNA_FM BIT(21) 59a72f7ea6Sql147931 /* 60a72f7ea6Sql147931 * fractional increment value, 61a72f7ea6Sql147931 * 0 to 7, default 4 62a72f7ea6Sql147931 */ 63a72f7ea6Sql147931 #define SA2400_SYNA_NF_MASK BITS(20, 18) 64a72f7ea6Sql147931 /* 65a72f7ea6Sql147931 * main divider division ratio, 66a72f7ea6Sql147931 * 512 to 65535, default 615 67a72f7ea6Sql147931 */ 68a72f7ea6Sql147931 #define SA2400_SYNA_N_MASK BITS(17, 2) 69a72f7ea6Sql147931 70a72f7ea6Sql147931 #define SA2400_SYNB 1 /* Synthesizer Register B */ 71a72f7ea6Sql147931 /* 72a72f7ea6Sql147931 * reference divider ratio, 73a72f7ea6Sql147931 * 4 to 1023, default 11 74a72f7ea6Sql147931 */ 75a72f7ea6Sql147931 76a72f7ea6Sql147931 #define SA2400_SYNB_R_MASK BITS(21, 12) 77a72f7ea6Sql147931 #define SA2400_SYNB_L_MASK BITS(11, 10) /* lock detect mode */ 78a72f7ea6Sql147931 #define SA2400_SYNB_L_INACTIVE0 LSHIFT(0, SA2400_SYNB_L_MASK) 79a72f7ea6Sql147931 #define SA2400_SYNB_L_INACTIVE1 LSHIFT(1, SA2400_SYNB_L_MASK) 80a72f7ea6Sql147931 #define SA2400_SYNB_L_NORMAL LSHIFT(2, SA2400_SYNB_L_MASK) 81a72f7ea6Sql147931 #define SA2400_SYNB_L_INACTIVE2 LSHIFT(3, SA2400_SYNB_L_MASK) 82a72f7ea6Sql147931 83a72f7ea6Sql147931 /* 84a72f7ea6Sql147931 * power on/off, 85a72f7ea6Sql147931 * 0: inverted chip mode control 86a72f7ea6Sql147931 * 1: as defined by chip mode (see SA2400_OPMODE) 87a72f7ea6Sql147931 */ 88a72f7ea6Sql147931 89a72f7ea6Sql147931 #define SA2400_SYNB_ON BIT(9) 90a72f7ea6Sql147931 #define SA2400_SYNB_ONE BIT(8) /* always 1 */ 91a72f7ea6Sql147931 /* 92a72f7ea6Sql147931 * fractional compensation 93a72f7ea6Sql147931 * charge pump current DAC, 94a72f7ea6Sql147931 * 0 to 255, default 80. 95a72f7ea6Sql147931 */ 96a72f7ea6Sql147931 97a72f7ea6Sql147931 #define SA2400_SYNB_FC_MASK BITS(7, 0) 98a72f7ea6Sql147931 #define SA2400_SYNC 2 /* Synthesizer Register C */ 99a72f7ea6Sql147931 #define SA2400_SYNC_CP_MASK BITS(7, 6) /* charge pump current setting */ 100a72f7ea6Sql147931 #define SA2400_SYNC_CP_NORMAL_ LSHIFT(0, SA2400_SYNC_CP_MASK) 101a72f7ea6Sql147931 #define SA2400_SYNC_CP_THIRD_ LSHIFT(1, SA2400_SYNC_CP_MASK) 102a72f7ea6Sql147931 #define SA2400_SYNC_CP_NORMAL LSHIFT(2, SA2400_SYNC_CP_MASK) /* recommended */ 103a72f7ea6Sql147931 #define SA2400_SYNC_CP_THIRD LSHIFT(3, SA2400_SYNC_CP_MASK) 104a72f7ea6Sql147931 105a72f7ea6Sql147931 /* 106a72f7ea6Sql147931 * comparison divider select, 107a72f7ea6Sql147931 * 0 to 4, extra division 108a72f7ea6Sql147931 * ratio is 2**SM. 109a72f7ea6Sql147931 */ 110a72f7ea6Sql147931 #define SA2400_SYNC_SM_MASK BITS(5, 3) 111a72f7ea6Sql147931 #define SA2400_SYNC_ZERO BIT(2) /* always 0 */ 112a72f7ea6Sql147931 113a72f7ea6Sql147931 #define SA2400_SYND 3 /* Synthesizer Register D */ 114a72f7ea6Sql147931 #define SA2400_SYND_ZERO1_MASK BITS(21, 17) /* always 0 */ 115a72f7ea6Sql147931 /* 116a72f7ea6Sql147931 * T[phpsu], 1: disable 117a72f7ea6Sql147931 * PHP speedup pump, 118a72f7ea6Sql147931 * overrides SA2400_SYND_TSPU 119a72f7ea6Sql147931 */ 120a72f7ea6Sql147931 #define SA2400_SYND_TPHPSU BIT(16) 121a72f7ea6Sql147931 /* 122a72f7ea6Sql147931 * T[spu], 1: speedup on, 123a72f7ea6Sql147931 * 0: speedup off 124a72f7ea6Sql147931 */ 125a72f7ea6Sql147931 #define SA2400_SYND_TPSU BIT(15) 126a72f7ea6Sql147931 #define SA2400_SYND_ZERO2_MASK BITS(14, 3) /* always 0 */ 127a72f7ea6Sql147931 /* 128a72f7ea6Sql147931 * Operating mode, filter tuner, 129a72f7ea6Sql147931 * other controls 130a72f7ea6Sql147931 */ 131a72f7ea6Sql147931 #define SA2400_OPMODE 4 132a72f7ea6Sql147931 /* 133a72f7ea6Sql147931 * 1: in Rx mode, RSSI-ADC always on 134a72f7ea6Sql147931 * 0: RSSI-ADC only on during AGC 135a72f7ea6Sql147931 */ 136a72f7ea6Sql147931 #define SA2400_OPMODE_ADC BIT(19) 137a72f7ea6Sql147931 /* 138a72f7ea6Sql147931 * read-only filter tuner error: 139a72f7ea6Sql147931 * 1 if tuner out of range 140a72f7ea6Sql147931 */ 141a72f7ea6Sql147931 #define SA2400_OPMODE_FTERR BIT(18) 142a72f7ea6Sql147931 /* 143a72f7ea6Sql147931 * Rx & Tx filter tuning, write tuning value (test mode only) or 144a72f7ea6Sql147931 * read tuner setting (in normal mode). 145a72f7ea6Sql147931 */ 146a72f7ea6Sql147931 #define SA2400_OPMODE_FILTTUNE_MASK BITS(17, 15) 147a72f7ea6Sql147931 /* 148a72f7ea6Sql147931 * external reference voltage 149a72f7ea6Sql147931 * (pad v2p5) on 150a72f7ea6Sql147931 */ 151a72f7ea6Sql147931 #define SA2400_OPMODE_V2P5 BIT(14) 152a72f7ea6Sql147931 #define SA2400_OPMODE_I1M BIT(13) /* external reference current ... */ 153a72f7ea6Sql147931 #define SA2400_OPMODE_I0P3 BIT(12) /* external reference current ... */ 154a72f7ea6Sql147931 /* 155a72f7ea6Sql147931 * xtal input frequency, 156a72f7ea6Sql147931 * 0: 44 MHz 157a72f7ea6Sql147931 * 1: 22 MHz 158a72f7ea6Sql147931 */ 159a72f7ea6Sql147931 #define SA2400_OPMODE_IN22 BIT(10) 160a72f7ea6Sql147931 #define SA2400_OPMODE_CLK BIT(9) /* reference clock output on */ 161a72f7ea6Sql147931 #define SA2400_OPMODE_XO BIT(8) /* xtal oscillator on */ 162a72f7ea6Sql147931 #define SA2400_OPMODE_DIGIN BIT(7) /* use digital Tx inputs (FIRDAC) */ 163a72f7ea6Sql147931 /* 164a72f7ea6Sql147931 * Rx output common mode voltage, 165a72f7ea6Sql147931 * 0: V[DD]/2 166a72f7ea6Sql147931 * 1: 1.25V 167a72f7ea6Sql147931 */ 168a72f7ea6Sql147931 #define SA2400_OPMODE_RXLV BIT(6) 169a72f7ea6Sql147931 /* 170a72f7ea6Sql147931 * make internal vco 171a72f7ea6Sql147931 * available at vco pads (vcoextout) 172a72f7ea6Sql147931 */ 173a72f7ea6Sql147931 #define SA2400_OPMODE_VEO BIT(5) 174a72f7ea6Sql147931 #define SA2400_OPMODE_VEI BIT(4) /* use external vco input (vcoextin) */ 175a72f7ea6Sql147931 /* main operating mode */ 176a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_MASK BITS(3, 0) 177a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_SLEEP LSHIFT(0, SA2400_OPMODE_MODE_MASK) 178a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_TXRX LSHIFT(1, SA2400_OPMODE_MODE_MASK) 179a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_WAIT LSHIFT(2, SA2400_OPMODE_MODE_MASK) 180a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_RXMGC LSHIFT(3, SA2400_OPMODE_MODE_MASK) 181a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_FCALIB LSHIFT(4, SA2400_OPMODE_MODE_MASK) 182a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_DCALIB LSHIFT(5, SA2400_OPMODE_MODE_MASK) 183a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_FASTTXRXMGC LSHIFT(6, SA2400_OPMODE_MODE_MASK) 184a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_RESET LSHIFT(7, SA2400_OPMODE_MODE_MASK) 185a72f7ea6Sql147931 #define SA2400_OPMODE_MODE_VCOCALIB LSHIFT(8, SA2400_OPMODE_MODE_MASK) 186a72f7ea6Sql147931 187a72f7ea6Sql147931 #define SA2400_OPMODE_DEFAULTS \ 188a72f7ea6Sql147931 (SA2400_OPMODE_XO | SA2400_OPMODE_RXLV | SA2400_OPMODE_CLK | \ 189a72f7ea6Sql147931 SA2400_OPMODE_I0P3 | LSHIFT(3, SA2400_OPMODE_FILTTUNE_MASK)) 190a72f7ea6Sql147931 191a72f7ea6Sql147931 #define SA2400_AGC 5 /* AGC adjustment */ 192a72f7ea6Sql147931 /* 193a72f7ea6Sql147931 * fine-tune AGC target: 194a72f7ea6Sql147931 * -7dB to 7dB, sign bit ... 195a72f7ea6Sql147931 */ 196a72f7ea6Sql147931 #define SA2400_AGC_TARGETSIGN BIT(23) 197a72f7ea6Sql147931 #define SA2400_AGC_TARGET_MASK BITS(22, 20) /* ... plus 0dB - 7dB */ 198a72f7ea6Sql147931 /* 199a72f7ea6Sql147931 * maximum AGC gain, 0 to 31, (yields 54dB to 85dB) 200a72f7ea6Sql147931 */ 201a72f7ea6Sql147931 #define SA2400_AGC_MAXGAIN_MASK BITS(19, 15) 202a72f7ea6Sql147931 /* 203a72f7ea6Sql147931 * write: settling time after baseband gain switching, units of 204a72f7ea6Sql147931 * 182 nanoseconds. 205a72f7ea6Sql147931 * read: output of RSSI/Tx-peak detector's ADC in 5-bit Gray code. 206a72f7ea6Sql147931 */ 207a72f7ea6Sql147931 #define SA2400_AGC_BBPDELAY_MASK BITS(14, 10) 208a72f7ea6Sql147931 #define SA2400_AGC_ADCVAL_MASK SA2400_AGC_BBPDELAY_MASK 209a72f7ea6Sql147931 210a72f7ea6Sql147931 /* 211a72f7ea6Sql147931 * write: settling time after LNA gain switching, units of 212a72f7ea6Sql147931 * 182 nanoseconds 213a72f7ea6Sql147931 * read: 2nd sample of RSSI in AGC cycle 214a72f7ea6Sql147931 */ 215a72f7ea6Sql147931 #define SA2400_AGC_LNADELAY_MASK BITS(9, 5) 216a72f7ea6Sql147931 #define SA2400_AGC_SAMPLE2_MASK SA2400_AGC_LNADELAY_MASK 217a72f7ea6Sql147931 218a72f7ea6Sql147931 /* 219a72f7ea6Sql147931 * write: time between turning on Rx and AGCSET, units of 220a72f7ea6Sql147931 * 182 nanoseconds 221a72f7ea6Sql147931 * read: 1st sample of RSSI in AGC cycle 222a72f7ea6Sql147931 */ 223a72f7ea6Sql147931 #define SA2400_AGC_RXONDELAY_MASK BITS(4, 0) 224a72f7ea6Sql147931 #define SA2400_AGC_SAMPLE1_MASK SA2400_AGC_RXONDELAY_MASK 225a72f7ea6Sql147931 226a72f7ea6Sql147931 #define SA2400_MANRX 6 /* Manual receiver control settings */ 227a72f7ea6Sql147931 /* 228a72f7ea6Sql147931 * 1: AGC w/ high S/N---switch LNA at 229a72f7ea6Sql147931 * step 52 (recommended) 230a72f7ea6Sql147931 * 0: switch LNA at step 60 231a72f7ea6Sql147931 */ 232a72f7ea6Sql147931 #define SA2400_MANRX_AHSN BIT(23) 233a72f7ea6Sql147931 234a72f7ea6Sql147931 /* 235a72f7ea6Sql147931 * If _RXOSQON, Q offset is 236a72f7ea6Sql147931 * (_RXOSQSIGN ? -1 : 1) * (1 + _RXOSQ_MASK) * 8 millivolts, 237a72f7ea6Sql147931 * otherwise, Q offset is 0. 238a72f7ea6Sql147931 * 239a72f7ea6Sql147931 * Ditto I offset. 240a72f7ea6Sql147931 */ 241a72f7ea6Sql147931 #define SA2400_MANRX_RXOSQON BIT(22) /* Rx Q-channel correction. */ 242a72f7ea6Sql147931 #define SA2400_MANRX_RXOSQSIGN BIT(21) 243a72f7ea6Sql147931 #define SA2400_MANRX_RXOSQ_MASK BITS(20, 18) 244a72f7ea6Sql147931 245a72f7ea6Sql147931 #define SA2400_MANRX_RXOSION BIT(17) /* Rx I-channel correction. */ 246a72f7ea6Sql147931 #define SA2400_MANRX_RXOSISIGN BIT(16) 247a72f7ea6Sql147931 #define SA2400_MANRX_RXOSI_MASK BITS(15, 13) 248a72f7ea6Sql147931 /* 249a72f7ea6Sql147931 * use 10MHz offset cancellation cornerpoint for brief period 250a72f7ea6Sql147931 * after each gain change 251a72f7ea6Sql147931 */ 252a72f7ea6Sql147931 #define SA2400_MANRX_TEN BIT(12) 253a72f7ea6Sql147931 254a72f7ea6Sql147931 /* 255a72f7ea6Sql147931 * DC offset cancellation cornerpoint select 256a72f7ea6Sql147931 * write: in RXMGC, set the cornerpoint 257a72f7ea6Sql147931 * read: in other modes, read AGC-controlled cornerpoint 258a72f7ea6Sql147931 */ 259a72f7ea6Sql147931 #define SA2400_MANRX_CORNERFREQ_MASK BITS(11, 10) 260a72f7ea6Sql147931 261a72f7ea6Sql147931 /* 262a72f7ea6Sql147931 * write: in RXMGC mode, sets receiver gain 263a72f7ea6Sql147931 * read: in other modes, read AGC-controlled gain 264a72f7ea6Sql147931 */ 265a72f7ea6Sql147931 #define SA2400_MANRX_RXGAIN_MASK BITS(9, 0) 266a72f7ea6Sql147931 267a72f7ea6Sql147931 #define SA2400_TX 7 /* Transmitter settings */ 268a72f7ea6Sql147931 /* 269a72f7ea6Sql147931 * Tx offsets 270a72f7ea6Sql147931 * write: in test mode, sets the offsets 271a72f7ea6Sql147931 * read: in normal mode, returns automatic settings 272a72f7ea6Sql147931 */ 273a72f7ea6Sql147931 #define SA2400_TX_TXOSQON BIT(19) 274a72f7ea6Sql147931 #define SA2400_TX_TXOSQSIGN BIT(18) 275a72f7ea6Sql147931 #define SA2400_TX_TXOSQ_MASK BITS(17, 15) 276a72f7ea6Sql147931 #define SA2400_TX_TXOSION BIT(14) 277a72f7ea6Sql147931 #define SA2400_TX_TXOSISIGN BIT(13) 278a72f7ea6Sql147931 #define SA2400_TX_TXOSI_MASK BITS(12, 10) 279a72f7ea6Sql147931 280a72f7ea6Sql147931 /* 281a72f7ea6Sql147931 * Ramp-up delay, 282a72f7ea6Sql147931 * 0: 1us 283a72f7ea6Sql147931 * 1: 2us 284a72f7ea6Sql147931 * 2: 3us 285a72f7ea6Sql147931 * 3: 4us 286a72f7ea6Sql147931 * datasheet says, "ramp-up 287a72f7ea6Sql147931 * time always 1us". huh? 288a72f7ea6Sql147931 */ 289a72f7ea6Sql147931 #define SA2400_TX_RAMP_MASK BITS(9, 8) 290a72f7ea6Sql147931 /* 291a72f7ea6Sql147931 * Transmitter gain settings 292a72f7ea6Sql147931 * for TXHI output 293a72f7ea6Sql147931 */ 294a72f7ea6Sql147931 #define SA2400_TX_HIGAIN_MASK BITS(7, 4) 295a72f7ea6Sql147931 /* 296a72f7ea6Sql147931 * Transmitter gain settings 297a72f7ea6Sql147931 * for TXLO output 298a72f7ea6Sql147931 */ 299a72f7ea6Sql147931 #define SA2400_TX_LOGAIN_MASK BITS(3, 0) 300a72f7ea6Sql147931 301a72f7ea6Sql147931 #define SA2400_VCO 8 /* VCO settings */ 302a72f7ea6Sql147931 #define SA2400_VCO_ZERO BITS(6, 5) /* always zero */ 303a72f7ea6Sql147931 /* 304a72f7ea6Sql147931 * VCO calibration error flag---no 305a72f7ea6Sql147931 * band with low enough frequency 306a72f7ea6Sql147931 * could be found 307a72f7ea6Sql147931 */ 308a72f7ea6Sql147931 #define SA2400_VCO_VCERR BIT(4) 309a72f7ea6Sql147931 /* 310a72f7ea6Sql147931 * VCO band, 311a72f7ea6Sql147931 * write: in test mode, sets 312a72f7ea6Sql147931 * VCO band 313a72f7ea6Sql147931 * read: in normal mode, 314a72f7ea6Sql147931 * the result of 315a72f7ea6Sql147931 * calibration (VCOCAL). 316a72f7ea6Sql147931 * 0 = highest 317a72f7ea6Sql147931 * frequencies 318a72f7ea6Sql147931 */ 319a72f7ea6Sql147931 #define SA2400_VCO_VCOBAND_MASK BITS(3, 0) 320*9aa73b68SQin Michael Li #ifdef __cplusplus 321*9aa73b68SQin Michael Li } 322*9aa73b68SQin Michael Li #endif 323*9aa73b68SQin Michael Li 324a72f7ea6Sql147931 #endif /* _SA2400REG_H_ */ 325