Loading...
Searching...
No Matches
registry.hpp
Go to the documentation of this file.
//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <uhd/rfnoc/defaults.hpp>
#include <uhd/rfnoc/noc_block_base.hpp>
#include <uhd/utils/static.hpp>
#include <functional>
#include <string>
// after the class definition
#define UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \
CLASS_NAME, NOC_ID, DEVICE_ID, BLOCK_NAME, MB_ACCESS, TB_CLOCK, CTRL_CLOCK) \
uhd::rfnoc::noc_block_base::sptr CLASS_NAME##_make( \
uhd::rfnoc::noc_block_base::make_args_ptr make_args) \
{ \
return std::make_shared<CLASS_NAME##_impl>(std::move(make_args)); \
} \
UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \
{ \
uhd::rfnoc::registry::register_block_direct(NOC_ID, \
DEVICE_ID, \
BLOCK_NAME, \
MB_ACCESS, \
TB_CLOCK, \
CTRL_CLOCK, \
&CLASS_NAME##_make); \
}
#define UHD_RFNOC_BLOCK_REGISTER_DIRECT( \
CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \
UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \
CLASS_NAME, NOC_ID, ANY_DEVICE, BLOCK_NAME, false, TB_CLOCK, CTRL_CLOCK)
#define UHD_RFNOC_BLOCK_REGISTER_DIRECT_MB_ACCESS( \
CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \
UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \
CLASS_NAME, NOC_ID, ANY_DEVICE, BLOCK_NAME, true, TB_CLOCK, CTRL_CLOCK)
namespace uhd { namespace rfnoc {
class UHD_API registry
{
public:
using factory_t = std::function<noc_block_base::sptr(noc_block_base::make_args_ptr)>;
static void register_block_direct(noc_id_t noc_id,
device_type_t device_id,
const std::string& block_name,
bool mb_access,
const std::string& timebase_clock,
const std::string& ctrlport_clock,
factory_t factory_fn);
static void register_block_direct(std::vector<noc_id_t> noc_ids,
device_type_t device_id,
const std::string& block_name,
bool mb_access,
const std::string& timebase_clock,
const std::string& ctrlport_clock,
factory_t factory_fn);
static void register_block_descriptor(
const std::string& block_key, factory_t factory_fn);
};
}} /* namespace uhd::rfnoc */
uhd::rfnoc::noc_block_base::make_args_ptr
std::unique_ptr< make_args_t > make_args_ptr
Opaque pointer to the constructor arguments.
Definition noc_block_base.hpp:54
uhd::rfnoc::noc_block_base::sptr
std::shared_ptr< noc_block_base > sptr
Definition noc_block_base.hpp:48
uhd::rfnoc::registry
Definition registry.hpp:53
uhd::rfnoc::registry::factory_t
std::function< noc_block_base::sptr(noc_block_base::make_args_ptr)> factory_t
Definition registry.hpp:55
uhd::rfnoc::registry::register_block_direct
static void register_block_direct(std::vector< noc_id_t > noc_ids, device_type_t device_id, const std::string &block_name, bool mb_access, const std::string &timebase_clock, const std::string &ctrlport_clock, factory_t factory_fn)
uhd::rfnoc::registry::register_block_descriptor
static void register_block_descriptor(const std::string &block_key, factory_t factory_fn)
uhd::rfnoc::registry::register_block_direct
static void register_block_direct(noc_id_t noc_id, device_type_t device_id, const std::string &block_name, bool mb_access, const std::string &timebase_clock, const std::string &ctrlport_clock, factory_t factory_fn)
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
defaults.hpp
uhd::rfnoc::device_type_t
uint16_t device_type_t
Device Type.
Definition defaults.hpp:56
uhd::rfnoc::noc_id_t
uint32_t noc_id_t
Definition defaults.hpp:52
uhd
Definition build_info.hpp:12
noc_block_base.hpp
static.hpp