enb_dl: fixed some issues in TX

master
Ismael Gomez 9 years ago
parent 6407aceea5
commit 6d70d5cb94

@ -456,6 +456,8 @@ int main(int argc, char **argv) {
// Set initial CFO for ue_sync // Set initial CFO for ue_sync
srslte_ue_sync_set_cfo(&ue_sync, cfo); srslte_ue_sync_set_cfo(&ue_sync, cfo);
srslte_pbch_decode_reset(&ue_mib.pbch);
INFO("\nEntering main loop...\n\n", 0); INFO("\nEntering main loop...\n\n", 0);
/* Main loop */ /* Main loop */
while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) { while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) {
@ -475,7 +477,6 @@ int main(int argc, char **argv) {
switch (state) { switch (state) {
case DECODE_MIB: case DECODE_MIB:
if (srslte_ue_sync_get_sfidx(&ue_sync) == 0) { if (srslte_ue_sync_get_sfidx(&ue_sync) == 0) {
srslte_pbch_decode_reset(&ue_mib.pbch);
n = srslte_ue_mib_decode(&ue_mib, sf_buffer, bch_payload, NULL, &sfn_offset); n = srslte_ue_mib_decode(&ue_mib, sf_buffer, bch_payload, NULL, &sfn_offset);
if (n < 0) { if (n < 0) {
fprintf(stderr, "Error decoding UE MIB\n"); fprintf(stderr, "Error decoding UE MIB\n");
@ -494,7 +495,7 @@ int main(int argc, char **argv) {
decode_pdsch = true; decode_pdsch = true;
} else { } else {
/* We are looking for SIB1 Blocks, search only in appropiate places */ /* We are looking for SIB1 Blocks, search only in appropiate places */
if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%8)==0)) { if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
decode_pdsch = true; decode_pdsch = true;
} else { } else {
decode_pdsch = false; decode_pdsch = false;

@ -90,21 +90,13 @@ typedef struct SRSLTE_API {
} srslte_enb_dl_t; } srslte_enb_dl_t;
typedef struct { typedef struct {
srslte_ra_dl_dci_t grant; bool is_dl;
srslte_dci_format_t format; srslte_ra_dci_grant_t grant;
srslte_dci_location_t location; srslte_dci_location_t location;
uint32_t rnti_idx; uint32_t rnti_idx;
uint32_t rv_idx; uint32_t rv_idx;
uint8_t *data; uint8_t *data;
} srslte_enb_dl_pdsch_t; } srslte_enb_dl_grant_t;
typedef struct {
srslte_ra_ul_dci_t grant;
srslte_dci_location_t location;
uint32_t rnti_idx;
uint32_t rv_idx;
} srslte_enb_dl_pusch_grant_t;
/* This function shall be called just after the initial synchronization */ /* This function shall be called just after the initial synchronization */
@ -141,6 +133,9 @@ SRSLTE_API int srslte_enb_dl_add_rnti(srslte_enb_dl_t *q,
uint32_t idx, uint32_t idx,
uint16_t rnti); uint16_t rnti);
SRSLTE_API int srslte_enb_dl_rem_rnti(srslte_enb_dl_t *q,
uint32_t idx);
SRSLTE_API int srslte_enb_dl_put_pdsch(srslte_enb_dl_t *q, SRSLTE_API int srslte_enb_dl_put_pdsch(srslte_enb_dl_t *q,
srslte_ra_dl_grant_t *grant, srslte_ra_dl_grant_t *grant,
uint32_t rnti_idx, uint32_t rnti_idx,
@ -161,14 +156,9 @@ SRSLTE_API int srslte_enb_dl_put_pdcch_ul(srslte_enb_dl_t *q,
uint32_t rnti_idx, uint32_t rnti_idx,
uint32_t sf_idx); uint32_t sf_idx);
SRSLTE_API int srslte_enb_dl_put_pdsch_multi(srslte_enb_dl_t *q, SRSLTE_API int srslte_enb_dl_put_grant(srslte_enb_dl_t *q,
srslte_enb_dl_pdsch_t *pdsch, srslte_enb_dl_grant_t *grants,
uint32_t nof_pdsch, uint32_t nof_grants,
uint32_t sf_idx);
SRSLTE_API int srslte_enb_dl_put_pusch_multi(srslte_enb_dl_t *q,
srslte_enb_dl_pusch_grant_t *pusch,
uint32_t nof_pusch,
uint32_t sf_idx); uint32_t sf_idx);

@ -178,6 +178,10 @@ typedef union {
srslte_ra_dl_grant_t dl; srslte_ra_dl_grant_t dl;
} srslte_phy_grant_t; } srslte_phy_grant_t;
typedef union {
srslte_ra_ul_dci_t ul;
srslte_ra_dl_dci_t dl;
} srslte_ra_dci_grant_t;
#define SRSLTE_PHY_GRANT_LEN sizeof(srslte_phy_grant_t) #define SRSLTE_PHY_GRANT_LEN sizeof(srslte_phy_grant_t)

@ -162,6 +162,7 @@ void srslte_enb_dl_free(srslte_enb_dl_t *q)
void srslte_enb_dl_set_cfi(srslte_enb_dl_t *q, uint32_t cfi) void srslte_enb_dl_set_cfi(srslte_enb_dl_t *q, uint32_t cfi)
{ {
q->cfi = cfi; q->cfi = cfi;
srslte_regs_set_cfi(&q->regs, cfi);
} }
void srslte_enb_dl_clear_sf(srslte_enb_dl_t *q) void srslte_enb_dl_clear_sf(srslte_enb_dl_t *q)
@ -212,10 +213,11 @@ void srslte_enb_dl_put_base(srslte_enb_dl_t *q, uint32_t tti)
void srslte_enb_dl_gen_signal(srslte_enb_dl_t *q, cf_t *signal_buffer) void srslte_enb_dl_gen_signal(srslte_enb_dl_t *q, cf_t *signal_buffer)
{ {
srslte_ofdm_tx_sf(&q->ifft, q->sf_symbols[0], signal_buffer); srslte_ofdm_tx_sf(&q->ifft, q->sf_symbols[0], signal_buffer);
// TODO: PAPR control // TODO: PAPR control
srslte_vec_sc_prod_cfc(signal_buffer, 0.5, signal_buffer, SRSLTE_SF_LEN_PRB(q->cell.nof_prb)); srslte_vec_sc_prod_cfc(signal_buffer, 0.2, signal_buffer, SRSLTE_SF_LEN_PRB(q->cell.nof_prb));
} }
int srslte_enb_dl_add_rnti(srslte_enb_dl_t *q, uint32_t idx, uint16_t rnti) int srslte_enb_dl_add_rnti(srslte_enb_dl_t *q, uint32_t idx, uint16_t rnti)
@ -223,6 +225,11 @@ int srslte_enb_dl_add_rnti(srslte_enb_dl_t *q, uint32_t idx, uint16_t rnti)
return srslte_pdsch_set_rnti_multi(&q->pdsch, idx, rnti); return srslte_pdsch_set_rnti_multi(&q->pdsch, idx, rnti);
} }
int srslte_enb_dl_rem_rnti(srslte_enb_dl_t *q, uint32_t idx)
{
return srslte_pdsch_set_rnti_multi(&q->pdsch, idx, 0);
}
int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t *q, srslte_ra_dl_dci_t *grant, int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t *q, srslte_ra_dl_dci_t *grant,
srslte_dci_format_t format, srslte_dci_location_t location, srslte_dci_format_t format, srslte_dci_location_t location,
uint32_t rnti_idx, uint32_t sf_idx) uint32_t rnti_idx, uint32_t sf_idx)
@ -236,6 +243,7 @@ int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t *q, srslte_ra_dl_dci_t *grant,
rnti_is_user = false; rnti_is_user = false;
} }
//srslte_ra_pdsch_fprint(stdout, grant, q->cell.nof_prb);
srslte_dci_msg_pack_pdsch(grant, &dci_msg, format, q->cell.nof_prb, rnti_is_user); srslte_dci_msg_pack_pdsch(grant, &dci_msg, format, q->cell.nof_prb, rnti_is_user);
if (srslte_pdcch_encode(&q->pdcch, &dci_msg, location, rnti, q->sf_symbols, sf_idx, q->cfi)) { if (srslte_pdcch_encode(&q->pdcch, &dci_msg, location, rnti, q->sf_symbols, sf_idx, q->cfi)) {
fprintf(stderr, "Error encoding DCI message\n"); fprintf(stderr, "Error encoding DCI message\n");
@ -266,6 +274,8 @@ int srslte_enb_dl_put_pdsch(srslte_enb_dl_t *q, srslte_ra_dl_grant_t *grant,
uint32_t rnti_idx, uint32_t rv_idx, uint32_t sf_idx, uint32_t rnti_idx, uint32_t rv_idx, uint32_t sf_idx,
uint8_t *data) uint8_t *data)
{ {
//srslte_ra_dl_grant_fprint(stdout, grant);
/* Configure pdsch_cfg parameters */ /* Configure pdsch_cfg parameters */
if (srslte_pdsch_cfg(&q->pdsch_cfg, q->cell, grant, q->cfi, sf_idx, rv_idx)) { if (srslte_pdsch_cfg(&q->pdsch_cfg, q->cell, grant, q->cfi, sf_idx, rv_idx)) {
fprintf(stderr, "Error configuring PDSCH\n"); fprintf(stderr, "Error configuring PDSCH\n");
@ -280,13 +290,33 @@ int srslte_enb_dl_put_pdsch(srslte_enb_dl_t *q, srslte_ra_dl_grant_t *grant,
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
int srslte_enb_dl_put_pdsch_multi(srslte_enb_dl_t *q, srslte_enb_dl_pdsch_t *grants, uint32_t nof_pdsch, uint32_t sf_idx) int srslte_enb_dl_put_grant(srslte_enb_dl_t *q, srslte_enb_dl_grant_t *grants, uint32_t nof_grants, uint32_t sf_idx)
{ {
for (int i=0;i<nof_pdsch;i++) { for (int i=0;i<nof_grants;i++) {
if (srslte_enb_dl_put_pdcch_dl(q, &grants[i].grant, grants[i].format, grants[i].location, grants[i].rnti_idx, sf_idx)) { if (grants[i].is_dl) {
srslte_dci_format_t format = SRSLTE_DCI_FORMAT1;
switch(grants[i].grant.dl.dci_format) {
case SRSLTE_RA_DCI_FORMAT1:
format = SRSLTE_DCI_FORMAT1;
break;
case SRSLTE_RA_DCI_FORMAT1A:
format = SRSLTE_DCI_FORMAT1A;
break;
case SRSLTE_RA_DCI_FORMAT1C:
format = SRSLTE_DCI_FORMAT1C;
break;
}
if (srslte_enb_dl_put_pdcch_dl(q, &grants[i].grant.dl, format, grants[i].location, grants[i].rnti_idx, sf_idx)) {
fprintf(stderr, "Error putting PDCCH &d\n",i);
return SRSLTE_ERROR;
}
} else {
if (srslte_enb_dl_put_pdcch_ul(q, &grants[i].grant.ul, grants[i].location, grants[i].rnti_idx, sf_idx)) {
fprintf(stderr, "Error putting PDCCH &d\n",i); fprintf(stderr, "Error putting PDCCH &d\n",i);
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
}
if (grants[i].is_dl) {
uint16_t rnti = srslte_pdsch_get_rnti_multi(&q->pdsch, grants[i].rnti_idx); uint16_t rnti = srslte_pdsch_get_rnti_multi(&q->pdsch, grants[i].rnti_idx);
bool rnti_is_user = true; bool rnti_is_user = true;
@ -294,24 +324,12 @@ int srslte_enb_dl_put_pdsch_multi(srslte_enb_dl_t *q, srslte_enb_dl_pdsch_t *gra
rnti_is_user = false; rnti_is_user = false;
} }
srslte_ra_dl_grant_t phy_grant; srslte_ra_dl_grant_t phy_grant;
srslte_ra_dl_dci_to_grant(&grants[i].grant, q->cell.nof_prb, rnti_is_user, &phy_grant); srslte_ra_dl_dci_to_grant(&grants[i].grant.dl, q->cell.nof_prb, rnti_is_user, &phy_grant);
if (srslte_enb_dl_put_pdsch(q, &phy_grant, grants[i].rnti_idx, grants[i].rv_idx, sf_idx, grants[i].data)) { if (srslte_enb_dl_put_pdsch(q, &phy_grant, grants[i].rnti_idx, grants[i].rv_idx, sf_idx, grants[i].data)) {
fprintf(stderr, "Error putting PDCCH %d\n",i); fprintf(stderr, "Error putting PDCCH %d\n",i);
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
} }
return SRSLTE_SUCCESS;
}
int srslte_enb_dl_put_pusch_multi(srslte_enb_dl_t *q, srslte_enb_dl_pusch_grant_t *grants, uint32_t nof_pusch, uint32_t sf_idx)
{
for (int i=0;i<nof_pusch;i++) {
if (srslte_enb_dl_put_pdcch_ul(q, &grants[i].grant, grants[i].location, grants[i].rnti_idx, sf_idx)) {
fprintf(stderr, "Error putting PDCCH &d\n",i);
return SRSLTE_ERROR;
}
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

@ -220,7 +220,8 @@ int srslte_pcfich_encode(srslte_pcfich_t *q, uint32_t cfi, cf_t *slot_symbols[SR
int i; int i;
if (q != NULL && if (q != NULL &&
cfi < 3 && cfi <= 3 &&
cfi > 0 &&
slot_symbols != NULL && slot_symbols != NULL &&
subframe < SRSLTE_NSUBFRAMES_X_FRAME) subframe < SRSLTE_NSUBFRAMES_X_FRAME)
{ {

@ -364,6 +364,7 @@ int srslte_pdsch_init_rnti_multi(srslte_pdsch_t *q, uint32_t nof_rntis)
perror("malloc"); perror("malloc");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
bzero(q->rnti_multi, sizeof(uint16_t)*nof_rntis);
q->nof_crnti = nof_rntis; q->nof_crnti = nof_rntis;
@ -373,10 +374,16 @@ int srslte_pdsch_init_rnti_multi(srslte_pdsch_t *q, uint32_t nof_rntis)
int srslte_pdsch_set_rnti_multi(srslte_pdsch_t *q, uint32_t idx, uint16_t rnti) int srslte_pdsch_set_rnti_multi(srslte_pdsch_t *q, uint32_t idx, uint16_t rnti)
{ {
if (idx < q->nof_crnti) { if (idx < q->nof_crnti) {
if (q->rnti_multi[idx]) {
for (uint32_t i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) {
srslte_sequence_free(&q->seq_multi[i][idx]);
}
q->rnti_multi[idx] = 0;
}
q->rnti_multi[idx] = rnti; q->rnti_multi[idx] = rnti;
q->rnti_is_set = true; q->rnti_is_set = true;
for (uint32_t i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) { for (uint32_t i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) {
if (srslte_sequence_pdsch(&q->seq[i], rnti, 0, 2 * i, q->cell.id, if (srslte_sequence_pdsch(&q->seq_multi[i][idx], rnti, 0, 2 * i, q->cell.id,
q->max_re * srslte_mod_bits_x_symbol(SRSLTE_MOD_64QAM))) { q->max_re * srslte_mod_bits_x_symbol(SRSLTE_MOD_64QAM))) {
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -598,6 +605,7 @@ int srslte_pdsch_encode_seq(srslte_pdsch_t *q,
for (i = 0; i < q->cell.nof_ports; i++) { for (i = 0; i < q->cell.nof_ports; i++) {
srslte_pdsch_put(q, q->symbols[i], sf_symbols[i], &cfg->grant, cfg->nbits.lstart, cfg->sf_idx); srslte_pdsch_put(q, q->symbols[i], sf_symbols[i], &cfg->grant, cfg->nbits.lstart, cfg->sf_idx);
} }
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
} }
return ret; return ret;
@ -608,7 +616,12 @@ int srslte_pdsch_encode_rnti_idx(srslte_pdsch_t *q,
uint8_t *data, uint32_t rnti_idx, cf_t *sf_symbols[SRSLTE_MAX_PORTS]) uint8_t *data, uint32_t rnti_idx, cf_t *sf_symbols[SRSLTE_MAX_PORTS])
{ {
if (rnti_idx < q->nof_crnti) { if (rnti_idx < q->nof_crnti) {
if (q->rnti_multi[rnti_idx]) {
return srslte_pdsch_encode_seq(q, cfg, softbuffer, data, &q->seq_multi[cfg->sf_idx][rnti_idx], sf_symbols); return srslte_pdsch_encode_seq(q, cfg, softbuffer, data, &q->seq_multi[cfg->sf_idx][rnti_idx], sf_symbols);
} else {
fprintf(stderr, "Error RNTI idx %d not set\n", rnti_idx);
return SRSLTE_ERROR;
}
} else { } else {
return SRSLTE_ERROR_INVALID_INPUTS; return SRSLTE_ERROR_INVALID_INPUTS;
} }

Loading…
Cancel
Save