diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-03-08 09:28:55 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:44 -0800 |
commit | 1a4348038d0eb57d53475074dca49e8192aeb2d7 (patch) | |
tree | 04c8e87fa9c95d2702aac410f6fb271461acb9bb /mpm/mpm_test_main.cpp | |
parent | fc8cd827f6b16b9c8c354a216889e6a9d7f37456 (diff) | |
download | uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.gz uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.bz2 uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.zip |
Initial commit for N3xx development.
- Creates mpm/ subdirectory
- First pass at hardware daemon/MPM
- New code for LMK04828, AD9371
- spidev integration
Contributions by:
Martin Braun <martin.braun@ettus.com>
Derek Kozel <derek.kozel@ettus.com>
Mark Meserve <mark.meserve@ni.com>
Andrej Rode <andrej.rode@ettus.com>
Diffstat (limited to 'mpm/mpm_test_main.cpp')
-rw-r--r-- | mpm/mpm_test_main.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mpm/mpm_test_main.cpp b/mpm/mpm_test_main.cpp new file mode 100644 index 000000000..175f0f94c --- /dev/null +++ b/mpm/mpm_test_main.cpp @@ -0,0 +1,52 @@ +#include "spi_lock.h" +#include "ad937x_ctrl.hpp" +#include <iostream> +#include <sstream> + +std::string tune_req(ad937x_ctrl *device, ad937x_ctrl::direction_t direction, double freq) +{ + std::ostringstream ss; + ss << "Requesting freq " << freq << std::endl; + double c_freq = device->tune(direction, freq); + ss << "Got freq " << c_freq << std::endl; + return ss.str(); +} + +std::string gain_req(ad937x_ctrl *device, ad937x_ctrl::direction_t direction, double gain) +{ + std::ostringstream ss; + ss << "Requesting gain " << gain << std::endl; + double c_gain = device->set_gain(direction, ad937x_ctrl::CHAIN_1, gain); + ss << "Got gain " << c_gain << std::endl; + return ss.str(); +} + +void main() +{ + std::cout << "N310 Hardware Daemon Test Main" << std::endl; + auto spiMon = spi_lock::make(0); + + spi_hwd_settings_t hwd_settings1 = { 0, 0 }; + spi_hwd_settings_t hwd_settings2 = { 0, 1 }; + ad937x_ctrl myk1(spiMon, hwd_settings1), myk2(spiMon, hwd_settings2); + + myk1.set_clock_rate(122800); + myk2.set_clock_rate(555); + myk1.set_active_chains(ad937x_ctrl::TX, true, true); + myk1.set_active_chains(ad937x_ctrl::RX, true, false); + myk2.set_active_chains(ad937x_ctrl::TX, false, true); + myk2.set_active_chains(ad937x_ctrl::RX, false, false); + + std::cout << gain_req(&myk1, ad937x_ctrl::TX, 0); + std::cout << gain_req(&myk1, ad937x_ctrl::TX, -5); + std::cout << gain_req(&myk1, ad937x_ctrl::TX, 77); + std::cout << gain_req(&myk1, ad937x_ctrl::RX, 0); + std::cout << gain_req(&myk1, ad937x_ctrl::RX, -5); + std::cout << gain_req(&myk1, ad937x_ctrl::RX, 77); + + std::cout << tune_req(&myk1, ad937x_ctrl::TX, 5.6e9); + std::cout << tune_req(&myk1, ad937x_ctrl::TX, 500e6); + std::cout << tune_req(&myk1, ad937x_ctrl::TX, 7e9); + std::cout << tune_req(&myk1, ad937x_ctrl::TX, 150e6); +} + |