Commit c51edecd authored by Rohit Gupta's avatar Rohit Gupta

Merge branch 'bugfix-136-OAI-UE-Attach-fixes' into 'develop'

[OAI-UE] issue#136 attach fixes:

- pusch/pucch power control
           - pucch encoding call
           - srb/drb add with default value

See merge request !44
parents a67f12e7 310a87ea
......@@ -2865,6 +2865,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
}
}
LOG_D(PHY,"DCI decoding CRNTI [format_c: %d, nCCE[subframe: %d]: %d ]\n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe]);
// memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_decoded_output,sizeof_bytes);
......
......@@ -154,6 +154,9 @@ void generate_pucch1x(int32_t **txdataF,
uint8_t Ncs1 = frame_parms->pucch_config_common.nCS_AN;
uint8_t Ncs1_div_deltaPUCCH_Shift = Ncs1/deltaPUCCH_Shift;
LOG_D(PHY,"generate_pucch Start [deltaPUCCH_Shift %d, NRB2 %d, Ncs1_div_deltaPUCCH_Shift %d, n1_pucch %d]\n", deltaPUCCH_Shift, NRB2, Ncs1_div_deltaPUCCH_Shift,n1_pucch);
uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
......@@ -178,6 +181,11 @@ void generate_pucch1x(int32_t **txdataF,
printf("[PHY] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch);
#endif
LOG_D(PHY,"[PHY] PUCCH: n1_pucch %d, thres %d Ncs1_div_deltaPUCCH_Shift %d (12/deltaPUCCH_Shift) %d Nprime_div_deltaPUCCH_Shift %d \n",
n1_pucch, thres, Ncs1_div_deltaPUCCH_Shift, (int)(12/deltaPUCCH_Shift), Nprime_div_deltaPUCCH_Shift);
LOG_D(PHY,"[PHY] PUCCH: deltaPUCCH_Shift %d, Nprime %d\n",deltaPUCCH_Shift,Nprime);
N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6;
if (n1_pucch < thres)
......
......@@ -433,7 +433,7 @@ UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
@param pucch_fmt Format of PUCCH that is being transmitted
@returns Transmit power
*/
int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue, UE_rxtx_proc_t *proc,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt);
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);
/*! \brief This function implements the power control mechanism for PUCCH from 36.213.
@param phy_vars_ue PHY variables
......
......@@ -335,7 +335,7 @@ void process_timing_advance_rar(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint16_t ti
#ifdef DEBUG_PHY_PROC
LOG_I(PHY,"[UE %d] Frame %d, received (rar) timing_advance %d, HW timing advance %d\n",ue->Mod_id,proc->frame_rx, ue->timing_advance);
LOG_I(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d, HW timing advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance);
#endif
}
......@@ -747,11 +747,12 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->prach_resources[eNB_id]->ra_PreambleIndex = 19;
}
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n",
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n",
ue->Mod_id,
frame_tx,
subframe_tx,
ue->prach_resources[eNB_id]->ra_PreambleIndex,
ue->tx_power_dBm[subframe_tx],
ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER,
ue->prach_resources[eNB_id]->ra_TDD_map_index,
ue->prach_resources[eNB_id]->ra_RNTI);
......@@ -1156,7 +1157,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
SR_payload);
if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,eNB_id,format);
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
}
else {
Po_PUCCH = ue->tx_power_max_dBm;
......@@ -1219,7 +1220,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
} else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC
if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,eNB_id,pucch_format1);
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,pucch_format1);
}
else {
Po_PUCCH = ue->tx_power_max_dBm;
......@@ -1306,8 +1307,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
}
if (ue->UE_mode[eNB_id] == PUSCH) { // check if we need to use PUCCH 1a/1b
ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag);
} // UE_mode==PUSCH
......@@ -1372,7 +1372,9 @@ 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-
......
......@@ -1167,6 +1167,22 @@ rrc_pdcp_config_asn1_req (
break;
case SRB_ToAddMod__rlc_Config_PR_defaultValue:
pdcp_config_req_asn1 (
ctxt_pP,
pdcp_p,
SRB_FLAG_YES,
rlc_type,
action,
lc_id,
mch_id,
srb_id,
srb_sn,
0, // drb_report
0, // header compression
security_modeP,
kRRCenc_pP,
kRRCint_pP,
kUPenc_pP);
// already the default values
break;
......
......@@ -202,6 +202,27 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
case SRB_ToAddMod__rlc_Config_PR_defaultValue:
//#warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue
LOG_I(RRC, "RLC SRB1 is default value !!\n");
struct RLC_Config__am * config_am_pP = &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am;
config_am_pP->dl_AM_RLC.t_Reordering = T_Reordering_ms35;
config_am_pP->dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0;
config_am_pP->ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms45;
config_am_pP->ul_AM_RLC.pollPDU = PollPDU_pInfinity;
config_am_pP->ul_AM_RLC.pollByte = PollByte_kBinfinity;
config_am_pP->ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t4;
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM) != NULL) {
config_req_rlc_am_asn1 (
ctxt_pP,
SRB_FLAG_YES,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
rb_id);
} else {
LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_id);
}
/*
if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
ctxt_pP,
......@@ -217,6 +238,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_id);
}
*/
break;
......
......@@ -201,7 +201,7 @@ double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}};
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
#endif
double rx_gain_off = 0.0;
double sample_rate=30.72e6;
double bw = 10.0e6;
......@@ -381,6 +381,7 @@ void help (void) {
printf(" --calib-prach-tx run normal prach with maximum power, but don't continue random-access\n");
printf(" --no-L2-connect bypass L2 and upper layers\n");
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-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");
......@@ -685,6 +686,7 @@ static void get_options (int argc, char **argv)
LONG_OPTION_NO_L2_CONNECT,
LONG_OPTION_CALIB_PRACH_TX,
LONG_OPTION_RXGAIN,
LONG_OPTION_RXGAINOFF,
LONG_OPTION_TXGAIN,
LONG_OPTION_SCANCARRIER,
LONG_OPTION_MAXPOWER,
......@@ -710,6 +712,7 @@ static void get_options (int argc, char **argv)
{"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT},
{"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-scan-carrier", no_argument, NULL, LONG_OPTION_SCANCARRIER},
{"ue-max-power", required_argument, NULL, LONG_OPTION_MAXPOWER},
......@@ -786,6 +789,10 @@ static void get_options (int argc, char **argv)
break;
case LONG_OPTION_RXGAINOFF:
rx_gain_off = atof(optarg);
break;
case LONG_OPTION_TXGAIN:
for (i=0; i<4; i++)
tx_gain[0][i] = atof(optarg);
......@@ -1353,7 +1360,7 @@ void init_openair0() {
openair0_cfg[card].rx_gain[i] = PHY_vars_eNB_g[0][0]->rx_total_gain_dB;
}
else {
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB;
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
}
......@@ -1587,7 +1594,7 @@ int main( int argc, char **argv )
else
UE[CC_id]->pdcch_vars[0]->crnti = 0x1235;
UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0];
UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
UE[CC_id]->N_TA_offset = 0;
......
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