Added sf trigger API functions
Signed-off-by: Xenofon Foukas <x.foukas@sms.ed.ac.uk>
This commit is contained in:
@@ -640,6 +640,56 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id)
|
||||
return eNB_UE_stats[CC_id].rank;
|
||||
}
|
||||
|
||||
int get_tpc(mid_t mod_id, mid_t ue_id)
|
||||
{
|
||||
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
|
||||
int32_t normalized_rx_power, target_rx_power;
|
||||
int tpc = 1;
|
||||
|
||||
int pCCid = UE_PCCID(mod_id,ue_id);
|
||||
rnti_t rnti = get_ue_crnti(mod_id,ue_id);
|
||||
|
||||
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti);
|
||||
|
||||
normalized_rx_power = eNB_UE_stats->UL_rssi[0];
|
||||
|
||||
target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid);
|
||||
|
||||
if (normalized_rx_power>(target_rx_power+1)) {
|
||||
tpc = 0; //-1
|
||||
} else if (normalized_rx_power<(target_rx_power-1)) {
|
||||
tpc = 2; //+1
|
||||
} else {
|
||||
tpc = 1; //0
|
||||
}
|
||||
return tpc;
|
||||
}
|
||||
|
||||
int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status) //flag_id_status = 0 then id, else status
|
||||
{
|
||||
/*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in
|
||||
* get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add
|
||||
* DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/
|
||||
|
||||
uint8_t *harq_pid = malloc(sizeof(uint8_t));
|
||||
uint8_t *round = malloc(sizeof(uint8_t));
|
||||
|
||||
uint16_t rnti = get_ue_crnti(mod_id,ue_id);
|
||||
|
||||
mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0);
|
||||
|
||||
if(flag_id_status == 0)
|
||||
return *harq_pid;
|
||||
else if(flag_id_status == 1)
|
||||
{
|
||||
if(*round > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 150;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ************************************
|
||||
|
||||
@@ -202,6 +202,9 @@ long get_si_window_length(mid_t mod_id, int CC_id);
|
||||
|
||||
int get_num_pdcch_symb(mid_t mod_id, int CC_id);
|
||||
|
||||
int get_tpc(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status);
|
||||
|
||||
/*******************
|
||||
* timer primitves
|
||||
|
||||
@@ -926,16 +926,16 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran
|
||||
dl_info[i]->rnti = get_ue_crnti(mod_id, i);
|
||||
dl_info[i]->has_rnti = 1;
|
||||
/*TODO: fill in the right id of this round's HARQ process for this UE*/
|
||||
dl_info[i]->harq_process_id = 1;
|
||||
dl_info[i]->harq_process_id = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),0);
|
||||
dl_info[i]->has_harq_process_id = 1;
|
||||
/*TODO: fill in the status of the HARQ process (2 TBs)*/
|
||||
dl_info[i]->n_harq_status = 2;
|
||||
dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status);
|
||||
for (j = 0; j < dl_info[j]->n_harq_status; j++) {
|
||||
dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK;
|
||||
dl_info[i]->harq_status[j] = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),1);
|
||||
}
|
||||
/*TODO: fill in the serving cell index for this UE */
|
||||
dl_info[i]->serv_cell_index = 0;
|
||||
dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i);
|
||||
dl_info[i]->has_serv_cell_index = 1;
|
||||
}
|
||||
}
|
||||
@@ -962,8 +962,14 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran
|
||||
ul_info[i]->rnti = get_ue_crnti(mod_id, i);
|
||||
ul_info[i]->has_rnti = 1;
|
||||
/*TODO: fill in the Tx power control command for this UE (if available)*/
|
||||
ul_info[i]->tpc = 1;
|
||||
ul_info[i]->has_tpc = 0;
|
||||
if(get_tpc(mod_id,i) != 1){
|
||||
ul_info[i]->tpc = get_tpc(mod_id,i);
|
||||
ul_info[i]->has_tpc = 1;
|
||||
}
|
||||
else{
|
||||
ul_info[i]->tpc = get_tpc(mod_id,i);
|
||||
ul_info[i]->has_tpc = 0;
|
||||
}
|
||||
/*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the
|
||||
given logical channel*/
|
||||
ul_info[i]->n_ul_reception = 11;
|
||||
@@ -975,7 +981,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran
|
||||
ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK;
|
||||
ul_info[i]->has_reception_status = 1;
|
||||
/*TODO: fill in the serving cell index for this UE */
|
||||
ul_info[i]->serv_cell_index = 0;
|
||||
ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i);
|
||||
ul_info[i]->has_serv_cell_index = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user