summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-01-04 16:49:34 -0800
committerJosh Blum <josh@joshknows.com>2011-01-04 16:49:34 -0800
commitfabfa8d9dd6670afb9c621b9ee12f8d602d7ccda (patch)
tree107e43e35008e6df0d33b0e8a8f5f52d28a91493 /host/lib
parent4711829f03ee2fcd1c4e9dc2a353af0e35497180 (diff)
parent7b0b2924d52bbbcb4660cad5d8070074426011ce (diff)
downloaduhd-fabfa8d9dd6670afb9c621b9ee12f8d602d7ccda.tar.gz
uhd-fabfa8d9dd6670afb9c621b9ee12f8d602d7ccda.tar.bz2
uhd-fabfa8d9dd6670afb9c621b9ee12f8d602d7ccda.zip
Merge branch 'cordic_policy' into next
Conflicts: host/lib/usrp/usrp2/usrp2_regs.cpp host/lib/usrp/usrp2/usrp2_regs.hpp
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/CMakeLists.txt2
-rw-r--r--host/lib/ic_reg_maps/.gitignore2
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp2
-rw-r--r--host/lib/usrp/multi_usrp.cpp29
-rw-r--r--host/lib/usrp/single_usrp.cpp6
-rw-r--r--host/lib/usrp/usrp2/fw_common.h5
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp10
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp24
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp14
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp9
-rw-r--r--host/lib/usrp/usrp2/usrp2_regs.cpp6
-rw-r--r--host/lib/usrp/usrp2/usrp2_regs.hpp6
-rw-r--r--host/lib/usrp/usrp_e100/mboard_impl.cpp2
13 files changed, 50 insertions, 67 deletions
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index fa5d6b67b..498841561 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -55,7 +55,7 @@ MACRO(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile)
#make the outfile depend on the python script
ADD_CUSTOM_COMMAND(
OUTPUT ${outfile} DEPENDS ${pyfile}
- COMMAND ${PYTHON_EXECUTABLE} ${pyfile} ${outfile}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${pyfile} ${outfile}
COMMENT "Generating ${outfile}"
)
diff --git a/host/lib/ic_reg_maps/.gitignore b/host/lib/ic_reg_maps/.gitignore
deleted file mode 100644
index 053049d05..000000000
--- a/host/lib/ic_reg_maps/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/*.pyc
-/*.pyo
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index 17fdad74a..2508555d0 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -280,7 +280,7 @@ static float rf_gain_to_voltage(float gain, double lo_freq){
gain = get_tvrx_gain_ranges()["RF"].clip(gain);
//first we need to find out what band we're in, because gains are different across different bands
- std::string band = get_band(lo_freq + tvrx_if_freq);
+ std::string band = get_band(lo_freq - tvrx_if_freq);
//this is the voltage at the TVRX gain input
double gain_volts = gain_interp(gain, tvrx_rf_gains_db[band], tvrx_gains_volts);
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 876f1a3fc..5610bcd3f 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -117,26 +117,31 @@ public:
return _mboard(0)[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
}
+ time_spec_t get_time_last_pps(void){
+ return _mboard(0)[MBOARD_PROP_TIME_PPS].as<time_spec_t>();
+ }
+
void set_time_next_pps(const time_spec_t &time_spec){
for (size_t m = 0; m < get_num_mboards(); m++){
- _mboard(m)[MBOARD_PROP_TIME_NEXT_PPS] = time_spec;
+ _mboard(m)[MBOARD_PROP_TIME_PPS] = time_spec;
}
}
void set_time_unknown_pps(const time_spec_t &time_spec){
- std::cout << "Set time with unknown pps edge:" << std::endl;
- std::cout << " 1) set times next pps (race condition)" << std::endl;
- set_time_next_pps(time_spec);
- boost::this_thread::sleep(boost::posix_time::seconds(1));
-
- std::cout << " 2) catch seconds rollover at pps edge" << std::endl;
- time_t last_secs = 0, curr_secs = 0;
- while(curr_secs == last_secs){
- last_secs = curr_secs;
- curr_secs = get_time_now().get_full_secs();
+ std::cout << " 1) catch time transition at pps edge" << std::endl;
+ time_spec_t time_start = get_time_now();
+ time_spec_t time_start_last_pps = get_time_last_pps();
+ while(true){
+ if (get_time_last_pps() != time_start_last_pps) break;
+ if ((get_time_now() - time_start) > time_spec_t(1.1)){
+ throw std::runtime_error(
+ "Board 0 may not be getting a PPS signal.\n"
+ "The time at the last PPS has not changed.\n"
+ );
+ }
}
- std::cout << " 3) set times next pps (synchronously)" << std::endl;
+ std::cout << " 2) set times next pps (synchronously)" << std::endl;
set_time_next_pps(time_spec);
boost::this_thread::sleep(boost::posix_time::seconds(1));
diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp
index a0456d1f0..12730929a 100644
--- a/host/lib/usrp/single_usrp.cpp
+++ b/host/lib/usrp/single_usrp.cpp
@@ -106,12 +106,16 @@ public:
return _mboard()[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
}
+ time_spec_t get_time_last_pps(void){
+ return _mboard()[MBOARD_PROP_TIME_PPS].as<time_spec_t>();
+ }
+
void set_time_now(const time_spec_t &time_spec){
_mboard()[MBOARD_PROP_TIME_NOW] = time_spec;
}
void set_time_next_pps(const time_spec_t &time_spec){
- _mboard()[MBOARD_PROP_TIME_NEXT_PPS] = time_spec;
+ _mboard()[MBOARD_PROP_TIME_PPS] = time_spec;
}
void issue_stream_cmd(const stream_cmd_t &stream_cmd){
diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h
index ee7fc3882..2cdfdc359 100644
--- a/host/lib/usrp/usrp2/fw_common.h
+++ b/host/lib/usrp/usrp2/fw_common.h
@@ -127,9 +127,8 @@ typedef struct{
struct {
__stdint(uint32_t) addr;
__stdint(uint32_t) data;
- __stdint(uint32_t) addrhi;
- __stdint(uint32_t) datahi;
- __stdint(uint8_t) num_bytes; //1, 2, 4, 8
+ __stdint(uint32_t) _pad[2];
+ __stdint(uint8_t) num_bytes; //1, 2, 4
} poke_args;
struct {
__stdint(uint8_t) dev;
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 5a6c0983c..86fb512cc 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -251,16 +251,6 @@ void usrp2_impl::io_init(void){
//create new io impl
_io_impl = UHD_PIMPL_MAKE(io_impl, (send_frame_size, _data_transports.size()));
- //TODO temporary fix for weird power up state, remove when FPGA fixed
- {
- //send an initial packet to all transports
- tx_metadata_t md; md.end_of_burst = true;
- this->send(
- std::vector<const void *>(_data_transports.size(), NULL), 0, md,
- io_type_t::COMPLEX_FLOAT32, device::SEND_MODE_ONE_PACKET, 0
- );
- }
-
//create a new pirate thread for each zc if (yarr!!)
for (size_t i = 0; i < _data_transports.size(); i++){
//lock the unlocked mutex (non-blocking)
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 4dcc45fd3..9ca47cdc3 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -330,15 +330,21 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
val = _clock_config;
return;
- case MBOARD_PROP_TIME_NOW:{
- usrp2_iface::pair64 time64(
- _iface->peek64(_iface->regs.time64_secs_rb, _iface->regs.time64_ticks_rb)
- );
- val = time_spec_t(
- time64.first, time64.second, get_master_clock_freq()
- );
- }
+ case MBOARD_PROP_TIME_NOW: while(true){
+ uint32_t secs = _iface->peek32(_iface->regs.time64_secs_rb_imm);
+ uint32_t ticks = _iface->peek32(_iface->regs.time64_ticks_rb_imm);
+ if (secs != _iface->peek32(_iface->regs.time64_secs_rb_imm)) continue;
+ val = time_spec_t(secs, ticks, get_master_clock_freq());
return;
+ }
+
+ case MBOARD_PROP_TIME_PPS: while(true){
+ uint32_t secs = _iface->peek32(_iface->regs.time64_secs_rb_pps);
+ uint32_t ticks = _iface->peek32(_iface->regs.time64_ticks_rb_pps);
+ if (secs != _iface->peek32(_iface->regs.time64_secs_rb_pps)) continue;
+ val = time_spec_t(secs, ticks, get_master_clock_freq());
+ return;
+ }
case MBOARD_PROP_RX_SUBDEV_SPEC:
val = _rx_subdev_spec;
@@ -372,7 +378,7 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
set_time_spec(val.as<time_spec_t>(), true);
return;
- case MBOARD_PROP_TIME_NEXT_PPS:
+ case MBOARD_PROP_TIME_PPS:
set_time_spec(val.as<time_spec_t>(), false);
return;
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index ffbe8eedb..dcb25dc54 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -93,20 +93,6 @@ public:
return this->peek<boost::uint16_t>(addr);
}
- pair64 peek64(boost::uint32_t addrlo, boost::uint32_t addrhi){
- //setup the out data
- usrp2_ctrl_data_t out_data;
- out_data.id = htonl(USRP2_CTRL_ID_PEEK_AT_THIS_REGISTER_FOR_ME_BRO);
- out_data.data.poke_args.addr = htonl(addrlo);
- out_data.data.poke_args.addrhi = htonl(addrhi);
- out_data.data.poke_args.num_bytes = sizeof(boost::uint64_t);
-
- //send and recv
- usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data);
- UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_WOAH_I_DEFINITELY_PEEKED_IT_DUDE);
- return pair64(ntohl(in_data.data.poke_args.data), ntohl(in_data.data.poke_args.datahi));
- }
-
/***********************************************************************
* SPI
**********************************************************************/
diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp
index af3ed6c9f..2b4378ddf 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -37,7 +37,6 @@
class usrp2_iface : public uhd::i2c_iface, boost::noncopyable{
public:
typedef boost::shared_ptr<usrp2_iface> sptr;
- typedef std::pair<boost::uint32_t, boost::uint32_t> pair64;
/*!
* Make a new usrp2 interface with the control transport.
@@ -54,14 +53,6 @@ public:
virtual usrp2_ctrl_data_t ctrl_send_and_recv(const usrp2_ctrl_data_t &data) = 0;
/*!
- * Read a dual register (64 bits)
- * \param addrlo the address for the low-32 bits
- * \param addrhi the address for the high-32 bits
- * \return a pair of 32 bit integers lo, hi
- */
- virtual pair64 peek64(boost::uint32_t addrlo, boost::uint32_t addrhi) = 0;
-
- /*!
* Write a register (32 bits)
* \param addr the address
* \param data the 32bit data
diff --git a/host/lib/usrp/usrp2/usrp2_regs.cpp b/host/lib/usrp/usrp2/usrp2_regs.cpp
index 82ad30f08..13f475413 100644
--- a/host/lib/usrp/usrp2/usrp2_regs.cpp
+++ b/host/lib/usrp/usrp2/usrp2_regs.cpp
@@ -59,9 +59,11 @@ usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) {
x.time64_tps = sr_addr(misc_output_base, x.sr_time64 + 4);
x.time64_mimo_sync = sr_addr(misc_output_base, x.sr_time64 + 5);
x.status = bp_base + 4*8;
- x.time64_secs_rb = bp_base + 4*10;
- x.time64_ticks_rb = bp_base + 4*11;
+ x.time64_secs_rb_imm = bp_base + 4*10;
+ x.time64_ticks_rb_imm = bp_base + 4*11;
x.compat_num_rb = bp_base + 4*12;
+ x.time64_secs_rb_pps = bp_base + 4*14;
+ x.time64_ticks_rb_pps = bp_base + 4*15;
x.dsp_tx_freq = sr_addr(misc_output_base, x.sr_tx_dsp + 0);
x.dsp_tx_scale_iq = sr_addr(misc_output_base, x.sr_tx_dsp + 1);
x.dsp_tx_interp_rate = sr_addr(misc_output_base, x.sr_tx_dsp + 2);
diff --git a/host/lib/usrp/usrp2/usrp2_regs.hpp b/host/lib/usrp/usrp2/usrp2_regs.hpp
index 56e64029e..68b8796d2 100644
--- a/host/lib/usrp/usrp2/usrp2_regs.hpp
+++ b/host/lib/usrp/usrp2/usrp2_regs.hpp
@@ -59,8 +59,10 @@ typedef struct {
int time64_tps; // ticks per second rollover count
int time64_mimo_sync;
int status;
- int time64_secs_rb;
- int time64_ticks_rb;
+ int time64_secs_rb_imm;
+ int time64_ticks_rb_imm;
+ int time64_secs_rb_pps;
+ int time64_ticks_rb_pps;
int compat_num_rb;
int dsp_tx_freq;
int dsp_tx_scale_iq;
diff --git a/host/lib/usrp/usrp_e100/mboard_impl.cpp b/host/lib/usrp/usrp_e100/mboard_impl.cpp
index fe26cd63d..c056bf3ea 100644
--- a/host/lib/usrp/usrp_e100/mboard_impl.cpp
+++ b/host/lib/usrp/usrp_e100/mboard_impl.cpp
@@ -150,7 +150,7 @@ void usrp_e100_impl::mboard_set(const wax::obj &key, const wax::obj &val){
return;
case MBOARD_PROP_TIME_NOW:
- case MBOARD_PROP_TIME_NEXT_PPS:{
+ case MBOARD_PROP_TIME_PPS:{
time_spec_t time_spec = val.as<time_spec_t>();
_iface->poke32(UE_REG_TIME64_TICKS, time_spec.get_tick_count(_clock_ctrl->get_fpga_clock_rate()));
boost::uint32_t imm_flags = (key.as<mboard_prop_t>() == MBOARD_PROP_TIME_NOW)? 1 : 0;