Added Shortened PUSCH support. Fixed pdsch_ue/enodeb examples bug in subframe 0 and 5. Fixed MAC PDU packing.

This commit is contained in:
ismagom 2015-06-04 10:48:13 +01:00
parent 78c795461e
commit 4a669048d3
22 changed files with 105 additions and 103 deletions

View File

@ -1,8 +1,10 @@
ueConfig=struct('NCellID',1,'NULRB',25,'NSubframe',0,'RNTI',65,'CyclicPrefixUL','Normal','NTxAnts',1);
puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',24,'Modulation','QPSK','RV',0,'Shortened',0);
ueConfig=struct('NCellID',1,'NULRB',25,'NSubframe',8,'RNTI',65,'CyclicPrefixUL','Normal','NTxAnts',1,'Shortened',0);
puschConfig=struct('NTurboDecIts',5,'NLayers',1,'OrthCover','Off','PRBSet',22,'Modulation','16QAM','RV',0);
TBS=72;
cfo=1146;
TBS=336;
cfo=2717.973389;
t0=1;
x=[rx(t0:end); zeros(t0-1,1)];
subframe_rx=lteSCFDMADemodulate(ueConfig,x.*exp(-1i*2*pi*cfo/15000*transpose(1:length(x))/512));
idx=ltePUSCHIndices(ueConfig,puschConfig);
@ -13,3 +15,4 @@ ce=hest(idx);
[trblkout,blkcrc,stateout] = lteULSCHDecode(ueConfig,puschConfig,TBS,cws);
disp(blkcrc)
scatter(real(symbols),imag(symbols))
plot(real(hest(:,1)))

View File

@ -1,17 +1,15 @@
ueConfig=struct('NCellID',1,'NULRB',25,'NSubframe',8,'RNTI',77,'CyclicPrefixUL','Normal','NTxAnts',1);
puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',24,'Modulation','QAM16','RV',0,'Shortened',0);
ueConfig=struct('NCellID',1,'NULRB',25,'RNTI',77,'CyclicPrefixUL','Normal','NTxAnts',1,'Shortened',1);
puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',22,'Shortened',1);
addpath('../../debug/srslte/lib/phch/test')
addpath('../../build/srslte/lib/phch/test')
TBs=336;
cqilen=0;
rvs=0;
mods={'16QAM'};
betas=0;
subf=8;
TBs=336;
cqilen=0;
rvs=0;
mods={'16QAM'};
betas=0;
subf=8;
trblkin=[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0];
for i=1:length(TBs)
for m=1:length(mods)
for r=1:length(rvs)
@ -21,7 +19,7 @@ for i=1:length(TBs)
for c=1:length(cqilen)
for s=1:length(subf)
fprintf('Subf=%d, RV=%d\n', subf(s), rvs(r));
%trblkin=randi(2,TBs(i),1)-1;
trblkin=randi(2,TBs(i),1)-1;
ueConfig.NSubframe=subf(s);
puschConfig.Modulation = mods{m};
puschConfig.RV = rvs(r);
@ -43,22 +41,17 @@ for i=1:length(TBs)
if (cqilen(c)>0 || TBs(i)>0)
[cw, info]=lteULSCH(ueConfig,puschConfig,trblkin);
cw_mat=ltePUSCH(ueConfig,puschConfig,cw);
drs=ltePUSCHDRS(ueConfig,puschConfig);
idx=ltePUSCHIndices(ueConfig,puschConfig);
drs_ind = ltePUSCHDRSIndices(ueConfig,puschConfig);
subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(idx)=cw_mat;
subframe_mat(drs_ind)=drs;
waveform = lteSCFDMAModulate(ueConfig,subframe_mat,0);
plot(abs(x-waveform*sqrt(512)))
% [waveform_lib, subframe_lib, cwlib]=srslte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
% err=mean(abs(waveform-waveform_lib));
% if (err > 10^-6)
% disp(err)
% error('Error!');
% end
[waveform_lib, subframe_lib, cwlib]=srslte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
err=mean(abs(waveform-waveform_lib));
if (err > 10^-3)
disp(err)
error('Error!');
end
end
end
end

View File

