commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9429 - usrp2/branches/developers/jcorgan/wip/host-ng/


From: jcorgan
Subject: [Commit-gnuradio] r9429 - usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2
Date: Tue, 26 Aug 2008 21:37:08 -0600 (MDT)

Author: jcorgan
Date: 2008-08-26 21:37:08 -0600 (Tue, 26 Aug 2008)
New Revision: 9429

Modified:
   usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test.sh
   usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test_gr_usrp2.cc
   usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.cc
   usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.h
Log:
wip

Modified: usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test.sh
===================================================================
--- usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test.sh      
2008-08-27 02:36:54 UTC (rev 9428)
+++ usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test.sh      
2008-08-27 03:37:08 UTC (rev 9429)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-sudo ./test_gr_usrp2 -v
+sudo ./test_gr_usrp2 -d 4 -v

Modified: 
usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test_gr_usrp2.cc
===================================================================
--- usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test_gr_usrp2.cc     
2008-08-27 02:36:54 UTC (rev 9428)
+++ usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/test_gr_usrp2.cc     
2008-08-27 03:37:08 UTC (rev 9429)
@@ -20,6 +20,7 @@
 #include <config.h>
 #endif
 
+#include <usrp2/strtod_si.h>
 #include <gruel/realtime.h>
 #include <usrp2_source_c.h>
 #include <string.h>
@@ -40,10 +41,10 @@
   fprintf(stderr, "  -h                   show this message and exit\n");
   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");
