mirror of https://github.com/PentHertz/srsLTE.git
Merge branch 'next' into next_novolk
This commit is contained in:
commit
ea935165af
|
@ -320,9 +320,9 @@ void base_init() {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
srslte_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2);
|
srslte_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2);
|
||||||
|
|
||||||
srslte_ofdm_set_normalize(&ifft, true);
|
|
||||||
srslte_ofdm_set_normalize(&ifft_mbsfn, true);
|
srslte_ofdm_set_normalize(&ifft_mbsfn, true);
|
||||||
|
srslte_ofdm_set_normalize(&ifft, true);
|
||||||
|
|
||||||
|
|
||||||
if (srslte_pbch_init(&pbch)) {
|
if (srslte_pbch_init(&pbch)) {
|
||||||
fprintf(stderr, "Error creating PBCH object\n");
|
fprintf(stderr, "Error creating PBCH object\n");
|
||||||
|
|
|
@ -467,6 +467,8 @@ int srslte_chest_dl_estimate_port_mbsfn(srslte_chest_dl_t *q, cf_t *input, cf_t
|
||||||
srslte_vec_prod_conj_ccc(q->pilot_recv_signal+(2*q->cell.nof_prb), q->mbsfn_refs[mbsfn_area_id]->pilots[port_id/2][sf_idx],
|
srslte_vec_prod_conj_ccc(q->pilot_recv_signal+(2*q->cell.nof_prb), q->mbsfn_refs[mbsfn_area_id]->pilots[port_id/2][sf_idx],
|
||||||
q->pilot_estimates+(2*q->cell.nof_prb), SRSLTE_REFSIGNAL_NUM_SF_MBSFN(q->cell.nof_prb, port_id)-(2*q->cell.nof_prb));
|
q->pilot_estimates+(2*q->cell.nof_prb), SRSLTE_REFSIGNAL_NUM_SF_MBSFN(q->cell.nof_prb, port_id)-(2*q->cell.nof_prb));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
chest_interpolate_noise_est(q, input, ce, sf_idx, port_id, rxant_id, SRSLTE_SF_MBSFN);
|
chest_interpolate_noise_est(q, input, ce, sf_idx, port_id, rxant_id, SRSLTE_SF_MBSFN);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -229,6 +229,7 @@ int srslte_refsignal_cs_init(srslte_refsignal_t * q, uint32_t max_prb)
|
||||||
if (q != NULL)
|
if (q != NULL)
|
||||||
{
|
{
|
||||||
ret = SRSLTE_ERROR;
|
ret = SRSLTE_ERROR;
|
||||||
|
bzero(q, sizeof(srslte_refsignal_t));
|
||||||
for (int p=0;p<2;p++) {
|
for (int p=0;p<2;p++) {
|
||||||
for (int i=0;i<SRSLTE_NSUBFRAMES_X_FRAME;i++) {
|
for (int i=0;i<SRSLTE_NSUBFRAMES_X_FRAME;i++) {
|
||||||
q->pilots[p][i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(max_prb, 2*p));
|
q->pilots[p][i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(max_prb, 2*p));
|
||||||
|
|
|
@ -394,6 +394,8 @@ int srslte_pmch_decode_multi(srslte_pmch_t *q,
|
||||||
* thus we don't need tot set it in thde LLRs normalization
|
* thus we don't need tot set it in thde LLRs normalization
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
srslte_demod_soft_demodulate_s(cfg->grant.mcs[0].mod, q->d, q->e, cfg->nbits[0].nof_re);
|
srslte_demod_soft_demodulate_s(cfg->grant.mcs[0].mod, q->d, q->e, cfg->nbits[0].nof_re);
|
||||||
|
|
||||||
/* descramble */
|
/* descramble */
|
||||||
|
|
|
@ -466,6 +466,7 @@ int srslte_dl_fill_ra_mcs(srslte_ra_mcs_t *mcs, uint32_t nprb) {
|
||||||
tbs = 0;
|
tbs = 0;
|
||||||
i_tbs = 0;
|
i_tbs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tbs == -1) {
|
if (tbs == -1) {
|
||||||
tbs = srslte_ra_tbs_from_idx(i_tbs, nprb);
|
tbs = srslte_ra_tbs_from_idx(i_tbs, nprb);
|
||||||
if (tbs >= 0) {
|
if (tbs >= 0) {
|
||||||
|
|
|
@ -159,6 +159,19 @@ add_test(pdsch_test_multiplex2cw_p1_50 pdsch_test -x multiplex -a 2 -t 0 -p 1 -
|
||||||
add_test(pdsch_test_multiplex2cw_p1_75 pdsch_test -x multiplex -a 2 -t 0 -p 1 -n 75)
|
add_test(pdsch_test_multiplex2cw_p1_75 pdsch_test -x multiplex -a 2 -t 0 -p 1 -n 75)
|
||||||
add_test(pdsch_test_multiplex2cw_p1_100 pdsch_test -x multiplex -a 2 -t 0 -p 1 -n 100)
|
add_test(pdsch_test_multiplex2cw_p1_100 pdsch_test -x multiplex -a 2 -t 0 -p 1 -n 100)
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# PMCH TEST
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(pmch_test pmch_test.c)
|
||||||
|
target_link_libraries(pmch_test srslte_phy)
|
||||||
|
|
||||||
|
add_test(pmch_test_qpsk pmch_test -m 6 -n 50)
|
||||||
|
add_test(pmch_test_qam16 pmch_test -m 15 -n 100)
|
||||||
|
add_test(pmch_test_qam64 pmch_test -m 25 -n 100)
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# FILE TEST
|
# FILE TEST
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -178,11 +191,15 @@ target_link_libraries(pdcch_file_test srslte_phy)
|
||||||
add_executable(pdsch_pdcch_file_test pdsch_pdcch_file_test.c)
|
add_executable(pdsch_pdcch_file_test pdsch_pdcch_file_test.c)
|
||||||
target_link_libraries(pdsch_pdcch_file_test srslte_phy)
|
target_link_libraries(pdsch_pdcch_file_test srslte_phy)
|
||||||
|
|
||||||
|
add_executable(pmch_file_test pmch_file_test.c)
|
||||||
|
target_link_libraries(pmch_file_test srslte_phy)
|
||||||
|
|
||||||
add_test(pbch_file_test pbch_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.dat)
|
add_test(pbch_file_test pbch_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.dat)
|
||||||
add_test(pcfich_file_test pcfich_file_test -c 150 -n 50 -p 2 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.10M.dat)
|
add_test(pcfich_file_test pcfich_file_test -c 150 -n 50 -p 2 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.10M.dat)
|
||||||
add_test(phich_file_test phich_file_test -c 150 -n 50 -p 2 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.10M.dat)
|
add_test(phich_file_test phich_file_test -c 150 -n 50 -p 2 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.10M.dat)
|
||||||
add_test(pdcch_file_test pdcch_file_test -c 1 -f 3 -n 6 -p 1 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.amar.dat)
|
add_test(pdcch_file_test pdcch_file_test -c 1 -f 3 -n 6 -p 1 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.amar.dat)
|
||||||
add_test(pdsch_pdcch_file_test pdsch_pdcch_file_test -c 1 -f 3 -n 6 -p 1 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.amar.dat)
|
add_test(pdsch_pdcch_file_test pdsch_pdcch_file_test -c 1 -f 3 -n 6 -p 1 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.amar.dat)
|
||||||
|
add_test(pmch_file_test pmch_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/pmch_100prbs_MCS2_SR0.bin)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# PUSCH TEST
|
# PUSCH TEST
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,204 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \section LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of the srsLTE library.
|
||||||
|
*
|
||||||
|
* srsLTE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* srsLTE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* A copy of the GNU Affero General Public License can be found in
|
||||||
|
* 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 "srslte/srslte.h"
|
||||||
|
|
||||||
|
char *input_file_name = NULL;
|
||||||
|
|
||||||
|
srslte_cell_t cell = {
|
||||||
|
100, // nof_prb
|
||||||
|
1, // nof_ports
|
||||||
|
1, // cell_id
|
||||||
|
SRSLTE_CP_EXT, // cyclic prefix
|
||||||
|
SRSLTE_PHICH_R_1, // PHICH resources
|
||||||
|
SRSLTE_PHICH_NORM // PHICH length
|
||||||
|
};
|
||||||
|
|
||||||
|
int flen;
|
||||||
|
|
||||||
|
uint32_t cfi = 2;
|
||||||
|
uint16_t rnti = SRSLTE_SIRNTI;
|
||||||
|
|
||||||
|
int max_frames = 150;
|
||||||
|
uint32_t sf_idx = 1;
|
||||||
|
|
||||||
|
uint8_t non_mbsfn_region = 2;
|
||||||
|
int mbsfn_area_id = 1;
|
||||||
|
|
||||||
|
srslte_dci_format_t dci_format = SRSLTE_DCI_FORMAT1A;
|
||||||
|
srslte_filesource_t fsrc;
|
||||||
|
srslte_ue_dl_t ue_dl;
|
||||||
|
cf_t *input_buffer[SRSLTE_MAX_PORTS];
|
||||||
|
|
||||||
|
void usage(char *prog) {
|
||||||
|
printf("Usage: %s [rovfcenmps] -i input_file\n", prog);
|
||||||
|
printf("\t-o DCI format [Default %s]\n", srslte_dci_format_string(dci_format));
|
||||||
|
printf("\t-c cell.id [Default %d]\n", cell.id);
|
||||||
|
printf("\t-s Start subframe_idx [Default %d]\n", sf_idx);
|
||||||
|
printf("\t-f cfi [Default %d]\n", cfi);
|
||||||
|
printf("\t-r rnti [Default 0x%x]\n",rnti);
|
||||||
|
printf("\t-p cell.nof_ports [Default %d]\n", cell.nof_ports);
|
||||||
|
printf("\t-n cell.nof_prb [Default %d]\n", cell.nof_prb);
|
||||||
|
printf("\t-M mbsfn_area_id [Default %d]\n", mbsfn_area_id);
|
||||||
|
printf("\t-e Set extended prefix [Default Normal]\n");
|
||||||
|
printf("\t-v [set srslte_verbose to debug, default none]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void parse_args(int argc, char **argv) {
|
||||||
|
int opt;
|
||||||
|
while ((opt = getopt(argc, argv, "irovfcenmps")) != -1) {
|
||||||
|
switch(opt) {
|
||||||
|
case 'i':
|
||||||
|
input_file_name = argv[optind];
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
cell.id = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
sf_idx = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
rnti = strtoul(argv[optind], NULL, 0);
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
cfi = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
cell.nof_prb = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
cell.nof_ports = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
mbsfn_area_id = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
dci_format = srslte_dci_format_from_string(argv[optind]);
|
||||||
|
if (dci_format == SRSLTE_DCI_NOF_FORMATS) {
|
||||||
|
fprintf(stderr, "Error unsupported format %s\n", argv[optind]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
srslte_verbose++;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
cell.cp = SRSLTE_CP_EXT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!input_file_name) {
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int base_init() {
|
||||||
|
|
||||||
|
if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) {
|
||||||
|
fprintf(stderr, "Error opening file %s\n", input_file_name);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
flen = 2 * (SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb)));
|
||||||
|
|
||||||
|
input_buffer[0] = malloc(flen * sizeof(cf_t));
|
||||||
|
if (!input_buffer[0]) {
|
||||||
|
perror("malloc");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srslte_ue_dl_init(&ue_dl, cell.nof_prb, 1)) {
|
||||||
|
fprintf(stderr, "Error initializing UE DL\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (srslte_ue_dl_set_cell(&ue_dl, cell)) {
|
||||||
|
fprintf(stderr, "Error initializing UE DL\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
srslte_ue_dl_set_rnti(&ue_dl, rnti);
|
||||||
|
|
||||||
|
srslte_ue_dl_set_mbsfn_area_id(&ue_dl, mbsfn_area_id);
|
||||||
|
srslte_ue_dl_set_non_mbsfn_region(&ue_dl, non_mbsfn_region);
|
||||||
|
|
||||||
|
|
||||||
|
DEBUG("Memory init OK\n",0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void base_free() {
|
||||||
|
srslte_filesource_free(&fsrc);
|
||||||
|
srslte_ue_dl_free(&ue_dl);
|
||||||
|
free(input_buffer[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (argc < 3) {
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
parse_args(argc,argv);
|
||||||
|
|
||||||
|
if (base_init()) {
|
||||||
|
fprintf(stderr, "Error initializing memory\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *data[] = {malloc(100000)};
|
||||||
|
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
srslte_filesource_read(&fsrc, input_buffer[0], flen);
|
||||||
|
INFO("Reading %d samples sub-frame %d\n", flen, sf_idx);
|
||||||
|
ret = srslte_ue_dl_decode_mbsfn(&ue_dl, input_buffer, data[0], sf_idx);
|
||||||
|
if(ret > 0) {
|
||||||
|
printf("PMCH Decoded OK!\n");
|
||||||
|
} else if (ret < 0) {
|
||||||
|
printf("Error decoding PMCH\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
base_free();
|
||||||
|
free(data[0]);
|
||||||
|
if (ret > 0) {
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,469 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \section LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of the srsLTE library.
|
||||||
|
*
|
||||||
|
* srsLTE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* srsLTE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* A copy of the GNU Affero General Public License can be found in
|
||||||
|
* 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 <unistd.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <srslte/phy/phch/ra.h>
|
||||||
|
|
||||||
|
#include "srslte/srslte.h"
|
||||||
|
|
||||||
|
// Enable to measure execution time
|
||||||
|
#define DO_OFDM
|
||||||
|
|
||||||
|
#ifdef DO_OFDM
|
||||||
|
#define NOF_CE_SYMBOLS SRSLTE_SF_LEN_PRB(cell.nof_prb)
|
||||||
|
#else
|
||||||
|
#define NOF_CE_SYMBOLS SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
srslte_cell_t cell = {
|
||||||
|
100, // nof_prb
|
||||||
|
1, // nof_ports
|
||||||
|
1, // cell_id
|
||||||
|
SRSLTE_CP_EXT, // cyclic prefix
|
||||||
|
SRSLTE_PHICH_NORM, // PHICH length
|
||||||
|
SRSLTE_PHICH_R_1_6 // PHICH resources
|
||||||
|
};
|
||||||
|
|
||||||
|
char mimo_type_str [32] = "single";
|
||||||
|
srslte_mimo_type_t mimo_type = SRSLTE_MIMO_TYPE_SINGLE_ANTENNA;
|
||||||
|
uint32_t cfi = 2;
|
||||||
|
uint32_t mcs_idx = 2;
|
||||||
|
uint32_t subframe = 1;
|
||||||
|
int rv_idx[SRSLTE_MAX_CODEWORDS] = {0, 1};
|
||||||
|
uint16_t rnti = 1234;
|
||||||
|
uint32_t nof_rx_antennas = 1;
|
||||||
|
uint32_t pmi = 0;
|
||||||
|
char *input_file = NULL;
|
||||||
|
uint32_t mbsfn_area_id = 1;
|
||||||
|
uint32_t non_mbsfn_region = 2;
|
||||||
|
void usage(char *prog) {
|
||||||
|
printf("Usage: %s [fmMcsrtRFpnwav] \n", prog);
|
||||||
|
printf("\t-f read signal from file [Default generate it with pdsch_encode()]\n");
|
||||||
|
printf("\t-m MCS [Default %d]\n", mcs_idx);
|
||||||
|
printf("\t-M mbsfn area id [Default %d]\n", mbsfn_area_id);
|
||||||
|
printf("\t-N non mbsfn region [Default %d]\n", non_mbsfn_region);
|
||||||
|
printf("\t-c cell id [Default %d]\n", cell.id);
|
||||||
|
printf("\t-s subframe [Default %d]\n", subframe);
|
||||||
|
printf("\t-r rv_idx [Default %d]\n", rv_idx[0]);
|
||||||
|
printf("\t-R rnti [Default %d]\n", rnti);
|
||||||
|
printf("\t-F cfi [Default %d]\n", cfi);
|
||||||
|
printf("\t-n cell.nof_prb [Default %d]\n", cell.nof_prb);
|
||||||
|
printf("\t-a nof_rx_antennas [Default %d]\n", nof_rx_antennas);
|
||||||
|
printf("\t-v [set srslte_verbose to debug, default none]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void parse_args(int argc, char **argv) {
|
||||||
|
int opt;
|
||||||
|
while ((opt = getopt(argc, argv, "fmMcsrtRFpnavx")) != -1) {
|
||||||
|
switch(opt) {
|
||||||
|
case 'f':
|
||||||
|
input_file = argv[optind];
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
mcs_idx = (uint32_t) atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
subframe = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
rv_idx[0] = (uint32_t) atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
rnti = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
cfi = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'x':
|
||||||
|
strncpy(mimo_type_str, argv[optind], 32);
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
pmi = (uint32_t) atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
cell.nof_prb = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
cell.id = atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
nof_rx_antennas = (uint32_t) atoi(argv[optind]);
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
srslte_verbose++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t *data_tx[SRSLTE_MAX_CODEWORDS] = {NULL};
|
||||||
|
static uint8_t *data_rx[SRSLTE_MAX_CODEWORDS] = {NULL};
|
||||||
|
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
|
||||||
|
srslte_softbuffer_rx_t *softbuffers_rx[SRSLTE_MAX_CODEWORDS];
|
||||||
|
srslte_ra_dl_grant_t grant;
|
||||||
|
#ifdef DO_OFDM
|
||||||
|
cf_t *tx_sf_symbols[SRSLTE_MAX_PORTS];
|
||||||
|
cf_t *rx_sf_symbols[SRSLTE_MAX_PORTS];
|
||||||
|
#endif /* DO_OFDM */
|
||||||
|
cf_t *tx_slot_symbols[SRSLTE_MAX_PORTS];
|
||||||
|
cf_t *rx_slot_symbols[SRSLTE_MAX_PORTS];
|
||||||
|
srslte_pmch_t pmch_tx, pmch_rx;
|
||||||
|
srslte_pdsch_cfg_t pmch_cfg;
|
||||||
|
srslte_ofdm_t ifft_mbsfn, fft_mbsfn;
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
uint32_t i, j, k;
|
||||||
|
int ret = -1;
|
||||||
|
struct timeval t[3];
|
||||||
|
srslte_softbuffer_tx_t *softbuffers_tx[SRSLTE_MAX_CODEWORDS];
|
||||||
|
int M=1;
|
||||||
|
|
||||||
|
parse_args(argc,argv);
|
||||||
|
/* Initialise to zeros */
|
||||||
|
bzero(&pmch_tx, sizeof(srslte_pmch_t));
|
||||||
|
bzero(&pmch_rx, sizeof(srslte_pmch_t));
|
||||||
|
bzero(&pmch_cfg, sizeof(srslte_pdsch_cfg_t));
|
||||||
|
bzero(ce, 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);
|
||||||
|
|
||||||
|
cell.nof_ports = 1;
|
||||||
|
|
||||||
|
srslte_ra_dl_dci_t dci;
|
||||||
|
bzero(&dci, sizeof(srslte_ra_dl_dci_t));
|
||||||
|
dci.type0_alloc.rbg_bitmask = 0xffffffff;
|
||||||
|
|
||||||
|
|
||||||
|
/* If transport block 0 is enabled */
|
||||||
|
grant.tb_en[0] = true;
|
||||||
|
grant.tb_en[1] = false;
|
||||||
|
grant.nof_tb = 1;
|
||||||
|
grant.mcs[0].idx = mcs_idx;
|
||||||
|
|
||||||
|
grant.nof_prb = cell.nof_prb;
|
||||||
|
grant.sf_type = SRSLTE_SF_MBSFN;
|
||||||
|
|
||||||
|
srslte_dl_fill_ra_mcs(&grant.mcs[0], cell.nof_prb);
|
||||||
|
grant.Qm[0] = srslte_mod_bits_x_symbol(grant.mcs[0].mod);
|
||||||
|
for(int i = 0; i < 2; i++){
|
||||||
|
for(int j = 0; j < grant.nof_prb; j++){
|
||||||
|
grant.prb_idx[i][j] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DO_OFDM
|
||||||
|
|
||||||
|
if (srslte_ofdm_tx_init_mbsfn(&ifft_mbsfn, SRSLTE_CP_EXT, cell.nof_prb)) {
|
||||||
|
fprintf(stderr, "Error creating iFFT object\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
if (srslte_ofdm_rx_init_mbsfn(&fft_mbsfn, SRSLTE_CP_EXT, cell.nof_prb)) {
|
||||||
|
fprintf(stderr, "Error creating iFFT object\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
srslte_ofdm_set_non_mbsfn_region(&ifft_mbsfn, non_mbsfn_region);
|
||||||
|
srslte_ofdm_set_non_mbsfn_region(&fft_mbsfn, non_mbsfn_region);
|
||||||
|
srslte_ofdm_set_normalize(&ifft_mbsfn, true);
|
||||||
|
srslte_ofdm_set_normalize(&fft_mbsfn, 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 */
|
||||||
|
|
||||||
|
if (srslte_pmch_cfg(&pmch_cfg, cell, &grant, cfi, subframe)) {
|
||||||
|
fprintf(stderr, "Error configuring PMCH\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* init memory */
|
||||||
|
for (i=0;i<SRSLTE_MAX_PORTS;i++) {
|
||||||
|
for (j = 0; j < SRSLTE_MAX_PORTS; j++) {
|
||||||
|
ce[i][j] = srslte_vec_malloc(sizeof(cf_t) * NOF_CE_SYMBOLS);
|
||||||
|
if (!ce[i]) {
|
||||||
|
perror("srslte_vec_malloc");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
for (k = 0; k < NOF_CE_SYMBOLS; k++) {
|
||||||
|
ce[i][j][k] = (i == j) ? 1.0f : 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rx_slot_symbols[i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp));
|
||||||
|
if (!rx_slot_symbols[i]) {
|
||||||
|
perror("srslte_vec_malloc");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
||||||
|
if (grant.tb_en[i]) {
|
||||||
|
data_tx[i] = srslte_vec_malloc(sizeof(uint8_t) * grant.mcs[i].tbs);
|
||||||
|
if (!data_tx[i]) {
|
||||||
|
perror("srslte_vec_malloc");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
bzero(data_tx[i], sizeof(uint8_t) * grant.mcs[i].tbs);
|
||||||
|
|
||||||
|
data_rx[i] = srslte_vec_malloc(sizeof(uint8_t) * grant.mcs[i].tbs);
|
||||||
|
if (!data_rx[i]) {
|
||||||
|
perror("srslte_vec_malloc");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
bzero(data_rx[i], sizeof(uint8_t) * grant.mcs[i].tbs);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
||||||
|
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");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srslte_pmch_cfg(&pmch_cfg, cell, &grant, cfi, subframe)) {
|
||||||
|
fprintf(stderr, "Error configuring PMCH\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INFO(" Global:\n");
|
||||||
|
INFO(" nof_prb=%d\n", cell.nof_prb);
|
||||||
|
INFO(" nof_ports=%d\n", cell.nof_ports);
|
||||||
|
INFO(" id=%d\n", cell.id);
|
||||||
|
INFO(" cp=%s\n", srslte_cp_string(cell.cp));
|
||||||
|
INFO(" phich_length=%d\n", (int) cell.phich_length);
|
||||||
|
INFO(" phich_resources=%d\n", (int) cell.phich_resources);
|
||||||
|
INFO(" nof_prb=%d\n", pmch_cfg.grant.nof_prb);
|
||||||
|
INFO(" sf_idx=%d\n", pmch_cfg.sf_idx);
|
||||||
|
INFO(" mimo_type=%s\n", srslte_mimotype2str(pmch_cfg.mimo_type));
|
||||||
|
INFO(" nof_layers=%d\n", pmch_cfg.nof_layers);
|
||||||
|
INFO(" nof_tb=%d\n", SRSLTE_RA_DL_GRANT_NOF_TB(&pmch_cfg.grant));
|
||||||
|
|
||||||
|
INFO(" Qm=%d\n", pmch_cfg.grant.Qm[0]);
|
||||||
|
INFO(" mcs.idx=0x%X\n", pmch_cfg.grant.mcs[0].idx);
|
||||||
|
INFO(" mcs.tbs=%d\n", pmch_cfg.grant.mcs[0].tbs);
|
||||||
|
INFO(" mcs.mod=%s\n", srslte_mod_string(pmch_cfg.grant.mcs[0].mod));
|
||||||
|
INFO(" rv=%d\n", pmch_cfg.rv[0]);
|
||||||
|
INFO(" lstart=%d\n", pmch_cfg.nbits[0].lstart);
|
||||||
|
INFO(" nof_bits=%d\n", pmch_cfg.nbits[0].nof_bits);
|
||||||
|
INFO(" nof_re=%d\n", pmch_cfg.nbits[0].nof_re);
|
||||||
|
INFO(" nof_symb=%d\n", pmch_cfg.nbits[0].nof_symb);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (srslte_pmch_init(&pmch_tx, cell.nof_prb)) {
|
||||||
|
fprintf(stderr, "Error creating PMCH object\n");
|
||||||
|
}
|
||||||
|
srslte_pmch_set_area_id(&pmch_tx, mbsfn_area_id);
|
||||||
|
|
||||||
|
if (srslte_pmch_init(&pmch_rx, cell.nof_prb)) {
|
||||||
|
fprintf(stderr, "Error creating PMCH object\n");
|
||||||
|
}
|
||||||
|
srslte_pmch_set_area_id(&pmch_rx, mbsfn_area_id);
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
||||||
|
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");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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++) {
|
||||||
|
if (grant.tb_en[tb]) {
|
||||||
|
for (int byte = 0; byte < grant.mcs[tb].tbs / 8; byte++) {
|
||||||
|
data_tx[tb][byte] = (uint8_t) (rand() % 256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srslte_pmch_encode(&pmch_tx, &pmch_cfg, softbuffers_tx[0], data_tx[0], mbsfn_area_id, tx_slot_symbols)) {
|
||||||
|
fprintf(stderr, "Error encoding PDSCH\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
gettimeofday(&t[2], NULL);
|
||||||
|
get_time_interval(t);
|
||||||
|
printf("ENCODED in %.2f (PHY bitrate=%.2f Mbps. Processing bitrate=%.2f Mbps)\n",
|
||||||
|
(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);
|
||||||
|
|
||||||
|
#ifdef DO_OFDM
|
||||||
|
for (i = 0; i < cell.nof_ports; i++) {
|
||||||
|
/* For each Tx antenna modulate OFDM */
|
||||||
|
srslte_ofdm_tx_sf(&ifft_mbsfn, tx_slot_symbols[i], tx_sf_symbols[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* combine outputs */
|
||||||
|
for (j = 0; j < nof_rx_antennas; j++) {
|
||||||
|
for (k = 0; k < NOF_CE_SYMBOLS; k++) {
|
||||||
|
rx_sf_symbols[j][k] = 0.0f;
|
||||||
|
for (i = 0; i < cell.nof_ports; i++) {
|
||||||
|
rx_sf_symbols[j][k] += tx_sf_symbols[i][k] * ce[i][j][k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* combine outputs */
|
||||||
|
for (j = 0; j < nof_rx_antennas; j++) {
|
||||||
|
for (k = 0; k < SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp); k++) {
|
||||||
|
rx_slot_symbols[j][k] = 0.0f;
|
||||||
|
for (i = 0; i < cell.nof_ports; i++) {
|
||||||
|
rx_slot_symbols[j][k] += tx_slot_symbols[i][k] * ce[i][j][k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int r=0;
|
||||||
|
gettimeofday(&t[1], NULL);
|
||||||
|
|
||||||
|
#ifdef DO_OFDM
|
||||||
|
/* For each Rx antenna demodulate OFDM */
|
||||||
|
for (i = 0; i < nof_rx_antennas; i++) {
|
||||||
|
srslte_ofdm_rx_sf(&fft_mbsfn, tx_sf_symbols[i], rx_slot_symbols[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
||||||
|
if (grant.tb_en[i]) {
|
||||||
|
srslte_softbuffer_rx_reset_tbs(softbuffers_rx[i], (uint32_t) grant.mcs[i].tbs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r = srslte_pmch_decode(&pmch_rx, &pmch_cfg, softbuffers_rx[0],rx_slot_symbols[0], ce[0],0,mbsfn_area_id, data_rx[0]);
|
||||||
|
gettimeofday(&t[2], NULL);
|
||||||
|
get_time_interval(t);
|
||||||
|
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) (grant.mcs[0].tbs + grant.mcs[1].tbs)*M/t[0].tv_usec);
|
||||||
|
|
||||||
|
/* If there is an error in PDSCH decode */
|
||||||
|
if (r) {
|
||||||
|
ret = -1;
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check Tx and Rx bytes */
|
||||||
|
for (int tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) {
|
||||||
|
if (grant.tb_en[tb]) {
|
||||||
|
for (int byte = 0; byte < grant.mcs[tb].tbs / 8; byte++) {
|
||||||
|
if (data_tx[tb][byte] != data_rx[tb][byte]) {
|
||||||
|
ERROR("Found BYTE error in TB %d (%02X != %02X), quiting...", tb, data_tx[tb][byte], data_rx[tb][byte]);
|
||||||
|
ret = SRSLTE_ERROR;
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = SRSLTE_SUCCESS;
|
||||||
|
|
||||||
|
quit:
|
||||||
|
srslte_pmch_free(&pmch_tx);
|
||||||
|
srslte_pmch_free(&pmch_rx);
|
||||||
|
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
|
||||||
|
srslte_softbuffer_tx_free(softbuffers_tx[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_tx[i]) {
|
||||||
|
free(data_tx[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data_rx[i]) {
|
||||||
|
free(data_rx[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0;i<SRSLTE_MAX_PORTS;i++) {
|
||||||
|
for (j = 0; j < SRSLTE_MAX_PORTS; j++) {
|
||||||
|
if (ce[i][j]) {
|
||||||
|
free(ce[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tx_slot_symbols[i]) {
|
||||||
|
free(tx_slot_symbols[i]);
|
||||||
|
}
|
||||||
|
if (rx_slot_symbols[i]) {
|
||||||
|
free(rx_slot_symbols[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ret) {
|
||||||
|
printf("Error\n");
|
||||||
|
} else {
|
||||||
|
printf("Ok\n");
|
||||||
|
}
|
||||||
|
exit(ret);
|
||||||
|
}
|
|
@ -631,8 +631,7 @@ int srslte_ue_dl_decode_mbsfn(srslte_ue_dl_t * q,
|
||||||
fprintf(stderr, "Error calling srslte_pmch_decode()\n");
|
fprintf(stderr, "Error calling srslte_pmch_decode()\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("q->pmch_pkts_total %d \n", q->pmch_pkts_total);
|
|
||||||
printf("qq->pmch_pkt_errors %d \n", q->pmch_pkt_errors);
|
|
||||||
q->pmch_pkts_total++;
|
q->pmch_pkts_total++;
|
||||||
|
|
||||||
if (ret == SRSLTE_SUCCESS) {
|
if (ret == SRSLTE_SUCCESS) {
|
||||||
|
|
|
@ -358,24 +358,8 @@ void radio::set_tx_srate(double srate)
|
||||||
}
|
}
|
||||||
} else if (!strcmp(srslte_rf_name(&rf_device), "uhd_x300")) {
|
} else if (!strcmp(srslte_rf_name(&rf_device), "uhd_x300")) {
|
||||||
|
|
||||||
double srate_khz = round(cur_tx_srate/1e3);
|
// In X300 TX/RX offset is independent of sampling rate
|
||||||
if (srate_khz == 1.92e3) {
|
nsamples = 45;
|
||||||
nsamples = 50;
|
|
||||||
} else if (srate_khz == 3.84e3) {
|
|
||||||
nsamples = 65;
|
|
||||||
} else if (srate_khz == 5.76e3) {
|
|
||||||
nsamples = 75;
|
|
||||||
} else if (srate_khz == 11.52e3) {
|
|
||||||
nsamples = 89;
|
|
||||||
} else if (srate_khz == 15.36e3) {
|
|
||||||
nsamples = 86;
|
|
||||||
} else if (srate_khz == 23.04e3) {
|
|
||||||
nsamples = 110;
|
|
||||||
} else {
|
|
||||||
/* Interpolate from known values */
|
|
||||||
printf("\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n", cur_tx_srate);
|
|
||||||
nsamples = cur_tx_srate*(uhd_default_tx_adv_samples * (1/cur_tx_srate) + uhd_default_tx_adv_offset_sec);
|
|
||||||
}
|
|
||||||
} else if (!strcmp(srslte_rf_name(&rf_device), "bladerf")) {
|
} else if (!strcmp(srslte_rf_name(&rf_device), "bladerf")) {
|
||||||
|
|
||||||
double srate_khz = round(cur_tx_srate/1e3);
|
double srate_khz = round(cur_tx_srate/1e3);
|
||||||
|
|
|
@ -113,9 +113,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void log_step_ul(uint32_t tti);
|
|
||||||
void log_step_dl(uint32_t tti);
|
|
||||||
|
|
||||||
static const int MAX_LOCATIONS = 20;
|
static const int MAX_LOCATIONS = 20;
|
||||||
static const uint32_t cfi = 3;
|
static const uint32_t cfi = 3;
|
||||||
srslte_dci_location_t locations[MAX_LOCATIONS];
|
srslte_dci_location_t locations[MAX_LOCATIONS];
|
||||||
|
|
|
@ -42,7 +42,6 @@ public:
|
||||||
// used by sched_metric
|
// used by sched_metric
|
||||||
uint32_t ue_idx;
|
uint32_t ue_idx;
|
||||||
|
|
||||||
bool has_pusch;
|
|
||||||
bool has_pucch;
|
bool has_pucch;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -116,7 +115,7 @@ public:
|
||||||
bool needs_cqi(uint32_t tti, bool will_send = false);
|
bool needs_cqi(uint32_t tti, bool will_send = false);
|
||||||
uint32_t get_max_retx();
|
uint32_t get_max_retx();
|
||||||
|
|
||||||
bool get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32_t *L);
|
bool get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2]);
|
||||||
bool pucch_sr_collision(uint32_t current_tti, uint32_t n_cce);
|
bool pucch_sr_collision(uint32_t current_tti, uint32_t n_cce);
|
||||||
|
|
||||||
uint32_t get_pending_ul_old_data();
|
uint32_t get_pending_ul_old_data();
|
||||||
|
|
|
@ -403,7 +403,7 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv)
|
||||||
|
|
||||||
int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res)
|
int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res)
|
||||||
{
|
{
|
||||||
log_step_dl(tti);
|
log_h->step(tti);
|
||||||
|
|
||||||
if (!started) {
|
if (!started) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -545,7 +545,7 @@ uint8_t* mac::assemble_si(uint32_t index)
|
||||||
int mac::get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res)
|
int mac::get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res)
|
||||||
{
|
{
|
||||||
|
|
||||||
log_step_ul(tti);
|
log_h->step(tti);
|
||||||
|
|
||||||
if (!started) {
|
if (!started) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -602,24 +602,6 @@ int mac::get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res)
|
||||||
return SRSLTE_SUCCESS;
|
return SRSLTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac::log_step_ul(uint32_t tti)
|
|
||||||
{
|
|
||||||
int tti_ul = tti-8;
|
|
||||||
if (tti_ul < 0) {
|
|
||||||
tti_ul += 10240;
|
|
||||||
}
|
|
||||||
log_h->step(tti_ul);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mac::log_step_dl(uint32_t tti)
|
|
||||||
{
|
|
||||||
int tti_dl = tti-4;
|
|
||||||
if (tti_dl < 0) {
|
|
||||||
tti_dl += 10240;
|
|
||||||
}
|
|
||||||
log_h->step(tti_dl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mac::tti_clock()
|
void mac::tti_clock()
|
||||||
{
|
{
|
||||||
timers_thread.tti_clock();
|
timers_thread.tti_clock();
|
||||||
|
|
|
@ -700,7 +700,6 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
|
||||||
sched_ue *user = (sched_ue*) &iter->second;
|
sched_ue *user = (sched_ue*) &iter->second;
|
||||||
uint16_t rnti = (uint16_t) iter->first;
|
uint16_t rnti = (uint16_t) iter->first;
|
||||||
|
|
||||||
user->has_pusch = false;
|
|
||||||
user->has_pucch = false;
|
user->has_pucch = false;
|
||||||
|
|
||||||
ul_harq_proc *h = user->get_ul_harq(current_tti);
|
ul_harq_proc *h = user->get_ul_harq(current_tti);
|
||||||
|
@ -726,15 +725,12 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
|
||||||
sched_ue *user = (sched_ue*) &iter->second;
|
sched_ue *user = (sched_ue*) &iter->second;
|
||||||
uint16_t rnti = (uint16_t) iter->first;
|
uint16_t rnti = (uint16_t) iter->first;
|
||||||
uint32_t prb_idx[2] = {0, 0};
|
uint32_t prb_idx[2] = {0, 0};
|
||||||
uint32_t L = 0;
|
if (user->get_pucch_sched(current_tti, prb_idx)) {
|
||||||
if (user->get_pucch_sched(current_tti, prb_idx, &L)) {
|
|
||||||
user->has_pucch = true;
|
user->has_pucch = true;
|
||||||
// allocate PUCCH if no PUSCH for user
|
// allocate PUCCH
|
||||||
if (!user->has_pusch) {
|
for (int i=0;i<2;i++) {
|
||||||
for (int i=0;i<2;i++) {
|
ul_harq_proc::ul_alloc_t pucch = {prb_idx[i], 1};
|
||||||
ul_harq_proc::ul_alloc_t pucch = {prb_idx[i], L};
|
ul_metric->update_allocation(pucch);
|
||||||
ul_metric->update_allocation(pucch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -807,22 +803,22 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
|
||||||
user->unset_sr();
|
user->unset_sr();
|
||||||
}
|
}
|
||||||
|
|
||||||
log_h->info("SCHED: %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=%d,%d, n_rtx=%d, tbs=%d, bsr=%d (%d-%d)\n",
|
log_h->info("SCHED: %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=(%d,%d), n_rtx=%d, tbs=%d, bsr=%d (%d-%d)\n",
|
||||||
is_rar?"RAR":"UL",
|
is_rar?"RAR":"UL",
|
||||||
is_newtx?"tx":"retx",
|
is_newtx?"tx":"retx",
|
||||||
rnti, h->get_id(),
|
rnti, h->get_id(),
|
||||||
sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce,
|
sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce,
|
||||||
alloc.RB_start, alloc.L, h->nof_retx(), sched_result->pusch[nof_dci_elems].tbs,
|
alloc.RB_start, alloc.RB_start+alloc.L, h->nof_retx(), sched_result->pusch[nof_dci_elems].tbs,
|
||||||
user->get_pending_ul_new_data(current_tti),pending_data_before, user->get_pending_ul_old_data());
|
user->get_pending_ul_new_data(current_tti),pending_data_before, user->get_pending_ul_old_data());
|
||||||
|
|
||||||
nof_dci_elems++;
|
nof_dci_elems++;
|
||||||
} else {
|
} else {
|
||||||
log_h->warning("SCHED: Error %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=%d,%d, tbs=%d, bsr=%d\n",
|
log_h->warning("SCHED: Error %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=(%d,%d), tbs=%d, bsr=%d\n",
|
||||||
is_rar?"RAR":"UL",
|
is_rar?"RAR":"UL",
|
||||||
is_newtx?"tx":"retx",
|
is_newtx?"tx":"retx",
|
||||||
rnti, h->get_id(),
|
rnti, h->get_id(),
|
||||||
sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce,
|
sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce,
|
||||||
alloc.RB_start, alloc.L, sched_result->pusch[nof_dci_elems].tbs,
|
alloc.RB_start, alloc.RB_start+alloc.L, sched_result->pusch[nof_dci_elems].tbs,
|
||||||
user->get_pending_ul_new_data(current_tti));
|
user->get_pending_ul_new_data(current_tti));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "mac/scheduler_harq.h"
|
||||||
#include "srslte/srslte.h"
|
|
||||||
#include "mac/scheduler_metric.h"
|
#include "mac/scheduler_metric.h"
|
||||||
|
|
||||||
#define Error(fmt, ...) log_h->error_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
#define Error(fmt, ...) log_h->error_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
||||||
|
@ -215,7 +214,6 @@ void ul_metric_rr::new_tti(std::map<uint16_t,sched_ue> &ue_db, uint32_t nof_rb_,
|
||||||
sched_ue *user = (sched_ue*) &iter->second;
|
sched_ue *user = (sched_ue*) &iter->second;
|
||||||
if (user->get_pending_ul_new_data(current_tti) || !user->get_ul_harq(current_tti)->is_empty()) {
|
if (user->get_pending_ul_new_data(current_tti) || !user->get_ul_harq(current_tti)->is_empty()) {
|
||||||
user->ue_idx = nof_users_with_data;
|
user->ue_idx = nof_users_with_data;
|
||||||
user->has_pusch = true;
|
|
||||||
nof_users_with_data++;
|
nof_users_with_data++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
#include <srslte/interfaces/sched_interface.h>
|
#include <srslte/interfaces/sched_interface.h>
|
||||||
#include <srslte/phy/phch/pucch.h>
|
#include <srslte/phy/phch/pucch.h>
|
||||||
|
#include <srslte/srslte.h>
|
||||||
|
|
||||||
#include "srslte/srslte.h"
|
#include "srslte/srslte.h"
|
||||||
#include "srslte/common/pdu.h"
|
#include "srslte/common/pdu.h"
|
||||||
|
@ -232,7 +233,7 @@ bool sched_ue::pucch_sr_collision(uint32_t current_tti, uint32_t n_cce)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32_t *L)
|
bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
|
||||||
{
|
{
|
||||||
if (!phy_config_dedicated_enabled) {
|
if (!phy_config_dedicated_enabled) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -254,10 +255,8 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32
|
||||||
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, i);
|
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (L) {
|
Info("SCHED: Reserved Format1A PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, ncce=%d, has_sr=%d, n_pucch_1=%d\n",
|
||||||
*L = 1;
|
rnti, prb_idx[0], prb_idx[1], n_pucch, dl_harq[i].get_n_cce(), has_sr, pucch_sched.N_pucch_1);
|
||||||
}
|
|
||||||
Debug("SCHED: Reserved Format1A PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d\n", rnti, prb_idx[0], prb_idx[1], n_pucch);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,10 +267,7 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32
|
||||||
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1, cfg.sr_N_pucch, cell.nof_prb, cell.cp, i);
|
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1, cfg.sr_N_pucch, cell.nof_prb, cell.cp, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (L) {
|
Info("SCHED: Reserved Format1 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d\n", rnti, prb_idx[0], prb_idx[1], cfg.sr_N_pucch);
|
||||||
*L = 1;
|
|
||||||
}
|
|
||||||
Debug("SCHED: Reserved Format1 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d\n", rnti, prb_idx[0], prb_idx[1], cfg.sr_N_pucch);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Finally check Format2 (periodic CQI)
|
// Finally check Format2 (periodic CQI)
|
||||||
|
@ -281,10 +277,7 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32
|
||||||
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_2, cfg.cqi_pucch, cell.nof_prb, cell.cp, i);
|
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_2, cfg.cqi_pucch, cell.nof_prb, cell.cp, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(L) {
|
Info("SCHED: Reserved Format2 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, pmi_idx=%d\n",
|
||||||
*L = 2;
|
|
||||||
}
|
|
||||||
Debug("SCHED: Reserved Format2 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, pmi_idx=%d\n",
|
|
||||||
rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx);
|
rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <srslte/interfaces/sched_interface.h>
|
#include "srslte/interfaces/sched_interface.h"
|
||||||
#include <srslte/asn1/liblte_rrc.h>
|
#include "srslte/asn1/liblte_rrc.h"
|
||||||
#include <upper/rrc.h>
|
#include "upper/rrc.h"
|
||||||
|
#include "srslte/srslte.h"
|
||||||
#include "srslte/asn1/liblte_mme.h"
|
#include "srslte/asn1/liblte_mme.h"
|
||||||
#include "upper/rrc.h"
|
#include "upper/rrc.h"
|
||||||
|
|
||||||
|
@ -1177,6 +1178,7 @@ void rrc::ue::send_connection_setup(bool is_setup)
|
||||||
sched_cfg.pucch_cfg.delta_pucch_shift = liblte_rrc_delta_pucch_shift_num[parent->sib2.rr_config_common_sib.pucch_cnfg.delta_pucch_shift%LIBLTE_RRC_DELTA_PUCCH_SHIFT_N_ITEMS];
|
sched_cfg.pucch_cfg.delta_pucch_shift = liblte_rrc_delta_pucch_shift_num[parent->sib2.rr_config_common_sib.pucch_cnfg.delta_pucch_shift%LIBLTE_RRC_DELTA_PUCCH_SHIFT_N_ITEMS];
|
||||||
sched_cfg.pucch_cfg.N_cs = parent->sib2.rr_config_common_sib.pucch_cnfg.n_cs_an;
|
sched_cfg.pucch_cfg.N_cs = parent->sib2.rr_config_common_sib.pucch_cnfg.n_cs_an;
|
||||||
sched_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_config_common_sib.pucch_cnfg.n_rb_cqi;
|
sched_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_config_common_sib.pucch_cnfg.n_rb_cqi;
|
||||||
|
sched_cfg.pucch_cfg.n1_pucch_an = parent->sib2.rr_config_common_sib.pucch_cnfg.n1_pucch_an;
|
||||||
|
|
||||||
// Configure MAC
|
// Configure MAC
|
||||||
parent->mac->ue_cfg(rnti, &sched_cfg);
|
parent->mac->ue_cfg(rnti, &sched_cfg);
|
||||||
|
|
Loading…
Reference in New Issue