commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5671 - gnuradio/branches/developers/gnychis/inband/us


From: gnychis
Subject: [Commit-gnuradio] r5671 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Mon, 4 Jun 2007 15:51:21 -0600 (MDT)

Author: gnychis
Date: 2007-06-04 15:51:21 -0600 (Mon, 04 Jun 2007)
New Revision: 5671

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_interface.mbh
   
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
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
Log:
Work-in-progress on inband RX side.

Start reading command being passed down to the low level interface, going to 
stub it out first for testing.


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_interface.mbh
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_interface.mbh
 2007-06-04 21:32:45 UTC (rev 5670)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_interface.mbh
 2007-06-04 21:51:21 UTC (rev 5671)
@@ -39,6 +39,7 @@
    (cmd-usrp-ntx-chan invocation-handle)
    (cmd-usrp-nrx-chan invocation-handle)
    (cmd-usrp-write invocation-handle channel data)
+   (cmd-usrp-start-reading invocation-handle channel)
    )
 
   (:incoming
@@ -47,5 +48,6 @@
    (response-usrp-ntx-chan invocation-handle ntx-chan)
    (response-usrp-nrx-chan invocation-handle nrx-chan)
    (response-usrp-write invocation-handle channel status)
+   (response-usrp-read invocation-handle channel)
    )
   )

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-04 21:32:45 UTC (rev 5670)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-06-04 21:51:21 UTC (rev 5671)
@@ -69,6 +69,7 @@
 static pmt_t s_cmd_usrp_write = pmt_intern("cmd-usrp-write");
 static pmt_t s_cmd_usrp_ntx_chan = pmt_intern("cmd-usrp-ntx-chan");
 static pmt_t s_cmd_usrp_nrx_chan = pmt_intern("cmd-usrp-nrx-chan");
+static pmt_t s_cmd_usrp_start_reading = pmt_intern("cmd-usrp-start-reading");
 static pmt_t s_response_usrp_ntx_chan = pmt_intern("response-usrp-ntx-chan");
 static pmt_t s_response_usrp_nrx_chan = pmt_intern("response-usrp-nrx-chan");
 static pmt_t s_response_usrp_open = pmt_intern("response-usrp-open");
@@ -149,13 +150,13 @@
   for(int chan=0; chan < d_ntx_chan; chan++) {
     d_chaninfo_tx[chan].assigned_capacity = 0;
     d_chaninfo_tx[chan].owner = PMT_NIL;
-    d_chaninfo_tx[chan].receiving = false;
   }
   for(int chan=0; chan < d_nrx_chan; chan++) {
     d_chaninfo_rx[chan].assigned_capacity = 0;
     d_chaninfo_rx[chan].owner = PMT_NIL;
-    d_chaninfo_rx[chan].receiving = false;
   }
+
+  d_rx_chan_mask = 0;
 }
 
 usrp_server::~usrp_server()
