commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 91/148: Added time spec to the start stream


From: git
Subject: [Commit-gnuradio] [gnuradio] 91/148: Added time spec to the start streaming command. One can do a start streaming at by specifiying a time spec, or leave the parameter off for stream now mode.
Date: Mon, 15 Aug 2016 00:47:28 +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 350b6e64b8943497a07c54b8d69f97af04b8f737
Author: Josh Blum <address@hidden>
Date:   Thu Dec 17 13:34:04 2009 -0800

    Added time spec to the start streaming command.
    One can do a start streaming at by specifiying a time spec,
    or leave the parameter off for stream now mode.
---
 usrp2/firmware/apps/txrx.c                | 18 +++++++++++-------
 usrp2/firmware/include/usrp2_eth_packet.h |  2 ++
 usrp2/firmware/lib/memory_map.h           |  4 ++--
 usrp2/host/include/usrp2/usrp2.h          | 15 ++++++++++++++-
 usrp2/host/lib/usrp2.cc                   |  4 ++--
 usrp2/host/lib/usrp2_impl.cc              |  6 ++++--
 usrp2/host/lib/usrp2_impl.h               |  2 +-
 7 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/usrp2/firmware/apps/txrx.c b/usrp2/firmware/apps/txrx.c
index 0e3fa20..2528bd1 100644
--- a/usrp2/firmware/apps/txrx.c
+++ b/usrp2/firmware/apps/txrx.c
@@ -116,11 +116,14 @@ dbsm_t dsp_rx_sm; // the state machine
 // The mac address of the host we're sending to.
 u2_mac_addr_t host_mac_addr;
 
+#define TIME_NOW ((uint32_t)(~0))
 
 // variables for streaming mode
 
 static bool         streaming_p = false;
 static unsigned int streaming_items_per_frame = 0;
+static uint32_t     time_secs = TIME_NOW;
+static uint32_t     time_tics = TIME_NOW;
 static int          streaming_frame_count = 0;
 #define FRAMES_PER_CMD 1000
 
@@ -153,21 +156,20 @@ restart_streaming(void)
 
   sr_rx_ctrl->cmd =
     MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame,
-             1, 1);                    // set "chain" bit
+    (time_tics==TIME_NOW)?1:0, 1);  // conditionally set "now" bit, set 
"chain" bit
 
   // kick off the state machine
   dbsm_start(&dsp_rx_sm);
 
-  sr_rx_ctrl->time_secs = 0;
-  sr_rx_ctrl->time_ticks = 0;          // enqueue first of two commands
+  sr_rx_ctrl->time_secs = time_secs;
+  sr_rx_ctrl->time_tics = time_tics;           // enqueue first of two commands
 
   // make sure this one and the rest have the "now" and "chain" bits set.
   sr_rx_ctrl->cmd =
-    MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame,
-             1, 1);
+    MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, 1, 1);
 
   sr_rx_ctrl->time_secs = 0;
-  sr_rx_ctrl->time_ticks = 0;          // enqueue second command
+  sr_rx_ctrl->time_tics = 0;           // enqueue second command
 }
 
 void
@@ -192,6 +194,8 @@ start_rx_streaming_cmd(const u2_mac_addr_t *host, 
op_start_rx_streaming_t *p)
     fw_seqno = 0;
 
   streaming_items_per_frame = p->items_per_frame;
+  time_secs = p->time_secs;
+  time_tics = p->time_tics;
   restart_streaming();
 }
 
@@ -248,7 +252,7 @@ fw_sets_seqno_inspector(dbsm_t *sm, int buf_this)   // 
returns false
   if (streaming_p && --streaming_frame_count == 0){
     streaming_frame_count = FRAMES_PER_CMD;
     sr_rx_ctrl->time_secs = 0;
-    sr_rx_ctrl->time_ticks = 0;
+    sr_rx_ctrl->time_tics = 0;
   }
 
   return false;                // we didn't handle the packet
