Initial commit: 1 thread per TTI

master
ismagom 10 years ago
commit 487b00817f

@ -93,7 +93,7 @@ private:
qbuff msg3_buff; qbuff msg3_buff;
/* PDU Buffer */ /* PDU Buffer */
static const uint32_t PDU_BUFF_SZ = 16*1024; static const uint32_t PDU_BUFF_SZ = 128*1024;
qbuff pdu_buff; qbuff pdu_buff;
sch_pdu pdu_msg; sch_pdu pdu_msg;
bool msg3_has_been_transmitted; bool msg3_has_been_transmitted;

@ -174,7 +174,7 @@ void dl_harq_entity::dl_harq_process::receive_data(uint32_t tti, srslte::ue::dl_
} }
} }
} else { } else {
Warning("DL PID %d: Received duplicate TB. Discarting and retransmitting ACK\n"); Warning("DL PID %d: Received duplicate TB. Discarting and retransmitting ACK\n", pid);
} }
if (pid == HARQ_BCCH_PID || harq_entity->timers_db->get(mac::TIME_ALIGNMENT)->is_expired()) { if (pid == HARQ_BCCH_PID || harq_entity->timers_db->get(mac::TIME_ALIGNMENT)->is_expired()) {
// Do not generate ACK // Do not generate ACK
@ -203,13 +203,24 @@ void dl_harq_entity::dl_harq_process::receive_data(uint32_t tti, srslte::ue::dl_
void dl_harq_entity::dl_harq_process::set_harq_info(srslte::ue::dl_sched_grant* new_grant) { void dl_harq_entity::dl_harq_process::set_harq_info(srslte::ue::dl_sched_grant* new_grant) {
bool is_new_transmission = false; bool is_new_transmission = false;
if ((new_grant->get_ndi() != cur_grant.get_ndi() && new_grant->get_tbs() == cur_grant.get_tbs()) || // NDI toggled for same TB (assume TB is identified by TBS) bool is_new_tb = true;
(pid == HARQ_BCCH_PID && new_grant->get_rv() == 0) || // Broadcast PID and 1st TX (RV=0) if (srslte_tti_interval(new_grant->get_tti(), cur_grant.get_tti()) <= 8 &&
(new_grant->get_tbs() != cur_grant.get_tbs())) // First transmission for this TB new_grant->get_tbs() == cur_grant.get_tbs())
{
is_new_tb = false;
}
if ((new_grant->get_ndi() != cur_grant.get_ndi() && !is_new_tb) || // NDI toggled for same TB
is_new_tb || // is new TB
(pid == HARQ_BCCH_PID && new_grant->get_rv() == 0)) // Broadcast PID and 1st TX (RV=0)
{ {
is_new_transmission = true; is_new_transmission = true;
Debug("Set HARQ Info for new transmission\n"); Debug("Set HARQ Info for new transmission\n");
} else { } else {
if (!is_new_tb) {
Info("old_tbs=%d, new_tbs=%d, old_tti=%d new_tti=%d\n", cur_grant.get_tbs(), new_grant->get_tbs(),
cur_grant.get_tti(), new_grant->get_tti());
}
is_new_transmission = false; is_new_transmission = false;
Debug("Set HARQ Info for retransmission\n"); Debug("Set HARQ Info for retransmission\n");
} }

@ -596,7 +596,7 @@ bool mac::tti_thread::init(mac* parent_, tti_sync_cv *sync_)
{ {
parent = parent_; parent = parent_;
log_h = parent->log_h; log_h = parent->log_h;
sync_ = sync; sync = sync_;
started = threads_new_rt(&thread, tti_thread_runner, this); started = threads_new_rt(&thread, tti_thread_runner, this);
return started; return started;

@ -179,7 +179,7 @@ sch_subh::cetype bsr_format_convert(bsr_proc::bsr_format_t format) {
} }
} }
int pkt_num=0;
bool mux::assemble_pdu(uint32_t pdu_sz_nbits) { bool mux::assemble_pdu(uint32_t pdu_sz_nbits) {
uint8_t *buff = (uint8_t*) pdu_buff.request(); uint8_t *buff = (uint8_t*) pdu_buff.request();
@ -238,8 +238,14 @@ bool mux::assemble_pdu(uint32_t pdu_sz_nbits) {
pdu_msg.update_space_ce(bsr_payload_sz); pdu_msg.update_space_ce(bsr_payload_sz);
} }
} }
pkt_num++;
// MAC control element for PHR // MAC control element for PHR
// TODO if (pkt_num == 2) {
if (pdu_msg.new_subh()) {
pdu_msg.next();
pdu_msg.get()->set_phd(46);
}
}
// data from any Logical Channel, except data from UL-CCCH; // data from any Logical Channel, except data from UL-CCCH;
// first only those with positive Bj // first only those with positive Bj

@ -169,7 +169,8 @@ bool sch_pdu::write_packet(uint8_t* ptr)
} }
// Set paddint to zeros (if any) // Set paddint to zeros (if any)
bzero(ptr, rem_len*sizeof(uint8_t)*8); bzero(ptr, rem_len*sizeof(uint8_t)*8);
return true;
} }
uint32_t sch_pdu::rem_size() { uint32_t sch_pdu::rem_size() {
@ -572,6 +573,8 @@ bool rar_pdu::write_packet(uint8_t* ptr)
} }
// Set paddint to zeros (if any) // Set paddint to zeros (if any)
bzero(ptr, rem_len*sizeof(uint8_t)*8); bzero(ptr, rem_len*sizeof(uint8_t)*8);
return true;
} }

