Merge branch 'develop-nr' into nr_pdcch
Conflicts: cmake_targets/CMakeLists.txt
This commit is contained in:
+116
-22
@@ -42,6 +42,8 @@
|
||||
|
||||
#include "fapi_nr_ue_l1.h"
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
|
||||
@@ -65,6 +67,69 @@ extern double cpuf;
|
||||
static nfapi_nr_config_request_t config_t;
|
||||
static nfapi_nr_config_request_t* config =&config_t;
|
||||
|
||||
/*
|
||||
* NR SLOT PROCESSING SEQUENCE
|
||||
*
|
||||
* Processing occurs with following steps for connected mode:
|
||||
*
|
||||
* - Rx samples for a slot are received,
|
||||
* - PDCCH processing (including DCI extraction for downlink and uplink),
|
||||
* - PDSCH processing (including transport blocks decoding),
|
||||
* - PUCCH/PUSCH (transmission of acknowledgements, CSI, ... or data).
|
||||
*
|
||||
* Time between reception of the slot and related transmission depends on UE processing performance.
|
||||
* It is defined by the value NR_UE_CAPABILITY_SLOT_RX_TO_TX.
|
||||
*
|
||||
* In NR, network gives the duration between Rx slot and Tx slot in the DCI:
|
||||
* - for reception of a PDSCH and its associated acknowledgment slot (with a PUCCH or a PUSCH),
|
||||
* - for reception of an uplink grant and its associated PUSCH slot.
|
||||
*
|
||||
* So duration between reception and it associated transmission depends on its transmission slot given in the DCI.
|
||||
* NR_UE_CAPABILITY_SLOT_RX_TO_TX means the minimum duration but higher duration can be given by the network because UE can support it.
|
||||
*
|
||||
* Slot k
|
||||
* -------+------------+--------
|
||||
* Frame | Tx samples |
|
||||
* Subframe | buffer |
|
||||
* Slot n -------+------------+--------
|
||||
* ------ +------------+-------- |
|
||||
* | Rx samples | |
|
||||
* | buffer | |
|
||||
* -------+------------+-------- |
|
||||
* | |
|
||||
* V |
|
||||
* +------------+ |
|
||||
* | PDCCH | |
|
||||
* | processing | |
|
||||
* +------------+ |
|
||||
* | | |
|
||||
* | v |
|
||||
* | +------------+ |
|
||||
* | | PDSCH | |
|
||||
* | | processing | decoding result |
|
||||
* | +------------+ -> ACK/NACK of PDSCH |
|
||||
* | | |
|
||||
* | v |
|
||||
* | +-------------+------------+ |
|
||||
* | | PUCCH/PUSCH | Tx samples | |
|
||||
* | | processing | transfer | |
|
||||
* | +-------------+------------+ |
|
||||
* | |
|
||||
* |/___________________________________________________________\|
|
||||
* \ duration between reception and associated transmission /
|
||||
*
|
||||
* Remark: processing is done slot by slot, it can be distribute on different threads which are executed in parallel.
|
||||
* This is an architecture optimization in order to cope with real time constraints.
|
||||
* By example, for LTE, subframe processing is spread over 4 different threads.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NO_RAT_NR
|
||||
#define DURATION_RX_TO_TX (NR_UE_CAPABILITY_SLOT_RX_TO_TX) /* for NR this will certainly depends to such UE capability which is not yet defined */
|
||||
#else
|
||||
#define DURATION_RX_TO_TX (4) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */
|
||||
#endif
|
||||
|
||||
#define FRAME_PERIOD 100000000ULL
|
||||
#define DAQ_PERIOD 66667ULL
|
||||
#define FIFO_PRIORITY 40
|
||||
@@ -331,7 +396,7 @@ static void *UE_thread_synch(void *arg) {
|
||||
switch (sync_mode) {
|
||||
case pss:
|
||||
LOG_I(PHY,"[SCHED][UE] Scanning band %d (%d), freq %u\n",bands_to_scan.band_info[current_band].band, current_band,bands_to_scan.band_info[current_band].dl_min+current_offset);
|
||||
lte_sync_timefreq(UE,current_band,bands_to_scan.band_info[current_band].dl_min+current_offset);
|
||||
//lte_sync_timefreq(UE,current_band,bands_to_scan.band_info[current_band].dl_min+current_offset);
|
||||
current_offset += 20000000; // increase by 20 MHz
|
||||
|
||||
if (current_offset > bands_to_scan.band_info[current_band].dl_max-bands_to_scan.band_info[current_band].dl_min) {
|
||||
@@ -425,7 +490,7 @@ static void *UE_thread_synch(void *arg) {
|
||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||
// sleep(1);
|
||||
nr_init_frame_parms_ue(config,&UE->frame_parms);
|
||||
nr_init_frame_parms_ue(&UE->frame_parms);
|
||||
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
@@ -584,9 +649,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
|
||||
#ifndef NO_RAT_NR
|
||||
// Process Rx data for one sub-frame
|
||||
nr_slot_t nr_slot ; //= slot_select_nr(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx);
|
||||
|
||||
if (nr_slot == NR_TDD_DOWNLINK_SLOT) {
|
||||
if (slot_select_nr(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx) & NR_DOWNLINK_SLOT) {
|
||||
#else
|
||||
// Process Rx data for one sub-frame
|
||||
lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx);
|
||||
@@ -614,7 +677,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
#ifdef UE_SLOT_PARALLELISATION
|
||||
phy_procedures_slot_parallelization_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
#else
|
||||
phy_procedures_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
phy_procedures_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -630,7 +693,8 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
UE->ul_indication.module_id = 0;
|
||||
UE->ul_indication.gNB_index = 0;
|
||||
UE->ul_indication.cc_id = 0;
|
||||
|
||||
UE->ul_indication.slot = 0; // to be fill
|
||||
UE->ul_indication.frame = 0; // to be fill
|
||||
// [TODO] mapping right after NR initial sync
|
||||
//UE->ul_indication.frame = ;
|
||||
//UE->ul_indication.slot = ;
|
||||
@@ -692,17 +756,22 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
|
||||
// Prepare the future Tx data
|
||||
#if 0
|
||||
#ifndef NO_RAT_NR
|
||||
if (slot_select_nr(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx) & NR_UPLINK_SLOT)
|
||||
#else
|
||||
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
|
||||
(UE->frame_parms.frame_type == FDD) )
|
||||
if (UE->mode != loop_through_memory)
|
||||
phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
|
||||
(UE->frame_parms.frame_type == TDD))
|
||||
if (UE->mode != loop_through_memory)
|
||||
//phy_procedures_UE_S_TX(UE,0,0,no_relay);
|
||||
updateTimes(current, &t3, 10000, timing_proc_name);
|
||||
#endif
|
||||
|
||||
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
|
||||
@@ -806,7 +875,7 @@ void *UE_thread(void *arg) {
|
||||
if (UE->mode != loop_through_memory) {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
rxp[i] = (void*)&dummy_rx[i][0];
|
||||
for (int sf=0; sf<10; sf++)
|
||||
for (int sf=0; sf<LTE_NUMBER_OF_SUBFRAMES_PER_FRAME; sf++)
|
||||
// printf("Reading dummy sf %d\n",sf);
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
@@ -823,13 +892,28 @@ void *UE_thread(void *arg) {
|
||||
start_rx_stream=1;
|
||||
if (UE->mode != loop_through_memory) {
|
||||
if (UE->no_timing_correction==0) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
|
||||
printf("before resync\n");
|
||||
//nr_slot_fep(UE,0, 0, UE->rx_offset, 1, 1, NR_PDCCH_EST);
|
||||
//nr_slot_fep(UE,1, 0, UE->rx_offset, 1, 1, NR_PDCCH_EST);
|
||||
|
||||
//write_output("txdata_pre.m", "txdata_pre", UE->common_vars.rxdata[0], UE->frame_parms.samples_per_subframe*10, 1, 1);
|
||||
|
||||
/*LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
|
||||
AssertFatal(UE->rx_offset ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void**)UE->common_vars.rxdata,
|
||||
UE->rx_offset,
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
|
||||
AssertFatal(UE->frame_parms.samples_per_subframe*10 ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void**)UE->common_vars.rxdata,
|
||||
UE->frame_parms.samples_per_subframe*10,
|
||||
UE->frame_parms.nb_antennas_rx),"");*/
|
||||
|
||||
//write_output("txdataF_ue.m", "txdataF_ue", UE->common_vars.rxdata[0], UE->frame_parms.samples_per_subframe*10, 1, 1);
|
||||
}
|
||||
UE->rx_offset=0;
|
||||
UE->time_sync_cell=0;
|
||||
@@ -838,6 +922,8 @@ void *UE_thread(void *arg) {
|
||||
for (th_id=0; th_id < RX_NB_TH; th_id++) {
|
||||
UE->proc.proc_rxtx[th_id].frame_rx++;
|
||||
}
|
||||
|
||||
//printf("first stream frame rx %d\n",UE->proc.proc_rxtx[0].frame_rx);
|
||||
|
||||
// read in first symbol
|
||||
AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 ==
|
||||
@@ -846,14 +932,16 @@ void *UE_thread(void *arg) {
|
||||
(void**)UE->common_vars.rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
nr_slot_fep(UE,0, 0, 0, 0, 0, NR_PBCH_EST);
|
||||
//write_output("txdata_sym.m", "txdata_sym", UE->common_vars.rxdata[0], (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0), 1, 1);
|
||||
//nr_slot_fep(UE,0, 0, 0, 1, 1, NR_PDCCH_EST);
|
||||
} //UE->mode != loop_through_memory
|
||||
else
|
||||
rt_sleep_ns(1000*1000);
|
||||
|
||||
} else {
|
||||
tti_nr++;
|
||||
tti_nr%=10*UE->frame_parms.ttis_per_subframe;
|
||||
int ttis_per_frame = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*UE->frame_parms.ttis_per_subframe;
|
||||
tti_nr %= ttis_per_frame;
|
||||
UE_nr_rxtx_proc_t *proc = &UE->proc.proc_rxtx[thread_idx];
|
||||
// update thread index for received subframe
|
||||
UE->current_thread_id[tti_nr] = thread_idx;
|
||||
@@ -874,7 +962,7 @@ void *UE_thread(void *arg) {
|
||||
txp[i] = (void*)&UE->common_vars.txdata[i][((tti_nr+2)%10*UE->frame_parms.ttis_per_subframe)*UE->frame_parms.samples_per_tti];
|
||||
|
||||
int readBlockSize, writeBlockSize;
|
||||
if (tti_nr<(10*UE->frame_parms.ttis_per_subframe-1)) {
|
||||
if (tti_nr<(ttis_per_frame - 1)) {
|
||||
readBlockSize=UE->frame_parms.samples_per_tti;
|
||||
writeBlockSize=UE->frame_parms.samples_per_tti;
|
||||
} else {
|
||||
@@ -897,7 +985,7 @@ void *UE_thread(void *arg) {
|
||||
UE->rx_offset_diff;
|
||||
}
|
||||
|
||||
AssertFatal(readBlockSize ==
|
||||
/*AssertFatal(readBlockSize ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
@@ -912,17 +1000,17 @@ void *UE_thread(void *arg) {
|
||||
txp,
|
||||
writeBlockSize,
|
||||
UE->frame_parms.nb_antennas_tx,
|
||||
1),"");
|
||||
if( tti_nr==(10*UE->frame_parms.ttis_per_subframe-1)) {
|
||||
1),"");*/
|
||||
if( tti_nr==(ttis_per_frame-1)) {
|
||||
// read in first symbol of next frame and adjust for timing drift
|
||||
int first_symbols=writeBlockSize-readBlockSize;
|
||||
if ( first_symbols > 0 )
|
||||
AssertFatal(first_symbols ==
|
||||
/*AssertFatal(first_symbols ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp1,
|
||||
(void**)UE->common_vars.rxdata,
|
||||
first_symbols,
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
UE->frame_parms.nb_antennas_rx),"");*/
|
||||
if ( first_symbols <0 )
|
||||
LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
|
||||
}
|
||||
@@ -950,13 +1038,19 @@ void *UE_thread(void *arg) {
|
||||
for (th_id=0; th_id < RX_NB_TH; th_id++) {
|
||||
UE->proc.proc_rxtx[th_id].gotIQs=readTime(gotIQs);
|
||||
}
|
||||
|
||||
proc->nr_tti_rx=tti_nr;
|
||||
proc->nr_tti_tx=(tti_nr+4)%(10*UE->frame_parms.ttis_per_subframe);
|
||||
proc->subframe_rx=tti_nr>>((uint8_t)(log2 (UE->frame_parms.ttis_per_subframe)));
|
||||
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
|
||||
|
||||
proc->frame_tx = proc->frame_rx;
|
||||
proc->nr_tti_tx= tti_nr + DURATION_RX_TO_TX;
|
||||
if (proc->nr_tti_tx > ttis_per_frame) {
|
||||
proc->frame_tx = (proc->frame_tx + 1)%MAX_FRAME_NUMBER;
|
||||
proc->nr_tti_tx %= ttis_per_frame;
|
||||
}
|
||||
proc->subframe_tx=(proc->nr_tti_tx)>>((uint8_t)(log2 (UE->frame_parms.ttis_per_subframe)));
|
||||
proc->timestamp_tx = timestamp+
|
||||
(4*UE->frame_parms.samples_per_tti)-
|
||||
(DURATION_RX_TO_TX*UE->frame_parms.samples_per_tti)-
|
||||
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
|
||||
|
||||
proc->instance_cnt_rxtx++;
|
||||
@@ -1097,7 +1191,7 @@ void fill_ue_band_info(void) {
|
||||
int setup_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg) {
|
||||
|
||||
int i, CC_id;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
openair0_rf_map *rf_map;
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
@@ -245,7 +245,7 @@ int emulate_rf = 0;
|
||||
threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
/* forward declarations */
|
||||
void set_default_frame_parms(nfapi_nr_config_request_t *config[MAX_NUM_CCs], NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
||||
void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
||||
|
||||
|
||||
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
|
||||
@@ -628,7 +628,7 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */
|
||||
int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
|
||||
#endif
|
||||
|
||||
void set_default_frame_parms(nfapi_nr_config_request_t *config[MAX_NUM_CCs], NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
|
||||
int CC_id;
|
||||
|
||||
@@ -700,7 +700,6 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA
|
||||
//int CC_id;
|
||||
|
||||
//for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
frame_parms = (NR_DL_FRAME_PARMS*) malloc(sizeof(NR_DL_FRAME_PARMS));
|
||||
/* Set some default values that may be overwritten while reading options */
|
||||
frame_parms = (NR_DL_FRAME_PARMS*) malloc(sizeof(NR_DL_FRAME_PARMS));
|
||||
config = (nfapi_nr_config_request_t*) malloc(sizeof(nfapi_nr_config_request_t));
|
||||
@@ -899,7 +898,7 @@ int main( int argc, char **argv ) {
|
||||
set_latency_target();
|
||||
|
||||
// set default parameters
|
||||
set_default_frame_parms(config,frame_parms);
|
||||
set_default_frame_parms(frame_parms);
|
||||
|
||||
// initialize logging
|
||||
logInit();
|
||||
@@ -985,6 +984,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
// set_default_frame_parms(frame_parms);//
|
||||
// init the parameters
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
@@ -995,10 +995,10 @@ int main( int argc, char **argv ) {
|
||||
|
||||
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
|
||||
|
||||
set_default_frame_parms(config[CC_id],frame_parms[CC_id]);
|
||||
//set_default_frame_parms(config[CC_id],frame_parms[CC_id]);
|
||||
|
||||
//init_ul_hopping(frame_parms[CC_id]);
|
||||
nr_init_frame_parms_ue(config[CC_id],frame_parms[CC_id]);
|
||||
nr_init_frame_parms_ue(frame_parms[CC_id]);
|
||||
printf("after init frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size);
|
||||
// phy_init_top(frame_parms[CC_id]);
|
||||
phy_init_nr_top(frame_parms[CC_id]);
|
||||
@@ -1238,7 +1238,7 @@ int main( int argc, char **argv ) {
|
||||
//}
|
||||
|
||||
// connect the TX/RX buffers
|
||||
if (UE_flag==1) {
|
||||
//if (UE_flag==1) {
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
@@ -1265,7 +1265,7 @@ int main( int argc, char **argv ) {
|
||||
printf("error reading from file\n");
|
||||
}
|
||||
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
|
||||
}
|
||||
//}
|
||||
sleep(3);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user