summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-02-14 15:01:15 -0800
committerJosh Blum <josh@joshknows.com>2012-02-14 15:01:15 -0800
commit1463a78fd2ebac1985182dede9c3ec1af11a3799 (patch)
treefcf1b8d416f3e2ab99b08e82ed761a67e4a9c097 /host/lib/usrp/common
parent8bd255c5f6ed586603727ffaa56d1eeb325458af (diff)
downloaduhd-1463a78fd2ebac1985182dede9c3ec1af11a3799.tar.gz
uhd-1463a78fd2ebac1985182dede9c3ec1af11a3799.tar.bz2
uhd-1463a78fd2ebac1985182dede9c3ec1af11a3799.zip
b100: reset/reenumerate fx2 for bad endpoint state
Determine state of control endpoint, re-enumerate to put in a known state, rerun some initialization code.
Diffstat (limited to 'host/lib/usrp/common')
-rw-r--r--host/lib/usrp/common/fx2_ctrl.cpp9
-rw-r--r--host/lib/usrp/common/fx2_ctrl.hpp3
2 files changed, 12 insertions, 0 deletions
diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp
index baf8f5e68..7b8920eb1 100644
--- a/host/lib/usrp/common/fx2_ctrl.cpp
+++ b/host/lib/usrp/common/fx2_ctrl.cpp
@@ -139,6 +139,15 @@ public:
_ctrl_transport = ctrl_transport;
}
+ void usrp_fx2_reset(void){
+ unsigned char reset_y = 1;
+ unsigned char reset_n = 0;
+ usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_y, 1);
+ usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_n, 1);
+ //wait for things to settle
+ boost::this_thread::sleep(boost::posix_time::milliseconds(2000));
+ }
+
void usrp_load_firmware(std::string filestring, bool force)
{
const char *filename = filestring.c_str();
diff --git a/host/lib/usrp/common/fx2_ctrl.hpp b/host/lib/usrp/common/fx2_ctrl.hpp
index 5e28e8081..f2e060862 100644
--- a/host/lib/usrp/common/fx2_ctrl.hpp
+++ b/host/lib/usrp/common/fx2_ctrl.hpp
@@ -39,6 +39,9 @@ public:
//! Call init after the fpga is loaded
virtual void usrp_init(void) = 0;
+ //! For emergency situations
+ virtual void usrp_fx2_reset(void) = 0;
+
/*!
* Load firmware in Intel HEX Format onto device
* \param filename name of firmware file