PDSCH decoder acknowledges TBs/CWs per sepparate and softbuffers are arrays of pointers

master
Xavier Arteaga 7 years ago
parent e22a526350
commit 8c71c716c9

@ -160,7 +160,8 @@ int main(int argc, char **argv) {
int sfn_offset; int sfn_offset;
float rssi_utra=0,rssi=0, rsrp=0, rsrq=0, snr=0; float rssi_utra=0,rssi=0, rsrp=0, rsrq=0, snr=0;
cf_t *ce[SRSLTE_MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS];
float cfo = 0; float cfo = 0;
bool acks[SRSLTE_MAX_CODEWORDS] = {false};
if (parse_args(&prog_args, argc, argv)) { if (parse_args(&prog_args, argc, argv)) {
exit(-1); exit(-1);
@ -313,7 +314,7 @@ int main(int argc, char **argv) {
case DECODE_SIB: case DECODE_SIB:
/* We are looking for SI Blocks, search only in appropiate places */ /* We are looking for SI Blocks, search only in appropiate places */
if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) { if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
n = srslte_ue_dl_decode_multi(&ue_dl, sf_buffer, data, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync)); n = srslte_ue_dl_decode_multi(&ue_dl, sf_buffer, data, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks);
if (n < 0) { if (n < 0) {
fprintf(stderr, "Error decoding UE DL\n");fflush(stdout); fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
return -1; return -1;

@ -84,7 +84,7 @@ srslte_pcfich_t pcfich;
srslte_pdcch_t pdcch; srslte_pdcch_t pdcch;
srslte_pdsch_t pdsch; srslte_pdsch_t pdsch;
srslte_pdsch_cfg_t pdsch_cfg; srslte_pdsch_cfg_t pdsch_cfg;
srslte_softbuffer_tx_t softbuffers[SRSLTE_MAX_CODEWORDS]; srslte_softbuffer_tx_t *softbuffers[SRSLTE_MAX_CODEWORDS];
srslte_regs_t regs; srslte_regs_t regs;
srslte_ra_dl_dci_t ra_dl; srslte_ra_dl_dci_t ra_dl;
int rvidx[SRSLTE_MAX_CODEWORDS] = {0, 0}; int rvidx[SRSLTE_MAX_CODEWORDS] = {0, 0};
@ -267,7 +267,7 @@ void base_init() {
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open_multi2(&rf, rf_args, cell.nof_ports, 1)) { if (srslte_rf_open_multi(&rf, rf_args, cell.nof_ports)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
@ -334,7 +334,7 @@ void base_init() {
srslte_pdsch_set_rnti(&pdsch, UE_CRNTI); srslte_pdsch_set_rnti(&pdsch, UE_CRNTI);
for (i = 0; i < nof_tb; i++) { for (i = 0; i < nof_tb; i++) {
if (srslte_softbuffer_tx_init(&softbuffers[i], cell.nof_prb)) { if (srslte_softbuffer_tx_init(softbuffers[i], cell.nof_prb)) {
fprintf(stderr, "Error initiating soft buffer\n"); fprintf(stderr, "Error initiating soft buffer\n");
exit(-1); exit(-1);
} }
@ -344,7 +344,10 @@ void base_init() {
void base_free() { void base_free() {
int i; int i;
for (i = 0; i < nof_tb; i++) { for (i = 0; i < nof_tb; i++) {
srslte_softbuffer_tx_free(&softbuffers[i]); if (softbuffers[i]) {
free(softbuffers[i]);
}
srslte_softbuffer_tx_free(softbuffers[i]);
} }
srslte_pdsch_free(&pdsch); srslte_pdsch_free(&pdsch);
srslte_pdcch_free(&pdcch); srslte_pdcch_free(&pdcch);
@ -649,7 +652,7 @@ int main(int argc, char **argv) {
bool send_data = false; bool send_data = false;
for (i = 0; i < nof_tb; i++) { for (i = 0; i < nof_tb; i++) {
srslte_softbuffer_tx_reset(&softbuffers[i]); srslte_softbuffer_tx_reset(softbuffers[i]);
} }
#ifndef DISABLE_RF #ifndef DISABLE_RF

@ -540,7 +540,8 @@ int main(int argc, char **argv) {
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)) {
bool acks [SRSLTE_MAX_CODEWORDS] = {false};
ret = srslte_ue_sync_zerocopy_multi(&ue_sync, sf_buffer); ret = srslte_ue_sync_zerocopy_multi(&ue_sync, sf_buffer);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "Error calling srslte_ue_sync_work()\n"); fprintf(stderr, "Error calling srslte_ue_sync_work()\n");
@ -585,7 +586,7 @@ int main(int argc, char **argv) {
n = srslte_ue_dl_decode_multi(&ue_dl, n = srslte_ue_dl_decode_multi(&ue_dl,
sf_buffer, sf_buffer,
data, data,
sfn*10+srslte_ue_sync_get_sfidx(&ue_sync)); sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks);
if (n < 0) { if (n < 0) {
// fprintf(stderr, "Error decoding UE DL\n");fflush(stdout); // fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
@ -623,7 +624,7 @@ int main(int argc, char **argv) {
rsrp1 = SRSLTE_VEC_EMA(srslte_chest_dl_get_rsrp_port(&ue_dl.chest, 1), rsrp1, 0.05f); rsrp1 = SRSLTE_VEC_EMA(srslte_chest_dl_get_rsrp_port(&ue_dl.chest, 1), rsrp1, 0.05f);
noise = SRSLTE_VEC_EMA(srslte_chest_dl_get_noise_estimate(&ue_dl.chest), noise, 0.05f); noise = SRSLTE_VEC_EMA(srslte_chest_dl_get_noise_estimate(&ue_dl.chest), noise, 0.05f);
enodebrate = SRSLTE_VEC_EMA((ue_dl.pdsch_cfg.grant.mcs[0].tbs + ue_dl.pdsch_cfg.grant.mcs[1].tbs)/1000.0f, enodebrate, 0.05f); enodebrate = SRSLTE_VEC_EMA((ue_dl.pdsch_cfg.grant.mcs[0].tbs + ue_dl.pdsch_cfg.grant.mcs[1].tbs)/1000.0f, enodebrate, 0.05f);
uerate = SRSLTE_VEC_EMA((n>0)?(ue_dl.pdsch_cfg.grant.mcs[0].tbs + ue_dl.pdsch_cfg.grant.mcs[1].tbs)/1000.0f:0.0f, uerate, 0.01f); uerate = SRSLTE_VEC_EMA(((acks[0]?ue_dl.pdsch_cfg.grant.mcs[0].tbs:0) + (acks[1]?ue_dl.pdsch_cfg.grant.mcs[1].tbs:0))/1000.0f, uerate, 0.01f);
nframes++; nframes++;
if (isnan(rsrq)) { if (isnan(rsrq)) {

@ -52,6 +52,7 @@
#define SRSLTE_MAX_PORTS 4 #define SRSLTE_MAX_PORTS 4
#define SRSLTE_MAX_LAYERS 4 #define SRSLTE_MAX_LAYERS 4
#define SRSLTE_MAX_CODEWORDS 2 #define SRSLTE_MAX_CODEWORDS 2
#define SRSLTE_MAX_TB SRSLTE_MAX_CODEWORDS
#define SRSLTE_MAX_CODEBLOCKS 32 #define SRSLTE_MAX_CODEBLOCKS 32
@ -150,12 +151,12 @@ typedef enum SRSLTE_API {
} srslte_phich_resources_t; } srslte_phich_resources_t;
typedef enum { typedef enum {
SRSLTE_RNTI_USER = 0, SRSLTE_RNTI_USER = 0, /* Cell RNTI */
SRSLTE_RNTI_SI, SRSLTE_RNTI_SI, /* System Information RNTI */
SRSLTE_RNTI_RAR, SRSLTE_RNTI_RAR, /* Random Access RNTI */
SRSLTE_RNTI_TEMP, SRSLTE_RNTI_TEMP, /* Temporary C-RNTI */
SRSLTE_RNTI_SPS, SRSLTE_RNTI_SPS, /* Semi-Persistent Scheduling C-RNTI */
SRSLTE_RNTI_PCH, SRSLTE_RNTI_PCH, /* Paging RNTI */
SRSLTE_RNTI_NOF_TYPES SRSLTE_RNTI_NOF_TYPES
} srslte_rnti_type_t; } srslte_rnti_type_t;

@ -124,7 +124,7 @@ SRSLTE_API int srslte_pdsch_encode(srslte_pdsch_t *q,
SRSLTE_API int srslte_pdsch_encode_multi(srslte_pdsch_t *q, SRSLTE_API int srslte_pdsch_encode_multi(srslte_pdsch_t *q,
srslte_pdsch_cfg_t *cfg, srslte_pdsch_cfg_t *cfg,
srslte_softbuffer_tx_t softbuffers[SRSLTE_MAX_CODEWORDS], srslte_softbuffer_tx_t *softbuffers[SRSLTE_MAX_CODEWORDS],
uint8_t *data[SRSLTE_MAX_CODEWORDS], uint8_t *data[SRSLTE_MAX_CODEWORDS],
uint16_t rnti, uint16_t rnti,
cf_t *sf_symbols[SRSLTE_MAX_PORTS]); cf_t *sf_symbols[SRSLTE_MAX_PORTS]);
@ -140,12 +140,13 @@ SRSLTE_API int srslte_pdsch_decode(srslte_pdsch_t *q,
SRSLTE_API int srslte_pdsch_decode_multi(srslte_pdsch_t *q, SRSLTE_API int srslte_pdsch_decode_multi(srslte_pdsch_t *q,
srslte_pdsch_cfg_t *cfg, srslte_pdsch_cfg_t *cfg,
srslte_softbuffer_rx_t softbuffers[SRSLTE_MAX_CODEWORDS], srslte_softbuffer_rx_t *softbuffers[SRSLTE_MAX_CODEWORDS],
cf_t *sf_symbols[SRSLTE_MAX_PORTS], cf_t *sf_symbols[SRSLTE_MAX_PORTS],
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
float noise_estimate, float noise_estimate,
uint16_t rnti, uint16_t rnti,
uint8_t *data[SRSLTE_MAX_CODEWORDS]); uint8_t *data[SRSLTE_MAX_CODEWORDS],
bool acks[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_pdsch_pmi_select(srslte_pdsch_t *q, SRSLTE_API int srslte_pdsch_pmi_select(srslte_pdsch_t *q,
srslte_pdsch_cfg_t *cfg, srslte_pdsch_cfg_t *cfg,

@ -84,7 +84,7 @@ typedef struct SRSLTE_API {
srslte_cfo_t sfo_correct; srslte_cfo_t sfo_correct;
srslte_pdsch_cfg_t pdsch_cfg; srslte_pdsch_cfg_t pdsch_cfg;
srslte_softbuffer_rx_t softbuffers[SRSLTE_MAX_CODEWORDS]; srslte_softbuffer_rx_t *softbuffers[SRSLTE_MAX_CODEWORDS];
srslte_ra_dl_dci_t dl_dci; srslte_ra_dl_dci_t dl_dci;
srslte_cell_t cell; srslte_cell_t cell;
@ -180,7 +180,7 @@ SRSLTE_API int srslte_ue_dl_decode(srslte_ue_dl_t * q,
SRSLTE_API int srslte_ue_dl_decode_multi(srslte_ue_dl_t * q, SRSLTE_API int srslte_ue_dl_decode_multi(srslte_ue_dl_t * q,
cf_t *input[SRSLTE_MAX_PORTS], cf_t *input[SRSLTE_MAX_PORTS],
uint8_t *data[SRSLTE_MAX_CODEWORDS], uint8_t *data[SRSLTE_MAX_CODEWORDS],
uint32_t tti); uint32_t tti, bool acks[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_ue_dl_decode_rnti(srslte_ue_dl_t * q, SRSLTE_API int srslte_ue_dl_decode_rnti(srslte_ue_dl_t * q,
cf_t *input, cf_t *input,
@ -192,7 +192,8 @@ SRSLTE_API int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t * q,
cf_t *input[SRSLTE_MAX_PORTS], cf_t *input[SRSLTE_MAX_PORTS],
uint8_t *data[SRSLTE_MAX_CODEWORDS], uint8_t *data[SRSLTE_MAX_CODEWORDS],
uint32_t tti, uint32_t tti,
uint16_t rnti); uint16_t rnti,
bool acks[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q, SRSLTE_API int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q,
uint32_t *ri, uint32_t *ri,

@ -553,30 +553,33 @@ void srslte_pdsch_free_rnti(srslte_pdsch_t* q, uint16_t rnti)
int srslte_pdsch_decode(srslte_pdsch_t *q, int srslte_pdsch_decode(srslte_pdsch_t *q,
srslte_pdsch_cfg_t *cfg, srslte_softbuffer_rx_t *softbuffer, srslte_pdsch_cfg_t *cfg, srslte_softbuffer_rx_t *softbuffer,
cf_t *sf_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate, cf_t *sf_symbols, cf_t *ce[SRSLTE_MAX_PORTS], float noise_estimate,
uint16_t rnti, uint8_t *data) uint16_t rnti, uint8_t *data) {
{
cf_t *_sf_symbols[SRSLTE_MAX_PORTS]; cf_t *_sf_symbols[SRSLTE_MAX_PORTS];
cf_t *_ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; cf_t *_ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
bool acks[SRSLTE_MAX_CODEWORDS];
srslte_softbuffer_rx_t *softbuffers[SRSLTE_MAX_TB] = {NULL};
_sf_symbols[0] = sf_symbols; _sf_symbols[0] = sf_symbols;
for (int i=0;i<q->cell.nof_ports;i++) { for (int i = 0; i < q->cell.nof_ports; i++) {
_ce[i][0] = ce[i]; _ce[i][0] = ce[i];
} }
return srslte_pdsch_decode_multi(q, cfg, softbuffer, _sf_symbols, _ce, noise_estimate, rnti, &data);
softbuffers[0] = softbuffer;
return srslte_pdsch_decode_multi(q, cfg, softbuffers, _sf_symbols, _ce, noise_estimate, rnti, &data, acks);
} }
/** Decodes the PDSCH from the received symbols /** Decodes the PDSCH from the received symbols
*/ */
int srslte_pdsch_decode_multi(srslte_pdsch_t *q, int srslte_pdsch_decode_multi(srslte_pdsch_t *q,
srslte_pdsch_cfg_t *cfg, srslte_softbuffer_rx_t softbuffers[SRSLTE_MAX_CODEWORDS], srslte_pdsch_cfg_t *cfg, srslte_softbuffer_rx_t *softbuffers[SRSLTE_MAX_CODEWORDS],
cf_t *sf_symbols[SRSLTE_MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], float noise_estimate, cf_t *sf_symbols[SRSLTE_MAX_PORTS], cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
uint16_t rnti, uint8_t *data[SRSLTE_MAX_CODEWORDS]) float noise_estimate, uint16_t rnti, uint8_t *data[SRSLTE_MAX_CODEWORDS],
{ bool acks[SRSLTE_MAX_CODEWORDS]) {
/* Set pointers for layermapping & precoding */ /* Set pointers for layermapping & precoding */
uint32_t i; uint32_t i;
cf_t *x[SRSLTE_MAX_LAYERS]; cf_t *x[SRSLTE_MAX_LAYERS];
int ret = 0;
if (q != NULL && if (q != NULL &&
sf_symbols != NULL && sf_symbols != NULL &&
@ -658,7 +661,8 @@ int srslte_pdsch_decode_multi(srslte_pdsch_t *q,
} }
for (uint32_t tb = 0; tb < cfg->grant.nof_tb; tb ++) { for (uint32_t tb = 0; tb < cfg->grant.nof_tb; tb ++) {
ret |= srslte_pdsch_codeword_decode(q, cfg, &softbuffers[tb], rnti, data[tb], tb); int ret = srslte_pdsch_codeword_decode(q, cfg, softbuffers[tb], rnti, data[tb], tb);
acks[tb] = (ret == SRSLTE_SUCCESS);
} }
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSLTE_VERBOSE_ISDEBUG()) {
@ -666,7 +670,7 @@ int srslte_pdsch_decode_multi(srslte_pdsch_t *q,
srslte_vec_save_file("llr.dat", q->e, cfg->nbits[0].nof_bits*sizeof(int16_t)); srslte_vec_save_file("llr.dat", q->e, cfg->nbits[0].nof_bits*sizeof(int16_t));
} }
return ret; return SRSLTE_SUCCESS;
} else { } else {
return SRSLTE_ERROR_INVALID_INPUTS; return SRSLTE_ERROR_INVALID_INPUTS;
@ -776,7 +780,7 @@ int srslte_pdsch_encode(srslte_pdsch_t *q,
} }
int srslte_pdsch_encode_multi(srslte_pdsch_t *q, int srslte_pdsch_encode_multi(srslte_pdsch_t *q,
srslte_pdsch_cfg_t *cfg, srslte_softbuffer_tx_t softbuffers[SRSLTE_MAX_CODEWORDS], srslte_pdsch_cfg_t *cfg, srslte_softbuffer_tx_t *softbuffers[SRSLTE_MAX_CODEWORDS],
uint8_t *data[SRSLTE_MAX_CODEWORDS], uint16_t rnti, cf_t *sf_symbols[SRSLTE_MAX_PORTS]) { uint8_t *data[SRSLTE_MAX_CODEWORDS], uint16_t rnti, cf_t *sf_symbols[SRSLTE_MAX_PORTS]) {
int i; int i;
@ -806,7 +810,7 @@ int srslte_pdsch_encode_multi(srslte_pdsch_t *q,
} }
for (uint32_t tb = 0; tb < cfg->grant.nof_tb; tb ++) { for (uint32_t tb = 0; tb < cfg->grant.nof_tb; tb ++) {
ret |= srslte_pdsch_codeword_encode(q, cfg, &softbuffers[tb], rnti, data[tb], tb); ret |= srslte_pdsch_codeword_encode(q, cfg, softbuffers[tb], rnti, data[tb], tb);
} }
if (q->cell.nof_ports > 1) { if (q->cell.nof_ports > 1) {

@ -135,7 +135,7 @@ void parse_args(int argc, char **argv) {
uint8_t *data[SRSLTE_MAX_CODEWORDS] = {NULL}; uint8_t *data[SRSLTE_MAX_CODEWORDS] = {NULL};
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; cf_t *ce[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;
#ifdef DO_OFDM #ifdef DO_OFDM
@ -151,8 +151,9 @@ int main(int argc, char **argv) {
uint32_t i, j, k; uint32_t i, j, k;
int ret = -1; int ret = -1;
struct timeval t[3]; struct timeval t[3];
srslte_softbuffer_tx_t softbuffers_tx[SRSLTE_MAX_CODEWORDS]; srslte_softbuffer_tx_t *softbuffers_tx[SRSLTE_MAX_CODEWORDS];
int M=10; int M=10;
bool acks[SRSLTE_MAX_CODEWORDS] = {false};
parse_args(argc,argv); parse_args(argc,argv);
@ -163,8 +164,6 @@ int main(int argc, char **argv) {
bzero(ce, sizeof(cf_t*)*SRSLTE_MAX_PORTS); bzero(ce, 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);
bzero(softbuffers_tx, sizeof(srslte_softbuffer_tx_t)*SRSLTE_MAX_CODEWORDS);
bzero(softbuffers_rx, sizeof(srslte_softbuffer_rx_t)*SRSLTE_MAX_CODEWORDS);
/* Parse transmission mode */ /* Parse transmission mode */
if (srslte_str2mimotype(mimo_type_str, &mimo_type)) { if (srslte_str2mimotype(mimo_type_str, &mimo_type)) {
@ -275,8 +274,14 @@ int main(int argc, char **argv) {
srslte_pdsch_set_rnti(&pdsch_rx, rnti); srslte_pdsch_set_rnti(&pdsch_rx, rnti);
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_TB; i++) {
if (srslte_softbuffer_rx_init(&softbuffers_rx[i], cell.nof_prb)) { softbuffers_rx[i] = calloc(sizeof(srslte_softbuffer_rx_t), 1);
if (!softbuffers_rx[i]) {
fprintf(stderr, "Error allocating RX soft buffer\n");
goto quit;
}
if (srslte_softbuffer_rx_init(softbuffers_rx[i], cell.nof_prb)) {
fprintf(stderr, "Error initiating RX soft buffer\n"); fprintf(stderr, "Error initiating RX soft buffer\n");
goto quit; goto quit;
} }
@ -339,7 +344,13 @@ int main(int argc, char **argv) {
srslte_pdsch_set_rnti(&pdsch_tx, rnti); srslte_pdsch_set_rnti(&pdsch_tx, rnti);
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
if (srslte_softbuffer_tx_init(&softbuffers_tx[i], cell.nof_prb)) { softbuffers_tx[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1);
if (!softbuffers_tx[i]) {
fprintf(stderr, "Error allocating TX soft buffer\n");
}
if (srslte_softbuffer_tx_init(softbuffers_tx[i], cell.nof_prb)) {
fprintf(stderr, "Error initiating TX soft buffer\n"); fprintf(stderr, "Error initiating TX soft buffer\n");
goto quit; goto quit;
} }
@ -427,29 +438,44 @@ int main(int argc, char **argv) {
#endif #endif
for (i = 0; i < grant.nof_tb; i++) { for (i = 0; i < grant.nof_tb; i++) {
if (grant.mcs[i].tbs) { if (grant.mcs[i].tbs) {
srslte_softbuffer_rx_reset_tbs(&softbuffers_rx[i], (uint32_t) grant.mcs[i].tbs); srslte_softbuffer_rx_reset_tbs(softbuffers_rx[i], (uint32_t) grant.mcs[i].tbs);
} }
} }
r = srslte_pdsch_decode_multi(&pdsch_rx, &pdsch_cfg, softbuffers_rx, rx_slot_symbols, ce, 0, rnti, data); r = srslte_pdsch_decode_multi(&pdsch_rx, &pdsch_cfg, softbuffers_rx, rx_slot_symbols, ce, 0, rnti, data, acks);
} }
gettimeofday(&t[2], NULL); gettimeofday(&t[2], NULL);
get_time_interval(t); get_time_interval(t);
printf("DECODED %s in %.2f (PHY bitrate=%.2f Mbps. Processing bitrate=%.2f Mbps)\n", r?"Error":"OK", printf("DECODED %s in %.2f (PHY bitrate=%.2f Mbps. Processing bitrate=%.2f Mbps)\n", r?"Error":"OK",
(float) t[0].tv_usec/M, (float) (grant.mcs[0].tbs + grant.mcs[1].tbs)/1000.0f, (float) t[0].tv_usec/M, (float) (grant.mcs[0].tbs + grant.mcs[1].tbs)/1000.0f,
(float) (grant.mcs[0].tbs + grant.mcs[1].tbs)*M/t[0].tv_usec); (float) (grant.mcs[0].tbs + grant.mcs[1].tbs)*M/t[0].tv_usec);
/* If there is an error in PDSCH decode */
if (r) { if (r) {
ret = -1; ERROR("PDSCH decode");
ret = SRSLTE_ERROR;
goto quit; goto quit;
} }
/* Check all transport blocks have been decoded OK */
for (int tb = 0; tb < grant.nof_tb; tb++) {
ret |= (acks[tb]) ? SRSLTE_SUCCESS : SRSLTE_ERROR;
}
ret = 0; ret = SRSLTE_SUCCESS;
quit: quit:
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++) {
srslte_softbuffer_tx_free(&softbuffers_tx[i]); srslte_softbuffer_tx_free(softbuffers_tx[i]);
srslte_softbuffer_rx_free(&softbuffers_rx[i]); if (softbuffers_tx[i]) {
free(softbuffers_tx[i]);
}
srslte_softbuffer_rx_free(softbuffers_rx[i]);
if (softbuffers_rx[i]) {
free(softbuffers_rx[i]);
}
if (data[i]) { if (data[i]) {
free(data[i]); free(data[i]);

@ -102,8 +102,14 @@ int srslte_ue_dl_init_multi(srslte_ue_dl_t *q,
goto clean_exit; goto clean_exit;
} }
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSLTE_MAX_TB; i++) {
if (srslte_softbuffer_rx_init(&q->softbuffers[i], q->cell.nof_prb)) { q->softbuffers[i] = srslte_vec_malloc(sizeof(srslte_softbuffer_rx_t));
if (!q->softbuffers[i]) {
fprintf(stderr, "Error allocating soft buffer\n");
goto clean_exit;
}
if (srslte_softbuffer_rx_init(q->softbuffers[i], q->cell.nof_prb)) {
fprintf(stderr, "Error initiating soft buffer\n"); fprintf(stderr, "Error initiating soft buffer\n");
goto clean_exit; goto clean_exit;
} }
@ -157,8 +163,11 @@ void srslte_ue_dl_free(srslte_ue_dl_t *q) {
srslte_pdcch_free(&q->pdcch); srslte_pdcch_free(&q->pdcch);
srslte_pdsch_free(&q->pdsch); srslte_pdsch_free(&q->pdsch);
srslte_cfo_free(&q->sfo_correct); srslte_cfo_free(&q->sfo_correct);
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSLTE_MAX_TB; i++) {
srslte_softbuffer_rx_free(&q->softbuffers[i]); srslte_softbuffer_rx_free(q->softbuffers[i]);
if (q->softbuffers[i]) {
free(q->softbuffers[i]);
}
} }
for (int j=0;j<q->nof_rx_antennas;j++) { for (int j=0;j<q->nof_rx_antennas;j++) {
if (q->sf_symbols_m[j]) { if (q->sf_symbols_m[j]) {
@ -194,7 +203,7 @@ void srslte_ue_dl_set_rnti(srslte_ue_dl_t *q, uint16_t rnti) {
void srslte_ue_dl_reset(srslte_ue_dl_t *q) { void srslte_ue_dl_reset(srslte_ue_dl_t *q) {
for(int i = 0; i < SRSLTE_MAX_CODEWORDS; i++){ for(int i = 0; i < SRSLTE_MAX_CODEWORDS; i++){
srslte_softbuffer_rx_reset(&q->softbuffers[i]); srslte_softbuffer_rx_reset(q->softbuffers[i]);
} }
bzero(&q->pdsch_cfg, sizeof(srslte_pdsch_cfg_t)); bzero(&q->pdsch_cfg, sizeof(srslte_pdsch_cfg_t));
} }
@ -212,14 +221,16 @@ void srslte_ue_dl_set_sample_offset(srslte_ue_dl_t * q, float sample_offset) {
*/ */
int srslte_ue_dl_decode(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t tti) { int srslte_ue_dl_decode(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t tti) {
uint8_t *_data[SRSLTE_MAX_CODEWORDS]; uint8_t *_data[SRSLTE_MAX_CODEWORDS];
cf_t *_input[SRSLTE_MAX_PORTS]; cf_t *_input[SRSLTE_MAX_PORTS];
bool acks[SRSLTE_MAX_CODEWORDS] = {false};
_data[0] = data; _data[0] = data;
_input[0] = input; _input[0] = input;
return srslte_ue_dl_decode_rnti_multi(q, _input, _data, tti, q->current_rnti); return srslte_ue_dl_decode_rnti_multi(q, _input, _data, tti, q->current_rnti, acks);
} }
int srslte_ue_dl_decode_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_PORTS], uint8_t *data[SRSLTE_MAX_CODEWORDS], uint32_t tti) { int srslte_ue_dl_decode_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_PORTS], uint8_t *data[SRSLTE_MAX_CODEWORDS],
return srslte_ue_dl_decode_rnti_multi(q, input, data, tti, q->current_rnti); uint32_t tti, bool acks[SRSLTE_MAX_CODEWORDS]) {
return srslte_ue_dl_decode_rnti_multi(q, input, data, tti, q->current_rnti, acks);
} }
int srslte_ue_dl_decode_fft_estimate(srslte_ue_dl_t *q, cf_t *input, uint32_t sf_idx, uint32_t *cfi) int srslte_ue_dl_decode_fft_estimate(srslte_ue_dl_t *q, cf_t *input, uint32_t sf_idx, uint32_t *cfi)
@ -307,16 +318,18 @@ int srslte_ue_dl_cfg_grant(srslte_ue_dl_t *q, srslte_ra_dl_grant_t *grant, uint3
return srslte_pdsch_cfg_multi(&q->pdsch_cfg, q->cell, grant, cfi, sf_idx, rvidx, mimo_type, pmi); return srslte_pdsch_cfg_multi(&q->pdsch_cfg, q->cell, grant, cfi, sf_idx, rvidx, mimo_type, pmi);
} }
int srslte_ue_dl_decode_rnti(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t tti, uint16_t rnti) int srslte_ue_dl_decode_rnti(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t tti, uint16_t rnti) {
{
uint8_t *_data[SRSLTE_MAX_CODEWORDS]; uint8_t *_data[SRSLTE_MAX_CODEWORDS];
cf_t *_input[SRSLTE_MAX_PORTS]; cf_t *_input[SRSLTE_MAX_PORTS];
bool acks[SRSLTE_MAX_CODEWORDS] = {false};
_input[0] = input; _input[0] = input;
_data[0] = data; _data[0] = data;
return srslte_ue_dl_decode_rnti_multi(q, _input, _data, tti, rnti); return srslte_ue_dl_decode_rnti_multi(q, _input, _data, tti, rnti, acks);
} }
int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_PORTS], uint8_t *data[SRSLTE_MAX_CODEWORDS], uint32_t tti, uint16_t rnti) int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_PORTS],
uint8_t *data[SRSLTE_MAX_CODEWORDS], uint32_t tti, uint16_t rnti,
bool acks[SRSLTE_MAX_CODEWORDS])
{ {
srslte_mimo_type_t mimo_type; srslte_mimo_type_t mimo_type;
srslte_dci_msg_t dci_msg; srslte_dci_msg_t dci_msg;
@ -324,8 +337,7 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR
srslte_ra_dl_grant_t grant; srslte_ra_dl_grant_t grant;
int ret = SRSLTE_ERROR; int ret = SRSLTE_ERROR;
uint32_t cfi; uint32_t cfi;
uint32_t sf_idx = tti%10;
uint32_t sf_idx = tti%10;
if ((ret = srslte_ue_dl_decode_fft_estimate_multi(q, input, sf_idx, &cfi)) < 0) { if ((ret = srslte_ue_dl_decode_fft_estimate_multi(q, input, sf_idx, &cfi)) < 0) {
return ret; return ret;
@ -357,7 +369,7 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR
uint32_t k = (sfn/2)%4; uint32_t k = (sfn/2)%4;
for (int i = 0; i < grant.nof_tb; i++) { for (int i = 0; i < grant.nof_tb; i++) {
rvidx[i] = ((uint32_t) ceilf((float) 1.5 * k)) % 4; rvidx[i] = ((uint32_t) ceilf((float) 1.5 * k)) % 4;
srslte_softbuffer_rx_reset_tbs(&q->softbuffers[i], (uint32_t) grant.mcs[i].tbs); srslte_softbuffer_rx_reset_tbs(q->softbuffers[i], (uint32_t) grant.mcs[i].tbs);
} }
} else { } else {
for (int i = 0; i < grant.nof_tb; i++) { for (int i = 0; i < grant.nof_tb; i++) {
@ -372,7 +384,7 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR
ERROR("Wrong number of transport blocks"); ERROR("Wrong number of transport blocks");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
srslte_softbuffer_rx_reset_tbs(&q->softbuffers[i], (uint32_t) grant.mcs[i].tbs); srslte_softbuffer_rx_reset_tbs(q->softbuffers[i], (uint32_t) grant.mcs[i].tbs);
} }
} }
@ -421,7 +433,7 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR
ret = srslte_pdsch_decode_multi(&q->pdsch, &q->pdsch_cfg, q->softbuffers, ret = srslte_pdsch_decode_multi(&q->pdsch, &q->pdsch_cfg, q->softbuffers,
q->sf_symbols_m, q->ce_m, q->sf_symbols_m, q->ce_m,
noise_estimate, noise_estimate,
rnti, data); rnti, data, acks);
if (ret == SRSLTE_ERROR) { if (ret == SRSLTE_ERROR) {
q->pkt_errors++; q->pkt_errors++;

Loading…
Cancel
Save