fixed bugs in enb

master
Ismael Gomez 7 years ago
parent 79b0ca81d0
commit 283cb115ac

@ -136,9 +136,6 @@ int srslte_sequence_LTE_pr(srslte_sequence_t *q, uint32_t len, uint32_t seed) {
q->c_float[i] = (1-2*q->c[i]); q->c_float[i] = (1-2*q->c[i]);
q->c_short[i] = (int16_t) q->c_float[i]; q->c_short[i] = (int16_t) q->c_float[i];
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

@ -30,6 +30,7 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <srslte/phy/common/phy_common.h> #include <srslte/phy/common/phy_common.h>
#include <srslte/srslte.h>
#define CURRENT_FFTSIZE srslte_symbol_sz(q->cell.nof_prb) #define CURRENT_FFTSIZE srslte_symbol_sz(q->cell.nof_prb)
@ -89,12 +90,12 @@ int srslte_enb_dl_init(srslte_enb_dl_t *q, uint32_t max_prb)
} }
for (int i=0;i<SRSLTE_MAX_PORTS;i++) { for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
q->sf_symbols[i] = srslte_vec_malloc(CURRENT_SFLEN_RE * sizeof(cf_t)); q->sf_symbols[i] = srslte_vec_malloc(SRSLTE_SF_LEN_RE(max_prb, SRSLTE_CP_NORM) * sizeof(cf_t));
if (!q->sf_symbols[i]) { if (!q->sf_symbols[i]) {
perror("malloc"); perror("malloc");
goto clean_exit; goto clean_exit;
} }
q->slot1_symbols[i] = &q->sf_symbols[i][CURRENT_SLOTLEN_RE]; q->slot1_symbols[i] = &q->sf_symbols[i][SRSLTE_SLOT_LEN_RE(max_prb, SRSLTE_CP_NORM)];
} }
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
@ -115,6 +116,7 @@ void srslte_enb_dl_free(srslte_enb_dl_t *q)
if (q) { if (q) {
srslte_ofdm_tx_free(&q->ifft); srslte_ofdm_tx_free(&q->ifft);
srslte_regs_free(&q->regs); srslte_regs_free(&q->regs);
srslte_pbch_free(&q->pbch);
srslte_pcfich_free(&q->pcfich); srslte_pcfich_free(&q->pcfich);
srslte_phich_free(&q->phich); srslte_phich_free(&q->phich);
srslte_pdcch_free(&q->pdcch); srslte_pdcch_free(&q->pdcch);
@ -138,18 +140,18 @@ int srslte_enb_dl_set_cell(srslte_enb_dl_t *q, srslte_cell_t cell)
if (q != NULL && if (q != NULL &&
srslte_cell_isvalid(&cell)) srslte_cell_isvalid(&cell))
{ {
q->cfi = 3; srslte_enb_dl_set_cfi(q, 3);
q->tx_amp = SRSLTE_ENB_RF_AMP; q->tx_amp = SRSLTE_ENB_RF_AMP;
if (q->cell.id != cell.id || q->cell.nof_prb == 0) { if (q->cell.id != cell.id || q->cell.nof_prb == 0) {
if (q->cell.nof_prb) { if (q->cell.nof_prb != 0) {
if (srslte_regs_init(&q->regs, q->cell)) { srslte_regs_free(&q->regs);
fprintf(stderr, "Error initiating REGs\n");
return SRSLTE_ERROR;
}
} }
memcpy(&q->cell, &cell, sizeof(srslte_cell_t)); memcpy(&q->cell, &cell, sizeof(srslte_cell_t));
if (srslte_regs_init(&q->regs, q->cell)) {
fprintf(stderr, "Error resizing REGs\n");
return SRSLTE_ERROR;
}
if (srslte_ofdm_rx_set_prb(&q->ifft, q->cell.cp, q->cell.nof_prb)) { if (srslte_ofdm_rx_set_prb(&q->ifft, q->cell.cp, q->cell.nof_prb)) {
fprintf(stderr, "Error initiating FFT\n"); fprintf(stderr, "Error initiating FFT\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;

@ -253,7 +253,6 @@ int srslte_pbch_set_cell(srslte_pbch_t *q, srslte_cell_t cell) {
if (q->cell.id != cell.id || q->cell.nof_prb == 0) { if (q->cell.id != cell.id || q->cell.nof_prb == 0) {
memcpy(&q->cell, &cell, sizeof(srslte_cell_t)); memcpy(&q->cell, &cell, sizeof(srslte_cell_t));
if (srslte_sequence_pbch(&q->seq, q->cell.cp, q->cell.id)) { if (srslte_sequence_pbch(&q->seq, q->cell.cp, q->cell.id)) {
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }

@ -331,6 +331,9 @@ int srslte_prach_gen_seqs(srslte_prach_t *p)
int srslte_prach_init_cfg(srslte_prach_t *p, srslte_prach_cfg_t *cfg, uint32_t nof_prb) int srslte_prach_init_cfg(srslte_prach_t *p, srslte_prach_cfg_t *cfg, uint32_t nof_prb)
{ {
if (srslte_prach_init(p, srslte_symbol_sz(nof_prb))) {
return -1;
}
return srslte_prach_set_cell(p, return srslte_prach_set_cell(p,
srslte_symbol_sz(nof_prb), srslte_symbol_sz(nof_prb),
cfg->config_idx, cfg->config_idx,

@ -434,7 +434,7 @@ int srslte_pusch_cfg(srslte_pusch_t *q,
int srslte_pusch_set_rnti(srslte_pusch_t *q, uint16_t rnti) { int srslte_pusch_set_rnti(srslte_pusch_t *q, uint16_t rnti) {
uint32_t i; uint32_t i;
uint32_t rnti_idx = q->is_ue?0:rnti; uint32_t rnti_idx = q->is_ue?0:rnti;
if (!q->users[rnti_idx] || q->is_ue) { if (!q->users[rnti_idx] || q->is_ue) {
if (!q->users[rnti_idx]) { if (!q->users[rnti_idx]) {

@ -103,8 +103,10 @@ void phch_worker::init(phch_common* phy_, srslte::log *log_h_)
fprintf(stderr, "Error initiating ENB DL\n"); fprintf(stderr, "Error initiating ENB DL\n");
return; return;
} }
srslte_enb_ul_init(&enb_ul, phy->cell.nof_prb); if (srslte_enb_ul_init(&enb_ul, phy->cell.nof_prb)) {
fprintf(stderr, "Error initiating ENB UL\n");
return;
}
if (srslte_enb_ul_set_cell(&enb_ul, if (srslte_enb_ul_set_cell(&enb_ul,
phy->cell, phy->cell,
NULL, NULL,
@ -112,7 +114,7 @@ void phch_worker::init(phch_common* phy_, srslte::log *log_h_)
&phy->hopping_cfg, &phy->hopping_cfg,
&phy->pucch_cfg)) &phy->pucch_cfg))
{ {
fprintf(stderr, "Error initiating ENB DL\n"); fprintf(stderr, "Error initiating ENB UL\n");
return; return;
} }
@ -154,14 +156,14 @@ void phch_worker::set_time(uint32_t tti_, uint32_t tx_mutex_cnt_, srslte_timesta
int phch_worker::add_rnti(uint16_t rnti) int phch_worker::add_rnti(uint16_t rnti)
{ {
if (srslte_enb_dl_add_rnti(&enb_dl, rnti)) { if (srslte_enb_dl_add_rnti(&enb_dl, rnti)) {
return -1; return -1;
} }
if (srslte_enb_ul_add_rnti(&enb_ul, rnti)) { if (srslte_enb_ul_add_rnti(&enb_ul, rnti)) {
return -1; return -1;
} }
// Create user // Create user
ue_db[rnti].rnti = rnti; ue_db[rnti].rnti = rnti;

@ -24,6 +24,7 @@
* *
*/ */
#include "srslte/srslte.h"
#include "phy/prach_worker.h" #include "phy/prach_worker.h"
namespace srsenb { namespace srsenb {
@ -48,7 +49,7 @@ int prach_worker::init(srslte_cell_t *cell_, srslte_prach_cfg_t *prach_cfg_, mac
srslte_prach_set_detect_factor(&prach, 60); srslte_prach_set_detect_factor(&prach, 60);
nof_sf = (uint32_t) ceilf(prach.T_tot*1000); nof_sf = (uint32_t) ceilf(prach.T_tot*1000);
signal_buffer_rx = (cf_t*) srslte_vec_malloc(sizeof(cf_t)*nof_sf*SRSLTE_SF_LEN_PRB(cell.nof_prb)); signal_buffer_rx = (cf_t*) srslte_vec_malloc(sizeof(cf_t)*nof_sf*SRSLTE_SF_LEN_PRB(cell.nof_prb));
if (!signal_buffer_rx) { if (!signal_buffer_rx) {
perror("malloc"); perror("malloc");
@ -108,7 +109,7 @@ int prach_worker::run_tti(uint32_t tti_rx)
{ {
if (srslte_prach_tti_opportunity(&prach, tti_rx, -1)) if (srslte_prach_tti_opportunity(&prach, tti_rx, -1))
{ {
// Detect possible PRACHs // Detect possible PRACHs
if (srslte_prach_detect_offset(&prach, if (srslte_prach_detect_offset(&prach,
prach_cfg.freq_offset, prach_cfg.freq_offset,
&signal_buffer_rx[prach.N_cp], &signal_buffer_rx[prach.N_cp],

Loading…
Cancel
Save