Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
dcb0b5a4
Commit
dcb0b5a4
authored
Aug 12, 2019
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'usrp_ref_locked' into 'develop-nr'
Usrp ref locked See merge request oai/openairinterface5g!657
parents
afc5020c
ce74dd3e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
136 additions
and
136 deletions
+136
-136
executables/nr-softmodem-common.h
executables/nr-softmodem-common.h
+2
-2
executables/nr-ue.c
executables/nr-ue.c
+2
-2
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+2
-19
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+3
-3
openair1/PHY/TOOLS/nr_phy_scope.c
openair1/PHY/TOOLS/nr_phy_scope.c
+11
-6
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+2
-0
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+112
-81
targets/RT/USER/lte-softmodem.h
targets/RT/USER/lte-softmodem.h
+2
-4
targets/RT/USER/lte-uesoftmodem.c
targets/RT/USER/lte-uesoftmodem.c
+0
-19
No files found.
executables/nr-softmodem-common.h
View file @
dcb0b5a4
...
...
@@ -58,7 +58,7 @@
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_EXCCLK "tells hardware to use a
n external clock reference
\n"
#define CONFIG_HLP_EXCCLK "tells hardware to use a
clock reference (0:internal(default), 1:external, 2:gpsdo)
\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
...
...
@@ -82,6 +82,7 @@
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_DISABLETIMECORR "disable UE timing correction\n"
#define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n"
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
...
...
@@ -90,7 +91,6 @@
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
#define CONFIG_HLP_USRP_CLK_SRC "USRP clock source: 'internal' or 'external'\n"
#define CONFIG_HLP_FLOG "Enable online log \n"
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n"
...
...
executables/nr-ue.c
View file @
dcb0b5a4
...
...
@@ -496,7 +496,7 @@ void trashFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
}
void
syncInFrame
(
PHY_VARS_NR_UE
*
UE
,
openair0_timestamp
*
timestamp
)
{
if
(
UE
->
no_timing_correction
==
0
)
{
LOG_I
(
PHY
,
"Resynchronizing RX by %d samples (mode = %d)
\n
"
,
UE
->
rx_offset
,
UE
->
mode
);
void
*
dummy_tx
[
UE
->
frame_parms
.
nb_antennas_tx
];
...
...
@@ -515,7 +515,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_tx
;
i
++
)
free
(
dummy_tx
[
i
]);
}
}
int
computeSamplesShift
(
PHY_VARS_NR_UE
*
UE
)
{
...
...
executables/nr-uesoftmodem.c
View file @
dcb0b5a4
...
...
@@ -126,6 +126,7 @@ extern int16_t nr_dlsch_demod_shift;
int
UE_scan
=
0
;
int
UE_scan_carrier
=
0
;
int
UE_fo_compensation
=
0
;
int
UE_no_timing_correction
=
0
;
runmode_t
mode
=
normal_txrx
;
openair0_config_t
openair0_cfg
[
MAX_CARDS
];
...
...
@@ -224,7 +225,6 @@ int emulate_rf = 0;
tpool_t
*
Tpool
;
char
*
usrp_args
=
NULL
;
char
*
usrp_clksrc
=
NULL
;
/* forward declarations */
void
set_default_frame_parms
(
NR_DL_FRAME_PARMS
*
frame_parms
[
MAX_NUM_CCs
]);
...
...
@@ -656,24 +656,6 @@ void init_openair0(void) {
if
(
usrp_args
)
openair0_cfg
[
card
].
sdr_addrs
=
usrp_args
;
if
(
usrp_clksrc
)
{
if
(
strcmp
(
usrp_clksrc
,
"internal"
)
==
0
)
{
openair0_cfg
[
card
].
clock_source
=
internal
;
LOG_D
(
PHY
,
"USRP clock source set as internal
\n
"
);
}
else
if
(
strcmp
(
usrp_clksrc
,
"external"
)
==
0
)
{
openair0_cfg
[
card
].
clock_source
=
external
;
LOG_D
(
PHY
,
"USRP clock source set as external
\n
"
);
}
else
if
(
strcmp
(
usrp_clksrc
,
"gpsdo"
)
==
0
)
{
openair0_cfg
[
card
].
clock_source
=
gpsdo
;
LOG_D
(
PHY
,
"USRP clock source set as gpsdo
\n
"
);
}
else
{
openair0_cfg
[
card
].
clock_source
=
internal
;
LOG_I
(
PHY
,
"USRP clock source unknown ('%s'). defaulting to internal
\n
"
,
usrp_clksrc
);
}
}
else
{
openair0_cfg
[
card
].
clock_source
=
internal
;
LOG_I
(
PHY
,
"USRP clock source not specified. defaulting to internal
\n
"
);
}
}
}
...
...
@@ -754,6 +736,7 @@ int main( int argc, char **argv ) {
UE
[
CC_id
]
->
UE_scan_carrier
=
UE_scan_carrier
;
UE
[
CC_id
]
->
UE_fo_compensation
=
UE_fo_compensation
;
UE
[
CC_id
]
->
mode
=
mode
;
UE
[
CC_id
]
->
no_timing_correction
=
UE_no_timing_correction
;
printf
(
"UE[%d]->mode = %d
\n
"
,
CC_id
,
mode
);
for
(
uint8_t
i
=
0
;
i
<
RX_NB_TH_MAX
;
i
++
)
{
...
...
executables/nr-uesoftmodem.h
View file @
dcb0b5a4
...
...
@@ -50,8 +50,7 @@
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"r" , CONFIG_HLP_PRB, 0, iptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0} \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
}
#define DEFAULT_DLF 2680000000
...
...
@@ -85,7 +84,8 @@
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0}, \
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0} \
}
...
...
openair1/PHY/TOOLS/nr_phy_scope.c
View file @
dcb0b5a4
...
...
@@ -513,8 +513,8 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form,
int
num_re
=
4500
;
int
Qm
=
2
;
int
coded_bits_per_codeword
=
num_re
*
Qm
;
int
symbol
,
first_symbol
,
nb_re
;
int
nb_rb_pdsch
=
50
;
int
symbol
,
first_symbol
=
2
,
nb_re
;
int
nb_rb_pdsch
=
50
,
nb_symb_sch
=
9
;
float
ymax
=
1
;
float
**
chest_t_abs
;
float
Re
,
Im
;
...
...
@@ -792,14 +792,19 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form,
fl_set_xyplot_data
(
form
->
pdsch_llr
,
bit
,
llr
,
coded_bits_per_codeword
,
""
,
""
,
""
);
}
first_symbol
=
2
;
ind
=
0
;
// PDSCH I/Q of MF Output
if
(
pdsch_comp
!=
NULL
)
{
for
(
i
=
0
;
i
<
nb_rb_pdsch
*
12
;
i
++
)
{
I
[
i
]
=
pdsch_comp
[
2
*
2
*
nb_rb_pdsch
*
12
+
2
*
i
];
Q
[
i
]
=
pdsch_comp
[
2
*
2
*
nb_rb_pdsch
*
12
+
2
*
i
+
1
];
for
(
symbol
=
0
;
symbol
<
nb_symb_sch
;
symbol
++
)
{
for
(
i
=
0
;
i
<
nb_rb_pdsch
*
12
;
i
++
)
{
I
[
ind
]
=
pdsch_comp
[
2
*
((
first_symbol
+
symbol
)
*
frame_parms
->
N_RB_DL
*
12
+
i
)
];
Q
[
ind
]
=
pdsch_comp
[
2
*
((
first_symbol
+
symbol
)
*
frame_parms
->
N_RB_DL
*
12
+
i
)
+
1
];
ind
++
;
}
}
fl_set_xyplot_data
(
form
->
pdsch_comp
,
I
,
Q
,
nb_rb_pdsch
*
12
,
""
,
""
,
""
);
fl_set_xyplot_data
(
form
->
pdsch_comp
,
I
,
Q
,
nb_
symb_sch
*
nb_
rb_pdsch
*
12
,
""
,
""
,
""
);
}
/*
...
...
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
dcb0b5a4
...
...
@@ -4216,6 +4216,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
LOG_D
(
PHY
,
" ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------
\n
"
,
frame_rx
%
1024
,
nr_tti_rx
);
//to update from pdsch config
nr_gold_pdsch
(
ue
,
nb_symb_pdcch
,
0
,
1
);
nb_symb_sch
=
dlsch0_harq
->
nb_symbols
;
for
(
uint16_t
m
=
nb_symb_pdcch
;
m
<=
(
nb_symb_sch
+
nb_symb_pdcch
-
1
)
;
m
++
){
nr_slot_fep
(
ue
,
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
dcb0b5a4
...
...
@@ -28,7 +28,7 @@
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <uhd/utils/thread
_priority
.hpp>
#include <uhd/utils/thread.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/version.hpp>
#include <boost/lexical_cast.hpp>
...
...
@@ -114,6 +114,36 @@ typedef struct {
// std::cout << boost::format("****************************************************************************************************************\n");
//}
int
check_ref_locked
(
usrp_state_t
*
s
,
size_t
mboard
)
{
std
::
vector
<
std
::
string
>
sensor_names
=
s
->
usrp
->
get_mboard_sensor_names
(
mboard
);
bool
ref_locked
=
false
;
if
(
std
::
find
(
sensor_names
.
begin
(),
sensor_names
.
end
(),
"ref_locked"
)
!=
sensor_names
.
end
())
{
std
::
cout
<<
"Waiting for reference lock..."
<<
std
::
flush
;
for
(
int
i
=
0
;
i
<
30
and
not
ref_locked
;
i
++
)
{
ref_locked
=
s
->
usrp
->
get_mboard_sensor
(
"ref_locked"
,
mboard
).
to_bool
();
if
(
not
ref_locked
)
{
std
::
cout
<<
"."
<<
std
::
flush
;
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
seconds
(
1
));
}
}
if
(
ref_locked
)
{
std
::
cout
<<
"LOCKED"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
}
}
else
{
std
::
cout
<<
boost
::
format
(
"ref_locked sensor not present on this board.
\n
"
);
}
return
ref_locked
;
}
static
int
sync_to_gps
(
openair0_device
*
device
)
{
uhd
::
set_thread_priority_safe
();
//std::string args;
...
...
@@ -144,37 +174,14 @@ static int sync_to_gps(openair0_device *device) {
for
(
size_t
mboard
=
0
;
mboard
<
num_mboards
;
mboard
++
)
{
std
::
cout
<<
"Synchronizing mboard "
<<
mboard
<<
": "
<<
s
->
usrp
->
get_mboard_name
(
mboard
)
<<
std
::
endl
;
//Set references to GPSDO
s
->
usrp
->
set_clock_source
(
"gpsdo"
,
mboard
);
s
->
usrp
->
set_time_source
(
"gpsdo"
,
mboard
);
//std::cout << std::endl;
//print_notes();
//std::cout << std::endl;
//Check for 10 MHz lock
std
::
vector
<
std
::
string
>
sensor_names
=
s
->
usrp
->
get_mboard_sensor_names
(
mboard
);
if
(
std
::
find
(
sensor_names
.
begin
(),
sensor_names
.
end
(),
"ref_locked"
)
!=
sensor_names
.
end
())
{
std
::
cout
<<
"Waiting for reference lock..."
<<
std
::
flush
;
bool
ref_locked
=
false
;
for
(
int
i
=
0
;
i
<
30
and
not
ref_locked
;
i
++
)
{
ref_locked
=
s
->
usrp
->
get_mboard_sensor
(
"ref_locked"
,
mboard
).
to_bool
();
if
(
not
ref_locked
)
{
std
::
cout
<<
"."
<<
std
::
flush
;
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
seconds
(
1
));
}
}
if
(
ref_locked
)
{
std
::
cout
<<
"LOCKED"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
std
::
cout
<<
"Failed to lock to GPSDO 10 MHz Reference. Exiting."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
bool
ref_locked
=
check_ref_locked
(
s
,
mboard
);
if
(
ref_locked
)
{
std
::
cout
<<
boost
::
format
(
"Ref Locked
\n
"
);
}
else
{
std
::
cout
<<
boost
::
format
(
"ref_locked sensor not present on this board.
\n
"
);
std
::
cout
<<
"Failed to lock to GPSDO 10 MHz Reference. Exiting."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
//Wait for GPS lock
...
...
@@ -311,8 +318,8 @@ static int trx_usrp_start(openair0_device *device) {
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"ATR_RX"
,
1
<<
4
,
0x1f
);
// init recv and send streaming
uhd
::
stream_cmd_t
cmd
(
uhd
::
stream_cmd_t
::
STREAM_MODE_START_CONTINUOUS
);
LOG_I
(
PHY
,
"Time in secs now: %llu
\n
"
,
s
->
usrp
->
get_time_now
().
to_ticks
(
s
->
sample_rate
));
LOG_I
(
PHY
,
"Time in secs last pps: %llu
\n
"
,
s
->
usrp
->
get_time_last_pps
().
to_ticks
(
s
->
sample_rate
));
LOG_I
(
HW
,
"Time in secs now: %llu
\n
"
,
s
->
usrp
->
get_time_now
().
to_ticks
(
s
->
sample_rate
));
LOG_I
(
HW
,
"Time in secs last pps: %llu
\n
"
,
s
->
usrp
->
get_time_last_pps
().
to_ticks
(
s
->
sample_rate
));
if
(
s
->
use_gps
==
1
)
{
s
->
wait_for_first_pps
=
1
;
...
...
@@ -512,7 +519,7 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
ret
=
(
int
)
s
->
tx_stream
->
send
(
buff_ptrs
,
nsamps
,
s
->
tx_md
);
}
else
ret
=
(
int
)
s
->
tx_stream
->
send
(
&
(((
int16_t
*
)
buff_tx
[
0
])[
0
]),
nsamps
,
s
->
tx_md
);
if
(
ret
!=
nsamps
)
LOG_E
(
PHY
,
"[xmit] tx samples %d != %d
\n
"
,
ret
,
nsamps
);
if
(
ret
!=
nsamps
)
LOG_E
(
HW
,
"[xmit] tx samples %d != %d
\n
"
,
ret
,
nsamps
);
#if defined(USRP_REC_PLAY)
}
else
{
...
...
@@ -623,10 +630,10 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
}
if
(
samples_received
<
nsamps
)
LOG_E
(
PHY
,
"[recv] received %d samples out of %d
\n
"
,
samples_received
,
nsamps
);
LOG_E
(
HW
,
"[recv] received %d samples out of %d
\n
"
,
samples_received
,
nsamps
);
if
(
s
->
rx_md
.
error_code
!=
uhd
::
rx_metadata_t
::
ERROR_CODE_NONE
)
LOG_E
(
PHY
,
"%s
\n
"
,
s
->
rx_md
.
to_pp_string
(
true
).
c_str
());
LOG_E
(
HW
,
"%s
\n
"
,
s
->
rx_md
.
to_pp_string
(
true
).
c_str
());
s
->
rx_count
+=
nsamps
;
s
->
rx_timestamp
=
s
->
rx_md
.
time_spec
.
to_ticks
(
s
->
sample_rate
);
...
...
@@ -792,13 +799,13 @@ int trx_usrp_set_gains(openair0_device *device,
// limit to maximum gain
if
(
openair0_cfg
[
0
].
rx_gain
[
0
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
0
]
>
gain_range
.
stop
())
{
LOG_E
(
PHY
,
"RX Gain 0 too high, reduce by %f dB
\n
"
,
LOG_E
(
HW
,
"RX Gain 0 too high, reduce by %f dB
\n
"
,
openair0_cfg
[
0
].
rx_gain
[
0
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
0
]
-
gain_range
.
stop
());
exit
(
-
1
);
}
s
->
usrp
->
set_rx_gain
(
openair0_cfg
[
0
].
rx_gain
[
0
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
0
]);
LOG_I
(
PHY
,
"Setting USRP RX gain to %f (rx_gain %f,gain_range.stop() %f)
\n
"
,
LOG_I
(
HW
,
"Setting USRP RX gain to %f (rx_gain %f,gain_range.stop() %f)
\n
"
,
openair0_cfg
[
0
].
rx_gain
[
0
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
0
],
openair0_cfg
[
0
].
rx_gain
[
0
],
gain_range
.
stop
());
return
(
0
);
...
...
@@ -881,7 +888,7 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
break
;
default:
LOG_E
(
PHY
,
"unknown sampling rate %d
\n
"
,(
int
)
openair0_cfg
[
0
].
sample_rate
);
LOG_E
(
HW
,
"unknown sampling rate %d
\n
"
,(
int
)
openair0_cfg
[
0
].
sample_rate
);
//exit(-1);
break
;
}
...
...
@@ -889,7 +896,7 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
while
(
openair0_cfg
->
rx_gain_calib_table
[
i
].
freq
>
0
)
{
diff
=
fabs
(
openair0_cfg
->
rx_freq
[
chain_index
]
-
openair0_cfg
->
rx_gain_calib_table
[
i
].
freq
);
LOG_I
(
PHY
,
"cal %d: freq %f, offset %f, diff %f
\n
"
,
LOG_I
(
HW
,
"cal %d: freq %f, offset %f, diff %f
\n
"
,
i
,
openair0_cfg
->
rx_gain_calib_table
[
i
].
freq
,
openair0_cfg
->
rx_gain_calib_table
[
i
].
offset
,
diff
);
...
...
@@ -999,8 +1006,6 @@ extern "C" {
* \param openair0_cfg RF frontend parameters set by application
*/
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
LOG_D
(
PHY
,
"openair0_cfg[0].sdr_addrs == '%s'
\n
"
,
openair0_cfg
[
0
].
sdr_addrs
);
LOG_D
(
PHY
,
"openair0_cfg[0].clock_source == '%d'
\n
"
,
openair0_cfg
[
0
].
clock_source
);
#if defined(USRP_REC_PLAY)
paramdef_t
usrp_recplay_params
[
7
];
struct
sysinfo
systeminfo
;
...
...
@@ -1069,9 +1074,6 @@ extern "C" {
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
calloc
(
sizeof
(
usrp_state_t
),
1
);
if
(
openair0_cfg
[
0
].
clock_source
==
gpsdo
)
s
->
use_gps
=
1
;
// Initialize USRP device
device
->
openair0_cfg
=
openair0_cfg
;
int
vers
=
0
,
subvers
=
0
,
subsubvers
=
0
;
...
...
@@ -1084,7 +1086,7 @@ extern "C" {
#endif
sscanf
(
uhd
::
get_version_string
().
c_str
(),
"%d.%d.%d"
,
&
vers
,
&
subvers
,
&
subsubvers
);
LOG_I
(
PHY
,
"UHD version %s (%d.%d.%d)
\n
"
,
LOG_I
(
HW
,
"UHD version %s (%d.%d.%d)
\n
"
,
uhd
::
get_version_string
().
c_str
(),
vers
,
subvers
,
subsubvers
);
std
::
string
args
;
...
...
@@ -1092,7 +1094,7 @@ extern "C" {
args
=
"type=b200"
;
}
else
{
args
=
openair0_cfg
[
0
].
sdr_addrs
;
LOG_I
(
PHY
,
"Checking for USRP with args %s
\n
"
,
openair0_cfg
[
0
].
sdr_addrs
);
LOG_I
(
HW
,
"Checking for USRP with args %s
\n
"
,
openair0_cfg
[
0
].
sdr_addrs
);
}
uhd
::
device_addrs_t
device_adds
=
uhd
::
device
::
find
(
args
);
...
...
@@ -1138,19 +1140,53 @@ extern "C" {
s
->
usrp
=
uhd
::
usrp
::
multi_usrp
::
make
(
args
);
// lock mboard clocks
if
(
openair0_cfg
[
0
].
clock_source
==
internal
)
s
->
usrp
->
set_clock_source
(
"internal"
);
else
s
->
usrp
->
set_clock_source
(
"external"
);
if
(
args
.
find
(
"clock_source"
)
==
std
::
string
::
npos
)
{
LOG_I
(
HW
,
"Using clock_source == '%d'
\n
"
,
openair0_cfg
[
0
].
clock_source
);
if
(
openair0_cfg
[
0
].
clock_source
==
internal
)
{
//in UHD 3.14 we could use
//s->usrp->set_sync_source("clock_source=internal","time_source=internal");
s
->
usrp
->
set_time_source
(
"internal"
);
s
->
usrp
->
set_clock_source
(
"internal"
);
}
else
if
(
openair0_cfg
[
0
].
clock_source
==
external
)
{
//s->usrp->set_sync_source("clock_source=external","time_source=external");
s
->
usrp
->
set_time_source
(
"external"
);
s
->
usrp
->
set_clock_source
(
"external"
);
}
else
if
(
openair0_cfg
[
0
].
clock_source
==
gpsdo
)
{
s
->
usrp
->
set_clock_source
(
"gpsdo"
);
s
->
usrp
->
set_time_source
(
"gpsdo"
);
}
}
else
{
LOG_W
(
HW
,
"clock_source already specified in device arguments! Ignoring command line parameter
\n
"
);
}
if
(
s
->
usrp
->
get_clock_source
(
0
)
==
"gpsdo"
)
{
s
->
use_gps
=
1
;
if
(
sync_to_gps
(
device
))
{
LOG_I
(
HW
,
"USRP synced with GPS!
\n
"
);
}
else
{
LOG_I
(
HW
,
"USRP fails to sync with GPS. Exiting.
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
else
if
(
s
->
usrp
->
get_clock_source
(
0
)
==
"external"
)
{
if
(
check_ref_locked
(
s
,
0
))
{
LOG_I
(
HW
,
"USRP locked to external reference!
\n
"
);
}
else
{
LOG_I
(
HW
,
"Failed to lock to external reference. Exiting.
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
if
(
device
->
type
==
USRP_X300_DEV
)
{
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_x310
;
#if defined(USRP_REC_PLAY)
std
::
cerr
<<
"-- Using calibration table: calib_table_x310"
<<
std
::
endl
;
// Bell Labs info
#endif
LOG_I
(
PHY
,
"%s() sample_rate:%u
\n
"
,
__FUNCTION__
,
(
int
)
openair0_cfg
[
0
].
sample_rate
);
LOG_I
(
HW
,
"%s() sample_rate:%u
\n
"
,
__FUNCTION__
,
(
int
)
openair0_cfg
[
0
].
sample_rate
);
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
case
122880000
:
...
...
@@ -1214,7 +1250,7 @@ extern "C" {
break
;
default:
LOG_E
(
PHY
,
"Error: unknown sampling rate %f
\n
"
,
openair0_cfg
[
0
].
sample_rate
);
LOG_E
(
HW
,
"Error: unknown sampling rate %f
\n
"
,
openair0_cfg
[
0
].
sample_rate
);
exit
(
-
1
);
break
;
}
...
...
@@ -1285,7 +1321,7 @@ extern "C" {
break
;
default:
LOG_E
(
PHY
,
"Error: unknown sampling rate %f
\n
"
,
openair0_cfg
[
0
].
sample_rate
);
LOG_E
(
HW
,
"Error: unknown sampling rate %f
\n
"
,
openair0_cfg
[
0
].
sample_rate
);
exit
(
-
1
);
break
;
}
...
...
@@ -1308,14 +1344,14 @@ extern "C" {
"RX Gain too high, lower by %f dB
\n
"
,
openair0_cfg
[
0
].
rx_gain
[
i
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
i
]
-
gain_range
.
stop
());
s
->
usrp
->
set_rx_gain
(
openair0_cfg
[
0
].
rx_gain
[
i
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
i
],
i
);
LOG_I
(
PHY
,
"RX Gain %d %f (%f) => %f (max %f)
\n
"
,
i
,
LOG_I
(
HW
,
"RX Gain %d %f (%f) => %f (max %f)
\n
"
,
i
,
openair0_cfg
[
0
].
rx_gain
[
i
],
openair0_cfg
[
0
].
rx_gain_offset
[
i
],
openair0_cfg
[
0
].
rx_gain
[
i
]
-
openair0_cfg
[
0
].
rx_gain_offset
[
i
],
gain_range
.
stop
());
}
}
LOG_D
(
PHY
,
"usrp->get_tx_num_channels() == %zd
\n
"
,
s
->
usrp
->
get_tx_num_channels
());
LOG_D
(
PHY
,
"openair0_cfg[0].tx_num_channels == %d
\n
"
,
openair0_cfg
[
0
].
tx_num_channels
);
LOG_D
(
HW
,
"usrp->get_tx_num_channels() == %zd
\n
"
,
s
->
usrp
->
get_tx_num_channels
());
LOG_D
(
HW
,
"openair0_cfg[0].tx_num_channels == %d
\n
"
,
openair0_cfg
[
0
].
tx_num_channels
);
for
(
int
i
=
0
;
i
<
s
->
usrp
->
get_tx_num_channels
();
i
++
)
{
::
uhd
::
gain_range_t
gain_range_tx
=
s
->
usrp
->
get_tx_gain_range
(
i
);
...
...
@@ -1324,26 +1360,27 @@ extern "C" {
s
->
usrp
->
set_tx_rate
(
openair0_cfg
[
0
].
sample_rate
,
i
);
s
->
usrp
->
set_tx_freq
(
openair0_cfg
[
0
].
tx_freq
[
i
],
i
);
s
->
usrp
->
set_tx_gain
(
gain_range_tx
.
stop
()
-
openair0_cfg
[
0
].
tx_gain
[
i
],
i
);
LOG_I
(
PHY
,
"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf
\n
"
,
gain_range_tx
.
stop
()
-
openair0_cfg
[
0
].
tx_gain
[
i
],
gain_range_tx
.
stop
(),
openair0_cfg
[
0
].
tx_gain
[
i
]);
LOG_I
(
HW
,
"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf
\n
"
,
gain_range_tx
.
stop
()
-
openair0_cfg
[
0
].
tx_gain
[
i
],
gain_range_tx
.
stop
(),
openair0_cfg
[
0
].
tx_gain
[
i
]);
}
}
//s->usrp->set_clock_source("external");
//s->usrp->set_time_source("external");
// display USRP settings
LOG_I
(
PHY
,
"Actual master clock: %fMHz...
\n
"
,
s
->
usrp
->
get_master_clock_rate
()
/
1e6
);
LOG_I
(
HW
,
"Actual master clock: %fMHz...
\n
"
,
s
->
usrp
->
get_master_clock_rate
()
/
1e6
);
sleep
(
1
);
// create tx & rx streamer
uhd
::
stream_args_t
stream_args_rx
(
"sc16"
,
"sc16"
);
int
samples
=
openair0_cfg
[
0
].
sample_rate
;
int
max
=
s
->
usrp
->
get_rx_stream
(
stream_args_rx
)
->
get_max_num_samps
();
samples
/=
10000
;
LOG_I
(
PHY
,
"RF board max packet size %u, size for 100µs jitter %d
\n
"
,
max
,
samples
);
LOG_I
(
HW
,
"RF board max packet size %u, size for 100µs jitter %d
\n
"
,
max
,
samples
);
if
(
samples
<
max
)
stream_args_rx
.
args
[
"spp"
]
=
str
(
boost
::
format
(
"%d"
)
%
samples
);
LOG_I
(
PHY
,
"rx_max_num_samps %zu
\n
"
,
LOG_I
(
HW
,
"rx_max_num_samps %zu
\n
"
,
s
->
usrp
->
get_rx_stream
(
stream_args_rx
)
->
get_max_num_samps
());
for
(
int
i
=
0
;
i
<
openair0_cfg
[
0
].
rx_num_channels
;
i
++
)
...
...
@@ -1365,25 +1402,25 @@ extern "C" {
s
->
usrp
->
set_rx_bandwidth
(
openair0_cfg
[
0
].
rx_bw
,
i
);
for
(
int
i
=
0
;
i
<
openair0_cfg
[
0
].
rx_num_channels
;
i
++
)
{
LOG_I
(
PHY
,
"RX Channel %d
\n
"
,
i
);
LOG_I
(
PHY
,
" Actual RX sample rate: %fMSps...
\n
"
,
s
->
usrp
->
get_rx_rate
(
i
)
/
1e6
);
LOG_I
(
PHY
,
" Actual RX frequency: %fGHz...
\n
"
,
s
->
usrp
->
get_rx_freq
(
i
)
/
1e9
);
LOG_I
(
PHY
,
" Actual RX gain: %f...
\n
"
,
s
->
usrp
->
get_rx_gain
(
i
));
LOG_I
(
PHY
,
" Actual RX bandwidth: %fM...
\n
"
,
s
->
usrp
->
get_rx_bandwidth
(
i
)
/
1e6
);
LOG_I
(
PHY
,
" Actual RX antenna: %s...
\n
"
,
s
->
usrp
->
get_rx_antenna
(
i
).
c_str
());
LOG_I
(
HW
,
"RX Channel %d
\n
"
,
i
);
LOG_I
(
HW
,
" Actual RX sample rate: %fMSps...
\n
"
,
s
->
usrp
->
get_rx_rate
(
i
)
/
1e6
);
LOG_I
(
HW
,
" Actual RX frequency: %fGHz...
\n
"
,
s
->
usrp
->
get_rx_freq
(
i
)
/
1e9
);
LOG_I
(
HW
,
" Actual RX gain: %f...
\n
"
,
s
->
usrp
->
get_rx_gain
(
i
));
LOG_I
(
HW
,
" Actual RX bandwidth: %fM...
\n
"
,
s
->
usrp
->
get_rx_bandwidth
(
i
)
/
1e6
);
LOG_I
(
HW
,
" Actual RX antenna: %s...
\n
"
,
s
->
usrp
->
get_rx_antenna
(
i
).
c_str
());
}
for
(
int
i
=
0
;
i
<
openair0_cfg
[
0
].
tx_num_channels
;
i
++
)
{
LOG_I
(
PHY
,
"TX Channel %d
\n
"
,
i
);
LOG_I
(
PHY
,
" Actual TX sample rate: %fMSps...
\n
"
,
s
->
usrp
->
get_tx_rate
(
i
)
/
1e6
);
LOG_I
(
PHY
,
" Actual TX frequency: %fGHz...
\n
"
,
s
->
usrp
->
get_tx_freq
(
i
)
/
1e9
);
LOG_I
(
PHY
,
" Actual TX gain: %f...
\n
"
,
s
->
usrp
->
get_tx_gain
(
i
));
LOG_I
(
PHY
,
" Actual TX bandwidth: %fM...
\n
"
,
s
->
usrp
->
get_tx_bandwidth
(
i
)
/
1e6
);
LOG_I
(
PHY
,
" Actual TX antenna: %s...
\n
"
,
s
->
usrp
->
get_tx_antenna
(
i
).
c_str
());
LOG_I
(
PHY
,
" Actual TX packet size: %lu
\n
"
,
s
->
tx_stream
->
get_max_num_samps
());
LOG_I
(
HW
,
"TX Channel %d
\n
"
,
i
);
LOG_I
(
HW
,
" Actual TX sample rate: %fMSps...
\n
"
,
s
->
usrp
->
get_tx_rate
(
i
)
/
1e6
);
LOG_I
(
HW
,
" Actual TX frequency: %fGHz...
\n
"
,
s
->
usrp
->
get_tx_freq
(
i
)
/
1e9
);
LOG_I
(
HW
,
" Actual TX gain: %f...
\n
"
,
s
->
usrp
->
get_tx_gain
(
i
));
LOG_I
(
HW
,
" Actual TX bandwidth: %fM...
\n
"
,
s
->
usrp
->
get_tx_bandwidth
(
i
)
/
1e6
);
LOG_I
(
HW
,
" Actual TX antenna: %s...
\n
"
,
s
->
usrp
->
get_tx_antenna
(
i
).
c_str
());
LOG_I
(
HW
,
" Actual TX packet size: %lu
\n
"
,
s
->
tx_stream
->
get_max_num_samps
());
}
LOG_I
(
PHY
,
"Device timestamp: %f...
\n
"
,
s
->
usrp
->
get_time_now
().
get_real_secs
());
LOG_I
(
HW
,
"Device timestamp: %f...
\n
"
,
s
->
usrp
->
get_time_now
().
get_real_secs
());
device
->
priv
=
s
;
device
->
trx_start_func
=
trx_usrp_start
;
device
->
trx_write_func
=
trx_usrp_write
;
...
...
@@ -1409,12 +1446,6 @@ extern "C" {
if
(
is_equal
(
s
->
sample_rate
,
(
double
)
7.68e6
))
s
->
tx_forward_nsamps
=
50
;
if
(
s
->
use_gps
==
1
)
{
if
(
sync_to_gps
(
device
))
{
LOG_I
(
PHY
,
"USRP fails to sync with GPS...
\n
"
);
exit
(
0
);
}
}
#if defined(USRP_REC_PLAY)
}
...
...
targets/RT/USER/lte-softmodem.h
View file @
dcb0b5a4
...
...
@@ -65,7 +65,7 @@
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal
(default)
, 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
...
...
@@ -99,7 +99,6 @@
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
#define CONFIG_HLP_USRP_CLK_SRC "USRP clock source: 'internal' or 'external'\n"
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
...
...
@@ -150,8 +149,7 @@
{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0} \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
}
#define DEFAULT_DLF 2680000000
...
...
targets/RT/USER/lte-uesoftmodem.c
View file @
dcb0b5a4
...
...
@@ -224,7 +224,6 @@ char *parallel_config = NULL;
char
*
worker_config
=
NULL
;
char
*
usrp_args
=
NULL
;
char
*
usrp_clksrc
=
NULL
;
static
THREAD_STRUCT
thread_struct
;
void
set_parallel_conf
(
char
*
parallel_conf
)
...
...
@@ -745,24 +744,6 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
}
if
(
usrp_args
)
openair0_cfg
[
card
].
sdr_addrs
=
usrp_args
;
if
(
usrp_clksrc
)
{
if
(
strcmp
(
usrp_clksrc
,
"internal"
)
==
0
)
{
openair0_cfg
[
card
].
clock_source
=
internal
;
LOG_D
(
PHY
,
"USRP clock source set as internal
\n
"
);
}
else
if
(
strcmp
(
usrp_clksrc
,
"external"
)
==
0
)
{
openair0_cfg
[
card
].
clock_source
=
external
;
LOG_D
(
PHY
,
"USRP clock source set as external
\n
"
);
}
else
if
(
strcmp
(
usrp_clksrc
,
"gpsdo"
)
==
0
)
{
openair0_cfg
[
card
].
clock_source
=
gpsdo
;
LOG_D
(
PHY
,
"USRP clock source set as gpsdo
\n
"
);
}
else
{
openair0_cfg
[
card
].
clock_source
=
internal
;
LOG_I
(
PHY
,
"USRP clock source unknown ('%s'). defaulting to internal
\n
"
,
usrp_clksrc
);
}
}
else
{
openair0_cfg
[
card
].
clock_source
=
internal
;
LOG_I
(
PHY
,
"USRP clock source not specified. defaulting to internal
\n
"
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment