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
spbro
OpenXG-RAN
Commits
7c9b5013
Commit
7c9b5013
authored
Jan 19, 2023
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing call from MAC to PHY to clear structures (now automatic clearing)
parent
342ea088
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
472 additions
and
648 deletions
+472
-648
common/openairinterface5g_limits.h
common/openairinterface5g_limits.h
+2
-0
executables/nr-gnb.c
executables/nr-gnb.c
+9
-38
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+22
-0
openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
+8
-7
openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
+10
-9
openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h
openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h
+1
-1
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+13
-12
openair1/PHY/NR_TRANSPORT/nr_dlsch.h
openair1/PHY/NR_TRANSPORT/nr_dlsch.h
+0
-2
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+11
-22
openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
+3
-2
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
+0
-1
openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
+1
-10
openair1/PHY/NR_TRANSPORT/nr_ulsch.c
openair1/PHY/NR_TRANSPORT/nr_ulsch.c
+76
-82
openair1/PHY/NR_TRANSPORT/nr_ulsch.h
openair1/PHY/NR_TRANSPORT/nr_ulsch.h
+2
-1
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+43
-98
openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
+1
-1
openair1/PHY/NR_TRANSPORT/pucch_rx.c
openair1/PHY/NR_TRANSPORT/pucch_rx.c
+70
-103
openair1/PHY/NR_TRANSPORT/srs_rx.c
openair1/PHY/NR_TRANSPORT/srs_rx.c
+15
-33
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+30
-32
openair1/SCHED_NR/fapi_nr_l1.c
openair1/SCHED_NR/fapi_nr_l1.c
+7
-6
openair1/SCHED_NR/phy_procedures_nr_gNB.c
openair1/SCHED_NR/phy_procedures_nr_gNB.c
+145
-154
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+3
-27
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+0
-7
No files found.
common/openairinterface5g_limits.h
View file @
7c9b5013
...
...
@@ -15,6 +15,8 @@
# define NUMBER_OF_SCH_STATS_MAX 16
# define NUMBER_OF_NR_SCH_STATS_MAX MAX_MOBILES_PER_GNB
# define NUMBER_FRAMES_PHY_UE_INACTIVE 10
#define MAX_MANAGED_ENB_PER_MOBILE 2
#define MAX_MANAGED_GNB_PER_MOBILE 2
...
...
executables/nr-gnb.c
View file @
7c9b5013
...
...
@@ -128,7 +128,9 @@ void tx_func(void *param) {
}
void
rx_func
(
void
*
param
)
{
void
rx_func
(
void
*
param
)
{
processingData_L1_t
*
info
=
(
processingData_L1_t
*
)
param
;
PHY_VARS_gNB
*
gNB
=
info
->
gNB
;
int
frame_rx
=
info
->
frame_rx
;
...
...
@@ -173,46 +175,15 @@ void rx_func(void *param) {
T
(
T_GNB_PHY_DL_TICK
,
T_INT
(
gNB
->
Mod_id
),
T_INT
(
frame_tx
),
T_INT
(
slot_tx
));
/* hack to remove UEs */
extern
int
rnti_to_remove
[
10
];
extern
volatile
int
rnti_to_remove_count
;
extern
pthread_mutex_t
rnti_to_remove_mutex
;
if
(
pthread_mutex_lock
(
&
rnti_to_remove_mutex
))
exit
(
1
);
int
up_removed
=
0
;
int
down_removed
=
0
;
int
pucch_removed
=
0
;
for
(
int
i
=
0
;
i
<
rnti_to_remove_count
;
i
++
)
{
LOG_W
(
NR_PHY
,
"to remove rnti 0x%04x
\n
"
,
rnti_to_remove
[
i
]);
void
clean_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
);
void
clean_gNB_dlsch
(
NR_gNB_DLSCH_t
*
dlsch
);
int
j
;
for
(
j
=
0
;
j
<
NUMBER_OF_NR_ULSCH_MAX
;
j
++
)
if
(
gNB
->
ulsch
[
j
]
->
rnti
==
rnti_to_remove
[
i
])
{
gNB
->
ulsch
[
j
]
->
rnti
=
0
;
gNB
->
ulsch
[
j
]
->
harq_mask
=
0
;
int
h
;
for
(
h
=
0
;
h
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
h
++
)
{
gNB
->
ulsch
[
j
]
->
harq_processes
[
h
]
->
status
=
NR_SCH_IDLE
;
gNB
->
ulsch
[
j
]
->
harq_processes
[
h
]
->
round
=
0
;
gNB
->
ulsch
[
j
]
->
harq_processes
[
h
]
->
handled
=
0
;
}
up_removed
++
;
}
for
(
j
=
0
;
j
<
gNB
->
max_nb_pucch
;
j
++
)
if
(
gNB
->
pucch
[
j
]
->
active
>
0
&&
gNB
->
pucch
[
j
]
->
pucch_pdu
.
rnti
==
rnti_to_remove
[
i
])
{
gNB
->
pucch
[
j
]
->
active
=
0
;
gNB
->
pucch
[
j
]
->
pucch_pdu
.
rnti
=
0
;
pucch_removed
++
;
}
// disactivate PHY stats if UE is inactive for more than 10 frames
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
NR_gNB_PHY_STATS_t
*
stats
=
&
gNB
->
phy_stats
[
i
];
if
(
stats
->
active
&&
(
frame_rx
>
(
stats
->
frame
+
NUMBER_FRAMES_PHY_UE_INACTIVE
)
%
1024
))
stats
->
active
=
false
;
}
if
(
rnti_to_remove_count
)
LOG_W
(
NR_PHY
,
"to remove rnti_to_remove_count=%d, up_removed=%d down_removed=%d pucch_removed=%d
\n
"
,
rnti_to_remove_count
,
up_removed
,
down_removed
,
pucch_removed
);
rnti_to_remove_count
=
0
;
if
(
pthread_mutex_unlock
(
&
rnti_to_remove_mutex
))
exit
(
1
);
// RX processing
int
rx_slot_type
=
nr_slot_select
(
cfg
,
frame_rx
,
slot_rx
);
int
rx_slot_type
=
nr_slot_select
(
cfg
,
frame_rx
,
slot_rx
);
if
(
rx_slot_type
==
NR_UPLINK_SLOT
||
rx_slot_type
==
NR_MIXED_SLOT
)
{
// UE-specific RX processing for subframe n
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT
...
...
openair1/PHY/INIT/nr_init.c
View file @
7c9b5013
...
...
@@ -77,6 +77,28 @@ void init_ul_delay_table(NR_DL_FRAME_PARMS *fp)
}
}
NR_gNB_PHY_STATS_t
*
get_phy_stats
(
PHY_VARS_gNB
*
gNB
,
uint16_t
rnti
)
{
NR_gNB_PHY_STATS_t
*
stats
;
int
first_free
=
-
1
;
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
stats
=
&
gNB
->
phy_stats
[
i
];
if
(
stats
->
active
&&
stats
->
rnti
==
rnti
)
return
stats
;
else
if
(
!
stats
->
active
&&
first_free
==
-
1
)
first_free
=
i
;
}
// new stats
AssertFatal
(
first_free
>=
0
,
"PHY statistics list is full
\n
"
);
stats
=
&
gNB
->
phy_stats
[
first_free
];
stats
->
active
=
true
;
stats
->
rnti
=
rnti
;
memset
((
void
*
)
&
stats
->
dlsch_stats
,
0
,
sizeof
(
stats
->
dlsch_stats
));
memset
((
void
*
)
&
stats
->
ulsch_stats
,
0
,
sizeof
(
stats
->
ulsch_stats
));
memset
((
void
*
)
&
stats
->
uci_stats
,
0
,
sizeof
(
stats
->
uci_stats
));
return
(
stats
);
}
int
init_codebook_gNB
(
PHY_VARS_gNB
*
gNB
)
{
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
){
...
...
openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
View file @
7c9b5013
...
...
@@ -38,7 +38,7 @@
extern
openair0_config_t
openair0_cfg
[
MAX_CARDS
];
void
nr_est_timing_advance_pusch
(
const
NR_DL_FRAME_PARMS
*
frame_parms
,
const
int32_t
*
ul_ch_estimates_time
,
struct
delay_s
*
delay
)
void
nr_est_timing_advance_pusch
(
const
NR_DL_FRAME_PARMS
*
frame_parms
,
const
int32_t
*
ul_ch_estimates_time
,
NR_ULSCH_delay_t
*
delay
)
{
int
max_pos
=
delay
->
pusch_delay_max_pos
;
int
max_val
=
delay
->
pusch_delay_max_val
;
...
...
@@ -208,19 +208,20 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
//
// Todo:
// - averaging IIR filter for RX power and noise
void
nr_gnb_measurements
(
PHY_VARS_gNB
*
gNB
,
uint8_t
ulsch_id
,
unsigned
char
harq_pid
,
unsigned
char
symbol
,
uint8_t
nrOfLayers
){
void
nr_gnb_measurements
(
PHY_VARS_gNB
*
gNB
,
uint8_t
ulsch_id
,
unsigned
char
harq_pid
,
unsigned
char
symbol
,
uint8_t
nrOfLayers
)
{
int
rx_power_tot
[
NUMBER_OF_NR_ULSCH_MAX
];
int
rx_power
[
NUMBER_OF_NR_ULSCH_MAX
][
NB_ANTENNAS_RX
];
unsigned
short
rx_power_avg_dB
[
NUMBER_OF_NR_ULSCH_MAX
];
unsigned
short
rx_power_tot_dB
[
NUMBER_OF_NR_ULSCH_MAX
];
double
rx_gain
=
openair0_cfg
[
0
].
rx_gain
[
0
];
double
rx_gain_offset
=
openair0_cfg
[
0
].
rx_gain_offset
[
0
];
double
rx_gain
=
openair0_cfg
[
0
].
rx_gain
[
0
];
double
rx_gain_offset
=
openair0_cfg
[
0
].
rx_gain_offset
[
0
];
PHY_MEASUREMENTS_gNB
*
meas
=
&
gNB
->
measurements
;
NR_DL_FRAME_PARMS
*
fp
=
&
gNB
->
frame_parms
;
int
ch_offset
=
fp
->
ofdm_symbol_size
*
symbol
;
int
N_RB_UL
=
gNB
->
ulsch
[
ulsch_id
]
->
harq_processes
[
harq_pid
]
->
ulsch_pdu
.
rb_size
;
NR_DL_FRAME_PARMS
*
fp
=
&
gNB
->
frame_parms
;
int
ch_offset
=
fp
->
ofdm_symbol_size
*
symbol
;
int
N_RB_UL
=
gNB
->
ulsch
[
ulsch_id
]
->
harq_process
->
ulsch_pdu
.
rb_size
;
rx_power_tot
[
ulsch_id
]
=
0
;
...
...
openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
View file @
7c9b5013
...
...
@@ -187,7 +187,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
c16_t
ul_ls_est
[
symbolSize
]
__attribute__
((
aligned
(
32
)));
memset
(
ul_ls_est
,
0
,
sizeof
(
c16_t
)
*
symbolSize
);
memset
(
&
gNB
->
measurements
.
delay
[
ul_id
],
0
,
sizeof
(
gNB
->
measurements
.
delay
[
ul_id
]));
NR_ULSCH_delay_t
*
delay
=
&
gNB
->
ulsch
[
ul_id
]
->
delay
;
memset
(
&
delay
,
0
,
sizeof
(
delay
));
for
(
int
aarx
=
0
;
aarx
<
gNB
->
frame_parms
.
nb_antennas_rx
;
aarx
++
)
{
c16_t
*
rxdataF
=
(
c16_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
aarx
][
symbol_offset
];
...
...
@@ -232,13 +233,13 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
(
int16_t
*
)
ul_ls_est
,
(
int16_t
*
)
gNB
->
pusch_vars
[
ul_id
]
->
ul_ch_estimates_time
[
aarx
]);
nr_est_timing_advance_pusch
(
&
gNB
->
frame_parms
,
gNB
->
pusch_vars
[
ul_id
]
->
ul_ch_estimates_time
[
aarx
],
&
gNB
->
measurements
.
delay
[
ul_id
]
);
int
delay
=
gNB
->
measurements
.
delay
[
ul_id
].
pusch_est_delay
;
int
delay_idx
=
get_delay_idx
(
delay
);
nr_est_timing_advance_pusch
(
&
gNB
->
frame_parms
,
gNB
->
pusch_vars
[
ul_id
]
->
ul_ch_estimates_time
[
aarx
],
delay
);
int
pusch_delay
=
delay
->
pusch_est_delay
;
int
delay_idx
=
get_delay_idx
(
pusch_
delay
);
c16_t
*
ul_delay_table
=
gNB
->
frame_parms
.
ul_delay_table
[
delay_idx
];
#ifdef DEBUG_PUSCH
printf
(
"Estimated delay = %i
\n
"
,
delay
>>
1
);
printf
(
"Estimated delay = %i
\n
"
,
pusch_
delay
>>
1
);
#endif
pilot_cnt
=
0
;
...
...
@@ -277,7 +278,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
// Revert delay
pilot_cnt
=
0
;
ul_ch
=
&
ul_ch_estimates
[
p
*
gNB
->
frame_parms
.
nb_antennas_rx
+
aarx
][
ch_offset
];
int
inv_delay_idx
=
get_delay_idx
(
-
delay
);
int
inv_delay_idx
=
get_delay_idx
(
-
pusch_
delay
);
c16_t
*
ul_inv_delay_table
=
gNB
->
frame_parms
.
ul_delay_table
[
inv_delay_idx
];
for
(
int
n
=
0
;
n
<
3
*
nb_rb_pusch
;
n
++
)
{
for
(
int
k_line
=
0
;
k_line
<=
1
;
k_line
++
)
{
...
...
@@ -311,9 +312,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
// Delay compensation
freq2time
(
symbolSize
,
(
int16_t
*
)
ul_ls_est
,
(
int16_t
*
)
gNB
->
pusch_vars
[
ul_id
]
->
ul_ch_estimates_time
[
aarx
]);
nr_est_timing_advance_pusch
(
&
gNB
->
frame_parms
,
gNB
->
pusch_vars
[
ul_id
]
->
ul_ch_estimates_time
[
aarx
],
&
gNB
->
measurements
.
delay
[
ul_id
]
);
int
delay
=
gNB
->
measurements
.
delay
[
ul_id
].
pusch_est_delay
;
int
delay_idx
=
get_delay_idx
(
-
delay
);
nr_est_timing_advance_pusch
(
&
gNB
->
frame_parms
,
gNB
->
pusch_vars
[
ul_id
]
->
ul_ch_estimates_time
[
aarx
],
delay
);
int
pusch_delay
=
delay
->
pusch_est_delay
;
int
delay_idx
=
get_delay_idx
(
-
pusch_
delay
);
c16_t
*
ul_delay_table
=
gNB
->
frame_parms
.
ul_delay_table
[
delay_idx
];
for
(
int
n
=
0
;
n
<
nb_rb_pusch
*
NR_NB_SC_PER_RB
;
n
++
)
{
ul_ch
[
n
]
=
c16mulShift
(
ul_ls_est
[
n
],
ul_delay_table
[
n
%
6
],
8
);
...
...
openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h
View file @
7c9b5013
...
...
@@ -55,7 +55,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb)
void
nr_gnb_measurements
(
PHY_VARS_gNB
*
gNB
,
uint8_t
ulsch_id
,
unsigned
char
harq_pid
,
unsigned
char
symbol
,
uint8_t
nrOfLayers
);
void
nr_est_timing_advance_pusch
(
const
NR_DL_FRAME_PARMS
*
frame_parms
,
const
int32_t
*
ul_ch_estimates_time
,
struct
delay_s
*
delay
);
void
nr_est_timing_advance_pusch
(
const
NR_DL_FRAME_PARMS
*
frame_parms
,
const
int32_t
*
ul_ch_estimates_time
,
NR_ULSCH_delay_t
*
delay
);
int
nr_est_timing_advance_srs
(
const
NR_DL_FRAME_PARMS
*
frame_parms
,
const
int32_t
srs_estimated_channel_time
[][
frame_parms
->
ofdm_symbol_size
]);
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
7c9b5013
...
...
@@ -568,20 +568,21 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
void
dump_pdsch_stats
(
FILE
*
fd
,
PHY_VARS_gNB
*
gNB
)
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
if
(
gNB
->
dlsch_stats
[
i
].
rnti
>
0
&&
gNB
->
dlsch_stats
[
i
].
frame
!=
gNB
->
dlsch_stats
[
i
].
dump_frame
)
{
gNB
->
dlsch_stats
[
i
].
dump_frame
=
gNB
->
dlsch_stats
[
i
].
frame
;
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
NR_gNB_PHY_STATS_t
*
stats
=
&
gNB
->
phy_stats
[
i
];
if
(
stats
->
active
&&
stats
->
frame
!=
stats
->
dlsch_stats
.
dump_frame
)
{
stats
->
dlsch_stats
.
dump_frame
=
stats
->
frame
;
fprintf
(
fd
,
"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d
\n
"
,
gNB
->
dlsch_stats
[
i
].
rnti
,
gNB
->
dlsch_stats
[
i
]
.
current_Qm
,
gNB
->
dlsch_stats
[
i
]
.
current_RI
,
gNB
->
dlsch_stats
[
i
]
.
total_bytes_tx
);
stats
->
rnti
,
stats
->
dlsch_stats
.
current_Qm
,
stats
->
dlsch_stats
.
current_RI
,
stats
->
dlsch_stats
.
total_bytes_tx
);
}
}
}
void
clear_pdsch_stats
(
PHY_VARS_gNB
*
gNB
)
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
memset
((
void
*
)
&
gNB
->
dlsch_stats
[
i
],
0
,
sizeof
(
gNB
->
dlsch_stats
[
i
]
));
void
clear_pdsch_stats
(
PHY_VARS_gNB
*
gNB
)
{
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
memset
((
void
*
)
&
gNB
->
phy_stats
[
i
].
dlsch_stats
,
0
,
sizeof
(
gNB
->
phy_stats
[
i
].
dlsch_stats
));
}
openair1/PHY/NR_TRANSPORT/nr_dlsch.h
View file @
7c9b5013
...
...
@@ -52,8 +52,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
void
clean_gNB_dlsch
(
NR_gNB_DLSCH_t
*
dlsch
);
void
clean_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
);
int16_t
find_nr_dlsch
(
uint16_t
rnti
,
PHY_VARS_gNB
*
gNB
,
find_type_t
type
);
NR_gNB_SCH_STATS_t
*
find_nr_dlsch_stats
(
uint16_t
rnti
,
PHY_VARS_gNB
*
gNB
,
find_type_t
type
);
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
7c9b5013
...
...
@@ -167,7 +167,6 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
void
clean_gNB_dlsch
(
NR_gNB_DLSCH_t
*
dlsch
)
{
AssertFatal
(
dlsch
!=
NULL
,
"dlsch is null
\n
"
);
dlsch
->
rnti
=
0
;
dlsch
->
active
=
0
;
}
...
...
@@ -280,7 +279,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned
char
*
output
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
,
time_stats_t
*
dlsch_rate_matching_stats
,
time_stats_t
*
dlsch_interleaving_stats
,
time_stats_t
*
dlsch_segmentation_stats
)
{
time_stats_t
*
dlsch_segmentation_stats
)
{
encoder_implemparams_t
impp
;
impp
.
output
=
output
;
unsigned
int
crc
=
1
;
...
...
@@ -289,29 +289,18 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING
,
VCD_FUNCTION_IN
);
uint32_t
A
=
rel15
->
TBSize
[
0
]
<<
3
;
unsigned
char
*
a
=
harq
->
pdu
;
if
(
rel15
->
rnti
!=
SI_RNTI
)
if
(
rel15
->
rnti
!=
SI_RNTI
)
trace_NRpdu
(
DIRECTION_DOWNLINK
,
a
,
rel15
->
TBSize
[
0
],
WS_C_RNTI
,
rel15
->
rnti
,
frame
,
slot
,
0
,
0
);
NR_gNB_SCH_STATS_t
*
stats
=
NULL
;
int
first_free
=-
1
;
NR_gNB_PHY_STATS_t
*
phy_stats
=
NULL
;
if
(
rel15
->
rnti
!=
0xFFFF
)
phy_stats
=
get_phy_stats
(
gNB
,
rel15
->
rnti
);
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
{
if
(
gNB
->
dlsch_stats
[
i
].
rnti
==
0
&&
first_free
==
-
1
)
{
first_free
=
i
;
stats
=&
gNB
->
dlsch_stats
[
i
];
}
if
(
gNB
->
dlsch_stats
[
i
].
rnti
==
rel15
->
rnti
)
{
stats
=&
gNB
->
dlsch_stats
[
i
];
break
;
}
}
if
(
stats
)
{
stats
->
rnti
=
rel15
->
rnti
;
stats
->
total_bytes_tx
+=
rel15
->
TBSize
[
0
];
stats
->
current_RI
=
rel15
->
nrOfLayers
;
stats
->
current_Qm
=
rel15
->
qamModOrder
[
0
];
if
(
phy_stats
)
{
phy_stats
->
frame
=
frame
;
phy_stats
->
dlsch_stats
.
total_bytes_tx
+=
rel15
->
TBSize
[
0
];
phy_stats
->
dlsch_stats
.
current_RI
=
rel15
->
nrOfLayers
;
phy_stats
->
dlsch_stats
.
current_Qm
=
rel15
->
qamModOrder
[
0
];
}
int
max_bytes
=
MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER
*
rel15
->
nrOfLayers
*
1056
;
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
View file @
7c9b5013
...
...
@@ -46,14 +46,15 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
void
nr_fill_dlsch
(
processingData_L1tx_t
*
msgTx
,
nfapi_nr_dl_tti_pdsch_pdu
*
pdsch_pdu
,
uint8_t
*
sdu
)
{
uint8_t
*
sdu
)
{
NR_gNB_DLSCH_t
*
dlsch
=
msgTx
->
dlsch
[
msgTx
->
num_pdsch_slot
][
0
];
NR_DL_gNB_HARQ_t
*
harq
=
&
dlsch
->
harq_process
;
/// DLSCH struct
memcpy
((
void
*
)
&
harq
->
pdsch_pdu
,
(
void
*
)
pdsch_pdu
,
sizeof
(
nfapi_nr_dl_tti_pdsch_pdu
));
msgTx
->
num_pdsch_slot
++
;
AssertFatal
(
sdu
!=
NULL
,
"sdu is null
\n
"
);
AssertFatal
(
sdu
!=
NULL
,
"sdu is null
\n
"
);
harq
->
pdu
=
sdu
;
}
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
View file @
7c9b5013
...
...
@@ -40,7 +40,6 @@
#include "PHY/defs_nr_common.h"
void
nr_group_sequence_hopping
(
pucch_GroupHopping_t
PUCCH_GroupHopping
,
uint32_t
n_id
,
uint8_t
n_hop
,
...
...
openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
View file @
7c9b5013
...
...
@@ -38,6 +38,7 @@
#define NR_PBCH_PDU_BITS 24
NR_gNB_PHY_STATS_t
*
get_phy_stats
(
PHY_VARS_gNB
*
gNB
,
uint16_t
rnti
);
int
nr_generate_prs
(
uint32_t
**
nr_gold_prs
,
c16_t
*
txdataF
,
...
...
@@ -312,19 +313,9 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
int
slot
,
nfapi_nr_pucch_pdu_t
*
pucch_pdu
);
int
nr_find_pucch
(
uint16_t
rnti
,
int
frame
,
int
slot
,
PHY_VARS_gNB
*
gNB
);
NR_gNB_SRS_t
*
new_gNB_srs
(
void
);
void
free_gNB_srs
(
NR_gNB_SRS_t
*
srs
);
int
nr_find_srs
(
rnti_t
rnti
,
frame_t
frame
,
slot_t
slot
,
PHY_VARS_gNB
*
gNB
);
void
nr_fill_srs
(
PHY_VARS_gNB
*
gNB
,
frame_t
frame
,
slot_t
slot
,
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch.c
View file @
7c9b5013
...
...
@@ -34,57 +34,63 @@
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
int16_t
find_nr_ulsch
(
uint16_t
rnti
,
PHY_VARS_gNB
*
gNB
,
find_type_t
type
)
{
uint16_t
i
;
int16_t
first_free_index
=-
1
;
AssertFatal
(
gNB
!=
NULL
,
"gNB is null
\n
"
);
for
(
i
=
0
;
i
<
NUMBER_OF_NR_ULSCH_MAX
;
i
++
)
{
AssertFatal
(
gNB
->
ulsch
[
i
]
!=
NULL
,
"gNB->ulsch[%d] is null
\n
"
,
i
);
LOG_D
(
PHY
,
"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d
\n
"
,
rnti
,
i
,
gNB
->
ulsch
[
i
]
->
harq_mask
,
gNB
->
ulsch
[
i
]
->
rnti
,
first_free_index
);
if
((
gNB
->
ulsch
[
i
]
->
harq_mask
>
0
)
&&
(
gNB
->
ulsch
[
i
]
->
rnti
==
rnti
))
return
i
;
else
if
((
gNB
->
ulsch
[
i
]
->
harq_mask
==
0
)
&&
(
first_free_index
==-
1
))
first_free_index
=
i
;
int16_t
find_nr_ulsch
(
PHY_VARS_gNB
*
gNB
,
uint16_t
rnti
,
int
pid
,
int
frame
)
{
int16_t
first_free_index
=
-
1
;
AssertFatal
(
gNB
!=
NULL
,
"gNB is null
\n
"
);
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_ULSCH_MAX
;
i
++
)
{
NR_gNB_ULSCH_t
*
ulsch
=
gNB
->
ulsch
[
i
];
AssertFatal
(
ulsch
!=
NULL
,
"gNB->ulsch[%d] is null
\n
"
,
i
);
if
(
!
ulsch
->
active
)
{
if
(
first_free_index
==
-
1
)
first_free_index
=
i
;
}
else
{
// if there is already an active ULSCH for this RNTI and HARQ_PID
if
((
ulsch
->
harq_pid
==
pid
)
&&
(
ulsch
->
rnti
==
rnti
))
return
i
;
// remove inactive ULSCH (from disconnected UEs)
else
if
((
frame
>
(
ulsch
->
harq_process
->
frame
+
NUMBER_FRAMES_PHY_UE_INACTIVE
)
%
1024
))
ulsch
->
active
=
false
;
}
}
if
(
type
==
SEARCH_EXIST
)
return
-
1
;
if
(
first_free_index
!=
-
1
)
gNB
->
ulsch
[
first_free_index
]
->
rnti
=
0
;
return
first_free_index
;
}
void
nr_fill_ulsch
(
PHY_VARS_gNB
*
gNB
,
int
frame
,
int
slot
,
nfapi_nr_pusch_pdu_t
*
ulsch_pdu
)
{
nfapi_nr_pusch_pdu_t
*
ulsch_pdu
)
{
int
ulsch_id
=
find_nr_ulsch
(
ulsch_pdu
->
rnti
,
gNB
,
SEARCH_EXIST_OR_FREE
);
int
harq_pid
=
ulsch_pdu
->
pusch_data
.
harq_process_id
;
int
ulsch_id
=
find_nr_ulsch
(
gNB
,
ulsch_pdu
->
rnti
,
harq_pid
,
frame
);
AssertFatal
((
ulsch_id
>=
0
)
&&
(
ulsch_id
<
NUMBER_OF_NR_ULSCH_MAX
),
"illegal or no ulsch_id found!!! rnti %04x ulsch_id %d
\n
"
,
ulsch_pdu
->
rnti
,
ulsch_id
);
NR_gNB_ULSCH_t
*
ulsch
=
gNB
->
ulsch
[
ulsch_id
];
int
harq_pid
=
ulsch_pdu
->
pusch_data
.
harq_process_id
;
ulsch
->
rnti
=
ulsch_pdu
->
rnti
;
//ulsch->rnti_type;
ulsch
->
harq_mask
|=
1
<<
harq_pid
;
NR_UL_gNB_HARQ_t
*
harq
=
ulsch
->
harq_processes
[
harq_pid
];
harq
->
frame
=
frame
;
harq
->
slot
=
slot
;
harq
->
handled
=
0
;
harq
->
status
=
NR_ACTIVE
;
ulsch
->
harq_pid
=
harq_pid
;
ulsch
->
handled
=
0
;
ulsch
->
active
=
true
;
NR_UL_gNB_HARQ_t
*
harq
=
ulsch
->
harq_process
;
harq
->
frame
=
frame
;
harq
->
slot
=
slot
;
harq
->
new_rx
=
ulsch_pdu
->
pusch_data
.
new_data_indicator
;
LOG_D
(
PHY
,
"ULSCH ID %d RNTI %x HARQ PID %d new data indicator %d
\n
"
,
ulsch_id
,
ulsch_pdu
->
rnti
,
harq_pid
,
ulsch_pdu
->
pusch_data
.
new_data_indicator
);
LOG_D
(
PHY
,
"%d.%d ULSCH ID %d RNTI %x HARQ PID %d new data indicator %d
\n
"
,
frame
,
slot
,
ulsch_id
,
ulsch_pdu
->
rnti
,
harq_pid
,
ulsch_pdu
->
pusch_data
.
new_data_indicator
);
if
(
harq
->
new_rx
)
harq
->
round
=
0
;
else
harq
->
round
++
;
memcpy
((
void
*
)
&
ulsch
->
harq_processes
[
harq_pid
]
->
ulsch_pdu
,
(
void
*
)
ulsch_pdu
,
sizeof
(
nfapi_nr_pusch_pdu_t
));
LOG_D
(
PHY
,
"Initializing nFAPI for ULSCH, UE %d, harq_pid %d
\n
"
,
ulsch_id
,
harq_pid
);
memcpy
((
void
*
)
&
ulsch
->
harq_process
->
ulsch_pdu
,
(
void
*
)
ulsch_pdu
,
sizeof
(
nfapi_nr_pusch_pdu_t
));
LOG_D
(
PHY
,
"Initializing nFAPI for ULSCH, UE %d, harq_pid %d
\n
"
,
ulsch_id
,
harq_pid
);
}
void
nr_ulsch_unscrambling
(
int16_t
*
llr
,
uint32_t
size
,
uint32_t
Nid
,
uint32_t
n_RNTI
)
...
...
@@ -93,10 +99,10 @@ void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n
}
void
nr_ulsch_layer_demapping
(
int16_t
*
llr_cw
,
uint8_t
Nl
,
uint8_t
mod_order
,
uint32_t
length
,
int16_t
**
llr_layers
)
uint8_t
Nl
,
uint8_t
mod_order
,
uint32_t
length
,
int16_t
**
llr_layers
)
{
switch
(
Nl
)
{
...
...
@@ -115,63 +121,51 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw,
}
break
;
default:
AssertFatal
(
0
,
"Not supported number of layers %d
\n
"
,
Nl
);
AssertFatal
(
0
,
"Not supported number of layers %d
\n
"
,
Nl
);
}
}
void
dump_pusch_stats
(
FILE
*
fd
,
PHY_VARS_gNB
*
gNB
)
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
{
void
dump_pusch_stats
(
FILE
*
fd
,
PHY_VARS_gNB
*
gNB
)
{
if
(
gNB
->
ulsch_stats
[
i
].
rnti
>
0
&&
gNB
->
ulsch_stats
[
i
].
frame
!=
gNB
->
ulsch_stats
[
i
].
dump_frame
)
{
gNB
->
ulsch_stats
[
i
].
dump_frame
=
gNB
->
ulsch_stats
[
i
].
frame
;
for
(
int
aa
=
0
;
aa
<
gNB
->
frame_parms
.
nb_antennas_rx
;
aa
++
)
if
(
aa
==
0
)
fprintf
(
fd
,
"ULSCH RNTI %4x, %d.%d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d
\n
"
,
gNB
->
ulsch_stats
[
i
].
rnti
,
gNB
->
ulsch_stats
[
i
].
frame
,
gNB
->
ulsch_stats
[
i
].
dump_frame
,
aa
,
gNB
->
ulsch_stats
[
i
].
power
[
aa
]
/
10
,
gNB
->
ulsch_stats
[
i
].
power
[
aa
]
%
10
,
aa
,
gNB
->
ulsch_stats
[
i
].
noise_power
[
aa
]
/
10
,
gNB
->
ulsch_stats
[
i
].
noise_power
[
aa
]
%
10
,
gNB
->
ulsch_stats
[
i
].
sync_pos
);
else
fprintf
(
fd
,
" ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d
\n
"
,
aa
,
gNB
->
ulsch_stats
[
i
].
power
[
aa
]
/
10
,
gNB
->
ulsch_stats
[
i
].
power
[
aa
]
%
10
,
aa
,
gNB
->
ulsch_stats
[
i
].
noise_power
[
aa
]
/
10
,
gNB
->
ulsch_stats
[
i
].
noise_power
[
aa
]
%
10
);
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
NR_gNB_PHY_STATS_t
*
stats
=
&
gNB
->
phy_stats
[
i
];
if
(
stats
->
active
&&
stats
->
frame
!=
stats
->
ulsch_stats
.
dump_frame
)
{
stats
->
ulsch_stats
.
dump_frame
=
stats
->
frame
;
for
(
int
aa
=
0
;
aa
<
gNB
->
frame_parms
.
nb_antennas_rx
;
aa
++
)
if
(
aa
==
0
)
fprintf
(
fd
,
"ULSCH RNTI %4x, %d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d
\n
"
,
stats
->
rnti
,
stats
->
frame
,
aa
,
stats
->
ulsch_stats
.
power
[
aa
]
/
10
,
stats
->
ulsch_stats
.
power
[
aa
]
%
10
,
aa
,
stats
->
ulsch_stats
.
noise_power
[
aa
]
/
10
,
stats
->
ulsch_stats
.
noise_power
[
aa
]
%
10
,
stats
->
ulsch_stats
.
sync_pos
);
else
fprintf
(
fd
,
" ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d
\n
"
,
aa
,
stats
->
ulsch_stats
.
power
[
aa
]
/
10
,
stats
->
ulsch_stats
.
power
[
aa
]
%
10
,
aa
,
stats
->
ulsch_stats
.
noise_power
[
aa
]
/
10
,
stats
->
ulsch_stats
.
noise_power
[
aa
]
%
10
);
fprintf
(
fd
,
" round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d
\n
"
,
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
0
],
(
double
)
gNB
->
ulsch_stats
[
i
].
round_trials
[
1
]
/
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
0
],
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
1
],
(
double
)
gNB
->
ulsch_stats
[
i
].
round_trials
[
2
]
/
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
0
],
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
2
],
(
double
)
gNB
->
ulsch_stats
[
i
].
round_trials
[
3
]
/
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
0
],
gNB
->
ulsch_stats
[
i
]
.
round_trials
[
3
],
gNB
->
ulsch_stats
[
i
]
.
DTX
,
gNB
->
ulsch_stats
[
i
]
.
current_Qm
,
gNB
->
ulsch_stats
[
i
]
.
current_RI
,
gNB
->
ulsch_stats
[
i
]
.
total_bytes_rx
,
gNB
->
ulsch_stats
[
i
]
.
total_bytes_tx
);
stats
->
ulsch_stats
.
round_trials
[
0
],
(
double
)
stats
->
ulsch_stats
.
round_trials
[
1
]
/
stats
->
ulsch_stats
.
round_trials
[
0
],
stats
->
ulsch_stats
.
round_trials
[
1
],
(
double
)
stats
->
ulsch_stats
.
round_trials
[
2
]
/
stats
->
ulsch_stats
.
round_trials
[
0
],
stats
->
ulsch_stats
.
round_trials
[
2
],
(
double
)
stats
->
ulsch_stats
.
round_trials
[
3
]
/
stats
->
ulsch_stats
.
round_trials
[
0
],
stats
->
ulsch_stats
.
round_trials
[
3
],
stats
->
ulsch_stats
.
DTX
,
stats
->
ulsch_stats
.
current_Qm
,
stats
->
ulsch_stats
.
current_RI
,
stats
->
ulsch_stats
.
total_bytes_rx
,
stats
->
ulsch_stats
.
total_bytes_tx
);
}
}
}
}
void
clear_pusch_stats
(
PHY_VARS_gNB
*
gNB
)
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_ULSCH_MAX
;
i
++
)
memset
((
void
*
)
&
gNB
->
ulsch_stats
[
i
],
0
,
sizeof
(
gNB
->
ulsch_stats
[
i
]
));
void
clear_pusch_stats
(
PHY_VARS_gNB
*
gNB
)
{
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
memset
((
void
*
)
&
gNB
->
phy_stats
[
i
].
ulsch_stats
,
0
,
sizeof
(
gNB
->
phy_stats
[
i
].
ulsch_stats
));
}
NR_gNB_SCH_STATS_t
*
get_ulsch_stats
(
PHY_VARS_gNB
*
gNB
,
NR_gNB_ULSCH_t
*
ulsch
)
{
NR_gNB_SCH_STATS_t
*
stats
=
NULL
;
int
first_free
=-
1
;
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_ULSCH_MAX
;
i
++
)
{
if
(
gNB
->
ulsch_stats
[
i
].
rnti
==
0
&&
first_free
==
-
1
)
{
first_free
=
i
;
stats
=&
gNB
->
ulsch_stats
[
i
];
}
if
(
gNB
->
ulsch_stats
[
i
].
rnti
==
ulsch
->
rnti
)
{
stats
=&
gNB
->
ulsch_stats
[
i
];
break
;
}
}
return
(
stats
);
}
openair1/PHY/NR_TRANSPORT/nr_ulsch.h
View file @
7c9b5013
...
...
@@ -82,7 +82,8 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
int
slot_rx
,
int
UE_id
,
uint8_t
harq_pid
);
int16_t
find_nr_ulsch
(
uint16_t
rnti
,
PHY_VARS_gNB
*
gNB
,
find_type_t
type
);
int16_t
find_nr_ulsch
(
PHY_VARS_gNB
*
gNB
,
uint16_t
rnti
,
int
pid
,
int
frame
);
void
dump_pusch_stats
(
FILE
*
fd
,
PHY_VARS_gNB
*
gNB
);
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
View file @
7c9b5013
...
...
@@ -38,6 +38,7 @@
#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/CODING/nrLDPC_extern.h"
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "SCHED_NR/sched_nr.h"
...
...
@@ -65,21 +66,19 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
a_segments
=
a_segments
/
273
+
1
;
}
for
(
int
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
if
(
ulsch
->
harq_processes
[
i
])
{
if
(
ulsch
->
harq_processes
[
i
]
->
b
)
{
free_and_zero
(
ulsch
->
harq_processes
[
i
]
->
b
);
ulsch
->
harq_processes
[
i
]
->
b
=
NULL
;
}
for
(
int
r
=
0
;
r
<
a_segments
;
r
++
)
{
free_and_zero
(
ulsch
->
harq_processes
[
i
]
->
c
[
r
]);
free_and_zero
(
ulsch
->
harq_processes
[
i
]
->
d
[
r
]);
}
free_and_zero
(
ulsch
->
harq_processes
[
i
]
->
c
);
free_and_zero
(
ulsch
->
harq_processes
[
i
]
->
d
);
free_and_zero
(
ulsch
->
harq_processes
[
i
]);
ulsch
->
harq_processes
[
i
]
=
NULL
;
if
(
ulsch
->
harq_process
)
{
if
(
ulsch
->
harq_process
->
b
)
{
free_and_zero
(
ulsch
->
harq_process
->
b
);
ulsch
->
harq_process
->
b
=
NULL
;
}
for
(
int
r
=
0
;
r
<
a_segments
;
r
++
)
{
free_and_zero
(
ulsch
->
harq_process
->
c
[
r
]);
free_and_zero
(
ulsch
->
harq_process
->
d
[
r
]);
}
free_and_zero
(
ulsch
->
harq_process
->
c
);
free_and_zero
(
ulsch
->
harq_process
->
d
);
free_and_zero
(
ulsch
->
harq_process
);
ulsch
->
harq_process
=
NULL
;
}
free_and_zero
(
*
ulschptr
);
}
...
...
@@ -88,8 +87,6 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
NR_gNB_ULSCH_t
*
new_gNB_ulsch
(
uint8_t
max_ldpc_iterations
,
uint16_t
N_RB_UL
)
{
NR_gNB_ULSCH_t
*
ulsch
;
uint8_t
i
,
r
;
uint16_t
a_segments
=
MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER
*
NR_MAX_NB_LAYERS
;
//number of segments to be allocated
if
(
N_RB_UL
!=
273
)
{
...
...
@@ -97,70 +94,31 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
a_segments
=
a_segments
/
273
+
1
;
}
uint32_t
ulsch_bytes
=
a_segments
*
1056
;
// allocated bytes per segment
ulsch
=
(
NR_gNB_ULSCH_t
*
)
malloc16_clear
(
sizeof
(
NR_gNB_ULSCH_t
));
uint32_t
ulsch_bytes
=
a_segments
*
1056
;
// allocated bytes per segment
NR_gNB_ULSCH_t
*
ulsch
=
(
NR_gNB_ULSCH_t
*
)
malloc16_clear
(
sizeof
(
NR_gNB_ULSCH_t
));
ulsch
->
max_ldpc_iterations
=
max_ldpc_iterations
;
for
(
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
ulsch
->
harq_processes
[
i
]
=
(
NR_UL_gNB_HARQ_t
*
)
malloc16_clear
(
sizeof
(
NR_UL_gNB_HARQ_t
));
ulsch
->
harq_processes
[
i
]
->
b
=
(
uint8_t
*
)
malloc16_clear
(
ulsch_bytes
);
ulsch
->
harq_processes
[
i
]
->
c
=
(
uint8_t
**
)
malloc16_clear
(
a_segments
*
sizeof
(
uint8_t
*
)
);
ulsch
->
harq_processes
[
i
]
->
d
=
(
int16_t
**
)
malloc16_clear
(
a_segments
*
sizeof
(
int16
_t
*
));
for
(
r
=
0
;
r
<
a_segments
;
r
++
)
{
ulsch
->
harq_processes
[
i
]
->
c
[
r
]
=
(
uint8_t
*
)
malloc16_clear
(
8448
*
sizeof
(
uint8_t
));
ulsch
->
harq_processes
[
i
]
->
d
[
r
]
=
(
int16_t
*
)
malloc16_clear
((
68
*
384
)
*
sizeof
(
int16
_t
));
}
ulsch
->
harq_pid
=
-
1
;
ulsch
->
active
=
false
;
ulsch
->
harq_process
=
(
NR_UL_gNB_HARQ_t
*
)
malloc16_clear
(
sizeof
(
NR_UL_gNB_HARQ_t
)
);
ulsch
->
harq_process
->
b
=
(
uint8_t
*
)
malloc16_clear
(
ulsch_bytes
);
ulsch
->
harq_process
->
c
=
(
uint8_t
**
)
malloc16_clear
(
a_segments
*
sizeof
(
uint8
_t
*
));
ulsch
->
harq_process
->
d
=
(
int16_t
**
)
malloc16_clear
(
a_segments
*
sizeof
(
int16_t
*
));
for
(
int
r
=
0
;
r
<
a_segments
;
r
++
)
{
ulsch
->
harq_process
->
c
[
r
]
=
(
uint8_t
*
)
malloc16_clear
(
8448
*
sizeof
(
uint8
_t
));
ulsch
->
harq_process
->
d
[
r
]
=
(
int16_t
*
)
malloc16_clear
((
68
*
384
)
*
sizeof
(
int16_t
));
}
return
(
ulsch
);
}
void
clean_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
)
{
if
(
ulsch
)
{
ulsch
->
harq_mask
=
0
;
ulsch
->
rnti
=
0
;
ulsch
->
rnti_type
=
0
;
ulsch
->
max_ldpc_iterations
=
0
;
ulsch
->
last_iteration_cnt
=
0
;
for
(
int
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
if
(
ulsch
->
harq_processes
[
i
]){
/// Nfapi ULSCH PDU
//nfapi_nr_ul_config_ulsch_pdu ulsch_pdu;
ulsch
->
harq_processes
[
i
]
->
frame
=
0
;
ulsch
->
harq_processes
[
i
]
->
slot
=
0
;
ulsch
->
harq_processes
[
i
]
->
round
=
0
;
ulsch
->
harq_processes
[
i
]
->
status
=
NR_SCH_IDLE
;
ulsch
->
harq_processes
[
i
]
->
handled
=
0
;
ulsch
->
harq_processes
[
i
]
->
TBS
=
0
;
/// Pointer to the payload (38.212 V15.4.0 section 5.1)
//uint8_t *b;
ulsch
->
harq_processes
[
i
]
->
B
=
0
;
/// Pointers to code blocks after code block segmentation and CRC attachment (38.212 V15.4.0 section 5.2.2)
//uint8_t *c[MAX_NUM_NR_ULSCH_SEGMENTS];
ulsch
->
harq_processes
[
i
]
->
K
=
0
;
ulsch
->
harq_processes
[
i
]
->
F
=
0
;
ulsch
->
harq_processes
[
i
]
->
C
=
0
;
/// Pointers to code blocks after LDPC coding (38.212 V15.4.0 section 5.3.2)
//int16_t *d[MAX_NUM_NR_ULSCH_SEGMENTS];
ulsch
->
harq_processes
[
i
]
->
Z
=
0
;
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
//int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448];
ulsch
->
harq_processes
[
i
]
->
E
=
0
;
}
}
}
}
#ifdef PRINT_CRC_CHECK
static
uint32_t
prnt_crc_cnt
=
0
;
#endif
void
nr_processULSegment
(
void
*
arg
)
{
void
nr_processULSegment
(
void
*
arg
)
{
ldpcDecode_t
*
rdata
=
(
ldpcDecode_t
*
)
arg
;
PHY_VARS_gNB
*
phy_vars_gNB
=
rdata
->
gNB
;
NR_UL_gNB_HARQ_t
*
ulsch_harq
=
rdata
->
ulsch_harq
;
...
...
@@ -325,14 +283,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint8_t
harq_pid
,
uint32_t
G
)
{
#ifdef PRINT_CRC_CHECK
prnt_crc_cnt
++
;
#endif
NR_gNB_ULSCH_t
*
ulsch
=
phy_vars_gNB
->
ulsch
[
ULSCH_id
];
NR_gNB_PUSCH
*
pusch
=
phy_vars_gNB
->
pusch_vars
[
ULSCH_id
];
NR_UL_gNB_HARQ_t
*
harq_process
=
ulsch
->
harq_processes
[
harq_pid
]
;
NR_gNB_ULSCH_t
*
ulsch
=
phy_vars_gNB
->
ulsch
[
ULSCH_id
];
NR_gNB_PUSCH
*
pusch
=
phy_vars_gNB
->
pusch_vars
[
ULSCH_id
];
NR_UL_gNB_HARQ_t
*
harq_process
=
ulsch
->
harq_process
;
if
(
!
harq_process
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: NULL harq_process pointer
\n
"
);
...
...
@@ -379,30 +337,18 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
kc
=
68
;
}
NR_gNB_SCH_STATS_t
*
stats
=
NULL
;
int
first_free
=-
1
;
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
{
if
(
phy_vars_gNB
->
ulsch_stats
[
i
].
rnti
==
0
&&
first_free
==
-
1
)
{
first_free
=
i
;
stats
=&
phy_vars_gNB
->
ulsch_stats
[
i
];
}
if
(
phy_vars_gNB
->
ulsch_stats
[
i
].
rnti
==
ulsch
->
rnti
)
{
stats
=&
phy_vars_gNB
->
ulsch_stats
[
i
];
break
;
}
}
NR_gNB_PHY_STATS_t
*
stats
=
get_phy_stats
(
phy_vars_gNB
,
ulsch
->
rnti
);
if
(
stats
)
{
stats
->
frame
=
frame
;
stats
->
rnti
=
ulsch
->
rnti
;
stats
->
round_trials
[
harq_process
->
round
]
++
;
for
(
int
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
stats
->
power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_power
[
aarx
]);
stats
->
noise_power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_noise_power
[
aarx
]);
stats
->
ulsch_stats
.
round_trials
[
harq_process
->
round
]
++
;
for
(
int
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
stats
->
ulsch_stats
.
power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_power
[
aarx
]);
stats
->
ulsch_stats
.
noise_power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_noise_power
[
aarx
]);
}
if
(
harq_process
->
new_rx
==
0
)
{
stats
->
current_Qm
=
Qm
;
stats
->
current_RI
=
n_layers
;
stats
->
total_bytes_tx
+=
harq_process
->
TBS
;
stats
->
ulsch_stats
.
current_Qm
=
Qm
;
stats
->
ulsch_stats
.
current_RI
=
n_layers
;
stats
->
ulsch_stats
.
total_bytes_tx
+=
harq_process
->
TBS
;
}
}
if
(
A
>
3824
)
...
...
@@ -594,9 +540,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
if
(
harq_process
->
processedSegments
==
(
harq_process
->
C
))
{
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting ACK for slot %d TBS %d
\n
"
,
phy_vars_gNB
->
Mod_id
,
harq_process
->
slot
,
harq_process
->
TBS
);
harq_process
->
status
=
NR_SCH_IDLE
;
ulsch
->
active
=
false
;
harq_process
->
round
=
0
;
ulsch
->
harq_mask
&=
~
(
1
<<
harq_pid
);
LOG_D
(
PHY
,
"ULSCH received ok
\n
"
);
nr_fill_indication
(
phy_vars_gNB
,
harq_process
->
frame
,
harq_process
->
slot
,
ULSCH_id
,
harq_pid
,
0
,
0
);
...
...
@@ -608,10 +553,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
harq_process
->
frame
,
harq_process
->
slot
,
harq_pid
,
harq_process
->
status
,
ulsch
->
active
,
harq_process
->
round
,
harq_process
->
TBS
);
harq_process
->
handled
=
1
;
ulsch
->
handled
=
1
;
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
LOG_D
(
PHY
,
"ULSCH %d in error
\n
"
,
ULSCH_id
);
nr_fill_indication
(
phy_vars_gNB
,
harq_process
->
frame
,
harq_process
->
slot
,
ULSCH_id
,
harq_pid
,
1
,
0
);
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
View file @
7c9b5013
...
...
@@ -1847,7 +1847,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
int
avgs
=
0
;
NR_DL_FRAME_PARMS
*
frame_parms
=
&
gNB
->
frame_parms
;
nfapi_nr_pusch_pdu_t
*
rel15_ul
=
&
gNB
->
ulsch
[
ulsch_id
]
->
harq_process
es
[
harq_pid
]
->
ulsch_pdu
;
nfapi_nr_pusch_pdu_t
*
rel15_ul
=
&
gNB
->
ulsch
[
ulsch_id
]
->
harq_process
->
ulsch_pdu
;
int
avg
[
frame_parms
->
nb_antennas_rx
*
rel15_ul
->
nrOfLayers
];
gNB
->
pusch_vars
[
ulsch_id
]
->
dmrs_symbol
=
INVALID_VALUE
;
...
...
openair1/PHY/NR_TRANSPORT/pucch_rx.c
View file @
7c9b5013
...
...
@@ -44,22 +44,23 @@
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "T.h"
//#define DEBUG_NR_PUCCH_RX 1
NR_gNB_PUCCH_t
*
new_gNB_pucch
(
void
){
NR_gNB_PUCCH_t
*
pucch
;
pucch
=
(
NR_gNB_PUCCH_t
*
)
malloc16
(
sizeof
(
NR_gNB_PUCCH_t
));
pucch
->
active
=
0
;
return
(
pucch
);
NR_gNB_PUCCH_t
*
new_gNB_pucch
(
void
)
{
NR_gNB_PUCCH_t
*
pucch
;
pucch
=
(
NR_gNB_PUCCH_t
*
)
malloc16
(
sizeof
(
NR_gNB_PUCCH_t
));
pucch
->
active
=
0
;
return
(
pucch
);
}
void
free_gNB_pucch
(
NR_gNB_PUCCH_t
*
pucch
)
...
...
@@ -67,32 +68,6 @@ void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
free_and_zero
(
pucch
);
}
int
nr_find_pucch
(
uint16_t
rnti
,
int
frame
,
int
slot
,
PHY_VARS_gNB
*
gNB
)
{
AssertFatal
(
gNB
!=
NULL
,
"gNB is null
\n
"
);
int
index
=
-
1
;
for
(
int
i
=
0
;
i
<
gNB
->
max_nb_pucch
;
i
++
)
{
AssertFatal
(
gNB
->
pucch
[
i
]
!=
NULL
,
"gNB->pucch[%d] is null
\n
"
,
i
);
if
((
gNB
->
pucch
[
i
]
->
active
>
0
)
&&
(
gNB
->
pucch
[
i
]
->
pucch_pdu
.
rnti
==
rnti
)
&&
(
gNB
->
pucch
[
i
]
->
frame
==
frame
)
&&
(
gNB
->
pucch
[
i
]
->
slot
==
slot
))
return
i
;
else
if
((
gNB
->
pucch
[
i
]
->
active
==
0
)
&&
(
index
==
-
1
))
index
=
i
;
}
if
(
index
==-
1
)
LOG_E
(
MAC
,
"PUCCH list is full
\n
"
);
return
(
index
);
}
void
nr_fill_pucch
(
PHY_VARS_gNB
*
gNB
,
int
frame
,
int
slot
,
...
...
@@ -101,18 +76,22 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
if
(
NFAPI_MODE
==
NFAPI_MODE_PNF
)
gNB
->
pucch
[
0
]
->
active
=
0
;
//check if ture in monolithic mode
int
id
=
nr_find_pucch
(
pucch_pdu
->
rnti
,
frame
,
slot
,
gNB
);
AssertFatal
((
id
>=
0
)
&&
(
id
<
gNB
->
max_nb_pucch
),
"invalid id found for pucch !!! rnti %04x id %d
\n
"
,
pucch_pdu
->
rnti
,
id
);
NR_gNB_PUCCH_t
*
pucch
=
gNB
->
pucch
[
id
];
pucch
->
frame
=
frame
;
pucch
->
slot
=
slot
;
pucch
->
active
=
1
;
if
(
pucch
->
pucch_pdu
.
format_type
>
0
)
LOG_D
(
PHY
,
"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d
\n
"
,
id
,
pucch
->
frame
,
pucch
->
slot
,
pucch
->
pucch_pdu
.
format_type
,
pucch
->
pucch_pdu
.
bit_len_harq
,
pucch
->
pucch_pdu
.
sr_flag
,
pucch
->
pucch_pdu
.
bit_len_csi_part1
);
memcpy
((
void
*
)
&
pucch
->
pucch_pdu
,
(
void
*
)
pucch_pdu
,
sizeof
(
nfapi_nr_pucch_pdu_t
));
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
gNB
->
max_nb_pucch
;
i
++
)
{
if
(
gNB
->
pucch
[
i
]
->
active
==
0
)
{
NR_gNB_PUCCH_t
*
pucch
=
gNB
->
pucch
[
i
];
pucch
->
frame
=
frame
;
pucch
->
slot
=
slot
;
pucch
->
active
=
1
;
memcpy
((
void
*
)
&
pucch
->
pucch_pdu
,
(
void
*
)
pucch_pdu
,
sizeof
(
nfapi_nr_pucch_pdu_t
));
LOG_D
(
PHY
,
"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d
\n
"
,
i
,
pucch
->
frame
,
pucch
->
slot
,
pucch
->
pucch_pdu
.
format_type
,
pucch
->
pucch_pdu
.
bit_len_harq
,
pucch
->
pucch_pdu
.
sr_flag
,
pucch
->
pucch_pdu
.
bit_len_csi_part1
);
found
=
true
;
break
;
}
}
AssertFatal
(
found
,
"PUCCH list is full
\n
"
);
}
...
...
@@ -176,38 +155,28 @@ int16_t idft12_im[12][12] = {
{
0
,
-
11585
,
-
20066
,
-
23170
,
-
20066
,
-
11585
,
0
,
11585
,
20066
,
23170
,
20066
,
11585
}
};
void
nr_decode_pucch0
(
PHY_VARS_gNB
*
gNB
,
int
frame
,
int
slot
,
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_pdu
,
nfapi_nr_pucch_pdu_t
*
pucch_pdu
)
{
nfapi_nr_pucch_pdu_t
*
pucch_pdu
)
{
c16_t
**
rxdataF
=
gNB
->
common_vars
.
rxdataF
;
NR_DL_FRAME_PARMS
*
frame_parms
=
&
gNB
->
frame_parms
;
int
soffset
=
(
slot
&
3
)
*
frame_parms
->
symbols_per_slot
*
frame_parms
->
ofdm_symbol_size
;
int
nr_sequences
;
const
uint8_t
*
mcs
;
pucch_GroupHopping_t
pucch_GroupHopping
=
pucch_pdu
->
group_hop_flag
+
(
pucch_pdu
->
sequence_hop_flag
<<
1
);
int
soffset
=
(
slot
&
3
)
*
frame_parms
->
symbols_per_slot
*
frame_parms
->
ofdm_symbol_size
;
AssertFatal
(
pucch_pdu
->
bit_len_harq
>
0
||
pucch_pdu
->
sr_flag
>
0
,
"Either bit_len_harq (%d) or sr_flag (%d) must be > 0
\n
"
,
pucch_pdu
->
bit_len_harq
,
pucch_pdu
->
sr_flag
);
NR_gNB_UCI_STATS_t
*
uci_stats
=
NULL
;
NR_gNB_UCI_STATS_t
*
first_uci_stats
=
gNB
->
uci_stats
;
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_UCI_STATS_MAX
;
i
++
)
if
(
gNB
->
uci_stats
[
i
].
rnti
==
pucch_pdu
->
rnti
)
{
uci_stats
=
&
gNB
->
uci_stats
[
i
];
break
;
}
else
if
(
first_uci_stats
==
NULL
&&
gNB
->
uci_stats
[
i
].
rnti
==
0
)
first_uci_stats
=
&
gNB
->
uci_stats
[
i
];
if
(
uci_stats
==
NULL
)
{
uci_stats
=
first_uci_stats
;
uci_stats
->
rnti
=
pucch_pdu
->
rnti
;}
AssertFatal
(
uci_stats
!=
NULL
,
"No stat index found
\n
"
);
uci_stats
->
frame
=
frame
;
NR_gNB_PHY_STATS_t
*
phy_stats
=
get_phy_stats
(
gNB
,
pucch_pdu
->
rnti
);
AssertFatal
(
phy_stats
!=
NULL
,
"No stat index found
\n
"
);
phy_stats
->
frame
=
frame
;
NR_gNB_UCI_STATS_t
*
uci_stats
=
&
phy_stats
->
uci_stats
;
int
nr_sequences
;
const
uint8_t
*
mcs
;
if
(
pucch_pdu
->
bit_len_harq
==
0
){
mcs
=
table1_mcs
;
nr_sequences
=
1
;
...
...
@@ -258,20 +227,18 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int
n
,
i
;
int
prb_offset
[
2
]
=
{
pucch_pdu
->
bwp_start
+
pucch_pdu
->
prb_start
,
pucch_pdu
->
bwp_start
+
pucch_pdu
->
prb_start
};
nr_group_sequence_hopping
(
pucch_GroupHopping
,
pucch_pdu
->
hopping_id
,
0
,
slot
,
&
u
[
0
],
&
v
[
0
]);
// calculating u and v value first hop
pucch_GroupHopping_t
pucch_GroupHopping
=
pucch_pdu
->
group_hop_flag
+
(
pucch_pdu
->
sequence_hop_flag
<<
1
);
nr_group_sequence_hopping
(
pucch_GroupHopping
,
pucch_pdu
->
hopping_id
,
0
,
slot
,
&
u
[
0
],
&
v
[
0
]);
// calculating u and v value first hop
LOG_D
(
PHY
,
"pucch0: u %d, v %d
\n
"
,
u
[
0
],
v
[
0
]);
if
(
pucch_pdu
->
freq_hop_flag
==
1
)
{
nr_group_sequence_hopping
(
pucch_GroupHopping
,
pucch_pdu
->
hopping_id
,
1
,
slot
,
&
u
[
1
],
&
v
[
1
]);
// calculating u and v value second hop
nr_group_sequence_hopping
(
pucch_GroupHopping
,
pucch_pdu
->
hopping_id
,
1
,
slot
,
&
u
[
1
],
&
v
[
1
]);
// calculating u and v value second hop
LOG_D
(
PHY
,
"pucch0 second hop: u %d, v %d
\n
"
,
u
[
1
],
v
[
1
]);
prb_offset
[
1
]
=
pucch_pdu
->
bwp_start
+
pucch_pdu
->
second_hop_prb
;
prb_offset
[
1
]
=
pucch_pdu
->
bwp_start
+
pucch_pdu
->
second_hop_prb
;
}
AssertFatal
(
pucch_pdu
->
nr_of_symbols
<
3
,
"nr_of_symbols %d not allowed
\n
"
,
pucch_pdu
->
nr_of_symbols
);
uint32_t
re_offset
[
2
]
=
{
0
};
uint8_t
l2
;
uint32_t
re_offset
[
2
]
=
{
0
};
const
int16_t
*
x_re
[
2
],
*
x_im
[
2
];
x_re
[
0
]
=
table_5_2_2_2_2_Re
[
u
[
0
]];
...
...
@@ -288,7 +255,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int32_t
rp
[
frame_parms
->
nb_antennas_rx
][
pucch_pdu
->
nr_of_symbols
][
nb_re_pucch
],
*
tmp_rp
;
for
(
int
l
=
0
;
l
<
pucch_pdu
->
nr_of_symbols
;
l
++
)
{
l2
=
l
+
pucch_pdu
->
start_symbol_index
;
uint8_t
l2
=
l
+
pucch_pdu
->
start_symbol_index
;
re_offset
[
l
]
=
(
12
*
prb_offset
[
l
])
+
frame_parms
->
first_carrier_offset
;
if
(
re_offset
[
l
]
>=
frame_parms
->
ofdm_symbol_size
)
...
...
@@ -454,10 +421,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu
->
harq
->
harq_confidence_level
=
no_conf
;
uci_pdu
->
harq
->
harq_list
=
(
nfapi_nr_harq_t
*
)
malloc
(
sizeof
*
uci_pdu
->
harq
->
harq_list
);
uci_pdu
->
harq
->
harq_list
[
0
].
harq_value
=
!
(
index
&
0x01
);
LOG_D
(
PHY
,
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f
, sync_pos %d
\n
"
,
LOG_D
(
PHY
,
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f
\n
"
,
frame
,
slot
,
uci_pdu
->
harq
->
harq_list
[
0
].
harq_value
==
0
?
"ACK"
:
"NACK"
,
uci_pdu
->
harq
->
harq_confidence_level
==
0
?
"good"
:
"bad"
,
xrtmag_dBtimes10
,
xrtmag_next_dBtimes10
,
max_n0
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
cqi
,
SNRtimes10
,
10
*
log10
((
double
)
sigenergy
)
,
gNB
->
ulsch_stats
[
0
].
sync_pos
);
xrtmag_dBtimes10
,
xrtmag_next_dBtimes10
,
max_n0
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
cqi
,
SNRtimes10
,
10
*
log10
((
double
)
sigenergy
));
if
(
pucch_pdu
->
sr_flag
==
1
)
{
uci_pdu
->
sr
=
calloc
(
1
,
sizeof
(
*
uci_pdu
->
sr
));
...
...
@@ -478,14 +445,13 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu
->
harq
->
harq_list
[
1
].
harq_value
=
!
(
index
&
0x01
);
uci_pdu
->
harq
->
harq_list
[
0
].
harq_value
=
!
((
index
>>
1
)
&
0x01
);
LOG_D
(
PHY
,
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d
,sync_pos %d
\n
"
,
LOG_D
(
PHY
,
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d
\n
"
,
frame
,
slot
,
uci_pdu
->
harq
->
harq_list
[
1
].
harq_value
==
0
?
"ACK"
:
"NACK"
,
uci_pdu
->
harq
->
harq_list
[
0
].
harq_value
==
0
?
"ACK"
:
"NACK"
,
uci_pdu
->
harq
->
harq_confidence_level
==
0
?
"good"
:
"bad"
,
xrtmag_dBtimes10
,
xrtmag_next_dBtimes10
,
max_n0
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
cqi
,
SNRtimes10
,
gNB
->
ulsch_stats
[
0
].
sync_pos
);
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
cqi
,
SNRtimes10
);
if
(
pucch_pdu
->
sr_flag
==
1
)
{
uci_pdu
->
sr
=
calloc
(
1
,
sizeof
(
*
uci_pdu
->
sr
));
uci_pdu
->
sr
->
sr_indication
=
(
index
>
3
)
?
1
:
0
;
...
...
@@ -1209,8 +1175,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
}
}
}
LOG_D
(
PHY
,
"Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d
\n
"
,
pucch_pdu
->
nr_of_symbols
,
pucch_pdu
->
prb_size
,
LOG_D
(
PHY
,
"
%d.%d
Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d
\n
"
,
frame
,
slot
,
pucch_pdu
->
nr_of_symbols
,
pucch_pdu
->
prb_size
,
pucch_pdu
->
bit_len_harq
,
pucch_pdu
->
sr_flag
,
pucch_pdu
->
bit_len_csi_part1
,
pucch_pdu
->
bit_len_csi_part2
);
int
nc_group_size
=
1
;
// 2 PRB
...
...
@@ -1790,30 +1756,31 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
void
nr_dump_uci_stats
(
FILE
*
fd
,
PHY_VARS_gNB
*
gNB
,
int
frame
)
{
int
strpos
=
0
;
char
output
[
16384
];
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_UCI_STATS_MAX
;
i
++
)
{
if
(
gNB
->
uci_stats
[
i
].
rnti
>
0
)
{
NR_gNB_UCI_STATS_t
*
uci_stats
=
&
gNB
->
uci_stats
[
i
];
if
(
uci_stats
->
pucch0_sr_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d
\n
"
,
i
,
uci_stats
->
rnti
,
uci_stats
->
pucch0_sr_trials
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_sr_thres
,
dB_fixed
(
uci_stats
->
current_pucch0_sr_stat0
),
dB_fixed
(
uci_stats
->
current_pucch0_sr_stat1
),
uci_stats
->
pucch0_positive_SR
);
if
(
uci_stats
->
pucch01_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d
\n
"
,
i
,
uci_stats
->
rnti
,
uci_stats
->
pucch01_trials
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
dB_fixed
(
uci_stats
->
current_pucch0_stat0
),
dB_fixed
(
uci_stats
->
current_pucch0_stat1
),
uci_stats
->
pucch01_DTX
);
if
(
uci_stats
->
pucch02_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d
\n
"
,
i
,
uci_stats
->
rnti
,
uci_stats
->
pucch02_trials
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
dB_fixed
(
uci_stats
->
current_pucch0_stat0
),
dB_fixed
(
uci_stats
->
current_pucch0_stat1
),
uci_stats
->
pucch02_DTX
);
if
(
uci_stats
->
pucch2_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d
\n
"
,
i
,
uci_stats
->
rnti
,
uci_stats
->
pucch2_trials
,
uci_stats
->
pucch2_DTX
);
}
int
strpos
=
0
;
char
output
[
16384
];
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
NR_gNB_PHY_STATS_t
*
stats
=
&
gNB
->
phy_stats
[
i
];
if
(
stats
->
active
)
{
NR_gNB_UCI_STATS_t
*
uci_stats
=
&
stats
->
uci_stats
;
if
(
uci_stats
->
pucch0_sr_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d
\n
"
,
i
,
stats
->
rnti
,
uci_stats
->
pucch0_sr_trials
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_sr_thres
,
dB_fixed
(
uci_stats
->
current_pucch0_sr_stat0
),
dB_fixed
(
uci_stats
->
current_pucch0_sr_stat1
),
uci_stats
->
pucch0_positive_SR
);
if
(
uci_stats
->
pucch01_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d
\n
"
,
i
,
stats
->
rnti
,
uci_stats
->
pucch01_trials
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
dB_fixed
(
uci_stats
->
current_pucch0_stat0
),
dB_fixed
(
uci_stats
->
current_pucch0_stat1
),
uci_stats
->
pucch01_DTX
);
if
(
uci_stats
->
pucch02_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d
\n
"
,
i
,
stats
->
rnti
,
uci_stats
->
pucch02_trials
,
uci_stats
->
pucch0_n00
,
uci_stats
->
pucch0_n01
,
uci_stats
->
pucch0_thres
,
dB_fixed
(
uci_stats
->
current_pucch0_stat0
),
dB_fixed
(
uci_stats
->
current_pucch0_stat1
),
uci_stats
->
pucch02_DTX
);
if
(
uci_stats
->
pucch2_trials
>
0
)
strpos
+=
sprintf
(
output
+
strpos
,
"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d
\n
"
,
i
,
stats
->
rnti
,
uci_stats
->
pucch2_trials
,
uci_stats
->
pucch2_DTX
);
}
if
(
fd
)
fprintf
(
fd
,
"%s"
,
output
);
else
printf
(
"%s"
,
output
);
}
if
(
fd
)
fprintf
(
fd
,
"%s"
,
output
);
else
printf
(
"%s"
,
output
);
}
openair1/PHY/NR_TRANSPORT/srs_rx.c
View file @
7c9b5013
...
...
@@ -56,43 +56,25 @@ void free_gNB_srs(NR_gNB_SRS_t *srs)
free_and_zero
(
srs
);
}
int
nr_find_srs
(
rnti_t
rnti
,
frame_t
frame
,
slot_t
slot
,
PHY_VARS_gNB
*
gNB
)
{
AssertFatal
(
gNB
!=
NULL
,
"gNB is null
\n
"
);
int
index
=
-
1
;
for
(
int
i
=
0
;
i
<
gNB
->
max_nb_srs
;
i
++
)
{
AssertFatal
(
gNB
->
srs
[
i
]
!=
NULL
,
"gNB->srs[%d] is null
\n
"
,
i
);
if
((
gNB
->
srs
[
i
]
->
active
>
0
)
&&
(
gNB
->
srs
[
i
]
->
srs_pdu
.
rnti
==
rnti
)
&&
(
gNB
->
srs
[
i
]
->
frame
==
frame
)
&&
(
gNB
->
srs
[
i
]
->
slot
==
slot
))
return
(
i
);
else
if
((
gNB
->
srs
[
i
]
->
active
==
0
)
&&
(
index
==-
1
))
index
=
i
;
}
if
(
index
==-
1
)
LOG_E
(
PHY
,
"SRS list is full
\n
"
);
return
(
index
);
}
void
nr_fill_srs
(
PHY_VARS_gNB
*
gNB
,
frame_t
frame
,
slot_t
slot
,
nfapi_nr_srs_pdu_t
*
srs_pdu
)
{
int
id
=
nr_find_srs
(
srs_pdu
->
rnti
,
frame
,
slot
,
gNB
);
AssertFatal
((
id
>=
0
)
&&
(
id
<
gNB
->
max_nb_srs
),
"invalid id found for srs !!! rnti %04x id %d
\n
"
,
srs_pdu
->
rnti
,
id
);
nfapi_nr_srs_pdu_t
*
srs_pdu
)
{
NR_gNB_SRS_t
*
srs
=
gNB
->
srs
[
id
];
srs
->
frame
=
frame
;
srs
->
slot
=
slot
;
srs
->
active
=
1
;
memcpy
((
void
*
)
&
srs
->
srs_pdu
,
(
void
*
)
srs_pdu
,
sizeof
(
nfapi_nr_srs_pdu_t
));
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
gNB
->
max_nb_srs
;
i
++
)
{
if
(
gNB
->
srs
[
i
]
->
active
==
0
)
{
found
=
true
;
NR_gNB_SRS_t
*
srs
=
gNB
->
srs
[
i
];
srs
->
frame
=
frame
;
srs
->
slot
=
slot
;
srs
->
active
=
1
;
memcpy
((
void
*
)
&
srs
->
srs_pdu
,
(
void
*
)
srs_pdu
,
sizeof
(
nfapi_nr_srs_pdu_t
));
break
;
}
}
AssertFatal
(
found
,
"SRS list is full
\n
"
);
}
int
nr_get_srs_signal
(
PHY_VARS_gNB
*
gNB
,
...
...
openair1/PHY/defs_gNB.h
View file @
7c9b5013
...
...
@@ -97,9 +97,7 @@ typedef struct {
}
NR_gNB_CSIRS_t
;
typedef
struct
{
int
frame
;
int
dump_frame
;
uint16_t
rnti
;
int
round_trials
[
8
];
int
total_bytes_tx
;
int
total_bytes_rx
;
...
...
@@ -112,8 +110,6 @@ typedef struct {
}
NR_gNB_SCH_STATS_t
;
typedef
struct
{
int
frame
;
uint16_t
rnti
;
int
pucch0_sr_trials
;
int
pucch0_sr_thres
;
int
current_pucch0_sr_stat0
;
...
...
@@ -132,6 +128,17 @@ typedef struct {
int
pucch2_DTX
;
}
NR_gNB_UCI_STATS_t
;
typedef
struct
{
int
frame
;
uint16_t
rnti
;
bool
active
;
/// statistics for DLSCH measurement collection
NR_gNB_SCH_STATS_t
dlsch_stats
;
/// statistics for ULSCH measurement collection
NR_gNB_SCH_STATS_t
ulsch_stats
;
NR_gNB_UCI_STATS_t
uci_stats
;
}
NR_gNB_PHY_STATS_t
;
typedef
struct
{
/// Pointers to variables related to DLSCH harq process
NR_DL_gNB_HARQ_t
harq_process
;
...
...
@@ -141,12 +148,8 @@ typedef struct {
int32_t
**
mod_symbs
;
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t
***
ue_spec_bf_weights
;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t
rnti
;
/// Active flag for baseband transmitter processing
uint8_t
active
;
/// HARQ process mask, indicates which processes are currently active
uint16_t
harq_mask
;
/// Number of soft channel bits
uint32_t
G
;
}
NR_gNB_DLSCH_t
;
...
...
@@ -192,11 +195,7 @@ typedef struct {
/// Index of current HARQ round for this DLSCH
uint8_t
round
;
bool
new_rx
;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
NR_SCH_status_t
status
;
/// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around
uint8_t
handled
;
/////////////////////// ulsch decoding ///////////////////////
/////////////////////// ulsch decoding ///////////////////////
/// Transport block size (This is A from 38.212 V15.4.0 section 5.1)
uint32_t
TBS
;
/// Pointer to the payload (38.212 V15.4.0 section 5.1)
...
...
@@ -226,19 +225,31 @@ typedef struct {
}
NR_UL_gNB_HARQ_t
;
typedef
struct
{
/// Time shift in number of samples estimated based on DMRS-PUSCH
int
pusch_est_delay
;
/// Max position in OFDM symbol related to time shift estimation based on DMRS-PUSCH
int
pusch_delay_max_pos
;
/// Max value related to time shift estimation based on DMRS-PUSCH
int
pusch_delay_max_val
;
}
NR_ULSCH_delay_t
;
typedef
struct
{
/// Pointers to 16 HARQ processes for the ULSCH
NR_UL_gNB_HARQ_t
*
harq_process
es
[
NR_MAX_ULSCH_HARQ_PROCESSES
]
;
NR_UL_gNB_HARQ_t
*
harq_process
;
/// HARQ process mask, indicates which processes are currently active
uint16_t
harq_mask
;
int
harq_pid
;
/// Allocated RNTI for this ULSCH
uint16_t
rnti
;
/// RNTI type
uint8_t
rnti_type
;
/// Maximum number of LDPC iterations
uint8_t
max_ldpc_iterations
;
/// number of iterations used in last LDPC decoding
uint8_t
last_iteration_cnt
;
uint8_t
last_iteration_cnt
;
/// Status Flag indicating for this ULSCH
bool
active
;
/// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around
uint8_t
handled
;
NR_ULSCH_delay_t
delay
;
}
NR_gNB_ULSCH_t
;
typedef
struct
{
...
...
@@ -546,15 +557,6 @@ typedef struct {
/// PRACH background noise level
int
prach_I0
;
struct
delay_s
{
/// Time shift in number of samples estimated based on DMRS-PUSCH
int
pusch_est_delay
;
/// Max position in OFDM symbol related to time shift estimation based on DMRS-PUSCH
int
pusch_delay_max_pos
;
/// Max value related to time shift estimation based on DMRS-PUSCH
int
pusch_delay_max_val
;
}
delay
[
NUMBER_OF_NR_ULSCH_MAX
];
}
PHY_MEASUREMENTS_gNB
;
...
...
@@ -615,11 +617,7 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_PUCCH_t
**
pucch
;
NR_gNB_SRS_t
**
srs
;
NR_gNB_ULSCH_t
*
ulsch
[
NUMBER_OF_NR_ULSCH_MAX
];
// [Nusers times]
/// statistics for DLSCH measurement collection
NR_gNB_SCH_STATS_t
dlsch_stats
[
NUMBER_OF_NR_SCH_STATS_MAX
];
/// statistics for ULSCH measurement collection
NR_gNB_SCH_STATS_t
ulsch_stats
[
NUMBER_OF_NR_SCH_STATS_MAX
];
NR_gNB_UCI_STATS_t
uci_stats
[
NUMBER_OF_NR_UCI_STATS_MAX
];
NR_gNB_PHY_STATS_t
phy_stats
[
MAX_MOBILES_PER_GNB
];
t_nrPolar_params
**
polarParams
;
/// SRS variables
...
...
openair1/SCHED_NR/fapi_nr_l1.c
View file @
7c9b5013
...
...
@@ -103,7 +103,8 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot,
void
handle_nfapi_nr_csirs_pdu
(
processingData_L1tx_t
*
msgTx
,
int
frame
,
int
slot
,
nfapi_nr_dl_tti_csi_rs_pdu
*
csirs_pdu
)
{
nfapi_nr_dl_tti_csi_rs_pdu
*
csirs_pdu
)
{
int
found
=
0
;
...
...
@@ -127,12 +128,12 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
uint8_t
*
sdu
)
{
nr_fill_dlsch
(
msgTx
,
pdsch_pdu
,
sdu
);
}
void
nr_schedule_response
(
NR_Sched_Rsp_t
*
Sched_INFO
){
void
nr_schedule_response
(
NR_Sched_Rsp_t
*
Sched_INFO
)
{
PHY_VARS_gNB
*
gNB
;
// copy data from L2 interface into L1 structures
...
...
@@ -170,9 +171,9 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
const
time_stats_t
ts
=
exec_time_stats_NotifiedFIFO
(
res
);
merge_meas
(
&
gNB
->
phy_proc_tx
,
&
ts
);
msgTx
->
num_pdsch_slot
=
0
;
msgTx
->
num_dl_pdcch
=
0
;
msgTx
->
num_ul_pdcch
=
number_ul_dci_pdu
;
msgTx
->
num_pdsch_slot
=
0
;
msgTx
->
num_dl_pdcch
=
0
;
msgTx
->
num_ul_pdcch
=
number_ul_dci_pdu
;
msgTx
->
slot
=
slot
;
msgTx
->
frame
=
frame
;
...
...
openair1/SCHED_NR/phy_procedures_nr_gNB.c
View file @
7c9b5013
...
...
@@ -207,12 +207,14 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX
+
offset
,
0
);
}
void
nr_postDecode
(
PHY_VARS_gNB
*
gNB
,
notifiedFIFO_elt_t
*
req
)
{
void
nr_postDecode
(
PHY_VARS_gNB
*
gNB
,
notifiedFIFO_elt_t
*
req
)
{
ldpcDecode_t
*
rdata
=
(
ldpcDecode_t
*
)
NotifiedFifoData
(
req
);
NR_UL_gNB_HARQ_t
*
ulsch_harq
=
rdata
->
ulsch_harq
;
NR_gNB_ULSCH_t
*
ulsch
=
rdata
->
ulsch
;
int
r
=
rdata
->
segment_r
;
nfapi_nr_pusch_pdu_t
*
pusch_pdu
=
&
gNB
->
ulsch
[
rdata
->
ulsch_id
]
->
harq_process
es
[
rdata
->
harq_pid
]
->
ulsch_pdu
;
nfapi_nr_pusch_pdu_t
*
pusch_pdu
=
&
gNB
->
ulsch
[
rdata
->
ulsch_id
]
->
harq_process
->
ulsch_pdu
;
bool
decodeSuccess
=
(
rdata
->
decodeIterations
<=
rdata
->
decoderParms
.
numMaxIter
);
ulsch_harq
->
processedSegments
++
;
LOG_D
(
PHY
,
"processing result of segment: %d, processed %d/%d
\n
"
,
...
...
@@ -241,27 +243,25 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
// if all segments are done
if
(
rdata
->
nbSegments
==
ulsch_harq
->
processedSegments
)
{
if
(
decodeSuccess
&&
!
gNB
->
pusch_vars
[
rdata
->
ulsch_id
]
->
DTX
)
{
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting ACK for SFN/SF %d.%d (pid %d, ndi %d, status %d, round %d, TBS %d, Max interation (all seg) %d)
\n
"
,
gNB
->
Mod_id
,
ulsch_harq
->
frame
,
ulsch_harq
->
slot
,
rdata
->
harq_pid
,
pusch_pdu
->
pusch_data
.
new_data_indicator
,
ulsch_harq
->
status
,
ulsch_harq
->
round
,
ulsch_harq
->
TBS
,
rdata
->
decodeIterations
);
ulsch_harq
->
status
=
NR_SCH_IDLE
;
ulsch_harq
->
round
=
0
;
ulsch
->
harq_mask
&=
~
(
1
<<
rdata
->
harq_pid
);
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting ACK for SFN/SF %d.%d (rnti %x, pid %d, ndi %d, status %d, round %d, TBS %d, Max interation (all seg) %d)
\n
"
,
gNB
->
Mod_id
,
ulsch_harq
->
frame
,
ulsch_harq
->
slot
,
ulsch
->
rnti
,
rdata
->
harq_pid
,
pusch_pdu
->
pusch_data
.
new_data_indicator
,
ulsch
->
active
,
ulsch_harq
->
round
,
ulsch_harq
->
TBS
,
rdata
->
decodeIterations
);
ulsch
->
active
=
false
;
ulsch_harq
->
round
=
0
;
LOG_D
(
PHY
,
"ULSCH received ok
\n
"
);
nr_fill_indication
(
gNB
,
ulsch_harq
->
frame
,
ulsch_harq
->
slot
,
rdata
->
ulsch_id
,
rdata
->
harq_pid
,
0
,
0
);
nr_fill_indication
(
gNB
,
ulsch_harq
->
frame
,
ulsch_harq
->
slot
,
rdata
->
ulsch_id
,
rdata
->
harq_pid
,
0
,
0
);
//dumpsig=1;
}
else
{
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, prb_start %d, prb_size %d, TBS %d) r %d
\n
"
,
gNB
->
Mod_id
,
ulsch_harq
->
frame
,
ulsch_harq
->
slot
,
rdata
->
harq_pid
,
pusch_pdu
->
pusch_data
.
new_data_indicator
,
ulsch
_harq
->
status
,
ulsch_harq
->
round
,
rdata
->
harq_pid
,
pusch_pdu
->
pusch_data
.
new_data_indicator
,
ulsch
->
active
,
ulsch_harq
->
round
,
ulsch_harq
->
ulsch_pdu
.
pusch_data
.
rv_index
,
ulsch_harq
->
ulsch_pdu
.
rb_start
,
ulsch_harq
->
ulsch_pdu
.
rb_size
,
ulsch_harq
->
TBS
,
r
);
ulsch_harq
->
handled
=
1
;
ulsch_harq
->
ulsch_pdu
.
rb_start
,
ulsch_harq
->
ulsch_pdu
.
rb_size
,
ulsch_harq
->
TBS
,
r
);
ulsch
->
handled
=
1
;
LOG_D
(
PHY
,
"ULSCH %d in error
\n
"
,
rdata
->
ulsch_id
);
nr_fill_indication
(
gNB
,
ulsch_harq
->
frame
,
ulsch_harq
->
slot
,
rdata
->
ulsch_id
,
rdata
->
harq_pid
,
1
,
0
);
// dumpsig=1;
...
...
@@ -306,17 +306,17 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
void
nr_ulsch_procedures
(
PHY_VARS_gNB
*
gNB
,
int
frame_rx
,
int
slot_rx
,
int
ULSCH_id
,
uint8_t
harq_pid
)
{
NR_DL_FRAME_PARMS
*
frame_parms
=
&
gNB
->
frame_parms
;
nfapi_nr_pusch_pdu_t
*
pusch_pdu
=
&
gNB
->
ulsch
[
ULSCH_id
]
->
harq_process
es
[
harq_pid
]
->
ulsch_pdu
;
nfapi_nr_pusch_pdu_t
*
pusch_pdu
=
&
gNB
->
ulsch
[
ULSCH_id
]
->
harq_process
->
ulsch_pdu
;
uint8_t
l
,
number_dmrs_symbols
=
0
;
uint32_t
G
;
uint16_t
start_symbol
,
number_symbols
,
nb_re_dmrs
;
uint16_t
nb_re_dmrs
;
uint8_t
enable_ldpc_offload
=
gNB
->
ldpc_offload_flag
;
start_symbol
=
pusch_pdu
->
start_symbol_index
;
number_symbols
=
pusch_pdu
->
nr_of_symbols
;
uint16_t
start_symbol
=
pusch_pdu
->
start_symbol_index
;
uint16_t
number_symbols
=
pusch_pdu
->
nr_of_symbols
;
for
(
l
=
start_symbol
;
l
<
start_symbol
+
number_symbols
;
l
++
)
uint8_t
number_dmrs_symbols
=
0
;
for
(
int
l
=
start_symbol
;
l
<
start_symbol
+
number_symbols
;
l
++
)
number_dmrs_symbols
+=
((
pusch_pdu
->
ul_dmrs_symb_pos
)
>>
l
)
&
0x01
;
if
(
pusch_pdu
->
dmrs_config_type
==
pusch_dmrs_type1
)
...
...
@@ -324,12 +324,12 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
else
nb_re_dmrs
=
4
*
pusch_pdu
->
num_dmrs_cdm_grps_no_data
;
G
=
nr_get_G
(
pusch_pdu
->
rb_size
,
number_symbols
,
nb_re_dmrs
,
number_dmrs_symbols
,
// number of dmrs symbols irrespective of single or double symbol dmrs
pusch_pdu
->
qam_mod_order
,
pusch_pdu
->
nrOfLayers
);
uint32_t
G
=
nr_get_G
(
pusch_pdu
->
rb_size
,
number_symbols
,
nb_re_dmrs
,
number_dmrs_symbols
,
// number of dmrs symbols irrespective of single or double symbol dmrs
pusch_pdu
->
qam_mod_order
,
pusch_pdu
->
nrOfLayers
);
AssertFatal
(
G
>
0
,
"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u
\n
"
,
pusch_pdu
->
rb_size
,
...
...
@@ -377,7 +377,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
slot_rx
,
harq_pid
,
G
);
if
(
enable_ldpc_offload
==
0
)
{
if
(
enable_ldpc_offload
==
0
)
{
while
(
gNB
->
nbDecode
>
0
)
{
notifiedFIFO_elt_t
*
req
=
pullTpool
(
&
gNB
->
respDecode
,
&
gNB
->
threadPool
);
if
(
req
==
NULL
)
...
...
@@ -390,18 +390,19 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
}
void
nr_fill_indication
(
PHY_VARS_gNB
*
gNB
,
int
frame
,
int
slot_rx
,
int
ULSCH_id
,
uint8_t
harq_pid
,
uint8_t
crc_flag
,
int
dtx_flag
)
{
void
nr_fill_indication
(
PHY_VARS_gNB
*
gNB
,
int
frame
,
int
slot_rx
,
int
ULSCH_id
,
uint8_t
harq_pid
,
uint8_t
crc_flag
,
int
dtx_flag
)
{
pthread_mutex_lock
(
&
gNB
->
UL_INFO_mutex
);
NR_gNB_ULSCH_t
*
ulsch
=
gNB
->
ulsch
[
ULSCH_id
];
NR_UL_gNB_HARQ_t
*
harq_process
=
ulsch
->
harq_processes
[
harq_pid
]
;
NR_gNB_
SCH_STATS_t
*
stats
=
get_ulsch_stats
(
gNB
,
ulsch
);
NR_gNB_ULSCH_t
*
ulsch
=
gNB
->
ulsch
[
ULSCH_id
];
NR_UL_gNB_HARQ_t
*
harq_process
=
ulsch
->
harq_process
;
NR_gNB_
PHY_STATS_t
*
stats
=
get_phy_stats
(
gNB
,
ulsch
->
rnti
);
nfapi_nr_pusch_pdu_t
*
pusch_pdu
=
&
harq_process
->
ulsch_pdu
;
// Get estimated timing advance for MAC
int
sync_pos
=
gNB
->
measurements
.
delay
[
ULSCH_id
]
.
pusch_est_delay
;
int
sync_pos
=
ulsch
->
delay
.
pusch_est_delay
;
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
uint16_t
bw_scaling
=
16
*
gNB
->
frame_parms
.
ofdm_symbol_size
/
2048
;
...
...
@@ -412,7 +413,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
sync_pos_rounded
=
sync_pos
+
(
bw_scaling
/
2
)
-
1
;
else
sync_pos_rounded
=
sync_pos
-
(
bw_scaling
/
2
)
+
1
;
if
(
stats
)
stats
->
sync_pos
=
sync_pos
;
if
(
stats
)
stats
->
ulsch_stats
.
sync_pos
=
sync_pos
;
int
timing_advance_update
=
sync_pos_rounded
/
bw_scaling
;
...
...
@@ -554,27 +555,21 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
for
(
int
ULSCH_id
=
0
;
ULSCH_id
<
NUMBER_OF_NR_ULSCH_MAX
;
ULSCH_id
++
)
{
NR_gNB_ULSCH_t
*
ulsch
=
gNB
->
ulsch
[
ULSCH_id
];
int
harq_pid
;
NR_UL_gNB_HARQ_t
*
ulsch_harq
;
if
((
ulsch
)
&&
(
ulsch
->
rnti
>
0
))
{
for
(
harq_pid
=
0
;
harq_pid
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
harq_pid
++
)
{
ulsch_harq
=
ulsch
->
harq_processes
[
harq_pid
];
AssertFatal
(
ulsch_harq
!=
NULL
,
"harq_pid %d is not allocated
\n
"
,
harq_pid
);
if
((
ulsch_harq
->
status
==
NR_ACTIVE
)
&&
(
ulsch_harq
->
frame
==
frame_rx
)
&&
(
ulsch_harq
->
slot
==
slot_rx
)
&&
(
ulsch_harq
->
handled
==
0
)){
uint8_t
symbol_start
=
ulsch_harq
->
ulsch_pdu
.
start_symbol_index
;
uint8_t
symbol_end
=
symbol_start
+
ulsch_harq
->
ulsch_pdu
.
nr_of_symbols
;
for
(
int
symbol
=
symbol_start
;
symbol
<
symbol_end
;
symbol
++
)
{
if
(
gNB
->
frame_parms
.
frame_type
==
FDD
||
(
gNB
->
frame_parms
.
frame_type
==
TDD
&&
gNB
->
gNB_config
.
tdd_table
.
max_tdd_periodicity_list
[
slot_rx
].
max_num_of_symbol_per_slot_list
[
symbol
].
slot_config
.
value
==
1
))
{
LOG_D
(
PHY
,
"symbol %d Filling rb_mask_ul rb_size %d
\n
"
,
symbol
,
ulsch_harq
->
ulsch_pdu
.
rb_size
);
for
(
rb
=
0
;
rb
<
ulsch_harq
->
ulsch_pdu
.
rb_size
;
rb
++
)
{
rb2
=
rb
+
ulsch_harq
->
ulsch_pdu
.
rb_start
+
ulsch_harq
->
ulsch_pdu
.
bwp_start
;
gNB
->
rb_mask_ul
[
symbol
][
rb2
>>
5
]
|=
1U
<<
(
rb2
&
31
);
}
}
NR_UL_gNB_HARQ_t
*
ulsch_harq
=
ulsch_harq
=
ulsch
->
harq_process
;
AssertFatal
(
ulsch_harq
!=
NULL
,
"harq_pid %d is not allocated
\n
"
,
harq_pid
);
if
((
ulsch
->
active
==
true
)
&&
(
ulsch_harq
->
frame
==
frame_rx
)
&&
(
ulsch_harq
->
slot
==
slot_rx
)
&&
(
ulsch
->
handled
==
0
))
{
uint8_t
symbol_start
=
ulsch_harq
->
ulsch_pdu
.
start_symbol_index
;
uint8_t
symbol_end
=
symbol_start
+
ulsch_harq
->
ulsch_pdu
.
nr_of_symbols
;
for
(
int
symbol
=
symbol_start
;
symbol
<
symbol_end
;
symbol
++
)
{
if
(
gNB
->
frame_parms
.
frame_type
==
FDD
||
(
gNB
->
frame_parms
.
frame_type
==
TDD
&&
gNB
->
gNB_config
.
tdd_table
.
max_tdd_periodicity_list
[
slot_rx
].
max_num_of_symbol_per_slot_list
[
symbol
].
slot_config
.
value
==
1
))
{
LOG_D
(
PHY
,
"symbol %d Filling rb_mask_ul rb_size %d
\n
"
,
symbol
,
ulsch_harq
->
ulsch_pdu
.
rb_size
);
for
(
rb
=
0
;
rb
<
ulsch_harq
->
ulsch_pdu
.
rb_size
;
rb
++
)
{
rb2
=
rb
+
ulsch_harq
->
ulsch_pdu
.
rb_start
+
ulsch_harq
->
ulsch_pdu
.
bwp_start
;
gNB
->
rb_mask_ul
[
symbol
][
rb2
>>
5
]
|=
1U
<<
(
rb2
&
31
);
}
}
}
...
...
@@ -683,7 +678,9 @@ int check_srs_pdu(const nfapi_nr_srs_pdu_t *srs_pdu, nfapi_nr_srs_pdu_t *saved_s
return
0
;
}
int
phy_procedures_gNB_uespec_RX
(
PHY_VARS_gNB
*
gNB
,
int
frame_rx
,
int
slot_rx
)
{
int
phy_procedures_gNB_uespec_RX
(
PHY_VARS_gNB
*
gNB
,
int
frame_rx
,
int
slot_rx
)
{
/* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */
int
pucch_decode_done
=
0
;
int
pusch_decode_done
=
0
;
...
...
@@ -702,17 +699,18 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
num_symb
++
;
}
}
else
num_symb
=
NR_NUMBER_OF_SYMBOLS_PER_SLOT
;
else
num_symb
=
NR_NUMBER_OF_SYMBOLS_PER_SLOT
;
gNB_I0_measurements
(
gNB
,
slot_rx
,
first_symb
,
num_symb
);
const
int
soffset
=
(
slot_rx
&
3
)
*
gNB
->
frame_parms
.
symbols_per_slot
*
gNB
->
frame_parms
.
ofdm_symbol_size
;
int
offset
=
10
*
gNB
->
frame_parms
.
ofdm_symbol_size
+
gNB
->
frame_parms
.
first_carrier_offset
;
int
power_rxF
=
signal_energy_nodc
((
int32_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
+
(
47
*
12
)],
12
*
18
);
const
int
soffset
=
(
slot_rx
&
3
)
*
gNB
->
frame_parms
.
symbols_per_slot
*
gNB
->
frame_parms
.
ofdm_symbol_size
;
int
offset
=
10
*
gNB
->
frame_parms
.
ofdm_symbol_size
+
gNB
->
frame_parms
.
first_carrier_offset
;
int
power_rxF
=
signal_energy_nodc
((
int32_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
+
(
47
*
12
)],
12
*
18
);
LOG_D
(
PHY
,
"frame %d, slot %d: UL signal energy %d
\n
"
,
frame_rx
,
slot_rx
,
power_rxF
);
start_meas
(
&
gNB
->
phy_proc_rx
);
for
(
int
i
=
0
;
i
<
gNB
->
max_nb_pucch
;
i
++
){
for
(
int
i
=
0
;
i
<
gNB
->
max_nb_pucch
;
i
++
)
{
NR_gNB_PUCCH_t
*
pucch
=
gNB
->
pucch
[
i
];
if
(
pucch
)
{
if
(
NFAPI_MODE
==
NFAPI_MODE_PNF
)
...
...
@@ -736,8 +734,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_pdu_format0
=
&
gNB
->
uci_pdu_list
[
num_ucis
].
pucch_pdu_format_0_1
;
offset
=
pucch_pdu
->
start_symbol_index
*
gNB
->
frame_parms
.
ofdm_symbol_size
+
(
gNB
->
frame_parms
.
first_carrier_offset
+
pucch_pdu
->
prb_start
*
12
);
power_rxF
=
signal_energy_nodc
((
int32_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
],
12
);
LOG_D
(
PHY
,
"frame %d, slot %d: PUCCH signal energy %d
\n
"
,
frame_rx
,
slot_rx
,
power_rxF
);
power_rxF
=
signal_energy_nodc
((
int32_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
],
12
);
LOG_D
(
PHY
,
"frame %d, slot %d: PUCCH signal energy %d
\n
"
,
frame_rx
,
slot_rx
,
power_rxF
);
nr_decode_pucch0
(
gNB
,
frame_rx
,
...
...
@@ -747,7 +745,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
gNB
->
UL_INFO
.
uci_ind
.
num_ucis
+=
1
;
pucch
->
active
=
0
;
break
;
break
;
case
2
:
num_ucis
=
gNB
->
UL_INFO
.
uci_ind
.
num_ucis
;
gNB
->
UL_INFO
.
uci_ind
.
uci_list
=
&
gNB
->
uci_pdu_list
[
0
];
...
...
@@ -757,7 +755,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
gNB
->
uci_pdu_list
[
num_ucis
].
pdu_size
=
sizeof
(
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
);
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_pdu_format2
=
&
gNB
->
uci_pdu_list
[
num_ucis
].
pucch_pdu_format_2_3_4
;
LOG_D
(
PHY
,
"%d.%d Calling nr_decode_pucch2
\n
"
,
frame_rx
,
slot_rx
);
LOG_D
(
PHY
,
"%d.%d Calling nr_decode_pucch2
\n
"
,
frame_rx
,
slot_rx
);
nr_decode_pucch2
(
gNB
,
frame_rx
,
slot_rx
,
...
...
@@ -768,104 +766,97 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
pucch
->
active
=
0
;
break
;
default:
AssertFatal
(
1
==
0
,
"Only PUCCH formats 0 and 2 are currently supported
\n
"
);
AssertFatal
(
1
==
0
,
"Only PUCCH formats 0 and 2 are currently supported
\n
"
);
}
}
}
}
for
(
int
ULSCH_id
=
0
;
ULSCH_id
<
NUMBER_OF_NR_ULSCH_MAX
;
ULSCH_id
++
)
{
NR_gNB_ULSCH_t
*
ulsch
=
gNB
->
ulsch
[
ULSCH_id
];
NR_UL_gNB_HARQ_t
*
ulsch_harq
;
if
((
ulsch
)
&&
(
ulsch
->
rnti
>
0
))
{
// for for an active HARQ process
for
(
int
harq_pid
=
0
;
harq_pid
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
harq_pid
++
)
{
ulsch_harq
=
ulsch
->
harq_processes
[
harq_pid
];
AssertFatal
(
ulsch_harq
!=
NULL
,
"harq_pid %d is not allocated
\n
"
,
harq_pid
);
if
((
ulsch_harq
->
status
==
NR_ACTIVE
)
&&
(
ulsch_harq
->
frame
==
frame_rx
)
&&
(
ulsch_harq
->
slot
==
slot_rx
)
&&
(
ulsch_harq
->
handled
==
0
)){
LOG_D
(
PHY
,
"PUSCH detection started in frame %d slot %d
\n
"
,
frame_rx
,
slot_rx
);
int
num_dmrs
=
0
;
for
(
int
s
=
0
;
s
<
NR_NUMBER_OF_SYMBOLS_PER_SLOT
;
s
++
)
num_dmrs
+=
(
ulsch_harq
->
ulsch_pdu
.
ul_dmrs_symb_pos
>>
s
)
&
1
;
NR_UL_gNB_HARQ_t
*
ulsch_harq
=
ulsch
->
harq_process
;
AssertFatal
(
ulsch_harq
!=
NULL
,
"harq_pid %d is not allocated
\n
"
,
ulsch
->
harq_pid
);
if
((
ulsch
->
active
==
true
)
&&
(
ulsch_harq
->
frame
==
frame_rx
)
&&
(
ulsch_harq
->
slot
==
slot_rx
)
&&
(
ulsch
->
handled
==
0
))
{
LOG_D
(
PHY
,
"PUSCH ID %d with RNTI %x detection started in frame %d slot %d
\n
"
,
ULSCH_id
,
ulsch
->
rnti
,
frame_rx
,
slot_rx
);
int
num_dmrs
=
0
;
for
(
int
s
=
0
;
s
<
NR_NUMBER_OF_SYMBOLS_PER_SLOT
;
s
++
)
num_dmrs
+=
(
ulsch_harq
->
ulsch_pdu
.
ul_dmrs_symb_pos
>>
s
)
&
1
;
#ifdef DEBUG_RXDATA
NR_DL_FRAME_PARMS
*
frame_parms
=
&
gNB
->
frame_parms
;
RU_t
*
ru
=
gNB
->
RU_list
[
0
];
int
slot_offset
=
frame_parms
->
get_samples_slot_timestamp
(
slot_rx
,
frame_parms
,
0
);
slot_offset
-=
ru
->
N_TA_offset
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
0
]
=
(
int16_t
)
ulsch
->
rnti
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
1
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
rb_size
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
2
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
rb_start
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
3
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
nr_of_symbols
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
4
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
start_symbol_index
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
5
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
mcs_index
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
6
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
pusch_data
.
rv_index
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
7
]
=
(
int16_t
)
harq_pid
;
memcpy
(
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
+
4
],
&
ru
->
common
.
rxdata
[
0
][
slot_offset
],
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
*
sizeof
(
int32_t
));
gNB
->
common_vars
.
debugBuff_sample_offset
+=
(
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
+
1000
+
4
);
if
(
gNB
->
common_vars
.
debugBuff_sample_offset
>
((
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
+
1000
+
2
)
*
20
))
{
FILE
*
f
;
f
=
fopen
(
"rxdata_buff.raw"
,
"w"
);
if
(
f
==
NULL
)
exit
(
1
);
fwrite
((
int16_t
*
)
gNB
->
common_vars
.
debugBuff
,
2
,(
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
+
1000
+
4
)
*
20
*
2
,
f
);
fclose
(
f
);
exit
(
-
1
);
}
NR_DL_FRAME_PARMS
*
frame_parms
=
&
gNB
->
frame_parms
;
RU_t
*
ru
=
gNB
->
RU_list
[
0
];
int
slot_offset
=
frame_parms
->
get_samples_slot_timestamp
(
slot_rx
,
frame_parms
,
0
);
slot_offset
-=
ru
->
N_TA_offset
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
0
]
=
(
int16_t
)
ulsch
->
rnti
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
1
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
rb_size
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
2
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
rb_start
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
3
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
nr_of_symbols
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
4
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
start_symbol_index
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
5
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
mcs_index
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
6
]
=
(
int16_t
)
ulsch_harq
->
ulsch_pdu
.
pusch_data
.
rv_index
;
((
int16_t
*
)
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
])[
7
]
=
(
int16_t
)
ulsch
->
harq_pid
;
memcpy
(
&
gNB
->
common_vars
.
debugBuff
[
gNB
->
common_vars
.
debugBuff_sample_offset
+
4
],
&
ru
->
common
.
rxdata
[
0
][
slot_offset
],
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
*
sizeof
(
int32_t
));
gNB
->
common_vars
.
debugBuff_sample_offset
+=
(
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
+
1000
+
4
);
if
(
gNB
->
common_vars
.
debugBuff_sample_offset
>
((
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
+
1000
+
2
)
*
20
))
{
FILE
*
f
;
f
=
fopen
(
"rxdata_buff.raw"
,
"w"
);
if
(
f
==
NULL
)
exit
(
1
);
fwrite
((
int16_t
*
)
gNB
->
common_vars
.
debugBuff
,
2
,(
frame_parms
->
get_samples_per_slot
(
slot_rx
,
frame_parms
)
+
1000
+
4
)
*
20
*
2
,
f
);
fclose
(
f
);
exit
(
-
1
);
}
#endif
pusch_decode_done
=
1
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH
,
1
);
start_meas
(
&
gNB
->
rx_pusch_stats
);
nr_rx_pusch
(
gNB
,
ULSCH_id
,
frame_rx
,
slot_rx
,
harq_pid
);
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
=
0
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
=
0
;
for
(
int
aarx
=
0
;
aarx
<
gNB
->
frame_parms
.
nb_antennas_rx
;
aarx
++
)
{
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power
[
aarx
]
/=
num_dmrs
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
+=
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power
[
aarx
];
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power
[
aarx
]
/=
num_dmrs
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
+=
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power
[
aarx
];
}
if
(
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
)
<
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
)
+
gNB
->
pusch_thres
)
{
NR_gNB_SCH_STATS_t
*
stats
=
get_ulsch_stats
(
gNB
,
ulsch
);
LOG_D
(
PHY
,
"PUSCH not detected in %d.%d (%d,%d,%d)
\n
"
,
frame_rx
,
slot_rx
,
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
),
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
),
gNB
->
pusch_thres
);
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
=
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
DTX
=
1
;
if
(
stats
)
stats
->
DTX
++
;
if
(
!
get_softmodem_params
()
->
phy_test
)
{
/* in case of phy_test mode, we still want to decode to measure execution time.
Therefore, we don't yet call nr_fill_indication, it will be called later */
nr_fill_indication
(
gNB
,
frame_rx
,
slot_rx
,
ULSCH_id
,
harq_pid
,
1
,
1
);
pusch_DTX
++
;
continue
;
}
}
else
{
LOG_D
(
PHY
,
"PUSCH detected in %d.%d (%d,%d,%d)
\n
"
,
frame_rx
,
slot_rx
,
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
),
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
),
gNB
->
pusch_thres
);
gNB
->
pusch_vars
[
ULSCH_id
]
->
DTX
=
0
;
}
stop_meas
(
&
gNB
->
rx_pusch_stats
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH
,
0
);
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX
,
1
);
nr_ulsch_procedures
(
gNB
,
frame_rx
,
slot_rx
,
ULSCH_id
,
harq_pid
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX
,
0
);
break
;
}
pusch_decode_done
=
1
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH
,
1
);
start_meas
(
&
gNB
->
rx_pusch_stats
);
nr_rx_pusch
(
gNB
,
ULSCH_id
,
frame_rx
,
slot_rx
,
ulsch
->
harq_pid
);
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
=
0
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
=
0
;
for
(
int
aarx
=
0
;
aarx
<
gNB
->
frame_parms
.
nb_antennas_rx
;
aarx
++
)
{
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power
[
aarx
]
/=
num_dmrs
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
+=
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power
[
aarx
];
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power
[
aarx
]
/=
num_dmrs
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
+=
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power
[
aarx
];
}
if
(
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
)
<
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
)
+
gNB
->
pusch_thres
)
{
NR_gNB_PHY_STATS_t
*
stats
=
get_phy_stats
(
gNB
,
ulsch
->
rnti
);
LOG_D
(
PHY
,
"PUSCH not detected in %d.%d (%d,%d,%d)
\n
"
,
frame_rx
,
slot_rx
,
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
),
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
),
gNB
->
pusch_thres
);
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
=
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
;
gNB
->
pusch_vars
[
ULSCH_id
]
->
DTX
=
1
;
if
(
stats
)
stats
->
ulsch_stats
.
DTX
++
;
if
(
!
get_softmodem_params
()
->
phy_test
)
{
/* in case of phy_test mode, we still want to decode to measure execution time.
Therefore, we don't yet call nr_fill_indication, it will be called later */
nr_fill_indication
(
gNB
,
frame_rx
,
slot_rx
,
ULSCH_id
,
ulsch
->
harq_pid
,
1
,
1
);
pusch_DTX
++
;
continue
;
}
}
else
{
LOG_D
(
PHY
,
"PUSCH detected in %d.%d (%d,%d,%d)
\n
"
,
frame_rx
,
slot_rx
,
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_power_tot
),
dB_fixed_x10
(
gNB
->
pusch_vars
[
ULSCH_id
]
->
ulsch_noise_power_tot
),
gNB
->
pusch_thres
);
gNB
->
pusch_vars
[
ULSCH_id
]
->
DTX
=
0
;
}
stop_meas
(
&
gNB
->
rx_pusch_stats
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH
,
0
);
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX
,
1
);
nr_ulsch_procedures
(
gNB
,
frame_rx
,
slot_rx
,
ULSCH_id
,
ulsch
->
harq_pid
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX
,
0
);
}
}
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
7c9b5013
...
...
@@ -1979,13 +1979,9 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces
}
}
/* hack data to remove UE in the phy */
int
rnti_to_remove
[
10
];
volatile
int
rnti_to_remove_count
;
pthread_mutex_t
rnti_to_remove_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
void
delete_nr_ue_data
(
NR_UE_info_t
*
UE
,
NR_COMMON_channels_t
*
ccPtr
,
uid_allocator_t
*
uia
)
{
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE
->
UE_sched_ctrl
;
destroy_nr_list
(
&
sched_ctrl
->
available_dl_harq
);
destroy_nr_list
(
&
sched_ctrl
->
feedback_dl_harq
);
...
...
@@ -1997,16 +1993,6 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca
LOG_I
(
NR_MAC
,
"Remove NR rnti 0x%04x
\n
"
,
UE
->
rnti
);
const
rnti_t
rnti
=
UE
->
rnti
;
free
(
UE
);
/* hack to remove UE in the phy */
if
(
pthread_mutex_lock
(
&
rnti_to_remove_mutex
))
exit
(
1
);
if
(
rnti_to_remove_count
==
10
)
exit
(
1
);
rnti_to_remove
[
rnti_to_remove_count
]
=
rnti
;
LOG_W
(
NR_MAC
,
"to remove in mac rnti_to_remove[%d] = 0x%04x
\n
"
,
rnti_to_remove_count
,
rnti
);
rnti_to_remove_count
++
;
if
(
pthread_mutex_unlock
(
&
rnti_to_remove_mutex
))
exit
(
1
);
/* clear RA process(es?) associated to the UE */
for
(
int
cc_id
=
0
;
cc_id
<
NFAPI_CC_MAX
;
cc_id
++
)
{
...
...
@@ -2015,8 +2001,8 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca
if
(
cc
->
ra
[
i
].
rnti
==
rnti
)
{
LOG_D
(
NR_MAC
,
"free RA process %d for rnti %04x
\n
"
,
i
,
rnti
);
/* is it enough? */
cc
->
ra
[
i
].
cfra
=
false
;
cc
->
ra
[
i
].
rnti
=
0
;
cc
->
ra
[
i
].
cfra
=
false
;
cc
->
ra
[
i
].
rnti
=
0
;
cc
->
ra
[
i
].
crnti
=
0
;
}
}
...
...
@@ -2524,16 +2510,6 @@ void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti)
delete_nr_ue_data
(
UE
,
nr_mac
->
common_channels
,
&
UE_info
->
uid_allocator
);
}
void
nr_mac_remove_ra_rnti
(
module_id_t
mod_id
,
rnti_t
rnti
)
{
// Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue)
if
(
pthread_mutex_lock
(
&
rnti_to_remove_mutex
))
exit
(
1
);
if
(
rnti_to_remove_count
==
10
)
exit
(
1
);
rnti_to_remove
[
rnti_to_remove_count
]
=
rnti
;
LOG_W
(
NR_MAC
,
"to remove in mac rnti_to_remove[%d] = 0x%04x
\n
"
,
rnti_to_remove_count
,
rnti
);
rnti_to_remove_count
++
;
if
(
pthread_mutex_unlock
(
&
rnti_to_remove_mutex
))
exit
(
1
);
}
uint8_t
nr_get_tpc
(
int
target
,
uint8_t
cqi
,
int
incr
)
{
// al values passed to this function are x10
int
snrx10
=
(
cqi
*
5
)
-
640
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
View file @
7c9b5013
...
...
@@ -680,7 +680,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
if
(
no_sig
)
{
LOG_D
(
NR_MAC
,
"Random Access %i failed at state %i (no signal)
\n
"
,
i
,
ra
->
state
);
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
}
else
{
...
...
@@ -693,7 +692,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
if
(
(
frameP
==
ra
->
Msg3_frame
)
&&
(
slotP
==
ra
->
Msg3_slot
)
)
{
LOG_D
(
NR_MAC
,
"Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)
\n
"
,
i
,
ra
->
state
,
ra
->
rnti
,
current_rnti
);
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
}
...
...
@@ -703,7 +701,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
NR_UE_info_t
*
UE
=
add_new_nr_ue
(
gNB_mac
,
ra
->
rnti
,
ra
->
CellGroup
);
if
(
!
UE
)
{
LOG_W
(
NR_MAC
,
"Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!
\n
"
,
i
,
ra
->
state
,
ra
->
rnti
,
current_rnti
);
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
return
;
}
...
...
@@ -737,7 +734,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
LOG_A
(
NR_MAC
,
"(rnti 0x%04x) CFRA procedure succeeded!
\n
"
,
ra
->
rnti
);
UE
->
ra_timer
=
0
;
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
process_CellGroup
(
ra
->
CellGroup
,
UE_scheduling_control
);
...
...
@@ -785,7 +781,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
}
}
else
{
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
}
}
...
...
@@ -804,14 +799,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
// for CFRA (NSA) do not schedule retransmission of msg3
if
(
ra
->
cfra
)
{
LOG_D
(
NR_MAC
,
"Random Access %i failed at state %i (NSA msg3 reception failed)
\n
"
,
i
,
ra
->
state
);
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
return
;
}
if
(
ra
->
msg3_round
>=
gNB_mac
->
ul_bler
.
harq_round_max
-
1
)
{
LOG_W
(
NR_MAC
,
"Random Access %i failed at state %i (Reached msg3 max harq rounds)
\n
"
,
i
,
ra
->
state
);
nr_mac_remove_ra_rnti
(
gnb_mod_idP
,
ra
->
rnti
);
nr_clear_ra_proc
(
gnb_mod_idP
,
CC_idP
,
frameP
,
ra
);
return
;
}
...
...
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