@ -1,14 +1,14 @@
clear
ueConfig=struct('NCellID',1,'CyclicPrefixUL','Normal','NTxAnts',1);
puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',0,'Modulation','16QAM','RV',0,'Shortened',0);
puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',22,'Shortened',1);
addpath('../../debug/srslte/lib/phch/test')
addpath('../../build/srslte/lib/phch/test')
TBs=0:13:222;
cqilen=[0, 8, 17];
mods={'QPSK','16QAM','64QAM'};
rvs=[0, 3];
betas=[2.0 2.5 6.25];
TBs=336;
cqilen=0;
mods={'16QAM'};
rvs=0;
betas=0;
for i=1:length(TBs)

View File

@ -109,10 +109,12 @@ public:
}
void del_subh() {
if (cur_idx > 0 && nof_subheaders > 0) {
cur_idx--;
if (nof_subheaders > 0) {
nof_subheaders--;
}
if (cur_idx > 0) {
cur_idx--;
}
}
SubH* get() {

View File

@ -239,7 +239,7 @@ bool mux::assemble_pdu(uint32_t pdu_sz_nbits) {
}
// MAC control element for PHR
// TODO
// data from any Logical Channel, except data from UL-CCCH;
// first only those with positive Bj
for (int i=0;i<mac_io::NOF_UL_LCH;i++) {
@ -265,12 +265,12 @@ bool mux::assemble_pdu(uint32_t pdu_sz_nbits) {
bsr_subh = pdu_msg.get();
}
}
// And set the BSR
if (bsr_subh) {
bsr_subh->set_bsr(bsr.buff_size, bsr_format_convert(bsr.format), bsr_payload_sz?false:true);
}
pthread_mutex_unlock(&mutex);
/* Release all SDUs */
@ -282,7 +282,7 @@ bool mux::assemble_pdu(uint32_t pdu_sz_nbits) {
}
Info("Assembled MAC PDU msg size %d/%d bytes\n", pdu_msg.size(), pdu_sz_nbits/8);
pdu_msg.fprint(stdout);
//pdu_msg.fprint(stdout);
/* Generate MAC PDU and save to buffer */
if (pdu_msg.write_packet(buff)) {
@ -306,7 +306,7 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, uint32_t *sdu_sz, bool *
{
// Get n-th pending SDU pointer and length
uint32_t buff_len;
uint32_t buff_len = 0;
uint8_t *buff_ptr = (uint8_t*) mac_io_h->get(mac_io::MAC_LCH_CCCH_UL + lcid)->pop(&buff_len, nof_tx_pkts[lcid]);
if (buff_ptr && buff_len > 0) { // there is pending SDU to allocate

View File

@ -96,9 +96,9 @@ namespace ue {
return true;
}
}
bool create_from_rar(srslte_dci_rar_grant_t *rar, srslte_cell_t cell, uint32_t N_srs, uint32_t n_rb_ho) {
bool create_from_rar(srslte_dci_rar_grant_t *rar, srslte_cell_t cell, uint32_t n_rb_ho) {
grant_is_from_rar = true;
if (srslte_dci_rar_to_ul_grant(rar, cell, N_srs, n_rb_ho, &ul_dci, &grant)) {
if (srslte_dci_rar_to_ul_grant(rar, cell, n_rb_ho, &ul_dci, &grant)) {
return false;
} else {
if (SRSLTE_VERBOSE_ISINFO()) {

View File

@ -97,7 +97,7 @@ bool dl_buffer::get_ul_grant(ul_sched_grant *grant)
{
if (signal_buffer) {
if (pending_rar_grant && grant->is_temp_rnti()) {
return grant->create_from_rar(&rar_grant, cell, 0, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
return grant->create_from_rar(&rar_grant, cell, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
} else {
if (!sf_symbols_and_ce_done) {
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {

View File

@ -109,20 +109,20 @@ radio* phy::get_radio() {
void phy::set_timeadv_rar(uint32_t ta_cmd) {
n_ta = srslte_N_ta_new_rar(ta_cmd);
time_adv_sec = SRSLTE_TA_OFFSET+((float) n_ta)*SRSLTE_LTE_TS;
time_adv_sec = SRSLTE_TA_OFFSET+((float) n_ta)/(15000.0*2048);
Info("Set TA RAR: ta_cmd: %d, n_ta: %d, ta_usec: %.1f\n", ta_cmd, n_ta, time_adv_sec*1e6);
}
void phy::set_timeadv(uint32_t ta_cmd) {
n_ta = srslte_N_ta_new(n_ta, ta_cmd);
time_adv_sec = SRSLTE_TA_OFFSET+((float) n_ta)*SRSLTE_LTE_TS;
time_adv_sec = SRSLTE_TA_OFFSET+((float) n_ta)/(15000.0*2048);
Info("Set TA: ta_cmd: %d, n_ta: %d, ta_usec: %.1f\n", ta_cmd, n_ta, time_adv_sec*1e6);
}
void phy::rar_ul_grant(srslte_dci_rar_grant_t *rar, ul_sched_grant *grant)
{
uint32_t n_ho = params_db.get_param(phy_params::PUSCH_HOPPING_OFFSET);
grant->create_from_rar(rar, cell, 0, params_db.get_param(phy_params::PUSCH_HOPPING_OFFSET));
grant->create_from_rar(rar, cell, params_db.get_param(phy_params::PUSCH_HOPPING_OFFSET));
}
void phy::set_param(phy_params::phy_param_t param, int64_t value) {
@ -527,6 +527,7 @@ void phy::run_rx_tx_state()
srslte_agc_lock(&ue_sync.agc, false);
Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain);
}
// Generate scheduling request if we have to
if (sr_is_ready_to_send(current_tti+ul_buffer::tx_advance_sf)) {
get_ul_buffer_adv(current_tti)->generate_sr();
}

View File

@ -220,6 +220,7 @@ int nof_tx = 0;
bool ul_buffer::send(srslte::radio* radio_handler, float time_adv_sec, float cfo, srslte_timestamp_t rx_time)
{
// send packet through usrp
srslte_timestamp_t tx_time;
srslte_timestamp_copy(&tx_time, &rx_time);
@ -247,12 +248,12 @@ bool ul_buffer::send(srslte::radio* radio_handler, float time_adv_sec, float cfo
radio_handler->tx(signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb), tx_time);
/*
char filename[25];
sprintf(filename, "pusch%d",nof_tx);
srslte_vec_save_file(filename, signal_buffer, sizeof(cf_t)*SRSLTE_SF_LEN_PRB(cell.nof_prb));
nof_tx++;
*/
ready();
}

View File

@ -471,7 +471,7 @@ int main(int argc, char **argv) {
cell.phich_resources = SRSLTE_PHICH_R_1;
sfn = 0;
prbset_num = (int) ceilf((float) cell.nof_prb / srslte_ra_type0_P(cell.nof_prb))/5;
prbset_num = (int) ceilf((float) cell.nof_prb / srslte_ra_type0_P(cell.nof_prb));
last_prbset_num = prbset_num;
/* this *must* be called after setting slot_len_* */
@ -548,22 +548,18 @@ int main(int argc, char **argv) {
}
/* Transmit PDCCH + PDSCH only when there is data to send */
if (sf_idx != 0 && sf_idx != 5) {
if (net_port > 0) {
send_data = net_packet_ready;
if (net_packet_ready) {
INFO("Transmitting packet\n",0);
}
} else {
INFO("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs.tbs);
for (i=0;i<pdsch_cfg.grant.mcs.tbs;i++) {
data[i] = rand()%2;
}
send_data = true;
}
if (net_port > 0) {
send_data = net_packet_ready;
if (net_packet_ready) {
INFO("Transmitting packet\n",0);
}
} else {
send_data = false;
}
INFO("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs.tbs);
for (i=0;i<pdsch_cfg.grant.mcs.tbs;i++) {
data[i] = rand()%2;
}
send_data = true;
}
if (send_data) {
srslte_ra_dl_dci_to_grant(&ra_dl, &pdsch_cfg.grant, cell, sf_idx, cfi, true);

View File

@ -101,7 +101,7 @@ void args_default(prog_args_t *args) {
args->input_file_name = NULL;
args->disable_cfo = false;
args->time_offset = 0;
args->file_nof_prb = 6;
args->file_nof_prb = 25;
args->file_nof_ports = 1;
args->file_cell_id = 0;
args->uhd_args = "";
@ -447,11 +447,7 @@ int main(int argc, char **argv) {
break;
case DECODE_PDSCH:
if (prog_args.rnti != SRSLTE_SIRNTI) {
if (srslte_ue_sync_get_sfidx(&ue_sync) != 5 && srslte_ue_sync_get_sfidx(&ue_sync) != 0) {
decode_pdsch = true;
} else {
decode_pdsch = false;
}
decode_pdsch = true;
} else {
/* We are looking for SIB1 Blocks, 2search only in appropiate places */
if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {

View File

@ -499,7 +499,7 @@ cell.nof_ports = 1;
rar_grant.hopping_flag = rar_msg.hopping_flag;
rar_grant.rba = rar_msg.rba;
rar_grant.trunc_mcs = rar_msg.mcs;
srslte_dci_rar_to_ul_grant(&rar_grant, cell, 0, 0, &ra_pusch, &ra_grant);
srslte_dci_rar_to_ul_grant(&rar_grant, cell, 0, &ra_pusch, &ra_grant);
srslte_ra_pusch_fprint(stdout, &ra_pusch, cell.nof_prb);
srslte_ue_sync_get_last_timestamp(&ue_sync, &uhd_time);

View File

@ -112,7 +112,6 @@ SRSLTE_API int srslte_dci_msg_to_ul_grant(srslte_dci_msg_t *msg,
SRSLTE_API int srslte_dci_rar_to_ul_grant(srslte_dci_rar_grant_t *rar,
srslte_cell_t cell,
uint32_t N_srs,
uint32_t n_rb_ho,
srslte_ra_ul_dci_t *ul_dci,
srslte_ra_ul_grant_t *grant);

View File

@ -351,7 +351,9 @@ int srslte_chest_dl_estimate_port(srslte_chest_dl_t *q, cf_t *input, cf_t *ce, u
}
#if NOISE_POWER_METHOD==1
q->noise_estimate[port_id] = estimate_noise_port(q, input);
if (sf_idx == 0 || sf_idx == 5) {
q->noise_estimate[port_id] = estimate_noise_port(q, input);
}
#endif
/* Compute RSRP for the channel estimates in this port */

View File

@ -103,7 +103,7 @@ int srslte_dci_msg_to_dl_grant(srslte_dci_msg_t *msg, uint16_t msg_rnti,
/* Creates the UL PUSCH resource allocation grant from the random access respone message
*/
int srslte_dci_rar_to_ul_grant(srslte_dci_rar_grant_t *rar, srslte_cell_t cell,
uint32_t N_srs, uint32_t n_rb_ho,
uint32_t n_rb_ho,
srslte_ra_ul_dci_t *ul_dci,
srslte_ra_ul_grant_t *grant)
{
@ -128,7 +128,7 @@ int srslte_dci_rar_to_ul_grant(srslte_dci_rar_grant_t *rar, srslte_cell_t cell,
srslte_ra_type2_from_riv(riv, &ul_dci->type2_alloc.L_crb, &ul_dci->type2_alloc.RB_start,
cell.nof_prb, cell.nof_prb);
if (srslte_ra_ul_dci_to_grant(ul_dci, grant, cell, n_rb_ho, N_srs)) {
if (srslte_ra_ul_dci_to_grant(ul_dci, grant, cell, n_rb_ho, 0)) {
fprintf(stderr, "Error computing resource allocation\n");
return SRSLTE_ERROR;
}

View File

@ -101,7 +101,7 @@ int srslte_pdsch_cp(srslte_pdsch_t *q, cf_t *input, cf_t *output, srslte_ra_dl_g
// Skip PSS/SSS signals
if (s == 0 && (nsubframe == 0 || nsubframe == 5)) {
if (n >= q->cell.nof_prb / 2 - 3
&& n < q->cell.nof_prb / 2 + 3) {
&& n <= q->cell.nof_prb / 2 + 3) {
lend = SRSLTE_CP_NSYMB(q->cell.cp) - 2;
is_sss = true;
}
@ -109,7 +109,7 @@ int srslte_pdsch_cp(srslte_pdsch_t *q, cf_t *input, cf_t *output, srslte_ra_dl_g
// Skip PBCH
if (s == 1 && nsubframe == 0) {
if (n >= q->cell.nof_prb / 2 - 3
&& n < q->cell.nof_prb / 2 + 3) {
&& n <= q->cell.nof_prb / 2 + 3) {
lstart = 4;
is_pbch = true;
}

View File

@ -323,9 +323,9 @@ int srslte_pusch_decode(srslte_pusch_t *q,
{
if (q->rnti_is_set) {
INFO("Decoding PUSCH SF: %d, Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n",
INFO("Decoding PUSCH SF: %d, Mod %s, NofBits: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d\n",
cfg->sf_idx, srslte_mod_string(cfg->grant.mcs.mod), cfg->grant.mcs.tbs,
cfg->grant.nof_re, cfg->grant.nof_bits, cfg->rv);
cfg->grant.nof_re, cfg->grant.nof_symb, cfg->grant.nof_bits, cfg->rv);
/* extract symbols */
n = pusch_get(q, &cfg->grant, cfg->sf_idx, sf_symbols, q->d);
@ -423,9 +423,9 @@ int srslte_pusch_uci_encode_rnti(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srs
return SRSLTE_ERROR_INVALID_INPUTS;
}
INFO("Encoding PUSCH SF: %d, Mod %s, RNTI: %d, TBS: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n",
INFO("Encoding PUSCH SF: %d, Mod %s, RNTI: %d, TBS: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d\n",
cfg->sf_idx, srslte_mod_string(cfg->grant.mcs.mod), rnti,
cfg->grant.mcs.tbs, cfg->grant.nof_re, cfg->grant.nof_bits, cfg->rv);
cfg->grant.mcs.tbs, cfg->grant.nof_re, cfg->grant.nof_symb, cfg->grant.nof_bits, cfg->rv);
bzero(q->q, cfg->grant.nof_bits);
if (srslte_ulsch_uci_encode(&q->dl_sch, cfg, softbuffer, data, uci_data, q->g, q->q)) {

View File

@ -55,7 +55,7 @@ uint32_t ra_re_x_prb(uint32_t subframe, uint32_t slot, uint32_t prb_idx, uint32_
/* if it's the prb in the middle, there are less RE due to PBCH and PSS/SSS */
if ((subframe == 0 || subframe == 5)
&& (prb_idx >= nof_prb / 2 - 3 && prb_idx < nof_prb / 2 + 3)) {
&& (prb_idx >= nof_prb / 2 - 3 && prb_idx <= nof_prb / 2 + 3)) {
if (subframe == 0) {
if (slot == 0) {
re = (SRSLTE_CP_NSYMB(cp) - nof_ctrl_symbols - 2) * SRSLTE_NRE;

View File

@ -107,11 +107,15 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexErrMsgTxt("Error field PRBSet not found\n");
return;
}
uint32_t N_srs = 0;
mexutils_read_uint32_struct(PUSCHCFG, "Shortened", &N_srs);
cfg.grant.L_prb = mexutils_read_f(p, &prbset);
cfg.grant.n_prb[0] = prbset[0];
cfg.grant.n_prb[1] = prbset[0];
cfg.grant.lstart = 0;
cfg.grant.nof_symb = 2*(SRSLTE_CP_NSYMB(cell.cp)-1);
cfg.grant.nof_symb = 2*(SRSLTE_CP_NSYMB(cell.cp)-1) - N_srs;
cfg.grant.M_sc = cfg.grant.L_prb*SRSLTE_NRE;
cfg.grant.M_sc_init = cfg.grant.M_sc; // FIXME: What should M_sc_init be?
cfg.grant.nof_re = cfg.grant.nof_symb*cfg.grant.M_sc;
@ -181,7 +185,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexPrintf("I_cqi: %d, I_ri: %d, I_ack=%d\n", uci_data.I_offset_cqi, uci_data.I_offset_ri, uci_data.I_offset_ack);
mexPrintf("NofRE: %d, NofBits: %d, TBS: %d\n", cfg.grant.nof_re, cfg.grant.nof_bits, cfg.grant.mcs.tbs);
mexPrintf("NofRE: %d, NofBits: %d, TBS: %d, N_srs=%d\n", cfg.grant.nof_re, cfg.grant.nof_bits, cfg.grant.mcs.tbs, N_srs);
int r = srslte_pusch_uci_encode(&pusch, &cfg, &softbuffer, trblkin, uci_data, sf_symbols);
if (r < 0) {
mexErrMsgTxt("Error encoding PUSCH\n");

View File

@ -137,6 +137,10 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return;
}
uint32_t N_srs = 0;
mexutils_read_uint32_struct(PUSCHCFG, "Shortened", &N_srs);
cfg.grant.L_prb = mexutils_read_f(p, &prbset);
cfg.grant.n_prb[0] = prbset[0];
cfg.grant.n_prb[1] = prbset[0];
@ -145,14 +149,14 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
cfg.grant.n_prb[0] = prbset[0];
cfg.grant.n_prb[1] = prbset[0];
cfg.grant.lstart = 0;
cfg.grant.nof_symb = 2*(SRSLTE_CP_NSYMB(cell.cp)-1);
cfg.grant.nof_symb = 2*(SRSLTE_CP_NSYMB(cell.cp)-1) - N_srs;
cfg.grant.M_sc = cfg.grant.L_prb*SRSLTE_NRE;
cfg.grant.M_sc_init = cfg.grant.M_sc; // FIXME: What should M_sc_init be?
cfg.grant.nof_re = cfg.grant.nof_symb*cfg.grant.M_sc;
cfg.grant.Qm = srslte_mod_bits_x_symbol(cfg.grant.mcs.mod);
cfg.grant.nof_bits = cfg.grant.nof_re * cfg.grant.Qm;
mexPrintf("Q_m: %d, NPRB: %d, RV: %d\n", srslte_mod_bits_x_symbol(cfg.grant.mcs.mod), cfg.grant.L_prb, cfg.rv);
mexPrintf("Q_m: %d, NPRB: %d, RV: %d, Nsrs=%d\n", srslte_mod_bits_x_symbol(cfg.grant.mcs.mod), cfg.grant.L_prb, cfg.rv, N_srs);
if (srslte_cbsegm(&cfg.cb_segm, cfg.grant.mcs.tbs)) {
mexErrMsgTxt("Error configuring HARQ process\n");

View File

@ -324,6 +324,21 @@ int srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t find_offset, uint32
DEBUG("No space for CFO computation. Frame starts at \n",peak_pos);
}
/* Correct CFO with the averaged CFO estimation */
if (q->correct_cfo) {
srslte_cfo_correct(&q->cfocorr, input, input, -q->mean_cfo / q->fft_size);
}
// Try to detect SSS
if (q->sss_en) {
// Set an invalid N_id_1 indicating SSS is yet to be detected
q->N_id_1 = 1000;
if (sync_sss(q, input, find_offset + peak_pos, q->cp) < 0) {
DEBUG("No space for SSS processing. Frame starts at %d\n", peak_pos);
}
}
if (q->detect_cp) {
if (peak_pos + find_offset >= 2*(q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) {
q->cp = srslte_sync_detect_cp(q, input, peak_pos + find_offset);
@ -332,20 +347,6 @@ int srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t find_offset, uint32
}
}
// Try to detect SSS
if (q->sss_en) {
/* Correct CFO with the averaged CFO estimation */
if (q->mean_cfo && q->correct_cfo) {
srslte_cfo_correct(&q->cfocorr, input, input, -q->mean_cfo / q->fft_size);
}
// Set an invalid N_id_1 indicating SSS is yet to be detected
q->N_id_1 = 1000;
if (sync_sss(q, input, find_offset + peak_pos, q->cp) < 0) {
DEBUG("No space for SSS processing. Frame starts at %d\n", peak_pos);
}
}
// Return 1 (peak detected) even if we couldn't estimate CFO and SSS
ret = 1;
} else {

View File

@ -245,7 +245,7 @@ int srslte_ue_dl_decode_rnti_rv_packet(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_
} else if (ret == SRSLTE_ERROR_INVALID_INPUTS) {
fprintf(stderr, "Error calling srslte_pdsch_decode()\n");
} else if (ret == SRSLTE_SUCCESS) {
if (SRSLTE_VERBOSE_ISINFO()) {
if (SRSLTE_VERBOSE_ISDEBUG()) {
INFO("Decoded Message: ", 0);
srslte_vec_fprint_hex(stdout, data, q->pdsch_cfg.grant.mcs.tbs);
}