|
|
@ -27,13 +27,12 @@
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <strings.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "srslte/srslte.h"
|
|
|
|
#include "srslte/srslte.h"
|
|
|
|
|
|
|
|
|
|
|
|
srslte_cell_t cell = {
|
|
|
|
static srslte_cell_t cell = {
|
|
|
|
.nof_prb = 6, // nof_prb
|
|
|
|
.nof_prb = 6, // nof_prb
|
|
|
|
.nof_ports = 1, // nof_ports
|
|
|
|
.nof_ports = 1, // nof_ports
|
|
|
|
.id = 0, // cell_id
|
|
|
|
.id = 0, // cell_id
|
|
|
@ -42,13 +41,13 @@ srslte_cell_t cell = {
|
|
|
|
.phich_resources = SRSLTE_PHICH_R_1_6 // PHICH resources
|
|
|
|
.phich_resources = SRSLTE_PHICH_R_1_6 // PHICH resources
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
srslte_uci_cfg_t uci_cfg = {
|
|
|
|
static srslte_uci_cfg_t uci_cfg = {
|
|
|
|
.I_offset_cqi = 6,
|
|
|
|
.I_offset_cqi = 6,
|
|
|
|
.I_offset_ri = 2,
|
|
|
|
.I_offset_ri = 2,
|
|
|
|
.I_offset_ack = 9,
|
|
|
|
.I_offset_ack = 9,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
srslte_uci_data_t uci_data_tx = {
|
|
|
|
static srslte_uci_data_t uci_data_tx = {
|
|
|
|
.uci_cqi = {0},
|
|
|
|
.uci_cqi = {0},
|
|
|
|
.uci_cqi_len = 0,
|
|
|
|
.uci_cqi_len = 0,
|
|
|
|
.uci_ri = 0,
|
|
|
|
.uci_ri = 0,
|
|
|
@ -64,7 +63,7 @@ srslte_uci_data_t uci_data_tx = {
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t cfi = 2;
|
|
|
|
uint32_t cfi = 2;
|
|
|
|
uint32_t tbs = 0;
|
|
|
|
uint32_t tbs = 0;
|
|
|
|
uint32_t subframe = 1;
|
|
|
|
uint32_t subframe = 10;
|
|
|
|
srslte_mod_t modulation = SRSLTE_MOD_QPSK;
|
|
|
|
srslte_mod_t modulation = SRSLTE_MOD_QPSK;
|
|
|
|
uint32_t rv_idx = 0;
|
|
|
|
uint32_t rv_idx = 0;
|
|
|
|
uint32_t L_prb = 2;
|
|
|
|
uint32_t L_prb = 2;
|
|
|
@ -95,56 +94,52 @@ void usage(char *prog) {
|
|
|
|
printf("\t\t-p I_offset_ack (0-15) [Default %d]\n", uci_cfg.I_offset_ack);
|
|
|
|
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("\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 (none, wideband) [Default none]\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_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 (0-1) [Default none]\n");
|
|
|
|
printf("\t\t-p uci_ack_2 (0-1) [Default none]\n");
|
|
|
|
printf("\t\t-p uci_ack_2 (0-1) [Default none]\n");
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n\tOther parameters:\n");
|
|
|
|
printf("\n\tOther parameters:\n");
|
|
|
|
printf("\t\t-s subframe [Default %d]\n", subframe);
|
|
|
|
printf("\t\t-s number of subframes [Default %d]\n", subframe);
|
|
|
|
printf("\t-v [set srslte_verbose to debug, default none]\n");
|
|
|
|
printf("\t-v [set srslte_verbose to debug, default none]\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void parse_extensive_param(char *param, char *arg) {
|
|
|
|
void parse_extensive_param(char *param, char *arg) {
|
|
|
|
int ext_code = SRSLTE_SUCCESS;
|
|
|
|
int ext_code = SRSLTE_SUCCESS;
|
|
|
|
if (!strcmp(param, "I_offset_cqi")) {
|
|
|
|
if (!strcmp(param, "I_offset_cqi")) {
|
|
|
|
uci_cfg.I_offset_cqi = (uint32_t) atoi(arg);
|
|
|
|
uci_cfg.I_offset_cqi = (uint32_t) strtol(arg, NULL, 10);
|
|
|
|
if (uci_cfg.I_offset_cqi > 15) {
|
|
|
|
if (uci_cfg.I_offset_cqi > 15) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "I_offset_ri")) {
|
|
|
|
} else if (!strcmp(param, "I_offset_ri")) {
|
|
|
|
uci_cfg.I_offset_ri = (uint32_t) atoi(arg);
|
|
|
|
uci_cfg.I_offset_ri = (uint32_t) strtol(arg, NULL, 10);
|
|
|
|
if (uci_cfg.I_offset_ri > 15) {
|
|
|
|
if (uci_cfg.I_offset_ri > 15) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "I_offset_ack")) {
|
|
|
|
} else if (!strcmp(param, "I_offset_ack")) {
|
|
|
|
uci_cfg.I_offset_ack = (uint32_t) atoi(arg);
|
|
|
|
uci_cfg.I_offset_ack = (uint32_t) strtol(arg, NULL, 10);
|
|
|
|
if (uci_cfg.I_offset_ack > 15) {
|
|
|
|
if (uci_cfg.I_offset_ack > 15) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_cqi")) {
|
|
|
|
} else if (!strcmp(param, "uci_cqi")) {
|
|
|
|
if (!strcmp(arg, "wideband")) {
|
|
|
|
if (!strcmp(arg, "wideband")) {
|
|
|
|
cqi_value.type = SRSLTE_CQI_TYPE_WIDEBAND;
|
|
|
|
cqi_value.type = SRSLTE_CQI_TYPE_WIDEBAND;
|
|
|
|
cqi_value.wideband.wideband_cqi = (uint8_t) (rand() & 0x03);
|
|
|
|
cqi_value.wideband.wideband_cqi = (uint8_t) (random() & 0x0f);
|
|
|
|
uci_data_tx.uci_cqi_len = (uint32_t) srslte_cqi_value_unpack(uci_data_tx.uci_cqi, &cqi_value);
|
|
|
|
uci_data_tx.uci_cqi_len = (uint32_t) srslte_cqi_value_pack(&cqi_value, uci_data_tx.uci_cqi);
|
|
|
|
|
|
|
|
} else if (!strcmp(arg, "none")) {
|
|
|
|
|
|
|
|
uci_data_tx.uci_cqi_len = 0;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
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")) {
|
|
|
|
} else if (!strcmp(param, "uci_ri")) {
|
|
|
|
uci_data_tx.uci_ri = (uint8_t) atol(arg);
|
|
|
|
uci_data_tx.uci_ri = (uint8_t) strtol(arg, NULL, 10);
|
|
|
|
if (uci_data_tx.uci_ri > 1) {
|
|
|
|
if (uci_data_tx.uci_ri > 1) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
uci_data_tx.uci_ri_len = 1;
|
|
|
|
uci_data_tx.uci_ri_len = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_ack")) {
|
|
|
|
} else if (!strcmp(param, "uci_ack")) {
|
|
|
|
uci_data_tx.uci_ack = (uint8_t) atol(arg);
|
|
|
|
uci_data_tx.uci_ack = (uint8_t) strtol(arg, NULL, 10);
|
|
|
|
if (uci_data_tx.uci_ack > 1) {
|
|
|
|
if (uci_data_tx.uci_ack > 1) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -154,7 +149,7 @@ void parse_extensive_param (char *param, char *arg) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcmp(param, "uci_ack_2")) {
|
|
|
|
} else if (!strcmp(param, "uci_ack_2")) {
|
|
|
|
uci_data_tx.uci_ack_2 = (uint8_t) atol(arg);
|
|
|
|
uci_data_tx.uci_ack_2 = (uint8_t) strtol(arg, NULL, 10);
|
|
|
|
if (uci_data_tx.uci_ack_2 > 1) {
|
|
|
|
if (uci_data_tx.uci_ack_2 > 1) {
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
ext_code = SRSLTE_ERROR;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -175,34 +170,37 @@ void parse_extensive_param (char *param, char *arg) {
|
|
|
|
|
|
|
|
|
|
|
|
void parse_args(int argc, char **argv) {
|
|
|
|
void parse_args(int argc, char **argv) {
|
|
|
|
int opt;
|
|
|
|
int opt;
|
|
|
|
while ((opt = getopt(argc, argv, "msLNRFrncpv")) != -1) {
|
|
|
|
while ((opt = getopt(argc, argv, "msLNRFrncpvf")) != -1) {
|
|
|
|
switch (opt) {
|
|
|
|
switch (opt) {
|
|
|
|
case 'm':
|
|
|
|
case 'm':
|
|
|
|
mcs_idx = atoi(argv[optind]);
|
|
|
|
mcs_idx = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
case 's':
|
|
|
|
subframe = atoi(argv[optind]);
|
|
|
|
subframe = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'f':
|
|
|
|
|
|
|
|
cfi = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'L':
|
|
|
|
case 'L':
|
|
|
|
L_prb = atoi(argv[optind]);
|
|
|
|
L_prb = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'N':
|
|
|
|
case 'N':
|
|
|
|
n_prb = atoi(argv[optind]);
|
|
|
|
n_prb = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'R':
|
|
|
|
case 'R':
|
|
|
|
riv = atoi(argv[optind]);
|
|
|
|
riv = (int) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'F':
|
|
|
|
case 'F':
|
|
|
|
freq_hop = atoi(argv[optind]);
|
|
|
|
freq_hop = (int) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
case 'r':
|
|
|
|
rv_idx = atoi(argv[optind]);
|
|
|
|
rv_idx = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
case 'n':
|
|
|
|
cell.nof_prb = atoi(argv[optind]);
|
|
|
|
cell.nof_prb = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
case 'c':
|
|
|
|
cell.id = atoi(argv[optind]);
|
|
|
|
cell.id = (uint32_t) strtol(argv[optind], NULL, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'p':
|
|
|
|
case 'p':
|
|
|
|
parse_extensive_param(argv[optind], argv[optind + 1]);
|
|
|
|
parse_extensive_param(argv[optind], argv[optind + 1]);
|
|
|
@ -222,6 +220,7 @@ int main(int argc, char **argv) {
|
|
|
|
srslte_pusch_t pusch_tx;
|
|
|
|
srslte_pusch_t pusch_tx;
|
|
|
|
srslte_pusch_t pusch_rx;
|
|
|
|
srslte_pusch_t pusch_rx;
|
|
|
|
uint8_t *data = NULL;
|
|
|
|
uint8_t *data = NULL;
|
|
|
|
|
|
|
|
uint8_t *data_rx = NULL;
|
|
|
|
cf_t *sf_symbols = NULL;
|
|
|
|
cf_t *sf_symbols = NULL;
|
|
|
|
cf_t *ce = NULL;
|
|
|
|
cf_t *ce = NULL;
|
|
|
|
int ret = -1;
|
|
|
|
int ret = -1;
|
|
|
@ -242,7 +241,7 @@ int main(int argc, char **argv) {
|
|
|
|
dci.type2_alloc.L_crb = L_prb;
|
|
|
|
dci.type2_alloc.L_crb = L_prb;
|
|
|
|
dci.type2_alloc.RB_start = n_prb;
|
|
|
|
dci.type2_alloc.RB_start = n_prb;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
dci.type2_alloc.riv = riv;
|
|
|
|
dci.type2_alloc.riv = (uint32_t) riv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dci.mcs_idx = mcs_idx;
|
|
|
|
dci.mcs_idx = mcs_idx;
|
|
|
|
|
|
|
|
|
|
|
@ -255,7 +254,7 @@ int main(int argc, char **argv) {
|
|
|
|
srslte_pusch_hopping_cfg_t ul_hopping;
|
|
|
|
srslte_pusch_hopping_cfg_t ul_hopping;
|
|
|
|
ul_hopping.n_sb = 1;
|
|
|
|
ul_hopping.n_sb = 1;
|
|
|
|
ul_hopping.hopping_offset = 0;
|
|
|
|
ul_hopping.hopping_offset = 0;
|
|
|
|
ul_hopping.hop_mode = SRSLTE_PUSCH_HOP_MODE_INTER_SF;
|
|
|
|
ul_hopping.hop_mode = 1;
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_pusch_init_ue(&pusch_tx, cell.nof_prb)) {
|
|
|
|
if (srslte_pusch_init_ue(&pusch_tx, cell.nof_prb)) {
|
|
|
|
fprintf(stderr, "Error creating PUSCH object\n");
|
|
|
|
fprintf(stderr, "Error creating PUSCH object\n");
|
|
|
@ -274,17 +273,6 @@ int main(int argc, char **argv) {
|
|
|
|
goto quit;
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Configure PUSCH */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_pusch_cfg(&pusch_tx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, subframe, 0, 0)) {
|
|
|
|
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (srslte_pusch_cfg(&pusch_rx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, subframe, 0, 0)) {
|
|
|
|
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t rnti = 1234;
|
|
|
|
uint16_t rnti = 1234;
|
|
|
|
srslte_pusch_set_rnti(&pusch_tx, rnti);
|
|
|
|
srslte_pusch_set_rnti(&pusch_tx, rnti);
|
|
|
|
srslte_pusch_set_rnti(&pusch_rx, rnti);
|
|
|
|
srslte_pusch_set_rnti(&pusch_rx, rnti);
|
|
|
@ -299,28 +287,69 @@ int main(int argc, char **argv) {
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data = srslte_vec_malloc(sizeof(uint8_t) * (cfg.grant.mcs.tbs+24));
|
|
|
|
data = srslte_vec_malloc(sizeof(uint8_t) * 150000);
|
|
|
|
if (!data) {
|
|
|
|
if (!data) {
|
|
|
|
perror("malloc");
|
|
|
|
perror("malloc");
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0;i<cfg.grant.mcs.tbs/8;i++) {
|
|
|
|
data_rx = srslte_vec_malloc(sizeof(uint8_t) * 150000);
|
|
|
|
data[i] = 1;
|
|
|
|
if (!data_rx) {
|
|
|
|
|
|
|
|
perror("malloc");
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_softbuffer_tx_init(&softbuffer_tx, 100)) {
|
|
|
|
if (srslte_softbuffer_tx_init(&softbuffer_tx, 100)) {
|
|
|
|
fprintf(stderr, "Error initiating soft buffer\n");
|
|
|
|
fprintf(stderr, "Error initiating soft buffer\n");
|
|
|
|
goto quit;
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
srslte_softbuffer_tx_reset(&softbuffer_tx);
|
|
|
|
|
|
|
|
if (srslte_softbuffer_rx_init(&softbuffer_rx, 100)) {
|
|
|
|
if (srslte_softbuffer_rx_init(&softbuffer_rx, 100)) {
|
|
|
|
fprintf(stderr, "Error initiating soft buffer\n");
|
|
|
|
fprintf(stderr, "Error initiating soft buffer\n");
|
|
|
|
goto quit;
|
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int n = 0; n < subframe; n++) {
|
|
|
|
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Configure PUSCH */
|
|
|
|
|
|
|
|
if (srslte_pusch_cfg(&pusch_tx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, (uint32_t) n % 10, 0, 0)) {
|
|
|
|
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_pusch_cfg(&pusch_rx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, (uint32_t) n % 10, 0, 0)) {
|
|
|
|
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srslte_softbuffer_tx_reset(&softbuffer_tx);
|
|
|
|
srslte_softbuffer_rx_reset(&softbuffer_rx);
|
|
|
|
srslte_softbuffer_rx_reset(&softbuffer_rx);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t ntrials = 100;
|
|
|
|
for (uint32_t i = 0; i < cfg.grant.mcs.tbs / 8; i++) {
|
|
|
|
|
|
|
|
data[i] = (uint8_t) (random() & 0xff);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < uci_data_tx.uci_cqi_len; i++) {
|
|
|
|
|
|
|
|
uci_data_tx.uci_cqi[i] = (uint8_t) (random() & 0x1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uci_data_tx.uci_ack_len > 0) {
|
|
|
|
|
|
|
|
uci_data_tx.uci_ack = (uint8_t) (random() & 0x1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uci_data_tx.uci_ack_len > 1) {
|
|
|
|
|
|
|
|
uci_data_tx.uci_ack_2 = (uint8_t) (random() & 0x1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_pusch_encode(&pusch_tx, &cfg, &softbuffer_tx, data, uci_data_tx, rnti, sf_symbols)) {
|
|
|
|
if (srslte_pusch_encode(&pusch_tx, &cfg, &softbuffer_tx, data, uci_data_tx, rnti, sf_symbols)) {
|
|
|
|
fprintf(stderr, "Error encoding TB\n");
|
|
|
|
fprintf(stderr, "Error encoding TB\n");
|
|
|
@ -334,15 +363,6 @@ int main(int argc, char **argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
int r = srslte_pusch_decode(&pusch_rx,
|
|
|
|
int r = srslte_pusch_decode(&pusch_rx,
|
|
|
|
&cfg,
|
|
|
|
&cfg,
|
|
|
@ -351,50 +371,75 @@ int main(int argc, char **argv) {
|
|
|
|
ce,
|
|
|
|
ce,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
rnti,
|
|
|
|
rnti,
|
|
|
|
data,
|
|
|
|
data_rx,
|
|
|
|
(uci_data_tx.uci_cqi_len) ? &cqi_value : NULL,
|
|
|
|
(uci_data_tx.uci_cqi_len) ? &cqi_value : NULL,
|
|
|
|
&uci_data_rx);
|
|
|
|
&uci_data_rx);
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
get_time_interval(t);
|
|
|
|
|
|
|
|
if (r) {
|
|
|
|
if (r) {
|
|
|
|
printf("Error decoding\n");
|
|
|
|
printf("Error returned while decoding\n");
|
|
|
|
ret = -1;
|
|
|
|
goto quit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (memcmp(data_rx, data, (size_t) cfg.grant.mcs.tbs / 8) != 0) {
|
|
|
|
|
|
|
|
printf("Unmatched data detected\n");
|
|
|
|
|
|
|
|
goto quit;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = 0;
|
|
|
|
INFO("Rx Data is Ok\n");
|
|
|
|
printf("DECODED OK in %d:%d (TBS: %d bits, TX: %.2f Mbps, Processing: %.2f Mbps)\n", (int) t[0].tv_sec,
|
|
|
|
|
|
|
|
(int) t[0].tv_usec/ntrials,
|
|
|
|
|
|
|
|
cfg.grant.mcs.tbs,
|
|
|
|
|
|
|
|
(float) cfg.grant.mcs.tbs/1000,
|
|
|
|
|
|
|
|
(float) cfg.grant.mcs.tbs/t[0].tv_usec*ntrials);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (uci_data_tx.uci_ack_len) {
|
|
|
|
if (uci_data_tx.uci_ack_len) {
|
|
|
|
if (uci_data_tx.uci_ack != uci_data_rx.uci_ack) {
|
|
|
|
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);
|
|
|
|
printf("UCI ACK bit error: %d != %d\n", uci_data_tx.uci_ack, uci_data_rx.uci_ack);
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
INFO("Rx ACK is Ok\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (uci_data_tx.uci_ack_len > 1) {
|
|
|
|
if (uci_data_tx.uci_ack_len > 1) {
|
|
|
|
if (uci_data_tx.uci_ack_2 != uci_data_rx.uci_ack_2) {
|
|
|
|
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);
|
|
|
|
printf("UCI ACK 2 bit error: %d != %d\n", uci_data_tx.uci_ack_2, uci_data_rx.uci_ack_2);
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
INFO("Rx ACK2 is Ok\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (uci_data_tx.uci_ri_len) {
|
|
|
|
if (uci_data_tx.uci_ri_len) {
|
|
|
|
if (uci_data_tx.uci_ri != uci_data_rx.uci_ri) {
|
|
|
|
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);
|
|
|
|
printf("UCI RI bit error: %d != %d\n", uci_data_tx.uci_ri, uci_data_rx.uci_ri);
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
INFO("Rx RI is Ok\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (uci_data_tx.uci_cqi_len) {
|
|
|
|
if (uci_data_tx.uci_cqi_len) {
|
|
|
|
if (memcmp(uci_data_tx.uci_cqi, uci_data_rx.uci_cqi, uci_data_tx.uci_cqi_len)) {
|
|
|
|
if (memcmp(uci_data_tx.uci_cqi, uci_data_rx.uci_cqi, uci_data_tx.uci_cqi_len) != 0) {
|
|
|
|
|
|
|
|
printf("CQI Decode failed at subframe %d\n", n);
|
|
|
|
printf("cqi_tx=");
|
|
|
|
printf("cqi_tx=");
|
|
|
|
srslte_vec_fprint_b(stdout, uci_data_tx.uci_cqi, uci_data_tx.uci_cqi_len);
|
|
|
|
srslte_vec_fprint_b(stdout, uci_data_tx.uci_cqi, uci_data_tx.uci_cqi_len);
|
|
|
|
printf("cqi_rx=");
|
|
|
|
printf("cqi_rx=");
|
|
|
|
srslte_vec_fprint_b(stdout, uci_data_rx.uci_cqi, uci_data_rx.uci_cqi_len);
|
|
|
|
srslte_vec_fprint_b(stdout, uci_data_rx.uci_cqi, uci_data_rx.uci_cqi_len);
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
INFO("Rx CQI is Ok\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
|
|
|
|
goto quit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_time_interval(t);
|
|
|
|
|
|
|
|
printf("DECODED OK in %d:%d (TBS: %d bits, TX: %.2f Mbps, Processing: %.2f Mbps)\n", (int) t[0].tv_sec,
|
|
|
|
|
|
|
|
(int) t[0].tv_usec,
|
|
|
|
|
|
|
|
cfg.grant.mcs.tbs,
|
|
|
|
|
|
|
|
(float) cfg.grant.mcs.tbs / 1000,
|
|
|
|
|
|
|
|
(float) cfg.grant.mcs.tbs / t[0].tv_usec);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
quit:
|
|
|
|
quit:
|
|
|
|
srslte_pusch_free(&pusch_tx);
|
|
|
|
srslte_pusch_free(&pusch_tx);
|
|
|
|
srslte_pusch_free(&pusch_rx);
|
|
|
|
srslte_pusch_free(&pusch_rx);
|
|
|
@ -407,6 +452,9 @@ quit:
|
|
|
|
if (data) {
|
|
|
|
if (data) {
|
|
|
|
free(data);
|
|
|
|
free(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data_rx) {
|
|
|
|
|
|
|
|
free(data_rx);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (ce) {
|
|
|
|
if (ce) {
|
|
|
|
free(ce);
|
|
|
|
free(ce);
|
|
|
|
}
|
|
|
|
}
|
|
|
|