Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
/* $NetBSD: max2820reg.h,v 1.7 2006/08/31 19:24:37 dyoung Exp $ */
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2004 David Young. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code was written by David Young.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
|
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David
|
|
|
|
* Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
|
|
* OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DEV_IC_MAX2820REG_H_
|
|
|
|
#define _DEV_IC_MAX2820REG_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Serial bus format for Maxim MAX2820/MAX2820A/MAX2821/MAX2821A
|
|
|
|
* 2.4GHz 802.11b Zero-IF Transceivers
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_TWI_ADDR_MASK __BITS(15,12)
|
|
|
|
#define MAX2820_TWI_DATA_MASK __BITS(11,0)
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Registers for Maxim MAX2820/MAX2820A/MAX2821/MAX2821A 2.4GHz
|
|
|
|
* 802.11b Zero-IF Transceivers
|
|
|
|
*/
|
|
|
|
#define MAX2820_TEST 0 /* Test Register */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_TEST_DEFAULT __BITS(2,0) /* Always set to this value. */
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
#define MAX2820_ENABLE 1 /* Block-Enable Register */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_RSVD1 __BIT(11) /* reserved */
|
|
|
|
#define MAX2820_ENABLE_PAB __BIT(10) /* Transmit Baseband Filters
|
2004-09-26 06:29:15 +04:00
|
|
|
* Enable
|
|
|
|
* PAB_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_PAB ||
|
|
|
|
* TX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_TXFLT __BIT(9) /* Transmit Baseband Filters
|
2004-09-26 06:29:15 +04:00
|
|
|
* Enable
|
|
|
|
* TXFLT_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_TXFLT ||
|
|
|
|
* TX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_TXUVD __BIT(8) /* Tx Upconverter, VGA, and
|
2004-09-26 06:29:15 +04:00
|
|
|
* Driver Amp Enable
|
|
|
|
* TXUVD_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_TXUVD ||
|
|
|
|
* TX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_DET __BIT(7) /* Receive Detector Enable
|
2004-09-26 06:29:15 +04:00
|
|
|
* DET_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_DET ||
|
|
|
|
* RX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_RXDFA __BIT(6) /* Rx Downconverter, Filters,
|
2004-09-26 06:29:15 +04:00
|
|
|
* and AGC Amps Enable
|
|
|
|
* RXDFA_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_RXDFA ||
|
|
|
|
* RX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_RXLNA __BIT(5) /* Receive LNA Enable
|
2004-09-26 06:29:15 +04:00
|
|
|
* AT_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_RXLNA ||
|
|
|
|
* RX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_AT __BIT(4) /* Auto-tuner Enable
|
2004-09-26 06:29:15 +04:00
|
|
|
* AT_EN = SHDNB &&
|
|
|
|
* (MAX2820_ENABLE_AT ||
|
|
|
|
* RX_ON || TX_ON)
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_CP __BIT(3) /* PLL Charge-Pump Enable
|
2004-09-26 06:29:15 +04:00
|
|
|
* CP_EN = SHDNB
|
|
|
|
* && MAX2820_ENABLE_CP
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_PLL __BIT(2) /* PLL Enable
|
2004-09-26 06:29:15 +04:00
|
|
|
* PLL_EN = SHDNB
|
|
|
|
* && MAX2820_ENABLE_PLL
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_VCO __BIT(1) /* VCO Enable
|
2004-09-26 06:29:15 +04:00
|
|
|
* VCO_EN = SHDNB
|
|
|
|
* && MAX2820_ENABLE_VCO
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_ENABLE_RSVD0 __BIT(0) /* reserved */
|
2004-09-26 06:29:15 +04:00
|
|
|
#define MAX2820_ENABLE_DEFAULT (MAX2820_ENABLE_AT|MAX2820_ENABLE_CP|\
|
|
|
|
MAX2820_ENABLE_PLL|MAX2820_ENABLE_VCO)
|
|
|
|
|
|
|
|
#define MAX2820_SYNTH 2 /* Synthesizer Register */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_SYNTH_RSVD0 __BITS(11,7) /* reserved */
|
|
|
|
#define MAX2820_SYNTH_ICP __BIT(6) /* Charge-Pump Current Select
|
2004-09-26 06:29:15 +04:00
|
|
|
* 0 = +/-1mA
|
|
|
|
* 1 = +/-2mA
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_SYNTH_R_MASK __BITS(5,0) /* Reference Frequency Divider
|
2004-09-26 06:29:15 +04:00
|
|
|
* 0 = 22MHz
|
|
|
|
* 1 = 44MHz
|
|
|
|
*/
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820_SYNTH_R_22MHZ __SHIFTIN(0, MAX2820_SYNTH_R_MASK)
|
|
|
|
#define MAX2820_SYNTH_R_44MHZ __SHIFTIN(1, MAX2820_SYNTH_R_MASK)
|
2004-09-26 06:29:15 +04:00
|
|
|
#define MAX2820_SYNTH_ICP_DEFAULT MAX2820_SYNTH_ICP
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820_SYNTH_R_DEFAULT __SHIFTIN(0, MAX2820_SYNTH_R_MASK)
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
#define MAX2820_CHANNEL 3 /* Channel Frequency Register */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_CHANNEL_RSVD __BITS(11,7) /* reserved */
|
|
|
|
#define MAX2820_CHANNEL_CF_MASK __BITS(6,0) /* Channel Frequency Select
|
2004-09-26 06:29:15 +04:00
|
|
|
* fLO = 2400MHz + CF * 1MHz
|
|
|
|
*/
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820_CHANNEL_RSVD_DEFAULT __SHIFTIN(0, MAX2820_CHANNEL_RSVD)
|
|
|
|
#define MAX2820_CHANNEL_CF_DEFAULT __SHIFTIN(37, MAX2820_CHANNEL_CF_MASK)
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
#define MAX2820_RECEIVE 4 /* Receiver Settings Register
|
|
|
|
* MAX2820/MAX2821
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_RECEIVE_2C_MASK __BITS(11,9) /* VGA DC Offset Nulling
|
2004-09-26 06:29:15 +04:00
|
|
|
* Parameter 2
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_RECEIVE_1C_MASK __BITS(8,6) /* VGA DC Offset Nulling
|
2004-09-26 06:29:15 +04:00
|
|
|
* Parameter 1
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_RECEIVE_DL_MASK __BITS(5,4) /* Rx Level Detector Midpoint
|
2004-09-26 06:29:15 +04:00
|
|
|
* Select
|
|
|
|
* 11, 01 = 50.2mVp
|
|
|
|
* 10 = 70.9mVp
|
|
|
|
* 00 = 35.5mVp
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_RECEIVE_SF __BIT(3) /* Special Function Select
|
2004-09-26 06:29:15 +04:00
|
|
|
* 0 = OFF
|
|
|
|
* 1 = ON
|
|
|
|
*/
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_RECEIVE_BW_MASK __BITS(2,0) /* Receive Filter -3dB Frequency
|
2004-09-26 06:29:15 +04:00
|
|
|
* Select (all frequencies are
|
|
|
|
* approximate)
|
|
|
|
*/
|
|
|
|
/* 8.5MHz */
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820_RECEIVE_BW_8_5MHZ __SHIFTIN(0, MAX2820_RECEIVE_BW_MASK)
|
|
|
|
#define MAX2820_RECEIVE_BW_8MHZ __SHIFTIN(1, MAX2820_RECEIVE_BW_MASK)
|
|
|
|
#define MAX2820_RECEIVE_BW_7_5MHZ __SHIFTIN(2, MAX2820_RECEIVE_BW_MASK)
|
|
|
|
#define MAX2820_RECEIVE_BW_7MHZ __SHIFTIN(3, MAX2820_RECEIVE_BW_MASK)
|
|
|
|
#define MAX2820_RECEIVE_BW_6_5MHZ __SHIFTIN(4, MAX2820_RECEIVE_BW_MASK)
|
|
|
|
#define MAX2820_RECEIVE_BW_6MHZ __SHIFTIN(5, MAX2820_RECEIVE_BW_MASK)
|
|
|
|
#define MAX2820_RECEIVE_2C_DEFAULT __SHIFTIN(7, MAX2820_RECEIVE_2C_MASK)
|
|
|
|
#define MAX2820_RECEIVE_1C_DEFAULT __SHIFTIN(7, MAX2820_RECEIVE_1C_MASK)
|
|
|
|
#define MAX2820_RECEIVE_DL_DEFAULT __SHIFTIN(1, MAX2820_RECEIVE_DL_MASK)
|
|
|
|
#define MAX2820_RECEIVE_SF_DEFAULT __SHIFTIN(0, MAX2820_RECEIVE_SF)
|
2005-02-27 03:26:58 +03:00
|
|
|
#define MAX2820_RECEIVE_BW_DEFAULT MAX2820_RECEIVE_BW_7_5MHZ
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
#define MAX2820A_RECEIVE 4 /* Receiver Settings Register,
|
|
|
|
* MAX2820A/MAX2821A
|
|
|
|
*/
|
|
|
|
/* VGA DC Offset Nulling Parameter 2 */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820A_RECEIVE_2C_MASK __BITS(11,9)
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820A_RECEIVE_2C_DEFAULT __SHIFTIN(7, MAX2820A_RECEIVE_2C_MASK)
|
2004-09-26 06:29:15 +04:00
|
|
|
/* VGA DC Offset Nulling Parameter 1 */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820A_RECEIVE_1C_MASK __BITS(8,6)
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820A_RECEIVE_1C_DEFAULT __SHIFTIN(7, MAX2820A_RECEIVE_1C_MASK)
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820A_RECEIVE_RSVD0_MASK __BITS(5,3)
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820A_RECEIVE_RSVD0_DEFAULT __SHIFTIN(2, MAX2820A_RECEIVE_RSVD0_MASK)
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820A_RECEIVE_RSVD1_MASK __BITS(2,0)
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820A_RECEIVE_RSVD1_DEFAULT __SHIFTIN(2,MAX2820_RECEIVE_RSVD1_MASK)
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
#define MAX2820_TRANSMIT 5 /* Transmitter Settings Reg. */
|
2006-03-08 11:26:50 +03:00
|
|
|
#define MAX2820_TRANSMIT_RSVD_MASK __BITS(11,4) /* reserved */
|
|
|
|
#define MAX2820_TRANSMIT_PA_MASK __BITS(3,0) /* PA Bias Select
|
2004-09-26 06:29:15 +04:00
|
|
|
* 15 = Highest
|
|
|
|
* 0 = Lowest
|
|
|
|
*/
|
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).
Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.
Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 23:24:37 +04:00
|
|
|
#define MAX2820_TRANSMIT_PA_DEFAULT __SHIFTIN(0, MAX2820_TRANSMIT_PA_MASK)
|
2004-09-26 06:29:15 +04:00
|
|
|
|
|
|
|
#endif /* _DEV_IC_MAX2820REG_H_ */
|