commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11039 - in gnuradio/branches/developers/eb/vrt: confi


From: eb
Subject: [Commit-gnuradio] r11039 - in gnuradio/branches/developers/eb/vrt: config vrt/apps vrt/include/vrt vrt/lib
Date: Thu, 14 May 2009 23:51:52 -0600 (MDT)

Author: eb
Date: 2009-05-14 23:51:52 -0600 (Thu, 14 May 2009)
New Revision: 11039

Modified:
   gnuradio/branches/developers/eb/vrt/config/grc_vrt.m4
   gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_packet_handler.h
   gnuradio/branches/developers/eb/vrt/vrt/lib/rx_udp.cc
Log:
work-in-progress: looking good :-)

Modified: gnuradio/branches/developers/eb/vrt/config/grc_vrt.m4
===================================================================
--- gnuradio/branches/developers/eb/vrt/config/grc_vrt.m4       2009-05-15 
05:06:16 UTC (rev 11038)
+++ gnuradio/branches/developers/eb/vrt/config/grc_vrt.m4       2009-05-15 
05:51:52 UTC (rev 11039)
@@ -44,6 +44,7 @@
         vrt/include/Makefile
         vrt/include/vrt/Makefile
         vrt/lib/Makefile
+        vrt/apps/Makefile
     ])
 
     GRC_BUILD_CONDITIONAL(vrt)

Modified: gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc   
2009-05-15 05:06:16 UTC (rev 11038)
+++ gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc   
2009-05-15 05:51:52 UTC (rev 11039)
@@ -212,7 +212,7 @@
   
   bool operator()(const uint32_t *payload,
                  size_t n32_bit_words,
-                 const vrt::expanded_headers *hdrs);
+                 const vrt::expanded_header *hdr);
 
 };
 
@@ -228,7 +228,7 @@
 bool
 rx_dummy_handler::operator()(const uint32_t *payload,
                             size_t n32_bit_words,
-                            const vrt::expanded_headers *hdr)
+                            const vrt::expanded_header *hdr)
 {
   if (hdr->pkt_cnt() != ((d_last_pkt_cnt + 1) & 0xf)){
     d_nwrong_pkt_cnt++;
@@ -282,10 +282,9 @@
 
   // start receiving packets
 
-  uint64_t     niter = 0;
-  uint64_t     max_iter = 1000;
+  uint64_t max_packets = 1000;
 
-  while(!signaled && niter++ < max_iter){
+  while(!signaled && handler->d_npackets < max_packets){
     bool ok = vrt_receiver->rx_packets(handler.get());
     if (!ok){
       fprintf(stderr, "vrt->rx_packets failed\n");
@@ -298,7 +297,5 @@
   printf("%llu packets received, %llu bad pkt_cnt field values\n",
         handler->d_npackets, handler->d_nwrong_pkt_cnt);
 
-  sleep(3);
-
   return 0;
 }

Modified: 
gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_packet_handler.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_packet_handler.h     
2009-05-15 05:06:16 UTC (rev 11038)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/rx_packet_handler.h     
2009-05-15 05:51:52 UTC (rev 11039)
@@ -21,7 +21,7 @@
 #ifndef INCLUDED_VRT_RX_PACKET_HANDLER_H
 #define INCLUDED_VRT_RX_PACKET_HANDLER_H
 
-#include <vrt/expanded_headers.h>
+#include <vrt/expanded_header.h>
 #include <stddef.h>
 
 namespace vrt {
@@ -39,7 +39,7 @@
     /*!
      * \param payload points to the first 32-bit word of the payload field.
      * \param n32_bit_words is the number of 32-bit words in the payload field.
-     * \param hdrs is the expanded version of the mandatory and optional 
headers (& trailer).
+     * \param hdr is the expanded version of the mandatory and optional header 
fields (& trailer).
      *
      * \p payload points to the raw payload section of the packet received off
      * the wire. The data is network-endian (aka big-endian) 32-bit integers.
@@ -53,7 +53,7 @@
      */
     virtual bool operator()(const uint32_t *payload,
                            size_t n32_bit_words,
-                           const expanded_headers *hdrs) = 0;
+                           const expanded_header *hdr) = 0;
   };
 
 };  // vrt

Modified: gnuradio/branches/developers/eb/vrt/vrt/lib/rx_udp.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/lib/rx_udp.cc       2009-05-15 
05:06:16 UTC (rev 11038)
+++ gnuradio/branches/developers/eb/vrt/vrt/lib/rx_udp.cc       2009-05-15 
05:51:52 UTC (rev 11039)
@@ -22,28 +22,29 @@
 #include <config.h>
 #endif
 #include <vrt/rx_udp.h>
-#include <unistd.h>
+#include <vrt/expanded_header.h>
 #include "socket_rx_buffer.h"
 #include "data_handler.h"
+#include <unistd.h>
 #include <stdio.h>
 #include <stdexcept>
 
 static void
-print_words(size_t offset, uint32_t *buf, size_t n)
+print_words(FILE *fp, size_t offset, uint32_t *buf, size_t n)
 {
   size_t i;
   for (i = 0; i < n; i++){
     if (i % 4 == 0){
-      printf("%04zx:", i);
+      fprintf(fp, "%04zx:", i);
     }
 
-    putchar(' ');
-    printf("%08x", buf[i]);
+    putc(' ', fp);
+    fprintf(fp, "%08x", buf[i]);
     if (i % 4 == 3)
-      putchar('\n');
+      putc('\n', fp);
   }
 
-  putchar('\n');
+  putc('\n', fp);
 }
 
 
@@ -87,14 +88,22 @@
   data_handler::result
   vrt_data_handler::operator()(const void *base, size_t len)
   {
-#if 1
+#if 0
     print_words(0, (uint32_t *)base, len/(sizeof(uint32_t)));
     return 0;
 #else
-    const uint32_t *payload = 0;       // FIXME
-    size_t n32_bit_words = 0;          // FIXME
-    expanded_headers hdrs;             // FIXME
-    bool want_more = (*d_handler)(payload, n32_bit_words, &hdrs);
+    const uint32_t *payload;
+    size_t n32_bit_words;
+    expanded_header hdr;
+    if (!expanded_header::parse((const uint32_t*) base, len/(sizeof(uint32_t)),
+                               &hdr, &payload, &n32_bit_words)){
+      if (1){
+       fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n");
+       print_words(stderr, 0, (uint32_t *)base, len/(sizeof(uint32_t)));
+      }
+      return 0;
+    }
+    bool want_more = (*d_handler)(payload, n32_bit_words, &hdr);
     return !want_more ? data_handler::DONE : 0;
 #endif
   }





reply via email to

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