Commit f60694db authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony
parents 8efba9bc 27f77d04
...@@ -121,7 +121,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id, ...@@ -121,7 +121,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
//int32_t rx_total_gain_eNB_dB = PHY_vars_eNB_g[Mod_id][CC_id]->rx_total_gain_eNB_dB; //int32_t rx_total_gain_eNB_dB = PHY_vars_eNB_g[Mod_id][CC_id]->rx_total_gain_eNB_dB;
int i; int i;
LOG_D(PHY,"[eNB%d] CCid %d Frame %d: Applying radioResourceConfigCommon\n",Mod_id,CC_id,PHY_vars_eNB_g[Mod_id][CC_id]->proc.frame_tx); LOG_D(PHY,"[eNB%d] CCid %d: Applying radioResourceConfigCommon\n",Mod_id,CC_id);
frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex; frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
LOG_D(PHY,"prach_config_common.rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex ); LOG_D(PHY,"prach_config_common.rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex );
...@@ -388,7 +388,7 @@ void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx, ...@@ -388,7 +388,7 @@ void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
LTE_DL_FRAME_PARMS *frame_parms = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms;
LOG_I(PHY,"[eNB%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_eNB_g[Mod_id][CC_id]->proc.frame_tx,mbsfn_AreaId_r9,mbsfn_Area_idx); LOG_I(PHY,"[eNB%d] Applying MBSFN_Area_id %d for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
if (mbsfn_Area_idx == 0) { if (mbsfn_Area_idx == 0) {
frame_parms->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9; frame_parms->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
...@@ -409,7 +409,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) ...@@ -409,7 +409,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
physicalConfigDedicated = eNB->physicalConfigDedicated[UE_id]; physicalConfigDedicated = eNB->physicalConfigDedicated[UE_id];
if (physicalConfigDedicated != NULL) { if (physicalConfigDedicated != NULL) {
LOG_I(PHY,"[eNB %d] Frame %d: Sent physicalConfigDedicated=%p for UE %d\n",eNB->Mod_id, eNB->proc.frame_tx,physicalConfigDedicated,UE_id); LOG_I(PHY,"[eNB %d] Frame %d: Sent physicalConfigDedicated=%p for UE %d\n",eNB->Mod_id,physicalConfigDedicated,UE_id);
LOG_D(PHY,"------------------------------------------------------------------------\n"); LOG_D(PHY,"------------------------------------------------------------------------\n");
if (physicalConfigDedicated->pdsch_ConfigDedicated) { if (physicalConfigDedicated->pdsch_ConfigDedicated) {
...@@ -644,7 +644,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id, ...@@ -644,7 +644,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
int8_t UE_id = find_ue(rnti,eNB); int8_t UE_id = find_ue(rnti,eNB);
if (UE_id == -1) { if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] Frame %d: find_ue() returns -1\n", Mod_id, eNB->proc.frame_tx ); LOG_E( PHY, "[eNB %"PRIu8"] Frame %d: find_ue() returns -1\n", Mod_id);
return; return;
} }
...@@ -653,7 +653,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id, ...@@ -653,7 +653,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated; eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated); LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
} else { } else {
LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, eNB->proc.frame_tx,UE_id); LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
return; return;
} }
......
...@@ -7078,6 +7078,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ...@@ -7078,6 +7078,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
} }
int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
void *dci_pdu, void *dci_pdu,
uint16_t rnti, uint16_t rnti,
DCI_format_t dci_format, DCI_format_t dci_format,
...@@ -7095,7 +7096,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -7095,7 +7096,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
ANFBmode_t AckNackFBMode = eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode; ANFBmode_t AckNackFBMode = eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode;
LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id]; LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id];
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
int subframe = eNB->proc.subframe_tx; int subframe = proc->subframe_tx;
uint32_t cqi_req = 0; uint32_t cqi_req = 0;
uint32_t dai = 0; uint32_t dai = 0;
...@@ -7116,7 +7117,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -7116,7 +7117,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
harq_pid = subframe2harq_pid(frame_parms, harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms, pdcch_alloc2ul_frame(frame_parms,
eNB->proc.frame_tx, proc->frame_tx,
subframe), subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe)); pdcch_alloc2ul_subframe(frame_parms,subframe));
...@@ -7637,7 +7638,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -7637,7 +7638,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d)\n", LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d)\n",
eNB->Mod_id,harq_pid,eNB->proc.frame_tx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift); eNB->Mod_id,harq_pid,proc->frame_tx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift);
......
...@@ -1416,7 +1416,8 @@ void rx_phich(PHY_VARS_UE *ue, ...@@ -1416,7 +1416,8 @@ void rx_phich(PHY_VARS_UE *ue,
} }
void generate_phich_top(PHY_VARS_eNB *eNB, void generate_phich_top(PHY_VARS_eNB *eNB,
int16_t amp, eNB_rxtx_proc_t *proc,
int16_t amp,
uint8_t sect_id, uint8_t sect_id,
uint8_t abstraction_flag) uint8_t abstraction_flag)
{ {
...@@ -1431,7 +1432,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1431,7 +1432,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
uint8_t pusch_subframe; uint8_t pusch_subframe;
uint8_t UE_id; uint8_t UE_id;
uint32_t pusch_frame; uint32_t pusch_frame;
int subframe = eNB->proc.subframe_tx; int subframe = proc->subframe_tx;
// compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211 // compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211
...@@ -1443,7 +1444,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1443,7 +1444,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
if (frame_parms->Ncp == 1) if (frame_parms->Ncp == 1)
NSF_PHICH = 2; NSF_PHICH = 2;
pusch_frame = phich_frame2_pusch_frame(frame_parms,eNB->proc.frame_tx,subframe); pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe);
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe); pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe); harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
...@@ -1452,7 +1453,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1452,7 +1453,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
if (ulsch[UE_id]->harq_processes[harq_pid]->phich_active == 1) { if (ulsch[UE_id]->harq_processes[harq_pid]->phich_active == 1) {
LOG_D(PHY,"[eNB][PUSCH %d/%x] Frame %d subframe %d (pusch_subframe %d,pusch_frame %d) phich active %d\n", LOG_D(PHY,"[eNB][PUSCH %d/%x] Frame %d subframe %d (pusch_subframe %d,pusch_frame %d) phich active %d\n",
harq_pid,ulsch[UE_id]->rnti,eNB->proc.frame_tx,subframe,pusch_subframe,pusch_frame,ulsch[UE_id]->harq_processes[harq_pid]->phich_active); harq_pid,ulsch[UE_id]->rnti,proc->frame_tx,subframe,pusch_subframe,pusch_frame,ulsch[UE_id]->harq_processes[harq_pid]->phich_active);
ngroup_PHICH = (ulsch[UE_id]->harq_processes[harq_pid]->first_rb + ngroup_PHICH = (ulsch[UE_id]->harq_processes[harq_pid]->first_rb +
ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH; ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH;
...@@ -1466,7 +1467,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1466,7 +1467,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
nseq_PHICH = ((ulsch[UE_id]->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) + nseq_PHICH = ((ulsch[UE_id]->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) +
ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH); ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS)%(2*NSF_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", 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",
eNB->Mod_id,harq_pid,eNB->proc.frame_tx, eNB->Mod_id,harq_pid,proc->frame_tx,
subframe,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH, subframe,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK, ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK,
ulsch[UE_id]->harq_processes[harq_pid]->first_rb, ulsch[UE_id]->harq_processes[harq_pid]->first_rb,
...@@ -1474,7 +1475,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1474,7 +1475,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
if (ulsch[UE_id]->Msg3_active == 1) { if (ulsch[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", 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",
eNB->Mod_id,harq_pid,eNB->proc.frame_tx,subframe, eNB->Mod_id,harq_pid,proc->frame_tx,subframe,
UE_id,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK, UE_id,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK,
ulsch[UE_id]->harq_processes[harq_pid]->first_rb); ulsch[UE_id]->harq_processes[harq_pid]->first_rb);
} }
...@@ -1504,7 +1505,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1504,7 +1505,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
(ulsch[UE_id]->harq_processes[harq_pid]->rar_alloc == 0) ) { (ulsch[UE_id]->harq_processes[harq_pid]->rar_alloc == 0) ) {
if (ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK==0 ) { if (ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK==0 ) {
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d, subframe %d : PHICH NACK / (no format0 DCI) Setting subframe_scheduling_flag\n", LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d, subframe %d : PHICH NACK / (no format0 DCI) Setting subframe_scheduling_flag\n",
eNB->Mod_id,harq_pid,eNB->proc.frame_tx,subframe); eNB->Mod_id,harq_pid,proc->frame_tx,subframe);
ulsch[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1; ulsch[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
ulsch[UE_id]->harq_processes[harq_pid]->rvidx = rv_table[ulsch[UE_id]->harq_processes[harq_pid]->round&3]; ulsch[UE_id]->harq_processes[harq_pid]->rvidx = rv_table[ulsch[UE_id]->harq_processes[harq_pid]->round&3];
ulsch[UE_id]->harq_processes[harq_pid]->O_RI = 0; ulsch[UE_id]->harq_processes[harq_pid]->O_RI = 0;
...@@ -1514,7 +1515,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, ...@@ -1514,7 +1515,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
} else { } 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", 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",
eNB->Mod_id,harq_pid,eNB->proc.frame_tx,subframe); eNB->Mod_id,harq_pid,proc->frame_tx,subframe);
ulsch[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; ulsch[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
ulsch[UE_id]->harq_processes[harq_pid]->round=0; ulsch[UE_id]->harq_processes[harq_pid]->round=0;
} }
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
int generate_mbsfn_pilot(PHY_VARS_eNB *eNB, int generate_mbsfn_pilot(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
int32_t **txdataF, int32_t **txdataF,
int16_t amp) int16_t amp)
...@@ -49,7 +50,7 @@ int generate_mbsfn_pilot(PHY_VARS_eNB *eNB, ...@@ -49,7 +50,7 @@ int generate_mbsfn_pilot(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
uint32_t subframe_offset,Nsymb,samples_per_symbol; uint32_t subframe_offset,Nsymb,samples_per_symbol;
int subframe = eNB->proc.subframe_tx; int subframe = proc->subframe_tx;
if (subframe<0 || subframe>= 10) { if (subframe<0 || subframe>= 10) {
......
...@@ -286,11 +286,11 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id) ...@@ -286,11 +286,11 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id)
} }
} }
void generate_mch(PHY_VARS_eNB *eNB,uint8_t *a,int abstraction_flag) void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a,int abstraction_flag)
{ {
int G; int G;
int subframe = eNB->proc.subframe_tx; int subframe = proc->subframe_tx;
if (abstraction_flag != 0) { if (abstraction_flag != 0) {
if (eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]!=0) if (eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]!=0)
...@@ -312,9 +312,9 @@ void generate_mch(PHY_VARS_eNB *eNB,uint8_t *a,int abstraction_flag) ...@@ -312,9 +312,9 @@ void generate_mch(PHY_VARS_eNB *eNB,uint8_t *a,int abstraction_flag)
eNB->frame_parms.N_RB_DL, eNB->frame_parms.N_RB_DL,
eNB->dlsch_MCH->harq_processes[0]->rb_alloc, eNB->dlsch_MCH->harq_processes[0]->rb_alloc,
get_Qm(eNB->dlsch_MCH->harq_processes[0]->mcs),1, get_Qm(eNB->dlsch_MCH->harq_processes[0]->mcs),1,
2,eNB->proc.frame_tx,subframe); 2,proc->frame_tx,subframe);
generate_mbsfn_pilot(eNB, generate_mbsfn_pilot(eNB,proc,
eNB->common_vars.txdataF[0], eNB->common_vars.txdataF[0],
AMP); AMP);
...@@ -323,7 +323,7 @@ void generate_mch(PHY_VARS_eNB *eNB,uint8_t *a,int abstraction_flag) ...@@ -323,7 +323,7 @@ void generate_mch(PHY_VARS_eNB *eNB,uint8_t *a,int abstraction_flag)
&eNB->frame_parms, &eNB->frame_parms,
1, 1,
eNB->dlsch_MCH, eNB->dlsch_MCH,
eNB->proc.frame_tx, proc->frame_tx,
subframe, subframe,
&eNB->dlsch_rate_matching_stats, &eNB->dlsch_rate_matching_stats,
&eNB->dlsch_turbo_encoding_stats, &eNB->dlsch_turbo_encoding_stats,
......
...@@ -568,7 +568,7 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length) ...@@ -568,7 +568,7 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0}; uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0};
uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0}; uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0};
uint32_t UE_id_mac, RRC_status; uint32_t UE_id_mac, RRC_status;
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
if (eNB==NULL) if (eNB==NULL)
return 0; return 0;
...@@ -583,7 +583,7 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length) ...@@ -583,7 +583,7 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
for (eNB_id=0; eNB_id<number_of_cards_l; eNB_id++) { for (eNB_id=0; eNB_id<number_of_cards_l; eNB_id++) {
len += sprintf(&buffer[len],"eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n", len += sprintf(&buffer[len],"eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
eNB_id,number_of_cards_l, eNB_id,number_of_cards_l,
eNB->proc.frame_tx, proc->frame_tx,
eNB->rx_total_gain_dB, eNB->rx_total_gain_dB,
eNB->measurements[eNB_id].n0_power_tot_dBm, eNB->measurements[eNB_id].n0_power_tot_dBm,
eNB->measurements[eNB_id].n0_power_dB[0], eNB->measurements[eNB_id].n0_power_dB[0],
...@@ -621,9 +621,9 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length) ...@@ -621,9 +621,9 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
len += sprintf(&buffer[len],"Total DLSCH %d kbits / %d frames ",(eNB->total_transmitted_bits/1000),eNB->proc.frame_tx+1); len += sprintf(&buffer[len],"Total DLSCH %d kbits / %d frames ",(eNB->total_transmitted_bits/1000),proc->frame_tx+1);
len += sprintf(&buffer[len],"Total DLSCH throughput %d kbps ",(eNB->total_dlsch_bitrate/1000)); len += sprintf(&buffer[len],"Total DLSCH throughput %d kbps ",(eNB->total_dlsch_bitrate/1000));
len += sprintf(&buffer[len],"Total DLSCH trans %d / %d frames\n",success,eNB->proc.frame_tx+1); len += sprintf(&buffer[len],"Total DLSCH trans %d / %d frames\n",success,proc->frame_tx+1);
//len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->FULL_MUMIMO_transmissions,eNB->check_for_total_transmissions); //len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->FULL_MUMIMO_transmissions,eNB->check_for_total_transmissions);
//len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_MUMIMO_transmissions,eNB->check_for_total_transmissions); //len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_MUMIMO_transmissions,eNB->check_for_total_transmissions);
//len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_SUMIMO_transmissions,eNB->check_for_total_transmissions); //len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_SUMIMO_transmissions,eNB->check_for_total_transmissions);
......
...@@ -232,10 +232,11 @@ int mch_modulation(int32_t **txdataF, ...@@ -232,10 +232,11 @@ int mch_modulation(int32_t **txdataF,
@param abstraction_flag @param abstraction_flag
*/ */
void generate_mch(PHY_VARS_eNB *phy_vars_eNB,uint8_t *a,int abstraction_flag); void generate_mch(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t *a,int abstraction_flag);
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) /** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
@param phy_vars_eNB Pointer to eNB variables @param phy_vars_eNB Pointer to eNB variables
@param proc Pointer to RXn-TXnp4 proc information
@param mcs MCS for MBSFN @param mcs MCS for MBSFN
@param ndi new data indicator @param ndi new data indicator
@param rdvix @param rdvix
...@@ -299,7 +300,8 @@ int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, ...@@ -299,7 +300,8 @@ int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB,
int first_pilot_only); int first_pilot_only);
int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB, int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF, eNB_rxtx_proc_t *proc,
int32_t **txdataF,
int16_t amp); int16_t amp);
int32_t generate_pss(int32_t **txdataF, int32_t generate_pss(int32_t **txdataF,
...@@ -1408,6 +1410,7 @@ int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, ...@@ -1408,6 +1410,7 @@ int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue,
double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id); uint8_t eNB_id);
int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
eNB_rxtx_proc_t *proc,
void *dci_pdu, void *dci_pdu,
rnti_t rnti, rnti_t rnti,
DCI_format_t dci_format, DCI_format_t dci_format,
...@@ -1419,7 +1422,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, ...@@ -1419,7 +1422,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
uint8_t use_srs); uint8_t use_srs);
void dump_ulsch(PHY_VARS_eNB *phy_vars_eNb,uint8_t UE_id); void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id);
void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid); void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid);
void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe); void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe);
...@@ -1474,12 +1477,14 @@ void generate_RIV_tables(void); ...@@ -1474,12 +1477,14 @@ void generate_RIV_tables(void);
int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode); int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode);
void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB, void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
uint8_t eNB_id, // this is the effective sector id eNB_rxtx_proc_t *proc,
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id, uint8_t UE_id,
LTE_eNB_ULSCH_t **ulsch, LTE_eNB_ULSCH_t **ulsch,
uint8_t cooperation_flag); uint8_t cooperation_flag);
void rx_ulsch_emul(PHY_VARS_eNB *phy_vars_eNB, void rx_ulsch_emul(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t sect_id, uint8_t sect_id,
uint8_t UE_index); uint8_t UE_index);
...@@ -1518,6 +1523,7 @@ int32_t ulsch_encoding_emul(uint8_t *ulsch_buffer, ...@@ -1518,6 +1523,7 @@ int32_t ulsch_encoding_emul(uint8_t *ulsch_buffer,
/*! /*!
\brief Decoding of PUSCH/ACK/RI/ACK from 36-212. \brief Decoding of PUSCH/ACK/RI/ACK from 36-212.
@param phy_vars_eNB Pointer to eNB top-level descriptor @param phy_vars_eNB Pointer to eNB top-level descriptor
@param proc Pointer to RXTX proc variables
@param UE_id ID of UE transmitting this PUSCH @param UE_id ID of UE transmitting this PUSCH
@param subframe Index of subframe for PUSCH @param subframe Index of subframe for PUSCH
@param control_only_flag Receive PUSCH with control information only @param control_only_flag Receive PUSCH with control information only
...@@ -1526,6 +1532,7 @@ int32_t ulsch_encoding_emul(uint8_t *ulsch_buffer, ...@@ -1526,6 +1532,7 @@ int32_t ulsch_encoding_emul(uint8_t *ulsch_buffer,
@returns 0 on success @returns 0 on success
*/ */
unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id, uint8_t UE_id,
uint8_t control_only_flag, uint8_t control_only_flag,
uint8_t Nbundled, uint8_t Nbundled,
...@@ -1536,6 +1543,7 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1536,6 +1543,7 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
uint16_t *crnti); uint16_t *crnti);
void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB, void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
int16_t amp, int16_t amp,
uint8_t sect_id, uint8_t sect_id,
uint8_t abstraction_flag); uint8_t abstraction_flag);
...@@ -1663,6 +1671,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1663,6 +1671,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
uint8_t pucch1_thres); uint8_t pucch1_thres);
int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB, int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_index, uint8_t UE_index,
PUCCH_FMT_t fmt, PUCCH_FMT_t fmt,
uint8_t n1_pucch_sel, uint8_t n1_pucch_sel,
......
...@@ -1064,6 +1064,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, ...@@ -1064,6 +1064,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
int32_t rx_pucch_emul(PHY_VARS_eNB *eNB, int32_t rx_pucch_emul(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_index, uint8_t UE_index,
PUCCH_FMT_t fmt, PUCCH_FMT_t fmt,
uint8_t n1_pucch_sel, uint8_t n1_pucch_sel,
...@@ -1072,7 +1073,7 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *eNB, ...@@ -1072,7 +1073,7 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *eNB,
{ {
uint8_t UE_id; uint8_t UE_id;
uint16_t rnti; uint16_t rnti;
int subframe = eNB->proc.subframe_rx; int subframe = proc->subframe_rx;
uint8_t CC_id = eNB->CC_id; uint8_t CC_id = eNB->CC_id;
rnti = eNB->ulsch[UE_index]->rnti; rnti = eNB->ulsch[UE_index]->rnti;
...@@ -1095,7 +1096,7 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *eNB, ...@@ -1095,7 +1096,7 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *eNB,
payload[0] = PHY_vars_UE_g[UE_id][CC_id]->pucch_payload[0]; payload[0] = PHY_vars_UE_g[UE_id][CC_id]->pucch_payload[0];
payload[1] = PHY_vars_UE_g[UE_id][CC_id]->pucch_payload[1]; payload[1] = PHY_vars_UE_g[UE_id][CC_id]->pucch_payload[1];
} else } else
LOG_E(PHY,"[eNB] Frame %d: Can't handle formats 2/2a/2b\n",eNB->proc.frame_rx); LOG_E(PHY,"[eNB] Frame %d: Can't handle formats 2/2a/2b\n",proc->frame_rx);
if (PHY_vars_UE_g[UE_id][CC_id]->pucch_sel[subframe] == n1_pucch_sel) if (PHY_vars_UE_g[UE_id][CC_id]->pucch_sel[subframe] == n1_pucch_sel)
return(99); return(99);
......
...@@ -218,7 +218,7 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH) ...@@ -218,7 +218,7 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH)
unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
uint8_t UE_id, uint8_t UE_id,
uint8_t control_only_flag, uint8_t control_only_flag,
uint8_t Nbundled, uint8_t Nbundled,
...@@ -259,7 +259,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, ...@@ -259,7 +259,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
int16_t cseq[6*14*1200]; int16_t cseq[6*14*1200];
int off; int off;
int status[20]; int status[20];
int subframe = eNB->proc.subframe_rx; int subframe = proc->subframe_rx;
LTE_UL_eNB_HARQ_t *ulsch_harq; LTE_UL_eNB_HARQ_t *ulsch_harq;
uint8_t (*tc)(int16_t *y, uint8_t (*tc)(int16_t *y,
...@@ -278,7 +278,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, ...@@ -278,7 +278,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
time_stats_t *, time_stats_t *,
time_stats_t *); time_stats_t *);
harq_pid = subframe2harq_pid(frame_parms,eNB->proc.frame_rx,subframe); harq_pid = subframe2harq_pid(frame_parms,proc->frame_rx,subframe);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,1);
...@@ -1501,18 +1501,18 @@ int ulsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nrb ...@@ -1501,18 +1501,18 @@ int ulsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nrb
#endif #endif
uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc,
uint8_t UE_index, uint8_t UE_index,
uint16_t *crnti) uint16_t *crnti)
{ {
uint8_t UE_id; uint8_t UE_id;
uint16_t rnti; uint16_t rnti;
int subframe = eNB->proc.subframe_rx; int subframe = proc->subframe_rx;
uint8_t harq_pid; uint8_t harq_pid;
uint8_t CC_id = eNB->CC_id; uint8_t CC_id = eNB->CC_id;
harq_pid = subframe2harq_pid(&eNB->frame_parms,eNB->proc.frame_rx,subframe); harq_pid = subframe2harq_pid(&eNB->frame_parms,proc->frame_rx,subframe);
rnti = eNB->ulsch[UE_index]->rnti; rnti = eNB->ulsch[UE_index]->rnti;
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
......
...@@ -1577,6 +1577,7 @@ int32_t avgU[2]; ...@@ -1577,6 +1577,7 @@ int32_t avgU[2];
int32_t avgU_0[2],avgU_1[2]; // For the Distributed Alamouti Scheme int32_t avgU_0[2],avgU_1[2]; // For the Distributed Alamouti Scheme
void rx_ulsch(PHY_VARS_eNB *eNB, void rx_ulsch(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id, // this is the effective sector id uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id, uint8_t UE_id,
LTE_eNB_ULSCH_t **ulsch, LTE_eNB_ULSCH_t **ulsch,
...@@ -1602,9 +1603,9 @@ void rx_ulsch(PHY_VARS_eNB *eNB, ...@@ -1602,9 +1603,9 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
uint8_t Qm; uint8_t Qm;
uint16_t rx_power_correction; uint16_t rx_power_correction;
int16_t *llrp; int16_t *llrp;
int subframe = eNB->proc.subframe_rx; int subframe = proc->subframe_rx;
harq_pid = subframe2harq_pid(frame_parms,eNB->proc.frame_rx,subframe); harq_pid = subframe2harq_pid(frame_parms,proc->frame_rx,subframe);
Qm = get_Qm_ul(ulsch[UE_id]->harq_processes[harq_pid]->mcs); Qm = get_Qm_ul(ulsch[UE_id]->harq_processes[harq_pid]->mcs);
#ifdef DEBUG_ULSCH #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, 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,
...@@ -1885,24 +1886,25 @@ void rx_ulsch(PHY_VARS_eNB *eNB, ...@@ -1885,24 +1886,25 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
} }
void rx_ulsch_emul(PHY_VARS_eNB *eNB, void rx_ulsch_emul(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t sect_id, uint8_t sect_id,
uint8_t UE_index) uint8_t UE_index)
{ {
msg("[PHY] EMUL eNB %d rx_ulsch_emul : subframe %d, sect_id %d, UE_index %d\n",eNB->Mod_id,eNB->proc.subframe_rx,sect_id,UE_index); msg("[PHY] EMUL eNB %d rx_ulsch_emul : subframe %d, sect_id %d, UE_index %d\n",eNB->Mod_id,proc->subframe_rx,sect_id,UE_index);
eNB->pusch_vars[UE_index]->ulsch_power[0] = 31622; //=45dB; eNB->pusch_vars[UE_index]->ulsch_power[0] = 31622; //=45dB;
eNB->pusch_vars[UE_index]->ulsch_power[1] = 31622; //=45dB; eNB->pusch_vars[UE_index]->ulsch_power[1] = 31622; //=45dB;
} }
void dump_ulsch(PHY_VARS_eNB *eNB,uint8_t UE_id) void dump_ulsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id)
{ {
uint32_t nsymb = (eNB->frame_parms.Ncp == 0) ? 14 : 12; uint32_t nsymb = (eNB->frame_parms.Ncp == 0) ? 14 : 12;
uint8_t harq_pid; uint8_t harq_pid;
int subframe = eNB->proc.subframe_rx; int subframe = proc->subframe_rx;
harq_pid = subframe2harq_pid(&eNB->frame_parms,eNB->proc.frame_rx,subframe); harq_pid = subframe2harq_pid(&eNB->frame_parms,proc->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,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, 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,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->mcs,get_Qm_ul(eNB->ulsch[UE_id]->harq_processes[harq_pid]->mcs), eNB->ulsch[UE_id]->harq_processes[harq_pid]->mcs,get_Qm_ul(eNB->ulsch[UE_id]->harq_processes[harq_pid]->mcs),
......
...@@ -183,7 +183,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, ...@@ -183,7 +183,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
float time[FRAME_LENGTH_COMPLEX_SAMPLES]; float time[FRAME_LENGTH_COMPLEX_SAMPLES];
float time2[2048]; float time2[2048];
float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx];
int frame = phy_vars_enb->proc.frame_tx; int frame = phy_vars_enb->proc.proc_rxtx[0].frame_tx;
uint32_t total_dlsch_bitrate = phy_vars_enb->total_dlsch_bitrate; uint32_t total_dlsch_bitrate = phy_vars_enb->total_dlsch_bitrate;
int coded_bits_per_codeword = 0; int coded_bits_per_codeword = 0;
uint8_t harq_pid; // in TDD config 3 it is sf-2, i.e., can be 0,1,2 uint8_t harq_pid; // in TDD config 3 it is sf-2, i.e., can be 0,1,2
......
...@@ -178,6 +178,34 @@ typedef struct ral_threshold_phy_s { ...@@ -178,6 +178,34 @@ typedef struct ral_threshold_phy_s {
} ral_threshold_phy_t; } ral_threshold_phy_t;
#endif #endif
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// 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;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread_rxtx;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr_rxtx;
/// condition variable for tx processing thread
pthread_cond_t cond_rxtx;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} eNB_rxtx_proc_t;
/// Context data structure for eNB subframe processing /// Context data structure for eNB subframe processing
typedef struct { typedef struct {
/// Component Carrier index /// Component Carrier index
...@@ -186,54 +214,37 @@ typedef struct { ...@@ -186,54 +214,37 @@ typedef struct {
int thread_index; int thread_index;
/// timestamp received from HW /// timestamp received from HW
openair0_timestamp timestamp_rx; openair0_timestamp timestamp_rx;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception /// subframe to act upon for reception
int subframe_rx; int subframe_rx;
/// subframe to act upon for PRACH /// subframe to act upon for PRACH
int subframe_prach; int subframe_prach;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for reception /// frame to act upon for reception
int frame_rx; int frame_rx;
/// frame to act upon for PRACH /// frame to act upon for PRACH
int frame_prach; int frame_prach;
/// \brief Instance count for tx processing thread.
/// \internal This variable is protected by \ref mutex_tx.
int instance_cnt_tx;
/// \brief Instance count for rx processing thread. /// \brief Instance count for rx processing thread.
/// \internal This variable is protected by \ref mutex_prach. /// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach; int instance_cnt_prach;
/// pthread structure for tx processing thread
pthread_t pthread_tx;
/// pthread structure for rx processing thread /// pthread structure for rx processing thread
pthread_t pthread_rx; pthread_t pthread_rx;
/// flag to indicate first RX acquisition /// flag to indicate first RX acquisition
int first_rx; int first_rx;
/// pthread attributes for tx processing thread
pthread_attr_t attr_tx;
/// pthread attributes for rx processing thread /// pthread attributes for rx processing thread
pthread_attr_t attr_rx; pthread_attr_t attr_rx;
/// pthread attributes for prach processing thread /// pthread attributes for prach processing thread
pthread_attr_t attr_prach; pthread_attr_t attr_prach;
/// scheduling parameters for tx thread
struct sched_param sched_param_tx;
/// scheduling parameters for rx thread /// scheduling parameters for rx thread
struct sched_param sched_param_rx; struct sched_param sched_param_rx;
/// scheduling parameters for prach thread /// scheduling parameters for prach thread
struct sched_param sched_param_prach; struct sched_param sched_param_prach;
/// condition variable for tx processing thread
pthread_t pthread_prach;
/// condition variable for prach processing thread /// condition variable for prach processing thread
pthread_cond_t cond_tx; pthread_t pthread_prach;
/// condition variable for rx processing thread; /// condition variable for rx processing thread;
pthread_cond_t cond_prach; pthread_cond_t cond_prach;
/// mutex for tx processing thread /// mutex for tx processing thread
pthread_mutex_t mutex_tx;
/// mutex for tx processing thread
pthread_mutex_t mutex_prach; pthread_mutex_t mutex_prach;
/// set of scheduling variables RXn-TXnp4 threads
eNB_rxtx_proc_t proc_rxtx[2];
} eNB_proc_t; } eNB_proc_t;
//! \brief Number of eNB TX and RX threads. //! \brief Number of eNB TX and RX threads.
......
...@@ -226,17 +226,19 @@ void phy_procedures_UE_S_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abst ...@@ -226,17 +226,19 @@ void phy_procedures_UE_S_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abst
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
@param phy_vars_rn pointer to the RN variables @param phy_vars_rn pointer to the RN variables
*/ */
void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn); void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t abstraction_flag,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
/*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes. /*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes.
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param proc Pointer to RXn-TXnp4 proc information
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
*/ */
void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type); void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t abstraction_flag,relaying_type_t r_type);
/*! \brief Scheduling for eNB TX procedures in TDD S-subframes. /*! \brief Scheduling for eNB TX procedures in TDD S-subframes.
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param proc Pointer to RXn-TXnp4 proc information
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
*/ */
...@@ -260,10 +262,11 @@ void phy_procedures_eNB_S_TX(PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag ...@@ -260,10 +262,11 @@ void phy_procedures_eNB_S_TX(PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
*/ */
void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,relaying_type_t r_type); void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t abstraction_flag,relaying_type_t r_type);
/*! \brief Scheduling for eNB PRACH RX procedures /*! \brief Scheduling for eNB PRACH RX procedures
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param proc Pointer to RXn-TXnp4 proc information
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
*/ */
void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag); void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag);
...@@ -393,10 +396,11 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe); ...@@ -393,10 +396,11 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe);
@param UE_id ID of UE which may be issuing the SR @param UE_id ID of UE which may be issuing the SR
@returns 1 if TXOp is active. @returns 1 if TXOp is active.
*/ */
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id); uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id);
/*! \brief Gives the UL subframe corresponding to a PDDCH order in subframe n /*! \brief Gives the UL subframe corresponding to a PDDCH order in subframe n
@param frame_parms Pointer to DL frame parameters @param frame_parms Pointer to DL frame parameters
@param proc Pointer to RXn-TXnp4 proc information
@param n subframe of PDCCH @param n subframe of PDCCH
@returns UL subframe corresponding to pdcch order @returns UL subframe corresponding to pdcch order
*/ */
...@@ -447,7 +451,8 @@ uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue, ...@@ -447,7 +451,8 @@ uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue,
/*! \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in /*! \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in
subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch. For subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch. For
TDD, this routine computes the procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2) TDD, this routine computes the procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2)
@param phy_vars_eNB Pointer to UE variables @param phy_vars_eNB Pointer to eNB variables
@param proc Pointer to RXn-TXnp4 proc information
@param eNB_id Index of eNB @param eNB_id Index of eNB
@param subframe Index of subframe @param subframe Index of subframe
@param b Pointer to PUCCH payload (b[0],b[1]) @param b Pointer to PUCCH payload (b[0],b[1])
...@@ -457,6 +462,7 @@ TDD, this routine computes the procedure described in Section 10.1 of 36.213 (th ...@@ -457,6 +462,7 @@ TDD, this routine computes the procedure described in Section 10.1 of 36.213 (th
@param n1_pucch3 Pointer to n1_pucch3 @param n1_pucch3 Pointer to n1_pucch3
*/ */
void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB, void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id, uint8_t UE_id,
int16_t *n1_pucch0, int16_t *n1_pucch0,
int16_t *n1_pucch1, int16_t *n1_pucch1,
...@@ -467,6 +473,7 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB, ...@@ -467,6 +473,7 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
/*! \brief This function retrieves the harq_pid of the corresponding DLSCH process and updates the error statistics of the DLSCH based on the received ACK info from UE along with the round index. It also performs the fine-grain rate-adaptation based on the error statistics derived from the ACK/NAK process. /*! \brief This function retrieves the harq_pid of the corresponding DLSCH process and updates the error statistics of the DLSCH based on the received ACK info from UE along with the round index. It also performs the fine-grain rate-adaptation based on the error statistics derived from the ACK/NAK process.
@param UE_id Local UE index on which to act @param UE_id Local UE index on which to act
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param proc Pointer to RXn-TXnp4 proc information
@param pusch_flag Indication that feedback came from PUSCH @param pusch_flag Indication that feedback came from PUSCH
@param pucch_payload Resulting payload from pucch @param pucch_payload Resulting payload from pucch
@param pucch_sel Selection of n1_pucch0 or n1_pucch1 (TDD specific) @param pucch_sel Selection of n1_pucch0 or n1_pucch1 (TDD specific)
...@@ -474,6 +481,7 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB, ...@@ -474,6 +481,7 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
*/ */
void process_HARQ_feedback(uint8_t UE_id, void process_HARQ_feedback(uint8_t UE_id,
PHY_VARS_eNB *phy_vars_eNB, PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t pusch_flag, uint8_t pusch_flag,
uint8_t *pucch_payload, uint8_t *pucch_payload,
uint8_t pucch_sel, uint8_t pucch_sel,
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "SCHED/phy_procedures_emos.h" #include "SCHED/phy_procedures_emos.h"
#endif #endif
void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{ {
...@@ -57,7 +57,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -57,7 +57,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
uint32_t rballoc = 0x7FFF; uint32_t rballoc = 0x7FFF;
//uint32_t rballoc2 = 0x000F; //uint32_t rballoc2 = 0x000F;
int subframe = eNB->proc.subframe_tx; int subframe = proc->subframe_tx;
LTE_eNB_DLSCH_t *DLSCH_ptr = eNB->dlsch[0][0]; LTE_eNB_DLSCH_t *DLSCH_ptr = eNB->dlsch[0][0];
...@@ -89,7 +89,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -89,7 +89,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->type = 1; ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->type = 1;
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->rv = 1; ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->rv = 1;
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->mcs = 1; ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->mcs = 1;
((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_1_5MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
...@@ -100,7 +100,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -100,7 +100,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->type = 1; ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1; ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1; ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_1_5MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0;
...@@ -117,7 +117,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -117,7 +117,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->type = 1; ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->type = 1;
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->rv = 1; ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->rv = 1;
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->mcs = 1; ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->mcs = 1;
((DCI1A_5MHz_FDD_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_5MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
...@@ -128,7 +128,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -128,7 +128,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->type = 1; ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1; ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1; ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_5MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0;
...@@ -144,7 +144,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -144,7 +144,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->type = 1; ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->type = 1;
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->rv = 1; ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->rv = 1;
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->mcs = 1; ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->mcs = 1;
((DCI1A_10MHz_FDD_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_10MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
...@@ -155,7 +155,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -155,7 +155,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->type = 1; ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1; ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1; ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1A_10MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
...@@ -171,7 +171,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -171,7 +171,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->type = 1; ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->type = 1;
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->rv = 1; ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->rv = 1;
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->mcs = 1; ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->mcs = 1;
((DCI1A_20MHz_FDD_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_20MHz_FDD_t*)&bcch_pdu)->harq_pid = 0;
...@@ -182,7 +182,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -182,7 +182,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->type = 1; ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->type = 1;
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0; ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->vrb_type = 0;
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3); ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->rballoc = computeRIV(25,10,3);
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->ndi = proc->frame_tx&1;
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1; ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->rv = 1;
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1; ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->mcs = 1;
((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0; ((DCI1A_20MHz_TDD_1_6_t*)&bcch_pdu)->harq_pid = 0;
...@@ -236,7 +236,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -236,7 +236,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs;
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); //((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28);
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = proc->frame_tx&1;
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t));
...@@ -267,7 +267,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -267,7 +267,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1_5MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; ((DCI1_5MHz_TDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs;
//((DCI1_5MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); //((DCI1_5MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28);
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1_5MHz_TDD_t *)&dlsch_pdu)->ndi = proc->frame_tx&1;
((DCI1_5MHz_TDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_5MHz_TDD_t *)&dlsch_pdu)->rv = 0;
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t));
...@@ -303,7 +303,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -303,7 +303,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs;
//((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); //((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28);
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = proc->frame_tx&1;
((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0;
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_TDD_t));
...@@ -334,7 +334,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -334,7 +334,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1_10MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; ((DCI1_10MHz_TDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs;
//((DCI1_10MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); //((DCI1_10MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28);
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1_10MHz_TDD_t *)&dlsch_pdu)->ndi = proc->frame_tx&1;
((DCI1_10MHz_TDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_10MHz_TDD_t *)&dlsch_pdu)->rv = 0;
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_TDD_t));
...@@ -369,7 +369,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -369,7 +369,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs;
//((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); //((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28);
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = proc->frame_tx&1;
((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0;
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_TDD_t));
...@@ -400,7 +400,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -400,7 +400,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI1_20MHz_TDD_t *)&dlsch_pdu)->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; ((DCI1_20MHz_TDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs;
//((DCI1_20MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); //((DCI1_20MHz_TDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28);
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->ndi = eNB->proc.frame_tx&1; ((DCI1_20MHz_TDD_t *)&dlsch_pdu)->ndi = proc->frame_tx&1;
((DCI1_20MHz_TDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_20MHz_TDD_t *)&dlsch_pdu)->rv = 0;
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_20MHz_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_20MHz_TDD_t));
...@@ -437,10 +437,10 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -437,10 +437,10 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->tpmi = 0; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->tpmi = 0;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rv1 = 0; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rv1 = 0;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->ndi1 = eNB->proc.frame_tx&1; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->ndi1 = proc->frame_tx&1;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->mcs1 = eNB->target_ue_dl_mcs; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->mcs1 = eNB->target_ue_dl_mcs;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rv2 = 0; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->rv2 = 0;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->ndi2 = eNB->proc.frame_tx&1; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->ndi2 = proc->frame_tx&1;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->mcs2 = eNB->target_ue_dl_mcs; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->mcs2 = eNB->target_ue_dl_mcs;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->tb_swap = 0; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->tb_swap = 0;
((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; ((DCI2_5MHz_2A_FDD_t*) (&DCI_pdu->dci_alloc[0].dci_pdu))->harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
...@@ -459,7 +459,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -459,7 +459,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
DLSCH_alloc_pdu1E.tpmi = 5; //5=use feedback DLSCH_alloc_pdu1E.tpmi = 5; //5=use feedback
DLSCH_alloc_pdu1E.rv = 0; DLSCH_alloc_pdu1E.rv = 0;
DLSCH_alloc_pdu1E.ndi = eNB->proc.frame_tx&1; DLSCH_alloc_pdu1E.ndi = proc->frame_tx&1;
//DLSCH_alloc_pdu1E.mcs = cqi_to_mcs[eNB->eNB_UE_stats->DL_cqi[0]]; //DLSCH_alloc_pdu1E.mcs = cqi_to_mcs[eNB->eNB_UE_stats->DL_cqi[0]];
//DLSCH_alloc_pdu1E.mcs = (unsigned char) (taus()%28); //DLSCH_alloc_pdu1E.mcs = (unsigned char) (taus()%28);
DLSCH_alloc_pdu1E.mcs = eNB->target_ue_dl_mcs; DLSCH_alloc_pdu1E.mcs = eNB->target_ue_dl_mcs;
...@@ -482,7 +482,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -482,7 +482,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
//DLSCH_alloc_pdu1E.mcs = eNB->target_ue_dl_mcs; //DLSCH_alloc_pdu1E.mcs = eNB->target_ue_dl_mcs;
//DLSCH_alloc_pdu1E.mcs = (unsigned char) (taus()%28); //DLSCH_alloc_pdu1E.mcs = (unsigned char) (taus()%28);
//DLSCH_alloc_pdu1E.mcs = (unsigned char) ((eNB->frame%1024)%28); //DLSCH_alloc_pdu1E.mcs = (unsigned char) ((eNB->frame%1024)%28);
DLSCH_alloc_pdu1E.mcs = (unsigned char) (((eNB->proc.frame_tx%1024)/3)%28); DLSCH_alloc_pdu1E.mcs = (unsigned char) (((proc->frame_tx%1024)/3)%28);
eNB->UE_stats[1].dlsch_mcs1 = DLSCH_alloc_pdu1E.mcs; eNB->UE_stats[1].dlsch_mcs1 = DLSCH_alloc_pdu1E.mcs;
memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t)); memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
...@@ -533,7 +533,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -533,7 +533,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
UL_alloc_pdu.hopping = 0; UL_alloc_pdu.hopping = 0;
UL_alloc_pdu.rballoc = computeRIV(25,2,eNB->ue_ul_nb_rb); UL_alloc_pdu.rballoc = computeRIV(25,2,eNB->ue_ul_nb_rb);
UL_alloc_pdu.mcs = eNB->target_ue_ul_mcs; UL_alloc_pdu.mcs = eNB->target_ue_ul_mcs;
UL_alloc_pdu.ndi = eNB->proc.frame_tx&1; UL_alloc_pdu.ndi = proc->frame_tx&1;
UL_alloc_pdu.TPC = 0; UL_alloc_pdu.TPC = 0;
UL_alloc_pdu.cshift = 0; UL_alloc_pdu.cshift = 0;
UL_alloc_pdu.dai = 0; UL_alloc_pdu.dai = 0;
...@@ -555,7 +555,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB) ...@@ -555,7 +555,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB)
else else
UL_alloc_pdu.rballoc = computeRIV(25,0,eNB->ue_ul_nb_rb); UL_alloc_pdu.rballoc = computeRIV(25,0,eNB->ue_ul_nb_rb);
UL_alloc_pdu.mcs = eNB->target_ue_ul_mcs; UL_alloc_pdu.mcs = eNB->target_ue_ul_mcs;
UL_alloc_pdu.ndi = eNB->proc.frame_tx&1; UL_alloc_pdu.ndi = proc->frame_tx&1;
UL_alloc_pdu.TPC = 0; UL_alloc_pdu.TPC = 0;
if ((cooperation_flag==0) || (cooperation_flag==1)) if ((cooperation_flag==0) || (cooperation_flag==1))
UL_alloc_pdu.cshift = 0; UL_alloc_pdu.cshift = 0;
......
...@@ -101,10 +101,9 @@ extern uint8_t smbv_frame_cnt; ...@@ -101,10 +101,9 @@ extern uint8_t smbv_frame_cnt;
extern int rx_sig_fifo; extern int rx_sig_fifo;
#endif #endif
uint8_t is_SR_subframe(PHY_VARS_eNB *eNB,uint8_t UE_id) uint8_t is_SR_subframe(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id)
{ {
eNB_proc_t *proc = &eNB->proc;
const int subframe = proc->subframe_rx; const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx; const int frame = proc->frame_rx;
...@@ -339,10 +338,9 @@ void phy_procedures_emos_eNB_TX(unsigned char subframe, PHY_VARS_eNB *eNB) ...@@ -339,10 +338,9 @@ void phy_procedures_emos_eNB_TX(unsigned char subframe, PHY_VARS_eNB *eNB)
void phy_procedures_eNB_S_RX(PHY_VARS_eNB *eNB,uint8_t abstraction_flag,relaying_type_t r_type) void phy_procedures_eNB_S_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t abstraction_flag,relaying_type_t r_type)
{ {
UNUSED(r_type); UNUSED(r_type);
eNB_proc_t *proc = &eNB->proc;
int subframe = proc->subframe_rx; int subframe = proc->subframe_rx;
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
...@@ -435,14 +433,13 @@ int QPSK2[4]= {AMP_OVER_2|(AMP_OVER_2<<16),AMP_OVER_2|((65536-AMP_OVER_2)<<16),( ...@@ -435,14 +433,13 @@ int QPSK2[4]= {AMP_OVER_2|(AMP_OVER_2<<16),AMP_OVER_2|((65536-AMP_OVER_2)<<16),(
unsigned int taus(void); unsigned int taus(void);
void pmch_procedures(PHY_VARS_eNB *eNB,PHY_VARS_RN *rn, int abstraction_flag,relaying_type_t r_type) { void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn, int abstraction_flag,relaying_type_t r_type) {
#ifdef Rel10 #ifdef Rel10
MCH_PDU *mch_pduP; MCH_PDU *mch_pduP;
MCH_PDU mch_pdu; MCH_PDU mch_pdu;
// uint8_t sync_area=255; // uint8_t sync_area=255;
#endif #endif
eNB_proc_t *proc = &eNB->proc;
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
if (abstraction_flag==0) { if (abstraction_flag==0) {
...@@ -508,7 +505,7 @@ void pmch_procedures(PHY_VARS_eNB *eNB,PHY_VARS_RN *rn, int abstraction_flag,rel ...@@ -508,7 +505,7 @@ void pmch_procedures(PHY_VARS_eNB *eNB,PHY_VARS_RN *rn, int abstraction_flag,rel
if (mch_pduP) { if (mch_pduP) {
fill_eNB_dlsch_MCH(eNB,mch_pduP->mcs,1,0, abstraction_flag); fill_eNB_dlsch_MCH(eNB,mch_pduP->mcs,1,0, abstraction_flag);
// Generate PMCH // Generate PMCH
generate_mch(eNB,(uint8_t*)mch_pduP->payload,abstraction_flag); generate_mch(eNB,proc,(uint8_t*)mch_pduP->payload,abstraction_flag);
} else { } else {
LOG_D(PHY,"[eNB/RN] Frame %d subframe %d: MCH not generated \n",proc->frame_tx,subframe); LOG_D(PHY,"[eNB/RN] Frame %d subframe %d: MCH not generated \n",proc->frame_tx,subframe);
} }
...@@ -516,12 +513,11 @@ void pmch_procedures(PHY_VARS_eNB *eNB,PHY_VARS_RN *rn, int abstraction_flag,rel ...@@ -516,12 +513,11 @@ void pmch_procedures(PHY_VARS_eNB *eNB,PHY_VARS_RN *rn, int abstraction_flag,rel
#endif #endif
} }
void common_signal_procedures (PHY_VARS_eNB *eNB,int abstraction_flag) { void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int abstraction_flag) {
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
int **txdataF = eNB->common_vars.txdataF[0]; int **txdataF = eNB->common_vars.txdataF[0];
uint8_t *pbch_pdu=&eNB->pbch_pdu[0]; uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
eNB_proc_t *proc = &eNB->proc;
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
int frame = proc->frame_tx; int frame = proc->frame_tx;
...@@ -703,10 +699,9 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int abstraction_flag) { ...@@ -703,10 +699,9 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int abstraction_flag) {
} }
void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const int UE_id) { void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,const int UE_id) {
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
eNB_proc_t *proc = &eNB->proc;
int frame = proc->frame_tx; int frame = proc->frame_tx;
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
...@@ -839,11 +834,10 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const in ...@@ -839,11 +834,10 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const in
} }
void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const int UE_id) { void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,const int UE_id) {
int harq_pid; int harq_pid;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
eNB_proc_t *proc = &eNB->proc;
int frame = proc->frame_tx; int frame = proc->frame_tx;
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
...@@ -862,6 +856,7 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const in ...@@ -862,6 +856,7 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const in
1<<dci_alloc->L); 1<<dci_alloc->L);
generate_eNB_ulsch_params_from_dci(eNB, generate_eNB_ulsch_params_from_dci(eNB,
proc,
&dci_alloc->dci_pdu[0], &dci_alloc->dci_pdu[0],
dci_alloc->rnti, dci_alloc->rnti,
format0, format0,
...@@ -904,9 +899,8 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const in ...@@ -904,9 +899,8 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,DCI_ALLOC_t *dci_alloc,const in
} }
void pdsch_procedures(PHY_VARS_eNB *eNB,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch1,LTE_eNB_UE_stats *ue_stats,int ra_flag,int num_pdcch_symbols,int abstraction_flag) { void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch1,LTE_eNB_UE_stats *ue_stats,int ra_flag,int num_pdcch_symbols,int abstraction_flag) {
eNB_proc_t *proc = &eNB->proc;
int frame=proc->frame_tx; int frame=proc->frame_tx;
int subframe=proc->subframe_tx; int subframe=proc->subframe_tx;
int harq_pid = dlsch->current_harq_pid; int harq_pid = dlsch->current_harq_pid;
...@@ -1112,12 +1106,12 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t ...@@ -1112,12 +1106,12 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t
} }
void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t abstraction_flag, uint8_t abstraction_flag,
relaying_type_t r_type, relaying_type_t r_type,
PHY_VARS_RN *rn) PHY_VARS_RN *rn)
{ {
UNUSED(rn); UNUSED(rn);
eNB_proc_t *proc = &eNB->proc;
int frame=proc->frame_tx; int frame=proc->frame_tx;
int subframe=proc->subframe_tx; int subframe=proc->subframe_tx;
// uint16_t input_buffer_length; // uint16_t input_buffer_length;
...@@ -1177,11 +1171,11 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1177,11 +1171,11 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
} }
if (is_pmch_subframe(frame,subframe,fp)) { if (is_pmch_subframe(frame,subframe,fp)) {
pmch_procedures(eNB,rn,abstraction_flag,r_type); pmch_procedures(eNB,proc,rn,abstraction_flag,r_type);
} }
else { else {
// this is not a pmch subframe, so generate PSS/SSS/PBCH // this is not a pmch subframe, so generate PSS/SSS/PBCH
common_signal_procedures(eNB,abstraction_flag); common_signal_procedures(eNB,proc,abstraction_flag);
} }
#if defined(SMBV) #if defined(SMBV)
...@@ -1207,7 +1201,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1207,7 +1201,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
#ifdef EMOS_CHANNEL #ifdef EMOS_CHANNEL
fill_dci_emos(DCI_pdu,eNB); fill_dci_emos(DCI_pdu,eNB);
#else #else
fill_dci(DCI_pdu,eNB); fill_dci(DCI_pdu,eNB,proc);
#endif #endif
} }
...@@ -1265,7 +1259,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1265,7 +1259,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
} }
else UE_id=0; else UE_id=0;
generate_eNB_dlsch_params(eNB,dci_alloc,UE_id); generate_eNB_dlsch_params(eNB,proc,dci_alloc,UE_id);
} }
...@@ -1287,7 +1281,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1287,7 +1281,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
LOG_E(PHY,"[eNB %"PRIu8"] Frame %d: Unknown UE_id for rnti %"PRIx16"\n",eNB->Mod_id,frame,dci_alloc->rnti); LOG_E(PHY,"[eNB %"PRIu8"] Frame %d: Unknown UE_id for rnti %"PRIx16"\n",eNB->Mod_id,frame,dci_alloc->rnti);
mac_xface->macphy_exit("FATAL\n"); mac_xface->macphy_exit("FATAL\n");
} }
generate_eNB_ulsch_params(eNB,dci_alloc,UE_id); generate_eNB_ulsch_params(eNB,proc,dci_alloc,UE_id);
} }
} }
...@@ -1335,7 +1329,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1335,7 +1329,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if (eNB->dlsch_SI->active == 1) { if (eNB->dlsch_SI->active == 1) {
pdsch_procedures(eNB,eNB->dlsch_SI,(LTE_eNB_DLSCH_t*)NULL,(LTE_eNB_UE_stats*)NULL,0,num_pdcch_symbols,abstraction_flag); pdsch_procedures(eNB,proc,eNB->dlsch_SI,(LTE_eNB_DLSCH_t*)NULL,(LTE_eNB_UE_stats*)NULL,0,num_pdcch_symbols,abstraction_flag);
#if defined(SMBV) #if defined(SMBV)
...@@ -1368,7 +1362,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1368,7 +1362,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB->ulsch[(uint32_t)UE_id]->Msg3_frame, eNB->ulsch[(uint32_t)UE_id]->Msg3_frame,
eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe); eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe);
pdsch_procedures(eNB,eNB->dlsch_ra,(LTE_eNB_DLSCH_t*)NULL,(LTE_eNB_UE_stats*)NULL,1,num_pdcch_symbols,abstraction_flag); pdsch_procedures(eNB,proc,eNB->dlsch_ra,(LTE_eNB_DLSCH_t*)NULL,(LTE_eNB_UE_stats*)NULL,1,num_pdcch_symbols,abstraction_flag);
eNB->dlsch_ra->active = 0; eNB->dlsch_ra->active = 0;
...@@ -1381,7 +1375,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1381,7 +1375,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
(eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&& (eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&&
(eNB->dlsch[(uint8_t)UE_id][0]->active == 1)) { (eNB->dlsch[(uint8_t)UE_id][0]->active == 1)) {
pdsch_procedures(eNB,eNB->dlsch[(uint8_t)UE_id][0],eNB->dlsch[(uint8_t)UE_id][1],&eNB->UE_stats[(uint32_t)UE_id],0,num_pdcch_symbols,abstraction_flag); pdsch_procedures(eNB,proc,eNB->dlsch[(uint8_t)UE_id][0],eNB->dlsch[(uint8_t)UE_id][1],&eNB->UE_stats[(uint32_t)UE_id],0,num_pdcch_symbols,abstraction_flag);
} }
...@@ -1402,6 +1396,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1402,6 +1396,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if (is_phich_subframe(fp,subframe)) if (is_phich_subframe(fp,subframe))
{ {
generate_phich_top(eNB, generate_phich_top(eNB,
proc,
AMP, AMP,
0, 0,
abstraction_flag); abstraction_flag);
...@@ -1437,10 +1432,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1437,10 +1432,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
} }
void process_Msg3(PHY_VARS_eNB *eNB,uint8_t UE_id, uint8_t harq_pid) void process_Msg3(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id, uint8_t harq_pid)
{ {
// this prepares the demodulation of the first PUSCH of a new user, containing Msg3 // this prepares the demodulation of the first PUSCH of a new user, containing Msg3
eNB_proc_t *proc = &eNB->proc;
int subframe = proc->subframe_rx; int subframe = proc->subframe_rx;
int frame = proc->frame_rx; int frame = proc->frame_rx;
...@@ -1475,13 +1469,13 @@ void process_Msg3(PHY_VARS_eNB *eNB,uint8_t UE_id, uint8_t harq_pid) ...@@ -1475,13 +1469,13 @@ void process_Msg3(PHY_VARS_eNB *eNB,uint8_t UE_id, uint8_t harq_pid)
void process_HARQ_feedback(uint8_t UE_id, void process_HARQ_feedback(uint8_t UE_id,
PHY_VARS_eNB *eNB, PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t pusch_flag, uint8_t pusch_flag,
uint8_t *pucch_payload, uint8_t *pucch_payload,
uint8_t pucch_sel, uint8_t pucch_sel,
uint8_t SR_payload) uint8_t SR_payload)
{ {
eNB_proc_t *proc = &eNB->proc;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
uint8_t dl_harq_pid[8],dlsch_ACK[8],dl_subframe; uint8_t dl_harq_pid[8],dlsch_ACK[8],dl_subframe;
LTE_eNB_DLSCH_t *dlsch = eNB->dlsch[(uint32_t)UE_id][0]; LTE_eNB_DLSCH_t *dlsch = eNB->dlsch[(uint32_t)UE_id][0];
...@@ -1745,6 +1739,7 @@ void process_HARQ_feedback(uint8_t UE_id, ...@@ -1745,6 +1739,7 @@ void process_HARQ_feedback(uint8_t UE_id,
} }
void get_n1_pucch_eNB(PHY_VARS_eNB *eNB, void get_n1_pucch_eNB(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id, uint8_t UE_id,
int16_t *n1_pucch0, int16_t *n1_pucch0,
int16_t *n1_pucch1, int16_t *n1_pucch1,
...@@ -1752,7 +1747,6 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *eNB, ...@@ -1752,7 +1747,6 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *eNB,
int16_t *n1_pucch3) int16_t *n1_pucch3)
{ {
eNB_proc_t *proc = &eNB->proc;
LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms;
uint8_t nCCE0,nCCE1; uint8_t nCCE0,nCCE1;
int sf; int sf;
...@@ -1892,9 +1886,8 @@ void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag) ...@@ -1892,9 +1886,8 @@ void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag)
uint16_t preamble_max,preamble_energy_max; uint16_t preamble_max,preamble_energy_max;
uint16_t i; uint16_t i;
int8_t UE_id; int8_t UE_id;
eNB_proc_t *proc = &eNB->proc; int subframe = eNB->proc.subframe_prach;
int subframe = proc->subframe_rx; int frame = eNB->proc.frame_prach;
int frame = proc->frame_rx;
uint8_t CC_id = eNB->CC_id; uint8_t CC_id = eNB->CC_id;
memset(&preamble_energy_list[0],0,64*sizeof(uint16_t)); memset(&preamble_energy_list[0],0,64*sizeof(uint16_t));
...@@ -2002,7 +1995,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag) ...@@ -2002,7 +1995,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag)
} }
} }
void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstraction_flag) { void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_pid,const uint8_t abstraction_flag) {
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
uint8_t SR_payload = 0,*pucch_payload=NULL,pucch_payload0[2]= {0,0},pucch_payload1[2]= {0,0}; uint8_t SR_payload = 0,*pucch_payload=NULL,pucch_payload0[2]= {0,0},pucch_payload1[2]= {0,0};
...@@ -2012,7 +2005,6 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs ...@@ -2012,7 +2005,6 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs
int32_t metric0=0,metric1=0,metric0_SR=0; int32_t metric0=0,metric1=0,metric0_SR=0;
ANFBmode_t bundling_flag; ANFBmode_t bundling_flag;
PUCCH_FMT_t format; PUCCH_FMT_t format;
eNB_proc_t *proc = &eNB->proc;
const int subframe = proc->subframe_rx; const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx; const int frame = proc->frame_rx;
...@@ -2021,159 +2013,160 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs ...@@ -2021,159 +2013,160 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs
(eNB->ulsch[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag==0)) { (eNB->ulsch[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag==0)) {
// check SR availability // check SR availability
do_SR = is_SR_subframe(eNB,UE_id); do_SR = is_SR_subframe(eNB,proc,UE_id);
// do_SR = 0; // do_SR = 0;
// Now ACK/NAK // Now ACK/NAK
// First check subframe_tx flag for earlier subframes // First check subframe_tx flag for earlier subframes
get_n1_pucch_eNB(eNB, get_n1_pucch_eNB(eNB,
UE_id, proc,
&n1_pucch0, UE_id,
&n1_pucch1, &n1_pucch0,
&n1_pucch2, &n1_pucch1,
&n1_pucch3); &n1_pucch2,
&n1_pucch3);
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d, subframe %d Checking for PUCCH (%d,%d,%d,%d) SR %d\n",
eNB->Mod_id,eNB->dlsch[UE_id][0]->rnti, LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d, subframe %d Checking for PUCCH (%d,%d,%d,%d) SR %d\n",
frame,subframe, eNB->Mod_id,eNB->dlsch[UE_id][0]->rnti,
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,do_SR); frame,subframe,
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,do_SR);
if ((n1_pucch0==-1) && (n1_pucch1==-1) && (do_SR==0)) { // no TX PDSCH that have to be checked and no SR for this UE_id
} else { if ((n1_pucch0==-1) && (n1_pucch1==-1) && (do_SR==0)) { // no TX PDSCH that have to be checked and no SR for this UE_id
// otherwise we have some PUCCH detection to do } else {
// otherwise we have some PUCCH detection to do
// Null out PUCCH PRBs for noise measurement
switch(fp->N_RB_UL) { // Null out PUCCH PRBs for noise measurement
case 6: switch(fp->N_RB_UL) {
eNB->rb_mask_ul[0] |= (0x1 | (1<<5)); //position 5 case 6:
break; eNB->rb_mask_ul[0] |= (0x1 | (1<<5)); //position 5
case 15: break;
eNB->rb_mask_ul[0] |= (0x1 | (1<<14)); // position 14 case 15:
break; eNB->rb_mask_ul[0] |= (0x1 | (1<<14)); // position 14
case 25: break;
eNB->rb_mask_ul[0] |= (0x1 | (1<<24)); // position 24 case 25:
break; eNB->rb_mask_ul[0] |= (0x1 | (1<<24)); // position 24
case 50: break;
eNB->rb_mask_ul[0] |= 0x1; case 50:
eNB->rb_mask_ul[1] |= (1<<17); // position 49 (49-32) eNB->rb_mask_ul[0] |= 0x1;
break; eNB->rb_mask_ul[1] |= (1<<17); // position 49 (49-32)
case 75: break;
eNB->rb_mask_ul[0] |= 0x1; case 75:
eNB->rb_mask_ul[2] |= (1<<10); // position 74 (74-64) eNB->rb_mask_ul[0] |= 0x1;
break; eNB->rb_mask_ul[2] |= (1<<10); // position 74 (74-64)
case 100: break;
eNB->rb_mask_ul[0] |= 0x1; case 100:
eNB->rb_mask_ul[3] |= (1<<3); // position 99 (99-96) eNB->rb_mask_ul[0] |= 0x1;
break; eNB->rb_mask_ul[3] |= (1<<3); // position 99 (99-96)
default: break;
LOG_E(PHY,"Unknown number for N_RB_UL %d\n",fp->N_RB_UL); default:
break; LOG_E(PHY,"Unknown number for N_RB_UL %d\n",fp->N_RB_UL);
} break;
}
if (do_SR == 1) {
eNB->UE_stats[UE_id].sr_total++; if (do_SR == 1) {
eNB->UE_stats[UE_id].sr_total++;
if (abstraction_flag == 0)
metric0_SR = rx_pucch(eNB,
pucch_format1,
UE_id,
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,
0, // n2_pucch
0, // shortened format, should be use_srs flag, later
&SR_payload,
subframe,
PUCCH1_THRES);
if (abstraction_flag == 0)
metric0_SR = rx_pucch(eNB,
pucch_format1,
UE_id,
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,
0, // n2_pucch
0, // shortened format, should be use_srs flag, later
&SR_payload,
subframe,
PUCCH1_THRES);
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
else { else {
metric0_SR = rx_pucch_emul(eNB, metric0_SR = rx_pucch_emul(eNB,
UE_id, UE_id,
pucch_format1, pucch_format1,
0, 0,
&SR_payload); &SR_payload);
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR (UE SR %d/%d)\n",eNB->Mod_id, LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR (UE SR %d/%d)\n",eNB->Mod_id,
eNB->ulsch[UE_id]->rnti,frame,subframe,SR_payload,eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex); eNB->ulsch[UE_id]->rnti,frame,subframe,SR_payload,eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex);
} }
#endif #endif
if (SR_payload == 1) { if (SR_payload == 1) {
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Got SR for PUSCH, transmitting to MAC\n",eNB->Mod_id, LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Got SR for PUSCH, transmitting to MAC\n",eNB->Mod_id,
eNB->ulsch[UE_id]->rnti,frame,subframe); eNB->ulsch[UE_id]->rnti,frame,subframe);
eNB->UE_stats[UE_id].sr_received++; eNB->UE_stats[UE_id].sr_received++;
if (eNB->first_sr[UE_id] == 1) { // this is the first request for uplink after Connection Setup, so clear HARQ process 0 use for Msg4 if (eNB->first_sr[UE_id] == 1) { // this is the first request for uplink after Connection Setup, so clear HARQ process 0 use for Msg4
/* is this test necessary? */ /* is this test necessary? */
if (eNB->dlsch[UE_id][0]->harq_processes[0]->status != SCH_IDLE) if (eNB->dlsch[UE_id][0]->harq_processes[0]->status != SCH_IDLE)
put_harq_pid_in_freelist(eNB->dlsch[UE_id][0], 0); put_harq_pid_in_freelist(eNB->dlsch[UE_id][0], 0);
eNB->first_sr[UE_id] = 0; eNB->first_sr[UE_id] = 0;
eNB->dlsch[UE_id][0]->harq_processes[0]->round=0; eNB->dlsch[UE_id][0]->harq_processes[0]->round=0;
eNB->dlsch[UE_id][0]->harq_processes[0]->status=SCH_IDLE; eNB->dlsch[UE_id][0]->harq_processes[0]->status=SCH_IDLE;
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d First SR\n", LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d First SR\n",
eNB->Mod_id, eNB->Mod_id,
eNB->ulsch[UE_id]->rnti,frame,subframe); eNB->ulsch[UE_id]->rnti,frame,subframe);
} }
if (eNB->mac_enabled==1) { if (eNB->mac_enabled==1) {
mac_xface->SR_indication(eNB->Mod_id, mac_xface->SR_indication(eNB->Mod_id,
eNB->CC_id, eNB->CC_id,
frame, frame,
eNB->dlsch[UE_id][0]->rnti,subframe); eNB->dlsch[UE_id][0]->rnti,subframe);
}
}
}// do_SR==1
if ((n1_pucch0==-1) && (n1_pucch1==-1)) { // just check for SR
} else if (fp->frame_type==FDD) { // FDD
// if SR was detected, use the n1_pucch from SR, else use n1_pucch0
// n1_pucch0 = (SR_payload==1) ? eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex:n1_pucch0;
LOG_D(PHY,"Demodulating PUCCH for ACK/NAK: n1_pucch0 %d (%d), SR_payload %d\n",n1_pucch0,eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,SR_payload);
if (abstraction_flag == 0) {
metric0 = rx_pucch(eNB,
pucch_format1a,
UE_id,
(uint16_t)n1_pucch0,
0, //n2_pucch
0, // shortened format
pucch_payload0,
subframe,
PUCCH1a_THRES);
if (metric0 < metric0_SR)
metric0=rx_pucch(eNB,
pucch_format1a,
UE_id,
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,
0, //n2_pucch
0, // shortened format
pucch_payload0,
subframe,
PUCCH1a_THRES);
} }
else { }
}// do_SR==1
if ((n1_pucch0==-1) && (n1_pucch1==-1)) { // just check for SR
} else if (fp->frame_type==FDD) { // FDD
// if SR was detected, use the n1_pucch from SR, else use n1_pucch0
// n1_pucch0 = (SR_payload==1) ? eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex:n1_pucch0;
LOG_D(PHY,"Demodulating PUCCH for ACK/NAK: n1_pucch0 %d (%d), SR_payload %d\n",n1_pucch0,eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,SR_payload);
if (abstraction_flag == 0) {
metric0 = rx_pucch(eNB,
pucch_format1a,
UE_id,
(uint16_t)n1_pucch0,
0, //n2_pucch
0, // shortened format
pucch_payload0,
subframe,
PUCCH1a_THRES);
if (metric0 < metric0_SR)
metric0=rx_pucch(eNB,
pucch_format1a,
UE_id,
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,
0, //n2_pucch
0, // shortened format
pucch_payload0,
subframe,
PUCCH1a_THRES);
}
else {
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
metric0 = rx_pucch_emul(eNB,UE_id, metric0 = rx_pucch_emul(eNB,UE_id,
pucch_format1a, pucch_format1a,
0, 0,
pucch_payload0, pucch_payload0,
subframe); subframe);
#endif #endif
} }
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d pucch1a (FDD) payload %d (metric %d)\n", LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d pucch1a (FDD) payload %d (metric %d)\n",
eNB->Mod_id, eNB->Mod_id,
eNB->dlsch[UE_id][0]->rnti, eNB->dlsch[UE_id][0]->rnti,
frame,subframe, frame,subframe,
pucch_payload0[0],metric0); pucch_payload0[0],metric0);
#endif #endif
process_HARQ_feedback(UE_id,eNB, process_HARQ_feedback(UE_id,eNB,proc,
0,// pusch_flag 0,// pusch_flag
pucch_payload0, pucch_payload0,
2, 2,
...@@ -2304,7 +2297,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs ...@@ -2304,7 +2297,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs
frame,subframe, frame,subframe,
metric0,metric1,pucch_sel,pucch_payload[0],pucch_payload[1]); metric0,metric1,pucch_sel,pucch_payload[0],pucch_payload[1]);
#endif #endif
process_HARQ_feedback(UE_id,eNB, process_HARQ_feedback(UE_id,eNB,proc,
0,// pusch_flag 0,// pusch_flag
pucch_payload, pucch_payload,
pucch_sel, pucch_sel,
...@@ -2315,9 +2308,8 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs ...@@ -2315,9 +2308,8 @@ void pucch_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abs
} }
} }
void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstraction_flag) { void cba_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_pid,const uint8_t abstraction_flag) {
eNB_proc_t *proc = &eNB->proc;
uint8_t access_mode; uint8_t access_mode;
int num_active_cba_groups; int num_active_cba_groups;
const int subframe = proc->subframe_rx; const int subframe = proc->subframe_rx;
...@@ -2342,7 +2334,7 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr ...@@ -2342,7 +2334,7 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr
#endif #endif
if (abstraction_flag==0) { if (abstraction_flag==0) {
rx_ulsch(eNB, rx_ulsch(eNB,proc,
eNB->UE_stats[UE_id].sector, // this is the effective sector id eNB->UE_stats[UE_id].sector, // this is the effective sector id
UE_id, UE_id,
eNB->ulsch, eNB->ulsch,
...@@ -2351,7 +2343,7 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr ...@@ -2351,7 +2343,7 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
else { else {
rx_ulsch_emul(eNB, rx_ulsch_emul(eNB,proc,
subframe, subframe,
eNB->UE_stats[UE_id].sector, // this is the effective sector id eNB->UE_stats[UE_id].sector, // this is the effective sector id
UE_id); UE_id);
...@@ -2360,7 +2352,7 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr ...@@ -2360,7 +2352,7 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr
#endif #endif
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
ret = ulsch_decoding(eNB, ret = ulsch_decoding(eNB,proc,
UE_id, UE_id,
0, // control_only_flag 0, // control_only_flag
eNB->ulsch[UE_id]->harq_processes[harq_pid]->V_UL_DAI, eNB->ulsch[UE_id]->harq_processes[harq_pid]->V_UL_DAI,
...@@ -2479,11 +2471,11 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr ...@@ -2479,11 +2471,11 @@ void cba_procedures(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,const uint8_t abstr
void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_flag) { void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_flag) {
eNB_proc_t *proc = &eNB->proc;
int i,l; int i,l;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
void *rxp[fp->nb_antennas_rx]; void *rxp[fp->nb_antennas_rx];
unsigned int rxs; unsigned int rxs;
eNB_proc_t *proc = &eNB->proc;
int subframe = proc->subframe_rx; int subframe = proc->subframe_rx;
int frame = proc->frame_rx; int frame = proc->frame_rx;
...@@ -2617,11 +2609,10 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2617,11 +2609,10 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
} }
} }
void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_flag,const relaying_type_t r_type) void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const uint8_t abstraction_flag,const relaying_type_t r_type)
{ {
//RX processing for ue-specific resources (i //RX processing for ue-specific resources (i
UNUSED(r_type); UNUSED(r_type);
eNB_proc_t *proc = &eNB->proc;
uint32_t l, ret=0,i,j,k; uint32_t l, ret=0,i,j,k;
uint32_t harq_pid, harq_idx, round; uint32_t harq_pid, harq_idx, round;
uint8_t nPRS; uint8_t nPRS;
...@@ -2659,7 +2650,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2659,7 +2650,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
// Do PUCCH processing first // Do PUCCH processing first
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
pucch_procedures(eNB,i,harq_pid,abstraction_flag); pucch_procedures(eNB,proc,i,harq_pid,abstraction_flag);
} }
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
...@@ -2667,7 +2658,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2667,7 +2658,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
// check for Msg3 // check for Msg3
if (eNB->mac_enabled==1) { if (eNB->mac_enabled==1) {
if (eNB->UE_stats[i].mode == RA_RESPONSE) { if (eNB->UE_stats[i].mode == RA_RESPONSE) {
process_Msg3(eNB,i,harq_pid); process_Msg3(eNB,proc,i,harq_pid);
} }
} }
...@@ -2745,7 +2736,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2745,7 +2736,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
start_meas(&eNB->ulsch_demodulation_stats); start_meas(&eNB->ulsch_demodulation_stats);
if (abstraction_flag==0) { if (abstraction_flag==0) {
rx_ulsch(eNB, rx_ulsch(eNB,proc,
eNB->UE_stats[i].sector, // this is the effective sector id eNB->UE_stats[i].sector, // this is the effective sector id
i, i,
eNB->ulsch, eNB->ulsch,
...@@ -2754,7 +2745,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2754,7 +2745,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
else { else {
rx_ulsch_emul(eNB, rx_ulsch_emul(eNB,proc,
subframe, subframe,
eNB->UE_stats[i].sector, // this is the effective sector id eNB->UE_stats[i].sector, // this is the effective sector id
i); i);
...@@ -2767,7 +2758,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2767,7 +2758,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
start_meas(&eNB->ulsch_decoding_stats); start_meas(&eNB->ulsch_decoding_stats);
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
ret = ulsch_decoding(eNB, ret = ulsch_decoding(eNB,proc,
i, i,
0, // control_only_flag 0, // control_only_flag
eNB->ulsch[i]->harq_processes[harq_pid]->V_UL_DAI, eNB->ulsch[i]->harq_processes[harq_pid]->V_UL_DAI,
...@@ -2776,7 +2767,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2776,7 +2767,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
else { else {
ret = ulsch_decoding_emul(eNB, ret = ulsch_decoding_emul(eNB,proc,
i, i,
&rnti); &rnti);
} }
...@@ -3093,7 +3084,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -3093,7 +3084,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
i); i);
#endif #endif
process_HARQ_feedback(i, process_HARQ_feedback(i,
eNB, eNB,proc,
1, // pusch_flag 1, // pusch_flag
0, 0,
0, 0,
...@@ -3156,7 +3147,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -3156,7 +3147,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
} }
// CBA (non-LTE) // CBA (non-LTE)
cba_procedures(eNB,i,harq_pid,abstraction_flag); cba_procedures(eNB,proc,i,harq_pid,abstraction_flag);
} // loop i=0 ... NUMBER_OF_UE_MAX-1 } // loop i=0 ... NUMBER_OF_UE_MAX-1
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
......
...@@ -786,7 +786,7 @@ rrc_get_estimated_ue_distance( ...@@ -786,7 +786,7 @@ rrc_get_estimated_ue_distance(
const int CC_idP, const int CC_idP,
const uint8_t loc_typeP); const uint8_t loc_typeP);
void fill_dci(DCI_PDU *DCI_pdu, PHY_VARS_eNB *phy_vars_eNB); void fill_dci(DCI_PDU *DCI_pdu, PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc);
#endif #endif
/** @}*/ /** @}*/
...@@ -183,26 +183,10 @@ const char* eurecomFunctionsNames[] = { ...@@ -183,26 +183,10 @@ const char* eurecomFunctionsNames[] = {
"rt_sleep", "rt_sleep",
"trx_read", "trx_read",
"trx_write", "trx_write",
"eNB_thread_tx0", "eNB_thread_rxtx0",
"eNB_thread_rx0", "eNB_thread_rxtx1",
"eNB_thread_tx1", "eNB_thread_rx",
"eNB_thread_rx1", "eNB_thread_prach",
"eNB_thread_tx2",
"eNB_thread_rx2",
"eNB_thread_tx3",
"eNB_thread_rx3",
"eNB_thread_tx4",
"eNB_thread_rx4",
"eNB_thread_tx5",
"eNB_thread_rx5",
"eNB_thread_tx6",
"eNB_thread_rx6",
"eNB_thread_tx7",
"eNB_thread_rx7",
"eNB_thread_tx8",
"eNB_thread_rx8",
"eNB_thread_tx9",
"eNB_thread_rx9",
"ue_thread_tx", "ue_thread_tx",
"ue_thread_rx", "ue_thread_rx",
......
...@@ -157,26 +157,10 @@ typedef enum { ...@@ -157,26 +157,10 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP=0, VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP=0,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX0, VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX0, VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX1,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX1, VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX1, VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_PRACH,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX2,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX2,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX3,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX3,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX4,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX4,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX5,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX5,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX6,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX6,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX7,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX7,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX8,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX8,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX9,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX9,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_TX, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_TX,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX,
......
...@@ -139,7 +139,7 @@ extern int sync_var; ...@@ -139,7 +139,7 @@ extern int sync_var;
time_stats_t softmodem_stats_mt; // main thread time_stats_t softmodem_stats_mt; // main thread
time_stats_t softmodem_stats_hw; // hw acquisition time_stats_t softmodem_stats_hw; // hw acquisition
time_stats_t softmodem_stats_tx_sf; // total tx time time_stats_t softmodem_stats_rxtx_sf; // total tx time
time_stats_t softmodem_stats_rx_sf; // total rx time time_stats_t softmodem_stats_rx_sf; // total rx time
int32_t **rxdata; int32_t **rxdata;
int32_t **txdata; int32_t **txdata;
...@@ -290,16 +290,15 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) ...@@ -290,16 +290,15 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB)
} }
/*! /*!
* \brief The transmit thread of eNB. * \brief The RX UE-specific and TX thread of eNB.
* \ref NUM_ENB_THREADS threads of this type are active at the same time.
* \param param is a \ref eNB_proc_t structure which contains the info what to process. * \param param is a \ref eNB_proc_t structure which contains the info what to process.
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
static void* eNB_thread_tx( void* param ) static void* eNB_thread_rxtx( void* param )
{ {
static int eNB_thread_tx_status; static int eNB_thread_rxtx_status;
eNB_proc_t *proc = (eNB_proc_t*)param; eNB_rxtx_proc_t *proc = (eNB_rxtx_proc_t*)param;
FILE *tx_time_file = NULL; FILE *tx_time_file = NULL;
char tx_time_name[101]; char tx_time_name[101];
void *txp[PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx]; void *txp[PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx];
...@@ -309,7 +308,7 @@ static void* eNB_thread_tx( void* param ) ...@@ -309,7 +308,7 @@ static void* eNB_thread_tx( void* param )
tx_time_file = fopen(tx_time_name,"w"); tx_time_file = fopen(tx_time_name,"w");
} }
// set default return value // set default return value
eNB_thread_tx_status = 0; eNB_thread_rxtx_status = 0;
MSC_START_USE(); MSC_START_USE();
...@@ -332,10 +331,10 @@ static void* eNB_thread_tx( void* param ) ...@@ -332,10 +331,10 @@ static void* eNB_thread_tx( void* param )
if (sched_setattr(0, &attr, flags) < 0 ) { if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB tx thread: sched_setattr failed\n"); perror("[SCHED] eNB tx thread: sched_setattr failed\n");
return &eNB_thread_tx_status; return &eNB_thread_rxtx_status;
} }
LOG_I( HW, "[SCHED] eNB TX deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() ); LOG_I( HW, "[SCHED] eNB RXn-TXnp4 deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
#else //LOW_LATENCY #else //LOW_LATENCY
int policy, s, j; int policy, s, j;
...@@ -414,31 +413,40 @@ static void* eNB_thread_tx( void* param ) ...@@ -414,31 +413,40 @@ static void* eNB_thread_tx( void* param )
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
if (pthread_mutex_lock(&proc->mutex_tx) != 0) { if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
LOG_E( PHY, "[SCHED][eNB] error locking mutex for eNB TX\n"); LOG_E( PHY, "[SCHED][eNB] error locking mutex for eNB RXn-TXnp4\n");
exit_fun("nothing to add"); exit_fun("nothing to add");
break; break;
} }
while (proc->instance_cnt_tx < 0) { while (proc->instance_cnt_rxtx < 0) {
// most of the time the thread is waiting here // most of the time the thread is waiting here
// proc->instance_cnt_tx is -1 // proc->instance_cnt_rxtx is -1
pthread_cond_wait( &proc->cond_tx, &proc->mutex_tx ); // this unlocks mutex_tx while waiting and then locks it again pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx ); // this unlocks mutex_rxtx while waiting and then locks it again
} }
if (pthread_mutex_unlock(&proc->mutex_tx) != 0) { if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for eNB TX\n"); LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for eNB TX\n");
exit_fun("nothing to add"); exit_fun("nothing to add");
break; break;
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX0, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
start_meas( &softmodem_stats_tx_sf ); start_meas( &softmodem_stats_rxtx_sf );
if (oai_exit) break; if (oai_exit) break;
// UE-specific RX processing for subframe n
if (PHY_vars_eNB_g[0][proc->CC_id]->node_function != NGFI_RRU_IF4) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 1 );
// this is the ue-specific processing for the subframe and can be multi-threaded later
phy_procedures_eNB_uespec_RX(PHY_vars_eNB_g[0][proc->CC_id], proc, 0, no_relay );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
}
// TX processing for subframe n+4
if (((PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.frame_type == TDD) && if (((PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.frame_type == TDD) &&
((subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->frame_parms,proc->subframe_tx) == SF_DL) || ((subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->frame_parms,proc->subframe_tx) == SF_DL) ||
(subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->frame_parms,proc->subframe_tx) == SF_S))) || (subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->frame_parms,proc->subframe_tx) == SF_S))) ||
...@@ -470,7 +478,7 @@ static void* eNB_thread_tx( void* param ) ...@@ -470,7 +478,7 @@ static void* eNB_thread_tx( void* param )
if (oai_exit) if (oai_exit)
break; break;
if (PHY_vars_eNB_g[0][proc->CC_id]->node_function != NGFI_RRU_IF4) { if (PHY_vars_eNB_g[0][proc->CC_id]->node_function != NGFI_RRU_IF4) {
phy_procedures_eNB_TX(PHY_vars_eNB_g[0][proc->CC_id], 0, no_relay, NULL ); phy_procedures_eNB_TX(PHY_vars_eNB_g[0][proc->CC_id], proc, 0, no_relay, NULL );
/* we're done, let the next one proceed */ /* we're done, let the next one proceed */
if (pthread_mutex_lock(&sync_phy_proc.mutex_phy_proc_tx) != 0) { if (pthread_mutex_lock(&sync_phy_proc.mutex_phy_proc_tx) != 0) {
...@@ -517,7 +525,7 @@ static void* eNB_thread_tx( void* param ) ...@@ -517,7 +525,7 @@ static void* eNB_thread_tx( void* param )
txp[i] = (void*)&PHY_vars_eNB_g[0][0]->common_vars.txdata[0][i][proc->subframe_tx*PHY_vars_eNB_g[0][0]->frame_parms.samples_per_tti]; txp[i] = (void*)&PHY_vars_eNB_g[0][0]->common_vars.txdata[0][i][proc->subframe_tx*PHY_vars_eNB_g[0][0]->frame_parms.samples_per_tti];
// if symb_written < spp ==> error // if symb_written < spp ==> error
openair0.trx_write_func(&openair0, openair0.trx_write_func(&openair0,
(proc->timestamp_tx+openair0_cfg[0].tx_sample_advance), (proc->timestamp_tx-openair0_cfg[0].tx_sample_advance),
txp, txp,
PHY_vars_eNB_g[0][0]->frame_parms.samples_per_tti, PHY_vars_eNB_g[0][0]->frame_parms.samples_per_tti,
PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx, PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx,
...@@ -531,42 +539,42 @@ static void* eNB_thread_tx( void* param ) ...@@ -531,42 +539,42 @@ static void* eNB_thread_tx( void* param )
} }
if (pthread_mutex_lock(&proc->mutex_tx) != 0) { if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
LOG_E( PHY, "[SCHED][eNB] error locking mutex for eNB TX proc\n"); LOG_E( PHY, "[SCHED][eNB] error locking mutex for eNB TX proc\n");
exit_fun("nothing to add"); exit_fun("nothing to add");
break; break;
} }
proc->instance_cnt_tx--; proc->instance_cnt_rxtx--;
if (pthread_mutex_unlock(&proc->mutex_tx) != 0) { if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for eNB TX proc\n"); LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for eNB TX proc\n");
exit_fun("nothing to add"); exit_fun("nothing to add");
break; break;
} }
stop_meas( &softmodem_stats_tx_sf ); stop_meas( &softmodem_stats_rxtx_sf );
#ifdef LOWLATENCY #ifdef LOWLATENCY
if (opp_enabled){ if (opp_enabled){
if(softmodem_stats_tx_sf.diff_now/(cpuf) > attr.sched_runtime){ if(softmodem_stats_rxtx_sf.diff_now/(cpuf) > attr.sched_runtime){
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, (softmodem_stats_tx_sf.diff_now/cpuf - attr.sched_runtime)/1000000.0); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, (softmodem_stats_rxtx_sf.diff_now/cpuf - attr.sched_runtime)/1000000.0);
} }
} }
#endif #endif
print_meas_now(&softmodem_stats_tx_sf,"eNB_TX_SF",tx_time_file); print_meas_now(&softmodem_stats_rxtx_sf,"eNB_TX_SF",tx_time_file);
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
printf( "Exiting eNB thread TX\n"); printf( "Exiting eNB thread TX\n");
#endif #endif
eNB_thread_tx_status = 0; eNB_thread_rxtx_status = 0;
return &eNB_thread_tx_status; return &eNB_thread_rxtx_status;
} }
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
...@@ -592,12 +600,11 @@ static void wait_system_ready (char *message, volatile int *start_flag) ...@@ -592,12 +600,11 @@ static void wait_system_ready (char *message, volatile int *start_flag)
#endif #endif
/*! /*!
* \brief The receive thread of eNB. * \brief The RX common thread of eNB.
* \ref NUM_ENB_THREADS threads of this type are active at the same time.
* \param param is a \ref eNB_proc_t structure which contains the info what to process. * \param param is a \ref eNB_proc_t structure which contains the info what to process.
* \returns a pointer to an int. The storage is not on the heap and must not be freed. * \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/ */
static void* eNB_thread_rx( void* param ) static void* eNB_thread_rx_common( void* param )
{ {
static int eNB_thread_rx_status; static int eNB_thread_rx_status;
...@@ -721,7 +728,7 @@ static void* eNB_thread_rx( void* param ) ...@@ -721,7 +728,7 @@ static void* eNB_thread_rx( void* param )
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe of TX and RX threads // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe of TX and RX threads
printf( "waiting for sync (eNB_thread_rx)\n"); printf( "waiting for sync (eNB_thread_rx_common)\n");
pthread_mutex_lock( &sync_mutex ); pthread_mutex_lock( &sync_mutex );
while (sync_var<0) while (sync_var<0)
...@@ -739,7 +746,7 @@ static void* eNB_thread_rx( void* param ) ...@@ -739,7 +746,7 @@ static void* eNB_thread_rx( void* param )
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX, 0 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON, 0 );
start_meas( &softmodem_stats_rx_sf ); start_meas( &softmodem_stats_rx_sf );
...@@ -753,67 +760,63 @@ static void* eNB_thread_rx( void* param ) ...@@ -753,67 +760,63 @@ static void* eNB_thread_rx( void* param )
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON, 0 );
if (eNB->node_function != NGFI_RRU_IF4) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 1 );
// this is the ue-specific processing for the subframe and can be multi-threaded later
phy_procedures_eNB_uespec_RX(eNB, 0, no_relay );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
}
} }
// choose even or odd thread for RXn-TXnp4 processing
eNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[proc->subframe_rx&1];
// wake up TX for subframe n+4 // wake up TX for subframe n+4
// lock the TX mutex and make sure the thread is ready // lock the TX mutex and make sure the thread is ready
if (pthread_mutex_lock(&proc->mutex_tx) != 0) { if (pthread_mutex_lock(&proc_rxtx->mutex_rxtx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX thread %d (IC %d)\n", proc->instance_cnt_tx ); LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX thread %d (IC %d)\n", proc_rxtx->instance_cnt_rxtx );
exit_fun( "error locking mutex_tx" ); exit_fun( "error locking mutex_rxtx" );
break; break;
} }
int cnt_tx = ++proc->instance_cnt_tx; int cnt_rxtx = ++proc_rxtx->instance_cnt_rxtx;
// We have just received and processed the common part of a subframe, say n. // We have just received and processed the common part of a subframe, say n.
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
// transmitted timestamp of the next TX slot (first). // transmitted timestamp of the next TX slot (first).
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti, // The last (TS_rx mod samples_pexr_frame) was n*samples_per_tti,
// we want to generate subframe (n+3), so TS_tx = TX_rx+3*samples_per_tti, // we want to generate subframe (n+3), so TS_tx = TX_rx+3*samples_per_tti,
// and proc->subframe_tx = proc->subframe_rx+3 // and proc->subframe_tx = proc->subframe_rx+3
proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
proc->frame_tx = (proc->subframe_rx > 5) ? (proc->frame_rx+1)&1023 : proc->frame_rx; proc_rxtx->frame_rx = proc->frame_rx;
proc->subframe_tx = (proc->subframe_rx + 4)%10; proc_rxtx->subframe_rx = proc->subframe_rx;
proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10;
pthread_mutex_unlock( &proc->mutex_tx ); pthread_mutex_unlock( &proc_rxtx->mutex_rxtx );
if (cnt_tx == 0){ if (cnt_rxtx == 0){
// the thread was presumably waiting where it should and can now be woken up // the thread was presumably waiting where it should and can now be woken up
if (pthread_cond_signal(&proc->cond_tx) != 0) { if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TX thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
break; break;
} }
} else { } else {
LOG_W( PHY,"[eNB] Frame %d, eNB TX thread busy!! (cnt_tx %i)\n", proc->frame_tx, cnt_tx ); LOG_W( PHY,"[eNB] Frame %d, eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", proc_rxtx->frame_tx, cnt_rxtx );
exit_fun( "TX thread busy" ); exit_fun( "TX thread busy" );
break; break;
} }
stop_meas( &softmodem_stats_rx_sf ); stop_meas( &softmodem_stats_rxtx_sf );
#ifdef LOWLATENCY #ifdef LOWLATENCY
if (opp_enabled){ if (opp_enabled){
if(softmodem_stats_rx_sf.diff_now/(cpuf) > attr.sched_runtime){ if(softmodem_stats_rxtx_sf.diff_now/(cpuf) > attr.sched_runtime){
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, (softmodem_stats_rx_sf.diff_now/cpuf - attr.sched_runtime)/1000000.0); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RXTX_ENB, (softmodem_stats_rxtx_sf.diff_now/cpuf - attr.sched_runtime)/1000000.0);
} }
} }
#endif // LOWLATENCY #endif // LOWLATENCY
print_meas_now(&softmodem_stats_rx_sf,"eNB_RX_SF", rx_time_file); print_meas_now(&softmodem_stats_rx_sf,"eNB_RX_SF", rx_time_file);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
} }
//stop_meas( &softmodem_stats_rx_sf[proc->thread_index] );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX0, 0 );
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
printf( "Exiting eNB thread RX\n"); printf( "Exiting eNB thread RXn-TXnp4\n");
#endif #endif
eNB_thread_rx_status = 0; eNB_thread_rx_status = 0;
...@@ -954,8 +957,8 @@ static void* eNB_thread_prach( void* param ) ...@@ -954,8 +957,8 @@ static void* eNB_thread_prach( void* param )
while (proc->instance_cnt_prach < 0) { while (proc->instance_cnt_prach < 0) {
// most of the time the thread is waiting here // most of the time the thread is waiting here
// proc->instance_cnt_tx is -1 // proc->instance_cnt_prach is -1
pthread_cond_wait( &proc->cond_prach, &proc->mutex_prach ); // this unlocks mutex_tx while waiting and then locks it again pthread_cond_wait( &proc->cond_prach, &proc->mutex_prach ); // this unlocks mutex_rxtx while waiting and then locks it again
} }
if (pthread_mutex_unlock(&proc->mutex_prach) != 0) { if (pthread_mutex_unlock(&proc->mutex_prach) != 0) {
...@@ -1000,13 +1003,14 @@ void init_eNB_proc(void) ...@@ -1000,13 +1003,14 @@ void init_eNB_proc(void)
int CC_id; int CC_id;
PHY_VARS_eNB *eNB; PHY_VARS_eNB *eNB;
eNB_proc_t *proc; eNB_proc_t *proc;
eNB_rxtx_proc_t *proc_rxtx;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB = PHY_vars_eNB_g[0][CC_id]; eNB = PHY_vars_eNB_g[0][CC_id];
proc = &eNB->proc; proc = &eNB->proc;
proc_rxtx = proc->proc_rxtx;
#ifndef LOWLATENCY #ifndef LOWLATENCY
/* /*
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] ); pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
...@@ -1018,9 +1022,12 @@ void init_eNB_proc(void) ...@@ -1018,9 +1022,12 @@ void init_eNB_proc(void)
perror("[ENB_PROC_RX] setting thread stack size failed\n"); perror("[ENB_PROC_RX] setting thread stack size failed\n");
*/ */
// set the kernel scheduling policy and priority // set the kernel scheduling policy and priority
proc->sched_param_tx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY; proc_rxtx[0].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc->attr_tx, &proc->sched_param_tx); pthread_attr_setschedparam (&proc_rxtx[0].attr_rxtx, &proc_rxtx[0].sched_param_rxtx);
pthread_attr_setschedpolicy (&proc->attr_tx, SCHED_FIFO); pthread_attr_setschedpolicy (&proc_rxtx[0].attr_rxtx, SCHED_FIFO);
proc_rxtx[1].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc_rxtx[1].attr_rxtx, &proc_rxtx[1].sched_param_rxtx);
pthread_attr_setschedpolicy (&proc_rxtx[1].attr_rxtx, SCHED_FIFO);
proc->sched_param_rx.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY; proc->sched_param_rx.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc->attr_rx, &proc->sched_param_rx); pthread_attr_setschedparam (&proc->attr_rx, &proc->sched_param_rx);
...@@ -1032,27 +1039,35 @@ void init_eNB_proc(void) ...@@ -1032,27 +1039,35 @@ void init_eNB_proc(void)
printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i); printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i);
#endif #endif
proc->instance_cnt_tx = -1; proc_rxtx[0].instance_cnt_rxtx = -1;
proc_rxtx[1].instance_cnt_rxtx = -1;
proc->instance_cnt_prach = -1; proc->instance_cnt_prach = -1;
proc->CC_id = CC_id; proc->CC_id = CC_id;
proc->first_rx=1; proc->first_rx=1;
pthread_mutex_init( &proc->mutex_tx, NULL); pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
pthread_cond_init( &proc->cond_tx, NULL); pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
pthread_mutex_init( &proc->mutex_prach, NULL);
pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL);
pthread_cond_init( &proc_rxtx[1].cond_rxtx, NULL);
pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_prach, NULL);
#ifndef LOWLATENCY #ifndef LOWLATENCY
pthread_create( &proc->pthread_tx, &proc->attr_tx, eNB_thread_tx, &eNB->proc ); pthread_create( &proc_rxtx[0].pthread_rxtx, &proc_rxtx[0].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[0] );
pthread_create( &proc->pthread_rx, &proc->attr_rx, eNB_thread_rx, &eNB->proc ); pthread_create( &proc_rxtx[1].pthread_rxtx, &proc_rxtx[1].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &proc->pthread_rx, &proc->attr_rx, eNB_thread_rx_common, &eNB->proc );
pthread_create( &proc->pthread_prach, &proc->attr_prach, eNB_thread_prach, &eNB->proc ); pthread_create( &proc->pthread_prach, &proc->attr_prach, eNB_thread_prach, &eNB->proc );
#else #else
pthread_create( &proc->pthread_tx, NULL, eNB_thread_tx, &eNB->proc ); pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[0] );
pthread_create( &proc->pthread_rx, NULL, eNB_thread_rx, &eNB->proc ); pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[1] );
pthread_create( &proc->pthread_rx, NULL, eNB_thread_rx_common, &eNB->proc );
pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc ); pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc );
#endif #endif
char name[16]; char name[16];
snprintf( name, sizeof(name), "TX %d", i ); snprintf( name, sizeof(name), "RXTX0 %d", i );
pthread_setname_np( proc->pthread_tx, name ); pthread_setname_np( proc_rxtx[0].pthread_rxtx, name );
snprintf( name, sizeof(name), "RXTX1 %d", i );
pthread_setname_np( proc_rxtx[1].pthread_rxtx, name );
snprintf( name, sizeof(name), "RX %d", i ); snprintf( name, sizeof(name), "RX %d", i );
pthread_setname_np( proc->pthread_rx, name ); pthread_setname_np( proc->pthread_rx, name );
} }
...@@ -1073,46 +1088,57 @@ void kill_eNB_proc(void) ...@@ -1073,46 +1088,57 @@ void kill_eNB_proc(void)
int *status; int *status;
PHY_VARS_eNB *eNB; PHY_VARS_eNB *eNB;
eNB_proc_t *proc; eNB_proc_t *proc;
eNB_rxtx_proc_t *proc_rxtx;
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB=PHY_vars_eNB_g[0][CC_id]; eNB=PHY_vars_eNB_g[0][CC_id];
proc = &eNB->proc; proc = &eNB->proc;
proc_rxtx = &proc->proc_rxtx[0];
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
printf( "Killing TX CC_id %d thread %d\n", CC_id, i ); printf( "Killing TX CC_id %d thread %d\n", CC_id, i );
#endif #endif
proc->instance_cnt_tx = 0; // FIXME data race! proc_rxtx[0].instance_cnt_rxtx = 0; // FIXME data race!
pthread_cond_signal( &proc->cond_tx ); proc_rxtx[1].instance_cnt_rxtx = 0; // FIXME data race!
pthread_cond_signal( &proc_rxtx[0].cond_rxtx );
pthread_cond_signal( &proc_rxtx[0].cond_rxtx );
pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx); pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
printf( "Joining eNB TX CC_id %d thread %d...\n", CC_id, i ); printf( "Joining eNB TX CC_id %d thread\n", CC_id);
#endif #endif
int result = pthread_join( proc->pthread_tx, (void**)&status ); int result,i;
for (i=0;i<1;i++) {
pthread_join( proc_rxtx[i].pthread_rxtx, (void**)&status );
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
if (result != 0) { if (result != 0) {
printf( "Error joining thread.\n" ); printf( "Error joining thread.\n" );
} else {
if (status) {
printf( "status %d\n", *status );
} else { } else {
printf( "The thread was killed. No status available.\n" ); if (status) {
printf( "status %d\n", *status );
} else {
printf( "The thread was killed. No status available.\n" );
}
} }
}
#else #else
UNUSED(result) UNUSED(result);
#endif #endif
pthread_mutex_destroy( &proc_rxtx[i].mutex_rxtx );
pthread_cond_destroy( &proc_rxtx[i].cond_rxtx );
}
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
printf( "Killing RX CC_id %d thread %d\n", CC_id, i ); printf( "Killing RX CC_id %d thread\n", CC_id);
#endif #endif
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
printf( "Joining eNB RX CC_id %d thread %d...\n", CC_id, i ); printf( "Joining eNB RX CC_id %d thread ...\n", CC_id);
#endif #endif
result = pthread_join( proc->pthread_rx, (void**)&status ); result = pthread_join( proc->pthread_rx, (void**)&status );
...@@ -1131,9 +1157,9 @@ void kill_eNB_proc(void) ...@@ -1131,9 +1157,9 @@ void kill_eNB_proc(void)
#else #else
UNUSED(result); UNUSED(result);
#endif #endif
pthread_mutex_destroy( &proc->mutex_tx ); pthread_mutex_destroy( &proc->mutex_prach );
pthread_cond_destroy( &proc->cond_tx ); pthread_cond_destroy( &proc->cond_prach );
} }
} }
...@@ -1262,7 +1288,7 @@ void reset_opp_meas(void) { ...@@ -1262,7 +1288,7 @@ void reset_opp_meas(void) {
reset_meas(&softmodem_stats_hw); reset_meas(&softmodem_stats_hw);
for (sfn=0; sfn < 10; sfn++) { for (sfn=0; sfn < 10; sfn++) {
reset_meas(&softmodem_stats_tx_sf); reset_meas(&softmodem_stats_rxtx_sf);
reset_meas(&softmodem_stats_rx_sf); reset_meas(&softmodem_stats_rx_sf);
} }
} }
...@@ -1274,7 +1300,7 @@ void print_opp_meas(void) { ...@@ -1274,7 +1300,7 @@ void print_opp_meas(void) {
print_meas(&softmodem_stats_hw, "HW Acquisation", NULL, NULL); print_meas(&softmodem_stats_hw, "HW Acquisation", NULL, NULL);
for (sfn=0; sfn < 10; sfn++) { for (sfn=0; sfn < 10; sfn++) {
print_meas(&softmodem_stats_tx_sf,"[eNB][total_phy_proc_tx]",NULL, NULL); print_meas(&softmodem_stats_rxtx_sf,"[eNB][total_phy_proc_rxtx]",NULL, NULL);
print_meas(&softmodem_stats_rx_sf,"[eNB][total_phy_proc_rx]",NULL,NULL); print_meas(&softmodem_stats_rx_sf,"[eNB][total_phy_proc_rx]",NULL,NULL);
} }
} }
......
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