commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 16/148: Put ethernet control transport into


From: git
Subject: [Commit-gnuradio] [gnuradio] 16/148: Put ethernet control transport into its own cc/h files. Ethernet control transport is in-charge of ethernet and transport headers, so that usrp2 impl knows nothing about ethernet stuff (as far as control goes).
Date: Mon, 15 Aug 2016 00:47:20 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.

commit 1d7462c51c20f551c55e5b3c6d6bfd3975a23d39
Author: Josh Blum <address@hidden>
Date:   Wed Nov 4 13:43:19 2009 -0800

    Put ethernet control transport into its own cc/h files.
    Ethernet control transport is in-charge of ethernet and transport headers,
    so that usrp2 impl knows nothing about ethernet stuff (as far as control 
goes).
---
 usrp2/host/lib/Makefile.am           |   2 +
 usrp2/host/lib/control.h             |  30 +++++-----
 usrp2/host/lib/eth_ctrl_transport.cc | 104 +++++++++++++++++++++++++++++++++++
 usrp2/host/lib/eth_ctrl_transport.h  |  46 ++++++++++++++++
 usrp2/host/lib/transport.cc          |   9 ++-
 usrp2/host/lib/usrp2.cc              |  85 +---------------------------
 usrp2/host/lib/usrp2_impl.cc         |  91 ++++++++----------------------
 usrp2/host/lib/usrp2_impl.h          |   9 +--
 8 files changed, 198 insertions(+), 178 deletions(-)

diff --git a/usrp2/host/lib/Makefile.am b/usrp2/host/lib/Makefile.am
index 1371ab0..614a7c6 100644
--- a/usrp2/host/lib/Makefile.am
+++ b/usrp2/host/lib/Makefile.am
@@ -36,6 +36,7 @@ libusrp2_la_SOURCES = \
        copy_handler.cc \
        data_handler.cc \
        eth_buffer.cc \
+       eth_ctrl_transport.cc \
        ethernet.cc \
        find.cc \
        open_usrp2_socket.cc \
@@ -57,6 +58,7 @@ noinst_HEADERS = \
        control.h \
        eth_buffer.h \
        eth_common.h \
+       eth_ctrl_transport.h \
        ethernet.h \
        open_usrp2_socket.h \
        pktfilter.h \
diff --git a/usrp2/host/lib/control.h b/usrp2/host/lib/control.h
index 91076a6..80bd159 100644
--- a/usrp2/host/lib/control.h
+++ b/usrp2/host/lib/control.h
@@ -24,8 +24,12 @@
 
 namespace usrp2 {
 
+  typedef struct{
+    u2_fixed_hdr_t fixed;
+  } op_fixed_hdr_t;
+
   struct op_generic_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_generic_t    op;
     op_generic_t    eop;
   };
@@ -35,78 +39,78 @@ namespace usrp2 {
    */
   struct op_config_rx_v2_cmd 
   {
-    u2_eth_packet_t   h;
+    op_fixed_hdr_t   h;
     op_config_rx_v2_t op;
     op_generic_t      eop;
   };
 
   struct op_start_rx_streaming_cmd 
   {
-    u2_eth_packet_t        h;
+    op_fixed_hdr_t         h;
     op_start_rx_streaming_t op;
     op_generic_t           eop;
   };
     
   struct op_stop_rx_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_generic_t    op;
     op_generic_t    eop;
   };
 
   struct op_config_tx_v2_cmd 
   {
-    u2_eth_packet_t   h;
+    op_fixed_hdr_t   h;
     op_config_tx_v2_t op;
     op_generic_t      eop;
   };
 
   struct op_config_mimo_cmd
   {
-    u2_eth_packet_t   h;
+    op_fixed_hdr_t   h;
     op_config_mimo_t  op;
     op_generic_t      eop;
   };
 
   struct op_burn_mac_addr_cmd 
   {
-    u2_eth_packet_t    h;
+    op_fixed_hdr_t    h;
     op_burn_mac_addr_t op;
     op_generic_t       eop;
   };
 
   struct op_dboard_info_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_generic_t    op;
     op_generic_t    eop;
   };
 
   struct op_peek_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_peek_t       op;
     op_generic_t    eop;
   };
 
   struct op_poke_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_poke_t       op;
     // words to write go here
     // eop must be dynamically written here
   };
 
   struct op_freq_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_freq_t       op;
     op_generic_t    eop;
   };
 
   struct op_gpio_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_gpio_t       op;
     op_generic_t    eop;
   };
 
   struct op_gpio_set_sels_cmd {
-    u2_eth_packet_t h;
+    op_fixed_hdr_t h;
     op_gpio_set_sels_t op;
     op_generic_t    eop;
   };
