From a6e18604befdb6a954542f7722c8d55424065621 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Thu, 17 Jul 2014 11:50:50 -0700 Subject: OctoClock firmware upgrade, added host driver * OctoClock can communicate with UHD over Ethernet * Can read NMEA strings from GPSDO and send to host * Added multi_usrp_clock class for clock devices * uhd::device can now filter to return only USRP devices or clock devices * New OctoClock bootloader can accept firmware download over Ethernet * Added octoclock_burn_eeprom,octoclock_firmware_burner utilities * Added test_clock_synch example to show clock API --- host/lib/device.cpp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'host/lib/device.cpp') diff --git a/host/lib/device.cpp b/host/lib/device.cpp index ff5163f2d..bd7bf5637 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 Ettus Research LLC +// Copyright 2010-2011,2014 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 @@ -57,35 +57,38 @@ static size_t hash_device_addr( /*********************************************************************** * Registration **********************************************************************/ -typedef boost::tuple dev_fcn_reg_t; +typedef boost::tuple dev_fcn_reg_t; // instantiate the device function registry container UHD_SINGLETON_FCN(std::vector, get_dev_fcn_regs) void device::register_device( const find_t &find, - const make_t &make + const make_t &make, + const device_filter_t filter ){ UHD_LOGV(always) << "registering device" << std::endl; - get_dev_fcn_regs().push_back(dev_fcn_reg_t(find, make)); + get_dev_fcn_regs().push_back(dev_fcn_reg_t(find, make, filter)); } /*********************************************************************** * Discover **********************************************************************/ -device_addrs_t device::find(const device_addr_t &hint){ +device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){ boost::mutex::scoped_lock lock(_device_mutex); device_addrs_t device_addrs; BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){ try{ - device_addrs_t discovered_addrs = fcn.get<0>()(hint); - device_addrs.insert( - device_addrs.begin(), - discovered_addrs.begin(), - discovered_addrs.end() - ); + if(filter == ANY or fcn.get<2>() == filter){ + device_addrs_t discovered_addrs = fcn.get<0>()(hint); + device_addrs.insert( + device_addrs.begin(), + discovered_addrs.begin(), + discovered_addrs.end() + ); + } } catch(const std::exception &e){ UHD_MSG(error) << "Device discovery error: " << e.what() << std::endl; @@ -98,16 +101,18 @@ device_addrs_t device::find(const device_addr_t &hint){ /*********************************************************************** * Make **********************************************************************/ -device::sptr device::make(const device_addr_t &hint, size_t which){ +device::sptr device::make(const device_addr_t &hint, device_filter_t filter, size_t which){ boost::mutex::scoped_lock lock(_device_mutex); typedef boost::tuple dev_addr_make_t; std::vector dev_addr_makers; BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){ - BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){ - //append the discovered address and its factory function - dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>())); + if(filter == ANY or fcn.get<2>() == filter){ + BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){ + //append the discovered address and its factory function + dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>())); + } } } @@ -159,3 +164,7 @@ device::get_tree(void) const { return _tree; } + +device::device_filter_t device::get_device_type() const { + return _type; +} -- cgit v1.2.3