@ -152,14 +152,6 @@ bool ra_proc::is_error() {
return state == RA_PROBLEM; return state == RA_PROBLEM;
} }
uint32_t interval(uint32_t x1, uint32_t x2) {
if (x1 > x2) {
return x1-x2;
} else {
return 10240-x2+x1;
}
}
const char* state_str[11] = {"Idle", const char* state_str[11] = {"Idle",
"RA Initializat.: ", "RA Initializat.: ",
"RA Initial.Wait: ", "RA Initial.Wait: ",
@ -277,7 +269,7 @@ void ra_proc::step_response_reception() {
ra_rnti = 1+ra_tti%10; // f_id=0 for FDD ra_rnti = 1+ra_tti%10; // f_id=0 for FDD
dl_sched_grant rar_grant(ra_rnti); dl_sched_grant rar_grant(ra_rnti);
uint32_t interval_ra = interval(tti, ra_tti); uint32_t interval_ra = srslte_tti_interval(tti, ra_tti);
// Try to decode RAR only within the RA response window // Try to decode RAR only within the RA response window
if (interval_ra >= 3 && interval_ra <= 3+responseWindowSize) { if (interval_ra >= 3 && interval_ra <= 3+responseWindowSize) {
@ -402,7 +394,7 @@ void ra_proc::step_response_error() {
} }
void ra_proc::step_backoff_wait() { void ra_proc::step_backoff_wait() {
if (interval(tti, backoff_interval_start) >= backoff_inteval) { if (srslte_tti_interval(tti, backoff_interval_start) >= backoff_inteval) {
state = RESOURCE_SELECTION; state = RESOURCE_SELECTION;
} }
} }

@ -124,9 +124,11 @@ public:
void start_trace(); void start_trace();
void write_trace(std::string filename); void write_trace(std::string filename);
void main_radio_loop(); bool sr_is_ready_to_send(uint32_t tti);
bool sr_is_ready_to_send(uint32_t tti); bool cqi_is_ready_to_send(uint32_t tti);
void main_radio_loop();
private: private:
enum { enum {
IDLE, RXTX IDLE, RXTX

@ -93,6 +93,12 @@ namespace ue {
SRS_CS_ACKNACKSIMUL, SRS_CS_ACKNACKSIMUL,
SRS_IS_CONFIGURED, SRS_IS_CONFIGURED,
CQI_PERIODIC_PMI_IDX,
CQI_PERIODIC_SIMULT_ACK,
CQI_PERIODIC_FORMAT_SUBBAND,
CQI_PERIODIC_FORMAT_SUBBAND_K,
CQI_PERIODIC_CONFIGURED,
UCI_I_OFFSET_ACK, UCI_I_OFFSET_ACK,
UCI_I_OFFSET_RI, UCI_I_OFFSET_RI,
UCI_I_OFFSET_CQI, UCI_I_OFFSET_CQI,

@ -80,6 +80,12 @@ namespace ue {
bool is_tpc_rnti() { bool is_tpc_rnti() {
return (rnti_type == RNTI_TYPE_TPC_PUSCH || rnti_type == RNTI_TYPE_TPC_PUCCH); return (rnti_type == RNTI_TYPE_TPC_PUSCH || rnti_type == RNTI_TYPE_TPC_PUCCH);
} }
uint32_t get_tti() {
return tti;
}
void set_tti(uint32_t tti_) {
tti = tti_;
}
virtual uint32_t get_rv() = 0; virtual uint32_t get_rv() = 0;
virtual void set_rv(uint32_t rv) = 0; virtual void set_rv(uint32_t rv) = 0;
virtual bool get_ndi() = 0; virtual bool get_ndi() = 0;
@ -89,6 +95,7 @@ namespace ue {
protected: protected:
uint16_t rnti; uint16_t rnti;
rnti_type_t rnti_type; rnti_type_t rnti_type;
uint32_t tti;
}; };
} }

@ -117,6 +117,8 @@ bool dl_buffer::get_ul_grant(ul_sched_grant *grant)
return false; return false;
} }
grant->set_tti(tti);
Info("PDCCH: UL DCI Format0 cce_index=%d, n_data_bits=%d\n", ue_dl.last_n_cce, dci_msg.nof_bits); Info("PDCCH: UL DCI Format0 cce_index=%d, n_data_bits=%d\n", ue_dl.last_n_cce, dci_msg.nof_bits);
return grant->create_from_dci(&dci_msg, cell, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET)); return grant->create_from_dci(&dci_msg, cell, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
@ -167,7 +169,9 @@ bool dl_buffer::get_dl_grant(dl_sched_grant *grant)
if (srslte_ue_dl_find_dl_dci(&ue_dl, &dci_msg, cfi, tti%10, grant->get_rnti()) != 1) { if (srslte_ue_dl_find_dl_dci(&ue_dl, &dci_msg, cfi, tti%10, grant->get_rnti()) != 1) {
return false; return false;
} }
grant->set_tti(tti);
Info("PDCCH: DL DCI %s cce_index=%d, n_data_bits=%d\n", grant->get_dciformat_string(), ue_dl.last_n_cce, dci_msg.nof_bits); Info("PDCCH: DL DCI %s cce_index=%d, n_data_bits=%d\n", grant->get_dciformat_string(), ue_dl.last_n_cce, dci_msg.nof_bits);
return grant->create_from_dci(&dci_msg, cell.nof_prb, srslte_ue_dl_get_ncce(&ue_dl)); return grant->create_from_dci(&dci_msg, cell.nof_prb, srslte_ue_dl_get_ncce(&ue_dl));

@ -195,6 +195,19 @@ int phy::sr_last_tx_tti() {
} }
} }
bool phy::cqi_is_ready_to_send(uint32_t tti)
{
/*
if (params_db.get_param(phy_params::CQI_PERIODIC_CONFIGURED)) {
if (srslte_cqi_send(params_db.get_param(phy_params::CQI_PERIODIC_PMI_IDX), tti)) {
Warning("Sending PUCCH CQI\n");
return true;
}
}
*/
return false;
}
bool phy::sr_is_ready_to_send(uint32_t tti_) { bool phy::sr_is_ready_to_send(uint32_t tti_) {
if (sr_enabled) { if (sr_enabled) {
// Get I_sr parameter // Get I_sr parameter
@ -534,7 +547,6 @@ void phy::run_rx_tx_state()
Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain); Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain);
} else if (get_ul_buffer_adv(current_tti)->is_end_of_burst()) { } else if (get_ul_buffer_adv(current_tti)->is_end_of_burst()) {
radio_handler->tx_end(); radio_handler->tx_end();
Info("Sending TX END\n");
} }
// Receive alligned buffer for the current tti // Receive alligned buffer for the current tti

