commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11581 - in gnuradio/branches/developers/eb/vrt2/vrt:


From: eb
Subject: [Commit-gnuradio] r11581 - in gnuradio/branches/developers/eb/vrt2/vrt: include/vrt lib
Date: Tue, 11 Aug 2009 19:18:44 -0600 (MDT)

Author: eb
Date: 2009-08-11 19:18:44 -0600 (Tue, 11 Aug 2009)
New Revision: 11581

Modified:
   gnuradio/branches/developers/eb/vrt2/vrt/include/vrt/quadradio.h
   gnuradio/branches/developers/eb/vrt2/vrt/lib/quadradio.cc
Log:
Changed which_dboard to a bitmask.


Modified: gnuradio/branches/developers/eb/vrt2/vrt/include/vrt/quadradio.h
===================================================================
--- gnuradio/branches/developers/eb/vrt2/vrt/include/vrt/quadradio.h    
2009-08-11 23:30:43 UTC (rev 11580)
+++ gnuradio/branches/developers/eb/vrt2/vrt/include/vrt/quadradio.h    
2009-08-12 01:18:44 UTC (rev 11581)
@@ -106,12 +106,21 @@
     
     /* primitives */
     bool set_setting_reg(int regno, int value);
-    bool set_dboard_pins(int which_dboard, int v);
-    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
     bool set_lo_freq(double freq);
     bool set_cal_freq(double freq);
+
+    /*
+     * The first parameter for these is a bitmask which indicates which
+     * daughterboard or daughterboards to apply the operation to.
+     * 0x1     -> dboard 0
+     * 0x2     -> dboard 1
+     * 0x3     -> dboard 0 and 1...
+     */
+    bool set_dboard_pins(int dboard_bitmask, int v);
+    bool set_hsadc_conf(int dboard_bitmask, int regno, int value);
+    bool set_lsdac(int dboard_bitmask, int which_dac, int value);
+
   };
 
 };

Modified: gnuradio/branches/developers/eb/vrt2/vrt/lib/quadradio.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt2/vrt/lib/quadradio.cc   2009-08-11 
23:30:43 UTC (rev 11580)
+++ gnuradio/branches/developers/eb/vrt2/vrt/lib/quadradio.cc   2009-08-12 
01:18:44 UTC (rev 11581)
@@ -31,6 +31,8 @@
 #define        MIN_IP_LOCAL_PORT       32768
 #define        MAX_IP_LOCAL_PORT       61000
 
+#define ALL_DBOARDS    0xf
+
 static bool
 send_and_check(int fd, void *buf, size_t len)
 {
@@ -152,33 +154,32 @@
         ((reverse_bits(~d_attenuation1, 5) & 0x1f) << 03) | \
         ((d_band_select                   & 0x03) << 01) | \
         ((d_rx_antenna                    & 0x01) << 00);
-    set_dboard_pins(0, db_ctrl);  // FIXME
+    set_dboard_pins(ALL_DBOARDS, db_ctrl);  // FIXME sets them all
 }
 
 void
 vrt::quadradio::set_adc_gain(bool on){
-    if (on) set_hsadc_conf(0, 0x14, 0x90);
-    else set_hsadc_conf(0, 0x14, 0x80);
+  set_hsadc_conf(ALL_DBOARDS, 0x14, on ? 0x90 : 0x80);
 }
 
 void
 vrt::quadradio::set_dc_offset_comp(bool on){
     if (on) {
-        set_hsadc_conf(0, 0x1B, 0x80);
-        set_hsadc_conf(0, 0x1A, 0x00); //bits 6:4 set time constant
+        set_hsadc_conf(ALL_DBOARDS, 0x1B, 0x80);
+        set_hsadc_conf(ALL_DBOARDS, 0x1A, 0x00); //bits 6:4 set time constant
     }
-    else set_hsadc_conf(0, 0x1B, 0x00);
+    else set_hsadc_conf(ALL_DBOARDS, 0x1B, 0x00);
 }
 
 void
 vrt::quadradio::set_digital_gain(float gain){
     int gain_q1 = static_cast<int>(round(gain*2.0));
-    set_hsadc_conf(0, 0x17, gain_q1);
+    set_hsadc_conf(ALL_DBOARDS, 0x17, gain_q1);
 }
 
 void
 vrt::quadradio::set_test_signal(vrt_test_sig_t type){
-    set_hsadc_conf(0, 0x16, type);
+    set_hsadc_conf(ALL_DBOARDS, 0x16, type);
 }
 
 bool
@@ -306,12 +307,12 @@
 }
 
 bool
-vrt::quadradio::set_dboard_pins(int which_dboard, int v)
+vrt::quadradio::set_dboard_pins(int dboard_bitmask, int v)
 {
   uint32_t cmd[4];
   cmd[0] = htonl(0);              // verb: set
   cmd[1] = htonl(1);              // id: dboard_pins
-  cmd[2] = htonl(which_dboard);
+  cmd[2] = htonl(dboard_bitmask);
   cmd[3] = htonl(v);              // value
 
   return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
@@ -330,12 +331,12 @@
 }
 
 bool
-vrt::quadradio::set_hsadc_conf(int which_dboard, int regno, int value)
+vrt::quadradio::set_hsadc_conf(int dboard_bitmask, 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[2] = htonl(dboard_bitmask);
   cmd[3] = htonl(regno);
   cmd[4] = htonl(value);
 
@@ -343,12 +344,12 @@
 }
 
 bool
-vrt::quadradio::set_lsdac(int which_dboard, int which_dac, int value)
+vrt::quadradio::set_lsdac(int dboard_bitmask, 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[2] = htonl(dboard_bitmask);
   cmd[3] = htonl(which_dac);
   cmd[4] = htonl(value);
 





reply via email to

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