-#if 0
+  fprintf(stderr, "  -g GAIN              specify receive daughterboard gain 
[default=0]\n");
   fprintf(stderr, "  -f FREQUENCY         specify receive center frequency in 
Hz [default=0.0]\n");
   fprintf(stderr, "  -d DECIM             specify receive decimation rate 
[default=5]\n");
-  fprintf(stderr, "  -g GAIN              specify receive daughterboard gain 
[default=0]\n");
+#if 0
   fprintf(stderr, "  -N NSAMPLES          specify number of samples to receive 
[default=infinite]\n");
   fprintf(stderr, "  -o OUTPUT_FILENAME   specify file to receive samples 
[default=none]\n");
   fprintf(stderr, "  -s                   write complex<short> 
[default=complex<float>]\n");
@@ -57,10 +58,10 @@
   // options and their defaults
   const char *interface = "eth0";
   const char *mac_addr_str = "";
-#if 0
+  double rx_gain = 0.0;
   double rx_freq = 0.0;
   int rx_decim = 5;
-  double rx_gain = 0.0;
+#if 0
   uint64_t nsamples = 0;
   bool output_shorts = false;
   char *output_filename = 0;
@@ -70,7 +71,7 @@
   int ch;
 
   //while ((ch = getopt(argc, argv, "he:m:f:d:g:N:o:sv")) != EOF){
-  while ((ch = getopt(argc, argv, "he:m:v")) != EOF){
+  while ((ch = getopt(argc, argv, "he:m:g:f:d:v")) != EOF){
     //double tmp;
     switch (ch){
 
@@ -81,17 +82,17 @@
     case 'm':
       mac_addr_str = optarg;
       break;
-#if 0
-    case 'f':
-      if (!strtod_si(optarg, &rx_freq)) {
+
+    case 'g':
+      if (!strtod_si(optarg, &rx_gain)) {
         std::cerr << "invalid number: " << optarg << std::endl;
        usage(argv[0]);
        exit(1);
       }
       break;
 
-    case 'g':
-      if (!strtod_si(optarg, &rx_gain)) {
+    case 'f':
+      if (!strtod_si(optarg, &rx_freq)) {
         std::cerr << "invalid number: " << optarg << std::endl;
        usage(argv[0]);
        exit(1);
@@ -107,6 +108,7 @@
       }
       break;
 
+#if 0
     case 'N':
       if (!strtod_si(optarg, &tmp)) {
         std::cerr << "invalid number: " << optarg << std::endl;
@@ -141,38 +143,35 @@
 
   usrp2_source_c_sptr u2 = usrp2_make_source_c(interface, mac_addr_str);
 
-#if 0
-  if (!u2->set_rx_gain(rx_gain)){
-    fprintf(stderr, "set_rx_gain(%f) failed\n", rx_gain);
+  if (!u2->set_gain(rx_gain)){
+    fprintf(stderr, "set_gain(%f) failed\n", rx_gain);
     exit(1);
   }
 
   usrp2::tune_result tr;
-  if (!u2->set_rx_center_freq(rx_freq, &tr)){
-    fprintf(stderr, "set_rx_center_freq(%g) failed\n", rx_freq);
+  if (!u2->set_center_freq(rx_freq, &tr)){
+    fprintf(stderr, "set_center_freq(%g) failed\n", rx_freq);
     exit(1);
   }
-#endif
 
   if (verbose){
     printf("USRP2 MAC address: %s\n\n", u2->mac_addr().c_str());
-#if 0
     printf("Daughterboard configuration:\n");
     printf("  baseband_freq=%f\n", tr.baseband_freq);
     printf("       ddc_freq=%f\n", tr.dxc_freq);
     printf("  residual_freq=%f\n", tr.residual_freq);
     printf("       inverted=%s\n\n", tr.spectrum_inverted ? "yes" : "no");
-#endif
   }
-#if 0
-  if (!u2->set_rx_decim(rx_decim)) {
-    fprintf(stderr, "set_rx_decim(%d) failed\n", rx_decim);
+
+  if (!u2->set_decim(rx_decim)) {
+    fprintf(stderr, "set_decim(%d) failed\n", rx_decim);
     exit(1);
   }
 
   if (verbose)
     printf("USRP2 using decimation rate of %d\n", rx_decim);
-    
+
+#if 0    
   if (verbose) {
     if (nsamples > 0)
         printf("Receiving %zd samples\n\n", nsamples);

Modified: 
usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.cc
===================================================================
--- usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.cc 
2008-08-27 02:36:54 UTC (rev 9428)
+++ usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.cc 
2008-08-27 03:37:08 UTC (rev 9429)
@@ -49,6 +49,24 @@
 {
 }
 
+bool
+usrp2_source_base::set_gain(double gain)
+{
+  return d_u2->set_rx_gain(gain);
+}
+
+bool
+usrp2_source_base::set_center_freq(double frequency, usrp2::tune_result *tr)
+{
+  return d_u2->set_rx_center_freq(frequency, tr);
+}
+
+bool
+usrp2_source_base::set_decim(int decimation_factor)
+{
+  return d_u2->set_rx_decim(decimation_factor);
+}
+
 int
 usrp2_source_base::work(int noutput_items,
                        gr_vector_const_void_star &input_items,

Modified: 
usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.h
===================================================================
--- usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.h  
2008-08-27 02:36:54 UTC (rev 9428)
+++ usrp2/branches/developers/jcorgan/wip/host-ng/gr-usrp2/usrp2_source_base.h  
2008-08-27 03:37:08 UTC (rev 9429)
@@ -41,8 +41,26 @@
 public:
   ~usrp2_source_base();
 
+  /*!
+   * \brief Return USRP2 MAC address
+   */
   const std::string &mac_addr() const { return d_u2->mac_addr(); }
-  
+
+  /*!
+   * \brief Set receiver gain
+   */
+  bool set_gain(double gain);
+
+  /*!
+   * \brief Set receiver center frequency
+   */
+  bool set_center_freq(double frequency, usrp2::tune_result *tr);
+   
+  /*!
+   * \brief Set receive decimation rate
+   */
+  bool set_decim(int decimation_factor);
+
   int work(int noutput_items,
           gr_vector_const_void_star &input_items,
           gr_vector_void_star &output_items);





reply via email to

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