aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/lib/usrp/multi_usrp.cpp79
-rw-r--r--host/lib/usrp/usrp1/dsp_impl.cpp6
-rw-r--r--host/lib/usrp/usrp2/dsp_impl.cpp14
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp11
-rw-r--r--host/lib/usrp/usrp_e100/dsp_impl.cpp14
-rw-r--r--host/lib/usrp/usrp_e100/mboard_impl.cpp4
7 files changed, 69 insertions, 61 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 2e38a9ff8..23049d569 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -238,7 +238,11 @@ public:
}
size_t get_rx_num_channels(void){
- return rx_cpm()*get_num_mboards(); //total num channels
+ size_t sum = 0;
+ for (size_t m = 0; m < get_num_mboards(); m++){
+ sum += get_rx_subdev_spec(m).size();
+ }
+ return sum;
}
std::string get_rx_subdev_name(size_t chan){
@@ -344,7 +348,11 @@ public:
}
size_t get_tx_num_channels(void){
- return tx_cpm()*get_num_mboards(); //total num channels
+ size_t sum = 0;
+ for (size_t m = 0; m < get_num_mboards(); m++){
+ sum += get_tx_subdev_spec(m).size();
+ }
+ return sum;
}
void set_tx_rate(double rate, size_t chan){
@@ -427,24 +435,31 @@ public:
private:
device::sptr _dev;
- size_t rx_cpm(void){ //channels per mboard
- size_t nchan = get_rx_subdev_spec(0).size();
- for (size_t m = 1; m < get_num_mboards(); m++){
- if (nchan != get_rx_subdev_spec(m).size()){
- throw std::runtime_error("rx subdev spec size inconsistent across all mboards");
- }
+ struct mboard_chan_pair{
+ size_t mboard, chan;
+ mboard_chan_pair(void): mboard(0), chan(0){}
+ };
+
+ mboard_chan_pair rx_chan_to_mcp(size_t chan){
+ mboard_chan_pair mcp;
+ mcp.chan = chan;
+ for (mcp.mboard = 0; mcp.mboard < get_num_mboards(); mcp.mboard++){
+ size_t sss = get_rx_subdev_spec(mcp.mboard).size();
+ if (mcp.chan < sss) break;
+ mcp.chan -= sss;
}
- return nchan;
+ return mcp;
}
- size_t tx_cpm(void){ //channels per mboard
- size_t nchan = get_tx_subdev_spec(0).size();
- for (size_t m = 1; m < get_num_mboards(); m++){
- if (nchan != get_tx_subdev_spec(m).size()){
- throw std::runtime_error("tx subdev spec size inconsistent across all mboards");
- }
+ mboard_chan_pair tx_chan_to_mcp(size_t chan){
+ mboard_chan_pair mcp;
+ mcp.chan = chan;
+ for (mcp.mboard = 0; mcp.mboard < get_num_mboards(); mcp.mboard++){
+ size_t sss = get_tx_subdev_spec(mcp.mboard).size();
+ if (mcp.chan < sss) break;
+ mcp.chan -= sss;
}
- return nchan;
+ return mcp;
}
wax::obj _mboard(size_t mboard){
@@ -452,35 +467,43 @@ private:
return (*_dev)[named_prop_t(DEVICE_PROP_MBOARD, mb_name)];
}
wax::obj _rx_dsp(size_t chan){
- prop_names_t dsp_names = _mboard(chan/rx_cpm())[MBOARD_PROP_RX_DSP_NAMES].as<prop_names_t>();
- return _mboard(chan/rx_cpm())[named_prop_t(MBOARD_PROP_RX_DSP, dsp_names.at(chan%rx_cpm()))];
+ mboard_chan_pair mcp = rx_chan_to_mcp(chan);
+ prop_names_t dsp_names = _mboard(mcp.mboard)[MBOARD_PROP_RX_DSP_NAMES].as<prop_names_t>();
+ return _mboard(mcp.mboard)[named_prop_t(MBOARD_PROP_RX_DSP, dsp_names.at(mcp.chan))];
}
wax::obj _tx_dsp(size_t chan){
- prop_names_t dsp_names = _mboard(chan/tx_cpm())[MBOARD_PROP_TX_DSP_NAMES].as<prop_names_t>();
- return _mboard(chan/tx_cpm())[named_prop_t(MBOARD_PROP_TX_DSP, dsp_names.at(chan%tx_cpm()))];
+ mboard_chan_pair mcp = tx_chan_to_mcp(chan);
+ prop_names_t dsp_names = _mboard(mcp.mboard)[MBOARD_PROP_TX_DSP_NAMES].as<prop_names_t>();
+ return _mboard(mcp.mboard)[named_prop_t(MBOARD_PROP_TX_DSP, dsp_names.at(mcp.chan))];
}
wax::obj _rx_dboard(size_t chan){
- std::string db_name = get_rx_subdev_spec(chan/rx_cpm()).at(chan%rx_cpm()).db_name;
- return _mboard(chan/rx_cpm())[named_prop_t(MBOARD_PROP_RX_DBOARD, db_name)];
+ mboard_chan_pair mcp = rx_chan_to_mcp(chan);
+ std::string db_name = get_rx_subdev_spec(mcp.mboard).at(mcp.chan).db_name;
+ return _mboard(mcp.mboard)[named_prop_t(MBOARD_PROP_RX_DBOARD, db_name)];
}
wax::obj _tx_dboard(size_t chan){
- std::string db_name = get_tx_subdev_spec(chan/tx_cpm()).at(chan%tx_cpm()).db_name;
- return _mboard(chan/tx_cpm())[named_prop_t(MBOARD_PROP_TX_DBOARD, db_name)];
+ mboard_chan_pair mcp = tx_chan_to_mcp(chan);
+ std::string db_name = get_tx_subdev_spec(mcp.mboard).at(mcp.chan).db_name;
+ return _mboard(mcp.mboard)[named_prop_t(MBOARD_PROP_TX_DBOARD, db_name)];
}
wax::obj _rx_subdev(size_t chan){
- std::string sd_name = get_rx_subdev_spec(chan/rx_cpm()).at(chan%rx_cpm()).sd_name;
+ mboard_chan_pair mcp = rx_chan_to_mcp(chan);
+ std::string sd_name = get_rx_subdev_spec(mcp.mboard).at(mcp.chan).sd_name;
return _rx_dboard(chan)[named_prop_t(DBOARD_PROP_SUBDEV, sd_name)];
}
wax::obj _tx_subdev(size_t chan){
- std::string sd_name = get_tx_subdev_spec(chan/tx_cpm()).at(chan%tx_cpm()).sd_name;
+ mboard_chan_pair mcp = tx_chan_to_mcp(chan);
+ std::string sd_name = get_tx_subdev_spec(mcp.mboard).at(mcp.chan).sd_name;
return _tx_dboard(chan)[named_prop_t(DBOARD_PROP_SUBDEV, sd_name)];
}
gain_group::sptr _rx_gain_group(size_t chan){
- std::string sd_name = get_rx_subdev_spec(chan/rx_cpm()).at(chan%rx_cpm()).sd_name;
+ mboard_chan_pair mcp = rx_chan_to_mcp(chan);
+ std::string sd_name = get_rx_subdev_spec(mcp.mboard).at(mcp.chan).sd_name;
return _rx_dboard(chan)[named_prop_t(DBOARD_PROP_GAIN_GROUP, sd_name)].as<gain_group::sptr>();
}
gain_group::sptr _tx_gain_group(size_t chan){
- std::string sd_name = get_tx_subdev_spec(chan/tx_cpm()).at(chan%tx_cpm()).sd_name;
+ mboard_chan_pair mcp = tx_chan_to_mcp(chan);
+ std::string sd_name = get_tx_subdev_spec(mcp.mboard).at(mcp.chan).sd_name;
return _tx_dboard(chan)[named_prop_t(DBOARD_PROP_GAIN_GROUP, sd_name)].as<gain_group::sptr>();
}
};
diff --git a/host/lib/usrp/usrp1/dsp_impl.cpp b/host/lib/usrp/usrp1/dsp_impl.cpp
index 9d6aca874..8152c4e34 100644
--- a/host/lib/usrp/usrp1/dsp_impl.cpp
+++ b/host/lib/usrp/usrp1/dsp_impl.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ using namespace uhd::usrp;
void usrp1_impl::rx_dsp_init(void)
{
for (size_t i = 0; i < this->get_num_ddcs(); i++){
- _rx_dsp_proxies[str(boost::format("dsp%d")%i)] = wax_obj_proxy::make(
+ _rx_dsp_proxies[str(boost::format("DSP%d")%i)] = wax_obj_proxy::make(
boost::bind(&usrp1_impl::rx_dsp_get, this, _1, _2, i),
boost::bind(&usrp1_impl::rx_dsp_set, this, _1, _2, i)
);
@@ -133,7 +133,7 @@ void usrp1_impl::rx_dsp_set(const wax::obj &key_, const wax::obj &val, size_t wh
void usrp1_impl::tx_dsp_init(void)
{
for (size_t i = 0; i < this->get_num_ducs(); i++){
- _tx_dsp_proxies[str(boost::format("dsp%d")%i)] = wax_obj_proxy::make(
+ _tx_dsp_proxies[str(boost::format("DSP%d")%i)] = wax_obj_proxy::make(
boost::bind(&usrp1_impl::tx_dsp_get, this, _1, _2, i),
boost::bind(&usrp1_impl::tx_dsp_set, this, _1, _2, i)
);
diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp
index 5cf48fe96..ec3e6082c 100644
--- a/host/lib/usrp/usrp2/dsp_impl.cpp
+++ b/host/lib/usrp/usrp2/dsp_impl.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -75,10 +75,6 @@ void usrp2_mboard_impl::ddc_get(const wax::obj &key_, wax::obj &val){
val = _ddc_freq;
return;
- case DSP_PROP_FREQ_SHIFT_NAMES:
- val = prop_names_t(1, "");
- return;
-
case DSP_PROP_CODEC_RATE:
val = get_master_clock_freq();
return;
@@ -96,6 +92,10 @@ void usrp2_mboard_impl::ddc_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<dsp_prop_t>()){
+ case DSP_PROP_STREAM_CMD:
+ issue_ddc_stream_cmd(val.as<stream_cmd_t>());
+ return;
+
case DSP_PROP_FREQ_SHIFT:{
double new_freq = val.as<double>();
_iface->poke32(_iface->regs.dsp0_rx_freq,
@@ -158,10 +158,6 @@ void usrp2_mboard_impl::duc_get(const wax::obj &key_, wax::obj &val){
val = _duc_freq;
return;
- case DSP_PROP_FREQ_SHIFT_NAMES:
- val = prop_names_t(1, "");
- return;
-
case DSP_PROP_CODEC_RATE:
val = get_master_clock_freq();
return;
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index b20b6652e..acd520b0b 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -265,7 +265,7 @@ void usrp2_impl::io_init(void){
_io_impl = UHD_PIMPL_MAKE(io_impl, (send_frame_size, _data_transports));
//create a new pirate thread for each zc if (yarr!!)
- for (size_t i = 0; i < _data_transports.size(); i++){
+ for (size_t i = 0; i < _err0_transports.size(); i++){
//lock the unlocked mutex (non-blocking)
_io_impl->spawn_mutex.lock();
//spawn a new pirate to plunder the recv booty
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 5fbbfc0ee..5f3537f1e 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -391,10 +391,6 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
set_time_spec(val.as<time_spec_t>(), false);
return;
- case MBOARD_PROP_STREAM_CMD:
- issue_ddc_stream_cmd(val.as<stream_cmd_t>());
- return;
-
case MBOARD_PROP_RX_SUBDEV_SPEC:
_rx_subdev_spec = val.as<subdev_spec_t>();
verify_rx_subdev_spec(_rx_subdev_spec, this->get_link());
@@ -404,9 +400,10 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
if (_rx_subdev_spec.size() >= 1) _iface->poke32(_iface->regs.dsp0_rx_mux, dsp_type1::calc_rx_mux_word(
_dboard_manager->get_rx_subdev(_rx_subdev_spec[0].sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()
));
- if (_rx_subdev_spec.size() >= 2)_iface->poke32(_iface->regs.dsp1_rx_mux, dsp_type1::calc_rx_mux_word(
- _dboard_manager->get_rx_subdev(_rx_subdev_spec[1].sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()
- ));
+ //TODO
+ //if (_rx_subdev_spec.size() >= 2) _iface->poke32(_iface->regs.dsp1_rx_mux, dsp_type1::calc_rx_mux_word(
+ // _dboard_manager->get_rx_subdev(_rx_subdev_spec[1].sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()
+ //));
return;
case MBOARD_PROP_TX_SUBDEV_SPEC:
diff --git a/host/lib/usrp/usrp_e100/dsp_impl.cpp b/host/lib/usrp/usrp_e100/dsp_impl.cpp
index 7d358a607..8d084f066 100644
--- a/host/lib/usrp/usrp_e100/dsp_impl.cpp
+++ b/host/lib/usrp/usrp_e100/dsp_impl.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -60,10 +60,6 @@ void usrp_e100_impl::rx_ddc_get(const wax::obj &key_, wax::obj &val){
val = _ddc_freq;
return;
- case DSP_PROP_FREQ_SHIFT_NAMES:
- val = prop_names_t(1, "");
- return;
-
case DSP_PROP_CODEC_RATE:
val = _clock_ctrl->get_fpga_clock_rate();
return;
@@ -84,6 +80,10 @@ void usrp_e100_impl::rx_ddc_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<dsp_prop_t>()){
+ case DSP_PROP_STREAM_CMD:
+ issue_stream_cmd(val.as<stream_cmd_t>());
+ return;
+
case DSP_PROP_FREQ_SHIFT:{
double new_freq = val.as<double>();
_iface->poke32(UE_REG_DSP_RX_FREQ,
@@ -143,10 +143,6 @@ void usrp_e100_impl::tx_duc_get(const wax::obj &key_, wax::obj &val){
val = _duc_freq;
return;
- case DSP_PROP_FREQ_SHIFT_NAMES:
- val = prop_names_t(1, "");
- return;
-
case DSP_PROP_CODEC_RATE:
val = _clock_ctrl->get_fpga_clock_rate();
return;
diff --git a/host/lib/usrp/usrp_e100/mboard_impl.cpp b/host/lib/usrp/usrp_e100/mboard_impl.cpp
index 0e08cd435..a4db53715 100644
--- a/host/lib/usrp/usrp_e100/mboard_impl.cpp
+++ b/host/lib/usrp/usrp_e100/mboard_impl.cpp
@@ -167,10 +167,6 @@ void usrp_e100_impl::mboard_set(const wax::obj &key, const wax::obj &val){
//handle the get request conditioned on the key
switch(key.as<mboard_prop_t>()){
- case MBOARD_PROP_STREAM_CMD:
- issue_stream_cmd(val.as<stream_cmd_t>());
- return;
-
case MBOARD_PROP_TIME_NOW:
case MBOARD_PROP_TIME_PPS:{
time_spec_t time_spec = val.as<time_spec_t>();