|
|
|
@ -45,6 +45,7 @@ bool dl_buffer::init_cell(srslte_cell_t cell_, phy_params *params_db_)
|
|
|
|
|
cell = cell_;
|
|
|
|
|
sf_symbols_and_ce_done = false;
|
|
|
|
|
pdcch_llr_extracted = false;
|
|
|
|
|
pending_rar_grant = false;
|
|
|
|
|
tti = 0;
|
|
|
|
|
if (!srslte_ue_dl_init(&ue_dl, cell)) {
|
|
|
|
|
signal_buffer = (cf_t*) srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
|
|
|
@ -81,33 +82,55 @@ bool dl_buffer::recv_ue_sync(srslte_ue_sync_t *ue_sync, srslte_timestamp_t *rx_t
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dl_buffer::get_ul_grant(pdcch_ul_search_t mode, ul_sched_grant *grant)
|
|
|
|
|
void dl_buffer::discard_pending_rar_grant() {
|
|
|
|
|
pending_rar_grant = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dl_buffer::get_ul_grant(ul_sched_grant *grant)
|
|
|
|
|
{
|
|
|
|
|
if (signal_buffer) {
|
|
|
|
|
if (!sf_symbols_and_ce_done) {
|
|
|
|
|
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {
|
|
|
|
|
return false;
|
|
|
|
|
printf("get_ul_grant tti=%d, is_temp_rnti=%d\n", tti, grant->is_temp_rnti());
|
|
|
|
|
if (pending_rar_grant && grant->is_temp_rnti()) {
|
|
|
|
|
printf("Get pending RAR grant tti=%d\n", tti);
|
|
|
|
|
return grant->create_from_rar(&rar_grant, cell, 0, 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) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
sf_symbols_and_ce_done = true;
|
|
|
|
|
}
|
|
|
|
|
sf_symbols_and_ce_done = true;
|
|
|
|
|
}
|
|
|
|
|
if (!pdcch_llr_extracted) {
|
|
|
|
|
if (srslte_pdcch_extract_llr(&ue_dl.pdcch, ue_dl.sf_symbols, ue_dl.ce, 0, tti%10, cfi)) {
|
|
|
|
|
if (!pdcch_llr_extracted) {
|
|
|
|
|
if (srslte_pdcch_extract_llr(&ue_dl.pdcch, ue_dl.sf_symbols, ue_dl.ce, 0, tti%10, cfi)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
pdcch_llr_extracted = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srslte_dci_msg_t dci_msg;
|
|
|
|
|
if (srslte_ue_dl_find_ul_dci(&ue_dl, &dci_msg, cfi, tti%10, grant->get_rnti()) != 1) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
pdcch_llr_extracted = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srslte_dci_msg_t dci_msg;
|
|
|
|
|
if (srslte_ue_dl_find_ul_dci(&ue_dl, &dci_msg, cfi, tti%10, grant->get_rnti())) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return grant->create_from_dci(&dci_msg, cell, 0, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
|
|
|
|
|
|
|
|
|
|
return grant->create_from_dci(&dci_msg, cell, 0, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void dl_buffer::set_rar_grant(uint8_t grant[SRSLTE_RAR_GRANT_LEN])
|
|
|
|
|
{
|
|
|
|
|
srslte_dci_rar_grant_t rar_grant;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dl_buffer::get_dl_grant(pdcch_dl_search_t mode, dl_sched_grant *grant)
|
|
|
|
|
void dl_buffer::set_rar_grant(srslte_dci_rar_grant_t* rar_grant_)
|
|
|
|
|
{
|
|
|
|
|
printf("Set pending RAR grant tti=%d\n", tti);
|
|
|
|
|
pending_rar_grant = true;
|
|
|
|
|
memcpy(&rar_grant, rar_grant_, sizeof(srslte_dci_rar_grant_t));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dl_buffer::get_dl_grant(dl_sched_grant *grant)
|
|
|
|
|
{
|
|
|
|
|
if (signal_buffer && is_ready()) {
|
|
|
|
|
INFO("DL Buffer TTI %d: Getting DL grant\n", tti);
|
|
|
|
@ -157,6 +180,11 @@ bool dl_buffer::decode_ack(ul_sched_grant *grant)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dl_buffer::decode_data(dl_sched_grant *grant, uint8_t *payload)
|
|
|
|
|
{
|
|
|
|
|
return decode_data(grant, &ue_dl.softbuffer, payload);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dl_buffer::decode_data(dl_sched_grant *grant, srslte_softbuffer_rx_t *softbuffer, uint8_t *payload)
|
|
|
|
|
{
|
|
|
|
|
if (signal_buffer && is_ready()) {
|
|
|
|
|
INFO("DL Buffer TTI %d: Decoding PDSCH\n", tti);
|
|
|
|
@ -170,7 +198,7 @@ bool dl_buffer::decode_data(dl_sched_grant *grant, uint8_t *payload)
|
|
|
|
|
|
|
|
|
|
grant->get_pdsch_cfg(tti%10, &ue_dl.pdsch_cfg);
|
|
|
|
|
if (ue_dl.pdsch_cfg.grant.mcs.mod > 0 && ue_dl.pdsch_cfg.grant.mcs.tbs >= 0) {
|
|
|
|
|
int ret = srslte_pdsch_decode_rnti(&ue_dl.pdsch, &ue_dl.pdsch_cfg, &ue_dl.softbuffer, ue_dl.sf_symbols,
|
|
|
|
|
int ret = srslte_pdsch_decode_rnti(&ue_dl.pdsch, &ue_dl.pdsch_cfg, softbuffer, ue_dl.sf_symbols,
|
|
|
|
|
ue_dl.ce, 0, grant->get_rnti(), payload);
|
|
|
|
|
|
|
|
|
|
if (SRSLTE_VERBOSE_ISINFO()) {
|
|
|
|
|