development of enb processing

master
Ismael Gomez 8 years ago
parent cfca587548
commit 6b71250a9c

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -55,6 +55,8 @@
#include "srslte/phch/ra.h"
#include "srslte/phch/regs.h"
#include "srslte/enb/enb_ul.h"
#include "srslte/utils/vector.h"
#include "srslte/utils/debug.h"
@ -86,7 +88,6 @@ typedef struct SRSLTE_API {
float sss_signal5[SRSLTE_SSS_LEN];
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
srslte_softbuffer_tx_t *softbuffer;
uint32_t nof_rnti;
} srslte_enb_dl_t;
@ -97,14 +98,13 @@ typedef struct {
srslte_dci_location_t location;
srslte_softbuffer_tx_t *softbuffer;
uint8_t *data;
} srslte_enb_dl_grant_pdsch_t;
} srslte_enb_dl_pdsch_t;
typedef struct {
uint32_t rnti_idx;
srslte_ra_ul_dci_t grant;
srslte_dci_location_t location;
} srslte_enb_dl_grant_pusch_t;
uint8_t ack;
uint32_t rnti_idx;
srslte_enb_ul_phich_info_t info;
} srslte_enb_dl_phich_t;
/* This function shall be called just after the initial synchronization */
SRSLTE_API int srslte_enb_dl_init(srslte_enb_dl_t *q,
@ -130,6 +130,17 @@ SRSLTE_API void srslte_enb_dl_put_mib(srslte_enb_dl_t *q,
SRSLTE_API void srslte_enb_dl_put_pcfich(srslte_enb_dl_t *q,
uint32_t sf_idx);
SRSLTE_API void srslte_enb_dl_put_phich(srslte_enb_dl_t *q,
uint8_t ack,
uint32_t n_prb_lowest,
uint32_t n_dmrs,
uint32_t sf_idx);
SRSLTE_API void srslte_enb_dl_put_phich_multi(srslte_enb_dl_t *q,
srslte_enb_dl_phich_t *acks,
uint32_t nof_acks,
uint32_t sf_idx);
SRSLTE_API void srslte_enb_dl_put_base(srslte_enb_dl_t *q,
uint32_t tti);
@ -165,12 +176,12 @@ SRSLTE_API int srslte_enb_dl_put_pdcch_ul(srslte_enb_dl_t *q,
uint32_t sf_idx);
SRSLTE_API int srslte_enb_dl_put_grant_pdsch(srslte_enb_dl_t *q,
srslte_enb_dl_grant_pdsch_t *grants,
srslte_enb_dl_pdsch_t *grants,
uint32_t nof_grants,
uint32_t sf_idx);
SRSLTE_API int srslte_enb_dl_put_grant_pusch(srslte_enb_dl_t *q,
srslte_enb_dl_grant_pusch_t *grants,
srslte_enb_ul_pusch_t *grants,
uint32_t nof_grants,
uint32_t sf_idx);

@ -53,6 +53,11 @@
#include "srslte/config.h"
typedef struct {
uint32_t n_prb_lowest;
uint32_t n_dmrs;
} srslte_enb_ul_phich_info_t;
typedef struct SRSLTE_API {
srslte_cell_t cell;
@ -67,16 +72,18 @@ typedef struct SRSLTE_API {
srslte_prach_t prach;
srslte_pusch_cfg_t pusch_cfg;
srslte_softbuffer_rx_t softbuffer;
srslte_enb_ul_phich_info_t *phich_info;
} srslte_enb_ul_t;
typedef struct {
srslte_ra_ul_dci_t grant;
uint32_t rnti_idx;
uint32_t rv_idx;
uint32_t current_tx_nb;
uint8_t *data;
uint32_t rnti_idx;
srslte_ra_ul_dci_t grant;
srslte_dci_location_t location;
uint32_t rv_idx;
uint32_t current_tx_nb;
uint8_t *data;
srslte_softbuffer_rx_t *softbuffer;
} srslte_enb_ul_pusch_t;
/* This function shall be called just after the initial synchronization */
@ -97,8 +104,13 @@ SRSLTE_API int srslte_enb_ul_rem_rnti(srslte_enb_ul_t *q,
SRSLTE_API void srslte_enb_ul_fft(srslte_enb_ul_t *q,
cf_t *signal_buffer);
SRSLTE_API void srslte_enb_ul_get_phich_info(srslte_enb_ul_t *q,
uint32_t rnti_idx,
srslte_enb_ul_phich_info_t *phich_info);
SRSLTE_API int srslte_enb_ul_get_pusch(srslte_enb_ul_t *q,
srslte_ra_ul_grant_t *grant,
srslte_softbuffer_rx_t *softbuffer,
uint32_t rnti_idx,
uint32_t rv_idx,
uint32_t current_tx_nb,
@ -107,6 +119,7 @@ SRSLTE_API int srslte_enb_ul_get_pusch(srslte_enb_ul_t *q,
SRSLTE_API int srslte_enb_ul_get_pusch_multi(srslte_enb_ul_t *q,
srslte_enb_ul_pusch_t *grants,
bool *pusch_crc_res,
uint32_t nof_pusch,
uint32_t sf_idx);

@ -89,6 +89,12 @@ SRSLTE_API int srslte_phich_init(srslte_phich_t *q,
SRSLTE_API void srslte_phich_free(srslte_phich_t *q);
SRSLTE_API void srslte_phich_calc(srslte_phich_t *q,
uint32_t n_prb_lowest,
uint32_t n_dmrs,
uint32_t *ngroup,
uint32_t *nseq);
SRSLTE_API int srslte_phich_decode(srslte_phich_t *q,
cf_t *slot_symbols,
cf_t *ce[SRSLTE_MAX_PORTS],

@ -184,7 +184,21 @@ void srslte_enb_dl_put_mib(srslte_enb_dl_t *q, uint32_t tti)
void srslte_enb_dl_put_pcfich(srslte_enb_dl_t *q, uint32_t sf_idx)
{
srslte_pcfich_encode(&q->pcfich, q->cfi, q->sf_symbols, sf_idx);
}
void srslte_enb_dl_put_phich(srslte_enb_dl_t *q, uint8_t ack, uint32_t n_prb_lowest,
uint32_t n_dmrs, uint32_t sf_idx)
{
uint32_t ngroup, nseq;
srslte_phich_calc(&q->phich, n_prb_lowest, n_dmrs, &ngroup, &nseq);
srslte_phich_encode(&q->phich, ack, ngroup, nseq, sf_idx, q->sf_symbols);
}
void srslte_enb_dl_put_phich_multi(srslte_enb_dl_t *q, srslte_enb_dl_phich_t *acks, uint32_t nof_acks, uint32_t sf_idx)
{
for (int i=0;i<nof_acks;i++) {
srslte_phich_encode(&q->phich, acks[i].ack, acks[i].n_prb_lowest, acks[i].n_dmrs, sf_idx, q->sf_symbols);
}
}
void srslte_enb_dl_put_base(srslte_enb_dl_t *q, uint32_t tti)
@ -278,7 +292,7 @@ int srslte_enb_dl_put_pdsch(srslte_enb_dl_t *q, srslte_ra_dl_grant_t *grant, srs
return SRSLTE_SUCCESS;
}
int srslte_enb_dl_put_grant_pusch(srslte_enb_dl_t *q, srslte_enb_dl_grant_pusch_t *grants, uint32_t nof_grants, uint32_t sf_idx)
int srslte_enb_dl_put_grant_pusch(srslte_enb_dl_t *q, srslte_enb_ul_pusch_t *grants, uint32_t nof_grants, uint32_t sf_idx)
{
for (int i=0;i<nof_grants;i++) {
if (srslte_enb_dl_put_pdcch_ul(q, &grants[i].grant, grants[i].location, grants[i].rnti_idx, sf_idx)) {
@ -289,7 +303,7 @@ int srslte_enb_dl_put_grant_pusch(srslte_enb_dl_t *q, srslte_enb_dl_grant_pusch_
return SRSLTE_SUCCESS;
}
int srslte_enb_dl_put_grant_pdsch(srslte_enb_dl_t *q, srslte_enb_dl_grant_pdsch_t *grants,
int srslte_enb_dl_put_grant_pdsch(srslte_enb_dl_t *q, srslte_enb_dl_pdsch_t *grants,
uint32_t nof_grants, uint32_t sf_idx)
{
for (int i=0;i<nof_grants;i++) {

@ -80,11 +80,6 @@ int srslte_enb_ul_init(srslte_enb_ul_t *q, srslte_cell_t cell,
goto clean_exit;
}
if (srslte_softbuffer_rx_init(&q->softbuffer, q->cell.nof_prb)) {
fprintf(stderr, "Error initiating soft buffer\n");
goto clean_exit;
}
if (srslte_chest_ul_init(&q->chest, cell)) {
fprintf(stderr, "Error initiating channel estimator\n");
goto clean_exit;
@ -123,7 +118,6 @@ void srslte_enb_ul_free(srslte_enb_ul_t *q)
srslte_ofdm_rx_free(&q->fft);
srslte_pucch_free(&q->pucch);
srslte_pusch_free(&q->pusch);
srslte_softbuffer_rx_free(&q->softbuffer);
srslte_chest_ul_free(&q->chest);
if (q->sf_symbols) {
free(q->sf_symbols);
@ -151,7 +145,7 @@ void srslte_enb_ul_fft(srslte_enb_ul_t *q, cf_t *signal_buffer)
}
int srslte_enb_ul_get_pusch(srslte_enb_ul_t *q, srslte_ra_ul_grant_t *grant,
int srslte_enb_ul_get_pusch(srslte_enb_ul_t *q, srslte_ra_ul_grant_t *grant, srslte_softbuffer_rx_t *softbuffer,
uint32_t rnti_idx, uint32_t rv_idx, uint32_t current_tx_nb,
uint8_t *data, uint32_t sf_idx)
{
@ -170,29 +164,35 @@ int srslte_enb_ul_get_pusch(srslte_enb_ul_t *q, srslte_ra_ul_grant_t *grant,
srslte_uci_data_t uci_data;
bzero(&uci_data, sizeof(srslte_uci_data_t));
return srslte_pusch_uci_decode_rnti_idx(&q->pusch, &q->pusch_cfg,
&q->softbuffer, q->sf_symbols,
softbuffer, q->sf_symbols,
q->ce, noise_power,
rnti_idx, data,
&uci_data);
}
int srslte_enb_ul_get_pusch_multi(srslte_enb_ul_t *q, srslte_enb_ul_pusch_t *grants,
bool *pusch_crc_res,
uint32_t nof_pusch, uint32_t tti)
{
uint32_t n_rb_ho = 0;
for (int i=0;i<nof_pusch;i++) {
srslte_ra_ul_grant_t phy_grant;
srslte_ra_ul_dci_to_grant(&grants[i].grant, q->cell.nof_prb, n_rb_ho, &phy_grant, tti%8);
if (srslte_enb_ul_get_pusch(q, &phy_grant, grants[i].rnti_idx, grants[i].rv_idx,
grants[i].current_tx_nb, grants[i].data, tti%10) < 0)
{
fprintf(stderr, "Error getting PUSCH\n");
return SRSLTE_ERROR;
}
pusch_crc_res[i] = srslte_enb_ul_get_pusch(q, &phy_grant, grants[i].softbuffer,
grants[i].rnti_idx, grants[i].rv_idx,
grants[i].current_tx_nb,
grants[i].data, tti%10) == 0;
q->phich_info[grants[i].rnti_idx].n_prb_lowest = q->pusch_cfg.grant.n_prb_tilde[0];
q->phich_info[grants[i].rnti_idx].n_dmrs = phy_grant.ncs_dmrs;
}
return SRSLTE_SUCCESS;
}
void srslte_enb_ul_get_phich_info(srslte_enb_ul_t *q,
uint32_t rnti_idx,
srslte_enb_ul_phich_info_t *phich_info)
int srslte_enb_ul_detect_prach(srslte_enb_ul_t *q, uint32_t tti,
uint32_t freq_offset, cf_t *signal,
uint32_t *indices, uint32_t *offsets)

@ -110,6 +110,16 @@ void srslte_phich_free(srslte_phich_t *q) {
}
/* Computes n_group and n_seq according to Section 9.1.2 in 36.213 */
void srslte_phich_calc(srslte_phich_t *q, uint32_t n_prb_lowest, uint32_t n_dmrs,
uint32_t *ngroup, uint32_t *nseq)
{
uint32_t Ngroups = srslte_phich_ngroups(q);
*ngroup = (n_prb_lowest+n_dmrs)%Ngroups;
*nseq = ((n_prb_lowest/Ngroups)+n_dmrs)%(2*srslte_phich_nsf(q));
}
/* Decodes ACK
*
*/

@ -130,9 +130,13 @@ static rf_dev_t dev_blade = {
};
#endif
//#define ENABLE_DUMMY_DEV
#define ENABLE_DUMMY_DEV
#ifdef ENABLE_DUMMY_DEV
int dummy_rcv() {
usleep(100000);
return 1;
}
void dummy_fnc() {
}
@ -160,7 +164,7 @@ static rf_dev_t dev_dummy = {
dummy_fnc,
dummy_fnc,
dummy_fnc,
dummy_fnc,
dummy_rcv,
dummy_fnc,
dummy_fnc,
dummy_fnc

@ -425,14 +425,13 @@ int srslte_ue_dl_decode_rnti_rv(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, u
}
}
/* Computes n_group and n_seq according to Section 9.1.2 in 36.213 and calls phich processing function */
bool srslte_ue_dl_decode_phich(srslte_ue_dl_t *q, uint32_t sf_idx, uint32_t n_prb_lowest, uint32_t n_dmrs)
{
uint8_t ack_bit;
float distance;
uint32_t Ngroups = srslte_phich_ngroups(&q->phich);
uint32_t ngroup = (n_prb_lowest+n_dmrs)%Ngroups;
uint32_t nseq = ((n_prb_lowest/Ngroups)+n_dmrs)%(2*srslte_phich_nsf(&q->phich));
uint32_t ngroup, nseq;
srslte_phich_calc(&q->phich, n_prb_lowest, n_dmrs, &ngroup, &nseq);
DEBUG("Decoding PHICH sf_idx=%d, n_prb_lowest=%d, n_dmrs=%d, n_group=%d, n_seq=%d\n",
sf_idx, n_prb_lowest, n_dmrs, ngroup, nseq);
if (!srslte_phich_decode(&q->phich, q->sf_symbols, q->ce, 0, ngroup, nseq, sf_idx, &ack_bit, &distance)) {

Loading…
Cancel
Save