Fixed some srslte duplicate prefix

master
ismagom 10 years ago
parent 8722ad8037
commit 8274370d3d

@ -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=srslte_srslte_refsignal_pusch(ueConfig,puschConfig); subframe_lib=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))

@ -51,7 +51,7 @@ for i=1:length(TBs)
subframe_mat(idx)=cw_mat; subframe_mat(idx)=cw_mat;
waveform = lteSCFDMAModulate(ueConfig,subframe_mat,0); 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)); err=mean(abs(waveform-waveform_lib));
if (err > 10^-6) if (err > 10^-6)
disp(err) disp(err)

@ -26,7 +26,7 @@ for i=1:length(trBlkLenVec)
mat2 = reshape(reshape(mat{1},[],3)',[],1); mat2 = reshape(reshape(mat{1},[],3)',[],1);
out = lteTurboDecode(mat{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); [outLib] = srslte_turbodecoder(lib);
if (length(trBlkLenVec) == 1) if (length(trBlkLenVec) == 1)

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

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

@ -52,7 +52,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1, // cell_id 1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length SRSLTE_PHICH_NORM // PHICH length
}; };
@ -215,7 +215,7 @@ void base_init() {
} }
/* create ifft object */ /* 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"); fprintf(stderr, "Error creating iFFT object\n");
exit(-1); exit(-1);
} }
@ -324,7 +324,7 @@ int update_radl(uint32_t sf_idx) {
ra_dl.type0_alloc.rbg_bitmask = prbset_to_bitmask(); ra_dl.type0_alloc.rbg_bitmask = prbset_to_bitmask();
srslte_ra_dl_alloc(&prb_alloc, &ra_dl, cell.nof_prb); 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_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); srslte_ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb);
@ -460,7 +460,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 * 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)); sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb));
cell.phich_length = SRSLTE_PHICH_NORM; 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); bzero(sf_buffer, sizeof(cf_t) * sf_n_re);
if (sf_idx == 0 || sf_idx == 5) { 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_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); srslte_refsignal_cs_put_sf(cell, 0, est.csr_signal.pilots[0][sf_idx], sf_buffer);

@ -304,7 +304,7 @@ int main(int argc, char **argv) {
state = DECODE_PDSCH; state = DECODE_PDSCH;
/* preset cell configuration */ /* preset cell configuration */
cell.id = 1; cell.id = 1;
cell.cp = SRSLTE_SRSLTE_CP_NORM; cell.cp = SRSLTE_CP_NORM;
cell.phich_length = SRSLTE_PHICH_NORM; cell.phich_length = SRSLTE_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1; cell.phich_resources = SRSLTE_PHICH_R_1;
cell.nof_ports = 1; cell.nof_ports = 1;
@ -519,9 +519,9 @@ int main(int argc, char **argv) {
plot_real_t p_sync, pce; plot_real_t p_sync, pce;
plot_scatter_t pscatequal, pscatequal_pdcch; plot_scatter_t pscatequal, pscatequal_pdcch;
float tmp_plot[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_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_SRSLTE_CP_NORM)]; float tmp_plot3[SRSLTE_SLOT_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)];
void *plot_thread_run(void *arg) { void *plot_thread_run(void *arg) {
int i; int i;

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

@ -219,7 +219,7 @@ int main(int argc, char **argv) {
/* If peak detected */ /* If peak detected */
if (peak_value[N_id_2] > corr_peak_threshold) { 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) { if (sss_idx >= 0) {
srslte_sss_synch_m0m1_diff(&sss[N_id_2], &input[sss_idx], srslte_sss_synch_m0m1_diff(&sss[N_id_2], &input[sss_idx],
&m0, &m0_value, &m1, &m1_value); &m0, &m0_value, &m1, &m1_value);

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

@ -57,7 +57,7 @@
#define SRSLTE_LTE_CRC16 0x11021 #define SRSLTE_LTE_CRC16 0x11021
#define SRSLTE_LTE_CRC8 0x19B #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 #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_SYMBOL_SZ_MAX 2048
#define SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB 7 #define SRSLTE_CP_NORM_NSYMB 7
#define SRSLTE_SRSLTE_CP_NORM_SF_NSYMB (2*SRSLTE_SRSLTE_SRSLTE_CP_NORM_NSYMB) #define SRSLTE_CP_NORM_SF_NSYMB (2*SRSLTE_CP_NORM_NSYMB)
#define SRSLTE_SRSLTE_CP_NORM_0_LEN 160 #define SRSLTE_CP_NORM_0_LEN 160
#define SRSLTE_SRSLTE_CP_NORM_LEN 144 #define SRSLTE_CP_NORM_LEN 144
#define SRSLTE_SRSLTE_CP_EXT_NSYMB 6 #define SRSLTE_CP_EXT_NSYMB 6
#define SRSLTE_SRSLTE_CP_EXT_SF_NSYMB (2*SRSLTE_SRSLTE_CP_EXT_NSYMB) #define SRSLTE_CP_EXT_SF_NSYMB (2*SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_SRSLTE_CP_EXT_LEN 512 #define SRSLTE_CP_EXT_LEN 512
#define SRSLTE_SRSLTE_CP_EXT_7_5_LEN 1024 #define SRSLTE_CP_EXT_7_5_LEN 1024
#define SRSLTE_CP_ISNORM(cp) (cp==SRSLTE_SRSLTE_CP_NORM) #define SRSLTE_CP_ISNORM(cp) (cp==SRSLTE_CP_NORM)
#define SRSLTE_CP_ISEXT(cp) (cp==SRSLTE_SRSLTE_CP_EXT) #define SRSLTE_CP_ISEXT(cp) (cp==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_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(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_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_SRSLTE_CP_EXT_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_SLOT_LEN(symbol_sz) (480*((symbol_sz)/64))
#define SRSLTE_SF_LEN(symbol_sz) (2*SRSLTE_SLOT_LEN(symbol_sz)) #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_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) + \ #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_SRSLTE_CP_NORM_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_SRSLTE_CP_EXT_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) #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 *forward;
uint32_t *reverse; uint32_t *reverse;
uint32_t max_long_cb; 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, SRSLTE_API int srslte_tc_interl_LTE_gen(srslte_tc_interl_t *h,
uint32_t long_cb); uint32_t long_cb);
SRSLTE_API int srs_tc_interl_UMTS_gen(srs_tc_interl_t *h, SRSLTE_API int srslte_tc_interl_UMTS_gen(srslte_tc_interl_t *h,
uint32_t long_cb); uint32_t long_cb);
SRSLTE_API int srs_tc_interl_init(srs_tc_interl_t *h, SRSLTE_API int srslte_tc_interl_init(srslte_tc_interl_t *h,
uint32_t max_long_cb); 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 #endif

@ -49,7 +49,7 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_long_cb; uint32_t max_long_cb;
srs_tc_interl_t interl; srslte_tc_interl_t interl;
} srslte_tcod_t; } srslte_tcod_t;
SRSLTE_API int srslte_tcod_init(srslte_tcod_t *h, 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 *syst;
srslte_llr_t *parity; srslte_llr_t *parity;
srs_tc_interl_t interleaver; srslte_tc_interl_t interleaver;
} srslte_tdec_t; } srslte_tdec_t;
SRSLTE_API int srslte_tdec_init(srslte_tdec_t * h, SRSLTE_API int srslte_tdec_init(srslte_tdec_t * h,

@ -52,8 +52,8 @@
#define BCH_PAYLOADCRC_LEN (BCH_PAYLOAD_LEN+16) #define BCH_PAYLOADCRC_LEN (BCH_PAYLOAD_LEN+16)
#define BCH_ENCODED_LEN 3*(BCH_PAYLOADCRC_LEN) #define BCH_ENCODED_LEN 3*(BCH_PAYLOADCRC_LEN)
#define PBCH_RE_SRSLTE_SRSLTE_CP_NORM 240 #define PBCH_RE_SRSLTE_CP_NORM 240
#define PBCH_RE_SRSLTE_SRSLTE_CP_EXT 216 #define PBCH_RE_SRSLTE_CP_EXT 216
/* PBCH object */ /* PBCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {

@ -74,7 +74,7 @@ typedef struct SRSLTE_API {
srslte_cell_t cell; srslte_cell_t cell;
srslte_pucch_cfg_t pucch_cfg; 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 tmp_arg[SRSLTE_PUCCH_N_SF_MAX*SRSLTE_PUCCH_N_SEQ];
float y[SRSLTE_PUCCH_N_SEQ]; float y[SRSLTE_PUCCH_N_SEQ];
}srslte_pucch_t; }srslte_pucch_t;
@ -96,7 +96,7 @@ SRSLTE_API int srslte_pucch_encode(srslte_pucch_t *q,
uint8_t bits[SRSLTE_PUCCH_MAX_BITS], uint8_t bits[SRSLTE_PUCCH_MAX_BITS],
cf_t *sf_symbols); 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_pucch_cfg_t *cfg,
srslte_cp_t cp, srslte_cp_t cp,
bool is_drms, 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); uint32_t *n_oc);
SRSLTE_API int srslte_generate_n_cs_cell(srslte_cell_t cell, 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); SRSLTE_API bool srslte_pucch_cfg_isvalid(srslte_pucch_cfg_t *cfg);

@ -37,7 +37,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1000, // cell_id 1000, // cell_id
SRSLTE_SRSLTE_CP_NORM // cyclic prefix SRSLTE_CP_NORM // cyclic prefix
}; };
char *output_matlab = NULL; char *output_matlab = NULL;
@ -62,7 +62,7 @@ void parse_args(int argc, char **argv) {
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = atoi(argv[optind]);
break; break;
case 'e': case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); 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_prb = mxGetM(INPUT)/SRSLTE_NRE;
cell.nof_ports = (uint32_t) *((double*) mxGetPr(PORTS)); cell.nof_ports = (uint32_t) *((double*) mxGetPr(PORTS));
if ((mxGetN(INPUT)%14) == 0) { if ((mxGetN(INPUT)%14) == 0) {
cell.cp = SRSLTE_SRSLTE_CP_NORM; cell.cp = SRSLTE_CP_NORM;
} else if ((mxGetN(INPUT)%12)!=0) { } else if ((mxGetN(INPUT)%12)!=0) {
cell.cp = SRSLTE_SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
} else { } else {
mexErrMsgTxt("Invalid number of symbols\n"); mexErrMsgTxt("Invalid number of symbols\n");
help(); help();
@ -103,7 +103,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} }
int nsubframes; int nsubframes;
if (cell.cp == SRSLTE_SRSLTE_CP_NORM) { if (cell.cp == SRSLTE_CP_NORM) {
nsubframes = mxGetN(INPUT)/14; nsubframes = mxGetN(INPUT)/14;
} else { } else {
nsubframes = mxGetN(INPUT)/12; nsubframes = mxGetN(INPUT)/12;

@ -39,7 +39,7 @@
void help() void help()
{ {
mexErrMsgTxt mexErrMsgTxt
("[seq] = srslte_srslte_refsignal_pusch(ueConfig, puschConfig)\n\n"); ("[seq] = srslte_refsignal_pusch(ueConfig, puschConfig)\n\n");
} }
extern int indices[2048]; 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"); mexErrMsgTxt("Field NCellID not found in UE config\n");
return; return;
} }
cell.cp = SRSLTE_SRSLTE_CP_NORM; cell.cp = SRSLTE_CP_NORM;
cell.nof_ports = 1; cell.nof_ports = 1;
if (mexutils_read_uint32_struct(UECFG, "NSubframe", &sf_idx)) { if (mexutils_read_uint32_struct(UECFG, "NSubframe", &sf_idx)) {

@ -37,7 +37,7 @@ srslte_cell_t cell = {
100, // nof_prb 100, // nof_prb
SRSLTE_MAX_PORTS, // nof_ports SRSLTE_MAX_PORTS, // nof_ports
1, // cell_id 1, // cell_id
SRSLTE_SRSLTE_CP_NORM // cyclic prefix SRSLTE_CP_NORM // cyclic prefix
}; };
void usage(char *prog) { void usage(char *prog) {
@ -59,7 +59,7 @@ void parse_args(int argc, char **argv) {
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = atoi(argv[optind]);
break; break;
case 'e': case 'e':
cell.cp = SRSLTE_SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); 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) { char *srslte_cp_string(srslte_cp_t cp) {
if (cp == SRSLTE_SRSLTE_CP_NORM) { if (cp == SRSLTE_CP_NORM) {
return "Normal"; return "Normal";
} else { } else {
return "Extended"; 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", 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, 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; return SRSLTE_SUCCESS;
} }

@ -35,7 +35,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
int nof_prb = -1; int nof_prb = -1;
srslte_cp_t cp = SRSLTE_SRSLTE_CP_NORM; srslte_cp_t cp = SRSLTE_CP_NORM;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s\n", prog); printf("Usage: %s\n", prog);
@ -51,7 +51,7 @@ void parse_args(int argc, char **argv) {
nof_prb = atoi(argv[optind]); nof_prb = atoi(argv[optind]);
break; break;
case 'e': case 'e':
cp = SRSLTE_SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
default: default:
usage(argv[0]); 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, 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 }; 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; uint32_t cb_table_idx, f1, f2;
uint64_t i, j; 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, 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 }; 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; int ret = -1;
h->forward = malloc(sizeof(uint32_t) * max_long_cb); h->forward = malloc(sizeof(uint32_t) * max_long_cb);
if (!h->forward) { 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; h->max_long_cb = max_long_cb;
ret = 0; ret = 0;
clean_exit: if (ret == -1) { clean_exit: if (ret == -1) {
srs_tc_interl_free(h); srslte_tc_interl_free(h);
} }
return ret; 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) { if (h->forward) {
free(h->forward); free(h->forward);
} }
if (h->reverse) { if (h->reverse) {
free(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 i, j;
uint32_t res, prim, aux; uint32_t res, prim, aux;

@ -39,7 +39,7 @@
int srslte_tcod_init(srslte_tcod_t *h, uint32_t max_long_cb) { 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; return -1;
} }
h->max_long_cb = max_long_cb; 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) { 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; 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; 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"); fprintf(stderr, "Error initiating TC interleaver\n");
return -1; return -1;
} }

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

@ -41,7 +41,7 @@
void help() void help()
{ {
mexErrMsgTxt 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 */ /* the gateway function */

@ -138,7 +138,7 @@ int srslte_pbch_init(srslte_pbch_t *q, srslte_cell_t cell) {
bzero(q, sizeof(srslte_pbch_t)); bzero(q, sizeof(srslte_pbch_t));
q->cell = cell; 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_SRSLTE_CP_NORM : PBCH_RE_SRSLTE_CP_EXT;
if (srslte_precoding_init(&q->precoding, SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp))) { if (srslte_precoding_init(&q->precoding, SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp))) {
fprintf(stderr, "Error initializing precoding\n"); 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 */ /* 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; srslte_sequence_t seq;
bzero(&seq, sizeof(srslte_sequence_t)); 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 */ /* 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_pucch_cfg_t *cfg,
srslte_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,

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

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

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

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

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

@ -37,7 +37,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1, // cell_id 1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length SRSLTE_PHICH_NORM // PHICH length
}; };
@ -121,7 +121,7 @@ int main(int argc, char **argv) {
parse_args(argc, 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()) { if (test_dci_payload_size()) {
exit(-1); exit(-1);

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

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 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_SRSLTE_PHICH_R_1_6, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length SRSLTE_PHICH_NORM // PHICH length
}; };
@ -143,7 +143,7 @@ int main(int argc, char **argv) {
bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS); bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
bzero(slot_symbols, 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; 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); mcs.tbs = mxGetScalar(TBS);
if (mcs.tbs == 0) { if (mcs.tbs == 0) {

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

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1000, // cell_id 1000, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length SRSLTE_PHICH_NORM // PHICH length
}; };
@ -87,7 +87,7 @@ void parse_args(int argc, char **argv) {
phich_length = SRSLTE_PHICH_EXT; phich_length = SRSLTE_PHICH_EXT;
break; break;
case 'l': case 'l':
cell.cp = SRSLTE_SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
break; break;
case 'v': case 'v':
srslte_verbose++; 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; 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 */ /* init memory */
for (i=0;i<SRSLTE_MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {

@ -43,7 +43,7 @@
void help() void help()
{ {
mexErrMsgTxt 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 */ /* the gateway function */
@ -197,7 +197,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)); 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)); bzero(scfdma, sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
srslte_ofdm_t fft; 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_normalize(&fft, true);
srslte_ofdm_set_freq_shift(&fft, 0.5); srslte_ofdm_set_freq_shift(&fft, 0.5);
srslte_ofdm_rx_sf(&fft, sf_symbols, scfdma); srslte_ofdm_rx_sf(&fft, sf_symbols, scfdma);

@ -38,7 +38,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 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_SRSLTE_PHICH_R_1_6, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length 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)); 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)); bzero(scfdma, sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
srslte_ofdm_t fft; 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_set_freq_shift(&fft, 0.5);
srslte_ofdm_rx_sf(&fft, sf_symbols, scfdma); srslte_ofdm_rx_sf(&fft, sf_symbols, scfdma);

@ -40,7 +40,7 @@
void help() void help()
{ {
mexErrMsgTxt 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 */ /* the gateway function */
@ -66,7 +66,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
srslte_cell_t cell; srslte_cell_t cell;
cell.nof_prb = 100; cell.nof_prb = 100;
cell.id=1; cell.id=1;
cell.cp=SRSLTE_SRSLTE_CP_NORM; cell.cp=SRSLTE_CP_NORM;
if (srslte_harq_init(&harq_process, cell)) { if (srslte_harq_init(&harq_process, cell)) {
mexErrMsgTxt("Error initiating HARQ\n"); mexErrMsgTxt("Error initiating HARQ\n");
return; return;

@ -38,7 +38,7 @@
char *srslte_sequence_name = NULL; char *srslte_sequence_name = NULL;
bool do_floats = false; bool do_floats = false;
srslte_cp_t cp = SRSLTE_SRSLTE_CP_NORM; srslte_cp_t cp = SRSLTE_CP_NORM;
int cell_id = -1; int cell_id = -1;
void usage(char *prog) { void usage(char *prog) {
@ -55,7 +55,7 @@ void parse_args(int argc, char **argv) {
cell_id = atoi(argv[optind]); cell_id = atoi(argv[optind]);
break; break;
case 'e': case 'e':
cp = SRSLTE_SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'f': case 'f':
do_floats = true; 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)); bzero(q, sizeof(srslte_sync_t));
q->detect_cp = true; q->detect_cp = true;
q->cp = SRSLTE_SRSLTE_CP_NORM; q->cp = SRSLTE_CP_NORM;
q->mean_peak_value = 0.0; q->mean_peak_value = 0.0;
q->sss_en = true; q->sss_en = true;
q->correct_cfo = 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); 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) { 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) { } else if (q->M_norm_avg < q->M_ext_avg) {
return SRSLTE_SRSLTE_CP_EXT; return SRSLTE_CP_EXT;
} else { } else {
if (R_norm > R_ext) { if (R_norm > R_ext) {
return SRSLTE_SRSLTE_CP_NORM; return SRSLTE_CP_NORM;
} else { } 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); srslte_sss_synch_set_N_id_2(&q->sss, q->N_id_2);
/* Make sure we have enough room to find SSS sequence */ /* 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) { if (sss_idx < 0) {
INFO("Not enough room to decode CP SSS (sss_idx=%d, peak_pos=%d)\n", sss_idx, peak_pos); INFO("Not enough room to decode CP SSS (sss_idx=%d, peak_pos=%d)\n", sss_idx, peak_pos);
return SRSLTE_ERROR; return SRSLTE_ERROR;

@ -53,7 +53,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;
srslte_cp_t cp=SRSLTE_SRSLTE_CP_NORM; srslte_cp_t cp=SRSLTE_CP_NORM;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [nlestdv] -i cell_id -f input_file_name\n", 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]); threshold = atof(argv[optind]);
break; break;
case 'e': case 'e':
cp = SRSLTE_SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'i': case 'i':
cell_id = atoi(argv[optind]); cell_id = atoi(argv[optind]);
@ -231,7 +231,7 @@ int main(int argc, char **argv) {
} }
// Find SSS // 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) { 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); 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) { 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; 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;
srslte_cp_t cp=SRSLTE_SRSLTE_CP_NORM; srslte_cp_t cp=SRSLTE_CP_NORM;
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);
@ -90,7 +90,7 @@ void parse_args(int argc, char **argv) {
threshold = atof(argv[optind]); threshold = atof(argv[optind]);
break; break;
case 'e': case 'e':
cp = SRSLTE_SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'i': case 'i':
cell_id = atoi(argv[optind]); cell_id = atoi(argv[optind]);
@ -241,7 +241,7 @@ int main(int argc, char **argv) {
} }
// Find SSS // 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) { 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); 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) { if (srslte_sss_synch_N_id_1(&sss, m0, m1) != N_id_1) {

@ -38,7 +38,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
int cell_id = -1, offset = 0; 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; uint32_t nof_prb=6;
#define FLEN SRSLTE_SF_LEN(fft_size) #define FLEN SRSLTE_SF_LEN(fft_size)
@ -66,7 +66,7 @@ void parse_args(int argc, char **argv) {
offset = atoi(argv[optind]); offset = atoi(argv[optind]);
break; break;
case 'e': case 'e':
cp = SRSLTE_SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'v': case 'v':
srslte_verbose++; 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; found_cell->peak /= nof_detected_frames;
if (nof_normal > q->mode_ntimes[mode_pos]/2) { if (nof_normal > q->mode_ntimes[mode_pos]/2) {
found_cell->cp = SRSLTE_SRSLTE_CP_NORM; found_cell->cp = SRSLTE_CP_NORM;
} else { } 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; 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; uint32_t fft_size=128;
float threshold = 0.4; float threshold = 0.4;
int N_id_2_sync = -1; 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) { 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);
@ -90,7 +90,7 @@ void parse_args(int argc, char **argv) {
threshold = atof(argv[optind]); threshold = atof(argv[optind]);
break; break;
case 'e': case 'e':
cp = SRSLTE_SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'i': case 'i':
cell_id = atoi(argv[optind]); cell_id = atoi(argv[optind]);
@ -242,7 +242,7 @@ int main(int argc, char **argv) {
} }
// Find SSS // 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) { 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); 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) { if (srslte_sss_synch_N_id_1(&sss, m0, m1) != N_id_1) {

@ -45,7 +45,7 @@ srslte_cell_t cell = {
6, // nof_prb 6, // nof_prb
1, // nof_ports 1, // nof_ports
1, // cell_id 1, // cell_id
SRSLTE_SRSLTE_CP_NORM, // cyclic prefix SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_R_1, // PHICH resources SRSLTE_PHICH_R_1, // PHICH resources
SRSLTE_PHICH_NORM // PHICH length SRSLTE_PHICH_NORM // PHICH length
}; };
@ -145,7 +145,7 @@ void base_init() {
} }
/* create ifft object */ /* 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"); fprintf(stderr, "Error creating iFFT object\n");
exit(-1); exit(-1);
} }
@ -183,7 +183,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 * 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)); sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb));
cell.phich_length = SRSLTE_PHICH_NORM; cell.phich_length = SRSLTE_PHICH_NORM;
@ -228,9 +228,9 @@ int main(int argc, char **argv) {
#ifdef kk #ifdef kk
if (sf_idx == 0 || sf_idx == 5) { 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_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 */ /* Transform to OFDM symbols */
srslte_ofdm_rx_sf(&ifft, sf_buffer, output_buffer); srslte_ofdm_rx_sf(&ifft, sf_buffer, output_buffer);

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

Loading…
Cancel
Save