aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mboard_eeprom.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-04-29 11:02:08 -0700
committerJosh Blum <josh@joshknows.com>2011-04-29 11:02:08 -0700
commit6bd7281f83d5311675847b31746525841657c057 (patch)
tree14ac0cdec8e04089205c468544e0878001c354aa /host/lib/usrp/mboard_eeprom.cpp
parent4d73aae4638e5c08b2f55ea229414319befec68e (diff)
downloaduhd-6bd7281f83d5311675847b31746525841657c057.tar.gz
uhd-6bd7281f83d5311675847b31746525841657c057.tar.bz2
uhd-6bd7281f83d5311675847b31746525841657c057.zip
usrp2: added support for GPSDO configuration bits in EEPROM
Added instructions to install and burn eeprom to documentation. Made gps_ctrl and gps_time sensor optional. Added sensors for motherboard to documentation
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"],