diff options
author | Josh Blum <josh@joshknows.com> | 2011-02-24 16:35:29 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-02-24 16:35:29 -0800 |
commit | 4357f5d3c043245b5c086b20742795624af9f432 (patch) | |
tree | 7a3cfc9f5b3ffc285ecd611655d741355dcb39b8 /host/lib/usrp | |
parent | 16f08844d7b6ccbdcfdf17963b88cadb7525ddc6 (diff) | |
download | uhd-4357f5d3c043245b5c086b20742795624af9f432.tar.gz uhd-4357f5d3c043245b5c086b20742795624af9f432.tar.bz2 uhd-4357f5d3c043245b5c086b20742795624af9f432.zip |
uhd: replaced instanced of std::exception with the uhd exceptions
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/dboard/db_basic_and_lf.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard_base.cpp | 16 | ||||
-rw-r--r-- | host/lib/usrp/dboard_manager.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/gps_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/misc_utils.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/subdev_spec.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/dboard_iface.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/mboard_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/codec_ctrl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 7 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/clock_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/dboard_iface.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/fpga_downloader.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/mboard_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/usrp_e100_iface.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/usrp_e100_impl.cpp | 6 |
20 files changed, 52 insertions, 52 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index 3de9adbec..3fffeab0c 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -193,7 +193,7 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){ case SUBDEV_PROP_ANTENNA: if (val.as<std::string>().empty()) return; - throw std::runtime_error("no selectable antennas on this board"); + throw uhd::value_error("no selectable antennas on this board"); case SUBDEV_PROP_FREQ: return; // it wont do you much good, but you can set it @@ -300,7 +300,7 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){ case SUBDEV_PROP_ANTENNA: if (val.as<std::string>().empty()) return; - throw std::runtime_error("no selectable antennas on this board"); + throw uhd::value_error("no selectable antennas on this board"); case SUBDEV_PROP_FREQ: return; // it wont do you much good, but you can set it diff --git a/host/lib/usrp/dboard_base.cpp b/host/lib/usrp/dboard_base.cpp index 6c4e29d9e..999dd9ffc 100644 --- a/host/lib/usrp/dboard_base.cpp +++ b/host/lib/usrp/dboard_base.cpp @@ -59,12 +59,12 @@ dboard_id_t dboard_base::get_tx_id(void){ **********************************************************************/ xcvr_dboard_base::xcvr_dboard_base(ctor_args_t args) : dboard_base(args){ if (get_rx_id() == dboard_id_t::none()){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "cannot create xcvr board when the rx id is \"%s\"" ) % dboard_id_t::none().to_pp_string())); } if (get_tx_id() == dboard_id_t::none()){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "cannot create xcvr board when the tx id is \"%s\"" ) % dboard_id_t::none().to_pp_string())); } @@ -79,7 +79,7 @@ xcvr_dboard_base::~xcvr_dboard_base(void){ **********************************************************************/ rx_dboard_base::rx_dboard_base(ctor_args_t args) : dboard_base(args){ if (get_tx_id() != dboard_id_t::none()){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "cannot create rx board when the tx id is \"%s\"" " -> expected a tx id of \"%s\"" ) % get_tx_id().to_pp_string() % dboard_id_t::none().to_pp_string())); @@ -91,11 +91,11 @@ rx_dboard_base::~rx_dboard_base(void){ } void rx_dboard_base::tx_get(const wax::obj &, wax::obj &){ - throw std::runtime_error("cannot call tx_get on a rx dboard"); + throw uhd::runtime_error("cannot call tx_get on a rx dboard"); } void rx_dboard_base::tx_set(const wax::obj &, const wax::obj &){ - throw std::runtime_error("cannot call tx_set on a rx dboard"); + throw uhd::runtime_error("cannot call tx_set on a rx dboard"); } /*********************************************************************** @@ -103,7 +103,7 @@ void rx_dboard_base::tx_set(const wax::obj &, const wax::obj &){ **********************************************************************/ tx_dboard_base::tx_dboard_base(ctor_args_t args) : dboard_base(args){ if (get_rx_id() != dboard_id_t::none()){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "cannot create tx board when the rx id is \"%s\"" " -> expected a rx id of \"%s\"" ) % get_rx_id().to_pp_string() % dboard_id_t::none().to_pp_string())); @@ -115,9 +115,9 @@ tx_dboard_base::~tx_dboard_base(void){ } void tx_dboard_base::rx_get(const wax::obj &, wax::obj &){ - throw std::runtime_error("cannot call rx_get on a tx dboard"); + throw uhd::runtime_error("cannot call rx_get on a tx dboard"); } void tx_dboard_base::rx_set(const wax::obj &, const wax::obj &){ - throw std::runtime_error("cannot call rx_set on a tx dboard"); + throw uhd::runtime_error("cannot call rx_set on a tx dboard"); } diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index f9d43901d..9055905b1 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -50,7 +50,7 @@ void dboard_manager::register_dboard( ){ //std::cout << "registering: " << name << std::endl; if (get_id_to_args_map().has_key(dboard_id)){ - throw std::runtime_error(str(boost::format( + throw uhd::key_error(str(boost::format( "The dboard id %s is already registered to %s." ) % dboard_id.to_string() % dboard_id.to_pp_string())); } @@ -315,7 +315,7 @@ prop_names_t dboard_manager_impl::get_tx_subdev_names(void){ } wax::obj dboard_manager_impl::get_rx_subdev(const std::string &subdev_name){ - if (not _rx_dboards.has_key(subdev_name)) throw std::invalid_argument( + if (not _rx_dboards.has_key(subdev_name)) throw uhd::key_error( str(boost::format("Unknown rx subdev name %s") % subdev_name) ); //get a link to the rx subdev proxy @@ -323,7 +323,7 @@ wax::obj dboard_manager_impl::get_rx_subdev(const std::string &subdev_name){ } wax::obj dboard_manager_impl::get_tx_subdev(const std::string &subdev_name){ - if (not _tx_dboards.has_key(subdev_name)) throw std::invalid_argument( + if (not _tx_dboards.has_key(subdev_name)) throw uhd::key_error( str(boost::format("Unknown tx subdev name %s") % subdev_name) ); //get a link to the tx subdev proxy diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index e868568a0..e0ab6de90 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -167,7 +167,7 @@ public: break; case GPS_TYPE_NONE: default: - throw std::runtime_error("get_time(): Unsupported GPS or no GPS detected\n"); + throw uhd::runtime_error("get_time(): Unsupported GPS or no GPS detected\n"); break; } return now; diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp index 9074c3fe6..6fcbdfe3d 100644 --- a/host/lib/usrp/misc_utils.cpp +++ b/host/lib/usrp/misc_utils.cpp @@ -167,7 +167,7 @@ static void verify_xx_subdev_spec( BOOST_FOREACH(subdev_spec_pair_t &pair, subdev_spec){ //empty db name means select dboard automatically if (pair.db_name.empty()){ - if (dboard_names.size() != 1) throw std::runtime_error( + if (dboard_names.size() != 1) throw uhd::value_error( "A daughterboard name must be provided for multi-slot motherboards: " + subdev_spec.to_string() ); pair.db_name = dboard_names.front(); @@ -178,7 +178,7 @@ static void verify_xx_subdev_spec( //empty sd name means select the subdev automatically if (pair.sd_name.empty()){ - if (subdev_names.size() != 1) throw std::runtime_error( + if (subdev_names.size() != 1) throw uhd::value_error( "A subdevice name must be provided for multi-subdev daughterboards: " + subdev_spec.to_string() ); pair.sd_name = subdev_names.front(); @@ -186,7 +186,7 @@ static void verify_xx_subdev_spec( uhd::assert_has(subdev_names, pair.sd_name, xx_type + " subdev name"); } }catch(const std::exception &e){ - throw std::runtime_error(str(boost::format( + throw uhd::value_error(str(boost::format( "Validate %s subdev spec failed: %s\n %s" ) % xx_type % subdev_spec.to_string() % e.what())); } @@ -200,7 +200,7 @@ static void verify_xx_subdev_spec( dboard[named_prop_t(DBOARD_PROP_SUBDEV, sd_name)][SUBDEV_PROP_ENABLED] = enable; } catch(const std::exception &e){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "Cannot set enabled property on subdevice %s:%s\n %s" ) % db_name % sd_name % e.what())); } diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 3329ea4fe..0acc53397 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -29,7 +29,6 @@ #include <boost/thread.hpp> #include <boost/foreach.hpp> #include <boost/format.hpp> -#include <stdexcept> #include <iostream> using namespace uhd; @@ -153,7 +152,7 @@ public: while(true){ if (get_time_last_pps() != time_start_last_pps) break; if ((get_time_now() - time_start) > time_spec_t(1.1)){ - throw std::runtime_error( + throw uhd::runtime_error( "Board 0 may not be getting a PPS signal!\n" "No PPS detected within the time interval.\n" "See the application notes for your device.\n" diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index d5d950f1f..6912afec8 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -16,11 +16,11 @@ // #include <uhd/usrp/subdev_spec.hpp> +#include <uhd/exception.hpp> #include <boost/algorithm/string.hpp> //for split #include <boost/tokenizer.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> -#include <stdexcept> #include <sstream> #include <vector> @@ -51,7 +51,7 @@ subdev_spec_t::subdev_spec_t(const std::string &markup){ switch(db_sd.size()){ case 1: this->push_back(subdev_spec_pair_t("", db_sd.front())); break; case 2: this->push_back(subdev_spec_pair_t(db_sd.front(), db_sd.back())); break; - default: throw std::runtime_error("invalid subdev-spec markup string: "+markup); + default: throw uhd::value_error("invalid subdev-spec markup string: "+markup); } } } diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp index 67da51ee9..53ccd4d55 100644 --- a/host/lib/usrp/usrp1/dboard_iface.cpp +++ b/host/lib/usrp/usrp1/dboard_iface.cpp @@ -329,7 +329,7 @@ static boost::uint32_t unit_to_otw_spi_dev(dboard_iface::unit_t unit, else break; } - throw std::invalid_argument("unknown unit type"); + UHD_THROW_INVALID_CODE_PATH(); } void usrp1_dboard_iface::write_spi(unit_t unit, diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 9f0512d6d..4e2fad6e5 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.cpp @@ -161,7 +161,7 @@ static boost::uint32_t calc_tx_mux( //sanity check, only 1 channel per slot slot_to_chan_count[pair.db_name]++; if (slot_to_chan_count[pair.db_name] > 1){ - throw std::runtime_error(str(boost::format( + throw uhd::value_error(str(boost::format( "dboard slot %s assigned to multiple channels in subdev spec %s" ) % pair.db_name % subdev_spec.to_string())); } @@ -343,7 +343,7 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val) case MBOARD_PROP_RX_SUBDEV_SPEC: _rx_subdev_spec = val.as<subdev_spec_t>(); if (_rx_subdev_spec.size() > this->get_num_ddcs()){ - throw std::runtime_error(str(boost::format( + throw uhd::value_error(str(boost::format( "USRP1 suports up to %u RX channels.\n" "However, this RX subdev spec requires %u channels\n" ) % this->get_num_ddcs() % _rx_subdev_spec.size())); @@ -356,7 +356,7 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val) case MBOARD_PROP_TX_SUBDEV_SPEC: _tx_subdev_spec = val.as<subdev_spec_t>(); if (_tx_subdev_spec.size() > this->get_num_ducs()){ - throw std::runtime_error(str(boost::format( + throw uhd::value_error(str(boost::format( "USRP1 suports up to %u TX channels.\n" "However, this TX subdev spec requires %u channels\n" ) % this->get_num_ducs() % _tx_subdev_spec.size())); diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index 0756c7971..be5c2c899 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.cpp @@ -19,10 +19,10 @@ #include "ad9777_regs.hpp" #include "ads62p44_regs.hpp" #include "usrp2_regs.hpp" +#include <uhd/exception.hpp> #include <boost/cstdint.hpp> #include <boost/foreach.hpp> #include <iostream> -#include <uhd/exception.hpp> static const bool codec_ctrl_debug = false; @@ -118,7 +118,7 @@ public: case 2: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_FS_2; break; case 4: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_FS_4; break; case 8: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_FS_8; break; - default: throw std::runtime_error("unknown modulation mode for ad9777"); + default: throw uhd::value_error("unknown modulation mode for ad9777"); } this->send_ad9777_reg(0x01); //set the register diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index b4f3e0873..082d77d3e 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -18,6 +18,7 @@ #include "../../transport/vrt_packet_handler.hpp" #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" +#include <uhd/exception.hpp> #include <uhd/usrp/mboard_props.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/utils/thread_priority.hpp> diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index f59b7b7dd..9049d4025 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -17,12 +17,12 @@ #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" +#include <uhd/exception.hpp> #include <uhd/usrp/gps_ctrl.hpp> #include <uhd/usrp/misc_utils.hpp> #include <uhd/usrp/dsp_utils.hpp> #include <uhd/usrp/mboard_props.hpp> #include <uhd/utils/byteswap.hpp> -#include <uhd/exception.hpp> #include <uhd/utils/algorithm.hpp> #include <boost/bind.hpp> #include <iostream> @@ -118,7 +118,7 @@ usrp2_mboard_impl::usrp2_mboard_impl( else if (device_addr["mimo_mode"] == "slave"){ _mimo_clocking_mode_is_master = false; } - else throw std::runtime_error( + else throw uhd::value_error( "mimo_mode must be set to master or slave" ); } @@ -170,14 +170,14 @@ void usrp2_mboard_impl::update_clock_config(void){ //translate pps source enums switch(_clock_config.pps_source){ case clock_config_t::PPS_SMA: pps_flags |= U2_FLAG_TIME64_PPS_SMA; break; - default: throw std::runtime_error("unhandled clock configuration pps source"); + default: throw uhd::value_error("unhandled clock configuration pps source"); } //translate pps polarity enums switch(_clock_config.pps_polarity){ case clock_config_t::PPS_POS: pps_flags |= U2_FLAG_TIME64_PPS_POSEDGE; break; case clock_config_t::PPS_NEG: pps_flags |= U2_FLAG_TIME64_PPS_NEGEDGE; break; - default: throw std::runtime_error("unhandled clock configuration pps polarity"); + default: throw uhd::value_error("unhandled clock configuration pps polarity"); } //set the pps flags @@ -190,7 +190,7 @@ void usrp2_mboard_impl::update_clock_config(void){ switch(_clock_config.ref_source){ case clock_config_t::REF_INT : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x12); break; case clock_config_t::REF_SMA : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x1C); break; - default: throw std::runtime_error("unhandled clock configuration reference source"); + default: throw uhd::value_error("unhandled clock configuration reference source"); } _clock_ctrl->enable_external_ref(true); //USRP2P has an internal 10MHz TCXO break; @@ -200,7 +200,7 @@ void usrp2_mboard_impl::update_clock_config(void){ switch(_clock_config.ref_source){ case clock_config_t::REF_INT : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x10); break; case clock_config_t::REF_SMA : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x1C); break; - default: throw std::runtime_error("unhandled clock configuration reference source"); + default: throw uhd::value_error("unhandled clock configuration reference source"); } _clock_ctrl->enable_external_ref(_clock_config.ref_source != clock_config_t::REF_INT); break; diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 462ebab16..3a7ed8351 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -25,7 +25,6 @@ #include <boost/assign/list_of.hpp> #include <boost/format.hpp> #include <boost/tokenizer.hpp> -#include <stdexcept> #include <algorithm> using namespace uhd; @@ -63,7 +62,7 @@ public: //check the fpga compatibility number const boost::uint32_t fpga_compat_num = this->peek32(this->regs.compat_num_rb); if (fpga_compat_num != USRP2_FPGA_COMPAT_NUM){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "Expected fpga compatibility number %d, but got %d:\n" "The fpga build is not compatible with the host code build." ) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num)); @@ -245,7 +244,7 @@ public: while(true){ size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem), CTRL_RECV_TIMEOUT); if(len >= sizeof(boost::uint32_t) and ntohl(ctrl_data_in->proto_ver) != USRP2_FW_COMPAT_NUM){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "Expected protocol compatibility number %d, but got %d:\n" "The firmware build is not compatible with the host code build." ) % int(USRP2_FW_COMPAT_NUM) % ntohl(ctrl_data_in->proto_ver))); @@ -256,7 +255,7 @@ public: if (len == 0) break; //timeout //didnt get seq or bad packet, continue looking... } - throw std::runtime_error("no control response"); + throw uhd::runtime_error("no control response"); } rev_type get_rev(void){ diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index afd73401f..0a23e3eff 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -16,6 +16,7 @@ // #include "usrp2_impl.hpp" +#include <uhd/exception.hpp> #include <uhd/transport/if_addrs.hpp> #include <uhd/transport/udp_zero_copy.hpp> #include <uhd/usrp/device_props.hpp> @@ -47,7 +48,7 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){ device_addrs_t found_devices; BOOST_FOREACH(const device_addr_t &hint_i, hints){ device_addrs_t found_devices_i = usrp2_find(hint_i); - if (found_devices_i.size() != 1) throw std::runtime_error(str(boost::format( + if (found_devices_i.size() != 1) throw uhd::value_error(str(boost::format( "Could not resolve device hint \"%s\" to a single device." ) % hint_i.to_string())); found_devices.push_back(found_devices_i[0]); diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp index 6128894cc..b4ddcd271 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp @@ -158,7 +158,7 @@ static clock_settings_type get_clock_settings(double rate){ } } - throw std::runtime_error(str(boost::format( + throw uhd::value_error(str(boost::format( "USRP-E100 clock control: could not calculate settings for clock rate %fMHz" ) % (rate/1e6))); } diff --git a/host/lib/usrp/usrp_e100/dboard_iface.cpp b/host/lib/usrp/usrp_e100/dboard_iface.cpp index ee6ca3933..ee1b852bf 100644 --- a/host/lib/usrp/usrp_e100/dboard_iface.cpp +++ b/host/lib/usrp/usrp_e100/dboard_iface.cpp @@ -235,7 +235,7 @@ static boost::uint32_t unit_to_otw_spi_dev(dboard_iface::unit_t unit){ case dboard_iface::UNIT_TX: return UE_SPI_SS_TX_DB; case dboard_iface::UNIT_RX: return UE_SPI_SS_RX_DB; } - throw std::invalid_argument("unknown unit type"); + UHD_THROW_INVALID_CODE_PATH(); } void usrp_e100_dboard_iface::write_spi( diff --git a/host/lib/usrp/usrp_e100/fpga_downloader.cpp b/host/lib/usrp/usrp_e100/fpga_downloader.cpp index 9836cbc02..95665da83 100644 --- a/host/lib/usrp/usrp_e100/fpga_downloader.cpp +++ b/host/lib/usrp/usrp_e100/fpga_downloader.cpp @@ -87,7 +87,7 @@ gpio::gpio(unsigned int gpio_num, gpio_direction pin_direction) std::fstream export_file; export_file.open("/sys/class/gpio/export", std::ios::out); - if (not export_file.is_open()) throw std::runtime_error( + if (not export_file.is_open()) throw uhd::os_error( "Failed to open gpio export file." ); @@ -211,7 +211,7 @@ static void send_file_to_fpga(const std::string &file_name, gpio &error, gpio &d std::ifstream bitstream; bitstream.open(file_name.c_str(), std::ios::binary); - if (!bitstream.is_open()) throw std::runtime_error( + if (!bitstream.is_open()) throw uhd::os_error( "Coult not open the file: " + file_name ); diff --git a/host/lib/usrp/usrp_e100/mboard_impl.cpp b/host/lib/usrp/usrp_e100/mboard_impl.cpp index 07476bd6c..cec4fd0ad 100644 --- a/host/lib/usrp/usrp_e100/mboard_impl.cpp +++ b/host/lib/usrp/usrp_e100/mboard_impl.cpp @@ -17,9 +17,9 @@ #include "usrp_e100_impl.hpp" #include "usrp_e100_regs.hpp" +#include <uhd/exception.hpp> #include <uhd/usrp/dsp_utils.hpp> #include <uhd/usrp/misc_utils.hpp> -#include <uhd/exception.hpp> #include <uhd/usrp/mboard_props.hpp> #include <boost/bind.hpp> #include <iostream> @@ -53,7 +53,7 @@ void usrp_e100_impl::update_clock_config(void){ switch(_clock_config.pps_polarity){ case clock_config_t::PPS_POS: pps_flags |= UE_FLAG_TIME64_PPS_POSEDGE; break; case clock_config_t::PPS_NEG: pps_flags |= UE_FLAG_TIME64_PPS_NEGEDGE; break; - default: throw std::runtime_error("unhandled clock configuration pps polarity"); + default: throw uhd::value_error("unhandled clock configuration pps polarity"); } //set the pps flags @@ -64,7 +64,7 @@ void usrp_e100_impl::update_clock_config(void){ case clock_config_t::REF_AUTO: _clock_ctrl->use_auto_ref(); break; case clock_config_t::REF_INT: _clock_ctrl->use_internal_ref(); break; case clock_config_t::REF_SMA: _clock_ctrl->use_auto_ref(); break; - default: throw std::runtime_error("unhandled clock configuration ref source"); + default: throw uhd::value_error("unhandled clock configuration ref source"); } } diff --git a/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp b/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp index 687008df8..076ec2fd6 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp @@ -37,7 +37,7 @@ class i2c_dev_iface : public i2c_iface{ public: i2c_dev_iface(const std::string &node){ if ((_node_fd = ::open(node.c_str(), O_RDWR)) < 0){ - throw std::runtime_error("Failed to open " + node); + throw uhd::io_error("Failed to open " + node); } } @@ -106,7 +106,7 @@ public: { //open the device node and check file descriptor if ((_node_fd = ::open(node.c_str(), O_RDWR)) < 0){ - throw std::runtime_error("Failed to open " + node); + throw uhd::io_error("Failed to open " + node); } //very first thing, reset all the wishbone, always do first! @@ -127,7 +127,7 @@ public: boost::mutex::scoped_lock lock(_ctrl_mutex); if (::ioctl(_node_fd, request, mem) < 0){ - throw std::runtime_error(str( + throw uhd::os_error(str( boost::format("ioctl failed with request %d") % request )); } diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp index d4404fc88..1385688e0 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 @@ -103,7 +103,7 @@ static device::sptr usrp_e100_make(const device_addr_t &device_addr){ size_t fpga_hash = 0; { std::ifstream file(usrp_e100_fpga_image.c_str()); - if (not file.good()) throw std::runtime_error( + if (not file.good()) throw uhd::io_error( "cannot open fpga file for read: " + usrp_e100_fpga_image ); do{ @@ -132,7 +132,7 @@ static device::sptr usrp_e100_make(const device_addr_t &device_addr){ //check that the compatibility is correct fpga_compat_num = iface->peek16(UE_REG_MISC_COMPAT); if (fpga_compat_num != USRP_E_COMPAT_NUM){ - throw std::runtime_error(str(boost::format( + throw uhd::runtime_error(str(boost::format( "Expected fpga compatibility number 0x%x, but got 0x%x:\n" "The fpga build is not compatible with the host code build." ) % USRP_E_COMPAT_NUM % fpga_compat_num)); |