#include #include #include #include #include #include "lte.h" char *input_file_name = NULL; int nof_slots=100; float corr_peak_threshold=30; int file_binary = 0; int force_N_id_2=-1; int nof_ports = 1; #define FLEN 9600 filesource_t fsrc; cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS]; pbch_t pbch; lte_fft_t fft; chest_t chest; sync_t synch; void usage(char *prog) { printf("Usage: %s [onlt] -i input_file\n", prog); printf("\t-n number of frames [Default %d]\n", nof_slots); printf("\t-t correlation threshold [Default %g]\n", corr_peak_threshold); printf("\t-v [set verbose to debug, default none]\n"); printf("\t-b Input files is binary [Default %s]\n", file_binary?"yes":"no"); printf("\t-f force_N_id_2 [Default %d]\n", force_N_id_2); } void parse_args(int argc, char **argv) { int opt; while ((opt = getopt(argc, argv, "intvbf")) != -1) { switch(opt) { case 'i': input_file_name = argv[optind]; break; case 'n': nof_slots = atoi(argv[optind]); break; case 't': corr_peak_threshold = atof(argv[optind]); break; case 'b': file_binary = 1; break; case 'v': verbose++; break; case 'f': force_N_id_2 = atoi(argv[optind]); break; default: usage(argv[0]); exit(-1); } } if (!input_file_name) { usage(argv[0]); exit(-1); } } int base_init() { int i; file_data_type_t type = file_binary?COMPLEX_FLOAT_BIN:COMPLEX_FLOAT; if (filesource_init(&fsrc, input_file_name, type)) { fprintf(stderr, "Error opening file %s\n", input_file_name); exit(-1); } input_buffer = malloc(4 * FLEN * sizeof(cf_t)); if (!input_buffer) { perror("malloc"); exit(-1); } fft_buffer = malloc(CPNORM_NSYMB * 72 * sizeof(cf_t)); if (!fft_buffer) { perror("malloc"); return -1; } for (i=0;i= 4) { state = SYNC; } } mib_attempts++; } break; case DONE: INFO("State Done, Slot idx=%d\n", frame_idx); pbch_mib_fprint(stdout, &mib); printf("Done\n"); break; } if (read_length) { frame_idx++; if (frame_idx == 2) { frame_idx = 0; } } } sync_free(&synch); filesource_close(&fsrc); free(input_buffer); printf("Done\n"); exit(0); }