From 8605b6d24c6ecfec232fc591d206b9388038652c Mon Sep 17 00:00:00 2001 From: ismagom Date: Wed, 18 Mar 2015 13:41:50 +0100 Subject: [PATCH] Added prefix until fft.h --- matlab/tests/drms_pusch_test.m | 2 +- mex/include/srslte/mex/mexutils.h | 2 +- mex/lib/mexutils.c | 2 +- srslte/examples/cell_measurement.c | 26 +-- srslte/examples/cell_search.c | 2 +- srslte/examples/cuhd_utils.c | 6 +- srslte/examples/cuhd_utils.h | 6 +- srslte/examples/hl_example.c | 6 +- srslte/examples/pdsch_enodeb.c | 26 +-- srslte/examples/pdsch_ue.c | 18 +- srslte/examples/prach_ue.c | 10 +- .../include/srslte/ch_estimation/chest_dl.h | 80 ++++----- .../srslte/ch_estimation/refsignal_dl.h | 58 +++---- .../srslte/ch_estimation/refsignal_ul.h | 98 +++++------ srslte/include/srslte/channel/ch_awgn.h | 30 ++-- srslte/include/srslte/common/fft.h | 44 ++--- srslte/include/srslte/common/phy_common.h | 24 +-- srslte/include/srslte/common/sequence.h | 2 +- srslte/include/srslte/filter/dft_precoding.h | 4 +- srslte/include/srslte/mimo/precoding.h | 8 +- srslte/include/srslte/phch/dci.h | 2 +- srslte/include/srslte/phch/harq.h | 4 +- srslte/include/srslte/phch/pbch.h | 20 +-- srslte/include/srslte/phch/pcfich.h | 16 +- srslte/include/srslte/phch/pdcch.h | 16 +- srslte/include/srslte/phch/pdsch.h | 20 +-- srslte/include/srslte/phch/phich.h | 18 +- srslte/include/srslte/phch/prach.h | 8 +- srslte/include/srslte/phch/pucch.h | 14 +- srslte/include/srslte/phch/pusch.h | 6 +- srslte/include/srslte/phch/ra.h | 4 +- srslte/include/srslte/phch/regs.h | 4 +- srslte/include/srslte/resampling/interp.h | 24 +-- srslte/include/srslte/scrambling/scrambling.h | 2 +- srslte/include/srslte/sync/pss.h | 4 +- srslte/include/srslte/sync/sss.h | 4 +- srslte/include/srslte/sync/sync.h | 8 +- srslte/include/srslte/ue/ue_cell_search.h | 2 +- srslte/include/srslte/ue/ue_dl.h | 10 +- srslte/include/srslte/ue/ue_mib.h | 12 +- srslte/include/srslte/ue/ue_sync.h | 4 +- srslte/include/srslte/ue/ue_ul.h | 12 +- srslte/include/srslte/utils/convolution.h | 6 +- srslte/include/srslte/utils/dft.h | 24 +-- srslte/lib/ch_estimation/src/chest_dl.c | 154 +++++++++--------- srslte/lib/ch_estimation/src/refsignal_dl.c | 58 +++---- srslte/lib/ch_estimation/src/refsignal_ul.c | 50 +++--- srslte/lib/ch_estimation/test/chest_test_dl.c | 14 +- .../ch_estimation/test/chest_test_dl_mex.c | 34 ++-- .../ch_estimation/test/refsignal_pusch_mex.c | 20 +-- .../ch_estimation/test/refsignal_ul_test.c | 22 +-- srslte/lib/channel/src/ch_awgn.c | 14 +- srslte/lib/common/src/fft.c | 36 ++-- srslte/lib/common/src/phy_common.c | 10 +- srslte/lib/common/test/fft_test.c | 10 +- srslte/lib/fec/test/turbodecoder_test.c | 2 +- srslte/lib/fec/test/viterbi_test.c | 4 +- srslte/lib/mimo/src/precoding.c | 16 +- srslte/lib/mimo/test/precoding_test.c | 4 +- srslte/lib/modem/test/soft_demod_test.c | 2 +- srslte/lib/phch/src/dci.c | 2 +- srslte/lib/phch/src/harq.c | 4 +- srslte/lib/phch/src/pbch.c | 22 +-- srslte/lib/phch/src/pcfich.c | 24 +-- srslte/lib/phch/src/pdcch.c | 14 +- srslte/lib/phch/src/pdsch.c | 14 +- srslte/lib/phch/src/phich.c | 28 ++-- srslte/lib/phch/src/prach.c | 8 +- srslte/lib/phch/src/pucch.c | 12 +- srslte/lib/phch/src/pusch.c | 6 +- srslte/lib/phch/src/ra.c | 6 +- srslte/lib/phch/src/regs.c | 4 +- srslte/lib/phch/src/sequences.c | 2 +- srslte/lib/phch/src/uci.c | 4 +- srslte/lib/phch/test/dlsch_encode_test_mex.c | 2 +- srslte/lib/phch/test/pbch_file_test.c | 26 +-- srslte/lib/phch/test/pbch_test.c | 6 +- srslte/lib/phch/test/pbch_test_mex.c | 26 +-- srslte/lib/phch/test/pcfich_file_test.c | 26 +-- srslte/lib/phch/test/pcfich_test.c | 12 +- srslte/lib/phch/test/pcfich_test_mex.c | 22 +-- srslte/lib/phch/test/pdcch_file_test.c | 26 +-- srslte/lib/phch/test/pdcch_test.c | 12 +- srslte/lib/phch/test/pdcch_test_mex.c | 22 +-- srslte/lib/phch/test/pdsch_file_test.c | 28 ++-- srslte/lib/phch/test/pdsch_test.c | 12 +- srslte/lib/phch/test/pdsch_test_mex.c | 24 +-- srslte/lib/phch/test/phich_file_test.c | 26 +-- srslte/lib/phch/test/phich_test.c | 12 +- srslte/lib/phch/test/pusch_encode_test_mex.c | 10 +- srslte/lib/phch/test/pusch_test.c | 6 +- srslte/lib/phch/test/ulsch_encode_test_mex.c | 2 +- srslte/lib/resampling/src/interp.c | 28 ++-- srslte/lib/scrambling/src/scrambling.c | 10 +- srslte/lib/scrambling/test/scrambling_test.c | 2 +- srslte/lib/sync/src/pss.c | 4 +- srslte/lib/sync/src/sss.c | 2 +- srslte/lib/sync/src/sync.c | 8 +- srslte/lib/sync/test/pss_mex.c | 2 +- srslte/lib/sync/test/pss_usrp.c | 4 +- srslte/lib/sync/test/sss_mex.c | 2 +- srslte/lib/sync/test/sync_test.c | 4 +- srslte/lib/ue/src/ue_cell_search.c | 4 +- srslte/lib/ue/src/ue_dl.c | 22 +-- srslte/lib/ue/src/ue_mib.c | 30 ++-- srslte/lib/ue/src/ue_sync.c | 2 +- srslte/lib/ue/src/ue_ul.c | 22 +-- srslte/lib/utils/src/dft.c | 26 +-- srslte/lib/utils/test/dft_test.c | 4 +- 109 files changed, 887 insertions(+), 887 deletions(-) diff --git a/matlab/tests/drms_pusch_test.m b/matlab/tests/drms_pusch_test.m index 468f5b237..ec1237f75 100644 --- a/matlab/tests/drms_pusch_test.m +++ b/matlab/tests/drms_pusch_test.m @@ -28,7 +28,7 @@ for prb=4 subframe_mat = lteULResourceGrid(ueConfig); subframe_mat(ind)=mat; - subframe_lib=liblte_refsignal_pusch(ueConfig,puschConfig); + subframe_lib=liblte_srslte_refsignal_pusch(ueConfig,puschConfig); error(k)=mean(abs(subframe_mat(:)-subframe_lib(:))); disp(error(k)) diff --git a/mex/include/srslte/mex/mexutils.h b/mex/include/srslte/mex/mexutils.h index 68021d638..95e5c2d96 100644 --- a/mex/include/srslte/mex/mexutils.h +++ b/mex/include/srslte/mex/mexutils.h @@ -45,7 +45,7 @@ typedef _Complex float cf_t; SRSLTE_API bool mexutils_isScalar(const mxArray *ptr); SRSLTE_API int mexutils_read_cell(const mxArray *ptr, - lte_cell_t *cell); + srslte_cell_t *cell); SRSLTE_API char *mexutils_get_char_struct(const mxArray *ptr, const char *field_name); diff --git a/mex/lib/mexutils.c b/mex/lib/mexutils.c index ef7e65d09..54381a035 100644 --- a/mex/lib/mexutils.c +++ b/mex/lib/mexutils.c @@ -72,7 +72,7 @@ int mexutils_read_float_struct(const mxArray *ptr, const char *field_name, float return 0; } -int mexutils_read_cell(const mxArray *ptr, lte_cell_t *cell) { +int mexutils_read_cell(const mxArray *ptr, srslte_cell_t *cell) { if (mexutils_read_uint32_struct(ptr, "NCellID", &cell->id)) { return -1; } diff --git a/srslte/examples/cell_measurement.c b/srslte/examples/cell_measurement.c index 1827c510e..b7a34f378 100644 --- a/srslte/examples/cell_measurement.c +++ b/srslte/examples/cell_measurement.c @@ -134,14 +134,14 @@ int main(int argc, char **argv) { int ret; cf_t *sf_buffer; prog_args_t prog_args; - lte_cell_t cell; + srslte_cell_t cell; int64_t sf_cnt; ue_sync_t ue_sync; ue_mib_t ue_mib; void *uhd; ue_dl_t ue_dl; - lte_fft_t fft; - chest_dl_t chest; + srslte_fft_t fft; + srslte_chest_dl_t chest; uint32_t nframes=0; uint32_t nof_trials = 0; uint32_t sfn = 0; // system frame number @@ -149,7 +149,7 @@ int main(int argc, char **argv) { uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_unpacked[BCH_PAYLOAD_LEN]; uint32_t sfn_offset; float rssi_utra=0,rssi=0, rsrp=0, rsrq=0, snr=0; - cf_t *ce[MAX_PORTS]; + cf_t *ce[SRSLTE_MAX_PORTS]; if (parse_args(&prog_args, argc, argv)) { exit(-1); @@ -209,11 +209,11 @@ int main(int argc, char **argv) { /* Initialize subframe counter */ sf_cnt = 0; - if (lte_fft_init(&fft, cell.cp, cell.nof_prb)) { + if (srslte_fft_init(&fft, cell.cp, cell.nof_prb)) { fprintf(stderr, "Error initiating FFT\n"); return -1; } - if (chest_dl_init(&chest, cell)) { + if (srslte_chest_dl_init(&chest, cell)) { fprintf(stderr, "Error initiating channel estimator\n"); return -1; } @@ -222,7 +222,7 @@ int main(int argc, char **argv) { cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t)); - for (int i=0;i config.threshold/2) { - lte_cell_t cell; + srslte_cell_t cell; cell.id = found_cells[i].cell_id; cell.cp = found_cells[i].cp; int ret = cuhd_mib_decoder(uhd, 100, &cell); diff --git a/srslte/examples/cuhd_utils.c b/srslte/examples/cuhd_utils.c index 009ed1a72..6cd328050 100644 --- a/srslte/examples/cuhd_utils.c +++ b/srslte/examples/cuhd_utils.c @@ -51,7 +51,7 @@ int cuhd_recv_wrapper_cs(void *h, void *data, uint32_t nsamples, timestamp_t *t) /** This function is simply a wrapper to the ue_cell_search module for cuhd devices * Return 1 if the MIB is decoded, 0 if not or -1 on error. */ -int cuhd_mib_decoder(void *uhd, uint32_t max_nof_frames, lte_cell_t *cell) { +int cuhd_mib_decoder(void *uhd, uint32_t max_nof_frames, srslte_cell_t *cell) { int ret = SRSLTE_ERROR; ue_mib_sync_t ue_mib; uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_unpacked[BCH_PAYLOAD_LEN]; @@ -90,7 +90,7 @@ clean_exit: /** This function is simply a wrapper to the ue_cell_search module for cuhd devices */ int cuhd_cell_search(void *uhd, cell_search_cfg_t *config, - int force_N_id_2, lte_cell_t *cell) + int force_N_id_2, srslte_cell_t *cell) { int ret = SRSLTE_ERROR; ue_cell_search_t cs; @@ -150,7 +150,7 @@ int cuhd_cell_search(void *uhd, cell_search_cfg_t *config, * 0 if no cell was found or MIB could not be decoded, * -1 on error */ -int cuhd_search_and_decode_mib(void *uhd, cell_search_cfg_t *config, int force_N_id_2, lte_cell_t *cell) +int cuhd_search_and_decode_mib(void *uhd, cell_search_cfg_t *config, int force_N_id_2, srslte_cell_t *cell) { int ret = SRSLTE_ERROR; diff --git a/srslte/examples/cuhd_utils.h b/srslte/examples/cuhd_utils.h index efba70a2a..4360b7f16 100644 --- a/srslte/examples/cuhd_utils.h +++ b/srslte/examples/cuhd_utils.h @@ -36,16 +36,16 @@ typedef struct SRSLTE_API { int cuhd_mib_decoder(void *uhd, uint32_t max_nof_frames, - lte_cell_t *cell); + srslte_cell_t *cell); int cuhd_cell_search(void *uhd, cell_search_cfg_t *config, int force_N_id_2, - lte_cell_t *cell); + srslte_cell_t *cell); int cuhd_search_and_decode_mib(void *uhd, cell_search_cfg_t *config, int force_N_id_2, - lte_cell_t *cell); + srslte_cell_t *cell); diff --git a/srslte/examples/hl_example.c b/srslte/examples/hl_example.c index 0883e31cc..d042bc73f 100644 --- a/srslte/examples/hl_example.c +++ b/srslte/examples/hl_example.c @@ -40,7 +40,7 @@ void usage(char *arg) { int main(int argc, char **argv) { binsource_hl bs; mod_hl mod; - ch_awgn_hl ch; + srslte_ch_awgn_hl ch; demod_soft_hl demod_s; demod_hard_hl demod_h; @@ -88,7 +88,7 @@ int main(int argc, char **argv) { if ( binsource_initialize(&bs) || mod_initialize(&mod) || - ch_awgn_initialize(&ch) || + srslte_ch_awgn_initialize(&ch) || demod_hard_initialize(&demod_h) || demod_soft_initialize(&demod_s) ) { @@ -98,7 +98,7 @@ int main(int argc, char **argv) { binsource_work(&bs); mod_work(&mod); - ch_awgn_work(&ch); + srslte_ch_awgn_work(&ch); demod_hard_work(&demod_h); demod_soft_work(&demod_s); diff --git a/srslte/examples/pdsch_enodeb.c b/srslte/examples/pdsch_enodeb.c index 07b69b63a..1744e18f9 100644 --- a/srslte/examples/pdsch_enodeb.c +++ b/srslte/examples/pdsch_enodeb.c @@ -49,7 +49,7 @@ char *output_file_name = NULL; #define UP_KEY 65 #define DOWN_KEY 66 -lte_cell_t cell = { +srslte_cell_t cell = { 6, // nof_prb 1, // nof_ports 1, // cell_id @@ -69,7 +69,7 @@ float uhd_amp = 0.03, uhd_gain = 70.0, uhd_freq = 2400000000; bool null_file_sink=false; filesink_t fsink; -lte_fft_t ifft; +srslte_fft_t ifft; pbch_t pbch; pcfich_t pcfich; pdcch_t pdcch; @@ -220,7 +220,7 @@ void base_init() { fprintf(stderr, "Error creating iFFT object\n"); exit(-1); } - lte_fft_set_normalize(&ifft, true); + srslte_fft_set_normalize(&ifft, true); if (pbch_init(&pbch, cell)) { fprintf(stderr, "Error creating PBCH object\n"); exit(-1); @@ -444,12 +444,12 @@ int main(int argc, char **argv) { float sss_signal5[SSS_LEN]; // for subframe 5 uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_packed[BCH_PAYLOAD_LEN/8]; int i; - cf_t *sf_symbols[MAX_PORTS]; - cf_t *slot1_symbols[MAX_PORTS]; + cf_t *sf_symbols[SRSLTE_MAX_PORTS]; + cf_t *slot1_symbols[SRSLTE_MAX_PORTS]; dci_msg_t dci_msg; - dci_location_t locations[NSUBFRAMES_X_FRAME][30]; + dci_location_t locations[SRSLTE_NSUBFRAMES_X_FRAME][30]; uint32_t sfn; - chest_dl_t est; + srslte_chest_dl_t est; #ifdef DISABLE_UHD if (argc < 3) { @@ -461,7 +461,7 @@ int main(int argc, char **argv) { parse_args(argc, argv); N_id_2 = cell.id % 3; - sf_n_re = 2 * CPNORM_NSYMB * cell.nof_prb * RE_X_RB; + sf_n_re = 2 * SRSLTE_CPNORM_NSYMB * cell.nof_prb * RE_X_RB; sf_n_samples = 2 * SLOT_LEN(lte_symbol_sz(cell.nof_prb)); cell.phich_length = PHICH_NORM; @@ -479,12 +479,12 @@ int main(int argc, char **argv) { sss_generate(sss_signal0, sss_signal5, cell.id); /* Generate CRS signals */ - if (chest_dl_init(&est, cell)) { + if (srslte_chest_dl_init(&est, cell)) { fprintf(stderr, "Error initializing equalizer\n"); exit(-1); } - for (i = 0; i < MAX_PORTS; i++) { // now there's only 1 port + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { // now there's only 1 port sf_symbols[i] = sf_buffer; slot1_symbols[i] = &sf_buffer[SLOT_LEN_RE(cell.nof_prb, cell.cp)]; } @@ -511,7 +511,7 @@ int main(int argc, char **argv) { } /* Initiate valid DCI locations */ - for (i=0;i 1000) { diff --git a/srslte/include/srslte/ch_estimation/chest_dl.h b/srslte/include/srslte/ch_estimation/chest_dl.h index bfff17aa9..4a6ebe162 100644 --- a/srslte/include/srslte/ch_estimation/chest_dl.h +++ b/srslte/include/srslte/ch_estimation/chest_dl.h @@ -45,70 +45,70 @@ * * The equalizer uses the channel estimates to produce an estimation of the transmitted symbol. * - * This object depends on the refsignal_t object for creating the LTE CSR signal. + * This object depends on the srslte_refsignal_t object for creating the LTE CSR signal. */ -#define CHEST_MAX_FILTER_FREQ_LEN 10 -#define CHEST_MAX_FILTER_TIME_LEN 4 +#define SRSLTE_CHEST_MAX_FILTER_FREQ_LEN 10 +#define SRSLTE_CHEST_MAX_FILTER_TIME_LEN 4 typedef struct { - lte_cell_t cell; - refsignal_cs_t csr_signal; - cf_t *pilot_estimates[MAX_PORTS]; - cf_t *pilot_estimates_average[MAX_PORTS]; - cf_t *pilot_recv_signal[MAX_PORTS]; + srslte_cell_t cell; + srslte_refsignal_cs_t csr_signal; + cf_t *pilot_estimates[SRSLTE_MAX_PORTS]; + cf_t *pilot_estimates_average[SRSLTE_MAX_PORTS]; + cf_t *pilot_recv_signal[SRSLTE_MAX_PORTS]; uint32_t filter_freq_len; - float filter_freq[CHEST_MAX_FILTER_FREQ_LEN]; + float filter_freq[SRSLTE_CHEST_MAX_FILTER_FREQ_LEN]; uint32_t filter_time_len; - float filter_time[CHEST_MAX_FILTER_TIME_LEN]; + float filter_time[SRSLTE_CHEST_MAX_FILTER_TIME_LEN]; cf_t *tmp_noise; cf_t *tmp_freqavg; - cf_t *tmp_timeavg[CHEST_MAX_FILTER_TIME_LEN]; + cf_t *tmp_timeavg[SRSLTE_CHEST_MAX_FILTER_TIME_LEN]; cf_t *tmp_timeavg_mult; - interp_linvec_t interp_linvec; - interp_lin_t interp_lin; + srslte_interp_linvec_t srslte_interp_linvec; + srslte_interp_lin_t srslte_interp_lin; - float rssi[MAX_PORTS]; - float rsrp[MAX_PORTS]; - float noise_estimate[MAX_PORTS]; -} chest_dl_t; + float rssi[SRSLTE_MAX_PORTS]; + float rsrp[SRSLTE_MAX_PORTS]; + float noise_estimate[SRSLTE_MAX_PORTS]; +} srslte_chest_dl_t; -SRSLTE_API int chest_dl_init(chest_dl_t *q, - lte_cell_t cell); +SRSLTE_API int srslte_chest_dl_init(srslte_chest_dl_t *q, + srslte_cell_t cell); -SRSLTE_API void chest_dl_free(chest_dl_t *q); +SRSLTE_API void srslte_chest_dl_free(srslte_chest_dl_t *q); -SRSLTE_API int chest_dl_set_filter_freq(chest_dl_t *q, - float *filter, - uint32_t filter_len); +SRSLTE_API int srslte_chest_dl_set_filter_freq(srslte_chest_dl_t *q, + float *filter, + uint32_t filter_len); -SRSLTE_API int chest_dl_set_filter_time(chest_dl_t *q, - float *filter, - uint32_t filter_len); +SRSLTE_API int srslte_chest_dl_set_filter_time(srslte_chest_dl_t *q, + float *filter, + uint32_t filter_len); -SRSLTE_API int chest_dl_estimate(chest_dl_t *q, - cf_t *input, - cf_t *ce[MAX_PORTS], - uint32_t sf_idx); +SRSLTE_API int srslte_chest_dl_estimate(srslte_chest_dl_t *q, + cf_t *input, + cf_t *ce[SRSLTE_MAX_PORTS], + uint32_t sf_idx); -SRSLTE_API int chest_dl_estimate_port(chest_dl_t *q, - cf_t *input, - cf_t *ce, - uint32_t sf_idx, - uint32_t port_id); +SRSLTE_API int srslte_chest_dl_estimate_port(srslte_chest_dl_t *q, + cf_t *input, + cf_t *ce, + uint32_t sf_idx, + uint32_t port_id); -SRSLTE_API float chest_dl_get_snr(chest_dl_t *q); +SRSLTE_API float srslte_chest_dl_get_snr(srslte_chest_dl_t *q); -SRSLTE_API float chest_dl_get_noise_estimate(chest_dl_t *q); +SRSLTE_API float srslte_chest_dl_get_noise_estimate(srslte_chest_dl_t *q); -SRSLTE_API float chest_dl_get_rssi(chest_dl_t *q); +SRSLTE_API float srslte_chest_dl_get_rssi(srslte_chest_dl_t *q); -SRSLTE_API float chest_dl_get_rsrq(chest_dl_t *q); +SRSLTE_API float srslte_chest_dl_get_rsrq(srslte_chest_dl_t *q); -SRSLTE_API float chest_dl_get_rsrp(chest_dl_t *q); +SRSLTE_API float srslte_chest_dl_get_rsrp(srslte_chest_dl_t *q); #endif \ No newline at end of file diff --git a/srslte/include/srslte/ch_estimation/refsignal_dl.h b/srslte/include/srslte/ch_estimation/refsignal_dl.h index f78f0bcca..08ed8581a 100644 --- a/srslte/include/srslte/ch_estimation/refsignal_dl.h +++ b/srslte/include/srslte/ch_estimation/refsignal_dl.h @@ -25,8 +25,8 @@ * */ -#ifndef REFSIGNAL_DL_ -#define REFSIGNAL_DL_ +#ifndef SRSLTE_REFSIGNAL_DL_ +#define SRSLTE_REFSIGNAL_DL_ /* Object to manage Downlink reference signals for channel estimation. * @@ -38,46 +38,46 @@ typedef _Complex float cf_t; // Number of references in a subframe: there are 2 symbols for port_id=0,1 x 2 slots x 2 refs per prb -#define REFSIGNAL_NUM_SF(nof_prb, port_id) (((port_id)<2?8:4)*(nof_prb)) -#define REFSIGNAL_MAX_NUM_SF(nof_prb) REFSIGNAL_NUM_SF(nof_prb, 0) +#define SRSLTE_REFSIGNAL_NUM_SF(nof_prb, port_id) (((port_id)<2?8:4)*(nof_prb)) +#define SRSLTE_REFSIGNAL_MAX_NUM_SF(nof_prb) SRSLTE_REFSIGNAL_NUM_SF(nof_prb, 0) -#define REFSIGNAL_PILOT_IDX(i,l,cell) (2*cell.nof_prb*(l)+(i)) +#define SRSLTE_REFSIGNAL_PILOT_IDX(i,l,cell) (2*cell.nof_prb*(l)+(i)) /** Cell-Specific Reference Signal */ typedef struct SRSLTE_API { - lte_cell_t cell; - cf_t *pilots[2][NSUBFRAMES_X_FRAME]; // Saves the reference signal per subframe for ports 0,1 and ports 2,3 -} refsignal_cs_t; + srslte_cell_t cell; + cf_t *pilots[2][SRSLTE_NSUBFRAMES_X_FRAME]; // Saves the reference signal per subframe for ports 0,1 and ports 2,3 +} srslte_refsignal_cs_t; -SRSLTE_API int refsignal_cs_init(refsignal_cs_t *q, - lte_cell_t cell); +SRSLTE_API int srslte_refsignal_cs_init(srslte_refsignal_cs_t *q, + srslte_cell_t cell); -SRSLTE_API void refsignal_cs_free(refsignal_cs_t *q); +SRSLTE_API void srslte_refsignal_cs_free(srslte_refsignal_cs_t *q); -SRSLTE_API int refsignal_cs_put_sf(lte_cell_t cell, - uint32_t port_id, - cf_t *pilots, - cf_t *sf_symbols); +SRSLTE_API int srslte_refsignal_cs_put_sf(srslte_cell_t cell, + uint32_t port_id, + cf_t *pilots, + cf_t *sf_symbols); -SRSLTE_API int refsignal_cs_get_sf(lte_cell_t cell, - uint32_t port_id, - cf_t *sf_symbols, - cf_t *pilots); +SRSLTE_API int srslte_refsignal_cs_get_sf(srslte_cell_t cell, + uint32_t port_id, + cf_t *sf_symbols, + cf_t *pilots); -SRSLTE_API uint32_t refsignal_cs_fidx(lte_cell_t cell, - uint32_t l, - uint32_t port_id, - uint32_t m); +SRSLTE_API uint32_t srslte_refsignal_cs_fidx(srslte_cell_t cell, + uint32_t l, + uint32_t port_id, + uint32_t m); -SRSLTE_API uint32_t refsignal_cs_nsymbol(uint32_t l, - lte_cp_t cp, - uint32_t port_id); +SRSLTE_API uint32_t srslte_refsignal_cs_nsymbol(uint32_t l, + srslte_cp_t cp, + uint32_t port_id); -SRSLTE_API uint32_t refsignal_cs_v(uint32_t port_id, - uint32_t ref_symbol_idx); +SRSLTE_API uint32_t srslte_refsignal_cs_v(uint32_t port_id, + uint32_t ref_symbol_idx); -SRSLTE_API uint32_t refsignal_cs_nof_symbols(uint32_t port_id); +SRSLTE_API uint32_t srslte_refsignal_cs_nof_symbols(uint32_t port_id); #endif diff --git a/srslte/include/srslte/ch_estimation/refsignal_ul.h b/srslte/include/srslte/ch_estimation/refsignal_ul.h index 408d5fa8d..f484e4679 100644 --- a/srslte/include/srslte/ch_estimation/refsignal_ul.h +++ b/srslte/include/srslte/ch_estimation/refsignal_ul.h @@ -25,8 +25,8 @@ * */ -#ifndef REFSIGNAL_UL_ -#define REFSIGNAL_UL_ +#ifndef SRSLTE_REFSIGNAL_UL_ +#define SRSLTE_REFSIGNAL_UL_ /* Object to manage Downlink reference signals for channel estimation. * @@ -36,10 +36,10 @@ #include "srslte/phch/pucch.h" #include "srslte/common/phy_common.h" -#define NOF_GROUPS_U 30 -#define NOF_SEQUENCES_U 2 -#define NOF_DELTA_SS 30 -#define NOF_CSHIFT 8 +#define SRSLTE_NOF_GROUPS_U 30 +#define SRSLTE_NOF_SEQUENCES_U 2 +#define SRSLTE_NOF_DELTA_SS 30 +#define SRSLTE_NOF_CSHIFT 8 typedef _Complex float cf_t; @@ -51,56 +51,56 @@ typedef struct SRSLTE_API { float beta_pusch; bool group_hopping_en; bool sequence_hopping_en; -}refsignal_drms_pusch_cfg_t; +}srslte_refsignal_drms_pusch_cfg_t; typedef struct SRSLTE_API { float beta_pucch; uint32_t nof_prb; -}refsignal_srs_cfg_t; +}srslte_refsignal_srs_cfg_t; /** Uplink DeModulation Reference Signal (DMRS) */ typedef struct SRSLTE_API { - lte_cell_t cell; - uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB]; + srslte_cell_t cell; + uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB]; float *tmp_arg; - uint32_t n_prs_pusch[NOF_DELTA_SS][NSLOTS_X_FRAME]; // We precompute n_prs needed for cyclic shift alpha at refsignal_dl_init() - uint32_t f_gh[NSLOTS_X_FRAME]; - uint32_t u_pucch[NSLOTS_X_FRAME]; - uint32_t v_pusch[NSLOTS_X_FRAME][NOF_DELTA_SS]; -} refsignal_ul_t; - - -SRSLTE_API int refsignal_ul_init(refsignal_ul_t *q, - lte_cell_t cell); - -SRSLTE_API void refsignal_ul_free(refsignal_ul_t *q); - -SRSLTE_API bool refsignal_drms_pusch_cfg_isvalid(refsignal_ul_t *q, - refsignal_drms_pusch_cfg_t *cfg, - uint32_t nof_prb); - -SRSLTE_API void refsignal_drms_pusch_put(refsignal_ul_t *q, - refsignal_drms_pusch_cfg_t *cfg, - cf_t *r_pusch, - uint32_t nof_prb, - uint32_t n_prb[2], - cf_t *sf_symbols); - -SRSLTE_API int refsignal_dmrs_pusch_gen(refsignal_ul_t *q, - refsignal_drms_pusch_cfg_t *cfg, - uint32_t nof_prb, - uint32_t sf_idx, - cf_t *r_pusch); - -SRSLTE_API int refsignal_dmrs_pucch_gen(refsignal_ul_t *q, - pucch_cfg_t *cfg, - uint32_t sf_idx, - uint32_t n_rb, - cf_t *r_pucch) ; - -SRSLTE_API void refsignal_srs_gen(refsignal_ul_t *q, - refsignal_srs_cfg_t *cfg, - uint32_t sf_idx, - cf_t *r_srs); + uint32_t n_prs_pusch[SRSLTE_NOF_DELTA_SS][SRSLTE_NSLOTS_X_FRAME]; // We precompute n_prs needed for cyclic shift alpha at srslte_refsignal_dl_init() + uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME]; + uint32_t u_pucch[SRSLTE_NSLOTS_X_FRAME]; + uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS]; +} srslte_refsignal_ul_t; + + +SRSLTE_API int srslte_refsignal_ul_init(srslte_refsignal_ul_t *q, + srslte_cell_t cell); + +SRSLTE_API void srslte_refsignal_ul_free(srslte_refsignal_ul_t *q); + +SRSLTE_API bool srslte_refsignal_drms_pusch_cfg_isvalid(srslte_refsignal_ul_t *q, + srslte_refsignal_drms_pusch_cfg_t *cfg, + uint32_t nof_prb); + +SRSLTE_API void srslte_refsignal_drms_pusch_put(srslte_refsignal_ul_t *q, + srslte_refsignal_drms_pusch_cfg_t *cfg, + cf_t *r_pusch, + uint32_t nof_prb, + uint32_t n_prb[2], + cf_t *sf_symbols); + +SRSLTE_API int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q, + srslte_refsignal_drms_pusch_cfg_t *cfg, + uint32_t nof_prb, + uint32_t sf_idx, + cf_t *r_pusch); + +SRSLTE_API int srslte_refsignal_dmrs_pucch_gen(srslte_refsignal_ul_t *q, + pucch_cfg_t *cfg, + uint32_t sf_idx, + uint32_t n_rb, + cf_t *r_pucch) ; + +SRSLTE_API void srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, + srslte_refsignal_srs_cfg_t *cfg, + uint32_t sf_idx, + cf_t *r_srs); #endif diff --git a/srslte/include/srslte/channel/ch_awgn.h b/srslte/include/srslte/channel/ch_awgn.h index fb061fd9c..dcdcba785 100644 --- a/srslte/include/srslte/channel/ch_awgn.h +++ b/srslte/include/srslte/channel/ch_awgn.h @@ -36,34 +36,34 @@ typedef _Complex float cf_t; -SRSLTE_API void ch_awgn_c(const cf_t* input, - cf_t* output, - float variance, - uint32_t len); +SRSLTE_API void srslte_ch_awgn_c(const cf_t* input, + cf_t* output, + float variance, + uint32_t len); -SRSLTE_API void ch_awgn_f(const float* x, - float* y, - float variance, - uint32_t len); +SRSLTE_API void srslte_ch_awgn_f(const float* x, + float* y, + float variance, + uint32_t len); -SRSLTE_API float ch_awgn_get_variance(float ebno_db, - float rate); +SRSLTE_API float srslte_ch_awgn_get_variance(float ebno_db, + float rate); /* High-level API */ typedef struct SRSLTE_API{ const cf_t* input; int in_len; - struct ch_awgn_ctrl_in { + struct srslte_ch_awgn_ctrl_in { float variance; // Noise variance } ctrl_in; cf_t* output; int out_len; -}ch_awgn_hl; +}srslte_ch_awgn_hl; -SRSLTE_API int ch_awgn_initialize(ch_awgn_hl* hl); -SRSLTE_API int ch_awgn_work(ch_awgn_hl* hl); -SRSLTE_API int ch_awgn_stop(ch_awgn_hl* hl); +SRSLTE_API int srslte_ch_awgn_initialize(srslte_ch_awgn_hl* hl); +SRSLTE_API int srslte_ch_awgn_work(srslte_ch_awgn_hl* hl); +SRSLTE_API int srslte_ch_awgn_stop(srslte_ch_awgn_hl* hl); #endif diff --git a/srslte/include/srslte/common/fft.h b/srslte/include/srslte/common/fft.h index 210b6ed87..64030a450 100644 --- a/srslte/include/srslte/common/fft.h +++ b/srslte/include/srslte/common/fft.h @@ -41,51 +41,51 @@ typedef _Complex float cf_t; /* this is only a shortcut */ /* This is common for both directions */ typedef struct SRSLTE_API{ - dft_plan_t fft_plan; + srslte_dft_plan_t fft_plan; uint32_t nof_symbols; uint32_t symbol_sz; uint32_t nof_guards; uint32_t nof_re; uint32_t slot_sz; - lte_cp_t cp; + srslte_cp_t cp; cf_t *tmp; // for removing zero padding bool freq_shift; cf_t *shift_buffer; -}lte_fft_t; +}srslte_fft_t; -SRSLTE_API int lte_fft_init(lte_fft_t *q, - lte_cp_t cp_type, - uint32_t nof_prb); +SRSLTE_API int srslte_fft_init(srslte_fft_t *q, + srslte_cp_t cp_type, + uint32_t nof_prb); -SRSLTE_API void lte_fft_free(lte_fft_t *q); +SRSLTE_API void srslte_fft_free(srslte_fft_t *q); -SRSLTE_API void lte_fft_run_slot(lte_fft_t *q, - cf_t *input, - cf_t *output); +SRSLTE_API void srslte_fft_run_slot(srslte_fft_t *q, + cf_t *input, + cf_t *output); -SRSLTE_API void lte_fft_run_sf(lte_fft_t *q, - cf_t *input, - cf_t *output); +SRSLTE_API void srslte_fft_run_sf(srslte_fft_t *q, + cf_t *input, + cf_t *output); -SRSLTE_API int lte_ifft_init(lte_fft_t *q, - lte_cp_t cp_type, +SRSLTE_API int lte_ifft_init(srslte_fft_t *q, + srslte_cp_t cp_type, uint32_t nof_prb); -SRSLTE_API void lte_ifft_free(lte_fft_t *q); +SRSLTE_API void lte_ifft_free(srslte_fft_t *q); -SRSLTE_API void lte_ifft_run_slot(lte_fft_t *q, +SRSLTE_API void lte_ifft_run_slot(srslte_fft_t *q, cf_t *input, cf_t *output); -SRSLTE_API void lte_ifft_run_sf(lte_fft_t *q, +SRSLTE_API void lte_ifft_run_sf(srslte_fft_t *q, cf_t *input, cf_t *output); -SRSLTE_API int lte_fft_set_freq_shift(lte_fft_t *q, - float freq_shift); +SRSLTE_API int srslte_fft_set_freq_shift(srslte_fft_t *q, + float freq_shift); -SRSLTE_API void lte_fft_set_normalize(lte_fft_t *q, - bool normalize_enable); +SRSLTE_API void srslte_fft_set_normalize(srslte_fft_t *q, + bool normalize_enable); #endif diff --git a/srslte/include/srslte/common/phy_common.h b/srslte/include/srslte/common/phy_common.h index 9bfbecc19..dfae48189 100644 --- a/srslte/include/srslte/common/phy_common.h +++ b/srslte/include/srslte/common/phy_common.h @@ -36,12 +36,12 @@ #include "srslte/config.h" -#define NSUBFRAMES_X_FRAME 10 -#define NSLOTS_X_FRAME (2*NSUBFRAMES_X_FRAME) +#define SRSLTE_NSUBFRAMES_X_FRAME 10 +#define SRSLTE_NSLOTS_X_FRAME (2*SRSLTE_NSUBFRAMES_X_FRAME) #define LTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE -#define MAX_PORTS 4 +#define SRSLTE_MAX_PORTS 4 #define MAX_LAYERS 8 #define MAX_CODEWORDS 2 @@ -50,7 +50,7 @@ #define LTE_CRC16 0x11021 #define LTE_CRC8 0x19B -typedef enum {CPNORM, CPEXT} lte_cp_t; +typedef enum {CPNORM, CPEXT} srslte_cp_t; #define CRNTI_START 0x003D @@ -70,8 +70,8 @@ typedef enum {CPNORM, CPEXT} lte_cp_t; #define SYMBOL_SZ_MAX 2048 -#define CPNORM_NSYMB 7 -#define CPNORM_SF_NSYMB (2*CPNORM_NSYMB) +#define SRSLTE_CPNORM_NSYMB 7 +#define CPNORM_SF_NSYMB (2*SRSLTE_CPNORM_NSYMB) #define CPNORM_0_LEN 160 #define CPNORM_LEN 144 @@ -82,7 +82,7 @@ typedef enum {CPNORM, CPEXT} lte_cp_t; #define CP_ISNORM(cp) (cp==CPNORM) #define CP_ISEXT(cp) (cp==CPEXT) -#define CP_NSYMB(cp) (CP_ISNORM(cp)?CPNORM_NSYMB:CPEXT_NSYMB) +#define CP_NSYMB(cp) (CP_ISNORM(cp)?SRSLTE_CPNORM_NSYMB:CPEXT_NSYMB) #define CP(symbol_sz, c) ((int) ceil((((float) (c)*(symbol_sz))/2048))) #define CP_NORM(symbol, symbol_sz) ((symbol==0)?CP((symbol_sz),CPNORM_0_LEN):CP((symbol_sz),CPNORM_LEN)) @@ -131,10 +131,10 @@ typedef struct SRSLTE_API { uint32_t nof_ports; uint32_t bw_idx; uint32_t id; - lte_cp_t cp; + srslte_cp_t cp; phich_length_t phich_length; phich_resources_t phich_resources; -}lte_cell_t; +}srslte_cell_t; typedef enum SRSLTE_API { SINGLE_ANTENNA,TX_DIVERSITY, SPATIAL_MULTIPLEX @@ -153,10 +153,10 @@ enum band_geographical_area { ALL, NAR, APAC, EMEA, JAPAN, CALA, NA }; -SRSLTE_API bool lte_cell_isvalid(lte_cell_t *cell); +SRSLTE_API bool lte_cell_isvalid(srslte_cell_t *cell); SRSLTE_API void lte_cell_fprint(FILE *stream, - lte_cell_t *cell); + srslte_cell_t *cell); SRSLTE_API bool lte_cellid_isvalid(uint32_t cell_id); @@ -195,7 +195,7 @@ SRSLTE_API int lte_cb_size(uint32_t index); SRSLTE_API bool lte_cb_size_isvalid(uint32_t size); -SRSLTE_API char *lte_cp_string(lte_cp_t cp); +SRSLTE_API char *lte_cp_string(srslte_cp_t cp); SRSLTE_API char *lte_mod_string(lte_mod_t mod); diff --git a/srslte/include/srslte/common/sequence.h b/srslte/include/srslte/common/sequence.h index d6f92bbad..dcc40f448 100644 --- a/srslte/include/srslte/common/sequence.h +++ b/srslte/include/srslte/common/sequence.h @@ -48,7 +48,7 @@ SRSLTE_API void sequence_set_LTE_pr(sequence_t *q, uint32_t seed); SRSLTE_API int sequence_pbch(sequence_t *seq, - lte_cp_t cp, + srslte_cp_t cp, uint32_t cell_id); SRSLTE_API int sequence_pcfich(sequence_t *seq, diff --git a/srslte/include/srslte/filter/dft_precoding.h b/srslte/include/srslte/filter/dft_precoding.h index 47ae4c190..c0946702b 100644 --- a/srslte/include/srslte/filter/dft_precoding.h +++ b/srslte/include/srslte/filter/dft_precoding.h @@ -39,8 +39,8 @@ typedef _Complex float cf_t; typedef struct SRSLTE_API { uint32_t max_prb; - dft_plan_t dft_plan[MAX_PRB]; - dft_plan_t idft_plan[MAX_PRB]; + srslte_dft_plan_t dft_plan[MAX_PRB]; + srslte_dft_plan_t idft_plan[MAX_PRB]; }dft_precoding_t; diff --git a/srslte/include/srslte/mimo/precoding.h b/srslte/include/srslte/mimo/precoding.h index 2adcea4c6..048a9fb9e 100644 --- a/srslte/include/srslte/mimo/precoding.h +++ b/srslte/include/srslte/mimo/precoding.h @@ -64,12 +64,12 @@ SRSLTE_API int precoding_single(precoding_t *q, SRSLTE_API int precoding_diversity(precoding_t *q, cf_t *x[MAX_LAYERS], - cf_t *y[MAX_PORTS], + cf_t *y[SRSLTE_MAX_PORTS], int nof_ports, int nof_symbols); SRSLTE_API int precoding_type(precoding_t *q, cf_t *x[MAX_LAYERS], - cf_t *y[MAX_PORTS], + cf_t *y[SRSLTE_MAX_PORTS], int nof_layers, int nof_ports, int nof_symbols, @@ -86,7 +86,7 @@ SRSLTE_API int predecoding_single(precoding_t *q, SRSLTE_API int predecoding_diversity(precoding_t *q, cf_t *y, - cf_t *h[MAX_PORTS], + cf_t *h[SRSLTE_MAX_PORTS], cf_t *x[MAX_LAYERS], int nof_ports, int nof_symbols, @@ -94,7 +94,7 @@ SRSLTE_API int predecoding_diversity(precoding_t *q, SRSLTE_API int predecoding_type(precoding_t *q, cf_t *y, - cf_t *h[MAX_PORTS], + cf_t *h[SRSLTE_MAX_PORTS], cf_t *x[MAX_LAYERS], int nof_ports, int nof_layers, diff --git a/srslte/include/srslte/phch/dci.h b/srslte/include/srslte/phch/dci.h index 6cad64148..51568ca0d 100644 --- a/srslte/include/srslte/phch/dci.h +++ b/srslte/include/srslte/phch/dci.h @@ -76,7 +76,7 @@ typedef struct SRSLTE_API { */ SRSLTE_API int dci_msg_to_ra_dl(dci_msg_t *msg, uint16_t msg_rnti, - lte_cell_t cell, + srslte_cell_t cell, uint32_t cfi, ra_pdsch_t *ra_dl); diff --git a/srslte/include/srslte/phch/harq.h b/srslte/include/srslte/phch/harq.h index 83ffd1312..729ed1d56 100644 --- a/srslte/include/srslte/phch/harq.h +++ b/srslte/include/srslte/phch/harq.h @@ -49,7 +49,7 @@ typedef struct SRSLTE_API { uint32_t sf_idx; ra_dl_alloc_t dl_alloc; ra_ul_alloc_t ul_alloc; - lte_cell_t cell; + srslte_cell_t cell; uint32_t nof_re; // Number of RE per subframe uint32_t nof_bits; // Number of bits per subframe @@ -66,7 +66,7 @@ typedef struct SRSLTE_API { } harq_t; SRSLTE_API int harq_init(harq_t * q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API int harq_setup_dl(harq_t *p, ra_mcs_t mcs, diff --git a/srslte/include/srslte/phch/pbch.h b/srslte/include/srslte/phch/pbch.h index 5231b8185..cca93f6e2 100644 --- a/srslte/include/srslte/phch/pbch.h +++ b/srslte/include/srslte/phch/pbch.h @@ -52,14 +52,14 @@ typedef _Complex float cf_t; /* PBCH object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; uint32_t nof_symbols; /* buffers */ - cf_t *ce[MAX_PORTS]; - cf_t *pbch_symbols[MAX_PORTS]; - cf_t *pbch_x[MAX_PORTS]; + cf_t *ce[SRSLTE_MAX_PORTS]; + cf_t *pbch_symbols[SRSLTE_MAX_PORTS]; + cf_t *pbch_x[SRSLTE_MAX_PORTS]; cf_t *pbch_d; float *pbch_llr; float *temp; @@ -82,12 +82,12 @@ typedef struct SRSLTE_API { } pbch_t; SRSLTE_API int pbch_init(pbch_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void pbch_free(pbch_t *q); SRSLTE_API int pbch_decode(pbch_t *q, cf_t *slot1_symbols, - cf_t *ce_slot1[MAX_PORTS], + cf_t *ce_slot1[SRSLTE_MAX_PORTS], float noise_estimate, uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, @@ -95,20 +95,20 @@ SRSLTE_API int pbch_decode(pbch_t *q, SRSLTE_API int pbch_encode(pbch_t *q, uint8_t bch_payload[BCH_PAYLOAD_LEN], - cf_t *slot1_symbols[MAX_PORTS]); + cf_t *slot1_symbols[SRSLTE_MAX_PORTS]); SRSLTE_API void pbch_decode_reset(pbch_t *q); SRSLTE_API void pbch_mib_unpack(uint8_t *msg, - lte_cell_t *cell, + srslte_cell_t *cell, uint32_t *sfn); -SRSLTE_API void pbch_mib_pack(lte_cell_t *cell, +SRSLTE_API void pbch_mib_pack(srslte_cell_t *cell, uint32_t sfn, uint8_t *msg); SRSLTE_API void pbch_mib_fprint(FILE *stream, - lte_cell_t *cell, + srslte_cell_t *cell, uint32_t sfn, uint32_t cell_id); diff --git a/srslte/include/srslte/phch/pcfich.h b/srslte/include/srslte/phch/pcfich.h index 89444fe23..67831a9e1 100644 --- a/srslte/include/srslte/phch/pcfich.h +++ b/srslte/include/srslte/phch/pcfich.h @@ -44,16 +44,16 @@ typedef _Complex float cf_t; /* PCFICH object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; int nof_symbols; /* handler to REGs resource mapper */ regs_t *regs; /* buffers */ - cf_t ce[MAX_PORTS][PCFICH_RE]; - cf_t pcfich_symbols[MAX_PORTS][PCFICH_RE]; - cf_t pcfich_x[MAX_PORTS][PCFICH_RE]; + cf_t ce[SRSLTE_MAX_PORTS][PCFICH_RE]; + cf_t pcfich_symbols[SRSLTE_MAX_PORTS][PCFICH_RE]; + cf_t pcfich_x[SRSLTE_MAX_PORTS][PCFICH_RE]; cf_t pcfich_d[PCFICH_RE]; // cfi table in floats @@ -68,20 +68,20 @@ typedef struct SRSLTE_API { /* tx & rx objects */ modem_table_t mod; demod_soft_t demod; - sequence_t seq_pcfich[NSUBFRAMES_X_FRAME]; + sequence_t seq_pcfich[SRSLTE_NSUBFRAMES_X_FRAME]; precoding_t precoding; } pcfich_t; SRSLTE_API int pcfich_init(pcfich_t *q, regs_t *regs, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void pcfich_free(pcfich_t *q); SRSLTE_API int pcfich_decode(pcfich_t *q, cf_t *sf_symbols, - cf_t *ce[MAX_PORTS], + cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint32_t subframe, uint32_t *cfi, @@ -89,7 +89,7 @@ SRSLTE_API int pcfich_decode(pcfich_t *q, SRSLTE_API int pcfich_encode(pcfich_t *q, uint32_t cfi, - cf_t *sf_symbols[MAX_PORTS], + cf_t *sf_symbols[SRSLTE_MAX_PORTS], uint32_t subframe); #endif diff --git a/srslte/include/srslte/phch/pdcch.h b/srslte/include/srslte/phch/pdcch.h index 767b61eab..917057f38 100644 --- a/srslte/include/srslte/phch/pdcch.h +++ b/srslte/include/srslte/phch/pdcch.h @@ -52,7 +52,7 @@ typedef enum SRSLTE_API { /* PDCCH object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; uint32_t nof_regs; uint32_t nof_cce; uint32_t max_bits; @@ -60,9 +60,9 @@ typedef struct SRSLTE_API { regs_t *regs; /* buffers */ - cf_t *ce[MAX_PORTS]; - cf_t *pdcch_symbols[MAX_PORTS]; - cf_t *pdcch_x[MAX_PORTS]; + cf_t *ce[SRSLTE_MAX_PORTS]; + cf_t *pdcch_symbols[SRSLTE_MAX_PORTS]; + cf_t *pdcch_x[SRSLTE_MAX_PORTS]; cf_t *pdcch_d; uint8_t *pdcch_e; float pdcch_rm_f[3 * (DCI_MAX_BITS + 16)]; @@ -71,7 +71,7 @@ typedef struct SRSLTE_API { /* tx & rx objects */ modem_table_t mod; demod_soft_t demod; - sequence_t seq_pdcch[NSUBFRAMES_X_FRAME]; + sequence_t seq_pdcch[SRSLTE_NSUBFRAMES_X_FRAME]; viterbi_t decoder; crc_t crc; precoding_t precoding; @@ -80,7 +80,7 @@ typedef struct SRSLTE_API { SRSLTE_API int pdcch_init(pdcch_t *q, regs_t *regs, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void pdcch_free(pdcch_t *q); @@ -90,14 +90,14 @@ SRSLTE_API int pdcch_encode(pdcch_t *q, dci_msg_t *msg, dci_location_t location, uint16_t rnti, - cf_t *sf_symbols[MAX_PORTS], + cf_t *sf_symbols[SRSLTE_MAX_PORTS], uint32_t nsubframe, uint32_t cfi); /* Decoding functions: Extract the LLRs and save them in the pdcch_t object */ SRSLTE_API int pdcch_extract_llr(pdcch_t *q, cf_t *sf_symbols, - cf_t *ce[MAX_PORTS], + cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint32_t nsubframe, uint32_t cfi); diff --git a/srslte/include/srslte/phch/pdsch.h b/srslte/include/srslte/phch/pdsch.h index ba5c33424..bb52292ac 100644 --- a/srslte/include/srslte/phch/pdsch.h +++ b/srslte/include/srslte/phch/pdsch.h @@ -47,7 +47,7 @@ typedef _Complex float cf_t; /* PDSCH object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; uint32_t max_re; bool rnti_is_set; @@ -55,16 +55,16 @@ typedef struct SRSLTE_API { /* buffers */ // void buffers are shared for tx and rx - cf_t *ce[MAX_PORTS]; - cf_t *pdsch_symbols[MAX_PORTS]; - cf_t *pdsch_x[MAX_PORTS]; + cf_t *ce[SRSLTE_MAX_PORTS]; + cf_t *pdsch_symbols[SRSLTE_MAX_PORTS]; + cf_t *pdsch_x[SRSLTE_MAX_PORTS]; cf_t *pdsch_d; void *pdsch_e; /* tx & rx objects */ modem_table_t mod[4]; demod_soft_t demod; - sequence_t seq_pdsch[NSUBFRAMES_X_FRAME]; + sequence_t seq_pdsch[SRSLTE_NSUBFRAMES_X_FRAME]; precoding_t precoding; sch_t dl_sch; @@ -72,7 +72,7 @@ typedef struct SRSLTE_API { }pdsch_t; SRSLTE_API int pdsch_init(pdsch_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void pdsch_free(pdsch_t *q); @@ -82,25 +82,25 @@ SRSLTE_API int pdsch_set_rnti(pdsch_t *q, SRSLTE_API int pdsch_encode(pdsch_t *q, harq_t *harq_process, uint8_t *data, - cf_t *sf_symbols[MAX_PORTS]); + cf_t *sf_symbols[SRSLTE_MAX_PORTS]); SRSLTE_API int pdsch_encode_rnti(pdsch_t *q, harq_t *harq_process, uint8_t *data, uint16_t rnti, - cf_t *sf_symbols[MAX_PORTS]); + cf_t *sf_symbols[SRSLTE_MAX_PORTS]); SRSLTE_API int pdsch_decode(pdsch_t *q, harq_t *harq_process, cf_t *sf_symbols, - cf_t *ce[MAX_PORTS], + cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint8_t *data); SRSLTE_API int pdsch_decode_rnti(pdsch_t *q, harq_t *harq_process, cf_t *sf_symbols, - cf_t *ce[MAX_PORTS], + cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint16_t rnti, uint8_t *data); diff --git a/srslte/include/srslte/phch/phich.h b/srslte/include/srslte/phch/phich.h index cdb088260..90d9f14de 100644 --- a/srslte/include/srslte/phch/phich.h +++ b/srslte/include/srslte/phch/phich.h @@ -55,15 +55,15 @@ typedef _Complex float cf_t; /* phich object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; /* handler to REGs resource mapper */ regs_t *regs; /* buffers */ - cf_t ce[MAX_PORTS][PHICH_MAX_NSYMB]; - cf_t phich_symbols[MAX_PORTS][PHICH_MAX_NSYMB]; - cf_t phich_x[MAX_PORTS][PHICH_MAX_NSYMB]; + cf_t ce[SRSLTE_MAX_PORTS][PHICH_MAX_NSYMB]; + cf_t phich_symbols[SRSLTE_MAX_PORTS][PHICH_MAX_NSYMB]; + cf_t phich_x[SRSLTE_MAX_PORTS][PHICH_MAX_NSYMB]; cf_t phich_d[PHICH_MAX_NSYMB]; cf_t phich_d0[PHICH_MAX_NSYMB]; cf_t phich_z[PHICH_NBITS]; @@ -74,20 +74,20 @@ typedef struct SRSLTE_API { /* tx & rx objects */ modem_table_t mod; demod_hard_t demod; - sequence_t seq_phich[NSUBFRAMES_X_FRAME]; + sequence_t seq_phich[SRSLTE_NSUBFRAMES_X_FRAME]; precoding_t precoding; }phich_t; SRSLTE_API int phich_init(phich_t *q, regs_t *regs, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void phich_free(phich_t *q); SRSLTE_API int phich_decode(phich_t *q, cf_t *slot_symbols, - cf_t *ce[MAX_PORTS], + cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint32_t ngroup, uint32_t nseq, @@ -100,10 +100,10 @@ SRSLTE_API int phich_encode(phich_t *q, uint32_t ngroup, uint32_t nseq, uint32_t nsubframe, - cf_t *slot_symbols[MAX_PORTS]); + cf_t *slot_symbols[SRSLTE_MAX_PORTS]); SRSLTE_API void phich_reset(phich_t *q, - cf_t *slot_symbols[MAX_PORTS]); + cf_t *slot_symbols[SRSLTE_MAX_PORTS]); SRSLTE_API uint32_t phich_ngroups(phich_t *q); diff --git a/srslte/include/srslte/phch/prach.h b/srslte/include/srslte/phch/prach.h index 1e0fcc78c..e5279fd2f 100644 --- a/srslte/include/srslte/phch/prach.h +++ b/srslte/include/srslte/phch/prach.h @@ -75,12 +75,12 @@ typedef struct SRSLTE_API { float *corr; // PRACH IFFT - dft_plan_t *fft; - dft_plan_t *ifft; + srslte_dft_plan_t *fft; + srslte_dft_plan_t *ifft; // ZC-sequence FFT and IFFT - dft_plan_t *zc_fft; - dft_plan_t *zc_ifft; + srslte_dft_plan_t *zc_fft; + srslte_dft_plan_t *zc_ifft; }prach_t; diff --git a/srslte/include/srslte/phch/pucch.h b/srslte/include/srslte/phch/pucch.h index 7f0e8388e..f8490c02a 100644 --- a/srslte/include/srslte/phch/pucch.h +++ b/srslte/include/srslte/phch/pucch.h @@ -68,17 +68,17 @@ typedef struct SRSLTE_API { /* PUSCH object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; pucch_cfg_t pucch_cfg; - uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB]; + uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB]; float tmp_arg[PUCCH_N_SF_MAX*PUCCH_N_SEQ]; float y[PUCCH_N_SEQ]; }pucch_t; SRSLTE_API int pucch_init(pucch_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void pucch_free(pucch_t *q); @@ -93,16 +93,16 @@ SRSLTE_API int pucch_encode(pucch_t *q, uint8_t bits[PUCCH_MAX_BITS], cf_t *sf_symbols); -SRSLTE_API float pucch_get_alpha(uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB], +SRSLTE_API float pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB], pucch_cfg_t *cfg, - lte_cp_t cp, + srslte_cp_t cp, bool is_drms, uint32_t ns, uint32_t l, uint32_t *n_oc); -SRSLTE_API int generate_n_cs_cell(lte_cell_t cell, - uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB]); +SRSLTE_API int generate_n_cs_cell(srslte_cell_t cell, + uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB]); SRSLTE_API bool pucch_cfg_isvalid(pucch_cfg_t *cfg); diff --git a/srslte/include/srslte/phch/pusch.h b/srslte/include/srslte/phch/pusch.h index 3b6d94753..415e92904 100644 --- a/srslte/include/srslte/phch/pusch.h +++ b/srslte/include/srslte/phch/pusch.h @@ -59,7 +59,7 @@ typedef struct { /* PUSCH object */ typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; pusch_hopping_cfg_t hopping_cfg; @@ -83,7 +83,7 @@ typedef struct SRSLTE_API { /* tx & rx objects */ modem_table_t mod[4]; demod_soft_t demod; - sequence_t seq_pusch[NSUBFRAMES_X_FRAME]; + sequence_t seq_pusch[SRSLTE_NSUBFRAMES_X_FRAME]; sequence_t seq_type2_fo; sch_t dl_sch; @@ -92,7 +92,7 @@ typedef struct SRSLTE_API { SRSLTE_API int pusch_init(pusch_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void pusch_free(pusch_t *q); diff --git a/srslte/include/srslte/phch/ra.h b/srslte/include/srslte/phch/ra.h index 8f9e66274..99c508373 100644 --- a/srslte/include/srslte/phch/ra.h +++ b/srslte/include/srslte/phch/ra.h @@ -79,7 +79,7 @@ typedef struct SRSLTE_API { typedef struct SRSLTE_API { ra_prb_slot_t slot[2]; uint32_t lstart; - uint32_t re_sf[NSUBFRAMES_X_FRAME]; + uint32_t re_sf[SRSLTE_NSUBFRAMES_X_FRAME]; } ra_dl_alloc_t; typedef struct SRSLTE_API { @@ -146,7 +146,7 @@ SRSLTE_API void ra_dl_alloc_re(ra_dl_alloc_t *prb_dist, uint32_t nof_prb, uint32_t nof_ports, uint32_t nof_ctrl_symbols, - lte_cp_t cp); + srslte_cp_t cp); SRSLTE_API uint32_t ra_nprb_dl(ra_pdsch_t *ra, uint32_t nof_prb); diff --git a/srslte/include/srslte/phch/regs.h b/srslte/include/srslte/phch/regs.h index 9b9952ffa..47aedb3b9 100644 --- a/srslte/include/srslte/phch/regs.h +++ b/srslte/include/srslte/phch/regs.h @@ -57,7 +57,7 @@ typedef struct SRSLTE_API { }regs_ch_t; typedef struct SRSLTE_API { - lte_cell_t cell; + srslte_cell_t cell; uint32_t max_ctrl_symbols; uint32_t cfi; bool cfi_initiated; @@ -76,7 +76,7 @@ typedef struct SRSLTE_API { }regs_t; SRSLTE_API int regs_init(regs_t *h, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void regs_free(regs_t *h); SRSLTE_API int regs_set_cfi(regs_t *h, diff --git a/srslte/include/srslte/resampling/interp.h b/srslte/include/srslte/resampling/interp.h index 9778ca0a8..bbf885dde 100644 --- a/srslte/include/srslte/resampling/interp.h +++ b/srslte/include/srslte/resampling/interp.h @@ -37,20 +37,20 @@ typedef _Complex float cf_t; /************* STATIC LINEAR INTERPOLATION FUNCTIONS */ -SRSLTE_API cf_t interp_linear_onesample(cf_t input0, +SRSLTE_API cf_t srslte_interp_linear_onesample(cf_t input0, cf_t input1); -SRSLTE_API cf_t interp_linear_onesample_cabs(cf_t input0, +SRSLTE_API cf_t srslte_interp_linear_onesample_cabs(cf_t input0, cf_t input1); -SRSLTE_API void interp_linear_offset_cabs(cf_t *input, +SRSLTE_API void srslte_interp_linear_offset_cabs(cf_t *input, cf_t *output, uint32_t M, uint32_t len, uint32_t off_st, uint32_t off_end); -SRSLTE_API void interp_linear_f(float *input, +SRSLTE_API void srslte_interp_linear_f(float *input, float *output, uint32_t M, uint32_t len); @@ -62,14 +62,14 @@ SRSLTE_API void interp_linear_f(float *input, typedef struct { cf_t *diff_vec; uint32_t vector_len; -} interp_linvec_t; +} srslte_interp_linvec_t; -SRSLTE_API int interp_linear_vector_init(interp_linvec_t *q, +SRSLTE_API int srslte_interp_linear_vector_init(srslte_interp_linvec_t *q, uint32_t vector_len); -SRSLTE_API void interp_linear_vector_free(interp_linvec_t *q); +SRSLTE_API void srslte_interp_linear_vector_free(srslte_interp_linvec_t *q); -SRSLTE_API void interp_linear_vector(interp_linvec_t *q, +SRSLTE_API void srslte_interp_linear_vector(srslte_interp_linvec_t *q, cf_t *in0, cf_t *in1, cf_t *between, @@ -85,15 +85,15 @@ typedef struct { float *ramp; uint32_t vector_len; uint32_t M; -} interp_lin_t; +} srslte_interp_lin_t; -SRSLTE_API int interp_linear_init(interp_lin_t *q, +SRSLTE_API int srslte_interp_linear_init(srslte_interp_lin_t *q, uint32_t vector_len, uint32_t M); -SRSLTE_API void interp_linear_free(interp_lin_t *q); +SRSLTE_API void srslte_interp_linear_free(srslte_interp_lin_t *q); -SRSLTE_API void interp_linear_offset(interp_lin_t *q, +SRSLTE_API void srslte_interp_linear_offset(srslte_interp_lin_t *q, cf_t *input, cf_t *output, uint32_t off_st, diff --git a/srslte/include/srslte/scrambling/scrambling.h b/srslte/include/srslte/scrambling/scrambling.h index 728ddf6db..8967fb196 100644 --- a/srslte/include/srslte/scrambling/scrambling.h +++ b/srslte/include/srslte/scrambling/scrambling.h @@ -77,7 +77,7 @@ SRSLTE_API void scrambling_c_offset(sequence_t *s, #define SCRAMBLING_PUCCH 5 typedef struct SRSLTE_API { - sequence_t seq[NSUBFRAMES_X_FRAME]; + sequence_t seq[SRSLTE_NSUBFRAMES_X_FRAME]; }scrambling_t; typedef struct SRSLTE_API { diff --git a/srslte/include/srslte/sync/pss.h b/srslte/include/srslte/sync/pss.h index 6fa68ff83..a3ee59710 100644 --- a/srslte/include/srslte/sync/pss.h +++ b/srslte/include/srslte/sync/pss.h @@ -67,7 +67,7 @@ typedef _Complex float cf_t; /* this is only a shortcut */ /* Low-level API */ typedef struct SRSLTE_API { - dft_plan_t dftp_input; + srslte_dft_plan_t dftp_input; #ifdef CONVOLUTION_FFT conv_fft_cc_t conv_fft; @@ -107,7 +107,7 @@ SRSLTE_API int pss_generate(cf_t *signal, SRSLTE_API void pss_put_slot(cf_t *pss_signal, cf_t *slot, uint32_t nof_prb, - lte_cp_t cp); + srslte_cp_t cp); SRSLTE_API void pss_synch_set_ema_alpha(pss_synch_t *q, float alpha); diff --git a/srslte/include/srslte/sync/sss.h b/srslte/include/srslte/sync/sss.h index c609441f0..a1236b3e9 100644 --- a/srslte/include/srslte/sync/sss.h +++ b/srslte/include/srslte/sync/sss.h @@ -62,7 +62,7 @@ struct fc_tables{ /* Low-level API */ typedef struct SRSLTE_API { - dft_plan_t dftp_input; + srslte_dft_plan_t dftp_input; uint32_t fft_size; @@ -96,7 +96,7 @@ SRSLTE_API void sss_generate(float *signal0, SRSLTE_API void sss_put_slot(float *sss, cf_t *symbol, uint32_t nof_prb, - lte_cp_t cp); + srslte_cp_t cp); SRSLTE_API int sss_synch_set_N_id_2(sss_synch_t *q, uint32_t N_id_2); diff --git a/srslte/include/srslte/sync/sync.h b/srslte/include/srslte/sync/sync.h index f6c3fe315..8de98f8e1 100644 --- a/srslte/include/srslte/sync/sync.h +++ b/srslte/include/srslte/sync/sync.h @@ -71,7 +71,7 @@ typedef struct SRSLTE_API { bool detect_cp; bool sss_en; bool correct_cfo; - lte_cp_t cp; + srslte_cp_t cp; uint32_t m0; uint32_t m1; float m0_value; @@ -97,7 +97,7 @@ SRSLTE_API int sync_find(sync_t *q, uint32_t *peak_position); /* Estimates the CP length */ -SRSLTE_API lte_cp_t sync_detect_cp(sync_t *q, +SRSLTE_API srslte_cp_t sync_detect_cp(sync_t *q, cf_t *input, uint32_t peak_pos); @@ -133,10 +133,10 @@ SRSLTE_API int sync_get_cell_id(sync_t *q); SRSLTE_API float sync_get_cfo(sync_t *q); /* Gets the CP length estimation from the last call to synch_run() */ -SRSLTE_API lte_cp_t sync_get_cp(sync_t *q); +SRSLTE_API srslte_cp_t sync_get_cp(sync_t *q); /* Sets the CP length estimation (must do it if disabled) */ -SRSLTE_API void sync_set_cp(sync_t *q, lte_cp_t cp); +SRSLTE_API void sync_set_cp(sync_t *q, srslte_cp_t cp); /* Enables/Disables SSS detection */ SRSLTE_API void sync_sss_en(sync_t *q, diff --git a/srslte/include/srslte/ue/ue_cell_search.h b/srslte/include/srslte/ue/ue_cell_search.h index 99606fa1d..427622d1f 100644 --- a/srslte/include/srslte/ue/ue_cell_search.h +++ b/srslte/include/srslte/ue/ue_cell_search.h @@ -64,7 +64,7 @@ typedef struct SRSLTE_API { uint32_t cell_id; - lte_cp_t cp; + srslte_cp_t cp; float peak; float mode; float psr; diff --git a/srslte/include/srslte/ue/ue_dl.h b/srslte/include/srslte/ue/ue_dl.h index 4483aab2a..9a3cdb371 100644 --- a/srslte/include/srslte/ue/ue_dl.h +++ b/srslte/include/srslte/ue/ue_dl.h @@ -61,15 +61,15 @@ typedef struct SRSLTE_API { pdsch_t pdsch; harq_t harq_process[NOF_HARQ_PROCESSES]; regs_t regs; - lte_fft_t fft; - chest_dl_t chest; + srslte_fft_t fft; + srslte_chest_dl_t chest; ra_pdsch_t ra_dl; - lte_cell_t cell; + srslte_cell_t cell; cf_t *sf_symbols; - cf_t *ce[MAX_PORTS]; + cf_t *ce[SRSLTE_MAX_PORTS]; uint64_t pkt_errors; uint64_t pkts_total; @@ -80,7 +80,7 @@ typedef struct SRSLTE_API { /* This function shall be called just after the initial synchronization */ SRSLTE_API int ue_dl_init(ue_dl_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void ue_dl_free(ue_dl_t *q); diff --git a/srslte/include/srslte/ue/ue_mib.h b/srslte/include/srslte/ue/ue_mib.h index d25b3668f..0fdc22dc5 100644 --- a/srslte/include/srslte/ue/ue_mib.h +++ b/srslte/include/srslte/ue/ue_mib.h @@ -56,7 +56,7 @@ #include "srslte/common/fft.h" -#define MIB_MAX_PORTS 4 +#define MIB_SRSLTE_MAX_PORTS 4 #define MIB_NOF_PRB 6 #define MIB_FOUND 1 @@ -66,10 +66,10 @@ typedef struct SRSLTE_API { sync_t sfind; cf_t *sf_symbols; - cf_t *ce[MIB_MAX_PORTS]; + cf_t *ce[MIB_SRSLTE_MAX_PORTS]; - lte_fft_t fft; - chest_dl_t chest; + srslte_fft_t fft; + srslte_chest_dl_t chest; pbch_t pbch; uint8_t bch_payload[BCH_PAYLOAD_LEN]; @@ -80,7 +80,7 @@ typedef struct SRSLTE_API { } ue_mib_t; SRSLTE_API int ue_mib_init(ue_mib_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void ue_mib_free(ue_mib_t *q); @@ -103,7 +103,7 @@ typedef struct { SRSLTE_API int ue_mib_sync_init(ue_mib_sync_t *q, uint32_t cell_id, - lte_cp_t cp, + srslte_cp_t cp, int (recv_callback)(void*, void*, uint32_t, timestamp_t *), void *stream_handler); diff --git a/srslte/include/srslte/ue/ue_sync.h b/srslte/include/srslte/ue/ue_sync.h index 2004b81cf..4dc230419 100644 --- a/srslte/include/srslte/ue/ue_sync.h +++ b/srslte/include/srslte/ue/ue_sync.h @@ -90,7 +90,7 @@ typedef struct SRSLTE_API { /* this is the system frame number (SFN) */ uint32_t frame_number; - lte_cell_t cell; + srslte_cell_t cell; uint32_t sf_idx; bool decode_sss_on_track; @@ -106,7 +106,7 @@ typedef struct SRSLTE_API { SRSLTE_API int ue_sync_init(ue_sync_t *q, - lte_cell_t cell, + srslte_cell_t cell, int (recv_callback)(void*, void*, uint32_t, timestamp_t*), void *stream_handler); diff --git a/srslte/include/srslte/ue/ue_ul.h b/srslte/include/srslte/ue/ue_ul.h index c51f4dadd..e1e717665 100644 --- a/srslte/include/srslte/ue/ue_ul.h +++ b/srslte/include/srslte/ue/ue_ul.h @@ -50,17 +50,17 @@ #define NOF_HARQ_PROCESSES 8 typedef struct SRSLTE_API { - lte_fft_t fft; + srslte_fft_t fft; cfo_t cfo; - lte_cell_t cell; + srslte_cell_t cell; bool normalize_en; float current_cfo; - refsignal_drms_pusch_cfg_t pusch_drms_cfg; + srslte_refsignal_drms_pusch_cfg_t pusch_drms_cfg; - refsignal_ul_t drms; + srslte_refsignal_ul_t drms; harq_t harq_process[NOF_HARQ_PROCESSES]; pusch_t pusch; @@ -72,7 +72,7 @@ typedef struct SRSLTE_API { /* This function shall be called just after the initial synchronization */ SRSLTE_API int ue_ul_init(ue_ul_t *q, - lte_cell_t cell); + srslte_cell_t cell); SRSLTE_API void ue_ul_free(ue_ul_t *q); @@ -83,7 +83,7 @@ SRSLTE_API void ue_ul_set_normalization(ue_ul_t *q, bool enabled); SRSLTE_API void ue_ul_set_pusch_cfg(ue_ul_t *q, - refsignal_drms_pusch_cfg_t *pusch_drms_cfg, + srslte_refsignal_drms_pusch_cfg_t *pusch_drms_cfg, pusch_hopping_cfg_t *pusch_hopping_cfg); SRSLTE_API int ue_ul_pusch_encode(ue_ul_t *q, diff --git a/srslte/include/srslte/utils/convolution.h b/srslte/include/srslte/utils/convolution.h index 215dad8a3..181ca8159 100644 --- a/srslte/include/srslte/utils/convolution.h +++ b/srslte/include/srslte/utils/convolution.h @@ -42,9 +42,9 @@ typedef struct SRSLTE_API { uint32_t input_len; uint32_t filter_len; uint32_t output_len; - dft_plan_t input_plan; - dft_plan_t filter_plan; - dft_plan_t output_plan; + srslte_dft_plan_t input_plan; + srslte_dft_plan_t filter_plan; + srslte_dft_plan_t output_plan; }conv_fft_cc_t; SRSLTE_API int conv_fft_cc_init(conv_fft_cc_t *q, diff --git a/srslte/include/srslte/utils/dft.h b/srslte/include/srslte/utils/dft.h index 5b284d9c0..49194195f 100644 --- a/srslte/include/srslte/utils/dft.h +++ b/srslte/include/srslte/utils/dft.h @@ -65,31 +65,31 @@ typedef struct SRSLTE_API { bool dc; // Handle insertion/removal of null DC carrier internally? dft_dir_t dir; // Forward/Backward dft_mode_t mode; // Complex/Real -}dft_plan_t; +}srslte_dft_plan_t; typedef _Complex float dft_c_t; typedef float dft_r_t; /* Create DFT plans */ -SRSLTE_API int dft_plan(dft_plan_t *plan, const int dft_points, dft_dir_t dir, +SRSLTE_API int dft_plan(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir, dft_mode_t type); -SRSLTE_API int dft_plan_c(dft_plan_t *plan, const int dft_points, dft_dir_t dir); -SRSLTE_API int dft_plan_r(dft_plan_t *plan, const int dft_points, dft_dir_t dir); -SRSLTE_API void dft_plan_free(dft_plan_t *plan); +SRSLTE_API int dft_plan_c(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir); +SRSLTE_API int dft_plan_r(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir); +SRSLTE_API void dft_plan_free(srslte_dft_plan_t *plan); /* Set options */ -SRSLTE_API void dft_plan_set_mirror(dft_plan_t *plan, bool val); -SRSLTE_API void dft_plan_set_db(dft_plan_t *plan, bool val); -SRSLTE_API void dft_plan_set_norm(dft_plan_t *plan, bool val); -SRSLTE_API void dft_plan_set_dc(dft_plan_t *plan, bool val); +SRSLTE_API void dft_plan_set_mirror(srslte_dft_plan_t *plan, bool val); +SRSLTE_API void dft_plan_set_db(srslte_dft_plan_t *plan, bool val); +SRSLTE_API void dft_plan_set_norm(srslte_dft_plan_t *plan, bool val); +SRSLTE_API void dft_plan_set_dc(srslte_dft_plan_t *plan, bool val); /* Compute DFT */ -SRSLTE_API void dft_run(dft_plan_t *plan, void *in, void *out); -SRSLTE_API void dft_run_c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out); -SRSLTE_API void dft_run_r(dft_plan_t *plan, dft_r_t *in, dft_r_t *out); +SRSLTE_API void dft_run(srslte_dft_plan_t *plan, void *in, void *out); +SRSLTE_API void dft_run_c(srslte_dft_plan_t *plan, dft_c_t *in, dft_c_t *out); +SRSLTE_API void dft_run_r(srslte_dft_plan_t *plan, dft_r_t *in, dft_r_t *out); #endif // DFT_H_ diff --git a/srslte/lib/ch_estimation/src/chest_dl.c b/srslte/lib/ch_estimation/src/chest_dl.c index fa39ec030..07e5b89a6 100644 --- a/srslte/lib/ch_estimation/src/chest_dl.c +++ b/srslte/lib/ch_estimation/src/chest_dl.c @@ -52,34 +52,34 @@ * * The equalizer uses the channel estimates to produce an estimation of the transmitted symbol. * - * This object depends on the refsignal_t object for creating the LTE CSR signal. + * This object depends on the srslte_refsignal_t object for creating the LTE CSR signal. */ -int chest_dl_init(chest_dl_t *q, lte_cell_t cell) +int srslte_chest_dl_init(srslte_chest_dl_t *q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && lte_cell_isvalid(&cell)) { - bzero(q, sizeof(chest_dl_t)); + bzero(q, sizeof(srslte_chest_dl_t)); - ret = refsignal_cs_init(&q->csr_signal, cell); + ret = srslte_refsignal_cs_init(&q->csr_signal, cell); if (ret != SRSLTE_SUCCESS) { fprintf(stderr, "Error initializing CSR signal (%d)\n",ret); goto clean_exit; } - q->tmp_freqavg = vec_malloc(sizeof(cf_t) * REFSIGNAL_MAX_NUM_SF(cell.nof_prb)); + q->tmp_freqavg = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_MAX_NUM_SF(cell.nof_prb)); if (!q->tmp_freqavg) { perror("malloc"); goto clean_exit; } - q->tmp_noise = vec_malloc(sizeof(cf_t) * REFSIGNAL_MAX_NUM_SF(cell.nof_prb)); + q->tmp_noise = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_MAX_NUM_SF(cell.nof_prb)); if (!q->tmp_noise) { perror("malloc"); goto clean_exit; } - for (int i=0;itmp_timeavg[i] = vec_malloc(sizeof(cf_t) * 2*cell.nof_prb); if (!q->tmp_timeavg[i]) { perror("malloc"); @@ -95,42 +95,42 @@ int chest_dl_init(chest_dl_t *q, lte_cell_t cell) bzero(q->tmp_timeavg_mult, sizeof(cf_t) * 2*cell.nof_prb); for (int i=0;ipilot_estimates[i] = vec_malloc(sizeof(cf_t) * REFSIGNAL_NUM_SF(cell.nof_prb, i)); + q->pilot_estimates[i] = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(cell.nof_prb, i)); if (!q->pilot_estimates[i]) { perror("malloc"); goto clean_exit; } - q->pilot_estimates_average[i] = vec_malloc(sizeof(cf_t) * REFSIGNAL_NUM_SF(cell.nof_prb, i)); + q->pilot_estimates_average[i] = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(cell.nof_prb, i)); if (!q->pilot_estimates_average[i]) { perror("malloc"); goto clean_exit; } - q->pilot_recv_signal[i] = vec_malloc(sizeof(cf_t) * REFSIGNAL_NUM_SF(cell.nof_prb, i)); + q->pilot_recv_signal[i] = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(cell.nof_prb, i)); if (!q->pilot_recv_signal[i]) { perror("malloc"); goto clean_exit; } } - if (interp_linear_vector_init(&q->interp_linvec, RE_X_RB*cell.nof_prb)) { + if (srslte_interp_linear_vector_init(&q->srslte_interp_linvec, RE_X_RB*cell.nof_prb)) { fprintf(stderr, "Error initializing vector interpolator\n"); goto clean_exit; } - if (interp_linear_init(&q->interp_lin, 2*cell.nof_prb, RE_X_RB/2)) { + if (srslte_interp_linear_init(&q->srslte_interp_lin, 2*cell.nof_prb, RE_X_RB/2)) { fprintf(stderr, "Error initializing interpolator\n"); goto clean_exit; } /* Set default time/freq filters */ //float f[3]={0.1, 0.8, 0.1}; - //chest_dl_set_filter_freq(q, f, 3); + //srslte_chest_dl_set_filter_freq(q, f, 3); float f[5]={0.05, 0.2, 0.5, 0.2, 0.05}; - chest_dl_set_filter_freq(q, f, 5); + srslte_chest_dl_set_filter_freq(q, f, 5); float t[2]={0.1, 0.9}; - chest_dl_set_filter_time(q, t, 0); + srslte_chest_dl_set_filter_time(q, t, 0); q->cell = cell; } @@ -139,14 +139,14 @@ int chest_dl_init(chest_dl_t *q, lte_cell_t cell) clean_exit: if (ret != SRSLTE_SUCCESS) { - chest_dl_free(q); + srslte_chest_dl_free(q); } return ret; } -void chest_dl_free(chest_dl_t *q) +void srslte_chest_dl_free(srslte_chest_dl_t *q) { - refsignal_cs_free(&q->csr_signal); + srslte_refsignal_cs_free(&q->csr_signal); if (q->tmp_freqavg) { free(q->tmp_freqavg); @@ -154,7 +154,7 @@ void chest_dl_free(chest_dl_t *q) if (q->tmp_noise) { free(q->tmp_noise); } - for (int i=0;itmp_timeavg[i]) { free(q->tmp_timeavg[i]); } @@ -162,10 +162,10 @@ void chest_dl_free(chest_dl_t *q) if (q->tmp_timeavg_mult) { free(q->tmp_timeavg_mult); } - interp_linear_vector_free(&q->interp_linvec); - interp_linear_free(&q->interp_lin); + srslte_interp_linear_vector_free(&q->srslte_interp_linvec); + srslte_interp_linear_free(&q->srslte_interp_lin); - for (int i=0;ipilot_estimates[i]) { free(q->pilot_estimates[i]); } @@ -176,11 +176,11 @@ void chest_dl_free(chest_dl_t *q) free(q->pilot_recv_signal[i]); } } - bzero(q, sizeof(chest_dl_t)); + bzero(q, sizeof(srslte_chest_dl_t)); } -int chest_dl_set_filter_freq(chest_dl_t *q, float *filter, uint32_t filter_len) { - if (filter_len <= CHEST_MAX_FILTER_FREQ_LEN) { +int srslte_chest_dl_set_filter_freq(srslte_chest_dl_t *q, float *filter, uint32_t filter_len) { + if (filter_len <= SRSLTE_CHEST_MAX_FILTER_FREQ_LEN) { q->filter_freq_len = filter_len; for (int i=0;ifilter_freq[i] = filter[i]; @@ -191,8 +191,8 @@ int chest_dl_set_filter_freq(chest_dl_t *q, float *filter, uint32_t filter_len) } } -int chest_dl_set_filter_time(chest_dl_t *q, float *filter, uint32_t filter_len) { - if (filter_len <= CHEST_MAX_FILTER_TIME_LEN) { +int srslte_chest_dl_set_filter_time(srslte_chest_dl_t *q, float *filter, uint32_t filter_len) { + if (filter_len <= SRSLTE_CHEST_MAX_FILTER_TIME_LEN) { q->filter_time_len = filter_len; for (int i=0;ifilter_time[i] = filter[i]; @@ -208,18 +208,18 @@ int chest_dl_set_filter_time(chest_dl_t *q, float *filter, uint32_t filter_len) #ifdef NOISE_POWER_USE_ESTIMATES /* Uses the difference between the averaged and non-averaged pilot estimates */ -static float estimate_noise_port(chest_dl_t *q, uint32_t port_id, cf_t *avg_pilots) { +static float estimate_noise_port(srslte_chest_dl_t *q, uint32_t port_id, cf_t *avg_pilots) { /* Use difference between averaged and noisy LS pilot estimates */ vec_sub_ccc(avg_pilots, q->pilot_estimates[port_id], - q->tmp_noise, REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); + q->tmp_noise, SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); - return vec_avg_power_cf(q->tmp_noise, REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); + return vec_avg_power_cf(q->tmp_noise, SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); } #else /* Uses the 5 empty transmitted SC before and after the SSS and PSS sequences for noise estimation */ -static float estimate_noise_empty_sc(chest_dl_t *q, cf_t *input) { +static float estimate_noise_empty_sc(srslte_chest_dl_t *q, cf_t *input) { int k_sss = (CP_NSYMB(q->cell.cp) - 2) * q->cell.nof_prb * RE_X_RB + q->cell.nof_prb * RE_X_RB / 2 - 31; float noise_power = 0; noise_power += vec_avg_power_cf(&input[k_sss-5], 5); // 5 empty SC before SSS @@ -232,26 +232,26 @@ static float estimate_noise_empty_sc(chest_dl_t *q, cf_t *input) { } #endif -#define pilot_est(idx) q->pilot_estimates[port_id][REFSIGNAL_PILOT_IDX(idx,l,q->cell)] -#define pilot_avg(idx) q->pilot_estimates_average[port_id][REFSIGNAL_PILOT_IDX(idx,l,q->cell)] -#define pilot_tmp(idx) q->tmp_freqavg[REFSIGNAL_PILOT_IDX(idx,l,q->cell)] +#define pilot_est(idx) q->pilot_estimates[port_id][SRSLTE_REFSIGNAL_PILOT_IDX(idx,l,q->cell)] +#define pilot_avg(idx) q->pilot_estimates_average[port_id][SRSLTE_REFSIGNAL_PILOT_IDX(idx,l,q->cell)] +#define pilot_tmp(idx) q->tmp_freqavg[SRSLTE_REFSIGNAL_PILOT_IDX(idx,l,q->cell)] -static void average_pilots(chest_dl_t *q, uint32_t port_id) +static void average_pilots(srslte_chest_dl_t *q, uint32_t port_id) { int nref=2*q->cell.nof_prb; uint32_t l, i; /* For each symbol with pilots in a slot */ - for (l=0;lfilter_freq_len > 0) { /* Filter pilot estimates in frequency */ conv_same_cf(&pilot_est(0), q->filter_freq, &pilot_tmp(0), nref, q->filter_freq_len); /* Adjust extremes using linear interpolation */ - pilot_tmp(0) += interp_linear_onesample(pilot_est(1), pilot_est(0)) + pilot_tmp(0) += srslte_interp_linear_onesample(pilot_est(1), pilot_est(0)) * q->filter_freq[q->filter_freq_len/2-1]*1.2; - pilot_tmp(nref-1) += interp_linear_onesample(pilot_est(nref-2), pilot_est(nref-1)) + pilot_tmp(nref-1) += srslte_interp_linear_onesample(pilot_est(nref-2), pilot_est(nref-1)) * q->filter_freq[q->filter_freq_len/2+1]*1.2; } else { memcpy(&pilot_tmp(0), &pilot_est(0), nref * sizeof(cf_t)); @@ -262,7 +262,7 @@ static void average_pilots(chest_dl_t *q, uint32_t port_id) q->noise_estimate[port_id] = estimate_noise_port(q, port_id, q->tmp_freqavg); #endif - for (l=0;lfilter_time_len > 0) { /* Move last symbols */ @@ -287,53 +287,53 @@ static void average_pilots(chest_dl_t *q, uint32_t port_id) #define cesymb(i) ce[RE_IDX(q->cell.nof_prb,i,0)] -static void interpolate_pilots(chest_dl_t *q, cf_t *ce, uint32_t port_id) +static void interpolate_pilots(srslte_chest_dl_t *q, cf_t *ce, uint32_t port_id) { /* interpolate the symbols with references in the freq domain */ uint32_t l; - uint32_t nsymbols = refsignal_cs_nof_symbols(port_id); + uint32_t nsymbols = srslte_refsignal_cs_nof_symbols(port_id); /* Interpolate in the frequency domain */ for (l=0;lcell, l, port_id, 0); - interp_linear_offset(&q->interp_lin, &pilot_avg(0), - &ce[refsignal_cs_nsymbol(l,q->cell.cp, port_id) * q->cell.nof_prb * RE_X_RB], + uint32_t fidx_offset = srslte_refsignal_cs_fidx(q->cell, l, port_id, 0); + srslte_interp_linear_offset(&q->srslte_interp_lin, &pilot_avg(0), + &ce[srslte_refsignal_cs_nsymbol(l,q->cell.cp, port_id) * q->cell.nof_prb * RE_X_RB], fidx_offset, RE_X_RB/2-fidx_offset); } /* Now interpolate in the time domain between symbols */ if (CP_ISNORM(q->cell.cp)) { if (nsymbols == 4) { - interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 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(8), 3); - interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(11), &cesymb(12), 2); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 3); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(4), &cesymb(7), &cesymb(5), 2); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(7), &cesymb(11), &cesymb(8), 3); + srslte_interp_linear_vector(&q->srslte_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); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(8), &cesymb(1), &cesymb(0), 1); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(1), &cesymb(8), &cesymb(2), 6); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(1), &cesymb(8), &cesymb(9), 5); } } else { if (nsymbols == 4) { - interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(3), &cesymb(1), 2); - 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); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(0), &cesymb(3), &cesymb(1), 2); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(3), &cesymb(6), &cesymb(4), 2); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(6), &cesymb(9), &cesymb(7), 2); + srslte_interp_linear_vector(&q->srslte_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); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(7), &cesymb(1), &cesymb(0), 1); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(1), &cesymb(7), &cesymb(2), 5); + srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(1), &cesymb(7), &cesymb(8), 4); } } } -float chest_dl_rssi(chest_dl_t *q, cf_t *input, uint32_t port_id) { +float srslte_chest_dl_rssi(srslte_chest_dl_t *q, cf_t *input, uint32_t port_id) { uint32_t l; float rssi = 0; - uint32_t nsymbols = refsignal_cs_nof_symbols(port_id); + uint32_t nsymbols = srslte_refsignal_cs_nof_symbols(port_id); for (l=0;lcell.cp, port_id) * q->cell.nof_prb * RE_X_RB]; + cf_t *tmp = &input[srslte_refsignal_cs_nsymbol(l, q->cell.cp, port_id) * q->cell.nof_prb * RE_X_RB]; rssi += vec_dot_prod_conj_ccc(tmp, tmp, q->cell.nof_prb * RE_X_RB); } return rssi/nsymbols; @@ -341,33 +341,33 @@ float chest_dl_rssi(chest_dl_t *q, cf_t *input, uint32_t port_id) { //#define RSRP_FROM_ESTIMATES -float chest_dl_rsrp(chest_dl_t *q, uint32_t port_id) { +float srslte_chest_dl_rsrp(srslte_chest_dl_t *q, uint32_t port_id) { #ifdef RSRP_FROM_ESTIMATES return vec_avg_power_cf(q->pilot_estimates[port_id], - REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); + SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); #else return vec_avg_power_cf(q->pilot_estimates_average[port_id], - REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); + SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); #endif } -int chest_dl_estimate_port(chest_dl_t *q, cf_t *input, cf_t *ce, uint32_t sf_idx, uint32_t port_id) +int srslte_chest_dl_estimate_port(srslte_chest_dl_t *q, cf_t *input, cf_t *ce, uint32_t sf_idx, uint32_t port_id) { /* Get references from the input signal */ - refsignal_cs_get_sf(q->cell, port_id, input, q->pilot_recv_signal[port_id]); + srslte_refsignal_cs_get_sf(q->cell, port_id, input, q->pilot_recv_signal[port_id]); /* Use the known CSR signal to compute Least-squares estimates */ vec_prod_conj_ccc(q->pilot_recv_signal[port_id], q->csr_signal.pilots[port_id/2][sf_idx], - q->pilot_estimates[port_id], REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); + q->pilot_estimates[port_id], SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id)); /* Average pilot estimates */ average_pilots(q, port_id); /* Compute RSRP for the channel estimates in this port */ - q->rsrp[port_id] = chest_dl_rsrp(q, port_id); + q->rsrp[port_id] = srslte_chest_dl_rsrp(q, port_id); if (port_id == 0) { /* compute rssi only for port 0 */ - q->rssi[port_id] = chest_dl_rssi(q, input, port_id); + q->rssi[port_id] = srslte_chest_dl_rssi(q, input, port_id); } /* Interpolate to create channel estimates for all resource grid */ @@ -381,17 +381,17 @@ int chest_dl_estimate_port(chest_dl_t *q, cf_t *input, cf_t *ce, uint32_t sf_idx return 0; } -int chest_dl_estimate(chest_dl_t *q, cf_t *input, cf_t *ce[MAX_PORTS], uint32_t sf_idx) +int srslte_chest_dl_estimate(srslte_chest_dl_t *q, cf_t *input, cf_t *ce[SRSLTE_MAX_PORTS], uint32_t sf_idx) { uint32_t port_id; for (port_id=0;port_idcell.nof_ports;port_id++) { - chest_dl_estimate_port(q, input, ce[port_id], sf_idx, port_id); + srslte_chest_dl_estimate_port(q, input, ce[port_id], sf_idx, port_id); } return SRSLTE_SUCCESS; } -float chest_dl_get_noise_estimate(chest_dl_t *q) { +float srslte_chest_dl_get_noise_estimate(srslte_chest_dl_t *q) { float noise = vec_acc_ff(q->noise_estimate, q->cell.nof_ports)/q->cell.nof_ports; #ifdef NOISE_POWER_USE_ESTIMATES return noise*sqrtf(lte_symbol_sz(q->cell.nof_prb)); @@ -401,24 +401,24 @@ float chest_dl_get_noise_estimate(chest_dl_t *q) { } -float chest_dl_get_snr(chest_dl_t *q) { +float srslte_chest_dl_get_snr(srslte_chest_dl_t *q) { // Uses RSRP as an estimation of the useful signal power - return chest_dl_get_rsrp(q)/chest_dl_get_noise_estimate(q)/sqrt(2)/q->cell.nof_ports; + return srslte_chest_dl_get_rsrp(q)/srslte_chest_dl_get_noise_estimate(q)/sqrt(2)/q->cell.nof_ports; } -float chest_dl_get_rssi(chest_dl_t *q) { +float srslte_chest_dl_get_rssi(srslte_chest_dl_t *q) { return 4*q->rssi[0]/q->cell.nof_prb/RE_X_RB; } /* q->rssi[0] is the average power in all RE in all symbol containing references for port 0 . q->rssi[0]/q->cell.nof_prb is the average power per PRB * q->rsrp[0] is the average power of RE containing references only (for port 0). */ -float chest_dl_get_rsrq(chest_dl_t *q) { +float srslte_chest_dl_get_rsrq(srslte_chest_dl_t *q) { return q->cell.nof_prb*q->rsrp[0] / q->rssi[0]; } -float chest_dl_get_rsrp(chest_dl_t *q) { +float srslte_chest_dl_get_rsrp(srslte_chest_dl_t *q) { // return sum of power received from all tx ports return vec_acc_ff(q->rsrp, q->cell.nof_ports); diff --git a/srslte/lib/ch_estimation/src/refsignal_dl.c b/srslte/lib/ch_estimation/src/refsignal_dl.c index 78d50c834..a46416a52 100644 --- a/srslte/lib/ch_estimation/src/refsignal_dl.c +++ b/srslte/lib/ch_estimation/src/refsignal_dl.c @@ -38,7 +38,7 @@ #include "srslte/utils/debug.h" #include "srslte/common/sequence.h" -uint32_t refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx) +uint32_t srslte_refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx) { uint32_t v = 0; switch (port_id) { @@ -74,7 +74,7 @@ uint32_t refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx) return v; } -uint32_t refsignal_cs_nof_symbols(uint32_t port_id) +uint32_t srslte_refsignal_cs_nof_symbols(uint32_t port_id) { if (port_id < 2) { return 4; @@ -83,11 +83,11 @@ uint32_t refsignal_cs_nof_symbols(uint32_t port_id) } } -inline uint32_t refsignal_cs_fidx(lte_cell_t cell, uint32_t l, uint32_t port_id, uint32_t m) { - return 6*m + ((refsignal_cs_v(port_id, l) + (cell.id % 6)) % 6); +inline uint32_t srslte_refsignal_cs_fidx(srslte_cell_t cell, uint32_t l, uint32_t port_id, uint32_t m) { + return 6*m + ((srslte_refsignal_cs_v(port_id, l) + (cell.id % 6)) % 6); } -inline uint32_t refsignal_cs_nsymbol(uint32_t l, lte_cp_t cp, uint32_t port_id) { +inline uint32_t srslte_refsignal_cs_nsymbol(uint32_t l, srslte_cp_t cp, uint32_t port_id) { if (port_id < 2) { if (l % 2) { return (l/2+1)*CP_NSYMB(cp) - 3; @@ -103,7 +103,7 @@ inline uint32_t refsignal_cs_nsymbol(uint32_t l, lte_cp_t cp, uint32_t port_id) /** Allocates and precomputes the Cell-Specific Reference (CSR) signal for * the 20 slots in a subframe */ -int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell) +int srslte_refsignal_cs_init(srslte_refsignal_cs_t * q, srslte_cell_t cell) { uint32_t c_init; @@ -117,7 +117,7 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell) { ret = SRSLTE_ERROR; - bzero(q, sizeof(refsignal_cs_t)); + bzero(q, sizeof(srslte_refsignal_cs_t)); bzero(&seq, sizeof(sequence_t)); if (sequence_init(&seq, 2 * 2 * MAX_PRB)) { goto free_and_exit; @@ -132,8 +132,8 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell) q->cell = cell; for (p=0;p<2;p++) { - for (i=0;ipilots[p][i] = vec_malloc(sizeof(cf_t) * REFSIGNAL_NUM_SF(q->cell.nof_prb, 2*p)); + for (i=0;ipilots[p][i] = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, 2*p)); if (!q->pilots[p][i]) { perror("malloc"); goto free_and_exit; @@ -141,12 +141,12 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell) } } - for (ns=0;nscell.nof_prb; i++) { mp = i + MAX_PRB - cell.nof_prb; /* save signal */ - q->pilots[p][ns/2][REFSIGNAL_PILOT_IDX(i,(ns%2)*nsymbols+l,q->cell)] = + q->pilots[p][ns/2][SRSLTE_REFSIGNAL_PILOT_IDX(i,(ns%2)*nsymbols+l,q->cell)] = (1 - 2 * (float) seq.c[2 * mp]) / sqrt(2) + _Complex_I * (1 - 2 * (float) seq.c[2 * mp + 1]) / sqrt(2); } @@ -171,29 +171,29 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell) free_and_exit: if (ret == SRSLTE_ERROR) { sequence_free(&seq); - refsignal_cs_free(q); + srslte_refsignal_cs_free(q); } return ret; } -/** Deallocates a refsignal_cs_t object allocated with refsignal_cs_init */ -void refsignal_cs_free(refsignal_cs_t * q) +/** Deallocates a srslte_refsignal_cs_t object allocated with srslte_refsignal_cs_init */ +void srslte_refsignal_cs_free(srslte_refsignal_cs_t * q) { int i, p; for (p=0;p<2;p++) { - for (i=0;ipilots[p][i]) { free(q->pilots[p][i]); } } } - bzero(q, sizeof(refsignal_cs_t)); + bzero(q, sizeof(srslte_refsignal_cs_t)); } -/* Maps a reference signal initialized with refsignal_cs_init() into an array of subframe symbols */ -int refsignal_cs_put_sf(lte_cell_t cell, uint32_t port_id, cf_t *pilots, cf_t *sf_symbols) +/* Maps a reference signal initialized with srslte_refsignal_cs_init() into an array of subframe symbols */ +int srslte_refsignal_cs_put_sf(srslte_cell_t cell, uint32_t port_id, cf_t *pilots, cf_t *sf_symbols) { uint32_t i, l; uint32_t fidx; @@ -204,12 +204,12 @@ int refsignal_cs_put_sf(lte_cell_t cell, uint32_t port_id, cf_t *pilots, cf_t *s sf_symbols != NULL) { - for (l=0;lcell.id / 30) << 5) + (((q->cell.id % 30) + delta_ss) % 30); if (sequence_LTE_pr(&seq, 8 * CP_NSYMB(q->cell.cp) * 20, c_init)) { return SRSLTE_ERROR; } - for (uint32_t ns=0;nscell.cp) * ns + i] << i); @@ -90,7 +90,7 @@ static int generate_n_prs(refsignal_ul_t * q) { } /** Computes sequence-group pattern f_gh according to 5.5.1.3 of 36.211 */ -static int generate_group_hopping_f_gh(refsignal_ul_t *q) { +static int generate_group_hopping_f_gh(srslte_refsignal_ul_t *q) { sequence_t seq; bzero(&seq, sizeof(sequence_t)); @@ -98,7 +98,7 @@ static int generate_group_hopping_f_gh(refsignal_ul_t *q) { return SRSLTE_ERROR; } - for (uint32_t ns=0;nscell.id / 30) << 5) + ((q->cell.id%30)+delta_ss)%30)) { return SRSLTE_ERROR; } @@ -127,17 +127,17 @@ static int generate_sequence_hopping_v(refsignal_ul_t *q) { } -/** Initializes refsignal_ul_t object according to 3GPP 36.211 5.5 +/** Initializes srslte_refsignal_ul_t object according to 3GPP 36.211 5.5 * */ -int refsignal_ul_init(refsignal_ul_t * q, lte_cell_t cell) +int srslte_refsignal_ul_init(srslte_refsignal_ul_t * q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && lte_cell_isvalid(&cell)) { - bzero(q, sizeof(refsignal_ul_t)); + bzero(q, sizeof(srslte_refsignal_ul_t)); q->cell = cell; // Allocate temporal buffer for computing signal argument @@ -170,16 +170,16 @@ int refsignal_ul_init(refsignal_ul_t * q, lte_cell_t cell) } free_and_exit: if (ret == SRSLTE_ERROR) { - refsignal_ul_free(q); + srslte_refsignal_ul_free(q); } return ret; } -void refsignal_ul_free(refsignal_ul_t * q) { +void srslte_refsignal_ul_free(srslte_refsignal_ul_t * q) { if (q->tmp_arg) { free(q->tmp_arg); } - bzero(q, sizeof(refsignal_ul_t)); + bzero(q, sizeof(srslte_refsignal_ul_t)); } @@ -232,7 +232,7 @@ static void arg_r_uv_mprb(float *arg, uint32_t M_sc, uint32_t u, uint32_t v) { } /* Computes argument of r_u_v signal */ -static void compute_pusch_r_uv_arg(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, uint32_t nof_prb, uint32_t u, uint32_t v) { +static void compute_pusch_r_uv_arg(srslte_refsignal_ul_t *q, srslte_refsignal_drms_pusch_cfg_t *cfg, uint32_t nof_prb, uint32_t u, uint32_t v) { if (nof_prb == 1) { arg_r_uv_1prb(q->tmp_arg, u); } else if (nof_prb == 2) { @@ -243,7 +243,7 @@ static void compute_pusch_r_uv_arg(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t } /* Calculates alpha according to 5.5.2.1.1 of 36.211 */ -static float pusch_get_alpha(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, uint32_t ns) { +static float pusch_get_alpha(srslte_refsignal_ul_t *q, srslte_refsignal_drms_pusch_cfg_t *cfg, uint32_t ns) { uint32_t n_drms_2_val = 0; if (cfg->en_drms_2) { n_drms_2_val = n_drms_2[cfg->cyclic_shift_for_drms]; @@ -254,10 +254,10 @@ static float pusch_get_alpha(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, } -bool refsignal_drms_pusch_cfg_isvalid(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, uint32_t nof_prb) { - if (cfg->cyclic_shift < NOF_CSHIFT && - cfg->cyclic_shift_for_drms < NOF_CSHIFT && - cfg->delta_ss < NOF_DELTA_SS && +bool srslte_refsignal_drms_pusch_cfg_isvalid(srslte_refsignal_ul_t *q, srslte_refsignal_drms_pusch_cfg_t *cfg, uint32_t nof_prb) { + if (cfg->cyclic_shift < SRSLTE_NOF_CSHIFT && + cfg->cyclic_shift_for_drms < SRSLTE_NOF_CSHIFT && + cfg->delta_ss < SRSLTE_NOF_DELTA_SS && nof_prb < q->cell.nof_prb) { return true; } else { @@ -265,7 +265,7 @@ bool refsignal_drms_pusch_cfg_isvalid(refsignal_ul_t *q, refsignal_drms_pusch_cf } } -void refsignal_drms_pusch_put(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, +void srslte_refsignal_drms_pusch_put(srslte_refsignal_ul_t *q, srslte_refsignal_drms_pusch_cfg_t *cfg, cf_t *r_pusch, uint32_t nof_prb, uint32_t n_prb[2], @@ -280,11 +280,11 @@ void refsignal_drms_pusch_put(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg } /* Generate DRMS for PUSCH signal according to 5.5.2.1 of 36.211 */ -int refsignal_dmrs_pusch_gen(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, uint32_t nof_prb, uint32_t sf_idx, cf_t *r_pusch) +int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q, srslte_refsignal_drms_pusch_cfg_t *cfg, uint32_t nof_prb, uint32_t sf_idx, cf_t *r_pusch) { int ret = SRSLTE_ERROR_INVALID_INPUTS; - if (refsignal_drms_pusch_cfg_isvalid(q, cfg, nof_prb)) { + if (srslte_refsignal_drms_pusch_cfg_isvalid(q, cfg, nof_prb)) { ret = SRSLTE_ERROR; for (uint32_t ns=2*sf_idx;ns<2*(sf_idx+1);ns++) { @@ -324,7 +324,7 @@ int refsignal_dmrs_pusch_gen(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg, return ret; } -int refsignal_dmrs_pucch_gen(refsignal_ul_t *q, pucch_cfg_t *cfg, uint32_t sf_idx, uint32_t n_rb, cf_t *r_pucch) +int srslte_refsignal_dmrs_pucch_gen(srslte_refsignal_ul_t *q, pucch_cfg_t *cfg, uint32_t sf_idx, uint32_t n_rb, cf_t *r_pucch) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (pucch_cfg_isvalid(cfg)) { @@ -411,7 +411,7 @@ int refsignal_dmrs_pucch_gen(refsignal_ul_t *q, pucch_cfg_t *cfg, uint32_t sf_id return ret; } -void refsignal_srs_gen(refsignal_ul_t *q, refsignal_srs_cfg_t *cfg, uint32_t ns, cf_t *r_srs) +void srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, srslte_refsignal_srs_cfg_t *cfg, uint32_t ns, cf_t *r_srs) { } diff --git a/srslte/lib/ch_estimation/test/chest_test_dl.c b/srslte/lib/ch_estimation/test/chest_test_dl.c index bb61c9f8e..6bb484291 100644 --- a/srslte/lib/ch_estimation/test/chest_test_dl.c +++ b/srslte/lib/ch_estimation/test/chest_test_dl.c @@ -33,7 +33,7 @@ #include "srslte/srslte.h" -lte_cell_t cell = { +srslte_cell_t cell = { 6, // nof_prb 1, // nof_ports 1000, // cell_id @@ -82,7 +82,7 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { - chest_dl_t est; + srslte_chest_dl_t est; precoding_t cheq; cf_t *input = NULL, *ce = NULL, *h = NULL, *output = NULL; int i, j, n_port, sf_idx, cid, num_re; @@ -135,7 +135,7 @@ int main(int argc, char **argv) { while(cid <= max_cid) { cell.id = cid; - if (chest_dl_init(&est, cell)) { + if (srslte_chest_dl_init(&est, cell)) { fprintf(stderr, "Error initializing equalizer\n"); goto do_exit; } @@ -151,7 +151,7 @@ int main(int argc, char **argv) { bzero(ce, sizeof(cf_t) * num_re); bzero(h, sizeof(cf_t) * num_re); - refsignal_cs_put_sf(cell, n_port, + srslte_refsignal_cs_put_sf(cell, n_port, est.csr_signal.pilots[n_port/2][sf_idx], input); for (i=0;i<2*CP_NSYMB(cell.cp);i++) { @@ -165,7 +165,7 @@ int main(int argc, char **argv) { struct timeval t[3]; gettimeofday(&t[1], NULL); for (int j=0;j<100;j++) { - chest_dl_estimate_port(&est, input, ce, sf_idx, n_port); + srslte_chest_dl_estimate_port(&est, input, ce, sf_idx, n_port); } gettimeofday(&t[2], NULL); get_time_interval(t); @@ -188,7 +188,7 @@ int main(int argc, char **argv) { gettimeofday(&t[1], NULL); for (int j=0;j<100;j++) { - predecoding_single(&cheq, input, ce, output, num_re, chest_dl_get_noise_estimate(&est)); + predecoding_single(&cheq, input, ce, output, num_re, srslte_chest_dl_get_noise_estimate(&est)); } gettimeofday(&t[2], NULL); get_time_interval(t); @@ -218,7 +218,7 @@ int main(int argc, char **argv) { } } } - chest_dl_free(&est); + srslte_chest_dl_free(&est); cid+=10; INFO("cid=%d\n", cid); } diff --git a/srslte/lib/ch_estimation/test/chest_test_dl_mex.c b/srslte/lib/ch_estimation/test/chest_test_dl_mex.c index b47fc6f32..c780e6ac3 100644 --- a/srslte/lib/ch_estimation/test/chest_test_dl_mex.c +++ b/srslte/lib/ch_estimation/test/chest_test_dl_mex.c @@ -62,12 +62,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int i; - lte_cell_t cell; - chest_dl_t chest; + srslte_cell_t cell; + srslte_chest_dl_t chest; precoding_t cheq; cf_t *input_signal = NULL, *output_signal[MAX_LAYERS]; cf_t *output_signal2 = NULL; - cf_t *ce[MAX_PORTS]; + cf_t *ce[SRSLTE_MAX_PORTS]; double *outr0=NULL, *outi0=NULL; double *outr1=NULL, *outi1=NULL; double *outr2=NULL, *outi2=NULL; @@ -97,7 +97,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) return; } - if (chest_dl_init(&chest, cell)) { + if (srslte_chest_dl_init(&chest, cell)) { mexErrMsgTxt("Error initiating channel estimator\n"); return; } @@ -135,7 +135,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) filter[i] = (float) f[i]; } - chest_dl_set_filter_freq(&chest, filter, filter_len); + srslte_chest_dl_set_filter_freq(&chest, filter, filter_len); filter_len = mxGetNumberOfElements(TIME_FILTER); filter = malloc(sizeof(float) * filter_len); @@ -143,7 +143,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) for (i=0;i= 2) { - plhs[1] = mxCreateDoubleMatrix(REFSIGNAL_MAX_NUM_SF(cell.nof_prb)*nsubframes, cell.nof_ports, mxCOMPLEX); + plhs[1] = mxCreateDoubleMatrix(SRSLTE_REFSIGNAL_MAX_NUM_SF(cell.nof_prb)*nsubframes, cell.nof_ports, mxCOMPLEX); outr1 = mxGetPr(plhs[1]); outi1 = mxGetPi(plhs[1]); } @@ -195,15 +195,15 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) sf_idx = sf%10; } - if (chest_dl_estimate(&chest, input_signal, ce, sf_idx)) { + if (srslte_chest_dl_estimate(&chest, input_signal, ce, sf_idx)) { mexErrMsgTxt("Error running channel estimator\n"); return; } if (cell.nof_ports == 1) { - predecoding_single(&cheq, input_signal, ce[0], output_signal2, nof_re, chest_dl_get_noise_estimate(&chest)); + predecoding_single(&cheq, input_signal, ce[0], output_signal2, nof_re, srslte_chest_dl_get_noise_estimate(&chest)); } else { - predecoding_diversity(&cheq, input_signal, ce, output_signal, cell.nof_ports, nof_re, chest_dl_get_noise_estimate(&chest)); + predecoding_diversity(&cheq, input_signal, ce, output_signal, cell.nof_ports, nof_re, srslte_chest_dl_get_noise_estimate(&chest)); layerdemap_diversity(output_signal, output_signal2, cell.nof_ports, nof_re/cell.nof_ports); } @@ -221,7 +221,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) } if (nlhs >= 2) { for (int j=0;j= 4) { - plhs[3] = mxCreateDoubleScalar(chest_dl_get_snr(&chest)); + plhs[3] = mxCreateDoubleScalar(srslte_chest_dl_get_snr(&chest)); } if (nlhs >= 5) { - plhs[4] = mxCreateDoubleScalar(chest_dl_get_noise_estimate(&chest)); + plhs[4] = mxCreateDoubleScalar(srslte_chest_dl_get_noise_estimate(&chest)); } if (nlhs >= 6) { - plhs[5] = mxCreateDoubleScalar(chest_dl_get_rsrp(&chest)); + plhs[5] = mxCreateDoubleScalar(srslte_chest_dl_get_rsrp(&chest)); } - chest_dl_free(&chest); + srslte_chest_dl_free(&chest); precoding_free(&cheq); return; diff --git a/srslte/lib/ch_estimation/test/refsignal_pusch_mex.c b/srslte/lib/ch_estimation/test/refsignal_pusch_mex.c index 9ed205dc3..180ffbbbe 100644 --- a/srslte/lib/ch_estimation/test/refsignal_pusch_mex.c +++ b/srslte/lib/ch_estimation/test/refsignal_pusch_mex.c @@ -39,7 +39,7 @@ void help() { mexErrMsgTxt - ("[seq] = srslte_refsignal_pusch(ueConfig, puschConfig)\n\n"); + ("[seq] = srslte_srslte_refsignal_pusch(ueConfig, puschConfig)\n\n"); } extern int indices[2048]; @@ -47,9 +47,9 @@ extern int indices[2048]; /* the gateway function */ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { - lte_cell_t cell; - refsignal_ul_t refs; - refsignal_drms_pusch_cfg_t pusch_cfg; + srslte_cell_t cell; + srslte_refsignal_ul_t refs; + srslte_refsignal_drms_pusch_cfg_t pusch_cfg; uint32_t sf_idx; if (nrhs != NOF_INPUTS) { @@ -73,7 +73,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) return; } - bzero(&pusch_cfg, sizeof(refsignal_drms_pusch_cfg_t)); + bzero(&pusch_cfg, sizeof(srslte_refsignal_drms_pusch_cfg_t)); pusch_cfg.group_hopping_en = false; @@ -113,8 +113,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) pusch_cfg.beta_pusch = 1.0; - if (refsignal_ul_init(&refs, cell)) { - mexErrMsgTxt("Error initiating refsignal_ul\n"); + if (srslte_refsignal_ul_init(&refs, cell)) { + mexErrMsgTxt("Error initiating srslte_refsignal_ul\n"); return; } @@ -135,16 +135,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) } bzero(sf_symbols, SF_LEN_RE(cell.nof_prb, cell.cp)*sizeof(cf_t)); //mexPrintf("Generating DRMS for ns=%d, nof_prb=%d\n", 2*sf_idx+i,pusch_cfg.nof_prb); - refsignal_dmrs_pusch_gen(&refs, &pusch_cfg, nof_prb, sf_idx, signal); + srslte_refsignal_dmrs_pusch_gen(&refs, &pusch_cfg, nof_prb, sf_idx, signal); uint32_t n_prb[2]; n_prb[0] = prbset[0]; n_prb[1] = prbset[0]; - refsignal_drms_pusch_put(&refs, &pusch_cfg, signal, nof_prb, n_prb, sf_symbols); + srslte_refsignal_drms_pusch_put(&refs, &pusch_cfg, signal, nof_prb, n_prb, sf_symbols); if (nlhs >= 1) { mexutils_write_cf(sf_symbols, &plhs[0], SF_LEN_RE(cell.nof_prb, cell.cp), 1); } - refsignal_ul_free(&refs); + srslte_refsignal_ul_free(&refs); free(signal); free(prbset); diff --git a/srslte/lib/ch_estimation/test/refsignal_ul_test.c b/srslte/lib/ch_estimation/test/refsignal_ul_test.c index 5cae6f749..4fa62341a 100644 --- a/srslte/lib/ch_estimation/test/refsignal_ul_test.c +++ b/srslte/lib/ch_estimation/test/refsignal_ul_test.c @@ -33,9 +33,9 @@ #include "srslte/srslte.h" -lte_cell_t cell = { +srslte_cell_t cell = { 100, // nof_prb - MAX_PORTS, // nof_ports + SRSLTE_MAX_PORTS, // nof_ports 1, // cell_id CPNORM // cyclic prefix }; @@ -75,8 +75,8 @@ void parse_args(int argc, char **argv) { } int main(int argc, char **argv) { - refsignal_ul_t refs; - refsignal_drms_pusch_cfg_t pusch_cfg; + srslte_refsignal_ul_t refs; + srslte_refsignal_drms_pusch_cfg_t pusch_cfg; cf_t *signal = NULL; int ret = -1; @@ -88,7 +88,7 @@ int main(int argc, char **argv) { goto do_exit; } - if (refsignal_ul_init(&refs, cell)) { + if (srslte_refsignal_ul_init(&refs, cell)) { fprintf(stderr, "Error initializing UL reference signal\n"); goto do_exit; } @@ -96,11 +96,11 @@ int main(int argc, char **argv) { printf("Running tests for %d PRB\n", cell.nof_prb); for (int n=6;ninput,hl->output,hl->ctrl_in.variance,hl->in_len); +int srslte_ch_awgn_work(srslte_ch_awgn_hl* hl) { + srslte_ch_awgn_c(hl->input,hl->output,hl->ctrl_in.variance,hl->in_len); hl->out_len = hl->in_len; return 0; } -int ch_awgn_stop(ch_awgn_hl* hl) { +int srslte_ch_awgn_stop(srslte_ch_awgn_hl* hl) { return 0; } diff --git a/srslte/lib/common/src/fft.c b/srslte/lib/common/src/fft.c index 63a43c12d..d2cffd293 100644 --- a/srslte/lib/common/src/fft.c +++ b/srslte/lib/common/src/fft.c @@ -37,7 +37,7 @@ #include "srslte/utils/debug.h" #include "srslte/utils/vector.h" -int lte_fft_init_(lte_fft_t *q, lte_cp_t cp, uint32_t nof_prb, dft_dir_t dir) { +int srslte_fft_init_(srslte_fft_t *q, srslte_cp_t cp, uint32_t nof_prb, dft_dir_t dir) { int symbol_sz = lte_symbol_sz(nof_prb); if (symbol_sz < 0) { @@ -72,7 +72,7 @@ int lte_fft_init_(lte_fft_t *q, lte_cp_t cp, uint32_t nof_prb, dft_dir_t dir) { return SRSLTE_SUCCESS; } -void lte_fft_free_(lte_fft_t *q) { +void srslte_fft_free_(srslte_fft_t *q) { dft_plan_free(&q->fft_plan); if (q->tmp) { free(q->tmp); @@ -80,22 +80,22 @@ void lte_fft_free_(lte_fft_t *q) { if (q->shift_buffer) { free(q->shift_buffer); } - bzero(q, sizeof(lte_fft_t)); + bzero(q, sizeof(srslte_fft_t)); } -int lte_fft_init(lte_fft_t *q, lte_cp_t cp, uint32_t nof_prb) { - return lte_fft_init_(q, cp, nof_prb, FORWARD); +int srslte_fft_init(srslte_fft_t *q, srslte_cp_t cp, uint32_t nof_prb) { + return srslte_fft_init_(q, cp, nof_prb, FORWARD); } -void lte_fft_free(lte_fft_t *q) { - lte_fft_free_(q); +void srslte_fft_free(srslte_fft_t *q) { + srslte_fft_free_(q); } -int lte_ifft_init(lte_fft_t *q, lte_cp_t cp, uint32_t nof_prb) { +int lte_ifft_init(srslte_fft_t *q, srslte_cp_t cp, uint32_t nof_prb) { uint32_t i; int ret; - ret = lte_fft_init_(q, cp, nof_prb, BACKWARD); + ret = srslte_fft_init_(q, cp, nof_prb, BACKWARD); if (ret == SRSLTE_SUCCESS) { dft_plan_set_norm(&q->fft_plan, true); @@ -113,7 +113,7 @@ int lte_ifft_init(lte_fft_t *q, lte_cp_t cp, uint32_t nof_prb) { * Freq_shift is relative to inter-carrier spacing. * Caution: This function shall not be called during run-time */ -int lte_fft_set_freq_shift(lte_fft_t *q, float freq_shift) { +int srslte_fft_set_freq_shift(srslte_fft_t *q, float freq_shift) { q->shift_buffer = vec_malloc(sizeof(cf_t) * SF_LEN(q->symbol_sz)); if (!q->shift_buffer) { perror("malloc"); @@ -138,14 +138,14 @@ int lte_fft_set_freq_shift(lte_fft_t *q, float freq_shift) { return SRSLTE_SUCCESS; } -void lte_ifft_free(lte_fft_t *q) { - lte_fft_free_(q); +void lte_ifft_free(srslte_fft_t *q) { + srslte_fft_free_(q); } /* Transforms input samples into output OFDM symbols. * Performs FFT on a each symbol and removes CP. */ -void lte_fft_run_slot(lte_fft_t *q, cf_t *input, cf_t *output) { +void srslte_fft_run_slot(srslte_fft_t *q, cf_t *input, cf_t *output) { uint32_t i; for (i=0;inof_symbols;i++) { input += CP_ISNORM(q->cp)?CP_NORM(i, q->symbol_sz):CP_EXT(q->symbol_sz); @@ -156,20 +156,20 @@ void lte_fft_run_slot(lte_fft_t *q, cf_t *input, cf_t *output) { } } -void lte_fft_run_sf(lte_fft_t *q, cf_t *input, cf_t *output) { +void srslte_fft_run_sf(srslte_fft_t *q, cf_t *input, cf_t *output) { uint32_t n; if (q->freq_shift) { vec_prod_ccc(input, q->shift_buffer, input, 2*q->slot_sz); } for (n=0;n<2;n++) { - lte_fft_run_slot(q, &input[n*q->slot_sz], &output[n*q->nof_re*q->nof_symbols]); + srslte_fft_run_slot(q, &input[n*q->slot_sz], &output[n*q->nof_re*q->nof_symbols]); } } /* Transforms input OFDM symbols into output samples. * Performs FFT on a each symbol and adds CP. */ -void lte_ifft_run_slot(lte_fft_t *q, cf_t *input, cf_t *output) { +void lte_ifft_run_slot(srslte_fft_t *q, cf_t *input, cf_t *output) { uint32_t i, cp_len; for (i=0;inof_symbols;i++) { cp_len = CP_ISNORM(q->cp)?CP_NORM(i, q->symbol_sz):CP_EXT(q->symbol_sz); @@ -182,11 +182,11 @@ void lte_ifft_run_slot(lte_fft_t *q, cf_t *input, cf_t *output) { } } -void lte_fft_set_normalize(lte_fft_t *q, bool normalize_enable) { +void srslte_fft_set_normalize(srslte_fft_t *q, bool normalize_enable) { dft_plan_set_norm(&q->fft_plan, normalize_enable); } -void lte_ifft_run_sf(lte_fft_t *q, cf_t *input, cf_t *output) { +void lte_ifft_run_sf(srslte_fft_t *q, cf_t *input, cf_t *output) { uint32_t n; for (n=0;n<2;n++) { lte_ifft_run_slot(q, &input[n*q->nof_re*q->nof_symbols], &output[n*q->slot_sz]); diff --git a/srslte/lib/common/src/phy_common.c b/srslte/lib/common/src/phy_common.c index cfd8726b3..1244e4cf3 100644 --- a/srslte/lib/common/src/phy_common.c +++ b/srslte/lib/common/src/phy_common.c @@ -69,18 +69,18 @@ bool lte_nofprb_isvalid(uint32_t nof_prb) { } } -bool lte_cell_isvalid(lte_cell_t *cell) { +bool lte_cell_isvalid(srslte_cell_t *cell) { return lte_cellid_isvalid(cell->id) && lte_portid_isvalid(cell->nof_ports) && lte_nofprb_isvalid(cell->nof_prb); } -void lte_cell_fprint(FILE *stream, lte_cell_t *cell) { +void lte_cell_fprint(FILE *stream, srslte_cell_t *cell) { fprintf(stream, "PCI: %d, CP: %s, PRB: %d, Ports: %d\n", cell->id, lte_cp_string(cell->cp), cell->nof_prb, cell->nof_ports); } bool lte_sfidx_isvalid(uint32_t sf_idx) { - if (sf_idx <= NSUBFRAMES_X_FRAME) { + if (sf_idx <= SRSLTE_NSUBFRAMES_X_FRAME) { return true; } else { return false; @@ -88,7 +88,7 @@ bool lte_sfidx_isvalid(uint32_t sf_idx) { } bool lte_portid_isvalid(uint32_t port_id) { - if (port_id <= MAX_PORTS) { + if (port_id <= SRSLTE_MAX_PORTS) { return true; } else { return false; @@ -162,7 +162,7 @@ uint32_t lte_mod_bits_x_symbol(lte_mod_t mod) { } } -char *lte_cp_string(lte_cp_t cp) { +char *lte_cp_string(srslte_cp_t cp) { if (cp == CPNORM) { return "Normal"; } else { diff --git a/srslte/lib/common/test/fft_test.c b/srslte/lib/common/test/fft_test.c index 649a68204..935ed711c 100644 --- a/srslte/lib/common/test/fft_test.c +++ b/srslte/lib/common/test/fft_test.c @@ -35,7 +35,7 @@ #include "srslte/srslte.h" int nof_prb = -1; -lte_cp_t cp = CPNORM; +srslte_cp_t cp = CPNORM; void usage(char *prog) { printf("Usage: %s\n", prog); @@ -62,7 +62,7 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { - lte_fft_t fft, ifft; + srslte_fft_t fft, ifft; cf_t *input, *outfft, *outifft; float mse; int n_prb, max_prb, n_re; @@ -98,7 +98,7 @@ int main(int argc, char **argv) { exit(-1); } - if (lte_fft_init(&fft, cp, n_prb)) { + if (srslte_fft_init(&fft, cp, n_prb)) { fprintf(stderr, "Error initializing FFT\n"); exit(-1); } @@ -115,7 +115,7 @@ int main(int argc, char **argv) { } lte_ifft_run_slot(&ifft, input, outfft); - lte_fft_run_slot(&fft, outfft, outifft); + srslte_fft_run_slot(&fft, outfft, outifft); /* compute MSE */ @@ -130,7 +130,7 @@ int main(int argc, char **argv) { exit(-1); } - lte_fft_free(&fft); + srslte_fft_free(&fft); lte_ifft_free(&ifft); free(input); diff --git a/srslte/lib/fec/test/turbodecoder_test.c b/srslte/lib/fec/test/turbodecoder_test.c index 13bd00faf..133973337 100644 --- a/srslte/lib/fec/test/turbodecoder_test.c +++ b/srslte/lib/fec/test/turbodecoder_test.c @@ -242,7 +242,7 @@ int main(int argc, char **argv) { llr[j] = symbols[j] ? sqrt(2) : -sqrt(2); } - ch_awgn_f(llr, llr, var[i], coded_length); + srslte_ch_awgn_f(llr, llr, var[i], coded_length); /* decoder */ tdec_reset(&tdec, frame_length); diff --git a/srslte/lib/fec/test/viterbi_test.c b/srslte/lib/fec/test/viterbi_test.c index 7e526f4fa..e3d5ff3ed 100644 --- a/srslte/lib/fec/test/viterbi_test.c +++ b/srslte/lib/fec/test/viterbi_test.c @@ -265,7 +265,7 @@ int main(int argc, char **argv) { for (j = 0; j < frame_length; j++) { llr[j] = data_tx[j] ? sqrt(2) : -sqrt(2); } - ch_awgn_f(llr, llr, varunc[i], frame_length); + srslte_ch_awgn_f(llr, llr, varunc[i], frame_length); for (j = 0; j < frame_length; j++) { data_rx[0][j] = llr[j] > 0 ? 1 : 0; } @@ -278,7 +278,7 @@ int main(int argc, char **argv) { llr[j] = symbols[j] ? sqrt(2) : -sqrt(2); } - ch_awgn_f(llr, llr, var[i], coded_length[n]); + srslte_ch_awgn_f(llr, llr, var[i], coded_length[n]); vec_quant_fuc(llr, llr_c, Gain, 127.5, 255, coded_length[n]); /* decoder 1 */ diff --git a/srslte/lib/mimo/src/precoding.c b/srslte/lib/mimo/src/precoding.c index 91f5d1957..2005bff44 100644 --- a/srslte/lib/mimo/src/precoding.c +++ b/srslte/lib/mimo/src/precoding.c @@ -138,7 +138,7 @@ int predecoding_single(precoding_t *q, cf_t *y, cf_t *h, cf_t *x, int nof_symbol /* ZF/MMSE STBC equalizer x=y(H'H+n0·I)^(-1)H' (ZF is n0=0.0) */ -int predecoding_diversity(precoding_t *q, cf_t *y, cf_t *h[MAX_PORTS], cf_t *x[MAX_LAYERS], +int predecoding_diversity(precoding_t *q, cf_t *y, cf_t *h[SRSLTE_MAX_PORTS], cf_t *x[MAX_LAYERS], int nof_ports, int nof_symbols, float noise_estimate) { int i; @@ -240,11 +240,11 @@ int predecoding_diversity(precoding_t *q, cf_t *y, cf_t *h[MAX_PORTS], cf_t *x[M } /* 36.211 v10.3.0 Section 6.3.4 */ -int predecoding_type(precoding_t *q, cf_t *y, cf_t *h[MAX_PORTS], cf_t *x[MAX_LAYERS], +int predecoding_type(precoding_t *q, cf_t *y, cf_t *h[SRSLTE_MAX_PORTS], cf_t *x[MAX_LAYERS], int nof_ports, int nof_layers, int nof_symbols, lte_mimo_type_t type, float noise_estimate) { - if (nof_ports > MAX_PORTS) { - fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", MAX_PORTS, + if (nof_ports > SRSLTE_MAX_PORTS) { + fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS, nof_ports); return -1; } @@ -295,7 +295,7 @@ int precoding_single(precoding_t *q, cf_t *x, cf_t *y, int nof_symbols) { memcpy(y, x, nof_symbols * sizeof(cf_t)); return nof_symbols; } -int precoding_diversity(precoding_t *q, cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_ports, +int precoding_diversity(precoding_t *q, cf_t *x[MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS], int nof_ports, int nof_symbols) { int i; if (nof_ports == 2) { @@ -341,11 +341,11 @@ int precoding_diversity(precoding_t *q, cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], } /* 36.211 v10.3.0 Section 6.3.4 */ -int precoding_type(precoding_t *q, cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_layers, +int precoding_type(precoding_t *q, cf_t *x[MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS], int nof_layers, int nof_ports, int nof_symbols, lte_mimo_type_t type) { - if (nof_ports > MAX_PORTS) { - fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", MAX_PORTS, + if (nof_ports > SRSLTE_MAX_PORTS) { + fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS, nof_ports); return -1; } diff --git a/srslte/lib/mimo/test/precoding_test.c b/srslte/lib/mimo/test/precoding_test.c index d6767bb31..748574beb 100644 --- a/srslte/lib/mimo/test/precoding_test.c +++ b/srslte/lib/mimo/test/precoding_test.c @@ -79,14 +79,14 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { int i, j; float mse; - cf_t *x[MAX_LAYERS], *r[MAX_PORTS], *y[MAX_PORTS], *h[MAX_PORTS], + cf_t *x[MAX_LAYERS], *r[SRSLTE_MAX_PORTS], *y[SRSLTE_MAX_PORTS], *h[SRSLTE_MAX_PORTS], *xr[MAX_LAYERS]; lte_mimo_type_t type; precoding_t precoding; parse_args(argc, argv); - if (nof_ports > MAX_PORTS || nof_layers > MAX_LAYERS) { + if (nof_ports > SRSLTE_MAX_PORTS || nof_layers > MAX_LAYERS) { fprintf(stderr, "Invalid number of layers or ports\n"); exit(-1); } diff --git a/srslte/lib/modem/test/soft_demod_test.c b/srslte/lib/modem/test/soft_demod_test.c index e10ebb845..a5f36ea18 100644 --- a/srslte/lib/modem/test/soft_demod_test.c +++ b/srslte/lib/modem/test/soft_demod_test.c @@ -175,7 +175,7 @@ int main(int argc, char **argv) { mod_modulate(&mod, input, symbols, num_bits); /* add noise */ - ch_awgn_c(symbols, symbols, ch_awgn_get_variance(5.0, mod.nbits_x_symbol), num_bits / mod.nbits_x_symbol); + srslte_ch_awgn_c(symbols, symbols, srslte_ch_awgn_get_variance(5.0, mod.nbits_x_symbol), num_bits / mod.nbits_x_symbol); /* Compare exact with approximation algorithms */ demod_soft_alg_set(&demod_soft, EXACT); diff --git a/srslte/lib/phch/src/dci.c b/srslte/lib/phch/src/dci.c index 615c444e5..aa0ed939f 100644 --- a/srslte/lib/phch/src/dci.c +++ b/srslte/lib/phch/src/dci.c @@ -44,7 +44,7 @@ /* Creates the DL PDSCH resource allocation grant from a DCI message */ int dci_msg_to_ra_dl(dci_msg_t *msg, uint16_t msg_rnti, - lte_cell_t cell, uint32_t cfi, + srslte_cell_t cell, uint32_t cfi, ra_pdsch_t *ra_dl) { int ret = SRSLTE_ERROR_INVALID_INPUTS; diff --git a/srslte/lib/phch/src/harq.c b/srslte/lib/phch/src/harq.c index 4807b5a1a..08403fd6c 100644 --- a/srslte/lib/phch/src/harq.c +++ b/srslte/lib/phch/src/harq.c @@ -93,14 +93,14 @@ int codeblock_segmentation(struct cb_segm *s, uint32_t tbs) { return ret; } -int harq_init(harq_t *q, lte_cell_t cell) { +int harq_init(harq_t *q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { uint32_t i; bzero(q, sizeof(harq_t)); - memcpy(&q->cell, &cell, sizeof(lte_cell_t)); + memcpy(&q->cell, &cell, sizeof(srslte_cell_t)); ret = ra_tbs_from_idx(26, cell.nof_prb); if (ret != SRSLTE_ERROR) { diff --git a/srslte/lib/phch/src/pbch.c b/srslte/lib/phch/src/pbch.c index 8a709e729..0dd86a207 100644 --- a/srslte/lib/phch/src/pbch.c +++ b/srslte/lib/phch/src/pbch.c @@ -53,7 +53,7 @@ bool pbch_exists(int nframe, int nslot) { cf_t *offset_original; -int pbch_cp(cf_t *input, cf_t *output, lte_cell_t cell, bool put) { +int pbch_cp(cf_t *input, cf_t *output, srslte_cell_t cell, bool put) { int i; cf_t *ptr; @@ -109,7 +109,7 @@ int pbch_cp(cf_t *input, cf_t *output, lte_cell_t cell, bool put) { * * 36.211 10.3 section 6.6.4 */ -int pbch_put(cf_t *pbch, cf_t *slot1_data, lte_cell_t cell) { +int pbch_put(cf_t *pbch, cf_t *slot1_data, srslte_cell_t cell) { return pbch_cp(pbch, slot1_data, cell, true); } @@ -120,7 +120,7 @@ int pbch_put(cf_t *pbch, cf_t *slot1_data, lte_cell_t cell) { * * 36.211 10.3 section 6.6.4 */ -int pbch_get(cf_t *slot1_data, cf_t *pbch, lte_cell_t cell) { +int pbch_get(cf_t *slot1_data, cf_t *pbch, srslte_cell_t cell) { return pbch_cp(slot1_data, pbch, cell, false); } @@ -128,7 +128,7 @@ int pbch_get(cf_t *slot1_data, cf_t *pbch, lte_cell_t cell) { * At the receiver, the field nof_ports in the cell structure indicates the * maximum number of BS transmitter ports to look for. */ -int pbch_init(pbch_t *q, lte_cell_t cell) { +int pbch_init(pbch_t *q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && @@ -246,7 +246,7 @@ void pbch_free(pbch_t *q) { /** Unpacks MIB from PBCH message. * msg buffer must be 24 byte length at least */ -void pbch_mib_unpack(uint8_t *msg, lte_cell_t *cell, uint32_t *sfn) { +void pbch_mib_unpack(uint8_t *msg, srslte_cell_t *cell, uint32_t *sfn) { int phich_res; cell->bw_idx = bit_unpack(&msg, 3); @@ -291,7 +291,7 @@ void pbch_mib_unpack(uint8_t *msg, lte_cell_t *cell, uint32_t *sfn) { /** Unpacks MIB from PBCH message. * msg buffer must be 24 byte length at least */ -void pbch_mib_pack(lte_cell_t *cell, uint32_t sfn, uint8_t *msg) { +void pbch_mib_pack(srslte_cell_t *cell, uint32_t sfn, uint8_t *msg) { int bw, phich_res = 0; bzero(msg, 24); @@ -326,7 +326,7 @@ void pbch_mib_pack(lte_cell_t *cell, uint32_t sfn, uint8_t *msg) { bit_pack(sfn >> 2, &msg, 8); } -void pbch_mib_fprint(FILE *stream, lte_cell_t *cell, uint32_t sfn, uint32_t cell_id) { +void pbch_mib_fprint(FILE *stream, srslte_cell_t *cell, uint32_t sfn, uint32_t cell_id) { printf(" - Cell ID: %d\n", cell_id); printf(" - Nof ports: %d\n", cell->nof_ports); printf(" - PRB: %d\n", cell->nof_prb); @@ -431,7 +431,7 @@ int pbch_decode_frame(pbch_t *q, uint32_t src, uint32_t dst, uint32_t n, * * Returns 1 if successfully decoded MIB, 0 if not and -1 on error */ -int pbch_decode(pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[MAX_PORTS], float noise_estimate, +int pbch_decode(pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[SRSLTE_MAX_PORTS], float noise_estimate, uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset) { uint32_t src, dst, nb; @@ -455,10 +455,10 @@ int pbch_decode(pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[MAX_PORTS], float nof_bits = 2 * q->nof_symbols; /* number of layers equals number of ports */ - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { x[i] = q->pbch_x[i]; } - memset(&x[MAX_PORTS], 0, sizeof(cf_t*) * (MAX_LAYERS - MAX_PORTS)); + memset(&x[SRSLTE_MAX_PORTS], 0, sizeof(cf_t*) * (MAX_LAYERS - SRSLTE_MAX_PORTS)); /* extract symbols */ if (q->nof_symbols != pbch_get(slot1_symbols, q->pbch_symbols[0], q->cell)) { @@ -537,7 +537,7 @@ int pbch_decode(pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[MAX_PORTS], float /** Converts the MIB message to symbols mapped to SLOT #1 ready for transmission */ -int pbch_encode(pbch_t *q, uint8_t bch_payload[BCH_PAYLOAD_LEN], cf_t *slot1_symbols[MAX_PORTS]) { +int pbch_encode(pbch_t *q, uint8_t bch_payload[BCH_PAYLOAD_LEN], cf_t *slot1_symbols[SRSLTE_MAX_PORTS]) { int i; int nof_bits; cf_t *x[MAX_LAYERS]; diff --git a/srslte/lib/phch/src/pcfich.c b/srslte/lib/phch/src/pcfich.c index 7d0cbe84a..1eeb99976 100644 --- a/srslte/lib/phch/src/pcfich.c +++ b/srslte/lib/phch/src/pcfich.c @@ -61,7 +61,7 @@ bool pcfich_exists(int nframe, int nslot) { /** Initializes the pcfich channel receiver. * On error, returns -1 and frees the structrure */ -int pcfich_init(pcfich_t *q, regs_t *regs, lte_cell_t cell) { +int pcfich_init(pcfich_t *q, regs_t *regs, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && @@ -87,7 +87,7 @@ int pcfich_init(pcfich_t *q, regs_t *regs, lte_cell_t cell) { demod_soft_table_set(&q->demod, &q->mod); demod_soft_alg_set(&q->demod, APPROX); - for (int nsf = 0; nsf < NSUBFRAMES_X_FRAME; nsf++) { + for (int nsf = 0; nsf < SRSLTE_NSUBFRAMES_X_FRAME; nsf++) { if (sequence_pcfich(&q->seq_pcfich[nsf], 2 * nsf, q->cell.id)) { goto clean; } @@ -111,7 +111,7 @@ int pcfich_init(pcfich_t *q, regs_t *regs, lte_cell_t cell) { } void pcfich_free(pcfich_t *q) { - for (int ns = 0; ns < NSUBFRAMES_X_FRAME; ns++) { + for (int ns = 0; ns < SRSLTE_NSUBFRAMES_X_FRAME; ns++) { sequence_free(&q->seq_pcfich[ns]); } modem_table_free(&q->mod); @@ -158,25 +158,25 @@ int pcfich_cfi_encode(int cfi, uint8_t bits[PCFICH_CFI_LEN]) { * * Returns 1 if successfully decoded the CFI, 0 if not and -1 on error */ -int pcfich_decode(pcfich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], float noise_estimate, +int pcfich_decode(pcfich_t *q, cf_t *slot_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint32_t nsubframe, uint32_t *cfi, float *corr_result) { /* Set pointers for layermapping & precoding */ int i; cf_t *x[MAX_LAYERS]; - cf_t *ce_precoding[MAX_PORTS]; + cf_t *ce_precoding[SRSLTE_MAX_PORTS]; if (q != NULL && slot_symbols != NULL && - nsubframe < NSUBFRAMES_X_FRAME) + nsubframe < SRSLTE_NSUBFRAMES_X_FRAME) { /* number of layers equals number of ports */ - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { x[i] = q->pcfich_x[i]; } - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { ce_precoding[i] = q->ce[i]; } @@ -228,25 +228,25 @@ int pcfich_decode(pcfich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], float no /** Encodes CFI and maps symbols to the slot */ -int pcfich_encode(pcfich_t *q, uint32_t cfi, cf_t *slot_symbols[MAX_PORTS], +int pcfich_encode(pcfich_t *q, uint32_t cfi, cf_t *slot_symbols[SRSLTE_MAX_PORTS], uint32_t subframe) { int i; if (q != NULL && cfi < 3 && slot_symbols != NULL && - subframe < NSUBFRAMES_X_FRAME) + subframe < SRSLTE_NSUBFRAMES_X_FRAME) { /* Set pointers for layermapping & precoding */ cf_t *x[MAX_LAYERS]; - cf_t *symbols_precoding[MAX_PORTS]; + cf_t *symbols_precoding[SRSLTE_MAX_PORTS]; /* number of layers equals number of ports */ for (i = 0; i < q->cell.nof_ports; i++) { x[i] = q->pcfich_x[i]; } - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { symbols_precoding[i] = q->pcfich_symbols[i]; } diff --git a/srslte/lib/phch/src/pdcch.c b/srslte/lib/phch/src/pdcch.c index 10a1b9b98..93cbd6fcc 100644 --- a/srslte/lib/phch/src/pdcch.c +++ b/srslte/lib/phch/src/pdcch.c @@ -55,7 +55,7 @@ static void set_cfi(pdcch_t *q, uint32_t cfi) { /** Initializes the PDCCH transmitter and receiver */ -int pdcch_init(pdcch_t *q, regs_t *regs, lte_cell_t cell) { +int pdcch_init(pdcch_t *q, regs_t *regs, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; uint32_t i; @@ -89,7 +89,7 @@ int pdcch_init(pdcch_t *q, regs_t *regs, lte_cell_t cell) { demod_soft_table_set(&q->demod, &q->mod); demod_soft_alg_set(&q->demod, APPROX); - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { // we need to pregenerate the sequence for the maximum number of bits, which is 8 times // the maximum number of REGs (for CFI=3) if (sequence_pdcch(&q->seq_pdcch[i], 2 * i, q->cell.id, 8*regs_pdcch_nregs(q->regs, 3))) { @@ -119,7 +119,7 @@ int pdcch_init(pdcch_t *q, regs_t *regs, lte_cell_t cell) { goto clean; } - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { q->ce[i] = vec_malloc(sizeof(cf_t) * q->max_bits / 2); if (!q->ce[i]) { goto clean; @@ -155,7 +155,7 @@ void pdcch_free(pdcch_t *q) { if (q->pdcch_d) { free(q->pdcch_d); } - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { if (q->ce[i]) { free(q->ce[i]); } @@ -167,7 +167,7 @@ void pdcch_free(pdcch_t *q) { } } - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { sequence_free(&q->seq_pdcch[i]); } @@ -359,7 +359,7 @@ int pdcch_decode_msg(pdcch_t *q, dci_msg_t *msg, dci_location_t *location, dci_f * Every time this function is called (with a different location), the last demodulated symbols are overwritten and * new messages from other locations can be decoded */ -int pdcch_extract_llr(pdcch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], float noise_estimate, +int pdcch_extract_llr(pdcch_t *q, cf_t *sf_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint32_t nsubframe, uint32_t cfi) { int ret = SRSLTE_ERROR_INVALID_INPUTS; @@ -498,7 +498,7 @@ static int dci_encode(pdcch_t *q, uint8_t *data, uint8_t *e, uint32_t nof_bits, * @TODO: Use a bitmask and CFI to ensure message locations are valid and old messages are not overwritten. */ int pdcch_encode(pdcch_t *q, dci_msg_t *msg, dci_location_t location, uint16_t rnti, - cf_t *sf_symbols[MAX_PORTS], uint32_t nsubframe, uint32_t cfi) { + cf_t *sf_symbols[SRSLTE_MAX_PORTS], uint32_t nsubframe, uint32_t cfi) { int ret = SRSLTE_ERROR_INVALID_INPUTS; uint32_t i; diff --git a/srslte/lib/phch/src/pdsch.c b/srslte/lib/phch/src/pdsch.c index 8cc656513..1a2e11ae2 100644 --- a/srslte/lib/phch/src/pdsch.c +++ b/srslte/lib/phch/src/pdsch.c @@ -196,7 +196,7 @@ int pdsch_get(pdsch_t *q, cf_t *sf_symbols, cf_t *pdsch_symbols, } /** Initializes the PDCCH transmitter and receiver */ -int pdsch_init(pdsch_t *q, lte_cell_t cell) { +int pdsch_init(pdsch_t *q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; int i; @@ -287,7 +287,7 @@ void pdsch_free(pdsch_t *q) { } } - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { sequence_free(&q->seq_pdsch[i]); } @@ -308,7 +308,7 @@ void pdsch_free(pdsch_t *q) { */ int pdsch_set_rnti(pdsch_t *q, uint16_t rnti) { uint32_t i; - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { if (sequence_pdsch(&q->seq_pdsch[i], rnti, 0, 2 * i, q->cell.id, q->max_re * lte_mod_bits_x_symbol(LTE_QAM64))) { return SRSLTE_ERROR; @@ -319,7 +319,7 @@ int pdsch_set_rnti(pdsch_t *q, uint16_t rnti) { return SRSLTE_SUCCESS; } -int pdsch_decode(pdsch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], float noise_estimate, uint8_t *data) { +int pdsch_decode(pdsch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint8_t *data) { if (q != NULL && sf_symbols != NULL && data != NULL && @@ -338,7 +338,7 @@ int pdsch_decode(pdsch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce[MAX_PORTS] /** Decodes the PDSCH from the received symbols */ -int pdsch_decode_rnti(pdsch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], +int pdsch_decode_rnti(pdsch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint16_t rnti, uint8_t *data) { @@ -416,7 +416,7 @@ int pdsch_decode_rnti(pdsch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce[MAX_P } } -int pdsch_encode(pdsch_t *q, harq_t *harq, uint8_t *data, cf_t *sf_symbols[MAX_PORTS]) +int pdsch_encode(pdsch_t *q, harq_t *harq, uint8_t *data, cf_t *sf_symbols[SRSLTE_MAX_PORTS]) { if (q != NULL && data != NULL && @@ -435,7 +435,7 @@ int pdsch_encode(pdsch_t *q, harq_t *harq, uint8_t *data, cf_t *sf_symbols[MAX_P /** Converts the PDSCH data bits to symbols mapped to the slot ready for transmission */ -int pdsch_encode_rnti(pdsch_t *q, harq_t *harq, uint8_t *data, uint16_t rnti, cf_t *sf_symbols[MAX_PORTS]) +int pdsch_encode_rnti(pdsch_t *q, harq_t *harq, uint8_t *data, uint16_t rnti, cf_t *sf_symbols[SRSLTE_MAX_PORTS]) { int i; /* Set pointers for layermapping & precoding */ diff --git a/srslte/lib/phch/src/phich.c b/srslte/lib/phch/src/phich.c index c6de62ab1..1070be7b3 100644 --- a/srslte/lib/phch/src/phich.c +++ b/srslte/lib/phch/src/phich.c @@ -53,15 +53,15 @@ uint32_t phich_ngroups(phich_t *q) { return regs_phich_ngroups(q->regs); } -void phich_reset(phich_t *q, cf_t *slot_symbols[MAX_PORTS]) { +void phich_reset(phich_t *q, cf_t *slot_symbols[SRSLTE_MAX_PORTS]) { int i; - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { regs_phich_reset(q->regs, slot_symbols[i]); } } /** Initializes the phich channel receiver */ -int phich_init(phich_t *q, regs_t *regs, lte_cell_t cell) { +int phich_init(phich_t *q, regs_t *regs, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && @@ -86,7 +86,7 @@ int phich_init(phich_t *q, regs_t *regs, lte_cell_t cell) { demod_hard_init(&q->demod); demod_hard_table_set(&q->demod, LTE_BPSK); - for (int nsf = 0; nsf < NSUBFRAMES_X_FRAME; nsf++) { + for (int nsf = 0; nsf < SRSLTE_NSUBFRAMES_X_FRAME; nsf++) { if (sequence_phich(&q->seq_phich[nsf], 2 * nsf, q->cell.id)) { goto clean; } @@ -101,7 +101,7 @@ int phich_init(phich_t *q, regs_t *regs, lte_cell_t cell) { } void phich_free(phich_t *q) { - for (int ns = 0; ns < NSUBFRAMES_X_FRAME; ns++) { + for (int ns = 0; ns < SRSLTE_NSUBFRAMES_X_FRAME; ns++) { sequence_free(&q->seq_phich[ns]); } modem_table_free(&q->mod); @@ -146,19 +146,19 @@ void phich_ack_encode(uint8_t ack, uint8_t bits[PHICH_NBITS]) { * * Returns 1 if successfully decoded the CFI, 0 if not and -1 on error */ -int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], float noise_estimate, +int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, uint32_t ngroup, uint32_t nseq, uint32_t subframe, uint8_t *ack, uint32_t *distance) { /* Set pointers for layermapping & precoding */ int i, j; cf_t *x[MAX_LAYERS]; - cf_t *ce_precoding[MAX_PORTS]; + cf_t *ce_precoding[SRSLTE_MAX_PORTS]; if (q == NULL || slot_symbols == NULL) { return SRSLTE_ERROR_INVALID_INPUTS; } - if (subframe >= NSUBFRAMES_X_FRAME) { + if (subframe >= SRSLTE_NSUBFRAMES_X_FRAME) { fprintf(stderr, "Invalid nslot %d\n", subframe); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -182,10 +182,10 @@ int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], float nois DEBUG("Decoding PHICH Ngroup: %d, Nseq: %d\n", ngroup, nseq); /* number of layers equals number of ports */ - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { x[i] = q->phich_x[i]; } - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { ce_precoding[i] = q->ce[i]; } @@ -278,14 +278,14 @@ int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], float nois * The parameter ack is an array of phich_ngroups() pointers to buffers of nof_sequences uint8_ts */ int phich_encode(phich_t *q, uint8_t ack, uint32_t ngroup, uint32_t nseq, uint32_t subframe, - cf_t *slot_symbols[MAX_PORTS]) { + cf_t *slot_symbols[SRSLTE_MAX_PORTS]) { int i; if (q == NULL || slot_symbols == NULL) { return SRSLTE_ERROR_INVALID_INPUTS; } - if (subframe >= NSUBFRAMES_X_FRAME) { + if (subframe >= SRSLTE_NSUBFRAMES_X_FRAME) { fprintf(stderr, "Invalid nslot %d\n", subframe); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -309,13 +309,13 @@ int phich_encode(phich_t *q, uint8_t ack, uint32_t ngroup, uint32_t nseq, uint32 /* Set pointers for layermapping & precoding */ cf_t *x[MAX_LAYERS]; - cf_t *symbols_precoding[MAX_PORTS]; + cf_t *symbols_precoding[SRSLTE_MAX_PORTS]; /* number of layers equals number of ports */ for (i = 0; i < q->cell.nof_ports; i++) { x[i] = q->phich_x[i]; } - for (i = 0; i < MAX_PORTS; i++) { + for (i = 0; i < SRSLTE_MAX_PORTS; i++) { symbols_precoding[i] = q->phich_symbols[i]; } diff --git a/srslte/lib/phch/src/prach.c b/srslte/lib/phch/src/prach.c index 4526a8d8b..f5b72882f 100644 --- a/srslte/lib/phch/src/prach.c +++ b/srslte/lib/phch/src/prach.c @@ -312,14 +312,14 @@ int prach_init(prach_t *p, p->corr = vec_malloc(sizeof(float)*p->N_zc); // Set up ZC FFTS - p->zc_fft = (dft_plan_t*)vec_malloc(sizeof(dft_plan_t)); + p->zc_fft = (srslte_dft_plan_t*)vec_malloc(sizeof(srslte_dft_plan_t)); if(dft_plan(p->zc_fft, p->N_zc, FORWARD, COMPLEX)){ return SRSLTE_ERROR; } dft_plan_set_mirror(p->zc_fft, false); dft_plan_set_norm(p->zc_fft, false); - p->zc_ifft = (dft_plan_t*)vec_malloc(sizeof(dft_plan_t)); + p->zc_ifft = (srslte_dft_plan_t*)vec_malloc(sizeof(srslte_dft_plan_t)); if(dft_plan(p->zc_ifft, p->N_zc, BACKWARD, COMPLEX)){ return SRSLTE_ERROR; } @@ -345,14 +345,14 @@ int prach_init(prach_t *p, p->ifft_in = (cf_t*)vec_malloc(p->N_ifft_prach*sizeof(cf_t)); p->ifft_out = (cf_t*)vec_malloc(p->N_ifft_prach*sizeof(cf_t)); - p->ifft = (dft_plan_t*)vec_malloc(sizeof(dft_plan_t)); + p->ifft = (srslte_dft_plan_t*)vec_malloc(sizeof(srslte_dft_plan_t)); if(dft_plan(p->ifft, p->N_ifft_prach, BACKWARD, COMPLEX)){ return -1; } dft_plan_set_mirror(p->ifft, true); dft_plan_set_norm(p->ifft, true); - p->fft = (dft_plan_t*)vec_malloc(sizeof(dft_plan_t)); + p->fft = (srslte_dft_plan_t*)vec_malloc(sizeof(srslte_dft_plan_t)); if(dft_plan(p->fft, p->N_ifft_prach, FORWARD, COMPLEX)){ return -1; } diff --git a/srslte/lib/phch/src/pucch.c b/srslte/lib/phch/src/pucch.c index f20263dad..6ff8a133b 100644 --- a/srslte/lib/phch/src/pucch.c +++ b/srslte/lib/phch/src/pucch.c @@ -50,14 +50,14 @@ bool pucch_cfg_isvalid(pucch_cfg_t *cfg) { /* Generates n_cs_cell according to Sec 5.4 of 36.211 */ -int generate_n_cs_cell(lte_cell_t cell, uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB]) +int generate_n_cs_cell(srslte_cell_t cell, uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB]) { sequence_t seq; bzero(&seq, sizeof(sequence_t)); - sequence_LTE_pr(&seq, 8*CP_NSYMB(cell.cp)*NSLOTS_X_FRAME, cell.id); + sequence_LTE_pr(&seq, 8*CP_NSYMB(cell.cp)*SRSLTE_NSLOTS_X_FRAME, cell.id); - for (uint32_t ns=0;nsequalizer); - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { sequence_free(&q->seq_pusch[i]); } @@ -291,7 +291,7 @@ void pusch_set_hopping_cfg(pusch_t *q, pusch_hopping_cfg_t *cfg) int pusch_set_rnti(pusch_t *q, uint16_t rnti) { uint32_t i; - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { if (sequence_pusch(&q->seq_pusch[i], rnti, 2 * i, q->cell.id, q->max_re * lte_mod_bits_x_symbol(LTE_QAM64))) { return SRSLTE_ERROR; diff --git a/srslte/lib/phch/src/ra.c b/srslte/lib/phch/src/ra.c index 4aa35c01c..ce668e6b6 100644 --- a/srslte/lib/phch/src/ra.c +++ b/srslte/lib/phch/src/ra.c @@ -42,7 +42,7 @@ /* Returns the number of RE in a PRB in a slot and subframe */ uint32_t ra_re_x_prb(uint32_t subframe, uint32_t slot, uint32_t prb_idx, uint32_t nof_prb, - uint32_t nof_ports, uint32_t nof_ctrl_symbols, lte_cp_t cp) { + uint32_t nof_ports, uint32_t nof_ctrl_symbols, srslte_cp_t cp) { uint32_t re; bool skip_refs = false; @@ -185,13 +185,13 @@ int ra_ul_alloc(ra_ul_alloc_t *prb_dist, ra_pusch_t *ra, uint32_t n_rb_ho, uint3 /* Computes the number of RE for each PRB in the prb_dist structure */ void ra_dl_alloc_re(ra_dl_alloc_t *prb_dist, uint32_t nof_prb, uint32_t nof_ports, - uint32_t nof_ctrl_symbols, lte_cp_t cp) { + uint32_t nof_ctrl_symbols, srslte_cp_t cp) { uint32_t i, j, s; /* Set start symbol according to Section 7.1.6.4 in 36.213 */ prb_dist->lstart = nof_ctrl_symbols; // Compute number of RE per subframe - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { prb_dist->re_sf[i] = 0; for (s = 0; s < 2; s++) { for (j = 0; j < nof_prb; j++) { diff --git a/srslte/lib/phch/src/regs.c b/srslte/lib/phch/src/regs.c index a0c2cd68e..52e72be1f 100644 --- a/srslte/lib/phch/src/regs.c +++ b/srslte/lib/phch/src/regs.c @@ -566,7 +566,7 @@ regs_reg_t *regs_find_reg(regs_t *h, uint32_t k, uint32_t l) { * Returns the number of REGs in a PRB * 36.211 Section 6.2.4 */ -int regs_num_x_symbol(uint32_t symbol, uint32_t nof_port, lte_cp_t cp) { +int regs_num_x_symbol(uint32_t symbol, uint32_t nof_port, srslte_cp_t cp) { switch (symbol) { case 0: @@ -680,7 +680,7 @@ int regs_set_cfi(regs_t *h, uint32_t cfi) { * Sets all REG indices and initializes PCFICH, PHICH and PDCCH REGs * Returns 0 if OK, -1 on error */ -int regs_init(regs_t *h, lte_cell_t cell) { +int regs_init(regs_t *h, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; uint32_t i, k; uint32_t j[4], jmax, prb; diff --git a/srslte/lib/phch/src/sequences.c b/srslte/lib/phch/src/sequences.c index 551ac335d..f1ad72986 100644 --- a/srslte/lib/phch/src/sequences.c +++ b/srslte/lib/phch/src/sequences.c @@ -33,7 +33,7 @@ /** * 36.211 6.6.1 */ -int sequence_pbch(sequence_t *seq, lte_cp_t cp, uint32_t cell_id) { +int sequence_pbch(sequence_t *seq, srslte_cp_t cp, uint32_t cell_id) { bzero(seq, sizeof(sequence_t)); return sequence_LTE_pr(seq, CP_ISNORM(cp)?1920:1728, cell_id); } diff --git a/srslte/lib/phch/src/uci.c b/srslte/lib/phch/src/uci.c index 5f0950a67..cc8047a11 100644 --- a/srslte/lib/phch/src/uci.c +++ b/srslte/lib/phch/src/uci.c @@ -239,7 +239,7 @@ int uci_encode_cqi_pusch(uci_cqi_pusch_t *q, uint8_t *cqi_data, uint32_t cqi_len /* Inserts UCI-ACK bits into the correct positions in the g buffer before interleaving */ static int uci_ulsch_interleave_ack(uint8_t ack_coded_bits[6], uint32_t ack_q_bit_idx, - uint32_t Q_m, uint32_t H_prime_total, uint32_t N_pusch_symbs, lte_cp_t cp, + uint32_t Q_m, uint32_t H_prime_total, uint32_t N_pusch_symbs, srslte_cp_t cp, uint8_t *q_bits) { const uint32_t ack_column_set_norm[4] = {2, 3, 8, 9}; @@ -263,7 +263,7 @@ static int uci_ulsch_interleave_ack(uint8_t ack_coded_bits[6], uint32_t ack_q_bi /* Inserts UCI-RI bits into the correct positions in the g buffer before interleaving */ static int uci_ulsch_interleave_ri(uint8_t ri_coded_bits[6], uint32_t ri_q_bit_idx, - uint32_t Q_m, uint32_t H_prime_total, uint32_t N_pusch_symbs, lte_cp_t cp, + uint32_t Q_m, uint32_t H_prime_total, uint32_t N_pusch_symbs, srslte_cp_t cp, uint8_t *q_bits) { static uint32_t ri_column_set_norm[4] = {1, 4, 7, 10}; diff --git a/srslte/lib/phch/test/dlsch_encode_test_mex.c b/srslte/lib/phch/test/dlsch_encode_test_mex.c index 450d1bba5..04dea351f 100644 --- a/srslte/lib/phch/test/dlsch_encode_test_mex.c +++ b/srslte/lib/phch/test/dlsch_encode_test_mex.c @@ -60,7 +60,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) mexErrMsgTxt("Error initiating DL-SCH\n"); return; } - lte_cell_t cell; + srslte_cell_t cell; cell.nof_prb = 100; cell.id=1; if (harq_init(&harq_process, cell)) { diff --git a/srslte/lib/phch/test/pbch_file_test.c b/srslte/lib/phch/test/pbch_file_test.c index d671c210d..48aacd0a7 100644 --- a/srslte/lib/phch/test/pbch_file_test.c +++ b/srslte/lib/phch/test/pbch_file_test.c @@ -35,7 +35,7 @@ char *input_file_name = NULL; -lte_cell_t cell = { +srslte_cell_t cell = { 6, // nof_prb 2, // nof_ports 150, // cell_id @@ -51,10 +51,10 @@ uint8_t bch_payload_file[BCH_PAYLOAD_LEN] = {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, #define FLEN (10*SF_LEN(lte_symbol_sz(cell.nof_prb))) filesource_t fsrc; -cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS]; +cf_t *input_buffer, *fft_buffer, *ce[SRSLTE_MAX_PORTS]; pbch_t pbch; -lte_fft_t fft; -chest_dl_t chest; +srslte_fft_t fft; +srslte_chest_dl_t chest; void usage(char *prog) { printf("Usage: %s [vcoe] -i input_file\n", prog); @@ -132,12 +132,12 @@ int base_init() { return -1; } - if (chest_dl_init(&chest, cell)) { + if (srslte_chest_dl_init(&chest, cell)) { fprintf(stderr, "Error initializing equalizer\n"); return -1; } - if (lte_fft_init(&fft, cell.cp, cell.nof_prb)) { + if (srslte_fft_init(&fft, cell.cp, cell.nof_prb)) { fprintf(stderr, "Error initializing FFT\n"); return -1; } @@ -163,8 +163,8 @@ void base_free() { for (i=0;i 0) { // process 1st subframe only - lte_fft_run_sf(&fft, input_buffer, fft_buffer); + srslte_fft_run_sf(&fft, input_buffer, fft_buffer); /* Get channel estimates for each port */ - chest_dl_estimate(&chest, fft_buffer, ce, 0); + srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0); INFO("Decoding PBCH\n", 0); - for (int i=0;i NOF_INPUTS) { cf_t *cearray; @@ -103,16 +103,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) } } } else { - chest_dl_estimate(&chest, input_fft, ce, 0); + srslte_chest_dl_estimate(&chest, input_fft, ce, 0); } float noise_power; if (nrhs > NOF_INPUTS + 1) { noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); } else { - noise_power = chest_dl_get_noise_estimate(&chest); + noise_power = srslte_chest_dl_get_noise_estimate(&chest); } - for (int i=0;i NOF_INPUTS) { cf_t *cearray; @@ -114,13 +114,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) } } } else { - chest_dl_estimate(&chest, input_fft, ce, sf_idx); + srslte_chest_dl_estimate(&chest, input_fft, ce, sf_idx); } float noise_power; if (nrhs > NOF_INPUTS + 1) { noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); } else { - noise_power = chest_dl_get_noise_estimate(&chest); + noise_power = srslte_chest_dl_get_noise_estimate(&chest); } @@ -142,8 +142,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) mexutils_write_cf(pcfich.pcfich_symbols[0], &plhs[2], 16, 1); } - chest_dl_free(&chest); - lte_fft_free(&fft); + srslte_chest_dl_free(&chest); + srslte_fft_free(&fft); pcfich_free(&pcfich); regs_free(®s); diff --git a/srslte/lib/phch/test/pdcch_file_test.c b/srslte/lib/phch/test/pdcch_file_test.c index 746c8c47f..35cbdb7df 100644 --- a/srslte/lib/phch/test/pdcch_file_test.c +++ b/srslte/lib/phch/test/pdcch_file_test.c @@ -37,7 +37,7 @@ char *input_file_name = NULL; #define MAX_CANDIDATES 64 -lte_cell_t cell = { +srslte_cell_t cell = { 6, // cell.cell.cell.nof_prb 1, // cell.cell.nof_ports 0, // cell.id @@ -54,10 +54,10 @@ int max_frames = 10; dci_format_t dci_format = Format1A; filesource_t fsrc; pdcch_t pdcch; -cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS]; +cf_t *input_buffer, *fft_buffer, *ce[SRSLTE_MAX_PORTS]; regs_t regs; -lte_fft_t fft; -chest_dl_t chest; +srslte_fft_t fft; +srslte_chest_dl_t chest; void usage(char *prog) { printf("Usage: %s [vcfoe] -i input_file\n", prog); @@ -143,7 +143,7 @@ int base_init() { return -1; } - for (i=0;i NOF_INPUTS) { cf_t *cearray; @@ -141,13 +141,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) } } } else { - chest_dl_estimate(&chest, input_fft, ce, sf_idx); + srslte_chest_dl_estimate(&chest, input_fft, ce, sf_idx); } float noise_power; if (nrhs > NOF_INPUTS + 1) { noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); } else { - noise_power = chest_dl_get_noise_estimate(&chest); + noise_power = srslte_chest_dl_get_noise_estimate(&chest); } pdcch_extract_llr(&pdcch, input_fft, ce, noise_power, sf_idx, cfi); @@ -186,8 +186,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) mexutils_write_cf(pdcch.pdcch_symbols[0], &plhs[2], 36*pdcch.nof_cce, 1); } - chest_dl_free(&chest); - lte_fft_free(&fft); + srslte_chest_dl_free(&chest); + srslte_fft_free(&fft); pdcch_free(&pdcch); regs_free(®s); diff --git a/srslte/lib/phch/test/pdsch_file_test.c b/srslte/lib/phch/test/pdsch_file_test.c index f2eba99da..6c09a2178 100644 --- a/srslte/lib/phch/test/pdsch_file_test.c +++ b/srslte/lib/phch/test/pdsch_file_test.c @@ -37,7 +37,7 @@ char *input_file_name = NULL; -lte_cell_t cell = { +srslte_cell_t cell = { 6, // nof_prb 1, // nof_ports 0, // cell_id @@ -59,10 +59,10 @@ filesource_t fsrc; pdcch_t pdcch; pdsch_t pdsch; harq_t harq_process; -cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS]; +cf_t *input_buffer, *fft_buffer, *ce[SRSLTE_MAX_PORTS]; regs_t regs; -lte_fft_t fft; -chest_dl_t chest; +srslte_fft_t fft; +srslte_chest_dl_t chest; void usage(char *prog) { printf("Usage: %s [rovfcenmps] -i input_file\n", prog); @@ -152,7 +152,7 @@ int base_init() { return -1; } - for (i=0;i NOF_INPUTS) { cf_t *cearray = NULL; @@ -195,13 +195,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) if (cearray_ptr) free(cearray_ptr); } else { - chest_dl_estimate(&chest, input_fft, ce, sf_idx); + srslte_chest_dl_estimate(&chest, input_fft, ce, sf_idx); } float noise_power; if (nrhs > NOF_INPUTS + 1) { noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); } else { - noise_power = chest_dl_get_noise_estimate(&chest); + noise_power = srslte_chest_dl_get_noise_estimate(&chest); } uint8_t *data = malloc(sizeof(uint8_t) * mcs.tbs); @@ -228,8 +228,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) mexutils_write_f(pdsch.pdsch_e, &plhs[4], harq_process.dl_alloc.re_sf[sf_idx] * lte_mod_bits_x_symbol(mcs.mod), 1); } - chest_dl_free(&chest); - lte_fft_free(&fft); + srslte_chest_dl_free(&chest); + srslte_fft_free(&fft); pdsch_free(&pdsch); for (i=0;idiff_vec = vec_malloc(vector_len * sizeof(cf_t)); if (!q->diff_vec) { @@ -114,16 +114,16 @@ int interp_linear_vector_init(interp_linvec_t *q, uint32_t vector_len) return ret; } -void interp_linear_vector_free(interp_linvec_t *q) { +void srslte_interp_linear_vector_free(srslte_interp_linvec_t *q) { if (q->diff_vec) { free(q->diff_vec); } - bzero(q, sizeof(interp_linvec_t)); + bzero(q, sizeof(srslte_interp_linvec_t)); } -void interp_linear_vector(interp_linvec_t *q, cf_t *in0, cf_t *in1, cf_t *between, uint32_t M) +void srslte_interp_linear_vector(srslte_interp_linvec_t *q, cf_t *in0, cf_t *in1, cf_t *between, uint32_t M) { uint32_t i; @@ -136,11 +136,11 @@ void interp_linear_vector(interp_linvec_t *q, cf_t *in0, cf_t *in1, cf_t *betwee } } -int interp_linear_init(interp_lin_t *q, uint32_t vector_len, uint32_t M) +int srslte_interp_linear_init(srslte_interp_lin_t *q, uint32_t vector_len, uint32_t M) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q) { - bzero(q, sizeof(interp_lin_t)); + bzero(q, sizeof(srslte_interp_lin_t)); ret = SRSLTE_SUCCESS; q->diff_vec = vec_malloc(vector_len * sizeof(cf_t)); if (!q->diff_vec) { @@ -171,7 +171,7 @@ int interp_linear_init(interp_lin_t *q, uint32_t vector_len, uint32_t M) return ret; } -void interp_linear_free(interp_lin_t *q) { +void srslte_interp_linear_free(srslte_interp_lin_t *q) { if (q->diff_vec) { free(q->diff_vec); } @@ -182,11 +182,11 @@ void interp_linear_free(interp_lin_t *q) { free(q->ramp); } - bzero(q, sizeof(interp_lin_t)); + bzero(q, sizeof(srslte_interp_lin_t)); } -void interp_linear_offset(interp_lin_t *q, cf_t *input, cf_t *output, +void srslte_interp_linear_offset(srslte_interp_lin_t *q, cf_t *input, cf_t *output, uint32_t off_st, uint32_t off_end) { uint32_t i, j; diff --git a/srslte/lib/scrambling/src/scrambling.c b/srslte/lib/scrambling/src/scrambling.c index 51895d10a..d8e3f4b5f 100644 --- a/srslte/lib/scrambling/src/scrambling.c +++ b/srslte/lib/scrambling/src/scrambling.c @@ -97,20 +97,20 @@ int compute_sequences(scrambling_hl* h) { switch (h->init.channel) { case SCRAMBLING_PBCH: return sequence_pbch(&h->obj.seq[0], - h->init.nof_symbols == CPNORM_NSYMB ? CPNORM : CPEXT, h->init.cell_id); + h->init.nof_symbols == SRSLTE_CPNORM_NSYMB ? CPNORM : CPEXT, h->init.cell_id); case SCRAMBLING_PDSCH: - for (int ns = 0; ns < NSUBFRAMES_X_FRAME; ns++) { + for (int ns = 0; ns < SRSLTE_NSUBFRAMES_X_FRAME; ns++) { sequence_pdsch(&h->obj.seq[ns], h->init.nrnti, 0, 2 * ns, h->init.cell_id, LTE_NSOFT_BITS); } return 0; case SCRAMBLING_PCFICH: - for (int ns = 0; ns < NSUBFRAMES_X_FRAME; ns++) { + for (int ns = 0; ns < SRSLTE_NSUBFRAMES_X_FRAME; ns++) { sequence_pcfich(&h->obj.seq[ns], 2 * ns, h->init.cell_id); } return 0; case SCRAMBLING_PDCCH: - for (int ns = 0; ns < NSUBFRAMES_X_FRAME; ns++) { + for (int ns = 0; ns < SRSLTE_NSUBFRAMES_X_FRAME; ns++) { sequence_pdcch(&h->obj.seq[ns], 2 * ns, h->init.cell_id, LTE_NSOFT_BITS); } return 0; @@ -154,7 +154,7 @@ int scrambling_work(scrambling_hl* hl) { int scrambling_stop(scrambling_hl* hl) { int i; - for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { + for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { sequence_free(&hl->obj.seq[i]); } return 0; diff --git a/srslte/lib/scrambling/test/scrambling_test.c b/srslte/lib/scrambling/test/scrambling_test.c index 2f169d3b7..1f2fa15eb 100644 --- a/srslte/lib/scrambling/test/scrambling_test.c +++ b/srslte/lib/scrambling/test/scrambling_test.c @@ -38,7 +38,7 @@ char *sequence_name = NULL; bool do_floats = false; -lte_cp_t cp = CPNORM; +srslte_cp_t cp = CPNORM; int cell_id = -1; void usage(char *prog) { diff --git a/srslte/lib/sync/src/pss.c b/srslte/lib/sync/src/pss.c index bea4ace5f..18b5f8688 100644 --- a/srslte/lib/sync/src/pss.c +++ b/srslte/lib/sync/src/pss.c @@ -40,7 +40,7 @@ int pss_synch_init_N_id_2(cf_t *pss_signal_time, cf_t *pss_signal_freq, uint32_t N_id_2, uint32_t fft_size) { - dft_plan_t plan; + srslte_dft_plan_t plan; cf_t pss_signal_pad[2048]; int ret = SRSLTE_ERROR_INVALID_INPUTS; @@ -241,7 +241,7 @@ int pss_generate(cf_t *signal, uint32_t N_id_2) { /** 36.211 10.3 section 6.11.1.2 */ -void pss_put_slot(cf_t *pss_signal, cf_t *slot, uint32_t nof_prb, lte_cp_t cp) { +void pss_put_slot(cf_t *pss_signal, cf_t *slot, uint32_t nof_prb, srslte_cp_t cp) { int k; k = (CP_NSYMB(cp) - 1) * nof_prb * RE_X_RB + nof_prb * RE_X_RB / 2 - 31; memset(&slot[k - 5], 0, 5 * sizeof(cf_t)); diff --git a/srslte/lib/sync/src/sss.c b/srslte/lib/sync/src/sss.c index c5e43b570..53663e508 100644 --- a/srslte/lib/sync/src/sss.c +++ b/srslte/lib/sync/src/sss.c @@ -109,7 +109,7 @@ int sss_synch_set_N_id_2(sss_synch_t *q, uint32_t N_id_2) { /** 36.211 10.3 section 6.11.2.2 */ -void sss_put_slot(float *sss, cf_t *slot, uint32_t nof_prb, lte_cp_t cp) { +void sss_put_slot(float *sss, cf_t *slot, uint32_t nof_prb, srslte_cp_t cp) { uint32_t i, k; k = (CP_NSYMB(cp) - 2) * nof_prb * RE_X_RB + nof_prb * RE_X_RB / 2 - 31; diff --git a/srslte/lib/sync/src/sync.c b/srslte/lib/sync/src/sync.c index 39ef82fbd..fd8016d75 100644 --- a/srslte/lib/sync/src/sync.c +++ b/srslte/lib/sync/src/sync.c @@ -168,10 +168,10 @@ void sync_set_em_alpha(sync_t *q, float alpha) { pss_synch_set_ema_alpha(&q->pss, alpha); } -lte_cp_t sync_get_cp(sync_t *q) { +srslte_cp_t sync_get_cp(sync_t *q) { return q->cp; } -void sync_set_cp(sync_t *q, lte_cp_t cp) { +void sync_set_cp(sync_t *q, srslte_cp_t cp) { q->cp = cp; } @@ -183,7 +183,7 @@ void sync_set_sss_algorithm(sync_t *q, sss_alg_t alg) { * "SSS Detection Method for Initial Cell Search in 3GPP LTE FDD/TDD Dual Mode Receiver" * by Jung-In Kim et al. */ -lte_cp_t sync_detect_cp(sync_t *q, cf_t *input, uint32_t peak_pos) +srslte_cp_t sync_detect_cp(sync_t *q, cf_t *input, uint32_t peak_pos) { float R_norm, R_ext, C_norm, C_ext; float M_norm=0, M_ext=0; @@ -230,7 +230,7 @@ lte_cp_t sync_detect_cp(sync_t *q, cf_t *input, uint32_t peak_pos) /* Returns 1 if the SSS is found, 0 if not and -1 if there is not enough space * to correlate */ -int sync_sss(sync_t *q, cf_t *input, uint32_t peak_pos, lte_cp_t cp) { +int sync_sss(sync_t *q, cf_t *input, uint32_t peak_pos, srslte_cp_t cp) { int sss_idx, ret; sss_synch_set_N_id_2(&q->sss, q->N_id_2); diff --git a/srslte/lib/sync/test/pss_mex.c b/srslte/lib/sync/test/pss_mex.c index fb8aa2077..8424dcaf4 100644 --- a/srslte/lib/sync/test/pss_mex.c +++ b/srslte/lib/sync/test/pss_mex.c @@ -47,7 +47,7 @@ void help() void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { - lte_cell_t cell; + srslte_cell_t cell; pss_synch_t pss; cf_t *input_symbols; int frame_len; diff --git a/srslte/lib/sync/test/pss_usrp.c b/srslte/lib/sync/test/pss_usrp.c index e1f750114..fb5b8bbb6 100644 --- a/srslte/lib/sync/test/pss_usrp.c +++ b/srslte/lib/sync/test/pss_usrp.c @@ -54,7 +54,7 @@ int nof_frames = -1; uint32_t fft_size=64; float threshold = 0.4; int N_id_2_sync = -1; -lte_cp_t cp=CPNORM; +srslte_cp_t cp=CPNORM; void usage(char *prog) { printf("Usage: %s [aedgtvnp] -f rx_frequency_hz -i cell_id\n", prog); @@ -262,7 +262,7 @@ int main(int argc, char **argv) { // Estimate CP if (peak_idx > 2*(fft_size + CP_EXT(fft_size))) { - lte_cp_t cp = sync_detect_cp(&ssync, buffer, peak_idx); + srslte_cp_t cp = sync_detect_cp(&ssync, buffer, peak_idx); if (CP_ISNORM(cp)) { cp_is_norm++; } diff --git a/srslte/lib/sync/test/sss_mex.c b/srslte/lib/sync/test/sss_mex.c index 6d480d7ec..480c65657 100644 --- a/srslte/lib/sync/test/sss_mex.c +++ b/srslte/lib/sync/test/sss_mex.c @@ -50,7 +50,7 @@ void help() void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { - lte_cell_t cell; + srslte_cell_t cell; sss_synch_t sss; cf_t *input_symbols; int frame_len; diff --git a/srslte/lib/sync/test/sync_test.c b/srslte/lib/sync/test/sync_test.c index e2d5c7577..59081d78a 100644 --- a/srslte/lib/sync/test/sync_test.c +++ b/srslte/lib/sync/test/sync_test.c @@ -38,7 +38,7 @@ #include "srslte/srslte.h" int cell_id = -1, offset = 0; -lte_cp_t cp = CPNORM; +srslte_cp_t cp = CPNORM; uint32_t nof_prb=6; #define FLEN SF_LEN(fft_size) @@ -87,7 +87,7 @@ int main(int argc, char **argv) { int cid, max_cid; uint32_t find_idx; sync_t sync; - lte_fft_t ifft; + srslte_fft_t ifft; int fft_size; parse_args(argc, argv); diff --git a/srslte/lib/ue/src/ue_cell_search.c b/srslte/lib/ue/src/ue_cell_search.c index d7f92bb46..9abd08373 100644 --- a/srslte/lib/ue/src/ue_cell_search.c +++ b/srslte/lib/ue/src/ue_cell_search.c @@ -51,11 +51,11 @@ int ue_cell_search_init_max(ue_cell_search_t * q, uint32_t max_frames, if (q != NULL) { ret = SRSLTE_ERROR; - lte_cell_t cell; + srslte_cell_t cell; bzero(q, sizeof(ue_cell_search_t)); - bzero(&cell, sizeof(lte_cell_t)); + bzero(&cell, sizeof(srslte_cell_t)); cell.id = CELL_ID_UNKNOWN; cell.nof_prb = CS_NOF_PRB; diff --git a/srslte/lib/ue/src/ue_dl.c b/srslte/lib/ue/src/ue_dl.c index 6c98e3ba9..34ec0ea12 100644 --- a/srslte/lib/ue/src/ue_dl.c +++ b/srslte/lib/ue/src/ue_dl.c @@ -39,7 +39,7 @@ #define MAX_CANDIDATES 64 int ue_dl_init(ue_dl_t *q, - lte_cell_t cell) + srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; @@ -54,11 +54,11 @@ int ue_dl_init(ue_dl_t *q, q->pkt_errors = 0; q->pkts_total = 0; - if (lte_fft_init(&q->fft, q->cell.cp, q->cell.nof_prb)) { + if (srslte_fft_init(&q->fft, q->cell.cp, q->cell.nof_prb)) { fprintf(stderr, "Error initiating FFT\n"); goto clean_exit; } - if (chest_dl_init(&q->chest, cell)) { + if (srslte_chest_dl_init(&q->chest, cell)) { fprintf(stderr, "Error initiating channel estimator\n"); goto clean_exit; } @@ -114,8 +114,8 @@ clean_exit: void ue_dl_free(ue_dl_t *q) { if (q) { - lte_fft_free(&q->fft); - chest_dl_free(&q->chest); + srslte_fft_free(&q->fft); + srslte_chest_dl_free(&q->chest); regs_free(&q->regs); pcfich_free(&q->pcfich); pdcch_free(&q->pdcch); @@ -173,17 +173,17 @@ int ue_dl_decode_rnti(ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, u int ue_dl_decode_fft_estimate(ue_dl_t *q, cf_t *input, uint32_t sf_idx, uint32_t *cfi) { float cfi_corr; - if (input && q && cfi && sf_idx < NSUBFRAMES_X_FRAME) { + if (input && q && cfi && sf_idx < SRSLTE_NSUBFRAMES_X_FRAME) { /* Run FFT for all subframe data */ - lte_fft_run_sf(&q->fft, input, q->sf_symbols); + srslte_fft_run_sf(&q->fft, input, q->sf_symbols); /* Get channel estimates for each port */ - chest_dl_estimate(&q->chest, q->sf_symbols, q->ce, sf_idx); + srslte_chest_dl_estimate(&q->chest, q->sf_symbols, q->ce, sf_idx); /* First decode PCFICH and obtain CFI */ if (pcfich_decode(&q->pcfich, q->sf_symbols, q->ce, - chest_dl_get_noise_estimate(&q->chest), sf_idx, cfi, &cfi_corr)<0) { + srslte_chest_dl_get_noise_estimate(&q->chest), sf_idx, cfi, &cfi_corr)<0) { fprintf(stderr, "Error decoding PCFICH\n"); return SRSLTE_ERROR; } @@ -196,7 +196,7 @@ int ue_dl_decode_fft_estimate(ue_dl_t *q, cf_t *input, uint32_t sf_idx, uint32_t } /* Extract all PDCCH symbols and get LLRs */ - if (pdcch_extract_llr(&q->pdcch, q->sf_symbols, q->ce, chest_dl_get_noise_estimate(&q->chest), sf_idx, *cfi)) { + if (pdcch_extract_llr(&q->pdcch, q->sf_symbols, q->ce, srslte_chest_dl_get_noise_estimate(&q->chest), sf_idx, *cfi)) { fprintf(stderr, "Error extracting LLRs\n"); return SRSLTE_ERROR; } @@ -228,7 +228,7 @@ int ue_dl_decode_rnti_rv_packet(ue_dl_t *q, dci_msg_t *dci_msg, uint8_t *data, } if (q->harq_process[0].mcs.mod > 0 && q->harq_process[0].mcs.tbs >= 0) { ret = pdsch_decode_rnti(&q->pdsch, &q->harq_process[0], q->sf_symbols, - q->ce, chest_dl_get_noise_estimate(&q->chest), + q->ce, srslte_chest_dl_get_noise_estimate(&q->chest), rnti, data); if (ret == SRSLTE_ERROR) { q->pkt_errors++; diff --git a/srslte/lib/ue/src/ue_mib.c b/srslte/lib/ue/src/ue_mib.c index 0f10f3222..925caa100 100644 --- a/srslte/lib/ue/src/ue_mib.c +++ b/srslte/lib/ue/src/ue_mib.c @@ -37,12 +37,12 @@ #include "srslte/utils/vector.h" int ue_mib_init(ue_mib_t * q, - lte_cell_t cell) + srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && - cell.nof_ports <= MIB_MAX_PORTS) + cell.nof_ports <= MIB_SRSLTE_MAX_PORTS) { ret = SRSLTE_ERROR; @@ -62,11 +62,11 @@ int ue_mib_init(ue_mib_t * q, } } - if (lte_fft_init(&q->fft, cell.cp, cell.nof_prb)) { + if (srslte_fft_init(&q->fft, cell.cp, cell.nof_prb)) { fprintf(stderr, "Error initializing FFT\n"); goto clean_exit; } - if (chest_dl_init(&q->chest, cell)) { + if (srslte_chest_dl_init(&q->chest, cell)) { fprintf(stderr, "Error initializing reference signal\n"); goto clean_exit; } @@ -91,15 +91,15 @@ void ue_mib_free(ue_mib_t * q) if (q->sf_symbols) { free(q->sf_symbols); } - for (int i=0;ice[i]) { free(q->ce[i]); } } sync_free(&q->sfind); - chest_dl_free(&q->chest); + srslte_chest_dl_free(&q->chest); pbch_free(&q->pbch); - lte_fft_free(&q->fft); + srslte_fft_free(&q->fft); bzero(q, sizeof(ue_mib_t)); @@ -116,13 +116,13 @@ int ue_mib_decode(ue_mib_t * q, cf_t *input, uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset) { int ret = SRSLTE_SUCCESS; - cf_t *ce_slot1[MAX_PORTS]; + cf_t *ce_slot1[SRSLTE_MAX_PORTS]; /* Run FFT for the slot symbols */ - lte_fft_run_sf(&q->fft, input, q->sf_symbols); + srslte_fft_run_sf(&q->fft, input, q->sf_symbols); /* Get channel estimates of sf idx #0 for each port */ - ret = chest_dl_estimate(&q->chest, q->sf_symbols, q->ce, 0); + ret = srslte_chest_dl_estimate(&q->chest, q->sf_symbols, q->ce, 0); if (ret < 0) { return SRSLTE_ERROR; } @@ -132,13 +132,13 @@ int ue_mib_decode(ue_mib_t * q, cf_t *input, ue_mib_reset(q); } - for (int i=0;ice[i][SLOT_LEN_RE(q->chest.cell.nof_prb, q->chest.cell.cp)]; } /* Decode PBCH */ ret = pbch_decode(&q->pbch, &q->sf_symbols[SLOT_LEN_RE(q->chest.cell.nof_prb, q->chest.cell.cp)], - ce_slot1, chest_dl_get_noise_estimate(&q->chest), + ce_slot1, srslte_chest_dl_get_noise_estimate(&q->chest), bch_payload, nof_tx_ports, sfn_offset); if (ret < 0) { fprintf(stderr, "Error decoding PBCH (%d)\n", ret); @@ -158,12 +158,12 @@ int ue_mib_decode(ue_mib_t * q, cf_t *input, int ue_mib_sync_init(ue_mib_sync_t *q, uint32_t cell_id, - lte_cp_t cp, + srslte_cp_t cp, int (recv_callback)(void*, void*, uint32_t, timestamp_t*), void *stream_handler) { - lte_cell_t cell; - cell.nof_ports = MIB_MAX_PORTS; + srslte_cell_t cell; + cell.nof_ports = MIB_SRSLTE_MAX_PORTS; cell.id = cell_id; cell.cp = cp; cell.nof_prb = MIB_NOF_PRB; diff --git a/srslte/lib/ue/src/ue_sync.c b/srslte/lib/ue/src/ue_sync.c index d0e0f50a9..a4d2b968c 100644 --- a/srslte/lib/ue/src/ue_sync.c +++ b/srslte/lib/ue/src/ue_sync.c @@ -81,7 +81,7 @@ clean_exit: } int ue_sync_init(ue_sync_t *q, - lte_cell_t cell, + srslte_cell_t cell, int (recv_callback)(void*, void*, uint32_t,timestamp_t*), void *stream_handler) { diff --git a/srslte/lib/ue/src/ue_ul.c b/srslte/lib/ue/src/ue_ul.c index 595786d05..1ef041284 100644 --- a/srslte/lib/ue/src/ue_ul.c +++ b/srslte/lib/ue/src/ue_ul.c @@ -39,7 +39,7 @@ int ue_ul_init(ue_ul_t *q, - lte_cell_t cell) + srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; @@ -56,8 +56,8 @@ int ue_ul_init(ue_ul_t *q, fprintf(stderr, "Error initiating FFT\n"); goto clean_exit; } - lte_fft_set_freq_shift(&q->fft, 0.5); - lte_fft_set_normalize(&q->fft, true); + srslte_fft_set_freq_shift(&q->fft, 0.5); + srslte_fft_set_normalize(&q->fft, true); q->normalize_en = true; @@ -76,8 +76,8 @@ int ue_ul_init(ue_ul_t *q, goto clean_exit; } } - if (refsignal_ul_init(&q->drms, cell)) { - fprintf(stderr, "Error initiating refsignal_ul\n"); + if (srslte_refsignal_ul_init(&q->drms, cell)) { + fprintf(stderr, "Error initiating srslte_refsignal_ul\n"); goto clean_exit; } q->sf_symbols = vec_malloc(CURRENT_SFLEN_RE * sizeof(cf_t)); @@ -106,13 +106,13 @@ clean_exit: void ue_ul_free(ue_ul_t *q) { if (q) { - lte_fft_free(&q->fft); + srslte_fft_free(&q->fft); pusch_free(&q->pusch); for (uint32_t i=0;iharq_process[i]); } cfo_free(&q->cfo); - refsignal_ul_free(&q->drms); + srslte_refsignal_ul_free(&q->drms); if (q->sf_symbols) { free(q->sf_symbols); @@ -146,9 +146,9 @@ void ue_ul_reset(ue_ul_t *q) { harq_reset(&q->harq_process[0]); } -void ue_ul_set_pusch_cfg(ue_ul_t *q, refsignal_drms_pusch_cfg_t *pusch_drms_cfg, pusch_hopping_cfg_t *pusch_hopping_cfg) +void ue_ul_set_pusch_cfg(ue_ul_t *q, srslte_refsignal_drms_pusch_cfg_t *pusch_drms_cfg, pusch_hopping_cfg_t *pusch_hopping_cfg) { - memcpy(&q->pusch_drms_cfg, pusch_drms_cfg, sizeof(refsignal_drms_pusch_cfg_t)); + memcpy(&q->pusch_drms_cfg, pusch_drms_cfg, sizeof(srslte_refsignal_drms_pusch_cfg_t)); pusch_set_hopping_cfg(&q->pusch, pusch_hopping_cfg); } @@ -201,13 +201,13 @@ int ue_ul_pusch_uci_encode_rnti(ue_ul_t *q, ra_pusch_t *ra_ul, uint8_t *data, uc } // FIXME: Pregenerate for all possible number of prb - if (refsignal_dmrs_pusch_gen(&q->drms, &q->pusch_drms_cfg, + if (srslte_refsignal_dmrs_pusch_gen(&q->drms, &q->pusch_drms_cfg, q->harq_process[0].ul_alloc.L_prb, sf_idx, q->refsignal)) { fprintf(stderr, "Error generating PUSCH DRMS signals\n"); return ret; } - refsignal_drms_pusch_put(&q->drms, &q->pusch_drms_cfg, q->refsignal, + srslte_refsignal_drms_pusch_put(&q->drms, &q->pusch_drms_cfg, q->refsignal, q->harq_process[0].ul_alloc.L_prb, q->harq_process[0].ul_alloc.n_prb_tilde, q->sf_symbols); diff --git a/srslte/lib/utils/src/dft.c b/srslte/lib/utils/src/dft.c index 94269b056..abf0d5e7e 100644 --- a/srslte/lib/utils/src/dft.c +++ b/srslte/lib/utils/src/dft.c @@ -37,7 +37,7 @@ #define dft_ceil(a,b) ((a-1)/b+1) #define dft_floor(a,b) (a/b) -int dft_plan(dft_plan_t *plan, const int dft_points, dft_dir_t dir, +int dft_plan(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir, dft_mode_t mode) { if(mode == COMPLEX){ return dft_plan_c(plan,dft_points,dir); @@ -47,12 +47,12 @@ int dft_plan(dft_plan_t *plan, const int dft_points, dft_dir_t dir, return 0; } -static void allocate(dft_plan_t *plan, int size_in, int size_out, int len) { +static void allocate(srslte_dft_plan_t *plan, int size_in, int size_out, int len) { plan->in = fftwf_malloc(size_in*len); plan->out = fftwf_malloc(size_out*len); } -int dft_plan_c(dft_plan_t *plan, const int dft_points, dft_dir_t dir) { +int dft_plan_c(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir) { allocate(plan,sizeof(fftwf_complex),sizeof(fftwf_complex), dft_points); int sign = (dir == FORWARD) ? FFTW_FORWARD : FFTW_BACKWARD; plan->p = fftwf_plan_dft_1d(dft_points, plan->in, plan->out, sign, 0U); @@ -71,7 +71,7 @@ int dft_plan_c(dft_plan_t *plan, const int dft_points, dft_dir_t dir) { return 0; } -int dft_plan_r(dft_plan_t *plan, const int dft_points, dft_dir_t dir) { +int dft_plan_r(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir) { allocate(plan,sizeof(float),sizeof(float), dft_points); int sign = (dir == FORWARD) ? FFTW_R2HC : FFTW_HC2R; plan->p = fftwf_plan_r2r_1d(dft_points, plan->in, plan->out, sign, 0U); @@ -90,16 +90,16 @@ int dft_plan_r(dft_plan_t *plan, const int dft_points, dft_dir_t dir) { return 0; } -void dft_plan_set_mirror(dft_plan_t *plan, bool val){ +void dft_plan_set_mirror(srslte_dft_plan_t *plan, bool val){ plan->mirror = val; } -void dft_plan_set_db(dft_plan_t *plan, bool val){ +void dft_plan_set_db(srslte_dft_plan_t *plan, bool val){ plan->db = val; } -void dft_plan_set_norm(dft_plan_t *plan, bool val){ +void dft_plan_set_norm(srslte_dft_plan_t *plan, bool val){ plan->norm = val; } -void dft_plan_set_dc(dft_plan_t *plan, bool val){ +void dft_plan_set_dc(srslte_dft_plan_t *plan, bool val){ plan->dc = val; } @@ -128,7 +128,7 @@ static void copy_post(uint8_t *dst, uint8_t *src, int size_d, int len, } } -void dft_run(dft_plan_t *plan, void *in, void *out) { +void dft_run(srslte_dft_plan_t *plan, void *in, void *out) { if(plan->mode == COMPLEX) { dft_run_c(plan,in,out); } else { @@ -136,7 +136,7 @@ void dft_run(dft_plan_t *plan, void *in, void *out) { } } -void dft_run_c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out) { +void dft_run_c(srslte_dft_plan_t *plan, dft_c_t *in, dft_c_t *out) { float norm; int i; fftwf_complex *f_out = plan->out; @@ -157,7 +157,7 @@ void dft_run_c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out) { plan->forward, plan->mirror, plan->dc); } -void dft_run_r(dft_plan_t *plan, dft_r_t *in, dft_r_t *out) { +void dft_run_r(srslte_dft_plan_t *plan, dft_r_t *in, dft_r_t *out) { float norm; int i; int len = plan->size; @@ -177,13 +177,13 @@ void dft_run_r(dft_plan_t *plan, dft_r_t *in, dft_r_t *out) { memcpy(out,plan->out,sizeof(dft_r_t)*plan->size); } -void dft_plan_free(dft_plan_t *plan) { +void dft_plan_free(srslte_dft_plan_t *plan) { if (!plan) return; if (!plan->size) return; if (plan->in) fftwf_free(plan->in); if (plan->out) fftwf_free(plan->out); if (plan->p) fftwf_destroy_plan(plan->p); - bzero(plan, sizeof(dft_plan_t)); + bzero(plan, sizeof(srslte_dft_plan_t)); } diff --git a/srslte/lib/utils/test/dft_test.c b/srslte/lib/utils/test/dft_test.c index 10d90f388..58f61bf1f 100644 --- a/srslte/lib/utils/test/dft_test.c +++ b/srslte/lib/utils/test/dft_test.c @@ -65,7 +65,7 @@ void print(cf_t* in, int len) int test_dft(cf_t* in){ int res = 0; - dft_plan_t plan; + srslte_dft_plan_t plan; if(forward){ dft_plan(&plan, N, FORWARD, COMPLEX); } else { @@ -84,7 +84,7 @@ int test_dft(cf_t* in){ dft_run(&plan, in, out1); print(out1, N); - dft_plan_t plan_rev; + srslte_dft_plan_t plan_rev; if(!forward){ dft_plan(&plan_rev, N, FORWARD, COMPLEX); } else {