@ -98,7 +98,10 @@ void ul_buffer::set_current_tx_nb(uint32_t current_tx_nb_)
bool ul_buffer::generate_cqi_report() bool ul_buffer::generate_cqi_report()
{ {
return false; uci_data.uci_cqi_len = 4;
uint8_t cqi[4] = {1, 1, 1, 1};
uci_data.uci_cqi = cqi;
return true;
} }
bool ul_buffer::generate_sr() { bool ul_buffer::generate_sr() {
@ -216,6 +219,13 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
int n = 0; int n = 0;
// Transmit on PUSCH if UL grant available, otherwise in PUCCH // Transmit on PUSCH if UL grant available, otherwise in PUCCH
if (grant) { if (grant) {
if (params_db->get_param(phy_params::CQI_PERIODIC_CONFIGURED)) {
if (srslte_cqi_send(params_db->get_param(phy_params::CQI_PERIODIC_PMI_IDX), tti)) {
generate_cqi_report();
}
}
srslte_pusch_hopping_cfg_t pusch_hopping_cfg; srslte_pusch_hopping_cfg_t pusch_hopping_cfg;
bzero(&pusch_hopping_cfg, sizeof(srslte_pusch_hopping_cfg_t)); bzero(&pusch_hopping_cfg, sizeof(srslte_pusch_hopping_cfg_t));
@ -233,6 +243,11 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
softbuffer, softbuffer,
grant->get_rnti(), grant->get_rnti(),
signal_buffer); signal_buffer);
if (ue_ul.pusch.shortened) {
Warning("PUSCH shortened on tti=%d\n", tti);
}
Info("PUSCH: TTI=%d, CFO= %.1f KHz TBS=%d, mod=%s, rb_start=%d n_prb=%d, ack=%s, sr=%s, rnti=%d, shortened=%s\n", Info("PUSCH: TTI=%d, CFO= %.1f KHz TBS=%d, mod=%s, rb_start=%d n_prb=%d, ack=%s, sr=%s, rnti=%d, shortened=%s\n",
tti, cfo*15e3, grant->get_tbs(), srslte_mod_string(ue_ul.pusch_cfg.grant.mcs.mod), ue_ul.pusch_cfg.grant.n_prb[0], tti, cfo*15e3, grant->get_tbs(), srslte_mod_string(ue_ul.pusch_cfg.grant.mcs.mod), ue_ul.pusch_cfg.grant.n_prb[0],
@ -299,7 +314,7 @@ void ul_buffer::set_tx_params(float cfo_, float time_adv_sec, srslte_timestamp_t
void ul_buffer::set_end_of_burst() void ul_buffer::set_end_of_burst()
{ {
Info("Is end of burst\n"); Info("TTI %d Is end of burst\n", tti);
tti_is_end_of_burst = true; tti_is_end_of_burst = true;
} }

@ -244,6 +244,7 @@ SRSLTE_API int srslte_band_get_fd_region(enum band_geographical_area region,
SRSLTE_API int srslte_str2mimotype(char *mimo_type_str, SRSLTE_API int srslte_str2mimotype(char *mimo_type_str,
srslte_mimo_type_t *type); srslte_mimo_type_t *type);
SRSLTE_API uint32_t srslte_tti_interval(uint32_t tti1,
uint32_t tti2);
#endif #endif

@ -94,4 +94,7 @@ SRSLTE_API int srslte_cqi_format2_subband_pack(srslte_cqi_format2_subband_t *msg
uint8_t *buff, uint8_t *buff,
uint32_t buff_len); uint32_t buff_len);
SRSLTE_API bool srslte_cqi_send(uint32_t I_cqi_pmi,
uint32_t tti);
#endif // CQI_ #endif // CQI_

@ -315,7 +315,7 @@ bool srslte_refsignal_dmrs_pusch_cfg_isvalid(srslte_refsignal_ul_t *q, srslte_re
if (cfg->cyclic_shift < SRSLTE_NOF_CSHIFT && if (cfg->cyclic_shift < SRSLTE_NOF_CSHIFT &&
cfg->cyclic_shift_for_dmrs < SRSLTE_NOF_CSHIFT && cfg->cyclic_shift_for_dmrs < SRSLTE_NOF_CSHIFT &&
cfg->delta_ss < SRSLTE_NOF_DELTA_SS && cfg->delta_ss < SRSLTE_NOF_DELTA_SS &&
nof_prb < q->cell.nof_prb) { nof_prb <= q->cell.nof_prb) {
return true; return true;
} else { } else {
return false; return false;

@ -422,3 +422,14 @@ int srslte_band_get_fd_region(enum band_geographical_area region, srslte_earfcn_
return nof_fd; return nof_fd;
} }
/* Returns the interval tti1-tti2 mod 10240 */
uint32_t srslte_tti_interval(uint32_t tti1, uint32_t tti2) {
if (tti1 > tti2) {
return tti1-tti2;
} else {
return 10240-tti2+tti1;
}
}

@ -48,7 +48,7 @@ int srslte_dft_precoding_init(srslte_dft_precoding_t *q, uint32_t max_prb)
if (max_prb <= SRSLTE_MAX_PRB) { if (max_prb <= SRSLTE_MAX_PRB) {
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;
for (uint32_t i=1;i<max_prb;i++) { for (uint32_t i=1;i<=max_prb;i++) {
if(srslte_dft_precoding_valid_prb(i)) { if(srslte_dft_precoding_valid_prb(i)) {
DEBUG("Initiating DFT precoding plan for %d PRBs\n", i); DEBUG("Initiating DFT precoding plan for %d PRBs\n", i);
if (srslte_dft_plan_c(&q->dft_plan[i], i*SRSLTE_NRE, SRSLTE_DFT_FORWARD)) { if (srslte_dft_plan_c(&q->dft_plan[i], i*SRSLTE_NRE, SRSLTE_DFT_FORWARD)) {
@ -77,7 +77,7 @@ clean_exit:
/* Free DFT plans for transform precoding */ /* Free DFT plans for transform precoding */
void srslte_dft_precoding_free(srslte_dft_precoding_t *q) void srslte_dft_precoding_free(srslte_dft_precoding_t *q)
{ {
for (uint32_t i=1;i<q->max_prb;i++) { for (uint32_t i=1;i<=q->max_prb;i++) {
if(srslte_dft_precoding_valid_prb(i)) { if(srslte_dft_precoding_valid_prb(i)) {
DEBUG("Freeing DFT precoding plan for %d PRBs\n", i); DEBUG("Freeing DFT precoding plan for %d PRBs\n", i);
srslte_dft_plan_free(&q->dft_plan[i]); srslte_dft_plan_free(&q->dft_plan[i]);
@ -99,7 +99,7 @@ int srslte_dft_precoding(srslte_dft_precoding_t *q, cf_t *input, cf_t *output,
uint32_t nof_prb, uint32_t nof_symbols) uint32_t nof_prb, uint32_t nof_symbols)
{ {
if (!srslte_dft_precoding_valid_prb(nof_prb)) { if (!srslte_dft_precoding_valid_prb(nof_prb) && nof_prb <= q->max_prb) {
fprintf(stderr, "Error invalid number of PRB (%d)\n", nof_prb); fprintf(stderr, "Error invalid number of PRB (%d)\n", nof_prb);
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -114,7 +114,7 @@ int srslte_dft_precoding(srslte_dft_precoding_t *q, cf_t *input, cf_t *output,
int srslte_dft_predecoding(srslte_dft_precoding_t *q, cf_t *input, cf_t *output, int srslte_dft_predecoding(srslte_dft_precoding_t *q, cf_t *input, cf_t *output,
uint32_t nof_prb, uint32_t nof_symbols) uint32_t nof_prb, uint32_t nof_symbols)
{ {
if (!srslte_dft_precoding_valid_prb(nof_prb)) { if (!srslte_dft_precoding_valid_prb(nof_prb) && nof_prb <= q->max_prb) {
fprintf(stderr, "Error invalid number of PRB (%d)\n", nof_prb); fprintf(stderr, "Error invalid number of PRB (%d)\n", nof_prb);
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }

@ -75,3 +75,51 @@ int srslte_cqi_format2_subband_pack(srslte_cqi_format2_subband_t *msg, uint8_t *
return 4+1; return 4+1;
} }
bool srslte_cqi_send(uint32_t I_cqi_pmi, uint32_t tti) {
uint32_t N_p = 0;
uint32_t N_offset = 0;
if (I_cqi_pmi <= 1) {
N_p = 2;
N_offset = I_cqi_pmi;
} else if (I_cqi_pmi <= 6) {
N_p = 5;
N_offset = I_cqi_pmi - 2;
} else if (I_cqi_pmi <= 16) {
N_p = 10;
N_offset = I_cqi_pmi - 7;
} else if (I_cqi_pmi <= 36) {
N_p = 20;
N_offset = I_cqi_pmi - 17;
} else if (I_cqi_pmi <= 76) {
N_p = 40;
N_offset = I_cqi_pmi - 37;
} else if (I_cqi_pmi <= 156) {
N_p = 80;
N_offset = I_cqi_pmi - 77;
} else if (I_cqi_pmi <= 316) {
N_p = 160;
N_offset = I_cqi_pmi - 157;
} else if (I_cqi_pmi == 317) {
return false;
} else if (I_cqi_pmi <= 349) {
N_p = 32;
N_offset = I_cqi_pmi - 318;
} else if (I_cqi_pmi <= 413) {
N_p = 64;
N_offset = I_cqi_pmi - 350;
} else if (I_cqi_pmi <= 541) {
N_p = 128;
N_offset = I_cqi_pmi - 414;
} else if (I_cqi_pmi <= 1023) {
return false;
}
if ((tti-N_offset)%N_p == 0) {
return true;
} else {
return false;
}
}

@ -335,28 +335,36 @@ int srslte_pusch_cfg(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srslte_dci_msg_
if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1 && if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1 &&
srslte_refsignal_srs_send_ue(srs_cfg->I_srs, tti) == 1) srslte_refsignal_srs_send_ue(srs_cfg->I_srs, tti) == 1)
{ {
printf("PUSCH shorteneed for SRS UE transmission\n");
q->shortened = true; q->shortened = true;
} /* If RBs are contiguous, PUSCH is not shortened */
// If not coincides with UE transmission. PUSCH shall be shortened if cell-specific SRS transmission RB coincides with PUSCH allocated RB
if (!q->shortened) {
uint32_t k0_srs = srslte_refsignal_srs_rb_start_cs(srs_cfg->bw_cfg, q->cell.nof_prb); uint32_t k0_srs = srslte_refsignal_srs_rb_start_cs(srs_cfg->bw_cfg, q->cell.nof_prb);
uint32_t nrb_srs = srslte_refsignal_srs_rb_L_cs(srs_cfg->bw_cfg, q->cell.nof_prb); uint32_t nrb_srs = srslte_refsignal_srs_rb_L_cs(srs_cfg->bw_cfg, q->cell.nof_prb);
for (uint32_t ns=0;ns<2 && !q->shortened;ns++) { for (uint32_t ns=0;ns<2 && q->shortened;ns++) {
if ((cfg->grant.n_prb_tilde[ns] >= k0_srs && cfg->grant.n_prb_tilde[ns] < k0_srs + nrb_srs) || if (cfg->grant.n_prb_tilde[ns] != k0_srs + nrb_srs || // If grant allocation starts when SRS ends
(cfg->grant.n_prb_tilde[ns] + cfg->grant.L_prb >= k0_srs && cfg->grant.n_prb_tilde[ns] + cfg->grant.L_prb != k0_srs) // or SRS allocation starts when grant ends
cfg->grant.n_prb_tilde[ns] + cfg->grant.L_prb < k0_srs + nrb_srs)) {
{ q->shortened = false;
q->shortened = true;
printf("CS n_prb=%d, L=%d, k0=%d, nrb=%d\n", cfg->grant.n_prb_tilde[ns], cfg->grant.L_prb, k0_srs, nrb_srs);
} }
} }
} }
} // If not coincides with UE transmission. PUSCH shall be shortened if cell-specific SRS transmission RB
//coincides with PUSCH allocated RB
if (q->shortened) { if (!q->shortened) {
printf("PUSCH is shortened TTI=%d\n", tti); if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1) {
} uint32_t k0_srs = srslte_refsignal_srs_rb_start_cs(srs_cfg->bw_cfg, q->cell.nof_prb);
uint32_t nrb_srs = srslte_refsignal_srs_rb_L_cs(srs_cfg->bw_cfg, q->cell.nof_prb);
for (uint32_t ns=0;ns<2 && !q->shortened;ns++) {
if ((cfg->grant.n_prb_tilde[ns] >= k0_srs && cfg->grant.n_prb_tilde[ns] < k0_srs + nrb_srs) ||
(cfg->grant.n_prb_tilde[ns] + cfg->grant.L_prb >= k0_srs &&
cfg->grant.n_prb_tilde[ns] + cfg->grant.L_prb < k0_srs + nrb_srs) ||
(cfg->grant.n_prb_tilde[ns] <= k0_srs && cfg->grant.n_prb_tilde[ns] + cfg->grant.L_prb >= k0_srs + nrb_srs))
{
q->shortened = true;
}
}
}
}
}
} }
/* Compute final number of bits and RE */ /* Compute final number of bits and RE */
@ -514,7 +522,7 @@ int srslte_pusch_uci_encode_rnti(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srs
fprintf(stderr, "Error encoding TB\n"); fprintf(stderr, "Error encoding TB\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (rnti != q->rnti) { if (rnti != q->rnti) {
srslte_sequence_t seq; srslte_sequence_t seq;
if (srslte_sequence_pusch(&seq, rnti, 2 * cfg->sf_idx, q->cell.id, cfg->nbits.nof_bits)) { if (srslte_sequence_pusch(&seq, rnti, 2 * cfg->sf_idx, q->cell.id, cfg->nbits.nof_bits)) {
@ -525,7 +533,6 @@ int srslte_pusch_uci_encode_rnti(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srs
} else { } else {
srslte_scrambling_b_offset_pusch(&q->seq[cfg->sf_idx], (uint8_t*) q->q, 0, cfg->nbits.nof_bits); srslte_scrambling_b_offset_pusch(&q->seq[cfg->sf_idx], (uint8_t*) q->q, 0, cfg->nbits.nof_bits);
} }
srslte_mod_modulate(&q->mod[cfg->grant.mcs.mod], (uint8_t*) q->q, q->d, cfg->nbits.nof_bits); srslte_mod_modulate(&q->mod[cfg->grant.mcs.mod], (uint8_t*) q->q, q->d, cfg->nbits.nof_bits);
srslte_dft_precoding(&q->dft_precoding, q->d, q->z, cfg->grant.L_prb, cfg->nbits.nof_symb); srslte_dft_precoding(&q->dft_precoding, q->d, q->z, cfg->grant.L_prb, cfg->nbits.nof_symb);

Loading…
Cancel
Save