commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 38/148: rx working with vrt header


From: git
Subject: [Commit-gnuradio] [gnuradio] 38/148: rx working with vrt header
Date: Mon, 15 Aug 2016 00:47:22 +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 6360ce1702e8b0474aea8064224c2b8ba4c829a7
Author: Josh Blum <address@hidden>
Date:   Tue Nov 17 17:56:24 2009 -0800

    rx working with vrt header
---
 usrp2/firmware/apps/txrx.c   | 15 ++++++++-------
 usrp2/host/lib/usrp2_impl.cc | 40 +++++++++++-----------------------------
 2 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/usrp2/firmware/apps/txrx.c b/usrp2/firmware/apps/txrx.c
index 5048aa2..61b151a 100644
--- a/usrp2/firmware/apps/txrx.c
+++ b/usrp2/firmware/apps/txrx.c
@@ -94,7 +94,7 @@ dbsm_t dsp_tx_sm;     // the state machine
 
 // 4 lines of ethernet hdr + 1 line transport hdr + 1 line (word0)
 // DSP Rx writes timestamp followed by nlines_per_frame of samples
-#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + 
sizeof(u2_transport_hdr_t))/4 + 1)
+#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + 
sizeof(u2_transport_hdr_t))/4)
 
 // receive from DSP
 buf_cmd_args_t dsp_rx_recv_args = {
@@ -129,6 +129,9 @@ bool is_streaming(void){ return streaming_p; }
 
 // ----------------------------------------------------------------
 
+#define VRT_HEADER_WORDS 5
+#define VRT_TRAILER_WORDS 1
+
 void
 restart_streaming(void)
 {
@@ -140,8 +143,8 @@ restart_streaming(void)
      | VRTH_PT_IF_DATA_WITH_SID
      | VRTH_HAS_TRAILER
      | VRTH_TSF_SAMPLE_CNT
-     | (6+streaming_items_per_frame)); //MAGIC number 6
-  sr_rx_ctrl->vrt_stream_id = 0xabab;
+     | (VRT_HEADER_WORDS+streaming_items_per_frame+VRT_TRAILER_WORDS));
+  sr_rx_ctrl->vrt_stream_id = 0;
   sr_rx_ctrl->vrt_trailer = 0;
 
   streaming_p = true;
@@ -170,15 +173,13 @@ start_rx_streaming_cmd(const u2_mac_addr_t *host, 
op_start_rx_streaming_t *p)
   host_mac_addr = *host;       // remember who we're sending to
 
   /*
-   * Construct  ethernet header and word0 and preload into two buffers
+   * Construct  ethernet header and preload into two buffers
    */
-  u2_eth_packet_t      pkt;
+  u2_eth_packet_only_t pkt;
   memset(&pkt, 0, sizeof(pkt));
   pkt.ehdr.dst = *host;
   pkt.ehdr.src = *ethernet_mac_addr();
   pkt.ehdr.ethertype = U2_DATA_ETHERTYPE;
-  u2p_set_word0(&pkt.fixed, 0, 0);
-  // DSP RX will fill in timestamp
 
   memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt));
   memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt));
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 096ecf7..548e714 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -99,38 +99,20 @@ namespace usrp2 {
     vrt::expanded_header vrt_hdr;
 
     if (vrt::expanded_header::parse(
-        (const uint32_t*)(d+1), payload_len_in_bytes/sizeof(uint32_t), //in
+        (const uint32_t*)p, payload_len_in_bytes/sizeof(uint32_t), //in
         &vrt_hdr, (const uint32_t**)items, nitems_in_uint32s) and 
vrt_hdr.if_data_p()){ //out
-        return true;
+        
+        (*items)++;//FIXME wrong ptr from parse
+        
+        //strip off the trailer if present
+        if (vrt_hdr.trailer_p()) (*nitems_in_uint32s)--;
+        
     } else {
+        *items = (uint32_t*)p; //KLUDGE until we move this code
+        *nitems_in_uint32s = payload_len_in_bytes/sizeof(uint32_t);
         printf("Bad vrt header %x\n", vrt_hdr.header);
     }
 
-    if (payload_len_in_bytes < sizeof(u2_fixed_hdr_t)) // invalid format
-      return false;
-
-    // FIXME deal with the fact that (p % 4) == 2
-    //assert((((uintptr_t) p) % 4) == 0);              // must be 4-byte 
aligned
-
-    u2_fixed_hdr_t *fh = static_cast<u2_fixed_hdr_t *>(p);
-    
-    // FIXME unaligned loads!
-    md->word0 = u2p_word0(fh);
-    md->timestamp = u2p_timestamp(fh);
-
-    // FIXME when we've got more info
-    // md->start_of_burst = (md->word0 & XXX) != 0;
-    // md->end_of_burst =   (md->word0 & XXX) != 0;
-    // md->rx_overrun =     (md->word0 & XXX) != 0;
-    md->start_of_burst = 0;
-    md->end_of_burst =   0;
-    md->rx_overrun =     0;
-
-    *items = (uint32_t *)(&fh[1]);
-    size_t nbytes = payload_len_in_bytes - sizeof(u2_fixed_hdr_t);
-    assert((nbytes % sizeof(uint32_t)) == 0);
-    *nitems_in_uint32s = nbytes / sizeof(uint32_t);
-
     return true;
   }
 
@@ -315,8 +297,8 @@ namespace usrp2 {
         sbuff::sptr sb = sbs[i];
 
         u2_fixed_hdr_t *fixed_hdr = (u2_fixed_hdr_t*)sb->buff();
-        // FIXME unaligned load!
-        unsigned int chan = u2p_chan(fixed_hdr);
+        // FIXME get channel from vrt
+        unsigned int chan = 0;
 
         gruel::scoped_lock l(d_channel_rings_mutex);
 



reply via email to

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