Merge branch 'next' into blind_search

master
Ismael Gomez 8 years ago
commit bf5130ab9b

@ -6,11 +6,11 @@ clear
plot_noise_estimation_only=false;
SNR_values_db=100;%linspace(20,35,8);
Nrealizations=1;
SNR_values_db=linspace(0,30,8);
Nrealizations=10;
w1=0.1;
w2=0.3;
w2=0.2;
enb.NDLRB = 6; % Number of resource blocks
@ -55,7 +55,7 @@ L = gridsize(2); % Number of OFDM symbols in one subframe
Ports = gridsize(3); % Number of transmit antenna ports
%% Allocate memory
Ntests=2;
Ntests=4;
hest=cell(1,Ntests);
tmpnoise=cell(1,Ntests);
for i=1:Ntests
@ -181,8 +181,8 @@ for i=1:10
rxGrid_sf = rxGrid(:,(i-1)*14+1:i*14);
%% Channel Estimation with Matlab
[hest{1}(:,(1:14)+(i-1)*14), tmpnoise{1}(i), hls(:,(1:4*P)+(i-1)*4*P)] = ...
lteDLChannelEstimate2(enb,cec,rxGrid_sf);
[hest{1}(:,(1:14)+(i-1)*14), tmpnoise{1}(i)] = ...
lteDLChannelEstimate(enb,cec,rxGrid_sf);
tmpnoise{1}(i)=tmpnoise{1}(i)*sqrt(2)*enb.CellRefP;
%% LS-Linear estimation with srsLTE
@ -233,11 +233,6 @@ if (length(SNR_values_db) == 1)
fprintf('Mean MMSE Robust %.2f dB\n', 10*log10(MSE(4,nreal,snr_idx)))
fprintf('Mean MMSE matlab %.2f dB\n', 10*log10(MSE(1,nreal,snr_idx)))
<<<<<<< HEAD
=======
>>>>>>> master
end
end

