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,8 +592,7 @@ static void UE_synch(void *arg) { ...@@ -602,8 +592,7 @@ 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);
} }
break; break;
...@@ -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
......
This diff is collapsed.
...@@ -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