diff --git a/usrp2/host/lib/eth_ctrl_transport.cc 
b/usrp2/host/lib/eth_ctrl_transport.cc
new file mode 100644
index 0000000..09c383e
--- /dev/null
+++ b/usrp2/host/lib/eth_ctrl_transport.cc
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "eth_ctrl_transport.h"
+
+//FIXME this is the third instance of this function, find it a home
+static bool
+parse_mac_addr(const std::string &s, u2_mac_addr_t *p)
+{
+    p->addr[0] = 0x00;         // Matt's IAB
+    p->addr[1] = 0x50;
+    p->addr[2] = 0xC2;
+    p->addr[3] = 0x85;
+    p->addr[4] = 0x30;
+    p->addr[5] = 0x00;
+
+    int len = s.size();
+
+    switch (len){
+      
+    case 5:
+      return sscanf(s.c_str(), "%hhx:%hhx", &p->addr[4], &p->addr[5]) == 2;
+      
+    case 17:
+      return sscanf(s.c_str(), "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
+            &p->addr[0], &p->addr[1], &p->addr[2],
+            &p->addr[3], &p->addr[4], &p->addr[5]) == 6;
+    default:
+      return false;
+    }
+}
+
+
+usrp2::eth_ctrl_transport::eth_ctrl_transport(const std::string &ifc, props 
*p) : transport("ethernet control"){
+
+    //create raw ethernet device
+    d_eth_ctrl = new ethernet();
+    if (!d_eth_ctrl->open(ifc, htons(U2_CTRL_ETHERTYPE)))
+        throw std::runtime_error("Unable to open/register USRP2 control 
protocol");
+
+    //extract mac addr
+    parse_mac_addr(p->addr, &d_usrp_mac);
+
+    //create and attach packet filter
+    d_pf_ctrl = pktfilter::make_ethertype_inbound_target(U2_CTRL_ETHERTYPE, 
(const unsigned char*)&(d_usrp_mac.addr));
+    if (!d_pf_ctrl || !d_eth_ctrl->attach_pktfilter(d_pf_ctrl))
+        throw std::runtime_error("Unable to attach packet filter for control 
packets.");
+}
+
+usrp2::eth_ctrl_transport::~eth_ctrl_transport(){
+    delete d_pf_ctrl;
+    d_eth_ctrl->close();
+    delete d_eth_ctrl;
+}
+
+//FIXME clean this up, probably when we get vrt headers
+//eth transport is only responsible for eth headers and transport headers
+//that leaves the u2 fixed headers to be handled by the usrp2 impl
+typedef struct {
+  u2_eth_hdr_t         ehdr;
+  u2_transport_hdr_t   thdr;
+} u2_eth_packet_only_t;
+
+int usrp2::eth_ctrl_transport::send(const void *buff, int len){
+    //return d_eth_ctrl->write_packet(buff, len);
+    //setup a new ethernet header
+    u2_eth_packet_only_t hdr;
+    hdr.ehdr.ethertype = htons(U2_CTRL_ETHERTYPE);
+    memcpy(&hdr.ehdr.dst, d_usrp_mac.addr, 6);
+    memcpy(&hdr.ehdr.src, d_eth_ctrl->mac(), 6);
+    hdr.thdr.flags = 0; // FIXME transport header values?
+    hdr.thdr.seqno = 0;
+    hdr.thdr.ack = 0;
+    //load the buffer with header and control data
+    uint8_t packet[len+sizeof(hdr)];
+    memcpy(packet, &hdr, sizeof(hdr));
+    memcpy(packet+sizeof(hdr), buff, len);
+    return d_eth_ctrl->write_packet(packet, len+sizeof(hdr));
+}
+
+int usrp2::eth_ctrl_transport::recv(void **buff){
+    int recv_len = d_eth_ctrl->read_packet_dont_block(d_buff, sizeof(d_buff));
+    if (recv_len > sizeof(u2_eth_packet_only_t)){
+        *buff = d_buff + sizeof(u2_eth_packet_only_t);
+        return recv_len - sizeof(u2_eth_packet_only_t);
+    }
+    boost::this_thread::sleep(gruel::get_new_timeout(0.05)); //50ms timeout
+    return 0; //nothing yet
+}
diff --git a/usrp2/host/lib/eth_ctrl_transport.h 
b/usrp2/host/lib/eth_ctrl_transport.h
new file mode 100644
index 0000000..461e70a
--- /dev/null
+++ b/usrp2/host/lib/eth_ctrl_transport.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INCLUDED_ETH_CTRL_TRANSPORT_H
+#define INCLUDED_ETH_CTRL_TRANSPORT_H
+
+#include "transport.h"
+#include "ethernet.h"
+#include "pktfilter.h"
+#include "usrp2_impl.h"
+
+namespace usrp2{
+
+    class eth_ctrl_transport: public transport{
+    private:
+        uint8_t              d_buff[1500]; //FIXME use MTU
+        ethernet      *d_eth_ctrl;  // unbuffered control frames
+        pktfilter     *d_pf_ctrl;
+        u2_mac_addr_t d_usrp_mac;
+
+    public:
+        eth_ctrl_transport(const std::string &ifc, props *p);
+        ~eth_ctrl_transport();
+        int send(const void *buff, int len);
+        int recv(void **buff);
+};
+
+
+} // namespace usrp2
+
+#endif /* INCLUDED_ETH_CTRL_TRANSPORT_H */
diff --git a/usrp2/host/lib/transport.cc b/usrp2/host/lib/transport.cc
index 4c180f9..42e5cfb 100644
--- a/usrp2/host/lib/transport.cc
+++ b/usrp2/host/lib/transport.cc
@@ -24,12 +24,8 @@
 #include <stdexcept>
 #include <cstdio>
 
-static void nop_cb(void *buff, size_t len){
-    //NOP
-}
-
 usrp2::transport::transport(const std::string &type_str){
-    d_cb = nop_cb;
+    d_cb = NULL;
     d_type_str = type_str;
     d_running = false;
 }
@@ -43,6 +39,9 @@ void usrp2::transport::init(){
 }
 
 void usrp2::transport::start(){
+    if (not d_cb){
+        throw std::runtime_error("usrp2::transport for" + d_type_str + " has 
no callback\n");
+    }
     if (d_running){
         throw std::runtime_error("usrp2::transport for" + d_type_str + " 
already started\n");
     }
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index b34e0b1..fafaa3c 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -28,92 +28,9 @@
 #include <string>
 #include <stdexcept>
 #include <cstdio>
-
-  //FIXME this is the third instance of this function, find it a home
-  static bool
-  parse_mac_addr(const std::string &s, u2_mac_addr_t *p)
-  {
-    p->addr[0] = 0x00;         // Matt's IAB
-    p->addr[1] = 0x50;
-    p->addr[2] = 0xC2;
-    p->addr[3] = 0x85;
-    p->addr[4] = 0x30;
-    p->addr[5] = 0x00;
-    
-    int len = s.size();
-    
-    switch (len){
-      
-    case 5:
-      return sscanf(s.c_str(), "%hhx:%hhx", &p->addr[4], &p->addr[5]) == 2;
-      
-    case 17:
-      return sscanf(s.c_str(), "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
-                   &p->addr[0], &p->addr[1], &p->addr[2],
-                   &p->addr[3], &p->addr[4], &p->addr[5]) == 6;
-    default:
-      return false;
-    }
-  }
-
-// ----------------------------------------------------------------
-//        Ethernet transport classes for data and control
-// ----------------------------------------------------------------
-#include "transport.h"
-#include "ethernet.h"
-#include "pktfilter.h"
-class eth_ctrl_transport: public usrp2::transport{
-  private:
-    uint8_t              d_buff[1500]; //FIXME use MTU
-    usrp2::ethernet      *d_eth_ctrl;  // unbuffered control frames
-    usrp2::pktfilter     *d_pf_ctrl;
-
-  public:
-  eth_ctrl_transport(const std::string &ifc, usrp2::props *p) : 
usrp2::transport("ethernet control"){
-
-    //create raw ethernet device
-    d_eth_ctrl = new usrp2::ethernet();
-    if (!d_eth_ctrl->open(ifc, htons(U2_CTRL_ETHERTYPE)))
-      throw std::runtime_error("Unable to open/register USRP2 control 
protocol");
-
-    //extract mac addr
-    u2_mac_addr_t usrp_mac;
-    parse_mac_addr(p->addr, &usrp_mac);
-
-    //create and attach packet filter
-    d_pf_ctrl = 
usrp2::pktfilter::make_ethertype_inbound_target(U2_CTRL_ETHERTYPE, (const 
unsigned char*)&(usrp_mac.addr));
-    if (!d_pf_ctrl || !d_eth_ctrl->attach_pktfilter(d_pf_ctrl))
-        throw std::runtime_error("Unable to attach packet filter for control 
packets.");
-
-    start(); //start thread now
-  }
-
-  ~eth_ctrl_transport(){
-    delete d_pf_ctrl;
-    d_eth_ctrl->close();
-    delete d_eth_ctrl;
-  }
-
-  int send(const void *buff, int len){
-    return d_eth_ctrl->write_packet(buff, len);
-  }
-
-  int recv(void **buff){
-    int recv_len = d_eth_ctrl->read_packet_dont_block(d_buff, sizeof(d_buff));
-    if (recv_len > 0){
-        *buff = d_buff;
-        return recv_len;
-    }
-    boost::this_thread::sleep(gruel::get_new_timeout(0.05)); //50ms timeout
-    return 0; //nothing yet
-  }
-
-};
+#include "eth_ctrl_transport.h"
 
 
-// ----------------------------------------------------------------
-//        The USRP2 class wrapper for impl
-// ----------------------------------------------------------------
 namespace usrp2 {
 
   // --- Table of weak pointers to usrps we know about ---
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index ec9a24c..91a309b 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -149,16 +149,14 @@ namespace usrp2 {
       d_tx_interp(0),
       d_rx_decim(0),
       d_dont_enqueue(true),
-      d_ctrl_running(false),
       d_data_running(false),
       d_ctrl_transport(ctrl_transport)
   {
     
d_ctrl_transport->set_callback(boost::bind(&usrp2::impl::handle_control_packet, 
this, _1, _2));
+    d_ctrl_transport->start();
 
     if (!d_eth_data->open(ifc, htons(U2_DATA_ETHERTYPE)))
       throw std::runtime_error("Unable to open/register USRP2 data protocol");
-    //if (!d_eth_ctrl->open(ifc, htons(U2_CTRL_ETHERTYPE)))
-    //  throw std::runtime_error("Unable to open/register USRP2 control 
protocol");
 
     d_addr = p->addr;
 
@@ -168,9 +166,6 @@ namespace usrp2 {
     d_pf_data = pktfilter::make_ethertype_inbound_target(U2_DATA_ETHERTYPE, 
(const unsigned char*)&(usrp_mac.addr));
     if (!d_pf_data || !d_eth_data->attach_pktfilter(d_pf_data))
       throw std::runtime_error("Unable to attach packet filter for data 
packets.");
-    //d_pf_ctrl = pktfilter::make_ethertype_inbound_target(U2_CTRL_ETHERTYPE, 
(const unsigned char*)&(usrp_mac.addr));
-    //if (!d_pf_ctrl || !d_eth_ctrl->attach_pktfilter(d_pf_ctrl))
-    //  throw std::runtime_error("Unable to attach packet filter for control 
packets.");
     
     if (USRP2_IMPL_DEBUG)
       std::cerr << "usrp2 constructor: using USRP2 at " << d_addr << std::endl;
@@ -178,7 +173,6 @@ namespace usrp2 {
     memset(d_pending_replies, 0, sizeof(d_pending_replies));
 
     start_data_thread();
-    //start_ctrl_thread();
 
     // In case the USRP2 was left streaming RX
     // FIXME: only one channel right now
@@ -232,16 +226,13 @@ namespace usrp2 {
   
   usrp2::impl::~impl()
   {
+    d_ctrl_transport->stop();
     //thread cleanup
     stop_data_thread();
-    //stop_ctrl_thread();
     //socket cleanup
     delete d_pf_data;
-    //delete d_pf_ctrl;
     d_eth_data->close();
     delete d_eth_data;
-    //d_eth_ctrl->close();
-    //delete d_eth_ctrl;
 
     if (USRP2_IMPL_DEBUG) {
       std::cerr << std::endl
@@ -294,13 +285,7 @@ namespace usrp2 {
   }
   
   void
-  usrp2::impl::init_etf_ctrl_hdrs(u2_eth_packet_t *p, const std::string &dst, 
int word0_flags, uint32_t timestamp){
-    p->ehdr.ethertype = htons(U2_CTRL_ETHERTYPE);
-    parse_mac_addr(dst, &p->ehdr.dst); 
-    memcpy(&p->ehdr.src, d_eth_data->mac(), 6);
-    p->thdr.flags = 0; // FIXME transport header values?
-    p->thdr.seqno = 0;
-    p->thdr.ack = 0;
+  usrp2::impl::init_op_ctrl_hdrs(op_fixed_hdr_t *p, int word0_flags, uint32_t 
timestamp){
     u2p_set_word0(&p->fixed, word0_flags, 0);
     u2p_set_timestamp(&p->fixed, timestamp);
   }
@@ -309,7 +294,7 @@ namespace usrp2 {
   usrp2::impl::init_config_rx_v2_cmd(op_config_rx_v2_cmd *cmd)
   {
     memset(cmd, 0, sizeof(*cmd)); 
-    init_etf_ctrl_hdrs(&cmd->h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd->h, 0, -1);
     cmd->op.opcode = OP_CONFIG_RX_V2;
     cmd->op.len = sizeof(cmd->op);
     cmd->op.rid = d_next_rid++;
@@ -321,7 +306,7 @@ namespace usrp2 {
   usrp2::impl::init_config_tx_v2_cmd(op_config_tx_v2_cmd *cmd)
   {
     memset(cmd, 0, sizeof(*cmd)); 
-    init_etf_ctrl_hdrs(&cmd->h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd->h, 0, -1);
     cmd->op.opcode = OP_CONFIG_TX_V2;
     cmd->op.len = sizeof(cmd->op);
     cmd->op.rid = d_next_rid++;
@@ -363,36 +348,6 @@ namespace usrp2 {
   }
 
   // ----------------------------------------------------------------
-  //        Background loop for handling control packets
-  // ----------------------------------------------------------------
-
-  /*void
-  usrp2::impl::start_ctrl_thread()
-  {
-    d_ctrl_thread = new 
boost::thread(boost::bind(&usrp2::impl::run_ctrl_thread, this));
-  }
-
-  void
-  usrp2::impl::stop_ctrl_thread()
-  {
-    d_ctrl_running = false;
-    d_ctrl_thread->join();
-  }
-
-  void
-  usrp2::impl::run_ctrl_thread()
-  {
-    boost::this_thread::disable_interruption di;
-    d_ctrl_running = true;
-    uint8_t buff[1500]; // FIXME use MTU
-    while (d_ctrl_running){
-      int ctrl_recv_len = d_eth_ctrl->read_packet_dont_block(buff, 
sizeof(buff));
-      if (ctrl_recv_len > 0) handle_control_packet(buff, ctrl_recv_len);
-      else boost::this_thread::sleep(gruel::get_new_timeout(0.05)); //50ms 
timeout
-    }
-  }*/
-
-  // ----------------------------------------------------------------
   //        Background loop for handling data packets
   // ----------------------------------------------------------------
 
@@ -453,7 +408,7 @@ namespace usrp2 {
   usrp2::impl::handle_control_packet(const void *base, size_t len)
   {
     // point to beginning of payload (subpackets)
-    unsigned char *p = (unsigned char *)base + sizeof(u2_eth_packet_t);
+    unsigned char *p = (unsigned char *)base + sizeof(u2_fixed_hdr_t);
     
     // FIXME (p % 4) == 2.  Not good.  Must watch for unaligned loads.
 
@@ -568,7 +523,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_SET_RX_LO_OFFSET;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -695,7 +650,7 @@ namespace usrp2 {
       op_generic_t reply;
 
       memset(&cmd, 0, sizeof(cmd));
-      init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+      init_op_ctrl_hdrs(&cmd.h, 0, -1);
       cmd.op.opcode = OP_START_RX_STREAMING;
       cmd.op.len = sizeof(cmd.op);
       cmd.op.rid = d_next_rid++;
@@ -744,7 +699,7 @@ namespace usrp2 {
       gruel::scoped_lock l(d_channel_rings_mutex);
 
       memset(&cmd, 0, sizeof(cmd));
-      init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+      init_op_ctrl_hdrs(&cmd.h, 0, -1);
       cmd.op.opcode = OP_STOP_RX;
       cmd.op.len = sizeof(cmd.op);
       cmd.op.rid = d_next_rid++;
@@ -868,7 +823,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_SET_TX_LO_OFFSET;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1108,7 +1063,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_CONFIG_MIMO;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1168,7 +1123,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_BURN_MAC_ADDR;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1207,7 +1162,7 @@ namespace usrp2 {
     op_dboard_info_reply_t     reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_DBOARD_INFO;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1234,7 +1189,7 @@ namespace usrp2 {
     op_generic_t   reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_SYNC_TO_PPS;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1255,7 +1210,7 @@ namespace usrp2 {
     op_generic_t   reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_SYNC_EVERY_PPS;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1292,7 +1247,7 @@ namespace usrp2 {
     size_t bytes = words*wlen;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_PEEK;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1348,7 +1303,7 @@ namespace usrp2 {
     cmd = (op_poke_cmd *)malloc(l);
     //fprintf(stderr, "cmd=%p l=%i\n", cmd, l);
     memset(cmd, 0, l);
-    init_etf_ctrl_hdrs(&cmd->h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd->h, 0, -1);
     cmd->op.opcode = OP_POKE;
     cmd->op.len = sizeof(cmd->op)+bytes;
     cmd->op.rid = d_next_rid++;
@@ -1385,7 +1340,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_RESET_DB;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1411,7 +1366,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_GPIO_SET_DDR;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1445,7 +1400,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_GPIO_SET_SELS;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1473,7 +1428,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_GPIO_WRITE;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1502,7 +1457,7 @@ namespace usrp2 {
     op_gpio_read_reply_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_GPIO_READ;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
@@ -1539,7 +1494,7 @@ namespace usrp2 {
     op_generic_t reply;
 
     memset(&cmd, 0, sizeof(cmd));
-    init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
+    init_op_ctrl_hdrs(&cmd.h, 0, -1);
     cmd.op.opcode = OP_GPIO_STREAM;
     cmd.op.len = sizeof(cmd.op);
     cmd.op.rid = d_next_rid++;
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index 8702705..3d99915 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -107,7 +107,7 @@ namespace usrp2 {
     
     static bool parse_mac_addr(const std::string &s, u2_mac_addr_t *p);
     void init_etf_data_hdrs(u2_eth_packet_t *p, const std::string &dst, int 
word0_flags, int chan, uint32_t timestamp);
-    void init_etf_ctrl_hdrs(u2_eth_packet_t *p, const std::string &dst, int 
word0_flags, uint32_t timestamp);
+    void init_op_ctrl_hdrs(op_fixed_hdr_t *p, int word0_flags, uint32_t 
timestamp);
     void init_config_rx_v2_cmd(op_config_rx_v2_cmd *cmd);
     void init_config_tx_v2_cmd(op_config_tx_v2_cmd *cmd);
     bool transmit_cmd_and_wait(void *cmd, size_t len, pending_reply *p, double 
secs=0.0);
@@ -118,13 +118,6 @@ namespace usrp2 {
     bool dboard_info();
     bool reset_db();
 
-    //control thread stuff
-    volatile bool d_ctrl_running;
-    boost::thread *d_ctrl_thread;
-    //void start_ctrl_thread();
-    //void stop_ctrl_thread();
-    //void run_ctrl_thread();
-
     //data thread stuff
     volatile bool d_data_running; // TODO: multistate if needed
     boost::thread *d_data_thread;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]