From dc9ca94afaa0a1c049eac934ad1c278deedc6766 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Sat, 1 Jun 2019 13:08:56 -0700 Subject: rfnoc: noc_block_base: Add API to reduce num ports This allows blocks to reduce the number of actual, available ports. --- host/lib/rfnoc/noc_block_base.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'host/lib/rfnoc/noc_block_base.cpp') diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp index 0b2d456b2..97aaeb002 100644 --- a/host/lib/rfnoc/noc_block_base.cpp +++ b/host/lib/rfnoc/noc_block_base.cpp @@ -64,6 +64,26 @@ noc_block_base::~noc_block_base() // nop } +void noc_block_base::set_num_input_ports(const size_t num_ports) +{ + if (num_ports > get_num_input_ports()) { + throw uhd::value_error( + "New number of input ports must not exceed current number!"); + } + + _num_input_ports = num_ports; +} + +void noc_block_base::set_num_output_ports(const size_t num_ports) +{ + if (num_ports > get_num_output_ports()) { + throw uhd::value_error( + "New number of output ports must not exceed current number!"); + } + + _num_output_ports = num_ports; +} + void noc_block_base::set_tick_rate(const double tick_rate) { -- cgit v1.2.3