commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11414 - in gnuradio/branches/developers/eb/vrt: gr-vr


From: eb
Subject: [Commit-gnuradio] r11414 - in gnuradio/branches/developers/eb/vrt: gr-vrt/src vrt/include/vrt vrt/lib
Date: Fri, 10 Jul 2009 14:29:37 -0600 (MDT)

Author: eb
Date: 2009-07-10 14:29:37 -0600 (Fri, 10 Jul 2009)
New Revision: 11414

Modified:
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h
   gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc
Log:
Implemted additional commands for debugging: write any setting reg,
write HS ADC config regs, write LSDAC, generic 32-bit memory poke.


Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i        2009-07-10 
18:38:41 UTC (rev 11413)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i        2009-07-10 
20:29:37 UTC (rev 11414)
@@ -84,6 +84,11 @@
 
   bool set_attenuation(int attenuation);
 
+  bool set_setting_reg(int regno, int value);
+  bool set_hsadc_conf(int which_dboard, int regno, int value);
+  bool set_lsdac(int which_dboard, int which_dac, int value);
+  bool set_mem32(int addr, int value);
+
 };
 
 

Modified: 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc 
2009-07-10 18:38:41 UTC (rev 11413)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc 
2009-07-10 20:29:37 UTC (rev 11414)
@@ -107,3 +107,27 @@
 {
   return d_qr->set_attenuation(attenuation);
 }
+
+bool
+vrt_quadradio_source_32fc::set_setting_reg(int regno, int value)
+{
+  return d_qr->set_setting_reg(regno, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_hsadc_conf(int which_dboard, int regno, int 
value)
+{
+  return d_qr->set_hsadc_conf(which_dboard, regno, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_lsdac(int which_dboard, int which_dac, int 
value)
+{
+  return d_qr->set_lsdac(which_dboard, which_dac, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_mem32(int addr, int value)
+{
+  return d_qr->set_mem32(addr, value);
+}

Modified: 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h  
2009-07-10 18:38:41 UTC (rev 11413)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h  
2009-07-10 20:29:37 UTC (rev 11414)
@@ -94,6 +94,11 @@
    */
   bool set_attenuation(int attenuation);
 
+
+  bool set_setting_reg(int regno, int value);
+  bool set_hsadc_conf(int which_dboard, int regno, int value);
+  bool set_lsdac(int which_dboard, int which_dac, int value);
+  bool set_mem32(int addr, int value);
 };
 
 

Modified: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h     
2009-07-10 18:38:41 UTC (rev 11413)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h     
2009-07-10 20:29:37 UTC (rev 11414)
@@ -87,6 +87,11 @@
     bool select_rx_antenna(const std::string &ant);
     bool set_attenuation(int attenuation);
     
+    bool set_setting_reg(int regno, int value);
+    bool set_hsadc_conf(int which_dboard, int regno, int value);
+    bool set_lsdac(int which_dboard, int which_dac, int value);
+    bool set_mem32(int addr, int value);       // poke a 32-bit value
+
   };
 
 };

Modified: gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc    2009-07-10 
18:38:41 UTC (rev 11413)
+++ gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc    2009-07-10 
20:29:37 UTC (rev 11414)
@@ -30,7 +30,22 @@
 #define        MIN_IP_LOCAL_PORT       32768
 #define        MAX_IP_LOCAL_PORT       61000
 
+static bool
+send_and_check(int fd, void *buf, size_t len)
+{
+  int r = send(fd, buf, len, 0);
+  if (r < 0){
+    perror("send");
+    return false;
+  }
+  if ((size_t) r != len){
+    fprintf(stderr, "send: short return value.  expected %zd, got %d\n", len, 
r);
+    return false;
+  }
+  return true;
+}
 
+
 vrt::quadradio::quadradio(const std::string &ip, size_t rx_bufsize)
   : d_ctrl_fd(0), d_data_fd(0), d_data_port(0),
   d_band_select(0), d_rx_antenna(0), d_attenuation(0), d_10dB_atten(true)
@@ -135,17 +150,7 @@
   cmd[1] = htonl(1);              // id: dboard_pins
   cmd[2] = htonl(v);              // value
 
-  int r = send(d_ctrl_fd, cmd, sizeof(cmd), 0);
-  if (r < 0){
-    perror("send");
-    return false;
-  }
-  if (r != sizeof(cmd)){
-    fprintf(stderr, "send: short return value.  expected %zd, got %d\n", 
sizeof(cmd), r);
-    return false;
-  }
-
-  return true;
+  return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
 }
   
 
@@ -246,7 +251,6 @@
   return true;
 }
 
-
 bool
 vrt::quadradio::send_rx_command(int ctrl_fd, bool start,
                                struct in_addr addr, int data_port,
@@ -261,17 +265,7 @@
   cmd[5] = htonl(samples_per_pkt);
   cmd[6] = htonl(siggen_param);
 
-  int r = send(ctrl_fd, cmd, sizeof(cmd), 0);
-  if (r < 0){
-    perror("send");
-    return false;
-  }
-  if (r != sizeof(cmd)){
-    fprintf(stderr, "send: short return value.  expected %zd, got %d\n", 
sizeof(cmd), r);
-    return false;
-  }
-
-  return true;
+  return send_and_check(ctrl_fd, cmd, sizeof(cmd));
 }
 
 bool
@@ -281,3 +275,53 @@
   in_addr.s_addr = 0;
   return send_rx_command(ctrl_fd, false, in_addr, 0, 0, 0);
 }
+
+bool
+vrt::quadradio::set_setting_reg(int regno, int value)
+{
+  uint32_t cmd[4];
+  cmd[0] = htonl(0);              // verb: set
+  cmd[1] = htonl(2);              // id: SR
+  cmd[2] = htonl(regno);
+  cmd[3] = htonl(value);
+
+  return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_hsadc_conf(int which_dboard, int regno, int value)
+{
+  uint32_t cmd[5];
+  cmd[0] = htonl(0);              // verb: set
+  cmd[1] = htonl(3);              // id: HSADC_CONF
+  cmd[2] = htonl(which_dboard);
+  cmd[3] = htonl(regno);
+  cmd[4] = htonl(value);
+
+  return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_lsdac(int which_dboard, int which_dac, int value)
+{
+  uint32_t cmd[5];
+  cmd[0] = htonl(0);              // verb: set
+  cmd[1] = htonl(4);              // id: LSDAC
+  cmd[2] = htonl(which_dboard);
+  cmd[3] = htonl(which_dac);
+  cmd[4] = htonl(value);
+
+  return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_mem32(int addr, int value)
+{
+  uint32_t cmd[4];
+  cmd[0] = htonl(0);              // verb: set
+  cmd[1] = htonl(5);              // id: MEM32
+  cmd[2] = htonl(addr);
+  cmd[3] = htonl(value);
+
+  return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}





reply via email to

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