From c16e4a2610e6b97cfb81e471adeb07cbb33f3b33 Mon Sep 17 00:00:00 2001 From: Sergey Musikhin <musihin_sergei@mail.ru> Date: Sun, 13 Jun 2021 07:45:39 +0000 Subject: [PATCH] split init bladerf1/bladerf2, tamer --- grc/gen_bladerf_blocks.py | 11 ++++++++++- lib/bladerf/bladerf_common.cc | 35 ++++++++++++++++++++++++++--------- lib/bladerf/bladerf_common.h | 3 +++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/grc/gen_bladerf_blocks.py b/grc/gen_bladerf_blocks.py index e63b34a..e052f4d 100644 --- a/grc/gen_bladerf_blocks.py +++ b/grc/gen_bladerf_blocks.py @@ -114,12 +114,20 @@ parameters: default: 10000 - id: xb200 - category: Advanced + category: x40/x115 label: 'XB-200' dtype: enum default: 'none' options: ['none','auto', 'auto3db', '50M', '144M', '222M', 'custom'] option_labels: ['none','auto', 'auto3db', '50M', '144M', '222M', 'custom'] + +- id: tamer + category: x40/x115 + label: 'Tamer' + dtype: enum + default: 'internal' + options: ['internal','external_1pps', 'external'] + option_labels: ['Internal','External 1pps', 'External 10 MHz'] @@ -176,6 +184,7 @@ templates: + ",out_clk=" + str(${'$'}{out_clk}) + ",dac=" + str(${'$'}{dac}) + ",xb200=" + '${'$'}{xb200}' + + ",tamer=" + '${'$'}{tamer}' + ",trigger0="+'${'$'}{trigger0}' + ",trigger_role0="+'${'$'}{trigger_role0}' + ",trigger_signal0="+'${'$'}{trigger_signal0}' diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc index adca35f..48dda68 100644 --- a/lib/bladerf/bladerf_common.cc +++ b/lib/bladerf/bladerf_common.cc @@ -271,10 +271,16 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction) "fpga=/path/to/the/bitstream.rbf to load it."); } - if (dict.count("xb200") && _get(dict, "xb200") != "none") { - init_xb200(_get(dict, "xb200"), direction); - + if(get_board_type() == BOARD_TYPE_BLADERF_1) + { + init_bladerf1(dict, direction); } + if(get_board_type() == BOARD_TYPE_BLADERF_2) + { + init_bladerf2(dict, direction); + } + + if(dict.count("ref_clk")) { @@ -334,11 +340,7 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction) /* Show some info about the device we've opened */ print_device_info(); - if (dict.count("tamer")) { - set_clock_source(_get(dict, "tamer")); - BLADERF_INFO(boost::str(boost::format("Tamer mode set to '%s'") - % get_clock_source())); - } + @@ -405,7 +407,22 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction) "%d, active transfers: %d") % _num_buffers % _samples_per_buffer - % _num_transfers)); + % _num_transfers)); +} + +void bladerf_common::init_bladerf1(const dict_t &dict, bladerf_direction direction) +{ + if (dict.count("xb200") && _get(dict, "xb200") != "none") { + init_xb200(_get(dict, "xb200"), direction); + } + if (dict.count("tamer")) { + set_clock_source(_get(dict, "tamer")); + } +} + +void bladerf_common::init_bladerf2(const dict_t &dict, bladerf_direction direction) +{ + } std::vector<std::string> bladerf_common::devices() diff --git a/lib/bladerf/bladerf_common.h b/lib/bladerf/bladerf_common.h index 816730f..c5d7322 100644 --- a/lib/bladerf/bladerf_common.h +++ b/lib/bladerf/bladerf_common.h @@ -156,6 +156,9 @@ protected: */ void init(dict_t const &dict, bladerf_direction direction); + void init_bladerf1(dict_t const &dict, bladerf_direction direction); + void init_bladerf2(dict_t const &dict, bladerf_direction direction); + /* Get a vector of available devices */ static std::vector<std::string> devices(); /* Get the type of the open bladeRF board */ -- GitLab