diff --git a/executables/lte-ru.c b/executables/lte-ru.c index 8d54d13ded..80a4162f00 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -742,7 +742,8 @@ void tx_rf(RU_t *ru, if ((SF_type == SF_DL) || (SF_type == SF_S) ) { - int siglen=fp->samples_per_tti,flags=1; + int siglen=fp->samples_per_tti; + radio_tx_burst_flag_t flags = TX_BURST_MIDDLE; if (SF_type == SF_S) { int txsymb = fp->dl_symbols_in_S_subframe+(ru->is_slave==0 ? 1 : 0); @@ -757,13 +758,13 @@ void tx_rf(RU_t *ru, siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples) + ru->end_of_burst_delay; - flags=3; // end of burst + flags = TX_BURST_END; } if (fp->frame_type == TDD && SF_type == SF_DL && prevSF_type == SF_UL) { - flags = 2; // start of burst + flags = TX_BURST_START; sf_extension = ru->sf_extension; } @@ -781,24 +782,24 @@ void tx_rf(RU_t *ru, LOG_E(PHY,"%d.%d late_control : %d\n",frame,subframe,late_control); switch (late_control) { case STATE_BURST_TERMINATE: - flags=10; // end of burst and no time spec + flags = TX_BURST_END_NO_TIME_SPEC; late_control=STATE_BURST_STOP_1; break; case STATE_BURST_STOP_1: - flags=0; // no send + flags = TX_BURST_INVALID; late_control=STATE_BURST_STOP_2; return;//no send break; case STATE_BURST_STOP_2: - flags=0; // no send + flags = TX_BURST_INVALID; late_control=STATE_BURST_RESTART; return;//no send break; case STATE_BURST_RESTART: - flags=2; // start burst + flags = TX_BURST_START; late_control=STATE_BURST_NORMAL; break; diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 9f6c3574ec..d209d0edf4 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -695,7 +695,8 @@ void ocp_tx_rf(RU_t *ru, L1_rxtx_proc_t *proc) { if ((SF_type == SF_DL) || (SF_type == SF_S)) { - int siglen=fp->samples_per_tti,flags=1; + int siglen=fp->samples_per_tti; + radio_tx_burst_flag_t flags = TX_BURST_MIDDLE; if (SF_type == SF_S) { /* end_of_burst_delay is used to stop TX only "after a while". @@ -708,13 +709,13 @@ void ocp_tx_rf(RU_t *ru, L1_rxtx_proc_t *proc) { siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (fp->dl_symbols_in_S_subframe - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples) + ru->end_of_burst_delay; - flags=3; // end of burst + flags = TX_BURST_END; } if (fp->frame_type == TDD && SF_type == SF_DL && prevSF_type == SF_UL) { - flags = 2; // start of burst + flags = TX_BURST_START; sf_extension = ru->sf_extension; } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 3d9b581a63..6610a96151 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -733,7 +733,8 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { T_INT(0), T_BUFFER(&ru->common.txdata[0][fp->get_samples_slot_timestamp(slot,fp,0)], fp->samples_per_subframe * 4)); int sf_extension = 0; int siglen=fp->get_samples_per_slot(slot,fp); - int flags=0,flags_burst=0,flags_gpio=0; + int flags=0,flags_gpio=0; + radio_tx_burst_flag_t flags_burst = TX_BURST_INVALID; if (cfg->cell_config.frame_duplex_type.value == TDD && !get_softmodem_params()->continuous_tx) { int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame); @@ -760,25 +761,21 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { } //+ ru->end_of_burst_delay; - flags_burst = 3; // end of burst + flags_burst = TX_BURST_END; } else if (slot_type == NR_DOWNLINK_SLOT) { int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame); if (prevslot_type == NR_UPLINK_SLOT) { - flags_burst = 2; // start of burst + flags_burst = TX_BURST_START; sf_extension = ru->sf_extension; } else if (nextslot_type == NR_UPLINK_SLOT) { - flags_burst = 3; // end of burst + flags_burst = TX_BURST_END; } else { - flags_burst = 1; // middle of burst + flags_burst = TX_BURST_MIDDLE; } } } else { // FDD - if (proc->first_tx == 1) { - flags_burst = 2; // start of burst - } else { - flags_burst = 1; // middle of burst - } + flags_burst = proc->first_tx == 1 ? TX_BURST_START : TX_BURST_MIDDLE; } if (fp->freq_range==nr_FR2) { diff --git a/executables/nr-ue.c b/executables/nr-ue.c index cd64a66287..61e12a158f 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -509,7 +509,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) { txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp( proc->nr_slot_tx, &UE->frame_parms, 0)]; - radio_tx_flag_t flags = Invalid; + radio_tx_burst_flag_t flags = TX_BURST_INVALID; NR_UE_MAC_INST_t *mac = get_mac_inst(0); @@ -531,13 +531,13 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) { uint8_t first_tx_slot = tdd_period - num_UL_slots; if (slot_tx_usrp % tdd_period == first_tx_slot) - flags = StartOfBurst; + flags = TX_BURST_START; else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1) - flags = EndOfBurst; + flags = TX_BURST_END; else if (slot_tx_usrp % tdd_period > first_tx_slot) - flags = MiddleOfBurst; + flags = TX_BURST_MIDDLE; } else { - flags = MiddleOfBurst; + flags = TX_BURST_MIDDLE; } if (flags || IS_SOFTMODEM_RFSIM) diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 2db3494956..efb77fdf91 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -152,11 +152,13 @@ typedef enum { /*! \brief Radio Tx burst flags */ typedef enum { - Invalid = 0, - MiddleOfBurst, - StartOfBurst, - EndOfBurst -} radio_tx_flag_t; + TX_BURST_INVALID = 0, + TX_BURST_MIDDLE = 1, + TX_BURST_START = 2, + TX_BURST_END = 3, + TX_BURST_START_AND_END = 4, + TX_BURST_END_NO_TIME_SPEC = 10, +} radio_tx_burst_flag_t; /*! \brief Structure used for initializing UDP read threads */ typedef struct { diff --git a/radio/IRIS/USERSPACE/LIB/iris_lib.cpp b/radio/IRIS/USERSPACE/LIB/iris_lib.cpp index 051efe7a53..32a2f51db0 100644 --- a/radio/IRIS/USERSPACE/LIB/iris_lib.cpp +++ b/radio/IRIS/USERSPACE/LIB/iris_lib.cpp @@ -164,9 +164,9 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf return nsamps; } - if (flags == 2 || flags == 1) { // start of burst + if (flags == TX_BURST_START || flags == TX_BURST_MIDDLE) - } else if (flags == 3 || flags == 4) { + } else if (flags == TX_BURST_END || flags == TX_BURST_START_AND_END) { flag |= SOAPY_SDR_END_BURST; } diff --git a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp index 374411734c..1800c866ce 100644 --- a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -389,7 +389,7 @@ static int trx_usrp_write(openair0_device *device, usrp_state_t *s = (usrp_state_t *)device->priv; int nsamps2; // aligned to upper 32 or 16 byte boundary - int flags_burst = flags&0xf; + radio_tx_burst_flag_t flags_burst = (radio_tx_burst_flag_t) (flags & 0xf); int flags_gpio = (flags>>4)&0x1fff; //MSB to enable sending GPIO command, 12 LSB carry GPIO values int end; @@ -400,22 +400,22 @@ static int trx_usrp_write(openair0_device *device, bool first_packet_state=false,last_packet_state=false; - if (flags_burst == 2) { // start of burst + if (flags_burst == TX_BURST_START) { // s->tx_md.start_of_burst = true; // s->tx_md.end_of_burst = false; first_packet_state = true; last_packet_state = false; - } else if (flags_burst == 3) { // end of burst + } else if (flags_burst == TX_BURST_END) { //s->tx_md.start_of_burst = false; //s->tx_md.end_of_burst = true; first_packet_state = false; last_packet_state = true; - } else if (flags_burst == 4) { // start and end + } else if (flags_burst == TX_BURST_START_AND_END) { // s->tx_md.start_of_burst = true; // s->tx_md.end_of_burst = true; first_packet_state = true; last_packet_state = true; - } else if (flags_burst==1) { // middle of burst + } else if (flags_burst == TX_BURST_MIDDLE) { // s->tx_md.start_of_burst = false; // s->tx_md.end_of_burst = false; first_packet_state = false;