[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9743 - gnuradio/branches/developers/eb/cppdb-wip/usrp
From: |
eb |
Subject: |
[Commit-gnuradio] r9743 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy |
Date: |
Tue, 7 Oct 2008 22:11:45 -0600 (MDT) |
Author: eb
Date: 2008-10-07 22:11:42 -0600 (Tue, 07 Oct 2008)
New Revision: 9743
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
Log:
s/which_dboard/which_side/g etc
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
===================================================================
---
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
2008-10-08 03:53:42 UTC (rev 9742)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
2008-10-08 04:11:42 UTC (rev 9743)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2004 Free Software Foundation, Inc.
+ * Copyright 2003,2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -250,22 +250,22 @@
// ----------------------------------------------------------------
bool
-usrp_basic::set_adc_offset (int which, int offset)
+usrp_basic::set_adc_offset (int which_adc, int offset)
{
- if (which < 0 || which > 3)
+ if (which_adc < 0 || which_adc > 3)
return false;
- return _write_fpga_reg (FR_ADC_OFFSET_0 + which, offset);
+ return _write_fpga_reg (FR_ADC_OFFSET_0 + which_adc, offset);
}
bool
-usrp_basic::set_dac_offset (int which, int offset, int offset_pin)
+usrp_basic::set_dac_offset (int which_dac, int offset, int offset_pin)
{
- if (which < 0 || which > 3)
+ if (which_dac < 0 || which_dac > 3)
return false;
- int which_codec = which >> 1;
- int tx_a = (which & 0x1) == 0;
+ int which_codec = which_dac >> 1;
+ int tx_a = (which_dac & 0x1) == 0;
int lo = ((offset & 0x3) << 6) | (offset_pin & 0x1);
int hi = (offset >> 2);
bool ok;
@@ -282,13 +282,13 @@
}
bool
-usrp_basic::set_adc_buffer_bypass (int which, bool bypass)
+usrp_basic::set_adc_buffer_bypass (int which_adc, bool bypass)
{
- if (which < 0 || which > 3)
+ if (which_adc < 0 || which_adc > 3)
return false;
- int codec = which >> 1;
- int reg = (which & 1) == 0 ? REG_RX_A : REG_RX_B;
+ int codec = which_adc >> 1;
+ int reg = (which_adc & 1) == 0 ? REG_RX_A : REG_RX_B;
unsigned char cur_rx;
unsigned char cur_pwr_dn;
@@ -302,11 +302,11 @@
if (bypass){
cur_rx |= RX_X_BYPASS_INPUT_BUFFER;
- cur_pwr_dn |= ((which & 1) == 0) ? RX_PWR_DN_BUF_A : RX_PWR_DN_BUF_B;
+ cur_pwr_dn |= ((which_adc & 1) == 0) ? RX_PWR_DN_BUF_A : RX_PWR_DN_BUF_B;
}
else {
cur_rx &= ~RX_X_BYPASS_INPUT_BUFFER;
- cur_pwr_dn &= ~(((which & 1) == 0) ? RX_PWR_DN_BUF_A : RX_PWR_DN_BUF_B);
+ cur_pwr_dn &= ~(((which_adc & 1) == 0) ? RX_PWR_DN_BUF_A :
RX_PWR_DN_BUF_B);
}
ok &= _write_9862 (codec, reg, cur_rx);
@@ -413,9 +413,9 @@
bool
-usrp_basic::_set_led (int which, bool on)
+usrp_basic::_set_led (int which_led, bool on)
{
- return usrp_set_led (d_udh, which, on);
+ return usrp_set_led (d_udh, which_led, on);
}
////////////////////////////////////////////////////////////////
@@ -657,16 +657,16 @@
}
bool
-usrp_basic_rx::set_pga (int which, double gain)
+usrp_basic_rx::set_pga (int which_amp, double gain)
{
- if (which < 0 || which > 3)
+ if (which_amp < 0 || which_amp > 3)
return false;
gain = std::max (pga_min (), gain);
gain = std::min (pga_max (), gain);
- int codec = which >> 1;
- int reg = (which & 1) == 0 ? REG_RX_A : REG_RX_B;
+ int codec = which_amp >> 1;
+ int reg = (which_amp & 1) == 0 ? REG_RX_A : REG_RX_B;
// read current value to get input buffer bypass flag.
unsigned char cur_rx;
@@ -680,13 +680,13 @@
}
double
-usrp_basic_rx::pga (int which) const
+usrp_basic_rx::pga (int which_amp) const
{
- if (which < 0 || which > 3)
+ if (which_amp < 0 || which_amp > 3)
return READ_FAILED;
- int codec = which >> 1;
- int reg = (which & 1) == 0 ? REG_RX_A : REG_RX_B;
+ int codec = which_amp >> 1;
+ int reg = (which_amp & 1) == 0 ? REG_RX_A : REG_RX_B;
unsigned char v;
bool ok = _read_9862 (codec, reg, &v);
if (!ok)
@@ -760,33 +760,33 @@
}
bool
-usrp_basic_rx::_write_oe (int which_dboard, int value, int mask)
+usrp_basic_rx::_write_oe (int which_side, int value, int mask)
{
- if (! (0 <= which_dboard && which_dboard <= 1))
+ if (! (0 <= which_side && which_side <= 1))
return false;
- return _write_fpga_reg (slot_id_to_oe_reg (dboard_to_slot (which_dboard)),
+ return _write_fpga_reg (slot_id_to_oe_reg (dboard_to_slot (which_side)),
(mask << 16) | (value & 0xffff));
}
bool
-usrp_basic_rx::write_io (int which_dboard, int value, int mask)
+usrp_basic_rx::write_io (int which_side, int value, int mask)
{
- if (! (0 <= which_dboard && which_dboard <= 1))
+ if (! (0 <= which_side && which_side <= 1))
return false;
- return _write_fpga_reg (slot_id_to_io_reg (dboard_to_slot (which_dboard)),
+ return _write_fpga_reg (slot_id_to_io_reg (dboard_to_slot (which_side)),
(mask << 16) | (value & 0xffff));
}
bool
-usrp_basic_rx::read_io (int which_dboard, int *value)
+usrp_basic_rx::read_io (int which_side, int *value)
{
- if (! (0 <= which_dboard && which_dboard <= 1))
+ if (! (0 <= which_side && which_side <= 1))
return false;
int t;
- int reg = which_dboard + 1; // FIXME, *very* magic number (fix in
serial_io.v)
+ int reg = which_side + 1; // FIXME, *very* magic number (fix in
serial_io.v)
bool ok = _read_fpga_reg (reg, &t);
if (!ok)
return false;
@@ -796,32 +796,32 @@
}
int
-usrp_basic_rx::read_io (int which_dboard)
+usrp_basic_rx::read_io (int which_side)
{
int value;
- if (!read_io (which_dboard, &value))
+ if (!read_io (which_side, &value))
return READ_FAILED;
return value;
}
bool
-usrp_basic_rx::write_aux_dac (int which_dboard, int which_dac, int value)
+usrp_basic_rx::write_aux_dac (int which_side, int which_dac, int value)
{
- return usrp_basic::write_aux_dac (dboard_to_slot (which_dboard),
+ return usrp_basic::write_aux_dac (dboard_to_slot (which_side),
which_dac, value);
}
bool
-usrp_basic_rx::read_aux_adc (int which_dboard, int which_adc, int *value)
+usrp_basic_rx::read_aux_adc (int which_side, int which_adc, int *value)
{
- return usrp_basic::read_aux_adc (dboard_to_slot (which_dboard),
+ return usrp_basic::read_aux_adc (dboard_to_slot (which_side),
which_adc, value);
}
int
-usrp_basic_rx::read_aux_adc (int which_dboard, int which_adc)
+usrp_basic_rx::read_aux_adc (int which_side, int which_adc)
{
- return usrp_basic::read_aux_adc (dboard_to_slot (which_dboard), which_adc);
+ return usrp_basic::read_aux_adc (dboard_to_slot (which_side), which_adc);
}
int
@@ -1095,15 +1095,15 @@
}
bool
-usrp_basic_tx::set_pga (int which, double gain)
+usrp_basic_tx::set_pga (int which_amp, double gain)
{
- if (which < 0 || which > 3)
+ if (which_amp < 0 || which_amp > 3)
return false;
gain = std::max (pga_min (), gain);
gain = std::min (pga_max (), gain);
- int codec = which >> 1; // 0 and 1 are same, as are 2 and 3
+ int codec = which_amp >> 1; // 0 and 1 are same, as are 2 and 3
int int_gain = (int) rint ((gain - pga_min ()) / pga_db_per_step());
@@ -1111,12 +1111,12 @@
}
double
-usrp_basic_tx::pga (int which) const
+usrp_basic_tx::pga (int which_amp) const
{
- if (which < 0 || which > 3)
+ if (which_amp < 0 || which_amp > 3)
return READ_FAILED;
- int codec = which >> 1;
+ int codec = which_amp >> 1;
unsigned char v;
bool ok = _read_9862 (codec, REG_TX_PGA, &v);
if (!ok)
@@ -1174,33 +1174,33 @@
}
bool
-usrp_basic_tx::_write_oe (int which_dboard, int value, int mask)
+usrp_basic_tx::_write_oe (int which_side, int value, int mask)
{
- if (! (0 <= which_dboard && which_dboard <= 1))
+ if (! (0 <= which_side && which_side <= 1))
return false;
- return _write_fpga_reg (slot_id_to_oe_reg (dboard_to_slot (which_dboard)),
+ return _write_fpga_reg (slot_id_to_oe_reg (dboard_to_slot (which_side)),
(mask << 16) | (value & 0xffff));
}
bool
-usrp_basic_tx::write_io (int which_dboard, int value, int mask)
+usrp_basic_tx::write_io (int which_side, int value, int mask)
{
- if (! (0 <= which_dboard && which_dboard <= 1))
+ if (! (0 <= which_side && which_side <= 1))
return false;
- return _write_fpga_reg (slot_id_to_io_reg (dboard_to_slot (which_dboard)),
+ return _write_fpga_reg (slot_id_to_io_reg (dboard_to_slot (which_side)),
(mask << 16) | (value & 0xffff));
}
bool
-usrp_basic_tx::read_io (int which_dboard, int *value)
+usrp_basic_tx::read_io (int which_side, int *value)
{
- if (! (0 <= which_dboard && which_dboard <= 1))
+ if (! (0 <= which_side && which_side <= 1))
return false;
int t;
- int reg = which_dboard + 1; // FIXME, *very* magic number (fix in
serial_io.v)
+ int reg = which_side + 1; // FIXME, *very* magic number (fix in
serial_io.v)
bool ok = _read_fpga_reg (reg, &t);
if (!ok)
return false;
@@ -1210,32 +1210,32 @@
}
int
-usrp_basic_tx::read_io (int which_dboard)
+usrp_basic_tx::read_io (int which_side)
{
int value;
- if (!read_io (which_dboard, &value))
+ if (!read_io (which_side, &value))
return READ_FAILED;
return value;
}
bool
-usrp_basic_tx::write_aux_dac (int which_dboard, int which_dac, int value)
+usrp_basic_tx::write_aux_dac (int which_side, int which_dac, int value)
{
- return usrp_basic::write_aux_dac (dboard_to_slot (which_dboard),
+ return usrp_basic::write_aux_dac (dboard_to_slot (which_side),
which_dac, value);
}
bool
-usrp_basic_tx::read_aux_adc (int which_dboard, int which_adc, int *value)
+usrp_basic_tx::read_aux_adc (int which_side, int which_adc, int *value)
{
- return usrp_basic::read_aux_adc (dboard_to_slot (which_dboard),
+ return usrp_basic::read_aux_adc (dboard_to_slot (which_side),
which_adc, value);
}
int
-usrp_basic_tx::read_aux_adc (int which_dboard, int which_adc)
+usrp_basic_tx::read_aux_adc (int which_side, int which_adc)
{
- return usrp_basic::read_aux_adc (dboard_to_slot (which_dboard), which_adc);
+ return usrp_basic::read_aux_adc (dboard_to_slot (which_side), which_adc);
}
int
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
2008-10-08 03:53:42 UTC (rev 9742)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
2008-10-08 04:11:42 UTC (rev 9743)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2004 Free Software Foundation, Inc.
+ * Copyright 2003,2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -172,7 +172,7 @@
* \param which which ADC[0,3]: 0 = RX_A I, 1 = RX_A Q...
* \param offset 16-bit value to subtract from raw ADC input.
*/
- bool set_adc_offset (int which, int offset);
+ bool set_adc_offset (int which_adc, int offset);
/*!
* \brief Set DAC offset correction
@@ -181,7 +181,7 @@
* \param offset_pin 1-bit value. If 0 offset applied to -ve differential
pin;
* If 1 offset applied to +ve differential
pin.
*/
- bool set_dac_offset (int which, int offset, int offset_pin);
+ bool set_dac_offset (int which_dac, int offset, int offset_pin);
/*!
* \brief Control ADC input buffer
@@ -189,7 +189,7 @@
* \param bypass if non-zero, bypass input buffer and connect input
* directly to switched cap SHA input of RxPGA.
*/
- bool set_adc_buffer_bypass (int which, bool bypass);
+ bool set_adc_buffer_bypass (int which_adc, bool bypass);
/*!
@@ -204,7 +204,7 @@
// You probably shouldn't be using these...
//
- bool _set_led (int which, bool on);
+ bool _set_led (int which_led, bool on);
/*!
* \brief Write FPGA register.
@@ -399,20 +399,20 @@
/*!
* \brief Return daughterboard ID for given Rx daughterboard slot [0,1].
*
- * \param which_dboard [0,1] which Rx daughterboard
+ * \param which_side [0,1] which Rx daughterboard
*
* \return daughterboard id >= 0 if successful
* \return -1 if no daugherboard
* \return -2 if invalid EEPROM on daughterboard
*/
- int daughterboard_id (int which_dboard) const { return d_dbid[which_dboard &
0x1]; }
+ int daughterboard_id (int which_side) const { return d_dbid[which_side &
0x1]; }
// ----------------------------------------------------------------
// routines for controlling the Programmable Gain Amplifier
/*!
* \brief Set Programmable Gain Amplifier (PGA)
*
- * \param which which A/D [0,3]
+ * \param which_amp which A/D [0,3]
* \param gain_in_db gain value (linear in dB)
*
* gain is rounded to closest setting supported by hardware.
@@ -421,14 +421,14 @@
*
* \sa pga_min(), pga_max(), pga_db_per_step()
*/
- bool set_pga (int which, double gain_in_db);
+ bool set_pga (int which_amp, double gain_in_db);
/*!
* \brief Return programmable gain amplifier gain setting in dB.
*
- * \param which which A/D [0,3]
+ * \param which_amp which A/D [0,3]
*/
- double pga (int which) const;
+ double pga (int which_amp) const;
/*!
* \brief Return minimum legal PGA gain in dB.
@@ -448,9 +448,9 @@
/*!
* \brief Write direction register (output enables) for pins that go to
daughterboard.
*
- * \param which_dboard [0,1] which d'board
- * \param value value to write into register
- * \param mask which bits of value to write into reg
+ * \param which_side [0,1] which d'board
+ * \param value value to write into register
+ * \param mask which bits of value to write into reg
*
* Each d'board has 16-bits of general purpose i/o.
* Setting the bit makes it an output from the FPGA to the d'board.
@@ -460,63 +460,63 @@
* without a very good reason. Using this method incorrectly will
* kill your USRP motherboard and/or daughterboard.
*/
- bool _write_oe (int which_dboard, int value, int mask);
+ bool _write_oe (int which_side, int value, int mask);
/*!
* \brief Write daughterboard i/o pin value
*
- * \param which_dboard [0,1] which d'board
- * \param value value to write into register
- * \param mask which bits of value to write into reg
+ * \param which_side [0,1] which d'board
+ * \param value value to write into register
+ * \param mask which bits of value to write into reg
*/
- bool write_io (int which_dboard, int value, int mask);
+ bool write_io (int which_side, int value, int mask);
/*!
* \brief Read daughterboard i/o pin value
*
- * \param which_dboard [0,1] which d'board
- * \param value output
+ * \param which_side [0,1] which d'board
+ * \param value output
*/
- bool read_io (int which_dboard, int *value);
+ bool read_io (int which_side, int *value);
/*!
* \brief Read daughterboard i/o pin value
*
- * \param which_dboard [0,1] which d'board
+ * \param which_side [0,1] which d'board
* \returns register value if successful, else READ_FAILED
*/
- int read_io (int which_dboard);
+ int read_io (int which_side);
/*!
* \brief Write auxiliary digital to analog converter.
*
- * \param which_dboard [0,1] which d'board
- * N.B., SLOT_TX_A and SLOT_RX_A share the same
AUX DAC's.
- * SLOT_TX_B and SLOT_RX_B share the same AUX
DAC's.
- * \param which_dac [2,3] TX slots must use only 2 and 3.
- * \param value [0,4095]
+ * \param which_side [0,1] which d'board
+ * N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's.
+ * SLOT_TX_B and SLOT_RX_B share the same AUX DAC's.
+ * \param which_dac [2,3] TX slots must use only 2 and 3.
+ * \param value [0,4095]
* \returns true iff successful
*/
- bool write_aux_dac (int which_board, int which_dac, int value);
+ bool write_aux_dac (int which_side, int which_dac, int value);
/*!
* \brief Read auxiliary analog to digital converter.
*
- * \param which_dboard [0,1] which d'board
- * \param which_adc [0,1]
- * \param value return 12-bit value [0,4095]
+ * \param which_side [0,1] which d'board
+ * \param which_adc [0,1]
+ * \param value return 12-bit value [0,4095]
* \returns true iff successful
*/
- bool read_aux_adc (int which_dboard, int which_adc, int *value);
+ bool read_aux_adc (int which_side, int which_adc, int *value);
/*!
* \brief Read auxiliary analog to digital converter.
*
- * \param which_dboard [0,1] which d'board
+ * \param which_side [0,1] which d'board
* \param which_adc [0,1]
* \returns value in the range [0,4095] if successful, else READ_FAILED.
*/
- int read_aux_adc (int which_dboard, int which_adc);
+ int read_aux_adc (int which_side, int which_adc);
/*!
* \brief returns current fusb block size
@@ -648,14 +648,14 @@
* \return -1 if no daugherboard
* \return -2 if invalid EEPROM on daughterboard
*/
- int daughterboard_id (int which_dboard) const { return d_dbid[which_dboard &
0x1]; }
+ int daughterboard_id (int which_side) const { return d_dbid[which_side &
0x1]; }
// ----------------------------------------------------------------
// routines for controlling the Programmable Gain Amplifier
/*!
* \brief Set Programmable Gain Amplifier (PGA)
*
- * \param which which D/A [0,3]
+ * \param which_amp which D/A [0,3]
* \param gain_in_db gain value (linear in dB)
*
* gain is rounded to closest setting supported by hardware.
@@ -666,14 +666,14 @@
*
* \sa pga_min(), pga_max(), pga_db_per_step()
*/
- bool set_pga (int which, double gain_in_db);
+ bool set_pga (int which_amp, double gain_in_db);
/*!
* \brief Return programmable gain amplifier gain in dB.
*
- * \param which which D/A [0,3]
+ * \param which_amp which D/A [0,3]
*/
- double pga (int which) const;
+ double pga (int which_amp) const;
/*!
* \brief Return minimum legal PGA gain in dB.
@@ -693,9 +693,9 @@
/*!
* \brief Write direction register (output enables) for pins that go to
daughterboard.
*
- * \param which_dboard [0,1] which d'board
- * \param value value to write into register
- * \param mask which bits of value to write into reg
+ * \param which_side [0,1] which d'board
+ * \param value value to write into register
+ * \param mask which bits of value to write into reg
*
* Each d'board has 16-bits of general purpose i/o.
* Setting the bit makes it an output from the FPGA to the d'board.
@@ -705,63 +705,63 @@
* without a very good reason. Using this method incorrectly will
* kill your USRP motherboard and/or daughterboard.
*/
- bool _write_oe (int which_dboard, int value, int mask);
+ bool _write_oe (int which_side, int value, int mask);
/*!
* \brief Write daughterboard i/o pin value
*
- * \param which_dboard [0,1] which d'board
+ * \param which_side [0,1] which d'board
* \param value value to write into register
* \param mask which bits of value to write into reg
*/
- bool write_io (int which_dboard, int value, int mask);
+ bool write_io (int which_side, int value, int mask);
/*!
* \brief Read daughterboard i/o pin value
*
- * \param which_dboard [0,1] which d'board
+ * \param which_side [0,1] which d'board
* \param value return value
*/
- bool read_io (int which_dboard, int *value);
+ bool read_io (int which_side, int *value);
/*!
* \brief Read daughterboard i/o pin value
*
- * \param which_dboard [0,1] which d'board
+ * \param which_side [0,1] which d'board
* \returns register value if successful, else READ_FAILED
*/
- int read_io (int which_dboard);
+ int read_io (int which_side);
/*!
* \brief Write auxiliary digital to analog converter.
*
- * \param which_dboard [0,1] which d'board
- * N.B., SLOT_TX_A and SLOT_RX_A share the same
AUX DAC's.
- * SLOT_TX_B and SLOT_RX_B share the same AUX
DAC's.
- * \param which_dac [2,3] TX slots must use only 2 and 3.
- * \param value [0,4095]
+ * \param which_side [0,1] which d'board
+ * N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's.
+ * SLOT_TX_B and SLOT_RX_B share the same AUX DAC's.
+ * \param which_dac [2,3] TX slots must use only 2 and 3.
+ * \param value [0,4095]
* \returns true iff successful
*/
- bool write_aux_dac (int which_board, int which_dac, int value);
+ bool write_aux_dac (int which_side, int which_dac, int value);
/*!
* \brief Read auxiliary analog to digital converter.
*
- * \param which_dboard [0,1] which d'board
- * \param which_adc [0,1]
- * \param value return 12-bit value [0,4095]
+ * \param which_side [0,1] which d'board
+ * \param which_adc [0,1]
+ * \param value return 12-bit value [0,4095]
* \returns true iff successful
*/
- bool read_aux_adc (int which_dboard, int which_adc, int *value);
+ bool read_aux_adc (int which_side, int which_adc, int *value);
/*!
* \brief Read auxiliary analog to digital converter.
*
- * \param which_dboard [0,1] which d'board
- * \param which_adc [0,1]
+ * \param which_side [0,1] which d'board
+ * \param which_adc [0,1]
* \returns value in the range [0,4095] if successful, else READ_FAILED.
*/
- int read_aux_adc (int which_dboard, int which_adc);
+ int read_aux_adc (int which_side, int which_adc);
/*!
* \brief returns current fusb block size
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9743 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy,
eb <=