|
|
|
@ -36,6 +36,7 @@
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
|
|
#include "liblte/rrc/rrc.h"
|
|
|
|
|
#include "liblte/phy/phy.h"
|
|
|
|
|
#include "liblte/cuhd/cuhd.h"
|
|
|
|
|
#include "cell_search_utils.h"
|
|
|
|
@ -105,7 +106,7 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* TODO: Do something with the output data */
|
|
|
|
|
uint8_t data[10000];
|
|
|
|
|
uint8_t data[10000], data_unpacked[1000];
|
|
|
|
|
|
|
|
|
|
int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) {
|
|
|
|
|
DEBUG(" ---- Receive %d samples ---- \n", nsamples);
|
|
|
|
@ -121,6 +122,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
int64_t sf_cnt;
|
|
|
|
|
ue_sync_t ue_sync;
|
|
|
|
|
void *uhd;
|
|
|
|
|
ue_dl_t ue_dl;
|
|
|
|
|
|
|
|
|
|
parse_args(&prog_args, argc, argv);
|
|
|
|
|
|
|
|
|
@ -148,6 +150,11 @@ int main(int argc, char **argv) {
|
|
|
|
|
fprintf(stderr, "Error initiating ue_sync\n");
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
if (ue_dl_init(&ue_dl, cell, 1234)) {
|
|
|
|
|
fprintf(stderr, "Error initiating UE downlink processing module\n");
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
pdsch_set_rnti(&ue_dl.pdsch, SIRNTI);
|
|
|
|
|
|
|
|
|
|
/* Initialize subframe counter */
|
|
|
|
|
sf_cnt = 0;
|
|
|
|
@ -168,6 +175,9 @@ int main(int argc, char **argv) {
|
|
|
|
|
cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t));
|
|
|
|
|
uint32_t nframes=0;
|
|
|
|
|
|
|
|
|
|
bool sib1_decoded = false;
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
/* Main loop */
|
|
|
|
|
while (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1) {
|
|
|
|
|
|
|
|
|
@ -181,6 +191,20 @@ int main(int argc, char **argv) {
|
|
|
|
|
/* iodev_receive returns 1 if successfully read 1 aligned subframe */
|
|
|
|
|
if (ret == 1) {
|
|
|
|
|
|
|
|
|
|
if (!sib1_decoded) {
|
|
|
|
|
n = ue_dl_decode(&ue_dl, sf_buffer, data, ue_sync_get_sfidx(&ue_sync), SIRNTI);
|
|
|
|
|
if (n < 0) {
|
|
|
|
|
fprintf(stderr, "\nError running receiver\n");fflush(stdout);
|
|
|
|
|
exit(-1);
|
|
|
|
|
} else if (n > 0) {
|
|
|
|
|
printf("\n\nDecoded SIB1 Message Len %d: ",n);
|
|
|
|
|
vec_fprint_hex(stdout, data, n);
|
|
|
|
|
bit_unpack_vector(data, data_unpacked, n);
|
|
|
|
|
bcch_dlsch_sib1_unpack(data_unpacked, n);
|
|
|
|
|
printf("\n");fflush(stdout);
|
|
|
|
|
sib1_decoded = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* Run FFT for all subframe data */
|
|
|
|
|
lte_fft_run_sf(&fft, sf_buffer, sf_symbols);
|
|
|
|
|
|
|
|
|
@ -198,7 +222,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
10*log10(rsrp*1000)-prog_args.uhd_gain,
|
|
|
|
|
10*log10(rsrq));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else if (ret == 0) {
|
|
|
|
|
printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r",
|
|
|
|
|
sync_get_peak_value(&ue_sync.sfind),
|
|
|
|
|