Commit af471c5c authored by Rakesh's avatar Rakesh

reworked as per the new fapi structures

parent 0b3c9220
...@@ -309,12 +309,13 @@ void fh_if5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp) ...@@ -309,12 +309,13 @@ void fh_if5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp)
// southbound IF4p5 fronthaul // southbound IF4p5 fronthaul
void fh_if4p5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp) void fh_if4p5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp)
{ {
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.tti_tx); LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.tti_tx);
if ((nr_slot_select(ru->nr_frame_parms,ru->proc.frame_tx,ru->proc.tti_tx)&NR_DOWNLINK_SLOT) > 0) if ((nr_slot_select(cfg,ru->proc.frame_tx,ru->proc.tti_tx)&NR_DOWNLINK_SLOT) > 0)
send_IF4p5(ru,frame, slot, IF4p5_PDLFFT); send_IF4p5(ru,frame, slot, IF4p5_PDLFFT);
} }
...@@ -517,7 +518,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *slot) { ...@@ -517,7 +518,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *slot) {
void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) {
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config; nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
uint16_t packet_type; uint16_t packet_type;
uint32_t symbol_number,symbol_mask,symbol_mask_full=0; uint32_t symbol_number,symbol_mask,symbol_mask_full=0;
...@@ -530,10 +531,10 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { ...@@ -530,10 +531,10 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) {
do { do {
recv_IF4p5(ru, &frame_tx, &slot_tx, &packet_type, &symbol_number); recv_IF4p5(ru, &frame_tx, &slot_tx, &packet_type, &symbol_number);
if (((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT) > 0) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); if (((nr_slot_select(cfg,frame_tx,slot_tx) & NR_DOWNLINK_SLOT) > 0) && (symbol_number == 0)) start_meas(&ru->rx_fhaul);
LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n",
*slot,nr_slot_select(ru->nr_frame_parms,frame_tx,*slot),frame_tx,slot_tx,symbol_number); *slot,nr_slot_select(cfg,frame_tx,*slot),frame_tx,slot_tx,symbol_number);
if (proc->first_tx != 0) { if (proc->first_tx != 0) {
*frame = frame_tx; *frame = frame_tx;
...@@ -552,7 +553,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { ...@@ -552,7 +553,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) {
} else AssertFatal(1==0,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type); } else AssertFatal(1==0,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type);
} while (symbol_mask != symbol_mask_full); } while (symbol_mask != symbol_mask_full);
if ((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT)>0) stop_meas(&ru->rx_fhaul); if ((nr_slot_select(cfg,frame_tx,slot_tx) & NR_DOWNLINK_SLOT)>0) stop_meas(&ru->rx_fhaul);
proc->tti_tx = slot_tx; proc->tti_tx = slot_tx;
proc->frame_tx = frame_tx; proc->frame_tx = frame_tx;
...@@ -715,24 +716,28 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -715,24 +716,28 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
//nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config; nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
void *txp[ru->nb_tx]; void *txp[ru->nb_tx];
unsigned int txs; unsigned int txs;
int i; int i,txsymb;
T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot), T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot),
T_INT(0), T_BUFFER(&ru->common.txdata[0][slot * fp->samples_per_slot], fp->samples_per_slot * 4)); T_INT(0), T_BUFFER(&ru->common.txdata[0][slot * fp->samples_per_slot], fp->samples_per_slot * 4));
int slot_type = nr_slot_select(ru->nr_frame_parms,frame,slot%fp->slots_per_frame); int slot_type = nr_slot_select(cfg,frame,slot%((1<<cfg->ssb_config.scs_common.value)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME));
int prevslot_type = nr_slot_select(ru->nr_frame_parms,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); int prevslot_type = nr_slot_select(cfg,frame,(slot+(((1<<cfg->ssb_config.scs_common.value)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)-1))%((1<<cfg->ssb_config.scs_common.value)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME));
int sf_extension = 0; int sf_extension = 0;
//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);
if (slot_type == NR_DOWNLINK_SLOT || if (slot_type == NR_DOWNLINK_SLOT ||
slot_type == NR_S_SLOT) { slot_type == NR_MIXED_SLOT) {
int siglen=fp->samples_per_tti,flags=1; int siglen=fp->samples_per_tti,flags=1;
if(slot_type == NR_S_SLOT) { if(slot_type == NR_MIXED_SLOT) {
int txsymb = fp->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols; txsymb = 0;
for(int symbol_count =0;symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT;symbol_count++) {
if (cfg->tdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
txsymb++;
}
}
AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb);
siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)
+ (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples);
...@@ -740,7 +745,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -740,7 +745,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
flags=3; // end of burst flags=3; // end of burst
} }
if (fp->frame_type == TDD && if (cfg->cell_config.frame_duplex_type.value == TDD &&
slot_type == NR_DOWNLINK_SLOT && slot_type == NR_DOWNLINK_SLOT &&
prevslot_type == NR_UPLINK_SLOT) { prevslot_type == NR_UPLINK_SLOT) {
flags = 2; // start of burst flags = 2; // start of burst
...@@ -812,6 +817,7 @@ void *ru_thread_asynch_rxtx( void *param ) { ...@@ -812,6 +817,7 @@ void *ru_thread_asynch_rxtx( void *param ) {
static int ru_thread_asynch_rxtx_status; static int ru_thread_asynch_rxtx_status;
RU_t *ru = (RU_t *)param; RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
int slot=0, frame=0; int slot=0, frame=0;
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
wait_sync("ru_thread_asynch_rxtx"); wait_sync("ru_thread_asynch_rxtx");
...@@ -835,7 +841,7 @@ void *ru_thread_asynch_rxtx( void *param ) { ...@@ -835,7 +841,7 @@ void *ru_thread_asynch_rxtx( void *param ) {
// asynchronous receive from north (RRU IF4/IF5) // asynchronous receive from north (RRU IF4/IF5)
if (ru->fh_north_asynch_in) { if (ru->fh_north_asynch_in) {
if ((nr_slot_select(ru->nr_frame_parms,frame,slot) & NR_DOWNLINK_SLOT)>0) if ((nr_slot_select(cfg,frame,slot) & NR_DOWNLINK_SLOT)>0)
ru->fh_north_asynch_in(ru,&frame,&slot); ru->fh_north_asynch_in(ru,&frame,&slot);
} else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n"); } else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n");
} }
......
...@@ -390,7 +390,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -390,7 +390,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
} }
memcpy((void*)&gNB_config->prach_config,(void*)&phy_config->cfg->prach_config,sizeof(phy_config->cfg->prach_config)); memcpy((void*)&gNB_config->prach_config,(void*)&phy_config->cfg->prach_config,sizeof(phy_config->cfg->prach_config));
memcpy((void*)&gNB_config->tdd_ul_dl_config,(void*)&phy_config->cfg->tdd_ul_dl_config,sizeof(phy_config->cfg->tdd_ul_dl_config)); memcpy((void*)&gNB_config->tdd_table,(void*)&phy_config->cfg->tdd_table,sizeof(phy_config->cfg->tdd_table));
RC.gNB[Mod_id]->mac_enabled = 1; RC.gNB[Mod_id]->mac_enabled = 1;
fp->dl_CarrierFreq = (gNB_config->carrier_config.dl_frequency.value)*1e3 + (gNB_config->carrier_config.dl_bandwidth.value)*5e5; fp->dl_CarrierFreq = (gNB_config->carrier_config.dl_frequency.value)*1e3 + (gNB_config->carrier_config.dl_bandwidth.value)*5e5;
...@@ -411,21 +411,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -411,21 +411,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
nr_init_frame_parms(gNB_config, fp); nr_init_frame_parms(gNB_config, fp);
if(gNB_config->subframe_config.duplex_mode.value == TDD){
return_tdd = set_tdd_config_nr(fp,
gNB_config->tdd_ul_dl_config.dl_ul_periodicity.value,
gNB_config->tdd_ul_dl_config.nrofDownlinkSlots.value,
gNB_config->tdd_ul_dl_config.nrofDownlinkSymbols.value,
gNB_config->tdd_ul_dl_config.nrofUplinkSlots.value,
gNB_config->tdd_ul_dl_config.nrofUplinkSymbols.value
);
if (return_tdd !=0){
LOG_E(PHY,"TDD configuration can not be done\n");
}
else LOG_I(PHY,"TDD has been properly configurated\n");
}
if (RC.gNB[Mod_id]->configured == 1) { if (RC.gNB[Mod_id]->configured == 1) {
LOG_E(PHY,"Already gNB already configured, do nothing\n"); LOG_E(PHY,"Already gNB already configured, do nothing\n");
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#define LTE_CE_OFFSET LTE_CE_FILTER_LENGTH #define LTE_CE_OFFSET LTE_CE_FILTER_LENGTH
#define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1) #define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1)
#define PBCH_PDU_SIZE 3 //bytes #define PBCH_PDU_SIZE 3 //bytes
#define NR_NUMBER_OF_SYMBOLS_PER_SLOT 14
#define PRACH_SYMBOL 3 //position of the UL PSS wrt 2nd slot of special subframe #define PRACH_SYMBOL 3 //position of the UL PSS wrt 2nd slot of special subframe
......
...@@ -97,7 +97,7 @@ SystemInformationBlockType1_nr_t; ...@@ -97,7 +97,7 @@ SystemInformationBlockType1_nr_t;
#define NR_DOWNLINK_SLOT (0x01) #define NR_DOWNLINK_SLOT (0x01)
#define NR_UPLINK_SLOT (0x02) #define NR_UPLINK_SLOT (0x02)
#define NR_S_SLOT (0x03) #define NR_MIXED_SLOT (0x03)
#define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */ #define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */
......
...@@ -114,6 +114,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -114,6 +114,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
struct timespec wait; struct timespec wait;
int slot = tti_tx; int slot = tti_tx;
...@@ -122,7 +123,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -122,7 +123,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
start_meas(&ru->ofdm_mod_stats); start_meas(&ru->ofdm_mod_stats);
if (nr_slot_select(fp,frame_tx,slot) == NR_UPLINK_SLOT) return; if (nr_slot_select(cfg,frame_tx,slot) == NR_UPLINK_SLOT) return;
// this copy should be done in the precoding thread (currently inactive) // this copy should be done in the precoding thread (currently inactive)
for (int aa=0;aa<ru->nb_tx;aa++) for (int aa=0;aa<ru->nb_tx;aa++)
...@@ -131,7 +132,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -131,7 +132,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 );
if (nr_slot_select(fp,frame_tx,slot)==SF_DL) { if (nr_slot_select(cfg,frame_tx,slot)==NR_DOWNLINK_SLOT) {
// If this is not an S-tti // If this is not an S-tti
if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) { if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) {
printf("[RU] ERROR pthread_mutex_lock for feptx thread (IC %d)\n", proc->instance_cnt_feptx); printf("[RU] ERROR pthread_mutex_lock for feptx thread (IC %d)\n", proc->instance_cnt_feptx);
...@@ -161,7 +162,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -161,7 +162,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
} }
// call first half-slot in this thread // call first half-slot in this thread
nr_feptx0(ru,slot,0,fp->symbols_per_slot>>1); nr_feptx0(ru,slot,0,NR_NUMBER_OF_SYMBOLS_PER_SLOT>>1);
wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"NR feptx thread"); wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"NR feptx thread");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
...@@ -213,6 +214,7 @@ void nr_init_feptx_thread(RU_t *ru) { ...@@ -213,6 +214,7 @@ void nr_init_feptx_thread(RU_t *ru) {
// seems to be hardcoded to numerology 1 (2 slots=1 subframe) // seems to be hardcoded to numerology 1 (2 slots=1 subframe)
void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
int cyclic_prefix_type = NFAPI_CP_NORMAL; int cyclic_prefix_type = NFAPI_CP_NORMAL;
...@@ -230,11 +232,11 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -230,11 +232,11 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
memcpy((void*)ru->common.txdataF_BF[aa], memcpy((void*)ru->common.txdataF_BF[aa],
(void*)ru->gNB_list[0]->common_vars.txdataF[aa], fp->samples_per_slot_wCP*sizeof(int32_t)); (void*)ru->gNB_list[0]->common_vars.txdataF[aa], fp->samples_per_slot_wCP*sizeof(int32_t));
if ((nr_slot_select(fp,frame_tx,slot)==SF_DL)|| if ((nr_slot_select(cfg,frame_tx,slot)==NR_DOWNLINK_SLOT)||
((nr_slot_select(fp,frame_tx,slot)==SF_S))) { ((nr_slot_select(cfg,frame_tx,slot)==NR_MIXED_SLOT))) {
// LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot);
nr_feptx0(ru,slot,0,fp->symbols_per_slot); nr_feptx0(ru,slot,0,NR_NUMBER_OF_SYMBOLS_PER_SLOT);
} }
...@@ -270,7 +272,7 @@ void nr_fep0(RU_t *ru, int first_half) { ...@@ -270,7 +272,7 @@ void nr_fep0(RU_t *ru, int first_half) {
end_symbol = NR_SYMBOLS_PER_SLOT; end_symbol = NR_SYMBOLS_PER_SLOT;
} }
LOG_I(PHY,"In fep0 for slot = %d, first_half = %d, start_symbol = %d, end_symbol = %d\n", proc->tti_rx, first_half, start_symbol, end_symbol); LOG_D(PHY,"In fep0 for slot = %d, first_half = %d, start_symbol = %d, end_symbol = %d\n", proc->tti_rx, first_half, start_symbol, end_symbol);
// printf("fep0: slot %d\n",slot); // printf("fep0: slot %d\n",slot);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 1);
......
...@@ -51,41 +51,62 @@ ...@@ -51,41 +51,62 @@
* *
*********************************************************************/ *********************************************************************/
int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeriodicity, int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg,
int mu, int dl_UL_TransmissionPeriodicity,
int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofDownlinkSlots, int nrofDownlinkSymbols,
int nrofUplinkSlots, int nrofUplinkSymbols) int nrofUplinkSlots, int nrofUplinkSymbols)
{ {
TDD_UL_DL_configCommon_t *p_tdd_ul_dl_configuration;
int slot_number = 0; int slot_number = 0;
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(frame_parms->slots_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME;
/* allocate buffer for configuration structure */
p_tdd_ul_dl_configuration = calloc( 1, sizeof(TDD_UL_DL_configCommon_t));
if (p_tdd_ul_dl_configuration == NULL) {
printf("Error test_frame_configuration: memory allocation problem \n");
assert(0);
}
else {
frame_parms->frame_type = TDD;
}
p_tdd_ul_dl_configuration->dl_UL_TransmissionPeriodicity = dl_UL_TransmissionPeriodicity;
p_tdd_ul_dl_configuration->nrofDownlinkSlots = nrofDownlinkSlots;
p_tdd_ul_dl_configuration->nrofDownlinkSymbols = nrofDownlinkSymbols;
p_tdd_ul_dl_configuration->nrofUplinkSlots = nrofUplinkSlots;
p_tdd_ul_dl_configuration->nrofUplinkSymbols = nrofUplinkSymbols;
frame_parms->p_tdd_UL_DL_Configuration = p_tdd_ul_dl_configuration;
int nb_periods_per_frame = (FRAME_DURATION_MICRO_SEC/dl_UL_TransmissionPeriodicity); int nb_periods_per_frame = (FRAME_DURATION_MICRO_SEC/dl_UL_TransmissionPeriodicity);
int nb_slots_per_period = ((1<<frame_parms->numerology_index) * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame; int nb_slots_per_period = ((1<<mu) * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame;
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots + 1), AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots + 1),
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nb_slots_per_period %d \n", "set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nb_slots_per_period %d \n",
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period); nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols); AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols);
cfg->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_to_set*sizeof(nfapi_nr_max_tdd_periodicity_t));
for(int memory_alloc =0 ; memory_alloc<nb_slots_to_set;memory_alloc++) {
cfg->tdd_table.max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list = (nfapi_nr_max_num_of_symbol_per_slot_t *) malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT*sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
}
while(slot_number != nb_slots_to_set) {
if(nrofDownlinkSlots != 0) {
for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.value= 0;
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0) {
slot_number++;
}
}
}
if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
for(int number_of_symbol =0; number_of_symbol < nrofDownlinkSymbols; number_of_symbol++){
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 0;
}
for(int number_of_symbol = nrofDownlinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol++){
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 2;
}
for(int number_of_symbol = NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++){
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 1;
}
slot_number++;
}
if(nrofUplinkSlots != 0) {
for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.value= 1;
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0) {
slot_number++;
}
}
}
}
/*
while(slot_number != nb_slots_to_set) { while(slot_number != nb_slots_to_set) {
for (int number_of_slot = 0; number_of_slot < nrofDownlinkSlots; number_of_slot++) { for (int number_of_slot = 0; number_of_slot < nrofDownlinkSlots; number_of_slot++) {
frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_DOWNLINK_SLOT; frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_DOWNLINK_SLOT;
...@@ -93,7 +114,7 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri ...@@ -93,7 +114,7 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri
slot_number++; slot_number++;
} }
if (p_tdd_ul_dl_configuration->nrofDownlinkSymbols != 0 || p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) { if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
frame_parms->tdd_uplink_nr[slot_number] = (1<<nrofUplinkSymbols) - 1; frame_parms->tdd_uplink_nr[slot_number] = (1<<nrofUplinkSymbols) - 1;
printf("slot %d set as SL\n",slot_number); printf("slot %d set as SL\n",slot_number);
slot_number++; slot_number++;
...@@ -105,16 +126,16 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri ...@@ -105,16 +126,16 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri
slot_number++; slot_number++;
} }
/*if (p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) { if (p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) {
LOG_E(PHY,"set_tdd_configuration_nr: uplink symbol for slot is not supported for tdd configuration \n"); LOG_E(PHY,"set_tdd_configuration_nr: uplink symbol for slot is not supported for tdd configuration \n");
return (-1); return (-1);
}*/ }
} }
if (frame_parms->p_tdd_UL_DL_ConfigurationCommon2 != NULL) { if (frame_parms->p_tdd_UL_DL_ConfigurationCommon2 != NULL) {
LOG_E(PHY,"set_tdd_configuration_nr: additionnal tdd configuration 2 is not supported for tdd configuration \n"); LOG_E(PHY,"set_tdd_configuration_nr: additionnal tdd configuration 2 is not supported for tdd configuration \n");
return (-1); return (-1);
} }*/
return (0); return (0);
} }
...@@ -253,29 +274,58 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) ...@@ -253,29 +274,58 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms)
* *
*********************************************************************/ *********************************************************************/
int nr_slot_select(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti) int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti)
{ {
/* for FFD all slot can be considered as an uplink */ /* for FFD all slot can be considered as an uplink */
if (frame_parms->frame_type == FDD) { int mu = cfg->ssb_config.scs_common.value,check_slot=0;
if (cfg->cell_config.frame_duplex_type.value == FDD) {
return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT ); return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT );
} }
if (nr_frame%2 == 0) { if (nr_frame%2 == 0) {
if (frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_UPLINK_SLOT) { for(int symbol_count=0;symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT;symbol_count++) {
if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
check_slot++;
}
}
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
return (NR_UPLINK_SLOT); return (NR_UPLINK_SLOT);
} }
else if(frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_DOWNLINK_SLOT){ check_slot = 0;
for(int symbol_count=0;symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT;symbol_count++) {
if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
check_slot++;
}
}
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
return (NR_DOWNLINK_SLOT); return (NR_DOWNLINK_SLOT);
} }
else return (NR_S_SLOT); else {
} return (NR_MIXED_SLOT);
else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_UPLINK_SLOT)) { }
return (NR_UPLINK_SLOT); } else {
} for(int symbol_count=0;symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT;symbol_count++) {
else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_DOWNLINK_SLOT)) { if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
return (NR_DOWNLINK_SLOT); check_slot++;
}
}
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
return (NR_UPLINK_SLOT);
}
check_slot = 0;
for(int symbol_count=0;symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT;symbol_count++) {
if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
check_slot++;
}
}
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
return (NR_DOWNLINK_SLOT);
}
else {
return (NR_MIXED_SLOT);
}
} }
else return (NR_S_SLOT);
} }
/******************************************************************* /*******************************************************************
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
* @param nrofUplinkSymbols number of uplink symbols * @param nrofUplinkSymbols number of uplink symbols
@returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */ @returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */
int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeriodicity, int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, int mu,int dl_UL_TransmissionPeriodicity,
int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofDownlinkSlots, int nrofDownlinkSymbols,
int nrofUplinkSlots, int nrofUplinkSymbols); int nrofUplinkSlots, int nrofUplinkSymbols);
...@@ -78,7 +78,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); ...@@ -78,7 +78,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms);
* @param nr_tti : slot number * @param nr_tti : slot number
@returns nr_slot_t : downlink or uplink */ @returns nr_slot_t : downlink or uplink */
nr_slot_t nr_slot_select(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti); nr_slot_t nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti);
/** \brief This function frees tdd configuration for nr /** \brief This function frees tdd configuration for nr
* @param frame_parms NR DL Frame parameters * @param frame_parms NR DL Frame parameters
......
...@@ -159,7 +159,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -159,7 +159,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ; // 10ms is the frame length ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ; // 10ms is the frame length
if ((cfg->cell_config.frame_duplex_type.value == TDD) && if ((cfg->cell_config.frame_duplex_type.value == TDD) &&
((nr_slot_select(fp,frame,slot)&NR_UPLINK_SLOT) > 0)) return; ((nr_slot_select(cfg,frame,slot)&NR_UPLINK_SLOT) > 0)) return;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1);
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* @param nrofUplinkSymbols number of uplink symbols * @param nrofUplinkSymbols number of uplink symbols
@returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */ @returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */
int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeriodicity, int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, int mu, int dl_UL_TransmissionPeriodicity,
int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofDownlinkSlots, int nrofDownlinkSymbols,
int nrofUplinkSlots, int nrofUplinkSymbols); int nrofUplinkSlots, int nrofUplinkSymbols);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "NR_ServingCellConfigCommon.h" #include "NR_ServingCellConfigCommon.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "SCHED_NR/phy_frame_config_nr.h"
#include "NR_MIB.h" #include "NR_MIB.h"
...@@ -226,14 +227,6 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { ...@@ -226,14 +227,6 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) {
RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc; RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc;
int i; int i;
// TDD Configuration
cfg->tdd_ul_dl_config.referenceSubcarrierSpacing.value = scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
cfg->tdd_ul_dl_config.dl_ul_periodicity.value = 5000;//scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;// rakesh:need to configure properly
cfg->tdd_ul_dl_config.nrofDownlinkSlots.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots;
cfg->tdd_ul_dl_config.nrofDownlinkSymbols.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols;
cfg->tdd_ul_dl_config.nrofUplinkSlots.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
cfg->tdd_ul_dl_config.nrofUplinkSymbols.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
// Carrier configuration // Carrier configuration
cfg->carrier_config.dl_bandwidth.value = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, cfg->carrier_config.dl_bandwidth.value = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
...@@ -408,9 +401,26 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { ...@@ -408,9 +401,26 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) {
cfg->num_tlv++; cfg->num_tlv++;
// TDD Table Configuration // TDD Table Configuration
cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; //cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG; cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
if(cfg->cell_config.frame_duplex_type.value == TDD){
int return_tdd = set_tdd_config_nr(cfg,
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
5000,
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
);
if (return_tdd !=0){
LOG_E(PHY,"TDD configuration can not be done\n");
}
else LOG_I(PHY,"TDD has been properly configurated\n");
}
/* /*
......
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