Commit bc02d1c7 authored by hbilel's avatar hbilel

[OAI-UE] new pucch procedure to support all formats

parent f9f83b20
......@@ -3184,7 +3184,7 @@ void dlsch_channel_level_TM7(int **dl_bf_ch_estimates_ext,
#endif
}
#define ONE_OVER_2_Q15 16384
void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
int **dl_ch_mag,
......@@ -3203,7 +3203,7 @@ void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t pilots = ((symbol_mod==0)||(symbol_mod==(4-frame_parms->Ncp))) ? 1 : 0;
rxF0_128 = (__m128i*) &rxdataF_comp[0][jj];
amp = _mm_set1_epi16(ONE_OVER_SQRT2_Q15);
amp = _mm_set1_epi16(ONE_OVER_2_Q15);
// printf("Doing alamouti!\n");
rxF0 = (short*)&rxdataF_comp[0][jj]; //tx antenna 0 h0*y
......@@ -3240,25 +3240,30 @@ void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms,
ch_mag0b[1] = _mm_adds_epi16(ch_mag0b[1],ch_mag1b[1]);
// account for 1/sqrt(2) scaling at transmission
ch_mag0[0] = _mm_srai_epi16(ch_mag0[0],1);
ch_mag0[1] = _mm_srai_epi16(ch_mag0[1],1);
ch_mag0b[0] = _mm_srai_epi16(ch_mag0b[0],1);
ch_mag0b[1] = _mm_srai_epi16(ch_mag0b[1],1);
//ch_mag0[0] = _mm_srai_epi16(ch_mag0[0],1);
//ch_mag0[1] = _mm_srai_epi16(ch_mag0[1],1);
//ch_mag0b[0] = _mm_srai_epi16(ch_mag0b[0],1);
//ch_mag0b[1] = _mm_srai_epi16(ch_mag0b[1],1);
rxF0_128[0] = _mm_mulhi_epi16(rxF0_128[0],amp);
rxF0_128[0] = _mm_slli_epi16(rxF0_128[0],1);
rxF0_128[1] = _mm_mulhi_epi16(rxF0_128[1],amp);
rxF0_128[1] = _mm_slli_epi16(rxF0_128[1],1);
//rxF0_128[0] = _mm_mulhi_epi16(rxF0_128[0],amp);
//rxF0_128[0] = _mm_slli_epi16(rxF0_128[0],1);
//rxF0_128[1] = _mm_mulhi_epi16(rxF0_128[1],amp);
//rxF0_128[1] = _mm_slli_epi16(rxF0_128[1],1);
//rxF0_128[0] = _mm_srai_epi16(rxF0_128[0],1);
//rxF0_128[1] = _mm_srai_epi16(rxF0_128[1],1);
if (pilots==0) {
ch_mag0[2] = _mm_adds_epi16(ch_mag0[2],ch_mag1[2]);
ch_mag0b[2] = _mm_adds_epi16(ch_mag0b[2],ch_mag1b[2]);
ch_mag0[2] = _mm_srai_epi16(ch_mag0[2],1);
ch_mag0b[2] = _mm_srai_epi16(ch_mag0b[2],1);
//ch_mag0[2] = _mm_srai_epi16(ch_mag0[2],1);
//ch_mag0b[2] = _mm_srai_epi16(ch_mag0b[2],1);
//rxF0_128[2] = _mm_mulhi_epi16(rxF0_128[2],amp);
//rxF0_128[2] = _mm_slli_epi16(rxF0_128[2],1);
rxF0_128[2] = _mm_mulhi_epi16(rxF0_128[2],amp);
rxF0_128[2] = _mm_slli_epi16(rxF0_128[2],1);
//rxF0_128[2] = _mm_srai_epi16(rxF0_128[2],1);
ch_mag0+=3;
ch_mag1+=3;
......
......@@ -1375,11 +1375,7 @@ void rx_phich(PHY_VARS_UE *ue,
HI16,
nseq_PHICH,
ngroup_PHICH);
get_Msg3_alloc_ret(&ue->frame_parms,
subframe,
proc->frame_rx,
&ue->ulsch_Msg3_frame[eNB_id],
&ue->ulsch_Msg3_subframe[eNB_id]);
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
// ulsch->harq_processes[harq_pid]->Ndi = 0;
ulsch->harq_processes[harq_pid]->round++;
......
......@@ -19,126 +19,126 @@
* contact@openairinterface.org
*/
#include "PHY/defs.h"
#include "PHY/impl_defs_lte.h"
//#define DEBUG_PC 1
/*
double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0},
{ 5.0/4.0,1.0,3.0/4.0,1.0/2.0}};
*/
double ratioPB[2][4]= {{ 0.00000, -0.96910, -2.21849, -3.97940},
{ 0.96910, 0.00000, -1.24939, -3.01030}
};
double pa_values[8]= {-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0};
double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated)
{
return(pa_values[pdsch_config_dedicated->p_a]);
}
double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_eNB_DLSCH_t *dlsch_eNB,int dl_power_off)
{
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off)
rho_a_dB-=10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC
printf("sqrt_rho_a(eNB):%d\n",dlsch_eNB->sqrt_rho_a);
#endif
return(rho_a_dB);
}
double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common,
uint8_t n_antenna_port,
LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off)
{
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_eNB(pdsch_config_dedicated,dlsch_eNB,dl_power_off);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB;
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
#ifdef DEBUG_PC
printf("sqrt_rho_b(eNB):%d\n",dlsch_eNB->sqrt_rho_b);
#endif
return(rho_b_dB);
}
double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off)
{
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off)
rho_a_dB-=10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC
printf("sqrt_rho_a(ue):%d\n",dlsch_ue->sqrt_rho_a);
#endif
return(rho_a_dB);
}
double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common,
uint8_t n_antenna_port,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off)
{
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB;
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
dlsch_ue->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
#ifdef DEBUG_PC
printf("sqrt_rho_b(ue):%d\n",dlsch_ue->sqrt_rho_b);
#endif
return(rho_b_dB);
}
#include "PHY/defs.h"
#include "PHY/impl_defs_lte.h"
//#define DEBUG_PC 1
/*
double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0},
{ 5.0/4.0,1.0,3.0/4.0,1.0/2.0}};
*/
double ratioPB[2][4]= {{ 0.00000, -0.96910, -2.21849, -3.97940},
{ 0.96910, 0.00000, -1.24939, -3.01030}
};
double pa_values[8]= {-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0};
double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated)
{
return(pa_values[pdsch_config_dedicated->p_a]);
}
double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_eNB_DLSCH_t *dlsch_eNB,int dl_power_off)
{
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off)
rho_a_dB-=10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC
printf("sqrt_rho_a(eNB):%d\n",dlsch_eNB->sqrt_rho_a);
#endif
return(rho_a_dB);
}
double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common,
uint8_t n_antenna_port,
LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off)
{
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_eNB(pdsch_config_dedicated,dlsch_eNB,dl_power_off);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB;
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
#ifdef DEBUG_PC
printf("sqrt_rho_b(eNB):%d\n",dlsch_eNB->sqrt_rho_b);
#endif
return(rho_b_dB);
}
double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off)
{
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off)
rho_a_dB-=10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC
printf("p_a %d, rho_a_dB: %f, sqrt_rho_a(ue):%d \n",pdsch_config_dedicated->p_a, rho_a_dB, dlsch_ue->sqrt_rho_a);
#endif
return(rho_a_dB);
}
double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common,
uint8_t n_antenna_port,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off)
{
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB;
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
dlsch_ue->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
#ifdef DEBUG_PC
printf("p_b : %d, rho_b_dB: %f, sqrt_rho_b(ue):%d\n",pdsch_config_common->p_b, rho_b_dB, dlsch_ue->sqrt_rho_b);
#endif
return(rho_b_dB);
}
......@@ -1849,7 +1849,7 @@ void generate_pucch2x(int32_t **txdataF,
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint16_t *payload,
uint8_t *payload,
int A,
int B2,
int16_t amp,
......
......@@ -473,7 +473,7 @@ void generate_pucch2x(int32_t **txdataF,
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint16_t *payload,
uint8_t *payload,
int A,
int B2,
int16_t amp,
......
......@@ -2067,7 +2067,7 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc,
get_ack(&eNB->frame_parms,
PHY_vars_UE_g[UE_id][CC_id]->dlsch[0][0]->harq_ack,
subframe,
eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK);
eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK,0);
} else { // get remote UEs' ack
eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[0];
eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[1] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[1];
......
......@@ -305,7 +305,7 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
@param o_ACK Pointer to ACK/NAK payload for PUCCH/PUSCH
@returns status indicator for PUCCH/PUSCH transmission
*/
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe,uint8_t *o_ACK);
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe,uint8_t *o_ACK, uint8_t cw_idx);
/*! \brief Reset ACK/NACK information
@param frame_parms Pointer to DL frame parameter descriptor
......@@ -317,7 +317,8 @@ uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t
uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK);
unsigned char *o_ACK,
uint8_t cw_idx);
/*! \brief Compute UL ACK subframe from DL subframe. This is used to retrieve corresponding DLSCH HARQ pid at eNB upon reception of ACK/NAK information on PUCCH/PUSCH. Derived from Table 10.1-1 in 36.213 (p. 69 in version 8.6)
@param frame_parms Pointer to DL frame parameter descriptor
......
......@@ -325,6 +325,7 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK,
uint8_t cw_idx,
uint8_t do_reset) // 1 to reset ACK/NACK status : 0 otherwise
{
uint8_t status=0;
......@@ -337,7 +338,7 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
else
subframe_dl0 = subframe - 4;
o_ACK[0] = harq_ack[subframe_dl0].ack;
o_ACK[cw_idx] = harq_ack[subframe_dl0].ack;
status = harq_ack[subframe_dl0].send_harq_status;
if(do_reset)
......@@ -484,17 +485,19 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK)
unsigned char *o_ACK,
uint8_t cw_idx)
{
return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, 0);
return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, cw_idx, 0);
}
uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK)
unsigned char *o_ACK,
uint8_t cw_idx)
{
return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, 1);
return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, cw_idx, 1);
}
......
......@@ -639,7 +639,7 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id
uint8_t pucch_ack_payload[2];
if (get_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,pucch_ack_payload) > 0)
subframe_tx,pucch_ack_payload,0) > 0)
{
is_sr_an_subframe = 1;
}
......@@ -737,6 +737,60 @@ void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id)
}
}
PUCCH_FMT_t get_pucch_format(lte_frame_type_t frame_type,
lte_prefix_type_t cyclic_prefix_type,
uint8_t SR_payload,
uint8_t nb_cw,
uint8_t cqi_status,
uint8_t ri_status)
{
if((cqi_status == 0) && (ri_status==0))
{
// PUCCH Format 1 1a 1b
// 1- SR only ==> PUCCH format 1
// 2- 1bit Ack/Nack with/without SR ==> PUCCH format 1a
// 3- 2bits Ack/Nack with/without SR ==> PUCCH format 1b
if(nb_cw == 1)
{
return pucch_format1a;
}
if(nb_cw == 2)
{
return pucch_format1b;
}
if(SR_payload == 1)
{
return pucch_format1;
}
}
else
{
// PUCCH Format 2 2a 2b
// 1- CQI only or RI only ==> PUCCH format 2
// 2- CQI or RI + 1bit Ack/Nack for normal CP ==> PUCCH format 2a
// 3- CQI or RI + 2bits Ack/Nack for normal CP ==> PUCCH format 2b
// 4- CQI or RI + Ack/Nack for extended CP ==> PUCCH format 2
if(nb_cw == 0)
{
return pucch_format2;
}
if(cyclic_prefix_type == NORMAL)
{
if(nb_cw == 1)
{
return pucch_format2a;
}
if(nb_cw == 2)
{
return pucch_format2b;
}
}
else
{
return pucch_format2;
}
}
}
uint16_t get_n1_pucch(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
harq_status_t *harq_ack,
......@@ -1022,7 +1076,8 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
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));
memset(&ue->common_vars.txdata[aa][ulsch_start],0,
4*cmin(frame_parms->samples_per_tti-overflow,frame_parms->samples_per_tti));
if (overflow> 0)
memset(&ue->common_vars.txdata[aa][0],0,4*overflow);
......@@ -1381,7 +1436,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ack_status = reset_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
ue->ulsch[eNB_id]->o_ACK,0);
Nbundled = ack_status;
first_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb;
nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb;
......@@ -1394,7 +1449,14 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
// check if we received a PDSCH at subframe_tx - 4
// ==> send ACK/NACK on PUSCH
ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = ack_status;
if( (ue->dlsch[eNB_id][0]->harq_ack[proc->subframe_rx].send_harq_status) == 1)
{
ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 1;
}
else
{
ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 0;
}
#if T_TRACER
if(ue->ulsch[eNB_id]->o_ACK[0])
......@@ -1421,7 +1483,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,
"[UE %d][PUSCH %d] Frame %d subframe %d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, bundling %d\n",
"[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, bundling %d\n",
Mod_id,harq_pid,frame_tx,subframe_tx,
first_rb,nb_rb,
ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,
......@@ -1684,17 +1746,79 @@ int16_t get_pucch2_ri(PHY_VARS_UE *ue,int eNB_id) {
return(1);
}
void get_pucch_param(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
uint8_t *ack_payload,
PUCCH_FMT_t format,
uint8_t eNB_id,
uint8_t SR,
uint8_t cqi_report,
uint16_t *pucch_resource,
uint8_t *pucch_payload,
uint16_t *plength)
{
switch (format) {
case pucch_format1:
{
pucch_resource[0] = ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex;
pucch_payload[0] = 0; // payload is ignored in case of format1
pucch_payload[1] = 0; // payload is ignored in case of format1
}
break;
case pucch_format1a:
case pucch_format1b:
{
pucch_resource[0] = get_n1_pucch(ue,
proc,
ue->dlsch[eNB_id][0]->harq_ack,
eNB_id,
ack_payload,
SR);
pucch_payload[0] = ack_payload[0];
//pucch_payload[1] = ack_payload[1];
pucch_payload[1] = 1;
}
break;
case pucch_format2:
{
pucch_resource[0] = ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex;
if(cqi_report)
{
pucch_payload[0] = get_pucch2_cqi(ue,eNB_id,plength);
}
else
{
*plength = 1;
pucch_payload[0] = get_pucch2_ri(ue,eNB_id);
}
}
break;
case pucch_format2a:
case pucch_format2b:
LOG_E(PHY,"NO Resource available for PUCCH 2a/2b \n");
break;
}
}
void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) {
uint8_t pucch_ack_payload[2];
uint8_t n1_pucch,n2_pucch;
uint8_t pucch_ack_payload[2];
uint8_t n1_pucch,n2_pucch;
uint16_t pucch_resource;
ANFBmode_t bundling_flag;
PUCCH_FMT_t format;
uint8_t SR_payload;
uint8_t SR_payload;
uint16_t CQI_payload;
uint16_t RI_payload;
uint8_t pucch_payload[2];
uint16_t len;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int frame_tx=proc->frame_tx;
......@@ -1704,6 +1828,11 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
int tx_amp;
int16_t Po_PUCCH;
uint8_t ack_status=0;
uint8_t ack_status_cw0=0;
uint8_t ack_status_cw1=0;
uint8_t nb_cw=0;
uint8_t cqi_status=0;
uint8_t ri_status=0;
uint8_t ack_sr_generated = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_IN);
......@@ -1741,312 +1870,254 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
LOG_D(PHY,"[UE] PUCCH 1b\n");
}
// Check for SR and do ACK/NACK accordingly
if (is_SR_TXOp(ue,proc,eNB_id)==1) {
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n",
Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame_tx,subframe_tx);
if (ue->mac_enabled==1) {
SR_payload = mac_xface->ue_get_SR(Mod_id,
CC_id,
frame_tx,
eNB_id,
ue->pdcch_vars[eNB_id]->crnti,
subframe_tx); // subframe used for meas gap
}
else {
SR_payload = 1;
}
if (SR_payload>0) {
ue->generate_ul_signal[eNB_id] = 1;
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n",
Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame_tx,subframe_tx,SR_payload);
} else {
ue->sr[subframe_tx]=0;
}
} else {
SR_payload=0;
}
ack_status = get_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,pucch_ack_payload);
if (ack_status > 0) {
// we need to transmit ACK/NAK in this subframe
ue->generate_ul_signal[eNB_id] = 1;
ack_sr_generated = 1;
if ((frame_parms->frame_type == TDD) && (SR_payload>0)) {
format = pucch_format1b;
}
n1_pucch = get_n1_pucch(ue,
proc,
ue->dlsch[eNB_id][0]->harq_ack,
eNB_id,
pucch_ack_payload,
SR_payload);
if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
}
else {
Po_PUCCH = ue->tx_power_max_dBm;
}
ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12;
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
1);
#else
tx_amp = AMP;
#endif
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
if (SR_payload>0) {
LOG_D(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx % 1024, subframe_tx,
(format == pucch_format1a? "1a": (
format == pucch_format1b? "1b" : "??")),
pucch_ack_payload[0],pucch_ack_payload[1],
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
Po_PUCCH,
tx_amp);
} else {
LOG_D(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx, subframe_tx,ue->rx_offset_diff,
(format == pucch_format1a? "1a": (
format == pucch_format1b? "1b" : "??")),
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload,
Po_PUCCH,
tx_amp);
}
#if T_TRACER
if(pucch_ack_payload[0])
{
LOG_I(PHY,"PUCCH ACK\n");
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
else
{
LOG_I(PHY,"PUCCH NACK\n");
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
#endif
if (abstraction_flag == 0) {
generate_pucch1x(ue->common_vars.txdataF,
&ue->frame_parms,
ue->ncs_cell,
format,
&ue->pucch_config_dedicated[eNB_id],
n1_pucch,
isShortenPucch, // shortened format
pucch_ack_payload,
tx_amp,
subframe_tx);
} else {
#ifdef PHY_ABSTRACTION
LOG_D(PHY,"Calling generate_pucch_emul ... (ACK %d %d, SR %d)\n",pucch_ack_payload[0],pucch_ack_payload[1],SR_payload);
generate_pucch_emul(ue,
proc,
format,
ue->frame_parms.pucch_config_common.nCS_AN,
pucch_ack_payload,
SR_payload);
#endif
}
} else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC
// Part - I
// Collect feedback that should be transmitted at this subframe
// - SR
// - ACK/NACK
// - CQI
// - RI
SR_payload = 0;
if (is_SR_TXOp(ue,proc,eNB_id)==1)
{
if (ue->mac_enabled==1) {
SR_payload = mac_xface->ue_get_SR(Mod_id,
CC_id,
frame_tx,
eNB_id,
ue->pdcch_vars[eNB_id]->crnti,
subframe_tx); // subframe used for meas gap
}
else {
SR_payload = 1;
}
}
ack_sr_generated = 1;
if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,pucch_format1);
}
else {
Po_PUCCH = ue->tx_power_max_dBm;
}
ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12;
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
1);
#else
tx_amp = AMP;
#endif
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx, subframe_tx,
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
Po_PUCCH);
if (abstraction_flag == 0) {
generate_pucch1x(ue->common_vars.txdataF,
&ue->frame_parms,
ue->ncs_cell,
pucch_format1,
&ue->pucch_config_dedicated[eNB_id],
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
isShortenPucch, // shortened format
pucch_ack_payload, // this is ignored anyway, we just need a pointer
tx_amp,
subframe_tx);
} else {
LOG_D(PHY,"Calling generate_pucch_emul ...\n");
generate_pucch_emul(ue,
proc,
pucch_format1,
ue->frame_parms.pucch_config_common.nCS_AN,
pucch_ack_payload,
SR_payload);
ack_status_cw0 = reset_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,
pucch_ack_payload,
0);
}
} // SR_Payload==1
ack_status_cw1 = reset_ack(&ue->frame_parms,
ue->dlsch[eNB_id][1]->harq_ack,
subframe_tx,
pucch_ack_payload,
1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
// PUCCH 2x
nb_cw = ack_status_cw0 + ack_status_cw1;
if (ack_sr_generated == 0) { // we have not generated ACK/NAK/SR in this subframe
cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&&
(is_cqi_TXOp(ue,proc,eNB_id)==1));
n2_pucch = ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex;
// only use format2 for now, i.e. now ACK/NAK - CQI multiplexing
format = pucch_format2;
ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
(is_ri_TXOp(ue,proc,eNB_id)==1));
// Periodic CQI report
if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&&
(is_cqi_TXOp(ue,proc,eNB_id)==1)){
// Part - II
// if nothing to report ==> exit function
if( (nb_cw==0) && (SR_payload==0) && (cqi_status==0) && (ri_status==0))
{
LOG_I(PHY,"PUCCH No feedback AbsSubframe %d.%d Return \n", frame_tx, subframe_tx, SR_payload, nb_cw, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status);
return;
}
// Part - III
// Decide which PUCCH format should be used if needed
format = get_pucch_format(frame_parms->frame_type,
frame_parms->Ncp,
SR_payload,
nb_cw,
cqi_status,
ri_status);
// Determine PUCCH resources and payload: mandatory for pucch encoding
get_pucch_param(ue,
proc,
pucch_ack_payload,
format,
eNB_id,
SR_payload,
cqi_status,
&pucch_resource,
&pucch_payload,
&len);
LOG_I(PHY,"PUCCH feedback AbsSubframe %d.%d SR %d NbCW %d AckNack %d.%d CQI %d RI %d format %d pucch_resource %d pucch_payload %d %d \n", frame_tx, subframe_tx, SR_payload, nb_cw, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status, ri_status, format, pucch_resource,pucch_payload[0],pucch_payload[1]);
// Part - IV
// Generate PUCCH signal
ue->generate_ul_signal[eNB_id] = 1;
switch (format) {
case pucch_format1:
case pucch_format1a:
case pucch_format1b:
{
if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
}
else {
Po_PUCCH = ue->tx_power_max_dBm;
Po_PUCCH = ue->tx_power_max_dBm;
}
ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12;
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
1);
tx_amp = get_tx_amp(Po_PUCCH,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
1);
#else
tx_amp = AMP;
#endif
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
int len;
// get the payload : < 12 bits, returned in len
CQI_payload = get_pucch2_cqi(ue,eNB_id,&len);
generate_pucch2x(ue->common_vars.txdataF,
&ue->frame_parms,
ue->ncs_cell,
format,
&ue->pucch_config_dedicated[eNB_id],
n2_pucch,
&CQI_payload,
len, // A
0, // B2 not needed
tx_amp,
subframe_tx,
ue->pdcch_vars[eNB_id]->crnti);
if(format == pucch_format1)
{
LOG_I(PHY,"[UE %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx, subframe_tx,
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
Po_PUCCH);
}
else
{
if (SR_payload>0) {
LOG_I(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx % 1024, subframe_tx,
(format == pucch_format1a? "1a": (
format == pucch_format1b? "1b" : "??")),
pucch_ack_payload[0],pucch_ack_payload[1],
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
pucch_resource,
Po_PUCCH,
tx_amp);
} else {
LOG_I(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx%1024, subframe_tx,ue->rx_offset_diff,
(format == pucch_format1a? "1a": (
format == pucch_format1b? "1b" : "??")),
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
pucch_resource,pucch_payload[0],pucch_payload[1],SR_payload,
Po_PUCCH,
tx_amp);
}
}
ue->generate_ul_signal[eNB_id] = 1;
#if T_TRACER
if(pucch_payload[0])
{
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
else
{
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
#endif
LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (CQI %d), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx, subframe_tx,CQI_payload,
n2_pucch,
Po_PUCCH,
isShortenPucch,
tx_amp);
if (abstraction_flag == 0) {
generate_pucch1x(ue->common_vars.txdataF,
&ue->frame_parms,
ue->ncs_cell,
format,
&ue->pucch_config_dedicated[eNB_id],
pucch_resource,
isShortenPucch, // shortened format
pucch_payload,
tx_amp,
subframe_tx);
} else {
#ifdef PHY_ABSTRACTION
LOG_D(PHY,"Calling generate_pucch_emul ... (ACK %d %d, SR %d)\n",pucch_ack_payload[0],pucch_ack_payload[1],SR_payload);
generate_pucch_emul(ue,
proc,
format,
ue->frame_parms.pucch_config_common.nCS_AN,
pucch_payload,
SR_payload);
#endif
}
}
break;
}
// Periodic RI report
else if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
(is_ri_TXOp(ue,proc,eNB_id)==1)){
case pucch_format2:
{
if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
}
else {
Po_PUCCH = ue->tx_power_max_dBm;
Po_PUCCH = ue->tx_power_max_dBm;
}
ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12;
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
1);
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
1);
#else
tx_amp = AMP;
#endif
LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx, subframe_tx,
n2_pucch,
Po_PUCCH,
isShortenPucch,
tx_amp);
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
RI_payload = get_pucch2_ri(ue,eNB_id);
LOG_I(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx%1024, subframe_tx,
n2_pucch,
Po_PUCCH,
isShortenPucch,
tx_amp);
generate_pucch2x(ue->common_vars.txdataF,
&ue->frame_parms,
ue->ncs_cell,
format,
&ue->pucch_config_dedicated[eNB_id],
n2_pucch,
&RI_payload,
1, // A
0, // B2 not needed
tx_amp,
subframe_tx,
ue->pdcch_vars[eNB_id]->crnti);
ue->generate_ul_signal[eNB_id] = 1;
}
&ue->frame_parms,
ue->ncs_cell,
format,
&ue->pucch_config_dedicated[eNB_id],
pucch_resource,
pucch_payload,
len, // A
0, // B2 not needed
tx_amp,
subframe_tx,
ue->pdcch_vars[eNB_id]->crnti);
}
break;
case pucch_format2a:
LOG_I(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2a (RI or CQI) Ack/Nack 1bit \n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx%1024, subframe_tx);
break;
case pucch_format2b:
LOG_I(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2b (RI or CQI) Ack/Nack 2bits\n",
Mod_id,
ue->dlsch[eNB_id][0]->rnti,
frame_tx%1024, subframe_tx);
break;
default:
break;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
......@@ -2186,14 +2257,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
reset_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
ue->ulsch[eNB_id]->o_ACK,0);
reset_ack(&ue->frame_parms,
ue->dlsch_SI[eNB_id]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK,0);
if (ue->dlsch_SI[eNB_id])
reset_ack(&ue->frame_parms,
ue->dlsch_SI[eNB_id]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
stop_meas(&ue->phy_proc_tx);
......@@ -2606,19 +2676,19 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
#endif
} else {
/*
LOG_E(PHY,"[UE %d] frame %d, subframe %d, Error decoding PBCH!\n",
ue->Mod_id,frame_rx, subframe_rx);
/*
LOG_I(PHY,"[UE %d] rx_offset %d\n",ue->Mod_id,ue->rx_offset);
write_output("rxsig0.m","rxs0", ue->common_vars.rxdata[0],ue->frame_parms.samples_per_tti,1,1);
write_output("H00.m","h00",&(ue->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[0][0][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("H10.m","h10",&(ue->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[0][2][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("H00.m","h00",&(ue->common_vars.dl_ch_estimates[0][0][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("H10.m","h10",&(ue->common_vars.dl_ch_estimates[0][2][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("rxsigF0.m","rxsF0", ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[0],8*ue->frame_parms.ofdm_symbol_size,1,1);
write_output("rxsigF0.m","rxsF0", ue->common_vars.rxdataF[0],8*ue->frame_parms.ofdm_symbol_size,1,1);
write_output("PBCH_rxF0_ext.m","pbch0_ext",ue->pbch_vars[0]->rxdataF_ext[0],12*4*6,1,1);
write_output("PBCH_rxF0_comp.m","pbch0_comp",ue->pbch_vars[0]->rxdataF_comp[0],12*4*6,1,1);
write_output("PBCH_rxF_llr.m","pbch_llr",ue->pbch_vars[0]->llr,(ue->frame_parms.Ncp==0) ? 1920 : 1728,1,4);
......@@ -2754,7 +2824,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
#endif
LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d, Mode %s: DCI found %i\n",ue->Mod_id,frame_rx%1024,subframe_rx,mode_string[ue->UE_mode[eNB_id]],dci_cnt);
LOG_I(PHY,"[UE %d] AbsSubFrame %d.%d, Mode %s: DCI found %i\n",ue->Mod_id,frame_rx%1024,subframe_rx,mode_string[ue->UE_mode[eNB_id]],dci_cnt);
ue->pdcch_vars[eNB_id]->dci_received += dci_cnt;
......@@ -2771,9 +2841,9 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
(dci_alloc_rx[i].format != format0)) {
LOG_D(PHY,"[UE %d][DCI][PDSCH %x] frame %d, subframe %d: format %d, num_pdcch_symbols %d, nCCE %d, total CCEs %d\n",
LOG_I(PHY,"[UE %d][DCI][PDSCH %x] frame %d, subframe %d: format %d, num_pdcch_symbols %d, nCCE %d, total CCEs %d\n",
ue->Mod_id,dci_alloc_rx[i].rnti,
frame_rx,subframe_rx,
frame_rx%1024,subframe_rx,
dci_alloc_rx[i].format,
ue->pdcch_vars[eNB_id]->num_pdcch_symbols,
ue->pdcch_vars[eNB_id]->nCCE[subframe_rx],
......@@ -2802,8 +2872,10 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
// update TPC for PUCCH
if((dci_alloc_rx[i].format == format1) ||
(dci_alloc_rx[i].format == format1A) ||
(dci_alloc_rx[i].format == format1B) ||
(dci_alloc_rx[i].format == format2) ||
(dci_alloc_rx[i].format == format2A))
(dci_alloc_rx[i].format == format2A) ||
(dci_alloc_rx[i].format == format2B))
{
ue->dlsch[eNB_id][0]->g_pucch += ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->delta_PUCCH;
}
......@@ -2970,14 +3042,17 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
#endif
}
}
/* else if( (dci_alloc_rx[i].rnti == ue->ulsch[eNB_id]->cba_rnti[0]) &&
} else if( (dci_alloc_rx[i].rnti == ue->ulsch[eNB_id]->cba_rnti[0]) &&
(dci_alloc_rx[i].format == format0)) {
// UE could belong to more than one CBA group
// ue->Mod_id%ue->ulsch[eNB_id]->num_active_cba_groups]
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d: Found cba rnti %x, format 0, dci_cnt %d\n",
ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i);
/*
if (((frame_rx%100) == 0) || (frame_rx < 20))
dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
*/
#endif
ue->ulsch_no_allocation_counter[eNB_id] = 0;
......@@ -3001,8 +3076,9 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
LOG_D(PHY,"[UE %d] Generate UE ULSCH CBA_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
#endif
ue->ulsch[eNB_id]->num_cba_dci[(subframe_rx+4)%10]++;
}
*/
}
}
else {
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti,
......
......@@ -88,17 +88,17 @@ int16_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,u
}
if (pucch_fmt!=pucch_format1) {
LOG_D(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n",
LOG_D(PHY,"[UE %d][PDSCH %x] AbsSubframe %d.%d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n",
ue->Mod_id,
ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe,
ue->dlsch[eNB_id][0]->rnti,proc->frame_tx%1024,subframe,
Po_PUCCH,
ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
get_PL(ue->Mod_id,ue->CC_id,eNB_id),
ue->dlsch[eNB_id][0]->g_pucch);
} else {
LOG_D(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n",
LOG_D(PHY,"[UE %d][SR %x] AbsSubframe %d.%d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n",
ue->Mod_id,
ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe,
ue->dlsch[eNB_id][0]->rnti,proc->frame_tx%1024,subframe,
Po_PUCCH,
ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
get_PL(ue->Mod_id,ue->CC_id,eNB_id),
......
......@@ -1095,6 +1095,17 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio
memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo,
(char*)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo,
sizeof(physicalConfigDedicated2->antennaInfo));
UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode =
radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode;
UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.codebookSubsetRestriction =
radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.codebookSubsetRestriction;
UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection =
radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection;
LOG_I(PHY,"New Transmission Mode %d \n",radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
LOG_I(PHY,"Configured Transmission Mode %d \n",UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode);
}
else
{
......@@ -3131,13 +3142,13 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 )
sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig );
LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission : %d\n",
sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission );
#if 0
/* TODO: test this - commented for the moment */
if (sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n",
/* TODO: check that it's okay to access [0] */
sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts[0] );
#endif
if(sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
{
LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n",
/* TODO: check that it's okay to access [0] */
sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts[0] );
}
}
// uplinkPowerControlCommon
......
......@@ -209,6 +209,8 @@ int chain_offset=0;
int phy_test = 0;
uint8_t usim_test = 0;
uint8_t nb_antenna_tx = 1;
uint8_t nb_antenna_rx = 1;
char ref[128] = "internal";
char channels[128] = "0";
......@@ -379,6 +381,7 @@ void help (void) {
printf(" --ue-rxgain set UE RX gain\n");
printf(" --ue-rxgain-off external UE amplifier offset\n");
printf(" --ue-txgain set UE TX gain\n");
printf(" --ue-nb-ant-rx set UE number of rx antennas ");
printf(" --ue-scan_carrier set UE to scan around carrier\n");
printf(" --loop-memory get softmodem (UE) to loop through memory instead of acquiring from HW\n");
printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n");
......@@ -686,6 +689,8 @@ static void get_options (int argc, char **argv)
LONG_OPTION_RXGAIN,
LONG_OPTION_RXGAINOFF,
LONG_OPTION_TXGAIN,
LONG_OPTION_NBRXANT,
LONG_OPTION_NBTXANT,
LONG_OPTION_SCANCARRIER,
LONG_OPTION_MAXPOWER,
LONG_OPTION_DUMP_FRAME,
......@@ -714,7 +719,9 @@ static void get_options (int argc, char **argv)
{"calib-prach-tx", no_argument, NULL, LONG_OPTION_CALIB_PRACH_TX},
{"ue-rxgain", required_argument, NULL, LONG_OPTION_RXGAIN},
{"ue-rxgain-off", required_argument, NULL, LONG_OPTION_RXGAINOFF},
{"ue-txgain", required_argument, NULL, LONG_OPTION_TXGAIN},
{"ue-txgain", required_argument, NULL, LONG_OPTION_TXGAIN},
{"ue-nb-ant-rx", required_argument, NULL, LONG_OPTION_NBRXANT},
{"ue-nb-ant-tx", required_argument, NULL, LONG_OPTION_NBTXANT},
{"ue-scan-carrier", no_argument, NULL, LONG_OPTION_SCANCARRIER},
{"ue-max-power", required_argument, NULL, LONG_OPTION_MAXPOWER},
{"ue-dump-frame", no_argument, NULL, LONG_OPTION_DUMP_FRAME},
......@@ -802,7 +809,12 @@ static void get_options (int argc, char **argv)
tx_gain[0][i] = atof(optarg);
break;
case LONG_OPTION_NBRXANT:
nb_antenna_rx = atof(optarg);
break;
case LONG_OPTION_NBTXANT:
nb_antenna_tx = atof(optarg);
break;
case LONG_OPTION_SCANCARRIER:
UE_scan_carrier=1;
......@@ -1353,7 +1365,7 @@ void init_openair0() {
openair0_cfg[card].clock_source = clock_source;
openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx));
openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
openair0_cfg[card].rx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
for (i=0; i<4; i++) {
......@@ -1548,9 +1560,11 @@ int main( int argc, char **argv )
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (UE_flag==1) {
frame_parms[CC_id]->nb_antennas_tx = 1;
frame_parms[CC_id]->nb_antennas_rx = 1;
frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx;
frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
}
init_ul_hopping(frame_parms[CC_id]);
......
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