commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5727 - in gnuradio/branches/developers/gnychis/inband


From: gnychis
Subject: [Commit-gnuradio] r5727 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband
Date: Wed, 6 Jun 2007 20:27:18 -0600 (MDT)

Author: gnychis
Date: 2007-06-06 20:27:17 -0600 (Wed, 06 Jun 2007)
New Revision: 5727

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
Log:
Forcing the 'fake-usrp' dictionary key to be PMT_T for setting the fake usrp, 
instead of just checking the key exists.

Cleaned up the handling of the TX signal in the usrp_server


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
   2007-06-07 02:22:25 UTC (rev 5726)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
   2007-06-07 02:27:17 UTC (rev 5727)
@@ -61,7 +61,7 @@
 static pmt_t s_cmd_xmit_raw_frame  = pmt_intern("cmd-xmit-raw-frame");
 static pmt_t s_response_xmit_raw_frame = pmt_intern("response-xmit-raw-frame");
 
-static bool verbose = true;
+static bool verbose = false;
 
 class test_usrp_tx : public mb_mblock
 {

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-06-07 02:22:25 UTC (rev 5726)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-06-07 02:27:17 UTC (rev 5727)
@@ -944,7 +944,7 @@
 
   // Use the stub with the usrp_server
   pmt_t usrp_server_dict = pmt_make_dict();
-  pmt_dict_set(usrp_server_dict, pmt_intern("fake-usrp"),PMT_T);
+  pmt_dict_set(usrp_server_dict, pmt_intern("fake-usrp"), PMT_T);
 
   // Test the TX side
   define_component("server", "usrp_server", usrp_server_dict);

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-06-07 02:22:25 UTC (rev 5726)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-06-07 02:27:17 UTC (rev 5727)
@@ -448,10 +448,20 @@
         return;
       }
 
-      //handle_cmd_start_recv_raw_samples(port, data);
+      handle_cmd_start_recv_raw_samples(d_rx[port], d_chaninfo_rx, data);
       return;
     }
+    
+    //-------------- STOP RECV ----------------//
+    if (pmt_eq(event, s_cmd_stop_recv_raw_samples)) {
+    
+      if(!d_opened) 
+        return;
 
+      //handle_cmd_stop_recv_raw_samples(port, data);
+      return;
+    }
+
     goto unhandled;
   }
 
@@ -643,47 +653,25 @@
 }
 
 void
-usrp_server::handle_cmd_start_recv_raw_samples(pmt_t port_id, pmt_t data)
+usrp_server::handle_cmd_start_recv_raw_samples(mb_port_sptr port, 
std::vector<struct channel_info> &chan_info, pmt_t data)
 {
   pmt_t invocation_handle = pmt_nth(0, data);
   long channel = pmt_to_long(pmt_nth(1, data));
 
-  long port = rx_port_index(port_id);   // If returns -1, the port is invalid
-                                        // which I don't know how to handle
-                                        // since you can't respond on an
-                                        // invalid port
-
-  // Not a valid channel?
-  if(channel >= d_nrx_chan) {
-    d_rx[port]->send(s_response_recv_raw_samples,
-                     pmt_list5(invocation_handle,
-                               pmt_from_long(CHANNEL_INVALID),
-                               PMT_NIL,
-                               PMT_NIL,
-                               PMT_NIL));
+  // Ensure the channel is valid and the caller owns the port
+  if(!check_valid(port, channel, chan_info,
+                  pmt_list2(s_response_xmit_raw_frame, invocation_handle)))
     return;
-  }
 
-  // Not the owner of the channel?
-  if(d_chaninfo_rx[channel].owner != port_id) {
-    d_rx[port]->send(s_response_recv_raw_samples,
-                     pmt_list5(invocation_handle,
-                               pmt_from_long(PERMISSION_DENIED),
-                               PMT_NIL,
-                               PMT_NIL,
-                               PMT_NIL));
-    return;
-  }
-
   // Already started receiving samples? (another start before a stop)
   // Check the RX channel bitmask.
   if(d_rx_chan_mask & (1 << channel)) {
-    d_rx[port]->send(s_response_recv_raw_samples,
-                     pmt_list5(invocation_handle,
-                               pmt_from_long(ALREADY_RECV),
-                               PMT_NIL,
-                               PMT_NIL,
-                               PMT_NIL));
+    port->send(s_response_recv_raw_samples,
+               pmt_list5(invocation_handle,
+                         pmt_from_long(ALREADY_RECV),
+                         PMT_NIL,
+                         PMT_NIL,
+                         PMT_NIL));
     return;
   }
 
@@ -694,13 +682,13 @@
   // interface does not care about the channel, we only demux it
   // at the usrp_server on responses.
   if(d_rx_chan_mask == 0) {
+    
     if(verbose)
       std::cout << "[USRP_SERVER] Sending read request down\n";
+
     d_cs_usrp->send(s_cmd_usrp_start_reading, pmt_list1(invocation_handle));
   }
 
-  // This channel is now receiving and we alert the low level code
-  // to start replying with samples
   d_rx_chan_mask |= 1<<channel;
   
   return;

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-06-07 02:22:25 UTC (rev 5726)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-06-07 02:27:17 UTC (rev 5727)
@@ -92,7 +92,7 @@
   void handle_cmd_allocate_channel(mb_port_sptr port, std::vector<struct 
channel_info> &chan_info, pmt_t data);
   void handle_cmd_deallocate_channel(mb_port_sptr port, std::vector<struct 
channel_info> &chan_info, pmt_t data);
   void handle_cmd_xmit_raw_frame(mb_port_sptr port, std::vector<struct 
channel_info> &chan_info, pmt_t data);
-  void handle_cmd_start_recv_raw_samples(pmt_t port_id, pmt_t data);
+  void handle_cmd_start_recv_raw_samples(mb_port_sptr port, std::vector<struct 
channel_info> &chan_info, pmt_t data);
   int rx_port_index(pmt_t port_id);
   int tx_port_index(pmt_t port_id);
   long current_capacity_allocation();

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
      2007-06-07 02:22:25 UTC (rev 5726)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
      2007-06-07 02:27:17 UTC (rev 5727)
@@ -71,11 +71,18 @@
   std::string rx_interface = "usrp_rx";
   
   if (pmt_is_dict(usrp_dict)) {
-    if(pmt_dict_has_key(usrp_dict, pmt_intern("fake-usrp"))) {
-      tx_interface = "usrp_tx_stub";
-      rx_interface = "usrp_rx_stub";
-      d_fake_usrp=true;
-     }
+
+    // The 'fake-usrp' key enables the TX and RX stubs if PMT_T
+    if(pmt_t fake_usrp = pmt_dict_ref(usrp_dict, 
+                                      pmt_intern("fake-usrp"), 
+                                      PMT_NIL)) {
+      if(pmt_eqv(fake_usrp, PMT_T)) {
+        tx_interface = "usrp_tx_stub";
+        rx_interface = "usrp_rx_stub";
+        d_fake_usrp=true;
+      }
+    }
+
   }
   
   if (verbose) {





reply via email to

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