Merge pull request #50 from suttonpd/master

Fix for building without uhd
master
suttonpd 11 years ago
commit 36e6c153d9

@ -44,11 +44,12 @@
#include "cell_search_utils.h" #include "cell_search_utils.h"
#ifndef DISABLE_UHD
int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) { int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) {
DEBUG(" ---- Receive %d samples ---- \n", nsamples); DEBUG(" ---- Receive %d samples ---- \n", nsamples);
return cuhd_recv(h, data, nsamples, 1); return cuhd_recv(h, data, nsamples, 1);
} }
#endif
/* Setup USRP or input file */ /* Setup USRP or input file */
int iodev_init(iodev_t *q, iodev_cfg_t *config, lte_cell_t *cell, pbch_mib_t *mib) { 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) { void iodev_free(iodev_t *q) {
if (q->mode == FILESOURCE) { if (q->mode == FILESOURCE) {
filesource_free(&q->fsrc); filesource_free(&q->fsrc);
} else { } else {
@ -187,9 +187,10 @@ void iodev_free(iodev_t *q) {
#endif #endif
} }
} }
/* Receive samples from the USRP or read from file */ /* Receive samples from the USRP or read from file */
int iodev_receive(iodev_t *q, cf_t **buffer) { int iodev_receive(iodev_t *q, cf_t **buffer) {
int n; int n=0;
if (q->mode == FILESOURCE) { if (q->mode == FILESOURCE) {
INFO(" ----- READING %d SAMPLES ---- \n", q->sf_len); INFO(" ----- READING %d SAMPLES ---- \n", q->sf_len);
n = filesource_read(&q->fsrc, q->input_buffer_file, 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) { void* iodev_get_cuhd(iodev_t *q) {
if (q->mode == UHD) { if (q->mode == UHD) {
#ifndef DISABLE_UHD
return q->uhd; return q->uhd;
} else { #endif
return NULL;
} }
return NULL;
} }
bool iodev_isfile(iodev_t *q) { bool iodev_isfile(iodev_t *q) {
@ -244,11 +247,12 @@ bool iodev_isUSRP(iodev_t *q) {
} }
uint32_t iodev_get_sfidx(iodev_t *q) { uint32_t iodev_get_sfidx(iodev_t *q) {
if (iodev_isfile(q)) { if (iodev_isUSRP(q)) {
return q->sf_idx; #ifndef DISABLE_UHD
} else {
return ue_sync_get_sfidx(&q->sframe); return ue_sync_get_sfidx(&q->sframe);
#endif
} }
return q->sf_idx;
} }

@ -218,13 +218,22 @@ int main(int argc, char **argv) {
} }
// Plot and Printf // 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", 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, ue_sync_get_cfo(&iodev.sframe)/1000, ue_sync_get_sfo(&iodev.sframe)/1000,
pdsch_average_noi(&ue_dl.pdsch), pdsch_average_noi(&ue_dl.pdsch),
(int) ue_dl.pkt_errors, (int) ue_dl.pkts_total, (int) ue_dl.nof_trials, (int) ue_dl.pkt_errors, (int) ue_dl.pkts_total, (int) ue_dl.nof_trials,
(float) ue_dl.pkt_errors / ue_dl.pkts_total, (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 #ifndef DISABLE_GRAPHICS
if (!prog_args.disable_plots && iodev_get_sfidx(&iodev) == 5) { if (!prog_args.disable_plots && iodev_get_sfidx(&iodev) == 5) {
@ -232,9 +241,11 @@ int main(int argc, char **argv) {
} }
#endif #endif
} else if (ret == 0) { } else if (ret == 0) {
#ifndef DISABLE_UHD
printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r", printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r",
sync_get_peak_value(&iodev.sframe.sfind), 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++; sf_cnt++;
} // Main loop } // Main loop

Loading…
Cancel
Save