USRP Hardware Driver and USRP Manual Version: 4.1.0.3
UHD and USRP Manual
registry.hpp
Go to the documentation of this file.
1//
2// Copyright 2019 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
9#include <uhd/config.hpp>
12#include <uhd/utils/static.hpp>
13#include <functional>
14#include <string>
15
17// after the class definition
18#define UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \
19 CLASS_NAME, NOC_ID, DEVICE_ID, BLOCK_NAME, MB_ACCESS, TB_CLOCK, CTRL_CLOCK) \
20 uhd::rfnoc::noc_block_base::sptr CLASS_NAME##_make( \
21 uhd::rfnoc::noc_block_base::make_args_ptr make_args) \
22 { \
23 return std::make_shared<CLASS_NAME##_impl>(std::move(make_args)); \
24 } \
25 UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \
26 { \
27 uhd::rfnoc::registry::register_block_direct(NOC_ID, \
28 DEVICE_ID, \
29 BLOCK_NAME, \
30 MB_ACCESS, \
31 TB_CLOCK, \
32 CTRL_CLOCK, \
33 &CLASS_NAME##_make); \
34 }
35
36#define UHD_RFNOC_BLOCK_REGISTER_DIRECT( \
37 CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \
38 UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \
39 CLASS_NAME, NOC_ID, ANY_DEVICE, BLOCK_NAME, false, TB_CLOCK, CTRL_CLOCK)
40
41#define UHD_RFNOC_BLOCK_REGISTER_DIRECT_MB_ACCESS( \
42 CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \
43 UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \
44 CLASS_NAME, NOC_ID, ANY_DEVICE, BLOCK_NAME, true, TB_CLOCK, CTRL_CLOCK)
45
46namespace uhd { namespace rfnoc {
47
53{
54public:
56
87 static void register_block_direct(noc_id_t noc_id,
88 device_type_t device_id,
89 const std::string& block_name,
90 bool mb_access,
91 const std::string& timebase_clock,
92 const std::string& ctrlport_clock,
93 factory_t factory_fn);
94
107 const std::string& block_key, factory_t factory_fn);
108};
109
110}} /* namespace uhd::rfnoc */
std::unique_ptr< make_args_t > make_args_ptr
Opaque pointer to the constructor arguments.
Definition: noc_block_base.hpp:53
std::shared_ptr< noc_block_base > sptr
Definition: noc_block_base.hpp:47
Definition: registry.hpp:53
std::function< noc_block_base::sptr(noc_block_base::make_args_ptr)> factory_t
Definition: registry.hpp:55
static void register_block_descriptor(const std::string &block_key, factory_t factory_fn)
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)
#define UHD_API
Definition: config.h:70
uint16_t device_type_t
Device Type.
Definition: defaults.hpp:58
uint32_t noc_id_t
Definition: defaults.hpp:54
Definition: build_info.hpp:12