blob: 9f72135ddcedf00dd0429b2006e6ec9dbf6f5471 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
//
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#include "rhodium_constants.hpp"
#include "rhodium_radio_control.hpp"
#include <uhd/utils/math.hpp>
using namespace uhd;
using namespace uhd::usrp;
using namespace uhd::rfnoc;
using namespace uhd::math::fp_compare;
namespace {
constexpr double FREQ_COMPARE_EPSILON = 1e-5;
/* Note on the RX filter bank:
*
* The RX path has 8 bands, which we call BAND0 through BAND7. BAND0 is the
* lowest frequency band. BAND7 is the highest frequency band.
*
* The following constants define lower cutoff frequencies for each band.
* RHODIUM_RX_BAND1_MIN_FREQ is the cutover frequency for switching from
* BAND0 to BAND1, and so on.
*
* Bands 1-7 have both high- and low-pass filters (effectively band
* passes). Band 0 has only low-pass filters. Frequencies have been
* chosen to allow as much of the full bandwidth through unattenuated.
*
* Switch selection logic for these bands can be found in
* rhodium_radio_control_impl::_update_rx_freq_switches()
*/
constexpr double RHODIUM_RX_BAND0_MIN_FREQ = RHODIUM_MIN_FREQ;
constexpr double RHODIUM_RX_BAND1_MIN_FREQ = 450e6;
constexpr double RHODIUM_RX_BAND2_MIN_FREQ = 760e6;
constexpr double RHODIUM_RX_BAND3_MIN_FREQ = 1100e6;
constexpr double RHODIUM_RX_BAND4_MIN_FREQ = 1410e6;
constexpr double RHODIUM_RX_BAND5_MIN_FREQ = 2050e6;
constexpr double RHODIUM_RX_BAND6_MIN_FREQ = 3000e6;
constexpr double RHODIUM_RX_BAND7_MIN_FREQ = 4500e6;
/* Note on the TX filter bank:
*
* The TX path has 8 bands, which we call BAND0 through BAND7. BAND0 is the
* lowest frequency band. BAND7 is the highest frequency band.
*
* The following constants define lower cutoff frequencies for each band.
* RHODIUM_TX_BAND1_MIN_FREQ is the cutover frequency for switching from
* BAND0 to BAND1, and so on.
*
* All filters on the TX filter bank are low pass filters (no high pass
* filters). Frequencies have been chosen to allow as much of the full
* bandwidth through unattenuated.
*
* Switch selection logic for these bands can be found in
* rhodium_radio_control_impl::_update_tx_freq_switches()
*/
constexpr double RHODIUM_TX_BAND0_MIN_FREQ = RHODIUM_MIN_FREQ;
constexpr double RHODIUM_TX_BAND1_MIN_FREQ = 450e6;
constexpr double RHODIUM_TX_BAND2_MIN_FREQ = 650e6;
constexpr double RHODIUM_TX_BAND3_MIN_FREQ = 1000e6;
constexpr double RHODIUM_TX_BAND4_MIN_FREQ = 1350e6;
constexpr double RHODIUM_TX_BAND5_MIN_FREQ = 1900e6;
constexpr double RHODIUM_TX_BAND6_MIN_FREQ = 3000e6;
constexpr double RHODIUM_TX_BAND7_MIN_FREQ = 4100e6;
} // namespace
rhodium_radio_control_impl::rx_band rhodium_radio_control_impl::_map_freq_to_rx_band(
const double freq)
{
auto freq_compare = fp_compare_epsilon<double>(freq, RHODIUM_FREQ_COMPARE_EPSILON);
if (freq_compare < RHODIUM_RX_BAND0_MIN_FREQ) {
return rx_band::RX_BAND_INVALID;
} else if (freq_compare < RHODIUM_RX_BAND1_MIN_FREQ) {
return rx_band::RX_BAND_0;
} else if (freq_compare < RHODIUM_RX_BAND2_MIN_FREQ) {
return rx_band::RX_BAND_1;
} else if (freq_compare < RHODIUM_RX_BAND3_MIN_FREQ) {
return rx_band::RX_BAND_2;
} else if (freq_compare < RHODIUM_RX_BAND4_MIN_FREQ) {
return rx_band::RX_BAND_3;
} else if (freq_compare < RHODIUM_RX_BAND5_MIN_FREQ) {
return rx_band::RX_BAND_4;
} else if (freq_compare < RHODIUM_RX_BAND6_MIN_FREQ) {
return rx_band::RX_BAND_5;
} else if (freq_compare < RHODIUM_RX_BAND7_MIN_FREQ) {
return rx_band::RX_BAND_6;
} else if (freq_compare <= RHODIUM_MAX_FREQ) {
return rx_band::RX_BAND_7;
} else {
return rx_band::RX_BAND_INVALID;
}
}
rhodium_radio_control_impl::tx_band rhodium_radio_control_impl::_map_freq_to_tx_band(
const double freq)
{
auto freq_compare = fp_compare_epsilon<double>(freq, RHODIUM_FREQ_COMPARE_EPSILON);
if (freq_compare < RHODIUM_TX_BAND0_MIN_FREQ) {
return tx_band::TX_BAND_INVALID;
} else if (freq_compare < RHODIUM_TX_BAND1_MIN_FREQ) {
return tx_band::TX_BAND_0;
} else if (freq_compare < RHODIUM_TX_BAND2_MIN_FREQ) {
return tx_band::TX_BAND_1;
} else if (freq_compare < RHODIUM_TX_BAND3_MIN_FREQ) {
return tx_band::TX_BAND_2;
} else if (freq_compare < RHODIUM_TX_BAND4_MIN_FREQ) {
return tx_band::TX_BAND_3;
} else if (freq_compare < RHODIUM_TX_BAND5_MIN_FREQ) {
return tx_band::TX_BAND_4;
} else if (freq_compare < RHODIUM_TX_BAND6_MIN_FREQ) {
return tx_band::TX_BAND_5;
} else if (freq_compare < RHODIUM_TX_BAND7_MIN_FREQ) {
return tx_band::TX_BAND_6;
} else if (freq_compare <= RHODIUM_MAX_FREQ) {
return tx_band::TX_BAND_7;
} else {
return tx_band::TX_BAND_INVALID;
}
}
bool rhodium_radio_control_impl::_is_rx_lowband(const double freq)
{
return _map_freq_to_rx_band(freq) == rx_band::RX_BAND_0;
}
bool rhodium_radio_control_impl::_is_tx_lowband(const double freq)
{
return _map_freq_to_tx_band(freq) == tx_band::TX_BAND_0;
}
|