Commit cad490a2 authored by Raymond Knopp's avatar Raymond Knopp

Addition of UE TX in USRP (still under test), calibration of UE RX for 5/10/20...

Addition of UE TX in USRP (still under test), calibration of UE RX for 5/10/20 MHz with USRP, new noise and signal power estimation for UE- RK

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6609 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 7f6cd81e
...@@ -159,7 +159,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -159,7 +159,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
uint8_t abstraction_flag) { uint8_t abstraction_flag) {
int aarx,rb; int aarx,rb;
int16_t *rxF; int16_t *rxF,*rxF_pss,*rxF_sss;
uint16_t Nid_cell = phy_vars_ue->lte_frame_parms.Nid_cell; uint16_t Nid_cell = phy_vars_ue->lte_frame_parms.Nid_cell;
uint8_t eNB_offset,nu,l,nushift,k; uint8_t eNB_offset,nu,l,nushift,k;
...@@ -168,8 +168,53 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -168,8 +168,53 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
for (eNB_offset = 0;eNB_offset<1+phy_vars_ue->PHY_measurements.n_adj_cells;eNB_offset++) { for (eNB_offset = 0;eNB_offset<1+phy_vars_ue->PHY_measurements.n_adj_cells;eNB_offset++) {
if (eNB_offset==0) if (eNB_offset==0) {
phy_vars_ue->PHY_measurements.rssi = 0; phy_vars_ue->PHY_measurements.rssi = 0;
phy_vars_ue->PHY_measurements.n0_power_tot = 0;
if ((phy_vars_ue->lte_frame_parms.frame_type == FDD) &&
((slot == 0) || (slot == 10))) { // FDD PSS/SSS, compute noise in DTX REs
if (phy_vars_ue->lte_frame_parms.Ncp==NORMAL) {
for (aarx=0;aarx<phy_vars_ue->lte_frame_parms.nb_antennas_rx;aarx++) {
rxF_sss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(5*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)];
rxF_pss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(6*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)];
//-ve spectrum from SSS
phy_vars_ue->PHY_measurements.n0_power[aarx] = ((rxF_pss[-72]*rxF_pss[-72])+(rxF_pss[-71]*rxF_pss[-71]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-70]*rxF_pss[-70])+(rxF_pss[-69]*rxF_pss[-69]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-68]*rxF_pss[-68])+(rxF_pss[-67]*rxF_pss[-67]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-66]*rxF_pss[-66])+(rxF_pss[-65]*rxF_pss[-65]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-64]*rxF_pss[-64])+(rxF_pss[-63]*rxF_pss[-63]));
//+ve spectrum from SSS
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_sss[2+72]*rxF_sss[2+72])+(rxF_sss[2+71]*rxF_sss[2+71]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_sss[2+70]*rxF_sss[2+70])+(rxF_sss[2+69]*rxF_sss[2+69]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_sss[2+68]*rxF_sss[2+68])+(rxF_sss[2+67]*rxF_sss[2+67]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_sss[2+66]*rxF_sss[2+66])+(rxF_sss[2+65]*rxF_sss[2+65]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_sss[2+64]*rxF_sss[2+64])+(rxF_sss[2+63]*rxF_sss[2+63]));
//+ve spectrum from PSS
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[2+72]*rxF_pss[2+72])+(rxF_pss[2+71]*rxF_pss[2+71]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[2+70]*rxF_pss[2+70])+(rxF_pss[2+69]*rxF_pss[2+69]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[2+68]*rxF_pss[2+68])+(rxF_pss[2+67]*rxF_pss[2+67]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[2+66]*rxF_pss[2+66])+(rxF_pss[2+65]*rxF_pss[2+65]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[2+64]*rxF_pss[2+64])+(rxF_pss[2+63]*rxF_pss[2+63]));
//-ve spectrum from PSS
rxF_pss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(7*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)];
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-72]*rxF_pss[-72])+(rxF_pss[-71]*rxF_pss[-71]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-70]*rxF_pss[-70])+(rxF_pss[-69]*rxF_pss[-69]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-68]*rxF_pss[-68])+(rxF_pss[-67]*rxF_pss[-67]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-66]*rxF_pss[-66])+(rxF_pss[-65]*rxF_pss[-65]));
phy_vars_ue->PHY_measurements.n0_power[aarx] += ((rxF_pss[-64]*rxF_pss[-64])+(rxF_pss[-63]*rxF_pss[-63]));
phy_vars_ue->PHY_measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power[aarx]/10);
phy_vars_ue->PHY_measurements.n0_power_tot += phy_vars_ue->PHY_measurements.n0_power[aarx];
}
phy_vars_ue->PHY_measurements.n0_power_tot_dB = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power_tot/20);
phy_vars_ue->PHY_measurements.n0_power_tot_dBm = phy_vars_ue->PHY_measurements.n0_power_tot_dB - phy_vars_ue->rx_total_gain_dB;
}
}
}
#ifdef DEBUG_MEAS #ifdef DEBUG_MEAS
LOG_D(PHY,"ue_rrc_measurements: eNB_offset %d => rssi %d\n",eNB_offset,phy_vars_ue->PHY_measurements.rssi); LOG_D(PHY,"ue_rrc_measurements: eNB_offset %d => rssi %d\n",eNB_offset,phy_vars_ue->PHY_measurements.rssi);
...@@ -206,13 +251,22 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -206,13 +251,22 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
// printf("rb %d, off %d, off2 %d\n",rb,off,off2); // printf("rb %d, off %d, off2 %d\n",rb,off,off2);
phy_vars_ue->PHY_measurements.rsrp[eNB_offset] += ((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])); phy_vars_ue->PHY_measurements.rsrp[eNB_offset] += ((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1]));
/* if ((phy_vars_ue->frame_rx&0x3ff) == 0)
printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])));
*/
off+=12; off+=12;
if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1)) if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1))
off = (1+k)<<1; off = (1+k)<<1;
phy_vars_ue->PHY_measurements.rsrp[eNB_offset] += ((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])); phy_vars_ue->PHY_measurements.rsrp[eNB_offset] += ((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1]));
/*
if ((phy_vars_ue->frame_rx&0x3ff) == 0)
printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])));
*/
off+=12; off+=12;
if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1)) if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1))
off = (1+k)<<1; off = (1+k)<<1;
} }
/* /*
...@@ -232,14 +286,16 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -232,14 +286,16 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
// LOG_D(PHY,"eNB: %d, RSRP_tmp: %d \n",eNB_offset,phy_vars_ue->PHY_measurements.rsrp[eNB_offset]); // LOG_D(PHY,"eNB: %d, RSRP_tmp: %d \n",eNB_offset,phy_vars_ue->PHY_measurements.rsrp[eNB_offset]);
// 2 RE per PRB // 2 RE per PRB
phy_vars_ue->PHY_measurements.rsrp[eNB_offset]/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL); // phy_vars_ue->PHY_measurements.rsrp[eNB_offset]/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL);
phy_vars_ue->PHY_measurements.rsrp[eNB_offset]/=(2*phy_vars_ue->lte_frame_parms.N_RB_DL);
if (eNB_offset == 0) { if (eNB_offset == 0) {
// phy_vars_ue->PHY_measurements.rssi/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL); // phy_vars_ue->PHY_measurements.rssi/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL);
// phy_vars_ue->PHY_measurements.rssi*=rx_power_correction; // phy_vars_ue->PHY_measurements.rssi*=rx_power_correction;
phy_vars_ue->PHY_measurements.rssi=phy_vars_ue->PHY_measurements.rsrp[0]*24/2; // phy_vars_ue->PHY_measurements.rssi=phy_vars_ue->PHY_measurements.rsrp[0]*24/2;
phy_vars_ue->PHY_measurements.rssi=phy_vars_ue->PHY_measurements.rsrp[0]*(12*phy_vars_ue->lte_frame_parms.N_RB_DL);
} }
if (phy_vars_ue->PHY_measurements.rssi>0) if (phy_vars_ue->PHY_measurements.rssi>0)
phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 100*phy_vars_ue->PHY_measurements.rsrp[eNB_offset]*phy_vars_ue->lte_frame_parms.N_RB_DL/phy_vars_ue->PHY_measurements.rssi; phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 100*phy_vars_ue->PHY_measurements.rsrp[eNB_offset]*phy_vars_ue->lte_frame_parms.N_RB_DL/phy_vars_ue->PHY_measurements.rssi;
...@@ -318,6 +374,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -318,6 +374,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
last_subband_size = 4*12; last_subband_size = 4*12;
break; break;
} }
/* // DONE NOW in ue_rrc_measurements
if (abstraction_flag!=0) { if (abstraction_flag!=0) {
phy_vars_ue->PHY_measurements.n0_power_tot = 0; phy_vars_ue->PHY_measurements.n0_power_tot = 0;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
...@@ -347,7 +404,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -347,7 +404,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
else { else {
phy_vars_ue->PHY_measurements.n0_power_tot_dBm = phy_vars_ue->PHY_measurements.n0_power_tot_dB - phy_vars_ue->rx_total_gain_dB + gain_offset; phy_vars_ue->PHY_measurements.n0_power_tot_dBm = phy_vars_ue->PHY_measurements.n0_power_tot_dB - phy_vars_ue->rx_total_gain_dB + gain_offset;
} }
*/
// signal measurements // signal measurements
for (eNB_id=0;eNB_id<phy_vars_ue->n_connected_eNB;eNB_id++) { for (eNB_id=0;eNB_id<phy_vars_ue->n_connected_eNB;eNB_id++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
...@@ -401,7 +458,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -401,7 +458,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id] = dB_fixed( phy_vars_ue->PHY_measurements.rx_power_avg[eNB_id]); phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id] = dB_fixed( phy_vars_ue->PHY_measurements.rx_power_avg[eNB_id]);
phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(phy_vars_ue->PHY_measurements.rx_power_tot[eNB_id],phy_vars_ue->PHY_measurements.n0_power_tot); phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(phy_vars_ue->PHY_measurements.rx_power_tot[eNB_id],phy_vars_ue->PHY_measurements.n0_power_tot);
phy_vars_ue->PHY_measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(phy_vars_ue->PHY_measurements.rx_power_avg[eNB_id],phy_vars_ue->PHY_measurements.n0_power_avg); phy_vars_ue->PHY_measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(phy_vars_ue->PHY_measurements.rx_power_avg[eNB_id],phy_vars_ue->PHY_measurements.n0_power_avg);
phy_vars_ue->PHY_measurements.rx_rssi_dBm[eNB_id] = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id] - phy_vars_ue->rx_total_gain_dB + gain_offset; phy_vars_ue->PHY_measurements.rx_rssi_dBm[eNB_id] = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id] - phy_vars_ue->rx_total_gain_dB;
#ifdef DEBUG_MEAS #ifdef DEBUG_MEAS
LOG_D(PHY,"[eNB %d] lte_ue_measurements: RSSI %d dBm, RSSI (digital) %d dB\n", LOG_D(PHY,"[eNB %d] lte_ue_measurements: RSSI %d dBm, RSSI (digital) %d dB\n",
eNB_id,phy_vars_ue->PHY_measurements.rx_rssi_dBm[eNB_id], eNB_id,phy_vars_ue->PHY_measurements.rx_rssi_dBm[eNB_id],
......
...@@ -65,7 +65,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -65,7 +65,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
if ((mode == normal_txrx) || (mode == no_L2_connect)) { if ((mode == normal_txrx) || (mode == no_L2_connect)) {
len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",phy_vars_ue->Mod_id, phy_vars_ue->lte_ue_pdcch_vars[0]->crnti); len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",phy_vars_ue->Mod_id, phy_vars_ue->lte_ue_pdcch_vars[0]->crnti);
len += sprintf(&buffer[len], "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm (%d dB, %d dB)\neNB1 RSSI %d dBm (%d dB, %d dB)\neNB2 RSSI %d dBm (%d dB, %d dB)\nN0 %d dBm (%d dB, %d dB)\n", len += sprintf(&buffer[len], "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)\neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n",
phy_vars_ue->frame_rx, phy_vars_ue->frame_rx,
phy_vars_ue->PHY_measurements.rx_rssi_dBm[0], phy_vars_ue->PHY_measurements.rx_rssi_dBm[0],
phy_vars_ue->PHY_measurements.rx_power_dB[0][0], phy_vars_ue->PHY_measurements.rx_power_dB[0][0],
...@@ -77,14 +77,15 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -77,14 +77,15 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
phy_vars_ue->PHY_measurements.rx_power_dB[2][0], phy_vars_ue->PHY_measurements.rx_power_dB[2][0],
phy_vars_ue->PHY_measurements.rx_power_dB[2][1], phy_vars_ue->PHY_measurements.rx_power_dB[2][1],
phy_vars_ue->PHY_measurements.n0_power_tot_dBm, phy_vars_ue->PHY_measurements.n0_power_tot_dBm,
phy_vars_ue->PHY_measurements.n0_power_tot_dBm+10*log10(12*phy_vars_ue->lte_frame_parms.N_RB_DL),
phy_vars_ue->lte_frame_parms.N_RB_DL,
phy_vars_ue->PHY_measurements.n0_power_dB[0], phy_vars_ue->PHY_measurements.n0_power_dB[0],
phy_vars_ue->PHY_measurements.n0_power_dB[1]); phy_vars_ue->PHY_measurements.n0_power_dB[1]);
#ifdef EXMIMO #ifdef EXMIMO
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]); len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
#endif #endif
#ifdef USRP #ifdef USRP
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d (%f) dB\n",phy_vars_ue->rx_total_gain_dB, len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
(double)phy_vars_ue->rx_total_gain_dB-USRP_GAIN_OFFSET);
#endif #endif
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d)\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset); len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d)\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset);
...@@ -446,7 +447,9 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -446,7 +447,9 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
RRC_status = mac_get_rrc_status(phy_vars_ue->Mod_id,0,0); RRC_status = mac_get_rrc_status(phy_vars_ue->Mod_id,0,0);
len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status); len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
#endif #endif
len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %d, RSSI %d, RSRQ[0] %d\n",phy_vars_ue->PHY_measurements.rsrp[0], phy_vars_ue->PHY_measurements.rssi, phy_vars_ue->PHY_measurements.rsrq[0]); len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f, RSRQ[0] %.2f\n",
10*log10(phy_vars_ue->PHY_measurements.rsrp[0])-phy_vars_ue->rx_total_gain_dB,
10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, 10*log10(phy_vars_ue->PHY_measurements.rsrq[0]));
len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d (mode1_flag %d)\n",phy_vars_ue->transmission_mode[eNB],phy_vars_ue->lte_frame_parms.mode1_flag); len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d (mode1_flag %d)\n",phy_vars_ue->transmission_mode[eNB],phy_vars_ue->lte_frame_parms.mode1_flag);
len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n", len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n",
......
...@@ -125,6 +125,19 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, ...@@ -125,6 +125,19 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
memcpy((short *)&ue_common_vars->rxdata[aa][frame_length_samples], memcpy((short *)&ue_common_vars->rxdata[aa][frame_length_samples],
(short *)&ue_common_vars->rxdata[aa][0], (short *)&ue_common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int)); frame_parms->ofdm_symbol_size*sizeof(int));
if ((rx_offset&3)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
memcpy((void *)tmp_dft_in,
(void *)&ue_common_vars->rxdata[aa][(rx_offset-nb_prefix_samples0) % frame_length_samples],
frame_parms->ofdm_symbol_size*sizeof(int));
#ifdef USRP
rescale((int16_t *)tmp_dft_in,
frame_parms->ofdm_symbol_size);
#endif
dft((int16_t *)tmp_dft_in,
(int16_t *)&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
}
else {// use dft input from RX buffer directly
start_meas(&phy_vars_ue->rx_dft_stats); start_meas(&phy_vars_ue->rx_dft_stats);
#ifdef USRP #ifdef USRP
rescale((int16_t *)&ue_common_vars->rxdata[aa][(rx_offset-nb_prefix_samples0) % frame_length_samples], rescale((int16_t *)&ue_common_vars->rxdata[aa][(rx_offset-nb_prefix_samples0) % frame_length_samples],
...@@ -135,6 +148,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, ...@@ -135,6 +148,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
stop_meas(&phy_vars_ue->rx_dft_stats); stop_meas(&phy_vars_ue->rx_dft_stats);
} }
}
else { else {
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples) + rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples) +
(frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1); (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
......
...@@ -56,10 +56,6 @@ ...@@ -56,10 +56,6 @@
#include "openair0_lib.h" #include "openair0_lib.h"
#include "gain_control.h" #include "gain_control.h"
extern int card; extern int card;
#else
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/from_grlib_softregs.h"
#endif #endif
#endif #endif
...@@ -125,18 +121,8 @@ DCI_ALLOC_t dci_alloc_rx[8]; ...@@ -125,18 +121,8 @@ DCI_ALLOC_t dci_alloc_rx[8];
extern int rx_sig_fifo; extern int rx_sig_fifo;
#endif #endif
/*
#if defined(CBMIMO) || defined(EXMIMO)
#include <rtai_lxrt.h>
extern struct timing_info_t {
unsigned int frame, hw_slot, last_slot, next_slot;
RTIME time0, time1, time2;
unsigned int mbox0, mbox1, mbox2, mbox_target;
} timing_info[2];
#endif
*/
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
#endif #endif
...@@ -206,7 +192,7 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) { ...@@ -206,7 +192,7 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) {
exit(-1); exit(-1);
} }
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
unsigned int prach_gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162}; unsigned int prach_gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
unsigned int get_tx_amp(int power_dBm, int power_max_dBm) { unsigned int get_tx_amp(int power_dBm, int power_max_dBm) {
...@@ -623,7 +609,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -623,7 +609,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
uint8_t ack_status=0; uint8_t ack_status=0;
int8_t Po_PUCCH; int8_t Po_PUCCH;
int32_t ulsch_start=0; int32_t ulsch_start=0;
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
int overflow=0; int overflow=0;
int k,l; int k,l;
#endif #endif
...@@ -921,7 +907,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -921,7 +907,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm, amp %d\n", LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm, amp %d\n",
Mod_id,harq_pid,frame_tx,subframe_tx,phy_vars_ue->tx_power_dBm, Mod_id,harq_pid,frame_tx,subframe_tx,phy_vars_ue->tx_power_dBm,
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm) get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm)
#else #else
AMP AMP
...@@ -929,7 +915,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -929,7 +915,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
); );
start_meas(&phy_vars_ue->ulsch_modulation_stats); start_meas(&phy_vars_ue->ulsch_modulation_stats);
ulsch_modulation(phy_vars_ue->lte_ue_common_vars.txdataF, ulsch_modulation(phy_vars_ue->lte_ue_common_vars.txdataF,
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm), get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),
#else #else
AMP, AMP,
...@@ -939,7 +925,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -939,7 +925,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
&phy_vars_ue->lte_frame_parms, &phy_vars_ue->lte_frame_parms,
phy_vars_ue->ulsch_ue[eNB_id]); phy_vars_ue->ulsch_ue[eNB_id]);
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),subframe_tx,first_rb,nb_rb,aa); generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),subframe_tx,first_rb,nb_rb,aa);
#else #else
...@@ -1027,7 +1013,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1027,7 +1013,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
frame_tx, subframe_tx, frame_tx, subframe_tx,
phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
Po_PUCCH, Po_PUCCH,
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm) get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm)
#else #else
AMP AMP
...@@ -1041,7 +1027,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1041,7 +1027,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
frame_tx, subframe_tx, frame_tx, subframe_tx,
n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload,
Po_PUCCH, Po_PUCCH,
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm) get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm)
#else #else
AMP AMP
...@@ -1060,7 +1046,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1060,7 +1046,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
0, // n2_pucch 0, // n2_pucch
1, // shortened format 1, // shortened format
pucch_ack_payload, pucch_ack_payload,
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm), get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm),
#else #else
AMP, AMP,
...@@ -1108,7 +1094,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1108,7 +1094,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
0, // n2_pucch 0, // n2_pucch
1, // shortened format 1, // shortened format
pucch_ack_payload, // this is ignored anyway, we just need a pointer pucch_ack_payload, // this is ignored anyway, we just need a pointer
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm), get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm),
#else #else
AMP, AMP,
...@@ -1184,7 +1170,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1184,7 +1170,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
nsymb = (frame_parms->Ncp == 0) ? 14 : 12; nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
#ifdef EXMIMO //this is the EXPRESS MIMO case #if defined(EXMIMO) || defined(USRP) //this is the EXPRESS MIMO case
ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-openair_daq_vars.timing_advance-phy_vars_ue->timing_advance-phy_vars_ue->N_TA_offset+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-openair_daq_vars.timing_advance-phy_vars_ue->timing_advance-phy_vars_ue->N_TA_offset+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
#else //this is the normal case #else //this is the normal case
ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-phy_vars_ue->N_TA_offset; ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-phy_vars_ue->N_TA_offset;
...@@ -1197,7 +1183,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1197,7 +1183,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1) if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
dummy_tx_buffer, dummy_tx_buffer,
#else #else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start], &phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
...@@ -1210,7 +1196,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1210,7 +1196,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
CYCLIC_PREFIX); CYCLIC_PREFIX);
else else
normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
dummy_tx_buffer, dummy_tx_buffer,
#else #else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start], &phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
...@@ -1231,7 +1217,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1231,7 +1217,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
} }
*/ */
#ifndef OFDMA_ULSCH #ifndef OFDMA_ULSCH
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,0); apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,0);
apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,1); apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,1);
#else #else
...@@ -1246,7 +1232,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1246,7 +1232,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
*/ */
#endif #endif
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
overflow = ulsch_start - 9*frame_parms->samples_per_tti; overflow = ulsch_start - 9*frame_parms->samples_per_tti;
//if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow); //if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow);
for (k=ulsch_start,l=0; k<cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++) for (k=ulsch_start,l=0; k<cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++)
...@@ -1275,13 +1261,14 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1275,13 +1261,14 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
// else { // slot_tx is odd, do the PRACH here // else { // slot_tx is odd, do the PRACH here
#ifdef OPENAIR2 #ifdef OPENAIR2
if ((phy_vars_ue->UE_mode[eNB_id] == PRACH) && (phy_vars_ue->lte_frame_parms.prach_config_common.prach_Config_enabled==1)) { if ((phy_vars_ue->UE_mode[eNB_id] == PRACH) && (phy_vars_ue->lte_frame_parms.prach_config_common.prach_Config_enabled==1)) {
#else #else
if (1) { if (1) {
#endif #endif
// check if we have PRACH opportunity // check if we have PRACH opportunity
if (is_prach_subframe(&phy_vars_ue->lte_frame_parms,frame_tx,subframe_tx)) { if (is_prach_subframe(&phy_vars_ue->lte_frame_parms,frame_tx,subframe_tx)) {
LOG_D(PHY,"UE %d: Frame %d, SF %d Clearing generate_prach\n",Mod_id,frame_tx,subframe_tx);
phy_vars_ue->generate_prach=0; phy_vars_ue->generate_prach=0;
#ifdef OPENAIR2 #ifdef OPENAIR2
// ask L2 for RACH transport // ask L2 for RACH transport
...@@ -1291,7 +1278,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1291,7 +1278,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
frame_tx, frame_tx,
eNB_id, eNB_id,
subframe_tx); subframe_tx);
LOG_D(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,phy_vars_ue->prach_resources[eNB_id],UE_mac_inst[Mod_id].radioResourceConfigCommon); // LOG_I(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,phy_vars_ue->prach_resources[eNB_id],UE_mac_inst[Mod_id].radioResourceConfigCommon);
} }
#endif #endif
if (phy_vars_ue->prach_resources[eNB_id]!=NULL) { if (phy_vars_ue->prach_resources[eNB_id]!=NULL) {
...@@ -1305,7 +1292,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1305,7 +1292,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
phy_vars_ue->prach_PreambleIndex=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex; phy_vars_ue->prach_PreambleIndex=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex;
#endif #endif
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
LOG_D(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, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n",
Mod_id, Mod_id,
frame_tx, frame_tx,
subframe_tx, subframe_tx,
...@@ -1322,11 +1309,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1322,11 +1309,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
phy_vars_ue->tx_total_RE = 96; phy_vars_ue->tx_total_RE = 96;
#ifdef EXMIMO #if defined(EXMIMO) || defined(USRP)
phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm); phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm);
#else #else
phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = AMP; phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = AMP;
#endif #endif
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : PRACH TX power %d dBm, amp %d\n",Mod_id,phy_vars_ue->frame_rx,phy_vars_ue->slot_tx>>1,phy_vars_ue->tx_power_dBm,phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp);
// start_meas(&phy_vars_ue->tx_prach); // start_meas(&phy_vars_ue->tx_prach);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN);
prach_power = generate_prach(phy_vars_ue,eNB_id,subframe_tx,frame_tx); prach_power = generate_prach(phy_vars_ue,eNB_id,subframe_tx,frame_tx);
...@@ -1385,7 +1374,7 @@ void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abst ...@@ -1385,7 +1374,7 @@ void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abst
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++){ for (aa=0;aa<frame_parms->nb_antennas_tx;aa++){
#ifdef EXMIMO //this is the EXPRESS MIMO case #if defined(EXMIMO) //this is the EXPRESS MIMO case
int i; int i;
// set the whole tx buffer to RX // set the whole tx buffer to RX
for (i=0;i<LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti;i++) for (i=0;i<LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti;i++)
...@@ -1660,9 +1649,6 @@ void restart_phy(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_fla ...@@ -1660,9 +1649,6 @@ void restart_phy(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_fla
phy_vars_ue->frame_tx = -1; phy_vars_ue->frame_tx = -1;
openair_daq_vars.synch_wait_cnt=0; openair_daq_vars.synch_wait_cnt=0;
openair_daq_vars.sched_cnt=-1; openair_daq_vars.sched_cnt=-1;
#if defined(EXMIMO) || defined(CBMIMO1)
//openair_daq_vars.timing_advance = TIMING_ADVANCE_HW;
#endif
phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq=0; phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq=0;
phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors=0; phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors=0;
...@@ -1798,16 +1784,7 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst ...@@ -1798,16 +1784,7 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
frame_tx, frame_tx,
frame_rx & 0x03FF, frame_rx & 0x03FF,
pbch_phase); pbch_phase);
/*
#if defined(CBMIMO) || defined(EXMIMO)
for (i=0;i<20;i++){
LOG_D(PHY,"slot %d: frame %d, hw_slot %d, slot_rx %d, next_slot %d, time0 %llu, time1 %llu, time2 %llu, mbox0 %d, mbox1 %d, mbox2 %d, mbox_target %d\n",
i, timing_info[i].frame, timing_info[i].hw_slot, timing_info[i].slot_rx, timing_info[i].next_slot,
timing_info[i].time0, timing_info[i].time1, timing_info[i].time2,
timing_info[i].mbox0, timing_info[i].mbox1, timing_info[i].mbox2, timing_info[i].mbox_target);
}
#endif
*/
phy_vars_ue->frame_rx = (phy_vars_ue->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF); phy_vars_ue->frame_rx = (phy_vars_ue->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF);
phy_vars_ue->frame_tx = phy_vars_ue->frame_rx; phy_vars_ue->frame_tx = phy_vars_ue->frame_rx;
frame_rx = phy_vars_ue->frame_rx; frame_rx = phy_vars_ue->frame_rx;
...@@ -3463,7 +3440,7 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold ...@@ -3463,7 +3440,7 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1);
#ifdef EXMIMO #if defined(EXMIMO)
#ifndef USRP #ifndef USRP
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[0].rxcnt_ptr[0])); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[0].rxcnt_ptr[0]));
#endif #endif
......
...@@ -1976,7 +1976,7 @@ decode_BCCH_DLSCH_Message( ...@@ -1976,7 +1976,7 @@ decode_BCCH_DLSCH_Message(
#endif #endif
) { ) {
rrc_ue_generate_RRCConnectionRequest(ue_mod_idP, frameP, 0); rrc_ue_generate_RRCConnectionRequest(ue_mod_idP, frameP, 0);
LOG_I(RRC, "not sending connection request\n"); // LOG_I(RRC, "not sending connection request\n");
rrc_set_sub_state (ue_mod_idP, RRC_SUB_STATE_IDLE_CONNECTING); rrc_set_sub_state (ue_mod_idP, RRC_SUB_STATE_IDLE_CONNECTING);
} }
......
...@@ -44,7 +44,7 @@ typedef struct openair0_device_t openair0_device; ...@@ -44,7 +44,7 @@ typedef struct openair0_device_t openair0_device;
#define MAX_CARDS 1 #define MAX_CARDS 1
#endif #endif
#define USRP_GAIN_OFFSET (65.0) // 82 calibrated for USRP B210 @ 2.6 GHz #define USRP_GAIN_OFFSET (86.0) // 86 calibrated for USRP B210 @ 2.6 GHz to get equivalent RS EPRE in OAI to SMBV100 output
typedef enum { typedef enum {
max_gain=0,med_gain,byp_gain max_gain=0,med_gain,byp_gain
......
...@@ -123,6 +123,9 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -123,6 +123,9 @@ unsigned short config_frames[4] = {2,9,11,13};
# include "create_tasks.h" # include "create_tasks.h"
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
# include "s1ap_eNB.h" # include "s1ap_eNB.h"
#ifdef NAS_NETLINK
# include "SIMULATION/ETH_TRANSPORT/proto.h"
#endif
# endif # endif
#endif #endif
...@@ -2529,11 +2532,24 @@ int main(int argc, char **argv) { ...@@ -2529,11 +2532,24 @@ int main(int argc, char **argv) {
openair0_cfg[card].tx_gain[i] = tx_gain[0][i]; openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
openair0_cfg[card].rx_gain[i] = ((UE_flag==0) ? PHY_vars_eNB_g[0][0]->rx_total_gain_eNB_dB : openair0_cfg[card].rx_gain[i] = ((UE_flag==0) ? PHY_vars_eNB_g[0][0]->rx_total_gain_eNB_dB :
PHY_vars_UE_g[0][0]->rx_total_gain_dB) - USRP_GAIN_OFFSET; // calibrated for USRP B210 @ 2.6 GHz PHY_vars_UE_g[0][0]->rx_total_gain_dB) - USRP_GAIN_OFFSET; // calibrated for USRP B210 @ 2.6 GHz, 30.72 MS/s
switch(frame_parms[0]->N_RB_DL) {
case 6:
openair0_cfg[card].rx_gain[i] -= 6;
break;
case 25:
openair0_cfg[card].rx_gain[i] += 6;
break;
case 50:
openair0_cfg[card].rx_gain[i] += 8;
break;
default:
break;
}
openair0_cfg[card].tx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] : downlink_frequency[0][i]+uplink_frequency_offset[0][i]; openair0_cfg[card].tx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] : downlink_frequency[0][i]+uplink_frequency_offset[0][i];
openair0_cfg[card].rx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] + uplink_frequency_offset[0][i] : downlink_frequency[0][i]; openair0_cfg[card].rx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] + uplink_frequency_offset[0][i] : downlink_frequency[0][i];
printf("Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
openair0_cfg[card].tx_gain[i], card,i, openair0_cfg[card].tx_gain[i],
openair0_cfg[card].rx_gain[i], openair0_cfg[card].rx_gain[i],
openair0_cfg[card].tx_freq[i], openair0_cfg[card].tx_freq[i],
openair0_cfg[card].rx_freq[i]); openair0_cfg[card].rx_freq[i]);
...@@ -2812,6 +2828,12 @@ int main(int argc, char **argv) { ...@@ -2812,6 +2828,12 @@ int main(int argc, char **argv) {
// Sleep to allow all threads to setup // Sleep to allow all threads to setup
sleep(1); sleep(1);
#ifdef USE_MME
while (start_UE == 0) {
sleep(1);
}
#endif
#ifndef EXMIMO #ifndef EXMIMO
#ifndef USRP_DEBUG #ifndef USRP_DEBUG
openair0.trx_start_func(&openair0); openair0.trx_start_func(&openair0);
......
...@@ -257,17 +257,35 @@ static void *UE_thread_synch(void *arg) { ...@@ -257,17 +257,35 @@ static void *UE_thread_synch(void *arg) {
openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]; openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i];
openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]; openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i];
#ifdef USRP
openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET;
switch(UE->lte_frame_parms.N_RB_DL) {
case 6:
openair0_cfg[card].rx_gain[i] -= 12;
break;
case 25:
openair0_cfg[card].rx_gain[i] -= 6;
break;
case 50:
openair0_cfg[card].rx_gain[i] -= 3;
break;
default:
printf("Unknown number of RBs %d\n",UE->lte_frame_parms.N_RB_DL);
break;
}
printf("UE synch: setting RX gain (%d,%d) to %d\n",card,i,openair0_cfg[card].rx_gain[i]);
#endif
}
#ifdef EXMIMO
openair0_config(&openair0_cfg[card],1);
#endif
}
#ifdef USRP #ifdef USRP
#ifndef USRP_DEBUG #ifndef USRP_DEBUG
openair0_set_rx_frequencies(&openair0,&openair0_cfg[0]); openair0_set_rx_frequencies(&openair0,&openair0_cfg[0]);
openair0_set_gains(&openair0,&openair0_cfg[0]); openair0_set_gains(&openair0,&openair0_cfg[0]);
#endif #endif
#else
openair0_config(&openair0_cfg[0],1);
#endif #endif
}
}
LOG_D(PHY,"[SCHED][UE] Scanning band %d, freq %u\n",bands_to_scan.band_info[0].band, bands_to_scan.band_info[0].dl_min); LOG_D(PHY,"[SCHED][UE] Scanning band %d, freq %u\n",bands_to_scan.band_info[0].band, bands_to_scan.band_info[0].dl_min);
} }
else { else {
...@@ -318,16 +336,36 @@ static void *UE_thread_synch(void *arg) { ...@@ -318,16 +336,36 @@ static void *UE_thread_synch(void *arg) {
openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset; openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset; openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset;
#ifdef USRP
openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz
switch(UE->lte_frame_parms.N_RB_DL) {
case 6:
openair0_cfg[card].rx_gain[i] -= 12;
break;
case 25:
openair0_cfg[card].rx_gain[i] -= 6;
break;
case 50:
openair0_cfg[card].rx_gain[i] -= 3;
break;
default:
printf("Unknown number of RBs %d\n",UE->lte_frame_parms.N_RB_DL);
break;
}
printf("UE synch: setting RX gain (%d,%d) to %d\n",card,i,openair0_cfg[card].rx_gain[i]);
#endif
}
#ifdef EXMIMO
openair0_config(&openair0_cfg[card],1);
#endif
}
#ifdef USRP #ifdef USRP
#ifndef USRP_DEBUG #ifndef USRP_DEBUG
openair0_set_rx_frequencies(&openair0,&openair0_cfg[0]); openair0_set_rx_frequencies(&openair0,&openair0_cfg[0]);
// openair0_set_gains(&openair0,&openair0_cfg[0]); // openair0_set_gains(&openair0,&openair0_cfg[0]);
#endif #endif
#endif #endif
}
}
break; break;
case pbch: case pbch:
printf("Running initial sync\n"); printf("Running initial sync\n");
...@@ -384,6 +422,28 @@ static void *UE_thread_synch(void *arg) { ...@@ -384,6 +422,28 @@ static void *UE_thread_synch(void *arg) {
openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset; openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset; openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz
#ifdef USRP
switch(UE->lte_frame_parms.N_RB_DL) {
case 6:
openair0_cfg[card].rx_gain[i] -= 12;
break;
case 25:
openair0_cfg[card].rx_gain[i] -= 6;
break;
case 50:
openair0_cfg[card].rx_gain[i] -= 3;
break;
default:
printf("Unknown number of RBs %d\n",UE->lte_frame_parms.N_RB_DL);
break;
}
printf("UE synch: setting RX gain (%d,%d) to %d\n",card,i,openair0_cfg[card].rx_gain[i]);
#endif
}
#ifdef EXMIMO
openair0_config(&openair0_cfg[card],1);
#endif
}
#ifdef USRP #ifdef USRP
#ifndef USRP_DEBUG #ifndef USRP_DEBUG
openair0_set_frequencies(&openair0,&openair0_cfg[0]); openair0_set_frequencies(&openair0,&openair0_cfg[0]);
...@@ -391,10 +451,10 @@ static void *UE_thread_synch(void *arg) { ...@@ -391,10 +451,10 @@ static void *UE_thread_synch(void *arg) {
#endif #endif
#else #else
openair0_config(&openair0_cfg[card],1);
#endif #endif
}
}
// openair0_dump_config(&openair0_cfg[0],UE_flag); // openair0_dump_config(&openair0_cfg[0],UE_flag);
...@@ -497,7 +557,8 @@ static void *UE_thread_tx(void *arg) { ...@@ -497,7 +557,8 @@ static void *UE_thread_tx(void *arg) {
} }
if ((subframe_select(&UE->lte_frame_parms,UE->slot_tx>>1)==SF_UL)){ if ((subframe_select(&UE->lte_frame_parms,UE->slot_tx>>1)==SF_UL)||
(UE->lte_frame_parms.frame_type == FDD)){
phy_procedures_UE_TX(UE,0,0,UE->mode,no_relay); phy_procedures_UE_TX(UE,0,0,UE->mode,no_relay);
} }
if ((subframe_select(&UE->lte_frame_parms,UE->slot_tx>>1)==SF_S) && if ((subframe_select(&UE->lte_frame_parms,UE->slot_tx>>1)==SF_S) &&
...@@ -890,6 +951,32 @@ void *UE_thread(void *arg) { ...@@ -890,6 +951,32 @@ void *UE_thread(void *arg) {
exit_fun("nothing to add"); exit_fun("nothing to add");
} }
} }
if (pthread_mutex_lock(&UE->mutex_tx) != 0) {
LOG_E(PHY,"[SCHED][UE] error locking mutex for UE TX thread\n");
exit_fun("nothing to add");
}
else {
if (tx_enabled == 1) {
UE->instance_cnt_tx++;
//printf("UE_thread: Unlocking UE mutex_rx\n");
pthread_mutex_unlock(&UE->mutex_tx);
if (UE->instance_cnt_tx == 0) {
if (pthread_cond_signal(&UE->cond_tx) != 0) {
LOG_E(PHY,"[SCHED][UE] ERROR pthread_cond_signal for UE TX thread\n");
exit_fun("nothing to add");
}
else {
// printf("UE_thread: cond_signal for RX ok (%p) @ %llu\n",(void*)&UE->cond_rx,rt_get_time_ns()-T0);
}
}
else {
LOG_E(PHY,"[SCHED][UE] UE TX thread busy!!\n");
exit_fun("nothing to add");
}
}
}
} }
} }
else { // we are not yet synchronized else { // we are not yet synchronized
...@@ -946,6 +1033,7 @@ void *UE_thread(void *arg) { ...@@ -946,6 +1033,7 @@ void *UE_thread(void *arg) {
rt_sleep_ns(10000000); rt_sleep_ns(10000000);
#endif #endif
UE->rx_offset=0; UE->rx_offset=0;
tx_enabled=1;
} }
else if ((UE->rx_offset < RX_OFF_MIN)&&(start_rx_stream==1) && (rx_correction_timer == 0)) { else if ((UE->rx_offset < RX_OFF_MIN)&&(start_rx_stream==1) && (rx_correction_timer == 0)) {
rx_off_diff = -UE->rx_offset + RX_OFF_MIN; rx_off_diff = -UE->rx_offset + RX_OFF_MIN;
......
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