commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7125 - in usrp2/trunk: . doc host host/lib


From: eb
Subject: [Commit-gnuradio] r7125 - in usrp2/trunk: . doc host host/lib
Date: Wed, 12 Dec 2007 02:29:02 -0700 (MST)

Author: eb
Date: 2007-12-12 02:29:01 -0700 (Wed, 12 Dec 2007)
New Revision: 7125

Added:
   usrp2/trunk/doc/
   usrp2/trunk/doc/inband-signaling-eth
   usrp2/trunk/host/lib/usrp2_basic.cc
   usrp2/trunk/host/lib/usrp2_basic.h
Modified:
   usrp2/trunk/host/Makefile.common
   usrp2/trunk/host/lib/Makefile.am
   usrp2/trunk/host/lib/gri_ethernet.h
Log:
work-in-progress

Copied: usrp2/trunk/doc/inband-signaling-eth (from rev 7090, 
gnuradio/trunk/usrp/doc/inband-signaling-usb)
===================================================================
--- usrp2/trunk/doc/inband-signaling-eth                                (rev 0)
+++ usrp2/trunk/doc/inband-signaling-eth        2007-12-12 09:29:01 UTC (rev 
7125)
@@ -0,0 +1,380 @@
+#
+# Copyright 2007 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/>.
+#
+
+
+FIXME Needless to say, this is _very much_ a work in progress
+
+
+
+This file specifies the format of ethernet packets used for in-band data
+transmission and signaling on the USRP2.
+
+IN packets are sent towards the host.
+OUT packets are sent away from the host.
+
+The layout is 32-bits wide.  All data is transmitted in BIG-endian
+format across the ethernet.
+
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |  Chan   |                     mbz                       |I|S|E|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                           Timestamp                           |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                                                               |
+   +                                                               +
+   |                            Payload                            |
+   .                                                               .
+   .                                                               .
+   .                                                               .
+   |                                                               |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+
+  mbz   Must be Zero: these bits must be zero in both IN and OUT packets.
+
+  I    Send Immediately. Set on Tx data that should be transmitted now.
+       FIXME: change definition to honor 0xffffffff timestamp.
+
+  S     Start of Burst Flag:  Set in an OUT packet if the data is the
+        first segment of what is logically a continuous burst of data.
+        Must be zero in IN packets.
+
+  E     End of Burst Flag:  Set in an OUT packet if the data is the
+        last segment of what is logically a continuous burst of data.
+        Must be zero in IN packets.  Underruns are not reported
+        when the FPGA runs out of samples between bursts.
+
+
+  Chan  5-bit logical channel number.  Channel number 0x1f is reserved
+        for control information.  See "Control Channel" below.  Other
+        channels are "data channels."  Each data channel is logically
+        independent of the others.  A data channel payload field
+        contains a sequence of homogeneous samples.  The format of the
+        samples is determined by the configuration associated with the
+        given channel.  It is often the case that the payload field
+        contains 32-bit complex samples, each containing 16-bit real
+        and imaginary components.
+
+  Timestamp: 32-bit timestamp.
+
+       FIXME: update to reflect that the time is measured at the
+       time the samples inserted into or pulled out of the 
+       DSP pipeline, not the A/D time.  Using A/D time is problematic
+       because of group delay through filtering, etc.
+
+       On IN packets, the timestamp indicates the time at which the
+       first sample of the packet was produced by the A/D converter(s)
+        for that channel.  On OUT packets, the timestamp specifies the
+        time at which the first sample in the packet should go out the
+        D/A converter(s) for that channel.  If a packet reaches the
+       head of the transmit queue, and the current time is later than
+       the timestamp, an error is assumed to have occurred and the
+       packet is discarded.  As a special case, the timestamp
+       0xffffffff is interpreted as "Now".
+
+       The time base is a free running 32-bit counter that is
+       incremented by the A/D sample-clock.
+
+  Payload: Variable length field.  Length is specified by the
+        length of the containing ethernet frame.
+
+
+// FIXME need to revisit this stuff
+
+  O     Overrun Flag: set in an IN packet if an overrun condition was
+        detected.  Must be zero in OUT packets.  Overrun occurs when
+        the FPGA has data to transmit to the host and there is no
+        buffer space available.  This generally indicates a problem on
+        the host.  Either it is not keeping up, or it has configured
+        the FPGA to transmit data at a higher rate than the transport
+        (USB) can support.
+
+  U     Underrun Flag: set in an IN packet if an underrun condition
+        was detected.  Must be zero in OUT packets.  Underrun occurs
+        when the FPGA runs out of samples, and it's not between
+        bursts.  See the "End of Burst flag" below.
+
+  D     Dropped Packet Flag: Set in an IN packet if the FPGA
+       discarded an OUT packet because its timestamp had already
+       passed.
+
+
+  RSSI  6-bit Received Strength Signal Indicator:  Must be zero in OUT
+        packets.  In IN packets, indicates RSSI as reported by front end.
+       FIXME The format and interpretation are to be determined.
+
+
+  Tag   4-bit tag for matching IN packets with OUT packets.
+        [FIXME, write more...]
+
+
+
+"Data Channel" payload format:
+-------------------------------
+
+If Chan != 0x1f, the packet is a "data packet" and the payload is a
+sequence of homogeneous samples.  The format of the samples is
+determined by the configuration associated with the given channel.  
+It is often the case that the payload field contains 32-bit complex
+samples, each containing 16-bit real and imaginary components.
+
+
+"Control Channel" payload format:
+---------------------------------
+
+If Chan == 0x1f, the packet is a "control packet".  The control channel
+payload consists of a sequence of 0 or more sub-packets.
+
+Each sub-packet starts on a 32-bit boundary, and consists of an 8-bit
+Opcode field, an 8-bit Length field, Length bytes of arguments, and 0,
+1, 2 or 3 bytes of padding to align the tail of the sub-packet to
+a 32-bit boundary.
+
+Control channel packets shall be processed at the head of the queue,
+and shall observe the timestamp semantics described above.
+
+
+General sub-packet format:
+--------------------------
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+
+   |     Opcode    |    Length     |        <length bytes> ...    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+
+
+
+Specific sub-packet formats:
+----------------------------
+
+  RID: 6-bit Request-ID. Copied from request sub-packet into corresponding
+       reply sub-packet.  RID allows the host to match requests and replies.
+
+  Reg Number: 10-bit Register Number.
+
+
+
+Identify:
+
+    Opcode:    OP_ID
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       2       |    RID    |        mbz        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Identify Reply:
+
+    Opcode:    OP_ID_REPLY
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |      50       |    RID    |        mbz        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |  Mac Addr 0   |  Mac Addr 1   |  Mac Addr 2   |  Mac Addr 3   |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |  Mac Addr 4   |  Mac Addr 5   | H/W rev major | H/W rev minor |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   | Serial Num 0  | Serial Num 1  | Serial Num 2  | Serial Num 3  |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   | Serial Num 4  | Serial Num 5  | Serial Num 6  | Serial Num 7  |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                                                               |
+   +                                                               +
+   |                                                               |
+   +                         FPGA MD5SUM                           +
+   |                                                               |
+   +                                                               +
+   |                                                               |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                                                               |
+   +                                                               +
+   |                                                               |
+   +                          S/W MD5SUM                           +
+   |                                                               |
+   +                                                               +
+   |                                                               |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Ping Fixed Length:
+
+    Opcode:    OP_PING_FIXED
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       2       |    RID    |     Ping Value    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Ping Fixed Length Reply:
+
+    Opcode:    OP_PING_FIXED_REPLY
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       2       |    RID    |     Ping Value    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Write Register:
+
+    Opcode:    OP_WRITE_REG
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       6       |    mbz    |     Reg Number    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                        Register Value                         |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Write Register Masked:
+
+    Opcode:    OP_WRITE_REG_MASKED
+
+    REG[Num] = (REG[Num] & ~Mask) | (Value & Mask)
+
+    That is, only the register bits that correspond to 1's in the
+    mask are written with the new value.
+
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |      10       |    mbz    |     Reg Number    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                         Register Value                        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                           Mask Value                          |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Read Register:
+
+    Opcode:    OP_READ_REG
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       2       |    RID    |     Reg Number    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Read Register Reply:
+
+    Opcode:    OP_READ_REG_REPLY
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       6       |    RID    |     Reg Number    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                        Register Value                         |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+// FIXME these may not be implemented...
+
+I2C Write:
+
+    Opcode:    OP_I2C_WRITE
+    I2C Addr:   7-bit I2C address
+    Data:      The bytes to write to the I2C bus
+    Length:     Length of Data + 2
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |    Length     |       mbz       |   I2C Addr  |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    Data ...                                                  .
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+I2C Read:
+
+    Opcode:    OP_I2C_READ
+    I2C Addr:  7-bit I2C address
+    Nbytes:    Number of bytes to read from I2C bus
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       3       |    RID    | mbz |   I2C Addr  |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Nbytes    |              unspecified padding              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+I2C Read Reply:
+
+    Opcode:    OP_I2C_READ_REPLY
+    I2C Addr:  7-bit I2C address
+    Data:      Length - 2 bytes of data read from I2C bus.
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |     Length    |    RID    | mbz |   I2C Addr  |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    Data ...                                                  .
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+SPI Write:
+
+    Opcode:          OP_SPI_WRITE
+    Enables:         Which SPI enables to assert (mask)
+    Format:          Specifies format of SPI data and Opt Header Bytes
+    Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format
+    Data:            The bytes to write to the SPI bus
+    Length:          Length of Data + 6
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |    Length     |              mbz              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    Enables    |    Format     |        Opt Header Bytes       |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    Data ...                                                  .
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+SPI Read:
+
+    Opcode:          OP_SPI_READ
+    Enables:         Which SPI enables to assert (mask)
+    Format:          Specifies format of SPI data and Opt Header Bytes
+    Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format
+    Nbytes:          Number of bytes to read from SPI bus.
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       7       |    RID    |        mbz        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    Enables    |    Format     |        Opt Header Bytes       |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Nbytes    |              unspecified padding              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+SPI Read Reply:
+
+    Opcode:   OP_SPI_READ_REPLY
+    Data:     Length - 2 bytes of data read from SPI bus.
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |     Length    |    RID    |        mbz        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    Data ...                                                  .
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Delay:
+
+    Opcode:    OP_DELAY
+    Ticks:     16-bit unsigned delay count
+
+    Delay Ticks clock ticks before executing next operation.
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |     Opcode    |       2       |            Ticks              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+

