diff --git a/lte/phy/examples/iodev.c b/lte/phy/examples/iodev.c index ce55b3a3a..f311443f4 100644 --- a/lte/phy/examples/iodev.c +++ b/lte/phy/examples/iodev.c @@ -44,11 +44,12 @@ #include "cell_search_utils.h" - +#ifndef DISABLE_UHD int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) { DEBUG(" ---- Receive %d samples ---- \n", nsamples); return cuhd_recv(h, data, nsamples, 1); } +#endif /* Setup USRP or input file */ int iodev_init(iodev_t *q, iodev_cfg_t *config, lte_cell_t *cell, pbch_mib_t *mib) { @@ -178,7 +179,6 @@ int iodev_init(iodev_t *q, iodev_cfg_t *config, lte_cell_t *cell, pbch_mib_t *mi void iodev_free(iodev_t *q) { - if (q->mode == FILESOURCE) { filesource_free(&q->fsrc); } else { @@ -187,9 +187,10 @@ void iodev_free(iodev_t *q) { #endif } } + /* Receive samples from the USRP or read from file */ int iodev_receive(iodev_t *q, cf_t **buffer) { - int n; + int n=0; if (q->mode == FILESOURCE) { INFO(" ----- READING %d SAMPLES ---- \n", q->sf_len); n = filesource_read(&q->fsrc, q->input_buffer_file, q->sf_len); @@ -229,10 +230,12 @@ int iodev_receive(iodev_t *q, cf_t **buffer) { void* iodev_get_cuhd(iodev_t *q) { if (q->mode == UHD) { +#ifndef DISABLE_UHD return q->uhd; - } else { - return NULL; +#endif } + return NULL; + } bool iodev_isfile(iodev_t *q) { @@ -244,11 +247,12 @@ bool iodev_isUSRP(iodev_t *q) { } uint32_t iodev_get_sfidx(iodev_t *q) { - if (iodev_isfile(q)) { - return q->sf_idx; - } else { + if (iodev_isUSRP(q)) { +#ifndef DISABLE_UHD return ue_sync_get_sfidx(&q->sframe); +#endif } + return q->sf_idx; } diff --git a/lte/phy/examples/pdsch_ue.c b/lte/phy/examples/pdsch_ue.c index adf3c8f4b..634416ee0 100644 --- a/lte/phy/examples/pdsch_ue.c +++ b/lte/phy/examples/pdsch_ue.c @@ -218,13 +218,22 @@ int main(int argc, char **argv) { } // Plot and Printf - if (!(sf_cnt % 10)) { + if (!(sf_cnt % 10)) { +#ifndef DISABLE_UHD printf("CFO: %+.4f KHz, SFO: %+.4f Khz, NOI: %.2f Errors: %4d/%4d/%4d, BLER: %.1e, Texec: %.2f\r", ue_sync_get_cfo(&iodev.sframe)/1000, ue_sync_get_sfo(&iodev.sframe)/1000, pdsch_average_noi(&ue_dl.pdsch), (int) ue_dl.pkt_errors, (int) ue_dl.pkts_total, (int) ue_dl.nof_trials, (float) ue_dl.pkt_errors / ue_dl.pkts_total, - mean_exec_time); + mean_exec_time); +#else + printf("CFO: %+.4f KHz, SFO: %+.4f Khz, NOI: %.2f Errors: %4d/%4d/%4d, BLER: %.1e, Texec: %.2f\r", + 0.0, 0.0, + pdsch_average_noi(&ue_dl.pdsch), + (int) ue_dl.pkt_errors, (int) ue_dl.pkts_total, (int) ue_dl.nof_trials, + (float) ue_dl.pkt_errors / ue_dl.pkts_total, + mean_exec_time); +#endif } #ifndef DISABLE_GRAPHICS if (!prog_args.disable_plots && iodev_get_sfidx(&iodev) == 5) { @@ -232,9 +241,11 @@ int main(int argc, char **argv) { } #endif } else if (ret == 0) { +#ifndef DISABLE_UHD printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r", sync_get_peak_value(&iodev.sframe.sfind), - iodev.sframe.frame_total_cnt, iodev.sframe.state); + iodev.sframe.frame_total_cnt, iodev.sframe.state); +#endif } sf_cnt++; } // Main loop