mirror of https://github.com/PentHertz/srsLTE.git
Now working with variable HARQ scheduling
This commit is contained in:
parent
fb0a918f7a
commit
ca0cf017d6
|
@ -44,13 +44,15 @@
|
|||
#define SRSLTE_N_DRB 8
|
||||
#define SRSLTE_N_RADIO_BEARERS 11
|
||||
|
||||
#define HARQ_DELAY_MS 4
|
||||
#define MSG3_DELAY_MS 6
|
||||
#define HARQ_TX(tti) ((tti+HARQ_DELAY_MS)%10240)
|
||||
#define HARQ_RX(tti) ((tti+(2*HARQ_DELAY_MS))%10240)
|
||||
#define HARQ_DELAY_MS 6
|
||||
#define MSG3_DELAY_MS 6
|
||||
#define TTI_TX(tti) ((tti+HARQ_DELAY_MS)%10240)
|
||||
#define TTI_RX_ACK(tti) ((tti+(2*HARQ_DELAY_MS))%10240)
|
||||
|
||||
#define TTIMOD_SZ 10
|
||||
#define TTIMOD(tti) (tti%TTIMOD_SZ)
|
||||
#define TTIMOD_SZ 20
|
||||
#define TTIMOD(tti) (tti%TTIMOD_SZ)
|
||||
|
||||
#define ASYNC_DL_SCHED (HARQ_DELAY_MS <= 4)
|
||||
|
||||
// Cat 3 UE - Max number of DL-SCH transport block bits received within a TTI
|
||||
// 3GPP 36.306 Table 4.1.1
|
||||
|
|
|
@ -89,9 +89,9 @@ private:
|
|||
|
||||
cf_t *signal_buffer_rx;
|
||||
cf_t *signal_buffer_tx;
|
||||
uint32_t tti_rx, tti_tx, tti_sched_ul;
|
||||
uint32_t tti_rx, tti_tx_dl, tti_tx_ul;
|
||||
uint32_t sf_rx, sf_tx, tx_mutex_cnt;
|
||||
uint32_t t_rx, t_tx, t_sched_ul;
|
||||
uint32_t t_rx, t_tx_dl, t_tx_ul;
|
||||
srslte_enb_dl_t enb_dl;
|
||||
srslte_enb_ul_t enb_ul;
|
||||
|
||||
|
|
|
@ -677,14 +677,14 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
|
|||
pthread_mutex_lock(&mutex);
|
||||
|
||||
/* If dl_sched() not yet called this tti (this tti is +4ms advanced), reset CCE state */
|
||||
if (HARQ_TX(current_tti) != tti) {
|
||||
if (TTI_TX(current_tti) != tti) {
|
||||
bzero(used_cce, MAX_CCE*sizeof(bool));
|
||||
}
|
||||
|
||||
/* Initialize variables */
|
||||
current_tti = tti;
|
||||
sfn = tti/10;
|
||||
if (tti > 4) {
|
||||
if (tti > HARQ_DELAY_MS) {
|
||||
sf_idx = (tti-HARQ_DELAY_MS)%10;
|
||||
} else {
|
||||
sf_idx = (tti+10240-HARQ_DELAY_MS)%10;
|
||||
|
|
|
@ -142,7 +142,11 @@ dl_harq_proc* dl_metric_rr::get_user_allocation(sched_ue *user)
|
|||
dl_harq_proc *h = user->get_pending_dl_harq(current_tti);
|
||||
|
||||
// Time-domain RR scheduling
|
||||
#if ASYNC_DL_SCHED
|
||||
if (pending_data || h) {
|
||||
#else
|
||||
if (pending_data || (h && !h->is_empty())) {
|
||||
#endif
|
||||
if (nof_users_with_data) {
|
||||
if (nof_users_with_data == 2) {
|
||||
}
|
||||
|
@ -153,7 +157,11 @@ dl_harq_proc* dl_metric_rr::get_user_allocation(sched_ue *user)
|
|||
}
|
||||
|
||||
// Schedule retx if we have space
|
||||
#if ASYNC_DL_SCHED
|
||||
if (h) {
|
||||
#else
|
||||
if (h && !h->is_empty()) {
|
||||
#endif
|
||||
uint32_t retx_mask = h->get_rbgmask();
|
||||
// If can schedule the same mask, do it
|
||||
if (!allocation_is_valid(retx_mask)) {
|
||||
|
@ -171,8 +179,12 @@ dl_harq_proc* dl_metric_rr::get_user_allocation(sched_ue *user)
|
|||
}
|
||||
}
|
||||
// If could not schedule the reTx, or there wasn't any pending retx, find an empty PID
|
||||
#if ASYNC_DL_SCHED
|
||||
h = user->get_empty_dl_harq();
|
||||
if (h) {
|
||||
#else
|
||||
if (h && h->is_empty()) {
|
||||
#endif
|
||||
// Allocate resources based on pending data
|
||||
if (pending_data) {
|
||||
uint32_t pending_rb = user->get_required_prb_dl(pending_data, nof_ctrl_symbols);
|
||||
|
|
|
@ -248,7 +248,7 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
|
|||
|
||||
// First check if it has pending ACKs
|
||||
for (int i=0;i<SCHED_MAX_HARQ_PROC;i++) {
|
||||
if (HARQ_TX(dl_harq[i].get_tti()) == current_tti) {
|
||||
if (TTI_TX(dl_harq[i].get_tti()) == current_tti) {
|
||||
uint32_t n_pucch = srslte_pucch_get_npucch(dl_harq[i].get_n_cce(), SRSLTE_PUCCH_FORMAT_1A, has_sr, &pucch_sched);
|
||||
if (prb_idx) {
|
||||
for (int i=0;i<2;i++) {
|
||||
|
@ -288,7 +288,7 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
|
|||
int sched_ue::set_ack_info(uint32_t tti, bool ack)
|
||||
{
|
||||
for (int i=0;i<SCHED_MAX_HARQ_PROC;i++) {
|
||||
if (HARQ_TX(dl_harq[i].get_tti()) == tti) {
|
||||
if (TTI_TX(dl_harq[i].get_tti()) == tti) {
|
||||
Debug("SCHED: Set ACK=%d for rnti=0x%x, pid=%d, tti=%d\n", ack, rnti, i, tti);
|
||||
dl_harq[i].set_ack(ack);
|
||||
return dl_harq[i].get_tbs();
|
||||
|
@ -656,6 +656,7 @@ bool sched_ue::is_sr_triggered()
|
|||
/* Gets HARQ process with oldest pending retx */
|
||||
dl_harq_proc* sched_ue::get_pending_dl_harq(uint32_t tti)
|
||||
{
|
||||
#if ASYNC_DL_SCHED
|
||||
int oldest_idx=-1;
|
||||
uint32_t oldest_tti = 0;
|
||||
for (int i=0;i<SCHED_MAX_HARQ_PROC;i++) {
|
||||
|
@ -672,6 +673,9 @@ dl_harq_proc* sched_ue::get_pending_dl_harq(uint32_t tti)
|
|||
} else {
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
return &dl_harq[tti%SCHED_MAX_HARQ_PROC];
|
||||
#endif
|
||||
}
|
||||
|
||||
dl_harq_proc* sched_ue::get_empty_dl_harq()
|
||||
|
|
|
@ -104,7 +104,7 @@ void phch_common::ack_clear(uint32_t sf_idx)
|
|||
|
||||
void phch_common::ack_add_rnti(uint16_t rnti)
|
||||
{
|
||||
for (int sf_idx=0;sf_idx<10;sf_idx++) {
|
||||
for (int sf_idx=0;sf_idx<TTIMOD_SZ;sf_idx++) {
|
||||
pending_ack[rnti].is_pending[sf_idx] = false;
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +128,10 @@ bool phch_common::ack_is_pending(uint32_t sf_idx, uint16_t rnti, uint32_t *last_
|
|||
bool ret = pending_ack[rnti].is_pending[sf_idx];
|
||||
pending_ack[rnti].is_pending[sf_idx] = false;
|
||||
|
||||
if (ret) {
|
||||
|
||||
}
|
||||
|
||||
if (ret && last_n_pdcch) {
|
||||
*last_n_pdcch = pending_ack[rnti].n_pdcch[sf_idx];
|
||||
}
|
||||
|
|
|
@ -176,15 +176,15 @@ cf_t* phch_worker::get_buffer_rx()
|
|||
void phch_worker::set_time(uint32_t tti_, uint32_t tx_mutex_cnt_, srslte_timestamp_t tx_time_)
|
||||
{
|
||||
tti_rx = tti_;
|
||||
tti_tx = HARQ_TX(tti_rx);
|
||||
tti_sched_ul = HARQ_RX(tti_rx);
|
||||
tti_tx_dl = TTI_TX(tti_rx);
|
||||
tti_tx_ul = TTI_RX_ACK(tti_rx);
|
||||
|
||||
sf_rx = tti_rx%10;
|
||||
sf_tx = tti_tx%10;
|
||||
sf_tx = tti_tx_dl%10;
|
||||
|
||||
t_tx = TTIMOD(tti_tx);
|
||||
t_tx_dl = TTIMOD(tti_tx_dl);
|
||||
t_rx = TTIMOD(tti_rx);
|
||||
t_sched_ul = TTIMOD(tti_sched_ul);
|
||||
t_tx_ul = TTIMOD(tti_tx_ul);
|
||||
|
||||
tx_mutex_cnt = tx_mutex_cnt_;
|
||||
memcpy(&tx_time, &tx_time_, sizeof(srslte_timestamp_t));
|
||||
|
@ -299,41 +299,41 @@ void phch_worker::work_imp()
|
|||
decode_pucch();
|
||||
|
||||
// Get DL scheduling for the TX TTI from MAC
|
||||
if (mac->get_dl_sched(tti_tx, &dl_grants[t_tx]) < 0) {
|
||||
if (mac->get_dl_sched(tti_tx_dl, &dl_grants[t_tx_dl]) < 0) {
|
||||
Error("Getting DL scheduling from MAC\n");
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
if (dl_grants[t_tx].cfi < 1 || dl_grants[t_tx].cfi > 3) {
|
||||
Error("Invalid CFI=%d\n", dl_grants[t_tx].cfi);
|
||||
if (dl_grants[t_tx_dl].cfi < 1 || dl_grants[t_tx_dl].cfi > 3) {
|
||||
Error("Invalid CFI=%d\n", dl_grants[t_tx_dl].cfi);
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
// Get UL scheduling for the TX TTI from MAC
|
||||
if (mac->get_ul_sched(tti_sched_ul, &ul_grants[t_sched_ul]) < 0) {
|
||||
if (mac->get_ul_sched(tti_tx_ul, &ul_grants[t_tx_ul]) < 0) {
|
||||
Error("Getting UL scheduling from MAC\n");
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
// Put base signals (references, PBCH, PCFICH and PSS/SSS) into the resource grid
|
||||
srslte_enb_dl_clear_sf(&enb_dl);
|
||||
srslte_enb_dl_set_cfi(&enb_dl, dl_grants[t_tx].cfi);
|
||||
srslte_enb_dl_put_base(&enb_dl, tti_tx);
|
||||
srslte_enb_dl_set_cfi(&enb_dl, dl_grants[t_tx_dl].cfi);
|
||||
srslte_enb_dl_put_base(&enb_dl, tti_tx_dl);
|
||||
|
||||
// Put UL/DL grants to resource grid. PDSCH data will be encoded as well.
|
||||
encode_pdcch_dl(dl_grants[t_tx].sched_grants, dl_grants[t_tx].nof_grants);
|
||||
encode_pdcch_ul(ul_grants[t_sched_ul].sched_grants, ul_grants[t_sched_ul].nof_grants);
|
||||
encode_pdsch(dl_grants[t_tx].sched_grants, dl_grants[t_tx].nof_grants);
|
||||
encode_pdcch_dl(dl_grants[t_tx_dl].sched_grants, dl_grants[t_tx_dl].nof_grants);
|
||||
encode_pdcch_ul(ul_grants[t_tx_ul].sched_grants, ul_grants[t_tx_ul].nof_grants);
|
||||
encode_pdsch(dl_grants[t_tx_dl].sched_grants, dl_grants[t_tx_dl].nof_grants);
|
||||
|
||||
// Put pending PHICH HARQ ACK/NACK indications into subframe
|
||||
encode_phich(ul_grants[t_sched_ul].phich, ul_grants[t_sched_ul].nof_phich);
|
||||
encode_phich(ul_grants[t_tx_ul].phich, ul_grants[t_tx_ul].nof_phich);
|
||||
|
||||
// Prepare for receive ACK for DL grants in t_tx+4
|
||||
phy->ack_clear(TTIMOD(HARQ_TX(sf_tx)));
|
||||
for (uint32_t i=0;i<dl_grants[t_tx].nof_grants;i++) {
|
||||
// Prepare for receive ACK for DL grants in t_tx_dl+4
|
||||
phy->ack_clear(TTIMOD(TTI_TX(t_tx_dl)));
|
||||
for (uint32_t i=0;i<dl_grants[t_tx_dl].nof_grants;i++) {
|
||||
// SI-RNTI and RAR-RNTI do not have ACK
|
||||
if (dl_grants[t_tx].sched_grants[i].rnti >= SRSLTE_CRNTI_START && dl_grants[t_tx].sched_grants[i].rnti <= SRSLTE_CRNTI_END) {
|
||||
phy->ack_set_pending(TTIMOD(HARQ_TX(sf_tx)), dl_grants[t_tx].sched_grants[i].rnti, dl_grants[t_tx].sched_grants[i].location.ncce);
|
||||
if (dl_grants[t_tx_dl].sched_grants[i].rnti >= SRSLTE_CRNTI_START && dl_grants[t_tx_dl].sched_grants[i].rnti <= SRSLTE_CRNTI_END) {
|
||||
phy->ack_set_pending(TTIMOD(TTI_TX(t_tx_dl)), dl_grants[t_tx_dl].sched_grants[i].rnti, dl_grants[t_tx_dl].sched_grants[i].location.ncce);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ void phch_worker::work_imp()
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_WRITE_FILE
|
||||
if (tti_tx == 10) {
|
||||
if (tti_tx_dl == 10) {
|
||||
fclose(f);
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -524,6 +524,7 @@ int phch_worker::decode_pucch()
|
|||
uci_data.scheduling_request = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (phy->ack_is_pending(t_rx, rnti, &last_n_pdcch)) {
|
||||
needs_pucch = true;
|
||||
needs_ack = true;
|
||||
|
@ -540,7 +541,7 @@ int phch_worker::decode_pucch()
|
|||
}
|
||||
|
||||
if (needs_pucch) {
|
||||
if (srslte_enb_ul_get_pucch(&enb_ul, rnti, last_n_pdcch, t_rx, &uci_data)) {
|
||||
if (srslte_enb_ul_get_pucch(&enb_ul, rnti, last_n_pdcch, sf_rx, &uci_data)) {
|
||||
fprintf(stderr, "Error getting PUCCH\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
@ -592,10 +593,10 @@ int phch_worker::encode_phich(srslte_enb_dl_phich_t *acks, uint32_t nof_acks)
|
|||
ue_db[rnti].phich_info.n_dmrs,
|
||||
sf_tx);
|
||||
|
||||
Info("PHICH: rnti=0x%x, hi=%d, I_lowest=%d, n_dmrs=%d, tti_tx=%d\n",
|
||||
Info("PHICH: rnti=0x%x, hi=%d, I_lowest=%d, n_dmrs=%d, tti_tx_dl=%d\n",
|
||||
rnti, acks[i].ack,
|
||||
ue_db[rnti].phich_info.n_prb_lowest,
|
||||
ue_db[rnti].phich_info.n_dmrs, tti_tx);
|
||||
ue_db[rnti].phich_info.n_dmrs, tti_tx_dl);
|
||||
}
|
||||
}
|
||||
return SRSLTE_SUCCESS;
|
||||
|
@ -612,8 +613,8 @@ int phch_worker::encode_pdcch_ul(srslte_enb_ul_pusch_t *grants, uint32_t nof_gra
|
|||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
||||
Info("PDCCH: UL DCI Format0 rnti=0x%x, cce_index=%d, L=%d, tpc=%d, tti_tx=%d\n",
|
||||
rnti, grants[i].location.ncce, (1<<grants[i].location.L), grants[i].grant.tpc_pusch, tti_tx);
|
||||
Info("PDCCH: UL DCI Format0 rnti=0x%x, cce_index=%d, L=%d, tpc=%d, tti_tx_dl=%d\n",
|
||||
rnti, grants[i].location.ncce, (1<<grants[i].location.L), grants[i].grant.tpc_pusch, tti_tx_dl);
|
||||
}
|
||||
}
|
||||
return SRSLTE_SUCCESS;
|
||||
|
@ -640,8 +641,8 @@ int phch_worker::encode_pdcch_dl(srslte_enb_dl_pdsch_t *grants, uint32_t nof_gra
|
|||
}
|
||||
|
||||
if (LOG_THIS(rnti)) {
|
||||
Info("PDCCH: DL DCI %s rnti=0x%x, cce_index=%d, L=%d, tti_tx=%d\n", srslte_dci_format_string(format),
|
||||
rnti, grants[i].location.ncce, (1<<grants[i].location.L), tti_tx);
|
||||
Info("PDCCH: DL DCI %s rnti=0x%x, cce_index=%d, L=%d, tti_tx_dl=%d\n", srslte_dci_format_string(format),
|
||||
rnti, grants[i].location.ncce, (1<<grants[i].location.L), tti_tx_dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -684,9 +685,9 @@ int phch_worker::encode_pdsch(srslte_enb_dl_pdsch_t *grants, uint32_t nof_grants
|
|||
len = 1;
|
||||
}
|
||||
log_h->info_hex(ptr, len,
|
||||
"PDSCH: rnti=0x%x, l_crb=%2d, %s, harq=%d, tbs=%d, mcs=%d, rv=%d, tti_tx=%d\n",
|
||||
"PDSCH: rnti=0x%x, l_crb=%2d, %s, harq=%d, tbs=%d, mcs=%d, rv=%d, tti_tx_dl=%d\n",
|
||||
rnti, phy_grant.nof_prb, grant_str, grants[i].grant.harq_process,
|
||||
phy_grant.mcs[0].tbs/8, phy_grant.mcs[0].idx, grants[i].grant.rv_idx, tti_tx);
|
||||
phy_grant.mcs[0].tbs/8, phy_grant.mcs[0].idx, grants[i].grant.rv_idx, tti_tx_dl);
|
||||
}
|
||||
|
||||
srslte_softbuffer_tx_t *sb[SRSLTE_MAX_CODEWORDS] = {grants[i].softbuffer, NULL};
|
||||
|
|
|
@ -115,7 +115,7 @@ void txrx::run_thread()
|
|||
|
||||
/* Compute TX time: Any transmission happens in TTI+4 thus advance 4 ms the reception time */
|
||||
srslte_timestamp_copy(&tx_time, &rx_time);
|
||||
srslte_timestamp_add(&tx_time, 0, 4e-3);
|
||||
srslte_timestamp_add(&tx_time, 0, HARQ_DELAY_MS*1e-3);
|
||||
|
||||
Debug("Settting TTI=%d, tx_mutex=%d, tx_time=%d:%f to worker %d\n",
|
||||
tti, tx_mutex_cnt,
|
||||
|
|
|
@ -82,7 +82,6 @@ private:
|
|||
|
||||
const static int MIN_RLC_SDU_LEN = 0;
|
||||
const static int MAX_NOF_SUBHEADERS = 20;
|
||||
const static int MAX_HARQ_PROC = 8;
|
||||
|
||||
std::vector<lchid_t> lch;
|
||||
|
||||
|
|
|
@ -137,11 +137,15 @@ void phch_common::set_rar_grant(uint32_t tti, uint8_t grant_payload[SRSLTE_RAR_G
|
|||
{
|
||||
srslte_dci_rar_grant_unpack(&rar_grant, grant_payload);
|
||||
rar_grant_pending = true;
|
||||
// PUSCH is at n+6 or n+7 and phch_worker assumes default delay of 4 ttis
|
||||
int delay = MSG3_DELAY_MS-HARQ_DELAY_MS;
|
||||
if (delay < 0) {
|
||||
fprintf(stderr, "Error MSG3_DELAY_MS can't be lower than HARQ_DELAY_MS\n");
|
||||
delay = 0;
|
||||
}
|
||||
if (rar_grant.ul_delay) {
|
||||
rar_grant_tti = (tti + 3) % 10240;
|
||||
rar_grant_tti = (tti + delay + 1) % 10240;
|
||||
} else {
|
||||
rar_grant_tti = (tti + 2) % 10240;
|
||||
rar_grant_tti = (tti + delay) % 10240;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
bool ul_ack = false;
|
||||
bool ul_ack_available = decode_phich(&ul_ack);
|
||||
|
@ -313,8 +320,8 @@ void phch_worker::work_imp()
|
|||
set_uci_periodic_cqi();
|
||||
}
|
||||
|
||||
/* TTI offset for UL is always 4 for LTE */
|
||||
ul_action.tti_offset = 4;
|
||||
/* TTI offset for UL */
|
||||
ul_action.tti_offset = HARQ_DELAY_MS;
|
||||
|
||||
/* Send UL grant or HARQ information (from PHICH) to MAC */
|
||||
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);
|
||||
signal_ready = true;
|
||||
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) {
|
||||
|
@ -357,7 +364,7 @@ void phch_worker::work_imp()
|
|||
if (!dl_action.generate_ack_callback) {
|
||||
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]);
|
||||
} else {
|
||||
} else if (!rar_delivered) {
|
||||
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {
|
||||
if (dl_action.decode_enabled[tb]) {
|
||||
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 */
|
||||
grant->ndi[0] = dci_unpacked.ndi;
|
||||
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[1] = grant->phy_grant.dl.mcs[1].tbs / (uint32_t) 8;
|
||||
grant->tti = tti;
|
||||
|
@ -663,7 +670,7 @@ bool phch_worker::decode_pdcch_ul(mac_interface_phy::mac_grant_t* grant)
|
|||
char timestr[64];
|
||||
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_ra_ul_dci_t dci_unpacked;
|
||||
|
@ -776,7 +783,7 @@ void phch_worker::set_uci_sr()
|
|||
{
|
||||
uci_data.scheduling_request = false;
|
||||
if (phy->sr_enabled) {
|
||||
uint32_t sr_tx_tti = HARQ_TX(tti);
|
||||
uint32_t sr_tx_tti = TTI_TX(tti);
|
||||
// Get I_sr parameter
|
||||
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);
|
||||
|
@ -793,7 +800,7 @@ void phch_worker::set_uci_periodic_cqi()
|
|||
int cqi_max = phy->args->cqi_max;
|
||||
|
||||
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) {
|
||||
uci_data.uci_cqi[0] = uci_data.uci_ri;
|
||||
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;
|
||||
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;
|
||||
if (period_cqi.format_is_subband) {
|
||||
// TODO: Implement subband periodic reports
|
||||
|
@ -868,8 +875,8 @@ void phch_worker::set_uci_aperiodic_cqi()
|
|||
|
||||
bool phch_worker::srs_is_ready_to_send() {
|
||||
if (srs_cfg.configured) {
|
||||
if (srslte_refsignal_srs_send_cs(srs_cfg.subframe_config, HARQ_RX(tti)%10) == 1 &&
|
||||
srslte_refsignal_srs_send_ue(srs_cfg.I_srs, HARQ_TX(tti)) == 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, TTI_TX(tti)) == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -889,7 +896,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui
|
|||
char timestr[64];
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -919,7 +926,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui
|
|||
#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",
|
||||
HARQ_TX(tti),
|
||||
TTI_TX(tti),
|
||||
grant->L_prb, grant->n_prb[0],
|
||||
grant->mcs.tbs/8, grant->mcs.mod, grant->mcs.idx, rv,
|
||||
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);
|
||||
#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");
|
||||
}
|
||||
|
||||
|
@ -966,7 +973,7 @@ void phch_worker::encode_pucch()
|
|||
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",
|
||||
HARQ_TX(tti),
|
||||
TTI_TX(tti),
|
||||
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>1?(uci_data.uci_ack_2?"1":"0"):"",
|
||||
|
@ -987,7 +994,7 @@ void phch_worker::encode_srs()
|
|||
char timestr[64];
|
||||
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");
|
||||
}
|
||||
|
@ -1002,7 +1009,7 @@ void phch_worker::encode_srs()
|
|||
float gain = set_power(tx_power);
|
||||
uint32_t fi = srslte_vec_max_fi((float*) signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue