summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-10 11:27:42 -0800
committerJosh Blum <josh@joshknows.com>2010-11-10 11:27:42 -0800
commit123de6dad521ca3dbc44a5d9fc70ff754f1196e3 (patch)
tree53f03bfd7a33e85646c5c21ad685e48202789eb5 /host/lib/usrp
parent793519d66aa569f45bbda25ba7f36c1534a451bb (diff)
parent8c434f7d63aca25b55d6d13dffcc1d7037261d4f (diff)
downloaduhd-123de6dad521ca3dbc44a5d9fc70ff754f1196e3.tar.gz
uhd-123de6dad521ca3dbc44a5d9fc70ff754f1196e3.tar.bz2
uhd-123de6dad521ca3dbc44a5d9fc70ff754f1196e3.zip
Merge branch 'master' into usrp_e100_i2c
Conflicts: host/utils/CMakeLists.txt
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/mboard_eeprom.cpp60
-rw-r--r--host/lib/usrp/usrp1/mboard_impl.cpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp2
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp2
5 files changed, 36 insertions, 36 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp
index 076d0b279..661030aa7 100644
--- a/host/lib/usrp/mboard_eeprom.cpp
+++ b/host/lib/usrp/mboard_eeprom.cpp
@@ -57,11 +57,11 @@ static const byte_vector_t string_to_bytes(const std::string &string, size_t max
}
/***********************************************************************
- * Implementation of NXXX load/store
+ * Implementation of N100 load/store
**********************************************************************/
-static const boost::uint8_t NXXX_EEPROM_ADDR = 0x50;
+static const boost::uint8_t N100_EEPROM_ADDR = 0x50;
-static const uhd::dict<std::string, boost::uint8_t> USRP_NXXX_OFFSETS = boost::assign::map_list_of
+static const uhd::dict<std::string, boost::uint8_t> USRP_N100_OFFSETS = boost::assign::map_list_of
("rev-lsb-msb", 0x00)
("mac-addr", 0x02)
("ip-addr", 0x08)
@@ -70,36 +70,36 @@ static const uhd::dict<std::string, boost::uint8_t> USRP_NXXX_OFFSETS = boost::a
("name", 0x18 + SERIAL_LEN)
;
-static void load_nxxx(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
+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(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["rev-lsb-msb"], 2);
+ byte_vector_t rev_lsb_msb = iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["rev-lsb-msb"], 2);
boost::uint16_t rev = (boost::uint16_t(rev_lsb_msb.at(0)) << 0) | (boost::uint16_t(rev_lsb_msb.at(1)) << 8);
mb_eeprom["rev"] = boost::lexical_cast<std::string>(rev);
//extract the addresses
mb_eeprom["mac-addr"] = mac_addr_t::from_bytes(iface.read_eeprom(
- NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["mac-addr"], 6
+ N100_EEPROM_ADDR, USRP_N100_OFFSETS["mac-addr"], 6
)).to_string();
boost::asio::ip::address_v4::bytes_type ip_addr_bytes;
- std::copy(iface.read_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["ip-addr"], 4), ip_addr_bytes);
+ std::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();
//extract the serial
mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom(
- NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["serial"], SERIAL_LEN
+ N100_EEPROM_ADDR, USRP_N100_OFFSETS["serial"], SERIAL_LEN
));
//extract the name
mb_eeprom["name"] = bytes_to_string(iface.read_eeprom(
- NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["name"], NAME_MAX_LEN
+ N100_EEPROM_ADDR, USRP_N100_OFFSETS["name"], NAME_MAX_LEN
));
//empty serial correction: use the mac address
if (mb_eeprom["serial"].empty()) mb_eeprom["serial"] = mb_eeprom["mac-addr"];
}
-static void store_nxxx(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
+static void store_n100(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
//parse the revision number
if (mb_eeprom.has_key("rev")){
boost::uint16_t rev = boost::lexical_cast<boost::uint16_t>(mb_eeprom["rev"]);
@@ -107,67 +107,67 @@ static void store_nxxx(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
(boost::uint8_t(rev >> 0))
(boost::uint8_t(rev >> 8))
;
- iface.write_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["rev-lsb-msb"], rev_lsb_msb);
+ iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["rev-lsb-msb"], rev_lsb_msb);
}
//store the addresses
if (mb_eeprom.has_key("mac-addr")) iface.write_eeprom(
- NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["mac-addr"],
+ N100_EEPROM_ADDR, USRP_N100_OFFSETS["mac-addr"],
mac_addr_t::from_string(mb_eeprom["mac-addr"]).to_bytes()
);
if (mb_eeprom.has_key("ip-addr")){
byte_vector_t ip_addr_bytes(4);
std::copy(boost::asio::ip::address_v4::from_string(mb_eeprom["ip-addr"]).to_bytes(), ip_addr_bytes);
- iface.write_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["ip-addr"], ip_addr_bytes);
+ iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["ip-addr"], ip_addr_bytes);
}
//store the serial
if (mb_eeprom.has_key("serial")) iface.write_eeprom(
- NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["serial"],
+ N100_EEPROM_ADDR, USRP_N100_OFFSETS["serial"],
string_to_bytes(mb_eeprom["serial"], SERIAL_LEN)
);
//store the name
if (mb_eeprom.has_key("name")) iface.write_eeprom(
- NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["name"],
+ N100_EEPROM_ADDR, USRP_N100_OFFSETS["name"],
string_to_bytes(mb_eeprom["name"], NAME_MAX_LEN)
);
}
/***********************************************************************
- * Implementation of B1XX load/store
+ * Implementation of B000 load/store
**********************************************************************/
-static const boost::uint8_t B1XX_EEPROM_ADDR = 0x50;
-static const size_t B1XXX_SERIAL_LEN = 8;
+static const boost::uint8_t B000_EEPROM_ADDR = 0x50;
+static const size_t B000X_SERIAL_LEN = 8;
-static const uhd::dict<std::string, boost::uint8_t> USRP_B1XX_OFFSETS = boost::assign::map_list_of
+static const uhd::dict<std::string, boost::uint8_t> USRP_B000_OFFSETS = boost::assign::map_list_of
("serial", 0xf8)
("name", 0xf8 - NAME_MAX_LEN)
;
-static void load_b1xx(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
+static void load_b000(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
//extract the serial
mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom(
- B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["serial"], B1XXX_SERIAL_LEN
+ B000_EEPROM_ADDR, USRP_B000_OFFSETS["serial"], B000X_SERIAL_LEN
));
//extract the name
mb_eeprom["name"] = bytes_to_string(iface.read_eeprom(
- B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["name"], NAME_MAX_LEN
+ B000_EEPROM_ADDR, USRP_B000_OFFSETS["name"], NAME_MAX_LEN
));
}
-static void store_b1xx(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
+static void store_b000(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
//store the serial
if (mb_eeprom.has_key("serial")) iface.write_eeprom(
- B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["serial"],
- string_to_bytes(mb_eeprom["serial"], B1XXX_SERIAL_LEN)
+ B000_EEPROM_ADDR, USRP_B000_OFFSETS["serial"],
+ string_to_bytes(mb_eeprom["serial"], B000X_SERIAL_LEN)
);
//store the name
if (mb_eeprom.has_key("name")) iface.write_eeprom(
- B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["name"],
+ B000_EEPROM_ADDR, USRP_B000_OFFSETS["name"],
string_to_bytes(mb_eeprom["name"], NAME_MAX_LEN)
);
}
@@ -181,14 +181,14 @@ mboard_eeprom_t::mboard_eeprom_t(void){
mboard_eeprom_t::mboard_eeprom_t(i2c_iface &iface, map_type map){
switch(map){
- case MAP_NXXX: load_nxxx(*this, iface); break;
- case MAP_B1XX: load_b1xx(*this, iface); break;
+ case MAP_N100: load_n100(*this, iface); break;
+ case MAP_B000: load_b000(*this, iface); break;
}
}
void mboard_eeprom_t::commit(i2c_iface &iface, map_type map){
switch(map){
- case MAP_NXXX: store_nxxx(*this, iface); break;
- case MAP_B1XX: store_b1xx(*this, iface); break;
+ case MAP_N100: store_n100(*this, iface); break;
+ case MAP_B000: store_b000(*this, iface); break;
}
}
diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp
index c1f0f1d38..4df5ada0a 100644
--- a/host/lib/usrp/usrp1/mboard_impl.cpp
+++ b/host/lib/usrp/usrp1/mboard_impl.cpp
@@ -380,8 +380,8 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val)
case MBOARD_PROP_EEPROM_MAP:
// Step1: commit the map, writing only those values set.
// Step2: readback the entire eeprom map into the iface.
- val.as<mboard_eeprom_t>().commit(*_iface, mboard_eeprom_t::MAP_B1XX);
- _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_B1XX);
+ val.as<mboard_eeprom_t>().commit(*_iface, mboard_eeprom_t::MAP_B000);
+ _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_B000);
return;
default: UHD_THROW_PROP_SET_ERROR();
diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp
index 691c51fe8..63fcd5777 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.cpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.cpp
@@ -38,7 +38,7 @@ public:
usrp1_iface_impl(usrp_ctrl::sptr ctrl_transport)
{
_ctrl_transport = ctrl_transport;
- mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_B1XX);
+ mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_B000);
}
~usrp1_iface_impl(void)
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index df98ba275..a6ca7f2d3 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -316,8 +316,8 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
case MBOARD_PROP_EEPROM_MAP:
// Step1: commit the map, writing only those values set.
// Step2: readback the entire eeprom map into the iface.
- val.as<mboard_eeprom_t>().commit(*_iface, mboard_eeprom_t::MAP_NXXX);
- _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_NXXX);
+ val.as<mboard_eeprom_t>().commit(*_iface, mboard_eeprom_t::MAP_N100);
+ _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_N100);
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 eb2685efa..09f3432d6 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -60,7 +60,7 @@ public:
) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num));
}
- mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_NXXX);
+ mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_N100);
}
~usrp2_iface_impl(void){