|
|
@ -293,6 +293,13 @@ void phch_worker::work_imp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Process RAR before UL to enable zero-delay Msg3
|
|
|
|
|
|
|
|
bool rar_delivered = false;
|
|
|
|
|
|
|
|
if (HARQ_DELAY_MS == MSG3_DELAY_MS && dl_mac_grant.rnti_type == SRSLTE_RNTI_RAR) {
|
|
|
|
|
|
|
|
rar_delivered = true;
|
|
|
|
|
|
|
|
phy->mac->tb_decoded(dl_ack[0], 0, dl_mac_grant.rnti_type, dl_mac_grant.pid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Decode PHICH
|
|
|
|
// Decode PHICH
|
|
|
|
bool ul_ack = false;
|
|
|
|
bool ul_ack = false;
|
|
|
|
bool ul_ack_available = decode_phich(&ul_ack);
|
|
|
|
bool ul_ack_available = decode_phich(&ul_ack);
|
|
|
@ -313,8 +320,8 @@ void phch_worker::work_imp()
|
|
|
|
set_uci_periodic_cqi();
|
|
|
|
set_uci_periodic_cqi();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* TTI offset for UL is always 4 for LTE */
|
|
|
|
/* TTI offset for UL */
|
|
|
|
ul_action.tti_offset = 4;
|
|
|
|
ul_action.tti_offset = HARQ_DELAY_MS;
|
|
|
|
|
|
|
|
|
|
|
|
/* Send UL grant or HARQ information (from PHICH) to MAC */
|
|
|
|
/* Send UL grant or HARQ information (from PHICH) to MAC */
|
|
|
|
if (ul_grant_available && ul_ack_available) {
|
|
|
|
if (ul_grant_available && ul_ack_available) {
|
|
|
@ -335,7 +342,7 @@ void phch_worker::work_imp()
|
|
|
|
&ul_action.softbuffers[0], ul_action.rv[0], ul_action.rnti, ul_mac_grant.is_from_rar);
|
|
|
|
&ul_action.softbuffers[0], ul_action.rv[0], ul_action.rnti, ul_mac_grant.is_from_rar);
|
|
|
|
signal_ready = true;
|
|
|
|
signal_ready = true;
|
|
|
|
if (ul_action.expect_ack) {
|
|
|
|
if (ul_action.expect_ack) {
|
|
|
|
phy->set_pending_ack(HARQ_RX(tti), ue_ul.pusch_cfg.grant.n_prb_tilde[0], ul_action.phy_grant.ul.ncs_dmrs);
|
|
|
|
phy->set_pending_ack(TTI_RX_ACK(tti), ue_ul.pusch_cfg.grant.n_prb_tilde[0], ul_action.phy_grant.ul.ncs_dmrs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if (dl_action.generate_ack || uci_data.scheduling_request || uci_data.uci_cqi_len > 0) {
|
|
|
|
} else if (dl_action.generate_ack || uci_data.scheduling_request || uci_data.uci_cqi_len > 0) {
|
|
|
@ -357,7 +364,7 @@ void phch_worker::work_imp()
|
|
|
|
if (!dl_action.generate_ack_callback) {
|
|
|
|
if (!dl_action.generate_ack_callback) {
|
|
|
|
if (dl_mac_grant.rnti_type == SRSLTE_RNTI_PCH && dl_action.decode_enabled[0]) {
|
|
|
|
if (dl_mac_grant.rnti_type == SRSLTE_RNTI_PCH && dl_action.decode_enabled[0]) {
|
|
|
|
phy->mac->pch_decoded_ok(dl_mac_grant.n_bytes[0]);
|
|
|
|
phy->mac->pch_decoded_ok(dl_mac_grant.n_bytes[0]);
|
|
|
|
} else {
|
|
|
|
} else if (!rar_delivered) {
|
|
|
|
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {
|
|
|
|
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {
|
|
|
|
if (dl_action.decode_enabled[tb]) {
|
|
|
|
if (dl_action.decode_enabled[tb]) {
|
|
|
|
phy->mac->tb_decoded(dl_ack[tb], tb, dl_mac_grant.rnti_type, dl_mac_grant.pid);
|
|
|
|
phy->mac->tb_decoded(dl_ack[tb], tb, dl_mac_grant.rnti_type, dl_mac_grant.pid);
|
|
|
@ -475,7 +482,7 @@ bool phch_worker::decode_pdcch_dl(srsue::mac_interface_phy::mac_grant_t* grant)
|
|
|
|
/* Fill MAC grant structure */
|
|
|
|
/* Fill MAC grant structure */
|
|
|
|
grant->ndi[0] = dci_unpacked.ndi;
|
|
|
|
grant->ndi[0] = dci_unpacked.ndi;
|
|
|
|
grant->ndi[1] = dci_unpacked.ndi_1;
|
|
|
|
grant->ndi[1] = dci_unpacked.ndi_1;
|
|
|
|
grant->pid = dci_unpacked.harq_process;
|
|
|
|
grant->pid = ASYNC_DL_SCHED?dci_unpacked.harq_process:(tti%(2*HARQ_DELAY_MS));
|
|
|
|
grant->n_bytes[0] = grant->phy_grant.dl.mcs[0].tbs / (uint32_t) 8;
|
|
|
|
grant->n_bytes[0] = grant->phy_grant.dl.mcs[0].tbs / (uint32_t) 8;
|
|
|
|
grant->n_bytes[1] = grant->phy_grant.dl.mcs[1].tbs / (uint32_t) 8;
|
|
|
|
grant->n_bytes[1] = grant->phy_grant.dl.mcs[1].tbs / (uint32_t) 8;
|
|
|
|
grant->tti = tti;
|
|
|
|
grant->tti = tti;
|
|
|
@ -663,7 +670,7 @@ bool phch_worker::decode_pdcch_ul(mac_interface_phy::mac_grant_t* grant)
|
|
|
|
char timestr[64];
|
|
|
|
char timestr[64];
|
|
|
|
timestr[0]='\0';
|
|
|
|
timestr[0]='\0';
|
|
|
|
|
|
|
|
|
|
|
|
phy->reset_pending_ack(HARQ_RX(tti));
|
|
|
|
phy->reset_pending_ack(TTI_RX_ACK(tti));
|
|
|
|
|
|
|
|
|
|
|
|
srslte_dci_msg_t dci_msg;
|
|
|
|
srslte_dci_msg_t dci_msg;
|
|
|
|
srslte_ra_ul_dci_t dci_unpacked;
|
|
|
|
srslte_ra_ul_dci_t dci_unpacked;
|
|
|
@ -776,7 +783,7 @@ void phch_worker::set_uci_sr()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uci_data.scheduling_request = false;
|
|
|
|
uci_data.scheduling_request = false;
|
|
|
|
if (phy->sr_enabled) {
|
|
|
|
if (phy->sr_enabled) {
|
|
|
|
uint32_t sr_tx_tti = HARQ_TX(tti);
|
|
|
|
uint32_t sr_tx_tti = TTI_TX(tti);
|
|
|
|
// Get I_sr parameter
|
|
|
|
// Get I_sr parameter
|
|
|
|
if (srslte_ue_ul_sr_send_tti(I_sr, sr_tx_tti)) {
|
|
|
|
if (srslte_ue_ul_sr_send_tti(I_sr, sr_tx_tti)) {
|
|
|
|
Info("PUCCH: SR transmission at TTI=%d, I_sr=%d\n", sr_tx_tti, I_sr);
|
|
|
|
Info("PUCCH: SR transmission at TTI=%d, I_sr=%d\n", sr_tx_tti, I_sr);
|
|
|
@ -793,7 +800,7 @@ void phch_worker::set_uci_periodic_cqi()
|
|
|
|
int cqi_max = phy->args->cqi_max;
|
|
|
|
int cqi_max = phy->args->cqi_max;
|
|
|
|
|
|
|
|
|
|
|
|
if (period_cqi.configured && rnti_is_set) {
|
|
|
|
if (period_cqi.configured && rnti_is_set) {
|
|
|
|
if (period_cqi.ri_idx_present && srslte_ri_send(period_cqi.pmi_idx, period_cqi.ri_idx, HARQ_TX(tti))) {
|
|
|
|
if (period_cqi.ri_idx_present && srslte_ri_send(period_cqi.pmi_idx, period_cqi.ri_idx, TTI_TX(tti))) {
|
|
|
|
if (uci_data.uci_ri_len) {
|
|
|
|
if (uci_data.uci_ri_len) {
|
|
|
|
uci_data.uci_cqi[0] = uci_data.uci_ri;
|
|
|
|
uci_data.uci_cqi[0] = uci_data.uci_ri;
|
|
|
|
uci_data.uci_cqi_len = uci_data.uci_ri_len;
|
|
|
|
uci_data.uci_cqi_len = uci_data.uci_ri_len;
|
|
|
@ -802,7 +809,7 @@ void phch_worker::set_uci_periodic_cqi()
|
|
|
|
uci_data.uci_pmi_len = 0;
|
|
|
|
uci_data.uci_pmi_len = 0;
|
|
|
|
Info("PUCCH: Periodic RI=%d\n", uci_data.uci_cqi[0]);
|
|
|
|
Info("PUCCH: Periodic RI=%d\n", uci_data.uci_cqi[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (srslte_cqi_send(period_cqi.pmi_idx, HARQ_TX(tti))) {
|
|
|
|
} else if (srslte_cqi_send(period_cqi.pmi_idx, TTI_TX(tti))) {
|
|
|
|
srslte_cqi_value_t cqi_report;
|
|
|
|
srslte_cqi_value_t cqi_report;
|
|
|
|
if (period_cqi.format_is_subband) {
|
|
|
|
if (period_cqi.format_is_subband) {
|
|
|
|
// TODO: Implement subband periodic reports
|
|
|
|
// TODO: Implement subband periodic reports
|
|
|
@ -868,8 +875,8 @@ void phch_worker::set_uci_aperiodic_cqi()
|
|
|
|
|
|
|
|
|
|
|
|
bool phch_worker::srs_is_ready_to_send() {
|
|
|
|
bool phch_worker::srs_is_ready_to_send() {
|
|
|
|
if (srs_cfg.configured) {
|
|
|
|
if (srs_cfg.configured) {
|
|
|
|
if (srslte_refsignal_srs_send_cs(srs_cfg.subframe_config, HARQ_RX(tti)%10) == 1 &&
|
|
|
|
if (srslte_refsignal_srs_send_cs(srs_cfg.subframe_config, TTI_TX(tti)%10) == 1 &&
|
|
|
|
srslte_refsignal_srs_send_ue(srs_cfg.I_srs, HARQ_TX(tti)) == 1)
|
|
|
|
srslte_refsignal_srs_send_ue(srs_cfg.I_srs, TTI_TX(tti)) == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -889,7 +896,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui
|
|
|
|
char timestr[64];
|
|
|
|
char timestr[64];
|
|
|
|
timestr[0]='\0';
|
|
|
|
timestr[0]='\0';
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_ue_ul_cfg_grant(&ue_ul, grant, HARQ_TX(tti), rv, current_tx_nb)) {
|
|
|
|
if (srslte_ue_ul_cfg_grant(&ue_ul, grant, TTI_TX(tti), rv, current_tx_nb)) {
|
|
|
|
Error("Configuring UL grant\n");
|
|
|
|
Error("Configuring UL grant\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -919,7 +926,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
Info("PUSCH: tti_tx=%d, n_prb=%d, rb_start=%d, tbs=%d, mod=%d, mcs=%d, rv_idx=%d, ack=%s, ri=%s, cfo=%.1f Hz%s\n",
|
|
|
|
Info("PUSCH: tti_tx=%d, n_prb=%d, rb_start=%d, tbs=%d, mod=%d, mcs=%d, rv_idx=%d, ack=%s, ri=%s, cfo=%.1f Hz%s\n",
|
|
|
|
HARQ_TX(tti),
|
|
|
|
TTI_TX(tti),
|
|
|
|
grant->L_prb, grant->n_prb[0],
|
|
|
|
grant->L_prb, grant->n_prb[0],
|
|
|
|
grant->mcs.tbs/8, grant->mcs.mod, grant->mcs.idx, rv,
|
|
|
|
grant->mcs.tbs/8, grant->mcs.mod, grant->mcs.idx, rv,
|
|
|
|
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",
|
|
|
|
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",
|
|
|
@ -950,7 +957,7 @@ void phch_worker::encode_pucch()
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_ue_ul_pucch_encode(&ue_ul, uci_data, last_dl_pdcch_ncce, HARQ_TX(tti), signal_buffer[0])) {
|
|
|
|
if (srslte_ue_ul_pucch_encode(&ue_ul, uci_data, last_dl_pdcch_ncce, TTI_TX(tti), signal_buffer[0])) {
|
|
|
|
Error("Encoding PUCCH\n");
|
|
|
|
Error("Encoding PUCCH\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -966,7 +973,7 @@ void phch_worker::encode_pucch()
|
|
|
|
float gain = set_power(tx_power);
|
|
|
|
float gain = set_power(tx_power);
|
|
|
|
|
|
|
|
|
|
|
|
Info("PUCCH: tti_tx=%d, n_cce=%3d, n_pucch=%d, n_prb=%d, ack=%s%s, ri=%s, pmi=%s%s, sr=%s, cfo=%.1f Hz%s\n",
|
|
|
|
Info("PUCCH: tti_tx=%d, n_cce=%3d, n_pucch=%d, n_prb=%d, ack=%s%s, ri=%s, pmi=%s%s, sr=%s, cfo=%.1f Hz%s\n",
|
|
|
|
HARQ_TX(tti),
|
|
|
|
TTI_TX(tti),
|
|
|
|
last_dl_pdcch_ncce, ue_ul.pucch.last_n_pucch, ue_ul.pucch.last_n_prb,
|
|
|
|
last_dl_pdcch_ncce, ue_ul.pucch.last_n_pucch, ue_ul.pucch.last_n_prb,
|
|
|
|
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",
|
|
|
|
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",
|
|
|
|
uci_data.uci_ack_len>1?(uci_data.uci_ack_2?"1":"0"):"",
|
|
|
|
uci_data.uci_ack_len>1?(uci_data.uci_ack_2?"1":"0"):"",
|
|
|
@ -987,7 +994,7 @@ void phch_worker::encode_srs()
|
|
|
|
char timestr[64];
|
|
|
|
char timestr[64];
|
|
|
|
timestr[0]='\0';
|
|
|
|
timestr[0]='\0';
|
|
|
|
|
|
|
|
|
|
|
|
if (srslte_ue_ul_srs_encode(&ue_ul, HARQ_TX(tti), signal_buffer[0]))
|
|
|
|
if (srslte_ue_ul_srs_encode(&ue_ul, TTI_TX(tti), signal_buffer[0]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Error("Encoding SRS\n");
|
|
|
|
Error("Encoding SRS\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1002,7 +1009,7 @@ void phch_worker::encode_srs()
|
|
|
|
float gain = set_power(tx_power);
|
|
|
|
float gain = set_power(tx_power);
|
|
|
|
uint32_t fi = srslte_vec_max_fi((float*) signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
uint32_t fi = srslte_vec_max_fi((float*) signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
float *f = (float*) signal_buffer;
|
|
|
|
float *f = (float*) signal_buffer;
|
|
|
|
Info("SRS: power=%.2f dBm, tti_tx=%d%s\n", tx_power, HARQ_TX(tti), timestr);
|
|
|
|
Info("SRS: power=%.2f dBm, tti_tx=%d%s\n", tx_power, TTI_TX(tti), timestr);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|