Пример #1
0
std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, int chan,
                          bool test_gain, double freq_step, double gain_step, bool verbose){

    //Getting USRP info
    uhd::dict<std::string, std::string> usrp_info = (type == "TX") ? usrp->get_usrp_tx_info(chan)
                                                                   : usrp->get_usrp_rx_info(chan);
    std::string subdev_name = (type == "TX") ? usrp_info.get("tx_subdev_name")
                                             : usrp_info.get("rx_subdev_name");
    std::string subdev_spec = (type == "TX") ? usrp_info.get("tx_subdev_spec")
                                             : usrp_info.get("rx_subdev_spec");

    //Establish frequency range
    std::vector<double> freqs;
    std::vector<double> xcvr_freqs; //XCVR2450 has two ranges
    uhd::freq_range_t freq_ranges  = (type == "TX") ? usrp->get_fe_tx_freq_range(chan)
                                                    : usrp->get_fe_rx_freq_range(chan);

    std::cout << boost::format("\nTesting %s coercion...") % type << std::endl;

    BOOST_FOREACH(const uhd::range_t &range, freq_ranges){
        double freq_begin = range.start();
        double freq_end = range.stop();

        if(subdev_name.find("XCVR2450") == 0){
            xcvr_freqs.push_back(freq_begin);
            xcvr_freqs.push_back(freq_end);
        }

        double current_freq = freq_begin;
        while(current_freq < freq_end){
            freqs.push_back(current_freq);
            current_freq += freq_step;
        }
        if(freq_end != *freqs.end()) freqs.push_back(freq_end);
    }
Пример #2
0
std::string return_usrp_config_string(uhd::usrp::multi_usrp::sptr usrp, int chan, bool test_tx, bool test_rx, bool is_b2xx){
    uhd::dict<std::string, std::string> tx_info = usrp->get_usrp_tx_info(chan);
    uhd::dict<std::string, std::string> rx_info = usrp->get_usrp_rx_info(chan);
    std::string info_string;
    std::string mboard_id, mboard_serial;
    std::string tx_serial, tx_subdev_name, tx_subdev_spec;
    std::string rx_serial, rx_subdev_name, rx_subdev_spec;

    mboard_id = tx_info.get("mboard_id");
    if(tx_info.get("mboard_serial") == "") mboard_serial = "no serial";
    else mboard_serial = tx_info.get("mboard_serial");

    info_string = str(boost::format("Motherboard: %s (%s)\n") % mboard_id % mboard_serial);

    if(test_tx){
        if(tx_info.get("tx_serial") == "") tx_serial = "no serial";
        else tx_serial = tx_info.get("tx_serial");
        tx_subdev_name = tx_info.get("tx_subdev_name");
        tx_subdev_spec = tx_info.get("tx_subdev_spec");

        info_string += is_b2xx ? str(boost::format("TX: %s (%s)")
                                 % tx_subdev_name % tx_subdev_spec)
                               : str(boost::format("TX: %s (%s, %s)")
                                 % tx_subdev_name % tx_serial % tx_subdev_spec);
    }
    if(test_tx and test_rx) info_string += "\n";
    if(test_rx){
        if(rx_info.get("rx_serial") == "") rx_serial = "no serial";
        else rx_serial = rx_info.get("rx_serial");
        rx_subdev_name = rx_info.get("rx_subdev_name");
        rx_subdev_spec = rx_info.get("rx_subdev_spec");

        info_string += is_b2xx ? str(boost::format("RX: %s (%s)")
                                 % rx_subdev_name % rx_subdev_spec)
                               : str(boost::format("RX: %s (%s, %s)")
                                 % rx_subdev_name % rx_serial % rx_subdev_spec);
    }

    return info_string;
}