Merged with master

master
ismagom 10 years ago
commit d4588a7f3c

@ -28,7 +28,7 @@ for prb=4
subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(ind)=mat;
subframe_lib=srslte_srslte_refsignal_pusch(ueConfig,puschConfig);
subframe_lib=srslte_refsignal_pusch(ueConfig,puschConfig);
error(k)=mean(abs(subframe_mat(:)-subframe_lib(:)));
disp(error(k))

@ -51,7 +51,7 @@ for i=1:length(TBs)
subframe_mat(idx)=cw_mat;
waveform = lteSCFDMAModulate(ueConfig,subframe_mat,0);
[waveform_lib, subframe_lib, cwlib]=srslte_srslte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
[waveform_lib, subframe_lib, cwlib]=srslte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
err=mean(abs(waveform-waveform_lib));
if (err > 10^-6)
disp(err)

@ -26,7 +26,7 @@ for i=1:length(trBlkLenVec)
mat2 = reshape(reshape(mat{1},[],3)',[],1);
out = lteTurboDecode(mat{1});
lib=srslte_srslte_rm_turbo_rx(double(codeword),trBlkLen,RV);
lib=srslte_rm_turbo_rx(double(codeword),trBlkLen,RV);
[outLib] = srslte_turbodecoder(lib);
if (length(trBlkLenVec) == 1)

@ -83,7 +83,7 @@ int mexutils_read_cell(const mxArray *ptr, srslte_cell_t *cell) {
return -1;
}
// TODO
cell->cp = SRSLTE_SRSLTE_CP_NORM;
cell->cp = SRSLTE_CP_NORM;
cell->phich_length = SRSLTE_PHICH_NORM;
cell->phich_resources = SRSLTE_PHICH_SRSLTE_PHICH_R_1_6;
return 0;

@ -89,6 +89,9 @@ IF(${CUHD_FIND} GREATER -1)
add_executable(usrp_capture usrp_capture.c cuhd_utils.c)
target_link_libraries(usrp_capture cuhd srslte)
add_executable(usrp_capture_sync usrp_capture_sync.c cuhd_utils.c)
target_link_libraries(usrp_capture_sync cuhd srslte)
MESSAGE(STATUS " UHD examples will be installed.")
ELSE(${CUHD_FIND} GREATER -1)

@ -52,7 +52,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -215,7 +215,7 @@ void base_init() {
}
/* create ifft object */
if (srslte_ofdm_rx_init(&ifft, SRSLTE_SRSLTE_CP_NORM, cell.nof_prb)) {
if (srslte_ofdm_rx_init(&ifft, SRSLTE_CP_NORM, cell.nof_prb)) {
fprintf(stderr, "Error creating iFFT object\n");
exit(-1);
}
@ -324,7 +324,7 @@ int update_radl(uint32_t sf_idx) {
ra_dl.type0_alloc.rbg_bitmask = prbset_to_bitmask();
srslte_ra_dl_alloc(&prb_alloc, &ra_dl, cell.nof_prb);
srslte_ra_dl_alloc_re(&prb_alloc, cell.nof_prb, 1, cell.nof_prb<10?(cfi+1):cfi, SRSLTE_SRSLTE_CP_NORM);
srslte_ra_dl_alloc_re(&prb_alloc, cell.nof_prb, 1, cell.nof_prb<10?(cfi+1):cfi, SRSLTE_CP_NORM);
srslte_ra_mcs_from_idx_dl(mcs_idx, prb_alloc.slot[0].nof_prb, &ra_dl.mcs);
srslte_ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb);
@ -460,7 +460,7 @@ int main(int argc, char **argv) {
parse_args(argc, argv);
N_id_2 = cell.id % 3;
sf_n_re = 2 * SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb));
cell.phich_length = SRSLTE_PHICH_NORM;
@ -524,9 +524,9 @@ int main(int argc, char **argv) {
bzero(sf_buffer, sizeof(cf_t) * sf_n_re);
if (sf_idx == 0 || sf_idx == 5) {
srslte_pss_put_slot(pss_signal, sf_buffer, cell.nof_prb, SRSLTE_SRSLTE_CP_NORM);
srslte_pss_put_slot(pss_signal, sf_buffer, cell.nof_prb, SRSLTE_CP_NORM);
srslte_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_buffer, cell.nof_prb,
SRSLTE_SRSLTE_CP_NORM);
SRSLTE_CP_NORM);
}
srslte_refsignal_cs_put_sf(cell, 0, est.csr_signal.pilots[0][sf_idx], sf_buffer);

