Commit b27a5532 authored by Florian Kaltenberger's avatar Florian Kaltenberger

fixed bug in ulsch_scheduler

ue runs again on exmimo2 (but does not connect yet)
added openair0_reconfig function in exmimo2 library
added sensing thread for SPECTRA in lte-softmodem (protected by #ifdef SPECTRA)
added Rohde and Schwarz client


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5780 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent af31c053
...@@ -51,15 +51,8 @@ ...@@ -51,15 +51,8 @@
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index); extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
#ifdef EXMIMO #ifdef EXMIMO
#ifdef DRIVER2013 #include "common_lib.h"
#include "openair0_lib.h" extern openair0_config_t openair0_cfg[];
extern int card;
#else
#include "ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_device.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#endif
#endif #endif
int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t mode, int input_level_dBm) { int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t mode, int input_level_dBm) {
...@@ -67,11 +60,6 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -67,11 +60,6 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
uint8_t eNB=0; uint8_t eNB=0;
uint32_t RRC_status; uint32_t RRC_status;
int len=length; int len=length;
#ifdef EXMIMO
#ifdef DRIVER2013
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
#endif
#endif
if (phy_vars_ue==NULL) if (phy_vars_ue==NULL)
return 0; return 0;
...@@ -93,11 +81,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -93,11 +81,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
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
#ifdef DRIVER2013 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, (p_exmimo_config->rf.rf_mode[0]& LNAGAINMASK) >> 14,p_exmimo_config->rf.rx_gain[0][0]);
#else
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, (p_exmimo_config->rf.rf_mode[0]& LNAGAINMASK) >> 14,exmimo_pci_interface->rf.rx_gain00);
#endif
#else #else
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d 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);
#endif #endif
...@@ -244,10 +228,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -244,10 +228,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
phy_vars_ue->PHY_measurements.n0_power_dB[1]); phy_vars_ue->PHY_measurements.n0_power_dB[1]);
#ifdef EXMIMO #ifdef EXMIMO
phy_vars_ue->rx_total_gain_dB = ((int)(10*log10(phy_vars_ue->PHY_measurements.rssi)))-input_level_dBm; phy_vars_ue->rx_total_gain_dB = ((int)(10*log10(phy_vars_ue->PHY_measurements.rssi)))-input_level_dBm;
len += sprintf(&buffer[len], "[UE PROC] rf_mode %d, input level (set by user) %d dBm, VGA gain %d dB ==> total gain %3.2f dB, noise figure %3.2f dB\n", len += sprintf(&buffer[len], "[UE PROC] rxg_mode %d, input level (set by user) %d dBm, VGA gain %d dB ==> total gain %3.2f dB, noise figure %3.2f dB\n",
p_exmimo_config->rf.rf_mode[0], openair0_cfg[0].rxg_mode[0],
input_level_dBm, input_level_dBm,
p_exmimo_config->rf.rx_gain[0][0], (int)openair0_cfg[0].rx_gain[0],
10*log10(phy_vars_ue->PHY_measurements.rssi)-input_level_dBm, 10*log10(phy_vars_ue->PHY_measurements.rssi)-input_level_dBm,
10*log10(phy_vars_ue->PHY_measurements.n0_power_tot)-phy_vars_ue->rx_total_gain_dB+105); 10*log10(phy_vars_ue->PHY_measurements.n0_power_tot)-phy_vars_ue->rx_total_gain_dB+105);
#endif #endif
...@@ -259,12 +243,14 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -259,12 +243,14 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
return len; return len;
} // is_clusterhead } // is_clusterhead
int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
unsigned int success=0; unsigned int success=0;
uint8_t eNB,UE_id,i,j,number_of_cards_l=1; uint8_t eNB,UE_id,i,j,number_of_cards_l=1;
uint32_t ulsch_errors=0; uint32_t ulsch_errors=0,dlsch_errors=0;
uint32_t ulsch_round_attempts[4]={0,0,0,0},ulsch_round_errors[4]={0,0,0,0}; uint32_t ulsch_round_attempts[4]={0,0,0,0},ulsch_round_errors[4]={0,0,0,0};
uint32_t dlsch_round_attempts[4]={0,0,0,0},dlsch_round_errors[4]={0,0,0,0};
uint32_t UE_id_mac, RRC_status; uint32_t UE_id_mac, RRC_status;
if (phy_vars_eNB==NULL) if (phy_vars_eNB==NULL)
return 0; return 0;
...@@ -332,18 +318,21 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -332,18 +318,21 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
#ifdef OPENAIR2 #ifdef OPENAIR2
if (phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti>0) { if (phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti>0) {
#endif #endif
len += sprintf(&buffer[len],"[eNB PROC] UE %d (%x) RSSI: (%d,%d) dBm, Sector %d, DLSCH Mode %d\n", len += sprintf(&buffer[len],"[eNB PROC] UE %d (%x) Power: (%d,%d) dB, RSSI: (%d,%d) dBm, Sector %d, DLSCH Mode %d\n",
UE_id, UE_id,
phy_vars_eNB->eNB_UE_stats[UE_id].crnti, phy_vars_eNB->eNB_UE_stats[UE_id].crnti,
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[UE_id]->ulsch_power[0]),
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[UE_id]->ulsch_power[1]),
phy_vars_eNB->eNB_UE_stats[UE_id].UL_rssi[0], phy_vars_eNB->eNB_UE_stats[UE_id].UL_rssi[0],
phy_vars_eNB->eNB_UE_stats[UE_id].UL_rssi[1], phy_vars_eNB->eNB_UE_stats[UE_id].UL_rssi[1],
phy_vars_eNB->eNB_UE_stats[UE_id].sector, phy_vars_eNB->eNB_UE_stats[UE_id].sector,
phy_vars_eNB->transmission_mode[UE_id]); phy_vars_eNB->transmission_mode[UE_id]);
for(i=0;i<8;i++) for(i=0;i<8;i++)
len+= sprintf(&buffer[len]," harq %d, UE_DL_mcs %d, UE_UL_MCS %d\n", len+= sprintf(&buffer[len]," harq %d: DL mcs %d, UL mcs %d, UL rb %d\n",
i, i,
phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[i]->mcs, phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[i]->mcs,
phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[i]->mcs); phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[i]->mcs,
phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[i]->nb_rb);
len += sprintf(&buffer[len],"[eNB PROC] Wideband CQI: (%d,%d) dB\n", len += sprintf(&buffer[len],"[eNB PROC] Wideband CQI: (%d,%d) dB\n",
phy_vars_eNB->PHY_measurements_eNB[eNB].wideband_cqi_dB[UE_id][0], phy_vars_eNB->PHY_measurements_eNB[eNB].wideband_cqi_dB[UE_id][0],
...@@ -387,8 +376,14 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -387,8 +376,14 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->eNB_UE_stats[UE_id].sr_received, phy_vars_eNB->eNB_UE_stats[UE_id].sr_received,
phy_vars_eNB->eNB_UE_stats[UE_id].sr_total, phy_vars_eNB->eNB_UE_stats[UE_id].sr_total,
phy_vars_eNB->eNB_UE_stats[UE_id].sr_total-phy_vars_eNB->eNB_UE_stats[UE_id].sr_received); phy_vars_eNB->eNB_UE_stats[UE_id].sr_total-phy_vars_eNB->eNB_UE_stats[UE_id].sr_received);
ulsch_errors = 0;
for (j=0;j<4;j++) {
ulsch_round_attempts[j]=0;
ulsch_round_errors[j]=0;
}
len += sprintf(&buffer[len],"[eNB PROC] ULSCH errors/attempts per harq (per round): \n"); len += sprintf(&buffer[len],"[eNB PROC] ULSCH errors/attempts per harq (per round): \n");
for (i=0;i<8;i++) for (i=0;i<8;i++) {
len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d, %d/%d, %d/%d, %d/%d)\n", len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d, %d/%d, %d/%d, %d/%d)\n",
i, i,
phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_errors[i], phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_errors[i],
...@@ -401,9 +396,26 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -401,9 +396,26 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][2], phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][2],
phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][3], phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][3],
phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][3]); phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][3]);
ulsch_errors+=phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_errors[i];
for (j=0;j<4;j++) {
ulsch_round_attempts[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][j];
ulsch_round_errors[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][j];
}
}
len += sprintf(&buffer[len],"[eNB PROC] ULSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n",
ulsch_errors,ulsch_round_attempts[0],
ulsch_round_errors[0],ulsch_round_attempts[0],
ulsch_round_errors[1],ulsch_round_attempts[1],
ulsch_round_errors[2],ulsch_round_attempts[2],
ulsch_round_errors[3],ulsch_round_attempts[3]);
dlsch_errors = 0;
for (j=0;j<4;j++) {
dlsch_round_attempts[j]=0;
dlsch_round_errors[j]=0;
}
len += sprintf(&buffer[len],"[eNB PROC] DLSCH errors/attempts per harq (per round): \n"); len += sprintf(&buffer[len],"[eNB PROC] DLSCH errors/attempts per harq (per round): \n");
for (i=0;i<8;i++) for (i=0;i<8;i++) {
len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d)\n", len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d)\n",
i, i,
phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i], phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i],
...@@ -420,6 +432,19 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -420,6 +432,19 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_ACK[i][3], phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_ACK[i][3],
phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][3], phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][3],
phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][3]); phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][3]);
dlsch_errors+=phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i];
for (j=0;j<4;j++) {
dlsch_round_attempts[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][j];
dlsch_round_errors[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][j];
}
}
len += sprintf(&buffer[len],"[eNB PROC] DLSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n",
dlsch_errors,dlsch_round_attempts[0],
dlsch_round_errors[0],dlsch_round_attempts[0],
dlsch_round_errors[1],dlsch_round_attempts[1],
dlsch_round_errors[2],dlsch_round_attempts[2],
dlsch_round_errors[3],dlsch_round_attempts[3]);
len += sprintf(&buffer[len],"[eNB PROC] DLSCH total bits from MAC: %dkbit\n",(phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS_MAC)/1000); len += sprintf(&buffer[len],"[eNB PROC] DLSCH total bits from MAC: %dkbit\n",(phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS_MAC)/1000);
len += sprintf(&buffer[len],"[eNB PROC] DLSCH total bits ack'ed: %dkbit\n",(phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS)/1000); len += sprintf(&buffer[len],"[eNB PROC] DLSCH total bits ack'ed: %dkbit\n",(phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS)/1000);
......
...@@ -258,15 +258,14 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, ...@@ -258,15 +258,14 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue,
} }
ulsch->uci_format = HLC_subband_cqi_nopmi; ulsch->uci_format = HLC_subband_cqi_nopmi;
//int flag_LA = 0; /*
// if(flag_LA==1) if(flag_LA==1)
// {
sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, eNB_id); sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, eNB_id);
else
sinr_eff = meas->wideband_cqi_avg[eNB_id];
*/
fill_CQI(ulsch->o,ulsch->uci_format,meas,eNB_id,0, transmission_mode,phy_vars_ue->sinr_eff);
fill_CQI(ulsch->o,ulsch->uci_format,meas,eNB_id,0, transmission_mode,sinr_eff);
// }
// else
// fill_CQI(ulsch->o,ulsch->uci_format,meas,eNB_id,transmission_mode);
if (((phy_vars_ue->frame_tx % 100) == 0) || (phy_vars_ue->frame_tx < 10)) if (((phy_vars_ue->frame_tx % 100) == 0) || (phy_vars_ue->frame_tx < 10))
print_CQI(ulsch->o,ulsch->uci_format,eNB_id); print_CQI(ulsch->o,ulsch->uci_format,eNB_id);
} }
......
...@@ -892,11 +892,14 @@ int ulsch_encoding_emul(uint8_t *ulsch_buffer, ...@@ -892,11 +892,14 @@ int ulsch_encoding_emul(uint8_t *ulsch_buffer,
eNB_id,phy_vars_ue->Mod_id, harq_pid, rnti,ulsch->o_ACK[0],ulsch->o_ACK[1]); eNB_id,phy_vars_ue->Mod_id, harq_pid, rnti,ulsch->o_ACK[0],ulsch->o_ACK[1]);
if (ulsch->O>0) { if (ulsch->O>0) {
// int flag_LA =0; /*
if(flag_LA==1)
sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, eNB_id); sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, eNB_id);
else
sinr_eff = meas->wideband_cqi_avg[eNB_id];
*/
fill_CQI(ulsch->o,ulsch->uci_format,meas,eNB_id,rnti,tmode,sinr_eff); fill_CQI(ulsch->o,ulsch->uci_format,meas,eNB_id,rnti,tmode,phy_vars_ue->sinr_eff);
//LOG_D(PHY,"UE CQI\n"); //LOG_D(PHY,"UE CQI\n");
// print_CQI(ulsch->o,ulsch->uci_format,eNB_id); // print_CQI(ulsch->o,ulsch->uci_format,eNB_id);
......
...@@ -442,7 +442,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, ...@@ -442,7 +442,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
float **chest_t_abs; float **chest_t_abs;
float time[FRAME_LENGTH_COMPLEX_SAMPLES]; float time[FRAME_LENGTH_COMPLEX_SAMPLES];
float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx];
int frame = phy_vars_ue->frame; int frame = phy_vars_ue->frame_rx;
uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id];
int coded_bits_per_codeword = 0; int coded_bits_per_codeword = 0;
int mcs = 0; int mcs = 0;
......
...@@ -137,7 +137,7 @@ extern struct timing_info_t { ...@@ -137,7 +137,7 @@ extern struct timing_info_t {
*/ */
#ifdef EXMIMO #ifdef EXMIMO
extern uint32_t carrier_freq[4]; extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
#endif #endif
#ifdef USER_MODE #ifdef USER_MODE
...@@ -1390,7 +1390,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1390,7 +1390,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms;
// int aa; // int aa;
#if defined(EXMIMO) && defined(DRIVER2013) #if defined(EXMIMO) && defined(DRIVER2013)
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr; exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr;
int aa; int aa;
#endif #endif
int Mod_id=phy_vars_ue->Mod_id; int Mod_id=phy_vars_ue->Mod_id;
...@@ -1423,7 +1423,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1423,7 +1423,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
if (l==0) { if (l==0) {
// UE measurements // UE measurements
if (abstraction_flag==0) { if (abstraction_flag==0) {
//LOG_D(PHY,"Calling measurements with rxdata %p\n",phy_vars_ue->lte_ue_common_vars.rxdata); LOG_D(PHY,"Calling measurements subframe %d, rxdata %p\n",subframe_rx,phy_vars_ue->lte_ue_common_vars.rxdata);
lte_ue_measurements(phy_vars_ue, lte_ue_measurements(phy_vars_ue,
(subframe_rx*frame_parms->samples_per_tti+phy_vars_ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME), (subframe_rx*frame_parms->samples_per_tti+phy_vars_ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME),
...@@ -1481,7 +1481,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1481,7 +1481,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
slot_rx, slot_rx,
abstraction_flag); abstraction_flag);
phy_vars_ue->sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, 0); //phy_vars_ue->sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, 0);
} }
...@@ -1509,14 +1509,14 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1509,14 +1509,14 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
0, 0,
16384); 16384);
if (openair_daq_vars.auto_freq_correction == 1) { /* if (openair_daq_vars.auto_freq_correction == 1) {
if (frame_rx % 100 == 0) { if (frame_rx % 100 == 0) {
if ((phy_vars_ue->lte_ue_common_vars.freq_offset>100) && (openair_daq_vars.freq_offset < 1000)) { if ((phy_vars_ue->lte_ue_common_vars.freq_offset>100) && (openair_daq_vars.freq_offset < 1000)) {
openair_daq_vars.freq_offset+=100; openair_daq_vars.freq_offset+=100;
#if defined(EXMIMO) && defined(DRIVER2013) #if defined(EXMIMO) && defined(DRIVER2013)
for (aa = 0; aa<4; aa++) { for (aa = 0; aa<4; aa++) {
p_exmimo_config->rf.rf_freq_rx[aa] = carrier_freq[aa]+=openair_daq_vars.freq_offset; p_exmimo_config->rf.rf_freq_rx[aa] = downlink_frequency[aa]+=openair_daq_vars.freq_offset;
p_exmimo_config->rf.rf_freq_tx[aa] = carrier_freq[aa]+=openair_daq_vars.freq_offset; p_exmimo_config->rf.rf_freq_tx[aa] = downlink_frequency[aa]+=openair_daq_vars.freq_offset;
} }
#endif #endif
} }
...@@ -1524,13 +1524,13 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1524,13 +1524,13 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
openair_daq_vars.freq_offset-=100; openair_daq_vars.freq_offset-=100;
#if defined(EXMIMO) && defined(DRIVER2013) #if defined(EXMIMO) && defined(DRIVER2013)
for (aa = 0; aa<4; aa++) { for (aa = 0; aa<4; aa++) {
p_exmimo_config->rf.rf_freq_rx[aa] = carrier_freq[aa]+=openair_daq_vars.freq_offset; p_exmimo_config->rf.rf_freq_rx[aa] = downlink_frequency[aa]+=openair_daq_vars.freq_offset;
p_exmimo_config->rf.rf_freq_tx[aa] = carrier_freq[aa]+=openair_daq_vars.freq_offset; p_exmimo_config->rf.rf_freq_tx[aa] = downlink_frequency[aa]+=openair_daq_vars.freq_offset;
} }
#endif #endif
} }
} }
} }*/
} }
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_OUT); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_OUT);
...@@ -3414,7 +3414,7 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold ...@@ -3414,7 +3414,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 #ifdef EXMIMO
#ifndef USRP #ifndef USRP
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[card].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
#endif #endif
start_meas(&phy_vars_ue->phy_proc); start_meas(&phy_vars_ue->phy_proc);
......
...@@ -116,7 +116,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u ...@@ -116,7 +116,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += ((alpha_lut[phy_vars_ue->lte_frame_parms.ul_power_control_config_common.alpha]*PL)/100); phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += ((alpha_lut[phy_vars_ue->lte_frame_parms.ul_power_control_config_common.alpha]*PL)/100);
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH; phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH;
phy_vars_ue->ulsch_ue[eNB_id]->PHR = 15-phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH; // 15 dBm, FIX ME should be P0_max phy_vars_ue->ulsch_ue[eNB_id]->PHR = phy_vars_ue->tx_power_max_dBm-phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH; // 15 dBm, FIX ME should be P0_max
if (phy_vars_ue->ulsch_ue[eNB_id]->PHR < -23) if (phy_vars_ue->ulsch_ue[eNB_id]->PHR < -23)
phy_vars_ue->ulsch_ue[eNB_id]->PHR = -23; phy_vars_ue->ulsch_ue[eNB_id]->PHR = -23;
......
...@@ -520,7 +520,7 @@ typedef struct{ ...@@ -520,7 +520,7 @@ typedef struct{
uint8_t bsr_info[MAX_NUM_LCGID]; uint8_t bsr_info[MAX_NUM_LCGID];
/// phr information /// phr information
uint8_t phr_info; int8_t phr_info;
//dl buffer info //dl buffer info
uint32_t dl_buffer_info[MAX_NUM_LCID]; uint32_t dl_buffer_info[MAX_NUM_LCID];
......
...@@ -99,7 +99,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_id,frame_t frameP,rnti_t rntiP,uint8_ ...@@ -99,7 +99,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_id,frame_t frameP,rnti_t rntiP,uint8_
switch (rx_ces[i]) { // implement and process BSR + CRNTI + switch (rx_ces[i]) { // implement and process BSR + CRNTI +
case POWER_HEADROOM: case POWER_HEADROOM:
if (UE_id != UE_INDEX_INVALID ){ if (UE_id != UE_INDEX_INVALID ){
UE_list->UE_template[CC_id][UE_id].phr_info = (payload_ptr[0] & 0x3f);// - PHR_MAPPING_OFFSET; UE_list->UE_template[CC_id][UE_id].phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET;
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], UE_list->UE_template[CC_id][UE_id].phr_info); LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], UE_list->UE_template[CC_id][UE_id].phr_info);
} }
payload_ptr+=sizeof(POWER_HEADROOM_CMD); payload_ptr+=sizeof(POWER_HEADROOM_CMD);
...@@ -490,7 +490,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, ...@@ -490,7 +490,7 @@ void schedule_ulsch_rnti(module_id_t module_idP,
uint8_t status = 0; uint8_t status = 0;
uint8_t rb_table_index = -1; uint8_t rb_table_index = -1;
uint16_t TBS,i; uint16_t TBS,i;
uint32_t buffer_occupancy; int32_t buffer_occupancy;
uint32_t tmp_bsr; uint32_t tmp_bsr;
uint32_t cqi_req,cshift,ndi,mcs,rballoc; uint32_t cqi_req,cshift,ndi,mcs,rballoc;
...@@ -521,25 +521,25 @@ void schedule_ulsch_rnti(module_id_t module_idP, ...@@ -521,25 +521,25 @@ void schedule_ulsch_rnti(module_id_t module_idP,
if (eNB_UE_stats==NULL) if (eNB_UE_stats==NULL)
mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n");
LOG_I(MAC,"[eNB %d] Scheduler Frame %d, subframeP %d, nCCE %d: Checking ULSCH next UE_id %d mode id %d (rnti %x,mode %s), format 0\n", LOG_D(MAC,"[eNB %d] Scheduler Frame %d, subframeP %d, nCCE %d: Checking ULSCH next UE_id %d mode id %d (rnti %x,mode %s), format 0\n",
module_idP,frameP,subframeP,*nCCE,UE_id,module_idP, rnti,mode_string[eNB_UE_stats->mode]); module_idP,frameP,subframeP,*nCCE,UE_id,module_idP, rnti,mode_string[eNB_UE_stats->mode]);
if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel
int8_t ret; int8_t ret;
// Get candidate harq_pid from PHY // Get candidate harq_pid from PHY
ret = mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,1); ret = mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,1);
LOG_I(MAC,"Got harq_pid %d, round %d, UE_id %d (UE_to_be_scheduled %d)\n",harq_pid,round,UE_id, LOG_D(MAC,"Got harq_pid %d, round %d, UE_id %d (UE_to_be_scheduled %d)\n",harq_pid,round,UE_id,
UE_is_to_be_scheduled(module_idP,CC_id,UE_id)); UE_is_to_be_scheduled(module_idP,CC_id,UE_id));
/* [SR] 01/07/13: Don't schedule UE if we cannot get harq pid */ /* [SR] 01/07/13: Don't schedule UE if we cannot get harq pid */
//#ifndef EXMIMO_IOT #ifndef EXMIMO_IOT
// if ((((UE_is_to_be_scheduled(module_idP,CC_id,UE_id)>0)) || (round>0) || ((frameP%10)==0)) && (ret == 0)) if ((((UE_is_to_be_scheduled(module_idP,CC_id,UE_id)>0)) || (round>0) || ((frameP%10)==0)) && (ret == 0))
// if there is information on bsr of DCCH, DTCH or if there is UL_SR, or if there is a packet to retransmit, or we want to schedule a periodic feedback every 10 frames // if there is information on bsr of DCCH, DTCH or if there is UL_SR, or if there is a packet to retransmit, or we want to schedule a periodic feedback every 10 frames
//#else #else
if (round==0) if (round==0)
//#endif #endif
{ {
LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframeP %d Scheduling UE %d round %d (SR %d)\n", LOG_I(MAC,"[eNB %d][PUSCH %d] Frame %d subframeP %d Scheduling UE %d round %d (SR %d)\n",
module_idP,harq_pid,frameP,subframeP,UE_id,round, module_idP,harq_pid,frameP,subframeP,UE_id,round,
UE_template->ul_SR); UE_template->ul_SR);
...@@ -636,37 +636,38 @@ void schedule_ulsch_rnti(module_id_t module_idP, ...@@ -636,37 +636,38 @@ void schedule_ulsch_rnti(module_id_t module_idP,
UE_template->nb_rb_ul[harq_pid] = rb_table[rb_table_index]; //store for possible retransmission UE_template->nb_rb_ul[harq_pid] = rb_table[rb_table_index]; //store for possible retransmission
buffer_occupancy -= mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]); // the max TBS that could be served is : mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]
i = bytes_to_bsr_index((int32_t)buffer_occupancy); TBS = mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]);
buffer_occupancy -= TBS;
// Adjust BSR entries for LCGIDs // Adjust BSR entries for LCGIDs
if (i>0) { if (buffer_occupancy > 0 ) { // could not serve all the uplink traffic
if (UE_template->bsr_info[LCGID0] <= i) { if (BSR_TABLE[UE_template->bsr_info[LCGID0]] <= TBS ) {
tmp_bsr = BSR_TABLE[UE_template->bsr_info[LCGID0]]; tmp_bsr = BSR_TABLE[UE_template->bsr_info[LCGID0]]; // serving this amout of bytes
UE_template->bsr_info[LCGID0] = 0; UE_template->bsr_info[LCGID0] = 0;
if (BSR_TABLE[UE_template->bsr_info[LCGID1]] <= (buffer_occupancy-tmp_bsr)) { if (BSR_TABLE[UE_template->bsr_info[LCGID1]] <= (TBS-tmp_bsr)) {
tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID1]]; tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID1]];
UE_template->bsr_info[LCGID1] = 0; UE_template->bsr_info[LCGID1] = 0;
if (BSR_TABLE[UE_template->bsr_info[LCGID2]] <= (buffer_occupancy-tmp_bsr)) { if (BSR_TABLE[UE_template->bsr_info[LCGID2]] <= (TBS-tmp_bsr)) {
tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID2]]; tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID2]];
UE_template->bsr_info[LCGID2] = 0; UE_template->bsr_info[LCGID2] = 0;
if (BSR_TABLE[UE_template->bsr_info[LCGID3]] <= (buffer_occupancy-tmp_bsr)) { if (BSR_TABLE[UE_template->bsr_info[LCGID3]] <= (TBS-tmp_bsr)) {
tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID3]]; tmp_bsr += BSR_TABLE[UE_template->bsr_info[LCGID3]];
UE_template->bsr_info[LCGID3] = 0; UE_template->bsr_info[LCGID3] = 0;
} else { } else {
UE_template->bsr_info[LCGID3] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID3]] - ((int32_t)buffer_occupancy - (int32_t)tmp_bsr)); UE_template->bsr_info[LCGID3] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID3]] - ((int32_t) TBS - (int32_t)tmp_bsr));
} }
} }
else { else {
UE_template->bsr_info[LCGID2] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID2]] - ((int32_t)buffer_occupancy -(int32_t)tmp_bsr)); UE_template->bsr_info[LCGID2] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID2]] - ((int32_t)TBS - (int32_t)tmp_bsr));
} }
} }
else { else {
UE_template->bsr_info[LCGID1] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID1]] - (int32_t)buffer_occupancy); UE_template->bsr_info[LCGID1] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID1]] - ((int32_t)TBS - (int32_t)tmp_bsr));
} }
} }
else { else {
UE_template->bsr_info[LCGID0] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID0]] - (int32_t)buffer_occupancy); UE_template->bsr_info[LCGID0] = bytes_to_bsr_index((int32_t)BSR_TABLE[UE_template->bsr_info[LCGID0]] - (int32_t)TBS);
} }
} }
else { // we have flushed all buffers so clear bsr else { // we have flushed all buffers so clear bsr
......
...@@ -110,7 +110,7 @@ int dump_eNB_l2_stats(char *buffer, int length){ ...@@ -110,7 +110,7 @@ int dump_eNB_l2_stats(char *buffer, int length){
} }
len += sprintf(&buffer[len],"\n"); len += sprintf(&buffer[len],"\n");
for (UE_id=UE_list->head;UE_id>0;UE_id=UE_list->next[UE_id]) { for (UE_id=UE_list->head;UE_id>=0;UE_id=UE_list->next[UE_id]) {
for (i=0;i<UE_list->numactiveCCs[UE_id];i++) { for (i=0;i<UE_list->numactiveCCs[UE_id];i++) {
CC_id=UE_list->ordered_CCids[i][UE_id]; CC_id=UE_list->ordered_CCids[i][UE_id];
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_bitrate=((UE_list->eNB_UE_stats[CC_id][UE_id].TBS*8)/((eNB->frame + 1)*10)); UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_bitrate=((UE_list->eNB_UE_stats[CC_id][UE_id].TBS*8)/((eNB->frame + 1)*10));
...@@ -118,7 +118,7 @@ int dump_eNB_l2_stats(char *buffer, int length){ ...@@ -118,7 +118,7 @@ int dump_eNB_l2_stats(char *buffer, int length){
UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes+= UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes; UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes+= UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes;
UE_list->eNB_UE_stats[CC_id][UE_id].avg_overhead_bytes=((UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes*8)/((eNB->frame + 1)*10)); UE_list->eNB_UE_stats[CC_id][UE_id].avg_overhead_bytes=((UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes*8)/((eNB->frame + 1)*10));
len += sprintf(&buffer[len],"UE %d %s, RNTI %x : CQI %d, MCS(%d->%d), RB(tx %d, retx %d, total %d), ncce (tx %d, retx %d) \n ", len += sprintf(&buffer[len],"UE %d %s, RNTI %x : CQI %d, MCS1 %d, MCS2 %d, RB (tx %d, retx %d, total %d), ncce (tx %d, retx %d) \n",
UE_id, UE_id,
map_int_to_str(rrc_status_names, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status), map_int_to_str(rrc_status_names, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status),
UE_list->eNB_UE_stats[CC_id][UE_id].crnti, UE_list->eNB_UE_stats[CC_id][UE_id].crnti,
...@@ -135,7 +135,7 @@ int dump_eNB_l2_stats(char *buffer, int length){ ...@@ -135,7 +135,7 @@ int dump_eNB_l2_stats(char *buffer, int length){
len += sprintf(&buffer[len], len += sprintf(&buffer[len],
"[MAC] DLSCH bitrate (TTI %d, avg %d), Transmitted bytes " "[MAC] DLSCH bitrate (TTI %d, avg %d), Transmitted bytes "
"(TTI %d, total %"PRIu64"), Total Transmitted PDU %d, Overhead " "(TTI %d, total %"PRIu64"), Total Transmitted PDU %d, Overhead "
"(TTI %"PRIu64", total %"PRIu64", avg %"PRIu64, "(TTI %"PRIu64", total %"PRIu64", avg %"PRIu64")\n",
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_bitrate, UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_bitrate,
UE_list->eNB_UE_stats[CC_id][UE_id].total_dlsch_bitrate, UE_list->eNB_UE_stats[CC_id][UE_id].total_dlsch_bitrate,
UE_list->eNB_UE_stats[CC_id][UE_id].TBS, UE_list->eNB_UE_stats[CC_id][UE_id].TBS,
...@@ -145,6 +145,7 @@ int dump_eNB_l2_stats(char *buffer, int length){ ...@@ -145,6 +145,7 @@ int dump_eNB_l2_stats(char *buffer, int length){
UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes, UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes,
UE_list->eNB_UE_stats[CC_id][UE_id].avg_overhead_bytes UE_list->eNB_UE_stats[CC_id][UE_id].avg_overhead_bytes
); );
len+= sprintf(&buffer[len],"Received PHR PH = %d (db)\n", UE_list->UE_template[CC_id][UE_id].phr_info);
} }
} }
......
...@@ -734,8 +734,8 @@ uint8_t do_SIB23(uint8_t Mod_id, ...@@ -734,8 +734,8 @@ uint8_t do_SIB23(uint8_t Mod_id,
// uplinkPowerControlCommon // uplinkPowerControlCommon
#ifdef EXMIMO #ifdef EXMIMO
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -90; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -98;//-90;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -96; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -98;//-96;
#else #else
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108;
......
...@@ -897,7 +897,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration( ...@@ -897,7 +897,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
MeasObj->measObjectId = 1; MeasObj->measObjectId = 1;
MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
//MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
...@@ -1143,7 +1144,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration( ...@@ -1143,7 +1144,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
memset(buffer, 0, RRC_BUF_SIZE); memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCConnectionReconfiguration(enb_mod_idP, buffer, ue_mod_idP, rrc_eNB_get_next_transaction_identifier(enb_mod_idP), //Transaction_id, size = do_RRCConnectionReconfiguration(enb_mod_idP, buffer, ue_mod_idP,
rrc_eNB_get_next_transaction_identifier(enb_mod_idP), //Transaction_id,
NULL, /// NN: do not reconfig srb1: SRB_configList2, NULL, /// NN: do not reconfig srb1: SRB_configList2,
*DRB_configList, NULL, // DRB2_list, *DRB_configList, NULL, // DRB2_list,
NULL, // *sps_Config, NULL, // *sps_Config,
...@@ -2483,10 +2485,7 @@ void rrc_eNB_generate_RRCConnectionSetup( ...@@ -2483,10 +2485,7 @@ void rrc_eNB_generate_RRCConnectionSetup(
eNB_rrc_inst[enb_mod_idP].Srb0.Tx_buffer.payload_size = eNB_rrc_inst[enb_mod_idP].Srb0.Tx_buffer.payload_size =
do_RRCConnectionSetup(enb_mod_idP, do_RRCConnectionSetup(enb_mod_idP,
(uint8_t *) eNB_rrc_inst[enb_mod_idP].Srb0.Tx_buffer.Payload, (uint8_t *) eNB_rrc_inst[enb_mod_idP].Srb0.Tx_buffer.Payload,
mac_xface->get_transmission_mode(enb_mod_idP,0, //CC_id 0!!!! (mac_xface->lte_frame_parms->nb_antennas_tx==2)?2:1,
UE_RNTI
(enb_mod_idP,
ue_mod_idP)),
ue_mod_idP, ue_mod_idP,
rrc_eNB_get_next_transaction_identifier(enb_mod_idP), rrc_eNB_get_next_transaction_identifier(enb_mod_idP),
mac_xface->lte_frame_parms, mac_xface->lte_frame_parms,
...@@ -3128,9 +3127,9 @@ int rrc_eNB_decode_dcch( ...@@ -3128,9 +3127,9 @@ int rrc_eNB_decode_dcch(
ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
array[0]->ueCapabilityRAT_Container.size, 0, 0); array[0]->ueCapabilityRAT_Container.size, 0, 0);
#ifdef XER_PRINT //#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability); xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability);
#endif //#endif
#if defined(ENABLE_USE_MME) #if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) { if (EPC_MODE_ENABLED == 1) {
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#include "openair0_lib.h" #include "openair0_lib.h"
#include "gain_control.h" #include "gain_control.h"
//#define DEBUG_PHY //#define DEBUG_PHY
#ifdef DEBUG_PHY
#include "UTIL/LOG/log_extern.h"
#endif
void gain_control_all (unsigned int rx_power_fil_dB, unsigned int card) { void gain_control_all (unsigned int rx_power_fil_dB, unsigned int card) {
unsigned int ant; unsigned int ant;
...@@ -84,7 +87,7 @@ void gain_control (unsigned int rx_power_fil_dB, unsigned int ant, unsigned int ...@@ -84,7 +87,7 @@ void gain_control (unsigned int rx_power_fil_dB, unsigned int ant, unsigned int
} }
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
LOG_D(PHY,"AGC for chain %d: rx_power_fil_dB=%d, rx_gain=%d, LNA=%d (1=Byp,2=Med,3=Max)\n",ant,rx_power_fil_dB,p_exmimo_config->rf.rx_gain[ant][0],(p_exmimo_config->rf.rf_mode&LNAGAINMASK)>>14); LOG_D(PHY,"AGC for chain %d: rx_power_fil_dB=%d, rx_gain=%d, LNA=%d (1=Byp,2=Med,3=Max)\n",ant,rx_power_fil_dB,p_exmimo_config->rf.rx_gain[ant][0],(p_exmimo_config->rf.rf_mode[ant]&LNAGAINMASK)>>14);
#endif //DEBUG_PHY #endif //DEBUG_PHY
} }
......
...@@ -356,14 +356,14 @@ int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -356,14 +356,14 @@ int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX + TXLPFNORM + TXLPFEN + tx_filter); p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX + TXLPFNORM + TXLPFEN + tx_filter);
p_exmimo_config->rf.rf_freq_tx[ant] = (unsigned int)openair0_cfg[card].tx_freq[ant]; p_exmimo_config->rf.rf_freq_tx[ant] = (unsigned int)openair0_cfg[card].tx_freq[ant];
p_exmimo_config->rf.tx_gain[ant][0] = (unsigned int)openair0_cfg[card].tx_gain[ant]; p_exmimo_config->rf.tx_gain[ant][0] = (unsigned int)openair0_cfg[card].tx_gain[ant];
printf("openair0 : programming TX antenna %d (freq %u, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_tx[ant],p_exmimo_config->rf.tx_gain[ant][0]); printf("openair0 : programming card %d TX antenna %d (freq %u, gain %d)\n",card,ant,p_exmimo_config->rf.rf_freq_tx[ant],p_exmimo_config->rf.tx_gain[ant][0]);
} }
if (openair0_cfg[card].rx_freq[ant]) { if (openair0_cfg[card].rx_freq[ant]) {
p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX + RXLPFNORM + RXLPFEN + rx_filter); p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX + RXLPFNORM + RXLPFEN + rx_filter);
p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant]; p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant];
p_exmimo_config->rf.rx_gain[ant][0] = (unsigned int)openair0_cfg[card].rx_gain[ant]; p_exmimo_config->rf.rx_gain[ant][0] = (unsigned int)openair0_cfg[card].rx_gain[ant];
printf("openair0 : programming RX antenna %d (freq %u, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]); printf("openair0 : programming card %d RX antenna %d (freq %u, gain %d)\n",card,ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]);
switch (openair0_cfg[card].rxg_mode[ant]) { switch (openair0_cfg[card].rxg_mode[ant]) {
default: default:
...@@ -409,6 +409,55 @@ int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -409,6 +409,55 @@ int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag)
return(0); return(0);
} }
int openair0_reconfig(openair0_config_t *openair0_cfg)
{
int ret;
int ant, card;
exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
if (!openair0_cfg) {
printf("Error, openair0_cfg is null!!\n");
return(-1);
}
for (card=0; card<openair0_num_detected_cards; card++) {
p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr;
for (ant=0;ant<4;ant++) {
if (openair0_cfg[card].tx_freq[ant]) {
p_exmimo_config->rf.rf_freq_tx[ant] = (unsigned int)openair0_cfg[card].tx_freq[ant];
p_exmimo_config->rf.tx_gain[ant][0] = (unsigned int)openair0_cfg[card].tx_gain[ant];
//printf("openair0 : programming TX antenna %d (freq %u, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_tx[ant],p_exmimo_config->rf.tx_gain[ant][0]);
}
if (openair0_cfg[card].rx_freq[ant]) {
p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant];
p_exmimo_config->rf.rx_gain[ant][0] = (unsigned int)openair0_cfg[card].rx_gain[ant];
//printf("openair0 : programming RX antenna %d (freq %u, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]);
switch (openair0_cfg[card].rxg_mode[ant]) {
default:
case max_gain:
p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMax;
break;
case med_gain:
p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMed;
break;
case byp_gain:
p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAByp;
break;
}
}
}
}
return(0);
}
unsigned int *openair0_daq_cnt() { unsigned int *openair0_daq_cnt() {
return((unsigned int *)openair0_exmimo_pci[0].rxcnt_ptr[0]); return((unsigned int *)openair0_exmimo_pci[0].rxcnt_ptr[0]);
......
...@@ -66,6 +66,9 @@ int openair0_close(void); ...@@ -66,6 +66,9 @@ int openair0_close(void);
int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag); int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag);
//int openair0_dump_config(int card); //int openair0_dump_config(int card);
// reconfigures the card (frequencies and gains only, does not do IOCTL)
int openair0_reconfig(openair0_config_t *openair0_cfg);
// triggers recording of exactly 1 frame // triggers recording of exactly 1 frame
// in case of synchronized multiple cards, send this only to the master card // in case of synchronized multiple cards, send this only to the master card
// return 0 on success // return 0 on success
......
...@@ -158,7 +158,7 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c ...@@ -158,7 +158,7 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c
// at eNB 0, an UL scope for every UE // at eNB 0, an UL scope for every UE
FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX];
FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX]; FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
FD_stats_form *form_stats=NULL; FD_stats_form *form_stats=NULL,*form_stats_l2=NULL;
char title[255]; char title[255];
unsigned char scope_enb_num_ue = 1; unsigned char scope_enb_num_ue = 1;
#endif //XFORMS #endif //XFORMS
...@@ -203,6 +203,10 @@ static pthread_t forms_thread; //xforms ...@@ -203,6 +203,10 @@ static pthread_t forms_thread; //xforms
static pthread_t thread3; //emos static pthread_t thread3; //emos
#endif #endif
#ifdef SPECTRA
static pthread_t sensing_thread;
#endif
openair0_device openair0; openair0_device openair0;
openair0_timestamp timestamp; openair0_timestamp timestamp;
...@@ -231,22 +235,33 @@ static int time_offset[4] = {0,0,0,0}; ...@@ -231,22 +235,33 @@ static int time_offset[4] = {0,0,0,0};
static char UE_flag=0; static char UE_flag=0;
static uint8_t eNB_id=0,UE_id=0; static uint8_t eNB_id=0,UE_id=0;
uint32_t carrier_freq[MAX_NUM_CCs][4] = {{1907600000,1907600000,1907600000,1907600000}}; /* For UE! */ //uint32_t carrier_freq[MAX_NUM_CCs][4] = {{1907600000,1907600000,1907600000,1907600000}}; /* For UE! */
static uint32_t downlink_frequency[MAX_NUM_CCs][4] = {{1907600000,1907600000,1907600000,1907600000}}; static uint32_t downlink_frequency[MAX_NUM_CCs][4] = {{1907600000,1907600000,1907600000,1907600000}};
static int32_t uplink_frequency_offset[MAX_NUM_CCs][4]= {{-120000000,-120000000,-120000000,-120000000}}; static int32_t uplink_frequency_offset[MAX_NUM_CCs][4]= {{0,0,0,0}};
static char *conf_config_file_name = NULL;
openair0_rf_map rf_map[MAX_NUM_CCs];
static char *conf_config_file_name = NULL;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
static char *itti_dump_file = NULL; static char *itti_dump_file = NULL;
#endif #endif
#ifndef USRP #ifndef USRP
double tx_gain[MAX_NUM_CCs][4] = {{20,10,0,0}}; double tx_gain[MAX_NUM_CCs][4] = {{20,20,0,0}};
double rx_gain[MAX_NUM_CCs][4] = {{10,10,0,0}}; double rx_gain[MAX_NUM_CCs][4] = {{20,20,0,0}};
// these are for EXMIMO2 target only // these are for EXMIMO2 target only
/*
static unsigned int rxg_max[4] = {133,133,133,133}; static unsigned int rxg_max[4] = {133,133,133,133};
static unsigned int rxg_med[4] = {127,127,127,127}; static unsigned int rxg_med[4] = {127,127,127,127};
static unsigned int rxg_byp[4] = {120,120,120,120}; static unsigned int rxg_byp[4] = {120,120,120,120};
*/
// these are for EXMIMO2 card 39
static unsigned int rxg_max[4] = {128,128,128,126};
static unsigned int rxg_med[4] = {122,123,123,120};
static unsigned int rxg_byp[4] = {116,117,116,116};
static unsigned int nf_max[4] = {7,9,16,12};
static unsigned int nf_med[4] = {12,13,22,17};
static unsigned int nf_byp[4] = {15,20,29,23};
static rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}}; static rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
#else #else
double tx_gain[MAX_NUM_CCs][4] = {{120,0,0,0}}; double tx_gain[MAX_NUM_CCs][4] = {{120,0,0,0}};
...@@ -451,6 +466,8 @@ static void *scope_thread(void *arg) { ...@@ -451,6 +466,8 @@ static void *scope_thread(void *arg) {
rewind (eNB_stats); rewind (eNB_stats);
fwrite (stats_buffer, 1, len, eNB_stats); fwrite (stats_buffer, 1, len, eNB_stats);
# endif # endif
dump_eNB_l2_stats (stats_buffer, 0);
fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
phy_scope_eNB(form_enb[UE_id], phy_scope_eNB(form_enb[UE_id],
PHY_vars_eNB_g[eNB_id][0], PHY_vars_eNB_g[eNB_id][0],
...@@ -634,6 +651,39 @@ void *emos_thread (void *arg) ...@@ -634,6 +651,39 @@ void *emos_thread (void *arg)
} }
#endif #endif
#ifdef SPECTRA
void *sensing (void *arg)
{
struct sched_param sched_param;
sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("[SPECTRA] sensing thread started with priority %d\n",sched_param.sched_priority);
while (oai_exit==0) {
openair0_cfg[1].rx_freq[0]+= 5e6;
if (openair0_cfg[1].rx_freq[0] >= 750000000)
openair0_cfg[1].rx_freq[0] = 727500000;
LOG_I(HW,"[SPECTRA] changing frequency to %u \n",(uint32_t)openair0_cfg[1].rx_freq[0]);
openair0_reconfig(&openair0_cfg[0]);
usleep(250000);
//sleep(1);
}
pthread_exit((void*) arg);
}
#endif
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
static void wait_system_ready (char *message, volatile int *start_flag) static void wait_system_ready (char *message, volatile int *start_flag)
{ {
...@@ -1489,7 +1539,7 @@ int is_synchronized=0; ...@@ -1489,7 +1539,7 @@ int is_synchronized=0;
static void *UE_thread_synch(void *arg) { static void *UE_thread_synch(void *arg) {
int i,hw_slot_offset; int i,hw_slot_offset,CC_id;
PHY_VARS_UE *UE = arg; PHY_VARS_UE *UE = arg;
#ifdef USRP #ifdef USRP
...@@ -1562,11 +1612,11 @@ static void *UE_thread_synch(void *arg) { ...@@ -1562,11 +1612,11 @@ static void *UE_thread_synch(void *arg) {
} }
else { else {
LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset); LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset);
for (card=0;card<MAX_CARDS;card++) { for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
for (i=0; i<openair0_cfg[card].rx_num_channels; i++) { for (i=0; i<openair0_cfg[rf_map[CC_id].card].rx_num_channels; i++)
openair0_cfg[card].rx_freq[i] = carrier_freq[card][i]+openair_daq_vars.freq_offset; openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].tx_freq[i] = carrier_freq[card][i]+openair_daq_vars.freq_offset; for (i=0; i<openair0_cfg[rf_map[CC_id].card].tx_num_channels; i++)
} openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+openair_daq_vars.freq_offset;
} }
// openair0_dump_config(&openair0_cfg[0],UE_flag); // openair0_dump_config(&openair0_cfg[0],UE_flag);
...@@ -1683,18 +1733,13 @@ static void *UE_thread_rx(void *arg) { ...@@ -1683,18 +1733,13 @@ static void *UE_thread_rx(void *arg) {
return(0); return(0);
} }
#ifdef USRP
static void *UE_thread_new(void *arg) { static void *UE_thread_new(void *arg) {
int slot=0,frame=0,hw_slot,last_slot, next_slot,hw_subframe; int slot=0,frame=0,hw_slot,last_slot, next_slot,hw_subframe;
// unsigned int aa; // unsigned int aa;
static int is_synchronized = 0; static int is_synchronized = 0;
#ifndef USRP
// volatile unsigned int *DAQ_MBOX = openair0_daq_cnt();
//exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;;
#endif
#ifdef USRP
printf("waiting for USRP sync \n"); printf("waiting for USRP sync \n");
#ifdef RTAI #ifdef RTAI
rt_sem_wait(sync_sem); rt_sem_wait(sync_sem);
...@@ -1703,12 +1748,8 @@ static void *UE_thread_new(void *arg) { ...@@ -1703,12 +1748,8 @@ static void *UE_thread_new(void *arg) {
pthread_cond_wait(&sync_cond, &sync_mutex); pthread_cond_wait(&sync_cond, &sync_mutex);
//pthread_mutex_unlock(&sync_mutex); //pthread_mutex_unlock(&sync_mutex);
#endif #endif
// printf("starting eNB thread @ %llu\n",get_usrp_time(&openair0));
#endif
while (!oai_exit) { while (!oai_exit) {
#ifdef USRP
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME, hw_subframe); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME, hw_subframe);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME, frame); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME, frame);
...@@ -1747,7 +1788,6 @@ static void *UE_thread_new(void *arg) { ...@@ -1747,7 +1788,6 @@ static void *UE_thread_new(void *arg) {
if(rx_cnt == max_cnt) if(rx_cnt == max_cnt)
rx_cnt = 0; rx_cnt = 0;
#endif
if (is_synchronized) { if (is_synchronized) {
// phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[0][0], 0, 0,mode,0,NULL); // phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[0][0], 0, 0,mode,0,NULL);
...@@ -1778,7 +1818,7 @@ static void *UE_thread_new(void *arg) { ...@@ -1778,7 +1818,7 @@ static void *UE_thread_new(void *arg) {
#endif #endif
} }
} }
#endif
...@@ -1797,6 +1837,7 @@ static void *UE_thread(void *arg) { ...@@ -1797,6 +1837,7 @@ static void *UE_thread(void *arg) {
int hw_slot_offset=0,rx_offset_mbox=0,mbox_target=0,mbox_current=0; int hw_slot_offset=0,rx_offset_mbox=0,mbox_target=0,mbox_current=0;
int diff2; int diff2;
int i, ret; int i, ret;
int CC_id;
volatile unsigned int *DAQ_MBOX = openair0_daq_cnt(); volatile unsigned int *DAQ_MBOX = openair0_daq_cnt();
#ifndef USRP #ifndef USRP
//exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;; //exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;;
...@@ -1914,8 +1955,16 @@ static void *UE_thread(void *arg) { ...@@ -1914,8 +1955,16 @@ static void *UE_thread(void *arg) {
last_slot+=LTE_SLOTS_PER_FRAME; last_slot+=LTE_SLOTS_PER_FRAME;
next_slot = (slot+3)%LTE_SLOTS_PER_FRAME; next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
PHY_vars_UE_g[0][0]->slot_rx = last_slot;
PHY_vars_UE_g[0][0]->slot_tx = next_slot;
if (PHY_vars_UE_g[0][0]->slot_rx==20)
PHY_vars_UE_g[0][0]->frame_rx++;
if (PHY_vars_UE_g[0][0]->slot_tx==20)
PHY_vars_UE_g[0][0]->frame_tx++;
if (is_synchronized) { if (is_synchronized) {
//phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[0][0], 0, 0,mode,0,NULL); phy_procedures_UE_lte (PHY_vars_UE_g[0][0], 0, 0, mode, 0, NULL);
} }
else { // we are not yet synchronized else { // we are not yet synchronized
...@@ -1941,10 +1990,11 @@ static void *UE_thread(void *arg) { ...@@ -1941,10 +1990,11 @@ static void *UE_thread(void *arg) {
memset(PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[aa],0, memset(PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[aa],0,
PHY_vars_UE_g[0]->lte_frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)); PHY_vars_UE_g[0]->lte_frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int));
*/ */
if (mode == rx_calib_ue) {
/*if (mode == rx_calib_ue) {
exit_fun("[HW][UE] UE in RX calibration mode"); exit_fun("[HW][UE] UE in RX calibration mode");
} }
else { else {*/
is_synchronized = 1; is_synchronized = 1;
//start the DMA transfers //start the DMA transfers
//LOG_D(HW,"Before openair0_start_rt_acquisition \n"); //LOG_D(HW,"Before openair0_start_rt_acquisition \n");
...@@ -1952,7 +2002,7 @@ static void *UE_thread(void *arg) { ...@@ -1952,7 +2002,7 @@ static void *UE_thread(void *arg) {
hw_slot_offset = (PHY_vars_UE_g[0][0]->rx_offset<<1) / PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti; hw_slot_offset = (PHY_vars_UE_g[0][0]->rx_offset<<1) / PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti;
LOG_D(HW,"Got synch: hw_slot_offset %d\n",hw_slot_offset); LOG_D(HW,"Got synch: hw_slot_offset %d\n",hw_slot_offset);
} /*}*/
} }
else { else {
if (openair_daq_vars.freq_offset >= 0) { if (openair_daq_vars.freq_offset >= 0) {
...@@ -1969,11 +2019,11 @@ static void *UE_thread(void *arg) { ...@@ -1969,11 +2019,11 @@ static void *UE_thread(void *arg) {
else { else {
LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset); LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset);
#ifndef USRP #ifndef USRP
for (card=0;card<MAX_CARDS;card++) { for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
for (i=0; i<openair0_cfg[card].rx_num_channels; i++) { for (i=0; i<openair0_cfg[rf_map[CC_id].card].rx_num_channels; i++)
openair0_cfg[card].rx_freq[i] = carrier_freq[card][i]+openair_daq_vars.freq_offset; openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].tx_freq[i] = carrier_freq[card][i]+openair_daq_vars.freq_offset; for (i=0; i<openair0_cfg[rf_map[CC_id].card].tx_num_channels; i++)
} openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+openair_daq_vars.freq_offset;
} }
openair0_dump_config(&openair0_cfg[0],UE_flag); openair0_dump_config(&openair0_cfg[0],UE_flag);
#endif #endif
...@@ -2134,11 +2184,6 @@ static void get_options (int argc, char **argv) { ...@@ -2134,11 +2184,6 @@ static void get_options (int argc, char **argv) {
downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
carrier_freq[CC_id][0] = downlink_frequency[CC_id][0];
carrier_freq[CC_id][1] = downlink_frequency[CC_id][1];
carrier_freq[CC_id][2] = downlink_frequency[CC_id][2];
carrier_freq[CC_id][3] = downlink_frequency[CC_id][3];
printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]); printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
} }
break; break;
...@@ -2361,9 +2406,9 @@ int main(int argc, char **argv) { ...@@ -2361,9 +2406,9 @@ int main(int argc, char **argv) {
{ {
printf("configuring for UE\n"); printf("configuring for UE\n");
set_comp_log(HW, LOG_INFO, LOG_HIGH, 1); set_comp_log(HW, LOG_DEBUG, LOG_HIGH, 1);
#ifdef OPENAIR2 #ifdef OPENAIR2
set_comp_log(PHY, LOG_INFO, LOG_HIGH, 1); set_comp_log(PHY, LOG_DEBUG, LOG_HIGH, 1);
#else #else
set_comp_log(PHY, LOG_INFO, LOG_HIGH, 1); set_comp_log(PHY, LOG_INFO, LOG_HIGH, 1);
#endif #endif
...@@ -2721,7 +2766,6 @@ int main(int argc, char **argv) { ...@@ -2721,7 +2766,6 @@ int main(int argc, char **argv) {
openair_daq_vars.timing_advance = 0; openair_daq_vars.timing_advance = 0;
openair0_rf_map rf_map[MAX_NUM_CCs];
for(CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { for(CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
rf_map[CC_id].card=0; rf_map[CC_id].card=0;
rf_map[CC_id].chain=CC_id+1; rf_map[CC_id].chain=CC_id+1;
...@@ -2754,6 +2798,14 @@ int main(int argc, char **argv) { ...@@ -2754,6 +2798,14 @@ int main(int argc, char **argv) {
for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++) for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
PHY_vars_eNB_g[0][CC_id]->lte_eNB_common_vars.txdata[0][aa][i] = 0x00010001; PHY_vars_eNB_g[0][CC_id]->lte_eNB_common_vars.txdata[0][aa][i] = 0x00010001;
} }
#ifdef SPECTRA
//setup the last channel for sensing
openair0_cfg[1].rx_freq[0] = 727500000;
openair0_cfg[1].tx_freq[0] = 727500000;
openair0_cfg[1].tx_gain[0] = 0;
openair0_cfg[1].rx_gain[0] = 30;
openair0_cfg[1].rxg_mode[0] = max_gain;
#endif
} }
#ifndef USRP #ifndef USRP
openair0_dump_config(&openair0_cfg[0],UE_flag); openair0_dump_config(&openair0_cfg[0],UE_flag);
...@@ -2829,6 +2881,7 @@ int main(int argc, char **argv) { ...@@ -2829,6 +2881,7 @@ int main(int argc, char **argv) {
sprintf (title, "LTE DL SCOPE UE"); sprintf (title, "LTE DL SCOPE UE");
fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
} else { } else {
form_stats_l2 = create_form_stats_form();
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
form_enb[UE_id] = create_lte_phy_scope_enb(); form_enb[UE_id] = create_lte_phy_scope_enb();
sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1); sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1);
...@@ -2837,6 +2890,8 @@ int main(int argc, char **argv) { ...@@ -2837,6 +2890,8 @@ int main(int argc, char **argv) {
} }
fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
if (UE_flag==0) { if (UE_flag==0) {
fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats");
for (UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for (UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
if (otg_enabled) { if (otg_enabled) {
fl_set_button(form_enb[UE_id]->button_0,1); fl_set_button(form_enb[UE_id]->button_0,1);
...@@ -2869,6 +2924,11 @@ int main(int argc, char **argv) { ...@@ -2869,6 +2924,11 @@ int main(int argc, char **argv) {
printf("EMOS thread created, ret=%d\n",ret); printf("EMOS thread created, ret=%d\n",ret);
#endif #endif
#ifdef SPECTRA
ret = pthread_create(&sensing_thread, NULL, sensing, NULL);
printf("sensing thread created, ret=%d\n",ret);
#endif
rt_sleep_ns(10*FRAME_PERIOD); rt_sleep_ns(10*FRAME_PERIOD);
#ifndef RTAI #ifndef RTAI
...@@ -2890,9 +2950,9 @@ int main(int argc, char **argv) { ...@@ -2890,9 +2950,9 @@ int main(int argc, char **argv) {
if (UE_flag == 1) { if (UE_flag == 1) {
#ifndef USRP #ifndef USRP
#ifdef RTAI #ifdef RTAI
main_ue_thread = rt_thread_create(UE_thread_new, NULL, 100000000); main_ue_thread = rt_thread_create(UE_thread, NULL, 100000000);
#else #else
error_code = pthread_create(&main_ue_thread, &attr_dlsch_threads, UE_thread_new, NULL); error_code = pthread_create(&main_ue_thread, &attr_dlsch_threads, UE_thread, NULL);
if (error_code!= 0) { if (error_code!= 0) {
LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code); LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
return(error_code); return(error_code);
...@@ -2970,6 +3030,8 @@ int main(int argc, char **argv) { ...@@ -2970,6 +3030,8 @@ int main(int argc, char **argv) {
fl_hide_form(form_ue[UE_id]->lte_phy_scope_ue); fl_hide_form(form_ue[UE_id]->lte_phy_scope_ue);
fl_free_form(form_ue[UE_id]->lte_phy_scope_ue); fl_free_form(form_ue[UE_id]->lte_phy_scope_ue);
} else { } else {
fl_hide_form(form_stats_l2->stats_form);
fl_free_form(form_stats_l2->stats_form);
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb); fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb);
fl_free_form(form_enb[UE_id]->lte_phy_scope_enb); fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
...@@ -3045,6 +3107,12 @@ int main(int argc, char **argv) { ...@@ -3045,6 +3107,12 @@ int main(int argc, char **argv) {
printf("[OPENAIR][SCHED][CLEANUP] EMOS FIFO closed, error_code %d\n", error_code); printf("[OPENAIR][SCHED][CLEANUP] EMOS FIFO closed, error_code %d\n", error_code);
#endif #endif
#ifdef SPECTRA
printf("waiting for sensing thread\n");
pthread_cancel(sensing_thread);
pthread_join(sensing_thread,&status);
#endif
if (ouput_vcd) if (ouput_vcd)
vcd_signal_dumper_close(); vcd_signal_dumper_close();
...@@ -3072,7 +3140,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, ...@@ -3072,7 +3140,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
// replace RX signal buffers with mmaped HW versions // replace RX signal buffers with mmaped HW versions
for (i=0;i<frame_parms->nb_antennas_rx;i++) { for (i=0;i<frame_parms->nb_antennas_rx;i++) {
printf("Mapping eNB CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i); printf("Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i);
free(phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i]); free(phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i]);
phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].adc_head[rf_map[CC_id].chain+i]; phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].adc_head[rf_map[CC_id].chain+i];
if (openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i]) { if (openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i]) {
...@@ -3089,7 +3157,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, ...@@ -3089,7 +3157,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
printf("rxdata[%d] @ %p\n",i,phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i]); printf("rxdata[%d] @ %p\n",i,phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i]);
} }
for (i=0;i<frame_parms->nb_antennas_tx;i++) { for (i=0;i<frame_parms->nb_antennas_tx;i++) {
printf("Mapping eNB CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i); printf("Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i);
free(phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i]); free(phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i]);
phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i]; phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i];
if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) { if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) {
...@@ -3183,8 +3251,6 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c ...@@ -3183,8 +3251,6 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c
return(-1); return(-1);
} }
else { else {
printf("Setting TX frequency to %d for CC_id %d, card %d, chain %d\n",
downlink_frequency[CC_id][i],CC_id,rf_map[CC_id].card,rf_map[CC_id].chain+i);
openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]; openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i];
openair0_cfg[rf_map[CC_id].card].tx_gain[rf_map[CC_id].chain+i] = tx_gain[CC_id][i]; openair0_cfg[rf_map[CC_id].card].tx_gain[rf_map[CC_id].chain+i] = tx_gain[CC_id][i];
openair0_cfg[rf_map[CC_id].card].tx_num_channels++; openair0_cfg[rf_map[CC_id].card].tx_num_channels++;
......
#include <iostream>
#include "TcpClient.h"
void printUsage()
{
cout<<"usage: EthernetRawCommand <server-ip> [scpi-command]"<<endl;
}
int main( int argc, char *argv[] )
{
int errorCode = 0; //no error
bool useSingleCommand = false;
string singleCommand = "";
string hostname = "";
int port = 5025;
string input = "";
TcpClient client;
switch( argc )
{
case 3:
useSingleCommand = true;
singleCommand = argv[2];
case 2:
hostname = argv[1];
break;
default:
printUsage();
return(-1);
}
try
{
client.connectToServer( hostname, port );
bool terminate = false;
while( !terminate )
{
char buffer[1024];
if( useSingleCommand )
{
input = singleCommand; //send string
}
else
{
cin.getline( buffer, 1024 );
input = buffer;
if( input == "end" )
{
terminate = true;
}
}
if( !terminate)
{
client.transmit( input ); //send string
int qPos = input.find( "?", 0 );
//receive string only when needed
if( qPos > 0 )
{
string rcStr = "";
client.receive( rcStr );
cout << rcStr << endl;
}
}
if( useSingleCommand )
{
terminate = true;
}
}
}catch( const string errorString )
{
cout<<errorString<<endl;
}
client.disconnect( );
return errorCode;
}
all:
g++ TcpClient.cpp EthernetRawCommand.cpp -o EthernetRawCommand.out
\ No newline at end of file
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "TcpClient.h"
TcpClient::TcpClient()
: currentHostName( "" )
, currentPort( 0 )
, currentSocketDescr( 0 )
, serverAddress ( )
, currentHostInfo( NULL )
, clientIsConnected( false )
, receiveBufferSize( 1024 )
{
}
TcpClient::~TcpClient()
{
currentHostInfo = NULL;
}
void TcpClient::connectToServer( string &hostname, int port )
{
currentHostInfo = gethostbyname( hostname.c_str( ) );
if( currentHostInfo == NULL )
{
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
printf("error connecting host\n" );
}
currentHostName = hostname;
currentPort = port;
currentSocketDescr = socket(AF_INET, SOCK_STREAM, 0);
if( currentSocketDescr == 0 )
{
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
printf("can't create socket\n" );
}
serverAddress.sin_family = currentHostInfo->h_addrtype;
serverAddress.sin_port = htons( currentPort );
memcpy( (char *) &serverAddress.sin_addr.s_addr, currentHostInfo->h_addr_list[0], currentHostInfo->h_length );
if( connect( currentSocketDescr, ( struct sockaddr *) &serverAddress, sizeof( serverAddress ) ) < 0 )
{
throw string("can't connect server\n" );
}
clientIsConnected = true;
}
void TcpClient::disconnect( )
{
if( clientIsConnected )
{
close( currentSocketDescr );
}
currentSocketDescr = 0;
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
}
void TcpClient::transmit( string &txString )
{
if( !clientIsConnected )
{
throw string("connection must be established before any data can be sent\n");
}
char * transmitBuffer = new char[txString.length() +1];
memcpy( transmitBuffer, txString.c_str(), txString.length() );
transmitBuffer[txString.length()] = '\n'; //newline is needed!
if( send( currentSocketDescr, transmitBuffer, txString.length() + 1, 0 ) < 0 )
{
throw string("can't transmit data\n");
}
delete [] transmitBuffer;
}
void TcpClient::receive( string &rxString )
{
if( !clientIsConnected )
{
throw string("connection must be established before any data can be received\n");
}
char * receiveBuffer = new char[receiveBufferSize];
memset( receiveBuffer, 0, receiveBufferSize );
bool receiving = true;
while( receiving )
{
int receivedByteCount = recv( currentSocketDescr, receiveBuffer, receiveBufferSize, 0 );
if( receivedByteCount < 0 )
{
throw string("error while receiving data\n");
}
rxString += string( receiveBuffer );
receiving = ( receivedByteCount == receiveBufferSize );
}
delete [] receiveBuffer;
}
string TcpClient::getCurrentHostName( ) const
{
return currentHostName;
}
int TcpClient::getCurrentPort( ) const
{
return currentPort;
}
#include <string>
//defines structs for socket handling
#include <netinet/in.h>
using namespace std;
typedef struct sockaddr_in SockAddrStruct;
typedef struct hostent HostInfoStruct;
class TcpClient
{
public:
TcpClient();
~TcpClient();
void connectToServer( string &hostname, int port );
void disconnect( );
void transmit( string &txString );
void receive( string &rxString );
string getCurrentHostName( ) const;
int getCurrentPort( ) const;
private:
string currentHostName;
int currentPort;
int currentSocketDescr;
SockAddrStruct serverAddress;
HostInfoStruct * currentHostInfo;
bool clientIsConnected;
int receiveBufferSize;
};
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