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
9eed7db8
Commit
9eed7db8
authored
Aug 30, 2022
by
Sagar Parsawar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizing PRS buffers, added freeing up in nrUE
parent
73ca6daa
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
247 additions
and
208 deletions
+247
-208
executables/nr-ue.c
executables/nr-ue.c
+0
-168
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+0
-2
openair1/PHY/INIT/nr_init_ue.c
openair1/PHY/INIT/nr_init_ue.c
+215
-0
openair1/PHY/INIT/phy_init.h
openair1/PHY/INIT/phy_init.h
+3
-0
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+27
-33
openair1/PHY/defs_nr_UE.h
openair1/PHY/defs_nr_UE.h
+2
-5
No files found.
executables/nr-ue.c
View file @
9eed7db8
...
...
@@ -34,7 +34,6 @@
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "openair2/COMMON/prs_nr_paramdef.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
/*
...
...
@@ -152,170 +151,6 @@ static void *nrL1_UE_stats_thread(void *param)
return
NULL
;
}
void
RCconfig_nrUE_prs
(
void
*
cfg
)
{
int
j
=
0
,
k
=
0
,
gNB_id
=
0
;
char
aprefix
[
MAX_OPTNAME_SIZE
*
2
+
8
];
char
str
[
7
][
100
]
=
{
'\0'
};
int16_t
n
[
7
]
=
{
0
};
PHY_VARS_NR_UE
*
ue
=
(
PHY_VARS_NR_UE
*
)
cfg
;
prs_config_t
*
prs_config
=
NULL
;
paramlist_def_t
gParamList
=
{
CONFIG_STRING_PRS_LIST
,
NULL
,
0
};
paramdef_t
gParams
[]
=
PRS_GLOBAL_PARAMS_DESC
;
config_getlist
(
&
gParamList
,
gParams
,
sizeof
(
gParams
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
gParamList
.
numelt
>
0
)
{
ue
->
prs_active_gNBs
=
*
(
gParamList
.
paramarray
[
j
][
PRS_ACTIVE_GNBS_IDX
].
uptr
);
}
else
{
LOG_E
(
PHY
,
"%s configuration NOT found..!! Skipped configuring UE for the PRS reception
\n
"
,
CONFIG_STRING_PRS_CONFIG
);
}
paramlist_def_t
PRS_ParamList
=
{{
0
},
NULL
,
0
};
for
(
int
i
=
0
;
i
<
ue
->
prs_active_gNBs
;
i
++
)
{
paramdef_t
PRS_Params
[]
=
PRS_PARAMS_DESC
;
sprintf
(
PRS_ParamList
.
listname
,
"%s%i"
,
CONFIG_STRING_PRS_CONFIG
,
i
);
sprintf
(
aprefix
,
"%s.[%i]"
,
CONFIG_STRING_PRS_LIST
,
0
);
config_getlist
(
&
PRS_ParamList
,
PRS_Params
,
sizeof
(
PRS_Params
)
/
sizeof
(
paramdef_t
),
aprefix
);
if
(
PRS_ParamList
.
numelt
>
0
)
{
for
(
j
=
0
;
j
<
PRS_ParamList
.
numelt
;
j
++
)
{
gNB_id
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_GNB_ID
].
uptr
);
if
(
gNB_id
!=
i
)
gNB_id
=
i
;
// force gNB_id to avoid mismatch
memset
(
n
,
0
,
sizeof
(
n
));
ue
->
prs_vars
[
gNB_id
]
->
NumPRSResources
=
*
(
PRS_ParamList
.
paramarray
[
j
][
NUM_PRS_RESOURCES
].
uptr
);
for
(
k
=
0
;
k
<
ue
->
prs_vars
[
gNB_id
]
->
NumPRSResources
;
k
++
)
{
prs_config
=
&
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
k
].
prs_cfg
;
prs_config
->
PRSResourceSetPeriod
[
0
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_SET_PERIOD_LIST
].
uptr
[
0
];
prs_config
->
PRSResourceSetPeriod
[
1
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_SET_PERIOD_LIST
].
uptr
[
1
];
// per PRS resources parameters
prs_config
->
SymbolStart
=
PRS_ParamList
.
paramarray
[
j
][
PRS_SYMBOL_START_LIST
].
uptr
[
k
];
prs_config
->
NumPRSSymbols
=
PRS_ParamList
.
paramarray
[
j
][
PRS_NUM_SYMBOLS_LIST
].
uptr
[
k
];
prs_config
->
REOffset
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RE_OFFSET_LIST
].
uptr
[
k
];
prs_config
->
NPRSID
=
PRS_ParamList
.
paramarray
[
j
][
PRS_ID_LIST
].
uptr
[
k
];
prs_config
->
PRSResourceOffset
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_OFFSET_LIST
].
uptr
[
k
];
// Common parameters to all PRS resources
prs_config
->
NumRB
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_NUM_RB
].
uptr
);
prs_config
->
RBOffset
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_RB_OFFSET
].
uptr
);
prs_config
->
CombSize
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_COMB_SIZE
].
uptr
);
prs_config
->
PRSResourceRepetition
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_REPETITION
].
uptr
);
prs_config
->
PRSResourceTimeGap
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_TIME_GAP
].
uptr
);
prs_config
->
MutingBitRepetition
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_BIT_REPETITION
].
uptr
);
for
(
int
l
=
0
;
l
<
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN1_LIST
].
numelt
;
l
++
)
{
prs_config
->
MutingPattern1
[
l
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN1_LIST
].
uptr
[
l
];
if
(
k
==
0
)
// print only for 0th resource
n
[
5
]
+=
snprintf
(
str
[
5
]
+
n
[
5
],
sizeof
(
str
[
5
]),
"%d, "
,
prs_config
->
MutingPattern1
[
l
]);
}
for
(
int
l
=
0
;
l
<
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN2_LIST
].
numelt
;
l
++
)
{
prs_config
->
MutingPattern2
[
l
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN2_LIST
].
uptr
[
l
];
if
(
k
==
0
)
// print only for 0th resource
n
[
6
]
+=
snprintf
(
str
[
6
]
+
n
[
6
],
sizeof
(
str
[
6
]),
"%d, "
,
prs_config
->
MutingPattern2
[
l
]);
}
// print to buffer
n
[
0
]
+=
snprintf
(
str
[
0
]
+
n
[
0
],
sizeof
(
str
[
0
]),
"%d, "
,
prs_config
->
SymbolStart
);
n
[
1
]
+=
snprintf
(
str
[
1
]
+
n
[
1
],
sizeof
(
str
[
1
]),
"%d, "
,
prs_config
->
NumPRSSymbols
);
n
[
2
]
+=
snprintf
(
str
[
2
]
+
n
[
2
],
sizeof
(
str
[
2
]),
"%d, "
,
prs_config
->
REOffset
);
n
[
3
]
+=
snprintf
(
str
[
3
]
+
n
[
3
],
sizeof
(
str
[
3
]),
"%d, "
,
prs_config
->
PRSResourceOffset
);
n
[
4
]
+=
snprintf
(
str
[
4
]
+
n
[
4
],
sizeof
(
str
[
4
]),
"%d, "
,
prs_config
->
NPRSID
);
}
// for k
prs_config
=
&
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
0
].
prs_cfg
;
LOG_I
(
PHY
,
"-----------------------------------------
\n
"
);
LOG_I
(
PHY
,
"PRS Config for gNB_id %d @ %p
\n
"
,
gNB_id
,
prs_config
);
LOG_I
(
PHY
,
"-----------------------------------------
\n
"
);
LOG_I
(
PHY
,
"NumPRSResources
\t
%d
\n
"
,
ue
->
prs_vars
[
gNB_id
]
->
NumPRSResources
);
LOG_I
(
PHY
,
"PRSResourceSetPeriod
\t
[%d, %d]
\n
"
,
prs_config
->
PRSResourceSetPeriod
[
0
],
prs_config
->
PRSResourceSetPeriod
[
1
]);
LOG_I
(
PHY
,
"NumRB
\t\t\t
%d
\n
"
,
prs_config
->
NumRB
);
LOG_I
(
PHY
,
"RBOffset
\t\t
%d
\n
"
,
prs_config
->
RBOffset
);
LOG_I
(
PHY
,
"CombSize
\t\t
%d
\n
"
,
prs_config
->
CombSize
);
LOG_I
(
PHY
,
"PRSResourceRepetition
\t
%d
\n
"
,
prs_config
->
PRSResourceRepetition
);
LOG_I
(
PHY
,
"PRSResourceTimeGap
\t
%d
\n
"
,
prs_config
->
PRSResourceTimeGap
);
LOG_I
(
PHY
,
"MutingBitRepetition
\t
%d
\n
"
,
prs_config
->
MutingBitRepetition
);
LOG_I
(
PHY
,
"SymbolStart
\t\t
[%s
\b\b
]
\n
"
,
str
[
0
]);
LOG_I
(
PHY
,
"NumPRSSymbols
\t\t
[%s
\b\b
]
\n
"
,
str
[
1
]);
LOG_I
(
PHY
,
"REOffset
\t\t
[%s
\b\b
]
\n
"
,
str
[
2
]);
LOG_I
(
PHY
,
"PRSResourceOffset
\t
[%s
\b\b
]
\n
"
,
str
[
3
]);
LOG_I
(
PHY
,
"NPRS_ID
\t\t
[%s
\b\b
]
\n
"
,
str
[
4
]);
LOG_I
(
PHY
,
"MutingPattern1
\t\t
[%s
\b\b
]
\n
"
,
str
[
5
]);
LOG_I
(
PHY
,
"MutingPattern2
\t\t
[%s
\b\b
]
\n
"
,
str
[
6
]);
LOG_I
(
PHY
,
"-----------------------------------------
\n
"
);
}
}
else
{
LOG_E
(
PHY
,
"No %s configuration found..!!
\n
"
,
PRS_ParamList
.
listname
);
}
}
}
void
init_nr_prs_ue_vars
(
PHY_VARS_NR_UE
*
ue
)
{
NR_UE_PRS
**
const
prs_vars
=
ue
->
prs_vars
;
NR_DL_FRAME_PARMS
*
const
fp
=
&
ue
->
frame_parms
;
// PRS vars init
for
(
int
idx
=
0
;
idx
<
NR_MAX_PRS_COMB_SIZE
;
idx
++
)
{
prs_vars
[
idx
]
=
(
NR_UE_PRS
*
)
malloc16_clear
(
sizeof
(
NR_UE_PRS
));
prs_vars
[
idx
]
->
ch_tmp
=
(
int16_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
chF_interpol
=
(
int16_t
*
)
malloc16_clear
(
NR_PRS_IDFT_OVERSAMP_FACTOR
*
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
chT_interpol
=
(
int16_t
*
)
malloc16_clear
(
NR_PRS_IDFT_OVERSAMP_FACTOR
*
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
for
(
int
k
=
0
;
k
<
NR_MAX_PRS_RESOURCES_PER_SET
;
k
++
)
{
// PRS channel estimates
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
=
(
int32_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
=
(
int32_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
AssertFatal
(((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
!=
NULL
)
||
(
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
!=
NULL
)),
"NR UE init: PRS channel estimates malloc failed for gNB_id %d
\n
"
,
idx
);
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
=
(
prs_meas_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
prs_meas_t
*
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
!=
NULL
),
"NR UE init: PRS measurements malloc failed for gNB_id %d
\n
"
,
idx
);
for
(
int
j
=
0
;
j
<
fp
->
nb_antennas_rx
;
j
++
)
{
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
[
j
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
[
j
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
(((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
[
j
]
!=
NULL
)
||
(
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
[
j
]
!=
NULL
)),
"NR UE init: PRS channel estimates malloc failed for rx_ant %d
\n
"
,
j
);
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]
=
(
prs_meas_t
*
)
malloc16_clear
(
sizeof
(
prs_meas_t
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]
!=
NULL
),
"NR UE init: PRS measurements malloc failed for rx_ant %d
\n
"
,
j
);
}
}
}
// load the config file params
RCconfig_nrUE_prs
(
ue
);
//PRS sequence init
ue
->
nr_gold_prs
=
(
uint32_t
*****
)
malloc16
(
ue
->
prs_active_gNBs
*
sizeof
(
uint32_t
****
));
uint32_t
*****
prs
=
ue
->
nr_gold_prs
;
AssertFatal
(
prs
!=
NULL
,
"NR UE init: positioning reference signal malloc failed
\n
"
);
for
(
int
gnb
=
0
;
gnb
<
ue
->
prs_active_gNBs
;
gnb
++
)
{
prs
[
gnb
]
=
(
uint32_t
****
)
malloc16
(
ue
->
prs_vars
[
gnb
]
->
NumPRSResources
*
sizeof
(
uint32_t
***
));
AssertFatal
(
prs
[
gnb
]
!=
NULL
,
"NR UE init: positioning reference signal for gnb %d - malloc failed
\n
"
,
gnb
);
for
(
int
rsc
=
0
;
rsc
<
ue
->
prs_vars
[
gnb
]
->
NumPRSResources
;
rsc
++
)
{
prs
[
gnb
][
rsc
]
=
(
uint32_t
***
)
malloc16
(
fp
->
slots_per_frame
*
sizeof
(
uint32_t
**
));
AssertFatal
(
prs
[
gnb
][
rsc
]
!=
NULL
,
"NR UE init: positioning reference signal for gnb %d rsc %d- malloc failed
\n
"
,
gnb
,
rsc
);
for
(
int
slot
=
0
;
slot
<
fp
->
slots_per_frame
;
slot
++
)
{
prs
[
gnb
][
rsc
][
slot
]
=
(
uint32_t
**
)
malloc16
(
fp
->
symbols_per_slot
*
sizeof
(
uint32_t
*
));
AssertFatal
(
prs
[
gnb
][
rsc
][
slot
]
!=
NULL
,
"NR UE init: positioning reference signal for gnb %d rsc %d slot %d - malloc failed
\n
"
,
gnb
,
rsc
,
slot
);
for
(
int
symb
=
0
;
symb
<
fp
->
symbols_per_slot
;
symb
++
)
{
prs
[
gnb
][
rsc
][
slot
][
symb
]
=
(
uint32_t
*
)
malloc16
(
NR_MAX_PRS_INIT_LENGTH_DWORD
*
sizeof
(
uint32_t
));
AssertFatal
(
prs
[
gnb
][
rsc
][
slot
][
symb
]
!=
NULL
,
"NR UE init: positioning reference signal for gnb %d rsc %d slot %d symbol %d - malloc failed
\n
"
,
gnb
,
rsc
,
slot
,
symb
);
}
// for symb
}
// for slot
}
// for rsc
}
// for gnb
init_nr_gold_prs
(
ue
);
}
void
init_nr_ue_vars
(
PHY_VARS_NR_UE
*
ue
,
uint8_t
UE_id
,
uint8_t
abstraction_flag
)
...
...
@@ -334,9 +169,6 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
ue
->
prach_resources
[
gNB_id
]
=
(
NR_PRACH_RESOURCES_t
*
)
malloc16_clear
(
sizeof
(
NR_PRACH_RESOURCES_t
));
}
// initialize nr prs vars
init_nr_prs_ue_vars
(
ue
);
// initialize all signal buffers
init_nr_ue_signal
(
ue
,
nb_connected_gNB
);
...
...
executables/nr-uesoftmodem.h
View file @
9eed7db8
...
...
@@ -100,6 +100,4 @@ extern void start_oai_nrue_threads(void);
void
*
UE_thread
(
void
*
arg
);
void
init_nr_ue_vars
(
PHY_VARS_NR_UE
*
ue
,
uint8_t
UE_id
,
uint8_t
abstraction_flag
);
void
init_nrUE_standalone_thread
(
int
ue_idx
);
void
RCconfig_nrUE_prs
(
void
*
cfg
);
void
init_nr_prs_ue_vars
(
PHY_VARS_NR_UE
*
ue
);
#endif
openair1/PHY/INIT/nr_init_ue.c
View file @
9eed7db8
...
...
@@ -33,6 +33,7 @@
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "openair2/COMMON/prs_nr_paramdef.h"
extern
uint16_t
beta_cqi
[
16
];
...
...
@@ -135,6 +136,174 @@ void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp
free_and_zero
(
pdsch
->
ptrs_re_per_slot
);
}
void
RCconfig_nrUE_prs
(
void
*
cfg
)
{
int
j
=
0
,
k
=
0
,
gNB_id
=
0
;
char
aprefix
[
MAX_OPTNAME_SIZE
*
2
+
8
];
char
str
[
7
][
100
]
=
{
'\0'
};
int16_t
n
[
7
]
=
{
0
};
PHY_VARS_NR_UE
*
ue
=
(
PHY_VARS_NR_UE
*
)
cfg
;
prs_config_t
*
prs_config
=
NULL
;
paramlist_def_t
gParamList
=
{
CONFIG_STRING_PRS_LIST
,
NULL
,
0
};
paramdef_t
gParams
[]
=
PRS_GLOBAL_PARAMS_DESC
;
config_getlist
(
&
gParamList
,
gParams
,
sizeof
(
gParams
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
gParamList
.
numelt
>
0
)
{
ue
->
prs_active_gNBs
=
*
(
gParamList
.
paramarray
[
j
][
PRS_ACTIVE_GNBS_IDX
].
uptr
);
}
else
{
LOG_E
(
PHY
,
"%s configuration NOT found..!! Skipped configuring UE for the PRS reception
\n
"
,
CONFIG_STRING_PRS_CONFIG
);
}
paramlist_def_t
PRS_ParamList
=
{{
0
},
NULL
,
0
};
for
(
int
i
=
0
;
i
<
ue
->
prs_active_gNBs
;
i
++
)
{
paramdef_t
PRS_Params
[]
=
PRS_PARAMS_DESC
;
sprintf
(
PRS_ParamList
.
listname
,
"%s%i"
,
CONFIG_STRING_PRS_CONFIG
,
i
);
sprintf
(
aprefix
,
"%s.[%i]"
,
CONFIG_STRING_PRS_LIST
,
0
);
config_getlist
(
&
PRS_ParamList
,
PRS_Params
,
sizeof
(
PRS_Params
)
/
sizeof
(
paramdef_t
),
aprefix
);
if
(
PRS_ParamList
.
numelt
>
0
)
{
for
(
j
=
0
;
j
<
PRS_ParamList
.
numelt
;
j
++
)
{
gNB_id
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_GNB_ID
].
uptr
);
if
(
gNB_id
!=
i
)
gNB_id
=
i
;
// force gNB_id to avoid mismatch
memset
(
n
,
0
,
sizeof
(
n
));
ue
->
prs_vars
[
gNB_id
]
->
NumPRSResources
=
*
(
PRS_ParamList
.
paramarray
[
j
][
NUM_PRS_RESOURCES
].
uptr
);
for
(
k
=
0
;
k
<
ue
->
prs_vars
[
gNB_id
]
->
NumPRSResources
;
k
++
)
{
prs_config
=
&
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
k
].
prs_cfg
;
prs_config
->
PRSResourceSetPeriod
[
0
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_SET_PERIOD_LIST
].
uptr
[
0
];
prs_config
->
PRSResourceSetPeriod
[
1
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_SET_PERIOD_LIST
].
uptr
[
1
];
// per PRS resources parameters
prs_config
->
SymbolStart
=
PRS_ParamList
.
paramarray
[
j
][
PRS_SYMBOL_START_LIST
].
uptr
[
k
];
prs_config
->
NumPRSSymbols
=
PRS_ParamList
.
paramarray
[
j
][
PRS_NUM_SYMBOLS_LIST
].
uptr
[
k
];
prs_config
->
REOffset
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RE_OFFSET_LIST
].
uptr
[
k
];
prs_config
->
NPRSID
=
PRS_ParamList
.
paramarray
[
j
][
PRS_ID_LIST
].
uptr
[
k
];
prs_config
->
PRSResourceOffset
=
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_OFFSET_LIST
].
uptr
[
k
];
// Common parameters to all PRS resources
prs_config
->
NumRB
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_NUM_RB
].
uptr
);
prs_config
->
RBOffset
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_RB_OFFSET
].
uptr
);
prs_config
->
CombSize
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_COMB_SIZE
].
uptr
);
prs_config
->
PRSResourceRepetition
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_REPETITION
].
uptr
);
prs_config
->
PRSResourceTimeGap
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_RESOURCE_TIME_GAP
].
uptr
);
prs_config
->
MutingBitRepetition
=
*
(
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_BIT_REPETITION
].
uptr
);
for
(
int
l
=
0
;
l
<
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN1_LIST
].
numelt
;
l
++
)
{
prs_config
->
MutingPattern1
[
l
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN1_LIST
].
uptr
[
l
];
if
(
k
==
0
)
// print only for 0th resource
n
[
5
]
+=
snprintf
(
str
[
5
]
+
n
[
5
],
sizeof
(
str
[
5
]),
"%d, "
,
prs_config
->
MutingPattern1
[
l
]);
}
for
(
int
l
=
0
;
l
<
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN2_LIST
].
numelt
;
l
++
)
{
prs_config
->
MutingPattern2
[
l
]
=
PRS_ParamList
.
paramarray
[
j
][
PRS_MUTING_PATTERN2_LIST
].
uptr
[
l
];
if
(
k
==
0
)
// print only for 0th resource
n
[
6
]
+=
snprintf
(
str
[
6
]
+
n
[
6
],
sizeof
(
str
[
6
]),
"%d, "
,
prs_config
->
MutingPattern2
[
l
]);
}
// print to buffer
n
[
0
]
+=
snprintf
(
str
[
0
]
+
n
[
0
],
sizeof
(
str
[
0
]),
"%d, "
,
prs_config
->
SymbolStart
);
n
[
1
]
+=
snprintf
(
str
[
1
]
+
n
[
1
],
sizeof
(
str
[
1
]),
"%d, "
,
prs_config
->
NumPRSSymbols
);
n
[
2
]
+=
snprintf
(
str
[
2
]
+
n
[
2
],
sizeof
(
str
[
2
]),
"%d, "
,
prs_config
->
REOffset
);
n
[
3
]
+=
snprintf
(
str
[
3
]
+
n
[
3
],
sizeof
(
str
[
3
]),
"%d, "
,
prs_config
->
PRSResourceOffset
);
n
[
4
]
+=
snprintf
(
str
[
4
]
+
n
[
4
],
sizeof
(
str
[
4
]),
"%d, "
,
prs_config
->
NPRSID
);
}
// for k
prs_config
=
&
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
0
].
prs_cfg
;
LOG_I
(
PHY
,
"-----------------------------------------
\n
"
);
LOG_I
(
PHY
,
"PRS Config for gNB_id %d @ %p
\n
"
,
gNB_id
,
prs_config
);
LOG_I
(
PHY
,
"-----------------------------------------
\n
"
);
LOG_I
(
PHY
,
"NumPRSResources
\t
%d
\n
"
,
ue
->
prs_vars
[
gNB_id
]
->
NumPRSResources
);
LOG_I
(
PHY
,
"PRSResourceSetPeriod
\t
[%d, %d]
\n
"
,
prs_config
->
PRSResourceSetPeriod
[
0
],
prs_config
->
PRSResourceSetPeriod
[
1
]);
LOG_I
(
PHY
,
"NumRB
\t\t\t
%d
\n
"
,
prs_config
->
NumRB
);
LOG_I
(
PHY
,
"RBOffset
\t\t
%d
\n
"
,
prs_config
->
RBOffset
);
LOG_I
(
PHY
,
"CombSize
\t\t
%d
\n
"
,
prs_config
->
CombSize
);
LOG_I
(
PHY
,
"PRSResourceRepetition
\t
%d
\n
"
,
prs_config
->
PRSResourceRepetition
);
LOG_I
(
PHY
,
"PRSResourceTimeGap
\t
%d
\n
"
,
prs_config
->
PRSResourceTimeGap
);
LOG_I
(
PHY
,
"MutingBitRepetition
\t
%d
\n
"
,
prs_config
->
MutingBitRepetition
);
LOG_I
(
PHY
,
"SymbolStart
\t\t
[%s
\b\b
]
\n
"
,
str
[
0
]);
LOG_I
(
PHY
,
"NumPRSSymbols
\t\t
[%s
\b\b
]
\n
"
,
str
[
1
]);
LOG_I
(
PHY
,
"REOffset
\t\t
[%s
\b\b
]
\n
"
,
str
[
2
]);
LOG_I
(
PHY
,
"PRSResourceOffset
\t
[%s
\b\b
]
\n
"
,
str
[
3
]);
LOG_I
(
PHY
,
"NPRS_ID
\t\t
[%s
\b\b
]
\n
"
,
str
[
4
]);
LOG_I
(
PHY
,
"MutingPattern1
\t\t
[%s
\b\b
]
\n
"
,
str
[
5
]);
LOG_I
(
PHY
,
"MutingPattern2
\t\t
[%s
\b\b
]
\n
"
,
str
[
6
]);
LOG_I
(
PHY
,
"-----------------------------------------
\n
"
);
}
}
else
{
LOG_E
(
PHY
,
"No %s configuration found..!!
\n
"
,
PRS_ParamList
.
listname
);
}
}
}
void
init_nr_prs_ue_vars
(
PHY_VARS_NR_UE
*
ue
)
{
NR_UE_PRS
**
const
prs_vars
=
ue
->
prs_vars
;
NR_DL_FRAME_PARMS
*
const
fp
=
&
ue
->
frame_parms
;
// PRS vars init
for
(
int
idx
=
0
;
idx
<
NR_MAX_PRS_COMB_SIZE
;
idx
++
)
{
prs_vars
[
idx
]
=
(
NR_UE_PRS
*
)
malloc16_clear
(
sizeof
(
NR_UE_PRS
));
// PRS channel estimates
prs_vars
[
idx
]
->
ch_tmp
=
(
int16_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
((
prs_vars
[
idx
]
->
ch_tmp
!=
NULL
),
"%s: PRS ch_tmp buffer malloc failed for gNB_id %d
\n
"
,
__FUNCTION__
,
idx
);
prs_vars
[
idx
]
->
chF_interpol
=
(
int32_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
));
prs_vars
[
idx
]
->
chT_interpol
=
(
int32_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
));
AssertFatal
((
prs_vars
[
idx
]
->
chF_interpol
!=
NULL
||
prs_vars
[
idx
]
->
chT_interpol
!=
NULL
),
"%s: PRS chF_interpol or chT_interpol buffer malloc failed for gNB_id %d
\n
"
,
__FUNCTION__
,
idx
);
for
(
int
j
=
0
;
j
<
fp
->
nb_antennas_rx
;
j
++
)
{
prs_vars
[
idx
]
->
chF_interpol
[
j
]
=
(
int32_t
*
)
malloc16_clear
(
NR_PRS_IDFT_OVERSAMP_FACTOR
*
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
chT_interpol
[
j
]
=
(
int32_t
*
)
malloc16_clear
(
NR_PRS_IDFT_OVERSAMP_FACTOR
*
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
((
prs_vars
[
idx
]
->
chF_interpol
[
j
]
!=
NULL
||
prs_vars
[
idx
]
->
chT_interpol
[
j
]
!=
NULL
),
"%s: PRS chF_interpol or chT_interpol buffer malloc failed for gNB_id %d, rx_ant %d
\n
"
,
__FUNCTION__
,
idx
,
j
);
}
for
(
int
k
=
0
;
k
<
NR_MAX_PRS_RESOURCES_PER_SET
;
k
++
)
{
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
=
(
prs_meas_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
prs_meas_t
*
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
!=
NULL
),
"%s: PRS measurements malloc failed for gNB_id %d
\n
"
,
__FUNCTION__
,
idx
);
for
(
int
j
=
0
;
j
<
fp
->
nb_antennas_rx
;
j
++
)
{
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]
=
(
prs_meas_t
*
)
malloc16_clear
(
sizeof
(
prs_meas_t
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]
!=
NULL
),
"%s: PRS measurements malloc failed for gNB_id %d, rx_ant %d
\n
"
,
__FUNCTION__
,
idx
,
j
);
}
}
}
// load the config file params
RCconfig_nrUE_prs
(
ue
);
//PRS sequence init
ue
->
nr_gold_prs
=
(
uint32_t
*****
)
malloc16
(
ue
->
prs_active_gNBs
*
sizeof
(
uint32_t
****
));
uint32_t
*****
prs
=
ue
->
nr_gold_prs
;
AssertFatal
(
prs
!=
NULL
,
"%s: positioning reference signal malloc failed
\n
"
,
__FUNCTION__
);
for
(
int
gnb
=
0
;
gnb
<
ue
->
prs_active_gNBs
;
gnb
++
)
{
prs
[
gnb
]
=
(
uint32_t
****
)
malloc16
(
ue
->
prs_vars
[
gnb
]
->
NumPRSResources
*
sizeof
(
uint32_t
***
));
AssertFatal
(
prs
[
gnb
]
!=
NULL
,
"%s: positioning reference signal for gnb %d - malloc failed
\n
"
,
__FUNCTION__
,
gnb
);
for
(
int
rsc
=
0
;
rsc
<
ue
->
prs_vars
[
gnb
]
->
NumPRSResources
;
rsc
++
)
{
prs
[
gnb
][
rsc
]
=
(
uint32_t
***
)
malloc16
(
fp
->
slots_per_frame
*
sizeof
(
uint32_t
**
));
AssertFatal
(
prs
[
gnb
][
rsc
]
!=
NULL
,
"%s: positioning reference signal for gnb %d rsc %d- malloc failed
\n
"
,
__FUNCTION__
,
gnb
,
rsc
);
for
(
int
slot
=
0
;
slot
<
fp
->
slots_per_frame
;
slot
++
)
{
prs
[
gnb
][
rsc
][
slot
]
=
(
uint32_t
**
)
malloc16
(
fp
->
symbols_per_slot
*
sizeof
(
uint32_t
*
));
AssertFatal
(
prs
[
gnb
][
rsc
][
slot
]
!=
NULL
,
"%s: positioning reference signal for gnb %d rsc %d slot %d - malloc failed
\n
"
,
__FUNCTION__
,
gnb
,
rsc
,
slot
);
for
(
int
symb
=
0
;
symb
<
fp
->
symbols_per_slot
;
symb
++
)
{
prs
[
gnb
][
rsc
][
slot
][
symb
]
=
(
uint32_t
*
)
malloc16
(
NR_MAX_PRS_INIT_LENGTH_DWORD
*
sizeof
(
uint32_t
));
AssertFatal
(
prs
[
gnb
][
rsc
][
slot
][
symb
]
!=
NULL
,
"%s: positioning reference signal for gnb %d rsc %d slot %d symbol %d - malloc failed
\n
"
,
__FUNCTION__
,
gnb
,
rsc
,
slot
,
symb
);
}
// for symb
}
// for slot
}
// for rsc
}
// for gnb
init_nr_gold_prs
(
ue
);
}
int
init_nr_ue_signal
(
PHY_VARS_NR_UE
*
ue
,
int
nb_connected_gNB
)
{
// create shortcuts
...
...
@@ -193,6 +362,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
///////////
////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// PRS init /////////////////////////
///////////
init_nr_prs_ue_vars
(
ue
);
///////////
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////PUSCH DMRS init/////////////////////////
///////////
...
...
@@ -481,6 +657,45 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
free_and_zero
(
ue
->
prach_vars
[
gNB_id
]);
}
for
(
int
gnb
=
0
;
gnb
<
ue
->
prs_active_gNBs
;
gnb
++
)
{
for
(
int
rsc
=
0
;
rsc
<
ue
->
prs_vars
[
gnb
]
->
NumPRSResources
;
rsc
++
)
{
for
(
int
slot
=
0
;
slot
<
fp
->
slots_per_frame
;
slot
++
)
{
for
(
int
symb
=
0
;
symb
<
fp
->
symbols_per_slot
;
symb
++
)
{
free_and_zero
(
ue
->
nr_gold_prs
[
gnb
][
rsc
][
slot
][
symb
]);
}
free_and_zero
(
ue
->
nr_gold_prs
[
gnb
][
rsc
][
slot
]);
}
free_and_zero
(
ue
->
nr_gold_prs
[
gnb
][
rsc
]);
}
free_and_zero
(
ue
->
nr_gold_prs
[
gnb
]);
}
free_and_zero
(
ue
->
nr_gold_prs
);
for
(
int
idx
=
0
;
idx
<
NR_MAX_PRS_COMB_SIZE
;
idx
++
)
{
for
(
int
k
=
0
;
k
<
NR_MAX_PRS_RESOURCES_PER_SET
;
k
++
)
{
for
(
int
j
=
0
;
j
<
fp
->
nb_antennas_rx
;
j
++
)
{
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]);
}
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
);
}
for
(
int
j
=
0
;
j
<
fp
->
nb_antennas_rx
;
j
++
)
{
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
chF_interpol
[
j
]);
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
chT_interpol
[
j
]);
}
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
chF_interpol
);
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
chT_interpol
);
free_and_zero
(
ue
->
prs_vars
[
idx
]
->
ch_tmp
);
free_and_zero
(
ue
->
prs_vars
[
idx
]);
}
free_and_zero
(
ue
->
sinr_CQI_dB
);
}
...
...
openair1/PHY/INIT/phy_init.h
View file @
9eed7db8
...
...
@@ -416,6 +416,9 @@ void fill_subframe_mask(PHY_VARS_eNB *eNB);
void
init_DLSCH_struct
(
PHY_VARS_gNB
*
gNB
,
processingData_L1tx_t
*
msg
);
void
reset_DLSCH_struct
(
const
PHY_VARS_gNB
*
gNB
,
processingData_L1tx_t
*
msg
);
void
RCconfig_nrUE_prs
(
void
*
cfg
);
void
init_nr_prs_ue_vars
(
PHY_VARS_NR_UE
*
ue
);
/** @} */
#endif
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
View file @
9eed7db8
...
...
@@ -47,18 +47,21 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
UE_nr_rxtx_proc_t
*
proc
,
NR_DL_FRAME_PARMS
*
frame_params
)
{
uint8_t
rxAnt
=
0
,
idx
=
0
;
int32_t
**
rxdataF
=
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
proc
->
thread_id
].
rxdataF
;
prs_config_t
*
prs_cfg
=
&
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_cfg
;
prs_meas_t
**
prs_meas
=
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_meas
;
int32_t
**
prs_chestF
=
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_ch_estimates
;
int32_t
**
prs_chestT
=
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_ch_estimates_time
;
int16_t
*
ch_tmp
=
ue
->
prs_vars
[
gNB_id
]
->
ch_tmp
;
int16_t
*
chF_interpol
=
ue
->
prs_vars
[
gNB_id
]
->
chF_interpol
;
int16_t
*
chT_interpol
=
ue
->
prs_vars
[
gNB_id
]
->
chT_interpol
;
int32_t
**
chF_interpol
=
ue
->
prs_vars
[
gNB_id
]
->
chF_interpol
;
int32_t
**
chT_interpol
=
ue
->
prs_vars
[
gNB_id
]
->
chT_interpol
;
memset
(
ch_tmp
,
0
,
ue
->
frame_parms
.
ofdm_symbol_size
*
sizeof
(
int32_t
));
for
(
rxAnt
=
0
;
rxAnt
<
frame_params
->
nb_antennas_rx
;
rxAnt
++
)
{
memset
(
chF_interpol
[
rxAnt
],
0
,
NR_PRS_IDFT_OVERSAMP_FACTOR
*
ue
->
frame_parms
.
ofdm_symbol_size
*
sizeof
(
int32_t
));
memset
(
chT_interpol
[
rxAnt
],
0
,
NR_PRS_IDFT_OVERSAMP_FACTOR
*
ue
->
frame_parms
.
ofdm_symbol_size
*
sizeof
(
int32_t
));
}
int
slot_prs
=
(
proc
->
nr_slot_rx
-
rep_num
*
prs_cfg
->
PRSResourceTimeGap
+
frame_params
->
slots_per_frame
)
%
frame_params
->
slots_per_frame
;
uint32_t
**
nr_gold_prs
=
ue
->
nr_gold_prs
[
gNB_id
][
rsc_id
][
slot_prs
];
uint8_t
rxAnt
=
0
,
idx
=
0
;
int16_t
*
rxF
,
*
pil
,
*
fl
,
*
fm
,
*
fmm
,
*
fml
,
*
fmr
,
*
fr
,
mod_prs
[
NR_MAX_PRS_LENGTH
<<
1
];
int16_t
ch
[
2
]
=
{
0
},
noiseFig
[
2
]
=
{
0
};
int16_t
k_prime
=
0
,
k
=
0
,
re_offset
=
0
,
first_half
=
0
,
second_half
=
0
;
...
...
@@ -109,7 +112,6 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
// Channel estimation and interpolation
pil
=
(
int16_t
*
)
&
mod_prs
[
0
];
rxF
=
(
int16_t
*
)
&
rxdataF
[
rxAnt
][
l
*
frame_params
->
ofdm_symbol_size
+
k
];
//memset(ch_tmp,0,sizeof(int32_t)*(ue->frame_parms.ofdm_symbol_size));
if
(
prs_cfg
->
CombSize
==
2
)
{
...
...
@@ -150,7 +152,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
0
,
snr
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -181,7 +183,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
pIdx
,
snr
/
(
pIdx
+
1
),
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -209,7 +211,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
pIdx
+
1
,
snr
/
(
pIdx
+
2
),
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -230,7 +232,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
num_pilots
-
1
,
snr
/
num_pilots
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -295,7 +297,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
0
,
snr
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -313,7 +315,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
1
,
snr
/
2
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -335,7 +337,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
pIdx
,
snr
/
(
pIdx
+
1
),
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -356,7 +358,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, %+d)
\n
"
,
rxAnt
,
num_pilots
-
2
,
snr
/
(
num_pilots
-
1
),
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -374,7 +376,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
//SNR estimation
noiseFig
[
0
]
=
rxF
[
0
]
-
(
int16_t
)(((
int32_t
)
ch
[
0
]
*
pil
[
0
]
-
(
int32_t
)
ch
[
1
]
*
pil
[
1
])
>>
15
);
noiseFig
[
1
]
=
rxF
[
1
]
-
(
int16_t
)(((
int32_t
)
ch
[
1
]
*
pil
[
0
]
+
(
int32_t
)
ch
[
0
]
*
pil
[
1
])
>>
15
);
snr
+=
10
*
log10
(
abs32
(
*
((
int
*
)
rxF
))
-
abs32
(
*
((
int
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
in
t
*
)
noiseFig
)));
snr
+=
10
*
log10
(
abs32
(
*
((
int
32_t
*
)
rxF
))
-
abs32
(
*
((
int32_t
*
)
noiseFig
)))
-
10
*
log10
(
abs32
(
*
((
int32_
t
*
)
noiseFig
)));
#ifdef DEBUG_PRS_PRINTS
printf
(
"[Rx %d] pilot %3d, SNR %+2d dB: rxF - > (%+3d, %+3d) addr %p ch -> (%+3d, %+3d), pil -> (%+d, +%d)
\n
"
,
rxAnt
,
num_pilots
-
1
,
snr
/
num_pilots
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -418,12 +420,9 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
first_half
=
frame_params
->
ofdm_symbol_size
-
re_offset
;
second_half
=
(
prs_cfg
->
NumRB
*
12
)
-
first_half
;
if
(
first_half
>
0
)
memcpy
((
int16_t
*
)
&
prs_chestF
[
rxAnt
][
re_offset
],
&
ch_tmp
[
0
],
first_half
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
chF_interpol
[
rxAnt
][
start_offset
+
re_offset
],
&
ch_tmp
[
0
],
first_half
*
sizeof
(
int32_t
));
if
(
second_half
>
0
)
memcpy
((
int16_t
*
)
&
prs_chestF
[
rxAnt
][
0
],
&
ch_tmp
[(
first_half
<<
1
)],
second_half
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
chF_interpol
[
start_offset
+
re_offset
],
&
ch_tmp
[
0
],
first_half
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
chF_interpol
[
start_offset
],
&
ch_tmp
[(
first_half
<<
1
)],
second_half
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
chF_interpol
[
rxAnt
][
start_offset
],
&
ch_tmp
[(
first_half
<<
1
)],
second_half
*
sizeof
(
int32_t
));
// Time domain IMPULSE response
idft_size_idx_t
idftsizeidx
;
...
...
@@ -498,26 +497,21 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
}
idft
(
idftsizeidx
,
(
int16_t
*
)
&
chF_interpol
[
0
],
(
int16_t
*
)
&
chT_interpol
[
0
],
1
);
// rearrange impulse response
memcpy
((
int16_t
*
)
&
prs_chestT
[
rxAnt
][
0
],
&
chT_interpol
[
NR_PRS_IDFT_OVERSAMP_FACTOR
*
frame_params
->
ofdm_symbol_size
],
(
frame_params
->
ofdm_symbol_size
>>
1
)
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
prs_chestT
[
rxAnt
][(
frame_params
->
ofdm_symbol_size
>>
1
)],
&
chT_interpol
[
start_offset
],
(
frame_params
->
ofdm_symbol_size
>>
1
)
*
sizeof
(
int32_t
));
(
int16_t
*
)
&
chF_interpol
[
rxAnt
][
0
],
(
int16_t
*
)
&
chT_interpol
[
rxAnt
][
0
],
1
);
// peak estimator
peak_estimator
(
&
prs_chestT
[
rxAnt
][
0
],
peak_estimator
(
&
chT_interpol
[
rxAnt
][
start_offset
],
frame_params
->
ofdm_symbol_size
,
&
prs_meas
[
rxAnt
]
->
dl_toa
,
&
ch_pwr
);
//prs measurements
prs_meas
[
rxAnt
]
->
dl_toa
-=
(
frame_params
->
ofdm_symbol_size
>>
1
);
// adjusting ToA wrt center
prs_meas
[
rxAnt
]
->
gNB_id
=
gNB_id
;
prs_meas
[
rxAnt
]
->
sfn
=
proc
->
frame_rx
;
prs_meas
[
rxAnt
]
->
slot
=
proc
->
nr_slot_rx
;
prs_meas
[
rxAnt
]
->
rxAnt_idx
=
rxAnt
;
prs_meas
[
rxAnt
]
->
dl_aoa
=
0
;
prs_meas
[
rxAnt
]
->
dl_aoa
=
rsc_id
;
LOG_I
(
PHY
,
"[gNB %d][rsc %d][Rx %d][sfn %d][slot %d] DL PRS ToA ==> %d / %d samples, peak channel power %.1f dBm, SNR %+2d dB
\n
"
,
gNB_id
,
rsc_id
,
rxAnt
,
proc
->
frame_rx
,
proc
->
nr_slot_rx
,
prs_meas
[
rxAnt
]
->
dl_toa
,
frame_params
->
ofdm_symbol_size
,
10
*
log10
(
ch_pwr
/
frame_params
->
ofdm_symbol_size
)
-
30
,
prs_meas
[
rxAnt
]
->
snr
);
#ifdef DEBUG_PRS_CHEST
...
...
@@ -528,10 +522,10 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
LOG_M
(
filename
,
varname
,
&
rxdataF
[
rxAnt
][
0
],
prs_cfg
->
NumPRSSymbols
*
frame_params
->
ofdm_symbol_size
,
1
,
1
);
sprintf
(
filename
,
"%s%i%s"
,
"prsChestF_"
,
rxAnt
,
".m"
);
sprintf
(
varname
,
"%s%i"
,
"prsChF_"
,
rxAnt
);
LOG_M
(
filename
,
varname
,
&
prs_chestF
[
rxAnt
][
0
],
frame_params
->
ofdm_symbol_size
,
1
,
1
);
LOG_M
(
filename
,
varname
,
&
chF_interpol
[
rxAnt
][
start_offset
],
frame_params
->
ofdm_symbol_size
,
1
,
1
);
sprintf
(
filename
,
"%s%i%s"
,
"prsChestT_"
,
rxAnt
,
".m"
);
sprintf
(
varname
,
"%s%i"
,
"prsChT_"
,
rxAnt
);
LOG_M
(
filename
,
varname
,
&
prs_chestT
[
rxAnt
][
0
],
frame_params
->
ofdm_symbol_size
,
1
,
1
);
LOG_M
(
filename
,
varname
,
&
chT_interpol
[
rxAnt
][
start_offset
],
frame_params
->
ofdm_symbol_size
,
1
,
1
);
#endif
// T tracer dump
...
...
@@ -541,11 +535,11 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
T
(
T_UE_PHY_DL_CHANNEL_ESTIMATE_FREQ
,
T_INT
(
gNB_id
),
T_INT
(
rsc_id
),
T_INT
(
proc
->
frame_rx
),
T_INT
(
proc
->
nr_slot_rx
),
T_INT
(
rxAnt
),
T_BUFFER
(
&
prs_chestF
[
rxAnt
][
0
],
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
)));
T_INT
(
rxAnt
),
T_BUFFER
(
&
chF_interpol
[
rxAnt
][
start_offset
],
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
)));
T
(
T_UE_PHY_DL_CHANNEL_ESTIMATE
,
T_INT
(
gNB_id
),
T_INT
(
rsc_id
),
T_INT
(
proc
->
frame_rx
),
T_INT
(
proc
->
nr_slot_rx
),
T_INT
(
rxAnt
),
T_BUFFER
(
&
prs_chestT
[
rxAnt
][
0
],
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
)));
T_INT
(
rxAnt
),
T_BUFFER
(
&
chT_interpol
[
rxAnt
][
start_offset
],
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
)));
}
return
(
0
);
...
...
openair1/PHY/defs_nr_UE.h
View file @
9eed7db8
...
...
@@ -349,8 +349,6 @@ typedef struct {
#define NR_PRS_IDFT_OVERSAMP_FACTOR 1 // IDFT oversampling factor for NR PRS channel estimates in time domain, ALLOWED value 16x, and 1x is default(ie. IDFT size is frame_params->ofdm_symbol_size)
typedef
struct
{
prs_config_t
prs_cfg
;
int32_t
**
prs_ch_estimates
;
int32_t
**
prs_ch_estimates_time
;
int32_t
reserved
;
prs_meas_t
**
prs_meas
;
}
NR_PRS_RESOURCE_t
;
...
...
@@ -358,10 +356,9 @@ typedef struct {
typedef
struct
{
uint8_t
NumPRSResources
;
NR_PRS_RESOURCE_t
prs_resource
[
NR_MAX_PRS_RESOURCES_PER_SET
];
//temp buffers
int16_t
*
ch_tmp
;
int
16_t
*
chF_interpol
;
int
16_t
*
chT_interpol
;
int
32_t
*
*
chF_interpol
;
int
32_t
*
*
chT_interpol
;
}
NR_UE_PRS
;
#define NR_PDCCH_DEFS_NR_UE
...
...
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