Added prefix until fft.h

master
ismagom 10 years ago
parent 2b4da53ef9
commit 8605b6d24c

@ -28,7 +28,7 @@ for prb=4
subframe_mat = lteULResourceGrid(ueConfig); subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(ind)=mat; 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(:))); error(k)=mean(abs(subframe_mat(:)-subframe_lib(:)));
disp(error(k)) disp(error(k))

@ -45,7 +45,7 @@ typedef _Complex float cf_t;
SRSLTE_API bool mexutils_isScalar(const mxArray *ptr); SRSLTE_API bool mexutils_isScalar(const mxArray *ptr);
SRSLTE_API int mexutils_read_cell(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, SRSLTE_API char *mexutils_get_char_struct(const mxArray *ptr,
const char *field_name); const char *field_name);

@ -72,7 +72,7 @@ int mexutils_read_float_struct(const mxArray *ptr, const char *field_name, float
return 0; 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)) { if (mexutils_read_uint32_struct(ptr, "NCellID", &cell->id)) {
return -1; return -1;
} }

@ -134,14 +134,14 @@ int main(int argc, char **argv) {
int ret; int ret;
cf_t *sf_buffer; cf_t *sf_buffer;
prog_args_t prog_args; prog_args_t prog_args;
lte_cell_t cell; srslte_cell_t cell;
int64_t sf_cnt; int64_t sf_cnt;
ue_sync_t ue_sync; ue_sync_t ue_sync;
ue_mib_t ue_mib; ue_mib_t ue_mib;
void *uhd; void *uhd;
ue_dl_t ue_dl; ue_dl_t ue_dl;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
uint32_t nframes=0; uint32_t nframes=0;
uint32_t nof_trials = 0; uint32_t nof_trials = 0;
uint32_t sfn = 0; // system frame number 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]; uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_unpacked[BCH_PAYLOAD_LEN];
uint32_t sfn_offset; uint32_t sfn_offset;
float rssi_utra=0,rssi=0, rsrp=0, rsrq=0, snr=0; 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)) { if (parse_args(&prog_args, argc, argv)) {
exit(-1); exit(-1);
@ -209,11 +209,11 @@ int main(int argc, char **argv) {
/* Initialize subframe counter */ /* Initialize subframe counter */
sf_cnt = 0; 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"); fprintf(stderr, "Error initiating FFT\n");
return -1; return -1;
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initiating channel estimator\n"); fprintf(stderr, "Error initiating channel estimator\n");
return -1; return -1;
} }
@ -222,7 +222,7 @@ int main(int argc, char **argv) {
cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t)); cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t));
for (int i=0;i<MAX_PORTS;i++) { for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = vec_malloc(sizeof(cf_t) * sf_re); ce[i] = vec_malloc(sizeof(cf_t) * sf_re);
} }
@ -289,15 +289,15 @@ int main(int argc, char **argv) {
if (ue_sync_get_sfidx(&ue_sync) == 5) { if (ue_sync_get_sfidx(&ue_sync) == 5) {
/* Run FFT for all subframe data */ /* Run FFT for all subframe data */
lte_fft_run_sf(&fft, sf_buffer, sf_symbols); srslte_fft_run_sf(&fft, sf_buffer, sf_symbols);
chest_dl_estimate(&chest, sf_symbols, ce, ue_sync_get_sfidx(&ue_sync)); srslte_chest_dl_estimate(&chest, sf_symbols, ce, ue_sync_get_sfidx(&ue_sync));
rssi = VEC_CMA(vec_avg_power_cf(sf_buffer,SF_LEN(lte_symbol_sz(cell.nof_prb))),rssi,nframes); rssi = VEC_CMA(vec_avg_power_cf(sf_buffer,SF_LEN(lte_symbol_sz(cell.nof_prb))),rssi,nframes);
rssi_utra = VEC_CMA(chest_dl_get_rssi(&chest),rssi_utra,nframes); rssi_utra = VEC_CMA(srslte_chest_dl_get_rssi(&chest),rssi_utra,nframes);
rsrq = VEC_EMA(chest_dl_get_rsrq(&chest),rsrq,0.05); rsrq = VEC_EMA(srslte_chest_dl_get_rsrq(&chest),rsrq,0.05);
rsrp = VEC_EMA(chest_dl_get_rsrp(&chest),rsrp,0.05); rsrp = VEC_EMA(srslte_chest_dl_get_rsrp(&chest),rsrp,0.05);
snr = VEC_EMA(chest_dl_get_snr(&chest),snr,0.05); snr = VEC_EMA(srslte_chest_dl_get_snr(&chest),snr,0.05);
nframes++; nframes++;
} }

@ -180,7 +180,7 @@ int main(int argc, char **argv) {
} else if (n == 1) { } else if (n == 1) {
for (int i=0;i<3;i++) { for (int i=0;i<3;i++) {
if (found_cells[i].peak > config.threshold/2) { if (found_cells[i].peak > config.threshold/2) {
lte_cell_t cell; srslte_cell_t cell;
cell.id = found_cells[i].cell_id; cell.id = found_cells[i].cell_id;
cell.cp = found_cells[i].cp; cell.cp = found_cells[i].cp;
int ret = cuhd_mib_decoder(uhd, 100, &cell); int ret = cuhd_mib_decoder(uhd, 100, &cell);

@ -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 /** 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. * 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; int ret = SRSLTE_ERROR;
ue_mib_sync_t ue_mib; ue_mib_sync_t ue_mib;
uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_unpacked[BCH_PAYLOAD_LEN]; 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 /** 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 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; int ret = SRSLTE_ERROR;
ue_cell_search_t cs; 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, * 0 if no cell was found or MIB could not be decoded,
* -1 on error * -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; int ret = SRSLTE_ERROR;

@ -36,16 +36,16 @@ typedef struct SRSLTE_API {
int cuhd_mib_decoder(void *uhd, int cuhd_mib_decoder(void *uhd,
uint32_t max_nof_frames, uint32_t max_nof_frames,
lte_cell_t *cell); srslte_cell_t *cell);
int cuhd_cell_search(void *uhd, int cuhd_cell_search(void *uhd,
cell_search_cfg_t *config, cell_search_cfg_t *config,
int force_N_id_2, int force_N_id_2,
lte_cell_t *cell); srslte_cell_t *cell);
int cuhd_search_and_decode_mib(void *uhd, int cuhd_search_and_decode_mib(void *uhd,
cell_search_cfg_t *config, cell_search_cfg_t *config,
int force_N_id_2, int force_N_id_2,
lte_cell_t *cell); srslte_cell_t *cell);

@ -40,7 +40,7 @@ void usage(char *arg) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
binsource_hl bs; binsource_hl bs;
mod_hl mod; mod_hl mod;
ch_awgn_hl ch; srslte_ch_awgn_hl ch;
demod_soft_hl demod_s; demod_soft_hl demod_s;
demod_hard_hl demod_h; demod_hard_hl demod_h;
@ -88,7 +88,7 @@ int main(int argc, char **argv) {
if ( binsource_initialize(&bs) || if ( binsource_initialize(&bs) ||
mod_initialize(&mod) || mod_initialize(&mod) ||
ch_awgn_initialize(&ch) || srslte_ch_awgn_initialize(&ch) ||
demod_hard_initialize(&demod_h) || demod_hard_initialize(&demod_h) ||
demod_soft_initialize(&demod_s) demod_soft_initialize(&demod_s)
) { ) {
@ -98,7 +98,7 @@ int main(int argc, char **argv) {
binsource_work(&bs); binsource_work(&bs);
mod_work(&mod); mod_work(&mod);
ch_awgn_work(&ch); srslte_ch_awgn_work(&ch);
demod_hard_work(&demod_h); demod_hard_work(&demod_h);
demod_soft_work(&demod_s); demod_soft_work(&demod_s);

@ -49,7 +49,7 @@ char *output_file_name = NULL;
#define UP_KEY 65 #define UP_KEY 65
#define DOWN_KEY 66 #define DOWN_KEY 66
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1, // cell_id 1, // cell_id
@ -69,7 +69,7 @@ float uhd_amp = 0.03, uhd_gain = 70.0, uhd_freq = 2400000000;
bool null_file_sink=false; bool null_file_sink=false;
filesink_t fsink; filesink_t fsink;
lte_fft_t ifft; srslte_fft_t ifft;
pbch_t pbch; pbch_t pbch;
pcfich_t pcfich; pcfich_t pcfich;
pdcch_t pdcch; pdcch_t pdcch;
@ -220,7 +220,7 @@ void base_init() {
fprintf(stderr, "Error creating iFFT object\n"); fprintf(stderr, "Error creating iFFT object\n");
exit(-1); exit(-1);
} }
lte_fft_set_normalize(&ifft, true); srslte_fft_set_normalize(&ifft, true);
if (pbch_init(&pbch, cell)) { if (pbch_init(&pbch, cell)) {
fprintf(stderr, "Error creating PBCH object\n"); fprintf(stderr, "Error creating PBCH object\n");
exit(-1); exit(-1);
@ -444,12 +444,12 @@ int main(int argc, char **argv) {
float sss_signal5[SSS_LEN]; // for subframe 5 float sss_signal5[SSS_LEN]; // for subframe 5
uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_packed[BCH_PAYLOAD_LEN/8]; uint8_t bch_payload[BCH_PAYLOAD_LEN], bch_payload_packed[BCH_PAYLOAD_LEN/8];
int i; int i;
cf_t *sf_symbols[MAX_PORTS]; cf_t *sf_symbols[SRSLTE_MAX_PORTS];
cf_t *slot1_symbols[MAX_PORTS]; cf_t *slot1_symbols[SRSLTE_MAX_PORTS];
dci_msg_t dci_msg; 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; uint32_t sfn;
chest_dl_t est; srslte_chest_dl_t est;
#ifdef DISABLE_UHD #ifdef DISABLE_UHD
if (argc < 3) { if (argc < 3) {
@ -461,7 +461,7 @@ int main(int argc, char **argv) {
parse_args(argc, argv); parse_args(argc, argv);
N_id_2 = cell.id % 3; 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)); sf_n_samples = 2 * SLOT_LEN(lte_symbol_sz(cell.nof_prb));
cell.phich_length = PHICH_NORM; cell.phich_length = PHICH_NORM;
@ -479,12 +479,12 @@ int main(int argc, char **argv) {
sss_generate(sss_signal0, sss_signal5, cell.id); sss_generate(sss_signal0, sss_signal5, cell.id);
/* Generate CRS signals */ /* Generate CRS signals */
if (chest_dl_init(&est, cell)) { if (srslte_chest_dl_init(&est, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
exit(-1); 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; sf_symbols[i] = sf_buffer;
slot1_symbols[i] = &sf_buffer[SLOT_LEN_RE(cell.nof_prb, cell.cp)]; 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 */ /* Initiate valid DCI locations */
for (i=0;i<NSUBFRAMES_X_FRAME;i++) { for (i=0;i<SRSLTE_NSUBFRAMES_X_FRAME;i++) {
pdcch_ue_locations(&pdcch, locations[i], 30, i, cfi, 1234); pdcch_ue_locations(&pdcch, locations[i], 30, i, cfi, 1234);
} }
@ -521,7 +521,7 @@ int main(int argc, char **argv) {
bool send_data = false; bool send_data = false;
while (nf < nof_frames || nof_frames == -1) { while (nf < nof_frames || nof_frames == -1) {
for (sf_idx = 0; sf_idx < NSUBFRAMES_X_FRAME && (nf < nof_frames || nof_frames == -1); sf_idx++) { for (sf_idx = 0; sf_idx < SRSLTE_NSUBFRAMES_X_FRAME && (nf < nof_frames || nof_frames == -1); sf_idx++) {
bzero(sf_buffer, sizeof(cf_t) * sf_n_re); bzero(sf_buffer, sizeof(cf_t) * sf_n_re);
if (sf_idx == 0 || sf_idx == 5) { if (sf_idx == 0 || sf_idx == 5) {
@ -530,7 +530,7 @@ int main(int argc, char **argv) {
CPNORM); CPNORM);
} }
refsignal_cs_put_sf(cell, 0, est.csr_signal.pilots[0][sf_idx], sf_buffer); srslte_refsignal_cs_put_sf(cell, 0, est.csr_signal.pilots[0][sf_idx], sf_buffer);
bcch_bch_pack(&cell, sfn, bch_payload_packed, BCH_PAYLOAD_LEN/8); bcch_bch_pack(&cell, sfn, bch_payload_packed, BCH_PAYLOAD_LEN/8);
bit_pack_vector(bch_payload_packed, bch_payload, BCH_PAYLOAD_LEN); bit_pack_vector(bch_payload_packed, bch_payload, BCH_PAYLOAD_LEN);

@ -228,7 +228,7 @@ netsink_t net_sink, net_sink_signal;
int main(int argc, char **argv) { int main(int argc, char **argv) {
int ret; int ret;
lte_cell_t cell; srslte_cell_t cell;
int64_t sf_cnt; int64_t sf_cnt;
ue_mib_t ue_mib; ue_mib_t ue_mib;
#ifndef DISABLE_UHD #ifndef DISABLE_UHD
@ -414,9 +414,9 @@ int main(int argc, char **argv) {
} }
nof_trials++; nof_trials++;
rsrq = VEC_EMA(chest_dl_get_rsrq(&ue_dl.chest), rsrq, 0.05); rsrq = VEC_EMA(srslte_chest_dl_get_rsrq(&ue_dl.chest), rsrq, 0.05);
rsrp = VEC_EMA(chest_dl_get_rsrp(&ue_dl.chest), rsrp, 0.05); rsrp = VEC_EMA(srslte_chest_dl_get_rsrp(&ue_dl.chest), rsrp, 0.05);
snr = VEC_EMA(chest_dl_get_snr(&ue_dl.chest), snr, 0.01); snr = VEC_EMA(srslte_chest_dl_get_snr(&ue_dl.chest), snr, 0.01);
nframes++; nframes++;
if (isnan(rsrq)) { if (isnan(rsrq)) {
rsrq = 0; rsrq = 0;
@ -432,13 +432,13 @@ int main(int argc, char **argv) {
/* Adjust channel estimator based on SNR */ /* Adjust channel estimator based on SNR */
if (10*log10(snr) < 5.0) { if (10*log10(snr) < 5.0) {
float f_low_snr[5]={0.05, 0.15, 0.6, 0.15, 0.05}; float f_low_snr[5]={0.05, 0.15, 0.6, 0.15, 0.05};
chest_dl_set_filter_freq(&ue_dl.chest, f_low_snr, 5); srslte_chest_dl_set_filter_freq(&ue_dl.chest, f_low_snr, 5);
} else if (10*log10(snr) < 10.0) { } else if (10*log10(snr) < 10.0) {
float f_mid_snr[3]={0.1, 0.8, 0.1}; float f_mid_snr[3]={0.1, 0.8, 0.1};
chest_dl_set_filter_freq(&ue_dl.chest, f_mid_snr, 3); srslte_chest_dl_set_filter_freq(&ue_dl.chest, f_mid_snr, 3);
} else { } else {
float f_high_snr[3]={0.05, 0.9, 0.05}; float f_high_snr[3]={0.05, 0.9, 0.05};
chest_dl_set_filter_freq(&ue_dl.chest, f_high_snr, 3); srslte_chest_dl_set_filter_freq(&ue_dl.chest, f_high_snr, 3);
} }
#endif #endif
@ -538,7 +538,7 @@ void *plot_thread_run(void *arg) {
tmp_plot[i] = -80; tmp_plot[i] = -80;
} }
} }
for (i = 0; i < REFSIGNAL_NUM_SF(ue_dl.cell.nof_prb,0); i++) { for (i = 0; i < SRSLTE_REFSIGNAL_NUM_SF(ue_dl.cell.nof_prb,0); i++) {
tmp_plot2[i] = 20 * log10f(cabsf(ue_dl.chest.pilot_estimates_average[0][i])); tmp_plot2[i] = 20 * log10f(cabsf(ue_dl.chest.pilot_estimates_average[0][i]));
if (isinf(tmp_plot2[i])) { if (isinf(tmp_plot2[i])) {
tmp_plot2[i] = -80; tmp_plot2[i] = -80;
@ -547,7 +547,7 @@ void *plot_thread_run(void *arg) {
//for (i=0;i<CP_NSYMB(ue_dl.cell.cp);i++) { //for (i=0;i<CP_NSYMB(ue_dl.cell.cp);i++) {
// plot_waterfall_appendNewData(&poutfft, &tmp_plot[i*RE_X_RB*ue_dl.cell.nof_prb], RE_X_RB*ue_dl.cell.nof_prb); // plot_waterfall_appendNewData(&poutfft, &tmp_plot[i*RE_X_RB*ue_dl.cell.nof_prb], RE_X_RB*ue_dl.cell.nof_prb);
//} //}
plot_real_setNewData(&pce, tmp_plot2, REFSIGNAL_NUM_SF(ue_dl.cell.nof_prb,0)); plot_real_setNewData(&pce, tmp_plot2, SRSLTE_REFSIGNAL_NUM_SF(ue_dl.cell.nof_prb,0));
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
int max = vec_max_fi(ue_sync.strack.pss.conv_output_avg, ue_sync.strack.pss.frame_size+ue_sync.strack.pss.fft_size-1); int max = vec_max_fi(ue_sync.strack.pss.conv_output_avg, ue_sync.strack.pss.frame_size+ue_sync.strack.pss.fft_size-1);
vec_sc_prod_fff(ue_sync.strack.pss.conv_output_avg, vec_sc_prod_fff(ue_sync.strack.pss.conv_output_avg,

@ -291,7 +291,7 @@ int rar_unpack(uint8_t *buffer, rar_msg_t *msg)
int main(int argc, char **argv) { int main(int argc, char **argv) {
int ret; int ret;
lte_cell_t cell; srslte_cell_t cell;
int64_t sf_cnt; int64_t sf_cnt;
ue_mib_t ue_mib; ue_mib_t ue_mib;
void *uhd; void *uhd;
@ -395,8 +395,8 @@ int main(int argc, char **argv) {
pusch_hopping_cfg_t hop_cfg; pusch_hopping_cfg_t hop_cfg;
bzero(&hop_cfg, sizeof(pusch_hopping_cfg_t)); bzero(&hop_cfg, sizeof(pusch_hopping_cfg_t));
refsignal_drms_pusch_cfg_t drms_cfg; srslte_refsignal_drms_pusch_cfg_t drms_cfg;
bzero(&drms_cfg, sizeof(refsignal_drms_pusch_cfg_t)); bzero(&drms_cfg, sizeof(srslte_refsignal_drms_pusch_cfg_t));
drms_cfg.beta_pusch = 1.0; drms_cfg.beta_pusch = 1.0;
drms_cfg.group_hopping_en = false; drms_cfg.group_hopping_en = false;
drms_cfg.sequence_hopping_en = false; drms_cfg.sequence_hopping_en = false;
@ -460,10 +460,10 @@ int main(int argc, char **argv) {
if (state != RECV_RAR) { if (state != RECV_RAR) {
/* Run FFT for all subframe data */ /* Run FFT for all subframe data */
lte_fft_run_sf(&ue_dl.fft, sf_buffer, ue_dl.sf_symbols); srslte_fft_run_sf(&ue_dl.fft, sf_buffer, ue_dl.sf_symbols);
/* Get channel estimates for each port */ /* Get channel estimates for each port */
chest_dl_estimate(&ue_dl.chest, ue_dl.sf_symbols, ue_dl.ce, ue_sync_get_sfidx(&ue_sync)); srslte_chest_dl_estimate(&ue_dl.chest, ue_dl.sf_symbols, ue_dl.ce, ue_sync_get_sfidx(&ue_sync));
} }
if (sf_cnt > 1000) { if (sf_cnt > 1000) {

@ -45,70 +45,70 @@
* *
* The equalizer uses the channel estimates to produce an estimation of the transmitted symbol. * 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 SRSLTE_CHEST_MAX_FILTER_FREQ_LEN 10
#define CHEST_MAX_FILTER_TIME_LEN 4 #define SRSLTE_CHEST_MAX_FILTER_TIME_LEN 4
typedef struct { typedef struct {
lte_cell_t cell; srslte_cell_t cell;
refsignal_cs_t csr_signal; srslte_refsignal_cs_t csr_signal;
cf_t *pilot_estimates[MAX_PORTS]; cf_t *pilot_estimates[SRSLTE_MAX_PORTS];
cf_t *pilot_estimates_average[MAX_PORTS]; cf_t *pilot_estimates_average[SRSLTE_MAX_PORTS];
cf_t *pilot_recv_signal[MAX_PORTS]; cf_t *pilot_recv_signal[SRSLTE_MAX_PORTS];
uint32_t filter_freq_len; 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; 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_noise;
cf_t *tmp_freqavg; 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; cf_t *tmp_timeavg_mult;
interp_linvec_t interp_linvec; srslte_interp_linvec_t srslte_interp_linvec;
interp_lin_t interp_lin; srslte_interp_lin_t srslte_interp_lin;
float rssi[MAX_PORTS]; float rssi[SRSLTE_MAX_PORTS];
float rsrp[MAX_PORTS]; float rsrp[SRSLTE_MAX_PORTS];
float noise_estimate[MAX_PORTS]; float noise_estimate[SRSLTE_MAX_PORTS];
} chest_dl_t; } srslte_chest_dl_t;
SRSLTE_API int chest_dl_init(chest_dl_t *q, SRSLTE_API int srslte_chest_dl_init(srslte_chest_dl_t *q,
lte_cell_t cell); 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, SRSLTE_API int srslte_chest_dl_set_filter_freq(srslte_chest_dl_t *q,
float *filter, float *filter,
uint32_t filter_len); uint32_t filter_len);
SRSLTE_API int chest_dl_set_filter_time(chest_dl_t *q, SRSLTE_API int srslte_chest_dl_set_filter_time(srslte_chest_dl_t *q,
float *filter, float *filter,
uint32_t filter_len); uint32_t filter_len);
SRSLTE_API int chest_dl_estimate(chest_dl_t *q, SRSLTE_API int srslte_chest_dl_estimate(srslte_chest_dl_t *q,
cf_t *input, cf_t *input,
cf_t *ce[MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS],
uint32_t sf_idx); uint32_t sf_idx);
SRSLTE_API int chest_dl_estimate_port(chest_dl_t *q, SRSLTE_API int srslte_chest_dl_estimate_port(srslte_chest_dl_t *q,
cf_t *input, cf_t *input,
cf_t *ce, cf_t *ce,
uint32_t sf_idx, uint32_t sf_idx,
uint32_t port_id); 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 #endif

@ -25,8 +25,8 @@
* *
*/ */
#ifndef REFSIGNAL_DL_ #ifndef SRSLTE_REFSIGNAL_DL_
#define REFSIGNAL_DL_ #define SRSLTE_REFSIGNAL_DL_
/* Object to manage Downlink reference signals for channel estimation. /* Object to manage Downlink reference signals for channel estimation.
* *
@ -38,46 +38,46 @@
typedef _Complex float cf_t; 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 // 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 SRSLTE_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_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 */ /** Cell-Specific Reference Signal */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
cf_t *pilots[2][NSUBFRAMES_X_FRAME]; // Saves the reference signal per subframe for ports 0,1 and ports 2,3 cf_t *pilots[2][SRSLTE_NSUBFRAMES_X_FRAME]; // Saves the reference signal per subframe for ports 0,1 and ports 2,3
} refsignal_cs_t; } srslte_refsignal_cs_t;
SRSLTE_API int refsignal_cs_init(refsignal_cs_t *q, SRSLTE_API int srslte_refsignal_cs_init(srslte_refsignal_cs_t *q,
lte_cell_t cell); 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, SRSLTE_API int srslte_refsignal_cs_put_sf(srslte_cell_t cell,
uint32_t port_id, uint32_t port_id,
cf_t *pilots, cf_t *pilots,
cf_t *sf_symbols); cf_t *sf_symbols);
SRSLTE_API int refsignal_cs_get_sf(lte_cell_t cell, SRSLTE_API int srslte_refsignal_cs_get_sf(srslte_cell_t cell,
uint32_t port_id, uint32_t port_id,
cf_t *sf_symbols, cf_t *sf_symbols,
cf_t *pilots); cf_t *pilots);
SRSLTE_API uint32_t refsignal_cs_fidx(lte_cell_t cell, SRSLTE_API uint32_t srslte_refsignal_cs_fidx(srslte_cell_t cell,
uint32_t l, uint32_t l,
uint32_t port_id, uint32_t port_id,
uint32_t m); uint32_t m);
SRSLTE_API uint32_t refsignal_cs_nsymbol(uint32_t l, SRSLTE_API uint32_t srslte_refsignal_cs_nsymbol(uint32_t l,
lte_cp_t cp, srslte_cp_t cp,
uint32_t port_id); uint32_t port_id);
SRSLTE_API uint32_t refsignal_cs_v(uint32_t port_id, SRSLTE_API uint32_t srslte_refsignal_cs_v(uint32_t port_id,
uint32_t ref_symbol_idx); 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 #endif

@ -25,8 +25,8 @@
* *
*/ */
#ifndef REFSIGNAL_UL_ #ifndef SRSLTE_REFSIGNAL_UL_
#define REFSIGNAL_UL_ #define SRSLTE_REFSIGNAL_UL_
/* Object to manage Downlink reference signals for channel estimation. /* Object to manage Downlink reference signals for channel estimation.
* *
@ -36,10 +36,10 @@
#include "srslte/phch/pucch.h" #include "srslte/phch/pucch.h"
#include "srslte/common/phy_common.h" #include "srslte/common/phy_common.h"
#define NOF_GROUPS_U 30 #define SRSLTE_NOF_GROUPS_U 30
#define NOF_SEQUENCES_U 2 #define SRSLTE_NOF_SEQUENCES_U 2
#define NOF_DELTA_SS 30 #define SRSLTE_NOF_DELTA_SS 30
#define NOF_CSHIFT 8 #define SRSLTE_NOF_CSHIFT 8
typedef _Complex float cf_t; typedef _Complex float cf_t;
@ -51,56 +51,56 @@ typedef struct SRSLTE_API {
float beta_pusch; float beta_pusch;
bool group_hopping_en; bool group_hopping_en;
bool sequence_hopping_en; bool sequence_hopping_en;
}refsignal_drms_pusch_cfg_t; }srslte_refsignal_drms_pusch_cfg_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
float beta_pucch; float beta_pucch;
uint32_t nof_prb; uint32_t nof_prb;
}refsignal_srs_cfg_t; }srslte_refsignal_srs_cfg_t;
/** Uplink DeModulation Reference Signal (DMRS) */ /** Uplink DeModulation Reference Signal (DMRS) */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
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; 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 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[NSLOTS_X_FRAME]; uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME];
uint32_t u_pucch[NSLOTS_X_FRAME]; uint32_t u_pucch[SRSLTE_NSLOTS_X_FRAME];
uint32_t v_pusch[NSLOTS_X_FRAME][NOF_DELTA_SS]; uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS];
} refsignal_ul_t; } srslte_refsignal_ul_t;
SRSLTE_API int refsignal_ul_init(refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_ul_init(srslte_refsignal_ul_t *q,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void refsignal_ul_free(refsignal_ul_t *q); SRSLTE_API void srslte_refsignal_ul_free(srslte_refsignal_ul_t *q);
SRSLTE_API bool refsignal_drms_pusch_cfg_isvalid(refsignal_ul_t *q, SRSLTE_API bool srslte_refsignal_drms_pusch_cfg_isvalid(srslte_refsignal_ul_t *q,
refsignal_drms_pusch_cfg_t *cfg, srslte_refsignal_drms_pusch_cfg_t *cfg,
uint32_t nof_prb); uint32_t nof_prb);
SRSLTE_API void refsignal_drms_pusch_put(refsignal_ul_t *q, SRSLTE_API void srslte_refsignal_drms_pusch_put(srslte_refsignal_ul_t *q,
refsignal_drms_pusch_cfg_t *cfg, srslte_refsignal_drms_pusch_cfg_t *cfg,
cf_t *r_pusch, cf_t *r_pusch,
uint32_t nof_prb, uint32_t nof_prb,
uint32_t n_prb[2], uint32_t n_prb[2],
cf_t *sf_symbols); cf_t *sf_symbols);
SRSLTE_API int refsignal_dmrs_pusch_gen(refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q,
refsignal_drms_pusch_cfg_t *cfg, srslte_refsignal_drms_pusch_cfg_t *cfg,
uint32_t nof_prb, uint32_t nof_prb,
uint32_t sf_idx, uint32_t sf_idx,
cf_t *r_pusch); cf_t *r_pusch);
SRSLTE_API int refsignal_dmrs_pucch_gen(refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_dmrs_pucch_gen(srslte_refsignal_ul_t *q,
pucch_cfg_t *cfg, pucch_cfg_t *cfg,
uint32_t sf_idx, uint32_t sf_idx,
uint32_t n_rb, uint32_t n_rb,
cf_t *r_pucch) ; cf_t *r_pucch) ;
SRSLTE_API void refsignal_srs_gen(refsignal_ul_t *q, SRSLTE_API void srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q,
refsignal_srs_cfg_t *cfg, srslte_refsignal_srs_cfg_t *cfg,
uint32_t sf_idx, uint32_t sf_idx,
cf_t *r_srs); cf_t *r_srs);
#endif #endif

@ -36,34 +36,34 @@
typedef _Complex float cf_t; typedef _Complex float cf_t;
SRSLTE_API void ch_awgn_c(const cf_t* input, SRSLTE_API void srslte_ch_awgn_c(const cf_t* input,
cf_t* output, cf_t* output,
float variance, float variance,
uint32_t len); uint32_t len);
SRSLTE_API void ch_awgn_f(const float* x, SRSLTE_API void srslte_ch_awgn_f(const float* x,
float* y, float* y,
float variance, float variance,
uint32_t len); uint32_t len);
SRSLTE_API float ch_awgn_get_variance(float ebno_db, SRSLTE_API float srslte_ch_awgn_get_variance(float ebno_db,
float rate); float rate);
/* High-level API */ /* High-level API */
typedef struct SRSLTE_API{ typedef struct SRSLTE_API{
const cf_t* input; const cf_t* input;
int in_len; int in_len;
struct ch_awgn_ctrl_in { struct srslte_ch_awgn_ctrl_in {
float variance; // Noise variance float variance; // Noise variance
} ctrl_in; } ctrl_in;
cf_t* output; cf_t* output;
int out_len; int out_len;
}ch_awgn_hl; }srslte_ch_awgn_hl;
SRSLTE_API int ch_awgn_initialize(ch_awgn_hl* hl); SRSLTE_API int srslte_ch_awgn_initialize(srslte_ch_awgn_hl* hl);
SRSLTE_API int ch_awgn_work(ch_awgn_hl* hl); SRSLTE_API int srslte_ch_awgn_work(srslte_ch_awgn_hl* hl);
SRSLTE_API int ch_awgn_stop(ch_awgn_hl* hl); SRSLTE_API int srslte_ch_awgn_stop(srslte_ch_awgn_hl* hl);
#endif #endif

@ -41,51 +41,51 @@ typedef _Complex float cf_t; /* this is only a shortcut */
/* This is common for both directions */ /* This is common for both directions */
typedef struct SRSLTE_API{ typedef struct SRSLTE_API{
dft_plan_t fft_plan; srslte_dft_plan_t fft_plan;
uint32_t nof_symbols; uint32_t nof_symbols;
uint32_t symbol_sz; uint32_t symbol_sz;
uint32_t nof_guards; uint32_t nof_guards;
uint32_t nof_re; uint32_t nof_re;
uint32_t slot_sz; uint32_t slot_sz;
lte_cp_t cp; srslte_cp_t cp;
cf_t *tmp; // for removing zero padding cf_t *tmp; // for removing zero padding
bool freq_shift; bool freq_shift;
cf_t *shift_buffer; cf_t *shift_buffer;
}lte_fft_t; }srslte_fft_t;
SRSLTE_API int lte_fft_init(lte_fft_t *q, SRSLTE_API int srslte_fft_init(srslte_fft_t *q,
lte_cp_t cp_type, srslte_cp_t cp_type,
uint32_t nof_prb); 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, SRSLTE_API void srslte_fft_run_slot(srslte_fft_t *q,
cf_t *input, cf_t *input,
cf_t *output); cf_t *output);
SRSLTE_API void lte_fft_run_sf(lte_fft_t *q, SRSLTE_API void srslte_fft_run_sf(srslte_fft_t *q,
cf_t *input, cf_t *input,
cf_t *output); cf_t *output);
SRSLTE_API int lte_ifft_init(lte_fft_t *q, SRSLTE_API int lte_ifft_init(srslte_fft_t *q,
lte_cp_t cp_type, srslte_cp_t cp_type,
uint32_t nof_prb); 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 *input,
cf_t *output); 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 *input,
cf_t *output); cf_t *output);
SRSLTE_API int lte_fft_set_freq_shift(lte_fft_t *q, SRSLTE_API int srslte_fft_set_freq_shift(srslte_fft_t *q,
float freq_shift); float freq_shift);
SRSLTE_API void lte_fft_set_normalize(lte_fft_t *q, SRSLTE_API void srslte_fft_set_normalize(srslte_fft_t *q,
bool normalize_enable); bool normalize_enable);
#endif #endif

@ -36,12 +36,12 @@
#include "srslte/config.h" #include "srslte/config.h"
#define NSUBFRAMES_X_FRAME 10 #define SRSLTE_NSUBFRAMES_X_FRAME 10
#define NSLOTS_X_FRAME (2*NSUBFRAMES_X_FRAME) #define SRSLTE_NSLOTS_X_FRAME (2*SRSLTE_NSUBFRAMES_X_FRAME)
#define LTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE #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_LAYERS 8
#define MAX_CODEWORDS 2 #define MAX_CODEWORDS 2
@ -50,7 +50,7 @@
#define LTE_CRC16 0x11021 #define LTE_CRC16 0x11021
#define LTE_CRC8 0x19B #define LTE_CRC8 0x19B
typedef enum {CPNORM, CPEXT} lte_cp_t; typedef enum {CPNORM, CPEXT} srslte_cp_t;
#define CRNTI_START 0x003D #define CRNTI_START 0x003D
@ -70,8 +70,8 @@ typedef enum {CPNORM, CPEXT} lte_cp_t;
#define SYMBOL_SZ_MAX 2048 #define SYMBOL_SZ_MAX 2048
#define CPNORM_NSYMB 7 #define SRSLTE_CPNORM_NSYMB 7
#define CPNORM_SF_NSYMB (2*CPNORM_NSYMB) #define CPNORM_SF_NSYMB (2*SRSLTE_CPNORM_NSYMB)
#define CPNORM_0_LEN 160 #define CPNORM_0_LEN 160
#define CPNORM_LEN 144 #define CPNORM_LEN 144
@ -82,7 +82,7 @@ typedef enum {CPNORM, CPEXT} lte_cp_t;
#define CP_ISNORM(cp) (cp==CPNORM) #define CP_ISNORM(cp) (cp==CPNORM)
#define CP_ISEXT(cp) (cp==CPEXT) #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(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)) #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 nof_ports;
uint32_t bw_idx; uint32_t bw_idx;
uint32_t id; uint32_t id;
lte_cp_t cp; srslte_cp_t cp;
phich_length_t phich_length; phich_length_t phich_length;
phich_resources_t phich_resources; phich_resources_t phich_resources;
}lte_cell_t; }srslte_cell_t;
typedef enum SRSLTE_API { typedef enum SRSLTE_API {
SINGLE_ANTENNA,TX_DIVERSITY, SPATIAL_MULTIPLEX SINGLE_ANTENNA,TX_DIVERSITY, SPATIAL_MULTIPLEX
@ -153,10 +153,10 @@ enum band_geographical_area {
ALL, NAR, APAC, EMEA, JAPAN, CALA, NA 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, 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); 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 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); SRSLTE_API char *lte_mod_string(lte_mod_t mod);

@ -48,7 +48,7 @@ SRSLTE_API void sequence_set_LTE_pr(sequence_t *q,
uint32_t seed); uint32_t seed);
SRSLTE_API int sequence_pbch(sequence_t *seq, SRSLTE_API int sequence_pbch(sequence_t *seq,
lte_cp_t cp, srslte_cp_t cp,
uint32_t cell_id); uint32_t cell_id);
SRSLTE_API int sequence_pcfich(sequence_t *seq, SRSLTE_API int sequence_pcfich(sequence_t *seq,

@ -39,8 +39,8 @@ typedef _Complex float cf_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_prb; uint32_t max_prb;
dft_plan_t dft_plan[MAX_PRB]; srslte_dft_plan_t dft_plan[MAX_PRB];
dft_plan_t idft_plan[MAX_PRB]; srslte_dft_plan_t idft_plan[MAX_PRB];
}dft_precoding_t; }dft_precoding_t;

@ -64,12 +64,12 @@ SRSLTE_API int precoding_single(precoding_t *q,
SRSLTE_API int precoding_diversity(precoding_t *q, SRSLTE_API int precoding_diversity(precoding_t *q,
cf_t *x[MAX_LAYERS], cf_t *x[MAX_LAYERS],
cf_t *y[MAX_PORTS], cf_t *y[SRSLTE_MAX_PORTS],
int nof_ports, int nof_symbols); int nof_ports, int nof_symbols);
SRSLTE_API int precoding_type(precoding_t *q, SRSLTE_API int precoding_type(precoding_t *q,
cf_t *x[MAX_LAYERS], cf_t *x[MAX_LAYERS],
cf_t *y[MAX_PORTS], cf_t *y[SRSLTE_MAX_PORTS],
int nof_layers, int nof_layers,
int nof_ports, int nof_ports,
int nof_symbols, int nof_symbols,
@ -86,7 +86,7 @@ SRSLTE_API int predecoding_single(precoding_t *q,
SRSLTE_API int predecoding_diversity(precoding_t *q, SRSLTE_API int predecoding_diversity(precoding_t *q,
cf_t *y, cf_t *y,
cf_t *h[MAX_PORTS], cf_t *h[SRSLTE_MAX_PORTS],
cf_t *x[MAX_LAYERS], cf_t *x[MAX_LAYERS],
int nof_ports, int nof_ports,
int nof_symbols, int nof_symbols,
@ -94,7 +94,7 @@ SRSLTE_API int predecoding_diversity(precoding_t *q,
SRSLTE_API int predecoding_type(precoding_t *q, SRSLTE_API int predecoding_type(precoding_t *q,
cf_t *y, cf_t *y,
cf_t *h[MAX_PORTS], cf_t *h[SRSLTE_MAX_PORTS],
cf_t *x[MAX_LAYERS], cf_t *x[MAX_LAYERS],
int nof_ports, int nof_ports,
int nof_layers, int nof_layers,

@ -76,7 +76,7 @@ typedef struct SRSLTE_API {
*/ */
SRSLTE_API int dci_msg_to_ra_dl(dci_msg_t *msg, SRSLTE_API int dci_msg_to_ra_dl(dci_msg_t *msg,
uint16_t msg_rnti, uint16_t msg_rnti,
lte_cell_t cell, srslte_cell_t cell,
uint32_t cfi, uint32_t cfi,
ra_pdsch_t *ra_dl); ra_pdsch_t *ra_dl);

@ -49,7 +49,7 @@ typedef struct SRSLTE_API {
uint32_t sf_idx; uint32_t sf_idx;
ra_dl_alloc_t dl_alloc; ra_dl_alloc_t dl_alloc;
ra_ul_alloc_t ul_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_re; // Number of RE per subframe
uint32_t nof_bits; // Number of bits per subframe uint32_t nof_bits; // Number of bits per subframe
@ -66,7 +66,7 @@ typedef struct SRSLTE_API {
} harq_t; } harq_t;
SRSLTE_API int harq_init(harq_t * q, 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, SRSLTE_API int harq_setup_dl(harq_t *p,
ra_mcs_t mcs, ra_mcs_t mcs,

@ -52,14 +52,14 @@ typedef _Complex float cf_t;
/* PBCH object */ /* PBCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
uint32_t nof_symbols; uint32_t nof_symbols;
/* buffers */ /* buffers */
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
cf_t *pbch_symbols[MAX_PORTS]; cf_t *pbch_symbols[SRSLTE_MAX_PORTS];
cf_t *pbch_x[MAX_PORTS]; cf_t *pbch_x[SRSLTE_MAX_PORTS];
cf_t *pbch_d; cf_t *pbch_d;
float *pbch_llr; float *pbch_llr;
float *temp; float *temp;
@ -82,12 +82,12 @@ typedef struct SRSLTE_API {
} pbch_t; } pbch_t;
SRSLTE_API int pbch_init(pbch_t *q, 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 void pbch_free(pbch_t *q);
SRSLTE_API int pbch_decode(pbch_t *q, SRSLTE_API int pbch_decode(pbch_t *q,
cf_t *slot1_symbols, cf_t *slot1_symbols,
cf_t *ce_slot1[MAX_PORTS], cf_t *ce_slot1[SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint8_t bch_payload[BCH_PAYLOAD_LEN], uint8_t bch_payload[BCH_PAYLOAD_LEN],
uint32_t *nof_tx_ports, 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, SRSLTE_API int pbch_encode(pbch_t *q,
uint8_t bch_payload[BCH_PAYLOAD_LEN], 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_decode_reset(pbch_t *q);
SRSLTE_API void pbch_mib_unpack(uint8_t *msg, SRSLTE_API void pbch_mib_unpack(uint8_t *msg,
lte_cell_t *cell, srslte_cell_t *cell,
uint32_t *sfn); 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, uint32_t sfn,
uint8_t *msg); uint8_t *msg);
SRSLTE_API void pbch_mib_fprint(FILE *stream, SRSLTE_API void pbch_mib_fprint(FILE *stream,
lte_cell_t *cell, srslte_cell_t *cell,
uint32_t sfn, uint32_t sfn,
uint32_t cell_id); uint32_t cell_id);

@ -44,16 +44,16 @@ typedef _Complex float cf_t;
/* PCFICH object */ /* PCFICH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
int nof_symbols; int nof_symbols;
/* handler to REGs resource mapper */ /* handler to REGs resource mapper */
regs_t *regs; regs_t *regs;
/* buffers */ /* buffers */
cf_t ce[MAX_PORTS][PCFICH_RE]; cf_t ce[SRSLTE_MAX_PORTS][PCFICH_RE];
cf_t pcfich_symbols[MAX_PORTS][PCFICH_RE]; cf_t pcfich_symbols[SRSLTE_MAX_PORTS][PCFICH_RE];
cf_t pcfich_x[MAX_PORTS][PCFICH_RE]; cf_t pcfich_x[SRSLTE_MAX_PORTS][PCFICH_RE];
cf_t pcfich_d[PCFICH_RE]; cf_t pcfich_d[PCFICH_RE];
// cfi table in floats // cfi table in floats
@ -68,20 +68,20 @@ typedef struct SRSLTE_API {
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod; modem_table_t mod;
demod_soft_t demod; demod_soft_t demod;
sequence_t seq_pcfich[NSUBFRAMES_X_FRAME]; sequence_t seq_pcfich[SRSLTE_NSUBFRAMES_X_FRAME];
precoding_t precoding; precoding_t precoding;
} pcfich_t; } pcfich_t;
SRSLTE_API int pcfich_init(pcfich_t *q, SRSLTE_API int pcfich_init(pcfich_t *q,
regs_t *regs, regs_t *regs,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void pcfich_free(pcfich_t *q); SRSLTE_API void pcfich_free(pcfich_t *q);
SRSLTE_API int pcfich_decode(pcfich_t *q, SRSLTE_API int pcfich_decode(pcfich_t *q,
cf_t *sf_symbols, cf_t *sf_symbols,
cf_t *ce[MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint32_t subframe, uint32_t subframe,
uint32_t *cfi, uint32_t *cfi,
@ -89,7 +89,7 @@ SRSLTE_API int pcfich_decode(pcfich_t *q,
SRSLTE_API int pcfich_encode(pcfich_t *q, SRSLTE_API int pcfich_encode(pcfich_t *q,
uint32_t cfi, uint32_t cfi,
cf_t *sf_symbols[MAX_PORTS], cf_t *sf_symbols[SRSLTE_MAX_PORTS],
uint32_t subframe); uint32_t subframe);
#endif #endif

@ -52,7 +52,7 @@ typedef enum SRSLTE_API {
/* PDCCH object */ /* PDCCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
uint32_t nof_regs; uint32_t nof_regs;
uint32_t nof_cce; uint32_t nof_cce;
uint32_t max_bits; uint32_t max_bits;
@ -60,9 +60,9 @@ typedef struct SRSLTE_API {
regs_t *regs; regs_t *regs;
/* buffers */ /* buffers */
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
cf_t *pdcch_symbols[MAX_PORTS]; cf_t *pdcch_symbols[SRSLTE_MAX_PORTS];
cf_t *pdcch_x[MAX_PORTS]; cf_t *pdcch_x[SRSLTE_MAX_PORTS];
cf_t *pdcch_d; cf_t *pdcch_d;
uint8_t *pdcch_e; uint8_t *pdcch_e;
float pdcch_rm_f[3 * (DCI_MAX_BITS + 16)]; float pdcch_rm_f[3 * (DCI_MAX_BITS + 16)];
@ -71,7 +71,7 @@ typedef struct SRSLTE_API {
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod; modem_table_t mod;
demod_soft_t demod; demod_soft_t demod;
sequence_t seq_pdcch[NSUBFRAMES_X_FRAME]; sequence_t seq_pdcch[SRSLTE_NSUBFRAMES_X_FRAME];
viterbi_t decoder; viterbi_t decoder;
crc_t crc; crc_t crc;
precoding_t precoding; precoding_t precoding;
@ -80,7 +80,7 @@ typedef struct SRSLTE_API {
SRSLTE_API int pdcch_init(pdcch_t *q, SRSLTE_API int pdcch_init(pdcch_t *q,
regs_t *regs, regs_t *regs,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void pdcch_free(pdcch_t *q); 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_msg_t *msg,
dci_location_t location, dci_location_t location,
uint16_t rnti, uint16_t rnti,
cf_t *sf_symbols[MAX_PORTS], cf_t *sf_symbols[SRSLTE_MAX_PORTS],
uint32_t nsubframe, uint32_t nsubframe,
uint32_t cfi); uint32_t cfi);
/* Decoding functions: Extract the LLRs and save them in the pdcch_t object */ /* Decoding functions: Extract the LLRs and save them in the pdcch_t object */
SRSLTE_API int pdcch_extract_llr(pdcch_t *q, SRSLTE_API int pdcch_extract_llr(pdcch_t *q,
cf_t *sf_symbols, cf_t *sf_symbols,
cf_t *ce[MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint32_t nsubframe, uint32_t nsubframe,
uint32_t cfi); uint32_t cfi);

@ -47,7 +47,7 @@ typedef _Complex float cf_t;
/* PDSCH object */ /* PDSCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
uint32_t max_re; uint32_t max_re;
bool rnti_is_set; bool rnti_is_set;
@ -55,16 +55,16 @@ typedef struct SRSLTE_API {
/* buffers */ /* buffers */
// void buffers are shared for tx and rx // void buffers are shared for tx and rx
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
cf_t *pdsch_symbols[MAX_PORTS]; cf_t *pdsch_symbols[SRSLTE_MAX_PORTS];
cf_t *pdsch_x[MAX_PORTS]; cf_t *pdsch_x[SRSLTE_MAX_PORTS];
cf_t *pdsch_d; cf_t *pdsch_d;
void *pdsch_e; void *pdsch_e;
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod[4]; modem_table_t mod[4];
demod_soft_t demod; demod_soft_t demod;
sequence_t seq_pdsch[NSUBFRAMES_X_FRAME]; sequence_t seq_pdsch[SRSLTE_NSUBFRAMES_X_FRAME];
precoding_t precoding; precoding_t precoding;
sch_t dl_sch; sch_t dl_sch;
@ -72,7 +72,7 @@ typedef struct SRSLTE_API {
}pdsch_t; }pdsch_t;
SRSLTE_API int pdsch_init(pdsch_t *q, SRSLTE_API int pdsch_init(pdsch_t *q,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void pdsch_free(pdsch_t *q); 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, SRSLTE_API int pdsch_encode(pdsch_t *q,
harq_t *harq_process, harq_t *harq_process,
uint8_t *data, 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, SRSLTE_API int pdsch_encode_rnti(pdsch_t *q,
harq_t *harq_process, harq_t *harq_process,
uint8_t *data, uint8_t *data,
uint16_t rnti, uint16_t rnti,
cf_t *sf_symbols[MAX_PORTS]); cf_t *sf_symbols[SRSLTE_MAX_PORTS]);
SRSLTE_API int pdsch_decode(pdsch_t *q, SRSLTE_API int pdsch_decode(pdsch_t *q,
harq_t *harq_process, harq_t *harq_process,
cf_t *sf_symbols, cf_t *sf_symbols,
cf_t *ce[MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint8_t *data); uint8_t *data);
SRSLTE_API int pdsch_decode_rnti(pdsch_t *q, SRSLTE_API int pdsch_decode_rnti(pdsch_t *q,
harq_t *harq_process, harq_t *harq_process,
cf_t *sf_symbols, cf_t *sf_symbols,
cf_t *ce[MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint16_t rnti, uint16_t rnti,
uint8_t *data); uint8_t *data);

@ -55,15 +55,15 @@ typedef _Complex float cf_t;
/* phich object */ /* phich object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
/* handler to REGs resource mapper */ /* handler to REGs resource mapper */
regs_t *regs; regs_t *regs;
/* buffers */ /* buffers */
cf_t ce[MAX_PORTS][PHICH_MAX_NSYMB]; cf_t ce[SRSLTE_MAX_PORTS][PHICH_MAX_NSYMB];
cf_t phich_symbols[MAX_PORTS][PHICH_MAX_NSYMB]; cf_t phich_symbols[SRSLTE_MAX_PORTS][PHICH_MAX_NSYMB];
cf_t phich_x[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_d[PHICH_MAX_NSYMB];
cf_t phich_d0[PHICH_MAX_NSYMB]; cf_t phich_d0[PHICH_MAX_NSYMB];
cf_t phich_z[PHICH_NBITS]; cf_t phich_z[PHICH_NBITS];
@ -74,20 +74,20 @@ typedef struct SRSLTE_API {
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod; modem_table_t mod;
demod_hard_t demod; demod_hard_t demod;
sequence_t seq_phich[NSUBFRAMES_X_FRAME]; sequence_t seq_phich[SRSLTE_NSUBFRAMES_X_FRAME];
precoding_t precoding; precoding_t precoding;
}phich_t; }phich_t;
SRSLTE_API int phich_init(phich_t *q, SRSLTE_API int phich_init(phich_t *q,
regs_t *regs, regs_t *regs,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void phich_free(phich_t *q); SRSLTE_API void phich_free(phich_t *q);
SRSLTE_API int phich_decode(phich_t *q, SRSLTE_API int phich_decode(phich_t *q,
cf_t *slot_symbols, cf_t *slot_symbols,
cf_t *ce[MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint32_t ngroup, uint32_t ngroup,
uint32_t nseq, uint32_t nseq,
@ -100,10 +100,10 @@ SRSLTE_API int phich_encode(phich_t *q,
uint32_t ngroup, uint32_t ngroup,
uint32_t nseq, uint32_t nseq,
uint32_t nsubframe, uint32_t nsubframe,
cf_t *slot_symbols[MAX_PORTS]); cf_t *slot_symbols[SRSLTE_MAX_PORTS]);
SRSLTE_API void phich_reset(phich_t *q, 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); SRSLTE_API uint32_t phich_ngroups(phich_t *q);

@ -75,12 +75,12 @@ typedef struct SRSLTE_API {
float *corr; float *corr;
// PRACH IFFT // PRACH IFFT
dft_plan_t *fft; srslte_dft_plan_t *fft;
dft_plan_t *ifft; srslte_dft_plan_t *ifft;
// ZC-sequence FFT and IFFT // ZC-sequence FFT and IFFT
dft_plan_t *zc_fft; srslte_dft_plan_t *zc_fft;
dft_plan_t *zc_ifft; srslte_dft_plan_t *zc_ifft;
}prach_t; }prach_t;

@ -68,17 +68,17 @@ typedef struct SRSLTE_API {
/* PUSCH object */ /* PUSCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
pucch_cfg_t pucch_cfg; 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 tmp_arg[PUCCH_N_SF_MAX*PUCCH_N_SEQ];
float y[PUCCH_N_SEQ]; float y[PUCCH_N_SEQ];
}pucch_t; }pucch_t;
SRSLTE_API int pucch_init(pucch_t *q, SRSLTE_API int pucch_init(pucch_t *q,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void pucch_free(pucch_t *q); 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], uint8_t bits[PUCCH_MAX_BITS],
cf_t *sf_symbols); 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, pucch_cfg_t *cfg,
lte_cp_t cp, srslte_cp_t cp,
bool is_drms, bool is_drms,
uint32_t ns, uint32_t ns,
uint32_t l, uint32_t l,
uint32_t *n_oc); uint32_t *n_oc);
SRSLTE_API int generate_n_cs_cell(lte_cell_t cell, SRSLTE_API int generate_n_cs_cell(srslte_cell_t cell,
uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB]); uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB]);
SRSLTE_API bool pucch_cfg_isvalid(pucch_cfg_t *cfg); SRSLTE_API bool pucch_cfg_isvalid(pucch_cfg_t *cfg);

@ -59,7 +59,7 @@ typedef struct {
/* PUSCH object */ /* PUSCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
pusch_hopping_cfg_t hopping_cfg; pusch_hopping_cfg_t hopping_cfg;
@ -83,7 +83,7 @@ typedef struct SRSLTE_API {
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod[4]; modem_table_t mod[4];
demod_soft_t demod; demod_soft_t demod;
sequence_t seq_pusch[NSUBFRAMES_X_FRAME]; sequence_t seq_pusch[SRSLTE_NSUBFRAMES_X_FRAME];
sequence_t seq_type2_fo; sequence_t seq_type2_fo;
sch_t dl_sch; sch_t dl_sch;
@ -92,7 +92,7 @@ typedef struct SRSLTE_API {
SRSLTE_API int pusch_init(pusch_t *q, SRSLTE_API int pusch_init(pusch_t *q,
lte_cell_t cell); srslte_cell_t cell);
SRSLTE_API void pusch_free(pusch_t *q); SRSLTE_API void pusch_free(pusch_t *q);

@ -79,7 +79,7 @@ typedef struct SRSLTE_API {
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
ra_prb_slot_t slot[2]; ra_prb_slot_t slot[2];
uint32_t lstart; uint32_t lstart;
uint32_t re_sf[NSUBFRAMES_X_FRAME]; uint32_t re_sf[SRSLTE_NSUBFRAMES_X_FRAME];
} ra_dl_alloc_t; } ra_dl_alloc_t;
typedef struct SRSLTE_API { 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_prb,
uint32_t nof_ports, uint32_t nof_ports,
uint32_t nof_ctrl_symbols, uint32_t nof_ctrl_symbols,
lte_cp_t cp); srslte_cp_t cp);
SRSLTE_API uint32_t ra_nprb_dl(ra_pdsch_t *ra, SRSLTE_API uint32_t ra_nprb_dl(ra_pdsch_t *ra,
uint32_t nof_prb); uint32_t nof_prb);

@ -57,7 +57,7 @@ typedef struct SRSLTE_API {
}regs_ch_t; }regs_ch_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_cell_t cell; srslte_cell_t cell;
uint32_t max_ctrl_symbols; uint32_t max_ctrl_symbols;
uint32_t cfi; uint32_t cfi;
bool cfi_initiated; bool cfi_initiated;
@ -76,7 +76,7 @@ typedef struct SRSLTE_API {
}regs_t; }regs_t;
SRSLTE_API int regs_init(regs_t *h, 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 void regs_free(regs_t *h);
SRSLTE_API int regs_set_cfi(regs_t *h, SRSLTE_API int regs_set_cfi(regs_t *h,

@ -37,20 +37,20 @@ typedef _Complex float cf_t;
/************* STATIC LINEAR INTERPOLATION FUNCTIONS */ /************* 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); 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); 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, cf_t *output,
uint32_t M, uint32_t M,
uint32_t len, uint32_t len,
uint32_t off_st, uint32_t off_st,
uint32_t off_end); uint32_t off_end);
SRSLTE_API void interp_linear_f(float *input, SRSLTE_API void srslte_interp_linear_f(float *input,
float *output, float *output,
uint32_t M, uint32_t M,
uint32_t len); uint32_t len);
@ -62,14 +62,14 @@ SRSLTE_API void interp_linear_f(float *input,
typedef struct { typedef struct {
cf_t *diff_vec; cf_t *diff_vec;
uint32_t vector_len; 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); 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 *in0,
cf_t *in1, cf_t *in1,
cf_t *between, cf_t *between,
@ -85,15 +85,15 @@ typedef struct {
float *ramp; float *ramp;
uint32_t vector_len; uint32_t vector_len;
uint32_t M; 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 vector_len,
uint32_t M); 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 *input,
cf_t *output, cf_t *output,
uint32_t off_st, uint32_t off_st,

@ -77,7 +77,7 @@ SRSLTE_API void scrambling_c_offset(sequence_t *s,
#define SCRAMBLING_PUCCH 5 #define SCRAMBLING_PUCCH 5
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
sequence_t seq[NSUBFRAMES_X_FRAME]; sequence_t seq[SRSLTE_NSUBFRAMES_X_FRAME];
}scrambling_t; }scrambling_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {

@ -67,7 +67,7 @@ typedef _Complex float cf_t; /* this is only a shortcut */
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
dft_plan_t dftp_input; srslte_dft_plan_t dftp_input;
#ifdef CONVOLUTION_FFT #ifdef CONVOLUTION_FFT
conv_fft_cc_t conv_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, SRSLTE_API void pss_put_slot(cf_t *pss_signal,
cf_t *slot, cf_t *slot,
uint32_t nof_prb, uint32_t nof_prb,
lte_cp_t cp); srslte_cp_t cp);
SRSLTE_API void pss_synch_set_ema_alpha(pss_synch_t *q, SRSLTE_API void pss_synch_set_ema_alpha(pss_synch_t *q,
float alpha); float alpha);

@ -62,7 +62,7 @@ struct fc_tables{
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
dft_plan_t dftp_input; srslte_dft_plan_t dftp_input;
uint32_t fft_size; uint32_t fft_size;
@ -96,7 +96,7 @@ SRSLTE_API void sss_generate(float *signal0,
SRSLTE_API void sss_put_slot(float *sss, SRSLTE_API void sss_put_slot(float *sss,
cf_t *symbol, cf_t *symbol,
uint32_t nof_prb, 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, SRSLTE_API int sss_synch_set_N_id_2(sss_synch_t *q,
uint32_t N_id_2); uint32_t N_id_2);

@ -71,7 +71,7 @@ typedef struct SRSLTE_API {
bool detect_cp; bool detect_cp;
bool sss_en; bool sss_en;
bool correct_cfo; bool correct_cfo;
lte_cp_t cp; srslte_cp_t cp;
uint32_t m0; uint32_t m0;
uint32_t m1; uint32_t m1;
float m0_value; float m0_value;
@ -97,7 +97,7 @@ SRSLTE_API int sync_find(sync_t *q,
uint32_t *peak_position); uint32_t *peak_position);
/* Estimates the CP length */ /* 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, cf_t *input,
uint32_t peak_pos); 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); SRSLTE_API float sync_get_cfo(sync_t *q);
/* Gets the CP length estimation from the last call to synch_run() */ /* 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) */ /* 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 */ /* Enables/Disables SSS detection */
SRSLTE_API void sync_sss_en(sync_t *q, SRSLTE_API void sync_sss_en(sync_t *q,

@ -64,7 +64,7 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t cell_id; uint32_t cell_id;
lte_cp_t cp; srslte_cp_t cp;
float peak; float peak;
float mode; float mode;
float psr; float psr;

@ -61,15 +61,15 @@ typedef struct SRSLTE_API {
pdsch_t pdsch; pdsch_t pdsch;
harq_t harq_process[NOF_HARQ_PROCESSES]; harq_t harq_process[NOF_HARQ_PROCESSES];
regs_t regs; regs_t regs;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
ra_pdsch_t ra_dl; ra_pdsch_t ra_dl;
lte_cell_t cell; srslte_cell_t cell;
cf_t *sf_symbols; cf_t *sf_symbols;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
uint64_t pkt_errors; uint64_t pkt_errors;
uint64_t pkts_total; uint64_t pkts_total;
@ -80,7 +80,7 @@ typedef struct SRSLTE_API {
/* This function shall be called just after the initial synchronization */ /* This function shall be called just after the initial synchronization */
SRSLTE_API int ue_dl_init(ue_dl_t *q, 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); SRSLTE_API void ue_dl_free(ue_dl_t *q);

@ -56,7 +56,7 @@
#include "srslte/common/fft.h" #include "srslte/common/fft.h"
#define MIB_MAX_PORTS 4 #define MIB_SRSLTE_MAX_PORTS 4
#define MIB_NOF_PRB 6 #define MIB_NOF_PRB 6
#define MIB_FOUND 1 #define MIB_FOUND 1
@ -66,10 +66,10 @@ typedef struct SRSLTE_API {
sync_t sfind; sync_t sfind;
cf_t *sf_symbols; cf_t *sf_symbols;
cf_t *ce[MIB_MAX_PORTS]; cf_t *ce[MIB_SRSLTE_MAX_PORTS];
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
pbch_t pbch; pbch_t pbch;
uint8_t bch_payload[BCH_PAYLOAD_LEN]; uint8_t bch_payload[BCH_PAYLOAD_LEN];
@ -80,7 +80,7 @@ typedef struct SRSLTE_API {
} ue_mib_t; } ue_mib_t;
SRSLTE_API int ue_mib_init(ue_mib_t *q, 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); 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, SRSLTE_API int ue_mib_sync_init(ue_mib_sync_t *q,
uint32_t cell_id, uint32_t cell_id,
lte_cp_t cp, srslte_cp_t cp,
int (recv_callback)(void*, void*, uint32_t, timestamp_t *), int (recv_callback)(void*, void*, uint32_t, timestamp_t *),
void *stream_handler); void *stream_handler);

@ -90,7 +90,7 @@ typedef struct SRSLTE_API {
/* this is the system frame number (SFN) */ /* this is the system frame number (SFN) */
uint32_t frame_number; uint32_t frame_number;
lte_cell_t cell; srslte_cell_t cell;
uint32_t sf_idx; uint32_t sf_idx;
bool decode_sss_on_track; bool decode_sss_on_track;
@ -106,7 +106,7 @@ typedef struct SRSLTE_API {
SRSLTE_API int ue_sync_init(ue_sync_t *q, 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*), int (recv_callback)(void*, void*, uint32_t, timestamp_t*),
void *stream_handler); void *stream_handler);

@ -50,17 +50,17 @@
#define NOF_HARQ_PROCESSES 8 #define NOF_HARQ_PROCESSES 8
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
lte_fft_t fft; srslte_fft_t fft;
cfo_t cfo; cfo_t cfo;
lte_cell_t cell; srslte_cell_t cell;
bool normalize_en; bool normalize_en;
float current_cfo; 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]; harq_t harq_process[NOF_HARQ_PROCESSES];
pusch_t pusch; pusch_t pusch;
@ -72,7 +72,7 @@ typedef struct SRSLTE_API {
/* This function shall be called just after the initial synchronization */ /* This function shall be called just after the initial synchronization */
SRSLTE_API int ue_ul_init(ue_ul_t *q, 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); 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); bool enabled);
SRSLTE_API void ue_ul_set_pusch_cfg(ue_ul_t *q, 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); pusch_hopping_cfg_t *pusch_hopping_cfg);
SRSLTE_API int ue_ul_pusch_encode(ue_ul_t *q, SRSLTE_API int ue_ul_pusch_encode(ue_ul_t *q,

@ -42,9 +42,9 @@ typedef struct SRSLTE_API {
uint32_t input_len; uint32_t input_len;
uint32_t filter_len; uint32_t filter_len;
uint32_t output_len; uint32_t output_len;
dft_plan_t input_plan; srslte_dft_plan_t input_plan;
dft_plan_t filter_plan; srslte_dft_plan_t filter_plan;
dft_plan_t output_plan; srslte_dft_plan_t output_plan;
}conv_fft_cc_t; }conv_fft_cc_t;
SRSLTE_API int conv_fft_cc_init(conv_fft_cc_t *q, SRSLTE_API int conv_fft_cc_init(conv_fft_cc_t *q,

@ -65,31 +65,31 @@ typedef struct SRSLTE_API {
bool dc; // Handle insertion/removal of null DC carrier internally? bool dc; // Handle insertion/removal of null DC carrier internally?
dft_dir_t dir; // Forward/Backward dft_dir_t dir; // Forward/Backward
dft_mode_t mode; // Complex/Real dft_mode_t mode; // Complex/Real
}dft_plan_t; }srslte_dft_plan_t;
typedef _Complex float dft_c_t; typedef _Complex float dft_c_t;
typedef float dft_r_t; typedef float dft_r_t;
/* Create DFT plans */ /* 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); 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_c(srslte_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 int dft_plan_r(srslte_dft_plan_t *plan, const int dft_points, dft_dir_t dir);
SRSLTE_API void dft_plan_free(dft_plan_t *plan); SRSLTE_API void dft_plan_free(srslte_dft_plan_t *plan);
/* Set options */ /* Set options */
SRSLTE_API void dft_plan_set_mirror(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(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(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(dft_plan_t *plan, bool val); SRSLTE_API void dft_plan_set_dc(srslte_dft_plan_t *plan, bool val);
/* Compute DFT */ /* Compute DFT */
SRSLTE_API void dft_run(dft_plan_t *plan, void *in, void *out); SRSLTE_API void dft_run(srslte_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_c(srslte_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_r(srslte_dft_plan_t *plan, dft_r_t *in, dft_r_t *out);
#endif // DFT_H_ #endif // DFT_H_

@ -52,34 +52,34 @@
* *
* The equalizer uses the channel estimates to produce an estimation of the transmitted symbol. * 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL && if (q != NULL &&
lte_cell_isvalid(&cell)) 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) { if (ret != SRSLTE_SUCCESS) {
fprintf(stderr, "Error initializing CSR signal (%d)\n",ret); fprintf(stderr, "Error initializing CSR signal (%d)\n",ret);
goto clean_exit; 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) { if (!q->tmp_freqavg) {
perror("malloc"); perror("malloc");
goto clean_exit; 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) { if (!q->tmp_noise) {
perror("malloc"); perror("malloc");
goto clean_exit; goto clean_exit;
} }
for (int i=0;i<CHEST_MAX_FILTER_TIME_LEN;i++) { for (int i=0;i<SRSLTE_CHEST_MAX_FILTER_TIME_LEN;i++) {
q->tmp_timeavg[i] = vec_malloc(sizeof(cf_t) * 2*cell.nof_prb); q->tmp_timeavg[i] = vec_malloc(sizeof(cf_t) * 2*cell.nof_prb);
if (!q->tmp_timeavg[i]) { if (!q->tmp_timeavg[i]) {
perror("malloc"); 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); bzero(q->tmp_timeavg_mult, sizeof(cf_t) * 2*cell.nof_prb);
for (int i=0;i<cell.nof_ports;i++) { for (int i=0;i<cell.nof_ports;i++) {
q->pilot_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]) { if (!q->pilot_estimates[i]) {
perror("malloc"); perror("malloc");
goto clean_exit; 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]) { if (!q->pilot_estimates_average[i]) {
perror("malloc"); perror("malloc");
goto clean_exit; 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]) { if (!q->pilot_recv_signal[i]) {
perror("malloc"); perror("malloc");
goto clean_exit; 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"); fprintf(stderr, "Error initializing vector interpolator\n");
goto clean_exit; 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"); fprintf(stderr, "Error initializing interpolator\n");
goto clean_exit; goto clean_exit;
} }
/* Set default time/freq filters */ /* Set default time/freq filters */
//float f[3]={0.1, 0.8, 0.1}; //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}; 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}; 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; q->cell = cell;
} }
@ -139,14 +139,14 @@ int chest_dl_init(chest_dl_t *q, lte_cell_t cell)
clean_exit: clean_exit:
if (ret != SRSLTE_SUCCESS) { if (ret != SRSLTE_SUCCESS) {
chest_dl_free(q); srslte_chest_dl_free(q);
} }
return ret; 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) { if (q->tmp_freqavg) {
free(q->tmp_freqavg); free(q->tmp_freqavg);
@ -154,7 +154,7 @@ void chest_dl_free(chest_dl_t *q)
if (q->tmp_noise) { if (q->tmp_noise) {
free(q->tmp_noise); free(q->tmp_noise);
} }
for (int i=0;i<CHEST_MAX_FILTER_TIME_LEN;i++) { for (int i=0;i<SRSLTE_CHEST_MAX_FILTER_TIME_LEN;i++) {
if (q->tmp_timeavg[i]) { if (q->tmp_timeavg[i]) {
free(q->tmp_timeavg[i]); free(q->tmp_timeavg[i]);
} }
@ -162,10 +162,10 @@ void chest_dl_free(chest_dl_t *q)
if (q->tmp_timeavg_mult) { if (q->tmp_timeavg_mult) {
free(q->tmp_timeavg_mult); free(q->tmp_timeavg_mult);
} }
interp_linear_vector_free(&q->interp_linvec); srslte_interp_linear_vector_free(&q->srslte_interp_linvec);
interp_linear_free(&q->interp_lin); srslte_interp_linear_free(&q->srslte_interp_lin);
for (int i=0;i<MAX_PORTS;i++) { for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
if (q->pilot_estimates[i]) { if (q->pilot_estimates[i]) {
free(q->pilot_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]); 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) { int srslte_chest_dl_set_filter_freq(srslte_chest_dl_t *q, float *filter, uint32_t filter_len) {
if (filter_len <= CHEST_MAX_FILTER_FREQ_LEN) { if (filter_len <= SRSLTE_CHEST_MAX_FILTER_FREQ_LEN) {
q->filter_freq_len = filter_len; q->filter_freq_len = filter_len;
for (int i=0;i<filter_len;i++) { for (int i=0;i<filter_len;i++) {
q->filter_freq[i] = filter[i]; q->filter_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) { int srslte_chest_dl_set_filter_time(srslte_chest_dl_t *q, float *filter, uint32_t filter_len) {
if (filter_len <= CHEST_MAX_FILTER_TIME_LEN) { if (filter_len <= SRSLTE_CHEST_MAX_FILTER_TIME_LEN) {
q->filter_time_len = filter_len; q->filter_time_len = filter_len;
for (int i=0;i<filter_len;i++) { for (int i=0;i<filter_len;i++) {
q->filter_time[i] = filter[i]; q->filter_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 #ifdef NOISE_POWER_USE_ESTIMATES
/* Uses the difference between the averaged and non-averaged pilot 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 */ /* Use difference between averaged and noisy LS pilot estimates */
vec_sub_ccc(avg_pilots, q->pilot_estimates[port_id], 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 #else
/* Uses the 5 empty transmitted SC before and after the SSS and PSS sequences for noise estimation */ /* 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; 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; float noise_power = 0;
noise_power += vec_avg_power_cf(&input[k_sss-5], 5); // 5 empty SC before SSS 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 #endif
#define pilot_est(idx) q->pilot_estimates[port_id][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][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[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; int nref=2*q->cell.nof_prb;
uint32_t l, i; uint32_t l, i;
/* For each symbol with pilots in a slot */ /* For each symbol with pilots in a slot */
for (l=0;l<refsignal_cs_nof_symbols(port_id);l++) { for (l=0;l<srslte_refsignal_cs_nof_symbols(port_id);l++) {
if (q->filter_freq_len > 0) { if (q->filter_freq_len > 0) {
/* Filter pilot estimates in frequency */ /* Filter pilot estimates in frequency */
conv_same_cf(&pilot_est(0), q->filter_freq, &pilot_tmp(0), nref, q->filter_freq_len); conv_same_cf(&pilot_est(0), q->filter_freq, &pilot_tmp(0), nref, q->filter_freq_len);
/* Adjust extremes using linear interpolation */ /* 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; * 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; * q->filter_freq[q->filter_freq_len/2+1]*1.2;
} else { } else {
memcpy(&pilot_tmp(0), &pilot_est(0), nref * sizeof(cf_t)); 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); q->noise_estimate[port_id] = estimate_noise_port(q, port_id, q->tmp_freqavg);
#endif #endif
for (l=0;l<refsignal_cs_nof_symbols(port_id);l++) { for (l=0;l<srslte_refsignal_cs_nof_symbols(port_id);l++) {
/* Filter in time domain. */ /* Filter in time domain. */
if (q->filter_time_len > 0) { if (q->filter_time_len > 0) {
/* Move last symbols */ /* 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)] #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 */ /* interpolate the symbols with references in the freq domain */
uint32_t l; 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 */ /* Interpolate in the frequency domain */
for (l=0;l<nsymbols;l++) { for (l=0;l<nsymbols;l++) {
uint32_t fidx_offset = refsignal_cs_fidx(q->cell, l, port_id, 0); uint32_t fidx_offset = srslte_refsignal_cs_fidx(q->cell, l, port_id, 0);
interp_linear_offset(&q->interp_lin, &pilot_avg(0), srslte_interp_linear_offset(&q->srslte_interp_lin, &pilot_avg(0),
&ce[refsignal_cs_nsymbol(l,q->cell.cp, port_id) * q->cell.nof_prb * RE_X_RB], &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); fidx_offset, RE_X_RB/2-fidx_offset);
} }
/* Now interpolate in the time domain between symbols */ /* Now interpolate in the time domain between symbols */
if (CP_ISNORM(q->cell.cp)) { if (CP_ISNORM(q->cell.cp)) {
if (nsymbols == 4) { if (nsymbols == 4) {
interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 3); srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 3);
interp_linear_vector(&q->interp_linvec, &cesymb(4), &cesymb(7), &cesymb(5), 2); srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(4), &cesymb(7), &cesymb(5), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(11), &cesymb(8), 3); srslte_interp_linear_vector(&q->srslte_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(7), &cesymb(11), &cesymb(12), 2);
} else { } else {
interp_linear_vector(&q->interp_linvec, &cesymb(8), &cesymb(1), &cesymb(0), 1); srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(8), &cesymb(1), &cesymb(0), 1);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(8), &cesymb(2), 6); srslte_interp_linear_vector(&q->srslte_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(1), &cesymb(8), &cesymb(9), 5);
} }
} else { } else {
if (nsymbols == 4) { if (nsymbols == 4) {
interp_linear_vector(&q->interp_linvec, &cesymb(0), &cesymb(3), &cesymb(1), 2); srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(0), &cesymb(3), &cesymb(1), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(3), &cesymb(6), &cesymb(4), 2); srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(3), &cesymb(6), &cesymb(4), 2);
interp_linear_vector(&q->interp_linvec, &cesymb(6), &cesymb(9), &cesymb(7), 2); srslte_interp_linear_vector(&q->srslte_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(6), &cesymb(9), &cesymb(9), 2);
} else { } else {
interp_linear_vector(&q->interp_linvec, &cesymb(7), &cesymb(1), &cesymb(0), 1); srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(7), &cesymb(1), &cesymb(0), 1);
interp_linear_vector(&q->interp_linvec, &cesymb(1), &cesymb(7), &cesymb(2), 5); srslte_interp_linear_vector(&q->srslte_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(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; uint32_t l;
float rssi = 0; 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;l<nsymbols;l++) { for (l=0;l<nsymbols;l++) {
cf_t *tmp = &input[refsignal_cs_nsymbol(l, q->cell.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); rssi += vec_dot_prod_conj_ccc(tmp, tmp, q->cell.nof_prb * RE_X_RB);
} }
return rssi/nsymbols; 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 //#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 #ifdef RSRP_FROM_ESTIMATES
return vec_avg_power_cf(q->pilot_estimates[port_id], 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 #else
return vec_avg_power_cf(q->pilot_estimates_average[port_id], 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 #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 */ /* 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 */ /* 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], 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 pilot estimates */
average_pilots(q, port_id); average_pilots(q, port_id);
/* Compute RSRP for the channel estimates in this port */ /* 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) { if (port_id == 0) {
/* compute rssi only for port 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 */ /* 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; 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; uint32_t port_id;
for (port_id=0;port_id<q->cell.nof_ports;port_id++) { for (port_id=0;port_id<q->cell.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; 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; float noise = vec_acc_ff(q->noise_estimate, q->cell.nof_ports)/q->cell.nof_ports;
#ifdef NOISE_POWER_USE_ESTIMATES #ifdef NOISE_POWER_USE_ESTIMATES
return noise*sqrtf(lte_symbol_sz(q->cell.nof_prb)); 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 // 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; 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->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). * 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]; 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 sum of power received from all tx ports
return vec_acc_ff(q->rsrp, q->cell.nof_ports); return vec_acc_ff(q->rsrp, q->cell.nof_ports);

@ -38,7 +38,7 @@
#include "srslte/utils/debug.h" #include "srslte/utils/debug.h"
#include "srslte/common/sequence.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; uint32_t v = 0;
switch (port_id) { switch (port_id) {
@ -74,7 +74,7 @@ uint32_t refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx)
return v; 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) { if (port_id < 2) {
return 4; 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) { inline uint32_t srslte_refsignal_cs_fidx(srslte_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); 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 (port_id < 2) {
if (l % 2) { if (l % 2) {
return (l/2+1)*CP_NSYMB(cp) - 3; 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 /** Allocates and precomputes the Cell-Specific Reference (CSR) signal for
* the 20 slots in a subframe * 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; uint32_t c_init;
@ -117,7 +117,7 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell)
{ {
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;
bzero(q, sizeof(refsignal_cs_t)); bzero(q, sizeof(srslte_refsignal_cs_t));
bzero(&seq, sizeof(sequence_t)); bzero(&seq, sizeof(sequence_t));
if (sequence_init(&seq, 2 * 2 * MAX_PRB)) { if (sequence_init(&seq, 2 * 2 * MAX_PRB)) {
goto free_and_exit; goto free_and_exit;
@ -132,8 +132,8 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell)
q->cell = cell; q->cell = cell;
for (p=0;p<2;p++) { for (p=0;p<2;p++) {
for (i=0;i<NSUBFRAMES_X_FRAME;i++) { for (i=0;i<SRSLTE_NSUBFRAMES_X_FRAME;i++) {
q->pilots[p][i] = vec_malloc(sizeof(cf_t) * REFSIGNAL_NUM_SF(q->cell.nof_prb, 2*p)); q->pilots[p][i] = vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, 2*p));
if (!q->pilots[p][i]) { if (!q->pilots[p][i]) {
perror("malloc"); perror("malloc");
goto free_and_exit; goto free_and_exit;
@ -141,12 +141,12 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell)
} }
} }
for (ns=0;ns<NSLOTS_X_FRAME;ns++) { for (ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) {
for (p=0;p<2;p++) { for (p=0;p<2;p++) {
uint32_t nsymbols = refsignal_cs_nof_symbols(2*p)/2; uint32_t nsymbols = srslte_refsignal_cs_nof_symbols(2*p)/2;
for (l = 0; l < nsymbols; l++) { for (l = 0; l < nsymbols; l++) {
/* Compute sequence init value */ /* Compute sequence init value */
uint32_t lp = refsignal_cs_nsymbol(l, cell.cp, 2*p); uint32_t lp = srslte_refsignal_cs_nsymbol(l, cell.cp, 2*p);
c_init = 1024 * (7 * (ns + 1) + lp + 1) * (2 * cell.id + 1) c_init = 1024 * (7 * (ns + 1) + lp + 1) * (2 * cell.id + 1)
+ 2 * cell.id + N_cp; + 2 * cell.id + N_cp;
@ -157,7 +157,7 @@ int refsignal_cs_init(refsignal_cs_t * q, lte_cell_t cell)
for (i = 0; i < 2*q->cell.nof_prb; i++) { for (i = 0; i < 2*q->cell.nof_prb; i++) {
mp = i + MAX_PRB - cell.nof_prb; mp = i + MAX_PRB - cell.nof_prb;
/* save signal */ /* 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) + (1 - 2 * (float) seq.c[2 * mp]) / sqrt(2) +
_Complex_I * (1 - 2 * (float) seq.c[2 * mp + 1]) / 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: free_and_exit:
if (ret == SRSLTE_ERROR) { if (ret == SRSLTE_ERROR) {
sequence_free(&seq); sequence_free(&seq);
refsignal_cs_free(q); srslte_refsignal_cs_free(q);
} }
return ret; return ret;
} }
/** Deallocates a refsignal_cs_t object allocated with refsignal_cs_init */ /** Deallocates a srslte_refsignal_cs_t object allocated with srslte_refsignal_cs_init */
void refsignal_cs_free(refsignal_cs_t * q) void srslte_refsignal_cs_free(srslte_refsignal_cs_t * q)
{ {
int i, p; int i, p;
for (p=0;p<2;p++) { for (p=0;p<2;p++) {
for (i=0;i<NSUBFRAMES_X_FRAME;i++) { for (i=0;i<SRSLTE_NSUBFRAMES_X_FRAME;i++) {
if (q->pilots[p][i]) { if (q->pilots[p][i]) {
free(q->pilots[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 */ /* Maps a reference signal initialized with srslte_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) 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 i, l;
uint32_t fidx; 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) sf_symbols != NULL)
{ {
for (l=0;l<refsignal_cs_nof_symbols(port_id);l++) { for (l=0;l<srslte_refsignal_cs_nof_symbols(port_id);l++) {
uint32_t nsymbol = refsignal_cs_nsymbol(l, cell.cp, port_id); uint32_t nsymbol = srslte_refsignal_cs_nsymbol(l, cell.cp, port_id);
/* Compute offset frequency index */ /* Compute offset frequency index */
fidx = ((refsignal_cs_v(port_id, l) + (cell.id % 6)) % 6); fidx = ((srslte_refsignal_cs_v(port_id, l) + (cell.id % 6)) % 6);
for (i = 0; i < 2*cell.nof_prb; i++) { for (i = 0; i < 2*cell.nof_prb; i++) {
sf_symbols[RE_IDX(cell.nof_prb, nsymbol, fidx)] = pilots[REFSIGNAL_PILOT_IDX(i,l,cell)]; sf_symbols[RE_IDX(cell.nof_prb, nsymbol, fidx)] = pilots[SRSLTE_REFSIGNAL_PILOT_IDX(i,l,cell)];
fidx += RE_X_RB/2; // 1 reference every 6 RE fidx += RE_X_RB/2; // 1 reference every 6 RE
} }
} }
@ -223,7 +223,7 @@ int refsignal_cs_put_sf(lte_cell_t cell, uint32_t port_id, cf_t *pilots, cf_t *s
* csr_signal[0] is the signal for the first OFDM symbol containing references and csr_signal[1] is the * csr_signal[0] is the signal for the first OFDM symbol containing references and csr_signal[1] is the
* second OFDM symbol containing references (symbol 4 or 3 if port_id < 2) * second OFDM symbol containing references (symbol 4 or 3 if port_id < 2)
*/ */
int refsignal_cs_get_sf(lte_cell_t cell, uint32_t port_id, cf_t *sf_symbols, cf_t *pilots) int srslte_refsignal_cs_get_sf(srslte_cell_t cell, uint32_t port_id, cf_t *sf_symbols, cf_t *pilots)
{ {
uint32_t i, l; uint32_t i, l;
uint32_t fidx; uint32_t fidx;
@ -233,12 +233,12 @@ int refsignal_cs_get_sf(lte_cell_t cell, uint32_t port_id, cf_t *sf_symbols, cf_
pilots != NULL && pilots != NULL &&
sf_symbols != NULL) sf_symbols != NULL)
{ {
for (l=0;l<refsignal_cs_nof_symbols(port_id);l++) { for (l=0;l<srslte_refsignal_cs_nof_symbols(port_id);l++) {
uint32_t nsymbol = refsignal_cs_nsymbol(l, cell.cp, port_id); uint32_t nsymbol = srslte_refsignal_cs_nsymbol(l, cell.cp, port_id);
/* Compute offset frequency index */ /* Compute offset frequency index */
fidx = ((refsignal_cs_v(port_id, l) + (cell.id % 6)) % 6); fidx = ((srslte_refsignal_cs_v(port_id, l) + (cell.id % 6)) % 6);
for (i = 0; i < 2*cell.nof_prb; i++) { for (i = 0; i < 2*cell.nof_prb; i++) {
pilots[REFSIGNAL_PILOT_IDX(i,l,cell)] = sf_symbols[RE_IDX(cell.nof_prb, nsymbol, fidx)]; pilots[SRSLTE_REFSIGNAL_PILOT_IDX(i,l,cell)] = sf_symbols[RE_IDX(cell.nof_prb, nsymbol, fidx)];
fidx += RE_X_RB/2; // 2 references per PRB fidx += RE_X_RB/2; // 2 references per PRB
} }
} }

@ -64,19 +64,19 @@ uint32_t pucch_symbol_format2_cpnorm[2] = {1, 5};
uint32_t pucch_symbol_format2_cpext[1] = {3}; uint32_t pucch_symbol_format2_cpext[1] = {3};
/** Computes n_prs values used to compute alpha as defined in 5.5.2.1.1 of 36.211 */ /** Computes n_prs values used to compute alpha as defined in 5.5.2.1.1 of 36.211 */
static int generate_n_prs(refsignal_ul_t * q) { static int generate_n_prs(srslte_refsignal_ul_t * q) {
/* Calculate n_prs */ /* Calculate n_prs */
uint32_t c_init; uint32_t c_init;
sequence_t seq; sequence_t seq;
bzero(&seq, sizeof(sequence_t)); bzero(&seq, sizeof(sequence_t));
for (uint32_t delta_ss=0;delta_ss<NOF_DELTA_SS;delta_ss++) { for (uint32_t delta_ss=0;delta_ss<SRSLTE_NOF_DELTA_SS;delta_ss++) {
c_init = ((q->cell.id / 30) << 5) + (((q->cell.id % 30) + delta_ss) % 30); c_init = ((q->cell.id / 30) << 5) + (((q->cell.id % 30) + delta_ss) % 30);
if (sequence_LTE_pr(&seq, 8 * CP_NSYMB(q->cell.cp) * 20, c_init)) { if (sequence_LTE_pr(&seq, 8 * CP_NSYMB(q->cell.cp) * 20, c_init)) {
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
for (uint32_t ns=0;ns<NSLOTS_X_FRAME;ns++) { for (uint32_t ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) {
uint32_t n_prs = 0; uint32_t n_prs = 0;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
n_prs += (seq.c[8 * CP_NSYMB(q->cell.cp) * ns + i] << i); n_prs += (seq.c[8 * CP_NSYMB(q->cell.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 */ /** 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; sequence_t seq;
bzero(&seq, sizeof(sequence_t)); bzero(&seq, sizeof(sequence_t));
@ -98,7 +98,7 @@ static int generate_group_hopping_f_gh(refsignal_ul_t *q) {
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
for (uint32_t ns=0;ns<NSLOTS_X_FRAME;ns++) { for (uint32_t ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) {
uint32_t f_gh = 0; uint32_t f_gh = 0;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
f_gh += (((uint32_t) seq.c[8 * ns + i]) << i); f_gh += (((uint32_t) seq.c[8 * ns + i]) << i);
@ -110,12 +110,12 @@ static int generate_group_hopping_f_gh(refsignal_ul_t *q) {
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
static int generate_sequence_hopping_v(refsignal_ul_t *q) { static int generate_sequence_hopping_v(srslte_refsignal_ul_t *q) {
sequence_t seq; sequence_t seq;
bzero(&seq, sizeof(sequence_t)); bzero(&seq, sizeof(sequence_t));
for (uint32_t ns=0;ns<NSLOTS_X_FRAME;ns++) { for (uint32_t ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) {
for (uint32_t delta_ss=0;delta_ss<NOF_DELTA_SS;delta_ss++) { for (uint32_t delta_ss=0;delta_ss<SRSLTE_NOF_DELTA_SS;delta_ss++) {
if (sequence_LTE_pr(&seq, 20, ((q->cell.id / 30) << 5) + ((q->cell.id%30)+delta_ss)%30)) { if (sequence_LTE_pr(&seq, 20, ((q->cell.id / 30) << 5) + ((q->cell.id%30)+delta_ss)%30)) {
return SRSLTE_ERROR; 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL && lte_cell_isvalid(&cell)) { if (q != NULL && lte_cell_isvalid(&cell)) {
bzero(q, sizeof(refsignal_ul_t)); bzero(q, sizeof(srslte_refsignal_ul_t));
q->cell = cell; q->cell = cell;
// Allocate temporal buffer for computing signal argument // 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: free_and_exit:
if (ret == SRSLTE_ERROR) { if (ret == SRSLTE_ERROR) {
refsignal_ul_free(q); srslte_refsignal_ul_free(q);
} }
return ret; return ret;
} }
void refsignal_ul_free(refsignal_ul_t * q) { void srslte_refsignal_ul_free(srslte_refsignal_ul_t * q) {
if (q->tmp_arg) { if (q->tmp_arg) {
free(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 */ /* 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) { if (nof_prb == 1) {
arg_r_uv_1prb(q->tmp_arg, u); arg_r_uv_1prb(q->tmp_arg, u);
} else if (nof_prb == 2) { } 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 */ /* 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; uint32_t n_drms_2_val = 0;
if (cfg->en_drms_2) { if (cfg->en_drms_2) {
n_drms_2_val = n_drms_2[cfg->cyclic_shift_for_drms]; 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) { 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 < NOF_CSHIFT && if (cfg->cyclic_shift < SRSLTE_NOF_CSHIFT &&
cfg->cyclic_shift_for_drms < NOF_CSHIFT && cfg->cyclic_shift_for_drms < SRSLTE_NOF_CSHIFT &&
cfg->delta_ss < NOF_DELTA_SS && cfg->delta_ss < SRSLTE_NOF_DELTA_SS &&
nof_prb < q->cell.nof_prb) { nof_prb < q->cell.nof_prb) {
return true; return true;
} else { } 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, cf_t *r_pusch,
uint32_t nof_prb, uint32_t nof_prb,
uint32_t n_prb[2], 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 */ /* 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; 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; ret = SRSLTE_ERROR;
for (uint32_t ns=2*sf_idx;ns<2*(sf_idx+1);ns++) { 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; 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (pucch_cfg_isvalid(cfg)) { 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; 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)
{ {
} }

@ -33,7 +33,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1000, // cell_id 1000, // cell_id
@ -82,7 +82,7 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
chest_dl_t est; srslte_chest_dl_t est;
precoding_t cheq; precoding_t cheq;
cf_t *input = NULL, *ce = NULL, *h = NULL, *output = NULL; cf_t *input = NULL, *ce = NULL, *h = NULL, *output = NULL;
int i, j, n_port, sf_idx, cid, num_re; int i, j, n_port, sf_idx, cid, num_re;
@ -135,7 +135,7 @@ int main(int argc, char **argv) {
while(cid <= max_cid) { while(cid <= max_cid) {
cell.id = cid; cell.id = cid;
if (chest_dl_init(&est, cell)) { if (srslte_chest_dl_init(&est, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
goto do_exit; goto do_exit;
} }
@ -151,7 +151,7 @@ int main(int argc, char **argv) {
bzero(ce, sizeof(cf_t) * num_re); bzero(ce, sizeof(cf_t) * num_re);
bzero(h, 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); est.csr_signal.pilots[n_port/2][sf_idx], input);
for (i=0;i<2*CP_NSYMB(cell.cp);i++) { for (i=0;i<2*CP_NSYMB(cell.cp);i++) {
@ -165,7 +165,7 @@ int main(int argc, char **argv) {
struct timeval t[3]; struct timeval t[3];
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);
for (int j=0;j<100;j++) { 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); gettimeofday(&t[2], NULL);
get_time_interval(t); get_time_interval(t);
@ -188,7 +188,7 @@ int main(int argc, char **argv) {
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);
for (int j=0;j<100;j++) { 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); gettimeofday(&t[2], NULL);
get_time_interval(t); 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; cid+=10;
INFO("cid=%d\n", cid); INFO("cid=%d\n", cid);
} }

@ -62,12 +62,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
int i; int i;
lte_cell_t cell; srslte_cell_t cell;
chest_dl_t chest; srslte_chest_dl_t chest;
precoding_t cheq; precoding_t cheq;
cf_t *input_signal = NULL, *output_signal[MAX_LAYERS]; cf_t *input_signal = NULL, *output_signal[MAX_LAYERS];
cf_t *output_signal2 = NULL; cf_t *output_signal2 = NULL;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
double *outr0=NULL, *outi0=NULL; double *outr0=NULL, *outi0=NULL;
double *outr1=NULL, *outi1=NULL; double *outr1=NULL, *outi1=NULL;
double *outr2=NULL, *outi2=NULL; double *outr2=NULL, *outi2=NULL;
@ -97,7 +97,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; return;
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
mexErrMsgTxt("Error initiating channel estimator\n"); mexErrMsgTxt("Error initiating channel estimator\n");
return; return;
} }
@ -135,7 +135,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
filter[i] = (float) f[i]; 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_len = mxGetNumberOfElements(TIME_FILTER);
filter = malloc(sizeof(float) * filter_len); 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<filter_len;i++) { for (i=0;i<filter_len;i++) {
filter[i] = (float) f[i]; filter[i] = (float) f[i];
} }
chest_dl_set_filter_time(&chest, filter, filter_len); srslte_chest_dl_set_filter_time(&chest, filter, filter_len);
@ -152,11 +152,11 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
/** Allocate input buffers */ /** Allocate input buffers */
int nof_re = 2*CP_NSYMB(cell.cp)*cell.nof_prb*RE_X_RB; int nof_re = 2*CP_NSYMB(cell.cp)*cell.nof_prb*RE_X_RB;
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = vec_malloc(nof_re * sizeof(cf_t)); ce[i] = vec_malloc(nof_re * sizeof(cf_t));
} }
input_signal = vec_malloc(nof_re * sizeof(cf_t)); input_signal = vec_malloc(nof_re * sizeof(cf_t));
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
output_signal[i] = vec_malloc(nof_re * sizeof(cf_t)); output_signal[i] = vec_malloc(nof_re * sizeof(cf_t));
} }
output_signal2 = vec_malloc(nof_re * sizeof(cf_t)); output_signal2 = vec_malloc(nof_re * sizeof(cf_t));
@ -170,7 +170,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
outi0 = mxGetPi(plhs[0]); outi0 = mxGetPi(plhs[0]);
} }
if (nlhs >= 2) { if (nlhs >= 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]); outr1 = mxGetPr(plhs[1]);
outi1 = mxGetPi(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; 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"); mexErrMsgTxt("Error running channel estimator\n");
return; return;
} }
if (cell.nof_ports == 1) { 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 { } 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); 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) { if (nlhs >= 2) {
for (int j=0;j<cell.nof_ports;j++) { for (int j=0;j<cell.nof_ports;j++) {
for (i=0;i<REFSIGNAL_NUM_SF(cell.nof_prb,j);i++) { for (i=0;i<SRSLTE_REFSIGNAL_NUM_SF(cell.nof_prb,j);i++) {
*outr1 = (double) crealf(chest.pilot_estimates_average[j][i]); *outr1 = (double) crealf(chest.pilot_estimates_average[j][i]);
if (outi1) { if (outi1) {
*outi1 = (double) cimagf(chest.pilot_estimates_average[j][i]); *outi1 = (double) cimagf(chest.pilot_estimates_average[j][i]);
@ -244,16 +244,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} }
if (nlhs >= 4) { if (nlhs >= 4) {
plhs[3] = mxCreateDoubleScalar(chest_dl_get_snr(&chest)); plhs[3] = mxCreateDoubleScalar(srslte_chest_dl_get_snr(&chest));
} }
if (nlhs >= 5) { 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) { 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); precoding_free(&cheq);
return; return;

@ -39,7 +39,7 @@
void help() void help()
{ {
mexErrMsgTxt mexErrMsgTxt
("[seq] = srslte_refsignal_pusch(ueConfig, puschConfig)\n\n"); ("[seq] = srslte_srslte_refsignal_pusch(ueConfig, puschConfig)\n\n");
} }
extern int indices[2048]; extern int indices[2048];
@ -47,9 +47,9 @@ extern int indices[2048];
/* the gateway function */ /* the gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
lte_cell_t cell; srslte_cell_t cell;
refsignal_ul_t refs; srslte_refsignal_ul_t refs;
refsignal_drms_pusch_cfg_t pusch_cfg; srslte_refsignal_drms_pusch_cfg_t pusch_cfg;
uint32_t sf_idx; uint32_t sf_idx;
if (nrhs != NOF_INPUTS) { if (nrhs != NOF_INPUTS) {
@ -73,7 +73,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; 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; 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; pusch_cfg.beta_pusch = 1.0;
if (refsignal_ul_init(&refs, cell)) { if (srslte_refsignal_ul_init(&refs, cell)) {
mexErrMsgTxt("Error initiating refsignal_ul\n"); mexErrMsgTxt("Error initiating srslte_refsignal_ul\n");
return; 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)); 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); //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]; uint32_t n_prb[2];
n_prb[0] = prbset[0]; n_prb[0] = prbset[0];
n_prb[1] = 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) { if (nlhs >= 1) {
mexutils_write_cf(sf_symbols, &plhs[0], SF_LEN_RE(cell.nof_prb, cell.cp), 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(signal);
free(prbset); free(prbset);

@ -33,9 +33,9 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
100, // nof_prb 100, // nof_prb
MAX_PORTS, // nof_ports SRSLTE_MAX_PORTS, // nof_ports
1, // cell_id 1, // cell_id
CPNORM // cyclic prefix CPNORM // cyclic prefix
}; };
@ -75,8 +75,8 @@ void parse_args(int argc, char **argv) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
refsignal_ul_t refs; srslte_refsignal_ul_t refs;
refsignal_drms_pusch_cfg_t pusch_cfg; srslte_refsignal_drms_pusch_cfg_t pusch_cfg;
cf_t *signal = NULL; cf_t *signal = NULL;
int ret = -1; int ret = -1;
@ -88,7 +88,7 @@ int main(int argc, char **argv) {
goto do_exit; goto do_exit;
} }
if (refsignal_ul_init(&refs, cell)) { if (srslte_refsignal_ul_init(&refs, cell)) {
fprintf(stderr, "Error initializing UL reference signal\n"); fprintf(stderr, "Error initializing UL reference signal\n");
goto do_exit; goto do_exit;
} }
@ -96,11 +96,11 @@ int main(int argc, char **argv) {
printf("Running tests for %d PRB\n", cell.nof_prb); printf("Running tests for %d PRB\n", cell.nof_prb);
for (int n=6;n<cell.nof_prb;n++) { for (int n=6;n<cell.nof_prb;n++) {
for (int delta_ss=29;delta_ss<NOF_DELTA_SS;delta_ss++) { for (int delta_ss=29;delta_ss<SRSLTE_NOF_DELTA_SS;delta_ss++) {
for (int cshift=0;cshift<NOF_CSHIFT;cshift++) { for (int cshift=0;cshift<SRSLTE_NOF_CSHIFT;cshift++) {
for (int h=0;h<3;h++) { for (int h=0;h<3;h++) {
for (int sf_idx=0;sf_idx<NSLOTS_X_FRAME;sf_idx++) { for (int sf_idx=0;sf_idx<SRSLTE_NSLOTS_X_FRAME;sf_idx++) {
for (int cshift_drms=0;cshift_drms<NOF_CSHIFT;cshift_drms++) { for (int cshift_drms=0;cshift_drms<SRSLTE_NOF_CSHIFT;cshift_drms++) {
pusch_cfg.beta_pusch = 1.0; pusch_cfg.beta_pusch = 1.0;
uint32_t nof_prb = n; uint32_t nof_prb = n;
pusch_cfg.cyclic_shift = cshift; pusch_cfg.cyclic_shift = cshift;
@ -123,7 +123,7 @@ int main(int argc, char **argv) {
printf("cyclic_shift_for_drms: %d, ",pusch_cfg.cyclic_shift_for_drms); printf("cyclic_shift_for_drms: %d, ",pusch_cfg.cyclic_shift_for_drms);
printf("delta_ss: %d, ",pusch_cfg.delta_ss); printf("delta_ss: %d, ",pusch_cfg.delta_ss);
printf("SF_idx: %d\n", sf_idx); printf("SF_idx: %d\n", sf_idx);
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);
exit(0); exit(0);
} }
} }
@ -140,7 +140,7 @@ do_exit:
free(signal); free(signal);
} }
refsignal_ul_free(&refs); srslte_refsignal_ul_free(&refs);
if (!ret) { if (!ret) {
printf("OK\n"); printf("OK\n");

@ -34,12 +34,12 @@
#include "gauss.h" #include "gauss.h"
#include "srslte/channel/ch_awgn.h" #include "srslte/channel/ch_awgn.h"
float ch_awgn_get_variance(float ebno_db, float rate) { float srslte_ch_awgn_get_variance(float ebno_db, float rate) {
float esno_db = ebno_db + 10 * log10f(rate); float esno_db = ebno_db + 10 * log10f(rate);
return sqrtf(1 / (powf(10, esno_db / 10))); return sqrtf(1 / (powf(10, esno_db / 10)));
} }
void ch_awgn_c(const cf_t* x, cf_t* y, float variance, uint32_t len) { void srslte_ch_awgn_c(const cf_t* x, cf_t* y, float variance, uint32_t len) {
cf_t tmp; cf_t tmp;
uint32_t i; uint32_t i;
@ -50,7 +50,7 @@ void ch_awgn_c(const cf_t* x, cf_t* y, float variance, uint32_t len) {
y[i] = tmp + x[i]; y[i] = tmp + x[i];
} }
} }
void ch_awgn_f(const float* x, float* y, float variance, uint32_t len) { void srslte_ch_awgn_f(const float* x, float* y, float variance, uint32_t len) {
uint32_t i; uint32_t i;
for (i=0;i<len;i++) { for (i=0;i<len;i++) {
@ -59,17 +59,17 @@ void ch_awgn_f(const float* x, float* y, float variance, uint32_t len) {
} }
/* High-level API */ /* High-level API */
int ch_awgn_initialize(ch_awgn_hl* hl) { int srslte_ch_awgn_initialize(srslte_ch_awgn_hl* hl) {
return 0; return 0;
} }
int ch_awgn_work(ch_awgn_hl* hl) { int srslte_ch_awgn_work(srslte_ch_awgn_hl* hl) {
ch_awgn_c(hl->input,hl->output,hl->ctrl_in.variance,hl->in_len); srslte_ch_awgn_c(hl->input,hl->output,hl->ctrl_in.variance,hl->in_len);
hl->out_len = hl->in_len; hl->out_len = hl->in_len;
return 0; return 0;
} }
int ch_awgn_stop(ch_awgn_hl* hl) { int srslte_ch_awgn_stop(srslte_ch_awgn_hl* hl) {
return 0; return 0;
} }

@ -37,7 +37,7 @@
#include "srslte/utils/debug.h" #include "srslte/utils/debug.h"
#include "srslte/utils/vector.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); int symbol_sz = lte_symbol_sz(nof_prb);
if (symbol_sz < 0) { 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; 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); dft_plan_free(&q->fft_plan);
if (q->tmp) { if (q->tmp) {
free(q->tmp); free(q->tmp);
@ -80,22 +80,22 @@ void lte_fft_free_(lte_fft_t *q) {
if (q->shift_buffer) { if (q->shift_buffer) {
free(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) { int srslte_fft_init(srslte_fft_t *q, srslte_cp_t cp, uint32_t nof_prb) {
return lte_fft_init_(q, cp, nof_prb, FORWARD); return srslte_fft_init_(q, cp, nof_prb, FORWARD);
} }
void lte_fft_free(lte_fft_t *q) { void srslte_fft_free(srslte_fft_t *q) {
lte_fft_free_(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; uint32_t i;
int ret; int ret;
ret = lte_fft_init_(q, cp, nof_prb, BACKWARD); ret = srslte_fft_init_(q, cp, nof_prb, BACKWARD);
if (ret == SRSLTE_SUCCESS) { if (ret == SRSLTE_SUCCESS) {
dft_plan_set_norm(&q->fft_plan, true); 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. * Freq_shift is relative to inter-carrier spacing.
* Caution: This function shall not be called during run-time * 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)); q->shift_buffer = vec_malloc(sizeof(cf_t) * SF_LEN(q->symbol_sz));
if (!q->shift_buffer) { if (!q->shift_buffer) {
perror("malloc"); perror("malloc");
@ -138,14 +138,14 @@ int lte_fft_set_freq_shift(lte_fft_t *q, float freq_shift) {
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
void lte_ifft_free(lte_fft_t *q) { void lte_ifft_free(srslte_fft_t *q) {
lte_fft_free_(q); srslte_fft_free_(q);
} }
/* Transforms input samples into output OFDM symbols. /* Transforms input samples into output OFDM symbols.
* Performs FFT on a each symbol and removes CP. * 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; uint32_t i;
for (i=0;i<q->nof_symbols;i++) { for (i=0;i<q->nof_symbols;i++) {
input += CP_ISNORM(q->cp)?CP_NORM(i, q->symbol_sz):CP_EXT(q->symbol_sz); 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; uint32_t n;
if (q->freq_shift) { if (q->freq_shift) {
vec_prod_ccc(input, q->shift_buffer, input, 2*q->slot_sz); vec_prod_ccc(input, q->shift_buffer, input, 2*q->slot_sz);
} }
for (n=0;n<2;n++) { 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. /* Transforms input OFDM symbols into output samples.
* Performs FFT on a each symbol and adds CP. * 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; uint32_t i, cp_len;
for (i=0;i<q->nof_symbols;i++) { for (i=0;i<q->nof_symbols;i++) {
cp_len = CP_ISNORM(q->cp)?CP_NORM(i, q->symbol_sz):CP_EXT(q->symbol_sz); 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); 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; uint32_t n;
for (n=0;n<2;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]); lte_ifft_run_slot(q, &input[n*q->nof_re*q->nof_symbols], &output[n*q->slot_sz]);

@ -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) && return lte_cellid_isvalid(cell->id) &&
lte_portid_isvalid(cell->nof_ports) && lte_portid_isvalid(cell->nof_ports) &&
lte_nofprb_isvalid(cell->nof_prb); 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); 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) { bool lte_sfidx_isvalid(uint32_t sf_idx) {
if (sf_idx <= NSUBFRAMES_X_FRAME) { if (sf_idx <= SRSLTE_NSUBFRAMES_X_FRAME) {
return true; return true;
} else { } else {
return false; return false;
@ -88,7 +88,7 @@ bool lte_sfidx_isvalid(uint32_t sf_idx) {
} }
bool lte_portid_isvalid(uint32_t port_id) { bool lte_portid_isvalid(uint32_t port_id) {
if (port_id <= MAX_PORTS) { if (port_id <= SRSLTE_MAX_PORTS) {
return true; return true;
} else { } else {
return false; 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) { if (cp == CPNORM) {
return "Normal"; return "Normal";
} else { } else {

@ -35,7 +35,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
int nof_prb = -1; int nof_prb = -1;
lte_cp_t cp = CPNORM; srslte_cp_t cp = CPNORM;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s\n", prog); printf("Usage: %s\n", prog);
@ -62,7 +62,7 @@ void parse_args(int argc, char **argv) {
int main(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; cf_t *input, *outfft, *outifft;
float mse; float mse;
int n_prb, max_prb, n_re; int n_prb, max_prb, n_re;
@ -98,7 +98,7 @@ int main(int argc, char **argv) {
exit(-1); exit(-1);
} }
if (lte_fft_init(&fft, cp, n_prb)) { if (srslte_fft_init(&fft, cp, n_prb)) {
fprintf(stderr, "Error initializing FFT\n"); fprintf(stderr, "Error initializing FFT\n");
exit(-1); exit(-1);
} }
@ -115,7 +115,7 @@ int main(int argc, char **argv) {
} }
lte_ifft_run_slot(&ifft, input, outfft); lte_ifft_run_slot(&ifft, input, outfft);
lte_fft_run_slot(&fft, outfft, outifft); srslte_fft_run_slot(&fft, outfft, outifft);
/* compute MSE */ /* compute MSE */
@ -130,7 +130,7 @@ int main(int argc, char **argv) {
exit(-1); exit(-1);
} }
lte_fft_free(&fft); srslte_fft_free(&fft);
lte_ifft_free(&ifft); lte_ifft_free(&ifft);
free(input); free(input);

@ -242,7 +242,7 @@ int main(int argc, char **argv) {
llr[j] = symbols[j] ? sqrt(2) : -sqrt(2); 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 */ /* decoder */
tdec_reset(&tdec, frame_length); tdec_reset(&tdec, frame_length);

@ -265,7 +265,7 @@ int main(int argc, char **argv) {
for (j = 0; j < frame_length; j++) { for (j = 0; j < frame_length; j++) {
llr[j] = data_tx[j] ? sqrt(2) : -sqrt(2); 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++) { for (j = 0; j < frame_length; j++) {
data_rx[0][j] = llr[j] > 0 ? 1 : 0; 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); 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]); vec_quant_fuc(llr, llr_c, Gain, 127.5, 255, coded_length[n]);
/* decoder 1 */ /* decoder 1 */

@ -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) /* 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 nof_ports, int nof_symbols, float noise_estimate)
{ {
int i; 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 */ /* 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) { int nof_ports, int nof_layers, int nof_symbols, lte_mimo_type_t type, float noise_estimate) {
if (nof_ports > MAX_PORTS) { if (nof_ports > SRSLTE_MAX_PORTS) {
fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", MAX_PORTS, fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS,
nof_ports); nof_ports);
return -1; 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)); memcpy(y, x, nof_symbols * sizeof(cf_t));
return nof_symbols; 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 nof_symbols) {
int i; int i;
if (nof_ports == 2) { 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 */ /* 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) { int nof_ports, int nof_symbols, lte_mimo_type_t type) {
if (nof_ports > MAX_PORTS) { if (nof_ports > SRSLTE_MAX_PORTS) {
fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", MAX_PORTS, fprintf(stderr, "Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS,
nof_ports); nof_ports);
return -1; return -1;
} }

@ -79,14 +79,14 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i, j; int i, j;
float mse; 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]; *xr[MAX_LAYERS];
lte_mimo_type_t type; lte_mimo_type_t type;
precoding_t precoding; precoding_t precoding;
parse_args(argc, argv); 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"); fprintf(stderr, "Invalid number of layers or ports\n");
exit(-1); exit(-1);
} }

@ -175,7 +175,7 @@ int main(int argc, char **argv) {
mod_modulate(&mod, input, symbols, num_bits); mod_modulate(&mod, input, symbols, num_bits);
/* add noise */ /* 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 */ /* Compare exact with approximation algorithms */
demod_soft_alg_set(&demod_soft, EXACT); demod_soft_alg_set(&demod_soft, EXACT);

@ -44,7 +44,7 @@
/* Creates the DL PDSCH resource allocation grant from a DCI message /* 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, 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) ra_pdsch_t *ra_dl)
{ {
int ret = SRSLTE_ERROR_INVALID_INPUTS; int ret = SRSLTE_ERROR_INVALID_INPUTS;

@ -93,14 +93,14 @@ int codeblock_segmentation(struct cb_segm *s, uint32_t tbs) {
return ret; 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL) { if (q != NULL) {
uint32_t i; uint32_t i;
bzero(q, sizeof(harq_t)); 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); ret = ra_tbs_from_idx(26, cell.nof_prb);
if (ret != SRSLTE_ERROR) { if (ret != SRSLTE_ERROR) {

@ -53,7 +53,7 @@ bool pbch_exists(int nframe, int nslot) {
cf_t *offset_original; 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; int i;
cf_t *ptr; 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 * 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); 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 * 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); 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 * At the receiver, the field nof_ports in the cell structure indicates the
* maximum number of BS transmitter ports to look for. * 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL && if (q != NULL &&
@ -246,7 +246,7 @@ void pbch_free(pbch_t *q) {
/** Unpacks MIB from PBCH message. /** Unpacks MIB from PBCH message.
* msg buffer must be 24 byte length at least * 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; int phich_res;
cell->bw_idx = bit_unpack(&msg, 3); 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. /** Unpacks MIB from PBCH message.
* msg buffer must be 24 byte length at least * 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; int bw, phich_res = 0;
bzero(msg, 24); 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); 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(" - Cell ID: %d\n", cell_id);
printf(" - Nof ports: %d\n", cell->nof_ports); printf(" - Nof ports: %d\n", cell->nof_ports);
printf(" - PRB: %d\n", cell->nof_prb); 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 * 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) uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset)
{ {
uint32_t src, dst, nb; 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; nof_bits = 2 * q->nof_symbols;
/* number of layers equals number of ports */ /* 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]; 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 */ /* extract symbols */
if (q->nof_symbols != pbch_get(slot1_symbols, q->pbch_symbols[0], q->cell)) { 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 /** 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 i;
int nof_bits; int nof_bits;
cf_t *x[MAX_LAYERS]; cf_t *x[MAX_LAYERS];

@ -61,7 +61,7 @@ bool pcfich_exists(int nframe, int nslot) {
/** Initializes the pcfich channel receiver. /** Initializes the pcfich channel receiver.
* On error, returns -1 and frees the structrure * 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL && 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_table_set(&q->demod, &q->mod);
demod_soft_alg_set(&q->demod, APPROX); 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)) { if (sequence_pcfich(&q->seq_pcfich[nsf], 2 * nsf, q->cell.id)) {
goto clean; 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) { 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]); sequence_free(&q->seq_pcfich[ns]);
} }
modem_table_free(&q->mod); 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 * 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) uint32_t nsubframe, uint32_t *cfi, float *corr_result)
{ {
/* Set pointers for layermapping & precoding */ /* Set pointers for layermapping & precoding */
int i; int i;
cf_t *x[MAX_LAYERS]; cf_t *x[MAX_LAYERS];
cf_t *ce_precoding[MAX_PORTS]; cf_t *ce_precoding[SRSLTE_MAX_PORTS];
if (q != NULL && if (q != NULL &&
slot_symbols != NULL && slot_symbols != NULL &&
nsubframe < NSUBFRAMES_X_FRAME) nsubframe < SRSLTE_NSUBFRAMES_X_FRAME)
{ {
/* number of layers equals number of ports */ /* 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]; 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]; 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 /** 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) { uint32_t subframe) {
int i; int i;
if (q != NULL && if (q != NULL &&
cfi < 3 && cfi < 3 &&
slot_symbols != NULL && slot_symbols != NULL &&
subframe < NSUBFRAMES_X_FRAME) subframe < SRSLTE_NSUBFRAMES_X_FRAME)
{ {
/* Set pointers for layermapping & precoding */ /* Set pointers for layermapping & precoding */
cf_t *x[MAX_LAYERS]; 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 */ /* number of layers equals number of ports */
for (i = 0; i < q->cell.nof_ports; i++) { for (i = 0; i < q->cell.nof_ports; i++) {
x[i] = q->pcfich_x[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]; symbols_precoding[i] = q->pcfich_symbols[i];
} }

@ -55,7 +55,7 @@ static void set_cfi(pdcch_t *q, uint32_t cfi) {
/** Initializes the PDCCH transmitter and receiver */ /** 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
uint32_t i; 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_table_set(&q->demod, &q->mod);
demod_soft_alg_set(&q->demod, APPROX); 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 // we need to pregenerate the sequence for the maximum number of bits, which is 8 times
// the maximum number of REGs (for CFI=3) // 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))) { 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; 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); q->ce[i] = vec_malloc(sizeof(cf_t) * q->max_bits / 2);
if (!q->ce[i]) { if (!q->ce[i]) {
goto clean; goto clean;
@ -155,7 +155,7 @@ void pdcch_free(pdcch_t *q) {
if (q->pdcch_d) { if (q->pdcch_d) {
free(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]) { if (q->ce[i]) {
free(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]); 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 * 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 * 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) { uint32_t nsubframe, uint32_t cfi) {
int ret = SRSLTE_ERROR_INVALID_INPUTS; 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. * @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, 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
uint32_t i; uint32_t i;

@ -196,7 +196,7 @@ int pdsch_get(pdsch_t *q, cf_t *sf_symbols, cf_t *pdsch_symbols,
} }
/** Initializes the PDCCH transmitter and receiver */ /** 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 ret = SRSLTE_ERROR_INVALID_INPUTS;
int i; 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]); 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) { int pdsch_set_rnti(pdsch_t *q, uint16_t rnti) {
uint32_t i; 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, if (sequence_pdsch(&q->seq_pdsch[i], rnti, 0, 2 * i, q->cell.id,
q->max_re * lte_mod_bits_x_symbol(LTE_QAM64))) { q->max_re * lte_mod_bits_x_symbol(LTE_QAM64))) {
return SRSLTE_ERROR; return SRSLTE_ERROR;
@ -319,7 +319,7 @@ int pdsch_set_rnti(pdsch_t *q, uint16_t rnti) {
return SRSLTE_SUCCESS; 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 && if (q != NULL &&
sf_symbols != NULL && sf_symbols != NULL &&
data != 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 /** 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) 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 && if (q != NULL &&
data != 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 /** 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; int i;
/* Set pointers for layermapping & precoding */ /* Set pointers for layermapping & precoding */

@ -53,15 +53,15 @@ uint32_t phich_ngroups(phich_t *q) {
return regs_phich_ngroups(q->regs); 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; 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]); regs_phich_reset(q->regs, slot_symbols[i]);
} }
} }
/** Initializes the phich channel receiver */ /** 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL && 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_init(&q->demod);
demod_hard_table_set(&q->demod, LTE_BPSK); 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)) { if (sequence_phich(&q->seq_phich[nsf], 2 * nsf, q->cell.id)) {
goto clean; 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) { 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]); sequence_free(&q->seq_phich[ns]);
} }
modem_table_free(&q->mod); 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 * 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) { uint32_t ngroup, uint32_t nseq, uint32_t subframe, uint8_t *ack, uint32_t *distance) {
/* Set pointers for layermapping & precoding */ /* Set pointers for layermapping & precoding */
int i, j; int i, j;
cf_t *x[MAX_LAYERS]; cf_t *x[MAX_LAYERS];
cf_t *ce_precoding[MAX_PORTS]; cf_t *ce_precoding[SRSLTE_MAX_PORTS];
if (q == NULL || slot_symbols == NULL) { if (q == NULL || slot_symbols == NULL) {
return SRSLTE_ERROR_INVALID_INPUTS; return SRSLTE_ERROR_INVALID_INPUTS;
} }
if (subframe >= NSUBFRAMES_X_FRAME) { if (subframe >= SRSLTE_NSUBFRAMES_X_FRAME) {
fprintf(stderr, "Invalid nslot %d\n", subframe); fprintf(stderr, "Invalid nslot %d\n", subframe);
return SRSLTE_ERROR_INVALID_INPUTS; 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); DEBUG("Decoding PHICH Ngroup: %d, Nseq: %d\n", ngroup, nseq);
/* number of layers equals number of ports */ /* 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]; 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]; 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 * 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, 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; int i;
if (q == NULL || slot_symbols == NULL) { if (q == NULL || slot_symbols == NULL) {
return SRSLTE_ERROR_INVALID_INPUTS; return SRSLTE_ERROR_INVALID_INPUTS;
} }
if (subframe >= NSUBFRAMES_X_FRAME) { if (subframe >= SRSLTE_NSUBFRAMES_X_FRAME) {
fprintf(stderr, "Invalid nslot %d\n", subframe); fprintf(stderr, "Invalid nslot %d\n", subframe);
return SRSLTE_ERROR_INVALID_INPUTS; 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 */ /* Set pointers for layermapping & precoding */
cf_t *x[MAX_LAYERS]; 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 */ /* number of layers equals number of ports */
for (i = 0; i < q->cell.nof_ports; i++) { for (i = 0; i < q->cell.nof_ports; i++) {
x[i] = q->phich_x[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]; symbols_precoding[i] = q->phich_symbols[i];
} }

@ -312,14 +312,14 @@ int prach_init(prach_t *p,
p->corr = vec_malloc(sizeof(float)*p->N_zc); p->corr = vec_malloc(sizeof(float)*p->N_zc);
// Set up ZC FFTS // 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)){ if(dft_plan(p->zc_fft, p->N_zc, FORWARD, COMPLEX)){
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
dft_plan_set_mirror(p->zc_fft, false); dft_plan_set_mirror(p->zc_fft, false);
dft_plan_set_norm(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)){ if(dft_plan(p->zc_ifft, p->N_zc, BACKWARD, COMPLEX)){
return SRSLTE_ERROR; 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_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_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)){ if(dft_plan(p->ifft, p->N_ifft_prach, BACKWARD, COMPLEX)){
return -1; return -1;
} }
dft_plan_set_mirror(p->ifft, true); dft_plan_set_mirror(p->ifft, true);
dft_plan_set_norm(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)){ if(dft_plan(p->fft, p->N_ifft_prach, FORWARD, COMPLEX)){
return -1; return -1;
} }

@ -50,14 +50,14 @@ bool pucch_cfg_isvalid(pucch_cfg_t *cfg) {
/* Generates n_cs_cell according to Sec 5.4 of 36.211 */ /* 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; sequence_t seq;
bzero(&seq, sizeof(sequence_t)); 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;ns<NSLOTS_X_FRAME;ns++) { for (uint32_t ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) {
for (uint32_t l=0;l<CP_NSYMB(cell.cp);l++) { for (uint32_t l=0;l<CP_NSYMB(cell.cp);l++) {
n_cs_cell[ns][l] = 0; n_cs_cell[ns][l] = 0;
for (uint32_t i=0;i<8;i++) { for (uint32_t i=0;i<8;i++) {
@ -71,9 +71,9 @@ int generate_n_cs_cell(lte_cell_t cell, uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNOR
/* Calculates alpha according to 5.5.2.2.2 of 36.211 */ /* Calculates alpha according to 5.5.2.2.2 of 36.211 */
float pucch_get_alpha(uint32_t n_cs_cell[NSLOTS_X_FRAME][CPNORM_NSYMB], float pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CPNORM_NSYMB],
pucch_cfg_t *cfg, pucch_cfg_t *cfg,
lte_cp_t cp, bool is_drms, srslte_cp_t cp, bool is_drms,
uint32_t ns, uint32_t l, uint32_t ns, uint32_t l,
uint32_t *n_oc_ptr) uint32_t *n_oc_ptr)
{ {
@ -119,7 +119,7 @@ int pucch_get(pucch_t *q, harq_t *harq, cf_t *input, cf_t *output) {
/** Initializes the PDCCH transmitter and receiver */ /** Initializes the PDCCH transmitter and receiver */
int pucch_init(pucch_t *q, lte_cell_t cell) { int pucch_init(pucch_t *q, srslte_cell_t cell) {
int ret = SRSLTE_ERROR_INVALID_INPUTS; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL && lte_cell_isvalid(&cell)) { if (q != NULL && lte_cell_isvalid(&cell)) {
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;

@ -162,7 +162,7 @@ int pusch_get(pusch_t *q, harq_t *harq, cf_t *input, cf_t *output) {
/** Initializes the PDCCH transmitter and receiver */ /** Initializes the PDCCH transmitter and receiver */
int pusch_init(pusch_t *q, lte_cell_t cell) { int pusch_init(pusch_t *q, srslte_cell_t cell) {
int ret = SRSLTE_ERROR_INVALID_INPUTS; int ret = SRSLTE_ERROR_INVALID_INPUTS;
int i; int i;
@ -266,7 +266,7 @@ void pusch_free(pusch_t *q) {
precoding_free(&q->equalizer); precoding_free(&q->equalizer);
for (i = 0; i < NSUBFRAMES_X_FRAME; i++) { for (i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) {
sequence_free(&q->seq_pusch[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) { int pusch_set_rnti(pusch_t *q, uint16_t rnti) {
uint32_t i; 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, if (sequence_pusch(&q->seq_pusch[i], rnti, 2 * i, q->cell.id,
q->max_re * lte_mod_bits_x_symbol(LTE_QAM64))) { q->max_re * lte_mod_bits_x_symbol(LTE_QAM64))) {
return SRSLTE_ERROR; return SRSLTE_ERROR;

@ -42,7 +42,7 @@
/* Returns the number of RE in a PRB in a slot and subframe */ /* 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 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; uint32_t re;
bool skip_refs = false; 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 */ /* 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, 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; uint32_t i, j, s;
/* Set start symbol according to Section 7.1.6.4 in 36.213 */ /* Set start symbol according to Section 7.1.6.4 in 36.213 */
prb_dist->lstart = nof_ctrl_symbols; prb_dist->lstart = nof_ctrl_symbols;
// Compute number of RE per subframe // 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; prb_dist->re_sf[i] = 0;
for (s = 0; s < 2; s++) { for (s = 0; s < 2; s++) {
for (j = 0; j < nof_prb; j++) { for (j = 0; j < nof_prb; j++) {

@ -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 * Returns the number of REGs in a PRB
* 36.211 Section 6.2.4 * 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) { switch (symbol) {
case 0: 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 * Sets all REG indices and initializes PCFICH, PHICH and PDCCH REGs
* Returns 0 if OK, -1 on error * 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
uint32_t i, k; uint32_t i, k;
uint32_t j[4], jmax, prb; uint32_t j[4], jmax, prb;

@ -33,7 +33,7 @@
/** /**
* 36.211 6.6.1 * 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)); bzero(seq, sizeof(sequence_t));
return sequence_LTE_pr(seq, CP_ISNORM(cp)?1920:1728, cell_id); return sequence_LTE_pr(seq, CP_ISNORM(cp)?1920:1728, cell_id);
} }

@ -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 */ /* 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, 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) { uint8_t *q_bits) {
const uint32_t ack_column_set_norm[4] = {2, 3, 8, 9}; 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 */ /* 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, 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) { uint8_t *q_bits) {
static uint32_t ri_column_set_norm[4] = {1, 4, 7, 10}; static uint32_t ri_column_set_norm[4] = {1, 4, 7, 10};

@ -60,7 +60,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexErrMsgTxt("Error initiating DL-SCH\n"); mexErrMsgTxt("Error initiating DL-SCH\n");
return; return;
} }
lte_cell_t cell; srslte_cell_t cell;
cell.nof_prb = 100; cell.nof_prb = 100;
cell.id=1; cell.id=1;
if (harq_init(&harq_process, cell)) { if (harq_init(&harq_process, cell)) {

@ -35,7 +35,7 @@
char *input_file_name = NULL; char *input_file_name = NULL;
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
2, // nof_ports 2, // nof_ports
150, // cell_id 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))) #define FLEN (10*SF_LEN(lte_symbol_sz(cell.nof_prb)))
filesource_t fsrc; 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; pbch_t pbch;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [vcoe] -i input_file\n", prog); printf("Usage: %s [vcoe] -i input_file\n", prog);
@ -132,12 +132,12 @@ int base_init() {
return -1; return -1;
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return -1; 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"); fprintf(stderr, "Error initializing FFT\n");
return -1; return -1;
} }
@ -163,8 +163,8 @@ void base_free() {
for (i=0;i<cell.nof_ports;i++) { for (i=0;i<cell.nof_ports;i++) {
free(ce[i]); free(ce[i]);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pbch_free(&pbch); pbch_free(&pbch);
} }
@ -173,7 +173,7 @@ int main(int argc, char **argv) {
uint8_t bch_payload[BCH_PAYLOAD_LEN]; uint8_t bch_payload[BCH_PAYLOAD_LEN];
int n; int n;
uint32_t nof_tx_ports, sfn_offset; uint32_t nof_tx_ports, sfn_offset;
cf_t *ce_slot1[MAX_PORTS]; cf_t *ce_slot1[SRSLTE_MAX_PORTS];
if (argc < 3) { if (argc < 3) {
usage(argv[0]); usage(argv[0]);
@ -195,20 +195,20 @@ int main(int argc, char **argv) {
if (nread > 0) { if (nread > 0) {
// process 1st subframe only // 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 */ /* 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); INFO("Decoding PBCH\n", 0);
for (int i=0;i<MAX_PORTS;i++) { for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
ce_slot1[i] = &ce[i][SLOT_LEN_RE(cell.nof_prb, cell.cp)]; ce_slot1[i] = &ce[i][SLOT_LEN_RE(cell.nof_prb, cell.cp)];
} }
pbch_decode_reset(&pbch); pbch_decode_reset(&pbch);
n = pbch_decode(&pbch, &fft_buffer[SLOT_LEN_RE(cell.nof_prb, cell.cp)], n = pbch_decode(&pbch, &fft_buffer[SLOT_LEN_RE(cell.nof_prb, cell.cp)],
ce_slot1, chest_dl_get_noise_estimate(&chest), ce_slot1, srslte_chest_dl_get_noise_estimate(&chest),
bch_payload, &nof_tx_ports, &sfn_offset); bch_payload, &nof_tx_ports, &sfn_offset);
if (n == 1) { if (n == 1) {
nof_decoded_mibs++; nof_decoded_mibs++;

@ -34,7 +34,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1, // cell_id 1, // cell_id
@ -79,9 +79,9 @@ int main(int argc, char **argv) {
pbch_t pbch; pbch_t pbch;
uint8_t bch_payload_tx[BCH_PAYLOAD_LEN], bch_payload_rx[BCH_PAYLOAD_LEN]; uint8_t bch_payload_tx[BCH_PAYLOAD_LEN], bch_payload_rx[BCH_PAYLOAD_LEN];
int i, j; int i, j;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
int nof_re; int nof_re;
cf_t *slot1_symbols[MAX_PORTS]; cf_t *slot1_symbols[SRSLTE_MAX_PORTS];
uint32_t nof_rx_ports; uint32_t nof_rx_ports;
parse_args(argc,argv); parse_args(argc,argv);

@ -47,13 +47,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
int i; int i;
lte_cell_t cell; srslte_cell_t cell;
pbch_t pbch; pbch_t pbch;
chest_dl_t chest; srslte_chest_dl_t chest;
lte_fft_t fft; srslte_fft_t fft;
cf_t *input_symbols, *input_fft; cf_t *input_symbols, *input_fft;
int nof_re; int nof_re;
cf_t *ce[MAX_PORTS], *ce_slot[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS], *ce_slot[SRSLTE_MAX_PORTS];
if (nrhs < NOF_INPUTS) { if (nrhs < NOF_INPUTS) {
help(); help();
@ -72,16 +72,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
// Allocate memory // Allocate memory
input_fft = vec_malloc(nof_re * sizeof(cf_t)); input_fft = vec_malloc(nof_re * sizeof(cf_t));
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = vec_malloc(nof_re * sizeof(cf_t)); ce[i] = vec_malloc(nof_re * sizeof(cf_t));
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return; return;
} }
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"); fprintf(stderr, "Error initializing FFT\n");
return; return;
} }
@ -91,7 +91,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; return;
} }
lte_fft_run_sf(&fft, input_symbols, input_fft); srslte_fft_run_sf(&fft, input_symbols, input_fft);
if (nrhs > NOF_INPUTS) { if (nrhs > NOF_INPUTS) {
cf_t *cearray; cf_t *cearray;
@ -103,16 +103,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} }
} }
} else { } else {
chest_dl_estimate(&chest, input_fft, ce, 0); srslte_chest_dl_estimate(&chest, input_fft, ce, 0);
} }
float noise_power; float noise_power;
if (nrhs > NOF_INPUTS + 1) { if (nrhs > NOF_INPUTS + 1) {
noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); noise_power = mxGetScalar(prhs[NOF_INPUTS+1]);
} else { } else {
noise_power = chest_dl_get_noise_estimate(&chest); noise_power = srslte_chest_dl_get_noise_estimate(&chest);
} }
for (int i=0;i<MAX_PORTS;i++) { for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
ce_slot[i] = &ce[i][SLOT_LEN_RE(cell.nof_prb, cell.cp)]; ce_slot[i] = &ce[i][SLOT_LEN_RE(cell.nof_prb, cell.cp)];
} }
@ -147,8 +147,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexutils_write_cf(pbch.ce[0], &plhs[6], pbch.nof_symbols, 1); mexutils_write_cf(pbch.ce[0], &plhs[6], pbch.nof_symbols, 1);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pbch_free(&pbch); pbch_free(&pbch);
for (i=0;i<cell.nof_ports;i++) { for (i=0;i<cell.nof_ports;i++) {

@ -37,7 +37,7 @@ char *input_file_name = NULL;
char *matlab_file_name = NULL; char *matlab_file_name = NULL;
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 0, // cell_id
@ -51,11 +51,11 @@ int flen;
FILE *fmatlab = NULL; FILE *fmatlab = NULL;
filesource_t fsrc; filesource_t fsrc;
cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS]; cf_t *input_buffer, *fft_buffer, *ce[SRSLTE_MAX_PORTS];
pcfich_t pcfich; pcfich_t pcfich;
regs_t regs; regs_t regs;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [vcoe] -i input_file\n", prog); printf("Usage: %s [vcoe] -i input_file\n", prog);
@ -135,7 +135,7 @@ int base_init() {
return -1; return -1;
} }
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -143,12 +143,12 @@ int base_init() {
} }
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return -1; 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"); fprintf(stderr, "Error initializing FFT\n");
return -1; return -1;
} }
@ -179,11 +179,11 @@ void base_free() {
free(fft_buffer); free(fft_buffer);
filesource_free(&fsrc); filesource_free(&fsrc);
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]); free(ce[i]);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pcfich_free(&pcfich); pcfich_free(&pcfich);
regs_free(&regs); regs_free(&regs);
@ -208,7 +208,7 @@ int main(int argc, char **argv) {
n = filesource_read(&fsrc, input_buffer, flen); n = filesource_read(&fsrc, input_buffer, flen);
lte_fft_run_sf(&fft, input_buffer, fft_buffer); srslte_fft_run_sf(&fft, input_buffer, fft_buffer);
if (fmatlab) { if (fmatlab) {
fprintf(fmatlab, "infft="); fprintf(fmatlab, "infft=");
@ -223,12 +223,12 @@ int main(int argc, char **argv) {
} }
/* Get channel estimates for each port */ /* 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 PCFICH\n", 0); INFO("Decoding PCFICH\n", 0);
n = pcfich_decode(&pcfich, fft_buffer, ce, chest_dl_get_noise_estimate(&chest), 0, &cfi, &cfi_corr); n = pcfich_decode(&pcfich, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), 0, &cfi, &cfi_corr);
printf("cfi: %d, distance: %f\n", cfi, cfi_corr); printf("cfi: %d, distance: %f\n", cfi, cfi_corr);
base_free(); base_free();

@ -34,7 +34,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1000, // cell_id 1000, // cell_id
@ -79,19 +79,19 @@ int main(int argc, char **argv) {
pcfich_t pcfich; pcfich_t pcfich;
regs_t regs; regs_t regs;
int i, j; int i, j;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
int nof_re; int nof_re;
cf_t *slot_symbols[MAX_PORTS]; cf_t *slot_symbols[SRSLTE_MAX_PORTS];
uint32_t cfi, cfi_rx, nsf; uint32_t cfi, cfi_rx, nsf;
int cid, max_cid; int cid, max_cid;
float corr_res; float corr_res;
parse_args(argc,argv); parse_args(argc,argv);
nof_re = CPNORM_NSYMB * cell.nof_prb * RE_X_RB; nof_re = SRSLTE_CPNORM_NSYMB * cell.nof_prb * RE_X_RB;
/* init memory */ /* init memory */
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = malloc(sizeof(cf_t) * nof_re); ce[i] = malloc(sizeof(cf_t) * nof_re);
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -152,7 +152,7 @@ int main(int argc, char **argv) {
cid++; cid++;
} }
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]); free(ce[i]);
free(slot_symbols[i]); free(slot_symbols[i]);
} }

@ -46,10 +46,10 @@ void help()
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
int i; int i;
lte_cell_t cell; srslte_cell_t cell;
pcfich_t pcfich; pcfich_t pcfich;
chest_dl_t chest; srslte_chest_dl_t chest;
lte_fft_t fft; srslte_fft_t fft;
regs_t regs; regs_t regs;
uint32_t sf_idx; uint32_t sf_idx;
cf_t *input_fft, *input_signal; cf_t *input_fft, *input_signal;
@ -69,12 +69,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; return;
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
mexErrMsgTxt("Error initializing equalizer\n"); mexErrMsgTxt("Error initializing equalizer\n");
return; return;
} }
if (lte_fft_init(&fft, cell.cp, cell.nof_prb)) { if (srslte_fft_init(&fft, cell.cp, cell.nof_prb)) {
mexErrMsgTxt("Error initializing FFT\n"); mexErrMsgTxt("Error initializing FFT\n");
return; return;
} }
@ -97,12 +97,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
input_fft = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); input_fft = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
// Set Channel estimates to 1.0 (ignore fading) // Set Channel estimates to 1.0 (ignore fading)
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
for (i=0;i<cell.nof_ports;i++) { for (i=0;i<cell.nof_ports;i++) {
ce[i] = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
} }
lte_fft_run_sf(&fft, input_signal, input_fft); srslte_fft_run_sf(&fft, input_signal, input_fft);
if (nrhs > NOF_INPUTS) { if (nrhs > NOF_INPUTS) {
cf_t *cearray; cf_t *cearray;
@ -114,13 +114,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} }
} }
} else { } else {
chest_dl_estimate(&chest, input_fft, ce, sf_idx); srslte_chest_dl_estimate(&chest, input_fft, ce, sf_idx);
} }
float noise_power; float noise_power;
if (nrhs > NOF_INPUTS + 1) { if (nrhs > NOF_INPUTS + 1) {
noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); noise_power = mxGetScalar(prhs[NOF_INPUTS+1]);
} else { } 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); mexutils_write_cf(pcfich.pcfich_symbols[0], &plhs[2], 16, 1);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pcfich_free(&pcfich); pcfich_free(&pcfich);
regs_free(&regs); regs_free(&regs);

@ -37,7 +37,7 @@ char *input_file_name = NULL;
#define MAX_CANDIDATES 64 #define MAX_CANDIDATES 64
lte_cell_t cell = { srslte_cell_t cell = {
6, // cell.cell.cell.nof_prb 6, // cell.cell.cell.nof_prb
1, // cell.cell.nof_ports 1, // cell.cell.nof_ports
0, // cell.id 0, // cell.id
@ -54,10 +54,10 @@ int max_frames = 10;
dci_format_t dci_format = Format1A; dci_format_t dci_format = Format1A;
filesource_t fsrc; filesource_t fsrc;
pdcch_t pdcch; 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; regs_t regs;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [vcfoe] -i input_file\n", prog); printf("Usage: %s [vcfoe] -i input_file\n", prog);
@ -143,7 +143,7 @@ int base_init() {
return -1; return -1;
} }
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -151,12 +151,12 @@ int base_init() {
} }
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return -1; 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"); fprintf(stderr, "Error initializing FFT\n");
return -1; return -1;
} }
@ -188,11 +188,11 @@ void base_free() {
free(fft_buffer); free(fft_buffer);
filesource_free(&fsrc); filesource_free(&fsrc);
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]); free(ce[i]);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pdcch_free(&pdcch); pdcch_free(&pdcch);
regs_free(&regs); regs_free(&regs);
@ -226,14 +226,14 @@ int main(int argc, char **argv) {
INFO("Reading %d samples sub-frame %d\n", flen, frame_cnt); INFO("Reading %d samples sub-frame %d\n", flen, frame_cnt);
lte_fft_run_sf(&fft, input_buffer, fft_buffer); srslte_fft_run_sf(&fft, input_buffer, fft_buffer);
/* Get channel estimates for each port */ /* Get channel estimates for each port */
chest_dl_estimate(&chest, fft_buffer, ce, frame_cnt %10); srslte_chest_dl_estimate(&chest, fft_buffer, ce, frame_cnt %10);
uint16_t crc_rem = 0; uint16_t crc_rem = 0;
if (pdcch_extract_llr(&pdcch, fft_buffer, if (pdcch_extract_llr(&pdcch, fft_buffer,
ce, chest_dl_get_noise_estimate(&chest), ce, srslte_chest_dl_get_noise_estimate(&chest),
frame_cnt %10, cfi)) { frame_cnt %10, cfi)) {
fprintf(stderr, "Error extracting LLRs\n"); fprintf(stderr, "Error extracting LLRs\n");
return -1; return -1;

@ -33,7 +33,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1, // cell_id 1, // cell_id
@ -112,23 +112,23 @@ int main(int argc, char **argv) {
ra_pdsch_t ra_dl; ra_pdsch_t ra_dl;
regs_t regs; regs_t regs;
int i, j; int i, j;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
int nof_re; int nof_re;
cf_t *slot_symbols[MAX_PORTS]; cf_t *slot_symbols[SRSLTE_MAX_PORTS];
int nof_dcis; int nof_dcis;
int ret = -1; int ret = -1;
parse_args(argc, argv); parse_args(argc, argv);
nof_re = CPNORM_NSYMB * cell.nof_prb * RE_X_RB; nof_re = SRSLTE_CPNORM_NSYMB * cell.nof_prb * RE_X_RB;
if (test_dci_payload_size()) { if (test_dci_payload_size()) {
exit(-1); exit(-1);
} }
/* init memory */ /* init memory */
for (i = 0; i < MAX_PORTS; i++) { for (i = 0; i < SRSLTE_MAX_PORTS; i++) {
ce[i] = malloc(sizeof(cf_t) * nof_re); ce[i] = malloc(sizeof(cf_t) * nof_re);
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -220,7 +220,7 @@ quit:
pdcch_free(&pdcch); pdcch_free(&pdcch);
regs_free(&regs); regs_free(&regs);
for (i = 0; i < MAX_PORTS; i++) { for (i = 0; i < SRSLTE_MAX_PORTS; i++) {
free(ce[i]); free(ce[i]);
free(slot_symbols[i]); free(slot_symbols[i]);
} }

@ -57,10 +57,10 @@ void help()
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
int i; int i;
lte_cell_t cell; srslte_cell_t cell;
pdcch_t pdcch; pdcch_t pdcch;
chest_dl_t chest; srslte_chest_dl_t chest;
lte_fft_t fft; srslte_fft_t fft;
regs_t regs; regs_t regs;
dci_location_t locations[MAX_CANDIDATES]; dci_location_t locations[MAX_CANDIDATES];
uint32_t cfi, sf_idx; uint32_t cfi, sf_idx;
@ -89,12 +89,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; return;
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return; return;
} }
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"); fprintf(stderr, "Error initializing FFT\n");
return; return;
} }
@ -124,12 +124,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
input_fft = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); input_fft = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
// Set Channel estimates to 1.0 (ignore fading) // Set Channel estimates to 1.0 (ignore fading)
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
for (i=0;i<cell.nof_ports;i++) { for (i=0;i<cell.nof_ports;i++) {
ce[i] = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
} }
lte_fft_run_sf(&fft, input_signal, input_fft); srslte_fft_run_sf(&fft, input_signal, input_fft);
if (nrhs > NOF_INPUTS) { if (nrhs > NOF_INPUTS) {
cf_t *cearray; cf_t *cearray;
@ -141,13 +141,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} }
} }
} else { } else {
chest_dl_estimate(&chest, input_fft, ce, sf_idx); srslte_chest_dl_estimate(&chest, input_fft, ce, sf_idx);
} }
float noise_power; float noise_power;
if (nrhs > NOF_INPUTS + 1) { if (nrhs > NOF_INPUTS + 1) {
noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); noise_power = mxGetScalar(prhs[NOF_INPUTS+1]);
} else { } 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); 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); mexutils_write_cf(pdcch.pdcch_symbols[0], &plhs[2], 36*pdcch.nof_cce, 1);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pdcch_free(&pdcch); pdcch_free(&pdcch);
regs_free(&regs); regs_free(&regs);

@ -37,7 +37,7 @@
char *input_file_name = NULL; char *input_file_name = NULL;
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 0, // cell_id
@ -59,10 +59,10 @@ filesource_t fsrc;
pdcch_t pdcch; pdcch_t pdcch;
pdsch_t pdsch; pdsch_t pdsch;
harq_t harq_process; 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; regs_t regs;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [rovfcenmps] -i input_file\n", prog); printf("Usage: %s [rovfcenmps] -i input_file\n", prog);
@ -152,7 +152,7 @@ int base_init() {
return -1; return -1;
} }
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -160,12 +160,12 @@ int base_init() {
} }
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return -1; 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"); fprintf(stderr, "Error initializing FFT\n");
return -1; return -1;
} }
@ -209,11 +209,11 @@ void base_free() {
free(fft_buffer); free(fft_buffer);
filesource_free(&fsrc); filesource_free(&fsrc);
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]); free(ce[i]);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pdcch_free(&pdcch); pdcch_free(&pdcch);
pdsch_free(&pdsch); pdsch_free(&pdsch);
@ -256,10 +256,10 @@ int main(int argc, char **argv) {
filesource_read(&fsrc, input_buffer, flen); filesource_read(&fsrc, input_buffer, flen);
INFO("Reading %d samples sub-frame %d\n", flen, sf_idx); INFO("Reading %d samples sub-frame %d\n", flen, sf_idx);
lte_fft_run_sf(&fft, input_buffer, fft_buffer); srslte_fft_run_sf(&fft, input_buffer, fft_buffer);
/* Get channel estimates for each port */ /* Get channel estimates for each port */
chest_dl_estimate(&chest, fft_buffer, ce, sf_idx); srslte_chest_dl_estimate(&chest, fft_buffer, ce, sf_idx);
if (rnti != SIRNTI) { if (rnti != SIRNTI) {
INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti); INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti);
@ -267,7 +267,7 @@ int main(int argc, char **argv) {
} }
uint16_t crc_rem = 0; uint16_t crc_rem = 0;
if (pdcch_extract_llr(&pdcch, fft_buffer, ce, chest_dl_get_noise_estimate(&chest), sf_idx, cfi)) { if (pdcch_extract_llr(&pdcch, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), sf_idx, cfi)) {
fprintf(stderr, "Error extracting LLRs\n"); fprintf(stderr, "Error extracting LLRs\n");
return -1; return -1;
} }
@ -288,7 +288,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error configuring HARQ process\n"); fprintf(stderr, "Error configuring HARQ process\n");
goto goout; goto goout;
} }
if (pdsch_decode(&pdsch, &harq_process, fft_buffer, ce, chest_dl_get_noise_estimate(&chest), data)) { if (pdsch_decode(&pdsch, &harq_process, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), data)) {
fprintf(stderr, "Error decoding PDSCH\n"); fprintf(stderr, "Error decoding PDSCH\n");
goto goout; goto goout;
} else { } else {

@ -34,7 +34,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 0, // cell_id
@ -126,9 +126,9 @@ int main(int argc, char **argv) {
pdsch_t pdsch; pdsch_t pdsch;
uint32_t i, j; uint32_t i, j;
uint8_t *data = NULL; uint8_t *data = NULL;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
uint32_t nof_re; uint32_t nof_re;
cf_t *slot_symbols[MAX_PORTS]; cf_t *slot_symbols[SRSLTE_MAX_PORTS];
int ret = -1; int ret = -1;
struct timeval t[3]; struct timeval t[3];
ra_mcs_t mcs; ra_mcs_t mcs;
@ -140,10 +140,10 @@ int main(int argc, char **argv) {
bzero(&pdsch, sizeof(pdsch_t)); bzero(&pdsch, sizeof(pdsch_t));
bzero(&harq_process, sizeof(harq_t)); bzero(&harq_process, sizeof(harq_t));
bzero(ce, sizeof(cf_t*)*MAX_PORTS); bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
bzero(slot_symbols, sizeof(cf_t*)*MAX_PORTS); bzero(slot_symbols, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
nof_re = 2 * CPNORM_NSYMB * cell.nof_prb * RE_X_RB; nof_re = 2 * SRSLTE_CPNORM_NSYMB * cell.nof_prb * RE_X_RB;
mcs.mod = modulation; mcs.mod = modulation;

@ -50,10 +50,10 @@ extern int indices[2048];
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
int i; int i;
lte_cell_t cell; srslte_cell_t cell;
pdsch_t pdsch; pdsch_t pdsch;
chest_dl_t chest; srslte_chest_dl_t chest;
lte_fft_t fft; srslte_fft_t fft;
uint32_t cfi, sf_idx; uint32_t cfi, sf_idx;
cf_t *input_fft, *input_signal; cf_t *input_fft, *input_signal;
int nof_re; int nof_re;
@ -98,18 +98,18 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; return;
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
mexErrMsgTxt("Error initializing equalizer\n"); mexErrMsgTxt("Error initializing equalizer\n");
return; return;
} }
if (lte_fft_init(&fft, cell.cp, cell.nof_prb)) { if (srslte_fft_init(&fft, cell.cp, cell.nof_prb)) {
mexErrMsgTxt("Error initializing FFT\n"); mexErrMsgTxt("Error initializing FFT\n");
return; return;
} }
nof_re = 2 * CPNORM_NSYMB * cell.nof_prb * RE_X_RB; nof_re = 2 * SRSLTE_CPNORM_NSYMB * cell.nof_prb * RE_X_RB;
mcs.tbs = mxGetScalar(TBS); mcs.tbs = mxGetScalar(TBS);
if (mcs.tbs == 0) { if (mcs.tbs == 0) {
@ -175,12 +175,12 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
input_fft = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); input_fft = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
// Set Channel estimates to 1.0 (ignore fading) // Set Channel estimates to 1.0 (ignore fading)
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
for (i=0;i<cell.nof_ports;i++) { for (i=0;i<cell.nof_ports;i++) {
ce[i] = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = vec_malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
} }
lte_fft_run_sf(&fft, input_signal, input_fft); srslte_fft_run_sf(&fft, input_signal, input_fft);
if (nrhs > NOF_INPUTS) { if (nrhs > NOF_INPUTS) {
cf_t *cearray = NULL; cf_t *cearray = NULL;
@ -195,13 +195,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if (cearray_ptr) if (cearray_ptr)
free(cearray_ptr); free(cearray_ptr);
} else { } else {
chest_dl_estimate(&chest, input_fft, ce, sf_idx); srslte_chest_dl_estimate(&chest, input_fft, ce, sf_idx);
} }
float noise_power; float noise_power;
if (nrhs > NOF_INPUTS + 1) { if (nrhs > NOF_INPUTS + 1) {
noise_power = mxGetScalar(prhs[NOF_INPUTS+1]); noise_power = mxGetScalar(prhs[NOF_INPUTS+1]);
} else { } 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); 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); 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); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
pdsch_free(&pdsch); pdsch_free(&pdsch);
for (i=0;i<cell.nof_ports;i++) { for (i=0;i<cell.nof_ports;i++) {

@ -36,7 +36,7 @@
char *input_file_name = NULL; char *input_file_name = NULL;
char *matlab_file_name = NULL; char *matlab_file_name = NULL;
lte_cell_t cell = { srslte_cell_t cell = {
50, // cell.nof_prb 50, // cell.nof_prb
2, // cell.nof_ports 2, // cell.nof_ports
150, // cell.id 150, // cell.id
@ -52,11 +52,11 @@ int numsubframe = 0;
FILE *fmatlab = NULL; FILE *fmatlab = NULL;
filesource_t fsrc; filesource_t fsrc;
cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS]; cf_t *input_buffer, *fft_buffer, *ce[SRSLTE_MAX_PORTS];
phich_t phich; phich_t phich;
regs_t regs; regs_t regs;
lte_fft_t fft; srslte_fft_t fft;
chest_dl_t chest; srslte_chest_dl_t chest;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [vcoe] -i input_file\n", prog); printf("Usage: %s [vcoe] -i input_file\n", prog);
@ -158,7 +158,7 @@ int base_init() {
return -1; return -1;
} }
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t)); ce[i] = malloc(SF_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -166,12 +166,12 @@ int base_init() {
} }
} }
if (chest_dl_init(&chest, cell)) { if (srslte_chest_dl_init(&chest, cell)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
return -1; 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"); fprintf(stderr, "Error initializing FFT\n");
return -1; return -1;
} }
@ -202,11 +202,11 @@ void base_free() {
free(fft_buffer); free(fft_buffer);
filesource_free(&fsrc); filesource_free(&fsrc);
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]); free(ce[i]);
} }
chest_dl_free(&chest); srslte_chest_dl_free(&chest);
lte_fft_free(&fft); srslte_fft_free(&fft);
phich_free(&phich); phich_free(&phich);
regs_free(&regs); regs_free(&regs);
@ -234,7 +234,7 @@ int main(int argc, char **argv) {
n = filesource_read(&fsrc, input_buffer, flen); n = filesource_read(&fsrc, input_buffer, flen);
lte_fft_run_sf(&fft, input_buffer, fft_buffer); srslte_fft_run_sf(&fft, input_buffer, fft_buffer);
if (fmatlab) { if (fmatlab) {
fprintf(fmatlab, "infft="); fprintf(fmatlab, "infft=");
@ -247,7 +247,7 @@ int main(int argc, char **argv) {
} }
/* Get channel estimates for each port */ /* 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 PHICH\n", 0); INFO("Decoding PHICH\n", 0);
@ -255,7 +255,7 @@ int main(int argc, char **argv) {
for (ngroup=0;ngroup<phich_ngroups(&phich);ngroup++) { for (ngroup=0;ngroup<phich_ngroups(&phich);ngroup++) {
for (nseq=0;nseq<max_nseq;nseq++) { for (nseq=0;nseq<max_nseq;nseq++) {
if (phich_decode(&phich, fft_buffer, ce, chest_dl_get_noise_estimate(&chest), ngroup, nseq, numsubframe, &ack_rx, &distance)<0) { if (phich_decode(&phich, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), ngroup, nseq, numsubframe, &ack_rx, &distance)<0) {
printf("Error decoding ACK\n"); printf("Error decoding ACK\n");
exit(-1); exit(-1);
} }

@ -34,7 +34,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1000, // cell_id 1000, // cell_id
@ -104,9 +104,9 @@ int main(int argc, char **argv) {
phich_t phich; phich_t phich;
regs_t regs; regs_t regs;
int i, j; int i, j;
cf_t *ce[MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
int nof_re; int nof_re;
cf_t *slot_symbols[MAX_PORTS]; cf_t *slot_symbols[SRSLTE_MAX_PORTS];
uint8_t ack[50][PHICH_NORM_NSEQUENCES], ack_rx; uint8_t ack[50][PHICH_NORM_NSEQUENCES], ack_rx;
uint32_t nsf, distance; uint32_t nsf, distance;
int cid, max_cid; int cid, max_cid;
@ -116,10 +116,10 @@ int main(int argc, char **argv) {
max_nseq = CP_ISNORM(cell.cp)?PHICH_NORM_NSEQUENCES:PHICH_EXT_NSEQUENCES; max_nseq = CP_ISNORM(cell.cp)?PHICH_NORM_NSEQUENCES:PHICH_EXT_NSEQUENCES;
nof_re = CPNORM_NSYMB * cell.nof_prb * RE_X_RB; nof_re = SRSLTE_CPNORM_NSYMB * cell.nof_prb * RE_X_RB;
/* init memory */ /* init memory */
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
ce[i] = malloc(sizeof(cf_t) * nof_re); ce[i] = malloc(sizeof(cf_t) * nof_re);
if (!ce[i]) { if (!ce[i]) {
perror("malloc"); perror("malloc");
@ -203,7 +203,7 @@ int main(int argc, char **argv) {
cid++; cid++;
} }
for (i=0;i<MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]); free(ce[i]);
free(slot_symbols[i]); free(slot_symbols[i]);
} }

@ -55,8 +55,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return; return;
} }
lte_cell_t cell; srslte_cell_t cell;
bzero(&cell, sizeof(lte_cell_t)); bzero(&cell, sizeof(srslte_cell_t));
cell.nof_ports = 1; cell.nof_ports = 1;
if (mexutils_read_uint32_struct(UECFG, "NCellID", &cell.id)) { if (mexutils_read_uint32_struct(UECFG, "NCellID", &cell.id)) {
mexErrMsgTxt("Field NCellID not found in UE config\n"); mexErrMsgTxt("Field NCellID not found in UE config\n");
@ -196,10 +196,10 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
cf_t *scfdma = vec_malloc(sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb)); cf_t *scfdma = vec_malloc(sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb));
bzero(scfdma, sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb)); bzero(scfdma, sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb));
lte_fft_t fft; srslte_fft_t fft;
lte_ifft_init(&fft, CPNORM, cell.nof_prb); lte_ifft_init(&fft, CPNORM, cell.nof_prb);
lte_fft_set_normalize(&fft, true); srslte_fft_set_normalize(&fft, true);
lte_fft_set_freq_shift(&fft, 0.5); srslte_fft_set_freq_shift(&fft, 0.5);
lte_ifft_run_sf(&fft, sf_symbols, scfdma); lte_ifft_run_sf(&fft, sf_symbols, scfdma);
// Matlab toolbox expects further normalization // Matlab toolbox expects further normalization

@ -34,7 +34,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
lte_cell_t cell = { srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 0, // cell_id
@ -236,9 +236,9 @@ int main(int argc, char **argv) {
cf_t *scfdma = vec_malloc(sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb)); cf_t *scfdma = vec_malloc(sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb));
bzero(scfdma, sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb)); bzero(scfdma, sizeof(cf_t) * SF_LEN_PRB(cell.nof_prb));
lte_fft_t fft; srslte_fft_t fft;
lte_ifft_init(&fft, CPNORM, cell.nof_prb); lte_ifft_init(&fft, CPNORM, cell.nof_prb);
lte_fft_set_freq_shift(&fft, 0.5); srslte_fft_set_freq_shift(&fft, 0.5);
lte_ifft_run_sf(&fft, sf_symbols, scfdma); lte_ifft_run_sf(&fft, sf_symbols, scfdma);
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);

@ -63,7 +63,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexErrMsgTxt("Error initiating ULSCH\n"); mexErrMsgTxt("Error initiating ULSCH\n");
return; return;
} }
lte_cell_t cell; srslte_cell_t cell;
cell.nof_prb = 100; cell.nof_prb = 100;
cell.id=1; cell.id=1;
cell.cp=CPNORM; cell.cp=CPNORM;

@ -36,11 +36,11 @@
/*************** STATIC FUNCTIONS ***********************/ /*************** STATIC FUNCTIONS ***********************/
cf_t interp_linear_onesample(cf_t input0, cf_t input1) { cf_t srslte_interp_linear_onesample(cf_t input0, cf_t input1) {
return 2*input1-input0; return 2*input1-input0;
} }
cf_t interp_linear_onesample_cabs(cf_t input0, cf_t input1) { cf_t srslte_interp_linear_onesample_cabs(cf_t input0, cf_t input1) {
float re0=0, im0=0, re1=0, im1=0, re=0, im=0; float re0=0, im0=0, re1=0, im1=0, re=0, im=0;
re0 = crealf(input0); re0 = crealf(input0);
im0 = cimagf(input1); im0 = cimagf(input1);
@ -53,7 +53,7 @@ cf_t interp_linear_onesample_cabs(cf_t input0, cf_t input1) {
/* Performs 1st order integer linear interpolation */ /* Performs 1st order integer linear interpolation */
void interp_linear_f(float *input, float *output, uint32_t M, uint32_t len) { void srslte_interp_linear_f(float *input, float *output, uint32_t M, uint32_t len) {
uint32_t i, j; uint32_t i, j;
for (i=0;i<len-1;i++) { for (i=0;i<len-1;i++) {
for (j=0;j<M;j++) { for (j=0;j<M;j++) {
@ -64,7 +64,7 @@ void interp_linear_f(float *input, float *output, uint32_t M, uint32_t len) {
/* Performs 1st order linear interpolation with out-of-bound interpolation */ /* Performs 1st order linear interpolation with out-of-bound interpolation */
void interp_linear_offset_cabs(cf_t *input, cf_t *output, void srslte_interp_linear_offset_cabs(cf_t *input, cf_t *output,
uint32_t M, uint32_t len, uint32_t M, uint32_t len,
uint32_t off_st, uint32_t off_end) uint32_t off_st, uint32_t off_end)
{ {
@ -98,11 +98,11 @@ void interp_linear_offset_cabs(cf_t *input, cf_t *output,
} }
} }
int interp_linear_vector_init(interp_linvec_t *q, uint32_t vector_len) int srslte_interp_linear_vector_init(srslte_interp_linvec_t *q, uint32_t vector_len)
{ {
int ret = SRSLTE_ERROR_INVALID_INPUTS; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q) { if (q) {
bzero(q, sizeof(interp_linvec_t)); bzero(q, sizeof(srslte_interp_linvec_t));
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
q->diff_vec = vec_malloc(vector_len * sizeof(cf_t)); q->diff_vec = vec_malloc(vector_len * sizeof(cf_t));
if (!q->diff_vec) { if (!q->diff_vec) {
@ -114,16 +114,16 @@ int interp_linear_vector_init(interp_linvec_t *q, uint32_t vector_len)
return ret; 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) { if (q->diff_vec) {
free(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; 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; int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q) { if (q) {
bzero(q, sizeof(interp_lin_t)); bzero(q, sizeof(srslte_interp_lin_t));
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
q->diff_vec = vec_malloc(vector_len * sizeof(cf_t)); q->diff_vec = vec_malloc(vector_len * sizeof(cf_t));
if (!q->diff_vec) { 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; return ret;
} }
void interp_linear_free(interp_lin_t *q) { void srslte_interp_linear_free(srslte_interp_lin_t *q) {
if (q->diff_vec) { if (q->diff_vec) {
free(q->diff_vec); free(q->diff_vec);
} }
@ -182,11 +182,11 @@ void interp_linear_free(interp_lin_t *q) {
free(q->ramp); 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 off_st, uint32_t off_end)
{ {
uint32_t i, j; uint32_t i, j;

@ -97,20 +97,20 @@ int compute_sequences(scrambling_hl* h) {
switch (h->init.channel) { switch (h->init.channel) {
case SCRAMBLING_PBCH: case SCRAMBLING_PBCH:
return sequence_pbch(&h->obj.seq[0], 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: 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, sequence_pdsch(&h->obj.seq[ns], h->init.nrnti, 0, 2 * ns, h->init.cell_id,
LTE_NSOFT_BITS); LTE_NSOFT_BITS);
} }
return 0; return 0;
case SCRAMBLING_PCFICH: 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); sequence_pcfich(&h->obj.seq[ns], 2 * ns, h->init.cell_id);
} }
return 0; return 0;
case SCRAMBLING_PDCCH: 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); sequence_pdcch(&h->obj.seq[ns], 2 * ns, h->init.cell_id, LTE_NSOFT_BITS);
} }
return 0; return 0;
@ -154,7 +154,7 @@ int scrambling_work(scrambling_hl* hl) {
int scrambling_stop(scrambling_hl* hl) { int scrambling_stop(scrambling_hl* hl) {
int i; 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]); sequence_free(&hl->obj.seq[i]);
} }
return 0; return 0;

@ -38,7 +38,7 @@
char *sequence_name = NULL; char *sequence_name = NULL;
bool do_floats = false; bool do_floats = false;
lte_cp_t cp = CPNORM; srslte_cp_t cp = CPNORM;
int cell_id = -1; int cell_id = -1;
void usage(char *prog) { void usage(char *prog) {

@ -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) { 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]; cf_t pss_signal_pad[2048];
int ret = SRSLTE_ERROR_INVALID_INPUTS; 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 /** 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; int k;
k = (CP_NSYMB(cp) - 1) * nof_prb * RE_X_RB + nof_prb * RE_X_RB / 2 - 31; 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)); memset(&slot[k - 5], 0, 5 * sizeof(cf_t));

@ -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 /** 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; uint32_t i, k;
k = (CP_NSYMB(cp) - 2) * nof_prb * RE_X_RB + nof_prb * RE_X_RB / 2 - 31; k = (CP_NSYMB(cp) - 2) * nof_prb * RE_X_RB + nof_prb * RE_X_RB / 2 - 31;

@ -168,10 +168,10 @@ void sync_set_em_alpha(sync_t *q, float alpha) {
pss_synch_set_ema_alpha(&q->pss, 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; 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; 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" * "SSS Detection Method for Initial Cell Search in 3GPP LTE FDD/TDD Dual Mode Receiver"
* by Jung-In Kim et al. * 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 R_norm, R_ext, C_norm, C_ext;
float M_norm=0, M_ext=0; 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 /* Returns 1 if the SSS is found, 0 if not and -1 if there is not enough space
* to correlate * 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; int sss_idx, ret;
sss_synch_set_N_id_2(&q->sss, q->N_id_2); sss_synch_set_N_id_2(&q->sss, q->N_id_2);

@ -47,7 +47,7 @@ void help()
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
lte_cell_t cell; srslte_cell_t cell;
pss_synch_t pss; pss_synch_t pss;
cf_t *input_symbols; cf_t *input_symbols;
int frame_len; int frame_len;

@ -54,7 +54,7 @@ int nof_frames = -1;
uint32_t fft_size=64; uint32_t fft_size=64;
float threshold = 0.4; float threshold = 0.4;
int N_id_2_sync = -1; int N_id_2_sync = -1;
lte_cp_t cp=CPNORM; srslte_cp_t cp=CPNORM;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [aedgtvnp] -f rx_frequency_hz -i cell_id\n", 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 // Estimate CP
if (peak_idx > 2*(fft_size + CP_EXT(fft_size))) { 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)) { if (CP_ISNORM(cp)) {
cp_is_norm++; cp_is_norm++;
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save