Exemplo n.º 1
0
 inline void _stop_io_service()
 {
     if (_io_service_thread.get()) {
         UHD_LOGGER_INFO("NIRIO") << "rpc_client stopping...";
         _io_service.stop();
         _io_service_thread->join();
         _io_service_thread.reset();
         UHD_LOGGER_INFO("NIRIO") << "rpc_client stopped.";
     }
 }
Exemplo n.º 2
0
    double set_tick_rate(const double rate)
    {
        UHD_LOGGER_INFO("N230") << "Configuring a tick rate of " << rate/1e6 << " MHz... ";
        _tick_rate = _codec_ctrl->set_clock_rate(rate);
        UHD_LOGGER_INFO("N230") << "got " << _tick_rate/1e6 << " MHz\n";

        for(time_core_3000::sptr& time_core:  _time_cores) {
            time_core->set_tick_rate(_tick_rate);
            time_core->self_test();
        }

        return _tick_rate;
    }
Exemplo n.º 3
0
static void apply_fe_corrections(
    uhd::property_tree::sptr sub_tree,
    const uhd::fs_path &db_path,
    const uhd::fs_path &fe_path,
    const std::string &file_prefix,
    const double lo_freq
){
    //extract eeprom serial
    const uhd::usrp::dboard_eeprom_t db_eeprom = sub_tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get();

    //make the calibration file path
    const fs::path cal_data_path = fs::path(uhd::get_app_path()) / ".uhd" / "cal" / (file_prefix + db_eeprom.serial + ".csv");
    if (not fs::exists(cal_data_path)) return;

    //parse csv file or get from cache
    if (not fe_cal_cache.has_key(cal_data_path.string())){
        std::ifstream cal_data(cal_data_path.string().c_str());
        const uhd::csv::rows_type rows = uhd::csv::to_rows(cal_data);

        bool read_data = false, skip_next = false;;
        std::vector<fe_cal_t> datas;
        for(const uhd::csv::row_type &row:  rows){
            if (not read_data and not row.empty() and row[0] == "DATA STARTS HERE"){
                read_data = true;
                skip_next = true;
                continue;
            }
            if (not read_data) continue;
            if (skip_next){
                skip_next = false;
                continue;
            }
            fe_cal_t data;
            std::sscanf(row[0].c_str(), "%lf" , &data.lo_freq);
            std::sscanf(row[1].c_str(), "%lf" , &data.iq_corr_real);
            std::sscanf(row[2].c_str(), "%lf" , &data.iq_corr_imag);
            datas.push_back(data);
        }
        std::sort(datas.begin(), datas.end(), fe_cal_comp);
        fe_cal_cache[cal_data_path.string()] = datas;
        UHD_LOGGER_INFO("CAL") << "Calibration data loaded: " << cal_data_path.string();

    }

    sub_tree->access<std::complex<double> >(fe_path)
        .set(get_fe_correction(cal_data_path.string(), lo_freq));
}