aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/microblaze/lib/eth_addrs.c6
-rw-r--r--host/include/uhd/usrp/mboard_eeprom.hpp3
-rw-r--r--host/lib/usrp/mboard_eeprom.cpp4
-rw-r--r--host/lib/usrp/usrp2/clock_ctrl.cpp5
-rw-r--r--host/lib/usrp/usrp2/fw_common.h8
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp11
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp3
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp2
9 files changed, 28 insertions, 18 deletions
diff --git a/firmware/microblaze/lib/eth_addrs.c b/firmware/microblaze/lib/eth_addrs.c
index d7c1e0394..c6320e4fa 100644
--- a/firmware/microblaze/lib/eth_addrs.c
+++ b/firmware/microblaze/lib/eth_addrs.c
@@ -23,6 +23,12 @@
#include "i2c.h"
#include "usrp2/fw_common.h"
+////////////////////////////////////////////////////////////////////////
+// EEPROM Layout
+////////////////////////////////////////////////////////////////////////
+#define USRP2_EE_MBOARD_MAC_ADDR 0x02 //6 bytes
+#define USRP2_EE_MBOARD_IP_ADDR 0x0C //uint32, big-endian
+
static bool
unprogrammed(const void *t, size_t len)
{
diff --git a/host/include/uhd/usrp/mboard_eeprom.hpp b/host/include/uhd/usrp/mboard_eeprom.hpp
index 3bb05c0a8..bc3f1f8c9 100644
--- a/host/include/uhd/usrp/mboard_eeprom.hpp
+++ b/host/include/uhd/usrp/mboard_eeprom.hpp
@@ -40,6 +40,9 @@ namespace uhd{ namespace usrp{
MAP_BXXX
};
+ //! Make a new empty mboard eeprom
+ mboard_eeprom_t(void);
+
/*!
* Make a new mboard EEPROM handler.
* \param iface the interface to i2c
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp
index 78b4122bb..a19210206 100644
--- a/host/lib/usrp/mboard_eeprom.cpp
+++ b/host/lib/usrp/mboard_eeprom.cpp
@@ -168,6 +168,10 @@ static void store_bxxx(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
/***********************************************************************
* Implementation of mboard eeprom
**********************************************************************/
+mboard_eeprom_t::mboard_eeprom_t(void){
+ /* NOP */
+}
+
mboard_eeprom_t::mboard_eeprom_t(i2c_iface &iface, map_type map){
switch(map){
case MAP_NXXX: load_nxxx(*this, iface); break;
diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index 1e1c9b7b8..232f3b32a 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -20,6 +20,7 @@
#include "usrp2_regs.hpp" //spi slave constants
#include <uhd/utils/assert.hpp>
#include <boost/cstdint.hpp>
+#include <boost/lexical_cast.hpp>
#include <iostream>
using namespace uhd;
@@ -83,8 +84,8 @@ public:
}
void enable_mimo_clock_out(bool enb){
- //FIXME TODO put this revision read in a common place
- boost::uint8_t rev_hi = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, 1).at(0);
+ boost::uint16_t rev = boost::lexical_cast<boost::uint16_t>(_iface->mb_eeprom["rev"]);
+ boost::uint8_t rev_hi = boost::uint8_t(rev >> 8);
//calculate the low and high dividers
size_t divider = size_t(this->get_master_clock_rate()/10e6);
diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h
index 4c46bbb1d..4ff31ddfd 100644
--- a/host/lib/usrp/usrp2/fw_common.h
+++ b/host/lib/usrp/usrp2/fw_common.h
@@ -52,14 +52,6 @@ extern "C" {
#define USRP2_I2C_ADDR_TX_DB (USRP2_I2C_DEV_EEPROM | 0x4)
#define USRP2_I2C_ADDR_RX_DB (USRP2_I2C_DEV_EEPROM | 0x5)
-////////////////////////////////////////////////////////////////////////
-// EEPROM Layout
-////////////////////////////////////////////////////////////////////////
-//#define USRP2_EE_MBOARD_REV_LSB 0x00 //1 byte
-//#define USRP2_EE_MBOARD_REV_MSB 0x01 //1 byte
-#define USRP2_EE_MBOARD_MAC_ADDR 0x02 //6 bytes
-#define USRP2_EE_MBOARD_IP_ADDR 0x0C //uint32, big-endian
-
typedef enum{
USRP2_CTRL_ID_HUH_WHAT = ' ',
//USRP2_CTRL_ID_FOR_SURE, //TODO error condition enums
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index e49ac717e..079f096cb 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -38,8 +38,7 @@ usrp2_mboard_impl::usrp2_mboard_impl(
):
_index(index),
_recv_frame_size(recv_frame_size),
- _iface(usrp2_iface::make(ctrl_transport)),
- _mboard_eeprom(mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_NXXX))
+ _iface(usrp2_iface::make(ctrl_transport))
{
//contruct the interfaces to mboard perifs
_clock_ctrl = usrp2_clock_ctrl::make(_iface);
@@ -194,7 +193,7 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
//handle the get request conditioned on the key
switch(key.as<mboard_prop_t>()){
case MBOARD_PROP_NAME:
- val = str(boost::format("usrp2 mboard%d - rev %s") % _index % _mboard_eeprom["rev"]);
+ val = str(boost::format("usrp2 mboard%d - rev %s") % _index % _iface->mb_eeprom["rev"]);
return;
case MBOARD_PROP_OTHERS:
@@ -260,7 +259,7 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_EEPROM_MAP:
- val = _mboard_eeprom;
+ val = _iface->mb_eeprom;
return;
default: UHD_THROW_PROP_GET_ERROR();
@@ -315,8 +314,8 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
return;
case MBOARD_PROP_EEPROM_MAP:
- _mboard_eeprom = val.as<mboard_eeprom_t>();
- _mboard_eeprom.commit(*_iface, mboard_eeprom_t::MAP_NXXX);
+ _iface->mb_eeprom = val.as<mboard_eeprom_t>();
+ _iface->mb_eeprom.commit(*_iface, mboard_eeprom_t::MAP_NXXX);
return;
default: UHD_THROW_PROP_SET_ERROR();
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 2d450bfc6..eb2685efa 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -28,6 +28,7 @@
#include <algorithm>
using namespace uhd;
+using namespace uhd::usrp;
using namespace uhd::transport;
/*!
@@ -58,6 +59,8 @@ public:
"The fpga build is not compatible with the host code build."
) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num));
}
+
+ mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_NXXX);
}
~usrp2_iface_impl(void){
diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp
index 12fd4730a..bf36cbf6e 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -20,6 +20,7 @@
#include <uhd/transport/udp_simple.hpp>
#include <uhd/types/serial.hpp>
+#include <uhd/usrp/mboard_eeprom.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
@@ -102,6 +103,9 @@ public:
size_t num_bits,
bool readback
) = 0;
+
+ //motherboard eeprom map structure
+ uhd::usrp::mboard_eeprom_t mb_eeprom;
};
#endif /* INCLUDED_USRP2_IFACE_HPP */
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 0a56ec788..71f52878c 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -29,7 +29,6 @@
#include <uhd/types/stream_cmd.hpp>
#include <uhd/types/clock_config.hpp>
#include <uhd/usrp/dboard_eeprom.hpp>
-#include <uhd/usrp/mboard_eeprom.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <uhd/transport/vrt_if_packet.hpp>
@@ -110,7 +109,6 @@ private:
void get(const wax::obj &, wax::obj &);
void set(const wax::obj &, const wax::obj &);
uhd::usrp::subdev_spec_t _rx_subdev_spec, _tx_subdev_spec;
- uhd::usrp::mboard_eeprom_t _mboard_eeprom;
//rx and tx dboard methods and objects
uhd::usrp::dboard_manager::sptr _dboard_manager;