/** High-level API */ int chest_initialize(chest_hl* h) { lte_cell_t cell; if (!h->init.nof_symbols) { h->init.nof_symbols = CPNORM_NSYMB; // Normal CP } if (!h->init.nof_prb) { h->init.nof_prb = 6; } cell.id = h->init.cell_id; cell.nof_ports = h->init.nof_ports; cell.nof_prb = h->init.nof_prb; cell.cp = h->init.nof_symbols == CPNORM_NSYMB ? CPNORM : CPEXT; if (chest_init_LTEDL(&h->obj, cell)) { fprintf(stderr, "Error initializing equalizer\n"); return -1; } return 0; }
int base_init() { int i; if (filesource_init(&fsrc, input_file_name, COMPLEX_FLOAT_BIN)) { fprintf(stderr, "Error opening file %s\n", input_file_name); exit(-1); } if (matlab_file_name) { fmatlab = fopen(matlab_file_name, "w"); if (!fmatlab) { perror("fopen"); return -1; } } else { fmatlab = NULL; } input_buffer = malloc(FLEN * sizeof(cf_t)); if (!input_buffer) { perror("malloc"); exit(-1); } fft_buffer = malloc(2 * CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB * sizeof(cf_t)); if (!fft_buffer) { perror("malloc"); return -1; } for (i=0;i<cell.nof_ports;i++) { ce[i] = malloc(2 * CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB * sizeof(cf_t)); if (!ce[i]) { perror("malloc"); return -1; } } if (!lte_cell_isvalid(&cell)) { fprintf(stderr, "Invalid cell properties\n"); return -1; } if (chest_init_LTEDL(&chest, cell)) { fprintf(stderr, "Error initializing equalizer\n"); return -1; } if (lte_fft_init(&fft, cell.cp, cell.nof_prb)) { fprintf(stderr, "Error initializing FFT\n"); return -1; } if (pbch_init(&pbch, cell)) { fprintf(stderr, "Error initiating PBCH\n"); return -1; } DEBUG("Memory init OK\n",0); return 0; }
int base_init() { int i; if (filesource_init(&fsrc, input_file_name, COMPLEX_FLOAT_BIN)) { fprintf(stderr, "Error opening file %s\n", input_file_name); exit(-1); } if (matlab_file_name) { fmatlab = fopen(matlab_file_name, "w"); if (!fmatlab) { perror("fopen"); return -1; } } else { fmatlab = NULL; } flen = 2 * (SLOT_LEN(lte_symbol_sz(cell.nof_prb))); input_buffer = malloc(flen * sizeof(cf_t)); if (!input_buffer) { perror("malloc"); exit(-1); } fft_buffer = malloc(2 * CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB * sizeof(cf_t)); if (!fft_buffer) { perror("malloc"); return -1; } for (i=0;i<MAX_PORTS;i++) { ce[i] = malloc(2 * CP_NSYMB(cell.cp) * cell.nof_prb * RE_X_RB * sizeof(cf_t)); if (!ce[i]) { perror("malloc"); return -1; } } if (chest_init_LTEDL(&chest, cell)) { fprintf(stderr, "Error initializing equalizer\n"); return -1; } if (lte_fft_init(&fft, cell.cp, cell.nof_prb)) { fprintf(stderr, "Error initializing FFT\n"); return -1; } if (regs_init(®s, R_1, PHICH_NORM, cell)) { fprintf(stderr, "Error initiating regs\n"); return -1; } if (regs_set_cfi(®s, cfi)) { fprintf(stderr, "Error setting CFI %d\n", cfi); return -1; } if (pdcch_init(&pdcch, ®s, cell)) { fprintf(stderr, "Error creating PDCCH object\n"); exit(-1); } if (pdsch_init(&pdsch, cell)) { fprintf(stderr, "Error creating PDSCH object\n"); exit(-1); } pdsch_set_rnti(&pdsch, rnti); if (pdsch_harq_init(&harq_process, &pdsch)) { fprintf(stderr, "Error initiating HARQ process\n"); exit(-1); } DEBUG("Memory init OK\n",0); return 0; }