aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-10-31 14:30:52 -0700
committerMartin Braun <martin.braun@ettus.com>2016-11-08 08:02:22 -0800
commit99c2730bc9db270560671f2d7d173768465ed51f (patch)
treebc4df495734a075ebe2f7917cf67dec6fb7d8177 /host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
parent218f4b0b63927110df9dbbaa8353c346eee2d98a (diff)
downloaduhd-99c2730bc9db270560671f2d7d173768465ed51f.tar.gz
uhd-99c2730bc9db270560671f2d7d173768465ed51f.tar.bz2
uhd-99c2730bc9db270560671f2d7d173768465ed51f.zip
Remove all boost:: namespace prefix for uint32_t, int32_t etc. (fixed-width types)
- Also removes all references to boost/cstdint.hpp and replaces it with stdint.h (The 'correct' replacement would be <cstdint>, but not all of our compilers support that).
Diffstat (limited to 'host/lib/usrp/common/ad9361_driver/ad9361_device.cpp')
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.cpp296
1 files changed, 148 insertions, 148 deletions
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
index 095017bb6..45ebf78bf 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
@@ -25,7 +25,7 @@
#include <uhd/exception.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/utils/msg.hpp>
-#include <boost/cstdint.hpp>
+#include <stdint.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/thread.hpp>
#include <boost/scoped_array.hpp>
@@ -107,9 +107,9 @@ const double ad9361_device_t::DEFAULT_TX_FREQ = 850e6;
* how many taps are in the filter, and given a vector of the taps
* themselves. */
-void ad9361_device_t::_program_fir_filter(direction_t direction, chain_t chain, int num_taps, boost::uint16_t *coeffs)
+void ad9361_device_t::_program_fir_filter(direction_t direction, chain_t chain, int num_taps, uint16_t *coeffs)
{
- boost::uint16_t base;
+ uint16_t base;
/* RX and TX filters use largely identical sets of programming registers.
Select the appropriate bank of registers here. */
@@ -120,9 +120,9 @@ void ad9361_device_t::_program_fir_filter(direction_t direction, chain_t chain,
}
/* Encode number of filter taps for programming register */
- boost::uint8_t reg_numtaps = (((num_taps / 16) - 1) & 0x07) << 5;
+ uint8_t reg_numtaps = (((num_taps / 16) - 1) & 0x07) << 5;
- boost::uint8_t reg_chain = 0;
+ uint8_t reg_chain = 0;
switch (chain) {
case CHAIN_1:
reg_chain = 0x01 << 3;
@@ -182,25 +182,25 @@ void ad9361_device_t::_program_fir_filter(direction_t direction, chain_t chain,
/* Program the RX FIR Filter. */
-void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t decimation)
+void ad9361_device_t::_setup_rx_fir(size_t num_taps, int32_t decimation)
{
if (not (decimation == 1 or decimation == 2 or decimation == 4)) {
throw uhd::runtime_error("[ad9361_device_t] Invalid Rx FIR decimation.");
}
- boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps]);
+ boost::scoped_array<uint16_t> coeffs(new uint16_t[num_taps]);
for (size_t i = 0; i < num_taps; i++) {
switch (num_taps) {
case 128:
- coeffs[i] = boost::uint16_t((decimation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
+ coeffs[i] = uint16_t((decimation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
break;
case 96:
- coeffs[i] = boost::uint16_t((decimation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
+ coeffs[i] = uint16_t((decimation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
break;
case 64:
- coeffs[i] = boost::uint16_t((decimation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
+ coeffs[i] = uint16_t((decimation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
break;
case 48:
- coeffs[i] = boost::uint16_t((decimation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
+ coeffs[i] = uint16_t((decimation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
break;
default:
throw uhd::runtime_error("[ad9361_device_t] Unsupported number of Rx FIR taps.");
@@ -211,7 +211,7 @@ void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t decimation)
}
/* Program the TX FIR Filter. */
-void ad9361_device_t::_setup_tx_fir(size_t num_taps, boost::int32_t interpolation)
+void ad9361_device_t::_setup_tx_fir(size_t num_taps, int32_t interpolation)
{
if (not (interpolation == 1 or interpolation == 2 or interpolation == 4)) {
throw uhd::runtime_error("[ad9361_device_t] Invalid Tx FIR interpolation.");
@@ -219,20 +219,20 @@ void ad9361_device_t::_setup_tx_fir(size_t num_taps, boost::int32_t interpolatio
if (interpolation == 1 and num_taps > 64) {
throw uhd::runtime_error("[ad9361_device_t] Too many Tx FIR taps for interpolation value.");
}
- boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps]);
+ boost::scoped_array<uint16_t> coeffs(new uint16_t[num_taps]);
for (size_t i = 0; i < num_taps; i++) {
switch (num_taps) {
case 128:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
+ coeffs[i] = uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
break;
case 96:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
+ coeffs[i] = uint16_t((interpolation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
break;
case 64:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
+ coeffs[i] = uint16_t((interpolation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
break;
case 48:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
+ coeffs[i] = uint16_t((interpolation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
break;
default:
throw uhd::runtime_error("[ad9361_device_t] Unsupported number of Tx FIR taps.");
@@ -335,16 +335,16 @@ double ad9361_device_t::_calibrate_baseband_rx_analog_filter(double req_rfbw)
}
double rxtune_clk = ((1.4 * bbbw * 2 * M_PI) / M_LN2);
- _rx_bbf_tunediv = std::min<boost::uint16_t>(511, boost::uint16_t(std::ceil(_bbpll_freq / rxtune_clk)));
+ _rx_bbf_tunediv = std::min<uint16_t>(511, uint16_t(std::ceil(_bbpll_freq / rxtune_clk)));
_regs.bbftune_config = (_regs.bbftune_config & 0xFE)
| ((_rx_bbf_tunediv >> 8) & 0x0001);
double bbbw_mhz = bbbw / 1e6;
double temp = ((bbbw_mhz - std::floor(bbbw_mhz)) * 1000) / 7.8125;
- boost::uint8_t bbbw_khz = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor(temp + 0.5)));
+ uint8_t bbbw_khz = std::min<uint8_t>(127, uint8_t(std::floor(temp + 0.5)));
/* Set corner frequencies and dividers. */
- _io_iface->poke8(0x1fb, (boost::uint8_t) (bbbw_mhz));
+ _io_iface->poke8(0x1fb, (uint8_t) (bbbw_mhz));
_io_iface->poke8(0x1fc, bbbw_khz);
_io_iface->poke8(0x1f8, (_rx_bbf_tunediv & 0x00FF));
_io_iface->poke8(0x1f9, _regs.bbftune_config);
@@ -402,7 +402,7 @@ double ad9361_device_t::_calibrate_baseband_tx_analog_filter(double req_rfbw)
}
double txtune_clk = ((1.6 * bbbw * 2 * M_PI) / M_LN2);
- boost::uint16_t txbbfdiv = std::min<boost::uint16_t>(511, boost::uint16_t(std::ceil(_bbpll_freq / txtune_clk)));
+ uint16_t txbbfdiv = std::min<uint16_t>(511, uint16_t(std::ceil(_bbpll_freq / txtune_clk)));
_regs.bbftune_mode = (_regs.bbftune_mode & 0xFE)
| ((txbbfdiv >> 8) & 0x0001);
@@ -481,7 +481,7 @@ double ad9361_device_t::_calibrate_secondary_tx_filter(double req_rfbw)
cap = 63;
}
- boost::uint8_t reg0d0, reg0d1, reg0d2;
+ uint8_t reg0d0, reg0d1, reg0d2;
/* Translate baseband bandwidths to register settings. */
if ((bbbw_mhz * 2) <= 9) {
@@ -526,14 +526,14 @@ double ad9361_device_t::_calibrate_secondary_tx_filter(double req_rfbw)
* UG570 page 33 states that this filter should be calibrated to 2.5 * bbbw */
double ad9361_device_t::_calibrate_rx_TIAs(double req_rfbw)
{
- boost::uint8_t reg1eb = _io_iface->peek8(0x1eb) & 0x3F;
- boost::uint8_t reg1ec = _io_iface->peek8(0x1ec) & 0x7F;
- boost::uint8_t reg1e6 = _io_iface->peek8(0x1e6) & 0x07;
- boost::uint8_t reg1db = 0x00;
- boost::uint8_t reg1dc = 0x00;
- boost::uint8_t reg1dd = 0x00;
- boost::uint8_t reg1de = 0x00;
- boost::uint8_t reg1df = 0x00;
+ uint8_t reg1eb = _io_iface->peek8(0x1eb) & 0x3F;
+ uint8_t reg1ec = _io_iface->peek8(0x1ec) & 0x7F;
+ uint8_t reg1e6 = _io_iface->peek8(0x1e6) & 0x07;
+ uint8_t reg1db = 0x00;
+ uint8_t reg1dc = 0x00;
+ uint8_t reg1dd = 0x00;
+ uint8_t reg1de = 0x00;
+ uint8_t reg1df = 0x00;
double bbbw = req_rfbw / 2.0;
@@ -572,12 +572,12 @@ double ad9361_device_t::_calibrate_rx_TIAs(double req_rfbw)
if (CTIA_fF > 2920) {
reg1dc = 0x40;
reg1de = 0x40;
- boost::uint8_t temp = (boost::uint8_t) std::min<boost::uint8_t>(127,
- boost::uint8_t(std::floor(0.5 + ((CTIA_fF - 400.0) / 320.0))));
+ uint8_t temp = (uint8_t) std::min<uint8_t>(127,
+ uint8_t(std::floor(0.5 + ((CTIA_fF - 400.0) / 320.0))));
reg1dd = temp;
reg1df = temp;
} else {
- boost::uint8_t temp = boost::uint8_t(std::floor(0.5 + ((CTIA_fF - 400.0) / 40.0)) + 0x40);
+ uint8_t temp = uint8_t(std::floor(0.5 + ((CTIA_fF - 400.0) / 40.0)) + 0x40);
reg1dc = temp;
reg1de = temp;
reg1dd = 0;
@@ -613,9 +613,9 @@ void ad9361_device_t::_setup_adc()
bbbw_mhz = 0.20;
}
- boost::uint8_t rxbbf_c3_msb = _io_iface->peek8(0x1eb) & 0x3F;
- boost::uint8_t rxbbf_c3_lsb = _io_iface->peek8(0x1ec) & 0x7F;
- boost::uint8_t rxbbf_r2346 = _io_iface->peek8(0x1e6) & 0x07;
+ uint8_t rxbbf_c3_msb = _io_iface->peek8(0x1eb) & 0x3F;
+ uint8_t rxbbf_c3_lsb = _io_iface->peek8(0x1ec) & 0x7F;
+ uint8_t rxbbf_r2346 = _io_iface->peek8(0x1e6) & 0x07;
double fsadc = _adcclock_freq / 1e6;
@@ -644,71 +644,71 @@ void ad9361_device_t::_setup_adc()
/* Calculate the values for all 40 settings registers.
*
* DO NOT TOUCH THIS UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING. kthx.*/
- boost::uint8_t data[40];
+ uint8_t data[40];
data[0] = 0; data[1] = 0; data[2] = 0; data[3] = 0x24;
data[4] = 0x24; data[5] = 0; data[6] = 0;
- data[7] = std::min<boost::uint8_t>(124, boost::uint8_t(std::floor(-0.5
+ data[7] = std::min<uint8_t>(124, uint8_t(std::floor(-0.5
+ (80.0 * scale_snr * scale_res
* std::min<double>(1.0, sqrt(maxsnr * fsadc / 640.0))))));
double data007 = data[7];
- data[8] = std::min<boost::uint8_t>(255, boost::uint8_t(std::floor(0.5
+ data[8] = std::min<uint8_t>(255, uint8_t(std::floor(0.5
+ ((20.0 * (640.0 / fsadc) * ((data007 / 80.0))
/ (scale_res * scale_cap))))));
- data[10] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor(-0.5 + (77.0 * scale_res
+ data[10] = std::min<uint8_t>(127, uint8_t(std::floor(-0.5 + (77.0 * scale_res
* std::min<double>(1.0, sqrt(maxsnr * fsadc / 640.0))))));
double data010 = data[10];
- data[9] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor(0.8 * data010)));
- data[11] = std::min<boost::uint8_t>(255, boost::uint8_t(std::floor(0.5
+ data[9] = std::min<uint8_t>(127, uint8_t(std::floor(0.8 * data010)));
+ data[11] = std::min<uint8_t>(255, uint8_t(std::floor(0.5
+ (20.0 * (640.0 / fsadc) * ((data010 / 77.0)
/ (scale_res * scale_cap))))));
- data[12] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor(-0.5
+ data[12] = std::min<uint8_t>(127, uint8_t(std::floor(-0.5
+ (80.0 * scale_res * std::min<double>(1.0,
sqrt(maxsnr * fsadc / 640.0))))));
double data012 = data[12];
- data[13] = std::min<boost::uint8_t>(255, boost::uint8_t(std::floor(-1.5
+ data[13] = std::min<uint8_t>(255, uint8_t(std::floor(-1.5
+ (20.0 * (640.0 / fsadc) * ((data012 / 80.0)
/ (scale_res * scale_cap))))));
- data[14] = 21 * boost::uint8_t(std::floor(0.1 * 640.0 / fsadc));
- data[15] = std::min<boost::uint8_t>(127, boost::uint8_t(1.025 * data007));
+ data[14] = 21 * uint8_t(std::floor(0.1 * 640.0 / fsadc));
+ data[15] = std::min<uint8_t>(127, uint8_t(1.025 * data007));
double data015 = data[15];
- data[16] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor((data015
+ data[16] = std::min<uint8_t>(127, uint8_t(std::floor((data015
* (0.98 + (0.02 * std::max<double>(1.0,
(640.0 / fsadc) / maxsnr)))))));
data[17] = data[15];
- data[18] = std::min<boost::uint8_t>(127, boost::uint8_t(0.975 * (data010)));
+ data[18] = std::min<uint8_t>(127, uint8_t(0.975 * (data010)));
double data018 = data[18];
- data[19] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor((data018
+ data[19] = std::min<uint8_t>(127, uint8_t(std::floor((data018
* (0.98 + (0.02 * std::max<double>(1.0,
(640.0 / fsadc) / maxsnr)))))));
data[20] = data[18];
- data[21] = std::min<boost::uint8_t>(127, boost::uint8_t(0.975 * data012));
+ data[21] = std::min<uint8_t>(127, uint8_t(0.975 * data012));
double data021 = data[21];
- data[22] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor((data021
+ data[22] = std::min<uint8_t>(127, uint8_t(std::floor((data021
* (0.98 + (0.02 * std::max<double>(1.0,
(640.0 / fsadc) / maxsnr)))))));
data[23] = data[21];
data[24] = 0x2e;
- data[25] = boost::uint8_t(std::floor(128.0 + std::min<double>(63.0,
+ data[25] = uint8_t(std::floor(128.0 + std::min<double>(63.0,
63.0 * (fsadc / 640.0))));
- data[26] = boost::uint8_t(std::floor(std::min<double>(63.0, 63.0 * (fsadc / 640.0)
+ data[26] = uint8_t(std::floor(std::min<double>(63.0, 63.0 * (fsadc / 640.0)
* (0.92 + (0.08 * (640.0 / fsadc))))));
- data[27] = boost::uint8_t(std::floor(std::min<double>(63.0,
+ data[27] = uint8_t(std::floor(std::min<double>(63.0,
32.0 * sqrt(fsadc / 640.0))));
- data[28] = boost::uint8_t(std::floor(128.0 + std::min<double>(63.0,
+ data[28] = uint8_t(std::floor(128.0 + std::min<double>(63.0,
63.0 * (fsadc / 640.0))));
- data[29] = boost::uint8_t(std::floor(std::min<double>(63.0,
+ data[29] = uint8_t(std::floor(std::min<double>(63.0,
63.0 * (fsadc / 640.0)
* (0.92 + (0.08 * (640.0 / fsadc))))));
- data[30] = boost::uint8_t(std::floor(std::min<double>(63.0,
+ data[30] = uint8_t(std::floor(std::min<double>(63.0,
32.0 * sqrt(fsadc / 640.0))));
- data[31] = boost::uint8_t(std::floor(128.0 + std::min<double>(63.0,
+ data[31] = uint8_t(std::floor(128.0 + std::min<double>(63.0,
63.0 * (fsadc / 640.0))));
- data[32] = boost::uint8_t(std::floor(std::min<double>(63.0,
+ data[32] = uint8_t(std::floor(std::min<double>(63.0,
63.0 * (fsadc / 640.0) * (0.92
+ (0.08 * (640.0 / fsadc))))));
- data[33] = boost::uint8_t(std::floor(std::min<double>(63.0,
+ data[33] = uint8_t(std::floor(std::min<double>(63.0,
63.0 * sqrt(fsadc / 640.0))));
- data[34] = std::min<boost::uint8_t>(127, boost::uint8_t(std::floor(64.0
+ data[34] = std::min<uint8_t>(127, uint8_t(std::floor(64.0
* sqrt(fsadc / 640.0))));
data[35] = 0x40;
data[36] = 0x40;
@@ -848,8 +848,8 @@ void ad9361_device_t::_tx_quadrature_cal_routine() {
* 3) Re-read 0A3 to get bits [5:0] because maybe they changed?
* 4) Update only the TX NCO freq bits in 0A3.
* 5) Profit (I hope). */
- boost::uint8_t reg0a3 = _io_iface->peek8(0x0a3);
- boost::uint8_t nco_freq = (reg0a3 & 0xC0);
+ uint8_t reg0a3 = _io_iface->peek8(0x0a3);
+ uint8_t nco_freq = (reg0a3 & 0xC0);
_io_iface->poke8(0x0a0, 0x15 | (nco_freq >> 1));
reg0a3 = _io_iface->peek8(0x0a3);
_io_iface->poke8(0x0a3, (reg0a3 & 0x3F) | nco_freq);
@@ -916,7 +916,7 @@ void ad9361_device_t::_calibrate_tx_quadrature()
/* This calibration must be done in a certain order, and for both TX_A
* and TX_B, separately. Store the original setting so that we can
* restore it later. */
- boost::uint8_t orig_reg_inputsel = _regs.inputsel;
+ uint8_t orig_reg_inputsel = _regs.inputsel;
/***********************************************************************
* TX1/2-A Calibration
@@ -951,9 +951,9 @@ void ad9361_device_t::_calibrate_tx_quadrature()
* Note that this table is fixed for all frequency settings. */
void ad9361_device_t::_program_mixer_gm_subtable()
{
- boost::uint8_t gain[] = { 0x78, 0x74, 0x70, 0x6C, 0x68, 0x64, 0x60, 0x5C, 0x58,
+ uint8_t gain[] = { 0x78, 0x74, 0x70, 0x6C, 0x68, 0x64, 0x60, 0x5C, 0x58,
0x54, 0x50, 0x4C, 0x48, 0x30, 0x18, 0x00 };
- boost::uint8_t gm[] = { 0x00, 0x0D, 0x15, 0x1B, 0x21, 0x25, 0x29, 0x2C, 0x2F, 0x31,
+ uint8_t gm[] = { 0x00, 0x0D, 0x15, 0x1B, 0x21, 0x25, 0x29, 0x2C, 0x2F, 0x31,
0x33, 0x34, 0x35, 0x3A, 0x3D, 0x3E };
/* Start the clock. */
@@ -984,8 +984,8 @@ void ad9361_device_t::_program_mixer_gm_subtable()
void ad9361_device_t::_program_gain_table() {
/* Figure out which gain table we should be using for our current
* frequency band. */
- boost::uint8_t (*gain_table)[3] = NULL;
- boost::uint8_t new_gain_table;
+ uint8_t (*gain_table)[3] = NULL;
+ uint8_t new_gain_table;
if (_rx_freq < 1300e6) {
gain_table = gain_table_sub_1300mhz;
new_gain_table = 1;
@@ -1012,7 +1012,7 @@ void ad9361_device_t::_program_gain_table() {
_io_iface->poke8(0x137, 0x1A);
/* IT'S PROGRAMMING TIME. */
- boost::uint8_t index = 0;
+ uint8_t index = 0;
for (; index < 77; index++) {
_io_iface->poke8(0x130, index);
_io_iface->poke8(0x131, gain_table[index][0]);
@@ -1118,18 +1118,18 @@ void ad9361_device_t::_setup_synth(direction_t direction, double vcorate)
throw uhd::runtime_error("[ad9361_device_t] vcoindex > 53");
/* Parse the values out of the LUT based on our calculated index... */
- boost::uint8_t vco_output_level = synth_cal_lut[vcoindex][0];
- boost::uint8_t vco_varactor = synth_cal_lut[vcoindex][1];
- boost::uint8_t vco_bias_ref = synth_cal_lut[vcoindex][2];
- boost::uint8_t vco_bias_tcf = synth_cal_lut[vcoindex][3];
- boost::uint8_t vco_cal_offset = synth_cal_lut[vcoindex][4];
- boost::uint8_t vco_varactor_ref = synth_cal_lut[vcoindex][5];
- boost::uint8_t charge_pump_curr = synth_cal_lut[vcoindex][6];
- boost::uint8_t loop_filter_c2 = synth_cal_lut[vcoindex][7];
- boost::uint8_t loop_filter_c1 = synth_cal_lut[vcoindex][8];
- boost::uint8_t loop_filter_r1 = synth_cal_lut[vcoindex][9];
- boost::uint8_t loop_filter_c3 = synth_cal_lut[vcoindex][10];
- boost::uint8_t loop_filter_r3 = synth_cal_lut[vcoindex][11];
+ uint8_t vco_output_level = synth_cal_lut[vcoindex][0];
+ uint8_t vco_varactor = synth_cal_lut[vcoindex][1];
+ uint8_t vco_bias_ref = synth_cal_lut[vcoindex][2];
+ uint8_t vco_bias_tcf = synth_cal_lut[vcoindex][3];
+ uint8_t vco_cal_offset = synth_cal_lut[vcoindex][4];
+ uint8_t vco_varactor_ref = synth_cal_lut[vcoindex][5];
+ uint8_t charge_pump_curr = synth_cal_lut[vcoindex][6];
+ uint8_t loop_filter_c2 = synth_cal_lut[vcoindex][7];
+ uint8_t loop_filter_c1 = synth_cal_lut[vcoindex][8];
+ uint8_t loop_filter_r1 = synth_cal_lut[vcoindex][9];
+ uint8_t loop_filter_c3 = synth_cal_lut[vcoindex][10];
+ uint8_t loop_filter_r3 = synth_cal_lut[vcoindex][11];
/* ... annnd program! */
if (direction == RX) {
@@ -1566,7 +1566,7 @@ void ad9361_device_t::initialize()
boost::this_thread::sleep(boost::posix_time::milliseconds(20));
/* Check device ID to make sure iface works */
- boost::uint32_t device_id = (_io_iface->peek8(0x037) & 0x8);
+ uint32_t device_id = (_io_iface->peek8(0x037) & 0x8);
if (device_id != 0x8) {
throw uhd::runtime_error(str(boost::format("[ad9361_device_t::initialize] Device ID readback failure. Expected: 0x8, Received: 0x%x") % device_id));
}
@@ -1631,9 +1631,9 @@ void ad9361_device_t::initialize()
/* Data delay for TX and RX data clocks */
digital_interface_delays_t timing =
_client_params->get_digital_interface_timing();
- boost::uint8_t rx_delays = ((timing.rx_clk_delay & 0xF) << 4)
+ uint8_t rx_delays = ((timing.rx_clk_delay & 0xF) << 4)
| (timing.rx_data_delay & 0xF);
- boost::uint8_t tx_delays = ((timing.tx_clk_delay & 0xF) << 4)
+ uint8_t tx_delays = ((timing.tx_clk_delay & 0xF) << 4)
| (timing.tx_data_delay & 0xF);
_io_iface->poke8(0x006, rx_delays);
_io_iface->poke8(0x007, tx_delays);
@@ -1811,7 +1811,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate)
/* We must be in the SLEEP / WAIT state to do this. If we aren't already
* there, transition the ENSM to State 0. */
- boost::uint8_t current_state = _io_iface->peek8(0x017) & 0x0F;
+ uint8_t current_state = _io_iface->peek8(0x017) & 0x0F;
switch (current_state) {
case 0x05:
/* We are in the ALERT state. */
@@ -1833,8 +1833,8 @@ double ad9361_device_t::set_clock_rate(const double req_rate)
/* Store the current chain / antenna selections so that we can restore
* them at the end of this routine; all chains will be enabled from
* within setup_rates for calibration purposes. */
- boost::uint8_t orig_tx_chains = _regs.txfilt & 0xC0;
- boost::uint8_t orig_rx_chains = _regs.rxfilt & 0xC0;
+ uint8_t orig_tx_chains = _regs.txfilt & 0xC0;
+ uint8_t orig_rx_chains = _regs.rxfilt & 0xC0;
/* Call into the clock configuration / settings function. This is where
* all the hard work gets done. */
@@ -1962,8 +1962,8 @@ void ad9361_device_t::set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2)
}
/* Check for FDD state */
- boost::uint8_t set_back_to_fdd = 0;
- boost::uint8_t ensm_state = _io_iface->peek8(0x017) & 0x0F;
+ uint8_t set_back_to_fdd = 0;
+ uint8_t ensm_state = _io_iface->peek8(0x017) & 0x0F;
if (ensm_state == 0xA) // FDD
{
/* Put into ALERT state (via the FDD flush state). */
@@ -2124,7 +2124,7 @@ double ad9361_device_t::set_gain(direction_t direction, chain_t chain, const dou
* outside this function.
*/
double atten = AD9361_MAX_GAIN - value;
- boost::uint32_t attenreg = boost::uint32_t(atten * 4);
+ uint32_t attenreg = uint32_t(atten * 4);
if (chain == CHAIN_1) {
_tx1_gain = value;
_io_iface->poke8(0x073, attenreg & 0xFF);
@@ -2166,8 +2166,8 @@ void ad9361_device_t::data_port_loopback(const bool loopback_enabled)
* -0.25dB / bit 9bit resolution.*/
double ad9361_device_t::get_rssi(chain_t chain)
{
- boost::uint32_t reg_rssi = 0;
- boost::uint8_t lsb_bit_pos = 0;
+ uint32_t reg_rssi = 0;
+ uint8_t lsb_bit_pos = 0;
if (chain == CHAIN_1) {
reg_rssi = 0x1A7;
lsb_bit_pos = 0;
@@ -2175,9 +2175,9 @@ double ad9361_device_t::get_rssi(chain_t chain)
reg_rssi = 0x1A9;
lsb_bit_pos = 1;
}
- boost::uint8_t msbs = _io_iface->peek8(reg_rssi);
- boost::uint8_t lsb = ((_io_iface->peek8(0x1AB)) >> lsb_bit_pos) & 0x01;
- boost::uint16_t val = ((msbs << 1) | lsb);
+ uint8_t msbs = _io_iface->peek8(reg_rssi);
+ uint8_t lsb = ((_io_iface->peek8(0x1AB)) >> lsb_bit_pos) & 0x01;
+ uint16_t val = ((msbs << 1) | lsb);
double rssi = (-0.25f * ((double)val)); //-0.25dB/lsb (See Gain Control Users Guide p. 25)
return rssi;
}
@@ -2190,7 +2190,7 @@ double ad9361_device_t::get_rssi(chain_t chain)
double ad9361_device_t::_get_temperature(const double cal_offset, const double timeout)
{
//set 0x01D[0] to 1 to disable AuxADC GPIO reading
- boost::uint8_t tmp = 0;
+ uint8_t tmp = 0;
tmp = _io_iface->peek8(0x01D);
_io_iface->poke8(0x01D, (tmp | 0x01));
_io_iface->poke8(0x00B, 0); //set offset to 0
@@ -2209,7 +2209,7 @@ double ad9361_device_t::_get_temperature(const double cal_offset, const double t
}
_io_iface->poke8(0x00C, 0x00); //clear read flag
- boost::uint8_t temp = _io_iface->peek8(0x00E); //read temperature.
+ uint8_t temp = _io_iface->peek8(0x00E); //read temperature.
double tmp_temp = temp/1.140f; //according to ADI driver
tmp_temp = tmp_temp + cal_offset; //Constant offset acquired by one point calibration.
@@ -2275,9 +2275,9 @@ void ad9361_device_t::set_iq_balance_auto(direction_t direction, const bool on)
* the gain configuration will be reloaded. */
void ad9361_device_t::_setup_agc(chain_t chain, gain_mode_t gain_mode)
{
- boost::uint8_t gain_mode_reg = 0;
- boost::uint8_t gain_mode_prev = 0;
- boost::uint8_t gain_mode_bits_pos = 0;
+ uint8_t gain_mode_reg = 0;
+ uint8_t gain_mode_prev = 0;
+ uint8_t gain_mode_bits_pos = 0;
gain_mode_reg = _io_iface->peek8(0x0FA);
gain_mode_prev = (gain_mode_reg & 0x0F);
@@ -2306,7 +2306,7 @@ void ad9361_device_t::_setup_agc(chain_t chain, gain_mode_t gain_mode)
throw uhd::runtime_error("[ad9361_device_t] Gain mode does not exist");
}
_io_iface->poke8(0x0FA, gain_mode_reg);
- boost::uint8_t gain_mode_status = _io_iface->peek8(0x0FA);
+ uint8_t gain_mode_status = _io_iface->peek8(0x0FA);
gain_mode_status = (gain_mode_status & 0x0F);
/*Check if gain mode configuration needs to be reprogrammed*/
if (((gain_mode_prev == 0) && (gain_mode_status != 0)) || ((gain_mode_prev != 0) && (gain_mode_status == 0))) {
@@ -2434,16 +2434,16 @@ double ad9361_device_t::set_bw_filter(direction_t direction, const double rf_bw)
return (2.0 * set_analog_bb_bw);
}
-void ad9361_device_t::_set_fir_taps(direction_t direction, chain_t chain, const std::vector<boost::int16_t>& taps)
+void ad9361_device_t::_set_fir_taps(direction_t direction, chain_t chain, const std::vector<int16_t>& taps)
{
size_t num_taps = taps.size();
size_t num_taps_avail = _get_num_fir_taps(direction);
if(num_taps == num_taps_avail)
{
- boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps_avail]);
+ boost::scoped_array<uint16_t> coeffs(new uint16_t[num_taps_avail]);
for (size_t i = 0; i < num_taps_avail; i++)
{
- coeffs[i] = boost::uint16_t(taps[i]);
+ coeffs[i] = uint16_t(taps[i]);
}
_program_fir_filter(direction, chain, num_taps_avail, coeffs.get());
} else if(num_taps < num_taps_avail){
@@ -2455,7 +2455,7 @@ void ad9361_device_t::_set_fir_taps(direction_t direction, chain_t chain, const
size_t ad9361_device_t::_get_num_fir_taps(direction_t direction)
{
- boost::uint8_t num = 0;
+ uint8_t num = 0;
if(direction == RX)
num = _io_iface->peek8(0x0F5);
else
@@ -2466,7 +2466,7 @@ size_t ad9361_device_t::_get_num_fir_taps(direction_t direction)
size_t ad9361_device_t::_get_fir_dec_int(direction_t direction)
{
- boost::uint8_t dec_int = 0;
+ uint8_t dec_int = 0;
if(direction == RX)
dec_int = _io_iface->peek8(0x003);
else
@@ -2484,12 +2484,12 @@ size_t ad9361_device_t::_get_fir_dec_int(direction_t direction)
return dec_int;
}
-std::vector<boost::int16_t> ad9361_device_t::_get_fir_taps(direction_t direction, chain_t chain)
+std::vector<int16_t> ad9361_device_t::_get_fir_taps(direction_t direction, chain_t chain)
{
int base;
size_t num_taps = _get_num_fir_taps(direction);
- boost::uint8_t config;
- boost::uint8_t reg_numtaps = (((num_taps / 16) - 1) & 0x07) << 5;
+ uint8_t config;
+ uint8_t reg_numtaps = (((num_taps / 16) - 1) & 0x07) << 5;
config = reg_numtaps | 0x02; //start the programming clock
if(chain == CHAIN_1)
@@ -2510,17 +2510,17 @@ std::vector<boost::int16_t> ad9361_device_t::_get_fir_taps(direction_t direction
_io_iface->poke8(base+5,config);
- std::vector<boost::int16_t> taps;
- boost::uint8_t lower_val;
- boost::uint8_t higher_val;
- boost::uint16_t coeff;
+ std::vector<int16_t> taps;
+ uint8_t lower_val;
+ uint8_t higher_val;
+ uint16_t coeff;
for(size_t i = 0;i < num_taps;i++)
{
_io_iface->poke8(base,0x00+i);
lower_val = _io_iface->peek8(base+3);
higher_val = _io_iface->peek8(base+4);
coeff = ((higher_val << 8) | lower_val);
- taps.push_back(boost::int16_t(coeff));
+ taps.push_back(int16_t(coeff));
}
config = (config & (~(1 << 1))); //disable filter clock
@@ -2569,16 +2569,16 @@ filter_info_base::sptr ad9361_device_t::_get_filter_lp_bb(direction_t direction)
* For TX direction the INT3 is returned. */
filter_info_base::sptr ad9361_device_t::_get_filter_dec_int_3(direction_t direction)
{
- boost::uint8_t enable = 0;
+ uint8_t enable = 0;
double rate = _adcclock_freq;
double full_scale;
size_t dec = 0;
size_t interpol = 0;
filter_info_base::filter_type type = filter_info_base::DIGITAL_I16;
std::string name;
- boost::int16_t taps_array_rx[] = {55, 83, 0, -393, -580, 0, 1914, 4041, 5120, 4041, 1914, 0, -580, -393, 0, 83, 55};
- boost::int16_t taps_array_tx[] = {36, -19, 0, -156, -12, 0, 479, 233, 0, -1215, -993, 0, 3569, 6277, 8192, 6277, 3569, 0, -993, -1215, 0, 223, 479, 0, -12, -156, 0, -19, 36};
- std::vector<boost::int16_t> taps;
+ int16_t taps_array_rx[] = {55, 83, 0, -393, -580, 0, 1914, 4041, 5120, 4041, 1914, 0, -580, -393, 0, 83, 55};
+ int16_t taps_array_tx[] = {36, -19, 0, -156, -12, 0, 479, 233, 0, -1215, -993, 0, 3569, 6277, 8192, 6277, 3569, 0, -993, -1215, 0, 223, 479, 0, -12, -156, 0, -19, 36};
+ std::vector<int16_t> taps;
filter_info_base::sptr ret;
@@ -2590,14 +2590,14 @@ filter_info_base::sptr ad9361_device_t::_get_filter_dec_int_3(direction_t direct
enable = _io_iface->peek8(0x003);
enable = ((enable >> 4) & 0x03);
- taps.assign(taps_array_rx, taps_array_rx + sizeof(taps_array_rx) / sizeof(boost::int16_t) );
+ taps.assign(taps_array_rx, taps_array_rx + sizeof(taps_array_rx) / sizeof(int16_t) );
} else {
full_scale = 8192;
dec = 1;
interpol = 3;
- boost::uint8_t use_dac_clk_div = _io_iface->peek8(0x00A);
+ uint8_t use_dac_clk_div = _io_iface->peek8(0x00A);
use_dac_clk_div = ((use_dac_clk_div >> 3) & 0x01);
if(use_dac_clk_div == 1)
{
@@ -2611,24 +2611,24 @@ filter_info_base::sptr ad9361_device_t::_get_filter_dec_int_3(direction_t direct
rate /= 3;
}
- taps.assign(taps_array_tx, taps_array_tx + sizeof(taps_array_tx) / sizeof(boost::int16_t) );
+ taps.assign(taps_array_tx, taps_array_tx + sizeof(taps_array_tx) / sizeof(int16_t) );
}
- ret = filter_info_base::sptr(new digital_filter_base<boost::int16_t>(type, (enable != 2) ? true : false, 2, rate, interpol, dec, full_scale, taps.size(), taps));
+ ret = filter_info_base::sptr(new digital_filter_base<int16_t>(type, (enable != 2) ? true : false, 2, rate, interpol, dec, full_scale, taps.size(), taps));
return ret;
}
filter_info_base::sptr ad9361_device_t::_get_filter_hb_3(direction_t direction)
{
- boost::uint8_t enable = 0;
+ uint8_t enable = 0;
double rate = _adcclock_freq;
double full_scale = 0;
size_t dec = 1;
size_t interpol = 1;
filter_info_base::filter_type type = filter_info_base::DIGITAL_I16;
- boost::int16_t taps_array_rx[] = {1, 4, 6, 4, 1};
- boost::int16_t taps_array_tx[] = {1, 2, 1};
- std::vector<boost::int16_t> taps;
+ int16_t taps_array_rx[] = {1, 4, 6, 4, 1};
+ int16_t taps_array_tx[] = {1, 2, 1};
+ std::vector<int16_t> taps;
if(direction == RX)
{
@@ -2637,12 +2637,12 @@ filter_info_base::sptr ad9361_device_t::_get_filter_hb_3(direction_t direction)
enable = _io_iface->peek8(0x003);
enable = ((enable >> 4) & 0x03);
- taps.assign(taps_array_rx, taps_array_rx + sizeof(taps_array_rx) / sizeof(boost::int16_t) );
+ taps.assign(taps_array_rx, taps_array_rx + sizeof(taps_array_rx) / sizeof(int16_t) );
} else {
full_scale = 2;
interpol = 2;
- boost::uint8_t use_dac_clk_div = _io_iface->peek8(0x00A);
+ uint8_t use_dac_clk_div = _io_iface->peek8(0x00A);
use_dac_clk_div = ((use_dac_clk_div >> 3) & 0x01);
if(use_dac_clk_div == 1)
{
@@ -2655,26 +2655,26 @@ filter_info_base::sptr ad9361_device_t::_get_filter_hb_3(direction_t direction)
{
rate /= 2;
}
- taps.assign(taps_array_tx, taps_array_tx + sizeof(taps_array_tx) / sizeof(boost::int16_t) );
+ taps.assign(taps_array_tx, taps_array_tx + sizeof(taps_array_tx) / sizeof(int16_t) );
}
- filter_info_base::sptr hb = filter_info_base::sptr(new digital_filter_base<boost::int16_t>(type, (enable != 1) ? true : false, 2, rate, interpol, dec, full_scale, taps.size(), taps));
+ filter_info_base::sptr hb = filter_info_base::sptr(new digital_filter_base<int16_t>(type, (enable != 1) ? true : false, 2, rate, interpol, dec, full_scale, taps.size(), taps));
return hb;
}
filter_info_base::sptr ad9361_device_t::_get_filter_hb_2(direction_t direction)
{
- boost::uint8_t enable = 0;
+ uint8_t enable = 0;
double rate = _adcclock_freq;
double full_scale = 0;
size_t dec = 1;
size_t interpol = 1;
filter_info_base::filter_type type = filter_info_base::DIGITAL_I16;
- boost::int16_t taps_array[] = {-9, 0, 73, 128, 73, 0, -9};
- std::vector<boost::int16_t> taps(taps_array, taps_array + sizeof(taps_array) / sizeof(boost::int16_t) );
+ int16_t taps_array[] = {-9, 0, 73, 128, 73, 0, -9};
+ std::vector<int16_t> taps(taps_array, taps_array + sizeof(taps_array) / sizeof(int16_t) );
- digital_filter_base<boost::int16_t>::sptr hb_3 = boost::dynamic_pointer_cast<digital_filter_base<boost::int16_t> >(_get_filter_hb_3(direction));
- digital_filter_base<boost::int16_t>::sptr dec_int_3 = boost::dynamic_pointer_cast<digital_filter_base<boost::int16_t> >(_get_filter_dec_int_3(direction));
+ digital_filter_base<int16_t>::sptr hb_3 = boost::dynamic_pointer_cast<digital_filter_base<int16_t> >(_get_filter_hb_3(direction));
+ digital_filter_base<int16_t>::sptr dec_int_3 = boost::dynamic_pointer_cast<digital_filter_base<int16_t> >(_get_filter_dec_int_3(direction));
if(direction == RX)
{
@@ -2714,24 +2714,24 @@ filter_info_base::sptr ad9361_device_t::_get_filter_hb_2(direction_t direction)
}
}
- filter_info_base::sptr hb(new digital_filter_base<boost::int16_t>(type, (enable == 0) ? true : false, 3, rate, interpol, dec, full_scale, taps.size(), taps));
+ filter_info_base::sptr hb(new digital_filter_base<int16_t>(type, (enable == 0) ? true : false, 3, rate, interpol, dec, full_scale, taps.size(), taps));
return hb;
}
filter_info_base::sptr ad9361_device_t::_get_filter_hb_1(direction_t direction)
{
- boost::uint8_t enable = 0;
+ uint8_t enable = 0;
double rate = 0;
double full_scale = 0;
size_t dec = 1;
size_t interpol = 1;
filter_info_base::filter_type type = filter_info_base::DIGITAL_I16;
- std::vector<boost::int16_t> taps;
- boost::int16_t taps_rx_array[] = {-8, 0, 42, 0, -147, 0, 619, 1013, 619, 0, -147, 0, 42, 0, -8};
- boost::int16_t taps_tx_array[] = {-53, 0, 313, 0, -1155, 0, 4989, 8192, 4989, 0, -1155, 0, 313, 0, -53};
+ std::vector<int16_t> taps;
+ int16_t taps_rx_array[] = {-8, 0, 42, 0, -147, 0, 619, 1013, 619, 0, -147, 0, 42, 0, -8};
+ int16_t taps_tx_array[] = {-53, 0, 313, 0, -1155, 0, 4989, 8192, 4989, 0, -1155, 0, 313, 0, -53};
- digital_filter_base<boost::int16_t>::sptr hb_2 = boost::dynamic_pointer_cast<digital_filter_base<boost::int16_t> >(_get_filter_hb_2(direction));
+ digital_filter_base<int16_t>::sptr hb_2 = boost::dynamic_pointer_cast<digital_filter_base<int16_t> >(_get_filter_hb_2(direction));
if(direction == RX)
{
@@ -2740,7 +2740,7 @@ filter_info_base::sptr ad9361_device_t::_get_filter_hb_1(direction_t direction)
enable = _io_iface->peek8(0x003);
enable = ((enable >> 2) & 0x01);
rate = hb_2->get_output_rate();
- taps.assign(taps_rx_array, taps_rx_array + sizeof(taps_rx_array) / sizeof(boost::int16_t) );
+ taps.assign(taps_rx_array, taps_rx_array + sizeof(taps_rx_array) / sizeof(int16_t) );
} else if (direction == TX) {
full_scale = 8192;
interpol = 2;
@@ -2751,10 +2751,10 @@ filter_info_base::sptr ad9361_device_t::_get_filter_hb_1(direction_t direction)
{
rate /= 2;
}
- taps.assign(taps_tx_array, taps_tx_array + sizeof(taps_tx_array) / sizeof(boost::int16_t) );
+ taps.assign(taps_tx_array, taps_tx_array + sizeof(taps_tx_array) / sizeof(int16_t) );
}
- filter_info_base::sptr hb(new digital_filter_base<boost::int16_t>(type, (enable == 0) ? true : false, 4, rate, interpol, dec, full_scale, taps.size(), taps));
+ filter_info_base::sptr hb(new digital_filter_base<int16_t>(type, (enable == 0) ? true : false, 4, rate, interpol, dec, full_scale, taps.size(), taps));
return hb;
}
@@ -2764,9 +2764,9 @@ filter_info_base::sptr ad9361_device_t::_get_filter_fir(direction_t direction, c
size_t dec = 1;
size_t interpol = 1;
size_t max_num_taps = 128;
- boost::uint8_t enable = 1;
+ uint8_t enable = 1;
- digital_filter_base<boost::int16_t>::sptr hb_1 = boost::dynamic_pointer_cast<digital_filter_base<boost::int16_t> >(_get_filter_hb_1(direction));
+ digital_filter_base<int16_t>::sptr hb_1 = boost::dynamic_pointer_cast<digital_filter_base<int16_t> >(_get_filter_hb_1(direction));
if(direction == RX)
{
@@ -2794,14 +2794,14 @@ filter_info_base::sptr ad9361_device_t::_get_filter_fir(direction_t direction, c
}
max_num_taps = _get_num_fir_taps(direction);
- filter_info_base::sptr fir(new digital_filter_fir<boost::int16_t>(filter_info_base::DIGITAL_FIR_I16, (enable == 0) ? true : false, 5, rate, interpol, dec, 32767, max_num_taps, _get_fir_taps(direction, chain)));
+ filter_info_base::sptr fir(new digital_filter_fir<int16_t>(filter_info_base::DIGITAL_FIR_I16, (enable == 0) ? true : false, 5, rate, interpol, dec, 32767, max_num_taps, _get_fir_taps(direction, chain)));
return fir;
}
void ad9361_device_t::_set_filter_fir(direction_t direction, chain_t channel, filter_info_base::sptr filter)
{
- digital_filter_fir<boost::int16_t>::sptr fir = boost::dynamic_pointer_cast<digital_filter_fir<boost::int16_t> >(filter);
+ digital_filter_fir<int16_t>::sptr fir = boost::dynamic_pointer_cast<digital_filter_fir<int16_t> >(filter);
//only write taps. Ignore everything else for now
_set_fir_taps(direction, channel, fir->get_taps());
}