summaryrefslogtreecommitdiff
path: root/usrp2/host
diff options
context:
space:
mode:
authorjcorgan2008-12-14 01:01:11 +0000
committerjcorgan2008-12-14 01:01:11 +0000
commitf2695be7c09fec1bc5b62f3b229b9002572aeb30 (patch)
tree231b06c32f76dbc74506423004af6a6d18c8163c /usrp2/host
parent0a5eb9fc28515627ef6d2937e26aadd0a4fd53cf (diff)
downloadgnuradio-f2695be7c09fec1bc5b62f3b229b9002572aeb30.tar.gz
gnuradio-f2695be7c09fec1bc5b62f3b229b9002572aeb30.tar.bz2
gnuradio-f2695be7c09fec1bc5b62f3b229b9002572aeb30.zip
Implement sync_to_pps command for USRP2
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10116 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2/host')
-rw-r--r--usrp2/host/include/usrp2/usrp2.h4
-rw-r--r--usrp2/host/lib/usrp2.cc5
-rw-r--r--usrp2/host/lib/usrp2_impl.cc22
-rw-r--r--usrp2/host/lib/usrp2_impl.h1
4 files changed, 32 insertions, 0 deletions
diff --git a/usrp2/host/include/usrp2/usrp2.h b/usrp2/host/include/usrp2/usrp2.h
index 83e14cd34..4fa9da1ee 100644
--- a/usrp2/host/include/usrp2/usrp2.h
+++ b/usrp2/host/include/usrp2/usrp2.h
@@ -356,6 +356,10 @@ namespace usrp2 {
*/
bool burn_mac_addr(const std::string &new_addr);
+ /*!
+ * Reset master time to 0 at next PPS rising edge
+ */
+ bool sync_to_pps();
#if 0 // not yet implemented
/*!
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index 55f80d8e0..ecfc0b30a 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -389,6 +389,11 @@ namespace usrp2 {
return d_impl->burn_mac_addr(new_addr);
}
+ bool
+ usrp2::sync_to_pps()
+ {
+ return d_impl->sync_to_pps();
+ }
} // namespace usrp2
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 956f2561e..24e6d7e73 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -71,6 +71,7 @@ namespace usrp2 {
case OP_CONFIG_MIMO: return "OP_CONFIG_MIMO";
case OP_DBOARD_INFO: return "OP_DBOARD_INFO";
case OP_DBOARD_INFO_REPLY: return "OP_DBOARD_INFO_REPLY";
+ case OP_SYNC_TO_PPS: return "OP_SYNC_TO_PPS";
#if 0
case OP_WRITE_REG: return "OP_WRITE_REG";
case OP_WRITE_REG_MASKED: return "OP_WRITE_REG_MASKED";
@@ -1020,4 +1021,25 @@ namespace usrp2 {
}
+ bool
+ usrp2::impl::sync_to_pps()
+ {
+ op_config_mimo_cmd cmd;
+ op_generic_t reply;
+
+ memset(&cmd, 0, sizeof(cmd));
+ init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1);
+ cmd.op.opcode = OP_SYNC_TO_PPS;
+ cmd.op.len = sizeof(cmd.op);
+ cmd.op.rid = d_next_rid++;
+ cmd.eop.opcode = OP_EOP;
+ cmd.eop.len = sizeof(cmd.eop);
+
+ pending_reply p(cmd.op.rid, &reply, sizeof(reply));
+ if (!transmit_cmd(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT))
+ return false;
+
+ return ntohx(reply.ok) == 1;
+ }
+
} // namespace usrp2
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index f513cf9d3..f5030f541 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -173,6 +173,7 @@ namespace usrp2 {
// low level
bool burn_mac_addr(const std::string &new_addr);
+ bool sync_to_pps();
};
} // namespace usrp2