int main(int argc, char **argv) { pbch_mib_t mib; int n; if (argc < 3) { usage(argv[0]); exit(-1); } parse_args(argc,argv); if (base_init()) { fprintf(stderr, "Error initializing receiver\n"); exit(-1); } n = filesource_read(&fsrc, input_buffer, FLEN); lte_fft_run_sf(&fft, input_buffer, fft_buffer); if (fmatlab) { fprintf(fmatlab, "outfft="); vec_sc_prod_cfc(fft_buffer, 1000.0, fft_buffer, CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB); vec_fprint_c(fmatlab, fft_buffer, CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB); fprintf(fmatlab, ";\n"); vec_sc_prod_cfc(fft_buffer, 0.001, fft_buffer, CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB); } /* Get channel estimates for each port */ chest_ce_sf(&chest, fft_buffer, ce, 0); INFO("Decoding PBCH\n", 0); n = pbch_decode(&pbch, fft_buffer, ce, &mib); base_free(); if (n < 0) { fprintf(stderr, "Error decoding PBCH\n"); exit(-1); } else if (n == 0) { printf("Could not decode PBCH\n"); exit(-1); } else { if (mib.nof_ports == 2 && mib.nof_prb == 50 && mib.phich_length == PHICH_NORM && mib.phich_resources == R_1 && mib.sfn == 28) { pbch_mib_fprint(stdout, &mib, cell.id); printf("This is the signal.1.92M.dat file\n"); exit(0); } else { pbch_mib_fprint(stdout, &mib, cell.id); printf("This is an unknown file\n"); exit(-1); } } }
/** This function must be called in an subframe basis (1ms) for LTE */ int chest_work(chest_hl* hl) { chest_t *q = &hl->obj; chest_ce_sf(q, hl->input, hl->output, hl->ctrl_in.sf_idx); return 0; }