aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/README1
-rw-r--r--host/lib/CMakeLists.txt5
-rwxr-xr-xhost/lib/ic_reg_maps/gen_max2829_regs.py169
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp29
4 files changed, 192 insertions, 12 deletions
diff --git a/host/README b/host/README
index 05a53b197..e67bb25f8 100644
--- a/host/README
+++ b/host/README
@@ -16,6 +16,7 @@ Basic TX
LF RX
LF TX
RFX Series
+XCVR 2450
########################################################################
# Documentation
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index d43a61010..5495620ec 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -111,6 +111,11 @@ UHD_PYTHON_GEN_SOURCE_FILE(
${CMAKE_CURRENT_BINARY_DIR}/ic_reg_maps/ad7922_regs.hpp
)
+UHD_PYTHON_GEN_SOURCE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ic_reg_maps/gen_max2829_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ic_reg_maps/max2829_regs.hpp
+)
+
########################################################################
# Add dboard sources
########################################################################
diff --git a/host/lib/ic_reg_maps/gen_max2829_regs.py b/host/lib/ic_reg_maps/gen_max2829_regs.py
new file mode 100755
index 000000000..91a711ecc
--- /dev/null
+++ b/host/lib/ic_reg_maps/gen_max2829_regs.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either asversion 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+import sys
+from common import *
+
+########################################################################
+# Template for raw text data describing registers
+# name addr[bit range inclusive] default optional enums
+########################################################################
+REGS_DATA_TMPL="""\
+########################################################################
+## Note: offsets given from perspective of data bits (excludes address)
+########################################################################
+##
+########################################################################
+## Standby (2)
+########################################################################
+_set_to_1_2_0 2[0] 1
+_set_to_1_2_1 2[1] 1
+_set_to_1_2_2 2[2] 1
+pa_bias_dac 2[10] 0
+voltage_ref 2[11] 0
+_set_to_1_2_12 2[12] 1
+mimo_select 2[13] 0 normal, mimo
+########################################################################
+## Integer Divider Ratio (3)
+########################################################################
+id_ratio_word 3[0:7] a2
+frac_div_ratio_lsb 3[12:13] 0
+########################################################################
+## Fractional Divider Ratio (4)
+########################################################################
+frac_div_ratio_msb 4[0:13] 0
+########################################################################
+## Band Select and PLL (5)
+########################################################################
+band_select 5[0] 0 2_4ghz, 5ghz
+ref_divider 5[1:3] 1
+pll_cp_select 5[5] 1 2ma, 4ma
+band_select_802_11a 5[6] 0 4_9ghz_to_5_35ghz, 5_47ghz_to_5_875ghz
+vco_bandswitch 5[7] 0 disable, automatic
+vco_spi_bandswitch 5[8] 0 fsm, spi
+vco_sub_band 5[9:10] 0
+_set_to_1_5_11 5[11] 1
+_set_to_1_5_12 5[12] 1
+band_sel_mimo 5[13] 0 normal, mimo
+########################################################################
+## Calibration (6)
+########################################################################
+rx_cal_mode 6[0] 0 dis, enb
+tx_cal_mode 6[1] 0 dis, enb
+_set_to_1_6_10 6[10] 1
+iq_cal_gain 6[11:12] 3 8db, 18db, 24db, 34db
+########################################################################
+## Lopass Filter (7)
+########################################################################
+rx_lpf_fine_adj 7[0:2] 2 90, 95, 100, 105, 110
+rx_lpf_coarse_adj 7[3:4] 1 7_5mhz, 9_5mhz, 14mhz, 18mhz
+tx_lpf_coarse_adj 7[5:6] 1 12mhz=1, 18mhz=2, 24mhz=3
+rssi_high_bw 7[11] 0 2mhz, 6mhz
+########################################################################
+## Rx Control/RSSI (8)
+########################################################################
+_set_to_1_8_0 8[0] 1
+rx_highpass 8[2] 1 100hz, 30khz
+_set_to_1_8_5 8[5] 1
+rssi_pin_fcn 8[8] 0 rssi, temp
+rssi_op_mode 8[10] 0 rssi_rxhp, enabled
+rssi_output_range 8[11] 0 low, high
+rx_vga_gain_spi 8[12] 0 io, spi
+########################################################################
+## Tx Linearity/Baseband Gain (9)
+########################################################################
+tx_baseband_gain 9[0:1] 0 0db, 2db, 3_5db, 5db
+tx_upconv_linearity 9[2:3] 0 50, 63, 78, 100
+tx_vga_linearity 9[6:7] 0 50, 63, 78, 100
+pa_driver_linearity 9[8:9] 2 50, 63, 78, 100
+tx_vga_gain_spi 9[10] 0 io, spi
+########################################################################
+## PA Bias DAC (10)
+########################################################################
+pa_bias_dac_out_curr a[0:5] 0
+pa_bias_dac_delay a[6:9] f
+########################################################################
+## Rx Gain (11)
+########################################################################
+rx_vga_gain b[0:4] 1f
+rx_lna_gain b[5:6] 3
+########################################################################
+## Tx VGA Gain (12)
+########################################################################
+tx_vga_gain c[0:5] 0
+"""
+
+########################################################################
+# Header and Source templates below
+########################################################################
+HEADER_TEXT="""
+#import time
+
+/***********************************************************************
+ * This file was generated by $file on $time.strftime("%c")
+ **********************************************************************/
+
+\#ifndef INCLUDED_MAX2829_REGS_HPP
+\#define INCLUDED_MAX2829_REGS_HPP
+
+\#include <boost/cstdint.hpp>
+
+struct max2829_regs_t{
+#for $reg in $regs
+ #if $reg.get_enums()
+ enum $(reg.get_name())_t{
+ #for $i, $enum in enumerate($reg.get_enums())
+ #set $end_comma = ',' if $i < len($reg.get_enums())-1 else ''
+ $(reg.get_name().upper())_$(enum[0].upper()) = $enum[1]$end_comma
+ #end for
+ } $reg.get_name();
+ #else
+ boost::$reg.get_stdint_type() $reg.get_name();
+ #end if
+#end for
+
+ max2829_regs_t(void){
+#for $reg in $regs
+ $reg.get_name() = $reg.get_default();
+#end for
+ }
+
+ boost::uint32_t get_reg(boost::uint8_t addr){
+ boost::uint16_t reg = 0;
+ switch(addr){
+ #for $addr in range(2, 12+1)
+ case $addr:
+ #for $reg in filter(lambda r: r.get_addr() == addr, $regs)
+ reg |= (boost::uint16_t($reg.get_name()) & $reg.get_mask()) << $reg.get_shift();
+ #end for
+ break;
+ #end for
+ }
+ return (boost::uint32_t(reg) << 4) | (addr & 0xf);
+ }
+};
+
+\#endif /* INCLUDED_MAX2829_REGS_HPP */
+"""
+
+if __name__ == '__main__':
+ regs = map(reg, parse_tmpl(REGS_DATA_TMPL).splitlines())
+ open(sys.argv[1], 'w').write(parse_tmpl(HEADER_TEXT, regs=regs, file=__file__))
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 44921d7d4..8002acc01 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -47,6 +47,7 @@
#define RX_ENB_RXIO RX_EN_RXIO
#define RX_DIS_RXIO 0
+#include "max2829_regs.hpp"
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -65,10 +66,23 @@ using namespace uhd::usrp;
using namespace boost::assign;
/***********************************************************************
- * The XCVR 2450 dboard
+ * The XCVR 2450 constants
**********************************************************************/
static const freq_range_t xcvr_freq_range(2.4e9, 6.0e9);
+static const prop_names_t xcvr_antennas = list_of("J1")("J2");
+
+static const uhd::dict<std::string, gain_range_t> xcvr_tx_gain_ranges = map_list_of
+ ("VGA", gain_range_t(0, 30, 0.5))
+;
+static const uhd::dict<std::string, gain_range_t> xcvr_rx_gain_ranges = map_list_of
+ ("RF LNA", gain_range_t(0, 30.5, 15))
+ ("BB VGA", gain_range_t(0, 62, 2.0))
+;
+
+/***********************************************************************
+ * The XCVR 2450 dboard class
+ **********************************************************************/
class xcvr2450 : public xcvr_dboard_base{
public:
xcvr2450(ctor_args_t const& args);
@@ -85,6 +99,7 @@ private:
uhd::dict<std::string, float> _tx_gains, _rx_gains;
std::string _tx_ant, _rx_ant;
int _ad9515div;
+ max2829_regs_t _max2829_regs;
void set_lo_freq(double target_freq);
void set_tx_ant(const std::string &ant);
@@ -96,7 +111,7 @@ private:
};
/***********************************************************************
- * Register the XCVR dboard
+ * Register the XCVR 2450 dboard
**********************************************************************/
static dboard_base::sptr make_xcvr2450(dboard_base::ctor_args_t const& args){
return dboard_base::sptr(new xcvr2450(args));
@@ -164,8 +179,6 @@ void xcvr2450::set_lo_freq(double target_freq){
/***********************************************************************
* Antenna Handling
**********************************************************************/
-static const prop_names_t xcvr_antennas = list_of("J1")("J2");
-
void xcvr2450::set_tx_ant(const std::string &ant){
assert_has(xcvr_antennas, ant, "xcvr antenna name");
//TODO
@@ -179,14 +192,6 @@ void xcvr2450::set_rx_ant(const std::string &ant){
/***********************************************************************
* Gain Handling
**********************************************************************/
-static const uhd::dict<std::string, gain_range_t> xcvr_tx_gain_ranges = map_list_of
- ("VGA", gain_range_t(0, 30, 0.5))
-;
-static const uhd::dict<std::string, gain_range_t> xcvr_rx_gain_ranges = map_list_of
- ("RF LNA", gain_range_t(0, 30.5, 15))
- ("BB VGA", gain_range_t(0, 62, 2.0))
-;
-
/*!
* Convert a requested gain for the tx vga into the integer register value.
* The gain passed into the function will be set to the actual value.