@ -80,6 +80,8 @@ typedef struct {
uint16_t rnti;
char *input_file_name;
uint32_t file_nof_prb;
uint32_t file_nof_ports;
uint32_t file_cell_id;
char *uhd_args;
float uhd_freq;
float uhd_freq_offset;
@ -96,6 +98,8 @@ void args_default(prog_args_t *args) {
args->force_N_id_2 = -1; // Pick the best
args->input_file_name = NULL;
args->file_nof_prb = 6;
args->file_nof_ports = 1;
args->file_cell_id = 0;
args->uhd_args = "";
args->uhd_freq = -1.0;
args->uhd_freq = 8000000.0;
@ -107,7 +111,7 @@ void args_default(prog_args_t *args) {
}
void usage(prog_args_t *args, char *prog) {
printf("Usage: %s [agildnruv] -f rx_frequency (in Hz) | -i input_file\n", prog);
printf("Usage: %s [agpPcildnruv] -f rx_frequency (in Hz) | -i input_file\n", prog);
#ifndef DISABLE_UHD
printf("\t-a UHD args [Default %s]\n", args->uhd_args);
printf("\t-g UHD RX gain [Default %.2f dB]\n", args->uhd_gain);
@ -117,6 +121,8 @@ void usage(prog_args_t *args, char *prog) {
#endif
printf("\t-i input_file [Default USRP]\n");
printf("\t-p nof_prb for input file [Default %d]\n", args->file_nof_prb);
printf("\t-P nof_ports for input file [Default %d]\n", args->file_nof_ports);
printf("\t-c cell_id for input file [Default %d]\n", args->file_cell_id);
printf("\t-r RNTI [Default 0x%x]\n",args->rnti);
printf("\t-l Force N_id_2 [Default best]\n");
#ifndef DISABLE_GRAPHICS
@ -135,7 +141,7 @@ void usage(prog_args_t *args, char *prog) {
void parse_args(prog_args_t *args, int argc, char **argv) {
int opt;
args_default(args);
while ((opt = getopt(argc, argv, "aoglipdnvrfuUsS")) != -1) {
while ((opt = getopt(argc, argv, "aoglipPcdnvrfuUsS")) != -1) {
switch (opt) {
case 'i':
args->input_file_name = argv[optind];
@ -143,6 +149,12 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
case 'p':
args->file_nof_prb = atoi(argv[optind]);
break;
case 'P':
args->file_nof_ports = atoi(argv[optind]);
break;
case 'c':
args->file_cell_id = atoi(argv[optind]);
break;
case 'a':
args->uhd_args = argv[optind];
break;
@ -303,11 +315,11 @@ int main(int argc, char **argv) {
if (prog_args.input_file_name) {
state = DECODE_PDSCH;
/* preset cell configuration */
cell.id = 1;
cell.cp = SRSLTE_SRSLTE_CP_NORM;
cell.id = prog_args.file_cell_id;
cell.cp = SRSLTE_CP_NORM;
cell.phich_length = SRSLTE_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1;
cell.nof_ports = 1;
cell.nof_ports = prog_args.file_nof_ports;
cell.nof_prb = prog_args.file_nof_prb;
if (srslte_ue_sync_init_file(&ue_sync, prog_args.file_nof_prb, prog_args.input_file_name)) {
@ -399,8 +411,8 @@ int main(int argc, char **argv) {
if (prog_args.rnti != SRSLTE_SIRNTI) {
n = srslte_ue_dl_decode(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync));
} else {
n = srslte_ue_dl_decode_rnti_rv(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync), SRSLTE_SIRNTI,
((int) ceilf((float)3*(((sfn)/2)%4)/2))%4);
n = srslte_ue_dl_decode_rnti_rv(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync),
SRSLTE_SIRNTI, ((int) ceilf((float)3*(((sfn)/2)%4)/2))%4);
}
if (n < 0) {
// fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
@ -519,9 +531,9 @@ int main(int argc, char **argv) {
plot_real_t p_sync, pce;
plot_scatter_t pscatequal, pscatequal_pdcch;
float tmp_plot[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_SRSLTE_CP_NORM)];
float tmp_plot2[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_SRSLTE_CP_NORM)];
float tmp_plot3[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_SRSLTE_CP_NORM)];
float tmp_plot[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
float tmp_plot2[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
float tmp_plot3[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
void *plot_thread_run(void *arg) {
int i;

@ -344,7 +344,7 @@ int main(int argc, char **argv) {
cell.id = 1;
cell.nof_ports = 1;
cell.nof_prb = 25;
cell.cp = SRSLTE_SRSLTE_CP_NORM;
cell.cp = SRSLTE_CP_NORM;
cell.phich_length = SRSLTE_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1;
#endif

@ -219,7 +219,7 @@ int main(int argc, char **argv) {
/* If peak detected */
if (peak_value[N_id_2] > corr_peak_threshold) {
sss_idx = peak_pos[N_id_2]-2*(symbol_sz+SRSLTE_CP(symbol_sz,SRSLTE_SRSLTE_CP_NORM_LEN));
sss_idx = peak_pos[N_id_2]-2*(symbol_sz+SRSLTE_CP(symbol_sz,SRSLTE_CP_NORM_LEN));
if (sss_idx >= 0) {
srslte_sss_synch_m0m1_diff(&sss[N_id_2], &input[sss_idx],
&m0, &m0_value, &m1, &m1_value);

@ -0,0 +1,208 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include <stdbool.h>
#include "srslte/srslte.h"
#include "srslte/cuhd/cuhd.h"
static bool keep_running = true;
char *output_file_name = NULL;
char *uhd_args="";
float uhd_gain=40.0, uhd_freq=-1.0;
int nof_prb = 6;
int nof_subframes = -1;
int N_id_2 = -1;
void int_handler(int dummy) {
keep_running = false;
}
void usage(char *prog) {
printf("Usage: %s [agrnv] -l N_id_2 -f rx_frequency_hz -o output_file\n", prog);
printf("\t-a UHD args [Default %s]\n", uhd_args);
printf("\t-g UHD Gain [Default %.2f dB]\n", uhd_gain);
printf("\t-p nof_prb [Default %d]\n", nof_prb);
printf("\t-n nof_subframes [Default %d]\n", nof_subframes);
printf("\t-v srslte_verbose\n");
}
void parse_args(int argc, char **argv) {
int opt;
while ((opt = getopt(argc, argv, "agpnvfol")) != -1) {
switch (opt) {
case 'o':
output_file_name = argv[optind];
break;
case 'a':
uhd_args = argv[optind];
break;
case 'g':
uhd_gain = atof(argv[optind]);
break;
case 'p':
nof_prb = atoi(argv[optind]);
break;
case 'f':
uhd_freq = atof(argv[optind]);
break;
case 'n':
nof_subframes = atoi(argv[optind]);
break;
case 'l':
N_id_2 = atoi(argv[optind]);
break;
case 'v':
srslte_verbose++;
break;
default:
usage(argv[0]);
exit(-1);
}
}
if (uhd_freq < 0 || N_id_2 == -1 || output_file_name == NULL) {
usage(argv[0]);
exit(-1);
}
}
int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples, srslte_timestamp_t *t) {
DEBUG(" ---- Receive %d samples ---- \n", nsamples);
return cuhd_recv(h, data, nsamples, 1);
}
enum receiver_state { DECODE_MIB, SAVE_FILE} state;
int main(int argc, char **argv) {
cf_t *buffer;
int subframe_count, n;
void *uhd;
srslte_filesink_t sink;
srslte_ue_mib_t ue_mib;
srslte_ue_sync_t ue_sync;
srslte_cell_t cell;
enum receiver_state state;
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
signal(SIGINT, int_handler);
parse_args(argc, argv);
subframe_count = 0;
srslte_filesink_init(&sink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN);
printf("Opening UHD device...\n");
if (cuhd_open(uhd_args, &uhd)) {
fprintf(stderr, "Error opening uhd\n");
exit(-1);
}
printf("Set RX freq: %.6f MHz\n", cuhd_set_rx_freq(uhd, uhd_freq) / 1000000);
printf("Set RX gain: %.1f dB\n", cuhd_set_rx_gain(uhd, uhd_gain));
printf("Set RX rate: %.6f MHz\n", cuhd_set_rx_srate(uhd, srslte_sampling_freq_hz(nof_prb)) / 1000000);
cuhd_rx_wait_lo_locked(uhd);
cuhd_start_rx_stream(uhd);
cell.cp = SRSLTE_CP_NORM;
cell.id = N_id_2;
cell.nof_prb = nof_prb;
cell.nof_ports = 1;
if (srslte_ue_sync_init(&ue_sync, cell, cuhd_recv_wrapper, uhd)) {
fprintf(stderr, "Error initiating ue_sync\n");
exit(-1);
}
if (srslte_ue_mib_init(&ue_mib, cell)) {
fprintf(stderr, "Error initaiting UE MIB decoder\n");
exit(-1);
}
state = DECODE_MIB;
bool decoded_mib = false;
uint32_t sfn, sfn_offset;
printf("Waiting for SFN=0\n");
while((subframe_count < nof_subframes || nof_subframes == -1)
&& keep_running)
{
n = srslte_ue_sync_get_buffer(&ue_sync, &buffer);
if (n < 0) {
fprintf(stderr, "Error receiving samples\n");
exit(-1);
}
if (n == 1) {
switch (state) {
case DECODE_MIB:
if (srslte_ue_sync_get_sfidx(&ue_sync) == 0) {
srslte_pbch_decode_reset(&ue_mib.pbch);
n = srslte_ue_mib_decode(&ue_mib, buffer, bch_payload, NULL, &sfn_offset);
if (n < 0) {
fprintf(stderr, "Error decoding UE MIB\n");
exit(-1);
} else if (n == SRSLTE_UE_MIB_FOUND) {
srslte_pbch_mib_unpack(bch_payload, &cell, &sfn);
sfn = (sfn + sfn_offset)%1024;
decoded_mib = true;
}
}
if (decoded_mib && srslte_ue_sync_get_sfidx(&ue_sync) == 9 && sfn == 1023) {
srslte_pbch_mib_fprint(stdout, &cell, sfn, cell.id);
printf("Decoded MIB. SFN: %d\n", sfn);
state = SAVE_FILE;
}
break;
case SAVE_FILE:
printf("Writing to file %4d subframes...\r", subframe_count);
srslte_filesink_write(&sink, buffer, SRSLTE_SF_LEN_PRB(nof_prb));
subframe_count++;
break;
}
if (srslte_ue_sync_get_sfidx(&ue_sync) == 9) {
sfn++;
if (sfn == 1024) {
sfn = 0;
}
}
}
}
srslte_filesink_free(&sink);
cuhd_close(uhd);
srslte_ue_sync_free(&ue_sync);
printf("Ok - wrote %d subframes\n", subframe_count);
exit(0);
}

@ -63,7 +63,7 @@ typedef struct SRSLTE_API {
/** Uplink DeModulation Reference Signal (DMRS) */
typedef struct SRSLTE_API {
srslte_cell_t cell;
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB];
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB];
float *tmp_arg;
uint32_t n_prs_pusch[SRSLTE_NOF_DELTA_SS][SRSLTE_NSLOTS_X_FRAME]; // We precompute n_prs needed for cyclic shift alpha at srslte_refsignal_dl_init()
uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME];

@ -57,7 +57,7 @@
#define SRSLTE_LTE_CRC16 0x11021
#define SRSLTE_LTE_CRC8 0x19B
typedef enum {SRSLTE_SRSLTE_CP_NORM, SRSLTE_SRSLTE_CP_EXT} srslte_cp_t;
typedef enum {SRSLTE_CP_NORM, SRSLTE_CP_EXT} srslte_cp_t;
#define SRSLTE_CRNTI_START 0x003D
@ -77,23 +77,23 @@ typedef enum {SRSLTE_SRSLTE_CP_NORM, SRSLTE_SRSLTE_CP_EXT} srslte_cp_t;
#define SRSLTE_SYMBOL_SZ_MAX 2048
#define SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB 7
#define SRSLTE_SRSLTE_CP_NORM_SF_NSYMB (2*SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB)
#define SRSLTE_SRSLTE_CP_NORM_0_LEN 160
#define SRSLTE_SRSLTE_CP_NORM_LEN 144
#define SRSLTE_CP_NORM_NSYMB 7
#define SRSLTE_CP_NORM_SF_NSYMB (2*SRSLTE_CP_NORM_NSYMB)
#define SRSLTE_CP_NORM_0_LEN 160
#define SRSLTE_CP_NORM_LEN 144
#define SRSLTE_SRSLTE_CP_EXT_NSYMB 6
#define SRSLTE_SRSLTE_CP_EXT_SF_NSYMB (2*SRSLTE_SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_SRSLTE_CP_EXT_LEN 512
#define SRSLTE_SRSLTE_CP_EXT_7_5_LEN 1024
#define SRSLTE_CP_EXT_NSYMB 6
#define SRSLTE_CP_EXT_SF_NSYMB (2*SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP_EXT_LEN 512
#define SRSLTE_CP_EXT_7_5_LEN 1024
#define SRSLTE_CP_ISNORM(cp) (cp==SRSLTE_SRSLTE_CP_NORM)
#define SRSLTE_CP_ISEXT(cp) (cp==SRSLTE_SRSLTE_CP_EXT)
#define SRSLTE_CP_NSYMB(cp) (SRSLTE_CP_ISNORM(cp)?SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB:SRSLTE_SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP_ISNORM(cp) (cp==SRSLTE_CP_NORM)
#define SRSLTE_CP_ISEXT(cp) (cp==SRSLTE_CP_EXT)
#define SRSLTE_CP_NSYMB(cp) (SRSLTE_CP_ISNORM(cp)?SRSLTE_CP_NORM_NSYMB:SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP(symbol_sz, c) ((int) ceil((((float) (c)*(symbol_sz))/2048)))
#define SRSLTE_CP_NORM(symbol, symbol_sz) ((symbol==0)?SRSLTE_CP((symbol_sz),SRSLTE_SRSLTE_CP_NORM_0_LEN):SRSLTE_CP((symbol_sz),SRSLTE_SRSLTE_CP_NORM_LEN))
#define SRSLTE_CP_EXT(symbol_sz) (SRSLTE_CP((symbol_sz),SRSLTE_SRSLTE_CP_EXT_LEN))
#define SRSLTE_CP_NORM(symbol, symbol_sz) ((symbol==0)?SRSLTE_CP((symbol_sz),SRSLTE_CP_NORM_0_LEN):SRSLTE_CP((symbol_sz),SRSLTE_CP_NORM_LEN))
#define SRSLTE_CP_EXT(symbol_sz) (SRSLTE_CP((symbol_sz),SRSLTE_CP_EXT_LEN))
#define SRSLTE_SLOT_LEN(symbol_sz) (480*((symbol_sz)/64))
#define SRSLTE_SF_LEN(symbol_sz) (2*SRSLTE_SLOT_LEN(symbol_sz))
@ -109,9 +109,9 @@ typedef enum {SRSLTE_SRSLTE_CP_NORM, SRSLTE_SRSLTE_CP_EXT} srslte_cp_t;
#define SRSLTE_LTE_TS 1.0/(15000.0*2048)
#define SRSLTE_SLOT_IDX_CPNORM(symbol_idx, symbol_sz) (symbol_idx==0?0:(symbol_sz + SRSLTE_CP(symbol_sz, SRSLTE_SRSLTE_CP_NORM_0_LEN) + \
(symbol_idx-1)*(symbol_sz+SRSLTE_CP(symbol_sz, SRSLTE_SRSLTE_CP_NORM_LEN))))
#define SRSLTE_SLOT_IDX_CPEXT(idx, symbol_sz) (idx*(symbol_sz+SRSLTE_CP(symbol_sz, SRSLTE_SRSLTE_CP_EXT_LEN)))
#define SRSLTE_SLOT_IDX_CPNORM(symbol_idx, symbol_sz) (symbol_idx==0?0:(symbol_sz + SRSLTE_CP(symbol_sz, SRSLTE_CP_NORM_0_LEN) + \
(symbol_idx-1)*(symbol_sz+SRSLTE_CP(symbol_sz, SRSLTE_CP_NORM_LEN))))
#define SRSLTE_SLOT_IDX_CPEXT(idx, symbol_sz) (idx*(symbol_sz+SRSLTE_CP(symbol_sz, SRSLTE_CP_EXT_LEN)))
#define SRSLTE_RE_IDX(nof_prb, symbol_idx, sample_idx) ((symbol_idx)*(nof_prb)*(SRSLTE_NRE) + sample_idx)

@ -42,17 +42,17 @@ typedef struct SRSLTE_API {
uint32_t *forward;
uint32_t *reverse;
uint32_t max_long_cb;
} srs_tc_interl_t;
} srslte_tc_interl_t;
SRSLTE_API int srs_tc_interl_LTE_gen(srs_tc_interl_t *h,
uint32_t long_cb);
SRSLTE_API int srslte_tc_interl_LTE_gen(srslte_tc_interl_t *h,
uint32_t long_cb);
SRSLTE_API int srs_tc_interl_UMTS_gen(srs_tc_interl_t *h,
uint32_t long_cb);
SRSLTE_API int srslte_tc_interl_UMTS_gen(srslte_tc_interl_t *h,
uint32_t long_cb);
SRSLTE_API int srs_tc_interl_init(srs_tc_interl_t *h,
uint32_t max_long_cb);
SRSLTE_API int srslte_tc_interl_init(srslte_tc_interl_t *h,
uint32_t max_long_cb);
SRSLTE_API void srs_tc_interl_free(srs_tc_interl_t *h);
SRSLTE_API void srslte_tc_interl_free(srslte_tc_interl_t *h);
#endif

@ -49,7 +49,7 @@
typedef struct SRSLTE_API {
uint32_t max_long_cb;
srs_tc_interl_t interl;
srslte_tc_interl_t interl;
} srslte_tcod_t;
SRSLTE_API int srslte_tcod_init(srslte_tcod_t *h,

@ -67,7 +67,7 @@ typedef struct SRSLTE_API {
srslte_llr_t *syst;
srslte_llr_t *parity;
srs_tc_interl_t interleaver;
srslte_tc_interl_t interleaver;
} srslte_tdec_t;
SRSLTE_API int srslte_tdec_init(srslte_tdec_t * h,

@ -74,7 +74,7 @@ typedef struct SRSLTE_API {
srslte_cell_t cell;
srslte_pucch_cfg_t pucch_cfg;
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB];
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB];
float tmp_arg[SRSLTE_PUCCH_N_SF_MAX*SRSLTE_PUCCH_N_SEQ];
float y[SRSLTE_PUCCH_N_SEQ];
}srslte_pucch_t;
@ -96,7 +96,7 @@ SRSLTE_API int srslte_pucch_encode(srslte_pucch_t *q,
uint8_t bits[SRSLTE_PUCCH_MAX_BITS],
cf_t *sf_symbols);
SRSLTE_API float srslte_pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB],
SRSLTE_API float srslte_pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB],
srslte_pucch_cfg_t *cfg,
srslte_cp_t cp,
bool is_drms,
@ -105,7 +105,7 @@ SRSLTE_API float srslte_pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME
uint32_t *n_oc);
SRSLTE_API int srslte_generate_n_cs_cell(srslte_cell_t cell,
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB]);
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB]);
SRSLTE_API bool srslte_pucch_cfg_isvalid(srslte_pucch_cfg_t *cfg);

@ -37,7 +37,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1000, // cell_id
SRSLTE_SRSLTE_CP_NORM // cyclic prefix
SRSLTE_CP_NORM // cyclic prefix
};
char *output_matlab = NULL;
@ -62,7 +62,7 @@ void parse_args(int argc, char **argv) {
cell.nof_prb = atoi(argv[optind]);
break;
case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
case 'c':
cell.id = atoi(argv[optind]);

@ -88,9 +88,9 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
cell.nof_prb = mxGetM(INPUT)/SRSLTE_NRE;
cell.nof_ports = (uint32_t) *((double*) mxGetPr(PORTS));
if ((mxGetN(INPUT)%14) == 0) {
cell.cp = SRSLTE_SRSLTE_CP_NORM;
cell.cp = SRSLTE_CP_NORM;
} else if ((mxGetN(INPUT)%12)!=0) {
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
} else {
mexErrMsgTxt("Invalid number of symbols\n");
help();
@ -103,7 +103,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
int nsubframes;
if (cell.cp == SRSLTE_SRSLTE_CP_NORM) {
if (cell.cp == SRSLTE_CP_NORM) {
nsubframes = mxGetN(INPUT)/14;
} else {
nsubframes = mxGetN(INPUT)/12;

@ -39,7 +39,7 @@
void help()
{
mexErrMsgTxt
("[seq] = srslte_srslte_refsignal_pusch(ueConfig, puschConfig)\n\n");
("[seq] = srslte_refsignal_pusch(ueConfig, puschConfig)\n\n");
}
extern int indices[2048];
@ -65,7 +65,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexErrMsgTxt("Field NCellID not found in UE config\n");
return;
}
cell.cp = SRSLTE_SRSLTE_CP_NORM;
cell.cp = SRSLTE_CP_NORM;
cell.nof_ports = 1;
if (mexutils_read_uint32_struct(UECFG, "NSubframe", &sf_idx)) {

@ -37,7 +37,7 @@ srslte_cell_t cell = {
100, // nof_prb
SRSLTE_MAX_PORTS, // nof_ports
1, // cell_id
SRSLTE_SRSLTE_CP_NORM // cyclic prefix
SRSLTE_CP_NORM // cyclic prefix
};
void usage(char *prog) {
@ -59,7 +59,7 @@ void parse_args(int argc, char **argv) {
cell.nof_prb = atoi(argv[optind]);
break;
case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
case 'c':
cell.id = atoi(argv[optind]);

@ -163,7 +163,7 @@ uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod) {
}
char *srslte_cp_string(srslte_cp_t cp) {
if (cp == SRSLTE_SRSLTE_CP_NORM) {
if (cp == SRSLTE_CP_NORM) {
return "Normal";
} else {
return "Extended";

@ -68,7 +68,7 @@ int srslte_ofdm_tx_init_(srslte_ofdm_t *q, srslte_cp_t cp, uint32_t nof_prb, srs
DEBUG("Init %s symbol_sz=%d, nof_symbols=%d, cp=%s, nof_re=%d, nof_guards=%d\n",
dir==SRSLTE_DFT_FORWARD?"FFT":"iFFT", q->symbol_sz, q->nof_symbols,
q->cp==SRSLTE_SRSLTE_CP_NORM?"Normal":"Extended", q->nof_re, q->nof_guards);
q->cp==SRSLTE_CP_NORM?"Normal":"Extended", q->nof_re, q->nof_guards);
return SRSLTE_SUCCESS;
}

@ -35,7 +35,7 @@
#include "srslte/srslte.h"
int nof_prb = -1;
srslte_cp_t cp = SRSLTE_SRSLTE_CP_NORM;
srslte_cp_t cp = SRSLTE_CP_NORM;
void usage(char *prog) {
printf("Usage: %s\n", prog);
@ -51,7 +51,7 @@ void parse_args(int argc, char **argv) {
nof_prb = atoi(argv[optind]);
break;
case 'e':
cp = SRSLTE_SRSLTE_CP_EXT;
cp = SRSLTE_CP_EXT;
break;
default:
usage(argv[0]);

@ -66,7 +66,7 @@ const uint32_t f2_list[SRSLTE_NOF_TC_CB_SIZES] = { 10, 12, 42, 16, 18, 20, 22, 2
280, 142, 480, 146, 444, 120, 152, 462, 234, 158, 80, 96, 902, 166, 336,
170, 86, 174, 176, 178, 120, 182, 184, 186, 94, 190, 480 };
int srs_tc_interl_LTE_gen(srs_tc_interl_t *h, uint32_t long_cb) {
int srslte_tc_interl_LTE_gen(srslte_tc_interl_t *h, uint32_t long_cb) {
uint32_t cb_table_idx, f1, f2;
uint64_t i, j;

@ -54,7 +54,7 @@ const uint8_t table_v[52] = { 3, 2, 2, 3, 2, 5, 2, 3, 2, 6, 3, 5, 2, 2, 2,
2, 7, 5, 3, 2, 3, 5, 2, 5, 2, 6, 3, 3, 2, 3, 2, 2, 6, 5, 2, 5, 2, 2, 2, 19,
5, 2, 3, 2, 3, 2, 6, 3, 7, 7, 6, 3 };
int srs_tc_interl_init(srs_tc_interl_t *h, uint32_t max_long_cb) {
int srslte_tc_interl_init(srslte_tc_interl_t *h, uint32_t max_long_cb) {
int ret = -1;
h->forward = malloc(sizeof(uint32_t) * max_long_cb);
if (!h->forward) {
@ -69,22 +69,22 @@ int srs_tc_interl_init(srs_tc_interl_t *h, uint32_t max_long_cb) {
h->max_long_cb = max_long_cb;
ret = 0;
clean_exit: if (ret == -1) {
srs_tc_interl_free(h);
srslte_tc_interl_free(h);
}
return ret;
}
void srs_tc_interl_free(srs_tc_interl_t *h) {
void srslte_tc_interl_free(srslte_tc_interl_t *h) {
if (h->forward) {
free(h->forward);
}
if (h->reverse) {
free(h->reverse);
}
bzero(h, sizeof(srs_tc_interl_t));
bzero(h, sizeof(srslte_tc_interl_t));
}
int srs_tc_interl_UMTS_gen(srs_tc_interl_t *h, uint32_t long_cb) {
int srslte_tc_interl_UMTS_gen(srslte_tc_interl_t *h, uint32_t long_cb) {
uint32_t i, j;
uint32_t res, prim, aux;

@ -39,7 +39,7 @@
int srslte_tcod_init(srslte_tcod_t *h, uint32_t max_long_cb) {
if (srs_tc_interl_init(&h->interl, max_long_cb)) {
if (srslte_tc_interl_init(&h->interl, max_long_cb)) {
return -1;
}
h->max_long_cb = max_long_cb;
@ -47,7 +47,7 @@ int srslte_tcod_init(srslte_tcod_t *h, uint32_t max_long_cb) {
}
void srslte_tcod_free(srslte_tcod_t *h) {
srs_tc_interl_free(&h->interl);
srslte_tc_interl_free(&h->interl);
h->max_long_cb = 0;
}
@ -65,7 +65,7 @@ int srslte_tcod_encode(srslte_tcod_t *h, uint8_t *input, uint8_t *output, uint32
return -1;
}
if (srs_tc_interl_LTE_gen(&h->interl, long_cb)) {
if (srslte_tc_interl_LTE_gen(&h->interl, long_cb)) {
fprintf(stderr, "Error initiating TC interleaver\n");
return -1;
}

@ -239,7 +239,7 @@ int srslte_tdec_init(srslte_tdec_t * h, uint32_t max_long_cb)
goto clean_and_exit;
}
if (srs_tc_interl_init(&h->interleaver, h->max_long_cb) < 0) {
if (srslte_tc_interl_init(&h->interleaver, h->max_long_cb) < 0) {
goto clean_and_exit;
}
@ -270,7 +270,7 @@ void srslte_tdec_free(srslte_tdec_t * h)
srslte_map_gen_free(&h->dec);
srs_tc_interl_free(&h->interleaver);
srslte_tc_interl_free(&h->interleaver);
bzero(h, sizeof(srslte_tdec_t));
}
@ -323,7 +323,7 @@ int srslte_tdec_reset(srslte_tdec_t * h, uint32_t long_cb)
return -1;
}
memset(h->w, 0, sizeof(srslte_llr_t) * long_cb);
return srs_tc_interl_LTE_gen(&h->interleaver, long_cb);
return srslte_tc_interl_LTE_gen(&h->interleaver, long_cb);
}
void srslte_tdec_decision(srslte_tdec_t * h, uint8_t *output, uint32_t long_cb)

@ -41,7 +41,7 @@
void help()
{
mexErrMsgTxt
("[out] = srslte_srslte_rm_turbo_rx(in, trblkin, rv)\n\n");
("[out] = srslte_rm_turbo_rx(in, trblkin, rv)\n\n");
}
/* the gateway function */

@ -41,8 +41,8 @@
#include "srslte/utils/vector.h"
#include "srslte/utils/debug.h"
#define PBCH_RE_SRSLTE_SRSLTE_CP_NORM 240
#define PBCH_RE_SRSLTE_SRSLTE_CP_EXT 216
#define PBCH_RE_CP_NORM 240
#define PBCH_RE_CP_EXT 216
const uint8_t srslte_crc_mask[4][16] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@ -141,7 +141,7 @@ int srslte_pbch_init(srslte_pbch_t *q, srslte_cell_t cell) {
bzero(q, sizeof(srslte_pbch_t));
q->cell = cell;
q->nof_symbols = (SRSLTE_CP_ISNORM(q->cell.cp)) ? PBCH_RE_SRSLTE_SRSLTE_CP_NORM : PBCH_RE_SRSLTE_SRSLTE_CP_EXT;
q->nof_symbols = (SRSLTE_CP_ISNORM(q->cell.cp)) ? PBCH_RE_CP_NORM : PBCH_RE_CP_EXT;
if (srslte_precoding_init(&q->precoding, SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp))) {
fprintf(stderr, "Error initializing precoding\n");

@ -50,7 +50,7 @@ bool srslte_pucch_cfg_isvalid(srslte_pucch_cfg_t *cfg) {
/* Generates n_cs_cell according to Sec 5.4 of 36.211 */
int srslte_generate_n_cs_cell(srslte_cell_t cell, uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB])
int srslte_generate_n_cs_cell(srslte_cell_t cell, uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB])
{
srslte_sequence_t seq;
bzero(&seq, sizeof(srslte_sequence_t));
@ -71,7 +71,7 @@ int srslte_generate_n_cs_cell(srslte_cell_t cell, uint32_t n_cs_cell[SRSLTE_NSLO
/* Calculates alpha according to 5.5.2.2.2 of 36.211 */
float srslte_pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB],
float srslte_pucch_get_alpha(uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB],
srslte_pucch_cfg_t *cfg,
srslte_cp_t cp, bool is_drms,
uint32_t ns, uint32_t l,

@ -40,7 +40,7 @@ srslte_cell_t cell = {
2, // nof_ports
0, // bw_idx
150, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -87,7 +87,7 @@ void parse_args(int argc, char **argv) {
srslte_verbose++;
break;
case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
default:
usage(argv[0]);

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -86,7 +86,7 @@ int main(int argc, char **argv) {
parse_args(argc,argv);
nof_re = SRSLTE_SLOT_LEN_RE(cell.nof_prb, SRSLTE_SRSLTE_CP_NORM);
nof_re = SRSLTE_SLOT_LEN_RE(cell.nof_prb, SRSLTE_CP_NORM);
/* init memory */
for (i=0;i<cell.nof_ports;i++) {

@ -42,7 +42,7 @@ srslte_cell_t cell = {
1, // nof_ports
0, // bw_idx
0, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -91,7 +91,7 @@ void parse_args(int argc, char **argv) {
srslte_verbose++;
break;
case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
default:
usage(argv[0]);

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1000, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -88,7 +88,7 @@ int main(int argc, char **argv) {
parse_args(argc,argv);
nof_re = SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
nof_re = SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
/* init memory */
for (i=0;i<SRSLTE_MAX_PORTS;i++) {

@ -42,7 +42,7 @@ srslte_cell_t cell = {
1, // cell.cell.nof_ports
0, // bw_idx
0, // cell.id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -109,7 +109,7 @@ void parse_args(int argc, char **argv) {
srslte_verbose++;
break;
case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
default:
usage(argv[0]);

@ -37,7 +37,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -121,7 +121,7 @@ int main(int argc, char **argv) {
parse_args(argc, argv);
nof_re = SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
nof_re = SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
if (test_dci_payload_size()) {
exit(-1);

@ -42,7 +42,7 @@ srslte_cell_t cell = {
1, // nof_ports
0, // bw_idx
0, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -118,7 +118,7 @@ void parse_args(int argc, char **argv) {
srslte_verbose++;
break;
case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
default:
usage(argv[0]);

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
0, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_SRSLTE_PHICH_R_1_6, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -143,7 +143,7 @@ int main(int argc, char **argv) {
bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
bzero(slot_symbols, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
nof_re = 2 * SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
nof_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
mcs.mod = modulation;

@ -109,7 +109,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
nof_re = 2 * SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
nof_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
mcs.tbs = mxGetScalar(TBS);
if (mcs.tbs == 0) {

@ -41,7 +41,7 @@ srslte_cell_t cell = {
2, // cell.nof_ports
2, // bw_idx
150, // cell.id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -114,7 +114,7 @@ void parse_args(int argc, char **argv) {
srslte_verbose++;
break;
case 'l':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
default:
usage(argv[0]);

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1000, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -87,7 +87,7 @@ void parse_args(int argc, char **argv) {
phich_length = SRSLTE_PHICH_EXT;
break;
case 'l':
cell.cp = SRSLTE_SRSLTE_CP_EXT;
cell.cp = SRSLTE_CP_EXT;
break;
case 'v':
srslte_verbose++;
@ -116,7 +116,7 @@ int main(int argc, char **argv) {
max_nseq = SRSLTE_CP_ISNORM(cell.cp)?SRSLTE_PHICH_NORM_NSEQUENCES:SRSLTE_PHICH_EXT_NSEQUENCES;
nof_re = SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
nof_re = SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
/* init memory */
for (i=0;i<SRSLTE_MAX_PORTS;i++) {

@ -43,7 +43,7 @@
void help()
{
mexErrMsgTxt
("sym=srslte_srslte_pusch_encode(ue, chs, trblkin, cqi, ri, ack)\n\n");
("sym=srslte_pusch_encode(ue, chs, trblkin, cqi, ri, ack)\n\n");
}
/* the gateway function */
@ -195,7 +195,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
cf_t *scfdma = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
bzero(scfdma, sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
srslte_ofdm_t fft;
srslte_ofdm_rx_init(&fft, SRSLTE_SRSLTE_CP_NORM, cell.nof_prb);
srslte_ofdm_rx_init(&fft, SRSLTE_CP_NORM, cell.nof_prb);
srslte_ofdm_set_normalize(&fft, true);
srslte_ofdm_set_freq_shift(&fft, 0.5);
srslte_ofdm_rx_sf(&fft, sf_symbols, scfdma);

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
0, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_SRSLTE_PHICH_R_1_6, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -237,7 +237,7 @@ int main(int argc, char **argv) {
cf_t *scfdma = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
bzero(scfdma, sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
srslte_ofdm_t fft;
srslte_ofdm_rx_init(&fft, SRSLTE_SRSLTE_CP_NORM, cell.nof_prb);
srslte_ofdm_rx_init(&fft, SRSLTE_CP_NORM, cell.nof_prb);
srslte_ofdm_set_freq_shift(&fft, 0.5);
srslte_ofdm_rx_sf(&fft, sf_symbols, scfdma);

@ -40,7 +40,7 @@
void help()
{
mexErrMsgTxt
("[cwout] = srslte_srslte_pusch_encode(ue, chs, trblkin, cqi, ri, ack)\n\n");
("[cwout] = srslte_pusch_encode(ue, chs, trblkin, cqi, ri, ack)\n\n");
}
/* the gateway function */
@ -66,7 +66,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
srslte_cell_t cell;
cell.nof_prb = 100;
cell.id=1;
cell.cp=SRSLTE_SRSLTE_CP_NORM;
cell.cp=SRSLTE_CP_NORM;
if (srslte_harq_init(&harq_process, cell)) {
mexErrMsgTxt("Error initiating HARQ\n");
return;

@ -38,7 +38,7 @@
char *srslte_sequence_name = NULL;
bool do_floats = false;
srslte_cp_t cp = SRSLTE_SRSLTE_CP_NORM;
srslte_cp_t cp = SRSLTE_CP_NORM;
int cell_id = -1;
void usage(char *prog) {
@ -55,7 +55,7 @@ void parse_args(int argc, char **argv) {
cell_id = atoi(argv[optind]);
break;
case 'e':
cp = SRSLTE_SRSLTE_CP_EXT;
cp = SRSLTE_CP_EXT;
break;
case 'f':
do_floats = true;

@ -59,7 +59,7 @@ int srslte_sync_init(srslte_sync_t *q, uint32_t frame_size, uint32_t fft_size) {
bzero(q, sizeof(srslte_sync_t));
q->detect_cp = true;
q->cp = SRSLTE_SRSLTE_CP_NORM;
q->cp = SRSLTE_CP_NORM;
q->mean_peak_value = 0.0;
q->sss_en = true;
q->correct_cfo = true;
@ -215,14 +215,14 @@ srslte_cp_t srslte_sync_detect_cp(srslte_sync_t *q, cf_t *input, uint32_t peak_p
q->M_ext_avg = SRSLTE_VEC_EMA(M_ext/2, q->M_ext_avg, CP_EMA_ALPHA);
if (q->M_norm_avg > q->M_ext_avg) {
return SRSLTE_SRSLTE_CP_NORM;
return SRSLTE_CP_NORM;
} else if (q->M_norm_avg < q->M_ext_avg) {
return SRSLTE_SRSLTE_CP_EXT;
return SRSLTE_CP_EXT;
} else {
if (R_norm > R_ext) {
return SRSLTE_SRSLTE_CP_NORM;
return SRSLTE_CP_NORM;
} else {
return SRSLTE_SRSLTE_CP_EXT;
return SRSLTE_CP_EXT;
}
}
}
@ -236,7 +236,7 @@ int sync_sss(srslte_sync_t *q, cf_t *input, uint32_t peak_pos, srslte_cp_t cp) {
srslte_sss_synch_set_N_id_2(&q->sss, q->N_id_2);
/* Make sure we have enough room to find SSS sequence */
sss_idx = (int) peak_pos-2*q->fft_size-SRSLTE_CP(q->fft_size, (SRSLTE_CP_ISNORM(q->cp)?SRSLTE_SRSLTE_CP_NORM_LEN:SRSLTE_SRSLTE_CP_EXT_LEN));
sss_idx = (int) peak_pos-2*q->fft_size-SRSLTE_CP(q->fft_size, (SRSLTE_CP_ISNORM(q->cp)?SRSLTE_CP_NORM_LEN:SRSLTE_CP_EXT_LEN));
if (sss_idx < 0) {
INFO("Not enough room to decode CP SSS (sss_idx=%d, peak_pos=%d)\n", sss_idx, peak_pos);
return SRSLTE_ERROR;

@ -53,7 +53,7 @@ int nof_frames = -1;
uint32_t fft_size=64;
float threshold = 0.4;
int N_id_2_sync = -1;
srslte_cp_t cp=SRSLTE_SRSLTE_CP_NORM;
srslte_cp_t cp=SRSLTE_CP_NORM;
void usage(char *prog) {
printf("Usage: %s [nlestdv] -i cell_id -f input_file_name\n", prog);
@ -81,7 +81,7 @@ void parse_args(int argc, char **argv) {
threshold = atof(argv[optind]);
break;
case 'e':
cp = SRSLTE_SRSLTE_CP_EXT;
cp = SRSLTE_CP_EXT;
break;
case 'i':
cell_id = atoi(argv[optind]);
@ -231,7 +231,7 @@ int main(int argc, char **argv) {
}
// Find SSS
int sss_idx = peak_idx-2*fft_size-(SRSLTE_CP_ISNORM(cp)?SRSLTE_CP(fft_size, SRSLTE_SRSLTE_CP_NORM_LEN):SRSLTE_CP(fft_size, SRSLTE_SRSLTE_CP_EXT_LEN));
int sss_idx = peak_idx-2*fft_size-(SRSLTE_CP_ISNORM(cp)?SRSLTE_CP(fft_size, SRSLTE_CP_NORM_LEN):SRSLTE_CP(fft_size, SRSLTE_CP_EXT_LEN));
if (sss_idx >= 0 && sss_idx < flen-fft_size) {
srslte_sss_synch_m0m1_partial(&sss, &buffer[sss_idx], 3, NULL, &m0, &m0_value, &m1, &m1_value);
if (srslte_sss_synch_N_id_1(&sss, m0, m1) != N_id_1) {

@ -54,7 +54,7 @@ int nof_frames = -1;
uint32_t fft_size=64;
float threshold = 0.4;
int N_id_2_sync = -1;
srslte_cp_t cp=SRSLTE_SRSLTE_CP_NORM;
srslte_cp_t cp=SRSLTE_CP_NORM;
void usage(char *prog) {
printf("Usage: %s [aedgtvnp] -f rx_frequency_hz -i cell_id\n", prog);
@ -90,7 +90,7 @@ void parse_args(int argc, char **argv) {
threshold = atof(argv[optind]);
break;
case 'e':
cp = SRSLTE_SRSLTE_CP_EXT;
cp = SRSLTE_CP_EXT;
break;
case 'i':
cell_id = atoi(argv[optind]);
@ -241,7 +241,7 @@ int main(int argc, char **argv) {
}
// Find SSS
int sss_idx = peak_idx-2*fft_size-(SRSLTE_CP_ISNORM(cp)?SRSLTE_CP(fft_size, SRSLTE_SRSLTE_CP_NORM_LEN):SRSLTE_CP(fft_size, SRSLTE_SRSLTE_CP_EXT_LEN));
int sss_idx = peak_idx-2*fft_size-(SRSLTE_CP_ISNORM(cp)?SRSLTE_CP(fft_size, SRSLTE_CP_NORM_LEN):SRSLTE_CP(fft_size, SRSLTE_CP_EXT_LEN));
if (sss_idx >= 0 && sss_idx < flen-fft_size) {
srslte_sss_synch_m0m1_partial(&sss, &buffer[sss_idx], 3, NULL, &m0, &m0_value, &m1, &m1_value);
if (srslte_sss_synch_N_id_1(&sss, m0, m1) != N_id_1) {

@ -38,7 +38,7 @@
#include "srslte/srslte.h"
int cell_id = -1, offset = 0;
srslte_cp_t cp = SRSLTE_SRSLTE_CP_NORM;
srslte_cp_t cp = SRSLTE_CP_NORM;
uint32_t nof_prb=6;
#define FLEN SRSLTE_SF_LEN(fft_size)
@ -66,7 +66,7 @@ void parse_args(int argc, char **argv) {
offset = atoi(argv[optind]);
break;
case 'e':
cp = SRSLTE_SRSLTE_CP_EXT;
cp = SRSLTE_CP_EXT;
break;
case 'v':
srslte_verbose++;

@ -167,9 +167,9 @@ static void get_cell(srslte_ue_cellsearch_t * q, uint32_t nof_detected_frames, s
found_cell->peak /= nof_detected_frames;
if (nof_normal > q->mode_ntimes[mode_pos]/2) {
found_cell->cp = SRSLTE_SRSLTE_CP_NORM;
found_cell->cp = SRSLTE_CP_NORM;
} else {
found_cell->cp = SRSLTE_SRSLTE_CP_EXT;
found_cell->cp = SRSLTE_CP_EXT;
}
found_cell->mode = (float) q->mode_ntimes[mode_pos]/nof_detected_frames;

@ -54,7 +54,7 @@ int nof_frames = -1;
uint32_t fft_size=128;
float threshold = 0.4;
int N_id_2_sync = -1;
srslte_cp_t cp=SRSLTE_SRSLTE_CP_NORM;
srslte_cp_t cp=SRSLTE_CP_NORM;
void usage(char *prog) {
printf("Usage: %s [aedgtvnp] -f rx_frequency_hz -i cell_id\n", prog);
@ -90,7 +90,7 @@ void parse_args(int argc, char **argv) {
threshold = atof(argv[optind]);
break;
case 'e':
cp = SRSLTE_SRSLTE_CP_EXT;
cp = SRSLTE_CP_EXT;
break;
case 'i':
cell_id = atoi(argv[optind]);
@ -242,7 +242,7 @@ int main(int argc, char **argv) {
}
// Find SSS
int sss_idx = peak_idx-2*fft_size-(SRSLTE_CP_ISNORM(cp)?SRSLTE_CP(fft_size, SRSLTE_SRSLTE_CP_NORM_LEN):SRSLTE_CP(fft_size, SRSLTE_SRSLTE_CP_EXT_LEN));
int sss_idx = peak_idx-2*fft_size-(SRSLTE_CP_ISNORM(cp)?SRSLTE_CP(fft_size, SRSLTE_CP_NORM_LEN):SRSLTE_CP(fft_size, SRSLTE_CP_EXT_LEN));
if (sss_idx >= 0 && sss_idx < flen-fft_size) {
srslte_sss_synch_m0m1_partial(&sss, &buffer[sss_idx], 3, NULL, &m0, &m0_value, &m1, &m1_value);
if (srslte_sss_synch_N_id_1(&sss, m0, m1) != N_id_1) {

@ -45,7 +45,7 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length
};
@ -145,7 +145,7 @@ void base_init() {
}
/* create ifft object */
if (srslte_ofdm_rx_init(&ifft, SRSLTE_SRSLTE_CP_NORM, cell.nof_prb)) {
if (srslte_ofdm_rx_init(&ifft, SRSLTE_CP_NORM, cell.nof_prb)) {
fprintf(stderr, "Error creating iFFT object\n");
exit(-1);
}
@ -183,7 +183,7 @@ int main(int argc, char **argv) {
parse_args(argc, argv);
N_id_2 = cell.id % 3;
sf_n_re = 2 * SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb));
cell.phich_length = SRSLTE_PHICH_NORM;
@ -228,9 +228,9 @@ int main(int argc, char **argv) {
#ifdef kk
if (sf_idx == 0 || sf_idx == 5) {
srslte_pss_put_slot(pss_signal, sf_buffer, cell.nof_prb, SRSLTE_SRSLTE_CP_NORM);
srslte_pss_put_slot(pss_signal, sf_buffer, cell.nof_prb, SRSLTE_CP_NORM);
srslte_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_buffer, cell.nof_prb,
SRSLTE_SRSLTE_CP_NORM);
SRSLTE_CP_NORM);
/* Transform to OFDM symbols */
srslte_ofdm_rx_sf(&ifft, sf_buffer, output_buffer);

@ -316,7 +316,7 @@ int main(int argc, char **argv) {
state = DECODE_PDSCH;
/* preset cell configuration */
cell.id = 1;
cell.cp = SRSLTE_SRSLTE_CP_NORM;
cell.cp = SRSLTE_CP_NORM;
cell.phich_length = SRSLTE_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1;
cell.nof_ports = 1;
@ -541,9 +541,9 @@ plot_real_t poutfft;
plot_real_t pce_angle, pce;
plot_scatter_t pscatequal, pscatequal_pdcch;
float tmp_plot[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_SRSLTE_CP_NORM)];
float tmp_plot2[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_SRSLTE_CP_NORM)];
float tmp_plot3[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_SRSLTE_CP_NORM)];
float tmp_plot[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
float tmp_plot2[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
float tmp_plot3[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
void *plot_thread_run(void *arg) {
int i;

Loading…
Cancel
Save