diff options
author | Martin Braun <martin.braun@ettus.com> | 2015-01-13 09:45:55 +0100 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-01-13 09:45:55 +0100 |
commit | be5f9613311d944b8971570bff444c5af094f0f5 (patch) | |
tree | 6e97e48801fe10a61244c2f4e36ef7f28a6e3c57 /host/lib/usrp/common/ad9361_driver/ad9361_device.cpp | |
parent | d15fe9bc22efe4d0499a9108659e32c93e0a2848 (diff) | |
parent | 23729861a2020359b9c920347bd2d7c43d96ebf8 (diff) | |
download | uhd-be5f9613311d944b8971570bff444c5af094f0f5.tar.gz uhd-be5f9613311d944b8971570bff444c5af094f0f5.tar.bz2 uhd-be5f9613311d944b8971570bff444c5af094f0f5.zip |
Merge branch 'maint'
Diffstat (limited to 'host/lib/usrp/common/ad9361_driver/ad9361_device.cpp')
-rw-r--r-- | host/lib/usrp/common/ad9361_driver/ad9361_device.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp index d56cedec9..b5e116a70 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp @@ -1911,4 +1911,26 @@ void ad9361_device_t::data_port_loopback(const bool loopback_enabled) _io_iface->poke8(0x3F5, (loopback_enabled ? 0x01 : 0x00)); } +/* Read back the internal RSSI measurement data. The result is in dB + * but not in absolute units. If absolute units are required + * a bench calibration should be done. + * -0.25dB / bit 9bit resolution.*/ +double ad9361_device_t::get_rssi(chain_t chain) +{ + boost::uint32_t reg_rssi = 0; + boost::uint8_t lsb_bit_pos = 0; + if (chain == CHAIN_1) { + reg_rssi = 0x1A7; + lsb_bit_pos = 0; + }else { + reg_rssi = 0x1A9; + lsb_bit_pos = 1; + } + boost::uint8_t msbs = _io_iface->peek8(reg_rssi); + boost::uint8_t lsb = ((_io_iface->peek8(0x1AB)) >> lsb_bit_pos) & 0x01; + boost::uint16_t val = ((msbs << 1) | lsb); + double rssi = (-0.25f * ((double)val)); //-0.25dB/lsb (See Gain Control Users Guide p. 25) + return rssi; +} + }} |