Merge branch 'next'

master
Andre Puschmann 7 years ago
commit 4fc7dbc340

@ -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);

@ -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);

@ -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);

@ -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};

@ -10,6 +10,7 @@
#include <vector>
#include "srslte/common/threads.h"
#include "srslte/srslte.h"
namespace srslte {
@ -24,7 +25,7 @@ template<typename metrics_t>
class metrics_listener
{
public:
virtual void set_metrics(metrics_t &m) = 0;
virtual void set_metrics(metrics_t &m, const uint32_t period_usec) = 0;
virtual void stop() = 0;
};
@ -34,13 +35,12 @@ class metrics_hub : public periodic_thread
public:
metrics_hub()
:m(NULL)
,report_period_secs(1)
,sleep_period_start()
{}
bool init(metrics_interface<metrics_t> *m_, float report_period_secs_=1.0) {
m = m_;
report_period_secs = report_period_secs_;
// Start with user-default priority
start_periodic(report_period_secs*1e6, -2);
start_periodic(report_period_secs_*1e6, -2);
return true;
}
void stop() {
@ -58,17 +58,23 @@ public:
private:
void run_period(){
// get current time and check how long we slept
gettimeofday(&sleep_period_start[2], NULL);
get_time_interval(sleep_period_start);
uint32_t period = sleep_period_start[0].tv_sec*1e6 + sleep_period_start[0].tv_usec;
if (m) {
metrics_t metric = {};
m->get_metrics(metric);
for (uint32_t i=0;i<listeners.size();i++) {
listeners[i]->set_metrics(metric);
listeners[i]->set_metrics(metric, period);
}
}
// store start of sleep period
gettimeofday(&sleep_period_start[1], NULL);
}
metrics_interface<metrics_t> *m;
std::vector<metrics_listener<metrics_t>*> listeners;
float report_period_secs;
struct timeval sleep_period_start[3];
};
} // namespace srslte

@ -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) {

@ -2205,7 +2205,9 @@ int srslte_precoding_pmi_select_2l_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
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 */
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 */
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,

@ -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;
}

@ -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) {

@ -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;
}

@ -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;
}

@ -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);
}

@ -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++) {

@ -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);

@ -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);

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

@ -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);

@ -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);

@ -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;
}

@ -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++) {

@ -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);
}

@ -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 */

@ -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;

@ -49,8 +49,7 @@ public:
metrics_csv(std::string filename);
~metrics_csv();
void set_periodicity(float metrics_report_period_sec);
void set_metrics(ue_metrics_t &m);
void set_metrics(ue_metrics_t &m, const uint32_t period_usec);
void set_ue_handle(ue_metrics_interface *ue_);
void stop();

@ -48,7 +48,7 @@ public:
void set_periodicity(float metrics_report_period_sec);
void toggle_print(bool b);
void set_metrics(ue_metrics_t &m);
void set_metrics(ue_metrics_t &m, const uint32_t period_usec);
void set_ue_handle(ue_metrics_interface *ue_);
void stop() {};

@ -447,13 +447,11 @@ int main(int argc, char *argv[])
metricshub.init(ue, args.expert.metrics_period_secs);
metricshub.add_listener(&metrics_screen);
metrics_screen.set_ue_handle(ue);
metrics_screen.set_periodicity(args.expert.metrics_period_secs);
metrics_csv metrics_file(args.expert.metrics_csv_filename);
if (args.expert.metrics_csv_enable) {
metricshub.add_listener(&metrics_file);
metrics_file.set_ue_handle(ue);
metrics_file.set_periodicity(args.expert.metrics_period_secs);
}
pthread_t input;

@ -68,11 +68,7 @@ void metrics_csv::stop()
}
}
void metrics_csv::set_periodicity(float metrics_report_period_sec) {
this->metrics_report_period = metrics_report_period_sec;
}
void metrics_csv::set_metrics(ue_metrics_t &metrics)
void metrics_csv::set_metrics(ue_metrics_t &metrics, const uint32_t period_usec)
{
if (file.is_open() && ue != NULL) {
if(n_reports == 0) {
@ -85,7 +81,7 @@ void metrics_csv::set_metrics(ue_metrics_t &metrics)
file << float_to_string(metrics.phy.dl.mcs, 2);
file << float_to_string(metrics.phy.dl.sinr, 2);
file << float_to_string(metrics.phy.dl.turbo_iters, 2);
file << float_to_string((float) metrics.mac.rx_brate/metrics_report_period, 2);
file << float_to_string((float) metrics.mac.rx_brate/period_usec*1e6, 2);
if (metrics.mac.rx_pkts > 0) {
file << float_to_string((float) 100*metrics.mac.rx_errors/metrics.mac.rx_pkts, 1);
} else {
@ -93,7 +89,7 @@ void metrics_csv::set_metrics(ue_metrics_t &metrics)
}
file << float_to_string(metrics.phy.ul.mcs, 2);
file << float_to_string((float) metrics.mac.ul_buffer, 2);
file << float_to_string((float) metrics.mac.tx_brate/metrics_report_period, 2);
file << float_to_string((float) metrics.mac.tx_brate/period_usec*1e6, 2);
if (metrics.mac.tx_pkts > 0) {
file << float_to_string((float) 100*metrics.mac.tx_errors/metrics.mac.tx_pkts, 1);
} else {

@ -50,7 +50,6 @@ char const * const prefixes[2][9] =
metrics_stdout::metrics_stdout()
:do_print(false)
,n_reports(10)
,metrics_report_period(1.0)
,ue(NULL)
{
}
@ -65,11 +64,7 @@ void metrics_stdout::toggle_print(bool b)
do_print = b;
}
void metrics_stdout::set_periodicity(float metrics_report_period_sec) {
this->metrics_report_period = metrics_report_period_sec;
}
void metrics_stdout::set_metrics(ue_metrics_t &metrics)
void metrics_stdout::set_metrics(ue_metrics_t &metrics, const uint32_t period_usec)
{
if(!do_print || ue == NULL)
return;
@ -92,7 +87,7 @@ void metrics_stdout::set_metrics(ue_metrics_t &metrics)
cout << float_to_string(metrics.phy.dl.mcs, 2);
cout << float_to_string(metrics.phy.dl.sinr, 2);
cout << float_to_string(metrics.phy.dl.turbo_iters, 2);
cout << float_to_eng_string((float) metrics.mac.rx_brate/metrics_report_period, 2);
cout << float_to_eng_string((float) metrics.mac.rx_brate/period_usec*1e6, 2);
if (metrics.mac.rx_pkts > 0) {
cout << float_to_string((float) 100*metrics.mac.rx_errors/metrics.mac.rx_pkts, 1) << "%";
} else {
@ -100,7 +95,7 @@ void metrics_stdout::set_metrics(ue_metrics_t &metrics)
}
cout << float_to_string(metrics.phy.ul.mcs, 2);
cout << float_to_eng_string((float) metrics.mac.ul_buffer, 2);
cout << float_to_eng_string((float) metrics.mac.tx_brate/metrics_report_period, 2);
cout << float_to_eng_string((float) metrics.mac.tx_brate/period_usec*1e6, 2);
if (metrics.mac.tx_pkts > 0) {
cout << float_to_string((float) 100*metrics.mac.tx_errors/metrics.mac.tx_pkts, 1) << "%";
} else {

Loading…
Cancel
Save