diff --git a/usrp2/firmware/include/usrp2_eth_packet.h 
b/usrp2/firmware/include/usrp2_eth_packet.h
index b85db24..80ee373 100644
--- a/usrp2/firmware/include/usrp2_eth_packet.h
+++ b/usrp2/firmware/include/usrp2_eth_packet.h
@@ -197,6 +197,8 @@ typedef struct {
   uint8_t      rid;
   uint8_t      mbz;
   uint32_t     items_per_frame;  // # of 32-bit data items; MTU=1500: [9,371]
+  uint32_t     time_secs;
+  uint32_t     time_tics;
 } _AL4 op_start_rx_streaming_t;
 
 typedef struct {
diff --git a/usrp2/firmware/lib/memory_map.h b/usrp2/firmware/lib/memory_map.h
index be30949..8aa21fd 100644
--- a/usrp2/firmware/lib/memory_map.h
+++ b/usrp2/firmware/lib/memory_map.h
@@ -453,10 +453,10 @@ typedef struct {
 // --- VITA RX CTRL regs ---
 typedef struct {
   // The following 3 are logically a single command register.
-  // They are clocked into the underlying fifo when time_ticks is written.
+  // They are clocked into the underlying fifo when time_tics is written.
   volatile uint32_t    cmd;            // {now, chain, num_samples(30)
   volatile uint32_t    time_secs;
-  volatile uint32_t    time_ticks;
+  volatile uint32_t    time_tics;
 
   volatile uint32_t    clear_overrun;  // write anything to clear overrun
   volatile uint32_t    vrt_header;     // word 0 of packet.  FPGA fills in 
packet counter
diff --git a/usrp2/host/include/usrp2/usrp2.h b/usrp2/host/include/usrp2/usrp2.h
index c956c07..1565002 100644
--- a/usrp2/host/include/usrp2/usrp2.h
+++ b/usrp2/host/include/usrp2/usrp2.h
@@ -51,6 +51,18 @@ namespace usrp2 {
   typedef std::vector<props> props_vector_t;
 
   /*!
+   * Structure to hold a time specification for a usrp hardware device
+   */
+  typedef struct time_spec{
+      uint32_t secs;
+      uint32_t tics;
+      time_spec(void){
+        secs = ~0;
+        tics = ~0;
+      }
+  } time_spec_t;
+
+  /*!
    * \brief Search the ethernet for all USRP2s or for a specific USRP2.
    *
    * \param ifc is the name of the OS ethernet interface (e.g., "eth0")
@@ -174,8 +186,9 @@ namespace usrp2 {
      * DSP pipeline samples to host.  Call rx_samples(...) to access.
      * 
      * \param items_per_frame  Number of 32-bit items per frame.
+     * \param time_spec        When to start streaming (default == whenever)
      */
-    bool start_rx_streaming(unsigned int items_per_frame=0);
+    bool start_rx_streaming(unsigned int items_per_frame=0, const time_spec_t 
*time_spec=new time_spec_t());
   
     /*!
      * Stop streaming receive mode.
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index e7ab46e..e3b1904 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -251,9 +251,9 @@ namespace usrp2 {
   }
   
   bool
-  usrp2::start_rx_streaming(unsigned int items_per_frame)
+  usrp2::start_rx_streaming(unsigned int items_per_frame, const time_spec_t 
*time_spec)
   {
-    return d_impl->start_rx_streaming(items_per_frame);
+    return d_impl->start_rx_streaming(items_per_frame, time_spec);
   }
   
   bool
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index c8b55c3..c21b295 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -408,7 +408,7 @@ namespace usrp2 {
   }
   
   bool
-  usrp2::impl::start_rx_streaming(unsigned int items_per_frame)
+  usrp2::impl::start_rx_streaming(unsigned int items_per_frame, const 
time_spec_t *time_spec)
   {
 
     //flush any old samples in the data transport
@@ -425,9 +425,11 @@ namespace usrp2 {
       cmd.op.len = sizeof(cmd.op);
       cmd.op.rid = d_next_rid++;
       cmd.op.items_per_frame = htonl(items_per_frame);
+      cmd.op.time_secs = time_spec->secs;
+      cmd.op.time_tics = time_spec->tics;
       cmd.eop.opcode = OP_EOP;
       cmd.eop.len = sizeof(cmd.eop);
-    
+
       bool success = false;
       pending_reply p(cmd.op.rid, &reply, sizeof(reply));
       success = transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT);
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index a4f7e07..1540f64 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -102,7 +102,7 @@ namespace usrp2 {
     bool enable_gpio_streaming(int bank, int enable);
     bool write_gpio(int bank, uint16_t value, uint16_t mask);
     bool read_gpio(int bank, uint16_t *value);
-    bool start_rx_streaming(unsigned int items_per_frame);
+    bool start_rx_streaming(unsigned int items_per_frame, const time_spec_t 
*time_spec);
     bool rx_samples(vrt::rx_packet_handler *handler);
     bool stop_rx_streaming();
 



reply via email to

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