@ -1,6 +1,6 @@
enb=struct('NCellID',137,'NDLRB',50,'NSubframe',8,'CFI',1,'CyclicPrefix','Normal','CellRefP',2,'Ng','One','PHICHDuration','Normal','DuplexMode','FDD');
enb=struct('NCellID',313,'NDLRB',75,'NSubframe',5,'CFI',1,'CyclicPrefix','Normal','CellRefP',2,'Ng','One','PHICHDuration','Normal','DuplexMode','FDD');
RNTI=5;
RNTI=65535;
addpath('../../build/srslte/lib/phch/test')
@ -44,12 +44,15 @@ if ~isempty(dci)
[sib1, crc] = lteDLSCHDecode(enb, pdsch, trblklen, dlschBits);
[dec2, data, pdschRx2, pdschSymbols2, e_bits] = srslte_pdsch(enb, pdsch, ...
[dec2, data, pdschRx2, pdschSymbols2, e_bits, ce] = srslte_pdsch(enb, pdsch, ...
trblklen, ...
subframe_rx);
subplot(2,1,1)
scatter(real(pdschSymbols{1}),imag(pdschSymbols{1}))
subplot(2,1,2)
scatter(real(pdschSymbols2),imag(pdschSymbols2))
if crc == 0
fprintf('PDSCH Matlab OK.\n\n');

@ -116,7 +116,7 @@ for snr_idx=1:length(SNR_values)
rmccFgOut.TotSubframes=1;
% Perform channel estimation
[hest, nest,estimates] = lteDLChannelEstimate2(rmccFgOut, cec, subframe_rx);
[hest, nest] = lteDLChannelEstimate(rmccFgOut, cec, subframe_rx);
[cws,symbols] = ltePDSCHDecode(rmccFgOut,rmccFgOut.PDSCH,subframe_rx,hest,nest);
[trblkout,blkcrc,dstate] = lteDLSCHDecode(rmccFgOut,rmccFgOut.PDSCH, ...
@ -127,7 +127,7 @@ for snr_idx=1:length(SNR_values)
%% Same with srsLTE
if (rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1) > 0)
[dec2, data, pdschRx, pdschSymbols2, cws2] = srslte_pdsch(rmccFgOut, rmccFgOut.PDSCH, ...
[dec2, data, pdschRx, pdschSymbols2, cws2, ce] = srslte_pdsch(rmccFgOut, rmccFgOut.PDSCH, ...
rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1), ...
subframe_rx);
else
@ -155,7 +155,12 @@ if (length(SNR_values)>1)
ylabel('BLER')
axis([min(SNR_values) max(SNR_values) 1/Npackets/(Nsf+1) 1])
else
scatter(real(symbols{1}),imag(symbols{1}))
subplot(2,1,1)
scatter(real(pdschSymbols2),imag(pdschSymbols2))
%plot(real(hest))
subplot(2,1,2)
%plot(1:180,angle(ce(1:180)),1:180,angle(hest(:,1)))
plot(abs(ce-hest(:)))
fprintf('Matlab: %d OK\nsrsLTE: %d OK\n',decoded, decoded_srslte);
end

@ -512,13 +512,12 @@ int main(int argc, char **argv) {
srslte_ue_sync_get_sfidx(&ue_sync),
SRSLTE_SIRNTI, rv);
/*
if (!n) {
if (n>0) {
printf("Saving signal...\n");
srslte_ue_dl_save_signal(&ue_dl, &ue_dl.softbuffer, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), rv);
srslte_ue_dl_save_signal(&ue_dl, &ue_dl.softbuffer, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), rv, prog_args.rnti);
exit(-1);
}
*/
}
if (n < 0) {
// fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);

@ -44,8 +44,8 @@
typedef struct SRSLTE_API {
uint32_t max_prb;
srslte_dft_plan_t dft_plan[SRSLTE_MAX_PRB];
srslte_dft_plan_t idft_plan[SRSLTE_MAX_PRB];
srslte_dft_plan_t dft_plan[SRSLTE_MAX_PRB+1];
srslte_dft_plan_t idft_plan[SRSLTE_MAX_PRB+1];
}srslte_dft_precoding_t;

@ -43,7 +43,7 @@
#include "srslte/common/phy_common.h"
#include "srslte/phch/ra.h"
#define SRSLTE_DCI_MAX_BITS 57
#define SRSLTE_DCI_MAX_BITS 128
#define SRSLTE_RAR_GRANT_LEN 20

@ -293,6 +293,7 @@ static void average_pilots(srslte_chest_dl_t *q, cf_t *input, cf_t *output, uint
uint32_t nsymbols = srslte_refsignal_cs_nof_symbols(port_id);
uint32_t nref = 2*q->cell.nof_prb;
// Average in the frequency domain
for (int l=0;l<nsymbols;l++) {
srslte_conv_same_cf(&input[l*nref], q->smooth_filter, &output[l*nref], nref, q->smooth_filter_len);
}

@ -92,10 +92,10 @@ int srslte_chest_ul_init(srslte_chest_ul_t *q, srslte_cell_t cell)
q->smooth_filter_len = 3;
srslte_chest_ul_set_smooth_filter3_coeff(q, 0.3333);
}
q->dmrs_signal_configured = false;
}
ret = SRSLTE_SUCCESS;
clean_exit:

