commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8612 - in usrp2/branches/features/host-ng/host-ng: ap


From: jcorgan
Subject: [Commit-gnuradio] r8612 - in usrp2/branches/features/host-ng/host-ng: apps lib
Date: Tue, 17 Jun 2008 22:21:36 -0600 (MDT)

Author: jcorgan
Date: 2008-06-17 22:21:35 -0600 (Tue, 17 Jun 2008)
New Revision: 8612

Modified:
   usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
   usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc
Log:
work-in-progress

Modified: usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-06-18 
00:16:11 UTC (rev 8611)
+++ usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-06-18 
04:21:35 UTC (rev 8612)
@@ -77,8 +77,8 @@
   
   u2->set_rx_gain(1.0);
   u2->set_rx_freq(0.0, NULL);
-  u2->set_rx_decim(5);
-  //u2->start_rx_streaming();
+  u2->set_rx_decim(50);
+  u2->start_rx_streaming();
   
   struct timespec ts;
   ts.tv_sec = 10;
@@ -87,7 +87,7 @@
   if (r == -1)
     perror("nanosleep");
   
-  //u2->stop_rx_streaming();
+  u2->stop_rx_streaming();
   
   return 0;
 }

Modified: usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc   2008-06-18 
00:16:11 UTC (rev 8611)
+++ usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc   2008-06-18 
04:21:35 UTC (rev 8612)
@@ -241,35 +241,28 @@
     if (USRP2_IMPL_DEBUG)
       std::cerr << "usrp2: setting receive decimation rate to " 
                << decimation_factor << std::endl;
-    uint8_t pktbuf[eth_buffer::MAX_PKTLEN];
-    memset(pktbuf, 0, sizeof(pktbuf));
     
-    struct command {
-      u2_eth_packet_t  h;
-      op_config_rx_v2_t        op;
-      op_eop_t         eop;
-    };
+    op_config_rx_v2_cmd cmd;
+    op_config_rx_reply_v2_t reply;
+
+    init_config_rx_v2_cmd(&cmd);
+    cmd.op.valid = htons(CFGV_INTERP_DECIM);
+    cmd.op.decim = htonl(decimation_factor);
     
-    command *c = (command *) pktbuf;
-    init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
-    
-    c->op.opcode = OP_CONFIG_RX_V2;
-    c->op.len = sizeof(op_config_rx_v2_t);
-    c->op.rid = d_next_rid++;
-    
-    c->op.valid = htons(CFGV_INTERP_DECIM);
-    c->op.decim = htonl(decimation_factor);
-    
-    c->eop.opcode = OP_EOP;
-    c->eop.len = sizeof(op_eop_t);
-    
-    int len = std::max((size_t) eth_buffer::MIN_PKTLEN, sizeof(command));
-    if (d_buffer->tx_frame(c, len) != len)
+    pending_reply p(cmd.op.rid, &reply, sizeof(reply));
+    // enqueue p into pending list
+
+    // Transmit command
+    if (d_buffer->tx_frame(&cmd, sizeof(cmd)) != 1)
       return false;
-    
-    // FIXME wait for corresponding reply, etc.
-    
+
+    // Wait for reply or timeout
+    if (p.wait(0, 10000000) == 0)
+      return false;
+
     d_rx_decim = decimation_factor;
+
+    // Process reply here
     return true;
   }
   
@@ -280,34 +273,25 @@
       std::cerr << "usrp2: setting RX IQ scaling to " 
                << scale_i << ", " << scale_q << std::endl;
     
-    uint8_t pktbuf[eth_buffer::MAX_PKTLEN];
-    memset(pktbuf, 0, sizeof(pktbuf));
+    op_config_rx_v2_cmd cmd;
+    op_config_rx_reply_v2_t reply;
+
+    init_config_rx_v2_cmd(&cmd);
+    cmd.op.valid = htons(CFGV_SCALE_IQ);
+    cmd.op.scale_iq = htonl(((scale_i & 0xffff) << 16) | (scale_q & 0xffff));
     
-    struct command {
-      u2_eth_packet_t  h;
-      op_config_rx_v2_t        op;
-      op_eop_t         eop;
-    };
-    
-    command *c = (command *) pktbuf;
-    init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
-    
-    c->op.opcode = OP_CONFIG_RX_V2;
-    c->op.len = sizeof(op_config_rx_v2_t);
-    c->op.rid = d_next_rid++;
-    
-    c->op.valid = htons(CFGV_SCALE_IQ);
-    c->op.scale_iq = htonl(((scale_i & 0xffff) << 16) | (scale_q & 0xffff));
-    
-    c->eop.opcode = OP_EOP;
-    c->eop.len = sizeof(op_eop_t);
-    
-    int len = std::max((size_t) eth_buffer::MIN_PKTLEN, sizeof(command));
-    if (d_buffer->tx_frame(c, len) != len)
+    pending_reply p(cmd.op.rid, &reply, sizeof(reply));
+    // enqueue p into pending list
+
+    // Transmit command
+    if (d_buffer->tx_frame(&cmd, sizeof(cmd)) != 1)
       return false;
-    
-    // FIXME wait for corresponding reply, etc.
-    
+
+    // Wait for reply or timeout
+    if (p.wait(0, 10000000) == 0)
+      return false;
+
+    // Process reply here
     return true;
   }
   





reply via email to

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