Commit 7b0d904d authored by knopp's avatar knopp

parent 90c9df89
......@@ -151,7 +151,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
}
int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,uint8_t UE_id,uint8_t subframe)
int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,uint8_t UE_id,uint8_t sched_subframe)
{
static int first_run=1;
static int max_pos_fil2=0;
......@@ -162,14 +162,14 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,uint8_t UE_id,uint8_
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
LTE_eNB_PUSCH *eNB_pusch_vars = phy_vars_eNB->lte_eNB_pusch_vars[UE_id];
int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time[0];
int subframe_sched = (subframe==9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
uint8_t harq_pid;
uint8_t Ns = 1; //we take the estimate from the second slot
uint8_t cyclic_shift = 0;//(frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
//phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS2 +
//frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12;
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[subframe_sched].frame_rx,subframe);
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
......@@ -197,7 +197,7 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,uint8_t UE_id,uint8_
max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15;
#ifdef DEBUG_PHY
LOG_I(PHY,"frame %d: max_pos = %d, max_pos_fil = %d, sync_pos=%d\n",phy_vars_eNB->proc[subframe_sched].frame_rx,max_pos,max_pos_fil2,sync_pos);
LOG_I(PHY,"frame %d: max_pos = %d, max_pos_fil = %d, sync_pos=%d\n",phy_vars_eNB->proc[sched_subframe].frame_rx,max_pos,max_pos_fil2,sync_pos);
#endif //DEBUG_PHY
return(max_pos_fil2-sync_pos);
......
......@@ -34,7 +34,7 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32
int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
uint8_t eNB_id,
uint8_t UE_id,
uint8_t subframe,
uint8_t sched_subframe,
unsigned char l,
unsigned char Ns,
uint8_t cooperation_flag) {
......@@ -46,8 +46,8 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
int32_t **ul_ch_estimates_0= eNB_pusch_vars->drs_ch_estimates_0[eNB_id];
int32_t **ul_ch_estimates_1= eNB_pusch_vars->drs_ch_estimates_1[eNB_id];
int32_t **rxdataF_ext= eNB_pusch_vars->rxdataF_ext[eNB_id];
int subframe_sched = (subframe == 9) ? 0 : (subframe+1);
uint8_t harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[subframe_sched].frame_rx,subframe);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
uint8_t harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
int16_t delta_phase = 0;
int16_t *ru1 = ru_90;
int16_t *ru2 = ru_90;
......
......@@ -4482,7 +4482,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
uint16_t rnti,
uint8_t subframe,
uint8_t sched_subframe,
DCI_format_t dci_format,
uint8_t UE_id,
PHY_VARS_eNB *phy_vars_eNB,
......@@ -4498,7 +4498,7 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
ANFBmode_t AckNackFBMode = phy_vars_eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode;
LTE_eNB_ULSCH_t *ulsch=phy_vars_eNB->ulsch_eNB[UE_id];
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
int subframe_sched = (subframe == 0) ? 9 : (subframe-1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
uint32_t cqi_req = 0;
uint32_t dai = 0;
......@@ -4520,7 +4520,7 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms,
phy_vars_eNB->proc[subframe_sched].frame_tx,
phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe));
......@@ -4786,8 +4786,7 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d)\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift);
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift);
......
......@@ -1313,7 +1313,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue,
}
void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
unsigned char subframe,
unsigned char sched_subframe,
int16_t amp,
uint8_t sect_id,
uint8_t abstraction_flag) {
......@@ -1328,7 +1328,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
uint8_t pusch_subframe;
uint8_t UE_id;
uint32_t pusch_frame;
int subframe_sched = (subframe == 0) ? 9 : (subframe-1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
// compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211
......@@ -1338,7 +1338,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
if (frame_parms->Ncp == 1)
NSF_PHICH = 2;
pusch_frame = phich_frame2_pusch_frame(frame_parms,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe);
pusch_frame = phich_frame2_pusch_frame(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
......@@ -1348,7 +1348,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
if (ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_active == 1) {
LOG_D(PHY,"[eNB][PUSCH %x/%d] Frame %d subframe %d (pusch_subframe %d,pusch_frame %d) phich active %d\n",
ulsch_eNB[UE_id]->rnti,harq_pid,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe,pusch_subframe,pusch_frame,ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_active);
ulsch_eNB[UE_id]->rnti,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,pusch_subframe,pusch_frame,ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_active);
ngroup_PHICH = (ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb +
ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH;
......@@ -1361,7 +1361,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH);
#ifdef DEBUG_PHICH
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d dci_alloc %d)\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[subframe_sched].frame_tx,
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_ACK,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb,
......@@ -1370,7 +1370,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
#endif
if (ulsch_eNB[UE_id]->Msg3_active == 1) {
LOG_D(PHY,"[eNB %d][PUSCH %d][RAPROC] Frame %d, subframe %d: Generating Msg3 PHICH for UE %d, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe,
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,
UE_id,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_ACK,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb);
}
......@@ -1399,7 +1399,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
(ulsch_eNB[UE_id]->harq_processes[harq_pid]->rar_alloc == 0) ){
if (ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_ACK==0 ){
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d, subframe %d : PHICH ACK / (no format0 DCI) Setting subframe_scheduling_flag\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe);
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);
ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
// ulsch_eNB[UE_id]->harq_processes[harq_pid]->Ndi = 0;
// ulsch_eNB[UE_id]->harq_processes[harq_pid]->round++; //this is already done in phy_procedures
......@@ -1407,7 +1407,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
}
else {
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d PHICH ACK (no format0 DCI) Clearing subframe_scheduling_flag, setting round to 0\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe);
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);
ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->round=0;
}
......
......@@ -224,10 +224,10 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eN
}
}
void generate_mch(PHY_VARS_eNB *phy_vars_eNB,int subframe,uint8_t *a,int abstraction_flag) {
void generate_mch(PHY_VARS_eNB *phy_vars_eNB,int sched_subframe,uint8_t *a,int abstraction_flag) {
int G;
int subframe_sched = (subframe==0) ? 9 : (subframe-1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
if (abstraction_flag != 0) {
if (eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]!=0)
......@@ -249,7 +249,7 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eN
phy_vars_eNB->lte_frame_parms.N_RB_DL,
phy_vars_eNB->dlsch_eNB_MCH->rb_alloc,
get_Qm(phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->mcs),1,
2,phy_vars_eNB->proc[subframe_sched].frame_tx,subframe);
2,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);
generate_mbsfn_pilot(phy_vars_eNB,
phy_vars_eNB->lte_eNB_common_vars.txdataF[0],
......@@ -260,7 +260,7 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eN
&phy_vars_eNB->lte_frame_parms,
1,
phy_vars_eNB->dlsch_eNB_MCH,
phy_vars_eNB->proc[subframe_sched].frame_tx,
phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe,
&phy_vars_eNB->dlsch_rate_matching_stats,
&phy_vars_eNB->dlsch_turbo_encoding_stats,
......
......@@ -254,7 +254,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su
uint8_t t1_ra;
uint8_t t2_ra;
// printf("In is_prach_subframe ..., prach_ConfigIndex %d\n",prach_ConfigIndex);
if (frame_parms->frame_type == FDD) { //FDD
//implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
if ((((frame&1) == 1) && (subframe < 9)) ||
......
......@@ -948,10 +948,10 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
PUCCH_FMT_t fmt,
uint8_t n1_pucch_sel,
uint8_t *payload,
uint8_t subframe) {
uint8_t sched_subframe) {
uint8_t UE_id;
uint16_t rnti;
int subframe_sched = (subframe==0)?9:(subframe-1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
rnti = phy_vars_eNB->ulsch_eNB[UE_index]->rnti;
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
......@@ -974,7 +974,7 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
payload[1] = PHY_vars_UE_g[UE_id]->pucch_payload[1];
}
else
LOG_E(PHY,"[eNB] Frame %d: Can't handle formats 2/2a/2b\n",phy_vars_eNB->proc[subframe_sched].frame_rx);
LOG_E(PHY,"[eNB] Frame %d: Can't handle formats 2/2a/2b\n",phy_vars_eNB->proc[sched_subframe].frame_rx);
if (PHY_vars_UE_g[UE_id]->pucch_sel[subframe] == n1_pucch_sel)
return(99);
......
......@@ -210,7 +210,7 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH) {
unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id,
uint8_t subframe,
uint8_t sched_subframe,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag) {
......@@ -249,7 +249,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
int16_t cseq[6*14*1200];
int off;
int status[20];
int subframe_sched = (subframe == 9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
uint8_t (*tc)(int16_t *y,
uint8_t *,
......@@ -273,7 +273,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
x2 = ((uint32_t)ulsch->rnti<<14) + ((uint32_t)subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
// harq_pid = (ulsch->RRCConnRequest_flag == 0) ? subframe2harq_pid_tdd(frame_parms->tdd_config,subframe) : 0;
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[subframe_sched].frame_rx,subframe);
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
if (harq_pid==255) {
LOG_E(PHY, "ulsch_decoding.c: FATAL ERROR: illegal harq_pid, returning\n");
......@@ -1669,16 +1669,16 @@ int ulsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nrb
#endif
uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t subframe,
uint8_t sched_subframe,
uint8_t UE_index,
uint16_t *crnti) {
uint8_t UE_id;
uint16_t rnti;
int subframe_sched = (subframe == 9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
uint8_t harq_pid;
harq_pid = subframe2harq_pid(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[subframe_sched].frame_rx,subframe);
harq_pid = subframe2harq_pid(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
rnti = phy_vars_eNB->ulsch_eNB[UE_index]->rnti;
#ifdef DEBUG_PHY
......
......@@ -1258,7 +1258,7 @@ int32_t ulsch_power_0[2],ulsch_power_1[2];// For the distributed Alamouti Scheme
*/
void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
uint32_t subframe,
uint32_t sched_subframe,
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id,
LTE_eNB_ULSCH_t **ulsch,
......@@ -1283,9 +1283,9 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
uint8_t Qm;
uint16_t rx_power_correction;
int16_t *llrp;
int subframe_sched = (subframe == 9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[subframe_sched].frame_rx,subframe);
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
Qm = get_Qm_ul(ulsch[UE_id]->harq_processes[harq_pid]->mcs);
#ifdef DEBUG_ULSCH
msg("rx_ulsch: eNB_id %d, harq_pid %d, nb_rb %d first_rb %d, cooperation %d\n",eNB_id,harq_pid,ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,ulsch[UE_id]->harq_processes[harq_pid]->first_rb, cooperation_flag);
......@@ -1314,7 +1314,7 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
lte_ul_channel_estimation(phy_vars_eNB,
eNB_id,
UE_id,
subframe,
sched_subframe,
l%(frame_parms->symbols_per_tti/2),
l/(frame_parms->symbols_per_tti/2),
cooperation_flag);
......@@ -1556,13 +1556,13 @@ void rx_ulsch_emul(PHY_VARS_eNB *phy_vars_eNB,
}
void dump_ulsch(PHY_VARS_eNB *PHY_vars_eNB,uint8_t subframe, uint8_t UE_id) {
void dump_ulsch(PHY_VARS_eNB *PHY_vars_eNB,uint8_t sched_subframe, uint8_t UE_id) {
uint32_t nsymb = (PHY_vars_eNB->lte_frame_parms.Ncp == 0) ? 14 : 12;
uint8_t harq_pid;
int subframe_sched = (subframe==9)?0 : (subframe+1);
int subframe = PHY_vars_eNB->proc[sched_subframe].subframe_rx;
harq_pid = subframe2harq_pid(&PHY_vars_eNB->lte_frame_parms,PHY_vars_eNB->proc[subframe_sched].frame_rx,subframe);
harq_pid = subframe2harq_pid(&PHY_vars_eNB->lte_frame_parms,PHY_vars_eNB->proc[sched_subframe].frame_rx,subframe);
printf("Dumping ULSCH in subframe %d with harq_pid %d, for NB_rb %d, mcs %d, Qm %d, N_symb %d\n", subframe,harq_pid,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs,get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs),PHY_vars_eNB->ulsch_eNB[UE_id]->Nsymb_pusch);
#ifndef OAI_EMU
......
......@@ -138,18 +138,34 @@ enum transmission_access_mode{
}ral_threshold_phy_t;
#endif
/// Context data structure for eNB subframe processing
typedef struct {
/// subframe index
int subframe;
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception
int subframe_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for reception
int frame_rx;
/// instance count for tx processing thread
int instance_cnt_tx;
/// instance count for rx processing thread
int instance_cnt_rx;
/// pthread structure for tx processing thread
pthread_t pthread_tx;
/// pthread structure for rx processing thread
pthread_t pthread_rx;
/// condition variable for tx processing thread
pthread_cond_t cond_tx;
/// condition variable for rx processing thread
pthread_cond_t cond_rx;
/// mutex for tx processing thread
pthread_mutex_t mutex_tx;
/// mutex for tx processing thread
pthread_mutex_t mutex_rx;
int subframe;
int frame_rx;
int frame_tx;
} eNB_proc_t;
/// Top-level PHY Data Structure for eNB
......
......@@ -258,7 +258,7 @@ unsigned char ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsig
return(4); // To be updated
}
else {
LOG_E(PHY,"phy_procedures_lte_common.c/subframe2_dl_harq_pid: illegal subframe %d for tdd_config %d\n",
LOG_E(PHY,"phy_procedures_lte_common.c/ul_ACK_subframe2_dl_subframe: illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config);
return(0);
}
......
......@@ -423,10 +423,11 @@ void phy_procedures_emos_eNB_TX(unsigned char next_slot, PHY_VARS_eNB *phy_vars_
}
*/
void phy_procedures_eNB_S_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type) {
void phy_procedures_eNB_S_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type) {
// unsigned char sect_id=0;
int subframe = phy_vars_eNB->proc[subframe].subframe_rx;
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d: Doing phy_procedures_eNB_S_RX(%d)\n", phy_vars_eNB->Mod_id,phy_vars_eNB->proc[subframe].frame_rx, subframe);
#endif
......@@ -502,7 +503,7 @@ void phy_procedures_emos_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eN
#endif
#ifndef OPENAIR2
void fill_dci(DCI_PDU *DCI_pdu, uint8_t subframe, PHY_VARS_eNB *phy_vars_eNB) {
void fill_dci(DCI_PDU *DCI_pdu, uint8_t sched_subframe, PHY_VARS_eNB *phy_vars_eNB) {
int i;
uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
......@@ -510,7 +511,7 @@ void fill_dci(DCI_PDU *DCI_pdu, uint8_t subframe, PHY_VARS_eNB *phy_vars_eNB) {
uint32_t rballoc = 0x7FFF;
uint32_t rballoc2 = 0x000F;
int sched_subframe = (subframe == 0) ? 9 : (subframe-1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
/*
uint32_t rand = taus();
if ((subframe==8) || (subframe==9) || (subframe==0))
......@@ -1005,7 +1006,7 @@ void phy_eNB_lte_check_measurement_thresholds(instance_t instanceP, ral_threshol
void phy_procedures_eNB_TX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,
void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,
relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) {
uint8_t *pbch_pdu=&phy_vars_eNB->pbch_pdu[0];
// unsigned int nb_dci_ue_spec = 0, nb_dci_common = 0;
......@@ -1036,7 +1037,7 @@ void phy_procedures_eNB_TX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
// there is at least one allocation for PDCCH
uint8_t smbv_alloc_cnt = 1;
#endif
int sched_subframe = (subframe==0)?9:(subframe-1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX,1);
start_meas(&phy_vars_eNB->phy_proc_tx);
......@@ -1125,7 +1126,7 @@ void phy_procedures_eNB_TX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
if (mch_pduP){
fill_eNB_dlsch_MCH(phy_vars_eNB,mch_pduP->mcs,1,0, abstraction_flag);
// Generate PMCH
generate_mch(phy_vars_eNB,subframe,(uint8_t*)mch_pduP->payload,abstraction_flag);
generate_mch(phy_vars_eNB,sched_subframe,(uint8_t*)mch_pduP->payload,abstraction_flag);
#ifdef DEBUG_PHY
for (i=0;i<mch_pduP->Pdu_size;i++)
msg("%2x.",(uint8_t)mch_pduP->payload[i]);
......@@ -1614,7 +1615,7 @@ void phy_procedures_eNB_TX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
//LOG_D(PHY,"[eNB] cba generate_eNB_ulsch_params_from_dci for ue %d for dci rnti %x\n", UE_id, DCI_pdu->dci_alloc[i].rnti);
generate_eNB_ulsch_params_from_dci(&DCI_pdu->dci_alloc[i].dci_pdu[0],
DCI_pdu->dci_alloc[i].rnti,
(subframe),
sched_subframe,
format0,
UE_id,
phy_vars_eNB,
......@@ -2072,7 +2073,7 @@ void phy_procedures_eNB_TX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
#endif
// for (sect_id=0;sect_id<number_of_cards;sect_id++) {
generate_phich_top(phy_vars_eNB,
subframe,
sched_subframe,
AMP,
0,
abstraction_flag);
......@@ -2090,10 +2091,10 @@ void phy_procedures_eNB_TX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
}
void process_Msg3(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint8_t UE_id, uint8_t harq_pid) {
void process_Msg3(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t UE_id, uint8_t harq_pid) {
// this prepares the demodulation of the first PUSCH of a new user, containing Msg3
int sched_subframe = (subframe==9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
LOG_D(PHY,"[eNB %d][RAPROC] frame %d : subframe %d : process_Msg3 UE_id %d (active %d, subframe %d, frame %d)\n",
......@@ -2126,7 +2127,7 @@ void process_Msg3(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint8_t UE_id, uin
// rate-adaptation based on the error statistics derived from the ACK/NAK process
void process_HARQ_feedback(uint8_t UE_id,
uint8_t subframe,
uint8_t sched_subframe,
PHY_VARS_eNB *phy_vars_eNB,
uint8_t pusch_flag,
uint8_t *pucch_payload,
......@@ -2140,7 +2141,8 @@ void process_HARQ_feedback(uint8_t UE_id,
uint8_t subframe_m4,M,m;
int mp;
int all_ACKed=1,nb_alloc=0,nb_ACK=0;
int frame = phy_vars_eNB->proc[subframe].frame_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
if (phy_vars_eNB->lte_frame_parms.frame_type == 0){ //FDD
subframe_m4 = (subframe<4) ? subframe+6 : subframe-4;
......@@ -2507,21 +2509,21 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
}
void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint8_t abstraction_flag) {
void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t abstraction_flag) {
uint16_t preamble_energy_list[64],preamble_delay_list[64];
uint16_t preamble_max,preamble_energy_max;
uint16_t i;
int8_t UE_id;
int sched_subframe = (subframe == 9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
memset(&preamble_energy_list[0],0,64*sizeof(uint16_t));
memset(&preamble_delay_list[0],0,64*sizeof(uint16_t));
if (abstraction_flag == 0) {
/* LOG_I(PHY,"[eNB %d][RAPROC] Frame %d, Subframe %d : PRACH RX Signal Power : %d dBm\n",phy_vars_eNB->Mod_id,
LOG_I(PHY,"[eNB %d][RAPROC] Frame %d, Subframe %d : PRACH RX Signal Power : %d dBm\n",phy_vars_eNB->Mod_id,
frame,subframe,dB_fixed(signal_energy(&phy_vars_eNB->lte_eNB_common_vars.rxdata[0][0][subframe*phy_vars_eNB->lte_frame_parms.samples_per_tti],512)) - phy_vars_eNB->rx_total_gain_eNB_dB);
*/
// LOG_I(PHY,"[eNB %d][RAPROC] PRACH: rootSequenceIndex %d, prach_ConfigIndex %d, zeroCorrelationZoneConfig %d, highSpeedFlag %d, prach_FreqOffset %d\n",phy_vars_eNB->Mod_id,phy_vars_eNB->lte_frame_parms.prach_config_common.rootSequenceIndex,phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex, phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset);
rx_prach(phy_vars_eNB,
......@@ -2598,7 +2600,7 @@ void ulsch_decoding_procedures(unsigned char subframe, unsigned int i, PHY_VARS_
}
void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type) {
void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type) {
//RX processing
uint32_t l, ret=0,i,j;
uint32_t sect_id=0;
......@@ -2618,7 +2620,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
uint16_t rnti=0;
uint8_t access_mode;
int num_active_cba_groups;
int sched_subframe = (subframe == 9) ? 0 : (subframe+1);
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX,1);
......@@ -2634,7 +2636,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
// check if we have to detect PRACH first
if (is_prach_subframe(&phy_vars_eNB->lte_frame_parms,frame,subframe)>0) {
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
prach_procedures(phy_vars_eNB,subframe,abstraction_flag);
prach_procedures(phy_vars_eNB,sched_subframe,abstraction_flag);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
}
......@@ -2744,7 +2746,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
*/
#ifdef OPENAIR2
if (phy_vars_eNB->eNB_UE_stats[i].mode == RA_RESPONSE)
process_Msg3(phy_vars_eNB,subframe,i,harq_pid);
process_Msg3(phy_vars_eNB,sched_subframe,i,harq_pid);
#endif
/*
......@@ -2827,7 +2829,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
start_meas(&phy_vars_eNB->ulsch_demodulation_stats);
if (abstraction_flag==0) {
rx_ulsch(phy_vars_eNB,
subframe,
sched_subframe,
phy_vars_eNB->eNB_UE_stats[i].sector, // this is the effective sector id
i,
phy_vars_eNB->ulsch_eNB,
......@@ -2851,7 +2853,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
if (abstraction_flag == 0) {
ret = ulsch_decoding(phy_vars_eNB,
i,
subframe,
sched_subframe,
0, // control_only_flag
0, //Nbundled, to be updated!!!!
0);
......@@ -2859,7 +2861,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
#ifdef PHY_ABSTRACTION
else {
ret = ulsch_decoding_emul(phy_vars_eNB,
subframe,
sched_subframe,
i,
&rnti);
}
......@@ -2934,7 +2936,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round++;
LOG_D(PHY,"[eNB][PUSCH %d] Increasing to round %d\n",harq_pid,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round);
// dump_ulsch(phy_vars_eNB, subframe, i);
// dump_ulsch(phy_vars_eNB, sched_subframe, i);
// exit(-1);
if (phy_vars_eNB->ulsch_eNB[i]->Msg3_flag == 1) {
......@@ -2974,7 +2976,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
for (j=0;j<phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3;j++)
printf("%x.",phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->c[0][j]);
printf("\n");
dump_ulsch(phy_vars_eNB,subframe,i);*/
dump_ulsch(phy_vars_eNB,sched_subframe,i);*/
//#ifndef EXMIMO_IOT
LOG_W(PHY,"[eNB] Frame %d, Subframe %d: Msg3 in error\n", frame,subframe);
//#else
......@@ -2999,7 +3001,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
}
// dump_ulsch(phy_vars_eNB,subframe,i);
// dump_ulsch(phy_vars_eNB,sched_subframe,i);
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round== phy_vars_eNB->ulsch_eNB[i]->Mdlharq) {
LOG_I(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d ULSCH Mdlharq %d reached\n",
......@@ -3011,7 +3013,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->phich_active=0;
phy_vars_eNB->eNB_UE_stats[i].ulsch_errors[harq_pid]++;
phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid]++;
//dump_ulsch(phy_vars_eNB, subframe, i);
//dump_ulsch(phy_vars_eNB, sched_subframe, i);
}
// If we've dropped the UE, go back to PRACH mode for this UE
......@@ -3087,7 +3089,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
LOG_T(PHY,"\n");
#endif
#endif
//dump_ulsch(phy_vars_eNB,subframe,i);
//dump_ulsch(phy_vars_eNB,sched_subframe,i);
#ifdef OPENAIR2
......@@ -3109,7 +3111,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
// estimate timing advance for MAC
if (abstraction_flag == 0) {
sync_pos = lte_est_timing_advance_pusch(phy_vars_eNB,i,subframe);
sync_pos = lte_est_timing_advance_pusch(phy_vars_eNB,i,sched_subframe);
phy_vars_eNB->eNB_UE_stats[i].timing_advance_update = sync_pos - phy_vars_eNB->lte_frame_parms.nb_prefix_samples/8; //to check
}
......@@ -3132,7 +3134,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
i);
#endif
process_HARQ_feedback(i,
subframe,
sched_subframe,
phy_vars_eNB,
1, // pusch_flag
0,
......@@ -3220,7 +3222,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
pucch_format1,
0,
&SR_payload,
subframe);
sched_subframe);
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR (UE SR %d/%d)\n",phy_vars_eNB->Mod_id,
phy_vars_eNB->ulsch_eNB[i]->rnti,frame,subframe,SR_payload,phy_vars_eNB->scheduling_request_config[i].sr_PUCCH_ResourceIndex);
}
......@@ -3277,7 +3279,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
pucch_payload0[0],metric0);
#endif
process_HARQ_feedback(i,subframe,phy_vars_eNB,
process_HARQ_feedback(i,sched_subframe,phy_vars_eNB,
0,// pusch_flag
pucch_payload0,
2,
......@@ -3410,7 +3412,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
frame,subframe,
metric0,metric1,pucch_sel,pucch_payload[0],pucch_payload[1]);
#endif
process_HARQ_feedback(i,subframe,phy_vars_eNB,
process_HARQ_feedback(i,sched_subframe,phy_vars_eNB,
0,// pusch_flag
pucch_payload,
pucch_sel,
......@@ -3448,7 +3450,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
#endif
if (abstraction_flag==0) {
rx_ulsch(phy_vars_eNB,
subframe,
sched_subframe,
phy_vars_eNB->eNB_UE_stats[i].sector, // this is the effective sector id
i,
phy_vars_eNB->ulsch_eNB,
......@@ -3466,7 +3468,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
if (abstraction_flag == 0) {
ret = ulsch_decoding(phy_vars_eNB,
i,
subframe,
sched_subframe,
0, // control_only_flag
0, //Nbundled, to be updated!!!!
0);
......@@ -3474,7 +3476,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
#ifdef PHY_ABSTRACTION
else {
ret = ulsch_decoding_emul(phy_vars_eNB,
subframe,
sched_subframe,
i,
&rnti);
}
......@@ -3500,7 +3502,7 @@ void phy_procedures_eNB_RX(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uin
(phy_vars_eNB->ulsch_eNB[i+num_active_cba_groups]->cba_rnti[i%num_active_cba_groups] > 0 ) &&
(phy_vars_eNB->ulsch_eNB[i+num_active_cba_groups]->num_active_cba_groups> 0)) {
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d harq_pid %d resetting the sched_subframeuling_flag for Ue %d cba groups %d members\n",
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d harq_pid %d resetting the subframe_scheduling_flag for Ue %d cba groups %d members\n",
phy_vars_eNB->Mod_id,harq_pid,frame,subframe,i,harq_pid,
i+num_active_cba_groups, i%phy_vars_eNB->ulsch_eNB[i]->num_active_cba_groups);
#endif
......@@ -3625,11 +3627,6 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui
int result;
#endif
int subframe_rx,subframe_tx;
subframe_rx = (subframe == 0) ? 9 : (subframe-1);
subframe_tx = (subframe == 9) ? 0 : (subframe+1);
/*
if (phy_vars_eNB->proc[sched_subframe].frame_tx >= 1000)
mac_xface->macphy_exit("Exiting after 1000 Frames\n");
......@@ -3774,25 +3771,27 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui