Commit 28c3205f authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/fix-rfsim-ue4G-sync' into integration_2022_wk17

Conflicts:
	targets/ARCH/rfsimulator/simulator.c
parents 327ccc08 2373b021
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#define CONFIG_HLP_UEFO "set UE to enable estimation and compensation of frequency offset\n" #define CONFIG_HLP_UEFO "set UE to enable estimation and compensation of frequency offset\n"
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n" #define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n" #define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
......
...@@ -573,17 +573,7 @@ static void UE_synch(void *arg) { ...@@ -573,17 +573,7 @@ static void UE_synch(void *arg) {
openair0_cfg[UE->rf_map.card].rx_freq[0], openair0_cfg[UE->rf_map.card].rx_freq[0],
openair0_cfg[UE->rf_map.card].tx_freq[0]); openair0_cfg[UE->rf_map.card].tx_freq[0]);
if (UE->mode != loop_through_memory) {
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
// sleep(1);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
}*/
}
if (UE->UE_scan_carrier == 1) { if (UE->UE_scan_carrier == 1) {
UE->UE_scan_carrier = 0; UE->UE_scan_carrier = 0;
} else { } else {
...@@ -602,7 +592,6 @@ static void UE_synch(void *arg) { ...@@ -602,7 +592,6 @@ static void UE_synch(void *arg) {
LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset); LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset);
if (UE->mode != loop_through_memory)
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
} }
...@@ -648,7 +637,7 @@ void processSlotTX(void *arg) { ...@@ -648,7 +637,7 @@ void processSlotTX(void *arg) {
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
} }
if ((UE->mode != loop_through_memory) && (rxtxD->ue_sched_mode != NOT_PUSCH)) { if (rxtxD->ue_sched_mode != NOT_PUSCH) {
phy_procedures_nrUE_TX(UE,proc,0); phy_procedures_nrUE_TX(UE,proc,0);
} }
} }
...@@ -738,9 +727,10 @@ void processSlotRX(void *arg) { ...@@ -738,9 +727,10 @@ void processSlotRX(void *arg) {
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
void *dummy_tx[UE->frame_parms.nb_antennas_tx]; void *dummy_tx[UE->frame_parms.nb_antennas_tx];
int16_t dummy_tx_data[UE->frame_parms.nb_antennas_tx][2*writeBlockSize]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers
memset(dummy_tx_data, 0, sizeof(dummy_tx_data));
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
dummy_tx[i]=malloc16_clear(writeBlockSize*4); dummy_tx[i]=dummy_tx_data[i];
AssertFatal( writeBlockSize == AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
...@@ -750,8 +740,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS ...@@ -750,8 +740,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
4),""); 4),"");
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]);
} }
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) { void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) {
...@@ -793,7 +781,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { ...@@ -793,7 +781,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
*timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms);
for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) {
int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ; int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ;
// we write before read becasue gNB waits for UE to write and both executions halt // we write before read because gNB waits for UE to write and both executions halt
// this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot // this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot
if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer); if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer);
AssertFatal(unitTransfer == AssertFatal(unitTransfer ==
......
...@@ -53,7 +53,6 @@ extern "C" ...@@ -53,7 +53,6 @@ extern "C"
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
#define CONFIG_HLP_SA "run gNB in standalone mode\n" #define CONFIG_HLP_SA "run gNB in standalone mode\n"
......
...@@ -54,7 +54,6 @@ typedef enum { ...@@ -54,7 +54,6 @@ typedef enum {
no_L2_connect=5, no_L2_connect=5,
calib_prach_tx=6, calib_prach_tx=6,
rx_dump_frame=7, rx_dump_frame=7,
loop_through_memory=8
} runmode_t; } runmode_t;
/*! \brief Extension Type */ /*! \brief Extension Type */
......
...@@ -833,7 +833,6 @@ typedef struct { ...@@ -833,7 +833,6 @@ typedef struct {
pthread_mutex_t timer_mutex; pthread_mutex_t timer_mutex;
pthread_cond_t timer_cond; pthread_cond_t timer_cond;
int instance_cnt_timer; int instance_cnt_timer;
/// RF and Interface devices per CC /// RF and Interface devices per CC
openair0_device rfdevice; openair0_device rfdevice;
......
...@@ -587,9 +587,6 @@ typedef struct gNB_L1_proc_t_s { ...@@ -587,9 +587,6 @@ typedef struct gNB_L1_proc_t_s {
int instance_cnt_te; int instance_cnt_te;
/// \internal This variable is protected by \ref mutex_prach. /// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach; int instance_cnt_prach;
// instance count for over-the-air gNB synchronization
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_asynch_rxtx. /// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx; int instance_cnt_asynch_rxtx;
/// pthread structure for eNB single processing thread /// pthread structure for eNB single processing thread
......
...@@ -4870,109 +4870,3 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, ...@@ -4870,109 +4870,3 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,
LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx);
return (0); return (0);
} }
void phy_procedures_UE_lte(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
uint8_t eNB_id,
uint8_t abstraction_flag,
uint8_t do_pdcch_flag,
runmode_t mode) {
MessageDef *msg_p;
int result;
int frame_rx = proc->frame_rx;
int frame_tx = proc->frame_tx;
int subframe_rx = proc->subframe_rx;
int subframe_tx = proc->subframe_tx;
UE_L2_STATE_t ret;
int slot;
if (ue->mac_enabled == 0) {
ue->UE_mode[eNB_id]=PUSCH;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1);
if ( LOG_DEBUGFLAG(UE_TIMING)) {
start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
}
do {
// Checks if a message has been sent to PHY sub-task
itti_poll_msg (TASK_PHY_UE, &msg_p);
if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) {
case PHY_FIND_CELL_REQ:
LOG_I(PHY, "[UE ] Received %s\n", ITTI_MSG_NAME (msg_p));
/* TODO process the message */
break;
default:
LOG_E(PHY, "[UE %ld] Received unexpected message %s\n", ITTI_MSG_DESTINATION_INSTANCE (msg_p), ITTI_MSG_NAME (msg_p));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
} while(msg_p != NULL);
for (slot=0; slot<2; slot++) {
if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)||
(ue->frame_parms.frame_type == FDD)) {
phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode);
}
if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_DL) ||
(ue->frame_parms.frame_type == FDD)) {
phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode);
}
if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) &&
(slot==1)) {
phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag);
}
if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_S) &&
(slot==0)) {
phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode);
}
if (ue->mac_enabled==1) {
if (slot==0) {
//LOG_I(PHY,"[UE %d] Frame %d, subframe %d, star ue_scheduler\n", ue->Mod_id,frame_rx,subframe_tx);
ret = ue_scheduler(ue->Mod_id,
frame_rx,
subframe_rx,
frame_tx,
subframe_tx,
subframe_select(&ue->frame_parms,subframe_tx),
eNB_id,
0/*FIXME CC_id*/);
if (ret == CONNECTION_LOST) {
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id,
frame_rx,subframe_tx);
ue->UE_mode[eNB_id] = PRACH;
// mac_xface->macphy_exit("Connection lost");
} else if (ret == PHY_RESYNCH) {
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n",
ue->Mod_id,
frame_rx,subframe_tx);
ue->UE_mode[eNB_id] = RESYNCH;
// mac_xface->macphy_exit("Connection lost");
} else if (ret == PHY_HO_PRACH) {
LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n",
ue->Mod_id,frame_rx,subframe_tx);
ue->UE_mode[eNB_id] = PRACH;
}
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0);
if (LOG_DEBUGFLAG(UE_TIMING)) {
stop_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
}
} // slot
}
...@@ -3175,7 +3175,8 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, ...@@ -3175,7 +3175,8 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
const size_t num_plmn_data = sizeof(plmn_data) / sizeof(plmn_data[0]); const size_t num_plmn_data = sizeof(plmn_data) / sizeof(plmn_data[0]);
for (size_t plmn_ind = 0;; ++plmn_ind) { for (size_t plmn_ind = 0;; ++plmn_ind) {
if (plmn_ind == num_plmn_data) { if (plmn_ind == num_plmn_data) {
LOG_E( RRC, "Did not find name from internal table for %u %u\n", mcc, mnc); LOG_W( RRC, "Did not find operator name from internal table for MCC %0*d, MNC %0*d\n",
mccdigits, mcc, mncdigits, mnc);
break; break;
} }
if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc == mnc)) { if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc == mnc)) {
......
...@@ -117,7 +117,7 @@ typedef struct buffer_s { ...@@ -117,7 +117,7 @@ typedef struct buffer_s {
typedef struct { typedef struct {
int listen_sock, epollfd; int listen_sock, epollfd;
openair0_timestamp nextTimestamp; openair0_timestamp nextRxTstamp;
openair0_timestamp lastWroteTS; openair0_timestamp lastWroteTS;
uint64_t typeStamp; uint64_t typeStamp;
char *ip; char *ip;
...@@ -196,7 +196,7 @@ static void removeCirBuf(rfsimulator_state_t *bridge, int sock) { ...@@ -196,7 +196,7 @@ static void removeCirBuf(rfsimulator_state_t *bridge, int sock) {
free(bridge->buf[sock].circularBuf); free(bridge->buf[sock].circularBuf);
// Fixme: no free_channel_desc_scm(bridge->buf[sock].channel_model) implemented // Fixme: no free_channel_desc_scm(bridge->buf[sock].channel_model) implemented
// a lot of mem leaks // a lot of mem leaks
free(bridge->buf[sock].channel_model); //free(bridge->buf[sock].channel_model);
memset(&bridge->buf[sock], 0, sizeof(buffer_t)); memset(&bridge->buf[sock], 0, sizeof(buffer_t));
bridge->buf[sock].conn_sock=-1; bridge->buf[sock].conn_sock=-1;
} }
...@@ -429,8 +429,6 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp ...@@ -429,8 +429,6 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
if (!alreadyLocked) if (!alreadyLocked)
pthread_mutex_lock(&Sockmutex); pthread_mutex_lock(&Sockmutex);
LOG_D(HW,"sending %d samples at time: %ld\n", nsamps, timestamp);
for (int i=0; i<FD_SETSIZE; i++) { for (int i=0; i<FD_SETSIZE; i++) {
buffer_t *b=&t->buf[i]; buffer_t *b=&t->buf[i];
...@@ -549,14 +547,14 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi ...@@ -549,14 +547,14 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
(t->typeStamp == ENB_MAGICDL && b->th.magic==UE_MAGICDL), "Socket Error in protocol"); (t->typeStamp == ENB_MAGICDL && b->th.magic==UE_MAGICDL), "Socket Error in protocol");
b->headerMode=false; b->headerMode=false;
if ( t->nextTimestamp == 0 ) { // First block in UE, resync with the eNB current TS if ( t->nextRxTstamp == 0 ) { // First block in UE, resync with the eNB current TS
t->nextTimestamp=b->th.timestamp> nsamps_for_initial ? t->nextRxTstamp=b->th.timestamp> nsamps_for_initial ?
b->th.timestamp - nsamps_for_initial : b->th.timestamp - nsamps_for_initial :
0; 0;
b->lastReceivedTS=b->th.timestamp> nsamps_for_initial ? b->lastReceivedTS=b->th.timestamp> nsamps_for_initial ?
b->th.timestamp : b->th.timestamp :
nsamps_for_initial; nsamps_for_initial;
LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextTimestamp); LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextRxTstamp);
b->trashingPacket=true; b->trashingPacket=true;
} else if ( b->lastReceivedTS < b->th.timestamp) { } else if ( b->lastReceivedTS < b->th.timestamp) {
int nbAnt= b->th.nbAnt; int nbAnt= b->th.nbAnt;
...@@ -623,7 +621,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -623,7 +621,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
} }
rfsimulator_state_t *t = device->priv; rfsimulator_state_t *t = device->priv;
LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextTimestamp+nsamps); LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextRxTstamp+nsamps);
// deliver data from received data // deliver data from received data
// check if a UE is connected // check if a UE is connected
int first_sock; int first_sock;
...@@ -634,54 +632,22 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -634,54 +632,22 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
if ( first_sock == FD_SETSIZE ) { if ( first_sock == FD_SETSIZE ) {
// no connected device (we are eNB, no UE is connected) // no connected device (we are eNB, no UE is connected)
if ( t->nextTimestamp == 0) if ( t->nextRxTstamp == 0)
LOG_W(HW,"No connected device, generating void samples...\n"); LOG_W(HW,"No connected device, generating void samples...\n");
if (!flushInput(t, 10, nsamps)) { if (!flushInput(t, 10, nsamps)) {
for (int x=0; x < nbAnt; x++) for (int x=0; x < nbAnt; x++)
memset(samplesVoid[x],0,sampleToByte(nsamps,1)); memset(samplesVoid[x],0,sampleToByte(nsamps,1));
t->nextTimestamp+=nsamps; t->nextRxTstamp+=nsamps;
if ( ((t->nextTimestamp/nsamps)%100) == 0) if ( ((t->nextRxTstamp/nsamps)%100) == 0)
LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextTimestamp); LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextRxTstamp);
*ptimestamp = t->nextTimestamp-nsamps; *ptimestamp = t->nextRxTstamp-nsamps;
return nsamps; return nsamps;
} }
} else { } else {
pthread_mutex_lock(&Sockmutex);
if ( t->nextTimestamp > 0 && t->lastWroteTS < t->nextTimestamp) {
pthread_mutex_unlock(&Sockmutex);
usleep(10000);
pthread_mutex_lock(&Sockmutex);
if ( t->lastWroteTS < t->nextTimestamp ) {
// Assuming Tx is not done fully in another thread
// We can never write is the past from the received time
// So, the node perform receive but will never write these symbols
// let's tell this to the opposite node
// We send timestamp for nb samples required
// assuming this should have been done earlier if a Tx would exist
pthread_mutex_unlock(&Sockmutex);
c16_t v= {0};
void *dummyS[t->tx_num_channels];
for ( int i=0; i < t->tx_num_channels; i++)
dummyS[i]=(void *)&v;
LOG_I(HW, "No samples Tx occured, so we send 1 sample to notify it: Tx:%lu, Rx:%lu\n",
t->lastWroteTS, t->nextTimestamp);
rfsimulator_write_internal(t, t->nextTimestamp,
dummyS, 1,
t->tx_num_channels, 1, true);
} else {
pthread_mutex_unlock(&Sockmutex);
LOG_W(HW, "trx_write came from another thread\n");
}
} else
pthread_mutex_unlock(&Sockmutex);
bool have_to_wait; bool have_to_wait;
...@@ -692,7 +658,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -692,7 +658,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
buffer_t *b=&t->buf[sock]; buffer_t *b=&t->buf[sock];
if ( b->circularBuf ) if ( b->circularBuf )
if ( t->nextTimestamp+nsamps > b->lastReceivedTS ) { if ( t->nextRxTstamp+nsamps > b->lastReceivedTS ) {
have_to_wait=true; have_to_wait=true;
break; break;
} }
...@@ -701,7 +667,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -701,7 +667,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
if (have_to_wait) if (have_to_wait)
/*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n", /*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n",
ptr->lastReceivedTS, ptr->lastReceivedTS,
t->nextTimestamp+nsamps); t->nextRxTstamp+nsamps);
*/ */
flushInput(t, 3, nsamps); flushInput(t, 3, nsamps);
} while (have_to_wait); } while (have_to_wait);
...@@ -732,7 +698,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -732,7 +698,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
a, a,
ptr->channel_model, ptr->channel_model,
nsamps, nsamps,
t->nextTimestamp, t->nextRxTstamp,
CirSize CirSize
); );
else { // no channel modeling else { // no channel modeling
...@@ -747,8 +713,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -747,8 +713,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
//LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx); //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx);
for (int i=0; i < nsamps; i++) {//loop over nsamps for (int i=0; i < nsamps; i++) {//loop over nsamps
for (int a_tx=0; a_tx<nbAnt_tx; a_tx++) { //sum up signals from nbAnt_tx antennas for (int a_tx=0; a_tx<nbAnt_tx; a_tx++) { //sum up signals from nbAnt_tx antennas
out[i].r += (short)(ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]); out[i].r += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]);
out[i].i += (short)(ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]); out[i].i += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]);
} // end for a_tx } // end for a_tx
} // end for i (number of samps) } // end for i (number of samps)
} // end of no channel modeling } // end of no channel modeling
...@@ -756,11 +722,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -756,11 +722,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
} }
} }
*ptimestamp = t->nextTimestamp; // return the time of the first sample *ptimestamp = t->nextRxTstamp; // return the time of the first sample
t->nextTimestamp+=nsamps; t->nextRxTstamp+=nsamps;
LOG_D(HW,"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d\n", LOG_D(HW,"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d\n",
nsamps, nsamps,
*ptimestamp, t->nextTimestamp, *ptimestamp, t->nextRxTstamp,
signal_energy(samplesVoid[0], nsamps)); signal_energy(samplesVoid[0], nsamps));
return nsamps; return nsamps;
} }
......
...@@ -733,7 +733,7 @@ void tx_rf(RU_t *ru, ...@@ -733,7 +733,7 @@ void tx_rf(RU_t *ru,
int sf_extension = 0; int sf_extension = 0;
if ((SF_type == SF_DL) || if ((SF_type == SF_DL) ||
(SF_type == SF_S)) { (SF_type == SF_S) ) {
int siglen=fp->samples_per_tti,flags=1; int siglen=fp->samples_per_tti,flags=1;
if (SF_type == SF_S) { if (SF_type == SF_S) {
...@@ -831,6 +831,23 @@ void tx_rf(RU_t *ru, ...@@ -831,6 +831,23 @@ void tx_rf(RU_t *ru,
late_control=STATE_BURST_TERMINATE; late_control=STATE_BURST_TERMINATE;
LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control); LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control);
} }
} else if (IS_SOFTMODEM_RFSIM ) {
// in case of rfsim, we always enable tx because we need to feed rx of the opposite side
// we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q)
void *dummy_tx[ru->frame_parms->nb_antennas_tx];
int16_t dummy_tx_data[ru->frame_parms->nb_antennas_tx][2]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers
memset(dummy_tx_data,0,sizeof(dummy_tx_data));
for (int i=0; i<ru->frame_parms->nb_antennas_tx; i++)
dummy_tx[i]= dummy_tx_data[i];
AssertFatal( 1 ==
ru->rfdevice.trx_write_func(&ru->rfdevice,
timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
dummy_tx,
1,
ru->frame_parms->nb_antennas_tx,
4),"");
} }
} }
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
} }
#define CMDLINE_CALIBUERX_IDX 0 #define CMDLINE_CALIBUERX_IDX 0
......
...@@ -173,6 +173,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -173,6 +173,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
{ {
PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE));
AssertFatal(ue,""); AssertFatal(ue,"");
if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
} }
...@@ -201,8 +202,7 @@ void init_thread(int sched_runtime, ...@@ -201,8 +202,7 @@ void init_thread(int sched_runtime,
int sched_deadline, int sched_deadline,
int sched_fifo, int sched_fifo,
cpu_set_t *cpuset, cpu_set_t *cpuset,
char *name) char *name) {
{
#ifdef DEADLINE_SCHEDULER #ifdef DEADLINE_SCHEDULER
if (sched_runtime!=0) { if (sched_runtime!=0) {
...@@ -263,8 +263,7 @@ void init_UE(int nb_inst, ...@@ -263,8 +263,7 @@ void init_UE(int nb_inst,
runmode_t mode, runmode_t mode,
int rxgain, int rxgain,
int txpowermax, int txpowermax,
LTE_DL_FRAME_PARMS *fp0) LTE_DL_FRAME_PARMS *fp0) {
{
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
int inst; int inst;
int ret; int ret;
...@@ -280,9 +279,7 @@ void init_UE(int nb_inst, ...@@ -280,9 +279,7 @@ void init_UE(int nb_inst,
if (PHY_vars_UE_g[inst]==NULL) PHY_vars_UE_g[inst] = (PHY_VARS_UE **)calloc(1+MAX_NUM_CCs,sizeof(PHY_VARS_UE *)); if (PHY_vars_UE_g[inst]==NULL) PHY_vars_UE_g[inst] = (PHY_VARS_UE **)calloc(1+MAX_NUM_CCs,sizeof(PHY_VARS_UE *));
LOG_I(PHY,"Allocating UE context %d\n",inst); LOG_I(PHY,"Allocating UE context %d\n",inst);
PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0); PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0);
// turn off timing control loop in UE // turn off timing control loop in UE
PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction; PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction;
UE = PHY_vars_UE_g[inst][0]; UE = PHY_vars_UE_g[inst][0];
...@@ -359,7 +356,6 @@ void init_UE(int nb_inst, ...@@ -359,7 +356,6 @@ void init_UE(int nb_inst,
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
init_UE_threads(inst); init_UE_threads(inst);
ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]); ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]);
if (ret !=0) { if (ret !=0) {
...@@ -382,8 +378,7 @@ void init_UE(int nb_inst, ...@@ -382,8 +378,7 @@ void init_UE(int nb_inst,
void init_UE_stub_single_thread(int nb_inst, void init_UE_stub_single_thread(int nb_inst,
int eMBMS_active, int eMBMS_active,
int uecap_xer_in, int uecap_xer_in,
char *emul_iface) char *emul_iface) {
{
int inst; int inst;
LOG_I(PHY,"UE : Calling Layer 2 for initialization, nb_inst: %d \n", nb_inst); LOG_I(PHY,"UE : Calling Layer 2 for initialization, nb_inst: %d \n", nb_inst);
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
...@@ -408,24 +403,23 @@ void init_UE_stub_single_thread(int nb_inst, ...@@ -408,24 +403,23 @@ void init_UE_stub_single_thread(int nb_inst,
} }
} }
void init_UE_standalone_thread(int ue_idx) void init_UE_standalone_thread(int ue_idx) {
{
int standalone_tx_port = 3211 + ue_idx * 2; int standalone_tx_port = 3211 + ue_idx * 2;
int standalone_rx_port = 3212 + ue_idx * 2; int standalone_rx_port = 3212 + ue_idx * 2;
ue_init_standalone_socket(standalone_tx_port, standalone_rx_port); ue_init_standalone_socket(standalone_tx_port, standalone_rx_port);
pthread_t thread; pthread_t thread;
if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) { if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) {
LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task"); LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task");
} }
pthread_setname_np(thread, "oai:ue-stand"); pthread_setname_np(thread, "oai:ue-stand");
} }
void init_UE_stub(int nb_inst, void init_UE_stub(int nb_inst,
int eMBMS_active, int eMBMS_active,
int uecap_xer_in, int uecap_xer_in,
char *emul_iface) char *emul_iface) {
{
int inst; int inst;
LOG_I(PHY,"UE : Calling Layer 2 for initialization\n"); LOG_I(PHY,"UE : Calling Layer 2 for initialization\n");
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
...@@ -459,8 +453,7 @@ void init_UE_stub(int nb_inst, ...@@ -459,8 +453,7 @@ void init_UE_stub(int nb_inst,
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
static void *UE_thread_synch(void *arg) static void *UE_thread_synch(void *arg) {
{
static int UE_thread_synch_retval; static int UE_thread_synch_retval;
int i ; int i ;
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
...@@ -475,6 +468,7 @@ static void *UE_thread_synch(void *arg) ...@@ -475,6 +468,7 @@ static void *UE_thread_synch(void *arg)
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg); printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
if ( threads.sync != -1 ) if ( threads.sync != -1 )
CPU_SET(threads.sync, &cpuset); CPU_SET(threads.sync, &cpuset);
...@@ -754,8 +748,7 @@ static void *UE_thread_synch(void *arg) ...@@ -754,8 +748,7 @@ static void *UE_thread_synch(void *arg)
* \param arg is a pointer to a \ref PHY_VARS_UE structure. * \param arg is a pointer to a \ref PHY_VARS_UE structure.
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
const char *get_connectionloss_errstr(int errcode) const char *get_connectionloss_errstr(int errcode) {
{
switch (errcode) { switch (errcode) {
case CONNECTION_LOST: case CONNECTION_LOST:
return "RRC Connection lost, returning to PRACH"; return "RRC Connection lost, returning to PRACH";
...@@ -770,8 +763,7 @@ const char *get_connectionloss_errstr(int errcode) ...@@ -770,8 +763,7 @@ const char *get_connectionloss_errstr(int errcode)
return "UNKNOWN RETURN CODE"; return "UNKNOWN RETURN CODE";
} }
static void *UE_thread_rxn_txnp4(void *arg) static void *UE_thread_rxn_txnp4(void *arg) {
{
static __thread int UE_thread_rxtx_retval; static __thread int UE_thread_rxtx_retval;
struct rx_tx_thread_data *rtd = arg; struct rx_tx_thread_data *rtd = arg;
UE_rxtx_proc_t *proc = rtd->proc; UE_rxtx_proc_t *proc = rtd->proc;
...@@ -864,12 +856,10 @@ static void *UE_thread_rxn_txnp4(void *arg) ...@@ -864,12 +856,10 @@ static void *UE_thread_rxn_txnp4(void *arg)
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) ) (UE->frame_parms.frame_type == FDD) )
if (UE->mode != loop_through_memory)
phy_procedures_UE_TX(UE,proc,0,0,UE->mode); phy_procedures_UE_TX(UE,proc,0,0,UE->mode);
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) && if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
(UE->frame_parms.frame_type == TDD)) (UE->frame_parms.frame_type == TDD))
if (UE->mode != loop_through_memory)
phy_procedures_UE_S_TX(UE,0,0); phy_procedures_UE_S_TX(UE,0,0);
proc->instance_cnt_rxtx--; proc->instance_cnt_rxtx--;
...@@ -892,8 +882,7 @@ static void *UE_thread_rxn_txnp4(void *arg) ...@@ -892,8 +882,7 @@ static void *UE_thread_rxn_txnp4(void *arg)
unsigned int emulator_absSF; unsigned int emulator_absSF;
void ue_stub_rx_handler(unsigned int num_bytes, void ue_stub_rx_handler(unsigned int num_bytes,
char *rx_buffer) char *rx_buffer) {
{
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
UE = PHY_vars_UE_g[0][0]; UE = PHY_vars_UE_g[0][0];
UE_tport_t *pdu = (UE_tport_t *)rx_buffer; UE_tport_t *pdu = (UE_tport_t *)rx_buffer;
...@@ -948,13 +937,13 @@ void ue_stub_rx_handler(unsigned int num_bytes, ...@@ -948,13 +937,13 @@ void ue_stub_rx_handler(unsigned int num_bytes,
} }
} }
uint64_t clock_usec(void) uint64_t clock_usec(void) {
{
struct timespec t; struct timespec t;
if (clock_gettime(CLOCK_MONOTONIC, &t) == -1)
{ if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) {
abort(); abort();
} }
return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000); return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
} }
/*! /*!
...@@ -965,23 +954,21 @@ uint64_t clock_usec(void) ...@@ -965,23 +954,21 @@ uint64_t clock_usec(void)
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
static void *UE_phy_stub_standalone_pnf_task(void *arg) static void *UE_phy_stub_standalone_pnf_task(void *arg) {
{
#if 1 #if 1
{ {
struct sched_param sparam = struct sched_param sparam =
{ {
.sched_priority = 79, .sched_priority = 79,
}; };
if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0)
{ if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0) {
LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno)); LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno));
} }
} }
#else #else
thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L); thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L);
#endif #endif
// for multipule UE's L2-emulator // for multipule UE's L2-emulator
//module_id_t Mod_id = 0; //module_id_t Mod_id = 0;
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames //int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
...@@ -1001,9 +988,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1001,9 +988,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
PHY_VARS_UE *UE = NULL; PHY_VARS_UE *UE = NULL;
int ret; int ret;
proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
UE = rtd->UE; UE = rtd->UE;
UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t)); UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU, sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
...@@ -1016,19 +1001,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1016,19 +1001,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_pdu_t)); UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_raw_pdu_t)); UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
proc->subframe_rx = proc->sub_frame_start; proc->subframe_rx = proc->sub_frame_start;
proc->subframe_tx = -1; proc->subframe_tx = -1;
proc->frame_rx = -1; proc->frame_rx = -1;
proc->frame_tx = -1; proc->frame_tx = -1;
// Initializations for nfapi-L2-emulator mode // Initializations for nfapi-L2-emulator mode
sync_var = 0; sync_var = 0;
//PANOS: CAREFUL HERE! //PANOS: CAREFUL HERE!
wait_sync("UE_phy_stub_standalone_pnf_task"); wait_sync("UE_phy_stub_standalone_pnf_task");
int last_sfn_sf = -1; int last_sfn_sf = -1;
LOG_I(MAC, "Clearing Queues\n"); LOG_I(MAC, "Clearing Queues\n");
reset_queue(&dl_config_req_tx_req_queue); reset_queue(&dl_config_req_tx_req_queue);
reset_queue(&ul_config_req_queue); reset_queue(&ul_config_req_queue);
...@@ -1036,35 +1017,37 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1036,35 +1017,37 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
while (!oai_exit) { while (!oai_exit) {
bool sent_any = false; bool sent_any = false;
if (sem_wait(&sfn_semaphore) != 0) { if (sem_wait(&sfn_semaphore) != 0) {
LOG_E(MAC, "sem_wait() error\n"); LOG_E(MAC, "sem_wait() error\n");
abort(); abort();
} }
int sfn_sf = current_sfn_sf; int sfn_sf = current_sfn_sf;
if (sfn_sf == last_sfn_sf)
{ if (sfn_sf == last_sfn_sf) {
LOG_W(MAC, "repeated sfn_sf = %d.%d\n", LOG_W(MAC, "repeated sfn_sf = %d.%d\n",
sfn_sf >> 4, sfn_sf & 15); sfn_sf >> 4, sfn_sf & 15);
continue; continue;
} }
last_sfn_sf = sfn_sf;
last_sfn_sf = sfn_sf;
nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue); nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue);
nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue); nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue);
nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue); nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue);
LOG_I(MAC, "received from proxy frame %d subframe %d\n", LOG_I(MAC, "received from proxy frame %d subframe %d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (ul_config_req != NULL) { if (ul_config_req != NULL) {
uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
if (ul_num_pdus > 0) { if (ul_num_pdus > 0) {
char *ul_str = nfapi_ul_config_req_to_string(ul_config_req); char *ul_str = nfapi_ul_config_req_to_string(ul_config_req);
LOG_I(MAC, "ul_config_req: %s\n", ul_str); LOG_I(MAC, "ul_config_req: %s\n", ul_str);
free(ul_str); free(ul_str);
} }
} }
if (hi_dci0_req != NULL) { if (hi_dci0_req != NULL) {
LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n", LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n",
hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_dci,
...@@ -1072,36 +1055,39 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1072,36 +1055,39 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
} }
if (dl_config_req_tx_req != NULL) { if (dl_config_req_tx_req != NULL) {
nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list; nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list;
nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req; nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req;
uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu; uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
LOG_I(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," LOG_I(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d,"
" with number of PDUs: %u\n", " with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
dl_num_pdus); dl_num_pdus);
if (dl_num_pdus > 0) { if (dl_num_pdus > 0) {
char *dl_str = nfapi_dl_config_req_to_string(dl_config_req); char *dl_str = nfapi_dl_config_req_to_string(dl_config_req);
LOG_I(MAC, "dl_config_req: %s\n", dl_str); LOG_I(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str); free(dl_str);
} }
LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
// Handling dl_config_req and tx_req: // Handling dl_config_req and tx_req:
nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body; nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body;
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i]; nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i];
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
i += 1; i += 1;
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu, AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
"Need PDU following DCI at index %d, but not found\n", "Need PDU following DCI at index %d, but not found\n",
i); i);
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i]; nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) { if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i); LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
continue; continue;
} }
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu, pdu,
...@@ -1122,8 +1108,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1122,8 +1108,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
} }
} }
} }
if (hi_dci0_req) { if (hi_dci0_req) {
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) { for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
...@@ -1136,13 +1124,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1136,13 +1124,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
for (ue_index = 0; ue_index < ue_num; ue_index++) { for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode
UE = PHY_vars_UE_g[ue_Mod_id][0]; UE = PHY_vars_UE_g[ue_Mod_id][0];
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&UE->generic_stat); start_meas(&UE->generic_stat);
#endif #endif
int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx
int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4; int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4;
LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe); LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe);
if (UE->mac_enabled == 1) { if (UE->mac_enabled == 1) {
ret = ue_scheduler(ue_Mod_id, ret = ue_scheduler(ue_Mod_id,
rx_frame, rx_frame,
...@@ -1165,31 +1153,28 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1165,31 +1153,28 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
// Prepare the future Tx data // Prepare the future Tx data
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) || if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
(UE->frame_parms.frame_type == FDD)) (UE->frame_parms.frame_type == FDD)) {
{
if (UE->mode != loop_through_memory)
{
// We make the start of RA between consecutive UEs differ by 20 frames // We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE && if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE &&
is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) {
{
UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH; UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH;
} }
LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]);
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH)
{ //&& ue_Mod_id == next_Mod_id) { if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) {
//&& ue_Mod_id == next_Mod_id) {
next_ra_frame++; next_ra_frame++;
if (next_ra_frame > 500)
{ if (next_ra_frame > 500) {
// check if we have PRACH opportunity // check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
{
// The one working strangely... // The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
if (prach_resources != NULL)
{ if (prach_resources != NULL) {
LOG_I(MAC, "preamble_received_tar_power: %d\n", LOG_I(MAC, "preamble_received_tar_power: %d\n",
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER);
UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf);
...@@ -1202,6 +1187,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1202,6 +1187,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
//next_ra_frame = (rx_frame + 20)%1000; //next_ra_frame = (rx_frame + 20)%1000;
next_ra_frame = 0; next_ra_frame = 0;
} }
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
} }
} }
...@@ -1210,20 +1196,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1210,20 +1196,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic. // Generate UL_indications which correspond to UL traffic.
if (ul_config_req != NULL) if (ul_config_req != NULL) {
{ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id);
} }
} } else {
phy_procedures_UE_SL_RX(UE, proc);
}
else
{
LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (ul_config_req != NULL)
{ if (ul_config_req != NULL) {
LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n",
NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf));
} }
...@@ -1240,12 +1221,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1240,12 +1221,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
} }
if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id);
sent_any = true; sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
} }
...@@ -1283,12 +1262,11 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1283,12 +1262,11 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list);
dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
} }
nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list);
dl_config_req_tx_req->tx_req_pdu_list = NULL; dl_config_req_tx_req->tx_req_pdu_list = NULL;
free(dl_config_req_tx_req->dl_config_req); free(dl_config_req_tx_req->dl_config_req);
dl_config_req_tx_req->dl_config_req = NULL; dl_config_req_tx_req->dl_config_req = NULL;
free(dl_config_req_tx_req); free(dl_config_req_tx_req);
dl_config_req_tx_req = NULL; dl_config_req_tx_req = NULL;
} }
...@@ -1312,8 +1290,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1312,8 +1290,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
free(hi_dci0_req); free(hi_dci0_req);
hi_dci0_req = NULL; hi_dci0_req = NULL;
} }
if (!sent_any)
{ if (!sent_any) {
send_standalone_dummy(); send_standalone_dummy();
} }
} }
...@@ -1333,7 +1311,6 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1333,7 +1311,6 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
free(UL_INFO); free(UL_INFO);
UL_INFO = NULL; UL_INFO = NULL;
// thread finished // thread finished
free(arg); free(arg);
return NULL; return NULL;
...@@ -1347,8 +1324,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1347,8 +1324,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
{
#if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy #if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
// for multipule UE's L2-emulator // for multipule UE's L2-emulator
...@@ -1374,7 +1350,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1374,7 +1350,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
phy_stub_ticking->num_single_thread[ue_thread_id] = -1; phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
UE = rtd->UE; UE = rtd->UE;
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t)); UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
...@@ -1486,19 +1461,23 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1486,19 +1461,23 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
if (dl_config_req && tx_req_pdu_list) { if (dl_config_req && tx_req_pdu_list) {
nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body; nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body;
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i]; nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i];
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
i += 1; i += 1;
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu, AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
"Need PDU following DCI at index %d, but not found\n", "Need PDU following DCI at index %d, but not found\n",
i); i);
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i]; nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) { if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i); LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
continue; continue;
} }
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu, pdu,
...@@ -1520,8 +1499,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1520,8 +1499,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if (hi_dci0_req) { if (hi_dci0_req) {
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) { for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
nfapi_hi_dci0_request_pdu_t* pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf),
pdu, pdu,
...@@ -1589,7 +1569,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1589,7 +1569,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) ) (UE->frame_parms.frame_type == FDD) )
if (UE->mode != loop_through_memory) {
// We make the start of RA between consecutive UEs differ by 20 frames // We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
...@@ -1624,9 +1604,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1624,9 +1604,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id);
} }
}
phy_procedures_UE_SL_RX(UE,proc);
} //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) } //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
phy_stub_ticking->num_single_thread[ue_thread_id] = -1; phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
...@@ -1706,6 +1683,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1706,6 +1683,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
tx_req_pdu_list[i].segments[j].segment_data = NULL; tx_req_pdu_list[i].segments[j].segment_data = NULL;
} }
} }
tx_req_num_elems = 0; tx_req_num_elems = 0;
free(tx_req_pdu_list); free(tx_req_pdu_list);
tx_req_pdu_list = NULL; tx_req_pdu_list = NULL;
...@@ -1749,7 +1727,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1749,7 +1727,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
free(UL_INFO); free(UL_INFO);
UL_INFO = NULL; UL_INFO = NULL;
#endif // disabled UE_phy_stub_single_thread_rxn_txnp4 #endif // disabled UE_phy_stub_single_thread_rxn_txnp4
// thread finished // thread finished
free(arg); free(arg);
return NULL; return NULL;
...@@ -1764,9 +1741,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1764,9 +1741,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
static void *UE_phy_stub_thread_rxn_txnp4(void *arg) static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
{ #if 0
#if 0
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
module_id_t Mod_id = 0; module_id_t Mod_id = 0;
static __thread int UE_thread_rxtx_retval; static __thread int UE_thread_rxtx_retval;
...@@ -1877,7 +1853,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) ...@@ -1877,7 +1853,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) ) (UE->frame_parms.frame_type == FDD) )
if (UE->mode != loop_through_memory) {
if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) { if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) {
// check if we have PRACH opportunity // check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) { if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) {
...@@ -1913,9 +1888,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) ...@@ -1913,9 +1888,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
} }
} }
phy_procedures_UE_SL_RX(UE,proc); #endif // disabled
}
#endif // disabled
// thread finished // thread finished
free(arg); free(arg);
return NULL; //return &UE_thread_rxtx_retval; return NULL; //return &UE_thread_rxtx_retval;
...@@ -1949,8 +1922,7 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { ...@@ -1949,8 +1922,7 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) {
1),""); 1),"");
} }
void *UE_thread(void *arg) void *UE_thread(void *arg) {
{
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
// int tx_enabled = 0; // int tx_enabled = 0;
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32))); int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32)));
...@@ -1963,10 +1935,11 @@ void *UE_thread(void *arg) ...@@ -1963,10 +1935,11 @@ void *UE_thread(void *arg)
int ret; int ret;
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
if ( threads.main != -1 ) if ( threads.main != -1 )
CPU_SET(threads.main, &cpuset); CPU_SET(threads.main, &cpuset);
init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads");
init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads");
/* /*
while (sync_var<0) while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex); pthread_cond_wait(&sync_cond, &sync_mutex);
...@@ -2000,6 +1973,7 @@ void *UE_thread(void *arg) ...@@ -2000,6 +1973,7 @@ void *UE_thread(void *arg)
// we shift in time flow because the UE doesn't detect sync when frame alignment is not easy // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void *)&dummy_rx[i][0]; rxp[i] = (void *)&dummy_rx[i][0];
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp, &timestamp,
rxp, rxp,
...@@ -2008,7 +1982,6 @@ void *UE_thread(void *arg) ...@@ -2008,7 +1982,6 @@ void *UE_thread(void *arg)
// grab 10 ms of signal and wakeup synch thread // grab 10 ms of signal and wakeup synch thread
if (UE->mode != loop_through_memory) {
if (IS_SOFTMODEM_RFSIM ) { if (IS_SOFTMODEM_RFSIM ) {
for(int sf=0; sf<10; sf++) { for(int sf=0; sf<10; sf++) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
...@@ -2032,7 +2005,6 @@ void *UE_thread(void *arg) ...@@ -2032,7 +2005,6 @@ void *UE_thread(void *arg)
UE->frame_parms.samples_per_tti*10, UE->frame_parms.samples_per_tti*10,
UE->frame_parms.nb_antennas_rx), ""); UE->frame_parms.nb_antennas_rx), "");
} }
}
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
instance_cnt_synch = ++UE->proc.instance_cnt_synch; instance_cnt_synch = ++UE->proc.instance_cnt_synch;
...@@ -2046,12 +2018,7 @@ void *UE_thread(void *arg) ...@@ -2046,12 +2018,7 @@ void *UE_thread(void *arg)
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
} else { } else {
#if OAISIM
(void)dummy_rx; /* avoid gcc warnings */
usleep(500);
#else
// grab 10 ms of signal into dummy buffer // grab 10 ms of signal into dummy buffer
if (UE->mode != loop_through_memory) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void *)&dummy_rx[i][0]; rxp[i] = (void *)&dummy_rx[i][0];
...@@ -2062,20 +2029,19 @@ void *UE_thread(void *arg) ...@@ -2062,20 +2029,19 @@ void *UE_thread(void *arg)
rxp, rxp,
UE->frame_parms.samples_per_tti, UE->frame_parms.samples_per_tti,
UE->frame_parms.nb_antennas_rx); UE->frame_parms.nb_antennas_rx);
if (IS_SOFTMODEM_RFSIM ) if (IS_SOFTMODEM_RFSIM )
write_dummy(UE, timestamp); write_dummy(UE, timestamp);
} }
} }
#endif
}
} // UE->is_synchronized==0 } // UE->is_synchronized==0
else { else {
if (start_rx_stream==0) { if (start_rx_stream==0) {
start_rx_stream=1; start_rx_stream=1;
if (UE->mode != loop_through_memory) {
if (UE->no_timing_correction==0) { if (UE->no_timing_correction==0) {
LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
while ( UE->rx_offset ) { while ( UE->rx_offset ) {
size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti); size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti);
AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice, AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice,
...@@ -2083,8 +2049,10 @@ void *UE_thread(void *arg) ...@@ -2083,8 +2049,10 @@ void *UE_thread(void *arg)
(void **)UE->common_vars.rxdata, (void **)UE->common_vars.rxdata,
s, s,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
if (IS_SOFTMODEM_RFSIM ) if (IS_SOFTMODEM_RFSIM )
write_dummy(UE, timestamp); write_dummy(UE, timestamp);
UE->rx_offset-=s; UE->rx_offset-=s;
} }
} }
...@@ -2106,9 +2074,6 @@ void *UE_thread(void *arg) ...@@ -2106,9 +2074,6 @@ void *UE_thread(void *arg)
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
slot_fep(UE,0, 0, 0, 0, 0); slot_fep(UE,0, 0, 0, 0, 0);
} //UE->mode != loop_through_memory
else
rt_sleep_ns(1000*1000);
} else { } else {
sub_frame++; sub_frame++;
sub_frame%=10; sub_frame%=10;
...@@ -2127,6 +2092,7 @@ void *UE_thread(void *arg) ...@@ -2127,6 +2092,7 @@ void *UE_thread(void *arg)
pthread_mutex_unlock(&proc->mutex_rxtx); pthread_mutex_unlock(&proc->mutex_rxtx);
} }
usleep(300); usleep(300);
} }
...@@ -2136,7 +2102,6 @@ void *UE_thread(void *arg) ...@@ -2136,7 +2102,6 @@ void *UE_thread(void *arg)
if(thread_idx>=RX_NB_TH) if(thread_idx>=RX_NB_TH)
thread_idx = 0; thread_idx = 0;
if (UE->mode != loop_through_memory) {
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+ rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
UE->frame_parms.nb_prefix_samples0+ UE->frame_parms.nb_prefix_samples0+
...@@ -2213,15 +2178,19 @@ void *UE_thread(void *arg) ...@@ -2213,15 +2178,19 @@ void *UE_thread(void *arg)
ret = pthread_mutex_lock(&proc->mutex_rxtx); ret = pthread_mutex_lock(&proc->mutex_rxtx);
} else { } else {
struct timespec tv; struct timespec tv;
if (clock_gettime(CLOCK_REALTIME, &tv) != 0) { if (clock_gettime(CLOCK_REALTIME, &tv) != 0) {
perror("clock_gettime"); perror("clock_gettime");
exit(1); exit(1);
} }
tv.tv_nsec += 10*1000; tv.tv_nsec += 10*1000;
if (tv.tv_nsec >= 1000 * 1000 * 1000) { if (tv.tv_nsec >= 1000 * 1000 * 1000) {
tv.tv_sec++; tv.tv_sec++;
tv.tv_nsec -= 1000 * 1000 * 1000; tv.tv_nsec -= 1000 * 1000 * 1000;
} }
ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv); ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv);
} }
...@@ -2256,10 +2225,6 @@ void *UE_thread(void *arg) ...@@ -2256,10 +2225,6 @@ void *UE_thread(void *arg)
T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx)); T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx));
AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,""); AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,"");
AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,"");
} else {
printf("Processing subframe %d",proc->subframe_rx);
getchar();
}
} // start_rx_stream==1 } // start_rx_stream==1
} // UE->is_synchronized==1 } // UE->is_synchronized==1
} // while !oai_exit } // while !oai_exit
...@@ -2280,8 +2245,7 @@ void *UE_thread(void *arg) ...@@ -2280,8 +2245,7 @@ void *UE_thread(void *arg)
* - UE_thread_dlsch_proc_slot1 * - UE_thread_dlsch_proc_slot1
* and the locking between them. * and the locking between them.
*/ */
void init_UE_threads(int inst) void init_UE_threads(int inst) {
{
struct rx_tx_thread_data *rtd; struct rx_tx_thread_data *rtd;
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
...@@ -2336,8 +2300,7 @@ void init_UE_threads(int inst) ...@@ -2336,8 +2300,7 @@ void init_UE_threads(int inst)
* - UE_thread_dlsch_proc_slot1 * - UE_thread_dlsch_proc_slot1
* and the locking between them. * and the locking between them.
*/ */
void init_UE_single_thread_stub(int nb_inst) void init_UE_single_thread_stub(int nb_inst) {
{
struct rx_tx_thread_data *rtd; struct rx_tx_thread_data *rtd;
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
...@@ -2365,8 +2328,8 @@ void init_UE_single_thread_stub(int nb_inst) ...@@ -2365,8 +2328,8 @@ void init_UE_single_thread_stub(int nb_inst)
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads // In phy_stub_UE mode due to less heavy processing operations we don't need two threads
//int nb_threads=RX_NB_TH; //int nb_threads=RX_NB_TH;
int nb_threads=1; int nb_threads=1;
void *(*task_func)(void *);
void* (*task_func)(void*);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) { if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
task_func = UE_phy_stub_standalone_pnf_task; task_func = UE_phy_stub_standalone_pnf_task;
} else { } else {
...@@ -2410,8 +2373,7 @@ void init_UE_single_thread_stub(int nb_inst) ...@@ -2410,8 +2373,7 @@ void init_UE_single_thread_stub(int nb_inst)
* - UE_thread_dlsch_proc_slot1 * - UE_thread_dlsch_proc_slot1
* and the locking between them. * and the locking between them.
*/ */
void init_UE_threads_stub(int inst) void init_UE_threads_stub(int inst) {
{
struct rx_tx_thread_data *rtd; struct rx_tx_thread_data *rtd;
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
...@@ -2448,8 +2410,7 @@ void init_UE_threads_stub(int inst) ...@@ -2448,8 +2410,7 @@ void init_UE_threads_stub(int inst)
} }
void fill_ue_band_info(void) void fill_ue_band_info(void) {
{
LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability; LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability;
int i,j; int i,j;
bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count;
...@@ -2474,8 +2435,7 @@ void fill_ue_band_info(void) ...@@ -2474,8 +2435,7 @@ void fill_ue_band_info(void)
} }
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
openair0_config_t *openair0_cfg) openair0_config_t *openair0_cfg) {
{
int i, CC_id; int i, CC_id;
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
...@@ -2512,8 +2472,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, ...@@ -2512,8 +2472,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
// playing the role of nfapi-pnf. // playing the role of nfapi-pnf.
//02/02/2018 //02/02/2018
static void *timer_thread( void *param ) static void *timer_thread( void *param ) {
{
thread_top_init("timer_thread",1,870000L,1000000L,1000000L); thread_top_init("timer_thread",1,870000L,1000000L,1000000L);
timer_subframe =9; timer_subframe =9;
timer_frame =1023; timer_frame =1023;
...@@ -2639,8 +2598,7 @@ static void *timer_thread( void *param ) ...@@ -2639,8 +2598,7 @@ static void *timer_thread( void *param )
} }
int init_timer_thread(void) int init_timer_thread(void) {
{
//PHY_VARS_UE *UE=PHY_vars_UE_g[0]; //PHY_VARS_UE *UE=PHY_vars_UE_g[0];
PHY_VARS_UE *UE=PHY_vars_UE_g[0][0]; PHY_VARS_UE *UE=PHY_vars_UE_g[0][0];
phy_stub_ticking = (SF_ticking *)malloc(sizeof(SF_ticking)); phy_stub_ticking = (SF_ticking *)malloc(sizeof(SF_ticking));
...@@ -2662,8 +2620,7 @@ int init_timer_thread(void) ...@@ -2662,8 +2620,7 @@ int init_timer_thread(void)
*/ */
int8_t find_dlsch(uint16_t rnti, int8_t find_dlsch(uint16_t rnti,
PHY_VARS_eNB *eNB, PHY_VARS_eNB *eNB,
find_type_t type) find_type_t type) {
{
printf("you cannot read this\n"); printf("you cannot read this\n");
abort(); abort();
} }
......
...@@ -276,7 +276,6 @@ uint16_t node_number; ...@@ -276,7 +276,6 @@ uint16_t node_number;
static void get_options(void) { static void get_options(void) {
int CC_id=0; int CC_id=0;
int tddflag=0; int tddflag=0;
char *loopfile=NULL;
int dumpframe=0; int dumpframe=0;
int timingadv=0; int timingadv=0;
uint8_t nfapi_mode = NFAPI_MONOLITHIC; uint8_t nfapi_mode = NFAPI_MONOLITHIC;
...@@ -293,14 +292,6 @@ static void get_options(void) { ...@@ -293,14 +292,6 @@ static void get_options(void) {
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
nfapi_setmode(nfapi_mode); nfapi_setmode(nfapi_mode);
if (loopfile != NULL) {
printf("Input file for hardware emulation: %s",loopfile);
mode=loop_through_memory;
input_fd = fopen(loopfile,"r");
AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
}
get_softmodem_params()->hw_timing_advance = timingadv; get_softmodem_params()->hw_timing_advance = timingadv;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
......
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