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 @@
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
#ifdef EXMIMO
#ifdef DRIVER2013
#include "openair0_lib.h"
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
#include "common_lib.h"
extern openair0_config_t openair0_cfg[];
#endif
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
uint8_t eNB=0;
uint32_t RRC_status;
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)
return 0;
......@@ -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[1]);
#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, (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
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]);
#else
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
#endif
......@@ -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]);
#ifdef EXMIMO
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",
p_exmimo_config->rf.rf_mode[0],
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",
openair0_cfg[0].rxg_mode[0],
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.n0_power_tot)-phy_vars_ue->rx_total_gain_dB+105);
#endif
......@@ -259,12 +243,14 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
return len;
} // is_clusterhead
int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
unsigned int success=0;
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 dlsch_round_attempts[4]={0,0,0,0},dlsch_round_errors[4]={0,0,0,0};
uint32_t UE_id_mac, RRC_status;
if (phy_vars_eNB==NULL)
return 0;
......@@ -332,18 +318,21 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
#ifdef OPENAIR2
if (phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti>0) {
#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,
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[1],
phy_vars_eNB->eNB_UE_stats[UE_id].sector,
phy_vars_eNB->transmission_mode[UE_id]);
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,
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->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]->nb_rb);
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],
......@@ -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_total,
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");
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",
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) {
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_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");
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",
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) {
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_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 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,
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
//int flag_LA = 0;
// if(flag_LA==1)
// {
sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, eNB_id);
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(flag_LA==1)
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);
if (((phy_vars_ue->frame_tx % 100) == 0) || (phy_vars_ue->frame_tx < 10))
print_CQI(ulsch->o,ulsch->uci_format,eNB_id);
}
......
......@@ -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]);
if (ulsch->O>0) {
// int flag_LA =0;
sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, eNB_id);
/*
if(flag_LA==1)
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");
// print_CQI(ulsch->o,ulsch->uci_format,eNB_id);
......
......@@ -442,7 +442,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
float **chest_t_abs;
float time[FRAME_LENGTH_COMPLEX_SAMPLES];
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];
int coded_bits_per_codeword = 0;
int mcs = 0;
......
......@@ -137,7 +137,7 @@ extern struct timing_info_t {
*/
#ifdef EXMIMO
extern uint32_t carrier_freq[4];
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
#endif
#ifdef USER_MODE
......@@ -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;
// int aa;
#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;
#endif
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
if (l==0) {
// UE measurements
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,
(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
slot_rx,
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
0,
16384);
if (openair_daq_vars.auto_freq_correction == 1) {
/* if (openair_daq_vars.auto_freq_correction == 1) {
if (frame_rx % 100 == 0) {
if ((phy_vars_ue->lte_ue_common_vars.freq_offset>100) && (openair_daq_vars.freq_offset < 1000)) {
openair_daq_vars.freq_offset+=100;
#if defined(EXMIMO) && defined(DRIVER2013)
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_tx[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] = downlink_frequency[aa]+=openair_daq_vars.freq_offset;
}
#endif
}
......@@ -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;
#if defined(EXMIMO) && defined(DRIVER2013)
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_tx[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] = downlink_frequency[aa]+=openair_daq_vars.freq_offset;
}
#endif
}
}
}
}*/
}
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
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1);
#ifdef EXMIMO
#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
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
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]->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)
phy_vars_ue->ulsch_ue[eNB_id]->PHR = -23;
......
......@@ -520,7 +520,7 @@ typedef struct{
uint8_t bsr_info[MAX_NUM_LCGID];
/// phr information
uint8_t phr_info;
int8_t phr_info;
//dl buffer info
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_
switch (rx_ces[i]) { // implement and process BSR + CRNTI +
case POWER_HEADROOM:
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);
}
payload_ptr+=sizeof(POWER_HEADROOM_CMD);
......@@ -490,7 +490,7 @@ void schedule_ulsch_rnti(module_id_t module_idP,
uint8_t status = 0;
uint8_t rb_table_index = -1;
uint16_t TBS,i;
uint32_t buffer_occupancy;
int32_t buffer_occupancy;
uint32_t tmp_bsr;
uint32_t cqi_req,cshift,ndi,mcs,rballoc;
......@@ -521,25 +521,25 @@ void schedule_ulsch_rnti(module_id_t module_idP,
if (eNB_UE_stats==NULL)
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]);
if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel
int8_t ret;
// 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);
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));
/* [SR] 01/07/13: Don't schedule UE if we cannot get harq pid */
//#ifndef EXMIMO_IOT
// if ((((UE_is_to_be_scheduled(module_idP,CC_id,UE_id)>0)) || (round>0) || ((frameP%10)==0)) && (ret == 0))
#ifndef EXMIMO_IOT
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
//#else
#else
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,
UE_template->ul_SR);
......@@ -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
buffer_occupancy -= mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]);
i = bytes_to_bsr_index((int32_t)buffer_occupancy);
// Adjust BSR entries for LCGIDs
if (i>0) {
if (UE_template->bsr_info[LCGID0] <= i) {
tmp_bsr = BSR_TABLE[UE_template->bsr_info[LCGID0]];
// the max TBS that could be served is : mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]
TBS = mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]);
buffer_occupancy -= TBS;
// Adjust BSR entries for LCGIDs
if (buffer_occupancy > 0 ) { // could not serve all the uplink traffic
if (BSR_TABLE[UE_template->bsr_info[LCGID0]] <= TBS ) {
tmp_bsr = BSR_TABLE[UE_template->bsr_info[LCGID0]]; // serving this amout of bytes
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]];
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]];
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]];
UE_template->bsr_info[LCGID3] = 0;
} 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 {
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 {
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 {
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
......
......@@ -110,7 +110,7 @@ int dump_eNB_l2_stats(char *buffer, int length){
}
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++) {
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));
......@@ -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].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,
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,
......@@ -135,7 +135,7 @@ int dump_eNB_l2_stats(char *buffer, int length){
len += sprintf(&buffer[len],
"[MAC] DLSCH bitrate (TTI %d, avg %d), Transmitted bytes "
"(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].total_dlsch_bitrate,
UE_list->eNB_UE_stats[CC_id][UE_id].TBS,
......@@ -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].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,
// uplinkPowerControlCommon
#ifdef EXMIMO
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -90;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -96;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -98;//-90;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -98;//-96;
#else
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108;
......
......@@ -897,7 +897,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
MeasObj->measObjectId = 1;
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.presenceAntennaPort1 = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
......@@ -1143,16 +1144,17 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
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,
NULL, /// NN: do not reconfig srb1: SRB_configList2,
*DRB_configList, NULL, // DRB2_list,
NULL, // *sps_Config,
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,
*DRB_configList, NULL, // DRB2_list,
NULL, // *sps_Config,
#ifdef EXMIMO_IOT
NULL, NULL, NULL, NULL,NULL,
NULL, NULL, NULL, NULL,NULL,
#else
physicalConfigDedicated[ue_mod_idP], MeasObj_list, ReportConfig_list, quantityConfig, MeasId_list,
physicalConfigDedicated[ue_mod_idP], MeasObj_list, ReportConfig_list, quantityConfig, MeasId_list,
#endif
mac_MainConfig, NULL, NULL, Sparams, rsrp, cba_RNTI, dedicatedInfoNASList);
mac_MainConfig, NULL, NULL, Sparams, rsrp, cba_RNTI, dedicatedInfoNASList);
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
......@@ -2483,11 +2485,8 @@ void rrc_eNB_generate_RRCConnectionSetup(
eNB_rrc_inst[enb_mod_idP].Srb0.Tx_buffer.payload_size =
do_RRCConnectionSetup(enb_mod_idP,
(uint8_t *) eNB_rrc_inst[enb_mod_idP].Srb0.Tx_buffer.Payload,
mac_xface->get_transmission_mode(enb_mod_idP,0, //CC_id 0!!!!
UE_RNTI
(enb_mod_idP,
ue_mod_idP)),
ue_mod_idP,
(mac_xface->lte_frame_parms->nb_antennas_tx==2)?2:1,
ue_mod_idP,
rrc_eNB_get_next_transaction_identifier(enb_mod_idP),
mac_xface->lte_frame_parms,
SRB_configList, &eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP]);
......@@ -3128,9 +3127,9 @@ int rrc_eNB_decode_dcch(
ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
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);
#endif
//#endif
#if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
......
......@@ -30,6 +30,9 @@
#include "openair0_lib.h"
#include "gain_control.h"
//#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) {
unsigned int ant;
......@@ -84,7 +87,7 @@ void gain_control (unsigned int rx_power_fil_dB, unsigned int ant, unsigned int
}
#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
}
......
......@@ -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_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]);
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]) {
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.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]) {
default:
......@@ -409,6 +409,55 @@ int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag)
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() {
return((unsigned int *)openair0_exmimo_pci[0].rxcnt_ptr[0]);
......
......@@ -66,6 +66,9 @@ int openair0_close(void);
int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag);
//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
// in case of synchronized multiple cards, send this only to the master card
// return 0 on success
......
This diff is collapsed.
#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