commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11036 - in gnuradio/branches/developers/eb/vrt/vrt: i


From: eb
Subject: [Commit-gnuradio] r11036 - in gnuradio/branches/developers/eb/vrt/vrt: include/vrt lib
Date: Thu, 14 May 2009 21:13:10 -0600 (MDT)

Author: eb
Date: 2009-05-14 21:13:10 -0600 (Thu, 14 May 2009)
New Revision: 11036

Added:
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_header.h
   gnuradio/branches/developers/eb/vrt/vrt/lib/expanded_header.cc
Removed:
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_headers.h
   gnuradio/branches/developers/eb/vrt/vrt/lib/expanded_headers.cc
Modified:
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am
   gnuradio/branches/developers/eb/vrt/vrt/lib/Makefile.am
Log:
s/expanded_headers/expanded_header/

Modified: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am     
2009-05-15 03:08:38 UTC (rev 11035)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/Makefile.am     
2009-05-15 03:13:10 UTC (rev 11036)
@@ -23,6 +23,6 @@
 
 vrtinclude_HEADERS = \
        bits.h \
-       expanded_headers.h \
+       expanded_header.h \
        rx_packet_handler.h \
        rx_udp.h 

Copied: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_header.h 
(from rev 10997, 
gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_headers.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_header.h       
                        (rev 0)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/expanded_header.h       
2009-05-15 03:13:10 UTC (rev 11036)
@@ -0,0 +1,81 @@
+/* -*- 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_EXPANDED_HEADER_H
+#define INCLUDED_VRT_EXPANDED_HEADER_H
+
+#include <stdint.h>
+#include <vrt/bits.h>
+
+namespace vrt {
+
+  /*!
+   * \brief All headers and trailer for VRT IF-Data, Extension-Data,
+   * IF-Context and Extension-Context packets.
+   *
+   * There are fields allocated for each possible header.  Their content may
+   * or may not be valid.  Check the header field to confirm their validity.
+   * All values are in host-endian format.
+   */
+  struct expanded_header {
+    uint32_t   header;                 // first word of all packets
+    uint32_t   stream_id;              // optional stream identifier
+    uint64_t   class_id;               // optional class identifier
+    uint32_t   integer_secs;           // optional integer seconds timestamp
+    uint64_t   fractional_secs;        // optional fractional seconds timestamp
+    uint32_t   trailer;                // optional trailer (only possible in 
data pkts)
+
+    expanded_header()
+      : header(0), stream_id(0), class_id(0),
+       integer_secs(0), fractional_secs(0), trailer(0) {}
+
+    int pkt_type() const {
+      return (header & VRTH_PT_MASK) >> 28;
+    }
+    
+    // packet type predicates
+    bool if_data_p() const { return s_if_data[pkt_type()]; }
+    bool ext_data_p() const { return s_ext_data[pkt_type()]; }
+    bool if_context_p() const { return (header & VRTH_PT_MASK) == 
VRTH_PT_IF_CONTEXT; }
+    bool ext_context_p() const { return (header & VRTH_PT_MASK) == 
VRTH_PT_EXT_CONTEXT; }
+
+    bool data_p() const { return s_data[pkt_type()]; } // if_data_p() || 
ext_data_p()
+    bool context_p() const { return s_context[pkt_type()]; }   // 
if_context_p() || ext_context_p()
+
+    // optional info predicates
+    bool stream_id_p() const { return s_stream_id[pkt_type()]; }
+    bool class_id_p() const { return (header & VRTH_HAS_CLASSID) != 0; }
+    bool trailer_p() const { return (header & VRTH_HAS_TRAILER) != 0 && 
data_p(); }
+
+    int pkt_cnt() const { return vrth_pkt_cnt(header); }
+
+  private:
+    static unsigned char s_if_data[16];
+    static unsigned char s_ext_data[16];
+    static unsigned char s_data[16];
+    static unsigned char s_context[16];
+    static unsigned char s_stream_id[16];
+
+  };
+
+}; // vrt
+
+
+#endif /* INCLUDED_VRT_EXPANDED_HEADER_H */

Modified: gnuradio/branches/developers/eb/vrt/vrt/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/lib/Makefile.am     2009-05-15 
03:08:38 UTC (rev 11035)
+++ gnuradio/branches/developers/eb/vrt/vrt/lib/Makefile.am     2009-05-15 
03:13:10 UTC (rev 11036)
@@ -29,7 +29,7 @@
 
 libvrt_la_SOURCES = \
        data_handler.cc \
-       expanded_headers.cc \
+       expanded_header.cc \
        rx_packet_handler.cc \
        rx_udp.cc \
        socket_rx_buffer.cc

Copied: gnuradio/branches/developers/eb/vrt/vrt/lib/expanded_header.cc (from 
rev 10980, gnuradio/branches/developers/eb/vrt/vrt/lib/expanded_headers.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/lib/expanded_header.cc              
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt/vrt/lib/expanded_header.cc      
2009-05-15 03:13:10 UTC (rev 11036)
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt/expanded_header.h>
+
+namespace vrt {
+
+  // lookup tables indexed by packet type
+  unsigned char expanded_header::s_if_data[16] = {
+    1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+  };
+
+  unsigned char expanded_header::s_ext_data[16] = {
+    0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+  };
+
+  unsigned char expanded_header::s_data[16] = {
+    1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+  };
+
+  unsigned char expanded_header::s_context[16] = {
+    0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+  };
+
+  unsigned char expanded_header::s_stream_id[16] = {
+    0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+  };
+
+
+}; // vrt





reply via email to

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