summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-17 16:44:31 -0800
committerJosh Blum <josh@joshknows.com>2011-02-17 16:44:31 -0800
commit1628434a32321f8af6355f5eb828e8b06da52b90 (patch)
tree5f30009c16a86001d2d27c0532c1fc606fc20896 /host/lib/usrp
parent11bf23d994fab2a01a27541db959dcc6991b5dd0 (diff)
downloaduhd-1628434a32321f8af6355f5eb828e8b06da52b90.tar.gz
uhd-1628434a32321f8af6355f5eb828e8b06da52b90.tar.bz2
uhd-1628434a32321f8af6355f5eb828e8b06da52b90.zip
uhd: work on multiple dsp in host wrapper
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/multi_usrp.cpp74
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp9
2 files changed, 47 insertions, 36 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 4bdb2bf2e..9f001595d 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -85,17 +85,14 @@ public:
//----------- rx side of life ----------------------------------
for (size_t m = 0, chan = 0; m < get_num_mboards(); m++){
- buff += str(boost::format(
- " RX DSP %d: %s\n"
- ) % m
- % _rx_dsp(m)[DSP_PROP_NAME].as<std::string>()
- );
for (; chan < (m + 1)*get_rx_subdev_spec(m).size(); chan++){
buff += str(boost::format(
" RX Channel: %u\n"
+ " RX DSP: %s\n"
" RX Dboard: %s\n"
" RX Subdev: %s\n"
) % chan
+ % _rx_dsp(chan)[DSP_PROP_NAME].as<std::string>()
% _rx_dboard(chan)[DBOARD_PROP_NAME].as<std::string>()
% _rx_subdev(chan)[SUBDEV_PROP_NAME].as<std::string>()
);
@@ -104,17 +101,14 @@ public:
//----------- tx side of life ----------------------------------
for (size_t m = 0, chan = 0; m < get_num_mboards(); m++){
- buff += str(boost::format(
- " TX DSP %d: %s\n"
- ) % m
- % _tx_dsp(m)[DSP_PROP_NAME].as<std::string>()
- );
for (; chan < (m + 1)*get_tx_subdev_spec(m).size(); chan++){
buff += str(boost::format(
" TX Channel: %u\n"
+ " TX DSP: %s\n"
" TX Dboard: %s\n"
" TX Subdev: %s\n"
) % chan
+ % _tx_dsp(chan)[DSP_PROP_NAME].as<std::string>()
% _tx_dboard(chan)[DBOARD_PROP_NAME].as<std::string>()
% _tx_subdev(chan)[SUBDEV_PROP_NAME].as<std::string>()
);
@@ -194,9 +188,13 @@ public:
return true;
}
- void issue_stream_cmd(const stream_cmd_t &stream_cmd){
- for (size_t m = 0; m < get_num_mboards(); m++){
- _mboard(m)[MBOARD_PROP_STREAM_CMD] = stream_cmd;
+ void issue_stream_cmd(const stream_cmd_t &stream_cmd, size_t chan){
+ if (chan != ALL_CHANS){
+ _rx_dsp(chan)[DSP_PROP_STREAM_CMD] = stream_cmd;
+ return;
+ }
+ for (size_t c = 0; m < get_rx_num_channels(); m++){
+ issue_stream_cmd(stream_cmd, c);
}
}
@@ -240,28 +238,32 @@ public:
}
void set_rx_rate(double rate){
- for (size_t m = 0; m < get_num_mboards(); m++){
- _rx_dsp(m)[DSP_PROP_HOST_RATE] = rate;
+ if (chan != ALL_CHANS){
+ _rx_dsp(chan)[DSP_PROP_HOST_RATE] = rate;
+ do_samp_rate_warning_message(rate, get_rx_rate(chan), "RX");
+ return;
+ }
+ for (size_t c = 0; m < get_rx_num_channels(); m++){
+ set_rx_rate(rate, c);
}
- do_samp_rate_warning_message(rate, get_rx_rate(), "RX");
}
- double get_rx_rate(void){
- return _rx_dsp(0)[DSP_PROP_HOST_RATE].as<double>();
+ double get_rx_rate(size_t chan){
+ return _rx_dsp(chan)[DSP_PROP_HOST_RATE].as<double>();
}
tune_result_t set_rx_freq(const tune_request_t &tune_request, size_t chan){
- tune_result_t r = tune_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(chan/rx_cpm()), chan%rx_cpm(), tune_request);
+ tune_result_t r = tune_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(chan), chan%rx_cpm(), tune_request);
do_tune_freq_warning_message(tune_request.target_freq, get_rx_freq(chan), "RX");
return r;
}
double get_rx_freq(size_t chan){
- return derive_freq_from_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(chan/rx_cpm()), chan%rx_cpm());
+ return derive_freq_from_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(chan), chan%rx_cpm());
}
freq_range_t get_rx_freq_range(size_t chan){
- return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp(chan/rx_cpm()));
+ return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp(chan));
}
void set_rx_gain(double gain, const std::string &name, size_t chan){
@@ -338,28 +340,32 @@ public:
}
void set_tx_rate(double rate){
- for (size_t m = 0; m < get_num_mboards(); m++){
- _tx_dsp(m)[DSP_PROP_HOST_RATE] = rate;
+ if (chan != ALL_CHANS){
+ _tx_dsp(chan)[DSP_PROP_HOST_RATE] = rate;
+ do_samp_rate_warning_message(rate, get_tx_rate(chan), "TX");
+ return;
+ }
+ for (size_t c = 0; m < get_tx_num_channels(); m++){
+ set_tx_rate(rate, c);
}
- do_samp_rate_warning_message(rate, get_tx_rate(), "TX");
}
- double get_tx_rate(void){
- return _tx_dsp(0)[DSP_PROP_HOST_RATE].as<double>();
+ double get_tx_rate(size_t chan){
+ return _tx_dsp(chan)[DSP_PROP_HOST_RATE].as<double>();
}
tune_result_t set_tx_freq(const tune_request_t &tune_request, size_t chan){
- tune_result_t r = tune_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(chan/tx_cpm()), chan%tx_cpm(), tune_request);
+ tune_result_t r = tune_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(chan), chan%tx_cpm(), tune_request);
do_tune_freq_warning_message(tune_request.target_freq, get_tx_freq(chan), "TX");
return r;
}
double get_tx_freq(size_t chan){
- return derive_freq_from_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(chan/tx_cpm()), chan%tx_cpm());
+ return derive_freq_from_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(chan), chan%tx_cpm());
}
freq_range_t get_tx_freq_range(size_t chan){
- return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp(chan/tx_cpm()));
+ return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp(chan));
}
void set_tx_gain(double gain, const std::string &name, size_t chan){
@@ -433,11 +439,13 @@ private:
std::string mb_name = (*_dev)[DEVICE_PROP_MBOARD_NAMES].as<prop_names_t>().at(mboard);
return (*_dev)[named_prop_t(DEVICE_PROP_MBOARD, mb_name)];
}
- wax::obj _rx_dsp(size_t mboard){
- return _mboard(mboard)[MBOARD_PROP_RX_DSP];
+ 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())];
}
- wax::obj _tx_dsp(size_t mboard){
- return _mboard(mboard)[MBOARD_PROP_TX_DSP];
+ 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())];
}
wax::obj _rx_dboard(size_t chan){
std::string db_name = get_rx_subdev_spec(chan/rx_cpm()).at(chan%rx_cpm()).db_name;
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index d8ce9824d..5fbbfc0ee 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -399,10 +399,13 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
_rx_subdev_spec = val.as<subdev_spec_t>();
verify_rx_subdev_spec(_rx_subdev_spec, this->get_link());
//sanity check
- UHD_ASSERT_THROW(_rx_subdev_spec.size() == 1);
+ UHD_ASSERT_THROW(_rx_subdev_spec.size() <= 2);
//set the mux
- _iface->poke32(_iface->regs.dsp0_rx_mux, dsp_type1::calc_rx_mux_word(
- _dboard_manager->get_rx_subdev(_rx_subdev_spec.front().sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()
+ 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>()
));
return;