Fixed memory bug with extended CP

master
ismagom 10 years ago
parent cbe159a77b
commit 256666554a

@ -256,6 +256,8 @@ int detect_and_decode_cell(cell_detect_cfg_t *config, void *uhd, int force_N_id_
} }
} }
found_cells[max_peak_cell].cp = CPEXT;
printf("Decoding PBCH for cell %d (N_id_2=%d)\n", found_cells[max_peak_cell].cell_id, max_peak_cell); printf("Decoding PBCH for cell %d (N_id_2=%d)\n", found_cells[max_peak_cell].cell_id, max_peak_cell);
if (decode_pbch(uhd, &found_cells[max_peak_cell], 400, bch_payload, &nof_tx_ports, NULL)) { if (decode_pbch(uhd, &found_cells[max_peak_cell], 400, bch_payload, &nof_tx_ports, NULL)) {
fprintf(stderr, "Could not decode PBCH from CELL ID %d\n", found_cells[max_peak_cell].cell_id); fprintf(stderr, "Could not decode PBCH from CELL ID %d\n", found_cells[max_peak_cell].cell_id);

@ -273,10 +273,10 @@ int main(int argc, char **argv) {
if ((sf_cnt%10)==0) { if ((sf_cnt%10)==0) {
printf("CFO: %+6.2f KHz, SFO: %+6.2f Khz, SNR: %5.1f dB, NOI: %.2f, " printf("CFO: %+6.2f KHz, SFO: %+6.2f Khz, SNR: %5.1f dB, NOI: %.2f, "
"PDCCH-Miss: %5.2f%%, PDSCH-BLER: %5.2f%% (%d blocks)\r", "PDCCH-Miss: %d/%d, PDSCH-BLER: %5.2f%% (%d blocks)\n",
ue_sync_get_cfo(&ue_sync)/1000, ue_sync_get_sfo(&ue_sync)/1000, ue_sync_get_cfo(&ue_sync)/1000, ue_sync_get_sfo(&ue_sync)/1000,
10*log10f(snr), pdsch_average_noi(&ue_dl.pdsch), 10*log10f(snr), pdsch_average_noi(&ue_dl.pdsch),
100*(1-(float) ue_dl.nof_pdcch_detected/nof_trials), nof_trials-ue_dl.nof_pdcch_detected, nof_trials,
(float) 100*ue_dl.pkt_errors/ue_dl.pkts_total,nof_trials, ue_dl.pkts_total); (float) 100*ue_dl.pkt_errors/ue_dl.pkts_total,nof_trials, ue_dl.pkts_total);
} }

@ -255,17 +255,29 @@ static void interpolate_pilots(chest_dl_t *q, cf_t *ce, uint32_t port_id)
} }
/* Now interpolate in the time domain between symbols */ /* Now interpolate in the time domain between symbols */
if (nsymbols == 4) { if (CP_ISNORM(q->cell.cp)) {
interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 3); if (nsymbols == 4) {
interp_linear_vector(&q->interp_linvec, &cesymb(4), &cesymb(7), &cesymb(5), 2); interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 3);
interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(11), &cesymb(8), 3); interp_linear_vector(&q->interp_linvec, &cesymb(4), &cesymb(7), &cesymb(5), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(11), &cesymb(12), 2); interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(11), &cesymb(8), 3);
interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(11), &cesymb(12), 2);
} else {
interp_linear_vector(&q->interp_linvec, &cesymb(8), &cesymb(1), &cesymb(0), 1);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(8), &cesymb(2), 6);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(8), &cesymb(9), 5);
}
} else { } else {
interp_linear_vector(&q->interp_linvec, &cesymb(8), &cesymb(1), &cesymb(0), 1); if (nsymbols == 4) {
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(8), &cesymb(2), 6); interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(3), &cesymb(1), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(8), &cesymb(9), 5); interp_linear_vector(&q->interp_linvec, &cesymb(3), &cesymb(6), &cesymb(4), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(6), &cesymb(9), &cesymb(7), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(6), &cesymb(9), &cesymb(9), 2);
} else {
interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(1), &cesymb(0), 1);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(7), &cesymb(2), 5);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(7), &cesymb(8), 4);
}
} }
} }
float chest_dl_rssi(lte_cell_t cell, cf_t *input) { float chest_dl_rssi(lte_cell_t cell, cf_t *input) {

@ -255,10 +255,17 @@ int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value)
/* Find maximum of the absolute value of the correlation */ /* Find maximum of the absolute value of the correlation */
corr_peak_pos = vec_max_abs_ci(q->conv_output, conv_output_len-1); corr_peak_pos = vec_max_abs_ci(q->conv_output, conv_output_len-1);
if (corr_peak_value) { if (corr_peak_pos <= q->frame_size) {
*corr_peak_value = cabsf(q->conv_output[corr_peak_pos]); if (corr_peak_value) {
*corr_peak_value = cabsf(q->conv_output[corr_peak_pos]);
}
ret = (int) corr_peak_pos;
} else {
ret = q->frame_size;
if (corr_peak_value) {
*corr_peak_value = 0.0;
}
} }
ret = (int) corr_peak_pos;
} }
return ret; return ret;
} }

@ -301,7 +301,7 @@ int sync_find(sync_t *q, cf_t *input, uint32_t find_offset, uint32_t *peak_posit
ret = 0; ret = 0;
} }
INFO("SYNC ret=%d N_id_2=%d pos=%d peak=%.2f/%.2f=%.2f threshold=%.2f sf_idx=%d offset=%d\n", printf("SYNC ret=%d N_id_2=%d pos=%d peak=%.2f/%.2f=%.2f threshold=%.2f sf_idx=%d offset=%d\n",
ret, q->N_id_2, peak_pos, peak_unnormalized,energy,q->peak_value, q->threshold, q->sf_idx, find_offset); ret, q->N_id_2, peak_pos, peak_unnormalized,energy,q->peak_value, q->threshold, q->sf_idx, find_offset);
} else if (lte_N_id_2_isvalid(q->N_id_2)) { } else if (lte_N_id_2_isvalid(q->N_id_2)) {

Loading…
Cancel
Save