|
|
|
@ -34,12 +34,32 @@
|
|
|
|
|
#include "srslte/srslte.h"
|
|
|
|
|
|
|
|
|
|
srslte_cell_t cell = {
|
|
|
|
|
6, // nof_prb
|
|
|
|
|
1, // nof_ports
|
|
|
|
|
0, // cell_id
|
|
|
|
|
SRSLTE_CP_NORM, // cyclic prefix
|
|
|
|
|
SRSLTE_PHICH_R_1_6, // PHICH resources
|
|
|
|
|
SRSLTE_PHICH_NORM // PHICH length
|
|
|
|
|
.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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
uint32_t cfi = 2;
|
|
|
|
@ -52,25 +72,110 @@ uint32_t n_prb = 0;
|
|
|
|
|
int freq_hop = -1;
|
|
|
|
|
int riv = -1;
|
|
|
|
|
uint32_t mcs_idx = 0;
|
|
|
|
|
srslte_cqi_value_t cqi_value;
|
|
|
|
|
|
|
|
|
|
void usage(char *prog) {
|
|
|
|
|
printf("Usage: %s [csrnfvmtLNF] -m MCS \n", prog);
|
|
|
|
|
printf("\t-m MCS index [Default %d]\n", mcs_idx);
|
|
|
|
|
printf("\t-c cell id [Default %d]\n", cell.id);
|
|
|
|
|
printf("\t-s subframe [Default %d]\n", subframe);
|
|
|
|
|
printf("\t-L L_prb [Default %d]\n", L_prb);
|
|
|
|
|
printf("\t-N n_prb [Default %d]\n", n_prb);
|
|
|
|
|
printf("\t-F frequency hopping [Default %d]\n", freq_hop);
|
|
|
|
|
printf("\t-R RIV [Default %d]\n", riv);
|
|
|
|
|
printf("\t-r rv_idx [Default %d]\n", rv_idx);
|
|
|
|
|
printf("\t-f cfi [Default %d]\n", cfi);
|
|
|
|
|
printf("\t-n cell.nof_prb [Default %d]\n", cell.nof_prb);
|
|
|
|
|
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);
|
|
|
|
|
printf("\t-v [set srslte_verbose to debug, default none]\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void parse_args(int argc, char **argv) {
|
|
|
|
|
int opt;
|
|
|
|
|
while ((opt = getopt(argc, argv, "cnfvmtsrLNFR")) != -1) {
|
|
|
|
|
while ((opt = getopt(argc, argv, "msLNRFrncpv")) != -1) {
|
|
|
|
|
switch(opt) {
|
|
|
|
|
case 'm':
|
|
|
|
|
mcs_idx = atoi(argv[optind]);
|
|
|
|
@ -99,6 +204,10 @@ void parse_args(int argc, char **argv) {
|
|
|
|
|
case 'c':
|
|
|
|
|
cell.id = atoi(argv[optind]);
|
|
|
|
|
break;
|
|
|
|
|
case 'p':
|
|
|
|
|
parse_extensive_param(argv[optind], argv[optind + 1]);
|
|
|
|
|
optind++;
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
srslte_verbose++;
|
|
|
|
|
break;
|
|
|
|
@ -125,6 +234,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
|
bzero(&cfg, sizeof(srslte_pusch_cfg_t));
|
|
|
|
|
|
|
|
|
|
srslte_dft_load();
|
|
|
|
|
|
|
|
|
|
srslte_ra_ul_dci_t dci;
|
|
|
|
|
dci.freq_hop_fl = freq_hop;
|
|
|
|
|
if (riv < 0) {
|
|
|
|
@ -165,13 +276,6 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
|
/* Configure PUSCH */
|
|
|
|
|
|
|
|
|
|
printf("Encoding rv_idx=%d\n",rv_idx);
|
|
|
|
|
|
|
|
|
|
srslte_uci_cfg_t uci_cfg;
|
|
|
|
|
uci_cfg.I_offset_cqi = 6;
|
|
|
|
|
uci_cfg.I_offset_ri = 2;
|
|
|
|
|
uci_cfg.I_offset_ack = 4;
|
|
|
|
|
|
|
|
|
|
if (srslte_pusch_cfg(&pusch_tx, &cfg, &grant, &uci_cfg, &ul_hopping, NULL, subframe, 0, 0)) {
|
|
|
|
|
fprintf(stderr, "Error configuring PDSCH\n");
|
|
|
|
|
exit(-1);
|
|
|
|
@ -185,21 +289,9 @@ int main(int argc, char **argv) {
|
|
|
|
|
srslte_pusch_set_rnti(&pusch_tx, rnti);
|
|
|
|
|
srslte_pusch_set_rnti(&pusch_rx, rnti);
|
|
|
|
|
|
|
|
|
|
srslte_uci_data_t uci_data_tx;
|
|
|
|
|
srslte_uci_data_t uci_data_rx;
|
|
|
|
|
bzero(&uci_data_tx, sizeof(srslte_uci_data_t));
|
|
|
|
|
uci_data_tx.uci_cqi_len = 4;
|
|
|
|
|
uci_data_tx.uci_ri_len = 0;
|
|
|
|
|
uci_data_tx.uci_ack_len = 1;
|
|
|
|
|
memcpy(&uci_data_rx, &uci_data_tx, sizeof(srslte_uci_data_t));
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0;i<uci_data_tx.uci_cqi_len;i++) {
|
|
|
|
|
uci_data_tx.uci_cqi [i] = 1;
|
|
|
|
|
}
|
|
|
|
|
uci_data_tx.uci_ri = 1;
|
|
|
|
|
uci_data_tx.uci_ack = 1;
|
|
|
|
|
uci_data_tx.uci_ack_2 = 1;
|
|
|
|
|
|
|
|
|
|
uint32_t nof_re = SRSLTE_NRE*cell.nof_prb*2*SRSLTE_CP_NSYMB(cell.cp);
|
|
|
|
|
sf_symbols = srslte_vec_malloc(sizeof(cf_t) * nof_re);
|
|
|
|
|
if (!sf_symbols) {
|
|
|
|
@ -252,7 +344,16 @@ int main(int argc, char **argv) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
|
int r = srslte_pusch_decode(&pusch_rx, &cfg, &softbuffer_rx, sf_symbols, ce, 0, rnti, data, NULL, &uci_data_rx);
|
|
|
|
|
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);
|
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
|
get_time_interval(t);
|
|
|
|
|
if (r) {
|
|
|
|
@ -285,10 +386,13 @@ int main(int argc, char **argv) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (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);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
quit:
|
|
|
|
|