aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mboard_eeprom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/mboard_eeprom.cpp')
-rw-r--r--host/lib/usrp/mboard_eeprom.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp
index c90f4a2db..869a38478 100644
--- a/host/lib/usrp/mboard_eeprom.cpp
+++ b/host/lib/usrp/mboard_eeprom.cpp
@@ -74,10 +74,17 @@ static const uhd::dict<std::string, boost::uint8_t> USRP_N100_OFFSETS = boost::a
("mac-addr", 0x02)
("ip-addr", 0x0C)
//leave space here for other addresses (perhaps)
+ ("gpsdo", 0x17)
("serial", 0x18)
("name", 0x18 + SERIAL_LEN)
;
+enum n200_gpsdo_type{
+ N200_GPSDO_NONE = 0,
+ N200_GPSDO_INTERNAL = 1,
+ N200_GPSDO_ONBOARD = 2
+};
+
static void load_n100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
//extract the revision number
byte_vector_t rev_lsb_msb = iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["rev-lsb-msb"], 2);
@@ -93,6 +100,14 @@ static void load_n100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
byte_copy(iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["ip-addr"], 4), ip_addr_bytes);
mb_eeprom["ip-addr"] = boost::asio::ip::address_v4(ip_addr_bytes).to_string();
+ //gpsdo capabilities
+ boost::uint8_t gpsdo_byte = iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["gpsdo"], 1).at(0);
+ switch(n200_gpsdo_type(gpsdo_byte)){
+ case N200_GPSDO_INTERNAL: mb_eeprom["gpsdo"] = "internal"; break;
+ case N200_GPSDO_ONBOARD: mb_eeprom["gpsdo"] = "onboard"; break;
+ default: mb_eeprom["gpsdo"] = "none";
+ }
+
//extract the serial
mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom(
N100_EEPROM_ADDR, USRP_N100_OFFSETS["serial"], SERIAL_LEN
@@ -136,6 +151,14 @@ static void store_n100(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["ip-addr"], ip_addr_bytes);
}
+ //gpsdo capabilities
+ if (mb_eeprom.has_key("gpsdo")){
+ boost::uint8_t gpsdo_byte = N200_GPSDO_NONE;
+ if (mb_eeprom["gpsdo"] == "internal") gpsdo_byte = N200_GPSDO_INTERNAL;
+ if (mb_eeprom["gpsdo"] == "onboard") gpsdo_byte = N200_GPSDO_ONBOARD;
+ iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["gpsdo"], byte_vector_t(1, gpsdo_byte));
+ }
+
//store the serial
if (mb_eeprom.has_key("serial")) iface.write_eeprom(
N100_EEPROM_ADDR, USRP_N100_OFFSETS["serial"],