Commit 759f5f75 authored by hbilel's avatar hbilel

[OAI-UE] 1- ignore bad dci

           2- reset dataTx buff correctly
           3- pucch/pusch power control fix
parent 8d2bb6cb
......@@ -3885,7 +3885,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
NPRB = RIV2nb_rb_LUT6[rballoc];
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
}
if (vrb_type == LOCALIZED) {
......@@ -3941,7 +3940,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
NPRB = RIV2nb_rb_LUT25[rballoc];
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
}
if (vrb_type == LOCALIZED) {
......@@ -3994,7 +3992,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
NPRB = RIV2nb_rb_LUT50[rballoc];
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
}
if (vrb_type == LOCALIZED) {
......@@ -4061,7 +4058,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
NPRB = RIV2nb_rb_LUT100[rballoc];
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
}
if (vrb_type == LOCALIZED) {
......@@ -4114,6 +4110,17 @@ int generate_ue_dlsch_params_from_dci(int frame,
return(-1);
}
if((mcs>28) && ( (dlsch0_harq->round == 0) || (rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti) ))
{
// DCI false detection
return(-1);
}
if((rv!=0) && (dlsch0_harq->round == 0) && (rnti != si_rnti) && (rnti != p_rnti) && (rnti != ra_rnti))
{
// DCI false detection
return(-1);
}
// change the mcs limit from 7 to 8, supported by MAC
/* if (mcs > 10) {
LOG_E(PHY,"Format 1A: subframe %d unlikely mcs for format 1A (%d), TPC %d rv %d\n",subframe,mcs,TPC,rv);
......@@ -4164,7 +4171,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
if(dlsch0_harq->round)
{
// compare old TBS to new TBS
if(dlsch0_harq->TBS != TBStable[get_I_TBS(mcs)][NPRB-1])
if((mcs<29) && (dlsch0_harq->TBS != TBStable[get_I_TBS(mcs)][NPRB-1]))
{
// this is an eNB issue
// retransmisison but old and new TBS are different !!!
......@@ -4174,12 +4181,17 @@ int generate_ue_dlsch_params_from_dci(int frame,
}
}
if(mcs<29)
{
dlsch0_harq->mcs = mcs;
}
if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) {
dlsch0_harq->TBS = TBStable[mcs][NPRB-1];
dlsch0_harq->Qm = 2;
}
else {
if(mcs < 29)
dlsch0_harq->TBS = TBStable[get_I_TBS(mcs)][NPRB-1];
dlsch0_harq->Qm = get_Qm(mcs);
}
......@@ -4410,14 +4422,27 @@ int generate_ue_dlsch_params_from_dci(int frame,
break;
}
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
if (harq_pid>=8) {
LOG_E(PHY,"Format 1: harq_pid >= 8\n");
return(-1);
}
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
if((mcs>28) && (dlsch0_harq->round == 0) )
{
// DCI false detection
return(-1);
}
if((rv!=0) && (dlsch0_harq->round == 0) )
{
// DCI false detection
return(-1);
}
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
dlsch[0]->current_harq_pid = harq_pid;
dlsch[0]->harq_ack[subframe].harq_id = harq_pid;
......@@ -4441,9 +4466,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
return(-1);
}
// printf("NPRB %d\n",NPRB);
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
if (TPC!=1)
LOG_D(PHY,"format1 TPC %d, dlsch0_harq->delta_PUCCH %d\n",TPC,dlsch0_harq->delta_PUCCH);
......@@ -4470,16 +4492,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
LOG_D(PHY,"[PDSCH %x/%d] Format 1 DCI First TX: Clearing flag\n");
dlsch0_harq->first_tx = 0;
}
} else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
// this happens if either another harq process in the same
// is NAK or an ACK was not received
dlsch[0]->harq_ack[subframe].ack = 1;
dlsch[0]->harq_ack[subframe].harq_id = harq_pid;
dlsch[0]->harq_ack[subframe].send_harq_status = 1;
dlsch[0]->active = 0;
// printf("Got NDI=0 for correctly decoded SDU (harq_pid %d) subframe %d\n",harq_pid,subframe);
return(0);
}
dlsch0_harq->mcs = mcs;
......@@ -4776,7 +4788,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->mcs = mcs1;
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
/*
if (dlsch0_harq->mcs>20) {
printf("dci_tools.c: mcs > 20 disabled for now (asked %d)\n",dlsch0_harq->mcs);
......@@ -5196,9 +5207,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
// printf("NPRB %d\n",NPRB);
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch0->g_pucch += delta_PUCCH_lut[TPC&3];
dlsch1_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch1->g_pucch += delta_PUCCH_lut[TPC&3];
dlsch0_harq->mcs = mcs1;
dlsch1_harq->mcs = mcs2;
......@@ -5449,7 +5458,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->mcs = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->mcs;
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
......@@ -5572,11 +5580,14 @@ int generate_ue_dlsch_params_from_dci(int frame,
#ifdef DEBUG_DCI
if (dlsch[0] && (dlsch[0]->rnti != 0xffff)) {
printf("dci_format:%d Abssubframe: %d.%d \n",dci_format,frame,subframe);
printf("dci_format:%d Abssubframe: %d.%d \n",dci_format,frame%1024,subframe);
printf("PDSCH dlsch0 UE: rnti %x\n",dlsch[0]->rnti);
printf("PDSCH dlsch0 UE: NBRB %d\n",dlsch0_harq->nb_rb);
printf("PDSCH dlsch0 UE: rballoc %x\n",dlsch0_harq->rb_alloc_even[0]);
printf("PDSCH dlsch0 UE: harq_pid %d\n",harq_pid);
printf("PDSCH dlsch0 UE: tpc %d\n",TPC);
printf("PDSCH dlsch0 UE: g %d\n",dlsch[0]->g_pucch);
printf("PDSCH dlsch0 UE: round %d\n",dlsch0_harq->round);
printf("PDSCH dlsch0 UE: DCINdi %d\n",dlsch0_harq->DCINdi);
printf("PDSCH dlsch0 UE: rvidx %d\n",dlsch0_harq->rvidx);
printf("PDSCH dlsch0 UE: TBS %d\n",dlsch0_harq->TBS);
......
......@@ -205,9 +205,6 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
int gain_dB = power_dBm - power_max_dBm;
double gain_lin;
//if (gain_dB < -20)
// return(AMP/10);
gain_lin = pow(10,.1*gain_dB);
if ((nb_rb >0) && (nb_rb <= N_RB_UL)) {
return((int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb)));
......@@ -934,7 +931,7 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
*/
#endif
void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) {
void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empty_subframe) {
int aa;
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
......@@ -971,6 +968,37 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) {
#else //this is the normal case
ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance;
#endif //else EXMIMO
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
if (empty_subframe)
{
//#if 1
overflow = ulsch_start - 9*frame_parms->samples_per_tti;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memset(&ue->common_vars.txdata[aa][ulsch_start],0,4*cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti));
if (overflow> 0)
memset(&ue->common_vars.txdata[aa][0],0,4*overflow);
}
/*#else
overflow = ulsch_start - 9*frame_parms->samples_per_tti;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
for (k=ulsch_start; k<cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++) {
((short*)ue->common_vars.txdata[aa])[2*k] = 0;
((short*)ue->common_vars.txdata[aa])[2*k+1] = 0;
}
for (k=0; k<overflow; k++) {
((short*)ue->common_vars.txdata[aa])[2*k] = 0;
((short*)ue->common_vars.txdata[aa])[2*k+1] = 0;
}
}
#endif*/
return;
}
#endif
if ((frame_tx%100) == 0)
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: ulsch_start = %d (rxoff %d, HW TA %d, timing advance %d, TA_offset %d\n",
ue->Mod_id,frame_tx,subframe_tx,
......@@ -1978,25 +2006,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
if (abstraction_flag == 0) {
if (ue->generate_ul_signal[eNB_id] == 1 )
{
ulsch_common_procedures(ue,proc);
}
else { // no uplink so clear signal buffer instead
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case
ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-
ue->hw_timing_advance-
ue->timing_advance-
ue->N_TA_offset+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
#else //this is the normal case
ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance;
#endif //else EXMIMO
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memset(&ue->common_vars.txdata[aa][ulsch_start],0,frame_parms->samples_per_tti<<2);
}
}
ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[eNB_id] == 0));
} // mode != PRACH
......@@ -2602,6 +2612,15 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
P_RNTI,
ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id])==0)) {
// update TPC for PUCCH
if((dci_alloc_rx[i].format == format1) ||
(dci_alloc_rx[i].format == format1A) ||
(dci_alloc_rx[i].format == format2) ||
(dci_alloc_rx[i].format == format2A))
{
ue->dlsch[eNB_id][0]->g_pucch += ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->delta_PUCCH;
}
ue->dlsch_received[eNB_id]++;
#ifdef DEBUG_PHY_PROC
......
......@@ -34,10 +34,10 @@
#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/extern.h"
int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt)
int16_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt)
{
int8_t Po_PUCCH;
int16_t Po_PUCCH;
//uint8_t harq_pid;
// P_pucch = P_opucch+ PL + h(nCQI,nHARQ) + delta_pucchF(pucch_fmt) + g(i))
......
......@@ -103,13 +103,13 @@ int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rn
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid)
{
uint32_t Nre = ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial *
uint32_t Nre = 2*ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial *
ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb*12;
if (Nre==0)
return(0);
uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->sumKr/Nre;
uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS/Nre;
// Note: MPR=is the effective spectral efficiency of the PUSCH
// FK 20140908 sumKr is only set after the ulsch_encoding
......@@ -174,8 +174,8 @@ void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_
else if (ue->ulsch[eNB_id]->PHR > 40)
ue->ulsch[eNB_id]->PHR = 40;
LOG_D(PHY,"[UE %d][PUSCH %d] frame %d, subframe %d: Po_PUSCH %d dBm : tx power %d, Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n",
ue->Mod_id,harq_pid,proc->frame_tx,proc->subframe_tx,
LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubframe %d.%d: nb_rb: %d, Po_PUSCH %d dBm : tx power %d, Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n",
ue->Mod_id,harq_pid,proc->frame_tx,proc->subframe_tx,nb_rb,
ue->ulsch[eNB_id]->Po_PUSCH,
ue->tx_power_max_dBm,
ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
......
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