aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/lib/mykonos/ad937x_device.cpp
diff options
context:
space:
mode:
authorMark Meserve <mark.meserve@ni.com>2017-05-02 17:09:03 -0500
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:52 -0800
commit24d3011233ba1cd0b8788eccfacd0b67cb776600 (patch)
treecfd2af3212182e76a84b1fcb325b26ebd266bdb6 /mpm/lib/mykonos/ad937x_device.cpp
parent8f9f29dabc1a0f9db1101f658d9bcbac526eca39 (diff)
downloaduhd-24d3011233ba1cd0b8788eccfacd0b67cb776600.tar.gz
uhd-24d3011233ba1cd0b8788eccfacd0b67cb776600.tar.bz2
uhd-24d3011233ba1cd0b8788eccfacd0b67cb776600.zip
mg: bring up links
Diffstat (limited to 'mpm/lib/mykonos/ad937x_device.cpp')
-rw-r--r--mpm/lib/mykonos/ad937x_device.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/mpm/lib/mykonos/ad937x_device.cpp b/mpm/lib/mykonos/ad937x_device.cpp
index 68065e67d..0e0851f41 100644
--- a/mpm/lib/mykonos/ad937x_device.cpp
+++ b/mpm/lib/mykonos/ad937x_device.cpp
@@ -24,6 +24,7 @@
#include <functional>
#include <iostream>
+#include <thread>
using namespace mpm::ad937x::device;
using namespace mpm::ad937x::gpio;
@@ -42,13 +43,14 @@ static const double RX_DEFAULT_FREQ = 1e9;
static const double TX_DEFAULT_FREQ = 1e9;
// TODO: get the actual device ID
-static const uint32_t AD9371_PRODUCT_ID = 0x1F;
+static const uint32_t AD9371_PRODUCT_ID = 0x1;
// TODO: move this to whereever we declare the ARM binary
static const size_t ARM_BINARY_SIZE = 98304;
static const uint32_t INIT_CAL_TIMEOUT_MS = 10000;
+// TODO: actually figure out what cals we want to run
static const uint32_t INIT_CALS =
TX_BB_FILTER |
ADC_TUNER |
@@ -96,9 +98,7 @@ void ad937x_device::_call_api_function(std::function<mykonosErr_t()> func)
auto error = func();
if (error != MYKONOS_ERR_OK)
{
- std::cout << getMykonosErrorMessage(error);
- // TODO: make UHD exception
- //throw std::exception(getMykonosErrorMessage(error));
+ throw mpm::runtime_error(getMykonosErrorMessage(error));
}
}
@@ -108,9 +108,7 @@ void ad937x_device::_call_gpio_api_function(std::function<mykonosGpioErr_t()> fu
auto error = func();
if (error != MYKONOS_ERR_GPIO_OK)
{
- std::cout << getGpioMykonosErrorMessage(error);
- // TODO: make UHD exception
- //throw std::exception(getMykonosErrorMessage(error));
+ throw mpm::runtime_error(getGpioMykonosErrorMessage(error));
}
}
@@ -217,13 +215,15 @@ void ad937x_device::begin_initialization()
void ad937x_device::finish_initialization()
{
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
// to check status, just call the same function with a 0 instead of a 1, seems good
uint8_t mcs_status = 0;
_call_api_function(std::bind(MYKONOS_enableMultichipSync, mykonos_config.device, 0, &mcs_status));
if ((mcs_status & 0x0A) != 0x0A)
{
- throw mpm::runtime_error("Multichip sync failed!");
+ throw mpm::runtime_error(str(boost::format("Multichip sync failed! Read: %X Expected: %X")
+ % int(mcs_status) % int(0x0A)));
}
_call_api_function(std::bind(MYKONOS_initSubRegisterTables, mykonos_config.device));