Commit 338426ed authored by francescomani's avatar francescomani

use NR_timer_t for SR-ProhibitTimer

parent 1cae1879
......@@ -1691,6 +1691,7 @@ static uint32_t nr_get_sf_periodicBSRTimer(long periodicBSR)
static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroupConfig_t *mcg)
{
NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info;
int scs = mac->current_UL_BWP->scs;
if (mcg->drx_Config)
LOG_E(NR_MAC, "DRX not implemented! Configuration not handled!\n");
if (mcg->schedulingRequestConfig) {
......@@ -1699,8 +1700,7 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
for (int i = 0; i < src->schedulingRequestToReleaseList->list.count; i++) {
if (*src->schedulingRequestToReleaseList->list.array[i] == si->sr_id) {
si->SR_COUNTER = 0;
si->sr_ProhibitTimer = 0;
si->sr_ProhibitTimer_Running = 0;
nr_timer_setup(&si->sr_ProhibitTimer, 0, 1); // default value is 0ms
si->sr_id = -1; // invalid init value
}
else
......@@ -1715,13 +1715,16 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
"Current implementation cannot handle more than 1 SR configuration\n");
si->sr_id = sr->schedulingRequestId;
si->sr_TransMax = sr->sr_TransMax;
int target_ms = 0;
if (sr->sr_ProhibitTimer)
LOG_E(NR_MAC, "SR prohibit timer not properly implemented\n");
target_ms = 1 << *sr->sr_ProhibitTimer;
// length of slot is (1/2^scs)ms
nr_timer_setup(&si->sr_ProhibitTimer, target_ms << scs, 1); // 1 slot update rate
}
}
}
if (mcg->bsr_Config) {
int subframes_per_slot = nr_slots_per_frame[mac->current_UL_BWP->scs] / 10;
int subframes_per_slot = nr_slots_per_frame[scs] / 10;
uint32_t periodic_sf = nr_get_sf_periodicBSRTimer(mcg->bsr_Config->periodicBSR_Timer);
uint32_t target = periodic_sf < UINT_MAX ? periodic_sf * subframes_per_slot : periodic_sf;
nr_timer_setup(&si->periodicBSR_Timer, target, 1); // 1 slot update rate
......
......@@ -222,10 +222,8 @@ typedef struct {
NR_timer_t retxBSR_Timer;
/// periodicBSR-Timer
NR_timer_t periodicBSR_Timer;
/// default value is 0: not configured
uint16_t sr_ProhibitTimer;
/// sr ProhibitTime running
uint8_t sr_ProhibitTimer_Running;
/// sr ProhibitTimer
NR_timer_t sr_ProhibitTimer;
// Maximum number of SR transmissions
uint32_t sr_TransMax;
int sr_id;
......
......@@ -165,6 +165,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
}
nr_timer_stop(&nr_mac->ra.contention_resolution_timer);
nr_timer_stop(&nr_mac->scheduling_info.sr_DelayTimer);
nr_timer_stop(&nr_mac->scheduling_info.sr_ProhibitTimer);
nr_timer_stop(&nr_mac->scheduling_info.retxBSR_Timer);
// consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2
......@@ -187,8 +188,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
// cancel any triggered Scheduling Request procedure
nr_mac->scheduling_info.SR_COUNTER = 0;
nr_mac->scheduling_info.SR_pending = 0;
nr_mac->scheduling_info.sr_ProhibitTimer = 0;
nr_mac->scheduling_info.sr_ProhibitTimer_Running = 0;
nr_mac->scheduling_info.sr_id = -1; // invalid init value
// cancel any triggered Buffer Status Reporting procedure
......
......@@ -2504,14 +2504,8 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot)
si->SR_pending); // todo
si->SR_COUNTER++;
// start the sr-prohibittimer : rel 9 and above
if (si->sr_ProhibitTimer > 0) { // timer configured
si->sr_ProhibitTimer--;
si->sr_ProhibitTimer_Running = 1;
} else {
si->sr_ProhibitTimer_Running = 0;
}
//mac->ul_active =1;
// start the sr-prohibittimer
nr_timer_start(&si->sr_ProhibitTimer);
return (1); //instruct phy to signal SR
} else {
// notify RRC to relase PUCCH/SRS
......@@ -2526,6 +2520,7 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot)
}
si->SR_pending = 0;
si->SR_COUNTER = 0;
nr_timer_stop(&si->sr_ProhibitTimer);
return (0);
}
}
......
......@@ -133,6 +133,7 @@ static void trigger_regular_bsr(NR_UE_MAC_INST_t *mac, NR_LogicalChannelIdentity
void update_mac_timers(NR_UE_MAC_INST_t *mac)
{
nr_timer_tick(&mac->ra.contention_resolution_timer);
nr_timer_tick(&mac->scheduling_info.sr_ProhibitTimer);
nr_timer_tick(&mac->scheduling_info.sr_DelayTimer);
bool retxBSR_expired = nr_timer_tick(&mac->scheduling_info.retxBSR_Timer);
if (retxBSR_expired) {
......@@ -2678,6 +2679,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
LOG_D(NR_MAC, "[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", mac->ue_id);
sched_info->SR_pending = 0;
sched_info->SR_COUNTER = 0;
nr_timer_stop(&sched_info->sr_ProhibitTimer);
/* Actions when a BSR is sent */
if (mac_ce_p->bsr_ce_len) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment