Merge remote-tracking branch 'origin/develop' into enhancement-10-harmony
Conflicts: targets/RT/USER/lte-enb.c targets/RT/USER/lte-softmodem.c
This commit is contained in:
@@ -1058,7 +1058,7 @@ unsigned char phy_threegpplte_turbo_decoder_scalar(llr_t *y,
|
||||
break;
|
||||
}
|
||||
|
||||
if ((crc == oldcrc) && (crc!=0)) {
|
||||
if (crc == oldcrc) {
|
||||
return(iteration_cnt);
|
||||
}
|
||||
|
||||
|
||||
@@ -1375,7 +1375,7 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
fprintf(fdavx2b,"oldcrc %x, crc %x, oldcrc_cw2 %x, crc_cw2 %x\n",oldcrc,crc,oldcrc_cw2,crc_cw2);
|
||||
#endif
|
||||
|
||||
if ((crc == oldcrc) && (crc!=0) && (crc_cw2 == oldcrc_cw2) && (crc_cw2!=0)) {
|
||||
if (crc == oldcrc && crc_cw2 == oldcrc_cw2) {
|
||||
return(iteration_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2556,7 +2556,7 @@ unsigned char phy_threegpplte_turbo_decoder(short *y,
|
||||
|
||||
stop_meas(intl2_stats);
|
||||
|
||||
if ((crc == oldcrc) && (crc!=0)) {
|
||||
if (crc == oldcrc) {
|
||||
return(iteration_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1612,7 +1612,7 @@ unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
fprintf(fdsse4,"oldcrc %x, crc %x\n",oldcrc,crc);
|
||||
#endif
|
||||
|
||||
if ((crc == oldcrc) && (crc!=0)) {
|
||||
if (crc == oldcrc) {
|
||||
return(iteration_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho
|
||||
|
||||
#endif
|
||||
|
||||
if (frame_length > 6143) {
|
||||
if (frame_length > 6144) {
|
||||
LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length);
|
||||
return;
|
||||
}
|
||||
@@ -1625,7 +1625,7 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
|
||||
if (intl2_stats) stop_meas(intl2_stats);
|
||||
|
||||
if ((crc == oldcrc) && (crc!=0)) {
|
||||
if (crc == oldcrc) {
|
||||
return(iteration_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7205,7 +7205,17 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
|
||||
|
||||
|
||||
if (cqi_req == 1) {
|
||||
ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
|
||||
/* 36.213 7.2.1 (release 10) says:
|
||||
* "RI is only reported for transmission modes 3 and 4,
|
||||
* as well as transmission modes 8 and 9 with PMI/RI reporting"
|
||||
* This is for aperiodic reporting.
|
||||
* TODO: deal with TM 8&9 correctly when they are implemented.
|
||||
* TODO: deal with periodic reporting if we implement it.
|
||||
*/
|
||||
if (transmission_mode == 3 || transmission_mode == 4)
|
||||
ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
|
||||
else
|
||||
ulsch->harq_processes[harq_pid]->O_RI = 0;
|
||||
|
||||
switch(transmission_mode) {
|
||||
// The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling
|
||||
|
||||
@@ -360,12 +360,18 @@ typedef struct {
|
||||
uint8_t TPC;
|
||||
/// First Allocated RB
|
||||
uint16_t first_rb;
|
||||
/// First Allocated RB - previous scheduling
|
||||
/// This is needed for PHICH generation which
|
||||
/// is done after a new scheduling
|
||||
uint16_t previous_first_rb;
|
||||
/// Current Number of RBs
|
||||
uint16_t nb_rb;
|
||||
/// Transport block size
|
||||
uint32_t TBS;
|
||||
/// The payload + CRC size in bits
|
||||
uint32_t B;
|
||||
/// Number of soft channel bits
|
||||
uint32_t G;
|
||||
/// CQI CRC status
|
||||
uint8_t cqi_crc_status;
|
||||
/// Pointer to CQI data
|
||||
@@ -442,6 +448,10 @@ typedef struct {
|
||||
uint8_t Nsymb_initial;
|
||||
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2)
|
||||
uint8_t n_DMRS;
|
||||
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) - previous scheduling
|
||||
/// This is needed for PHICH generation which
|
||||
/// is done after a new scheduling
|
||||
uint8_t previous_n_DMRS;
|
||||
/// n_DMRS 2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1)
|
||||
uint8_t n_DMRS2;
|
||||
/// Flag to indicate that this ULSCH is for calibration information sent from UE (i.e. no MAC SDU to pass up)
|
||||
|
||||
@@ -1453,8 +1453,12 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
||||
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,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 +
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH;
|
||||
/* the HARQ process may have been reused by a new scheduling, so we use
|
||||
* previous values of first_rb and n_DMRS to compute ngroup_PHICH and nseq_PHICH
|
||||
*/
|
||||
|
||||
ngroup_PHICH = (ulsch[UE_id]->harq_processes[harq_pid]->previous_first_rb +
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->previous_n_DMRS)%Ngroup_PHICH;
|
||||
|
||||
if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == TDD) ) {
|
||||
|
||||
@@ -1462,20 +1466,28 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
||||
ngroup_PHICH += 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);
|
||||
nseq_PHICH = ((ulsch[UE_id]->harq_processes[harq_pid]->previous_first_rb/Ngroup_PHICH) +
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->previous_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",
|
||||
eNB->Mod_id,harq_pid,proc->frame_tx,
|
||||
subframe,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]->previous_first_rb,
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->dci_alloc);
|
||||
|
||||
T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe),
|
||||
T_INT(UE_id), T_INT(ulsch[UE_id]->rnti), T_INT(harq_pid),
|
||||
T_INT(Ngroup_PHICH), T_INT(NSF_PHICH),
|
||||
T_INT(ngroup_PHICH), T_INT(nseq_PHICH),
|
||||
T_INT(ulsch[UE_id]->harq_processes[harq_pid]->phich_ACK),
|
||||
T_INT(ulsch[UE_id]->harq_processes[harq_pid]->previous_first_rb),
|
||||
T_INT(ulsch[UE_id]->harq_processes[harq_pid]->previous_n_DMRS));
|
||||
|
||||
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",
|
||||
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,
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->first_rb);
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->previous_first_rb);
|
||||
}
|
||||
|
||||
if (eNB->abstraction_flag == 0) {
|
||||
|
||||
@@ -228,7 +228,7 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
|
||||
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
|
||||
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
int Q_m = get_Qm_ul(ulsch_harq->mcs);
|
||||
int G = ulsch_harq->nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch;
|
||||
int G = ulsch_harq->G;
|
||||
uint32_t E;
|
||||
uint32_t Gp,GpmodC,Nl=1;
|
||||
uint32_t C = ulsch_harq->C;
|
||||
@@ -449,8 +449,8 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
|
||||
int16_t dummy_w[MAX_NUM_ULSCH_SEGMENTS][3*(6144+64)];
|
||||
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
|
||||
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
int Q_m = get_Qm_ul(ulsch_harq->mcs);
|
||||
int G = ulsch_harq->nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch;
|
||||
//int Q_m = get_Qm_ul(ulsch_harq->mcs);
|
||||
int G = ulsch_harq->G;
|
||||
unsigned int E;
|
||||
int Cby2;
|
||||
|
||||
@@ -657,8 +657,8 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
|
||||
int16_t dummy_w[MAX_NUM_ULSCH_SEGMENTS][3*(6144+64)];
|
||||
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
|
||||
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
int Q_m = get_Qm_ul(ulsch_harq->mcs);
|
||||
int G = ulsch_harq->nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch;
|
||||
//int Q_m = get_Qm_ul(ulsch_harq->mcs);
|
||||
int G = ulsch_harq->G;
|
||||
unsigned int E;
|
||||
|
||||
uint8_t (*tc)(int16_t *y,
|
||||
@@ -1036,6 +1036,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
|
||||
#endif
|
||||
|
||||
G = G - Q_RI - Q_CQI;
|
||||
ulsch_harq->G = G;
|
||||
|
||||
if ((int)G < 0) {
|
||||
LOG_E(PHY,"FATAL: ulsch_decoding.c G < 0 (%d) : Q_RI %d, Q_CQI %d\n",G,Q_RI,Q_CQI);
|
||||
@@ -1532,6 +1533,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
|
||||
// CQI
|
||||
|
||||
// printf("before cqi c[%d] = %p\n",0,ulsch_harq->c[0]);
|
||||
ulsch_harq->cqi_crc_status = 0;
|
||||
if (Q_CQI>0) {
|
||||
memset((void *)&dummy_w_cc[0],0,3*(ulsch_harq->Or1+8+32));
|
||||
|
||||
@@ -1554,9 +1556,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
|
||||
|
||||
if (extract_cqi_crc(o_flip,ulsch_harq->Or1) == (crc8(o_flip,ulsch_harq->Or1)>>24))
|
||||
ulsch_harq->cqi_crc_status = 1;
|
||||
else
|
||||
ulsch_harq->cqi_crc_status = 0;
|
||||
|
||||
|
||||
if (ulsch->harq_processes[harq_pid]->Or1<=32) {
|
||||
ulsch_harq->o[3] = o_flip[0] ;
|
||||
|
||||
@@ -70,6 +70,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
|
||||
case 5:
|
||||
DCI_pdu->Num_common_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].firstCCE = 0;
|
||||
DCI_pdu->dci_alloc[0].rnti = SI_RNTI;
|
||||
DCI_pdu->dci_alloc[0].format = format1A;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
@@ -212,6 +213,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
|
||||
case 7:
|
||||
DCI_pdu->Num_ue_spec_dci = 1;
|
||||
DCI_pdu->dci_alloc[0].L = 2;
|
||||
DCI_pdu->dci_alloc[0].firstCCE = 0;
|
||||
DCI_pdu->dci_alloc[0].rnti = 0x1235;
|
||||
DCI_pdu->dci_alloc[0].format = format1;
|
||||
DCI_pdu->dci_alloc[0].ra_flag = 0;
|
||||
|
||||
@@ -760,7 +760,9 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
|
||||
|
||||
T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id),
|
||||
T_INT(dci_alloc->rnti), T_INT(dci_alloc->format),
|
||||
T_INT(eNB->dlsch[(int)UE_id][0]->current_harq_pid));
|
||||
T_INT(eNB->dlsch[(int)UE_id][0]->current_harq_pid),
|
||||
T_INT(eNB->dlsch[(int)UE_id][0]->harq_processes[eNB->dlsch[(int)UE_id][0]->current_harq_pid]->mcs),
|
||||
T_INT(eNB->dlsch[(int)UE_id][0]->harq_processes[eNB->dlsch[(int)UE_id][0]->current_harq_pid]->TBS));
|
||||
|
||||
eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = dci_alloc->firstCCE;
|
||||
|
||||
@@ -854,8 +856,12 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
|
||||
eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
|
||||
|
||||
T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id),
|
||||
T_INT(dci_alloc->rnti), T_INT(harq_pid));
|
||||
|
||||
T_INT(dci_alloc->rnti), T_INT(harq_pid),
|
||||
T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->mcs),
|
||||
T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->round),
|
||||
T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->first_rb),
|
||||
T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->nb_rb),
|
||||
T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->TBS));
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -968,6 +974,22 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
|
||||
UE_id,
|
||||
eNB->ulsch[(uint32_t)UE_id]->Msg3_frame,
|
||||
eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe);
|
||||
|
||||
/* TODO: get rid of this hack. The problem is that the eNodeB may
|
||||
* sometimes wrongly generate PHICH because somewhere 'phich_active' was
|
||||
* not reset to 0, due to an unidentified reason. When adding this
|
||||
* resetting here the problem seems to disappear completely.
|
||||
*/
|
||||
LOG_D(PHY, "hack: set phich_active to 0 for UE %d fsf %d %d all HARQs\n", UE_id, frame, subframe);
|
||||
for (i = 0; i < 8; i++)
|
||||
eNB->ulsch[(uint32_t)UE_id]->harq_processes[i]->phich_active = 0;
|
||||
|
||||
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, (uint16_t)crnti,
|
||||
eNB->ulsch[UE_id]->Msg3_frame, eNB->ulsch[UE_id]->Msg3_subframe);
|
||||
|
||||
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
|
||||
T_INT(UE_id), T_INT((uint16_t)crnti), T_INT(1 /* 1 is for initial transmission*/),
|
||||
T_INT(eNB->ulsch[UE_id]->Msg3_frame), T_INT(eNB->ulsch[UE_id]->Msg3_subframe));
|
||||
}
|
||||
if (ue_stats) ue_stats->total_TBS_MAC += dlsch_harq->TBS;
|
||||
}
|
||||
@@ -1103,7 +1125,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
|
||||
|
||||
#endif
|
||||
|
||||
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_DL)) return;
|
||||
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1);
|
||||
if (do_meas==1) start_meas(&eNB->phy_proc_tx);
|
||||
@@ -1206,6 +1228,38 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
|
||||
eNB->dlsch[i][0]->subframe_tx[subframe] = 0;
|
||||
}
|
||||
|
||||
/* save old HARQ information needed for PHICH generation */
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
if (eNB->ulsch[i]) {
|
||||
/* Store first_rb and n_DMRS for correct PHICH generation below.
|
||||
* For PHICH generation we need "old" values of last scheduling
|
||||
* for this HARQ process. 'generate_eNB_dlsch_params' below will
|
||||
* overwrite first_rb and n_DMRS and 'generate_phich_top', done
|
||||
* after 'generate_eNB_dlsch_params', would use the "new" values
|
||||
* instead of the "old" ones.
|
||||
*
|
||||
* This has been tested for FDD only, may be wrong for TDD.
|
||||
*
|
||||
* TODO: maybe we should restructure the code to be sure it
|
||||
* is done correctly. The main concern is if the code
|
||||
* changes and first_rb and n_DMRS are modified before
|
||||
* we reach here, then the PHICH processing will be wrong,
|
||||
* using wrong first_rb and n_DMRS values to compute
|
||||
* ngroup_PHICH and nseq_PHICH.
|
||||
*
|
||||
* TODO: check if that works with TDD.
|
||||
*/
|
||||
if ((subframe_select(fp,ul_subframe)==SF_UL) ||
|
||||
(fp->frame_type == FDD)) {
|
||||
harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
|
||||
eNB->ulsch[i]->harq_processes[harq_pid]->previous_first_rb =
|
||||
eNB->ulsch[i]->harq_processes[harq_pid]->first_rb;
|
||||
eNB->ulsch[i]->harq_processes[harq_pid]->previous_n_DMRS =
|
||||
eNB->ulsch[i]->harq_processes[harq_pid]->n_DMRS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
num_pdcch_symbols = DCI_pdu->num_pdcch_symbols;
|
||||
LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(dci common %"PRIu8", dci uespec %"PRIu8"\n",num_pdcch_symbols,
|
||||
@@ -1927,6 +1981,9 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
|
||||
preamble_energy_max%10,
|
||||
preamble_delay_list[preamble_max]);
|
||||
|
||||
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id),
|
||||
T_INT(preamble_max), T_INT(preamble_energy_max), T_INT(preamble_delay_list[preamble_max]));
|
||||
|
||||
if (eNB->mac_enabled==1) {
|
||||
uint8_t update_TA=4;
|
||||
|
||||
@@ -1965,11 +2022,11 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
|
||||
}
|
||||
|
||||
void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_pid) {
|
||||
|
||||
void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_pid)
|
||||
{
|
||||
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};
|
||||
int16_t n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3;
|
||||
int16_t n1_pucch0 = -1, n1_pucch1 = -1, n1_pucch2 = -1, n1_pucch3 = -1;
|
||||
uint8_t do_SR = 0;
|
||||
uint8_t pucch_sel = 0;
|
||||
int32_t metric0=0,metric1=0,metric0_SR=0;
|
||||
@@ -1980,352 +2037,329 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq
|
||||
|
||||
if ((eNB->dlsch[UE_id][0]) &&
|
||||
(eNB->dlsch[UE_id][0]->rnti>0) &&
|
||||
(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
|
||||
do_SR = is_SR_subframe(eNB,proc,UE_id);
|
||||
// do_SR = 0;
|
||||
|
||||
|
||||
// Now ACK/NAK
|
||||
// First check subframe_tx flag for earlier subframes
|
||||
|
||||
get_n1_pucch_eNB(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
&n1_pucch0,
|
||||
&n1_pucch1,
|
||||
&n1_pucch2,
|
||||
&n1_pucch3);
|
||||
|
||||
proc,
|
||||
UE_id,
|
||||
&n1_pucch0,
|
||||
&n1_pucch1,
|
||||
&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,
|
||||
frame,subframe,
|
||||
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,do_SR);
|
||||
|
||||
eNB->Mod_id,eNB->dlsch[UE_id][0]->rnti,
|
||||
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 {
|
||||
// otherwise we have some PUCCH detection to do
|
||||
|
||||
|
||||
// Null out PUCCH PRBs for noise measurement
|
||||
switch(fp->N_RB_UL) {
|
||||
case 6:
|
||||
eNB->rb_mask_ul[0] |= (0x1 | (1<<5)); //position 5
|
||||
break;
|
||||
eNB->rb_mask_ul[0] |= (0x1 | (1<<5)); //position 5
|
||||
break;
|
||||
case 15:
|
||||
eNB->rb_mask_ul[0] |= (0x1 | (1<<14)); // position 14
|
||||
break;
|
||||
eNB->rb_mask_ul[0] |= (0x1 | (1<<14)); // position 14
|
||||
break;
|
||||
case 25:
|
||||
eNB->rb_mask_ul[0] |= (0x1 | (1<<24)); // position 24
|
||||
break;
|
||||
eNB->rb_mask_ul[0] |= (0x1 | (1<<24)); // position 24
|
||||
break;
|
||||
case 50:
|
||||
eNB->rb_mask_ul[0] |= 0x1;
|
||||
eNB->rb_mask_ul[1] |= (1<<17); // position 49 (49-32)
|
||||
break;
|
||||
eNB->rb_mask_ul[0] |= 0x1;
|
||||
eNB->rb_mask_ul[1] |= (1<<17); // position 49 (49-32)
|
||||
break;
|
||||
case 75:
|
||||
eNB->rb_mask_ul[0] |= 0x1;
|
||||
eNB->rb_mask_ul[2] |= (1<<10); // position 74 (74-64)
|
||||
break;
|
||||
eNB->rb_mask_ul[0] |= 0x1;
|
||||
eNB->rb_mask_ul[2] |= (1<<10); // position 74 (74-64)
|
||||
break;
|
||||
case 100:
|
||||
eNB->rb_mask_ul[0] |= 0x1;
|
||||
eNB->rb_mask_ul[3] |= (1<<3); // position 99 (99-96)
|
||||
break;
|
||||
eNB->rb_mask_ul[0] |= 0x1;
|
||||
eNB->rb_mask_ul[3] |= (1<<3); // position 99 (99-96)
|
||||
break;
|
||||
default:
|
||||
LOG_E(PHY,"Unknown number for N_RB_UL %d\n",fp->N_RB_UL);
|
||||
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++;
|
||||
eNB->UE_stats[UE_id].sr_total++;
|
||||
|
||||
|
||||
if (eNB->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,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1_THRES);
|
||||
|
||||
if (eNB->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,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1_THRES);
|
||||
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR is %d (SR n1pucch is %d)\n",
|
||||
eNB->Mod_id,
|
||||
eNB->ulsch[UE_id]->rnti,
|
||||
frame,
|
||||
subframe,
|
||||
SR_payload,
|
||||
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex);
|
||||
}
|
||||
#ifdef PHY_ABSTRACTION
|
||||
else {
|
||||
metric0_SR = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
pucch_format1,
|
||||
0,
|
||||
&SR_payload);
|
||||
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);
|
||||
}
|
||||
|
||||
else {
|
||||
metric0_SR = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
pucch_format1,
|
||||
0,
|
||||
&SR_payload);
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
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,
|
||||
eNB->ulsch[UE_id]->rnti,frame,subframe);
|
||||
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
|
||||
eNB->first_sr[UE_id] = 0;
|
||||
eNB->dlsch[UE_id][0]->harq_processes[0]->round=0;
|
||||
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",
|
||||
eNB->Mod_id,
|
||||
eNB->ulsch[UE_id]->rnti,frame,subframe);
|
||||
}
|
||||
|
||||
if (eNB->mac_enabled==1) {
|
||||
mac_xface->SR_indication(eNB->Mod_id,
|
||||
eNB->CC_id,
|
||||
frame,
|
||||
eNB->dlsch[UE_id][0]->rnti,subframe);
|
||||
}
|
||||
}
|
||||
}// do_SR==1
|
||||
|
||||
|
||||
if ((n1_pucch0==-1) && (n1_pucch1==-1)) { // just check for SR
|
||||
} else if (eNB->frame_parms.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 (eNB->abstraction_flag == 0) {
|
||||
|
||||
|
||||
|
||||
metric0 = rx_pucch(eNB,
|
||||
pucch_format1a,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch0,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
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,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
|
||||
}
|
||||
|
||||
if (eNB->mac_enabled==1) {
|
||||
mac_xface->SR_indication(eNB->Mod_id,
|
||||
eNB->CC_id,
|
||||
frame,
|
||||
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 (eNB->abstraction_flag == 0) {
|
||||
|
||||
|
||||
|
||||
metric0 = rx_pucch(eNB,
|
||||
pucch_format1a,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch0,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
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,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
}
|
||||
else {
|
||||
} 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 (eNB->abstraction_flag == 0) {
|
||||
metric0 = rx_pucch(eNB,
|
||||
pucch_format1a,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch0,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
}
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric0 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
pucch_format1a,
|
||||
0,
|
||||
pucch_payload0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d pucch1a (FDD) payload %d (metric %d)\n",
|
||||
eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
pucch_payload0[0],metric0);
|
||||
#endif
|
||||
|
||||
process_HARQ_feedback(UE_id,eNB,proc,
|
||||
0,// pusch_flag
|
||||
pucch_payload0,
|
||||
2,
|
||||
SR_payload);
|
||||
|
||||
} // FDD
|
||||
else { //TDD
|
||||
|
||||
bundling_flag = eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode;
|
||||
|
||||
// fix later for 2 TB case and format1b
|
||||
|
||||
if ((fp->frame_type==FDD) ||
|
||||
(bundling_flag==bundling) ||
|
||||
((fp->frame_type==TDD)&&(fp->tdd_config==1)&&((subframe!=2)||(subframe!=7)))) {
|
||||
format = pucch_format1a;
|
||||
} else {
|
||||
format = pucch_format1b;
|
||||
}
|
||||
|
||||
// if SR was detected, use the n1_pucch from SR
|
||||
if (SR_payload==1) {
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d Checking ACK/NAK (%d,%d,%d,%d) format %d with SR\n",eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,format);
|
||||
else {
|
||||
metric0 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
pucch_format1a,
|
||||
0,
|
||||
pucch_payload0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (eNB->abstraction_flag == 0)
|
||||
metric0_SR = rx_pucch(eNB,
|
||||
format,
|
||||
UE_id,
|
||||
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
else {
|
||||
/* cancel SR detection if reception on n1_pucch0 is better than on SR PUCCH resource index */
|
||||
if (do_SR && metric0 > metric0_SR) SR_payload = 0;
|
||||
|
||||
if (do_SR && metric0 <= metric0_SR) {
|
||||
/* when transmitting ACK/NACK on SR PUCCH resource index, SR payload is always 1 */
|
||||
SR_payload = 1;
|
||||
|
||||
if (eNB->abstraction_flag == 0) {
|
||||
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,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
}
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric0 = rx_pucch_emul(eNB,proc,
|
||||
UE_id,
|
||||
format,
|
||||
0,
|
||||
pucch_payload0);
|
||||
else {
|
||||
metric0 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
pucch_format1a,
|
||||
0,
|
||||
pucch_payload0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else { //using n1_pucch0/n1_pucch1 resources
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d Checking ACK/NAK (%d,%d,%d,%d) format %d\n",eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,format);
|
||||
#endif
|
||||
metric0=0;
|
||||
metric1=0;
|
||||
|
||||
// Check n1_pucch0 metric
|
||||
if (n1_pucch0 != -1) {
|
||||
if (eNB->abstraction_flag == 0)
|
||||
metric0 = rx_pucch(eNB,
|
||||
format,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch0,
|
||||
0, // n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
else {
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric0 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
format,
|
||||
0,
|
||||
pucch_payload0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Check n1_pucch1 metric
|
||||
if (n1_pucch1 != -1) {
|
||||
if (eNB->abstraction_flag == 0)
|
||||
metric1 = rx_pucch(eNB,
|
||||
format,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch1,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload1,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
else {
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric1 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
format,
|
||||
1,
|
||||
pucch_payload1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SR_payload == 1) {
|
||||
pucch_payload = pucch_payload0;
|
||||
|
||||
if (bundling_flag == bundling)
|
||||
pucch_sel = 2;
|
||||
} else if (bundling_flag == multiplexing) { // multiplexing + no SR
|
||||
pucch_payload = (metric1>metric0) ? pucch_payload1 : pucch_payload0;
|
||||
pucch_sel = (metric1>metric0) ? 1 : 0;
|
||||
} else { // bundling + no SR
|
||||
if (n1_pucch1 != -1)
|
||||
pucch_payload = pucch_payload1;
|
||||
else if (n1_pucch0 != -1)
|
||||
pucch_payload = pucch_payload0;
|
||||
|
||||
pucch_sel = 2; // indicate that this is a bundled ACK/NAK
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d ACK/NAK metric 0 %d, metric 1 %d, sel %d, (%d,%d)\n",eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
metric0,metric1,pucch_sel,pucch_payload[0],pucch_payload[1]);
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d pucch1a (FDD) payload %d (metric %d)\n",
|
||||
eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
pucch_payload0[0],metric0);
|
||||
#endif
|
||||
process_HARQ_feedback(UE_id,eNB,proc,
|
||||
0,// pusch_flag
|
||||
pucch_payload,
|
||||
pucch_sel,
|
||||
SR_payload);
|
||||
|
||||
process_HARQ_feedback(UE_id,eNB,proc,
|
||||
0,// pusch_flag
|
||||
pucch_payload0,
|
||||
2,
|
||||
SR_payload);
|
||||
} // FDD
|
||||
else { //TDD
|
||||
|
||||
bundling_flag = eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode;
|
||||
|
||||
// fix later for 2 TB case and format1b
|
||||
|
||||
if ((fp->frame_type==FDD) ||
|
||||
(bundling_flag==bundling) ||
|
||||
((fp->frame_type==TDD)&&(fp->tdd_config==1)&&((subframe!=2)||(subframe!=7)))) {
|
||||
format = pucch_format1a;
|
||||
} else {
|
||||
format = pucch_format1b;
|
||||
}
|
||||
|
||||
// if SR was detected, use the n1_pucch from SR
|
||||
if (SR_payload==1) {
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d Checking ACK/NAK (%d,%d,%d,%d) format %d with SR\n",eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,format);
|
||||
#endif
|
||||
|
||||
if (eNB->abstraction_flag == 0)
|
||||
metric0 = rx_pucch(eNB,
|
||||
format,
|
||||
UE_id,
|
||||
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
else {
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric0 = rx_pucch_emul(eNB,proc,
|
||||
UE_id,
|
||||
format,
|
||||
0,
|
||||
pucch_payload0);
|
||||
#endif
|
||||
}
|
||||
} else { //using n1_pucch0/n1_pucch1 resources
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d Checking ACK/NAK (%d,%d,%d,%d) format %d\n",eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
n1_pucch0,n1_pucch1,n1_pucch2,n1_pucch3,format);
|
||||
#endif
|
||||
metric0=0;
|
||||
metric1=0;
|
||||
|
||||
// Check n1_pucch0 metric
|
||||
if (n1_pucch0 != -1) {
|
||||
if (eNB->abstraction_flag == 0)
|
||||
metric0 = rx_pucch(eNB,
|
||||
format,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch0,
|
||||
0, // n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload0,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
else {
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric0 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
format,
|
||||
0,
|
||||
pucch_payload0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Check n1_pucch1 metric
|
||||
if (n1_pucch1 != -1) {
|
||||
if (eNB->abstraction_flag == 0)
|
||||
metric1 = rx_pucch(eNB,
|
||||
format,
|
||||
UE_id,
|
||||
(uint16_t)n1_pucch1,
|
||||
0, //n2_pucch
|
||||
0, // shortened format
|
||||
pucch_payload1,
|
||||
frame,
|
||||
subframe,
|
||||
PUCCH1a_THRES);
|
||||
else {
|
||||
#ifdef PHY_ABSTRACTION
|
||||
metric1 = rx_pucch_emul(eNB,
|
||||
proc,
|
||||
UE_id,
|
||||
format,
|
||||
1,
|
||||
pucch_payload1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SR_payload == 1) {
|
||||
pucch_payload = pucch_payload0;
|
||||
|
||||
if (bundling_flag == bundling)
|
||||
pucch_sel = 2;
|
||||
} else if (bundling_flag == multiplexing) { // multiplexing + no SR
|
||||
pucch_payload = (metric1>metric0) ? pucch_payload1 : pucch_payload0;
|
||||
pucch_sel = (metric1>metric0) ? 1 : 0;
|
||||
} else { // bundling + no SR
|
||||
if (n1_pucch1 != -1)
|
||||
pucch_payload = pucch_payload1;
|
||||
else if (n1_pucch0 != -1)
|
||||
pucch_payload = pucch_payload0;
|
||||
|
||||
pucch_sel = 2; // indicate that this is a bundled ACK/NAK
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d ACK/NAK metric 0 %d, metric 1 %d, sel %d, (%d,%d)\n",eNB->Mod_id,
|
||||
eNB->dlsch[UE_id][0]->rnti,
|
||||
frame,subframe,
|
||||
metric0,metric1,pucch_sel,pucch_payload[0],pucch_payload[1]);
|
||||
#endif
|
||||
process_HARQ_feedback(UE_id,eNB,proc,
|
||||
0,// pusch_flag
|
||||
pucch_payload,
|
||||
pucch_sel,
|
||||
SR_payload);
|
||||
} // TDD
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
eNB->ulsch[UE_id]->rnti,frame,subframe);
|
||||
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
|
||||
eNB->first_sr[UE_id] = 0;
|
||||
eNB->dlsch[UE_id][0]->harq_processes[0]->round=0;
|
||||
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",
|
||||
eNB->Mod_id,
|
||||
eNB->ulsch[UE_id]->rnti,frame,subframe);
|
||||
}
|
||||
|
||||
if (eNB->mac_enabled==1) {
|
||||
mac_xface->SR_indication(eNB->Mod_id,
|
||||
eNB->CC_id,
|
||||
frame,
|
||||
eNB->dlsch[UE_id][0]->rnti,subframe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3025,6 +3059,13 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
|
||||
frame,
|
||||
&eNB->ulsch[i]->Msg3_frame,
|
||||
&eNB->ulsch[i]->Msg3_subframe);
|
||||
|
||||
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, eNB->ulsch[i]->rnti,
|
||||
eNB->ulsch[i]->Msg3_frame, eNB->ulsch[i]->Msg3_subframe);
|
||||
|
||||
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
|
||||
T_INT(i), T_INT(eNB->ulsch[i]->rnti), T_INT(0 /* 0 is for retransmission*/),
|
||||
T_INT(eNB->ulsch[i]->Msg3_frame), T_INT(eNB->ulsch[i]->Msg3_subframe));
|
||||
}
|
||||
LOG_D(PHY,"[eNB] Frame %d, Subframe %d: Msg3 in error, i = %d \n", frame,subframe,i);
|
||||
} // This is Msg3 error
|
||||
|
||||
@@ -2420,7 +2420,7 @@ int main(int argc, char **argv)
|
||||
phy_procedures_UE_RX(UE,proc,0,0,normal_txrx,no_relay,NULL);
|
||||
|
||||
if (UE->dlsch[0][0]->active == 0) {
|
||||
printf("DCI not received\n");
|
||||
//printf("DCI not received\n");
|
||||
/*
|
||||
write_output("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
|
||||
write_output("pdcch00_ch0_ext.m","pdcch00_ch0_ext",UE->pdcch_vars[eNB_id]->dl_ch_estimates_ext[0],12*UE->frame_parms.N_RB_DL*3,1,1);
|
||||
|
||||
Reference in New Issue
Block a user