commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10898 - gnuradio/branches/developers/eb/vrt/vrt/inclu


From: eb
Subject: [Commit-gnuradio] r10898 - gnuradio/branches/developers/eb/vrt/vrt/include/vrt
Date: Wed, 22 Apr 2009 22:00:37 -0600 (MDT)

Author: eb
Date: 2009-04-22 22:00:37 -0600 (Wed, 22 Apr 2009)
New Revision: 10898

Added:
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/bits.h
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_udp.h
Removed:
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/vrt_bits.h
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/vrt_rx_udp.h
Modified:
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_headers.h
Log:
renamed some files for consistency

Modified: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am     
2009-04-23 03:56:05 UTC (rev 10897)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am     
2009-04-23 04:00:37 UTC (rev 10898)
@@ -22,7 +22,7 @@
 vrtincludedir = $(includedir)/vrt
 
 vrtinclude_HEADERS = \
+       bits.h \
        expanded_headers.h \
        rx_packet_handler.h \
-       vrt_bits.h \
-       vrt_rx_udp.h 
+       rx_udp.h 

Copied: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/bits.h (from rev 
10896, gnuradio/branches/developers/eb/vrt/vrt/include/vrt/vrt_bits.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/bits.h                  
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/bits.h  2009-04-23 
04:00:37 UTC (rev 10898)
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_VRT_BITS_H
+#define INCLUDED_VRT_BITS_H
+
+#include <stdint.h>
+
+
+/* VRT Header bits */
+
+#define        VRTH_PT_MASK              (0xf << 28)
+#define        VRTH_PT_IF_DATA_NO_SID    (0x0 << 28)   // IF-Data, no stream id
+#define        VRTH_PT_IF_DATA_WITH_SID  (0x1 << 28)   // IF-Data, w/ stream id
+#define VRTH_PT_EXT_DATA_NO_SID          (0x2 << 28)
+#define        VRTH_PT_EXT_DATA_WITH_SID (0x3 << 28)
+#define        VRTH_PT_IF_CONTEXT        (0x4 << 28)
+#define        VRTH_PT_EXT_CONTEXT       (0x5 << 28)
+
+#define        VRTH_HAS_CLASSID          (1 << 27)
+#define        VRTH_HAS_TRAILER          (1 << 26)     // Data pkts only
+#define        VRTH_START_OF_BURST       (1 << 25)     // Data (Tx) pkts only
+#define        VRTH_END_OF_BURST         (1 << 24)     // Data (Tx) pkts only
+#define        VRTH_TSM                  (1 << 24)     // Context pkts only
+
+#define        VRTH_TSI_MASK             (0x3 << 22)
+#define        VRTH_TSI_NONE             (0x0 << 22)
+#define        VRTH_TSI_UTC              (0x1 << 22)
+#define        VRTH_TSI_GPS              (0x2 << 22)
+#define VRTH_TSI_OTHER           (0x3 << 22)
+
+#define        VRTH_TSF_MASK             (0x3 << 20)
+#define        VRTH_TSF_NONE             (0x0 << 20)
+#define        VRTH_TSF_SAMPLE_CNT       (0x1 << 20)
+#define        VRTH_TSF_REAL_TIME_PS     (0x2 << 20)
+#define        VRTH_TSF_FREE_RUNNING     (0x3 << 20)
+
+#define        VRTH_PKT_CNT_MASK         (0xf << 16)
+#define        VRTH_PKT_SIZE_MASK        0xffff                    
+
+
+static inline int
+vrth_pkt_cnt(uint32_t h)
+{
+  return (h & VRTH_PKT_CNT_MASK) >> 16;
+}
+
+static inline int
+vrth_pkt_size(uint32_t h)
+{
+  return h & VRTH_PKT_SIZE_MASK;
+}
+
+#endif /* INCLUDED_VRT_BITS_H */

Modified: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_headers.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_headers.h      
2009-04-23 03:56:05 UTC (rev 10897)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_headers.h      
2009-04-23 04:00:37 UTC (rev 10898)
@@ -22,7 +22,7 @@
 #define INCLUDED_VRT_EXPANDED_HEADERS_H
 
 #include <stdint.h>
-#include <vrt/vrt_bits.h>
+#include <vrt/bits.h>
 
 namespace vrt {
 
@@ -62,7 +62,7 @@
     // optional info predicates
     bool stream_id_p() { return s_stream_id[pkt_type()]; }
     bool class_id_p() { return (header & VRTH_HAS_CLASSID) != 0; }
-    bool trailer_p() { return data_p() && (header & VRTH_HAS_TRAILER) != 0; }
+    bool trailer_p() { return (header & VRTH_HAS_TRAILER) != 0 && data_p(); }
 
   private:
     static unsigned char s_if_data[16];

Copied: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_udp.h (from rev 
10896, gnuradio/branches/developers/eb/vrt/vrt/include/vrt/vrt_rx_udp.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_udp.h                
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_udp.h        
2009-04-23 04:00:37 UTC (rev 10898)
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_RX_UDP_H
+#define INCLUDED_VRT_RX_UDP_H
+
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+
+namespace vrt {
+
+  /*!
+   * Relatively low-level interface to receive VRT packets over UDP.
+   *
+   * (We'll refactor this if/when we use a non-UDP transport.)
+   * No VRT control issues are addressed here.
+   */
+  class rx_udp : boost::nocopyable
+  {
+    int                d_socket_fd;
+
+  public:
+    /*!
+     * Shared pointer to this class
+     */ 
+    typedef boost::shared_ptr<usrp2> sptr;
+
+    /*! 
+     * \brief Static function to return an instance of rx_udp as a shared 
pointer.
+     *
+     * \param socket_fd file descriptor that data grams will be received from.
+     *                 It is assumed that some higher-level control software
+     *                 opened the appropriate UDP socket for us.  This object
+     *                 assumes management of the socket's lifetime.  The
+     *                 socket will be closed when our destructor fires.
+     */
+    static sptr make(int socket_fd);
+
+    /*! 
+     * \param socket_fd file descriptor that data grams will be received from.
+     *                 It is assumed that some higher-level control software
+     *                 opened the appropriate UDP socket for us.  This object
+     *                 assumes management of the socket's lifetime.  The
+     *                 socket will be closed when our destructor fires.
+     */
+    rx_udp(int socket_fd);
+    ~rx_udp();
+
+    /*!
+     * \brief Receive packets from the given socket file descriptor.
+     *
+     * Handler will be invoked for all available packets.
+     * This function blocks until at least one packet has been processed.
+     */
+    bool rx_packets(rx_sample_handler *handler);
+
+    /*
+     * \returns the socket_fd.   Useful for select or poll.
+     */
+    int socket_fd() const { return d_socket_fd; }
+  };
+
+}
+
+#endif /* INCLUDED_VRT_RX_UDP_H */





reply via email to

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