From 76ebda895cae3bd0014a5e428b07440445f3b631 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 22 Feb 2011 11:55:54 -0800 Subject: uhd: switch dboard id prop to whole eeprom struct modified implementation code and burner app also made dboard manager use safe constructor that will use none ids if construction fails --- host/utils/usrp_burn_db_eeprom.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'host/utils') diff --git a/host/utils/usrp_burn_db_eeprom.cpp b/host/utils/usrp_burn_db_eeprom.cpp index 9afd71a22..ac5608f22 100644 --- a/host/utils/usrp_burn_db_eeprom.cpp +++ b/host/utils/usrp_burn_db_eeprom.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -50,6 +50,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("slot", po::value(&slot)->default_value(""), "dboard slot name [default is blank for automatic]") ("unit", po::value(&unit)->default_value(""), "which unit [RX or TX]") ("id", po::value(), "dboard id to burn, omit for readback") + ("ser", po::value(), "serial to burn, omit for readback") ; po::variables_map vm; @@ -80,20 +81,22 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ wax::obj dboard = (*dev)[DEVICE_PROP_MBOARD][named_prop_t(unit_to_db_prop[unit], slot)]; std::string prefix = unit + ":" + slot; - //read the current dboard id from eeprom - if (vm.count("id") == 0){ - std::cout << boost::format("Getting dbid on %s dboard...") % prefix << std::endl; - dboard_id_t id = dboard[DBOARD_PROP_DBOARD_ID].as(); - std::cout << boost::format(" Current dbid: %s") % id.to_pp_string() << std::endl; + std::cout << boost::format("Reading EEPROM on %s dboard...") % prefix << std::endl; + dboard_eeprom_t db_eeprom = dboard[DBOARD_PROP_DBOARD_EEPROM].as(); + + //------------- handle the dboard ID -----------------------------// + if (vm.count("id")){ + db_eeprom.id = dboard_id_t::from_string(vm["id"].as()); + dboard[DBOARD_PROP_DBOARD_EEPROM] = db_eeprom; } + std::cout << boost::format(" Current ID: %s") % db_eeprom.id.to_pp_string() << std::endl; - //write a new dboard id to eeprom - else{ - dboard_id_t id = dboard_id_t::from_string(vm["id"].as()); - std::cout << boost::format("Setting dbid on %s dboard...") % prefix << std::endl; - std::cout << boost::format(" New dbid: %s") % id.to_pp_string() << std::endl; - dboard[DBOARD_PROP_DBOARD_ID] = id; + //------------- handle the dboard serial--------------------------// + if (vm.count("ser")){ + db_eeprom.serial = vm["ser"].as(); + dboard[DBOARD_PROP_DBOARD_EEPROM] = db_eeprom; } + std::cout << boost::format(" Current serial: \"%s\"") % db_eeprom.serial << std::endl; std::cout << " Done" << std::endl << std::endl; return 0; -- cgit v1.2.3