master
Xavier Arteaga 7 years ago
commit 9fbcf95367

@ -943,6 +943,7 @@ int main(int argc, char **argv) {
/* Configure pmch_cfg parameters */
srslte_ra_dl_grant_t grant;
grant.tb_en[0] = true;
grant.tb_en[1] = false;
grant.mcs[0].idx = 2;
grant.mcs[0].mod = SRSLTE_MOD_QPSK;
grant.nof_prb = cell.nof_prb;

@ -24,7 +24,7 @@ template<typename metrics_t>
class metrics_listener
{
public:
virtual void set_metrics(metrics_t &m, float report_period_secs=1.0) = 0;
virtual void set_metrics(metrics_t &m) = 0;
};
template<typename metrics_t>
@ -57,7 +57,7 @@ private:
bzero(&metric, sizeof(metrics_t));
m->get_metrics(metric);
for (uint32_t i=0;i<listeners.size();i++) {
listeners[i]->set_metrics(metric, report_period_secs);
listeners[i]->set_metrics(metric);
}
}
}

@ -80,8 +80,9 @@ typedef struct pcaprec_hdr_s {
#define MAC_LTE_UEID_TAG 0x03
/* 2 bytes, network order */
#define MAC_LTE_SUBFRAME_TAG 0x04
#define MAC_LTE_FRAME_SUBFRAME_TAG 0x04
/* 2 bytes, network order */
/* SFN is stored in 12 MSB and SF in 4 LSB */
#define MAC_LTE_PREDFINED_DATA_TAG 0x05
/* 1 byte */
@ -150,7 +151,7 @@ inline int MAC_LTE_PCAP_WritePDU(FILE *fd, MAC_Context_Info_t *context,
pcaprec_hdr_t packet_header;
char context_header[256];
int offset = 0;
unsigned short tmp16;
uint16_t tmp16;
/* Can't write if file wasn't successfully opened */
if (fd == NULL) {
@ -176,9 +177,11 @@ inline int MAC_LTE_PCAP_WritePDU(FILE *fd, MAC_Context_Info_t *context,
memcpy(context_header+offset, &tmp16, 2);
offset += 2;
/* Subframe number */
context_header[offset++] = MAC_LTE_SUBFRAME_TAG;
tmp16 = htons(context->subFrameNumber);
/* Subframe Number and System Frame Number */
/* SFN is stored in 12 MSB and SF in 4 LSB */
context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
tmp16 = (context->sysFrameNumber << 4) | context->subFrameNumber;
tmp16 = htons(tmp16);
memcpy(context_header+offset, &tmp16, 2);
offset += 2;

@ -38,10 +38,13 @@
#define RESAMPLE_ARB_
#include <stdint.h>
#include <stdbool.h>
#include <complex.h>
#include "srslte/config.h"
#define SRSLTE_RESAMPLE_ARB_N_35 35
#define SRSLTE_RESAMPLE_ARB_N 32 // Polyphase filter rows
#define SRSLTE_RESAMPLE_ARB_M 8 // Polyphase filter columns
@ -49,11 +52,13 @@ typedef struct SRSLTE_API {
float rate; // Resample rate
float step; // Step increment through filter
float acc; // Index into filter
bool interpolate;
cf_t reg[SRSLTE_RESAMPLE_ARB_M]; // Our window of samples
} srslte_resample_arb_t;
SRSLTE_API void srslte_resample_arb_init(srslte_resample_arb_t *q,
float rate);
float rate, bool interpolate);
SRSLTE_API int srslte_resample_arb_compute(srslte_resample_arb_t *q,
cf_t *input,

@ -163,6 +163,8 @@ private:
static const int reordering_timeout_id = 1;
static const int poll_periodicity = 8; // After how many data PDUs a status PDU shall be requested
// Timer checks
bool status_prohibited();
bool poll_retx();

@ -823,7 +823,7 @@ void rar_subh::write_subheader(uint8_t** ptr, bool is_last)
// Section 6.2.3
void rar_subh::write_payload(uint8_t** ptr)
{
*(*ptr + 0) = (uint8_t) (ta&0x7f0)>>4;
*(*ptr + 0) = (uint8_t) ((ta&0x7f0)>>4);
*(*ptr + 1) = (uint8_t) ((ta&0xf) <<4) | (grant[0]<<3) | (grant[1]<<2) | (grant[2]<<1) | grant[3];
uint8_t *x = &grant[4];
*(*ptr + 2) = (uint8_t) srslte_bit_pack(&x, 8);

@ -70,10 +70,6 @@ int srslte_enb_dl_init(srslte_enb_dl_t *q, cf_t *out_buffer[SRSLTE_MAX_PORTS], u
}
}
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) {
srslte_ofdm_set_normalize(&q->ifft[i], true);
}
if (srslte_pbch_init(&q->pbch)) {
fprintf(stderr, "Error creating PBCH object\n");
goto clean_exit;
@ -158,7 +154,7 @@ int srslte_enb_dl_set_cell(srslte_enb_dl_t *q, srslte_cell_t cell)
fprintf(stderr, "Error resizing REGs\n");
return SRSLTE_ERROR;
}
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) {
for (int i = 0; i < q->cell.nof_ports; i++) {
if (srslte_ofdm_tx_set_prb(&q->ifft[i], q->cell.cp, q->cell.nof_prb)) {
fprintf(stderr, "Error re-planning iFFT (%d)\n", i);
return SRSLTE_ERROR;
@ -279,7 +275,7 @@ void srslte_enb_dl_put_base(srslte_enb_dl_t *q, uint32_t tti)
void srslte_enb_dl_gen_signal(srslte_enb_dl_t *q)
{
// TODO: PAPR control
float norm_factor = (float) sqrt(q->cell.nof_prb)/15;
float norm_factor = (float) sqrt(q->cell.nof_prb)/15/sqrt(q->ifft[0].symbol_sz);
for (int i = 0; i < q->cell.nof_ports; i++) {
srslte_ofdm_tx_sf(&q->ifft[i]);

@ -1454,7 +1454,7 @@ int srslte_predecoding_type_multi(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_
return srslte_predecoding_single_multi(y, h[0], x[0], nof_rxant, nof_symbols, noise_estimate);
} else {
fprintf(stderr,
"Number of ports and layers must be 1 for transmission on single antenna ports\n");
"Number of ports and layers must be 1 for transmission on single antenna ports (%d, %d)\n", nof_ports, nof_layers);
return -1;
}
break;

@ -32,6 +32,7 @@
#include <stdbool.h>
#include <assert.h>
#include <math.h>
#include <srslte/phy/phch/ra.h>
#include "srslte/phy/phch/dci.h"
#include "srslte/phy/common/phy_common.h"
@ -1160,6 +1161,31 @@ int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
data->pinfo = srslte_bit_pack(&y, precoding_bits_f2a(nof_ports));
}
// Table 5.3.3.1.5-1
if (SRSLTE_RA_DL_GRANT_NOF_TB(data) == 2) {
if (data->tb_cw_swap) {
uint32_t tmp = data->rv_idx;
data->rv_idx = data->rv_idx_1;
data->rv_idx_1 = tmp;
tmp = data->mcs_idx;
data->mcs_idx = data->mcs_idx_1;
data->mcs_idx_1 = tmp;
bool tmp_ndi = data->ndi;
data->ndi = data->ndi_1;
data->ndi_1 = tmp_ndi;
}
}
// Table 5.3.3.1.5-2
if (!data->tb_en[0]) {
data->rv_idx = data->rv_idx_1;
data->mcs_idx = data->mcs_idx_1;
data->ndi = data->ndi_1;
data->tb_en[1] = false;
}
return SRSLTE_SUCCESS;
}

@ -546,6 +546,7 @@ static int dl_dci_to_grant_mcs(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *gr
}
}
grant->pinfo = dci->pinfo;
grant->tb_cw_swap = dci->tb_cw_swap;
if (grant->mcs[0].tbs < 0 || grant->mcs[1].tbs < 0) {
return SRSLTE_ERROR;

@ -458,12 +458,12 @@ static int decode_tb(srslte_sch_t *q,
if (cb_segm->F) {
fprintf(stderr, "Error filler bits are not supported. Use standard TBS\n");
return SRSLTE_ERROR;
return SRSLTE_ERROR_INVALID_INPUTS;
}
if (cb_segm->C > softbuffer->max_cb) {
fprintf(stderr, "Error number of CB (%d) exceeds soft buffer size (%d CBs)\n", cb_segm->C, softbuffer->max_cb);
return SRSLTE_ERROR;
return SRSLTE_ERROR_INVALID_INPUTS;
}
bool crc_ok = true;
@ -517,15 +517,15 @@ int srslte_dlsch_decode(srslte_sch_t *q, srslte_pdsch_cfg_t *cfg, srslte_softbuf
int srslte_dlsch_decode2(srslte_sch_t *q, srslte_pdsch_cfg_t *cfg, srslte_softbuffer_rx_t *softbuffer,
int16_t *e_bits, uint8_t *data, int codeword_idx) {
int16_t *e_bits, uint8_t *data, int tb_idx) {
uint32_t Nl = 1;
if (cfg->nof_layers != SRSLTE_RA_DL_GRANT_NOF_TB(&cfg->grant)) {
Nl = 2;
}
return decode_tb(q, softbuffer, &cfg->cb_segm[codeword_idx],
cfg->grant.Qm[codeword_idx] * Nl, cfg->rv[codeword_idx], cfg->nbits[codeword_idx].nof_bits,
return decode_tb(q, softbuffer, &cfg->cb_segm[tb_idx],
cfg->grant.Qm[tb_idx] * Nl, cfg->rv[tb_idx], cfg->nbits[tb_idx].nof_bits,
e_bits, data);
}
@ -546,15 +546,15 @@ int srslte_dlsch_encode(srslte_sch_t *q, srslte_pdsch_cfg_t *cfg, srslte_softbuf
}
int srslte_dlsch_encode2(srslte_sch_t *q, srslte_pdsch_cfg_t *cfg, srslte_softbuffer_tx_t *softbuffer,
uint8_t *data, uint8_t *e_bits, int codeword_idx) {
uint8_t *data, uint8_t *e_bits, int tb_idx) {
uint32_t Nl = 1;
if (cfg->nof_layers != SRSLTE_RA_DL_GRANT_NOF_TB(&cfg->grant)) {
Nl = 2;
}
return encode_tb(q, softbuffer, &cfg->cb_segm[codeword_idx], cfg->grant.Qm[codeword_idx]*Nl, cfg->rv[codeword_idx],
cfg->nbits[codeword_idx].nof_bits, data, e_bits);
return encode_tb(q, softbuffer, &cfg->cb_segm[tb_idx], cfg->grant.Qm[tb_idx]*Nl, cfg->rv[tb_idx],
cfg->nbits[tb_idx].nof_bits, data, e_bits);
}
/* Compute the interleaving function on-the-fly, because it depends on number of RI bits

@ -119,6 +119,14 @@ add_test(pdsch_test_multiplex1cw_p0_50 pdsch_test -x multiplex -a 2 -p 0 -n 50)
add_test(pdsch_test_multiplex1cw_p0_75 pdsch_test -x multiplex -a 2 -p 0 -n 75)
add_test(pdsch_test_multiplex1cw_p0_100 pdsch_test -x multiplex -a 2 -p 0 -n 100)
# PDSCH test for Spatial Multiplex transmision mode with PMI = 0 (1 codeword, swapped)
add_test(pdsch_test_multiplex1cw_p0_6_swap pdsch_test -x multiplex -a 2 -p 0 -m 0 -r 1 -M 28 -t 0 -n 6 -F 1)
add_test(pdsch_test_multiplex1cw_p0_15_swap pdsch_test -x multiplex -a 2 -p 0 -m 0 -r 1 -M 28 -t 0 -n 15)
add_test(pdsch_test_multiplex1cw_p0_25_swap pdsch_test -x multiplex -a 2 -p 0 -m 0 -r 1 -M 28 -t 0 -n 25)
add_test(pdsch_test_multiplex1cw_p0_50_swap pdsch_test -x multiplex -a 2 -p 0 -m 0 -r 1 -M 28 -t 0 -n 50)
add_test(pdsch_test_multiplex1cw_p0_75_swap pdsch_test -x multiplex -a 2 -p 0 -m 0 -r 1 -M 28 -t 0 -n 75)
add_test(pdsch_test_multiplex1cw_p0_100_swap pdsch_test -x multiplex -a 2 -p 0 -m 0 -r 1 -M 28 -t 0 -n 100)
# PDSCH test for Spatial Multiplex transmision mode with PMI = 1 (1 codeword)
add_test(pdsch_test_multiplex1cw_p1_6 pdsch_test -x multiplex -a 2 -p 1 -n 6)
add_test(pdsch_test_multiplex1cw_p1_12 pdsch_test -x multiplex -a 2 -p 1 -n 12)
@ -151,6 +159,14 @@ add_test(pdsch_test_multiplex2cw_p0_50 pdsch_test -x multiplex -a 2 -t 0 -p 0 -
add_test(pdsch_test_multiplex2cw_p0_75 pdsch_test -x multiplex -a 2 -t 0 -p 0 -n 75)
add_test(pdsch_test_multiplex2cw_p0_100 pdsch_test -x multiplex -a 2 -t 0 -p 0 -n 100)
# PDSCH test for Spatial Multiplex transmision mode with PMI = 0 (2 codeword, swapped)
add_test(pdsch_test_multiplex2cw_p0_6_swap pdsch_test -x multiplex -a 2 -t 0 -p 0 -M 28 -n 6 -w -F 1)
add_test(pdsch_test_multiplex2cw_p0_12_swap pdsch_test -x multiplex -a 2 -t 0 -p 0 -m 28 -n 12 -w)
add_test(pdsch_test_multiplex2cw_p0_25_swap pdsch_test -x multiplex -a 2 -t 0 -p 0 -M 28 -n 25 -w)
add_test(pdsch_test_multiplex2cw_p0_50_swap pdsch_test -x multiplex -a 2 -t 0 -p 0 -m 28 -n 50 -w)
add_test(pdsch_test_multiplex2cw_p0_75_swap pdsch_test -x multiplex -a 2 -t 0 -p 0 -M 28 -n 75 -w)
add_test(pdsch_test_multiplex2cw_p0_100_swap pdsch_test -x multiplex -a 2 -t 0 -p 0 -m 28 -n 100 -w)
# PDSCH test for Spatial Multiplex transmision mode with PMI = 1 (2 codeword)
add_test(pdsch_test_multiplex2cw_p1_6 pdsch_test -x multiplex -a 2 -t 0 -p 1 -n 6)
add_test(pdsch_test_multiplex2cw_p1_12 pdsch_test -x multiplex -a 2 -t 0 -p 1 -n 12)

@ -59,6 +59,7 @@ uint32_t subframe = 1;
int rv_idx[SRSLTE_MAX_CODEWORDS] = {0, 1};
uint16_t rnti = 1234;
uint32_t nof_rx_antennas = 1;
bool tb_cw_swap = false;
uint32_t pmi = 0;
char *input_file = NULL;
@ -77,12 +78,13 @@ void usage(char *prog) {
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-p pmi (multiplex only) [Default %d]\n", pmi);
printf("\t-w Swap Transport Blocks\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, "fmMcsrtRFpnavx")) != -1) {
while ((opt = getopt(argc, argv, "fmMcsrtRFpnawvx")) != -1) {
switch(opt) {
case 'f':
input_file = argv[optind];
@ -123,6 +125,9 @@ void parse_args(int argc, char **argv) {
case 'a':
nof_rx_antennas = (uint32_t) atoi(argv[optind]);
break;
case 'w':
tb_cw_swap = true;
break;
case 'v':
srslte_verbose++;
break;
@ -207,6 +212,11 @@ int main(int argc, char **argv) {
dci.tb_en[1] = true;
}
/* Enable swap */
if (SRSLTE_RA_DL_GRANT_NOF_TB(&dci) == SRSLTE_MAX_TB && tb_cw_swap) {
dci.tb_cw_swap = tb_cw_swap;
}
/* Generate grant from DCI */
if (srslte_ra_dl_dci_to_grant(&dci, cell.nof_prb, rnti, &grant)) {
fprintf(stderr, "Error computing resource allocation\n");
@ -255,7 +265,7 @@ int main(int argc, char **argv) {
}
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
for (i = 0; i < SRSLTE_MAX_TB; i++) {
if (grant.tb_en[i]) {
data_tx[i] = srslte_vec_malloc(sizeof(uint8_t) * grant.mcs[i].tbs);
if (!data_tx[i]) {
@ -271,6 +281,9 @@ int main(int argc, char **argv) {
}
bzero(data_rx[i], sizeof(uint8_t) * grant.mcs[i].tbs);
} else {
data_tx[i] = NULL;
data_rx[i] = NULL;
}
}

@ -28,64 +28,104 @@
#include <string.h>
#include "srslte/phy/resampling/resample_arb.h"
#include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
float srslte_resample_arb_polyfilt[SRSLTE_RESAMPLE_ARB_N][SRSLTE_RESAMPLE_ARB_M] =
{{0,0.002400347599485495,-0.006922416132556366,0.0179104136912176,0.99453086623794,-0.008521087756729117,0.0008598969867484128,0.0004992625165376107},
{-0.001903604727400391,0.004479591950094871,-0.01525319260830623,0.04647449496926549,0.9910477342662829,-0.03275243420114668,0.008048813755373533,-0.001216900416836847},
{-0.001750442300940216,0.006728826416921727,-0.02407540632178267,0.07708575473589654,0.9841056525667189,-0.05473739187922162,0.01460652754040275,-0.002745266140572769},
{-0.001807302702047332,0.009130494591071001,-0.03332524241797466,0.1096377743266821,0.9737536341125557,-0.07444712408657775,0.0205085154280773,-0.004077596041064956},
{-0.002005048395707184,0.01166717081713966,-0.04292591596219218,0.1440068251440274,0.9600641782991848,-0.09187282739868929,0.02573649090563353,-0.005218582609802016},
{-0.002303606593778858,0.01431549924598744,-0.05279365431190471,0.1800496557331084,0.9431333663677619,-0.107022659158021,0.03028295984887362,-0.006178495199082676},
{-0.002673824939871474,0.01705308556587308,-0.06283262272105428,0.2176066284621515,0.9230793648715676,-0.1199244901666642,0.03414559686566755,-0.006951034565279722},
{-0.003099294850834212,0.01985022208215894,-0.07294100481214681,0.2564996326404178,0.9000412628278351,-0.1306207218667012,0.03733448898243594,-0.007554128492547957},
{-0.003564415127592977,0.02267702927238637,-0.08300660359189582,0.2965368855416621,0.874178327911914,-0.1391710078036285,0.03986356581130199,-0.007992692892036229},
{-0.004060222849803048,0.02549633298710617,-0.09291211362877161,0.3375102453232687,0.8456688916962831,-0.1456479420005528,0.04175429631970297,-0.00827816851803391},
{-0.004574770330592958,0.02827133859849648,-0.1025308044303699,0.379200979038518,0.8147072909915275,-0.1501397816831265,0.04303284689167361,-0.008423951215857236},
{-0.005100453570725489,0.0309593063669097,-0.1117325201826136,0.4213772298764557,0.7815036335229155,-0.1527444636485677,0.0437349357738538,-0.008441129184587313},
{-0.005625340687997995,0.03351877124912608,-0.1203802123857154,0.463798444519773,0.7462810500374923,-0.1535722712206338,0.04389261707032224,-0.008345136869130621},
{-0.006140888413286479,0.03590276234084221,-0.1283350405000867,0.5062161107254219,0.7092744343987509,-0.152741400055636,0.04355110899623683,-0.008147838953503964},
{-0.006634012711933725,0.03806645580467819,-0.1354549138065051,0.5483763739419955,0.6707272107491931,-0.1503798528838644,0.0427502160096194,-0.007865132034489236},
{-0.007094909626785393,0.03996043743797257,-0.1415969539549883,0.5900207719663111,0.6308907308946271,-0.1466186670140106,0.04153829696698895,-0.007508971112586246},
{-0.007508971112586246,0.04153829696698895,-0.1466186670140106,0.6308907308946271,0.5900207719663111,-0.1415969539549883,0.03996043743797257,-0.007094909626785393},
{-0.007865132034489236,0.0427502160096194,-0.1503798528838644,0.6707272107491931,0.5483763739419955,-0.1354549138065051,0.03806645580467819,-0.006634012711933725},
{-0.008147838953503964,0.04355110899623683,-0.152741400055636,0.7092744343987509,0.5062161107254219,-0.1283350405000867,0.03590276234084221,-0.006140888413286479},
{-0.008345136869130621,0.04389261707032224,-0.1535722712206338,0.7462810500374923,0.463798444519773,-0.1203802123857154,0.03351877124912608,-0.005625340687997995},
{-0.008441129184587313,0.0437349357738538,-0.1527444636485677,0.7815036335229155,0.4213772298764557,-0.1117325201826136,0.0309593063669097,-0.005100453570725489},
{-0.008423951215857236,0.04303284689167361,-0.1501397816831265,0.8147072909915275,0.379200979038518,-0.1025308044303699,0.02827133859849648,-0.004574770330592958},
{-0.00827816851803391,0.04175429631970297,-0.1456479420005528,0.8456688916962831,0.3375102453232687,-0.09291211362877161,0.02549633298710617,-0.004060222849803048},
{-0.007992692892036229,0.03986356581130199,-0.1391710078036285,0.874178327911914,0.2965368855416621,-0.08300660359189582,0.02267702927238637,-0.003564415127592977},
{-0.007554128492547957,0.03733448898243594,-0.1306207218667012,0.9000412628278351,0.2564996326404178,-0.07294100481214681,0.01985022208215894,-0.003099294850834212},
{-0.006951034565279722,0.03414559686566755,-0.1199244901666642,0.9230793648715676,0.2176066284621515,-0.06283262272105428,0.01705308556587308,-0.002673824939871474},
{-0.006178495199082676,0.03028295984887362,-0.107022659158021,0.9431333663677619,0.1800496557331084,-0.05279365431190471,0.01431549924598744,-0.002303606593778858},
{-0.005218582609802016,0.02573649090563353,-0.09187282739868929,0.9600641782991848,0.1440068251440274,-0.04292591596219218,0.01166717081713966,-0.002005048395707184},
{-0.004077596041064956,0.0205085154280773,-0.07444712408657775,0.9737536341125557,0.1096377743266821,-0.03332524241797466,0.009130494591071001,-0.001807302702047332},
{-0.002745266140572769,0.01460652754040275,-0.05473739187922162,0.9841056525667189,0.07708575473589654,-0.02407540632178267,0.006728826416921727,-0.001750442300940216},
{-0.001216900416836847,0.008048813755373533,-0.03275243420114668,0.9910477342662829,0.04647449496926549,-0.01525319260830623,0.004479591950094871,-0.001903604727400391},
{0.0004992625165376107,0.0008598969867484128,-0.008521087756729117,0.99453086623794,0.0179104136912176,-0.006922416132556366,0.002400347599485495,0}};
// TODO: use lte/utils/vector.h and Volk
cf_t srslte_resample_arb_dot_prod(cf_t* x, float *y, int len)
{
cf_t res = 0+0*I;
for(int i=0;i<len;i++){
res += x[i]*y[i];
}
return res;
float srslte_resample_arb_polyfilt[SRSLTE_RESAMPLE_ARB_N][SRSLTE_RESAMPLE_ARB_M] __attribute__((aligned(256))) =
{{0.000499262532685, 0.000859897001646, -0.008521087467670, 0.994530856609344, 0.017910413444042, -0.006922415923327, 0.002400347497314, 0.000000000000000 },
{-0.001216900418513, 0.008048813790083, -0.032752435654402, 0.991047739982605, 0.046474494040012, -0.015253192745149, 0.004479591734707, -0.001903604716063 },
{-0.002745266072452, 0.014606527984142, -0.054737392812967, 0.984105646610260, 0.077085755765438, -0.024075405672193, 0.006728826556355, -0.001750442315824 },
{-0.004077596124262, 0.020508514717221, -0.074447125196457, 0.973753631114960, 0.109637774527073, -0.033325243741274, 0.009130494669080, -0.001807302702218 },
{-0.005218582693487, 0.025736490264535, -0.091872826218605, 0.960064172744751, 0.144006818532944, -0.042925916612148, 0.011667170561850, -0.002005048329011 },
{-0.006178495008498, 0.030282959342003, -0.107022657990456, 0.943133354187012, 0.180049657821655, -0.052793655544519, 0.014315498992801, -0.002303606597707 },
{-0.006951034534723, 0.034145597368479, -0.119924493134022, 0.923079371452332, 0.217606633901596, -0.062832623720169, 0.017053086310625, -0.002673825016245 },
{-0.007554128300399, 0.037334490567446, -0.130620718002319, 0.900041282176971, 0.256499618291855, -0.072941005229950, 0.019850222393870, -0.003099294845015 },
{-0.007992693223059, 0.039863564074039, -0.139171004295349, 0.874178349971771, 0.296536892652512, -0.083006605505943, 0.022677028551698, -0.003564415033907 },
{-0.008278168737888, 0.041754297912121, -0.145647943019867, 0.845668911933899, 0.337510257959366, -0.092912115156651, 0.025496333837509, -0.004060222767293 },
{-0.008423951454461, 0.043032847344875, -0.150139778852463, 0.814707279205322, 0.379200965166092, -0.102530807256699, 0.028271337971091, -0.004574770107865 },
{-0.008441128768027, 0.043734934180975, -0.152744457125664, 0.781503617763519, 0.421377241611481, -0.111732520163059, 0.030959306284785, -0.005100453738123 },
{-0.008345136418939, 0.043892618268728, -0.153572276234627, 0.746281027793884, 0.463798433542252, -0.120380215346813, 0.033518772572279, -0.005625340621918 },
{-0.008147838525474, 0.043551109731197, -0.152741402387619, 0.709274411201477, 0.506216108798981, -0.128335043787956, 0.035902760922909, -0.006140888202935 },
{-0.007865131832659, 0.042750217020512, -0.150379851460457, 0.670727193355560, 0.548376381397247, -0.135454908013344, 0.038066454231739, -0.006634012795985 },
{-0.007508971262723, 0.041538298130035, -0.146618664264679, 0.630890727043152, 0.590020775794983, -0.141596958041191, 0.039960436522961, -0.007094909437001 },
{-0.007094909437001, 0.039960436522961, -0.141596958041191, 0.590020775794983, 0.630890727043152, -0.146618664264679, 0.041538298130035, -0.007508971262723 },
{-0.006634012795985, 0.038066454231739, -0.135454908013344, 0.548376381397247, 0.670727193355560, -0.150379851460457, 0.042750217020512, -0.007865131832659 },
{-0.006140888202935, 0.035902760922909, -0.128335043787956, 0.506216108798981, 0.709274411201477, -0.152741402387619, 0.043551109731197, -0.008147838525474 },
{-0.005625340621918, 0.033518772572279, -0.120380215346813, 0.463798433542252, 0.746281027793884, -0.153572276234627, 0.043892618268728, -0.008345136418939 },
{-0.005100453738123, 0.030959306284785, -0.111732520163059, 0.421377241611481, 0.781503617763519, -0.152744457125664, 0.043734934180975, -0.008441128768027 },
{-0.004574770107865, 0.028271337971091, -0.102530807256699, 0.379200965166092, 0.814707279205322, -0.150139778852463, 0.043032847344875, -0.008423951454461 },
{-0.004060222767293, 0.025496333837509, -0.092912115156651, 0.337510257959366, 0.845668911933899, -0.145647943019867, 0.041754297912121, -0.008278168737888 },
{-0.003564415033907, 0.022677028551698, -0.083006605505943, 0.296536892652512, 0.874178349971771, -0.139171004295349, 0.039863564074039, -0.007992693223059 },
{-0.003099294845015, 0.019850222393870, -0.072941005229950, 0.256499618291855, 0.900041282176971, -0.130620718002319, 0.037334490567446, -0.007554128300399 },
{-0.002673825016245, 0.017053086310625, -0.062832623720169, 0.217606633901596, 0.923079371452332, -0.119924493134022, 0.034145597368479, -0.006951034534723 },
{-0.002303606597707, 0.014315498992801, -0.052793655544519, 0.180049657821655, 0.943133354187012, -0.107022657990456, 0.030282959342003, -0.006178495008498 },
{-0.002005048329011, 0.011667170561850, -0.042925916612148, 0.144006818532944, 0.960064172744751, -0.091872826218605, 0.025736490264535, -0.005218582693487 },
{-0.001807302702218, 0.009130494669080, -0.033325243741274, 0.109637774527073, 0.973753631114960, -0.074447125196457, 0.020508514717221, -0.004077596124262 },
{-0.001750442315824, 0.006728826556355, -0.024075405672193, 0.077085755765438, 0.984105646610260, -0.054737392812967, 0.014606527984142, -0.002745266072452 },
{-0.001903604716063, 0.004479591734707, -0.015253192745149, 0.046474494040012, 0.991047739982605, -0.032752435654402, 0.008048813790083, -0.001216900418513 },
{0.000000000000000, 0.002400347497314, -0.006922415923327, 0.017910413444042, 0.994530856609344, -0.008521087467670, 0.000859897001646, 0.000499262532685 }};
float srslte_resample_arb_polyfilt_35[SRSLTE_RESAMPLE_ARB_N_35][SRSLTE_RESAMPLE_ARB_M] __attribute__((aligned(256))) =
{{0.000002955485215, 0.000657994314549, -0.033395686652146, 0.188481383863832, 0.704261032406613, 0.171322660416961, -0.032053439082436, 0.000722236729272},
{0.000003596427925, 0.000568080243211, -0.034615802155152, 0.206204344739138, 0.702921418438421, 0.154765509342932, -0.030612377229395, 0.000764085430796},
{0.000005121937258, 0.000449039680445, -0.035689076986744, 0.224449928603191, 0.700248311996698, 0.138842912406449, -0.029094366813032, 0.000786624971348},
{0.000007718609465, 0.000297261794949, -0.036589488825594, 0.243172347408947, 0.696253915778072, 0.123583456372980, -0.027519775698206, 0.000792734165095},
{0.000011575047600, 0.000109005258838, -0.037289794881918, 0.262321777662990, 0.690956433427623, 0.109011322456059, -0.025907443019580, 0.000785077624893},
{0.000016882508098, -0.000119571475197, -0.037761641428480, 0.281844530653151, 0.684379949985066, 0.095146306185631, -0.024274662580170, 0.000766100891437},
{0.000023834849457, -0.000392374989948, -0.037975689603840, 0.301683254255907, 0.676554274013489, 0.082003866618022, -0.022637179782782, 0.000738028846774},
{0.000032627688404, -0.000713336731203, -0.037901757319987, 0.321777165554580, 0.667514742706306, 0.069595203590358, -0.021009201268519, 0.000702867092175},
{0.000043456678971, -0.001086367817537, -0.037508976943232, 0.342062313218325, 0.657301991568526, 0.057927361522269, -0.019403416364306, 0.000662405963124},
{0.000056514841640, -0.001515308860252, -0.036765968249551, 0.362471868314761, 0.645961690553484, 0.047003358086968, -0.017831029382043, 0.000618226851332},
{0.000071988882997, -0.002003874882511, -0.035641025985104, 0.382936441958648, 0.633544248803284, 0.036822335913581, -0.016301801765629, 0.000571710504985},
{0.000090054461223, -0.002555595491550, -0.034102321191048, 0.403384427938144, 0.620104490387788, 0.027379735343965, -0.014824103048525, 0.000524046983526},
{0.000110870369116, -0.003173750525766, -0.032118115280935, 0.423742368211529, 0.605701303660781, 0.018667486151043, -0.013404969563367, 0.000476246951838},
{0.000134571624077, -0.003861301468941, -0.029656985690720, 0.443935338933583, 0.590397267050922, 0.010674216032341, -0.012050169836157, 0.000429154010367},
{0.000161261473605, -0.004620818996097, -0.026688061757620, 0.463887354454611, 0.574258254277514, 0.003385473622292, -0.010764275599988, 0.000383457772129},
{0.000191002345063, -0.005454407088752, -0.023181269326746, 0.483521786538780, 0.557353022125450, -0.003216036280022, -0.009550737376604, 0.000339707414324},
{0.000223805789820, -0.006363624230896, -0.019107582435436, 0.502761795874207, 0.539752784028766, -0.009150207594916, -0.008411963597610, 0.000298325451050},
{0.000259621494011, -0.007349402269867, -0.014439280286493, 0.521530772797177, 0.521530772797177, -0.014439280286493, -0.007349402269867, 0.000259621494011},
{0.000298325451050, -0.008411963597610, -0.009150207594916, 0.539752784028765, 0.502761795874207, -0.019107582435436, -0.006363624230896, 0.000223805789820},
{0.000339707414324, -0.009550737376604, -0.003216036280022, 0.557353022125450, 0.483521786538780, -0.023181269326746, -0.005454407088752, 0.000191002345063},
{0.000383457772129, -0.010764275599988, 0.003385473622292, 0.574258254277514, 0.463887354454611, -0.026688061757620, -0.004620818996097, 0.000161261473605},
{0.000429154010367, -0.012050169836157, 0.010674216032341, 0.590397267050922, 0.443935338933583, -0.029656985690720, -0.003861301468941, 0.000134571624077},
{0.000476246951838, -0.013404969563367, 0.018667486151043, 0.605701303660781, 0.423742368211529, -0.032118115280935, -0.003173750525766, 0.000110870369116},
{0.000524046983526, -0.014824103048525, 0.027379735343965, 0.620104490387787, 0.403384427938144, -0.034102321191048, -0.002555595491550, 0.000090054461223},
{0.000571710504985, -0.016301801765629, 0.036822335913581, 0.633544248803283, 0.382936441958648, -0.035641025985104, -0.002003874882511, 0.000071988882997},
{0.000618226851332, -0.017831029382043, 0.047003358086968, 0.645961690553484, 0.362471868314761, -0.036765968249551, -0.001515308860252, 0.000056514841640},
{0.000662405963124, -0.019403416364306, 0.057927361522269, 0.657301991568526, 0.342062313218325, -0.037508976943232, -0.001086367817537, 0.000043456678971},
{0.000702867092175, -0.021009201268519, 0.069595203590358, 0.667514742706306, 0.321777165554580, -0.037901757319987, -0.000713336731203, 0.000032627688404},
{0.000738028846774, -0.022637179782782, 0.082003866618022, 0.676554274013489, 0.301683254255907, -0.037975689603840, -0.000392374989948, 0.000023834849457},
{0.000766100891437, -0.024274662580170, 0.095146306185631, 0.684379949985066, 0.281844530653151, -0.037761641428480, -0.000119571475197, 0.000016882508098},
{0.000785077624893, -0.025907443019580, 0.109011322456059, 0.690956433427623, 0.262321777662990, -0.037289794881918, 0.000109005258838, 0.000011575047600},
{0.000792734165095, -0.027519775698206, 0.123583456372980, 0.696253915778072, 0.243172347408947, -0.036589488825594, 0.000297261794949, 0.000007718609465},
{0.000786624971348, -0.029094366813032, 0.138842912406449, 0.700248311996698, 0.224449928603191, -0.035689076986744, 0.000449039680445, 0.000005121937258},
{0.000764085430796, -0.030612377229395, 0.154765509342932, 0.702921418438421, 0.206204344739138, -0.034615802155152, 0.000568080243211, 0.000003596427925},
{0.000722236729272, -0.032053439082436, 0.171322660416961, 0.704261032406613, 0.188481383863832, -0.033395686652146, 0.000657994314549 , 0.000002955485215}};
static inline cf_t srslte_resample_arb_dot_prod(cf_t* x, float *y, int len){
cf_t res1 = srslte_vec_dot_prod_cfc(x,y,len);
return res1;
}
// Right-shift our window of samples
void srslte_resample_arb_push(srslte_resample_arb_t *q, cf_t x)
{
void srslte_resample_arb_push(srslte_resample_arb_t *q, cf_t x){
memmove(&q->reg[1], &q->reg[0], (SRSLTE_RESAMPLE_ARB_M-1)*sizeof(cf_t));
q->reg[0] = x;
}
// Initialize our struct
void srslte_resample_arb_init(srslte_resample_arb_t *q, float rate){
void srslte_resample_arb_init(srslte_resample_arb_t *q, float rate, bool interpolate){
memset(q->reg, 0, SRSLTE_RESAMPLE_ARB_M*sizeof(cf_t));
q->acc = 0.0;
q->rate = rate;
q->interpolate = interpolate;
q->step = (1/rate)*SRSLTE_RESAMPLE_ARB_N;
}
@ -94,19 +134,48 @@ int srslte_resample_arb_compute(srslte_resample_arb_t *q, cf_t *input, cf_t *out
int cnt = 0;
int n_out = 0;
int idx = 0;
cf_t res1,res2;
cf_t *filter_input;
float frac = 0;
memset(q->reg, 0, SRSLTE_RESAMPLE_ARB_M*sizeof(cf_t));
while (cnt < n_in) {
if(cnt<SRSLTE_RESAMPLE_ARB_M){
memcpy(&q->reg[SRSLTE_RESAMPLE_ARB_M - cnt], input, (cnt)*sizeof(cf_t));
filter_input = q->reg;
} else{
filter_input = &input[cnt-SRSLTE_RESAMPLE_ARB_M];
}
res1 = srslte_resample_arb_dot_prod(filter_input, srslte_resample_arb_polyfilt[idx], SRSLTE_RESAMPLE_ARB_M);
if(q->interpolate){
res2 = srslte_resample_arb_dot_prod(filter_input, srslte_resample_arb_polyfilt[(idx%SRSLTE_RESAMPLE_ARB_N)+1], SRSLTE_RESAMPLE_ARB_M);
}
if(idx == SRSLTE_RESAMPLE_ARB_N){
*output = res1;
}else {
*output = (q->interpolate)?(res1 + (res2-res1)*frac):res1;
}
while(cnt < n_in)
{
*output = srslte_resample_arb_dot_prod(q->reg, srslte_resample_arb_polyfilt[idx], SRSLTE_RESAMPLE_ARB_M);
output++;
n_out++;
q->acc += q->step;
idx = (int)roundf(q->acc);
idx = (int)(q->acc);
while(idx >= SRSLTE_RESAMPLE_ARB_N){
q->acc -= SRSLTE_RESAMPLE_ARB_N;
idx -= SRSLTE_RESAMPLE_ARB_N;
if(cnt < n_in)
srslte_resample_arb_push(q, input[cnt++]);
if(cnt < n_in){
cnt++;
}
}
if(q->interpolate){
frac = q->acc - idx;
if(frac < 0)
frac = frac*(-1);
}
}
return n_out;

@ -35,9 +35,9 @@
#include "srslte/phy/resampling/resample_arb.h"
#define ITERATIONS 10000
int main(int argc, char **argv) {
int N=10000000;
int N=9000;
float rate = 24.0/25.0;
cf_t *in = malloc(N*sizeof(cf_t));
cf_t *out = malloc(N*sizeof(cf_t));
@ -46,12 +46,15 @@ int main(int argc, char **argv) {
in[i] = sin(i*2*M_PI/100);
srslte_resample_arb_t r;
srslte_resample_arb_init(&r, rate);
srslte_resample_arb_init(&r, rate, 0);
clock_t start = clock(), diff;
//int n_out = srslte_resample_arb_compute(&r, in, out, N);
for(int xx = 0; xx<ITERATIONS;xx++){
int n_out = srslte_resample_arb_compute(&r, in, out, N);
}
diff = clock() - start;
diff = diff/ITERATIONS;
int msec = diff * 1000 / CLOCKS_PER_SEC;
float thru = (CLOCKS_PER_SEC/(float)diff)*(N/1e6);
printf("Time taken %d seconds %d milliseconds\n", msec/1000, msec%1000);

@ -35,12 +35,14 @@
#include "srslte/phy/resampling/resample_arb.h"
int main(int argc, char **argv) {
int N = 100; // Number of sinwave samples
int delay = 5; // Delay of our resampling filter
float down = 25.0; // Downsampling rate
for(int up=1;up<down;up++)
{
float rate = up/down;
@ -62,7 +64,7 @@ int main(int argc, char **argv) {
// Resample
srslte_resample_arb_t r;
srslte_resample_arb_init(&r, rate);
srslte_resample_arb_init(&r, rate, 0);
int n_out = srslte_resample_arb_compute(&r, in, out, N);
// Check interp values
@ -74,12 +76,11 @@ int main(int argc, char **argv) {
float diff = fabs(creal(in[pre])-creal(in[post]));
float diff2 = fabs(creal(out[i])-creal(in[round]));
if(diff2 > diff && pre != post){
printf("Interpolation failed at index %f", idx);
printf("Interpolation failed at index %f\n", idx);
exit(-1);
}
}
free(in);
free(out);
}

@ -38,6 +38,7 @@
#include <SoapySDR/Formats.h>
typedef struct {
char *devname;
SoapySDRKwargs args;
SoapySDRDevice *device;
SoapySDRRange *ranges;
@ -51,7 +52,6 @@ typedef struct {
cf_t zero_mem[64*1024];
int soapy_error(void *h)
{
return 0;
@ -90,7 +90,8 @@ void rf_soapy_register_error_handler(void *notused, srslte_rf_error_handler_t ne
char* rf_soapy_devname(void* h)
{
return "soapy";
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
return handler->devname;
}
@ -196,11 +197,15 @@ 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;
for (size_t i = 0; i < length; 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");
}
@ -218,7 +223,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
handler->device = sdr;
handler->tx_stream_active = false;
handler->rx_stream_active = false;
handler->devname = devname;
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){
printf("setting up RX stream\n");
if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
@ -234,6 +239,14 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
return SRSLTE_ERROR;
}
}
size_t sensor_length;
char** sensors;
sensors = SoapySDRDevice_listSensors(handler->device, &sensor_length);
for(int i = 0; i < sensor_length;i++)
{
printf("available sensors are : \n");
puts(sensors[i]);
}
return SRSLTE_SUCCESS;
}
@ -267,7 +280,7 @@ int rf_soapy_close(void *h)
void rf_soapy_set_master_clock_rate(void *h, double rate)
{
// Allow the soapy to automatically set the appropriate clock rate
// TODO: implement this function
}
@ -285,12 +298,6 @@ double rf_soapy_set_rx_srate(void *h, double rate)
printf("setSampleRate Rx fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
if (SoapySDRDevice_setBandwidth(handler->device, SOAPY_SDR_RX, 0, rate) != 0) {
printf("setBandwidth Rx failed: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
return SoapySDRDevice_getSampleRate(handler->device, SOAPY_SDR_RX,0);
}
@ -301,12 +308,6 @@ double rf_soapy_set_tx_srate(void *h, double rate)
printf("setSampleRate Tx fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
if (SoapySDRDevice_setBandwidth(handler->device, SOAPY_SDR_TX, 0, rate) != 0) {
printf("setBandwidth Tx failed: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
return SoapySDRDevice_getSampleRate(handler->device, SOAPY_SDR_TX,0);
}

@ -28,7 +28,7 @@
#include <stdint.h>
#include "srslte/config.h"
#include "srslte/phy/rf/rf.h"
#define DEVNAME_LIME "lime"
SRSLTE_API int rf_soapy_open(char *args,
void **handler);

@ -59,6 +59,7 @@ bool radio::init(char *args, char *devname, uint32_t nof_channels)
} else if (strstr(srslte_rf_name(&rf_device), "bladerf")) {
burst_preamble_sec = blade_default_burst_preamble_sec;
} else {
burst_preamble_sec = 0;
printf("\nWarning burst preamble is not calibrated for device %s. Set a value manually\n\n", srslte_rf_name(&rf_device));
}
@ -337,7 +338,6 @@ void radio::set_tx_srate(double srate)
}
burst_preamble_time_rounded = (double) burst_preamble_samples/cur_tx_srate;
int nsamples=0;
/* Set time advance for each known device if in auto mode */
if (tx_adv_auto) {
@ -364,6 +364,47 @@ void radio::set_tx_srate(double srate)
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), "uhd_usrp2")) {
double srate_khz = round(cur_tx_srate/1e3);
if (srate_khz == 1.92e3) {
nsamples = 14;// estimated
} else if (srate_khz == 3.84e3) {
nsamples = 32;
} else if (srate_khz == 5.76e3) {
nsamples = 43;
} else if (srate_khz == 11.52e3) {
nsamples = 54;
} else if (srate_khz == 15.36e3) {
nsamples = 65;// to calc
} else if (srate_khz == 23.04e3) {
nsamples = 80; // to calc
} 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), "lime")) {
double srate_khz = round(cur_tx_srate/1e3);
if (srate_khz == 1.92e3) {
nsamples = 70;// estimated
} else if (srate_khz == 3.84e3) {
nsamples = 76;//estimated
} else if (srate_khz == 5.76e3) {
nsamples = 76;
} else if (srate_khz == 11.52e3) {
nsamples = 76;
} else if (srate_khz == 15.36e3) {
nsamples = 73;
} else if (srate_khz == 23.04e3) {
nsamples = 87;
} 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), "uhd_x300")) {
// In X300 TX/RX offset is independent of sampling rate

@ -381,6 +381,18 @@ bool rlc_am::poll_required()
return true;
if(poll_retx())
return true;
if(tx_sdu_queue.size() == 0 && retx_queue.size() == 0)
return true;
/* According to 5.2.2.1 in 36.322 v13.3.0 a poll should be requested if
* the entire AM window is unacknowledged, i.e. no new PDU can be transmitted.
* However, it seems more appropiate to request more often if polling
* is disabled otherwise, e.g. every N PDUs.
*/
if (cfg.poll_pdu == 0 && cfg.poll_byte == 0 && vt_s % poll_periodicity == 0)
return true;
return false;
}

@ -279,6 +279,7 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
if(pdu_space <= head_len + 1)
{
pool->deallocate(pdu);
log->warning("%s Cannot build a PDU - %d bytes available, %d bytes required for header\n",
rrc->get_rb_name(lcid).c_str(), nof_bytes, head_len);
return 0;
@ -348,7 +349,7 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
rlc_um_write_data_pdu_header(&header, pdu);
memcpy(payload, pdu->msg, pdu->N_bytes);
uint32_t ret = pdu->N_bytes;
log->debug("%sreturning length %d\n", rrc->get_rb_name(lcid).c_str(), pdu->N_bytes);
log->debug("%s returning length %d\n", rrc->get_rb_name(lcid).c_str(), pdu->N_bytes);
pool->deallocate(pdu);
debug_state();

@ -749,7 +749,7 @@ int enb::parse_sibs(all_args_t *args, rrc_cfg_t *rrc_cfg, phy_cfg_t *phy_config_
}
// Fill rest of data from enb config
sib1->cell_id = args->enb.s1ap.enb_id;
sib1->cell_id = (args->enb.s1ap.enb_id << 8) + args->enb.s1ap.cell_id;
sib1->tracking_area_code = args->enb.s1ap.tac;
sib1->freq_band_indicator = srslte_band_get_band(args->rf.dl_earfcn);
sib1->N_plmn_ids = 1;

@ -641,11 +641,12 @@ int sched::dl_sched_data(dl_sched_data_t data[MAX_DATA_LIST])
srslte_dci_format_t dci_format = user->get_dci_format();
data[nof_data_elems].dci_format = dci_format;
uint32_t aggr_level = user->get_aggr_level(srslte_dci_format_sizeof(SRSLTE_DCI_FORMAT1, cfg.cell.nof_prb, cfg.cell.nof_ports));
if (h) {
// Try to schedule DCI first
if (generate_dci(&data[nof_data_elems].dci_location,
user->get_locations(current_cfi, sf_idx),
user->get_aggr_level(srslte_dci_format_sizeof(dci_format, cfg.cell.nof_prb, cfg.cell.nof_ports)), user))
aggr_level, user))
{
bool is_newtx = h->is_empty(0);
int tbs = 0;

@ -768,9 +768,9 @@ bool rrc::ue::is_timeout()
}
if (deadline_str) {
uint64_t deadline = deadline_s*1e6 + deadline_us;
uint64_t elapsed = t[0].tv_sec*1e6 + t[0].tv_usec;
if (elapsed > deadline) {
int64_t deadline = deadline_s*1e6 + deadline_us;
int64_t elapsed = t[0].tv_sec*1e6 + t[0].tv_usec;
if (elapsed > deadline && elapsed > 0) {
parent->rrc_log->warning("User rnti=0x%x expired %s deadline: %d:%d>%d:%d us\n",
rnti, deadline_str,
t[0].tv_sec, t[0].tv_usec,

@ -48,12 +48,14 @@ class metrics_csv : public srslte::metrics_listener<ue_metrics_t>
public:
metrics_csv(std::string filename);
void set_metrics(ue_metrics_t &m, float report_period_secs);
void set_periodicity(float metrics_report_period_sec);
void set_metrics(ue_metrics_t &m);
void set_ue_handle(ue_metrics_interface *ue_);
private:
std::string float_to_string(float f, int digits, bool add_semicolon = true);
float metrics_report_period;
std::ofstream file;
ue_metrics_interface* ue;
uint32_t n_reports;

@ -46,8 +46,9 @@ class metrics_stdout : public srslte::metrics_listener<ue_metrics_t>
public:
metrics_stdout();
void set_periodicity(float metrics_report_period_sec);
void toggle_print(bool b);
void set_metrics(ue_metrics_t &m, float report_period_secs);
void set_metrics(ue_metrics_t &m);
void set_ue_handle(ue_metrics_interface *ue_);
private:
@ -55,6 +56,7 @@ private:
std::string float_to_eng_string(float f, int digits);
std::string int_to_eng_string(int f, int digits);
float metrics_report_period;
bool do_print;
uint8_t n_reports;
ue_metrics_interface* ue;

@ -386,11 +386,13 @@ 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;

@ -43,6 +43,7 @@ namespace srsue{
metrics_csv::metrics_csv(std::string filename)
:n_reports(0)
,metrics_report_period(1.0)
,ue(NULL)
{
file.open(filename.c_str());
@ -53,7 +54,11 @@ void metrics_csv::set_ue_handle(ue_metrics_interface *ue_)
ue = ue_;
}
void metrics_csv::set_metrics(ue_metrics_t &metrics, float metrics_report_period)
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)
{
if (file.is_open() && ue != NULL) {
if(n_reports == 0) {

@ -50,6 +50,7 @@ char const * const prefixes[2][9] =
metrics_stdout::metrics_stdout()
:do_print(false)
,n_reports(10)
,metrics_report_period(1.0)
,ue(NULL)
{
}
@ -64,8 +65,11 @@ 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, float metrics_report_period)
void metrics_stdout::set_metrics(ue_metrics_t &metrics)
{
if(!do_print || ue == NULL)
return;

@ -509,11 +509,6 @@ bool phch_worker::decode_pdcch_dl(srsue::mac_interface_phy::mac_grant_t* grant)
grant->tb_en[1] = dci_unpacked.tb_en[1];
grant->tb_cw_swap = dci_unpacked.tb_cw_swap; // FIXME: tb_cw_swap not supported
if (grant->tb_cw_swap) {
Info("tb_cw_swap = true\n");
printf("tb_cw_swap = true\n");
}
last_dl_pdcch_ncce = srslte_ue_dl_get_ncce(&ue_dl);
char hexstr[16];
@ -644,7 +639,7 @@ int phch_worker::decode_pdsch(srslte_ra_dl_grant_t *grant, uint8_t *payload[SRSL
for (int i=0;i<SRSLTE_MAX_CODEWORDS;i++) {
if (grant->tb_en[i]) {
snprintf(tbstr[i], 128, ", TB%d: tbs=%d, mcs=%d, rv=%d, crc=%s, it=%d",
snprintf(tbstr[i], 128, ", CW%d: tbs=%d, mcs=%d, rv=%d, crc=%s, it=%d",
i, grant->mcs[i].tbs/8, grant->mcs[i].idx, rv[i], acks[i] ? "OK" : "KO",
srslte_pdsch_last_noi_cw(&ue_dl.pdsch, i));
}

@ -201,7 +201,7 @@ void phy::set_timeadv_rar(uint32_t ta_cmd) {
void phy::set_timeadv(uint32_t ta_cmd) {
n_ta = srslte_N_ta_new(n_ta, ta_cmd);
sf_recv.set_time_adv_sec(((float) n_ta)*SRSLTE_LTE_TS);
//Warning("Not supported: Set TA: ta_cmd: %d, n_ta: %d, ta_usec: %.1f\n", ta_cmd, n_ta, ((float) n_ta)*SRSLTE_LTE_TS*1e6);
Info("PHY: Set TA: ta_cmd: %d, n_ta: %d, ta_usec: %.1f\n", ta_cmd, n_ta, ((float) n_ta)*SRSLTE_LTE_TS*1e6);
}
void phy::configure_prach_params()

Loading…
Cancel
Save