|
|
@ -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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|