2015-01-29 16:15:09 -08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* \section COPYRIGHT
|
|
|
|
*
|
2015-11-13 04:22:33 -08:00
|
|
|
* Copyright 2013-2015 Software Radio Systems Limited
|
2015-01-29 16:15:09 -08:00
|
|
|
*
|
|
|
|
* \section LICENSE
|
|
|
|
*
|
2015-03-20 05:01:08 -07:00
|
|
|
* This file is part of the srsLTE library.
|
2015-01-29 16:15:09 -08:00
|
|
|
*
|
2015-03-20 05:01:08 -07:00
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
2015-05-08 08:05:40 -07:00
|
|
|
* it under the terms of the GNU Affero General Public License as
|
2015-01-29 16:15:09 -08:00
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
2015-03-20 05:01:08 -07:00
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
2015-01-29 16:15:09 -08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-05-08 08:05:40 -07:00
|
|
|
* GNU Affero General Public License for more details.
|
2015-01-29 16:15:09 -08:00
|
|
|
*
|
2015-05-08 08:05:40 -07:00
|
|
|
* A copy of the GNU Affero General Public License can be found in
|
2015-01-29 16:15:09 -08:00
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
#include "srslte/srslte.h"
|
2015-01-29 16:15:09 -08:00
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
srslte_cell_t cell = {
|
2018-05-14 01:45:04 -07:00
|
|
|
.nof_prb = 6, // nof_prb
|
|
|
|
.nof_ports = 1, // nof_ports
|
|
|
|
.id = 0, // cell_id
|
|
|
|
.cp = SRSLTE_CP_NORM, // cyclic prefix
|
|
|
|
.phich_length = SRSLTE_PHICH_NORM, // PHICH length
|
|
|
|
.phich_resources = SRSLTE_PHICH_R_1_6 // PHICH resources
|
|
|
|
};
|
|
|
|
|
|
|
|
srslte_uci_cfg_t uci_cfg = {
|
|
|
|
.I_offset_cqi = 6,
|
|
|
|
.I_offset_ri = 2,
|
|
|
|
.I_offset_ack = 9,
|
|
|
|
};
|
|
|
|
|
|
|
|
srslte_uci_data_t uci_data_tx = {
|
|
|
|
.uci_cqi = {0},
|
|
|
|
.uci_cqi_len = 0,
|
|
|
|
.uci_ri = 0,
|
|
|
|
.uci_ri_len = 0,
|
|
|
|
.uci_ack = 0,
|
|
|
|
.uci_ack_2 = 0,
|
|
|
|
.uci_ack_len = 0,
|
|
|
|
.ri_periodic_report = false,
|
|
|
|
.scheduling_request = false,
|
|
|
|
.channel_selection = false,
|
|
|
|
.cqi_ack = false
|
2015-01-29 16:15:09 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
uint32_t cfi = 2;
|
|
|
|
uint32_t tbs = 0;
|
|
|
|
uint32_t subframe = 1;
|
2015-03-18 11:14:24 -07:00
|
|
|
srslte_mod_t modulation = SRSLTE_MOD_QPSK;
|
2015-01-29 16:15:09 -08:00
|
|
|
uint32_t rv_idx = 0;
|
2015-02-15 23:55:17 -08:00
|
|
|
uint32_t L_prb = 2;
|
|
|
|
uint32_t n_prb = 0;
|
|
|
|
int freq_hop = -1;
|
|
|
|
int riv = -1;
|
2015-07-05 13:30:47 -07:00
|
|
|
uint32_t mcs_idx = 0;
|
2018-05-14 01:45:04 -07:00
|
|
|
srslte_cqi_value_t cqi_value;
|
2015-01-29 16:15:09 -08:00
|
|
|
|
|
|
|
void usage(char *prog) {
|
2018-05-14 01:45:04 -07:00
|
|
|
printf("Usage: %s [csrnfvmtLNF] \n", prog);
|
|
|
|
printf("\n\tCell specific parameters:\n");
|
|
|
|
printf("\t\t-n number of PRB [Default %d]\n", cell.nof_prb);
|
|
|
|
printf("\t\t-c cell id [Default %d]\n", cell.id);
|
|
|
|
|
|
|
|
printf("\n\tGrant parameters:\n");
|
|
|
|
printf("\t\t-m MCS index (0-28) [Default %d]\n", mcs_idx);
|
|
|
|
printf("\t\t-L L_prb [Default %d]\n", L_prb);
|
|
|
|
printf("\t\t-N n_prb [Default %d]\n", n_prb);
|
|
|
|
printf("\t\t-F frequency hopping [Default %d]\n", freq_hop);
|
|
|
|
printf("\t\t-R RIV [Default %d]\n", riv);
|
|
|
|
printf("\t\t-r rv_idx (0-3) [Default %d]\n", rv_idx);
|
|
|
|
printf("\t\t-f cfi [Default %d]\n", cfi);
|
|
|
|
|
|
|
|
printf("\n\tCQI/RI/ACK Reporting indexes parameters:\n");
|
|
|
|
printf("\t\t-p I_offset_cqi (0-15) [Default %d]\n", uci_cfg.I_offset_cqi);
|
|
|
|
printf("\t\t-p I_offset_ri (0-15) [Default %d]\n", uci_cfg.I_offset_ri);
|
|
|
|
printf("\t\t-p I_offset_ack (0-15) [Default %d]\n", uci_cfg.I_offset_ack);
|
|
|
|
|
|
|
|
printf("\n\tCQI/RI/ACK Reporting contents:\n");
|
|
|
|
printf("\t\t-p uci_cqi (zeros, ones, random) [Default zeros]\n");
|
|
|
|
printf("\t\t-p uci_cqi_len (0-64) [Default %d]\n", uci_data_tx.uci_cqi_len);
|
|
|
|
printf("\t\t-p uci_ri (0-1) (zeros, ones, random) [Default none]\n");
|
|
|
|
printf("\t\t-p uci_ack (0-1) [Default none]\n");
|
|
|
|
printf("\t\t-p uci_ack_2 (0-1) [Default none]\n");
|
|
|
|
|
|
|
|
printf("\n\tOther parameters:\n");
|
|
|
|
printf("\t\t-s subframe [Default %d]\n", subframe);
|
2015-03-18 11:14:24 -07:00
|
|
|
printf("\t-v [set srslte_verbose to debug, default none]\n");
|
2015-01-29 16:15:09 -08:00
|
|
|
}
|
|
|
|
|
2018-05-14 01:45:04 -07:00
|
|
|
void parse_extensive_param (char *param, char *arg) {
|
|
|
|
int ext_code = SRSLTE_SUCCESS;
|
|
|
|
if (!strcmp(param, "I_offset_cqi")) {
|
|
|
|
uci_cfg.I_offset_cqi = (uint32_t) atoi(arg);
|
|
|
|
if (uci_cfg.I_offset_cqi > 15) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "I_offset_ri")) {
|
|
|
|
uci_cfg.I_offset_ri = (uint32_t) atoi(arg);
|
|
|
|
if (uci_cfg.I_offset_ri > 15) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "I_offset_ack")) {
|
|
|
|
uci_cfg.I_offset_ack = (uint32_t) atoi(arg);
|
|
|
|
if (uci_cfg.I_offset_ack > 15) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_cqi")) {
|
|
|
|
if (!strcmp(arg, "wideband")) {
|
|
|
|
cqi_value.type = SRSLTE_CQI_TYPE_WIDEBAND;
|
|
|
|
cqi_value.wideband.wideband_cqi = (uint8_t) (rand() & 0x03);
|
|
|
|
uci_data_tx.uci_cqi_len = (uint32_t) srslte_cqi_value_unpack(uci_data_tx.uci_cqi, &cqi_value);
|
|
|
|
} else {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_cqi_len")) {
|
|
|
|
uci_data_tx.uci_cqi_len = (uint32_t) atol(arg);
|
|
|
|
if (uci_data_tx.uci_cqi_len >= SRSLTE_CQI_MAX_BITS) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_ri")) {
|
|
|
|
uci_data_tx.uci_ri = (uint8_t) atol(arg);
|
|
|
|
if (uci_data_tx.uci_ri > 1) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
} else {
|
|
|
|
uci_data_tx.uci_ri_len = 1;
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_ack")) {
|
|
|
|
uci_data_tx.uci_ack = (uint8_t) atol(arg);
|
|
|
|
if (uci_data_tx.uci_ack > 1) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
} else {
|
|
|
|
uci_data_tx.uci_ack_len++;
|
|
|
|
if (uci_data_tx.uci_ack_len > 2) {
|
|
|
|
uci_data_tx.uci_ack_len = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_ack_2")) {
|
|
|
|
uci_data_tx.uci_ack_2 = (uint8_t) atol(arg);
|
|
|
|
if (uci_data_tx.uci_ack_2 > 1) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
} else {
|
|
|
|
uci_data_tx.uci_ack_len++;
|
|
|
|
if (uci_data_tx.uci_ack_len > 2) {
|
|
|
|
uci_data_tx.uci_ack_len = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ext_code) {
|
|
|
|
fprintf(stderr, "Error parsing parameter '%s' and argument '%s'\n", param, arg);
|
|
|
|
exit(ext_code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-29 16:15:09 -08:00
|
|
|
void parse_args(int argc, char **argv) {
|
|
|
|
int opt;
|
2018-05-14 01:45:04 -07:00
|
|
|
while ((opt = getopt(argc, argv, "msLNRFrncpv")) != -1) {
|
2015-01-29 16:15:09 -08:00
|
|
|
switch(opt) {
|
|
|
|
case 'm':
|
2015-07-05 13:30:47 -07:00
|
|
|
mcs_idx = atoi(argv[optind]);
|
2015-01-29 16:15:09 -08:00
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
subframe = atoi(argv[optind]);
|
|
|
|
break;
|
2015-02-15 23:55:17 -08:00
|
|
|
case 'L':
|
|
|
|
L_prb = atoi(argv[optind]);
|
|
|
|
break;
|
|
|
|
case 'N':
|
|
|
|
n_prb = atoi(argv[optind]);
|
|
|
|
break;
|
|
|
|
case 'R':
|
|
|
|
riv = atoi(argv[optind]);
|
|
|
|
break;
|
|
|
|
case 'F':
|
|
|
|
freq_hop = atoi(argv[optind]);
|
|
|
|
break;
|
2015-01-29 16:15:09 -08:00
|
|
|
case 'r':
|
|
|
|
rv_idx = atoi(argv[optind]);
|
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
cell.nof_prb = atoi(argv[optind]);
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
cell.id = atoi(argv[optind]);
|
|
|
|
break;
|
2018-05-14 01:45:04 -07:00
|
|
|
case 'p':
|
|
|
|
parse_extensive_param(argv[optind], argv[optind + 1]);
|
|
|
|
optind++;
|
|
|
|
break;
|
2015-01-29 16:15:09 -08:00
|
|
|
case 'v':
|
2015-03-18 11:14:24 -07:00
|
|
|
srslte_verbose++;
|
2015-01-29 16:15:09 -08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
usage(argv[0]);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2017-09-01 04:29:11 -07:00
|
|
|
srslte_pusch_t pusch_tx;
|
|
|
|
srslte_pusch_t pusch_rx;
|
2015-01-29 16:15:09 -08:00
|
|
|
uint8_t *data = NULL;
|
2015-02-14 05:20:16 -08:00
|
|
|
cf_t *sf_symbols = NULL;
|
2016-04-21 10:06:48 -07:00
|
|
|
cf_t *ce = NULL;
|
2015-01-29 16:15:09 -08:00
|
|
|
int ret = -1;
|
|
|
|
struct timeval t[3];
|
2015-04-27 09:14:28 -07:00
|
|
|
srslte_pusch_cfg_t cfg;
|
2016-04-21 10:06:48 -07:00
|
|
|
srslte_softbuffer_tx_t softbuffer_tx;
|
|
|
|
srslte_softbuffer_rx_t softbuffer_rx;
|
2015-02-09 02:32:47 -08:00
|
|
|
|
2015-01-29 16:15:09 -08:00
|
|
|
parse_args(argc,argv);
|
|
|
|
|
2015-04-27 09:14:28 -07:00
|
|
|
bzero(&cfg, sizeof(srslte_pusch_cfg_t));
|
|
|
|
|
2018-05-14 01:45:04 -07:00
|
|
|
srslte_dft_load();
|
|
|
|
|
2015-04-27 09:14:28 -07:00
|
|
|
srslte_ra_ul_dci_t dci;
|
|
|
|
dci.freq_hop_fl = freq_hop;
|
|
|
|
if (riv < 0) {
|
|
|
|
dci.type2_alloc.L_crb = L_prb;
|
|
|
|
dci.type2_alloc.RB_start = n_prb;
|
|
|
|
} else {
|
2015-08-07 17:16:48 -07:00
|
|
|
dci.type2_alloc.riv = riv;
|
2015-04-27 09:14:28 -07:00
|
|
|
}
|
2015-07-05 13:30:47 -07:00
|
|
|
dci.mcs_idx = mcs_idx;
|
2015-08-07 17:16:48 -07:00
|
|
|
|
2015-07-19 13:52:56 -07:00
|
|
|
srslte_ra_ul_grant_t grant;
|
2017-10-19 13:10:27 -07:00
|
|
|
if (srslte_ra_ul_dci_to_grant(&dci, cell.nof_prb, 0, &grant)) {
|
2015-08-07 17:16:48 -07:00
|
|
|
fprintf(stderr, "Error computing resource allocation\n");
|
|
|
|
return ret;
|
2015-07-19 13:52:56 -07:00
|
|
|
}
|
2015-08-07 17:16:48 -07:00
|
|
|
|
2015-06-14 13:11:49 -07:00
|
|
|
srslte_pusch_hopping_cfg_t ul_hopping;
|
|
|
|
ul_hopping.n_sb = 1;
|
|
|
|
ul_hopping.hopping_offset = 0;
|
|
|
|
ul_hopping.hop_mode = SRSLTE_PUSCH_HOP_MODE_INTER_SF;
|
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
if (srslte_pusch_init_ue(&pusch_tx, cell.nof_prb)) {
|
|
|
|
fprintf(stderr, "Error creating PUSCH object\n");
|
2015-06-14 13:11:49 -07:00
|
|
|
goto quit;
|
|
|
|
}
|
2017-09-01 04:29:11 -07:00
|
|
|
if (srslte_pusch_set_cell(&pusch_tx, cell)) {
|
|
|
|
fprintf(stderr, "Error creating PUSCH object\n");
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
if (srslte_pusch_init_enb(&pusch_rx, cell.nof_prb)) {
|
|
|
|
fprintf(stderr, "Error creating PUSCH object\n");
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
if (srslte_pusch_set_cell(&pusch_rx, cell)) {
|
|
|
|
fprintf(stderr, "Error creating PUSCH object\n");
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
|
2015-06-09 10:21:52 -07:00
|
|
|
/* Configure PUSCH */
|
2015-07-19 13:52:56 -07:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
if (srslte_pusch_cfg(&pusch_tx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, subframe, 0, 0)) {
|
2015-06-09 10:21:52 -07:00
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
exit(-1);
|
2015-04-27 09:14:28 -07:00
|
|
|
}
|
2017-09-01 04:29:11 -07:00
|
|
|
if (srslte_pusch_cfg(&pusch_rx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, subframe, 0, 0)) {
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2016-11-20 08:36:21 -08:00
|
|
|
uint16_t rnti = 1234;
|
2017-09-01 04:29:11 -07:00
|
|
|
srslte_pusch_set_rnti(&pusch_tx, rnti);
|
|
|
|
srslte_pusch_set_rnti(&pusch_rx, rnti);
|
|
|
|
|
2018-05-14 01:45:04 -07:00
|
|
|
srslte_uci_data_t uci_data_rx;
|
2016-04-27 08:23:36 -07:00
|
|
|
memcpy(&uci_data_rx, &uci_data_tx, sizeof(srslte_uci_data_t));
|
|
|
|
|
2015-03-18 05:59:29 -07:00
|
|
|
uint32_t nof_re = SRSLTE_NRE*cell.nof_prb*2*SRSLTE_CP_NSYMB(cell.cp);
|
2015-03-18 11:14:24 -07:00
|
|
|
sf_symbols = srslte_vec_malloc(sizeof(cf_t) * nof_re);
|
2015-02-14 05:20:16 -08:00
|
|
|
if (!sf_symbols) {
|
|
|
|
perror("malloc");
|
2016-08-25 17:05:17 -07:00
|
|
|
exit(-1);
|
2015-02-14 05:20:16 -08:00
|
|
|
}
|
2015-07-05 13:30:47 -07:00
|
|
|
|
2017-06-21 02:22:10 -07:00
|
|
|
data = srslte_vec_malloc(sizeof(uint8_t) * (cfg.grant.mcs.tbs+24));
|
2015-02-14 05:20:16 -08:00
|
|
|
if (!data) {
|
|
|
|
perror("malloc");
|
2016-08-25 17:05:17 -07:00
|
|
|
exit(-1);
|
2015-02-14 05:20:16 -08:00
|
|
|
}
|
|
|
|
|
2015-09-16 11:49:48 -07:00
|
|
|
for (uint32_t i=0;i<cfg.grant.mcs.tbs/8;i++) {
|
2015-02-14 05:20:16 -08:00
|
|
|
data[i] = 1;
|
|
|
|
}
|
2015-01-29 16:15:09 -08:00
|
|
|
|
2016-04-21 10:06:48 -07:00
|
|
|
if (srslte_softbuffer_tx_init(&softbuffer_tx, 100)) {
|
|
|
|
fprintf(stderr, "Error initiating soft buffer\n");
|
|
|
|
goto quit;
|
|
|
|
}
|
2017-06-09 04:03:47 -07:00
|
|
|
srslte_softbuffer_tx_reset(&softbuffer_tx);
|
2016-04-21 10:06:48 -07:00
|
|
|
if (srslte_softbuffer_rx_init(&softbuffer_rx, 100)) {
|
2015-07-05 13:30:47 -07:00
|
|
|
fprintf(stderr, "Error initiating soft buffer\n");
|
|
|
|
goto quit;
|
|
|
|
}
|
2017-06-09 04:03:47 -07:00
|
|
|
srslte_softbuffer_rx_reset(&softbuffer_rx);
|
2015-09-18 13:47:37 -07:00
|
|
|
|
|
|
|
uint32_t ntrials = 100;
|
2015-02-12 07:41:16 -08:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
if (srslte_pusch_encode(&pusch_tx, &cfg, &softbuffer_tx, data, uci_data_tx, rnti, sf_symbols)) {
|
2016-04-21 10:06:48 -07:00
|
|
|
fprintf(stderr, "Error encoding TB\n");
|
|
|
|
exit(-1);
|
2015-09-15 02:55:07 -07:00
|
|
|
}
|
2015-02-12 07:41:16 -08:00
|
|
|
if (rv_idx > 0) {
|
2015-04-27 09:14:28 -07:00
|
|
|
cfg.rv = rv_idx;
|
2017-09-01 04:29:11 -07:00
|
|
|
if (srslte_pusch_encode(&pusch_tx, &cfg, &softbuffer_tx, data, uci_data_tx, rnti, sf_symbols)) {
|
2015-01-29 16:15:09 -08:00
|
|
|
fprintf(stderr, "Error encoding TB\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
2015-02-12 07:41:16 -08:00
|
|
|
}
|
2016-04-21 10:06:48 -07:00
|
|
|
|
|
|
|
ce = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp));
|
|
|
|
if (!ce) {
|
|
|
|
perror("srslte_vec_malloc");
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
for (int j=0;j<SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp);j++) {
|
|
|
|
ce[j] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gettimeofday(&t[1], NULL);
|
2018-05-14 01:45:04 -07:00
|
|
|
int r = srslte_pusch_decode(&pusch_rx,
|
|
|
|
&cfg,
|
|
|
|
&softbuffer_rx,
|
|
|
|
sf_symbols,
|
|
|
|
ce,
|
|
|
|
0,
|
|
|
|
rnti,
|
|
|
|
data,
|
|
|
|
(uci_data_tx.uci_cqi_len) ? &cqi_value : NULL,
|
|
|
|
&uci_data_rx);
|
2015-02-12 07:41:16 -08:00
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
get_time_interval(t);
|
|
|
|
if (r) {
|
|
|
|
printf("Error decoding\n");
|
|
|
|
ret = -1;
|
|
|
|
} else {
|
2016-04-27 08:23:36 -07:00
|
|
|
ret = 0;
|
2016-04-21 10:06:48 -07:00
|
|
|
printf("DECODED OK in %d:%d (TBS: %d bits, TX: %.2f Mbps, Processing: %.2f Mbps)\n", (int) t[0].tv_sec,
|
2015-09-18 13:47:37 -07:00
|
|
|
(int) t[0].tv_usec/ntrials,
|
2015-08-07 17:16:48 -07:00
|
|
|
cfg.grant.mcs.tbs,
|
|
|
|
(float) cfg.grant.mcs.tbs/1000,
|
2016-04-27 08:23:36 -07:00
|
|
|
(float) cfg.grant.mcs.tbs/t[0].tv_usec*ntrials);
|
2015-02-12 07:41:16 -08:00
|
|
|
}
|
2016-04-27 08:23:36 -07:00
|
|
|
if (uci_data_tx.uci_ack_len) {
|
|
|
|
if (uci_data_tx.uci_ack != uci_data_rx.uci_ack) {
|
|
|
|
printf("UCI ACK bit error: %d != %d\n", uci_data_tx.uci_ack, uci_data_rx.uci_ack);
|
2017-09-07 08:46:30 -07:00
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uci_data_tx.uci_ack_len > 1) {
|
|
|
|
if (uci_data_tx.uci_ack_2 != uci_data_rx.uci_ack_2) {
|
|
|
|
printf("UCI ACK 2 bit error: %d != %d\n", uci_data_tx.uci_ack_2, uci_data_rx.uci_ack_2);
|
|
|
|
ret = SRSLTE_ERROR;
|
2016-04-27 08:23:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uci_data_tx.uci_ri_len) {
|
|
|
|
if (uci_data_tx.uci_ri != uci_data_rx.uci_ri) {
|
|
|
|
printf("UCI RI bit error: %d != %d\n", uci_data_tx.uci_ri, uci_data_rx.uci_ri);
|
2017-09-07 08:46:30 -07:00
|
|
|
ret = SRSLTE_ERROR;
|
2016-04-27 08:23:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uci_data_tx.uci_cqi_len) {
|
2018-05-14 01:45:04 -07:00
|
|
|
if (memcmp(uci_data_tx.uci_cqi, uci_data_rx.uci_cqi, uci_data_tx.uci_cqi_len)) {
|
|
|
|
printf("cqi_tx=");
|
|
|
|
srslte_vec_fprint_b(stdout, uci_data_tx.uci_cqi, uci_data_tx.uci_cqi_len);
|
|
|
|
printf("cqi_rx=");
|
|
|
|
srslte_vec_fprint_b(stdout, uci_data_rx.uci_cqi, uci_data_rx.uci_cqi_len);
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
2016-04-27 08:23:36 -07:00
|
|
|
}
|
|
|
|
|
2015-01-29 16:15:09 -08:00
|
|
|
quit:
|
2017-09-01 04:29:11 -07:00
|
|
|
srslte_pusch_free(&pusch_tx);
|
|
|
|
srslte_pusch_free(&pusch_rx);
|
2016-04-21 10:06:48 -07:00
|
|
|
srslte_softbuffer_tx_free(&softbuffer_tx);
|
2018-05-03 08:36:39 -07:00
|
|
|
srslte_softbuffer_rx_free(&softbuffer_rx);
|
2015-01-29 16:15:09 -08:00
|
|
|
|
2015-02-13 01:02:10 -08:00
|
|
|
if (sf_symbols) {
|
|
|
|
free(sf_symbols);
|
2015-01-29 16:15:09 -08:00
|
|
|
}
|
|
|
|
if (data) {
|
|
|
|
free(data);
|
|
|
|
}
|
2016-04-21 10:06:48 -07:00
|
|
|
if (ce) {
|
|
|
|
free(ce);
|
|
|
|
}
|
2015-01-29 16:15:09 -08:00
|
|
|
if (ret) {
|
|
|
|
printf("Error\n");
|
|
|
|
} else {
|
|
|
|
printf("Ok\n");
|
|
|
|
}
|
2018-05-03 08:36:39 -07:00
|
|
|
srslte_dft_exit();
|
2015-01-29 16:15:09 -08:00
|
|
|
exit(ret);
|
|
|
|
}
|