@@ -408,8 +409,8 @@
   if (pmt_eq(event, s_cmd_xmit_raw_frame)){
 
     // Check that the user did not send an xmit over an RX port
-    long port;
-    if(rx_port_index(port_id) != -1) {
+    long port = rx_port_index(port_id);
+    if(port != -1) {
       // FIXME: this should include an error
       d_rx[port]->send(s_response_xmit_raw_frame, 
                        pmt_list2(invocation_handle, PMT_F));
@@ -431,8 +432,8 @@
   if (pmt_eq(event, s_cmd_start_recv_raw_samples)) {
 
     // Ensure the user is not trying to recv on TX port
-    long port;
-    if(tx_port_index(port_id) != -1) {
+    long port = tx_port_index(port_id);
+    if(port != -1) {
       // FIXME: should return error type
       d_tx[port]->send(s_response_recv_raw_samples,
                        pmt_list2(invocation_handle, PMT_F));
@@ -749,7 +750,8 @@
   }
 
   // Already started receiving samples? (another start before a stop)
-  if(d_chaninfo_rx[channel].receiving) {
+  // 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),
@@ -759,8 +761,20 @@
     return;
   }
 
+  // This channel is now receiving and we alert the low level code
+  // to start replying with samples
+  d_rx_chan_mask |= 1<<channel;
   
+  // We only need to generate a 'start reading' command down to the
+  // low level interface if no other channel is already reading
+  //
+  // We carry this over the CS interface because the lower level
+  // interface does not care about the channel, we only demux it
+  // at the usrp_server on responses.
+  if(d_rx_chan_mask == 0)
+    d_cs->send(s_cmd_usrp_start_reading, pmt_list1(invocation_handle));
   
+  return;
 }
 
 void

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-04 21:32:45 UTC (rev 5670)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-06-04 21:51:21 UTC (rev 5671)
@@ -57,9 +57,11 @@
   struct channel_info {
     long assigned_capacity;   // the capacity currently assignedby the channel
     pmt_t owner;              // port ID of the owner of the channel
-    bool receiving;           // is a 'receieve' sample data started on this 
channel?
   };
 
+  long d_rx_chan_mask;    // A bitmask representing the channels in the
+                          // receiving state
+
   struct channel_info d_chaninfo_tx[D_MAX_CHANNELS];
   struct channel_info d_chaninfo_rx[D_MAX_CHANNELS];
 

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-04 21:32:45 UTC (rev 5670)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
      2007-06-04 21:51:21 UTC (rev 5671)
@@ -39,6 +39,7 @@
 static pmt_t s_cmd_usrp_write = pmt_intern("cmd-usrp-write");
 static pmt_t s_cmd_usrp_ntx_chan = pmt_intern("cmd-usrp-ntx-chan");
 static pmt_t s_cmd_usrp_nrx_chan = pmt_intern("cmd-usrp-nrx-chan");
+static pmt_t s_cmd_usrp_start_reading = pmt_intern("cmd-usrp-start-reading");
 static pmt_t s_response_usrp_ntx_chan = pmt_intern("response-usrp-ntx-chan");
 static pmt_t s_response_usrp_nrx_chan = pmt_intern("response-usrp-nrx-chan");
 static pmt_t s_response_usrp_open = pmt_intern("response-usrp-open");
@@ -84,31 +85,42 @@
   pmt_t data = msg->data();
   pmt_t invocation_handle;
 
-  // message came in on our control/status port
+  //------------- CONTROL / STATUS -------------//
   if (pmt_eq(port_id, d_cs->port_symbol())) {  
 
+    //------------ OPEN --------------//
     if (pmt_eq(event, s_cmd_usrp_open)){
       handle_cmd_open(data);
       return;
     }
+    //----------- CLOSE -------------//
     else if (pmt_eq(event, s_cmd_usrp_close)) {
       handle_cmd_close(data);
       return;
     }
+    //---------- NTX CHAN ----------//
     else if (pmt_eq(event, s_cmd_usrp_ntx_chan)) {
       invocation_handle = pmt_nth(0, data);
       d_cs->send(s_response_usrp_ntx_chan, pmt_list2(invocation_handle, 
pmt_from_long(d_ntx_chan)));
       return;
     }
+    //---------- NRX CHAN ----------//
     else if (pmt_eq(event, s_cmd_usrp_nrx_chan)) {
       invocation_handle = pmt_nth(0, data);
       d_cs->send(s_response_usrp_nrx_chan, pmt_list2(invocation_handle, 
pmt_from_long(d_nrx_chan)));
       return;
     }
+    //------------ WRITE -----------//
     else if(pmt_eq(event, s_cmd_usrp_write)) {
       handle_cmd_write(data);
       return;
     }
+    //-------- START READING --------//
+    else if(pmt_eq(event, s_cmd_usrp_start_reading)) {
+      handle_cmd_start_reading(data);
+      return;
+    }
+
     goto unhandled;
   }
 
@@ -244,6 +256,14 @@
 }
 
 void
+usrp_usb_interface::handle_cmd_start_reading(pmt_t data)
+{
+  pmt_t invocation_handle = pmt_nth(0, data);
+
+  return;
+}
+
+void
 usrp_usb_interface::handle_cmd_close(pmt_t data)
 {
   pmt_t invocation_handle = pmt_nth(0, data);

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
       2007-06-04 21:32:45 UTC (rev 5670)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
       2007-06-04 21:51:21 UTC (rev 5671)
@@ -52,6 +52,7 @@
   void handle_cmd_open(pmt_t data);
   void handle_cmd_close(pmt_t data);
   void handle_cmd_write(pmt_t data);
+  void handle_cmd_start_reading(pmt_t data);
  
 };
   





reply via email to

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