Commit b93598c2 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Patch by Laurent to fix RFsim for FR2

parent cf51fff7
...@@ -509,57 +509,49 @@ void UE_processing(void *arg) { ...@@ -509,57 +509,49 @@ 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);
AssertFatal( writeBlockSize ==
for(int x=0; x<20; x++) { // two frames for initial sync UE->rfdevice.trx_write_func(&UE->rfdevice,
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) timestamp,
rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) + 4*x*UE->frame_parms.samples_per_subframe; dummy_tx,
writeBlockSize,
AssertFatal( UE->frame_parms.samples_per_subframe == UE->frame_parms.nb_antennas_tx,
UE->rfdevice.trx_read_func(&UE->rfdevice, 4),"");
timestamp,
rxp,
UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx), "");
}
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]; void *rxp[NB_ANTENNAS_RX];
for(int x=0; x<20; x++) { // two frames for initial sync
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (int slot=0; slot<UE->frame_parms.slots_per_subframe; slot ++ ) {
dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4); for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) {
if (toTrash)
void *dummy_rx[UE->frame_parms.nb_antennas_rx]; rxp[i]=malloc16(UE->frame_parms.samples_per_slot*4);
else
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) +
dummy_rx[i]=malloc16(UE->frame_parms.samples_per_subframe*4); 4*(x*UE->frame_parms.slots_per_subframe+slot)*UE->frame_parms.samples_per_slot;
}
for (int sf=0; sf<NR_NUMBER_OF_SUBFRAMES_PER_FRAME; sf++) {
// printf("Reading dummy sf %d\n",sf); AssertFatal( UE->frame_parms.samples_per_slot ==
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.samples_per_slot,
UE->frame_parms.nb_antennas_rx); UE->frame_parms.nb_antennas_rx), "");
if (IS_SOFTMODEM_RFSIM ) { if (IS_SOFTMODEM_RFSIM)
usleep(1000); // slow down, as would do actuall rf to let cpu for the synchro thread dummyWrite(UE,*timestamp, UE->frame_parms.samples_per_slot);
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) {
...@@ -644,7 +636,7 @@ void *UE_thread(void *arg) { ...@@ -644,7 +636,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;
} }
...@@ -653,7 +645,7 @@ void *UE_thread(void *arg) { ...@@ -653,7 +645,7 @@ void *UE_thread(void *arg) {
AssertFatal( !syncRunning, "At this point synchronisation can't be running\n"); AssertFatal( !syncRunning, "At this point synchronisation 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;
...@@ -747,7 +739,7 @@ void *UE_thread(void *arg) { ...@@ -747,7 +739,7 @@ void *UE_thread(void *arg) {
readBlockSize, readBlockSize,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
if (slot_nr==18) if (slot_nr==18 || IS_SOFTMODEM_RFSIM)
AssertFatal(writeBlockSize == AssertFatal(writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+ timestamp+
......
...@@ -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