Commit d2bf4ddc authored by knopp's avatar knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5739 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b1e97ab1
......@@ -837,11 +837,8 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms) {
init_td8();
init_td16();
#ifdef USER_MODE
lte_sync_time_init(lte_frame_parms);
#else
// lte_sync_time_init(lte_frame_parms) has to be called from the real-time thread, since it uses SSE instructions.
#endif
generate_ul_ref_sigs();
generate_ul_ref_sigs_rx();
......
......@@ -45,9 +45,11 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) {
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
uint16_t i;
#endif
int rssi;
//rx_power_fil_dB = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
rx_power_fil_dB = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id];
rssi = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
if (rssi>0) rx_power_fil_dB = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
else rx_power_fil_dB = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id];
// Gain control with hysterisis
// Adjust gain in phy_vars_ue->rx_vars[0].rx_total_gain_dB
......@@ -78,6 +80,7 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) {
phy_vars_ue->rx_total_gain_dB = MIN_RF_GAIN;
}
printf("Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",phy_vars_ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
#ifdef EXMIMO
......
......@@ -49,7 +49,7 @@ __m128i zeroPMI;
#define k1 ((long long int) 1000)
#define k2 ((long long int) (1024-k1))
//#define DEBUG_MEAS
#define DEBUG_MEAS
#ifdef USER_MODE
void print_shorts(char *s,__m128i *x) {
......@@ -84,17 +84,21 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
int RSoffset;
LOG_D(PHY,"get_PL : Frame %d : rssi %d, eNB power %d\n", phy_vars_ue->frame,
dB_fixed(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB,
phy_vars_ue->lte_frame_parms.pdsch_config_common.referenceSignalPower);
if (phy_vars_ue->lte_frame_parms.mode1_flag == 1)
RSoffset = 6;
else
RSoffset = 3;
return((int16_t)(phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->PHY_measurements.rssi/RSoffset) +
phy_vars_ue->lte_frame_parms.pdsch_config_common.referenceSignalPower));
LOG_D(PHY,"get_PL : Frame %d : rssi %f dBm, eNB power %d dBm/RE\n", phy_vars_ue->frame,
(1.0*dB_fixed_times10(phy_vars_ue->PHY_measurements.rssi/RSoffset)-(10.0*phy_vars_ue->rx_total_gain_dB))/10.0,
phy_vars_ue->lte_frame_parms.pdsch_config_common.referenceSignalPower);
return((int16_t)(((10*phy_vars_ue->rx_total_gain_dB) -
dB_fixed_times10(phy_vars_ue->PHY_measurements.rssi)+
dB_fixed_times10(RSoffset*12*PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL) +
(phy_vars_ue->lte_frame_parms.pdsch_config_common.referenceSignalPower*10))/10));
}
......@@ -170,24 +174,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
uint16_t Nid_cell = phy_vars_ue->lte_frame_parms.Nid_cell;
uint8_t eNB_offset,nu,l,nushift,k;
uint16_t off;
int16_t rx_power_correction;
// if the fft size an odd power of 2, the output of the fft is shifted one too much, so we need to compensate for that
if (abstraction_flag==0) {
rx_power_correction = 1;
}
else {
#ifndef NEW_FFT
if ((phy_vars_ue->lte_frame_parms.ofdm_symbol_size == 128) ||
(phy_vars_ue->lte_frame_parms.ofdm_symbol_size == 512))
rx_power_correction = 2;
else
rx_power_correction = 1;
#else
rx_power_correction=1;
#endif
}
for (eNB_offset = 0;eNB_offset<1+phy_vars_ue->PHY_measurements.n_adj_cells;eNB_offset++) {
......@@ -220,39 +207,22 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
LOG_D(PHY,"[UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,slot,Nid_cell,nushift,eNB_offset,k);
#endif
for (aarx=0;aarx<phy_vars_ue->lte_frame_parms.nb_antennas_rx;aarx++) {
#ifndef NEW_FFT
rxF = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(l*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)<<1];
off = (phy_vars_ue->lte_frame_parms.first_carrier_offset+k)<<2;
#else
rxF = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(l*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)];
off = (phy_vars_ue->lte_frame_parms.first_carrier_offset+k)<<1;
#endif
if (l==(4-phy_vars_ue->lte_frame_parms.Ncp)) {
if (l==(4-phy_vars_ue->lte_frame_parms.Ncp)) {
for (rb=0;rb<phy_vars_ue->lte_frame_parms.N_RB_DL;rb++) {
// 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]));
#ifndef NEW_FFT
off+=24;
if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<2))
off = (1+k)<<2;
#else
off+=12;
if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1))
off = (1+k)<<1;
#endif
phy_vars_ue->PHY_measurements.rsrp[eNB_offset] += ((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1]));
#ifndef NEW_FFT
off+=24;
if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<2))
off = (1+k)<<2;
#else
off+=12;
if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1))
off = (1+k)<<1;
#endif
}
/*
......@@ -273,9 +243,9 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
// 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]*=rx_power_correction;
// phy_vars_ue->PHY_measurements.rsrp[eNB_offset] = phy_vars_ue->PHY_measurements.rx_spatial_power[eNB_offset][0][0]/(2*phy_vars_ue->lte_frame_parms.N_RB_DL);
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*=rx_power_correction;
......@@ -295,12 +265,13 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 3;
}
if (((phy_vars_ue->frame %10) == 0) && (slot == 1)) {
if (((phy_vars_ue->frame %10) == 0) && (slot == 0)) {
#ifdef DEBUG_MEAS
if (eNB_offset == 0)
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",phy_vars_ue->Mod_id,
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d)\n",phy_vars_ue->Mod_id,
phy_vars_ue->frame,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB,
10*log10(phy_vars_ue->PHY_measurements.rssi));
10*log10(phy_vars_ue->PHY_measurements.rssi),
phy_vars_ue->rx_total_gain_dB);
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f (%3.1f) dBm, rsrq: %3.1f dB\n",
phy_vars_ue->Mod_id,
phy_vars_ue->frame,slot,eNB_offset,
......@@ -324,7 +295,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
unsigned char abstraction_flag){
int aarx,aatx,eNB_id=0,rx_power_correction=1,gain_offset=0;
int aarx,aatx,eNB_id=0,gain_offset=0;
//int rx_power[NUMBER_OF_CONNECTED_eNB_MAX];
int i;
unsigned int limit,subband;
......@@ -334,12 +305,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->PHY_measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
#ifdef CBMIMO1
if (openair_daq_vars.rx_rf_mode == 0)
gain_offset = 25;
else
gain_offset = 0;
#endif
#ifndef __SSE3__
zeroPMI = _mm_xor_si128(zeroPMI,zeroPMI);
......@@ -361,21 +327,6 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->PHY_measurements.n0_power_avg_dB = 0;
}
// if the fft size an odd power of 2, the output of the fft is shifted one too much, so we need to compensate for that
if (abstraction_flag==0) {
rx_power_correction = 1;
}
else {
#ifndef NEW_FFT
if ((frame_parms->ofdm_symbol_size == 128) || (frame_parms->ofdm_symbol_size == 512))
rx_power_correction = 2;
else
rx_power_correction = 1;
#else
rx_power_correction=1;
#endif
}
// noise measurements
// for abstraction we do noise measurements based on the precalculated phy_vars_ue->N0
// otherwise if there is a symbol where we can take noise measurements on, we measure there
......@@ -417,7 +368,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
for (aatx=0; aatx<frame_parms->nb_antennas_tx_eNB; aatx++) {
phy_vars_ue->PHY_measurements.rx_spatial_power[eNB_id][aatx][aarx] =
(signal_energy_nodc(&phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0],
(frame_parms->N_RB_DL*12))*rx_power_correction);
(frame_parms->N_RB_DL*12)));
//- phy_vars_ue->PHY_measurements.n0_power[aarx];
if (phy_vars_ue->PHY_measurements.rx_spatial_power[eNB_id][aatx][aarx]<0)
......@@ -465,6 +416,11 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
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.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;
#ifdef DEBUG_MEAS
printf("[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],
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]);
#endif
}
phy_vars_ue->PHY_measurements.n0_power_avg_dB = dB_fixed( phy_vars_ue->PHY_measurements.n0_power_avg);
......@@ -488,7 +444,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
msg("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
*/
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] =
(signal_energy_nodc(dl_ch0,48) + signal_energy_nodc(dl_ch1,48))*rx_power_correction;
(signal_energy_nodc(dl_ch0,48) + signal_energy_nodc(dl_ch1,48));
if ( phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] < 0)
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband]=0;
/*
......@@ -503,7 +459,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
else {
// for (i=0;i<12;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) + signal_energy_nodc(dl_ch1,12))*rx_power_correction; // - phy_vars_ue->PHY_measurements.n0_power[aarx];
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) + signal_energy_nodc(dl_ch1,12)); // - phy_vars_ue->PHY_measurements.n0_power[aarx];
phy_vars_ue->PHY_measurements.subband_cqi_tot[eNB_id][subband] += phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband];
phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband],
phy_vars_ue->PHY_measurements.n0_power[aarx]);
......@@ -608,7 +564,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
// for (i=0;i<48;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] =
(signal_energy_nodc(dl_ch0,48) )*rx_power_correction - phy_vars_ue->PHY_measurements.n0_power[aarx];
(signal_energy_nodc(dl_ch0,48) ) - phy_vars_ue->PHY_measurements.n0_power[aarx];
phy_vars_ue->PHY_measurements.subband_cqi_tot[eNB_id][subband] += phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband];
phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband],
......@@ -617,7 +573,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
else {
// for (i=0;i<12;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) )*rx_power_correction - phy_vars_ue->PHY_measurements.n0_power[aarx];
phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) ) - phy_vars_ue->PHY_measurements.n0_power[aarx];
phy_vars_ue->PHY_measurements.subband_cqi_tot[eNB_id][subband] += phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband];
phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(phy_vars_ue->PHY_measurements.subband_cqi[eNB_id][aarx][subband],
phy_vars_ue->PHY_measurements.n0_power[aarx]);
......
......@@ -1832,13 +1832,13 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
lte_ue_pdcch_vars[eNB_id]->llr16, //subsequent function require 16 bit llr, but output must be 8 bit (actually clipped to 4, because of the Viterbi decoder)
lte_ue_pdcch_vars[eNB_id]->llr,
s);
/*
#ifdef DEBUG_PHY
if (subframe==5) {
write_output("llr8_seq.m","llr8",&lte_ue_pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
write_output("llr16_seq.m","llr16",&lte_ue_pdcch_vars[eNB_id]->llr16[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
}
#endif
#endif*/
}
else {
#endif //MU_RECEIVER
......@@ -1846,9 +1846,9 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
lte_ue_pdcch_vars[eNB_id]->rxdataF_comp,
(char *)lte_ue_pdcch_vars[eNB_id]->llr,
s);
#ifdef DEBUG_PHY
/*#ifdef DEBUG_PHY
write_output("llr8_seq.m","llr8",&lte_ue_pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
#endif
#endif*/
#ifdef MU_RECEIVER
}
#endif //MU_RECEIVER
......
......@@ -4031,12 +4031,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms,phy_vars_ue->frame,subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe));
/*
msg("Scheduling UE transmission for frame %d, subframe %d harq_pid = %d\n",
pdcch_alloc2ul_frame(frame_parms,phy_vars_ue->frame,subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe),harq_pid);
*/
if (harq_pid == 255) {
LOG_E(PHY, "frame %d, subframe %d, rnti %x, format %d: illegal harq_pid!\n",
phy_vars_ue->frame, subframe, rnti, dci_format);
......
......@@ -276,6 +276,8 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) {
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
//phy_adjust_gain(phy_vars_ue,0);
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
#else
phy_adjust_gain(phy_vars_ue,0);
#endif
// SSS detection
......
......@@ -762,7 +762,7 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
pbch_E = (frame_parms->Ncp==0) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
pbch_e_rx = &lte_ue_pbch_vars->llr[frame_mod4*(pbch_E>>2)];
#ifdef DEBUG_PBCH
msg("[PBCH] starting symbol loop\n");
msg("[PBCH] starting symbol loop (Ncp %d, frame_mod4 %d,mimo_mode %d\n",frame_parms->Ncp,frame_mod4,mimo_mode);
#endif
// clear LLR buffer
......
......@@ -142,10 +142,6 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
uint8_t i;
uint32_t symbol_offset,m,re_offset,reg_offset;
int16_t gain_lin_QPSK;
#ifdef IFFT_FPGA
uint8_t qpsk_table_offset = 0;
uint8_t qpsk_table_offset2 = 0;
#endif
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
int nushiftmod3 = frame_parms->nushift%3;
......@@ -164,28 +160,15 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
gain_lin_QPSK = amp/2;
if (frame_parms->mode1_flag) { // SISO
#ifndef IFFT_FPGA
for (i=0;i<16;i++) {
((int16_t*)(&(pcfich_d[0][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[1][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[0][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[1][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
}
#else
for (i=0;i<16;i++) {
qpsk_table_offset = MOD_TABLE_QPSK_OFFSET;
if (pcfich_bt[2*i] == 1)
qpsk_table_offset+=2;
if (pcfich_bt[2*i+1] == 1)
qpsk_table_offset+=1;
pcfich_d[0][i] = (mod_sym_t) qpsk_table_offset;
pcfich_d[1][i] = (mod_sym_t) qpsk_table_offset;
}
#endif
}
else { // ALAMOUTI
#ifndef IFFT_FPGA
for (i=0;i<16;i+=2) {
// first antenna position n -> x0
((int16_t*)(&(pcfich_d[0][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
......@@ -201,83 +184,25 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
}
#else
for (i=0;i<16;i+=2) {
qpsk_table_offset = MOD_TABLE_QPSK_OFFSET; //x0
qpsk_table_offset2 = MOD_TABLE_QPSK_OFFSET; //x0*
// flipping bit for imag part of symbol means taking x0*
if (pcfich_bt[2*i] == 1) { //real
qpsk_table_offset+=2;
qpsk_table_offset2+=2;
}
if (pcfich_bt[2*i+1] == 1) //imag
qpsk_table_offset+=1;
else
qpsk_table_offset2+=1;
pcfich_d[0][i] = (mod_sym_t) qpsk_table_offset; // x0
pcfich_d[1][i+1] = (mod_sym_t) qpsk_table_offset2; // x0*
qpsk_table_offset = MOD_TABLE_QPSK_OFFSET; //-x1*
qpsk_table_offset2 = MOD_TABLE_QPSK_OFFSET;//x1
// flipping bit for real part of symbol means taking -x1*
if (pcfich_bt[2*i+2] == 1) //real
qpsk_table_offset2+=2;
else
qpsk_table_offset+=2;
if (pcfich_bt[2*i+3] == 1) { //imag
qpsk_table_offset+=1;
qpsk_table_offset2+=1;
}
pcfich_d[1][i] = (mod_sym_t) qpsk_table_offset; // -x1*
pcfich_d[0][i+1] = (mod_sym_t) qpsk_table_offset2; // x1
}
#endif
}
// mapping
nsymb = (frame_parms->Ncp==0) ? 14:12;
#ifdef IFFT_FPGA
symbol_offset = (uint32_t)frame_parms->N_RB_DL*12*((subframe*nsymb));
re_offset = frame_parms->N_RB_DL*12/2;
#else
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*((subframe*nsymb));
re_offset = frame_parms->first_carrier_offset;
#endif
// loop over 4 quadruplets and lookup REGs
m=0;
for (pcfich_quad=0;pcfich_quad<4;pcfich_quad++) {
reg_offset = re_offset+((uint16_t)pcfich_reg[pcfich_quad]*6);
#ifdef IFFT_FPGA
if (reg_offset>=(frame_parms->N_RB_DL*12))
reg_offset-=(frame_parms->N_RB_DL*12);
#else
if (reg_offset>=frame_parms->ofdm_symbol_size)
reg_offset=1 + reg_offset-frame_parms->ofdm_symbol_size;
#endif
// printf("mapping pcfich reg_offset %d\n",reg_offset);
for (i=0;i<6;i++) {
if ((i!=nushiftmod3)&&(i!=(nushiftmod3+3))) {
txdataF[0][symbol_offset+reg_offset+i] = pcfich_d[0][m];
/*
#ifndef IFFT_FPGA
printf("pcfich: quad %d, i %d, offset %d => m%d (%d,%d)\n",pcfich_quad,i,reg_offset+i,m,
((int16_t*)&txdataF[0][symbol_offset+reg_offset+i])[0],
((int16_t*)&txdataF[0][symbol_offset+reg_offset+i])[1]);
#else
printf("pcfich: quad %d, i %d, offset %d => m%d (%d)\n",pcfich_quad,i,reg_offset+i,m,
txdataF[0][symbol_offset+reg_offset+i]);
#endif
*/
if (frame_parms->nb_antennas_tx_eNB>1)
txdataF[1][symbol_offset+reg_offset+i] = pcfich_d[1][m];
m++;
......
......@@ -1158,6 +1158,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
#endif
start_meas(&phy_vars_eNB->ulsch_rate_unmatching_stats);
if (lte_rate_matching_turbo_rx(ulsch->harq_processes[harq_pid]->RTC[r],
G,
ulsch->harq_processes[harq_pid]->w[r],
......@@ -1188,14 +1189,14 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
&ulsch->harq_processes[harq_pid]->d[r][96],
ulsch->harq_processes[harq_pid]->w[r]);
stop_meas(&phy_vars_eNB->ulsch_deinterleaving_stats);
/*#ifdef DEBUG_ULSCH_DECODING
/*
#ifdef DEBUG_ULSCH_DECODING
msg("decoder input(segment %d) :",r);
for (i=0;i<(3*8*Kr_bytes)+12;i++)
msg("%d : %d\n",i,ulsch->harq_processes[harq_pid]->d[r][96+i]);
msg("\n");
#endif*/
#endif
*/
}
#ifdef OMP
......
......@@ -1565,7 +1565,7 @@ void dump_ulsch(PHY_VARS_eNB *PHY_vars_eNB,uint8_t sched_subframe, uint8_t UE_id
harq_pid = subframe2harq_pid(&PHY_vars_eNB->lte_frame_parms,PHY_vars_eNB->proc[sched_subframe].frame_rx,subframe);
printf("Dumping ULSCH in subframe %d with harq_pid %d, for NB_rb %d, mcs %d, Qm %d, N_symb %d\n", subframe,harq_pid,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs,get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs),PHY_vars_eNB->ulsch_eNB[UE_id]->Nsymb_pusch);
#ifndef OAI_EMU
//#ifndef OAI_EMU
write_output("/tmp/ulsch_d.m","ulsch_dseq",&PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->d[0][96],
PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
write_output("/tmp/rxsig0.m","rxs0", &PHY_vars_eNB->lte_eNB_common_vars.rxdata[0][0][0],PHY_vars_eNB->lte_frame_parms.samples_per_tti*10,1,1);
......@@ -1590,6 +1590,6 @@ void dump_ulsch(PHY_VARS_eNB *PHY_vars_eNB,uint8_t sched_subframe, uint8_t UE_id
write_output("/tmp/ulsch_rxF_llr.m","ulsch_llr",PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->llr,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb*12*get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs)*PHY_vars_eNB->ulsch_eNB[UE_id]->Nsymb_pusch,1,0);
write_output("/tmp/ulsch_ch_mag.m","ulsch_ch_mag",&PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->ul_ch_mag[0][0][0],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
// write_output("ulsch_ch_mag1.m","ulsch_ch_mag1",&PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->ul_ch_mag[0][1][0],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
#endif
//#endif
}
......@@ -89,6 +89,8 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms);
void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
void remove_7_5_kHz(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe);
void apply_7_5_kHz(PHY_VARS_UE *phy_vars_ue,int32_t*txdata,uint8_t subframe);
......
......@@ -37,7 +37,7 @@ This section deals with basic functions for OFDM Modulation.
*/
#include "PHY/defs.h"
#include "UTIL/LOG/log.h"
//static short temp2[2048*4] __attribute__((aligned(16)));
......@@ -244,4 +244,64 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
*/
}
void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) {
int aa, slot_offset, slot_offset_F;
slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if (is_pmch_subframe(frame,next_slot>>1,frame_parms)) {
if ((next_slot%2)==0) {
LOG_D(PHY,"Frame %d, subframe %d: Doing MBSFN modulation (slot_offset %d)\n",frame,next_slot>>1,slot_offset);
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
12, // number of symbols
frame_parms->ofdm_symbol_size>>2, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX);
if (frame_parms->Ncp == EXTENDED)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
2, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX);
else {
LOG_D(PHY,"Frame %d, subframe %d: Doing PDCCH modulation\n",frame,next_slot>>1);
normal_prefix_mod(&txdataF[aa][slot_offset_F],
&txdata[aa][slot_offset],
2,
frame_parms);
}
}
}
else {
if (frame_parms->Ncp == EXTENDED)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX);
else {
normal_prefix_mod(&txdataF[aa][slot_offset_F],
&txdata[aa][slot_offset],
7,
frame_parms);
}
}
}
}
/** @} */
......@@ -102,11 +102,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
for (aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
#ifdef NEW_FFT
memset(&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
#else