From 39b17fd7c18ad7896823f1d45bbb65e27325e198 Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Tue, 13 Jan 2015 10:21:10 +0100 Subject: e300: Changed (max) serial number from 6 to 8. This works without hickup because we store the serial as a \0 terminated string. Note: We now also write the data version fields, as they might come in handy one day. Signed-off-by: Moritz Fischer --- host/lib/usrp/e300/e300_eeprom_manager.cpp | 9 +++++++++ host/lib/usrp/e300/e300_eeprom_manager.hpp | 14 ++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/e300/e300_eeprom_manager.cpp b/host/lib/usrp/e300/e300_eeprom_manager.cpp index af1235b6b..dad6741f5 100644 --- a/host/lib/usrp/e300/e300_eeprom_manager.cpp +++ b/host/lib/usrp/e300/e300_eeprom_manager.cpp @@ -126,6 +126,10 @@ void e300_eeprom_manager::write_db_eeprom(const dboard_eeprom_t& eeprom) db_eeprom_map_t &map = *map_ptr; + // set the data version, that can be used to distinguish eeprom layouts + map.data_version_major = E310_DB_MAP_MAJOR; + map.data_version_minor = E310_DB_MAP_MINOR; + if (_db_eeprom.id != dboard_id_t::none()) { map.hw_product = uhd::htonx( _db_eeprom.id.to_uint16()); @@ -160,6 +164,11 @@ void e300_eeprom_manager::write_mb_eeprom(const mboard_eeprom_t& eeprom) mb_eeprom_map_t &map = *map_ptr; + // set the data version, that can be used to distinguish eeprom layouts + map.data_version_major = E310_MB_MAP_MAJOR; + map.data_version_minor = E310_MB_MAP_MINOR; + + if (_mb_eeprom.has_key("product")) { map.hw_product = uhd::htonx( boost::lexical_cast(_mb_eeprom["product"])); diff --git a/host/lib/usrp/e300/e300_eeprom_manager.hpp b/host/lib/usrp/e300/e300_eeprom_manager.hpp index e77f25ed5..86d7c3463 100644 --- a/host/lib/usrp/e300/e300_eeprom_manager.hpp +++ b/host/lib/usrp/e300/e300_eeprom_manager.hpp @@ -34,6 +34,12 @@ static const boost::uint16_t E310_MB_PID = 0x77d2; static const boost::uint16_t E300_DB_PID = 0x0100; static const boost::uint16_t E310_DB_PID = 0x0110; +static const boost::uint16_t E310_MB_MAP_MAJOR = 0x0001; +static const boost::uint16_t E310_MB_MAP_MINOR = 0x0000; + +static const boost::uint16_t E310_DB_MAP_MAJOR = 0x0001; +static const boost::uint16_t E310_DB_MAP_MINOR = 0x0000; + class e300_eeprom_manager : boost::noncopyable { public: @@ -69,11 +75,11 @@ public: std::string get_mb_type_string(void) const; private: // types - const static size_t MB_SERIAL_LEN = 6; + const static size_t MB_SERIAL_LEN = 8; const static size_t MB_NAME_LEN = 32; const static size_t MB_ADDR = 0x51; - const static size_t DB_SERIAL_LEN = 6; + const static size_t DB_SERIAL_LEN = 8; const static size_t DB_ADDR = 0x50; struct mb_eeprom_map_t @@ -108,8 +114,8 @@ private: // types boost::uint16_t hw_revision; // serial - boost::uint8_t serial[MB_SERIAL_LEN]; - boost::uint8_t pad[20 - MB_SERIAL_LEN]; + boost::uint8_t serial[DB_SERIAL_LEN]; + boost::uint8_t pad[20 - DB_SERIAL_LEN]; }; private: // members -- cgit v1.2.3 From fd2e2156ea5c263bf8c6d098980e4873b55de18e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 19 Jan 2015 15:32:01 +0100 Subject: uhd: Added direction type --- host/include/uhd/types/CMakeLists.txt | 3 ++- host/include/uhd/types/direction.hpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 host/include/uhd/types/direction.hpp (limited to 'host') diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt index 0c6b7bd7a..8bb1de381 100644 --- a/host/include/uhd/types/CMakeLists.txt +++ b/host/include/uhd/types/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2010-2011 Ettus Research LLC +# Copyright 2010-2011,2015 Ettus Research LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ UHD_INSTALL(FILES device_addr.hpp dict.ipp dict.hpp + direction.hpp endianness.hpp io_type.hpp mac_addr.hpp diff --git a/host/include/uhd/types/direction.hpp b/host/include/uhd/types/direction.hpp new file mode 100644 index 000000000..0f257de44 --- /dev/null +++ b/host/include/uhd/types/direction.hpp @@ -0,0 +1,34 @@ +// +// Copyright 2015 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#ifndef INCLUDED_UHD_TYPES_DIRECTION_HPP +#define INCLUDED_UHD_TYPES_DIRECTION_HPP + +namespace uhd { + + enum direction_t { + //! Receive + RX_DIRECTION, + //! Transmit + TX_DIRECTION, + //! Duplex + DX_DIRECTION + }; + +} //namespace uhd + +#endif /* INCLUDED_UHD_TYPES_DIRECTION_HPP */ -- cgit v1.2.3 From 876269193db3392247e4af57bbfbdd7e8b433895 Mon Sep 17 00:00:00 2001 From: Jon Kiser Date: Thu, 15 Jan 2015 15:59:44 -0800 Subject: ad9361: bugfix for ad9361 gain value truncation --- host/lib/usrp/common/ad9361_driver/ad9361_device.cpp | 14 +++++++++----- host/lib/usrp/common/ad9361_driver/ad9361_device.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp index 3abcdc157..7e574920a 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp @@ -1872,10 +1872,10 @@ double ad9361_device_t::set_gain(direction_t direction, chain_t chain, const dou gain_index = 0; if (chain == CHAIN_1) { - _rx1_gain = boost::uint32_t(value); + _rx1_gain = value; _io_iface->poke8(0x109, gain_index); } else { - _rx2_gain = boost::uint32_t(value); + _rx2_gain = value; _io_iface->poke8(0x10c, gain_index); } @@ -1888,15 +1888,19 @@ double ad9361_device_t::set_gain(direction_t direction, chain_t chain, const dou /* Each gain step is -0.25dB. Calculate the attenuation necessary * for the requested gain, convert it into gain steps, then write - * the attenuation word. Max gain (so zero attenuation) is 89.75. */ + * the attenuation word. Max gain (so zero attenuation) is 89.75. + * Ugly values will be written to the attenuation registers if + * "value" is out of bounds, so range checking must be performed + * outside this function. + */ double atten = AD9361_MAX_GAIN - value; boost::uint32_t attenreg = boost::uint32_t(atten * 4); if (chain == CHAIN_1) { - _tx1_gain = boost::uint32_t(value); + _tx1_gain = value; _io_iface->poke8(0x073, attenreg & 0xFF); _io_iface->poke8(0x074, (attenreg >> 8) & 0x01); } else { - _tx2_gain = boost::uint32_t(value); + _tx2_gain = value; _io_iface->poke8(0x075, attenreg & 0xFF); _io_iface->poke8(0x076, (attenreg >> 8) & 0x01); } diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.h b/host/lib/usrp/common/ad9361_driver/ad9361_device.h index bd93bd06b..fead90424 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h @@ -116,7 +116,7 @@ private: //Members double _req_clock_rate, _req_coreclk; boost::uint16_t _rx_bbf_tunediv; boost::uint8_t _curr_gain_table; - boost::uint32_t _rx1_gain, _rx2_gain, _tx1_gain, _tx2_gain; + double _rx1_gain, _rx2_gain, _tx1_gain, _tx2_gain; boost::int32_t _tfir_factor; boost::int32_t _rfir_factor; //Register soft-copies -- cgit v1.2.3