Commit be09a9b0 authored by Sakthivel Velumani's avatar Sakthivel Velumani

applying laurent's patch for rfsim. Missed in the RRC_FR2 branch

2 issues at this point:
1.rfsim for FR1 works sometimes. other times 100 consec PBCH errors.(this commit)
2.PDCCH and PDSCH are not transmitted in correct slots. problem might be with sf_ahead.
parent 7f4b6a29
...@@ -538,57 +538,54 @@ void UE_processing(void *arg) { ...@@ -538,57 +538,54 @@ void UE_processing(void *arg) {
} }
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
void *rxp[NB_ANTENNAS_RX];
void *dummy_tx[UE->frame_parms.nb_antennas_tx]; void *dummy_tx[UE->frame_parms.nb_antennas_tx];
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(UE->frame_parms.samples_per_subframe*4); dummy_tx[i]=malloc16_clear(writeBlockSize*4);
for(int x=0; x<20; x++) { // two frames for initial sync
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) + 4*x*UE->frame_parms.samples_per_subframe;
AssertFatal( UE->frame_parms.samples_per_subframe == AssertFatal( writeBlockSize ==
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp, timestamp,
rxp, dummy_tx,
UE->frame_parms.samples_per_subframe, writeBlockSize,
UE->frame_parms.nb_antennas_rx), ""); UE->frame_parms.nb_antennas_tx,
} 4),"");
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]); free(dummy_tx[i]);
} }
void trashFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) {
void *dummy_tx[UE->frame_parms.nb_antennas_tx];
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4);
void *dummy_rx[UE->frame_parms.nb_antennas_rx]; void *rxp[NB_ANTENNAS_RX];
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for(int x=0; x<20; x++) { // two frames for initial sync
dummy_rx[i]=malloc16(UE->frame_parms.samples_per_subframe*4); for (int slot=0; slot<UE->frame_parms.slots_per_subframe; slot ++ ) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) {
if (toTrash)
rxp[i]=malloc16(UE->frame_parms.get_samples_per_slot(slot,&UE->frame_parms)*4);
else
rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) +
4*((x*UE->frame_parms.samples_per_subframe)+
UE->frame_parms.get_samples_slot_timestamp(slot,&UE->frame_parms,0));
}
for (int sf=0; sf<NR_NUMBER_OF_SUBFRAMES_PER_FRAME; sf++) { AssertFatal( UE->frame_parms.get_samples_per_slot(slot,&UE->frame_parms) ==
// printf("Reading dummy sf %d\n",sf);
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_read_func(&UE->rfdevice,
timestamp, timestamp,
dummy_rx, rxp,
UE->frame_parms.samples_per_subframe, UE->frame_parms.get_samples_per_slot(slot,&UE->frame_parms),
UE->frame_parms.nb_antennas_rx); UE->frame_parms.nb_antennas_rx), "");
if (IS_SOFTMODEM_RFSIM ) {
usleep(1000); // slow down, as would do actual rf to let cpu for the synchro thread if (IS_SOFTMODEM_RFSIM)
dummyWrite(UE,*timestamp, UE->frame_parms.get_samples_per_slot(slot,&UE->frame_parms));
if (toTrash)
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
free(rxp[i]);
} }
} }
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]);
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
free(dummy_rx[i]);
} }
void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
...@@ -673,7 +670,7 @@ void *UE_thread(void *arg) { ...@@ -673,7 +670,7 @@ void *UE_thread(void *arg) {
decoded_frame_rx=(tmp->proc.decoded_frame_rx+trashed_frames) % MAX_FRAME_NUMBER; decoded_frame_rx=(tmp->proc.decoded_frame_rx+trashed_frames) % MAX_FRAME_NUMBER;
delNotifiedFIFO_elt(res); delNotifiedFIFO_elt(res);
} else { } else {
trashFrame(UE, &timestamp); readFrame(UE, &timestamp, true);
trashed_frames++; trashed_frames++;
continue; continue;
} }
...@@ -682,7 +679,7 @@ void *UE_thread(void *arg) { ...@@ -682,7 +679,7 @@ void *UE_thread(void *arg) {
AssertFatal( !syncRunning, "At this point synchronization can't be running\n"); AssertFatal( !syncRunning, "At this point synchronization can't be running\n");
if (!UE->is_synchronized) { if (!UE->is_synchronized) {
readFrame(UE, &timestamp); readFrame(UE, &timestamp, false);
notifiedFIFO_elt_t *Msg=newNotifiedFIFO_elt(sizeof(syncData_t),0,&nf,UE_synch); notifiedFIFO_elt_t *Msg=newNotifiedFIFO_elt(sizeof(syncData_t),0,&nf,UE_synch);
syncData_t *syncMsg=(syncData_t *)NotifiedFifoData(Msg); syncData_t *syncMsg=(syncData_t *)NotifiedFifoData(Msg);
syncMsg->UE=UE; syncMsg->UE=UE;
......
...@@ -478,9 +478,9 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi ...@@ -478,9 +478,9 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
} }
if ( b->headerMode==false ) { if ( b->headerMode==false ) {
LOG_D(HW,"UEsock: %d Set b->lastReceivedTS %ld\n", fd, b->lastReceivedTS);
if ( ! b->trashingPacket ) { if ( ! b->trashingPacket ) {
b->lastReceivedTS=b->th.timestamp+b->th.size-byteToSample(b->remainToTransfer,b->th.nbAnt); b->lastReceivedTS=b->th.timestamp+b->th.size-byteToSample(b->remainToTransfer,b->th.nbAnt);
LOG_D(HW,"UEsock: %d Set b->lastReceivedTS %ld\n", fd, b->lastReceivedTS);
} }
if ( b->remainToTransfer==0) { if ( b->remainToTransfer==0) {
......
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