Option to not wrap when reading signal from file

master
Ismael Gomez 7 years ago
parent 4cc286222d
commit 0750ff3091

@ -213,6 +213,6 @@ int main(int argc, char **argv) {
} }
} }
printf("Ok - wrote %d subframes\n", subframe_count); printf("\nOk - wrote %d subframes\n", subframe_count);
exit(0); exit(0);
} }

@ -97,6 +97,7 @@ typedef struct SRSLTE_API {
srslte_filesource_t file_source; srslte_filesource_t file_source;
bool file_mode; bool file_mode;
float file_cfo; float file_cfo;
bool file_wrap_enable;
srslte_cfo_t file_cfo_correct; srslte_cfo_t file_cfo_correct;
srslte_ue_sync_state_t state; srslte_ue_sync_state_t state;
@ -185,6 +186,9 @@ SRSLTE_API int srslte_ue_sync_init_file_multi(srslte_ue_sync_t *q,
SRSLTE_API void srslte_ue_sync_free(srslte_ue_sync_t *q); SRSLTE_API void srslte_ue_sync_free(srslte_ue_sync_t *q);
SRSLTE_API void srslte_ue_sync_file_wrap(srslte_ue_sync_t *q,
bool enable);
SRSLTE_API int srslte_ue_sync_set_cell(srslte_ue_sync_t *q, SRSLTE_API int srslte_ue_sync_set_cell(srslte_ue_sync_t *q,
srslte_cell_t cell); srslte_cell_t cell);

@ -58,6 +58,10 @@ int srslte_ue_sync_init_file(srslte_ue_sync_t *q, uint32_t nof_prb, char *file_n
return srslte_ue_sync_init_file_multi(q, nof_prb, file_name, offset_time, offset_freq, 1); return srslte_ue_sync_init_file_multi(q, nof_prb, file_name, offset_time, offset_freq, 1);
} }
void srslte_ue_sync_file_wrap(srslte_ue_sync_t *q, bool enable) {
q->file_wrap_enable = enable;
}
int srslte_ue_sync_init_file_multi(srslte_ue_sync_t *q, uint32_t nof_prb, char *file_name, int offset_time, int srslte_ue_sync_init_file_multi(srslte_ue_sync_t *q, uint32_t nof_prb, char *file_name, int offset_time,
float offset_freq, uint32_t nof_rx_ant) { float offset_freq, uint32_t nof_rx_ant) {
int ret = SRSLTE_ERROR_INVALID_INPUTS; int ret = SRSLTE_ERROR_INVALID_INPUTS;
@ -69,6 +73,7 @@ int srslte_ue_sync_init_file_multi(srslte_ue_sync_t *q, uint32_t nof_prb, char *
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;
bzero(q, sizeof(srslte_ue_sync_t)); bzero(q, sizeof(srslte_ue_sync_t));
q->file_mode = true; q->file_mode = true;
q->file_wrap_enable = true;
q->sf_len = SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)); q->sf_len = SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb));
q->file_cfo = -offset_freq; q->file_cfo = -offset_freq;
q->fft_size = srslte_symbol_sz(nof_prb); q->fft_size = srslte_symbol_sz(nof_prb);
@ -691,6 +696,7 @@ int srslte_ue_sync_zerocopy_multi(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (n == 0) { if (n == 0) {
if (q->file_wrap_enable) {
srslte_filesource_seek(&q->file_source, 0); srslte_filesource_seek(&q->file_source, 0);
q->sf_idx = 9; q->sf_idx = 9;
n = srslte_filesource_read_multi(&q->file_source, (void **) input_buffer, q->sf_len, q->nof_rx_antennas); n = srslte_filesource_read_multi(&q->file_source, (void **) input_buffer, q->sf_len, q->nof_rx_antennas);
@ -698,6 +704,9 @@ int srslte_ue_sync_zerocopy_multi(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE
fprintf(stderr, "Error reading input file\n"); fprintf(stderr, "Error reading input file\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
} else {
return SRSLTE_ERROR;
}
} }
if (q->cfo_correct_enable_track) { if (q->cfo_correct_enable_track) {
for (int i = 0; i < q->nof_rx_antennas; i++) { for (int i = 0; i < q->nof_rx_antennas; i++) {

Loading…
Cancel
Save