Commit e88d1e73 authored by Bilel's avatar Bilel

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

parent cd6ac452
......@@ -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++;
......
......@@ -108,7 +108,7 @@ double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
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);
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);
......@@ -136,7 +136,7 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
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);
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;
uint16_t pucch_resource;
ANFBmode_t bundling_flag;
PUCCH_FMT_t format;
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,11 +1870,16 @@ 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);
// 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,
......@@ -1757,38 +1891,68 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
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,
ack_status_cw0 = reset_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
subframe_tx,
pucch_ack_payload,
0);
ue->generate_ul_signal[eNB_id] = 1;
ack_sr_generated = 1;
ack_status_cw1 = reset_ack(&ue->frame_parms,
ue->dlsch[eNB_id][1]->harq_ack,
subframe_tx,
pucch_ack_payload,
1);
if ((frame_parms->frame_type == TDD) && (SR_payload>0)) {
format = pucch_format1b;
nb_cw = ack_status_cw0 + ack_status_cw1;
cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&&
(is_cqi_TXOp(ue,proc,eNB_id)==1));
ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
(is_ri_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;
}
n1_pucch = get_n1_pucch(ue,
// 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,
ue->dlsch[eNB_id][0]->harq_ack,
eNB_id,
pucch_ack_payload,
SR_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);
}
......@@ -1810,8 +1974,21 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
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(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_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",
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,
......@@ -1820,33 +1997,32 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
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,
pucch_resource,
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",
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, subframe_tx,ue->rx_offset_diff,
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,
n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload,
pucch_resource,pucch_payload[0],pucch_payload[1],SR_payload,
Po_PUCCH,
tx_amp);
}
}
#if T_TRACER
if(pucch_ack_payload[0])
if(pucch_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));
}
......@@ -1859,9 +2035,9 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->ncs_cell,
format,
&ue->pucch_config_dedicated[eNB_id],
n1_pucch,
pucch_resource,
isShortenPucch, // shortened format
pucch_ack_payload,
pucch_payload,
tx_amp,
subframe_tx);
......@@ -1872,81 +2048,16 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
proc,
format,
ue->frame_parms.pucch_config_common.nCS_AN,
pucch_ack_payload,
pucch_payload,
SR_payload);
#endif
}
} else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC
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);
}
} // SR_Payload==1
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
// PUCCH 2x
if (ack_sr_generated == 0) { // we have not generated ACK/NAK/SR in this subframe
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;
break;
// Periodic CQI report
if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&&
(is_cqi_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);
}
......@@ -1969,84 +2080,44 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
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);
ue->generate_ul_signal[eNB_id] = 1;
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",
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, subframe_tx,CQI_payload,
frame_tx%1024, subframe_tx,
n2_pucch,
Po_PUCCH,
isShortenPucch,
tx_amp);
}
// Periodic RI report
else if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
(is_ri_TXOp(ue,proc,eNB_id)==1)){
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 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_