USRP Hardware Driver and USRP Manual Version: 4.2.0.0
UHD and USRP Manual
rfnoc_types.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 <cstddef>
10#include <cstdint>
11
12namespace uhd { namespace rfnoc {
13
14//----------------------------------------------
15// Types
16//----------------------------------------------
17
21constexpr size_t chdr_w_to_bits(chdr_w_t chdr_w)
22{
23 // clang-format off
24 // This switch statement is what this function is doing, but it requires all
25 // consumers of this file to use C++14, which we currently enforce. We
26 // therefore keep this switch statement for reference, and for future
27 // improvements of this code, but what we feed the compiler is the nested
28 // ternary statement below.
29 /*
30 switch (chdr_w) {
31 case CHDR_W_64:
32 return 64;
33 case CHDR_W_128:
34 return 128;
35 case CHDR_W_256:
36 return 256;
37 case CHDR_W_512:
38 return 512;
39 default:
40 return 0;
41 }
42 */
43 return
44 chdr_w == CHDR_W_64 ? 64 :
45 chdr_w == CHDR_W_128 ? 128 :
46 chdr_w == CHDR_W_256 ? 256 :
47 chdr_w == CHDR_W_512 ? 512 :
48 /* default */ 0 ;
49 // clang-format on
50}
51
53using sep_id_t = uint16_t;
54
55}} // namespace uhd::rfnoc
uint16_t sep_id_t
Stream Endpoint ID Type.
Definition: rfnoc_types.hpp:53
chdr_w_t
Type that indicates the CHDR Width in bits.
Definition: rfnoc_types.hpp:19
@ CHDR_W_128
Definition: rfnoc_types.hpp:19
@ CHDR_W_256
Definition: rfnoc_types.hpp:19
@ CHDR_W_512
Definition: rfnoc_types.hpp:19
@ CHDR_W_64
Definition: rfnoc_types.hpp:19
constexpr size_t chdr_w_to_bits(chdr_w_t chdr_w)
Conversion from chdr_w_t to a number of bits.
Definition: rfnoc_types.hpp:21
Definition: build_info.hpp:12