aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-10-11 18:09:45 -0700
committerJosh Blum <josh@joshknows.com>2011-10-12 10:16:48 -0700
commit1a695f94849644773deda18f84a07ef1a206481b (patch)
tree5fa3699ec69792bf01251fac3ef670a771bed915
parent08b23bf3c6fcd0aaa84be74b4890687491e561bb (diff)
downloaduhd-1a695f94849644773deda18f84a07ef1a206481b.tar.gz
uhd-1a695f94849644773deda18f84a07ef1a206481b.tar.bz2
uhd-1a695f94849644773deda18f84a07ef1a206481b.zip
b100: new eeprom map for special 9 byte serial
-rw-r--r--firmware/fx2/b100/usb_descriptors.a513
-rw-r--r--firmware/fx2/b100/usrp_main.c6
-rw-r--r--host/include/uhd/usrp/mboard_eeprom.hpp1
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp6
-rw-r--r--host/lib/usrp/mboard_eeprom.cpp91
5 files changed, 75 insertions, 32 deletions
diff --git a/firmware/fx2/b100/usb_descriptors.a51 b/firmware/fx2/b100/usb_descriptors.a51
index 169aea4fd..5365de840 100644
--- a/firmware/fx2/b100/usb_descriptors.a51
+++ b/firmware/fx2/b100/usb_descriptors.a51
@@ -452,7 +452,8 @@ _usb_desc_serial_number_ascii::
.db '1, 0
.db '5, 0
.db '9, 0
- .db '3, 0
+ .db '2, 0
+ .db '7, 0
str6_end:
SI_FPGA_COMMAND_OUT_PATH = 7
diff --git a/firmware/fx2/b100/usrp_main.c b/firmware/fx2/b100/usrp_main.c
index 7558fadb8..391a6d94f 100644
--- a/firmware/fx2/b100/usrp_main.c
+++ b/firmware/fx2/b100/usrp_main.c
@@ -37,8 +37,8 @@
* offsets into boot eeprom for configuration values
*/
#define HW_REV_OFFSET 5
-#define SERIAL_NO_OFFSET 248
-#define SERIAL_NO_LEN 8
+#define SERIAL_NO_OFFSET 247
+#define SERIAL_NO_LEN 9
#define bRequestType SETUPDAT[0]
@@ -342,7 +342,7 @@ void
patch_usb_descriptors(void)
{
static xdata unsigned char hw_rev;
- static xdata unsigned char serial_no[8];
+ static xdata unsigned char serial_no[SERIAL_NO_LEN];
unsigned char i;
eeprom_read(I2C_ADDR_BOOT, HW_REV_OFFSET, &hw_rev, 1); // LSB of device id
diff --git a/host/include/uhd/usrp/mboard_eeprom.hpp b/host/include/uhd/usrp/mboard_eeprom.hpp
index ea66bb2e0..c47f894be 100644
--- a/host/include/uhd/usrp/mboard_eeprom.hpp
+++ b/host/include/uhd/usrp/mboard_eeprom.hpp
@@ -38,6 +38,7 @@ namespace uhd{ namespace usrp{
enum map_type{
MAP_N100,
MAP_B000,
+ MAP_B100,
MAP_E100
};
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 591a8b49f..7d5876449 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -110,7 +110,7 @@ static device_addrs_t b100_find(const device_addr_t &hint)
try{
usb_control::sptr control = usb_control::make(handle, 0);
fx2_ctrl::sptr fx2_ctrl = fx2_ctrl::make(control);
- const mboard_eeprom_t mb_eeprom = mboard_eeprom_t(*fx2_ctrl, mboard_eeprom_t::MAP_B000);
+ const mboard_eeprom_t mb_eeprom = mboard_eeprom_t(*fx2_ctrl, mboard_eeprom_t::MAP_B100);
new_addr["name"] = mb_eeprom["name"];
}
catch(const uhd::exception &){
@@ -243,7 +243,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
////////////////////////////////////////////////////////////////////
// setup the mboard eeprom
////////////////////////////////////////////////////////////////////
- const mboard_eeprom_t mb_eeprom(*_fx2_ctrl, mboard_eeprom_t::MAP_B000);
+ const mboard_eeprom_t mb_eeprom(*_fx2_ctrl, mboard_eeprom_t::MAP_B100);
_tree->create<mboard_eeprom_t>(mb_path / "eeprom")
.set(mb_eeprom)
.subscribe(boost::bind(&b100_impl::set_mb_eeprom, this, _1));
@@ -463,7 +463,7 @@ double b100_impl::update_rx_codec_gain(const double gain){
}
void b100_impl::set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &mb_eeprom){
- mb_eeprom.commit(*_fx2_ctrl, mboard_eeprom_t::MAP_B000);
+ mb_eeprom.commit(*_fx2_ctrl, mboard_eeprom_t::MAP_B100);
}
void b100_impl::set_db_eeprom(const std::string &type, const uhd::usrp::dboard_eeprom_t &db_eeprom){
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp
index 467b4289d..785d30296 100644
--- a/host/lib/usrp/mboard_eeprom.cpp
+++ b/host/lib/usrp/mboard_eeprom.cpp
@@ -215,25 +215,13 @@ static const size_t B000_SERIAL_LEN = 8;
//use char array so we dont need to attribute packed
struct b000_eeprom_map{
- unsigned char _r[217];
- unsigned char revision[2];
- unsigned char product[2];
+ unsigned char _r[221];
unsigned char mcr[4];
unsigned char name[NAME_MAX_LEN];
unsigned char serial[B000_SERIAL_LEN];
};
static void load_b000(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
- //extract the revision number
- mb_eeprom["revision"] = uint16_bytes_to_string(
- iface.read_eeprom(B000_EEPROM_ADDR, offsetof(b000_eeprom_map, revision), 2)
- );
-
- //extract the product code
- mb_eeprom["product"] = uint16_bytes_to_string(
- iface.read_eeprom(B000_EEPROM_ADDR, offsetof(b000_eeprom_map, product), 2)
- );
-
//extract the serial
mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom(
B000_EEPROM_ADDR, offsetof(b000_eeprom_map, serial), B000_SERIAL_LEN
@@ -261,18 +249,6 @@ static void load_b000(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
}
static void store_b000(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
- //parse the revision number
- if (mb_eeprom.has_key("revision")) iface.write_eeprom(
- B000_EEPROM_ADDR, offsetof(b000_eeprom_map, revision),
- string_to_uint16_bytes(mb_eeprom["revision"])
- );
-
- //parse the product code
- if (mb_eeprom.has_key("product")) iface.write_eeprom(
- B000_EEPROM_ADDR, offsetof(b000_eeprom_map, product),
- string_to_uint16_bytes(mb_eeprom["product"])
- );
-
//store the serial
if (mb_eeprom.has_key("serial")) iface.write_eeprom(
B000_EEPROM_ADDR, offsetof(b000_eeprom_map, serial),
@@ -298,6 +274,69 @@ static void store_b000(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
);
}
}
+
+/***********************************************************************
+ * Implementation of B100 load/store
+ **********************************************************************/
+static const boost::uint8_t B100_EEPROM_ADDR = 0x50;
+
+//use char array so we dont need to attribute packed
+struct b100_eeprom_map{
+ unsigned char _r[220];
+ unsigned char revision[2];
+ unsigned char product[2];
+ unsigned char name[NAME_MAX_LEN];
+ unsigned char serial[SERIAL_LEN];
+};
+
+static void load_b100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
+ //extract the revision number
+ mb_eeprom["revision"] = uint16_bytes_to_string(
+ iface.read_eeprom(B100_EEPROM_ADDR, offsetof(b100_eeprom_map, revision), 2)
+ );
+
+ //extract the product code
+ mb_eeprom["product"] = uint16_bytes_to_string(
+ iface.read_eeprom(B100_EEPROM_ADDR, offsetof(b100_eeprom_map, product), 2)
+ );
+
+ //extract the serial
+ mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom(
+ B100_EEPROM_ADDR, offsetof(b100_eeprom_map, serial), SERIAL_LEN
+ ));
+
+ //extract the name
+ mb_eeprom["name"] = bytes_to_string(iface.read_eeprom(
+ B100_EEPROM_ADDR, offsetof(b100_eeprom_map, name), NAME_MAX_LEN
+ ));
+}
+
+static void store_b100(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){
+ //parse the revision number
+ if (mb_eeprom.has_key("revision")) iface.write_eeprom(
+ B100_EEPROM_ADDR, offsetof(b100_eeprom_map, revision),
+ string_to_uint16_bytes(mb_eeprom["revision"])
+ );
+
+ //parse the product code
+ if (mb_eeprom.has_key("product")) iface.write_eeprom(
+ B100_EEPROM_ADDR, offsetof(b100_eeprom_map, product),
+ string_to_uint16_bytes(mb_eeprom["product"])
+ );
+
+ //store the serial
+ if (mb_eeprom.has_key("serial")) iface.write_eeprom(
+ B100_EEPROM_ADDR, offsetof(b100_eeprom_map, serial),
+ string_to_bytes(mb_eeprom["serial"], SERIAL_LEN)
+ );
+
+ //store the name
+ if (mb_eeprom.has_key("name")) iface.write_eeprom(
+ B100_EEPROM_ADDR, offsetof(b100_eeprom_map, name),
+ string_to_bytes(mb_eeprom["name"], NAME_MAX_LEN)
+ );
+}
+
/***********************************************************************
* Implementation of E100 load/store
**********************************************************************/
@@ -391,6 +430,7 @@ mboard_eeprom_t::mboard_eeprom_t(i2c_iface &iface, map_type map){
switch(map){
case MAP_N100: load_n100(*this, iface); break;
case MAP_B000: load_b000(*this, iface); break;
+ case MAP_B100: load_b100(*this, iface); break;
case MAP_E100: load_e100(*this, iface); break;
}
}
@@ -399,6 +439,7 @@ void mboard_eeprom_t::commit(i2c_iface &iface, map_type map) const{
switch(map){
case MAP_N100: store_n100(*this, iface); break;
case MAP_B000: store_b000(*this, iface); break;
+ case MAP_B100: store_b100(*this, iface); break;
case MAP_E100: store_e100(*this, iface); break;
}
}