Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
OpenXG
OpenXG UE
Commits
1f98f05a
Commit
1f98f05a
authored
Nov 05, 2018
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nr-fix-ue-usrp' into 'develop-nr'
Nr fix ue usrp See merge request oai/openairinterface5g!436
parents
0a375aff
17e868ca
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1088 additions
and
151 deletions
+1088
-151
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+5
-2
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+1
-1
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+2
-1
openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
+10
-14
openair1/PHY/TOOLS/nr_phy_scope.c
openair1/PHY/TOOLS/nr_phy_scope.c
+842
-0
openair1/PHY/TOOLS/nr_phy_scope.h
openair1/PHY/TOOLS/nr_phy_scope.h
+84
-0
openair1/SIMULATION/NR_PHY/pbchsim.c
openair1/SIMULATION/NR_PHY/pbchsim.c
+40
-24
targets/RT/USER/nr-ue.c
targets/RT/USER/nr-ue.c
+59
-46
targets/RT/USER/nr-uesoftmodem.c
targets/RT/USER/nr-uesoftmodem.c
+42
-60
targets/RT/USER/nr-uesoftmodem.h
targets/RT/USER/nr-uesoftmodem.h
+3
-3
No files found.
cmake_targets/CMakeLists.txt
View file @
1f98f05a
...
...
@@ -2142,6 +2142,9 @@ if (${XFORMS})
set
(
XFORMS_SOURCE
${
OPENAIR1_DIR
}
/PHY/TOOLS/lte_phy_scope.c
)
set
(
XFORMS_SOURCE_NR
${
OPENAIR1_DIR
}
/PHY/TOOLS/nr_phy_scope.c
)
set
(
XFORMS_SOURCE_SOFTMODEM
${
OPENAIR_TARGETS
}
/RT/USER/stats.c
)
...
...
@@ -2444,7 +2447,7 @@ add_executable(nr-uesoftmodem
${
OPENAIR3_DIR
}
/NAS/UE/nas_ue_task.c
${
OPENAIR_DIR
}
/common/utils/utils.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
XFORMS_SOURCE
}
${
XFORMS_SOURCE
_NR
}
${
XFORMS_SOURCE_SOFTMODEM
}
${
T_SOURCE
}
${
CONFIG_SOURCES
}
...
...
@@ -2478,7 +2481,7 @@ add_executable(nr-uesoftmodem-nos1
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/netlink_init.c
${
OPENAIR_DIR
}
/common/utils/utils.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
XFORMS_SOURCE
}
${
XFORMS_SOURCE
_NR
}
${
XFORMS_SOURCE_SOFTMODEM
}
${
T_SOURCE
}
${
CONFIG_SOURCES
}
...
...
openair1/PHY/INIT/nr_init.c
View file @
1f98f05a
...
...
@@ -419,7 +419,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
gNB_config
->
rf_config
.
ul_carrier_bandwidth
.
value
=
phy_config
->
cfg
->
rf_config
.
ul_carrier_bandwidth
.
value
;
//106;
gNB_config
->
sch_config
.
half_frame_index
.
value
=
0
;
gNB_config
->
sch_config
.
ssb_subcarrier_offset
.
value
=
phy_config
->
cfg
->
sch_config
.
ssb_subcarrier_offset
.
value
;
//0;
gNB_config
->
sch_config
.
n_ssb_crb
.
value
=
86
;
gNB_config
->
sch_config
.
n_ssb_crb
.
value
=
(
phy_config
->
cfg
->
rf_config
.
dl_carrier_bandwidth
.
value
-
20
)
>>
1
;
gNB_config
->
sch_config
.
physical_cell_id
.
value
=
phy_config
->
cfg
->
sch_config
.
physical_cell_id
.
value
;
if
(
phy_config
->
cfg
->
subframe_config
.
duplex_mode
.
value
==
0
)
{
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
1f98f05a
...
...
@@ -156,6 +156,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
// FK: added N_RB_DL paramter here as this function shares code with the gNB where it is needed. We should rewrite this function for the UE.
nr_init_frame_parms_ue
(
fp
,
NR_MU_1
,
NORMAL
,
fp
->
N_RB_DL
,
n_ssb_crb
,
0
);
LOG_D
(
PHY
,
"nr_initial sync ue RB_DL %d
\n
"
,
fp
->
N_RB_DL
);
/*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1);
exit(-1);
...
...
@@ -196,7 +197,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
#endif
/* check that SSS/PBCH block is continuous inside the received buffer */
if
(
sync_pos
<
(
10
*
fp
->
slots_per_subframe
*
fp
->
samples_per_subframe
-
(
NB_SYMBOLS_PBCH
*
fp
->
ofdm_symbol_size
)))
{
if
(
sync_pos
<
(
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
*
fp
->
samples_per_subframe
-
(
NB_SYMBOLS_PBCH
*
fp
->
ofdm_symbol_size
)))
{
#ifdef DEBUG_INITIAL_SYNCH
LOG_I
(
PHY
,
"Calling sss detection (normal CP)
\n
"
);
...
...
openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
View file @
1f98f05a
...
...
@@ -838,14 +838,15 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
/* Search pss in the received buffer each 4 samples which ensures a memory alignment on 128 bits (32 bits x 4 ) */
/* This is required by SIMD (single instruction Multiple Data) Extensions of Intel processors. */
/* Correlation computation is based on a a dot product which is realized thank to SIMS extensions */
for
(
int
pss_index
=
0
;
pss_index
<
NUMBER_PSS_SEQUENCE
;
pss_index
++
)
avg
[
pss_index
]
=
0
;
for
(
int
pss_index
=
0
;
pss_index
<
NUMBER_PSS_SEQUENCE
;
pss_index
++
)
{
avg
[
pss_index
]
=
0
;
memset
(
pss_corr_ue
[
pss_index
],
0
,
length
*
sizeof
(
int64_t
));
}
for
(
n
=
0
;
n
<
length
;
n
+=
4
)
{
for
(
n
=
0
;
n
<
length
;
n
+=
4
)
{
//
for
(
int
pss_index
=
0
;
pss_index
<
NUMBER_PSS_SEQUENCE
;
pss_index
++
)
{
pss_corr_ue
[
pss_index
][
n
]
=
0
;
/* clean correlation for position n */
if
(
n
<
(
length
-
frame_parms
->
ofdm_symbol_size
))
{
/* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */
...
...
@@ -886,24 +887,19 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
LOG_I
(
PHY
,
"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB
\n
"
,
pss_source
,
peak_position
,
(
unsigned
long
long
)
peak_value
,
dB_fixed64
(
peak_value
),
dB_fixed64
(
avg
[
pss_source
]));
//#ifdef DEBUG_PSS_NR
#define PSS_DETECTION_FLOOR_NR (31)
if
(
peak_value
<
5
*
avg
[
pss_source
])
{
//PSS_DETECTION_FLOOR_NR)
if
(
peak_value
<
5
*
avg
[
pss_source
])
return
(
-
1
);
}
//#endif
#ifdef DBG_PSS_NR
static
debug_cnt
=
0
;
static
int
debug_cnt
=
0
;
if
(
debug_cnt
==
0
)
{
/*
LOG_M("pss_corr_ue0.m","pss_corr_ue0",pss_corr_ue[0],length,1,6);
LOG_M
(
"pss_corr_ue0.m"
,
"pss_corr_ue0"
,
pss_corr_ue
[
0
],
length
,
1
,
6
);
LOG_M
(
"pss_corr_ue1.m"
,
"pss_corr_ue1"
,
pss_corr_ue
[
1
],
length
,
1
,
6
);
LOG_M
(
"pss_corr_ue2.m"
,
"pss_corr_ue2"
,
pss_corr_ue
[
2
],
length
,
1
,
6
);
LOG_M("rxdata0.m","rxd0",rxdata[0],length,1,1);
*/
LOG_M
(
"rxdata0.m"
,
"rxd0"
,
rxdata
[
0
],
length
,
1
,
1
);
}
else
{
debug_cnt
++
;
}
...
...
openair1/PHY/TOOLS/nr_phy_scope.c
0 → 100644
View file @
1f98f05a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* Form definition file generated by fdesign */
#include <stdlib.h>
#include "nr_phy_scope.h"
#define TPUT_WINDOW_LENGTH 100
int
otg_enabled
;
FL_COLOR
rx_antenna_colors
[
4
]
=
{
FL_RED
,
FL_BLUE
,
FL_GREEN
,
FL_YELLOW
};
float
tput_time_enb
[
NUMBER_OF_UE_MAX
][
TPUT_WINDOW_LENGTH
]
=
{{
0
}};
float
tput_enb
[
NUMBER_OF_UE_MAX
][
TPUT_WINDOW_LENGTH
]
=
{{
0
}};
float
tput_time_ue
[
NUMBER_OF_UE_MAX
][
TPUT_WINDOW_LENGTH
]
=
{{
0
}};
float
tput_ue
[
NUMBER_OF_UE_MAX
][
TPUT_WINDOW_LENGTH
]
=
{{
0
}};
float
tput_ue_max
[
NUMBER_OF_UE_MAX
]
=
{
0
};
extern
int64_t
*
pss_corr_ue
[
3
];
static
void
ia_receiver_on_off
(
FL_OBJECT
*
button
,
long
arg
)
{
if
(
fl_get_button
(
button
))
{
fl_set_object_label
(
button
,
"IA Receiver ON"
);
// PHY_vars_UE_g[0][0]->use_ia_receiver = 1;
fl_set_object_color
(
button
,
FL_GREEN
,
FL_GREEN
);
}
else
{
fl_set_object_label
(
button
,
"IA Receiver OFF"
);
// PHY_vars_UE_g[0][0]->use_ia_receiver = 0;
fl_set_object_color
(
button
,
FL_RED
,
FL_RED
);
}
}
static
void
dl_traffic_on_off
(
FL_OBJECT
*
button
,
long
arg
)
{
if
(
fl_get_button
(
button
))
{
fl_set_object_label
(
button
,
"DL Traffic ON"
);
otg_enabled
=
1
;
fl_set_object_color
(
button
,
FL_GREEN
,
FL_GREEN
);
}
else
{
fl_set_object_label
(
button
,
"DL Traffic OFF"
);
otg_enabled
=
0
;
fl_set_object_color
(
button
,
FL_RED
,
FL_RED
);
}
}
FD_lte_phy_scope_enb
*
create_lte_phy_scope_enb
(
void
)
{
FL_OBJECT
*
obj
;
FD_lte_phy_scope_enb
*
fdui
=
fl_malloc
(
sizeof
*
fdui
);
// Define form
fdui
->
lte_phy_scope_enb
=
fl_bgn_form
(
FL_NO_BOX
,
800
,
800
);
// This the whole UI box
obj
=
fl_add_box
(
FL_BORDER_BOX
,
0
,
0
,
800
,
800
,
""
);
fl_set_object_color
(
obj
,
FL_BLACK
,
FL_BLACK
);
// Received signal
fdui
->
rxsig_t
=
fl_add_xyplot
(
FL_NORMAL_XYPLOT
,
20
,
20
,
370
,
100
,
"Received Signal (Time-Domain, dB)"
);
fl_set_object_boxtype
(
fdui
->
rxsig_t
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
rxsig_t
,
FL_BLACK
,
FL_RED
);
fl_set_object_lcolor
(
fdui
->
rxsig_t
,
FL_WHITE
);
// Label color
fl_set_xyplot_ybounds
(
fdui
->
rxsig_t
,
10
,
70
);
// Time-domain channel response
fdui
->
chest_t
=
fl_add_xyplot
(
FL_NORMAL_XYPLOT
,
410
,
20
,
370
,
100
,
"SRS Frequency Response (samples, abs)"
);
fl_set_object_boxtype
(
fdui
->
chest_t
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
chest_t
,
FL_BLACK
,
FL_RED
);
fl_set_object_lcolor
(
fdui
->
chest_t
,
FL_WHITE
);
// Label color
// Frequency-domain channel response
fdui
->
chest_f
=
fl_add_xyplot
(
FL_IMPULSE_XYPLOT
,
20
,
140
,
760
,
100
,
"Channel Frequency Response (RE, dB)"
);
fl_set_object_boxtype
(
fdui
->
chest_f
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
chest_f
,
FL_BLACK
,
FL_RED
);
fl_set_object_lcolor
(
fdui
->
chest_f
,
FL_WHITE
);
// Label color
fl_set_xyplot_ybounds
(
fdui
->
chest_f
,
30
,
70
);
// LLR of PUSCH
fdui
->
pusch_llr
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
20
,
260
,
500
,
200
,
"PUSCH Log-Likelihood Ratios (LLR, mag)"
);
fl_set_object_boxtype
(
fdui
->
pusch_llr
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pusch_llr
,
FL_BLACK
,
FL_YELLOW
);
fl_set_object_lcolor
(
fdui
->
pusch_llr
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pusch_llr
,
2
);
// I/Q PUSCH comp
fdui
->
pusch_comp
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
540
,
260
,
240
,
200
,
"PUSCH I/Q of MF Output"
);
fl_set_object_boxtype
(
fdui
->
pusch_comp
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pusch_comp
,
FL_BLACK
,
FL_YELLOW
);
fl_set_object_lcolor
(
fdui
->
pusch_comp
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pusch_comp
,
2
);
fl_set_xyplot_xgrid
(
fdui
->
pusch_llr
,
FL_GRID_MAJOR
);
// I/Q PUCCH comp (format 1)
fdui
->
pucch_comp1
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
540
,
480
,
240
,
100
,
"PUCCH1 Energy (SR)"
);
fl_set_object_boxtype
(
fdui
->
pucch_comp1
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pucch_comp1
,
FL_BLACK
,
FL_YELLOW
);
fl_set_object_lcolor
(
fdui
->
pucch_comp1
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pucch_comp1
,
2
);
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
// I/Q PUCCH comp (fromat 1a/b)
fdui
->
pucch_comp
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
540
,
600
,
240
,
100
,
"PUCCH I/Q of MF Output"
);
fl_set_object_boxtype
(
fdui
->
pucch_comp
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pucch_comp
,
FL_BLACK
,
FL_YELLOW
);
fl_set_object_lcolor
(
fdui
->
pucch_comp
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pucch_comp
,
2
);
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
// Throughput on PUSCH
fdui
->
pusch_tput
=
fl_add_xyplot
(
FL_NORMAL_XYPLOT
,
20
,
480
,
500
,
100
,
"PUSCH Throughput [frame]/[kbit/s]"
);
fl_set_object_boxtype
(
fdui
->
pusch_tput
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pusch_tput
,
FL_BLACK
,
FL_WHITE
);
fl_set_object_lcolor
(
fdui
->
pusch_tput
,
FL_WHITE
);
// Label color
// Generic eNB Button
fdui
->
button_0
=
fl_add_button
(
FL_PUSH_BUTTON
,
20
,
600
,
240
,
40
,
""
);
fl_set_object_lalign
(
fdui
->
button_0
,
FL_ALIGN_CENTER
);
fl_set_button
(
fdui
->
button_0
,
0
);
otg_enabled
=
0
;
fl_set_object_label
(
fdui
->
button_0
,
"DL Traffic OFF"
);
fl_set_object_color
(
fdui
->
button_0
,
FL_RED
,
FL_RED
);
fl_set_object_callback
(
fdui
->
button_0
,
dl_traffic_on_off
,
0
);
fl_end_form
(
);
fdui
->
lte_phy_scope_enb
->
fdui
=
fdui
;
return
fdui
;
}
/*
void phy_scope_eNB(FD_lte_phy_scope_enb *form,
PHY_VARS_eNB *phy_vars_enb,
int UE_id)
{
int eNB_id = 0;
int i,i2,arx,atx,ind,k;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_enb->frame_parms;
int nsymb_ce = 12*frame_parms->N_RB_UL*frame_parms->symbols_per_tti;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint8_t nb_antennas_tx = 1; // frame_parms->nb_antennas_tx; // in LTE Rel. 8 and 9 only a single transmit antenna is assumed at the UE
int16_t **rxsig_t;
int16_t **chest_t;
int16_t **chest_f;
int16_t *pusch_llr;
int32_t *pusch_comp;
int32_t *pucch1_comp;
int32_t *pucch1_thres;
int32_t *pucch1ab_comp;
float Re,Im,ymax;
float *llr, *bit;
float I[nsymb_ce*2], Q[nsymb_ce*2];
float I_pucch[10240],Q_pucch[10240],A_pucch[10240],B_pucch[10240],C_pucch[10240];
float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES];
float chest_t_abs[nb_antennas_rx][frame_parms->ofdm_symbol_size];
float *chest_f_abs;
float time[FRAME_LENGTH_COMPLEX_SAMPLES];
float time2[2048];
float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx];
int frame = phy_vars_enb->proc.proc_rxtx[0].frame_tx;
uint32_t total_dlsch_bitrate = phy_vars_enb->total_dlsch_bitrate;
int coded_bits_per_codeword = 0;
uint8_t harq_pid; // in TDD config 3 it is sf-2, i.e., can be 0,1,2
int Qm = 2;
// choose max MCS to compute coded_bits_per_codeword
if (phy_vars_enb->ulsch[UE_id]!=NULL) {
for (harq_pid=0; harq_pid<3; harq_pid++) {
Qm = cmax(phy_vars_enb->ulsch[UE_id]->harq_processes[harq_pid]->Qm,Qm);
}
}
coded_bits_per_codeword = frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti;
chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero
bit = malloc(coded_bits_per_codeword*sizeof(float));
rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id];
//chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id];
chest_t = (int16_t**) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates[eNB_id];
chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id];
pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr;
pusch_comp = (int32_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0];
pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id];
pucch1_thres = (int32_t*) phy_vars_enb->pucch1_stats_thres[UE_id];
pucch1ab_comp = (int32_t*) phy_vars_enb->pucch1ab_stats[UE_id];
// Received signal in time domain of receive antenna 0
if (rxsig_t != NULL) {
if (rxsig_t[0] != NULL) {
for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; i++) {
rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((rxsig_t[0][2*i])*(rxsig_t[0][2*i])+(rxsig_t[0][2*i+1])*(rxsig_t[0][2*i+1])));
time[i] = (float) i;
}
fl_set_xyplot_data(form->rxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","","");
}
for (arx=1; arx<nb_antennas_rx; arx++) {
if (rxsig_t[arx] != NULL) {
for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; i++) {
rxsig_t_dB[arx][i] = 10*log10(1.0+(float) ((rxsig_t[arx][2*i])*(rxsig_t[arx][2*i])+(rxsig_t[arx][2*i+1])*(rxsig_t[arx][2*i+1])));
}
fl_add_xyplot_overlay(form->rxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]);
}
}
}
// Channel Impulse Response
if (chest_t != NULL) {
ymax = 0;
if (chest_t[0] !=NULL) {
for (i=0; i<(frame_parms->ofdm_symbol_size); i++) {
//i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size;
i2=i;
//time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1));
time2[i] = (float)i;
chest_t_abs[0][i] = 10*log10((float) (1+chest_t[0][2*i2]*chest_t[0][2*i2]+chest_t[0][2*i2+1]*chest_t[0][2*i2+1]));
if (chest_t_abs[0][i] > ymax)
ymax = chest_t_abs[0][i];
}
fl_set_xyplot_data(form->chest_t,time2,chest_t_abs[0],(frame_parms->ofdm_symbol_size),"","","");
}
for (arx=1; arx<nb_antennas_rx; arx++) {
if (chest_t[arx] !=NULL) {
for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) {
chest_t_abs[arx][i] = 10*log10((float) (1+chest_t[arx][2*i]*chest_t[arx][2*i]+chest_t[arx][2*i+1]*chest_t[arx][2*i+1]));
if (chest_t_abs[arx][i] > ymax)
ymax = chest_t_abs[arx][i];
}
fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]);
fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT);
}
}
// Avoid flickering effect
// fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax);
fl_set_xyplot_ybounds(form->chest_t,0,ymax);
}
// Channel Frequency Response
if (chest_f != NULL) {
ind = 0;
for (atx=0; atx<nb_antennas_tx; atx++) {
for (arx=0; arx<nb_antennas_rx; arx++) {
if (chest_f[(atx<<1)+arx] != NULL) {
for (k=0; k<nsymb_ce; k++) {
freq[ind] = (float)ind;
Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
ind++;
}
}
}
}
// tx antenna 0
fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce);
fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,3);
fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR);
fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","","");
for (arx=1; arx<nb_antennas_rx; arx++) {
fl_add_xyplot_overlay(form->chest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
// other tx antennas
if (nb_antennas_tx > 1) {
if (nb_antennas_rx > 1) {
for (atx=1; atx<nb_antennas_tx; atx++) {
for (arx=0; arx<nb_antennas_rx; arx++) {
fl_add_xyplot_overlay(form->chest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
}
} else { // 1 rx antenna
atx=1;
arx=0;
fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
}
}
// PUSCH LLRs
if (pusch_llr != NULL) {
for (i=0; i<coded_bits_per_codeword; i++) {
llr[i] = (float) pusch_llr[i];
bit[i] = (float) i;
}
fl_set_xyplot_data(form->pusch_llr,bit,llr,coded_bits_per_codeword,"","","");
}
// PUSCH I/Q of MF Output
if (pusch_comp!=NULL) {
ind=0;
for (k=0; k<frame_parms->symbols_per_tti; k++) {
for (i=0; i<12*frame_parms->N_RB_UL; i++) {
I[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i];
Q[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i+1];
ind++;
}
}
fl_set_xyplot_data(form->pusch_comp,I,Q,ind,"","","");
}
// PUSCH I/Q of MF Output
if (pucch1ab_comp!=NULL) {
for (ind=0; ind<10240; ind++) {
I_pucch[ind] = (float)pucch1ab_comp[2*(ind)];
Q_pucch[ind] = (float)pucch1ab_comp[2*(ind)+1];
A_pucch[ind] = 10*log10(pucch1_comp[ind]);
B_pucch[ind] = ind;
C_pucch[ind] = (float)pucch1_thres[ind];
}
fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","","");
fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","","");
fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED);
fl_set_xyplot_ybounds(form->pucch_comp,-5000,5000);
fl_set_xyplot_xbounds(form->pucch_comp,-5000,5000);
fl_set_xyplot_ybounds(form->pucch_comp1,0,80);
}
// PUSCH Throughput
memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame;
tput_enb[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0;
fl_set_xyplot_data(form->pusch_tput,tput_time_enb[UE_id],tput_enb[UE_id],TPUT_WINDOW_LENGTH,"","","");
// fl_get_xyplot_ybounds(form->pusch_tput,&ymin,&ymax);
// fl_set_xyplot_ybounds(form->pusch_tput,0,ymax);
fl_check_forms();
free(llr);
free(bit);
free(chest_f_abs);
}
*/
FD_lte_phy_scope_ue
*
create_lte_phy_scope_ue
(
void
)
{
FL_OBJECT
*
obj
;
FD_lte_phy_scope_ue
*
fdui
=
fl_malloc
(
sizeof
*
fdui
);
// Define form
fdui
->
lte_phy_scope_ue
=
fl_bgn_form
(
FL_NO_BOX
,
800
,
900
);
// This the whole UI box
obj
=
fl_add_box
(
FL_BORDER_BOX
,
0
,
0
,
800
,
900
,
""
);
fl_set_object_color
(
obj
,
FL_BLACK
,
FL_BLACK
);
// Received signal
fdui
->
rxsig_t
=
fl_add_xyplot
(
FL_NORMAL_XYPLOT
,
20
,
20
,
370
,
100
,
"Received Signal (Time-Domain, dB)"
);
fl_set_object_boxtype
(
fdui
->
rxsig_t
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
rxsig_t
,
FL_BLACK
,
FL_RED
);
fl_set_object_lcolor
(
fdui
->
rxsig_t
,
FL_WHITE
);
// Label color
fl_set_xyplot_ybounds
(
fdui
->
rxsig_t
,
10
,
70
);
// Time-domain channel response
fdui
->
chest_t
=
fl_add_xyplot
(
FL_NORMAL_XYPLOT
,
410
,
20
,
370
,
100
,
"Channel Impulse Response (samples, abs)"
);
fl_set_object_boxtype
(
fdui
->
chest_t
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
chest_t
,
FL_BLACK
,
FL_RED
);
fl_set_object_lcolor
(
fdui
->
chest_t
,
FL_WHITE
);
// Label color
// Frequency-domain channel response
fdui
->
chest_f
=
fl_add_xyplot
(
FL_IMPULSE_XYPLOT
,
20
,
140
,
760
,
100
,
"Channel Frequency Response (RE, dB)"
);
fl_set_object_boxtype
(
fdui
->
chest_f
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
chest_f
,
FL_BLACK
,
FL_RED
);
fl_set_object_lcolor
(
fdui
->
chest_f
,
FL_WHITE
);
// Label color
fl_set_xyplot_ybounds
(
fdui
->
chest_f
,
30
,
70
);
// LLR of PBCH
fdui
->
pbch_llr
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
20
,
260
,
500
,
100
,
"PBCH Log-Likelihood Ratios (LLR, mag)"
);
fl_set_object_boxtype
(
fdui
->
pbch_llr
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pbch_llr
,
FL_BLACK
,
FL_GREEN
);
fl_set_object_lcolor
(
fdui
->
pbch_llr
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pbch_llr
,
2
);
fl_set_xyplot_xgrid
(
fdui
->
pbch_llr
,
FL_GRID_MAJOR
);
fl_set_xyplot_xbounds
(
fdui
->
pbch_llr
,
0
,
1920
);
// I/Q PBCH comp
fdui
->
pbch_comp
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
540
,
260
,
240
,
100
,
"PBCH I/Q of MF Output"
);
fl_set_object_boxtype
(
fdui
->
pbch_comp
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pbch_comp
,
FL_BLACK
,
FL_GREEN
);
fl_set_object_lcolor
(
fdui
->
pbch_comp
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pbch_comp
,
2
);
// fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100);
// fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100);
// LLR of PDCCH
fdui
->
pdcch_llr
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
20
,
380
,
500
,
100
,
"PDCCH Log-Likelihood Ratios (LLR, mag)"
);
fl_set_object_boxtype
(
fdui
->
pdcch_llr
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pdcch_llr
,
FL_BLACK
,
FL_CYAN
);
fl_set_object_lcolor
(
fdui
->
pdcch_llr
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pdcch_llr
,
2
);
// I/Q PDCCH comp
fdui
->
pdcch_comp
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
540
,
380
,
240
,
100
,
"PDCCH I/Q of MF Output"
);
fl_set_object_boxtype
(
fdui
->
pdcch_comp
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pdcch_comp
,
FL_BLACK
,
FL_CYAN
);
fl_set_object_lcolor
(
fdui
->
pdcch_comp
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pdcch_comp
,
2
);
fl_set_xyplot_xgrid
(
fdui
->
pdcch_llr
,
FL_GRID_MAJOR
);
// LLR of PDSCH
fdui
->
pdsch_llr
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
20
,
500
,
500
,
200
,
"PDSCH Log-Likelihood Ratios (LLR, mag)"
);
fl_set_object_boxtype
(
fdui
->
pdsch_llr
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pdsch_llr
,
FL_BLACK
,
FL_YELLOW
);
fl_set_object_lcolor
(
fdui
->
pdsch_llr
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pdsch_llr
,
2
);
fl_set_xyplot_xgrid
(
fdui
->
pdsch_llr
,
FL_GRID_MAJOR
);
// I/Q PDSCH comp
fdui
->
pdsch_comp
=
fl_add_xyplot
(
FL_POINTS_XYPLOT
,
540
,
500
,
240
,
200
,
"PDSCH I/Q of MF Output"
);
fl_set_object_boxtype
(
fdui
->
pdsch_comp
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pdsch_comp
,
FL_BLACK
,
FL_YELLOW
);
fl_set_object_lcolor
(
fdui
->
pdsch_comp
,
FL_WHITE
);
// Label color
fl_set_xyplot_symbolsize
(
fdui
->
pdsch_comp
,
2
);
// Throughput on PDSCH
fdui
->
pdsch_tput
=
fl_add_xyplot
(
FL_NORMAL_XYPLOT
,
20
,
720
,
500
,
100
,
"PDSCH Throughput [frame]/[kbit/s]"
);
fl_set_object_boxtype
(
fdui
->
pdsch_tput
,
FL_EMBOSSED_BOX
);
fl_set_object_color
(
fdui
->
pdsch_tput
,
FL_BLACK
,
FL_WHITE
);
fl_set_object_lcolor
(
fdui
->
pdsch_tput
,
FL_WHITE
);
// Label color
// Generic UE Button
fdui
->
button_0
=
fl_add_button
(
FL_PUSH_BUTTON
,
540
,
720
,
240
,
40
,
""
);
fl_set_object_lalign
(
fdui
->
button_0
,
FL_ALIGN_CENTER
);
//openair_daq_vars.use_ia_receiver = 0;
fl_set_button
(
fdui
->
button_0
,
0
);
fl_set_object_label
(
fdui
->
button_0
,
"IA Receiver OFF"
);
fl_set_object_color
(
fdui
->
button_0
,
FL_RED
,
FL_RED
);
fl_set_object_callback
(
fdui
->
button_0
,
ia_receiver_on_off
,
0
);
fl_hide_object
(
fdui
->
button_0
);
fl_end_form
(
);
fdui
->
lte_phy_scope_ue
->
fdui
=
fdui
;
return
fdui
;
}
void
phy_scope_UE
(
FD_lte_phy_scope_ue
*
form
,
PHY_VARS_NR_UE
*
phy_vars_ue
,
int
eNB_id
,
int
UE_id
,
uint8_t
subframe
)
{
int
i
,
arx
,
atx
,
ind
,
k
;
NR_DL_FRAME_PARMS
*
frame_parms
=
&
phy_vars_ue
->
frame_parms
;
int
nsymb_ce
=
frame_parms
->
ofdm_symbol_size
;
//*frame_parms->symbols_per_tti;
int
samples_per_frame
=
frame_parms
->
samples_per_frame
;
uint8_t
nb_antennas_rx
=
frame_parms
->
nb_antennas_rx
;
uint8_t
nb_antennas_tx
=
frame_parms
->
nb_antenna_ports_eNB
;
int16_t
**
rxsig_t
;
float
**
rxsig_t_dB
;
float
*
time
;
float
*
corr
;
/*
int16_t **chest_t;
int16_t **chest_f;
int16_t *pdsch_llr;
int16_t *pdsch_comp;
int16_t *pdsch_mag;
int8_t *pdcch_llr;
int16_t *pdcch_comp;
int8_t *pbch_llr;
int16_t *pbch_comp;
float Re,Im,ymax=1;
int num_pdcch_symbols=3;
float *llr, *bit, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch;
float *I, *Q;
float **chest_t_abs;
float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx];
int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx;
int coded_bits_per_codeword = 0;
int mcs = 0;
unsigned char harq_pid = 0;
*/
/*
if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) {
harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid;
if (harq_pid>=8)
return;
mcs = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->mcs;
// Button 0
if(!phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->dl_power_off) {
// we are in TM5
fl_show_object(form->button_0);
}
}
if (phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]!=NULL) {
num_pdcch_symbols = phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->num_pdcch_symbols;
}
// coded_bits_per_codeword = frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti);
if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) {
coded_bits_per_codeword = get_G(frame_parms,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even,
get_Qm(mcs),
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl,
num_pdcch_symbols,
frame,
subframe,
beamforming_mode);
} else {
coded_bits_per_codeword = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti);
}
I = (float*) calloc(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*2,sizeof(float));
Q = (float*) calloc(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*2,sizeof(float));
chest_t_abs = (float**) malloc(nb_antennas_rx*sizeof(float*));
for (arx=0; arx<nb_antennas_rx; arx++) {
chest_t_abs[arx] = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float));
}
chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero
bit = malloc(coded_bits_per_codeword*sizeof(float));
llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero
bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float));
*/
rxsig_t
=
(
int16_t
**
)
phy_vars_ue
->
common_vars
.
rxdata
;
rxsig_t_dB
=
calloc
(
nb_antennas_rx
,
sizeof
(
float
*
));
for
(
arx
=
0
;
arx
<
nb_antennas_rx
;
arx
++
)
{
rxsig_t_dB
[
arx
]
=
(
float
*
)
calloc
(
samples_per_frame
,
sizeof
(
float
));
}
time
=
calloc
(
samples_per_frame
,
sizeof
(
float
));
corr
=
calloc
(
samples_per_frame
,
sizeof
(
float
));
/*
chest_t = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id];
chest_f = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id];
pbch_llr = (int8_t*) phy_vars_ue->pbch_vars[eNB_id]->llr;
pbch_comp = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0];
pdcch_llr = (int8_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr;
pdcch_comp = (int16_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0];
pdsch_llr = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0
// pdsch_llr = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0]; // stream 0
pdsch_comp = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0];
pdsch_mag = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0];
*/
// Received signal in time domain of receive antenna 0
if
(
rxsig_t
!=
NULL
)
{
if
(
rxsig_t
[
0
]
!=
NULL
)
{
for
(
i
=
0
;
i
<
samples_per_frame
;
i
++
)
{
rxsig_t_dB
[
0
][
i
]
=
10
*
log10
(
1
.
0
+
(
float
)
((
rxsig_t
[
0
][
2
*
i
])
*
(
rxsig_t
[
0
][
2
*
i
])
+
(
rxsig_t
[
0
][
2
*
i
+
1
])
*
(
rxsig_t
[
0
][
2
*
i
+
1
])));
time
[
i
]
=
(
float
)
i
;
}
fl_set_xyplot_data
(
form
->
rxsig_t
,
time
,
rxsig_t_dB
[
0
],
samples_per_frame
,
""
,
""
,
""
);
}
/*
for (arx=1; arx<nb_antennas_rx; arx++) {
if (rxsig_t[arx] != NULL) {
for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; i++) {
rxsig_t_dB[arx][i] = 10*log10(1.0+(float) ((rxsig_t[arx][2*i])*(rxsig_t[arx][2*i])+(rxsig_t[arx][2*i+1])*(rxsig_t[arx][2*i+1])));
}
fl_add_xyplot_overlay(form->rxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]);
}
}
*/
}
for
(
ind
=
0
;
ind
<
3
;
ind
++
)
{
if
(
pss_corr_ue
[
ind
])
{
for
(
i
=
0
;
i
<
samples_per_frame
;
i
++
)
{
corr
[
i
]
=
(
float
)
pss_corr_ue
[
ind
][
i
];
time
[
i
]
=
(
float
)
i
;
}
if
(
ind
==
0
)
fl_set_xyplot_data
(
form
->
chest_t
,
time
,
corr
,
samples_per_frame
,
""
,
""
,
""
);
else
fl_add_xyplot_overlay
(
form
->
chest_t
,
ind
,
time
,
corr
,
samples_per_frame
,
rx_antenna_colors
[
ind
]);
}
}
/*
// Channel Impulse Response (still repeated format)
if (chest_t != NULL) {
ymax = 0;
if (chest_t[0] !=NULL) {
for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) {
chest_t_abs[0][i] = (float) (chest_t[0][4*i]*chest_t[0][4*i]+chest_t[0][4*i+1]*chest_t[0][4*i+1]);
if (chest_t_abs[0][i] > ymax)
ymax = chest_t_abs[0][i];
}
fl_set_xyplot_data(form->chest_t,time,chest_t_abs[0],(frame_parms->ofdm_symbol_size>>3),"","","");
}
for (arx=1; arx<nb_antennas_rx; arx++) {
if (chest_t[arx] !=NULL) {
for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) {
chest_t_abs[arx][i] = (float) (chest_t[arx][4*i]*chest_t[arx][4*i]+chest_t[arx][4*i+1]*chest_t[arx][4*i+1]);
if (chest_t_abs[arx][i] > ymax)
ymax = chest_t_abs[arx][i];
}
fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]);
fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT);
}
}
// Avoid flickering effect
// fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); // Does not always work...
fl_set_xyplot_ybounds(form->chest_t,0,(double) ymax);
}
// Channel Frequency Response (includes 5 complex sample for filter)
if (chest_f != NULL) {
ind = 0;
for (atx=0; atx<nb_antennas_tx; atx++) {
for (arx=0; arx<nb_antennas_rx; arx++) {
if (chest_f[(atx<<1)+arx] != NULL) {
for (k=0; k<nsymb_ce; k++) {
freq[ind] = (float)ind;
Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
ind++;
}
}
}
}
// tx antenna 0
fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce);
//fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2);
// fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2);
fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR);
fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","","");
for (arx=1; arx<nb_antennas_rx; arx++) {
fl_add_xyplot_overlay(form->chest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
// other tx antennas
if (nb_antennas_tx > 1) {
if (nb_antennas_rx > 1) {
for (atx=1; atx<nb_antennas_tx; atx++) {
for (arx=0; arx<nb_antennas_rx; arx++) {
fl_add_xyplot_overlay(form->chest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
}
} else { // 1 rx antenna
atx=1;
arx=0;
fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
}
}
// PBCH LLRs
if (pbch_llr != NULL) {
for (i=0; i<1920; i++) {
llr_pbch[i] = (float) pbch_llr[i];
bit_pbch[i] = (float) i;
}
fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","","");
}
// PBCH I/Q of MF Output
if (pbch_comp!=NULL) {
for (i=0; i<72*2; i++) {
I[i] = pbch_comp[2*i];
Q[i] = pbch_comp[2*i+1];
}
fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","","");
}
// PDCCH LLRs
if (pdcch_llr != NULL) {
for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols; i++) {
llr_pdcch[i] = (float) pdcch_llr[i];
bit_pdcch[i] = (float) i;
}
fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3);
if (frame_parms->N_RB_DL != 100)
{
fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","","");
}
else
{
LOG_D(PHY,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n");
}
}
// PDCCH I/Q of MF Output
if (pdcch_comp!=NULL) {
for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) {
I[i] = pdcch_comp[2*i];
Q[i] = pdcch_comp[2*i+1];
}
if (frame_parms->N_RB_DL != 100)
{
fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","","");
}
else
{
LOG_D(PHY,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n");
}
}
// PDSCH LLRs
if (pdsch_llr != NULL) {
for (i=0; i<coded_bits_per_codeword; i++) {
llr[i] = (float) pdsch_llr[i];
bit[i] = (float) i;
}
fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
if (frame_parms->N_RB_DL != 100)
{
fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","","");
}
else
{
LOG_D(PHY,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n");
}
}
// PDSCH I/Q of MF Output
if (pdsch_comp!=NULL) {
ind=0;
for (k=0; k<frame_parms->symbols_per_tti; k++) {
for (i=0; i<12*frame_parms->N_RB_DL/2; i++) {
int j = (2*frame_parms->N_RB_DL*12*k)+4*i;
I[ind] = (pdsch_mag[j ]!=0? 1.0/pdsch_mag[j ]: 0.0) * pdsch_comp[j ]*1.0;
Q[ind] = (pdsch_mag[j+1]!=0? 1.0/pdsch_mag[j+1]: 0.0) * pdsch_comp[j+1]*1.0;
ind++;
}
}
fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","","");
}
// PDSCH Throughput
memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
memmove( tput_ue[UE_id], &tput_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame;
tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0;
if (tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] > tput_ue_max[UE_id]) {
tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1];
}
fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","","");
fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]);
*/
fl_check_forms
();
free
(
time
);
free
(
corr
);
for
(
arx
=
0
;
arx
<
nb_antennas_rx
;
arx
++
)
{
free
(
rxsig_t_dB
[
arx
]);
}
free
(
rxsig_t_dB
);
/*
free(I);
free(Q);
free(chest_f_abs);
free(llr);
free(bit);
free(bit_pdcch);
free(llr_pdcch);
for (arx=0; arx<nb_antennas_rx; arx++) {
free(chest_t_abs[arx]);
}
free(chest_t_abs);
*/
}
openair1/PHY/TOOLS/nr_phy_scope.h
0 → 100644
View file @
1f98f05a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* Header file generated by fdesign on Tue Nov 13 09:42:50 2012 */
#ifndef FD_lte_scope_h_
#define FD_lte_scope_h_
#include <forms.h>
//#include "PHY/defs_eNB.h"
//#include "PHY/defs_UE.h"
//#include "PHY/impl_defs_top.h"
#include "PHY/defs_nr_UE.h"
/* Forms and Objects */
typedef
struct
{
FL_FORM
*
lte_phy_scope_enb
;
FL_OBJECT
*
rxsig_t
;
FL_OBJECT
*
chest_f
;
FL_OBJECT
*
chest_t
;
FL_OBJECT
*
pusch_comp
;
FL_OBJECT
*
pucch_comp
;
FL_OBJECT
*
pucch_comp1
;
FL_OBJECT
*
pusch_llr
;
FL_OBJECT
*
pusch_tput
;
FL_OBJECT
*
button_0
;
}
FD_lte_phy_scope_enb
;
typedef
struct
{
FL_FORM
*
lte_phy_scope_ue
;
FL_OBJECT
*
rxsig_t
;
FL_OBJECT
*
chest_f
;
FL_OBJECT
*
chest_t
;
FL_OBJECT
*
pbch_comp
;
FL_OBJECT
*
pbch_llr
;
FL_OBJECT
*
pdcch_comp
;
FL_OBJECT
*
pdcch_llr
;
FL_OBJECT
*
pdsch_comp
;
FL_OBJECT
*
pdsch_llr
;
FL_OBJECT
*
pdsch_comp1
;
FL_OBJECT
*
pdsch_llr1
;
FL_OBJECT
*
pdsch_tput
;
FL_OBJECT
*
button_0
;
}
FD_lte_phy_scope_ue
;
FD_lte_phy_scope_enb
*
create_lte_phy_scope_enb
(
void
);
FD_lte_phy_scope_ue
*
create_lte_phy_scope_ue
(
void
);
/*
void phy_scope_eNB(FD_lte_phy_scope_enb *form,
PHY_VARS_gNB *phy_vars_enb,
int UE_id);
*/
void
phy_scope_UE
(
FD_lte_phy_scope_ue
*
form
,
PHY_VARS_NR_UE
*
phy_vars_ue
,
int
eNB_id
,
int
UE_id
,
uint8_t
subframe
);
#endif
/* FD_lte_scope_h_ */
openair1/SIMULATION/NR_PHY/pbchsim.c
View file @
1f98f05a
...
...
@@ -379,7 +379,7 @@ int main(int argc, char **argv)
exit
(
-
1
);
}
frame_length_complex_samples
=
frame_parms
->
samples_per_subframe
;
frame_length_complex_samples
=
frame_parms
->
samples_per_subframe
*
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
;
frame_length_complex_samples_no_prefix
=
frame_parms
->
samples_per_subframe_wCP
;
s_re
=
malloc
(
2
*
sizeof
(
double
*
));
...
...
@@ -432,34 +432,47 @@ int main(int argc, char **argv)
gNB
->
pbch_configured
=
1
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
gNB
->
pbch_pdu
[
i
]
=
i
+
1
;
nr_common_signal_procedures
(
gNB
,
frame
,
subframe
);
}
/*
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
if (gNB->frame_parms.nb_antennas_tx>1)
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
*/
//TODO: loop over slots
for
(
aa
=
0
;
aa
<
gNB
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
if
(
gNB_config
->
subframe_config
.
dl_cyclic_prefix_type
.
value
==
1
)
{
PHY_ofdm_mod
(
gNB
->
common_vars
.
txdataF
[
aa
],
txdata
[
aa
],
frame_parms
->
ofdm_symbol_size
,
12
,
frame_parms
->
nb_prefix_samples
,
CYCLIC_PREFIX
);
}
else
{
nr_normal_prefix_mod
(
gNB
->
common_vars
.
txdataF
[
aa
],
txdata
[
aa
],
14
,
frame_parms
);
/*
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
if (gNB->frame_parms.nb_antennas_tx>1)
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
*/
//TODO: loop over slots
for
(
aa
=
0
;
aa
<
gNB
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
if
(
gNB_config
->
subframe_config
.
dl_cyclic_prefix_type
.
value
==
1
)
{
PHY_ofdm_mod
(
gNB
->
common_vars
.
txdataF
[
aa
],
txdata
[
aa
],
frame_parms
->
ofdm_symbol_size
,
12
,
frame_parms
->
nb_prefix_samples
,
CYCLIC_PREFIX
);
}
else
{
nr_normal_prefix_mod
(
gNB
->
common_vars
.
txdataF
[
aa
],
txdata
[
aa
],
14
,
frame_parms
);
}
}
}
else
{
printf
(
"Reading %d samples from file to antenna buffer %d
\n
"
,
frame_length_complex_samples
,
0
);
if
(
fread
(
txdata
[
0
],
sizeof
(
int32_t
),
frame_length_complex_samples
,
input_fd
)
!=
frame_length_complex_samples
)
{
printf
(
"error reading from file
\n
"
);
exit
(
-
1
);
}
}
/*
LOG_M
(
"txsig0.m"
,
"txs0"
,
txdata
[
0
],
frame_length_complex_samples
,
1
,
1
);
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
)
LOG_M
(
"txsig1.m"
,
"txs1"
,
txdata
[
1
],
frame_length_complex_samples
,
1
,
1
);
*/
if
(
output_fd
)
fwrite
(
txdata
[
0
],
sizeof
(
int32_t
),
frame_length_complex_samples
,
output_fd
);
int
txlev
=
signal_energy
(
&
txdata
[
0
][
5
*
frame_parms
->
ofdm_symbol_size
+
4
*
frame_parms
->
nb_prefix_samples
+
frame_parms
->
nb_prefix_samples0
],
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
...
...
@@ -568,9 +581,12 @@ int main(int argc, char **argv)
free
(
r_im
);
free
(
txdata
);
if
(
write_output_file
)
if
(
output_fd
)
fclose
(
output_fd
);
if
(
input_fd
)
fclose
(
input_fd
);
return
(
n_errors
);
}
...
...
targets/RT/USER/nr-ue.c
View file @
1f98f05a
...
...
@@ -59,6 +59,8 @@
#include "T.h"
#include "PHY/TOOLS/nr_phy_scope.h"
extern
double
cpuf
;
//static nfapi_nr_config_request_t config_t;
//static nfapi_nr_config_request_t* config =&config_t;
...
...
@@ -435,7 +437,7 @@ static void *UE_thread_synch(void *arg) {
#endif
if
(
nr_initial_sync
(
UE
,
UE
->
mode
)
==
0
)
{
hw_slot_offset
=
(
UE
->
rx_offset
<<
1
)
/
UE
->
frame_parms
.
samples_per_
tti
;
hw_slot_offset
=
(
UE
->
rx_offset
<<
1
)
/
UE
->
frame_parms
.
samples_per_
subframe
;
printf
(
"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d
\n
"
,
hw_slot_offset
,
freq_offset
,
...
...
@@ -488,15 +490,17 @@ static void *UE_thread_synch(void *arg) {
break
;
}
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
// sleep(1);
//nr_init_frame_parms_ue(&UE->frame_parms);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
}*/
if
(
UE
->
mode
!=
loop_through_memory
)
{
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
// sleep(1);
//nr_init_frame_parms_ue(&UE->frame_parms);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
}*/
}
if
(
UE
->
UE_scan_carrier
==
1
)
{
...
...
@@ -532,6 +536,7 @@ static void *UE_thread_synch(void *arg) {
}
else
{
// initial sync failed
// calculate new offset and try again
if
(
UE
->
UE_scan_carrier
==
1
)
{
if
(
freq_offset
>=
0
)
freq_offset
+=
100
;
...
...
@@ -553,6 +558,7 @@ static void *UE_thread_synch(void *arg) {
return
&
UE_thread_synch_retval
;
// not reached
}
}
#if DISABLE_LOG_X
printf
(
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
...
...
@@ -583,6 +589,12 @@ static void *UE_thread_synch(void *arg) {
break
;
}
extern
FD_lte_phy_scope_ue
*
form_ue
[
NUMBER_OF_UE_MAX
];
phy_scope_UE
(
form_ue
[
0
],
PHY_vars_UE_g
[
0
][
0
],
0
,
0
,
7
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
// indicate readiness
UE
->
proc
.
instance_cnt_synch
--
;
...
...
@@ -646,8 +658,8 @@ static void *UE_thread_rxn_txnp4(void *arg) {
}
// initRefTimes(t2);
initRefTimes
(
t3
);
pickTime
(
current
);
//
initRefTimes(t3);
//
pickTime(current);
// updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");
// Process Rx data for one sub-frame
...
...
@@ -796,7 +808,7 @@ void *UE_thread(void *arg) {
PHY_VARS_NR_UE
*
UE
=
(
PHY_VARS_NR_UE
*
)
arg
;
// int tx_enabled = 0;
int
dummy_rx
[
UE
->
frame_parms
.
nb_antennas_rx
][
UE
->
frame_parms
.
samples_per_
tti
]
__attribute__
((
aligned
(
32
)));
int
dummy_rx
[
UE
->
frame_parms
.
nb_antennas_rx
][
UE
->
frame_parms
.
samples_per_
subframe
]
__attribute__
((
aligned
(
32
)));
openair0_timestamp
timestamp
;
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
int
start_rx_stream
=
0
;
...
...
@@ -828,7 +840,7 @@ void *UE_thread(void *arg) {
//itti_send_msg_to_task (TASK_NAS_UE, UE->Mod_id + NB_eNB_INST, message_p);
#endif
int
tti
_nr
=-
1
;
int
subframe
_nr
=-
1
;
//int cumulated_shift=0;
if
((
oaisim_flag
==
0
)
&&
(
UE
->
mode
!=
loop_through_memory
))
AssertFatal
(
UE
->
rfdevice
.
trx_start_func
(
&
UE
->
rfdevice
)
==
0
,
"Could not start the device
\n
"
);
...
...
@@ -876,7 +888,7 @@ void *UE_thread(void *arg) {
if
(
UE
->
mode
!=
loop_through_memory
)
{
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
dummy_rx
[
i
][
0
];
for
(
int
sf
=
0
;
sf
<
LTE
_NUMBER_OF_SUBFRAMES_PER_FRAME
;
sf
++
)
for
(
int
sf
=
0
;
sf
<
NR
_NUMBER_OF_SUBFRAMES_PER_FRAME
;
sf
++
)
// printf("Reading dummy sf %d\n",sf);
AssertFatal
(
UE
->
frame_parms
.
samples_per_subframe
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
...
...
@@ -926,12 +938,11 @@ void *UE_thread(void *arg) {
rt_sleep_ns
(
1000
*
1000
);
}
else
{
tti_nr
++
;
int
ttis_per_frame
=
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME
*
UE
->
frame_parms
.
ttis_per_subframe
;
tti_nr
%=
ttis_per_frame
;
subframe_nr
++
;
subframe_nr
%=
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
;
UE_nr_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
thread_idx
];
// update thread index for received subframe
UE
->
current_thread_id
[
tti
_nr
]
=
thread_idx
;
UE
->
current_thread_id
[
subframe
_nr
]
=
thread_idx
;
#if BASIC_SIMULATOR
{
...
...
@@ -944,7 +955,7 @@ void *UE_thread(void *arg) {
}
}
#endif
LOG_D
(
PHY
,
"Process
TTI %d thread Idx %d
\n
"
,
tti_nr
,
UE
->
current_thread_id
[
tti
_nr
]);
LOG_D
(
PHY
,
"Process
subframe %d thread Idx %d
\n
"
,
subframe_nr
,
UE
->
current_thread_id
[
subframe
_nr
]);
thread_idx
++
;
if
(
thread_idx
>=
RX_NB_TH
)
...
...
@@ -955,14 +966,14 @@ void *UE_thread(void *arg) {
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
rxdata
[
i
][
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
+
tti_nr
*
UE
->
frame_parms
.
samples_per_tti
];
subframe_nr
*
UE
->
frame_parms
.
samples_per_subframe
];
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_tx
;
i
++
)
txp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
txdata
[
i
][((
tti_nr
+
2
)
%
10
*
UE
->
frame_parms
.
ttis_per_subframe
)
*
UE
->
frame_parms
.
samples_per_tti
];
txp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
txdata
[
i
][((
subframe_nr
+
2
)
%
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
)
*
UE
->
frame_parms
.
samples_per_subframe
];
int
readBlockSize
,
writeBlockSize
;
if
(
tti_nr
<
(
ttis_per_frame
-
1
))
{
readBlockSize
=
UE
->
frame_parms
.
samples_per_
tti
;
writeBlockSize
=
UE
->
frame_parms
.
samples_per_
tti
;
if
(
subframe_nr
<
(
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
-
1
))
{
readBlockSize
=
UE
->
frame_parms
.
samples_per_
subframe
;
writeBlockSize
=
UE
->
frame_parms
.
samples_per_
subframe
;
}
else
{
// set TO compensation to zero
UE
->
rx_offset_diff
=
0
;
...
...
@@ -971,15 +982,15 @@ void *UE_thread(void *arg) {
UE
->
rx_offset
>
0
)
UE
->
rx_offset_diff
=
-
1
;
if
(
UE
->
rx_offset
>
5
*
UE
->
frame_parms
.
samples_per_subframe
&&
UE
->
rx_offset
<
10
*
UE
->
frame_parms
.
samples_per_
tti
)
UE
->
rx_offset
<
10
*
UE
->
frame_parms
.
samples_per_
subframe
)
UE
->
rx_offset_diff
=
1
;
LOG_D
(
PHY
,
"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d
\n
"
,
proc
->
frame_rx
,
tti
_nr
,
UE
->
rx_offset_diff
,
UE
->
rx_offset
);
readBlockSize
=
UE
->
frame_parms
.
samples_per_
tti
-
LOG_D
(
PHY
,
"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d
\n
"
,
proc
->
frame_rx
,
subframe
_nr
,
UE
->
rx_offset_diff
,
UE
->
rx_offset
);
readBlockSize
=
UE
->
frame_parms
.
samples_per_
subframe
-
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
-
UE
->
rx_offset_diff
;
writeBlockSize
=
UE
->
frame_parms
.
samples_per_
tti
-
writeBlockSize
=
UE
->
frame_parms
.
samples_per_
subframe
-
UE
->
rx_offset_diff
;
}
...
...
@@ -992,7 +1003,7 @@ void *UE_thread(void *arg) {
AssertFatal
(
writeBlockSize
==
UE
->
rfdevice
.
trx_write_func
(
&
UE
->
rfdevice
,
timestamp
+
(
2
*
UE
->
frame_parms
.
samples_per_
tti
)
-
(
2
*
UE
->
frame_parms
.
samples_per_
subframe
)
-
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
-
openair0_cfg
[
0
].
tx_sample_advance
,
txp
,
...
...
@@ -1000,7 +1011,7 @@ void *UE_thread(void *arg) {
UE
->
frame_parms
.
nb_antennas_tx
,
1
),
""
);
if
(
tti_nr
==
(
ttis_per_frame
-
1
))
{
if
(
subframe_nr
==
(
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
-
1
))
{
// read in first symbol of next frame and adjust for timing drift
int
first_symbols
=
writeBlockSize
-
readBlockSize
;
if
(
first_symbols
>
0
)
...
...
@@ -1013,10 +1024,14 @@ void *UE_thread(void *arg) {
if
(
first_symbols
<
0
)
LOG_E
(
PHY
,
"can't compensate: diff =%d
\n
"
,
first_symbols
);
}
}
//UE->mode != loop_through_memory
else
rt_sleep_ns
(
1000
*
1000
);
pickTime
(
gotIQs
);
// operate on thread sf mod 2
AssertFatal
(
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
)
==
0
,
""
);
if
(
tti
_nr
==
0
)
{
if
(
subframe
_nr
==
0
)
{
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++;
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
...
...
@@ -1038,18 +1053,18 @@ void *UE_thread(void *arg) {
UE
->
proc
.
proc_rxtx
[
th_id
].
gotIQs
=
readTime
(
gotIQs
);
}
proc
->
nr_tti_rx
=
tti
_nr
;
proc
->
subframe_rx
=
tti_nr
>>
((
uint8_t
)(
log2
(
UE
->
frame_parms
.
ttis_per_subframe
)))
;
proc
->
nr_tti_rx
=
subframe
_nr
;
proc
->
subframe_rx
=
subframe_nr
;
proc
->
frame_tx
=
proc
->
frame_rx
;
proc
->
nr_tti_tx
=
tti
_nr
+
DURATION_RX_TO_TX
;
if
(
proc
->
nr_tti_tx
>
ttis_per_frame
)
{
proc
->
nr_tti_tx
=
subframe
_nr
+
DURATION_RX_TO_TX
;
if
(
proc
->
nr_tti_tx
>
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
)
{
proc
->
frame_tx
=
(
proc
->
frame_tx
+
1
)
%
MAX_FRAME_NUMBER
;
proc
->
nr_tti_tx
%=
ttis_per_frame
;
proc
->
nr_tti_tx
%=
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
;
}
proc
->
subframe_tx
=
(
proc
->
nr_tti_tx
)
>>
((
uint8_t
)(
log2
(
UE
->
frame_parms
.
ttis_per_subframe
)))
;
proc
->
subframe_tx
=
subframe_nr
+
DURATION_RX_TO_TX
;
proc
->
timestamp_tx
=
timestamp
+
(
DURATION_RX_TO_TX
*
UE
->
frame_parms
.
samples_per_
tti
)
-
(
DURATION_RX_TO_TX
*
UE
->
frame_parms
.
samples_per_
subframe
)
-
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
;
proc
->
instance_cnt_rxtx
++
;
...
...
@@ -1069,11 +1084,11 @@ void *UE_thread(void *arg) {
char
exit_fun_string
[
256
];
sprintf
(
exit_fun_string
,
"[SCHED][UE %d] !!! UE instance_cnt_rxtx > 2 (IC %d) (Proc %d)!!"
,
UE
->
Mod_id
,
proc
->
instance_cnt_rxtx
,
UE
->
current_thread_id
[
tti
_nr
]);
UE
->
current_thread_id
[
subframe
_nr
]);
printf
(
"%s
\n
"
,
exit_fun_string
);
fflush
(
stdout
);
sleep
(
1
);
exit_fun
(
exit_fun_string
);
exit_fun
(
exit_fun_string
);
}
}
...
...
@@ -1084,10 +1099,6 @@ void *UE_thread(void *arg) {
// updateTimes(lastTime, &t1, 20000, "Delay between two IQ acquisitions (case 1)");
// pickStaticTime(lastTime);
}
else
{
printf
(
"Processing subframe %d"
,
proc
->
subframe_rx
);
getchar
();
}
}
// start_rx_stream==1
}
// UE->is_synchronized==1
...
...
@@ -1115,6 +1126,7 @@ void init_UE_threads(PHY_VARS_NR_UE *UE) {
pthread_mutex_init
(
&
UE
->
proc
.
mutex_synch
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
cond_synch
,
NULL
);
UE
->
proc
.
instance_cnt_synch
=
-
1
;
// the threads are not yet active, therefore access is allowed without locking
int
nb_threads
=
RX_NB_TH
;
...
...
@@ -1187,6 +1199,7 @@ void fill_ue_band_info(void) {
}*/
#endif
/*
int setup_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg) {
int i, CC_id;
...
...
@@ -1226,4 +1239,4 @@ int setup_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_c
}
return 0;
}
*/
targets/RT/USER/nr-uesoftmodem.c
View file @
1f98f05a
...
...
@@ -80,7 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "system.h"
#include "stats.h"
#ifdef XFORMS
#include "PHY/TOOLS/
lte
_phy_scope.h"
#include "PHY/TOOLS/
nr
_phy_scope.h"
//#include "stats.h"
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
...
...
@@ -111,11 +111,10 @@ volatile int oai_exit = 0;
static
clock_source_t
clock_source
=
internal
;
static
int
wait_for_sync
=
0
;
static
char
UE_flag
=
0
;
unsigned
int
mmapped_dma
=
0
;
int
single_thread_flag
=
1
;
unsigned
int
mmapped_dma
=
0
;
int
single_thread_flag
=
1
;
static
char
threequarter_fs
=
0
;
int
threequarter_fs
=
0
;
uint32_t
downlink_frequency
[
MAX_NUM_CCs
][
4
];
int32_t
uplink_frequency_offset
[
MAX_NUM_CCs
][
4
];
...
...
@@ -149,7 +148,7 @@ double rx_gain_off = 0.0;
double
sample_rate
=
30.72e6
;
double
bw
=
10.0e6
;
static
int
tx_max_power
[
MAX_NUM_CCs
];
/* = {0,0}*/
;
static
int
tx_max_power
[
MAX_NUM_CCs
]
=
{
0
}
;
char
rf_config_file
[
1024
];
...
...
@@ -175,7 +174,7 @@ int rx_input_level_dBm;
#ifdef XFORMS
extern
int
otg_enabled
;
static
char
do_forms
=
0
;
int
do_forms
=
0
;
#else
int
otg_enabled
;
#endif
...
...
@@ -415,22 +414,20 @@ static void *scope_thread(void *arg) {
#endif
while
(
!
oai_exit
)
{
if
(
UE_flag
==
1
)
{
//len = dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser
(
form_stats
->
stats_text
);
fl_add_browser_line
(
form_stats
->
stats_text
,
stats_buffer
);
/*phy_scope_UE(form_ue[0],
PHY_vars_UE_g[0][0],
0,
0,7);*/
}
//printf("doing forms\n");
//usleep(100000); // 100 ms
sleep
(
1
);
//len = dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser
(
form_stats
->
stats_text
);
fl_add_browser_line
(
form_stats
->
stats_text
,
stats_buffer
);
if
(
PHY_vars_UE_g
[
0
][
0
]
->
is_synchronized
==
1
)
phy_scope_UE
(
form_ue
[
0
],
PHY_vars_UE_g
[
0
][
0
],
0
,
0
,
7
);
//else it is done in the synch thread
//printf("doing forms\n");
//usleep(100000); // 100 ms
sleep
(
1
);
}
// printf("%s",stats_buffer);
...
...
@@ -502,7 +499,7 @@ static void get_options(void) {
int
CC_id
;
int
tddflag
,
nonbiotflag
;
char
*
loopfile
=
NULL
;
int
dumpframe
;
int
dumpframe
=
0
;
uint32_t
online_log_messages
;
uint32_t
glog_level
,
glog_verbosity
;
uint32_t
start_telnetsrv
;
...
...
@@ -615,10 +612,6 @@ static void get_options(void) {
uecap_xer_in
=
1
;
}
/* UE with config file */
#if defined(OAI_USRP) || defined(CPRIGW) || defined(OAI_ADRV9371_ZC706)
int
clock_src
;
#endif
}
#if T_TRACER
...
...
@@ -1002,8 +995,6 @@ int main( int argc, char **argv ) {
UE
[
CC_id
]
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1235
;
}
rx_gain
[
CC_id
][
0
]
=
81
;
tx_max_power
[
CC_id
]
=
-
40
;
UE
[
CC_id
]
->
rx_total_gain_dB
=
(
int
)
rx_gain
[
CC_id
][
0
]
+
rx_gain_off
;
UE
[
CC_id
]
->
tx_power_max_dBm
=
tx_max_power
[
CC_id
];
...
...
@@ -1120,11 +1111,14 @@ int main( int argc, char **argv ) {
#ifdef XFORMS
int
UE_id
;
int
fl_argc
=
1
;
if
(
do_forms
==
1
)
{
fl_initialize
(
&
argc
,
argv
,
NULL
,
0
,
0
);
form_stats
=
create_form_stats_form
();
// fl_initialize messes with argv and argc, so pretend to not pass any options
fl_initialize
(
&
fl_argc
,
argv
,
NULL
,
0
,
0
);
// restore the original command line args
// argv = fl_get_cmdline_args( &argc );
form_stats
=
create_form_stats_form
();
fl_show_form
(
form_stats
->
stats_form
,
FL_PLACE_HOTSPOT
,
FL_FULLBORDER
,
"stats"
);
UE_id
=
0
;
form_ue
[
UE_id
]
=
create_lte_phy_scope_ue
();
...
...
@@ -1155,48 +1149,34 @@ int main( int argc, char **argv ) {
rt_sleep_ns
(
10
*
100000000ULL
);
// start the main thread
//if (UE_flag == 1) {
init_UE
(
1
);
number_of_cards
=
1
;
init_UE
(
1
);
number_of_cards
=
1
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
PHY_vars_UE_g
[
0
][
CC_id
]
->
rf_map
.
card
=
0
;
PHY_vars_UE_g
[
0
][
CC_id
]
->
rf_map
.
chain
=
CC_id
+
chain_offset
;
}
//}
// connect the TX/RX buffers
//if (UE_flag==1) {
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
#if defined(OAI_USRP) || defined(OAI_ADRV9371_ZC706)
UE
[
CC_id
]
->
hw_timing_advance
=
timing_advance
;
#else
UE
[
CC_id
]
->
hw_timing_advance
=
160
;
#endif
}
if
(
setup_ue_buffers
(
UE
,
&
openair0_cfg
[
0
])
!=
0
)
{
printf
(
"Error setting up eNB buffer
\n
"
);
exit
(
-
1
);
}
if
(
input_fd
)
{
printf
(
"Reading in from file to antenna buffer %d
\n
"
,
0
);
if
(
fread
(
UE
[
0
]
->
common_vars
.
rxdata
[
0
],
sizeof
(
int32_t
),
frame_parms
[
0
]
->
samples_per_subframe
*
10
,
input_fd
)
!=
frame_parms
[
0
]
->
samples_per_subframe
*
10
)
printf
(
"error reading from file
\n
"
);
}
if
(
input_fd
)
{
printf
(
"Reading in from file to antenna buffer %d
\n
"
,
0
);
if
(
fread
(
UE
[
0
]
->
common_vars
.
rxdata
[
0
],
sizeof
(
int32_t
),
frame_parms
[
0
]
->
samples_per_subframe
*
10
,
input_fd
)
!=
frame_parms
[
0
]
->
samples_per_subframe
*
10
)
printf
(
"error reading from file
\n
"
);
}
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
//}
sleep
(
3
);
...
...
@@ -1211,16 +1191,18 @@ int main( int argc, char **argv ) {
printf
(
"TYPE <CTRL-C> TO TERMINATE
\n
"
);
//getchar();
/*
#if defined(ENABLE_ITTI)
printf("Entering ITTI signals handler\n");
itti_wait_tasks_end();
oai_exit=1;
#else
*/
while
(
oai_exit
==
0
)
rt_sleep_ns
(
100000000ULL
);
#endif
//
#endif
// stop threads
#ifdef XFORMS
...
...
targets/RT/USER/nr-uesoftmodem.h
View file @
1f98f05a
...
...
@@ -136,7 +136,7 @@
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"r" , CONFIG_HLP_PRB, 0,
u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8
, 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} \
...
...
@@ -167,8 +167,8 @@
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL,
uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8
, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i
8ptr:&threequarter_fs, defintval:0, TYPE_INT8
, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL,
iptr:&do_forms, defintval:0, TYPE_INT
, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i
ptr:&threequarter_fs, defintval:0, TYPE_INT
, 0}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
...
...
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