Modified: usrp2/trunk/host/Makefile.common
===================================================================
--- usrp2/trunk/host/Makefile.common    2007-12-12 08:33:33 UTC (rev 7124)
+++ usrp2/trunk/host/Makefile.common    2007-12-12 09:29:01 UTC (rev 7125)
@@ -1,3 +1,4 @@
+# -*- Makefile -*-
 #
 # Copyright 2007 Free Software Foundation, Inc.
 #
@@ -14,3 +15,5 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
+
+STD_DEFINES_AND_INCLUDES = -I$(top_srcdir)/../firmware/include

Modified: usrp2/trunk/host/lib/Makefile.am
===================================================================
--- usrp2/trunk/host/lib/Makefile.am    2007-12-12 08:33:33 UTC (rev 7124)
+++ usrp2/trunk/host/lib/Makefile.am    2007-12-12 09:29:01 UTC (rev 7125)
@@ -23,8 +23,12 @@
 
 libusrp2_la_SOURCES = \
        gri_ethernet.cc \
-       gri_pktfilter.cc
+       gri_pktfilter.cc \
+       usrp2_basic.cc
 
-noinst_HEADERS = \
+
+include_HEADERS = \
        gri_ethernet.h \
-       gri_pktfilter.h 
+       gri_pktfilter.h \
+       usrp2_basic.h
+

Modified: usrp2/trunk/host/lib/gri_ethernet.h
===================================================================
--- usrp2/trunk/host/lib/gri_ethernet.h 2007-12-12 08:33:33 UTC (rev 7124)
+++ usrp2/trunk/host/lib/gri_ethernet.h 2007-12-12 09:29:01 UTC (rev 7125)
@@ -39,7 +39,7 @@
   ~gri_ethernet ();
 
   /*!
-   * \param ifname             interface name, e.g., "eth0"
+   * \param ifname ethernet interface name, e.g., "eth0"
    */
   bool open (std::string ifname);
   bool close ();

Added: usrp2/trunk/host/lib/usrp2_basic.cc
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.cc                         (rev 0)
+++ usrp2/trunk/host/lib/usrp2_basic.cc 2007-12-12 09:29:01 UTC (rev 7125)
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "usrp2_basic.h"
+#include "gri_ethernet.h"
+#include "gri_pktfilter.h"
+
+usrp2_basic::usrp2_basic()
+  : d_ethernet(new gri_ethernet()), d_pf(0)
+{
+}
+
+usrp2_basic::~usrp2_basic()
+{
+  delete d_pf;
+  delete d_ethernet;
+}
+
+bool
+usrp2_basic::open(std::string ifname)
+{
+  if (!d_ethernet->open(ifname))
+    return false;
+
+  if (d_pf)
+    delete d_pf;
+
+  d_pf = gri_pktfilter::make_ethertype_inbound(U2_ETHERTYPE, 
d_ethernet->mac());
+  if (!d_ethernet->attach_pktfilter(d_pf))
+    return false;
+
+  return true;
+}
+
+bool
+usrp2_basic::close()
+{
+  return d_ethernet->close();
+}
+
+std::vector<op_id_reply_t> 
+usrp2_basic::find_usrp2s()
+{
+  static const uint8_t broadcast_mac_addr[6] =
+    { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+
+  std::vector<op_id_reply_t> r;
+
+  struct command {
+    u2_eth_packet_t    h;
+    op_id_t            op_id;
+  };
+    
+  struct reply {
+    u2_eth_packet_t    h;
+    op_id_reply_t      op_id_reply;
+  };
+
+  command      command;
+  memset(&command, 0, sizeof(command));
+  command.h.ehdr.ethertype = U2_ETHERTYPE;
+  memcpy(command.h.ehdr.dst_addr, broadcast_mac_addr, 
sizeof(broadcast_mac_addr));
+  command.op_id.opcode = OP_ID;
+  command.op_id.len = sizeof(op_id_t);
+  if (d_ethernet->write_packet(&command, sizeof(command)) != sizeof(command)){
+    goto bail;
+  }
+
+  reply                reply;
+  memset(&reply, 0, sizeof(reply));
+
+  // FIXME read some packets
+
+ bail:
+  return r;
+}


Property changes on: usrp2/trunk/host/lib/usrp2_basic.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: usrp2/trunk/host/lib/usrp2_basic.h
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.h                          (rev 0)
+++ usrp2/trunk/host/lib/usrp2_basic.h  2007-12-12 09:29:01 UTC (rev 7125)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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_USRP2_BASIC_H
+#define INCLUDED_USRP2_BASIC_H
+
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include "usrp2_eth_packet.h"
+
+class gri_ethernet;
+class gri_pktfilter;
+
+class usrp2_basic : public boost::noncopyable
+{
+  gri_ethernet *d_ethernet;
+  gri_pktfilter        *d_pf;
+
+public:
+  usrp2_basic();
+  ~usrp2_basic();
+
+  /*!
+   * \param ifname interface name, e.g., "eth0"
+   */
+  bool open(std::string ifname = "eth0");
+  bool close();
+  
+  std::vector<op_id_reply_t> find_usrp2s();
+};
+
+
+
+#endif /* INCLUDED_USRP2_BASIC_H */


Property changes on: usrp2/trunk/host/lib/usrp2_basic.h
___________________________________________________________________
Name: svn:eol-style
   + native





reply via email to

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