Commit 49a65ad6 authored by Khalid Ahmed's avatar Khalid Ahmed Committed by Thomas Schlichter

TDD fixes in real-time environment

parent 839776ba
...@@ -734,8 +734,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -734,8 +734,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame);
int sf_extension = 0; int sf_extension = 0;
if ((SF_type == SF_DL) ||
(SF_type == SF_S)) {
int siglen=fp->samples_per_slot,flags=1; int siglen=fp->samples_per_slot,flags=1;
/* /*
if (SF_type == SF_S) { if (SF_type == SF_S) {
...@@ -776,7 +774,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -776,7 +774,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
(long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot); (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen); AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
}
} }
...@@ -1388,9 +1385,9 @@ static void *ru_thread( void *param ) { ...@@ -1388,9 +1385,9 @@ static void *ru_thread( void *param ) {
} }
if (ru->if_south == LOCAL_RF) { // configure RF parameters only if (ru->if_south == LOCAL_RF) { // configure RF parameters only
fill_rf_config(ru,ru->rf_config_file);
nr_init_frame_parms(&ru->gNB_list[0]->gNB_config, fp); nr_init_frame_parms(&ru->gNB_list[0]->gNB_config, fp);
nr_dump_frame_parms(fp); nr_dump_frame_parms(fp);
fill_rf_config(ru,ru->rf_config_file);
nr_phy_init_RU(ru); nr_phy_init_RU(ru);
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
AssertFatal(ret==0,"Cannot connect to local radio\n"); AssertFatal(ret==0,"Cannot connect to local radio\n");
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "executables/nr-softmodem-common.h"
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/phy_extern.h" #include "PHY/phy_extern.h"
#include "PHY/NR_REFSIG/nr_refsig.h" #include "PHY/NR_REFSIG/nr_refsig.h"
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
#include "MBSFN-SubframeConfigList.h"*/ #include "MBSFN-SubframeConfigList.h"*/
#include "openair1/PHY/defs_RU.h" #include "openair1/PHY/defs_RU.h"
#include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "assertions.h" #include "assertions.h"
#include <math.h> #include <math.h>
...@@ -428,23 +430,25 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) ...@@ -428,23 +430,25 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
gNB_config->sch_config.ssb_periodicity.value = phy_config->cfg->sch_config.ssb_periodicity.value; gNB_config->sch_config.ssb_periodicity.value = phy_config->cfg->sch_config.ssb_periodicity.value;
if (phy_config->cfg->subframe_config.duplex_mode.value == 0) { if (phy_config->cfg->subframe_config.duplex_mode.value == 0) {
gNB_config->subframe_config.duplex_mode.value = TDD;
} else {
gNB_config->subframe_config.duplex_mode.value = FDD; gNB_config->subframe_config.duplex_mode.value = FDD;
} else {
gNB_config->subframe_config.duplex_mode.value = TDD;
} }
RC.gNB[Mod_id][CC_id]->mac_enabled = 1; RC.gNB[Mod_id][CC_id]->mac_enabled = 1;
fp->dl_CarrierFreq = from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); fp->dl_CarrierFreq = from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_nr_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); get_band(fp->dl_CarrierFreq, &gNB_config->nfapi_config.rf_bands.rf_band[0], &uplink_frequency_offset[CC_id][0], &fp->frame_type);
fp->ul_CarrierFreq = fp->dl_CarrierFreq + uplink_frequency_offset[CC_id][0];
fp->threequarter_fs = openair0_cfg[0].threequarter_fs; fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,DL freq %u)\n", LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,DL freq %u, UL freq %u)\n",
Mod_id, Mod_id,
CC_id, CC_id,
gNB_config->nfapi_config.rf_bands.rf_band[0], gNB_config->nfapi_config.rf_bands.rf_band[0],
gNB_config->rf_config.dl_carrier_bandwidth.value, gNB_config->rf_config.dl_carrier_bandwidth.value,
gNB_config->rf_config.ul_carrier_bandwidth.value, gNB_config->rf_config.ul_carrier_bandwidth.value,
gNB_config->sch_config.physical_cell_id.value, gNB_config->sch_config.physical_cell_id.value,
fp->dl_CarrierFreq ); fp->dl_CarrierFreq,
fp->ul_CarrierFreq);
nr_init_frame_parms(gNB_config, fp); nr_init_frame_parms(gNB_config, fp);
......
...@@ -256,7 +256,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config, ...@@ -256,7 +256,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config,
{ {
fp->eutra_band = config->nfapi_config.rf_bands.rf_band[0]; fp->eutra_band = config->nfapi_config.rf_bands.rf_band[0];
fp->frame_type = !(config->subframe_config.duplex_mode.value); fp->frame_type = config->subframe_config.duplex_mode.value;
fp->L_ssb = config->sch_config.ssb_scg_position_in_burst.value; fp->L_ssb = config->sch_config.ssb_scg_position_in_burst.value;
return nr_init_frame_parms0(fp, return nr_init_frame_parms0(fp,
config->subframe_config.numerology_index_mu.value, config->subframe_config.numerology_index_mu.value,
...@@ -288,6 +288,8 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp) ...@@ -288,6 +288,8 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp)
LOG_I(PHY,"fp->samples_per_frame_wCP=%d\n",fp->samples_per_frame_wCP); LOG_I(PHY,"fp->samples_per_frame_wCP=%d\n",fp->samples_per_frame_wCP);
LOG_I(PHY,"fp->samples_per_subframe=%d\n",fp->samples_per_subframe); LOG_I(PHY,"fp->samples_per_subframe=%d\n",fp->samples_per_subframe);
LOG_I(PHY,"fp->samples_per_frame=%d\n",fp->samples_per_frame); LOG_I(PHY,"fp->samples_per_frame=%d\n",fp->samples_per_frame);
LOG_I(PHY,"fp->dl_CarrierFreq=%u\n",fp->dl_CarrierFreq);
LOG_I(PHY,"fp->ul_CarrierFreq=%u\n",fp->ul_CarrierFreq);
} }
......
...@@ -348,7 +348,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -348,7 +348,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// G = 0; // G = 0;
// G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->Qm, nfapi_ulsch_pdu_rel15->n_layers); // G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->Qm, nfapi_ulsch_pdu_rel15->n_layers);
LOG_I(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb); LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb);
if (harq_process->round == 0) { if (harq_process->round == 0) {
......
...@@ -35,8 +35,10 @@ ...@@ -35,8 +35,10 @@
nr_subframe_t nr_slot_select(nfapi_nr_config_request_t *cfg, nr_subframe_t nr_slot_select(nfapi_nr_config_request_t *cfg,
unsigned char slot) unsigned char slot)
{ {
if (cfg->subframe_config.duplex_mode.value == FDD) if (cfg->subframe_config.duplex_mode.value == FDD || slot == NR_DOWNLINK_SLOT)
return(SF_DL); return(SF_DL);
LOG_E(PHY,"Not developped TDD mode\n"); else if (slot == NR_UPLINK_SLOT)
return (SF_UL);
return -1; return -1;
} }
...@@ -75,30 +75,42 @@ void get_band(uint32_t downlink_frequency, ...@@ -75,30 +75,42 @@ void get_band(uint32_t downlink_frequency,
lte_frame_type_t *current_type) lte_frame_type_t *current_type)
{ {
int ind; int ind;
int64_t dl_freq_khz = downlink_frequency/1000; uint64_t center_frequency_khz;
uint64_t center_freq_diff_khz;
uint64_t dl_freq_khz = downlink_frequency/1000;
center_freq_diff_khz = 999999999999999999; // 2^64
*current_band = 0;
for ( ind=0; for ( ind=0;
ind < sizeof(nr_bandtable) / sizeof(nr_bandtable[0]); ind < sizeof(nr_bandtable) / sizeof(nr_bandtable[0]);
ind++) { ind++) {
*current_band = nr_bandtable[ind].band; LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min);
LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", ind, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min);
if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) { if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) {
center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min)/2;
if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
*current_band = nr_bandtable[ind].band;
*current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000; *current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000;
center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
if (*current_offset == 0) if (*current_offset == 0)
*current_type = TDD; *current_type = TDD;
else else
*current_type = FDD; *current_type = FDD;
}
LOG_I( PHY, "DL frequency %"PRIu32": band %d, frame_type %d, UL frequency %"PRIu32"\n",
downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
break;
} }
} }
AssertFatal(ind != (sizeof(nr_bandtable) / sizeof(nr_bandtable[0])), LOG_I( PHY, "DL frequency %"PRIu32": band %d, frame_type %d, UL frequency %"PRIu32"\n",
"Can't find EUTRA band for frequency %d\n", downlink_frequency); downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
AssertFatal(*current_band != 0,
"Can't find EUTRA band for frequency %u\n", downlink_frequency);
} }
uint32_t to_nrarfcn(int nr_bandP, uint32_t to_nrarfcn(int nr_bandP,
......
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