|
|
@ -142,6 +142,7 @@ void parse_args(int argc, char **argv) {
|
|
|
|
static uint8_t *data_tx[SRSLTE_MAX_CODEWORDS] = {NULL};
|
|
|
|
static uint8_t *data_tx[SRSLTE_MAX_CODEWORDS] = {NULL};
|
|
|
|
static uint8_t *data_rx[SRSLTE_MAX_CODEWORDS] = {NULL};
|
|
|
|
static uint8_t *data_rx[SRSLTE_MAX_CODEWORDS] = {NULL};
|
|
|
|
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
|
|
|
|
|
|
|
|
cf_t *ce_dummy[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
|
|
|
|
srslte_softbuffer_rx_t *softbuffers_rx[SRSLTE_MAX_CODEWORDS];
|
|
|
|
srslte_softbuffer_rx_t *softbuffers_rx[SRSLTE_MAX_CODEWORDS];
|
|
|
|
srslte_ra_dl_grant_t grant;
|
|
|
|
srslte_ra_dl_grant_t grant;
|
|
|
|
srslte_pdsch_cfg_t pdsch_cfg;
|
|
|
|
srslte_pdsch_cfg_t pdsch_cfg;
|
|
|
@ -152,7 +153,8 @@ cf_t *rx_sf_symbols[SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *tx_slot_symbols[SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *tx_slot_symbols[SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *rx_slot_symbols[SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *rx_slot_symbols[SRSLTE_MAX_PORTS];
|
|
|
|
srslte_pdsch_t pdsch_tx, pdsch_rx;
|
|
|
|
srslte_pdsch_t pdsch_tx, pdsch_rx;
|
|
|
|
srslte_ofdm_t ofdm_tx, ofdm_rx;
|
|
|
|
srslte_ofdm_t ofdm_tx[SRSLTE_MAX_PORTS], ofdm_rx[SRSLTE_MAX_PORTS];
|
|
|
|
|
|
|
|
srslte_chest_dl_t chest_dl;
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
uint32_t i, j, k;
|
|
|
|
uint32_t i, j, k;
|
|
|
@ -169,6 +171,7 @@ int main(int argc, char **argv) {
|
|
|
|
bzero(&pdsch_rx, sizeof(srslte_pdsch_t));
|
|
|
|
bzero(&pdsch_rx, sizeof(srslte_pdsch_t));
|
|
|
|
bzero(&pdsch_cfg, sizeof(srslte_pdsch_cfg_t));
|
|
|
|
bzero(&pdsch_cfg, sizeof(srslte_pdsch_cfg_t));
|
|
|
|
bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
|
|
|
|
bzero(ce_dummy, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
bzero(tx_slot_symbols, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
bzero(tx_slot_symbols, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
bzero(rx_slot_symbols, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
bzero(rx_slot_symbols, sizeof(cf_t*)*SRSLTE_MAX_PORTS);
|
|
|
|
|
|
|
|
|
|
|
@ -213,22 +216,6 @@ int main(int argc, char **argv) {
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DO_OFDM
|
|
|
|
|
|
|
|
srslte_ofdm_tx_init(&ofdm_tx, cell.cp, cell.nof_prb);
|
|
|
|
|
|
|
|
srslte_ofdm_rx_init(&ofdm_rx, cell.cp, cell.nof_prb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srslte_ofdm_set_normalize(&ofdm_tx, true);
|
|
|
|
|
|
|
|
srslte_ofdm_set_normalize(&ofdm_rx, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
|
|
|
|
tx_sf_symbols[i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nof_rx_antennas; i++) {
|
|
|
|
|
|
|
|
rx_sf_symbols[i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* DO_OFDM */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Configure PDSCH */
|
|
|
|
/* Configure PDSCH */
|
|
|
|
if (srslte_pdsch_cfg_mimo(&pdsch_cfg, cell, &grant, cfi, subframe, rv_idx, mimo_type, pmi)) {
|
|
|
|
if (srslte_pdsch_cfg_mimo(&pdsch_cfg, cell, &grant, cfi, subframe, rv_idx, mimo_type, pmi)) {
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
@ -243,6 +230,11 @@ int main(int argc, char **argv) {
|
|
|
|
perror("srslte_vec_malloc");
|
|
|
|
perror("srslte_vec_malloc");
|
|
|
|
goto quit;
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ce_dummy[i][j] = srslte_vec_malloc(sizeof(cf_t) * NOF_CE_SYMBOLS);
|
|
|
|
|
|
|
|
if (!ce_dummy[i][j]) {
|
|
|
|
|
|
|
|
perror("srslte_vec_malloc");
|
|
|
|
|
|
|
|
goto quit;
|
|
|
|
|
|
|
|
}
|
|
|
|
for (k = 0; k < NOF_CE_SYMBOLS; k++) {
|
|
|
|
for (k = 0; k < NOF_CE_SYMBOLS; k++) {
|
|
|
|
ce[i][j][k] = (i == j) ? 1.0f : 0.0f;
|
|
|
|
ce[i][j][k] = (i == j) ? 1.0f : 0.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -254,6 +246,42 @@ int main(int argc, char **argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
|
|
|
|
tx_slot_symbols[i] = calloc(SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp), sizeof(cf_t));
|
|
|
|
|
|
|
|
if (!tx_slot_symbols[i]) {
|
|
|
|
|
|
|
|
perror("srslte_vec_malloc");
|
|
|
|
|
|
|
|
goto quit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DO_OFDM
|
|
|
|
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
|
|
|
|
tx_sf_symbols[i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nof_rx_antennas; i++) {
|
|
|
|
|
|
|
|
rx_sf_symbols[i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (k = 0; k < cell.nof_ports; k++) {
|
|
|
|
|
|
|
|
srslte_ofdm_tx_init(&ofdm_tx[k], cell.cp, tx_slot_symbols[k], tx_sf_symbols[k], cell.nof_prb);
|
|
|
|
|
|
|
|
srslte_ofdm_set_normalize(&ofdm_tx[k], true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (k = 0; k < nof_rx_antennas; k++) {
|
|
|
|
|
|
|
|
srslte_ofdm_rx_init(&ofdm_rx[k], cell.cp, rx_sf_symbols[k], rx_slot_symbols[k], cell.nof_prb);
|
|
|
|
|
|
|
|
srslte_ofdm_set_normalize(&ofdm_rx[k], true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_chest_dl_init(&chest_dl, cell.nof_prb)) {
|
|
|
|
|
|
|
|
goto quit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srslte_chest_dl_set_cell(&chest_dl, cell);
|
|
|
|
|
|
|
|
srslte_chest_dl_set_smooth_filter_gauss(&chest_dl, 4, 1.0f);
|
|
|
|
|
|
|
|
srslte_chest_dl_average_subframe(&chest_dl, true);
|
|
|
|
|
|
|
|
#endif /* DO_OFDM */
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < SRSLTE_MAX_TB; i++) {
|
|
|
|
for (i = 0; i < SRSLTE_MAX_TB; i++) {
|
|
|
|
if (grant.tb_en[i]) {
|
|
|
|
if (grant.tb_en[i]) {
|
|
|
@ -376,14 +404,6 @@ int main(int argc, char **argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
|
|
|
|
tx_slot_symbols[i] = calloc(SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp), sizeof(cf_t));
|
|
|
|
|
|
|
|
if (!tx_slot_symbols[i]) {
|
|
|
|
|
|
|
|
perror("srslte_vec_malloc");
|
|
|
|
|
|
|
|
goto quit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) {
|
|
|
|
for (int tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) {
|
|
|
|
if (grant.tb_en[tb]) {
|
|
|
|
if (grant.tb_en[tb]) {
|
|
|
|
for (int byte = 0; byte < grant.mcs[tb].tbs / 8; byte++) {
|
|
|
|
for (int byte = 0; byte < grant.mcs[tb].tbs / 8; byte++) {
|
|
|
@ -421,7 +441,7 @@ int main(int argc, char **argv) {
|
|
|
|
#ifdef DO_OFDM
|
|
|
|
#ifdef DO_OFDM
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
/* For each Tx antenna modulate OFDM */
|
|
|
|
/* For each Tx antenna modulate OFDM */
|
|
|
|
srslte_ofdm_tx_sf(&ofdm_tx, tx_slot_symbols[i], tx_sf_symbols[i]);
|
|
|
|
srslte_ofdm_tx_sf(&ofdm_tx[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* combine outputs */
|
|
|
|
/* combine outputs */
|
|
|
@ -455,8 +475,9 @@ int main(int argc, char **argv) {
|
|
|
|
#ifdef DO_OFDM
|
|
|
|
#ifdef DO_OFDM
|
|
|
|
/* For each Rx antenna demodulate OFDM */
|
|
|
|
/* For each Rx antenna demodulate OFDM */
|
|
|
|
for (i = 0; i < nof_rx_antennas; i++) {
|
|
|
|
for (i = 0; i < nof_rx_antennas; i++) {
|
|
|
|
srslte_ofdm_rx_sf(&ofdm_rx, tx_sf_symbols[i], rx_slot_symbols[i]);
|
|
|
|
srslte_ofdm_rx_sf(&ofdm_rx[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
srslte_chest_dl_estimate_multi(&chest_dl, rx_slot_symbols, ce_dummy, subframe, nof_rx_antennas);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
|
|
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
|
|
|
if (grant.tb_en[i]) {
|
|
|
|
if (grant.tb_en[i]) {
|
|
|
@ -506,6 +527,13 @@ int main(int argc, char **argv) {
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
|
|
|
|
|
|
|
|
quit:
|
|
|
|
quit:
|
|
|
|
|
|
|
|
for (i = 0; i < cell.nof_ports; i++) {
|
|
|
|
|
|
|
|
srslte_ofdm_tx_free(&ofdm_tx[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < nof_rx_antennas; i++) {
|
|
|
|
|
|
|
|
srslte_ofdm_rx_free(&ofdm_rx[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
srslte_chest_dl_free(&chest_dl);
|
|
|
|
srslte_pdsch_free(&pdsch_tx);
|
|
|
|
srslte_pdsch_free(&pdsch_tx);
|
|
|
|
srslte_pdsch_free(&pdsch_rx);
|
|
|
|
srslte_pdsch_free(&pdsch_rx);
|
|
|
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
|
|
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
|
|
@ -533,6 +561,9 @@ quit:
|
|
|
|
if (ce[i][j]) {
|
|
|
|
if (ce[i][j]) {
|
|
|
|
free(ce[i][j]);
|
|
|
|
free(ce[i][j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ce_dummy[i][j]) {
|
|
|
|
|
|
|
|
free(ce_dummy[i][j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tx_slot_symbols[i]) {
|
|
|
|
if (tx_slot_symbols[i]) {
|
|
|
|
free(tx_slot_symbols[i]);
|
|
|
|
free(tx_slot_symbols[i]);
|
|
|
|