Commit d8ad650f authored by lfarizav's avatar lfarizav

Multiple RRUs. PRACH successful

parent ba403ee0
......@@ -68,7 +68,7 @@ phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
}
LOG_D(PHY,"[UE %d] Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",ue->Mod_id,ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
printf("[UE %d] Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",ue->Mod_id,ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
//printf("[UE %d] Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",ue->Mod_id,ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
#ifdef DEBUG_PHY
/* if ((ue->frame%100==0) || (ue->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
......
......@@ -101,7 +101,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch();
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,ue->common_vars.eNb_id,1);//ue->common_vars.eNb_id);
ue->UE_mode[0] = PRACH;
}
else {
......
......@@ -721,7 +721,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch();
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,ue->common_vars.eNb_id,1);//ue->common_vars.eNb_id);
ue->UE_mode[0] = PRACH;
}
else {
......@@ -963,7 +963,7 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch();
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,ue->common_vars.eNb_id,1);//ue->common_vars.eNb_id);
ue->UE_mode[0] = PRACH;
}
else {
......
......@@ -193,7 +193,7 @@ int slot_fep(PHY_VARS_UE *ue,
#if UE_TIMING_TRACE
start_meas(&ue->dlsch_channel_estimation_stats);
#endif
lte_dl_channel_estimation(ue,eNB_id,0,
lte_dl_channel_estimation(ue,0,0,
Ns,
aa,
l,
......@@ -203,7 +203,7 @@ int slot_fep(PHY_VARS_UE *ue,
#endif
for (i=0; i<ue->measurements.n_adj_cells; i++) {
lte_dl_channel_estimation(ue,eNB_id,i+1,
lte_dl_channel_estimation(ue,0,i+1,
Ns,
aa,
l,
......@@ -224,7 +224,7 @@ int slot_fep(PHY_VARS_UE *ue,
start_meas(&ue->dlsch_freq_offset_estimation_stats);
#endif
lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[current_thread_id[Ns>>1]].dl_ch_estimates[eNB_id],
lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[current_thread_id[Ns>>1]].dl_ch_estimates[0],
frame_parms,
l,
&common_vars->freq_offset,
......
......@@ -1402,7 +1402,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
}
void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) {
printf("ue_prach_procedures: eNB_id %d, ue->common_vars.eNb.id %d, mac enabled %d\n",eNB_id,ue->common_vars.eNb_id,ue->mac_enabled==1);
int frame_tx = proc->frame_tx;
int subframe_tx = proc->subframe_tx;
int prach_power;
......@@ -1420,6 +1420,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
if (ue->mac_enabled==1){
// ask L2 for RACH transport
printf("ue_prach_procedures: ask L2 for RACH transport: %d,%d,%d\n",mode != rx_calib_ue,mode != rx_calib_ue_med,mode != no_L2_connect);
if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ) {
LOG_D(PHY,"Getting PRACH resources\n");
ue->prach_resources[eNB_id] = mac_xface->ue_get_rach(ue->Mod_id,
......@@ -1429,6 +1430,8 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
subframe_tx);
LOG_D(PHY,"Got prach_resources for eNB %d address %p, RRCCommon %p\n",eNB_id,ue->prach_resources[eNB_id],UE_mac_inst[ue->Mod_id].radioResourceConfigCommon);
LOG_D(PHY,"Prach resources %p\n",ue->prach_resources[eNB_id]);
printf("Got prach_resources for eNB %d address %p, RRCCommon %p\n",ue->common_vars.eNb_id,ue->prach_resources[eNB_id],UE_mac_inst[ue->Mod_id].radioResourceConfigCommon);
printf("Prach resources %p\n",ue->prach_resources[eNB_id]);
}
}
......@@ -1508,11 +1511,11 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
mac_xface->Msg1_transmitted(ue->Mod_id,
ue->CC_id,
frame_tx,
eNB_id);
ue->common_vars.eNb_id);
}
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
ue->Mod_id,frame_tx,subframe_tx,eNB_id,
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d (ue->common_vars.eNb_id %d)) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
ue->Mod_id,frame_tx,subframe_tx,eNB_id,ue->common_vars.eNb_id,
ue->prach_resources[eNB_id]->ra_PreambleIndex,
ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id),
get_PL(ue->Mod_id,ue->CC_id,eNB_id));
......@@ -2448,7 +2451,6 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
#endif
ue->tx_power_dBm[subframe_tx]=-127;
if (abstraction_flag==0) {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memset(&ue->common_vars.txdataF[aa][subframe_tx*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti],
......@@ -2495,7 +2497,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
CC_id,
frame_tx,
subframe_tx,
eNB_id,
ue->common_vars.eNb_id,
ulsch_input_buffer,
input_buffer_length,
&access_mode);
......@@ -2538,14 +2540,14 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[eNB_id] == 0));
} // mode != PRACH
printf("phy_procedures_UE_TX: ue->UE_mode[eNB_id] == PRACH? %d,%d\n",ue->UE_mode[eNB_id] == PRACH,ue->frame_parms.prach_config_common.prach_Config_enabled==1);
if ((ue->UE_mode[eNB_id] == PRACH) &&
(ue->frame_parms.prach_config_common.prach_Config_enabled==1)) {
// check if we have PRACH opportunity
if (is_prach_subframe(&ue->frame_parms,frame_tx,subframe_tx)) {
printf("is there a PRACH opportunity? %d\n",is_prach_subframe(&ue->frame_parms,frame_tx,subframe_tx));
ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
} // mode is PRACH
......@@ -2899,6 +2901,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
{
//printf("PBCH: id %d\n",ue->Mod_id);
// int i;
printf("ue_pbch_procedures: eNB_id %d, ue->common_vars.eNb.id %d\n",eNB_id,ue->common_vars.eNb_id);
int pbch_tx_ant=0;
uint8_t pbch_phase;
uint16_t frame_tx;
......@@ -2922,7 +2925,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
for (pbch_trials=0; pbch_trials<4; pbch_trials++) {
//for (pbch_phase=0;pbch_phase<4;pbch_phase++) {
printf("[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id);
printf("[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,ue->common_vars.eNb_id);
if (abstraction_flag == 0) {
pbch_tx_ant = rx_pbch(&ue->common_vars,
ue->pbch_vars[eNB_id],
......@@ -2984,7 +2987,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
if (ue->mac_enabled==1) {
//printf("[UE%d] if mac_enabled? then dl_phy_sync_success. UE_mode %s\n",ue->Mod_id,ue->UE_mode[eNB_id]==NOT_SYNCHED?"NOT_SYNCHED":ue->UE_mode[eNB_id]==NOT_SYNCHED?"SYNCHED":"OTHER CHOICE");
mac_xface->dl_phy_sync_success(ue->Mod_id,frame_rx,eNB_id,
mac_xface->dl_phy_sync_success(ue->Mod_id,frame_rx,ue->common_vars.eNb_id,
ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
}
......@@ -3103,7 +3106,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t abstraction_flag)
{
printf("ue_pdcch_procedures: eNB_id %d, ue->common_vars.eNb.id %d\n",eNB_id,ue->common_vars.eNb_id);
unsigned int dci_cnt=0, i;
int frame_rx = proc->frame_rx;
......@@ -3722,7 +3725,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
int harq_pid;
int i_mod,eNB_id_i,dual_stream_UE;
int first_symbol_flag=0;
printf("ue_pdsch_procedures: eNB_id %d, ue->common_vars.eNb.id %d\n",eNB_id,ue->common_vars.eNb_id);
if (dlsch0->active == 0)
return;
......@@ -5767,7 +5770,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
frame_tx,
subframe_tx,
subframe_select(&ue->frame_parms,subframe_tx),
eNB_id,
ue->common_vars.eNb_id,
0/*FIXME CC_id*/);
if (ret == CONNECTION_LOST) {
......
......@@ -48,7 +48,7 @@
#endif
#include "SIMULATION/TOOLS/defs.h" // for taus
#include "PHY/extern.h"
int8_t get_DELTA_PREAMBLE(module_id_t module_idP,int CC_id)
{
......@@ -324,7 +324,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
mac_xface->macphy_exit("MAC FATAL CC_id>0");
return 0; // not reached
}
printf("ue_get_rach:UE_mode == PRACH? %d\n",UE_mode == PRACH);
if (UE_mode == PRACH) {
if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
......@@ -333,7 +333,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
}
if (Is_rrc_registered == 1) {
printf("ue_get_rach:Is_rrc_registered? %d\n",Is_rrc_registered == 1);
if (UE_mac_inst[module_idP].RA_active == 0) {
LOG_D(MAC,"RA not active\n");
// check if RRC is ready to initiate the RA procedure
......@@ -342,10 +342,10 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
frameP,
CCCH,1,
&UE_mac_inst[module_idP].CCCH_pdu.payload[sizeof(SCH_SUBHEADER_SHORT)+1],0,
eNB_indexP,
PHY_vars_UE_g[module_idP][0]->common_vars.eNb_id,
0);
Size16 = (uint16_t)Size;
printf("ue_get_rach:Size16 %d\n",Size16);
// LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
frameP, module_idP, eNB_indexP, module_idP);
......@@ -394,7 +394,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
} else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) {
// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element
rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, /*eNB_indexP*/PHY_vars_UE_g[module_idP][0]->common_vars.eNb_id,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH,
6);
......@@ -407,9 +407,9 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len);
sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti,
eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
/*eNB_indexP*/PHY_vars_UE_g[module_idP][0]->common_vars.eNb_id, frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH,
6, //not used
6, //not used
(char *)&ulsch_buff[0]);
LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]);
......@@ -443,7 +443,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
UE_mac_inst[module_idP].RA_backoff_frame = frameP;
UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
// Fill in preamble and PRACH resource
get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);
get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);//not necessary change eNB_indexP by PHY_vars_UE_g[module_idP][0]->common_vars.eNb_id
generate_ulsch_header((uint8_t*)ulsch_buff, // mac header
1, // num sdus
0, // short pading
......@@ -546,7 +546,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
UE_mac_inst[module_idP].RA_backoff_cnt = 0;
// Fill in preamble and PRACH resource
get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,0,NULL);
get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,0,NULL);//not necessary change eNB_indexP by PHY_vars_UE_g[module_idP][0]->common_vars.eNb_id
return(&UE_mac_inst[module_idP].RA_prach_resources);
}
}
......
......@@ -2752,7 +2752,7 @@ int decode_BCCH_DLSCH_Message(
&& (UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL)
#endif
) {
rrc_ue_generate_RRCConnectionRequest(ctxt_pP, 0);
rrc_ue_generate_RRCConnectionRequest(ctxt_pP, eNB_index);
rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING );
}
......
......@@ -513,7 +513,7 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE
frame_parms->N_RB_DL*12);
stop_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_dac_fixed_gain_freq);
printf("UE%d,eNB%d: dac_fixed_gain: referenceSignalPower %d\n",UE_id,eNB_id,frame_parms->pdsch_config_common.referenceSignalPower);
//printf("UE%d,eNB%d: dac_fixed_gain: referenceSignalPower %d\n",UE_id,eNB_id,frame_parms->pdsch_config_common.referenceSignalPower);
#else
start_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_dac_fixed_gain_freq);
tx_pwr = dac_fixed_gain(s_re_f,
......@@ -1430,15 +1430,13 @@ void do_UL_sig_freq_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB
//for (int i=0;i<NB_UE_INST;i++)
// Compute RX signal for eNB = eNB_id
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
if (PHY_vars_UE_g[UE_id][CC_id]->common_vars.eNb_id != eNB_id)
continue;
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
lte_frame_type_t frame_type = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.frame_type;
prach_ConfigIndex = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
n_ra_prb = get_prach_prb_offset(frame_parms, PHY_vars_UE_g[UE_id][CC_id]->prach_resources[eNB_id]->ra_TDD_map_index, PHY_vars_UE_g[UE_id][CC_id]->proc.proc_rxtx[subframe&0x1].frame_tx);
n_ra_prb = get_prach_prb_offset(frame_parms, PHY_vars_UE_g[UE_id][CC_id]->prach_resources[0]->ra_TDD_map_index, PHY_vars_UE_g[UE_id][CC_id]->proc.proc_rxtx[subframe&0x1].frame_tx);
tx_prachF = PHY_vars_UE_g[UE_id][CC_id]->prach_vars[eNB_id]->prachF;
tx_prachF = PHY_vars_UE_g[UE_id][CC_id]->prach_vars[0]->prachF;
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][0]->prach_vars[0]->prachF,frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*12,1,1);
//for (int idx=0;idx<10;idx++) printf("dumping DL raw subframe %d: txdataF[%d] = (%d,%d)\n", subframe, idx, ((short*)&txdataF[0][sf_offset+idx])[0], ((short*)&txdataF[0][sf_offset+idx])[1]);
......
......@@ -631,7 +631,8 @@ l2l1_task (void *args_p)
if (abstraction_flag == 1) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
mac_xface->dl_phy_sync_success (UE_id, 0, 0,1); //UE_id%NB_eNB_INST);
for (enb_id = 0; enb_id < NB_eNB_INST; enb_id++)
mac_xface->dl_phy_sync_success (UE_id, 0, enb_id,1); //UE_id%NB_eNB_INST);
}
start_meas (&oaisim_stats);
......
......@@ -1130,10 +1130,13 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
if (do_ofdm_mod)
{
for (UE_id=0; UE_id<NB_UE_INST; UE_id++){
if (eNB_id!=PHY_vars_UE_g[UE_id][CC_id]->common_vars.eNb_id)
continue;
if (is_prach_subframe(&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,frame,subframe) && PHY_vars_UE_g[UE_id][CC_id]->generate_prach)
{
//clock_t start=clock();
//printf("subframe UL PRACH: %d\n",subframe);
printf("prach is generated for UE %d, eNB %d\n",UE_id,eNB_id);
start_meas(&UE2eNB[UE_id][eNB_id][CC_id]->UL_PRACH_channel_freq);
do_UL_sig_freq_prach(UE2eNB,
enb_data,
......
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