Commit e0d9c0a9 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/nr_prs' into integration_2022_wk40

parents 57fbbf53 dbee8c67
...@@ -713,6 +713,32 @@ file(GLOB F1AP_C_FILES ${F1AP_DIR}/*.c) ...@@ -713,6 +713,32 @@ file(GLOB F1AP_C_FILES ${F1AP_DIR}/*.c)
add_library(F1AP ${F1AP_C_FILES} ) add_library(F1AP ${F1AP_C_FILES} )
# LPP
##############
set(LPP_DIR ${OPENAIR3_DIR}/LPP)
set(LPP_ASN_DIR ${LPP_DIR}/MESSAGES)
set(LPP_ASN_FILES
${LPP_ASN_DIR}/37355-g60.asn
)
set(LPP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/LPP)
set(lpp_cmd ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LPP_" "-findirect-choice -fno-include-deps" "${LPP_ASN_GENERATED_C_DIR}")
compile_asn1("${LPP_ASN_FILES}" "${lpp_cmd}" lpp_flag)
file(GLOB LPP_ASN_GENERATED_C_FILES ${LPP_ASN_GENERATED_C_DIR}/*.c)
add_library(LPP_LIB
${LPP_ASN_GENERATED_C_FILES}
)
add_dependencies (LPP_LIB lpp_flag)
include_directories ("${LPP_ASN_GENERATED_C_DIR}")
include_directories ("${LPP_DIR}")
#file(GLOB LPP_C_FILES ${LPP_DIR}/*.c)
#add_library(LPP ${LPP_C_FILES} )
# Hardware dependant options # Hardware dependant options
################################### ###################################
add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
...@@ -1610,6 +1636,7 @@ set(PHY_SRC_UE ...@@ -1610,6 +1636,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/INIT/nr_init.c ${OPENAIR1_DIR}/PHY/INIT/nr_init.c
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c ${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
${OPENAIR1_DIR}/PHY/MODULATION/nr_modulation.c ${OPENAIR1_DIR}/PHY/MODULATION/nr_modulation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prs.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pss.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pss.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sss.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sss.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pbch.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pbch.c
......
...@@ -105,6 +105,10 @@ ID = GNB_PHY_PRACH_INPUT_SIGNAL ...@@ -105,6 +105,10 @@ ID = GNB_PHY_PRACH_INPUT_SIGNAL
DESC = gNodeB input data in the time domain for slots with PRACH detection DESC = gNodeB input data in the time domain for slots with PRACH detection
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata
ID = GNB_PHY_DL_OUTPUT_SIGNAL
DESC = gNodeB output data in the freq domain for slots
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,gNB_ID : int,frame : int,slot : int,antenna : buffer,txdata
#MAC logs #MAC logs
ID = ENB_MAC_UE_DL_SDU ID = ENB_MAC_UE_DL_SDU
...@@ -1305,7 +1309,11 @@ ID = UE_PHY_INPUT_SIGNAL ...@@ -1305,7 +1309,11 @@ ID = UE_PHY_INPUT_SIGNAL
ID = UE_PHY_DL_CHANNEL_ESTIMATE ID = UE_PHY_DL_CHANNEL_ESTIMATE
DESC = UE channel estimation in the time domain DESC = UE channel estimation in the time domain
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,antenna : buffer,chest_t FORMAT = int,eNB_ID : int,rsc_id : int,frame : int,subframe : int,antenna : buffer,chest_t
ID = UE_PHY_DL_CHANNEL_ESTIMATE_FREQ
DESC = UE channel estimation in the frequency domain
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,rsc_id : int,frame : int,subframe : int,antenna : buffer,chestF_t
ID = UE_PHY_PDCCH_IQ ID = UE_PHY_PDCCH_IQ
DESC = UE PDCCH received IQ data DESC = UE PDCCH received IQ data
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
......
#!/bin/bash
: ${1?"Usage: $0 [-g num_gnb] [-n num_rsc] [-f filename] [-c count]"}
# Usage info
show_help()
{
echo "
Usage of script with arguments: [-g num_gnb] [-n num_rsc] [-f filename] [-c count]
-g num_gnb Number of active gNBs
-n num_rsc Number of PRS resources
-f filename T tracer recorded .raw filename
-c count Number of dump instances to be extacted
For Example: ./extract_prs_dumps.sh -g 1 -n 8 -f fr2_64_prbs.raw -c 100
-h Help
"
exit 0
}
while getopts g:n:f:c:h flag
do
case "${flag}" in
g) num_gnb=${OPTARG};;
n) num_rsc=${OPTARG};;
f) file=${OPTARG};;
c) count=${OPTARG};;
h) show_help;;
*) exit -1;;
esac
done
echo "num_gnb: $num_gnb";
echo "num_rsc: $num_rsc";
echo "filename: $file";
echo "count: $count";
for (( i = 0; i < $num_gnb; i++ ))
do
for (( j = 0; j < $num_rsc; j++ ))
do
name=chF_gnb${i}_${j}.raw
echo "Extracting $name"
./extract -d ../T_messages.txt $file UE_PHY_DL_CHANNEL_ESTIMATE_FREQ chestF_t -f eNB_ID $i -f rsc_id $j -o $name -count $count
name=chT_gnb${i}_${j}.raw
echo "Extracting $name"
./extract -d ../T_messages.txt $file UE_PHY_DL_CHANNEL_ESTIMATE chest_t -f eNB_ID $i -f rsc_id $j -o $name -count $count
done
done
# zip the extracted dumps
name=prs_dumps.tgz
tar cvzf $name chF_gnb* chT_gnb*
echo "created a zip file $name"
...@@ -664,10 +664,26 @@ void get_samplerate_and_bw(int mu, ...@@ -664,10 +664,26 @@ void get_samplerate_and_bw(int mu,
} }
} else if (mu == 3) { } else if (mu == 3) {
switch(n_rb) { switch(n_rb) {
case 66: case 132:
case 128:
if (threequarter_fs) { if (threequarter_fs) {
*sample_rate=184.32e6; *sample_rate=184.32e6;
*samples_per_frame = 1843200; *samples_per_frame = 1843200;
*tx_bw = 200e6;
*rx_bw = 200e6;
} else {
*sample_rate = 245.76e6;
*samples_per_frame = 2457600;
*tx_bw = 200e6;
*rx_bw = 200e6;
}
break;
case 66:
case 64:
if (threequarter_fs) {
*sample_rate=92.16e6;
*samples_per_frame = 921600;
*tx_bw = 100e6; *tx_bw = 100e6;
*rx_bw = 100e6; *rx_bw = 100e6;
} else { } else {
...@@ -676,7 +692,6 @@ void get_samplerate_and_bw(int mu, ...@@ -676,7 +692,6 @@ void get_samplerate_and_bw(int mu,
*tx_bw = 100e6; *tx_bw = 100e6;
*rx_bw = 100e6; *rx_bw = 100e6;
} }
break; break;
case 32: case 32:
...@@ -691,7 +706,6 @@ void get_samplerate_and_bw(int mu, ...@@ -691,7 +706,6 @@ void get_samplerate_and_bw(int mu,
*tx_bw = 50e6; *tx_bw = 50e6;
*rx_bw = 50e6; *rx_bw = 50e6;
} }
break; break;
default: default:
......
...@@ -298,6 +298,10 @@ The following features are valid for the gNB and the 5G-NR UE. ...@@ -298,6 +298,10 @@ The following features are valid for the gNB and the 5G-NR UE.
- SRS signal reception - SRS signal reception
- Channel estimation (with T tracer real time monitoring) - Channel estimation (with T tracer real time monitoring)
- Power noise estimation - Power noise estimation
* NR-PRS
- Rel16 Positioning reference signal(PRS) generation and modulation
- Multiple PRS resources, one per beam is supported in FR2 TDD mode
- FR1 and FR2 support with config file
* NR-PRACH * NR-PRACH
- Formats 0,1,2,3, A1-A3, B1-B3 - Formats 0,1,2,3, A1-A3, B1-B3
* Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 are supported) * Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 are supported)
...@@ -459,6 +463,11 @@ The following features are valid for the gNB and the 5G-NR UE. ...@@ -459,6 +463,11 @@ The following features are valid for the gNB and the 5G-NR UE.
* NR-SRS * NR-SRS
- Generation of sequence at PHY - Generation of sequence at PHY
- SRS signal transmission - SRS signal transmission
* NR-PRS
- PRS based Channel estimation with T tracer dumps
- Time of arrival(ToA) estimation based on channel impulse response(CIR)
- Finer ToA estimation by 16x oversampled IDFT for CIR
- Support for multiple gNB reception with gNBs synced via GPSDO
* NR-PRACH * NR-PRACH
- Formats 0,1,2,3, A1-A3, B1-B3 - Formats 0,1,2,3, A1-A3, B1-B3
* SS-RSRP * SS-RSRP
......
This diff is collapsed.
...@@ -99,6 +99,8 @@ ...@@ -99,6 +99,8 @@
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_LDPC_OFFLOAD "enable LDPC offload\n" #define CONFIG_HLP_LDPC_OFFLOAD "enable LDPC offload\n"
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n" #define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
#define CONFIG_HLP_TX_SUBDEV "set the arguments to select tx_subdev (same syntax as in UHD)\n"
#define CONFIG_HLP_RX_SUBDEV "set the arguments to select rx_subdev (same syntax as in UHD)\n"
#define CONFIG_HLP_FLOG "Enable online log \n" #define CONFIG_HLP_FLOG "Enable online log \n"
#define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n" #define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" #include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
/* /*
* NR SLOT PROCESSING SEQUENCE * NR SLOT PROCESSING SEQUENCE
...@@ -595,13 +596,13 @@ static void UE_synch(void *arg) { ...@@ -595,13 +596,13 @@ static void UE_synch(void *arg) {
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
} }
}
break; break;
case si: case si:
default: default:
break; break;
}
} }
} }
......
...@@ -117,6 +117,8 @@ int vcdflag = 0; ...@@ -117,6 +117,8 @@ int vcdflag = 0;
double rx_gain_off = 0.0; double rx_gain_off = 0.0;
char *usrp_args = NULL; char *usrp_args = NULL;
char *tx_subdev = NULL;
char *rx_subdev = NULL;
char *rrc_config_path = NULL; char *rrc_config_path = NULL;
char *uecap_file = NULL; char *uecap_file = NULL;
int dumpframe = 0; int dumpframe = 0;
...@@ -359,6 +361,8 @@ void init_openair0(void) { ...@@ -359,6 +361,8 @@ void init_openair0(void) {
openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file; openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file;
if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args; if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args;
if (tx_subdev) openair0_cfg[card].tx_subdev = tx_subdev;
if (rx_subdev) openair0_cfg[card].rx_subdev = rx_subdev;
} }
} }
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
/*------------------------------------------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_NRUEPARAMS_DESC { \ #define CMDLINE_NRUEPARAMS_DESC { \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
{"tx_subdev", CONFIG_HLP_TX_SUBDEV, 0, strptr:&tx_subdev, defstrval:NULL, TYPE_STRING, 0}, \
{"rx_subdev", CONFIG_HLP_RX_SUBDEV, 0, strptr:&rx_subdev, defstrval:NULL, TYPE_STRING, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, u8ptr:NULL, defintval:0, TYPE_UINT8, 0}, \ {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, u8ptr:NULL, defintval:0, TYPE_UINT8, 0}, \
{"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:&nrUE_params.ofdm_offset_divisor, defuintval:8, TYPE_UINT32, 0}, \ {"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:&nrUE_params.ofdm_offset_divisor, defuintval:8, TYPE_UINT32, 0}, \
...@@ -97,5 +99,4 @@ extern void start_oai_nrue_threads(void); ...@@ -97,5 +99,4 @@ extern void start_oai_nrue_threads(void);
void *UE_thread(void *arg); 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_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 init_nrUE_standalone_thread(int ue_idx);
#endif #endif
...@@ -615,6 +615,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -615,6 +615,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->nr_csi_info->csi_gold_init = cfg->cell_config.phy_cell_id.value; gNB->nr_csi_info->csi_gold_init = cfg->cell_config.phy_cell_id.value;
nr_init_csi_rs(&gNB->frame_parms, gNB->nr_csi_info->nr_gold_csi_rs, cfg->cell_config.phy_cell_id.value); nr_init_csi_rs(&gNB->frame_parms, gNB->nr_csi_info->nr_gold_csi_rs, cfg->cell_config.phy_cell_id.value);
//PRS init
nr_init_prs(gNB);
for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) { for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) {
gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t));
gNB->nr_srs_info[id]->srs_generated_signal = (int32_t**)malloc16_clear(MAX_NUM_NR_SRS_AP*sizeof(int32_t*)); gNB->nr_srs_info[id]->srs_generated_signal = (int32_t**)malloc16_clear(MAX_NUM_NR_SRS_AP*sizeof(int32_t*));
...@@ -793,6 +796,17 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -793,6 +796,17 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(common_vars->beam_id[i]); free_and_zero(common_vars->beam_id[i]);
} }
for (int rsc=0; rsc < gNB->prs_vars.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(gNB->nr_gold_prs[rsc][slot][symb]);
}
free_and_zero(gNB->nr_gold_prs[rsc][slot]);
}
free_and_zero(gNB->nr_gold_prs[rsc]);
}
free_and_zero(gNB->nr_gold_prs);
/* Do NOT free per-antenna txdataF/rxdataF: the gNB gets a pointer to the /* Do NOT free per-antenna txdataF/rxdataF: the gNB gets a pointer to the
* RU's txdataF/rxdataF, and the RU will free that */ * RU's txdataF/rxdataF, and the RU will free that */
free_and_zero(common_vars->txdataF); free_and_zero(common_vars->txdataF);
......
This diff is collapsed.
...@@ -212,12 +212,12 @@ uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp) ...@@ -212,12 +212,12 @@ uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp)
uint32_t get_slot_from_timestamp(openair0_timestamp timestamp_rx, NR_DL_FRAME_PARMS* fp) uint32_t get_slot_from_timestamp(openair0_timestamp timestamp_rx, NR_DL_FRAME_PARMS* fp)
{ {
uint32_t slot_idx = 0; uint32_t slot_idx = 0;
int samples_till_the_slot = 0; int samples_till_the_slot = fp->get_samples_per_slot(slot_idx,fp)-1;
timestamp_rx = timestamp_rx%fp->samples_per_frame; timestamp_rx = timestamp_rx%fp->samples_per_frame;
while (timestamp_rx > samples_till_the_slot) { while (timestamp_rx > samples_till_the_slot) {
samples_till_the_slot += fp->get_samples_per_slot(slot_idx,fp);
slot_idx++; slot_idx++;
samples_till_the_slot += fp->get_samples_per_slot(slot_idx,fp);
} }
return slot_idx; return slot_idx;
} }
......
...@@ -416,6 +416,9 @@ void fill_subframe_mask(PHY_VARS_eNB *eNB); ...@@ -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 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 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 #endif
...@@ -701,7 +701,7 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue, ...@@ -701,7 +701,7 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
} }
} }
T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id), T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id), T_INT(0),
T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].frame_rx%1024), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].subframe_rx), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].frame_rx%1024), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].subframe_rx),
T_INT(0), T_BUFFER(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][0][0], 512 * 4)); T_INT(0), T_BUFFER(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][0][0], 512 * 4));
return(0); return(0);
......
...@@ -131,14 +131,6 @@ void lte_sync_time_free(void) { ...@@ -131,14 +131,6 @@ void lte_sync_time_free(void) {
} }
static inline int abs32(int x) {
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
}
static inline double absF(struct complexd x) {
return x.r*x.r+x.i*x.i;
}
#define complexNull(c) bzero((void*) &(c), sizeof(c)) #define complexNull(c) bzero((void*) &(c), sizeof(c))
#define SHIFT 17 #define SHIFT 17
...@@ -196,16 +188,12 @@ int lte_sync_time(int **rxdata, ///rx data in time domain ...@@ -196,16 +188,12 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
// calculate the absolute value of sync_corr[n] // calculate the absolute value of sync_corr[n]
for (s=0; s<3; s++) { for (s=0; s<3; s++) {
double tmp = absF(sync_out[s]) + absF(sync_out2[s]); double tmp = squaredMod(sync_out[s]) + squaredMod(sync_out2[s]);
if (tmp>peak_val) { if (tmp>peak_val) {
peak_val = tmp; peak_val = tmp;
peak_pos = n; peak_pos = n;
sync_source = s; sync_source = s;
/*
printf("s %d: n %d sync_out %d, sync_out2 %d (sync_corr %d,%d), (%d,%d) (%d,%d)\n",s,n,abs32(sync_out[s]),abs32(sync_out2[s]),sync_corr_ue0[n],
sync_corr_ue0[n+length],((int16_t*)&sync_out[s])[0],((int16_t*)&sync_out[s])[1],((int16_t*)&sync_out2[s])[0],((int16_t*)&sync_out2[s])[1]);
*/
} }
} }
} }
...@@ -337,7 +325,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -337,7 +325,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
result = dot_product((short *)primary_synch_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); result = dot_product((short *)primary_synch_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
//((short*)sync_corr)[2*n] += ((short*) &result)[0]; //((short*)sync_corr)[2*n] += ((short*) &result)[0];
//((short*)sync_corr)[2*n+1] += ((short*) &result)[1]; //((short*)sync_corr)[2*n+1] += ((short*) &result)[1];
sync_corr_eNB[n] += abs32(result); sync_corr_eNB[n] += squaredMod(*(c16_t*)&result);
} }
} }
...@@ -368,12 +356,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -368,12 +356,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
} }
static inline int64_t abs64(int64_t x) {
return (((int64_t)((int32_t *)&x)[0])*((int64_t)((int32_t *)&x)[0]) + ((int64_t)
((int32_t *)&x)[1])*((int64_t)((int32_t *)&x)[1]));
}
int ru_sync_time(RU_t *ru, int ru_sync_time(RU_t *ru,
int64_t *lev, int64_t *lev,
int64_t *avg) { int64_t *avg) {
...@@ -426,7 +408,7 @@ int ru_sync_time(RU_t *ru, ...@@ -426,7 +408,7 @@ int ru_sync_time(RU_t *ru,
shift); shift);
} }
dmrs_corr += abs64(result); dmrs_corr += squaredMod(*(c32_t*)&result);
} }
if (ru->dmrs_corr != NULL) if (ru->dmrs_corr != NULL)
......
...@@ -153,6 +153,10 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input ...@@ -153,6 +153,10 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
idftsize = IDFT_512; idftsize = IDFT_512;
break; break;
case 768:
idftsize = IDFT_768;
break;
case 1024: case 1024:
idftsize = IDFT_1024; idftsize = IDFT_1024;
break; break;
......
...@@ -123,3 +123,56 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid) { ...@@ -123,3 +123,56 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid) {
} }
} }
} }
void nr_init_prs(PHY_VARS_gNB* gNB)
{
unsigned int x1, x2;
uint16_t Nid;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
gNB->nr_gold_prs = (uint32_t ****)malloc16(gNB->prs_vars.NumPRSResources*sizeof(uint32_t ***));
uint32_t ****prs = gNB->nr_gold_prs;
AssertFatal(prs!=NULL, "NR init: positioning reference signal malloc failed\n");
for (int rsc=0; rsc < gNB->prs_vars.NumPRSResources; rsc++) {
prs[rsc] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
AssertFatal(prs[rsc]!=NULL, "NR init: positioning reference signal for rsc %d - malloc failed\n", rsc);
for (int slot=0; slot<fp->slots_per_frame; slot++) {
prs[rsc][slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(prs[rsc][slot]!=NULL, "NR init: positioning reference signal for slot %d - malloc failed\n", slot);
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
prs[rsc][slot][symb] = (uint32_t *)malloc16(NR_MAX_PRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
AssertFatal(prs[rsc][slot][symb]!=NULL, "NR init: positioning reference signal for rsc %d slot %d symbol %d - malloc failed\n", rsc, slot, symb);
}
}
}
uint8_t reset;
uint8_t slotNum, symNum, rsc_id;
for (rsc_id = 0; rsc_id < gNB->prs_vars.NumPRSResources; rsc_id++) {
Nid = gNB->prs_vars.prs_cfg[rsc_id].NPRSID; // seed value
LOG_I(PHY, "Initiaized NR-PRS sequence with PRS_ID %3d for resource %d\n", Nid, rsc_id);
for (slotNum = 0; slotNum < fp->slots_per_frame; slotNum++) {
for (symNum = 0; symNum < fp->symbols_per_slot ; symNum++) {
reset = 1;
// initial x2 for prs as ts138.211
uint32_t c_init1, c_init2, c_init3;
uint32_t pow22=1<<22;
uint32_t pow10=1<<10;
c_init1 = pow22*ceil(Nid/1024);
c_init2 = pow10*(slotNum+symNum+1)*(2*(Nid%1024)+1);
c_init3 = Nid%1024;
x2 = c_init1 + c_init2 + c_init3;
for (uint8_t n=0; n<NR_MAX_PRS_INIT_LENGTH_DWORD; n++) {
gNB->nr_gold_prs[rsc_id][slotNum][symNum][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0;
//printf("%d \n",gNB->nr_gold_prs[slotNum][symNum][n]);
}
}
}
}
}
...@@ -124,3 +124,40 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, ...@@ -124,3 +124,40 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue,
} }
} }
} }
void init_nr_gold_prs(PHY_VARS_NR_UE* ue)
{
unsigned int x1, x2;
uint16_t Nid;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
uint8_t reset;
uint8_t slotNum, symNum, gnb, rsc;
for(gnb = 0; gnb < ue->prs_active_gNBs; gnb++) {
for(rsc = 0; rsc < ue->prs_vars[gnb]->NumPRSResources; rsc++) {
Nid = ue->prs_vars[gnb]->prs_resource[rsc].prs_cfg.NPRSID; // seed value
LOG_I(PHY,"Initialised NR-PRS sequence with PRS_ID %3d for resource %d\n",Nid, rsc);
for (slotNum = 0; slotNum < fp->slots_per_frame; slotNum++) {
for (symNum = 0; symNum < fp->symbols_per_slot ; symNum++) {
reset = 1;
// initial x2 for prs as ts138.211
uint32_t c_init1, c_init2, c_init3;
uint32_t pow22=1<<22;
uint32_t pow10=1<<10;
c_init1 = pow22*ceil(Nid/1024);
c_init2 = pow10*(slotNum+symNum+1)*(2*(Nid%1024)+1);
c_init3 = Nid%1024;
x2 = c_init1 + c_init2 + c_init3;
for (uint8_t n=0; n<NR_MAX_PRS_INIT_LENGTH_DWORD; n++) {
ue->nr_gold_prs[gnb][rsc][slotNum][symNum][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0;
//printf("%d \n",gNB->nr_gold_prs[slotNum][symNum][n]);
}
}
}
} // for rsc
} // for gnb
}
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
@param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables @param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
*/ */
void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB); void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB);
/*
This function generates NR Gold Sequence(ts 138.211) for the PRS.
@param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
*/
void nr_init_prs(PHY_VARS_gNB* gNB);
/*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PDCCH DMRS. /*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PDCCH DMRS.
@param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables @param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
@param Nid is used for the initialization of x2, Physical cell Id by default or upper layer configured pdcch_scrambling_ID @param Nid is used for the initialization of x2, Physical cell Id by default or upper layer configured pdcch_scrambling_ID
......
...@@ -68,5 +68,6 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, ...@@ -68,5 +68,6 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue,
uint8_t n_scid); uint8_t n_scid);
void nr_init_csi_rs(const NR_DL_FRAME_PARMS *fp, uint32_t ***csi_rs, uint32_t Nid); void nr_init_csi_rs(const NR_DL_FRAME_PARMS *fp, uint32_t ***csi_rs, uint32_t Nid);
void init_nr_gold_prs(PHY_VARS_NR_UE* ue);
#endif #endif
#include "PHY/defs_gNB.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "PHY/sse_intrin.h"
//#define DEBUG_PRS_MOD
//#define DEBUG_PRS_MAP
extern short nr_qpsk_mod_table[8];
int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF,
int16_t amp,
prs_config_t *prs_cfg,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms)
{
int k_prime = 0, k = 0, idx;
int16_t mod_prs[NR_MAX_PRS_LENGTH<<1];
int16_t k_prime_table[K_PRIME_TABLE_ROW_SIZE][K_PRIME_TABLE_COL_SIZE] = PRS_K_PRIME_TABLE;
// PRS resource mapping with combsize=k which means PRS symbols exist in every k-th subcarrier in frequency domain
// According to ts138.211 sec.7.4.1.7.2
for (int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart + prs_cfg->NumPRSSymbols; l++) {
int symInd = l-prs_cfg->SymbolStart;
if (prs_cfg->CombSize == 2) {
k_prime = k_prime_table[0][symInd];
}
else if (prs_cfg->CombSize == 4){
k_prime = k_prime_table[1][symInd];
}
else if (prs_cfg->CombSize == 6){
k_prime = k_prime_table[2][symInd];
}
else if (prs_cfg->CombSize == 12){
k_prime = k_prime_table[3][symInd];
}
k = (prs_cfg->REOffset+k_prime) % prs_cfg->CombSize + prs_cfg->RBOffset*12 + frame_parms->first_carrier_offset;
// QPSK modulation
for (int m = 0; m < (12/prs_cfg->CombSize) * prs_cfg->NumRB; m++) {
idx = (((nr_gold_prs[l][(m<<1)>>5])>>((m<<1)&0x1f))&3);
mod_prs[m<<1] = nr_qpsk_mod_table[idx<<1];
mod_prs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1];
#ifdef DEBUG_PRS_MOD
LOG_D("m %d idx %d gold seq %d mod_prs %d %d\n", m, idx, nr_gold_prs[l][(m<<1)>>5], mod_prs[m<<1], mod_prs[(m<<1)+1]);
#endif
#ifdef DEBUG_PRS_MAP
LOG_D("m %d at k %d of l %d reIdx %d\n", m, k, l, (l*frame_parms->ofdm_symbol_size + k)<<1);
#endif
((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_prs[m<<1]) >> 15;
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_prs[(m<<1) + 1]) >> 15;
#ifdef DEBUG_PRS_MAP
LOG_D("(%d,%d)\n",
((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif
k = k + prs_cfg->CombSize;
if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size;
}
}
#ifdef DEBUG_PRS_MAP
LOG_M("nr_prs.m", "prs",(int16_t *)&txdataF[prs_cfg->SymbolStart*frame_parms->ofdm_symbol_size],prs_cfg->NumPRSSymbols*frame_parms->ofdm_symbol_size, 1, 1);
#endif
return 0;
}
...@@ -38,6 +38,14 @@ ...@@ -38,6 +38,14 @@
#define NR_PBCH_PDU_BITS 24 #define NR_PBCH_PDU_BITS 24
int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF,
int16_t amp,
prs_config_t *prs_cfg,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms);
/*! /*!
\fn int nr_generate_pss \fn int nr_generate_pss
\brief Generation of the NR PSS \brief Generation of the NR PSS
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
short filt16a_l0[16] = { short filt16a_l0[16] = {
16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0}; 16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_mm0[16] = {
0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0,0,0};
short filt16a_r0[16] = { short filt16a_r0[16] = {
0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672,0,0,0,0}; 0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672,0,0,0,0};
...@@ -32,6 +35,15 @@ short filt16a_m0[16] = { ...@@ -32,6 +35,15 @@ short filt16a_m0[16] = {
short filt16a_l1[16] = { short filt16a_l1[16] = {
20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0}; 20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_mm1[16] = {
0,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0,0};
short filt16a_ml1[16] = {
-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0,0};
short filt16a_mr1[16] = {
0,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,0,0,0,0};
short filt16a_r1[16] = { short filt16a_r1[16] = {
0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0}; 0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0};
...@@ -41,6 +53,15 @@ short filt16a_m1[16] = { ...@@ -41,6 +53,15 @@ short filt16a_m1[16] = {
short filt16a_l2[16] = { short filt16a_l2[16] = {
24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0}; 24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0};
short filt16a_mm2[16] = {
0,0,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0};
short filt16a_ml2[16] = {
-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0};
short filt16a_mr2[16] = {
0,0,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,0,0,0,0};
short filt16a_r2[16] = { short filt16a_r2[16] = {
0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0}; 0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0};
...@@ -50,6 +71,12 @@ short filt16a_m2[16] = { ...@@ -50,6 +71,12 @@ short filt16a_m2[16] = {
short filt16a_l3[16] = { short filt16a_l3[16] = {
28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0}; 28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0};
short filt16a_mm3[16] = {
0,0,0,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0};
short filt16a_ml3[16] = {
-12288,-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0};
short filt16a_r3[16] = { short filt16a_r3[16] = {
0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0}; 0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0};
......
...@@ -28,24 +28,42 @@ extern short filt16a_r0[16]; ...@@ -28,24 +28,42 @@ extern short filt16a_r0[16];
extern short filt16a_m0[16]; extern short filt16a_m0[16];
extern short filt16a_mm0[16];
extern short filt16a_l1[16]; extern short filt16a_l1[16];
extern short filt16a_r1[16]; extern short filt16a_r1[16];
extern short filt16a_m1[16]; extern short filt16a_m1[16];
extern short filt16a_mm1[16];
extern short filt16a_mr1[16];
extern short filt16a_ml1[16];
extern short filt16a_l2[16]; extern short filt16a_l2[16];
extern short filt16a_r2[16]; extern short filt16a_r2[16];
extern short filt16a_m2[16]; extern short filt16a_m2[16];
extern short filt16a_mm2[16];
extern short filt16a_mr2[16];
extern short filt16a_ml2[16];
extern short filt16a_l3[16]; extern short filt16a_l3[16];
extern short filt16a_r3[16]; extern short filt16a_r3[16];
extern short filt16a_m3[16]; extern short filt16a_m3[16];
extern short filt16a_mm3[16];
extern short filt16a_ml3[16];
extern short filt16a_l0_dc[16]; extern short filt16a_l0_dc[16];
extern short filt16a_r0_dc[16]; extern short filt16a_r0_dc[16];
......
...@@ -32,6 +32,17 @@ ...@@ -32,6 +32,17 @@
/*!\brief Timing drift hysterisis in samples*/ /*!\brief Timing drift hysterisis in samples*/
#define SYNCH_HYST 2 #define SYNCH_HYST 2
/* A function to perform the channel estimation of DL PRS signal */
int nr_prs_channel_estimation(uint8_t gNB_id,
uint8_t rsc_id,
uint8_t rep_num,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
NR_DL_FRAME_PARMS *frame_params);
/* Generic function to find the peak of channel estimation buffer */
void peak_estimator(int32_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val);
/*! /*!
\brief This function performs channel estimation including frequency and temporal interpolation \brief This function performs channel estimation including frequency and temporal interpolation
\param ue Pointer to UE PHY variables \param ue Pointer to UE PHY variables
......
clc; clear all;
dir = input('Enter the directory path to T tracer dumps: ');
fft_size = input('Enter the OFDM FFT size used for file parsing: ');
num_resources = input('Enter number of PRS respurces: ');
num_gnb = input('Enter number of active gNBs: ');
num_prs_symb = 1;
start_resource = 0;
buff_offset = start_resource*2*fft_size;
%% Channel Impulse Response(CIR)
figure, hold on;
for i=0:num_gnb-1
for j=0:num_resources-1
file = [dir '/chT_gnb', num2str(i), '_', num2str(j), '.raw'];
fid = fopen(file, 'r');
if (fid > 0)
x = fread(fid, Inf, 'int16');
else
disp(['Failed to open the file ', file, '..!!'])
return;
end
fclose(fid);
y = x(buff_offset+1:2:num_prs_symb*2*fft_size) + 1j*x(buff_offset+2:2:num_prs_symb*2*fft_size);
plot(abs(fftshift(y)));
end
end
xlabel('FFT Index'); ylabel('ABS');
title('CHANNEL IMPULSE RESPONSE');
hold off;
%% Channel Frequncy Response(CFR)
figure, hold on;
for i=0:num_gnb-1
for j=0:num_resources-1
file = [dir '/chF_gnb', num2str(i), '_', num2str(j), '.raw'];
fid = fopen(file, 'r');
if (fid > 0)
x = fread(fid, Inf, 'int16');
else
disp(['Failed to open the file ', file, '..!!'])
return;
end
fclose(fid);
y = x(buff_offset+1:2:num_prs_symb*2*fft_size) + 1j*x(buff_offset+2:2:num_prs_symb*2*fft_size);
plot(abs(y));
end
end
xlabel('FFT Index'); ylabel('ABS');
title('CHANNEL FREQUENCY RESPONSE');
hold off;
\ No newline at end of file
...@@ -600,24 +600,6 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) ...@@ -600,24 +600,6 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change)
} }
static inline int abs32(int x)
{
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
}
static inline int64_t abs64(int64_t x)
{
return (((int64_t)((int32_t*)&x)[0])*((int64_t)((int32_t*)&x)[0]) + ((int64_t)((int32_t*)&x)[1])*((int64_t)((int32_t*)&x)[1]));
}
static inline double angle64(int64_t x)
{
double re=((int32_t*)&x)[0];
double im=((int32_t*)&x)[1];
return (atan2(im,re));
}
/******************************************************************* /*******************************************************************
* *
...@@ -726,7 +708,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -726,7 +708,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
(short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]), (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]),
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
shift); shift);
pss_corr_ue += abs64(result); pss_corr_ue += squaredMod(*(c32_t*)&result);
//((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */ //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */
//((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */ //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */
//((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */ //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */
......
oai_dfts_sse4: oai_dfts.c oai_dfts_sse4: oai_dfts.c
gcc-7 -O3 -std=gnu99 -msse4.1 -o oai_dfts_sse4 oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_HOME/sdr/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS gcc -O3 -std=gnu99 -msse4.1 -o oai_dfts_sse4 oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_HOME/sdr/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
oai_dfts_avx2: oai_dfts.c oai_dfts_avx2: oai_dfts.c
gcc -O2 -std=gnu99 -mavx2 -g -ggdb -o oai_dfts_avx2 oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_HOME/sdr/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS gcc -O2 -std=gnu99 -mavx2 -g -ggdb -o oai_dfts_avx2 oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_HOME/sdr/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
......
This diff is collapsed.
...@@ -436,6 +436,7 @@ This function performs optimized fixed-point radix-2 FFT/IFFT. ...@@ -436,6 +436,7 @@ This function performs optimized fixed-point radix-2 FFT/IFFT.
SZ_DEF(128) \ SZ_DEF(128) \
SZ_DEF(256) \ SZ_DEF(256) \
SZ_DEF(512) \ SZ_DEF(512) \
SZ_DEF(768) \
SZ_DEF(1024) \ SZ_DEF(1024) \
SZ_DEF(1536) \ SZ_DEF(1536) \
SZ_DEF(2048) \ SZ_DEF(2048) \
...@@ -445,10 +446,13 @@ This function performs optimized fixed-point radix-2 FFT/IFFT. ...@@ -445,10 +446,13 @@ This function performs optimized fixed-point radix-2 FFT/IFFT.
SZ_DEF(8192) \ SZ_DEF(8192) \
SZ_DEF(9216) \ SZ_DEF(9216) \
SZ_DEF(12288) \ SZ_DEF(12288) \
SZ_DEF(16384) \
SZ_DEF(18432) \ SZ_DEF(18432) \
SZ_DEF(24576) \ SZ_DEF(24576) \
SZ_DEF(32768) \
SZ_DEF(36864) \ SZ_DEF(36864) \
SZ_DEF(49152) \ SZ_DEF(49152) \
SZ_DEF(65536) \
SZ_DEF(73728) \ SZ_DEF(73728) \
SZ_DEF(98304) SZ_DEF(98304)
...@@ -507,6 +511,8 @@ dft_size_idx_t get_dft(int ofdm_symbol_size) ...@@ -507,6 +511,8 @@ dft_size_idx_t get_dft(int ofdm_symbol_size)
return DFT_256; return DFT_256;
case 512: case 512:
return DFT_512; return DFT_512;
case 768:
return DFT_768;
case 1024: case 1024:
return DFT_1024; return DFT_1024;
case 1536: case 1536:
...@@ -591,6 +597,8 @@ idft_size_idx_t get_idft(int ofdm_symbol_size) ...@@ -591,6 +597,8 @@ idft_size_idx_t get_idft(int ofdm_symbol_size)
return IDFT_256; return IDFT_256;
case 512: case 512:
return IDFT_512; return IDFT_512;
case 768:
return IDFT_768;
case 1024: case 1024:
return IDFT_1024; return IDFT_1024;
case 1536: case 1536:
......
...@@ -225,6 +225,11 @@ typedef struct { ...@@ -225,6 +225,11 @@ typedef struct {
gNB_PRACH_list_t list[NUMBER_OF_NR_PRACH_MAX]; gNB_PRACH_list_t list[NUMBER_OF_NR_PRACH_MAX];
} NR_gNB_PRACH; } NR_gNB_PRACH;
typedef struct {
uint8_t NumPRSResources;
prs_config_t prs_cfg[NR_MAX_PRS_RESOURCES_PER_SET];
} NR_gNB_PRS;
typedef struct { typedef struct {
/// Nfapi ULSCH PDU /// Nfapi ULSCH PDU
nfapi_nr_pusch_pdu_t ulsch_pdu; nfapi_nr_pusch_pdu_t ulsch_pdu;
...@@ -737,6 +742,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -737,6 +742,7 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_PBCH pbch; NR_gNB_PBCH pbch;
NR_gNB_COMMON common_vars; NR_gNB_COMMON common_vars;
NR_gNB_PRACH prach_vars; NR_gNB_PRACH prach_vars;
NR_gNB_PRS prs_vars;
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX]; NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX];
NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX]; NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX];
...@@ -790,6 +796,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -790,6 +796,9 @@ typedef struct PHY_VARS_gNB_s {
// Mask of occupied RBs, per symbol and PRB // Mask of occupied RBs, per symbol and PRB
uint32_t rb_mask_ul[14][9]; uint32_t rb_mask_ul[14][9];
/// PRS sequence
uint32_t ****nr_gold_prs;
/// Indicator set to 0 after first SR /// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_NR_SR_MAX]; uint8_t first_sr[NUMBER_OF_NR_SR_MAX];
......
...@@ -347,6 +347,18 @@ typedef struct { ...@@ -347,6 +347,18 @@ typedef struct {
int32_t **ptrs_re_per_slot; int32_t **ptrs_re_per_slot;
} NR_UE_PDSCH; } NR_UE_PDSCH;
#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 reserved;
prs_meas_t **prs_meas;
} NR_PRS_RESOURCE_t;
typedef struct {
uint8_t NumPRSResources;
NR_PRS_RESOURCE_t prs_resource[NR_MAX_PRS_RESOURCES_PER_SET];
} NR_UE_PRS;
#define NR_PDCCH_DEFS_NR_UE #define NR_PDCCH_DEFS_NR_UE
#define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0) #define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0)
#define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0) #define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0)
...@@ -723,6 +735,8 @@ typedef struct { ...@@ -723,6 +735,8 @@ typedef struct {
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE];
uint8_t prs_active_gNBs;
//Paging parameters //Paging parameters
uint32_t IMSImod1024; uint32_t IMSImod1024;
...@@ -767,6 +781,9 @@ typedef struct { ...@@ -767,6 +781,9 @@ typedef struct {
/// PUSCH DMRS sequence /// PUSCH DMRS sequence
uint32_t ****nr_gold_pusch_dmrs; uint32_t ****nr_gold_pusch_dmrs;
// PRS sequence per gNB, per resource
uint32_t *****nr_gold_prs;
uint32_t X_u[64][839]; uint32_t X_u[64][839];
// flag to activate PRB based averaging of channel estimates // flag to activate PRB based averaging of channel estimates
......
...@@ -63,13 +63,19 @@ ...@@ -63,13 +63,19 @@
#define NR_PSS_LENGTH 127 #define NR_PSS_LENGTH 127
#define NR_SSS_LENGTH 127 #define NR_SSS_LENGTH 127
#define NR_MAX_PRS_LENGTH 3264 //272*6(max allocation per RB)*2(QPSK)
#define NR_MAX_PRS_INIT_LENGTH_DWORD 102 // ceil(NR_MAX_CSI_RS_LENGTH/32)
#define NR_MAX_NUM_PRS_SYMB 12
#define NR_MAX_PRS_COMB_SIZE 12
#define NR_MAX_PRS_RESOURCES_PER_SET 64
#define NR_MAX_PRS_MUTING_PATTERN_LENGTH 32
#define NR_PBCH_DMRS_LENGTH 144 // in mod symbols #define NR_PBCH_DMRS_LENGTH 144 // in mod symbols
#define NR_PBCH_DMRS_LENGTH_DWORD 10 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32) #define NR_PBCH_DMRS_LENGTH_DWORD 10 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32)
/*used for the resource mapping*/ /*used for the resource mapping*/
#define NR_MAX_PDCCH_DMRS_LENGTH 576 // 16(L)*2(QPSK)*3(3 DMRS symbs per REG)*6(REG per CCE) #define NR_MAX_PDCCH_DMRS_LENGTH 576 // 16(L)*2(QPSK)*3(3 DMRS symbs per REG)*6(REG per CCE)
#define NR_MAX_PDCCH_SIZE 8192 // It seems it is the max polar coded block size #define NR_MAX_PDCCH_SIZE 8192 // It seems it is the max polar coded block size
#define NR_MAX_DCI_PAYLOAD_SIZE 64 #define NR_MAX_DCI_PAYLOAD_SIZE 64
#define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE) #define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE)
#define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32) #define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32)
...@@ -383,7 +389,42 @@ struct NR_DL_FRAME_PARMS { ...@@ -383,7 +389,42 @@ struct NR_DL_FRAME_PARMS {
uint32_t ofdm_offset_divisor; uint32_t ofdm_offset_divisor;
}; };
// PRS config structures
typedef struct {
uint16_t PRSResourceSetPeriod[2]; // [slot period, slot offset] of a PRS resource set
uint16_t PRSResourceOffset; // Slot offset of each PRS resource defined relative to the slot offset of the PRS resource set (0...511)
uint8_t PRSResourceRepetition; // Repetition factor for all PRS resources in resource set (1 /*default*/, 2, 4, 6, 8, 16, 32)
uint8_t PRSResourceTimeGap; // Slot offset between two consecutive repetition indices of all PRS resources in a PRS resource set (1 /*default*/, 2, 4, 6, 8, 16, 32)
uint16_t NumRB; // Number of PRBs allocated to all PRS resources in a PRS resource set (<= 272 and multiples of 4)
uint8_t NumPRSSymbols; // Number of OFDM symbols in a slot allocated to each PRS resource in a PRS resource set
uint8_t SymbolStart; // Starting OFDM symbol of each PRS resource in a PRS resource set
uint16_t RBOffset; // Starting PRB index of all PRS resources in a PRS resource set
uint8_t CombSize; // RE density of all PRS resources in a PRS resource set (2, 4, 6, 12)
uint8_t REOffset; // Starting RE offset in the first OFDM symbol of each PRS resource in a PRS resource set
uint32_t MutingPattern1[32]; // Muting bit pattern option-1, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32
uint32_t MutingPattern2[32]; // Muting bit pattern option-2, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32
uint8_t MutingBitRepetition; // Muting bit repetition factor, specified as 1, 2, 4, or 8
uint16_t NPRSID; // Sequence identity of each PRS resource in a PRS resource set, specified in the range [0, 4095]
} prs_config_t;
typedef struct {
int8_t gNB_id;
int32_t sfn;
int8_t slot;
int8_t rxAnt_idx;
int32_t dl_toa;
int32_t dl_aoa;
int32_t snr;
int32_t reserved;
} prs_meas_t;
// rel16 prs k_prime table as per ts138.211 sec.7.4.1.7.2
#define K_PRIME_TABLE_ROW_SIZE 4
#define K_PRIME_TABLE_COL_SIZE 12
#define PRS_K_PRIME_TABLE { {0,1,0,1,0,1,0,1,0,1,0,1}, \
{0,2,1,3,0,2,1,3,0,2,1,3}, \
{0,3,1,4,2,5,0,3,1,4,2,5}, \
{0,6,3,9,1,7,4,10,2,8,5,11} };
#define KHz (1000UL) #define KHz (1000UL)
#define MHz (1000*KHz) #define MHz (1000*KHz)
......
...@@ -121,8 +121,9 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, ...@@ -121,8 +121,9 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
PHY_VARS_gNB *gNB = msgTx->gNB; PHY_VARS_gNB *gNB = msgTx->gNB;
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
int offset = gNB->CC_id; int offset = gNB->CC_id, slot_prs;
int txdataF_offset = slot*fp->samples_per_slot_wCP; int txdataF_offset = slot*fp->samples_per_slot_wCP;
prs_config_t *prs_config = NULL;
if ((cfg->cell_config.frame_duplex_type.value == TDD) && if ((cfg->cell_config.frame_duplex_type.value == TDD) &&
(nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return; (nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return;
...@@ -135,6 +136,21 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, ...@@ -135,6 +136,21 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t)); memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t));
} }
// Check for PRS slot - section 7.4.1.7.4 in 3GPP rel16 38.211
for(int rsc_id = 0; rsc_id < gNB->prs_vars.NumPRSResources; rsc_id++)
{
prs_config = &gNB->prs_vars.prs_cfg[rsc_id];
for (int i = 0; i < prs_config->PRSResourceRepetition; i++)
{
if( (((frame*fp->slots_per_frame + slot) - (prs_config->PRSResourceSetPeriod[1] + prs_config->PRSResourceOffset)+prs_config->PRSResourceSetPeriod[0])%prs_config->PRSResourceSetPeriod[0]) == i*prs_config->PRSResourceTimeGap )
{
slot_prs = (slot - i*prs_config->PRSResourceTimeGap + fp->slots_per_frame)%fp->slots_per_frame;
LOG_D(PHY,"gNB_TX: frame %d, slot %d, slot_prs %d, PRS Resource ID %d\n",frame, slot, slot_prs, rsc_id);
nr_generate_prs(gNB->nr_gold_prs[rsc_id][slot_prs],&gNB->common_vars.txdataF[0][txdataF_offset], AMP, prs_config, cfg, fp);
}
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
for (int i=0; i<fp->Lmax; i++) { for (int i=0; i<fp->Lmax; i++) {
if (msgTx->ssb[i].active) { if (msgTx->ssb[i].active) {
...@@ -182,6 +198,10 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, ...@@ -182,6 +198,10 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
//apply the OFDM symbol rotation here //apply the OFDM symbol rotation here
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) { for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14); apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14);
T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0),
T_INT(frame), T_INT(slot),
T_INT(aa), T_BUFFER(&gNB->common_vars.txdataF[aa][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)));
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0);
......
...@@ -1331,7 +1331,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1331,7 +1331,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
fapi_nr_config_request_t *cfg = &ue->nrUE_config; fapi_nr_config_request_t *cfg = &ue->nrUE_config;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms; NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
...@@ -1410,6 +1409,29 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1410,6 +1409,29 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
} }
} }
// Check for PRS slot - section 7.4.1.7.4 in 3GPP rel16 38.211
for(int gNB_id = 0; gNB_id < ue->prs_active_gNBs; gNB_id++)
{
for(int rsc_id = 0; rsc_id < ue->prs_vars[gNB_id]->NumPRSResources; rsc_id++)
{
prs_config_t *prs_config = &ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg;
for (int i = 0; i < prs_config->PRSResourceRepetition; i++)
{
if( (((frame_rx*fp->slots_per_frame + nr_slot_rx) - (prs_config->PRSResourceSetPeriod[1] + prs_config->PRSResourceOffset) + prs_config->PRSResourceSetPeriod[0])%prs_config->PRSResourceSetPeriod[0]) == i*prs_config->PRSResourceTimeGap)
{
for(int j = prs_config->SymbolStart; j < (prs_config->SymbolStart+prs_config->NumPRSSymbols); j++)
{
nr_slot_fep(ue,
proc,
(j%fp->symbols_per_slot),
nr_slot_rx);
}
nr_prs_channel_estimation(gNB_id,rsc_id,i,ue,proc,fp);
}
} // for i
} // for rsc_id
} // for gNB_id
if ((frame_rx%64 == 0) && (nr_slot_rx==0)) { if ((frame_rx%64 == 0) && (nr_slot_rx==0)) {
LOG_I(NR_PHY,"============================================\n"); LOG_I(NR_PHY,"============================================\n");
// fixed text + 8 HARQs rounds à 10 ("999999999/") + NULL // fixed text + 8 HARQs rounds à 10 ("999999999/") + NULL
......
This diff is collapsed.
...@@ -103,6 +103,8 @@ typedef enum { ...@@ -103,6 +103,8 @@ typedef enum {
#define CONFIG_STRING_RU_SL_AHEAD "sl_ahead" #define CONFIG_STRING_RU_SL_AHEAD "sl_ahead"
#define CONFIG_STRING_RU_NR_FLAG "nr_flag" #define CONFIG_STRING_RU_NR_FLAG "nr_flag"
#define CONFIG_STRING_RU_NR_SCS_FOR_RASTER "nr_scs_for_raster" #define CONFIG_STRING_RU_NR_SCS_FOR_RASTER "nr_scs_for_raster"
#define CONFIG_STRING_RU_TX_SUBDEV "tx_subdev"
#define CONFIG_STRING_RU_RX_SUBDEV "rx_subdev"
#define CONFIG_STRING_RU_RXFH_CORE_ID "rxfh_core_id" #define CONFIG_STRING_RU_RXFH_CORE_ID "rxfh_core_id"
#define CONFIG_STRING_RU_TXFH_CORE_ID "txfh_core_id" #define CONFIG_STRING_RU_TXFH_CORE_ID "txfh_core_id"
#define CONFIG_STRING_RU_TP_CORES "tp_cores" #define CONFIG_STRING_RU_TP_CORES "tp_cores"
...@@ -154,12 +156,14 @@ typedef enum { ...@@ -154,12 +156,14 @@ typedef enum {
#define RU_SL_AHEAD 30 #define RU_SL_AHEAD 30
#define RU_NR_FLAG 31 #define RU_NR_FLAG 31
#define RU_NR_SCS_FOR_RASTER 32 #define RU_NR_SCS_FOR_RASTER 32
#define RU_RXFH_CORE_ID 33 #define RU_TX_SUBDEV 33
#define RU_TXFH_CORE_ID 34 #define RU_RX_SUBDEV 34
#define RU_TP_CORES 35 #define RU_RXFH_CORE_ID 35
#define RU_NUM_TP_CORES 36 #define RU_TXFH_CORE_ID 36
#define RU_NUM_INTERFACES 37 #define RU_TP_CORES 37
#define RU_HALF_SLOT_PARALLELIZATION 38 #define RU_NUM_TP_CORES 38
#define RU_NUM_INTERFACES 39
#define RU_HALF_SLOT_PARALLELIZATION 40
/*-----------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* RU configuration parameters */ /* RU configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
...@@ -198,6 +202,8 @@ typedef enum { ...@@ -198,6 +202,8 @@ typedef enum {
{CONFIG_STRING_RU_SL_AHEAD, HLP_RU_SL_AHEAD, 0, iptr:NULL, defintval:6, TYPE_INT, 0}, \ {CONFIG_STRING_RU_SL_AHEAD, HLP_RU_SL_AHEAD, 0, iptr:NULL, defintval:6, TYPE_INT, 0}, \
{CONFIG_STRING_RU_NR_FLAG, HLP_RU_NR_FLAG, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_FLAG, HLP_RU_NR_FLAG, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \
{CONFIG_STRING_RU_NR_SCS_FOR_RASTER, HLP_RU_NR_SCS_FOR_RASTER, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, HLP_RU_NR_SCS_FOR_RASTER, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
{CONFIG_STRING_RU_TX_SUBDEV, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_RX_SUBDEV, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_RXFH_CORE_ID, HLP_RU_RXFH_CORE_ID, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_RXFH_CORE_ID, HLP_RU_RXFH_CORE_ID, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_TXFH_CORE_ID, HLP_RU_TXFH_CORE_ID, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_TXFH_CORE_ID, HLP_RU_TXFH_CORE_ID, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_TP_CORES, HLP_RU_TP_CORES, 0, uptr:NULL, defintarrayval:DEFRUTPCORES, TYPE_INTARRAY, 8}, \ {CONFIG_STRING_RU_TP_CORES, HLP_RU_TP_CORES, 0, uptr:NULL, defintarrayval:DEFRUTPCORES, TYPE_INTARRAY, 8}, \
......
...@@ -155,6 +155,7 @@ void *gNB_app_task(void *args_p) ...@@ -155,6 +155,7 @@ void *gNB_app_task(void *args_p)
LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__);
RCconfig_NR_L1(); RCconfig_NR_L1();
RCconfig_nr_prs();
if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc(); if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc();
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "nfapi_pnf.h" #include "nfapi_pnf.h"
//#include "L1_paramdef.h" //#include "L1_paramdef.h"
#include "prs_nr_paramdef.h"
#include "L1_nr_paramdef.h" #include "L1_nr_paramdef.h"
#include "MACRLC_nr_paramdef.h" #include "MACRLC_nr_paramdef.h"
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
...@@ -671,6 +672,100 @@ void RCconfig_nr_flexran() ...@@ -671,6 +672,100 @@ void RCconfig_nr_flexran()
} }
} }
void RCconfig_nr_prs(void)
{
uint16_t j = 0, k = 0;
prs_config_t *prs_config = NULL;
char str[7][100] = {0};
paramdef_t PRS_Params[] = PRS_PARAMS_DESC;
paramlist_def_t PRS_ParamList = {CONFIG_STRING_PRS_CONFIG,NULL,0};
if (RC.gNB == NULL) {
RC.gNB = (PHY_VARS_gNB **)malloc((1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*));
LOG_I(NR_PHY,"RC.gNB = %p\n",RC.gNB);
memset(RC.gNB,0,(1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*));
}
config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), NULL);
if (PRS_ParamList.numelt > 0) {
for (j = 0; j < RC.nb_nr_L1_inst; j++) {
if (RC.gNB[j] == NULL) {
RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB));
LOG_I(NR_PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]);
memset(RC.gNB[j],0,sizeof(PHY_VARS_gNB));
RC.gNB[j]->Mod_id = j;
}
RC.gNB[j]->prs_vars.NumPRSResources = *(PRS_ParamList.paramarray[j][NUM_PRS_RESOURCES].uptr);
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
{
prs_config = &RC.gNB[j]->prs_vars.prs_cfg[k];
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->PRSResourceOffset = PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET_LIST].uptr[k];
prs_config->NPRSID = PRS_ParamList.paramarray[j][PRS_ID_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
snprintf(str[5]+strlen(str[5]),sizeof(str[5])-strlen(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
snprintf(str[6]+strlen(str[6]),sizeof(str[6])-strlen(str[6]),"%d, ",prs_config->MutingPattern2[l]);
}
// print to buffer
snprintf(str[0]+strlen(str[0]),sizeof(str[0])-strlen(str[0]),"%d, ",prs_config->SymbolStart);
snprintf(str[1]+strlen(str[1]),sizeof(str[1])-strlen(str[1]),"%d, ",prs_config->NumPRSSymbols);
snprintf(str[2]+strlen(str[2]),sizeof(str[2])-strlen(str[2]),"%d, ",prs_config->REOffset);
snprintf(str[3]+strlen(str[3]),sizeof(str[3])-strlen(str[3]),"%d, ",prs_config->PRSResourceOffset);
snprintf(str[4]+strlen(str[4]),sizeof(str[4])-strlen(str[4]),"%d, ",prs_config->NPRSID);
} // for k
prs_config = &RC.gNB[j]->prs_vars.prs_cfg[0];
LOG_I(PHY, "-----------------------------------------\n");
LOG_I(PHY, "PRS Config for gNB_id %d @ %p\n", j, prs_config);
LOG_I(PHY, "-----------------------------------------\n");
LOG_I(PHY, "NumPRSResources \t%d\n", RC.gNB[j]->prs_vars.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");
} // for j
}
else
{
LOG_E(PHY,"No " CONFIG_STRING_PRS_CONFIG " configuration found..!!\n");
}
}
void RCconfig_NR_L1(void) { void RCconfig_NR_L1(void) {
int j; int j;
paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
...@@ -2264,6 +2359,7 @@ void nr_read_config_and_init(void) { ...@@ -2264,6 +2359,7 @@ void nr_read_config_and_init(void) {
uint32_t gnb_nb = RC.nb_nr_inst; uint32_t gnb_nb = RC.nb_nr_inst;
RCconfig_NR_L1(); RCconfig_NR_L1();
RCconfig_nr_prs();
RCconfig_nr_macrlc(); RCconfig_nr_macrlc();
LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst);
......
...@@ -92,6 +92,7 @@ typedef struct ru_config_s { ...@@ -92,6 +92,7 @@ typedef struct ru_config_s {
*/ */
extern void NRRCconfig_RU(void); extern void NRRCconfig_RU(void);
extern void RCconfig_nr_flexran(void); extern void RCconfig_nr_flexran(void);
extern void RCconfig_nr_prs(void);
extern void RCconfig_NR_L1(void); extern void RCconfig_NR_L1(void);
extern void RCconfig_nr_macrlc(void); extern void RCconfig_nr_macrlc(void);
extern int RCconfig_nr_gtpu(void ); extern int RCconfig_nr_gtpu(void );
......
...@@ -47,9 +47,9 @@ static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac, ...@@ -47,9 +47,9 @@ static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac,
{ {
nfapi_nr_ul_tti_request_t *future_ul_tti_req = nfapi_nr_ul_tti_request_t *future_ul_tti_req =
&nrmac->UL_tti_req_ahead[0][pucch->ul_slot]; &nrmac->UL_tti_req_ahead[0][pucch->ul_slot];
AssertFatal(future_ul_tti_req->SFN == pucch->frame if (future_ul_tti_req->SFN != pucch->frame || future_ul_tti_req->Slot != pucch->ul_slot)
&& future_ul_tti_req->Slot == pucch->ul_slot, LOG_W(MAC,
"Current %4d.%2d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n", "Current %d.%d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n",
frame,slot, frame,slot,
future_ul_tti_req->SFN, future_ul_tti_req->SFN,
future_ul_tti_req->Slot, future_ul_tti_req->Slot,
......
...@@ -2062,8 +2062,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) ...@@ -2062,8 +2062,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
/* PUSCH in a later slot, but corresponding DCI now! */ /* PUSCH in a later slot, but corresponding DCI now! */
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][sched_pusch->slot]; nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][sched_pusch->slot];
AssertFatal(future_ul_tti_req->SFN == sched_pusch->frame if (future_ul_tti_req->SFN != sched_pusch->frame || future_ul_tti_req->Slot != sched_pusch->slot)
&& future_ul_tti_req->Slot == sched_pusch->slot, LOG_W(MAC,
"%d.%d future UL_tti_req's frame.slot %d.%d does not match PUSCH %d.%d\n", "%d.%d future UL_tti_req's frame.slot %d.%d does not match PUSCH %d.%d\n",
frame, slot, frame, slot,
future_ul_tti_req->SFN, future_ul_tti_req->SFN,
...@@ -2073,6 +2073,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) ...@@ -2073,6 +2073,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
AssertFatal(future_ul_tti_req->n_pdus < AssertFatal(future_ul_tti_req->n_pdus <
sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]), sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]),
"Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus); "Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus);
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE; future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu; nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu;
......
...@@ -284,5 +284,6 @@ int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, ...@@ -284,5 +284,6 @@ int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index,
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci); int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
#endif #endif
This diff is collapsed.
...@@ -187,7 +187,11 @@ typedef struct { ...@@ -187,7 +187,11 @@ typedef struct {
int rx_num_channels; int rx_num_channels;
//! number of TX channels (=TX antennas) //! number of TX channels (=TX antennas)
int tx_num_channels; int tx_num_channels;
//! \brief RX base addresses for mmapped_dma or direct access //! rx daughter card
char* rx_subdev;
//! tx daughter card
char* tx_subdev;
//! \brief RX base addresses for mmapped_dma
int32_t *rxbase[4]; int32_t *rxbase[4];
//! \brief RX buffer size for direct access //! \brief RX buffer size for direct access
int rxsize; int rxsize;
......
...@@ -203,8 +203,9 @@ static int sync_to_gps(openair0_device *device) { ...@@ -203,8 +203,9 @@ static int sync_to_gps(openair0_device *device) {
//Set to GPS time //Set to GPS time
uhd::time_spec_t gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int())); uhd::time_spec_t gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int()));
//s->usrp->set_time_next_pps(gps_time+1.0, mboard); s->usrp->set_time_next_pps(gps_time+1.0, mboard);
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0)); //s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
//Wait for it to apply //Wait for it to apply
//The wait is 2 seconds because N-Series has a known issue where //The wait is 2 seconds because N-Series has a known issue where
//the time at the last PPS does not properly update at the PPS edge //the time at the last PPS does not properly update at the PPS edge
...@@ -215,10 +216,10 @@ static int sync_to_gps(openair0_device *device) { ...@@ -215,10 +216,10 @@ static int sync_to_gps(openair0_device *device) {
uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps(mboard); uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps(mboard);
std::cout << "USRP time: " << (boost::format("%0.9f") % time_last_pps.get_real_secs()) << std::endl; std::cout << "USRP time: " << (boost::format("%0.9f") % time_last_pps.get_real_secs()) << std::endl;
std::cout << "GPSDO time: " << (boost::format("%0.9f") % gps_time.get_real_secs()) << std::endl; std::cout << "GPSDO time: " << (boost::format("%0.9f") % gps_time.get_real_secs()) << std::endl;
//if (gps_time.get_real_secs() == time_last_pps.get_real_secs()) if (gps_time.get_real_secs() == time_last_pps.get_real_secs())
// std::cout << std::endl << "SUCCESS: USRP time synchronized to GPS time" << std::endl << std::endl; std::cout << std::endl << "SUCCESS: USRP time synchronized to GPS time" << std::endl << std::endl;
//else else
// std::cerr << std::endl << "ERROR: Failed to synchronize USRP time to GPS time" << std::endl << std::endl; std::cerr << std::endl << "ERROR: Failed to synchronize USRP time to GPS time" << std::endl << std::endl;
} }
if (num_gps_locked == num_mboards and num_mboards > 1) { if (num_gps_locked == num_mboards and num_mboards > 1) {
...@@ -295,15 +296,18 @@ static int trx_usrp_start(openair0_device *device) { ...@@ -295,15 +296,18 @@ static int trx_usrp_start(openair0_device *device) {
//s->first_rx = 1; //s->first_rx = 1;
s->rx_timestamp = 0; s->rx_timestamp = 0;
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0)); //wait for next pps
// wait for the pps to change uhd::time_spec_t last_pps = s->usrp->get_time_last_pps();
uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps(); uhd::time_spec_t current_pps = s->usrp->get_time_last_pps();
while (time_last_pps == s->usrp->get_time_last_pps()) { while(current_pps == last_pps) {
boost::this_thread::sleep(boost::posix_time::milliseconds(1)); boost::this_thread::sleep(boost::posix_time::milliseconds(1));
current_pps = s->usrp->get_time_last_pps();
} }
LOG_I(HW,"current pps at %f, starting streaming at %f\n",current_pps.get_real_secs(),current_pps.get_real_secs()+1.0);
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
cmd.time_spec = uhd::time_spec_t(1.0); cmd.time_spec = uhd::time_spec_t(current_pps+1.0);
cmd.stream_now = false; // start at constant delay cmd.stream_now = false; // start at constant delay
s->rx_stream->issue_stream_cmd(cmd); s->rx_stream->issue_stream_cmd(cmd);
...@@ -440,7 +444,14 @@ static int trx_usrp_write(openair0_device *device, ...@@ -440,7 +444,14 @@ static int trx_usrp_write(openair0_device *device,
for (int j=0; j<nsamps2; j++) { for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__ #ifdef __AVX2__
if ((((uintptr_t) buff[i])&0x1F)==0) {
buff_tx[i][j] = _mm256_slli_epi16(((__m256i *)buff[i])[j],4); buff_tx[i][j] = _mm256_slli_epi16(((__m256i *)buff[i])[j],4);
}
else
{
__m256i tmp=_mm256_loadu_si256(((__m256i *)buff[i])+j);
buff_tx[i][j] = _mm256_slli_epi16(tmp,4);
}
#else #else
buff_tx[i][j] = _mm_slli_epi16(((__m128i *)buff[i])[j],4); buff_tx[i][j] = _mm_slli_epi16(((__m128i *)buff[i])[j],4);
#endif #endif
...@@ -580,7 +591,14 @@ void *trx_usrp_write_thread(void * arg){ ...@@ -580,7 +591,14 @@ void *trx_usrp_write_thread(void * arg){
for (int j=0; j<nsamps2; j++) { for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__ #ifdef __AVX2__
if ((((uintptr_t) buff[i])&0x1F)==0) {
buff_tx[i][j] = _mm256_slli_epi16(((__m256i *)buff[i])[j],4); buff_tx[i][j] = _mm256_slli_epi16(((__m256i *)buff[i])[j],4);
}
else
{
__m256i tmp=_mm256_loadu_si256(((__m256i *)buff[i])+j);
buff_tx[i][j] = _mm256_slli_epi16(tmp,4);
}
#else #else
buff_tx[i][j] = _mm_slli_epi16(((__m128i *)buff[i])[j],4); buff_tx[i][j] = _mm_slli_epi16(((__m128i *)buff[i])[j],4);
#endif #endif
...@@ -727,16 +745,17 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -727,16 +745,17 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
// bring RX data into 12 LSBs for softmodem RX // bring RX data into 12 LSBs for softmodem RX
for (int i=0; i<cc; i++) { for (int i=0; i<cc; i++) {
for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__ #ifdef __AVX2__
// FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
if ((((uintptr_t) buff[i])&0x1F)==0) { if ((((uintptr_t) buff[i])&0x1F)==0) {
for (int j=0; j<nsamps2; j++)
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],rxshift); ((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],rxshift);
} else { } else {
for (int j=0; j<(nsamps2<<1); j++) __m256i tmp=_mm256_srai_epi16(buff_tmp[i][j],rxshift);
((__m128i *)buff[i])[j] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[j],rxshift); _mm256_storeu_si256(((__m256i *)buff[i])+j, tmp);
}
} }
#else #else
for (int j=0; j<nsamps2; j++) for (int j=0; j<nsamps2; j++)
...@@ -1048,7 +1067,7 @@ extern "C" { ...@@ -1048,7 +1067,7 @@ extern "C" {
sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers); sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
LOG_I(HW,"UHD version %s (%d.%d.%d)\n", LOG_I(HW,"UHD version %s (%d.%d.%d)\n",
uhd::get_version_string().c_str(),vers,subvers,subsubvers); uhd::get_version_string().c_str(),vers,subvers,subsubvers);
std::string args; std::string args,tx_subdev,rx_subdev;
if (openair0_cfg[0].sdr_addrs == NULL) { if (openair0_cfg[0].sdr_addrs == NULL) {
args = "type=b200"; args = "type=b200";
...@@ -1169,7 +1188,10 @@ extern "C" { ...@@ -1169,7 +1188,10 @@ extern "C" {
LOG_I(HW,"USRP fails to sync with GPS. Exiting.\n"); LOG_I(HW,"USRP fails to sync with GPS. Exiting.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} else if (s->usrp->get_clock_source(0) == "external") { } else {
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
if (s->usrp->get_clock_source(0) == "external") {
if (check_ref_locked(s,0)) { if (check_ref_locked(s,0)) {
LOG_I(HW,"USRP locked to external reference!\n"); LOG_I(HW,"USRP locked to external reference!\n");
} else { } else {
...@@ -1177,6 +1199,7 @@ extern "C" { ...@@ -1177,6 +1199,7 @@ extern "C" {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
}
if (device->type==USRP_X300_DEV) { if (device->type==USRP_X300_DEV) {
openair0_cfg[0].rx_gain_calib_table = calib_table_x310; openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
...@@ -1198,6 +1221,12 @@ extern "C" { ...@@ -1198,6 +1221,12 @@ extern "C" {
LOG_I(HW,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate); LOG_I(HW,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate);
switch ((int)openair0_cfg[0].sample_rate) { switch ((int)openair0_cfg[0].sample_rate) {
case 184320000:
// from usrp_time_offset
//openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15; //to be checked
break;
case 122880000: case 122880000:
// from usrp_time_offset // from usrp_time_offset
//openair0_cfg[0].samples_per_packet = 2048; //openair0_cfg[0].samples_per_packet = 2048;
...@@ -1210,8 +1239,8 @@ extern "C" { ...@@ -1210,8 +1239,8 @@ extern "C" {
// from usrp_time_offset // from usrp_time_offset
//openair0_cfg[0].samples_per_packet = 2048; //openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15; //to be checked openair0_cfg[0].tx_sample_advance = 15; //to be checked
openair0_cfg[0].tx_bw = 80e6; //openair0_cfg[0].tx_bw = 80e6;
openair0_cfg[0].rx_bw = 80e6; //openair0_cfg[0].rx_bw = 80e6;
break; break;
case 61440000: case 61440000:
...@@ -1237,6 +1266,13 @@ extern "C" { ...@@ -1237,6 +1266,13 @@ extern "C" {
openair0_cfg[0].rx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6;
break; break;
case 23040000:
//openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15;
openair0_cfg[0].tx_bw = 20e6;
openair0_cfg[0].rx_bw = 20e6;
break;
case 15360000: case 15360000:
//openair0_cfg[0].samples_per_packet = 2048; //openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 45; openair0_cfg[0].tx_sample_advance = 45;
...@@ -1338,6 +1374,18 @@ extern "C" { ...@@ -1338,6 +1374,18 @@ extern "C" {
openair0_cfg[0].iq_txshift = 4;//shift openair0_cfg[0].iq_txshift = 4;//shift
openair0_cfg[0].iq_rxrescale = 15;//rescale iqs openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
if(openair0_cfg[0].tx_subdev!=NULL){
LOG_I(HW, "openair0_cfg[0].tx_subdev == %s\n", openair0_cfg[0].tx_subdev);
tx_subdev = openair0_cfg[0].tx_subdev;
s->usrp->set_tx_subdev_spec(tx_subdev);
}
if(openair0_cfg[0].rx_subdev!=NULL){
LOG_I(HW, "openair0_cfg[0].rx_subdev == %s\n", openair0_cfg[0].rx_subdev);
rx_subdev = openair0_cfg[0].rx_subdev;
s->usrp->set_rx_subdev_spec(rx_subdev);
}
for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) { for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i+choffset); s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i+choffset);
...@@ -1383,7 +1431,7 @@ extern "C" { ...@@ -1383,7 +1431,7 @@ extern "C" {
LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6); LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6);
LOG_I(HW,"Actual clock source %s...\n",s->usrp->get_clock_source(0).c_str()); LOG_I(HW,"Actual clock source %s...\n",s->usrp->get_clock_source(0).c_str());
LOG_I(HW,"Actual time source %s...\n",s->usrp->get_time_source(0).c_str()); LOG_I(HW,"Actual time source %s...\n",s->usrp->get_time_source(0).c_str());
sleep(1);
// create tx & rx streamer // create tx & rx streamer
uhd::stream_args_t stream_args_rx("sc16", "sc16"); uhd::stream_args_t stream_args_rx("sc16", "sc16");
int samples=openair0_cfg[0].sample_rate; int samples=openair0_cfg[0].sample_rate;
...@@ -1437,6 +1485,7 @@ extern "C" { ...@@ -1437,6 +1485,7 @@ extern "C" {
LOG_I(HW," Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps()); LOG_I(HW," Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps());
} }
std::cout << boost::format("Using Device: %s") % s->usrp->get_pp_string() << std::endl;
LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs()); LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs());
device->trx_write_func = trx_usrp_write; device->trx_write_func = trx_usrp_write;
device->trx_read_func = trx_usrp_read; device->trx_read_func = trx_usrp_read;
......
PRSs =
(
{
Active_gNBs = 1;
prs_config0 = (
{
gNB_id = 0;
NumPRSResources = 1;
PRSResourceSetPeriod = [20, 2];
SymbolStart = [7];
NumPRSSymbols = [6];
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = [0];
PRSResourceOffset = [0];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [0];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
prs_config1 = (
{
gNB_id = 1;
NumPRSResources = 1;
PRSResourceSetPeriod = [20, 2];
SymbolStart = [7];
NumPRSSymbols = [6];
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = [0];
PRSResourceOffset = [1];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [1];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
prs_config2 = (
{
gNB_id = 2;
NumPRSResources = 1;
PRSResourceSetPeriod = [20, 2];
SymbolStart = [7];
NumPRSSymbols = [6];
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = [0];
PRSResourceOffset = [2];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [2];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
prs_config3 = (
{
gNB_id = 3;
NumPRSResources = 1;
PRSResourceSetPeriod = [20, 2];
SymbolStart = [7];
NumPRSSymbols = [6];
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = [0];
PRSResourceOffset = [3];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [3];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
}
);
PRSs =
(
{
Active_gNBs = 1;
prs_config0 = (
{
gNB_id = 0;
NumPRSResources = 8;
PRSResourceSetPeriod = [80, 2];
SymbolStart = [8,8,8,8,8,8,8,8];
NumPRSSymbols = [6,6,6,6,6,6,6,6];
NumRB = 64;
RBOffset = 0;
CombSize = 4;
REOffset = [0,0,0,0,0,0,0,0];
PRSResourceOffset = [0,10,20,30,40,50,60,70];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [0,1,2,3,4,5,6,7];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
prs_config1 = (
{
gNB_id = 1;
NumPRSResources = 8;
PRSResourceSetPeriod = [80, 2];
SymbolStart = [8,8,8,8,8,8,8,8];
NumPRSSymbols = [6,6,6,6,6,6,6,6];
NumRB = 64;
RBOffset = 0;
CombSize = 4;
REOffset = [1,1,1,1,1,1,1,1];
PRSResourceOffset = [0,10,20,30,40,50,60,70];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [10,11,12,13,14,15,16,17];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
}
);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment