Commit c43db483 authored by Florian Kaltenberger's avatar Florian Kaltenberger

debugging

parent 9276121d
...@@ -638,8 +638,6 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -638,8 +638,6 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
for (i=0; i<ru->nb_rx; i++) for (i=0; i<ru->nb_rx; i++)
rxp[i] = (void *)&ru->common.rxdata[i][fp->get_samples_slot_timestamp(*slot,fp,0)]; rxp[i] = (void *)&ru->common.rxdata[i][fp->get_samples_slot_timestamp(*slot,fp,0)];
LOG_D(PHY,"Reading %d samples for slot %d (%p)\n",samples_per_slot,*slot,rxp[0]);
//when the USRP starts, it initializes the timestamp to 0. We wait 1 frames until we program the first rx. //when the USRP starts, it initializes the timestamp to 0. We wait 1 frames until we program the first rx.
if (proc->first_rx==1) { if (proc->first_rx==1) {
proc->timestamp_rx = fp->samples_per_frame; proc->timestamp_rx = fp->samples_per_frame;
...@@ -647,7 +645,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -647,7 +645,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
} }
else { else {
//we always advance the timestamp by samples_per_slot, even if we have not read the (full) slot. This is to keep the timestamp updated even when there is no RX. //we always advance the timestamp by samples_per_slot, even if we have not read the (full) slot. This is to keep the timestamp updated even when there is no RX.
proc->timestamp_rx += fp->get_samples_per_slot((*slot-1)%fp->slots_per_frame,fp); proc->timestamp_rx += fp->get_samples_per_slot(*slot%fp->slots_per_frame,fp);
} }
int slot_type = nr_slot_select(cfg,*frame,*slot%fp->slots_per_frame); int slot_type = nr_slot_select(cfg,*frame,*slot%fp->slots_per_frame);
...@@ -661,12 +659,16 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -661,12 +659,16 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
rxsymb++; rxsymb++;
} }
AssertFatal(rxsymb>0,"illegal rxsymb %d\n",rxsymb); AssertFatal(rxsymb>0,"illegal rxsymb %d\n",rxsymb);
//TODO: this has to be adapted for numerology!=1
siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (rxsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (rxsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples);
proc->timestamp_rx += fp->get_samples_per_slot(*slot%fp->slots_per_frame,fp) - siglen;
} }
else { else {
siglen = samples_per_slot; siglen = samples_per_slot;
} }
LOG_I(PHY,"Reading %d samples for slot %d at timestamp %ld\n",siglen,*slot,proc->timestamp_rx);
if(emulate_rf) { if(emulate_rf) {
wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread");
release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread");
...@@ -779,12 +781,15 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -779,12 +781,15 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers // prepare tx buffer pointers
/*
txs = ru->rfdevice.trx_write_func(&ru->rfdevice, txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
txp, txp,
siglen+sf_extension, siglen+sf_extension,
ru->nb_tx, ru->nb_tx,
flags); flags);
*/
txs=siglen+sf_extension;
LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, slot %d\n",ru->idx, LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, slot %d\n",ru->idx,
(long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot); (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
......
...@@ -661,10 +661,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp, ...@@ -661,10 +661,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp,
// receive a single channel (e.g. from connector RF A) // receive a single channel (e.g. from connector RF A)
samples_received=0; samples_received=0;
while (samples_received != nsamps) { //while (samples_received != nsamps) {
samples_received += s->rx_stream->recv((void*)((int32_t*)buff_tmp[0]+samples_received), samples_received += s->rx_stream->recv((void*)((int32_t*)buff_tmp[0]+samples_received),
nsamps-samples_received, s->rx_md); nsamps-samples_received, s->rx_md);
/*
if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)) if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE))
break; break;
...@@ -672,7 +673,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp, ...@@ -672,7 +673,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp,
printf("sleep...\n"); //usleep(100); printf("sleep...\n"); //usleep(100);
} }
} }
*/
if (samples_received == nsamps) s->wait_for_first_pps=0; if (samples_received == nsamps) s->wait_for_first_pps=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