@ -177,6 +177,8 @@ int srslte_refsignal_ul_init(srslte_refsignal_ul_t * q, srslte_cell_t cell)
if (q != NULL && srslte_cell_isvalid(&cell)) {
ret = SRSLTE_ERROR;
bzero(q, sizeof(srslte_refsignal_ul_t));
q->cell = cell;
@ -275,6 +277,7 @@ static uint32_t get_q(uint32_t u, uint32_t v, uint32_t N_sz) {
static void arg_r_uv_mprb(float *arg, uint32_t M_sc, uint32_t u, uint32_t v) {
uint32_t N_sz = largest_prime_lower_than(M_sc);
if (N_sz > 0) {
float q = get_q(u,v,N_sz);
float n_sz = (float) N_sz;
for (uint32_t i = 0; i < M_sc; i++) {
@ -282,6 +285,7 @@ static void arg_r_uv_mprb(float *arg, uint32_t M_sc, uint32_t u, uint32_t v) {
arg[i] = -M_PI * q * m * (m + 1) / n_sz;
}
}
}
/* Computes argument of r_u_v signal */
static void compute_r_uv_arg(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t u, uint32_t v) {
@ -478,29 +482,35 @@ static uint32_t get_pucch_dmrs_symbol(uint32_t m, srslte_pucch_format_t format,
case SRSLTE_PUCCH_FORMAT_1A:
case SRSLTE_PUCCH_FORMAT_1B:
if (SRSLTE_CP_ISNORM(cp)) {
if (m < 4) {
if (m < 3) {
return pucch_dmrs_symbol_format1_cpnorm[m];
}
} else {
if (m < 3) {
if (m < 2) {
return pucch_dmrs_symbol_format1_cpext[m];
}
}
break;
case SRSLTE_PUCCH_FORMAT_2:
if (SRSLTE_CP_ISNORM(cp)) {
if (m < 3) {
if (m < 2) {
return pucch_dmrs_symbol_format2_cpnorm[m];
}
} else {
if (m < 2) {
if (m < 1) {
return pucch_dmrs_symbol_format2_cpext[m];
}
}
break;
case SRSLTE_PUCCH_FORMAT_2A:
case SRSLTE_PUCCH_FORMAT_2B:
if (m < 3) {
if (m < 2) {
return pucch_dmrs_symbol_format2_cpnorm[m];
}
break;
default:
fprintf(stderr, "Unsupported format %d\n", format);
return 0;
}
return 0;
}
@ -759,7 +769,10 @@ uint32_t srslte_refsignal_srs_rb_L_cs(uint32_t bw_cfg, uint32_t nof_prb) {
}
uint32_t srs_Fb(srslte_refsignal_srs_cfg_t *cfg, uint32_t b, uint32_t nof_prb, uint32_t tti) {
uint32_t n_srs = tti/T_srs_table(cfg->I_srs);
uint32_t Fb = 0;
uint32_t T = T_srs_table(cfg->I_srs);
if (T) {
uint32_t n_srs = tti/T;
uint32_t N_b = Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
uint32_t prod_1=1;
@ -767,13 +780,12 @@ uint32_t srs_Fb(srslte_refsignal_srs_cfg_t *cfg, uint32_t b, uint32_t nof_prb, u
prod_1 *= Nb[srsbwtable_idx(nof_prb)][bp][cfg->bw_cfg];
}
uint32_t prod_2 = prod_1*Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
uint32_t Fb;
if ((N_b%2) == 0) {
Fb = (N_b/2)*((n_srs%prod_2)/prod_1)+((n_srs%prod_2)/prod_1/2);
} else {
Fb = (N_b/2)*(n_srs/prod_1);
}
}
return Fb;
}

@ -178,7 +178,7 @@ int main(int argc, char **argv) {
/* Generate random input */
bzero(input, sizeof(cf_t) * num_re);
for (i=0;i<num_re;i++) {
input[i] = 0.5-rand()/RAND_MAX+I*(0.5-rand()/RAND_MAX);
input[i] = 0.5-rand()/RAND_MAX+I*(0.5-(float) rand()/RAND_MAX);
}
/* Generate channel and pass input through channel */

@ -36,13 +36,13 @@
int srslte_convcoder_encode(srslte_convcoder_t *q, uint8_t *input, uint8_t *output, uint32_t frame_length) {
uint32_t sr;
uint32_t i,j;
uint32_t len = q->tail_biting ? frame_length : (frame_length + q->K - 1);
if (q != NULL &&
input != NULL &&
output != NULL &&
frame_length > q->K + 1)
{
uint32_t len = q->tail_biting ? frame_length : (frame_length + q->K - 1);
if (q->tail_biting) {
sr = 0;
for (i=frame_length - q->K + 1; i<frame_length; i++) {

@ -129,13 +129,13 @@ bool srslte_cqi_send(uint32_t I_cqi_pmi, uint32_t tti) {
} else if (I_cqi_pmi <= 1023) {
return false;
}
if (N_p) {
if ((tti-N_offset)%N_p == 0) {
return true;
} else {
return false;
}
}
return false;
}
/* SNR-to-CQI conversion, got from "Downlink SNR to CQI Mapping for Different Multiple Antenna Techniques in LTE"
@ -181,5 +181,10 @@ int srslte_cqi_hl_get_subband_size(int nof_prb)
*/
int srslte_cqi_hl_get_no_subbands(int nof_prb)
{
return (int)ceil(nof_prb/(float)srslte_cqi_hl_get_subband_size(nof_prb));
int hl_size = srslte_cqi_hl_get_subband_size(nof_prb);
if (hl_size > 0) {
return (int)ceil((float)nof_prb/hl_size);
} else {
return 0;
}
}

@ -65,7 +65,7 @@ int srslte_dci_msg_to_dl_grant(srslte_dci_msg_t *msg, uint16_t msg_rnti,
srslte_dci_format_t tmp = msg->format;
ret = srslte_dci_msg_unpack_pdsch(msg, dl_dci, nof_prb, nof_ports, crc_is_crnti);
if (ret) {
fprintf(stderr, "Can't unpack DCI message %s (%d)\n", srslte_dci_format_string(tmp), ret);
fprintf(stderr, "Can't unpack DCI message %s (%d)\n", srslte_dci_format_string(tmp), tmp);
return ret;
}
@ -170,7 +170,7 @@ int srslte_dci_msg_to_ul_grant(srslte_dci_msg_t *msg, uint32_t nof_prb,
ret = SRSLTE_ERROR;
bzero(ul_dci, sizeof(srslte_ra_ul_dci_t));
bzero(grant, sizeof(srslte_ra_ul_dci_t));
bzero(grant, sizeof(srslte_ra_ul_grant_t));
if (srslte_dci_msg_unpack_pusch(msg, ul_dci, nof_prb)) {
return ret;
@ -386,12 +386,13 @@ uint32_t srslte_dci_format_sizeof(srslte_dci_format_t format, uint32_t nof_prb,
return dci_format3A_sizeof(nof_prb);
*/
default:
return SRSLTE_ERROR;
printf("Error computing DCI bits: Unknown format %d\n", format);
return 0;
}
}
uint32_t srslte_dci_format_sizeof_lut(srslte_dci_format_t format, uint32_t nof_prb) {
if (nof_prb <= 100 && format < 11) {
if (nof_prb < 101 && format < 4) {
return dci_sz_table[nof_prb][format];
} else {
return 0;

@ -275,8 +275,8 @@ int srslte_pdcch_dci_decode(srslte_pdcch_t *q, float *e, uint8_t *data, uint32_t
uint16_t p_bits, crc_res;
uint8_t *x;
if (q != NULL &&
data != NULL &&
if (q != NULL) {
if (data != NULL &&
E <= q->max_bits &&
nof_bits <= SRSLTE_DCI_MAX_BITS)
{
@ -303,6 +303,9 @@ int srslte_pdcch_dci_decode(srslte_pdcch_t *q, float *e, uint8_t *data, uint32_t
fprintf(stderr, "Invalid parameters: E: %d, max_bits: %d, nof_bits: %d\n", E, q->max_bits, nof_bits);
return SRSLTE_ERROR_INVALID_INPUTS;
}
} else {
return SRSLTE_ERROR_INVALID_INPUTS;
}
}
/** Tries to decode a DCI message from the LLRs stored in the srslte_pdcch_t structure by the function
@ -525,7 +528,7 @@ int srslte_pdcch_encode(srslte_pdcch_t *q, srslte_dci_msg_t *msg, srslte_dci_loc
ret = SRSLTE_ERROR;
if (location.ncce + PDCCH_FORMAT_NOF_CCE(location.L) <= q->nof_cce &&
msg->nof_bits < SRSLTE_DCI_MAX_BITS)
msg->nof_bits < SRSLTE_DCI_MAX_BITS - 16)
{
DEBUG("Encoding DCI: Nbits: %d, E: %d, nCCE: %d, L: %d, RNTI: 0x%x\n",
msg->nof_bits, e_bits, location.ncce, location.L, rnti);

@ -316,8 +316,8 @@ void srslte_pdsch_free(srslte_pdsch_t *q) {
*/
int srslte_pdsch_cfg(srslte_pdsch_cfg_t *cfg, srslte_cell_t cell, srslte_ra_dl_grant_t *grant, uint32_t cfi, uint32_t sf_idx, uint32_t rvidx)
{
if (cfg && grant) {
if (cfg) {
if (grant) {
memcpy(&cfg->grant, grant, sizeof(srslte_ra_dl_grant_t));
}
if (srslte_cbsegm(&cfg->cb_segm, cfg->grant.mcs.tbs)) {
@ -329,6 +329,9 @@ int srslte_pdsch_cfg(srslte_pdsch_cfg_t *cfg, srslte_cell_t cell, srslte_ra_dl_g
cfg->rv = rvidx;
return SRSLTE_SUCCESS;
} else {
return SRSLTE_ERROR_INVALID_INPUTS;
}
}

@ -264,7 +264,7 @@ int srslte_prach_gen_seqs(srslte_prach_t *p)
if(((p_*u) % p->N_zc) == 1)
break;
}
if(p_ >= 0 && p_ < p->N_zc/2){
if(p_ < p->N_zc/2){
d_u = p_;
}else{
d_u = p->N_zc - p_;
@ -342,8 +342,7 @@ int srslte_prach_init(srslte_prach_t *p,
if(p != NULL &&
N_ifft_ul < 2049 &&
config_idx < 16 &&
root_seq_index < MAX_ROOTS &&
zero_corr_zone_config < 16)
root_seq_index < MAX_ROOTS)
{
uint32_t preamble_format = srslte_prach_get_preamble_format(config_idx);
p->config_idx = config_idx;
@ -356,14 +355,29 @@ int srslte_prach_init(srslte_prach_t *p,
// Determine N_zc and N_cs
if(4 == preamble_format){
if (p->zczc < 7) {
p->N_zc = 139;
p->N_cs = prach_Ncs_format4[p->zczc];
} else {
fprintf(stderr, "Invalid zeroCorrelationZoneConfig=%d for format4\n", p->zczc);
return SRSLTE_ERROR;
}
}else{
p->N_zc = 839;
if(p->hs){
if (p->zczc < 15) {
p->N_cs = prach_Ncs_restricted[p->zczc];
} else {
fprintf(stderr, "Invalid zeroCorrelationZoneConfig=%d for restricted set\n", p->zczc);
return SRSLTE_ERROR;
}
}else{
if (p->zczc < 16) {
p->N_cs = prach_Ncs_unrestricted[p->zczc];
} else {
fprintf(stderr, "Invalid zeroCorrelationZoneConfig=%d\n", p->zczc);
return SRSLTE_ERROR;
}
}
}

@ -136,7 +136,7 @@ uint32_t get_pucch_symbol(uint32_t m, srslte_pucch_format_t format, srslte_cp_t
case SRSLTE_PUCCH_FORMAT_1:
case SRSLTE_PUCCH_FORMAT_1A:
case SRSLTE_PUCCH_FORMAT_1B:
if (m < 5) {
if (m < 4) {
if (SRSLTE_CP_ISNORM(cp)) {
return pucch_symbol_format1_cpnorm[m];
} else {
@ -147,7 +147,7 @@ uint32_t get_pucch_symbol(uint32_t m, srslte_pucch_format_t format, srslte_cp_t
case SRSLTE_PUCCH_FORMAT_2:
case SRSLTE_PUCCH_FORMAT_2A:
case SRSLTE_PUCCH_FORMAT_2B:
if (m < 6) {
if (m < 5) {
if (SRSLTE_CP_ISNORM(cp)) {
return pucch_symbol_format2_cpnorm[m];
} else {

@ -595,7 +595,10 @@ int srslte_ra_tbs_to_table_idx(uint32_t tbs, uint32_t n_prb) {
if (tbs <= tbs_table[0][n_prb-1]) {
return 0;
}
for (idx = 0; idx < 27; idx++) {
if (tbs >= tbs_table[26][n_prb-1]) {
return 27;
}
for (idx = 0; idx < 26; idx++) {
if (tbs_table[idx][n_prb-1] <= tbs && tbs_table[idx+1][n_prb-1] >= tbs) {
return idx+1;
}

@ -247,6 +247,10 @@ int regs_phich_init(srslte_regs_t *h) {
srslte_regs_reg_t **regs_phich[3];
int ret = SRSLTE_ERROR;
for (int i=0;i<3;i++) {
regs_phich[i] = NULL;
}
switch(h->phich_res) {
case SRSLTE_PHICH_R_1_6:
ng = (float) 1/6;
@ -768,9 +772,11 @@ int srslte_regs_init(srslte_regs_t *h, srslte_cell_t cell) {
ret = SRSLTE_SUCCESS;
}
clean_and_exit:
if (h) {
if (ret != SRSLTE_SUCCESS) {
srslte_regs_free(h);
}
}
return ret;
}

@ -58,7 +58,7 @@ float beta_cqi_offset[16] = {-1.0, -1.0, 1.125, 1.25, 1.375, 1.625, 1.750, 2.0,
float srslte_sch_beta_cqi(uint32_t I_cqi) {
if (I_cqi <= 16) {
if (I_cqi < 16) {
return beta_cqi_offset[I_cqi];
} else {
return 0;

@ -81,9 +81,6 @@ target_link_libraries(pdcch_test srslte)
add_test(pdcch_test pdcch_test)
add_executable(dci_unpacking dci_unpacking.c)
target_link_libraries(dci_unpacking srslte)
BuildMex(MEXNAME pdcch SOURCES pdcch_test_mex.c LIBRARIES srslte_static srslte_mex)
########################################################################

@ -1,102 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include "srslte/srslte.h"
void usage(char *prog) {
printf("Usage: %s nof_prb length_bits Word0 Word1 ...\n", prog);
}
int main(int argc, char **argv) {
srslte_dci_msg_t msg;
srslte_ra_dl_dci_t ra_dl;
int len, rlen;
int nof_prb;
int nwords;
int i;
uint8_t *y;
if (argc < 3) {
usage(argv[0]);
exit(-1);
}
nof_prb = atoi(argv[1]);
len = atoi(argv[2]);
nwords = (len - 1) / 32 + 1;
if (argc < 3 + nwords) {
usage(argv[0]);
exit(-1);
}
y = msg.data;
rlen = 0;
uint32_t x;
for (i = 0; i < nwords; i++) {
x = strtoul(argv[i + 3], NULL, 16);
if (len - rlen < 32) {
srslte_bit_unpack(x, &y, len - rlen);
} else {
srslte_bit_unpack(x, &y, 32);
}
}
printf("DCI message len %d:\n", len);
for (i = 0; i < len; i++) {
printf("%d, ", msg.data[i]);
}
printf("\n");
srslte_dci_msg_type_t dci_type;
msg.nof_bits = len;
if (srslte_dci_msg_get_type(&msg, &dci_type, nof_prb, SRSLTE_SIRNTI)) {
fprintf(stderr, "Can't obtain DCI message type\n");
exit(-1);
}
printf("\n");
printf("Message type:");
srslte_dci_msg_type_fprint(stdout, dci_type);
switch (dci_type.type) {
case SRSLTE_DCI_MSG_TYPE_PDSCH_SCHED:
bzero(&ra_dl, sizeof(srslte_ra_dl_dci_t));
srslte_dci_msg_unpack_pdsch(&msg, &ra_dl, nof_prb, 1, false);
srslte_ra_pdsch_fprint(stdout, &ra_dl, nof_prb);
break;
default:
printf("Error expected PDSCH\n");
exit(-1);
}
printf("\n");
}

@ -271,7 +271,9 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if (nlhs >= 5) {
mexutils_write_s(pdsch.e, &plhs[4], cfg.nbits.nof_bits, 1);
}
if (nlhs >= 6) {
mexutils_write_cf(ce[0], &plhs[5], SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp), 1);
}
srslte_softbuffer_rx_free(&softbuffer);
srslte_chest_dl_free(&chest);
srslte_pdsch_free(&pdsch);

@ -90,11 +90,11 @@ int main(int argc, char **argv) {
if (srslte_pucch_init(&pucch, cell)) {
fprintf(stderr, "Error creating PDSCH object\n");
goto quit;
exit(-1);
}
if (srslte_refsignal_ul_init(&dmrs, cell)) {
fprintf(stderr, "Error creating PDSCH object\n");
goto quit;
exit(-1);
}
bzero(&pucch_cfg, sizeof(srslte_pucch_cfg_t));

@ -184,13 +184,13 @@ int main(int argc, char **argv) {
sf_symbols = srslte_vec_malloc(sizeof(cf_t) * nof_re);
if (!sf_symbols) {
perror("malloc");
goto quit;
exit(-1);
}
data = srslte_vec_malloc(sizeof(uint8_t) * cfg.grant.mcs.tbs);
if (!data) {
perror("malloc");
goto quit;
exit(-1);
}
for (uint32_t i=0;i<cfg.grant.mcs.tbs/8;i++) {

@ -478,10 +478,12 @@ int rf_blade_send_timed(void *h,
if (is_end_of_burst) {
meta.flags |= BLADERF_META_FLAG_TX_BURST_END;
}
srslte_rf_error_t error;
bzero(&error, sizeof(srslte_rf_error_t));
status = bladerf_sync_tx(handler->dev, handler->tx_buffer, nsamples, &meta, 2000);
if (status == BLADERF_ERR_TIME_PAST) {
if (blade_error_handler) {
srslte_rf_error_t error;
error.type = SRSLTE_RF_ERROR_LATE;
blade_error_handler(error);
} else {
@ -492,7 +494,6 @@ int rf_blade_send_timed(void *h,
return status;
} else if (meta.status == BLADERF_META_STATUS_UNDERRUN) {
if (blade_error_handler) {
srslte_rf_error_t error;
error.type = SRSLTE_RF_ERROR_UNDERFLOW;
blade_error_handler(error);
} else {

@ -62,6 +62,8 @@ srslte_rf_error_handler_t uhd_error_handler = NULL;
void msg_handler(const char *msg)
{
srslte_rf_error_t error;
bzero(&error, sizeof(srslte_rf_error_t));
if(0 == strcmp(msg, "O")) {
error.type = SRSLTE_RF_ERROR_OVERFLOW;
} else if(0 == strcmp(msg, "D")) {

@ -62,7 +62,7 @@ void srslte_cfo_free(srslte_cfo_t *h) {
if (h->cur_cexp) {
free(h->cur_cexp);
}
bzero(h, sizeof(cf_t));
bzero(h, sizeof(srslte_cfo_t));
}
void srslte_cfo_set_tol(srslte_cfo_t *h, float tol) {

@ -94,6 +94,8 @@ int srslte_pss_synch_init_fft_offset(srslte_pss_synch_t *q, uint32_t frame_size,
if (q != NULL) {
ret = SRSLTE_ERROR;
uint32_t N_id_2;
uint32_t buffer_size;
bzero(q, sizeof(srslte_pss_synch_t));

@ -139,14 +139,15 @@ uint32_t srslte_sss_synch_subframe(uint32_t m0, uint32_t m1) {
/** Returns the N_id_1 value based on the m0 and m1 values */
int srslte_sss_synch_N_id_1(srslte_sss_synch_t *q, uint32_t m0, uint32_t m1) {
if (m0==m1 || m0 > 30 || m1 > 30) {
return SRSLTE_ERROR;
}
int N_id_1;
int N_id_1 = -1;
if (m1 > m0) {
if (m0 < 30 && m1 - 1 < 30) {
N_id_1 = q->N_id_1_table[m0][m1 - 1];
}
} else {
if (m1 < 30 && m0 - 1 < 30) {
N_id_1 = q->N_id_1_table[m1][m0 - 1];
}
}
return N_id_1;
}

@ -79,7 +79,7 @@ int srslte_sync_init(srslte_sync_t *q, uint32_t frame_size, uint32_t max_offset,
}
// Set a CFO tolerance of approx 100 Hz
srslte_cfo_set_tol(&q->cfocorr, 100/(15000*q->fft_size));
srslte_cfo_set_tol(&q->cfocorr, 100.0/(15000.0*q->fft_size));
for (int i=0;i<2;i++) {
q->cfo_i_corr[i] = srslte_vec_malloc(sizeof(cf_t)*q->frame_size);
@ -398,8 +398,11 @@ srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t
srslte_sync_find_ret_t ret = SRSLTE_SYNC_ERROR;
if (q != NULL &&
input != NULL &&
if (!q) {
return SRSLTE_ERROR_INVALID_INPUTS;
}
if (input != NULL &&
srslte_N_id_2_isvalid(q->N_id_2) &&
fft_size_isvalid(q->fft_size))
{

@ -44,7 +44,7 @@ cf_t dummy[MAX_TIME_OFFSET];
#define TRACK_MAX_LOST 4
#define TRACK_FRAME_SIZE 32
#define FIND_NOF_AVG_FRAMES 4
#define DEFAULT_SAMPLE_OFFSET_CORRECT_PERIOD 5
#define DEFAULT_SAMPLE_OFFSET_CORRECT_PERIOD 0
#define DEFAULT_SFO_EMA_COEFF 0.1
cf_t dummy_offset_buffer[1024*1024];
@ -358,7 +358,6 @@ static int track_peak_ok(srslte_ue_sync_t *q, uint32_t track_idx) {
{
INFO("Warning: Expected SF idx %d but got %d! (%d frames)\n",
q->sf_idx, srslte_sync_get_sf_idx(&q->strack), q->frame_no_cnt);
q->sf_idx = srslte_sync_get_sf_idx(&q->strack);
q->frame_no_cnt++;
if (q->frame_no_cnt >= TRACK_MAX_LOST) {
INFO("\n%d frames lost. Going back to FIND\n", (int) q->frame_no_cnt);

@ -434,12 +434,14 @@ int srslte_ue_ul_pusch_encode_rnti_softbuffer(srslte_ue_ul_t *q,
{
int ret = SRSLTE_ERROR_INVALID_INPUTS;
bzero(q->sf_symbols, sizeof(cf_t)*SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp));
if (q != NULL &&
softbuffer != NULL &&
output_signal != NULL)
{
bzero(q->sf_symbols, sizeof(cf_t)*SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp));
if (srslte_pusch_uci_encode_rnti(&q->pusch, &q->pusch_cfg, softbuffer, data, uci_data, rnti, q->sf_symbols)) {
fprintf(stderr, "Error encoding TB\n");
return ret;

Loading…
Cancel
Save