fixing conflicts

This commit is contained in:
yagoda 2018-01-31 12:32:11 +00:00
commit 42040f7111
39 changed files with 167 additions and 114 deletions

View File

@ -239,7 +239,7 @@ int main(int argc, char **argv) {
exit(-1);
}
INFO("Stopping RF and flushing buffer...\n",0);
INFO("Stopping RF and flushing buffer...\n");
srslte_rf_stop_rx_stream(&rf);
srslte_rf_flush_buffer(&rf);

View File

@ -220,7 +220,7 @@ int main(int argc, char **argv) {
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000);
srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ);
INFO("Starting receiver...\n", 0);
INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(&rf, false);
n = srslte_ue_cellsearch_scan(&cs, found_cells, NULL);

View File

@ -858,7 +858,7 @@ int main(int argc, char **argv) {
if (net_port > 0) {
send_data = net_packet_ready;
if (net_packet_ready) {
INFO("Transmitting packet\n",0);
INFO("Transmitting packet\n");
}
} else {
INFO("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs[0].tbs + pdsch_cfg.grant.mcs[1].tbs);

View File

@ -473,7 +473,7 @@ int main(int argc, char **argv) {
exit(-1);
}
INFO("Stopping RF and flushing buffer...\r",0);
INFO("Stopping RF and flushing buffer...\r");
}
#endif
@ -606,7 +606,7 @@ int main(int argc, char **argv) {
srslte_pbch_decode_reset(&ue_mib.pbch);
INFO("\nEntering main loop...\n\n", 0);
INFO("\nEntering main loop...\n\n");
/* Main loop */
while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) {
bool acks [SRSLTE_MAX_CODEWORDS] = {false};

View File

@ -59,6 +59,9 @@
// cf_t definition
typedef _Complex float cf_t;
#ifdef ENABLE_C16
typedef _Complex short int c16_t;
#endif /* ENABLE_C16 */
#endif // CONFIG_H

View File

@ -110,7 +110,7 @@ typedef enum {SRSLTE_SF_NORM, SRSLTE_SF_MBSFN} srslte_sf_t;
#define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX))
#define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SF_LEN_PRB(nof_prb) (SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SF_LEN_PRB(nof_prb) (nof_prb > 0 ? SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)) : 0)
#define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb*SRSLTE_NRE*SRSLTE_CP_NSYMB(cp))
#define SRSLTE_SF_LEN_RE(nof_prb, cp) (2*SRSLTE_SLOT_LEN_RE(nof_prb, cp))

View File

@ -43,6 +43,7 @@
#define SRSLTE_CQI_MAX_BITS 64
#define SRSLTE_DIF_CQI_MAX_BITS 3
#define SRSLTE_PMI_MAX_BITS 4
#define SRSLTE_CQI_STR_MAX_CHAR 32
typedef struct {
bool configured;

View File

@ -150,7 +150,10 @@
#endif /* LV_HAVE_AVX2 */
#endif /* LV_HAVE_AVX512 */
#ifndef ENABLE_C16
#undef SRSLTE_SIMD_C16_SIZE
#define SRSLTE_SIMD_C16_SIZE 0
#endif /* ENABLE_C16 */
#if SRSLTE_SIMD_F_SIZE

View File

@ -106,7 +106,9 @@ SRSLTE_API cf_t srslte_vec_dot_prod_conj_ccc_simd(const cf_t *x, const cf_t *y,
SRSLTE_API cf_t srslte_vec_dot_prod_ccc_simd(const cf_t *x, const cf_t *y, const int len);
#ifdef ENABLE_C16
SRSLTE_API c16_t srslte_vec_dot_prod_ccc_c16i_simd(const c16_t *x, const c16_t *y, const int len);
#endif /* ENABLE_C16 */
SRSLTE_API int srslte_vec_dot_prod_sss_simd(const int16_t *x, const int16_t *y, const int len);

View File

@ -50,7 +50,9 @@ void srslte_filesource_free(srslte_filesource_t *q) {
}
void srslte_filesource_seek(srslte_filesource_t *q, int pos) {
fseek(q->f, pos, SEEK_SET);
if (!fseek(q->f, pos, SEEK_SET)){
perror("srslte_filesource_seek");
}
}
int read_complex_f(FILE *f, _Complex float *y) {

View File

@ -2205,7 +2205,9 @@ int srslte_precoding_pmi_select_2l_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
sinr_list[i] /= count;
if (count) {
sinr_list[i] /= count;
}
if (sinr_list[i] > max_sinr) {
max_sinr = sinr_list[i];
@ -2326,7 +2328,9 @@ int srslte_precoding_pmi_select_2l_sse(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
sinr_list[i] /= count;
if (count) {
sinr_list[i] /= count;
}
if (sinr_list[i] > max_sinr) {
max_sinr = sinr_list[i];
@ -2473,7 +2477,9 @@ int srslte_precoding_pmi_select_2l_avx(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
sinr_list[i] /= count;
if (count) {
sinr_list[i] /= count;
}
if (sinr_list[i] > max_sinr) {
max_sinr = sinr_list[i];
@ -2545,7 +2551,11 @@ float srslte_precoding_2x2_cn_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], u
count++;
}
return cn_avg/count;
if (count) {
cn_avg /= count;
}
return cn_avg;
}
/* Computes the condition number for a given number of antennas,

View File

@ -124,7 +124,7 @@ int main(int argc, char **argv) {
/* Condition number */
if (srslte_precoding_cn(h, 2, 2, nof_symbols, &cn)) {
ERROR("Test case %d condition number returned error\n");
ERROR("Test case %d condition number returned error\n", c + 1);
goto clean;
}

View File

@ -42,7 +42,7 @@ int nof_symbols = 1000;
uint32_t codebook_idx = 0;
int nof_layers = 1, nof_tx_ports = 1, nof_rx_ports = 1, nof_re = 1;
char *mimo_type_name = NULL;
char decoder_type_name [16] = "zf";
char decoder_type_name [17] = "zf";
float snr_db = 100.0f;
float scaling = 0.1f;
@ -56,7 +56,7 @@ void usage(char *prog) {
printf("\t-g Scaling [Default %.1f]*\n", scaling);
printf("\t-d decoder type [zf|mmse] [Default %s]\n", decoder_type_name);
printf("\n");
printf("* Performance test example:\n\t for snr in {0..20..1}; do ./precoding_test -m single -s $snr; done; \n\n", decoder_type_name);
printf("* Performance test example:\n\t for snr in {0..20..1}; do ./precoding_test -m single -s $snr; done; \n\n");
}
void parse_args(int argc, char **argv) {
@ -82,7 +82,8 @@ void parse_args(int argc, char **argv) {
codebook_idx = (uint32_t) atoi(argv[optind]);
break;
case 'd':
strncpy(decoder_type_name, argv[optind], 16);
strncpy(decoder_type_name, argv[optind], 15);
decoder_type_name[15] = 0;
break;
case 's':
snr_db = (float) atof(argv[optind]);

View File

@ -383,7 +383,7 @@ bool srslte_ri_send(uint32_t I_cqi_pmi, uint32_t I_ri, uint32_t tti) {
return false;
}
if (M_ri) {
if (M_ri && N_p) {
if ((tti - N_offset_p + N_offset_ri) % (N_p * M_ri) == 0) {
return true;
}
@ -456,8 +456,16 @@ int srslte_cqi_hl_get_no_subbands(int nof_prb)
void srslte_cqi_to_str(const uint8_t *cqi_value, int cqi_len, char *str, int str_len) {
int i = 0;
for (i = 0; i < cqi_len && i < (str_len - 1); i++) {
for (i = 0; i < cqi_len && i < (str_len - 5); i++) {
str[i] = (cqi_value[i] == 0)?(char)'0':(char)'1';
}
if (i == (str_len - 5)) {
str[i++] = '.';
str[i++] = '.';
str[i++] = '.';
str[i++] = (cqi_value[cqi_len - 1] == 0)?(char)'0':(char)'1';
}
str[i] = '\0';
}

View File

@ -577,7 +577,7 @@ int dci_format0_unpack(srslte_dci_msg_t *msg, srslte_ra_ul_dci_t *data, uint32_t
return SRSLTE_ERROR;
}
if (*y++ != 0) {
INFO("DCI message is Format1A\n", 0);
INFO("DCI message is Format1A\n");
return SRSLTE_ERROR;
}
if (*y++ == 0) {
@ -836,7 +836,7 @@ int dci_format1As_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
}
if (*y++ != 1) {
INFO("DCI message is Format0\n", 0);
INFO("DCI message is Format0\n");
return SRSLTE_ERROR;
}

View File

@ -557,7 +557,7 @@ int srslte_pdcch_dci_encode(srslte_pdcch_t *q, uint8_t *data, uint8_t *e, uint32
srslte_pdcch_dci_encode_conv(q, data, nof_bits, tmp, rnti);
DEBUG("CConv output: ", 0);
DEBUG("CConv output: ");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, tmp, 3 * (nof_bits + 16));
}
@ -617,7 +617,7 @@ int srslte_pdcch_encode(srslte_pdcch_t *q, srslte_dci_msg_t *msg, srslte_dci_loc
srslte_scrambling_b_offset(&q->seq[nsubframe], q->e, 72 * location.ncce, e_bits);
DEBUG("Scrambling output: ", 0);
DEBUG("Scrambling output: ");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->e, e_bits);
}

View File

@ -29,6 +29,8 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <srslte/phy/phch/pdsch_cfg.h>
#include <srslte/srslte.h>
#include "prb_dl.h"
#include "srslte/phy/phch/pdsch.h"
@ -656,8 +658,8 @@ int srslte_pdsch_decode(srslte_pdsch_t *q,
{
uint32_t nof_tb = SRSLTE_RA_DL_GRANT_NOF_TB(&cfg->grant);
INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mimo_type=%d, nof_layers=%d, nof_tb=%d\n",
cfg->sf_idx, rnti, cfg->nbits[0].nof_re, cfg->grant.nof_prb, cfg->nof_layers, nof_tb);
INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mimo_type=%s, nof_layers=%d, nof_tb=%d\n",
cfg->sf_idx, rnti, cfg->nbits[0].nof_re, cfg->grant.nof_prb, srslte_mod_string(cfg->grant.mcs->mod), cfg->nof_layers, nof_tb);
// Extract Symbols and Channel Estimates
for (int j=0;j<q->nof_rx_antennas;j++) {

View File

@ -148,7 +148,7 @@ uint8_t srslte_phich_ack_decode(float bits[SRSLTE_PHICH_NBITS], float *distance)
uint8_t index=0;
if (SRSLTE_VERBOSE_ISINFO()) {
INFO("Received bits: ", 0);
INFO("Received bits: ");
srslte_vec_fprint_f(stdout, bits, SRSLTE_PHICH_NBITS);
}
@ -244,8 +244,8 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS],
srslte_predecoding_diversity_multi(q_sf_symbols, q_ce, x, q->nof_rx_antennas, q->cell.nof_ports, SRSLTE_PHICH_MAX_NSYMB, 1.0f);
srslte_layerdemap_diversity(x, q->d0, q->cell.nof_ports, SRSLTE_PHICH_MAX_NSYMB / q->cell.nof_ports);
}
DEBUG("Recv!!: \n", 0);
DEBUG("d0: ", 0);
DEBUG("Recv!!: \n");
DEBUG("d0: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB);
@ -265,7 +265,7 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS],
memcpy(q->d, q->d0, SRSLTE_PHICH_MAX_NSYMB * sizeof(cf_t));
}
DEBUG("d: ", 0);
DEBUG("d: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d, SRSLTE_PHICH_EXT_MSYMB);
@ -290,7 +290,7 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS],
}
}
DEBUG("z: ", 0);
DEBUG("z: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->z, SRSLTE_PHICH_NBITS);
@ -353,7 +353,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_
srslte_mod_modulate(&q->mod, q->data, q->z, SRSLTE_PHICH_NBITS);
DEBUG("data: ", 0);
DEBUG("data: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->z, SRSLTE_PHICH_NBITS);
@ -370,7 +370,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_
}
}
DEBUG("d: ", 0);
DEBUG("d: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d, SRSLTE_PHICH_EXT_MSYMB);
@ -397,7 +397,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_
memcpy(q->d0, q->d, SRSLTE_PHICH_MAX_NSYMB * sizeof(cf_t));
}
DEBUG("d0: ", 0);
DEBUG("d0: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB);

View File

@ -494,7 +494,7 @@ static int decode_tb(srslte_sch_t *q,
((uint32_t) data[cb_segm->tbs/8+2]);
if (par_rx == par_tx && par_rx) {
INFO("TB decoded OK\n",0);
INFO("TB decoded OK\n");
return SRSLTE_SUCCESS;
} else {
INFO("Error in TB parity: par_tx=0x%x, par_rx=0x%x\n", par_tx, par_rx);

View File

@ -154,7 +154,7 @@ int base_init() {
return -1;
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}

View File

@ -170,7 +170,7 @@ int base_init() {
return -1;
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}
@ -232,7 +232,7 @@ int main(int argc, char **argv) {
/* Get channel estimates for each port */
srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0);
INFO("Decoding PCFICH\n", 0);
INFO("Decoding PCFICH\n");
n = srslte_pcfich_decode(&pcfich, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), 0, &cfi, &cfi_corr);

View File

@ -180,7 +180,7 @@ int base_init() {
exit(-1);
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}
@ -244,7 +244,7 @@ int main(int argc, char **argv) {
return -1;
}
if (rnti == SRSLTE_SIRNTI) {
INFO("Initializing common search space for SI-RNTI\n",0);
INFO("Initializing common search space for SI-RNTI\n");
nof_locations = srslte_pdcch_common_locations(&pdcch, locations, MAX_CANDIDATES, cfi);
} else {
INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti);

View File

@ -148,7 +148,7 @@ int base_init() {
srslte_ue_dl_set_rnti(&ue_dl, rnti);
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}

View File

@ -194,7 +194,7 @@ int base_init() {
return -1;
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}
@ -257,7 +257,7 @@ int main(int argc, char **argv) {
/* Get channel estimates for each port */
srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0);
INFO("Decoding PHICH\n", 0);
INFO("Decoding PHICH\n");
/* Receive all PHICH groups and sequence numbers */
for (ngroup=0;ngroup<srslte_phich_ngroups(&phich);ngroup++) {

View File

@ -102,7 +102,8 @@ void parse_args(int argc, char **argv) {
cfi = atoi(argv[optind]);
break;
case 'x':
strncpy(mimo_type_str, argv[optind], 32);
strncpy(mimo_type_str, argv[optind], 31);
mimo_type_str[31] = 0;
break;
case 'p':
pmi = (uint32_t) atoi(argv[optind]);

View File

@ -368,14 +368,14 @@ int encode_cqi_long(srslte_uci_cqi_pusch_t *q, uint8_t *data, uint32_t nof_bits,
memcpy(q->tmp_cqi, data, sizeof(uint8_t) * nof_bits);
srslte_crc_attach(&q->crc, q->tmp_cqi, nof_bits);
DEBUG("cqi_crc_tx=", 0);
DEBUG("cqi_crc_tx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->tmp_cqi, nof_bits+8);
}
srslte_convcoder_encode(&encoder, q->tmp_cqi, q->encoded_cqi, nof_bits + 8);
DEBUG("cconv_tx=", 0);
DEBUG("cconv_tx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->encoded_cqi, 3 * (nof_bits + 8));
}
@ -400,14 +400,14 @@ int decode_cqi_long(srslte_uci_cqi_pusch_t *q, int16_t *q_bits, uint32_t Q,
srslte_rm_conv_rx_s(q_bits, Q, q->encoded_cqi_s, 3 * (nof_bits + 8));
DEBUG("cconv_rx=", 0);
DEBUG("cconv_rx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_s(stdout, q->encoded_cqi_s, 3 * (nof_bits + 8));
}
srslte_viterbi_decode_s(&q->viterbi, q->encoded_cqi_s, q->tmp_cqi, nof_bits + 8);
DEBUG("cqi_crc_rx=", 0);
DEBUG("cqi_crc_rx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->tmp_cqi, nof_bits+8);
}

View File

@ -201,14 +201,13 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
printf("No Soapy devices found.\n");
return SRSLTE_ERROR;
}
char* devname;
char* devname = NULL;
for (size_t i = 0; i < length; i++) {
printf("Soapy has Found device #%d: ", (int)i);
printf("Soapy has found device #%d: ", (int)i);
for (size_t j = 0; j < soapy_args[i].size; j++) {
printf("%s=%s, ", soapy_args[i].keys[j], soapy_args[i].vals[j]);
if(!strcmp(soapy_args[i].keys[j],"name") && !strcmp(soapy_args[i].vals[j], "LimeSDR-USB")){
devname = DEVNAME_LIME;
}
}
printf("\n");
@ -411,7 +410,7 @@ void rf_soapy_get_time(void *h, time_t *secs, double *frac_secs)
//TODO: add multi-channel support
int rf_soapy_recv_with_time_multi(void *h,
void **data,
void *data[SRSLTE_MAX_PORTS],
uint32_t nsamples,
bool blocking,
time_t *secs,

View File

@ -711,13 +711,12 @@ int rf_uhd_recv_with_time(void *h,
}
int rf_uhd_recv_with_time_multi(void *h,
void **data,
void *data[SRSLTE_MAX_PORTS],
uint32_t nsamples,
bool blocking,
time_t *secs,
double *frac_secs)
{
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
uhd_rx_metadata_handle *md = &handler->rx_md_first;
size_t rxd_samples = 0;

View File

@ -117,7 +117,7 @@ int rf_mib_decoder(srslte_rf_t *rf, uint32_t nof_rx_antennas,cell_search_cfg_t *
INFO("Setting sampling frequency %.2f MHz for PSS search\n", (float) srate/1000000);
srslte_rf_set_rx_srate(rf, (float) srate);
INFO("Starting receiver...\n", 0);
INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(rf, false);
// Copy CFO estimate if provided and disable CP estimation during find
@ -174,7 +174,7 @@ int rf_cell_search(srslte_rf_t *rf, uint32_t nof_rx_antennas,
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000);
srslte_rf_set_rx_srate(rf, SRSLTE_CS_SAMP_FREQ);
INFO("Starting receiver...\n", 0);
INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(rf, false);
/* Find a cell in the given N_id_2 or go through the 3 of them to find the strongest */

View File

@ -751,7 +751,7 @@ int srslte_ue_sync_zerocopy_multi(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE
break;
case SRSLTE_SYNC_FOUND_NOSPACE:
/* If a peak was found but there is not enough space for SSS/CP detection, discard a few samples */
INFO("No space for SSS/CP detection. Realigning frame...\n",0);
INFO("No space for SSS/CP detection. Realigning frame...\n");
q->recv_callback(q->stream, dummy_offset_buffer, q->frame_len/2, NULL);
srslte_sync_reset(&q->sfind);
ret = SRSLTE_SUCCESS;

View File

@ -49,8 +49,8 @@ bool verbose = false;
#define RANDOM_F() ((float)rand())/((float)RAND_MAX)
#define RANDOM_S() ((int16_t)(rand() && 0x800F))
#define RANDOM_B() ((int8_t)(rand() && 0x8008))
#define RANDOM_S() ((int16_t)(rand() & 0x800F))
#define RANDOM_B() ((int8_t)(rand() & 0x8008))
#define RANDOM_CF() (RANDOM_F() + _Complex_I*RANDOM_F())
#define TEST_CALL(TEST_CODE) gettimeofday(&start, NULL);\
@ -137,7 +137,7 @@ TEST(srslte_vec_dot_prod_sss,
MALLOC(int16_t, y);
int16_t z;
cf_t gold = 0.0f;
int16_t gold = 0.0f;
for (int i = 0; i < block_size; i++) {
x[i] = RANDOM_S();
y[i] = RANDOM_S();
@ -149,7 +149,7 @@ TEST(srslte_vec_dot_prod_sss,
gold += x[i] * y[i];
}
mse += cabsf(gold - z) / cabsf(gold);
mse = (gold - z) / abs(gold);
free(x);
free(y);
@ -160,7 +160,7 @@ TEST(srslte_vec_sum_sss,
MALLOC(int16_t, y);
MALLOC(int16_t, z);
cf_t gold = 0.0f;
int16_t gold = 0;
for (int i = 0; i < block_size; i++) {
x[i] = RANDOM_S();
y[i] = RANDOM_S();
@ -170,7 +170,7 @@ TEST(srslte_vec_sum_sss,
for (int i = 0; i < block_size; i++) {
gold = x[i] + y[i];
mse += cabsf(gold - z[i]);
mse += abs(gold - z[i]);
}
free(x);
@ -183,7 +183,7 @@ TEST(srslte_vec_sub_sss,
MALLOC(int16_t, y);
MALLOC(int16_t, z);
cf_t gold = 0.0f;
int16_t gold = 0.0f;
for (int i = 0; i < block_size; i++) {
x[i] = RANDOM_S();
y[i] = RANDOM_S();
@ -193,7 +193,7 @@ TEST(srslte_vec_sub_sss,
for (int i = 0; i < block_size; i++) {
gold = x[i] - y[i];
mse += cabsf(gold - z[i]);
mse += abs(gold - z[i]);
}
free(x);
@ -206,7 +206,7 @@ TEST(srslte_vec_prod_sss,
MALLOC(int16_t, y);
MALLOC(int16_t, z);
cf_t gold = 0.0f;
int16_t gold = 0.0f;
for (int i = 0; i < block_size; i++) {
x[i] = RANDOM_S();
y[i] = RANDOM_S();
@ -216,7 +216,7 @@ TEST(srslte_vec_prod_sss,
for (int i = 0; i < block_size; i++) {
gold = x[i] * y[i];
mse += cabsf(gold - z[i]);
mse += abs(gold - z[i]);
}
free(x);
@ -802,16 +802,18 @@ int main(int argc, char **argv) {
size_count++;
}
char fname[68];
char fname[69];
FILE *f = NULL;
void * p = popen("(date +%g%m%d && hostname) | tr '\\r\\n' '__'", "r");
if (p) {
fgets(fname, 64, p);
strncpy(fname + strnlen(fname, 64) - 1, ".tsv", 4);
strncpy(fname + strnlen(fname, 64) - 1, ".tsv", 5);
f = fopen(fname, "w");
if (f) printf("Saving benchmark results in '%s'\n", fname);
if (f) {
printf("Saving benchmark results in '%s'\n", fname);
}
pclose(p);
}
pclose(p);
printf("\n");

View File

@ -433,6 +433,7 @@ cf_t srslte_vec_dot_prod_ccc_simd(const cf_t *x, const cf_t *y, const int len) {
return result;
}
#ifdef ENABLE_C16
c16_t srslte_vec_dot_prod_ccc_c16i_simd(const c16_t *x, const c16_t *y, const int len) {
int i = 0;
c16_t result = 0;
@ -460,6 +461,7 @@ c16_t srslte_vec_dot_prod_ccc_c16i_simd(const c16_t *x, const c16_t *y, const in
return result;
}
#endif /* ENABLE_C16 */
cf_t srslte_vec_dot_prod_conj_ccc_simd(const cf_t *x, const cf_t *y, const int len)
{
@ -620,6 +622,7 @@ void srslte_vec_prod_ccc_split_simd(const float *a_re, const float *a_im, const
}
}
#ifdef ENABLE_C16
void srslte_vec_prod_ccc_c16_simd(const int16_t *a_re, const int16_t *a_im, const int16_t *b_re, const int16_t *b_im,
int16_t *r_re, int16_t *r_im, const int len) {
int i = 0;
@ -652,6 +655,7 @@ void srslte_vec_prod_ccc_c16_simd(const int16_t *a_re, const int16_t *a_im, cons
r_im[i] = a_re[i]*b_im[i] + a_im[i]*b_re[i];
}
}
#endif /* ENABLE_C16 */
void srslte_vec_prod_conj_ccc_simd(const cf_t *x, const cf_t *y, cf_t *z, const int len) {
int i = 0;

View File

@ -392,7 +392,7 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv)
// Find empty slot for pending rars
uint32_t ra_id=0;
while(pending_rars[ra_id].temp_crnti && ra_id<MAX_PENDING_RARS) {
while(pending_rars[ra_id].temp_crnti && ra_id<MAX_PENDING_RARS-1) {
ra_id++;
}
if (ra_id == MAX_PENDING_RARS) {

View File

@ -256,7 +256,7 @@ void ue::push_pdu(uint32_t tti, uint32_t len)
bool ue::process_ce(srslte::sch_subh *subh) {
uint32_t buff_size[4] = {0, 0, 0, 0};
float phr = 0;
int idx = 0;
uint32_t idx = 0;
uint16_t old_rnti = 0;
bool is_bsr = false;
switch(subh->ce_type()) {
@ -293,7 +293,7 @@ bool ue::process_ce(srslte::sch_subh *subh) {
break;
case srslte::sch_subh::LONG_BSR:
subh->get_bsr(buff_size);
for (int idx=0;idx<4;idx++) {
for (idx=0;idx<4;idx++) {
for (uint32_t i=0;i<lc_groups[idx].size();i++) {
sched->ul_bsr(rnti, lc_groups[idx][i], buff_size[idx]);
}

View File

@ -551,7 +551,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
ue_db[rnti].phich_info.n_prb_lowest = enb_ul.pusch_cfg.grant.n_prb_tilde[0];
ue_db[rnti].phich_info.n_dmrs = phy_grant.ncs_dmrs;
char cqi_str[64];
char cqi_str[SRSLTE_CQI_STR_MAX_CHAR];
if (cqi_enabled) {
if (ue_db[rnti].cqi_en) {
wideband_cqi_value = cqi_value.wideband.wideband_cqi;
@ -578,7 +578,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
cqi_value.subband_hl.wideband_cqi_cw0, cqi_value.subband_hl.N);
}
}
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64);
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR);
//snprintf(cqi_str, 64, ", cqi=%s", wideband_cqi_value);
}

View File

@ -609,6 +609,7 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(tun_fd, TUNSETIFF, &ifr))
{
perror("ioctl1");
close(tun_fd);
return -1;
}
@ -617,15 +618,21 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(sock, SIOCGIFFLAGS, &ifr))
{
perror("socket");
close(sock);
close(tun_fd);
return -1;
}
ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
if(0 > ioctl(sock, SIOCSIFFLAGS, &ifr))
{
perror("ioctl2");
close(sock);
close(tun_fd);
return -1;
}
close(sock);
// Setup the IP address
sock = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET;
@ -633,6 +640,8 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(sock, SIOCSIFADDR, &ifr))
{
perror("ioctl");
close(sock);
close(tun_fd);
return -1;
}
ifr.ifr_netmask.sa_family = AF_INET;
@ -640,9 +649,12 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr))
{
perror("ioctl");
close(sock);
close(tun_fd);
return -1;
}
close(sock);
return(tun_fd);
}

View File

@ -223,13 +223,11 @@ void phch_worker::work_imp()
bool ul_grant_available = false;
bool dl_ack[SRSLTE_MAX_CODEWORDS] = {false};
mac_interface_phy::mac_grant_t dl_mac_grant;
mac_interface_phy::tb_action_dl_t dl_action;
bzero(&dl_action, sizeof(mac_interface_phy::tb_action_dl_t));
mac_interface_phy::mac_grant_t dl_mac_grant = {};
mac_interface_phy::tb_action_dl_t dl_action = {};
mac_interface_phy::mac_grant_t ul_mac_grant;
mac_interface_phy::tb_action_ul_t ul_action;
bzero(&ul_action, sizeof(mac_interface_phy::tb_action_ul_t));
mac_interface_phy::mac_grant_t ul_mac_grant = {};
mac_interface_phy::tb_action_ul_t ul_action = {};
/** Calculate RSSI on the input signal before generating the output */
@ -399,13 +397,14 @@ void phch_worker::compute_ri(uint8_t *ri, uint8_t *pmi, float *sinr) {
Debug("TM3 RI select %d layers, κ=%fdB\n", (*ri) + 1, cn);
} else {
/* If only one receiving antenna, force RI for 1 layer */
uci_data.uci_ri = 0;
if (ri) {
*ri = 0;
}
}
uci_data.uci_ri_len = 1;
} else if (phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) {
srslte_ue_dl_ri_pmi_select(&ue_dl, ri, pmi, sinr);
Debug("TM4 ri=%d; pmi=%d; SINR=%.1fdB\n", ue_dl.ri, ue_dl.pmi[ue_dl.ri], 10*log10f(ue_dl.sinr[ue_dl.ri][ue_dl.pmi[ue_dl.ri]]));
uci_data.uci_ri_len = 1;
}
}
@ -906,11 +905,11 @@ void phch_worker::set_uci_aperiodic_cqi()
{
uint8_t ri = (uint8_t) ue_dl.ri;
uint8_t pmi = (uint8_t) ue_dl.pmi[ri];
float sinr = ue_dl.sinr[ri][pmi];
float sinr_db = ue_dl.sinr[ri][pmi];
if (phy->config->dedicated.cqi_report_cnfg.report_mode_aperiodic_present) {
/* Compute RI, PMI and SINR */
compute_ri(&ri, &pmi, &sinr);
compute_ri(&ri, &pmi, &sinr_db);
switch(phy->config->dedicated.cqi_report_cnfg.report_mode_aperiodic) {
case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM30:
@ -930,18 +929,24 @@ void phch_worker::set_uci_aperiodic_cqi()
// TODO: implement subband CQI properly
cqi_report.subband_hl.subband_diff_cqi_cw0 = 0; // Always report zero offset on all subbands
cqi_report.subband_hl.N = (cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0;
cqi_report.subband_hl.N = (cell.nof_prb > 7) ? (uint32_t) srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0;
uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
int cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
if (cqi_len < 0) {
Error("Error packing CQI value (Aperiodic reporting mode RM31).");
return;
}
uci_data.uci_cqi_len = (uint32_t) cqi_len;
char cqi_str[64] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64);
char cqi_str[SRSLTE_CQI_STR_MAX_CHAR] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR);
Info("PUSCH: Aperiodic CQI=%s, SNR=%.1f dB, for %d subbands\n", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N);
/* Set RI = 1 */
uci_data.uci_ri = ri;
uci_data.uci_ri_len = 1;
/* Fake RI = 1 */
uci_data.uci_ri = 0;
uci_data.uci_ri_len = 0;
Info("PUSCH: Aperiodic RM30 ri%s, CQI=%s, SNR=%.1f dB, for %d subbands\n",
(uci_data.uci_ri == 0)?"=1":"~1", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N);
}
break;
case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31:
@ -957,11 +962,6 @@ void phch_worker::set_uci_aperiodic_cqi()
other transmission modes they are reported conditioned on rank 1.
*/
if (rnti_is_set) {
/* Select RI, PMI and SINR */
uint32_t ri = ue_dl.ri; // Select RI (0: 1 layer, 1: 2 layer, otherwise: not implemented)
uint32_t pmi = ue_dl.pmi[ri]; // Select PMI
float sinr_db = 10 * log10(ue_dl.sinr[ri][pmi]);
/* Fill CQI Report */
srslte_cqi_value_t cqi_report = {0};
cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND_HL;
@ -982,17 +982,24 @@ void phch_worker::set_uci_aperiodic_cqi()
// TODO: implement subband CQI properly
cqi_report.subband_hl.N = (uint32_t) ((cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0);
uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
int cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
if (cqi_len < 0) {
Error("Error packing CQI value (Aperiodic reporting mode RM31).");
return;
}
uci_data.uci_cqi_len = (uint32_t) cqi_len;
uci_data.uci_ri_len = 1;
uci_data.uci_ri = ri;
char cqi_str[64] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64);
char cqi_str[SRSLTE_CQI_STR_MAX_CHAR] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR);
if (cqi_report.subband_hl.rank_is_not_one) {
Info("PUSCH: Aperiodic ri~1, CQI=%02d/%02d, SINR=%2.1f/%2.1fdB, pmi=%d for %d subbands\n",
Info("PUSCH: Aperiodic RM31 ri~1, CQI=%02d/%02d, SINR=%2.1f/%2.1fdB, pmi=%d for %d subbands\n",
cqi_report.subband_hl.wideband_cqi_cw0, cqi_report.subband_hl.wideband_cqi_cw1,
sinr_db, sinr_db, pmi, cqi_report.subband_hl.N);
} else {
Info("PUSCH: Aperiodic ri=1, CQI=%02d, SINR=%2.1f, pmi=%d for %d subbands\n",
Info("PUSCH: Aperiodic RM31 ri=1, CQI=%02d, SINR=%2.1f, pmi=%d for %d subbands\n",
cqi_report.subband_hl.wideband_cqi_cw0,
sinr_db, pmi, cqi_report.subband_hl.N);
}
@ -1060,8 +1067,8 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui
snprintf(timestr, 64, ", tot_time=%4d us", (int) logtime_start[0].tv_usec);
#endif
char cqi_str[32] = "";
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 32);
char cqi_str[SRSLTE_CQI_STR_MAX_CHAR] = "";
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR);
uint8_t dummy[2] = {0,0};
log_h->info("PUSCH: tti_tx=%d, alloc=(%d,%d), tbs=%d, mcs=%d, rv=%d%s%s%s, cfo=%.1f KHz%s%s%s\n",
@ -1114,8 +1121,8 @@ void phch_worker::encode_pucch()
float tx_power = srslte_ue_ul_pucch_power(&ue_ul, phy->pathloss, ue_ul.last_pucch_format, uci_data.uci_cqi_len, uci_data.uci_ack_len);
float gain = set_power(tx_power);
char str_cqi[32] = "";
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, str_cqi, 32);
char str_cqi[SRSLTE_CQI_STR_MAX_CHAR] = "";
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, str_cqi, SRSLTE_CQI_STR_MAX_CHAR);
Info("PUCCH: tti_tx=%d, n_pucch=%d, n_prb=%d, ack=%s%s%s%s%s, sr=%s, cfo=%.1f KHz%s\n",
(tti + 4) % 10240,
@ -1152,10 +1159,7 @@ void phch_worker::encode_srs()
float tx_power = srslte_ue_ul_srs_power(&ue_ul, phy->pathloss);
float gain = set_power(tx_power);
uint32_t fi = srslte_vec_max_fi((float*) signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
float *f = (float*) signal_buffer;
Info("SRS: power=%.2f dBm, tti_tx=%d%s\n", tx_power, TTI_TX(tti), timestr);
}
void phch_worker::enable_pregen_signals(bool enabled)

View File

@ -193,9 +193,9 @@ void nas::notify_connection_setup() {
}
void nas::write_pdu(uint32_t lcid, byte_buffer_t *pdu) {
uint8 pd;
uint8 msg_type;
uint8 sec_hdr_type;
uint8 pd = 0;
uint8 msg_type = 0;
uint8 sec_hdr_type = 0;
bool mac_valid = false;
nas_log->info_hex(pdu->msg, pdu->N_bytes, "DL %s PDU", rrc->get_rb_name(lcid).c_str());
@ -216,7 +216,7 @@ void nas::write_pdu(uint32_t lcid, byte_buffer_t *pdu) {
case LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED_WITH_NEW_EPS_SECURITY_CONTEXT:
break;
default:
nas_log->error("Not handling NAS message with SEC_HDR_TYPE=%02X\n",msg_type);
nas_log->error("Not handling NAS message with SEC_HDR_TYPE=%02X\n", sec_hdr_type);
pool->deallocate(pdu);
break;
}

View File

@ -132,7 +132,7 @@ void setup_mac_phy_sib2(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2, srsue::ma
memcpy(&common.pusch_cnfg, &sib2->rr_config_common_sib.pusch_cnfg, sizeof(LIBLTE_RRC_PUSCH_CONFIG_COMMON_STRUCT));
memcpy(&common.pucch_cnfg, &sib2->rr_config_common_sib.pucch_cnfg, sizeof(LIBLTE_RRC_PUCCH_CONFIG_COMMON_STRUCT));
memcpy(&common.ul_pwr_ctrl, &sib2->rr_config_common_sib.ul_pwr_ctrl, sizeof(LIBLTE_RRC_UL_POWER_CONTROL_COMMON_STRUCT));
memcpy(&common.prach_cnfg, &sib2->rr_config_common_sib.prach_cnfg, sizeof(LIBLTE_RRC_PRACH_CONFIG_STRUCT));
memcpy(&common.prach_cnfg, &sib2->rr_config_common_sib.prach_cnfg, sizeof(LIBLTE_RRC_PRACH_CONFIG_SIB_STRUCT));
if (sib2->rr_config_common_sib.srs_ul_cnfg.present) {
memcpy(&common.srs_ul_cnfg, &sib2->rr_config_common_sib.srs_ul_cnfg, sizeof(LIBLTE_RRC_SRS_UL_CONFIG_COMMON_STRUCT));
} else {