aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-07-25 10:41:25 -0700
committerMartin Braun <martin.braun@ettus.com>2019-08-02 11:03:11 -0700
commit173531521970ed823b2f300180b8cacda94ec841 (patch)
treedf23a21876e4430ae2b232499af5626189b819a3 /host/lib/usrp/x300/x300_mb_eeprom_iface.cpp
parente2ce13e35d915c2d8b1300fd88745610c17638d1 (diff)
downloaduhd-173531521970ed823b2f300180b8cacda94ec841.tar.gz
uhd-173531521970ed823b2f300180b8cacda94ec841.tar.bz2
uhd-173531521970ed823b2f300180b8cacda94ec841.zip
x300: Refactor heavily
This pulls out a lot of code from x300_impl and puts it into its own compilation units: - EEPROM code goes to x300_mb_eeprom.* - Claim code goes to x300_claim.* - PCIe code goes to uhd::usrp::x300::pcie_manager - Ethernet code goes to uhd::usrp::x300::eth_manager
Diffstat (limited to 'host/lib/usrp/x300/x300_mb_eeprom_iface.cpp')
-rw-r--r--host/lib/usrp/x300/x300_mb_eeprom_iface.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp b/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp
index 12022ec24..a54caa560 100644
--- a/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp
+++ b/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp
@@ -18,6 +18,7 @@
*/
#include "x300_mb_eeprom_iface.hpp"
+#include "x300_claim.hpp"
#include "x300_fw_common.h"
#include "x300_impl.hpp"
#include "x300_regs.hpp"
@@ -52,7 +53,7 @@ public:
void write_i2c(uint16_t addr, const byte_vector_t& buf)
{
UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR);
- if (x300_impl::claim_status(_wb) != x300_impl::CLAIMED_BY_US) {
+ if (uhd::usrp::x300::claim_status(_wb) != uhd::usrp::x300::CLAIMED_BY_US) {
throw uhd::io_error("Attempted to write MB EEPROM without claim to device.");
}
_i2c->write_i2c(addr, buf);
@@ -71,13 +72,14 @@ public:
if (_compat_num > X300_FW_SHMEM_IDENT_MIN_VERSION) {
bytes = read_eeprom(addr, 0, num_bytes);
} else {
- x300_impl::claim_status_t status = x300_impl::claim_status(_wb);
+ auto status = uhd::usrp::x300::claim_status(_wb);
// Claim device before driving the I2C bus
- if (status == x300_impl::CLAIMED_BY_US or x300_impl::try_to_claim(_wb)) {
+ if (status == uhd::usrp::x300::CLAIMED_BY_US
+ or uhd::usrp::x300::try_to_claim(_wb)) {
bytes = _i2c->read_i2c(addr, num_bytes);
- if (status != x300_impl::CLAIMED_BY_US) {
+ if (status != uhd::usrp::x300::CLAIMED_BY_US) {
// We didn't originally have the claim, so give it up
- x300_impl::release(_wb);
+ uhd::usrp::x300::release(_wb);
}
}
}
@@ -93,7 +95,7 @@ public:
void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& buf)
{
UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR);
- if (x300_impl::claim_status(_wb) != x300_impl::CLAIMED_BY_US) {
+ if (uhd::usrp::x300::claim_status(_wb) != uhd::usrp::x300::CLAIMED_BY_US) {
throw uhd::io_error("Attempted to write MB EEPROM without claim to device.");
}
_i2c->write_eeprom(addr, offset, buf);
@@ -110,7 +112,7 @@ public:
{
UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR);
byte_vector_t bytes;
- x300_impl::claim_status_t status = x300_impl::claim_status(_wb);
+ uhd::usrp::x300::claim_status_t status = uhd::usrp::x300::claim_status(_wb);
if (_compat_num >= X300_FW_SHMEM_IDENT_MIN_VERSION) {
// Get MB EEPROM data from firmware memory
if (num_bytes == 0)
@@ -128,11 +130,12 @@ public:
}
} else {
// Claim device before driving the I2C bus
- if (status == x300_impl::CLAIMED_BY_US or x300_impl::try_to_claim(_wb)) {
+ if (status == uhd::usrp::x300::CLAIMED_BY_US
+ or uhd::usrp::x300::try_to_claim(_wb)) {
bytes = _i2c->read_eeprom(addr, offset, num_bytes);
- if (status != x300_impl::CLAIMED_BY_US) {
+ if (status != uhd::usrp::x300::CLAIMED_BY_US) {
// We didn't originally have the claim, so give it up
- x300_impl::release(_wb);
+ uhd::usrp::x300::release(_wb);
}
}
}