commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8636 - usrp2/branches/features/host-ng/host-ng/apps


From: jcorgan
Subject: [Commit-gnuradio] r8636 - usrp2/branches/features/host-ng/host-ng/apps
Date: Thu, 19 Jun 2008 17:44:26 -0600 (MDT)

Author: jcorgan
Date: 2008-06-19 17:44:25 -0600 (Thu, 19 Jun 2008)
New Revision: 8636

Modified:
   usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
Log:
Add more cli control.

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-19 
22:25:05 UTC (rev 8635)
+++ usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-06-19 
23:44:25 UTC (rev 8636)
@@ -43,7 +43,8 @@
   fprintf(stderr, "  -e ETH_INTERFACE     specify ethernet interface 
[default=eth0]\n");
   fprintf(stderr, "  -m MAC_ADDR          mac address of USRP2 HH:HH 
[default=first one found]\n");
   fprintf(stderr, "  -f FREQUENCY         specify receive center frequency in 
Hz [default=0.0]\n");
-  fprintf(stderr, "  -d DECIM             specify receive decimation rate 
(4-512) [default=5]\n");
+  fprintf(stderr, "  -d DECIM             specify receive decimation rate 
[default=5]\n");
+  fprintf(stderr, "  -g GAIN              specify receive daughterboard gain 
[default=0]\n");
 }
 
 int
@@ -52,13 +53,13 @@
   // options and their defaults
   const char *interface = "eth0";
   const char *mac_addr_str = "";
-  double freq = 0.0;
+  double rx_freq = 0.0;
   int rx_decim = 5;
   double rx_gain = 0.0;
   
   int ch;
 
-  while ((ch = getopt(argc, argv, "he:m:f:d:")) != EOF){
+  while ((ch = getopt(argc, argv, "he:m:f:d:g:")) != EOF){
     switch (ch){
 
     case 'e':
@@ -70,16 +71,24 @@
       break;
 
     case 'f':
-      if (!strtod_si(optarg, &freq)) {
+      if (!strtod_si(optarg, &rx_freq)) {
         std::cerr << "invalid number: " << optarg << std::endl;
        usage(argv[0]);
        exit(1);
       }
       break;
 
+    case 'g':
+      if (!strtod_si(optarg, &rx_gain)) {
+        std::cerr << "invalid number: " << optarg << std::endl;
+       usage(argv[0]);
+       exit(1);
+      }
+      break;
+
    case 'd':
       rx_decim = strtol(optarg, 0, 0);
-      if (rx_decim < 4 or rx_decim > 512) { // FIXME: check stride
+      if (rx_decim < 4 or rx_decim > 512) { 
         std::cerr << "invalid decimation rate: " << optarg << std::endl;
        usage(argv[0]);
        exit(1);
@@ -105,8 +114,8 @@
   }
 
   usrp2::tune_result tr;
-  if (!u2->set_rx_freq(freq, &tr)){
-    fprintf(stderr, "set_rx_freq(%g) failed\n", freq);
+  if (!u2->set_rx_freq(rx_freq, &tr)){
+    fprintf(stderr, "set_rx_freq(%g) failed\n", rx_freq);
     exit(1);
   }
 
@@ -125,6 +134,7 @@
     exit(1);
   }
 
+  // Wait while streaming
   struct timespec ts;
   ts.tv_sec = 4;
   ts.tv_nsec = 0;
@@ -134,6 +144,7 @@
   
   u2->stop_rx_streaming();
   
+  // Wait to be able to see stray packets
   ts.tv_sec = 1;
   ts.tv_nsec = 0;
   r = nanosleep(&ts, 0);





reply via email to

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