Commit 20fd3906 authored by Rajeev Gangula's avatar Rajeev Gangula

UAV BS TDD old version.

parent 1fcf4479
...@@ -111,6 +111,20 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA ...@@ -111,6 +111,20 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE DESC = MAC downlink PDU for an UE
GROUP = ALL:MAC:ENB GROUP = ALL:MAC:ENB
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
ID = ENB_TPC_DLSCH
DESC = MAC TPC PUCCH command
GROUP = ALL:MAC:ENB
FORMAT = int,frame : int,subframe : int,rnti : int,tpc : int,tpc_accumulated : int,normalized_rx_power : int,target_rx_power
ID = ENB_TPC_ULSCH
DESC = MAC TPC PUSCH command
GROUP = ALL:MAC:ENB
FORMAT = int,frame : int,subframe : int,rnti : int,tpc : int,tpc_accumulated : int,normalized_rx_power : int,target_rx_power
ID = ENB_TPC_ULSCH_PHR
DESC = MAC PHR Report
GROUP = ALL:MAC:ENB
FORMAT = int,UE_id : int,PHR
#RLC logs #RLC logs
ID = ENB_RLC_DL ID = ENB_RLC_DL
...@@ -253,6 +267,11 @@ ID = ENB_RRC_UNKNOW_MESSAGE ...@@ -253,6 +267,11 @@ ID = ENB_RRC_UNKNOW_MESSAGE
DESC = RRC unknown message DESC = RRC unknown message
GROUP = ALL:RRC:ENB GROUP = ALL:RRC:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti
ID = ENB_RRC_RSRP
DESC = RSRP Measurements
GROUP = ALL:RRC:ENB
FORMAT = int,rnti : int,RSRP
#legacy logs #legacy logs
ID = LEGACY_MAC_INFO ID = LEGACY_MAC_INFO
......
...@@ -120,7 +120,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, ...@@ -120,7 +120,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
PHY_MEASUREMENTS_eNB *measurements = &eNB->measurements[eNB_id]; PHY_MEASUREMENTS_eNB *measurements = &eNB->measurements[eNB_id];
LTE_eNB_SRS *srs_vars = &eNB->srs_vars[UE_id]; LTE_eNB_SRS *srs_vars = &eNB->srs_vars[UE_id];
int32_t aarx,rx_power_correction; int32_t aarx,rx_power_correction=1;
int32_t rx_power; int32_t rx_power;
uint32_t rb; uint32_t rb;
int32_t *ul_ch; int32_t *ul_ch;
...@@ -132,13 +132,13 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, ...@@ -132,13 +132,13 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
rx_power = 0; rx_power = 0;
/*
if ( (frame_parms->ofdm_symbol_size == 128) || if ( (frame_parms->ofdm_symbol_size == 128) ||
(frame_parms->ofdm_symbol_size == 512) ) (frame_parms->ofdm_symbol_size == 512) )
rx_power_correction = 2; rx_power_correction = 2;
else else
rx_power_correction = 1; rx_power_correction = 1;
*/
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
...@@ -157,7 +157,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, ...@@ -157,7 +157,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
measurements->wideband_cqi[UE_id][aarx] = measurements->rx_spatial_power[UE_id][0][aarx]; measurements->wideband_cqi[UE_id][aarx] = measurements->rx_spatial_power[UE_id][0][aarx];
//LOG_I(PHY,"lte_eNB_srs_measurements: UE %d, ant %d, CQI %d dB\n",UE_id,aarx,measurements->wideband_cqi[UE_id][aarx]);
// measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx; // measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx;
measurements->wideband_cqi_dB[UE_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[UE_id][aarx]); measurements->wideband_cqi_dB[UE_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[UE_id][aarx]);
......
...@@ -2149,6 +2149,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, ...@@ -2149,6 +2149,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
dci_alloc[i].dci_pdu); dci_alloc[i].dci_pdu);
dump_dci(frame_parms,&dci_alloc[i]); dump_dci(frame_parms,&dci_alloc[i]);
#endif #endif
dump_dci(frame_parms,&dci_alloc[i]);
if (dci_alloc[i].firstCCE >= 0) { if (dci_alloc[i].firstCCE >= 0) {
e_ptr = generate_dci0(dci_alloc[i].dci_pdu, e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
......
...@@ -2852,6 +2852,17 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) ...@@ -2852,6 +2852,17 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
break; break;
case 25: case 25:
/*printf("DCI format0 (TDD1-6, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n",
dci->rnti,
((uint32_t*)&dci->dci_pdu[0])[0],
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai,
((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req);*/
LOG_D(PHY,"DCI format0 (TDD1-6, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", LOG_D(PHY,"DCI format0 (TDD1-6, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n",
dci->rnti, dci->rnti,
((uint32_t*)&dci->dci_pdu[0])[0], ((uint32_t*)&dci->dci_pdu[0])[0],
......
...@@ -914,8 +914,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, ...@@ -914,8 +914,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
G = nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch; G = nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch;
#ifdef DEBUG_ULSCH_DECODING //#ifdef DEBUG_ULSCH_DECODING
printf("ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d, subframe %d\n", if(ulsch_harq->mcs > 4)
printf("ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d, %d.%d harq %d Or1 %d nb_rb %d\n",
frame_parms->Nid_cell,ulsch->rnti,x2, frame_parms->Nid_cell,ulsch->rnti,x2,
ulsch_harq->round, ulsch_harq->round,
ulsch_harq->rvidx, ulsch_harq->rvidx,
...@@ -923,8 +924,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, ...@@ -923,8 +924,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
ulsch_harq->O_RI, ulsch_harq->O_RI,
ulsch_harq->O_ACK, ulsch_harq->O_ACK,
G, G,
subframe); proc->frame_rx, subframe, harq_pid, ulsch_harq->Or1, nb_rb);
#endif //#endif
if (ulsch_harq->round == 0) { if (ulsch_harq->round == 0) {
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
......
...@@ -297,7 +297,7 @@ void do_OFDM_mod_symbol(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t ne ...@@ -297,7 +297,7 @@ void do_OFDM_mod_symbol(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t ne
slot_offsetF = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==EXTENDED) ? 6 : 7); slot_offsetF = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==EXTENDED) ? 6 : 7);
//printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); //printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
for (l=0; l<frame_parms->symbols_per_tti>>1; l++) { for (l=0; l<frame_parms->symbols_per_tti>>1; l++) {
if (PHY_vars_eNB_g[0][0]->proc.frame_tx==0) LOG_I(PHY,"Generating symbol %d for slot %d\n",l,next_slot); //if (PHY_vars_eNB_g[0][0]->proc.frame_tx==0) LOG_I(PHY,"Generating symbol %d for slot %d\n",l,next_slot);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
//printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
......
...@@ -188,11 +188,15 @@ typedef struct { ...@@ -188,11 +188,15 @@ typedef struct {
} PHY_VARS_RN; } PHY_VARS_RN;
/// Context data structure for RX/TX portion of subframe processing /// Context data structure for RX/TX portion of subframe processing
typedef struct { typedef struct eNB_rxtx_proc_t_s{
/// Component Carrier index /// Component Carrier index
uint8_t CC_id; uint8_t CC_id;
/// timestamp transmitted to HW /// timestamp transmitted to HW
openair0_timestamp timestamp_tx; openair0_timestamp timestamp_tx;
//Now timestamp_rx is stored in proc, before it was a common variable in eNB struct
openair0_timestamp timestamp_rx;
//Now offset is stored in proc, before it was a common variable in eNB struct
openair0_timestamp ts_offset;
/// subframe to act upon for transmission /// subframe to act upon for transmission
int subframe_tx; int subframe_tx;
/// subframe to act upon for reception /// subframe to act upon for reception
...@@ -216,6 +220,11 @@ typedef struct { ...@@ -216,6 +220,11 @@ typedef struct {
struct sched_param sched_param_rxtx; struct sched_param sched_param_rxtx;
} eNB_rxtx_proc_t; } eNB_rxtx_proc_t;
typedef struct {
struct eNB_proc_t_s *argeNBProc;
struct eNB_rxtx_proc_t_s *argeNBproc_rxtx;
} enB_thread_params;
typedef struct { typedef struct {
struct PHY_VARS_eNB_s *eNB; struct PHY_VARS_eNB_s *eNB;
int UE_id; int UE_id;
...@@ -240,6 +249,8 @@ typedef struct eNB_proc_t_s { ...@@ -240,6 +249,8 @@ typedef struct eNB_proc_t_s {
openair0_timestamp timestamp_rx; openair0_timestamp timestamp_rx;
/// timestamp to send to "slave rru" /// timestamp to send to "slave rru"
openair0_timestamp timestamp_tx; openair0_timestamp timestamp_tx;
//Now offset is stored in proc, before it was a common variable in eNB struct
openair0_timestamp ts_offset;
/// subframe to act upon for reception /// subframe to act upon for reception
int subframe_rx; int subframe_rx;
/// subframe to act upon for transmission /// subframe to act upon for transmission
...@@ -278,6 +289,9 @@ typedef struct eNB_proc_t_s { ...@@ -278,6 +289,9 @@ typedef struct eNB_proc_t_s {
pthread_t pthread_FH; pthread_t pthread_FH;
/// pthread structure for eNB single processing thread /// pthread structure for eNB single processing thread
pthread_t pthread_single; pthread_t pthread_single;
/// pthread structure for eNB two threads
pthread_t pthread_odd;
pthread_t pthread_even;
/// pthread structure for asychronous RX/TX processing thread /// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx; pthread_t pthread_asynch_rxtx;
/// flag to indicate first RX acquisition /// flag to indicate first RX acquisition
...@@ -342,6 +356,10 @@ typedef struct eNB_proc_t_s { ...@@ -342,6 +356,10 @@ typedef struct eNB_proc_t_s {
pthread_cond_t cond_asynch_rxtx; pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel fep thread /// mutex for parallel fep thread
pthread_mutex_t mutex_fep; pthread_mutex_t mutex_fep;
/// Mutex locks for rf read, enb RX func, Tx process+write
pthread_mutex_t mutex_rxRf;
pthread_mutex_t mutex_rxnew;
pthread_mutex_t mutex_txnew;
/// mutex for parallel turbo-decoder thread /// mutex for parallel turbo-decoder thread
pthread_mutex_t mutex_td; pthread_mutex_t mutex_td;
/// mutex for parallel turbo-encoder thread /// mutex for parallel turbo-encoder thread
...@@ -436,6 +454,7 @@ typedef struct PHY_VARS_eNB_s { ...@@ -436,6 +454,7 @@ typedef struct PHY_VARS_eNB_s {
module_id_t Mod_id; module_id_t Mod_id;
uint8_t CC_id; uint8_t CC_id;
eNB_proc_t proc; eNB_proc_t proc;
eNB_proc_t proc_new[2];
eNB_func_t node_function; eNB_func_t node_function;
eNB_timing_t node_timing; eNB_timing_t node_timing;
eth_params_t *eth_params; eth_params_t *eth_params;
......
...@@ -102,7 +102,8 @@ double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012 ...@@ -102,7 +102,8 @@ double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012
}; };
//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27}; //int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; //int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 25, 25};
//for SNR to MI conversion 7 th order Polynomial coeff //for SNR to MI conversion 7 th order Polynomial coeff
double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
......
...@@ -497,7 +497,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -497,7 +497,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
// generate Cell-Specific Reference Signals for both slots // generate Cell-Specific Reference Signals for both slots
if (eNB->abstraction_flag==0) { if (eNB->abstraction_flag==0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
if (frame==0) LOG_I(PHY,"Generating RS for slot %d\n",subframe<<1); //if (frame==0) LOG_I(PHY,"Generating RS for slot %d\n",subframe<<1);
generate_pilots_slot(eNB, generate_pilots_slot(eNB,
txdataF, txdataF,
AMP, AMP,
...@@ -599,7 +599,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -599,7 +599,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
if ((fp->frame_type == TDD)&& if ((fp->frame_type == TDD)&&
(eNB->abstraction_flag==0)){ (eNB->abstraction_flag==0)){
if (frame==0) LOG_I(PHY,"Generating SSS for slot %d\n",1+(subframe<<1)); //if (frame==0) LOG_I(PHY,"Generating SSS for slot %d\n",1+(subframe<<1));
generate_sss(txdataF, generate_sss(txdataF,
AMP, AMP,
fp, fp,
...@@ -626,7 +626,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -626,7 +626,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
else if ((subframe == 1) && else if ((subframe == 1) &&
(fp->frame_type == TDD)&& (fp->frame_type == TDD)&&
(eNB->abstraction_flag==0)) { (eNB->abstraction_flag==0)) {
if (frame==0) LOG_I(PHY,"Generating PSS for slot %d\n",subframe<<1); //if (frame==0) LOG_I(PHY,"Generating PSS for slot %d\n",subframe<<1);
generate_pss(txdataF, generate_pss(txdataF,
AMP, AMP,
fp, fp,
...@@ -1360,9 +1360,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1360,9 +1360,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if (UE_id<0) { // should not happen, log an error and exit, this is a fatal error if (UE_id<0) { // should not happen, log an error and exit, this is a fatal error
LOG_E(PHY,"[eNB %"PRIu8"] Frame %d: Unknown UE_id for rnti %"PRIx16"\n",eNB->Mod_id,frame,dci_alloc->rnti); LOG_E(PHY,"[eNB %"PRIu8"] Frame %d: Unknown UE_id for rnti %"PRIx16"\n",eNB->Mod_id,frame,dci_alloc->rnti);
mac_xface->macphy_exit("FATAL\n"); //mac_xface->macphy_exit("FATAL\n");
} }
generate_eNB_ulsch_params(eNB,proc,dci_alloc,UE_id); if (UE_id >= 0) generate_eNB_ulsch_params(eNB,proc,dci_alloc,UE_id);
} }
} }
...@@ -1386,7 +1386,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1386,7 +1386,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (common %"PRIu8",ue_spec %"PRIu8")\n",eNB->Mod_id,frame, subframe, LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (common %"PRIu8",ue_spec %"PRIu8")\n",eNB->Mod_id,frame, subframe,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci); DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
} }
if (frame==0) LOG_I(PHY,"Generating PDCCCH/PCFICH for slot %d\n",subframe<<1); // if (frame==0) LOG_I(PHY,"Generating PDCCCH/PCFICH for slot %d\n",subframe<<1);
num_pdcch_symbols = generate_dci_top(DCI_pdu->Num_ue_spec_dci, num_pdcch_symbols = generate_dci_top(DCI_pdu->Num_ue_spec_dci,
DCI_pdu->Num_common_dci, DCI_pdu->Num_common_dci,
DCI_pdu->dci_alloc, DCI_pdu->dci_alloc,
...@@ -2869,6 +2869,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc){ ...@@ -2869,6 +2869,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc){
} }
static char subframe_null[7680*4*4];
void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const relaying_type_t r_type) void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const relaying_type_t r_type)
{ {
//RX processing for ue-specific resources (i //RX processing for ue-specific resources (i
...@@ -2892,6 +2893,13 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const ...@@ -2892,6 +2893,13 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
T(T_ENB_PHY_UL_TICK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe)); T(T_ENB_PHY_UL_TICK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe));
/* if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) {
T(T_ENB_PHY_INPUT_SIGNAL, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(0),
T_BUFFER(subframe_null,
eNB->frame_parms.samples_per_tti * 4));
return;
}*/
T(T_ENB_PHY_INPUT_SIGNAL, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(0), T(T_ENB_PHY_INPUT_SIGNAL, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(0),
T_BUFFER(&eNB->common_vars.rxdata[0][0][subframe*eNB->frame_parms.samples_per_tti], T_BUFFER(&eNB->common_vars.rxdata[0][0][subframe*eNB->frame_parms.samples_per_tti],
eNB->frame_parms.samples_per_tti * 4)); eNB->frame_parms.samples_per_tti * 4));
...@@ -2941,8 +2949,10 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const ...@@ -2941,8 +2949,10 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
&eNB->soundingrs_ul_config_dedicated[i], &eNB->soundingrs_ul_config_dedicated[i],
subframe, subframe,
0/*eNB_id*/)) { 0/*eNB_id*/)) {
LOG_E(PHY,"problem processing SRS\n"); LOG_E(PHY,"problem processing SRS\n");
} }
lte_eNB_srs_measurements(eNB,0/*eNB_id*/,i,0/*init_averaging*/);
} }
// Do PUCCH processing // Do PUCCH processing
...@@ -3083,6 +3093,19 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const ...@@ -3083,6 +3093,19 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0], eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1], eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1],
ret); ret);
/*printf("[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
eNB->Mod_id,harq_pid,
frame,subframe,
eNB->ulsch[i]->rnti,
dB_fixed(eNB->pusch_vars[i]->ulsch_power[0]),
dB_fixed(eNB->pusch_vars[i]->ulsch_power[1]),
eNB->UE_stats[i].UL_rssi[0],
eNB->UE_stats[i].UL_rssi[1],
eNB->measurements->n0_power_dB[0],
eNB->measurements->n0_power_dB[1],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1],
ret);*/
//compute the expected ULSCH RX power (for the stats) //compute the expected ULSCH RX power (for the stats)
eNB->ulsch[(uint32_t)i]->harq_processes[harq_pid]->delta_TF = eNB->ulsch[(uint32_t)i]->harq_processes[harq_pid]->delta_TF =
...@@ -3474,7 +3497,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const ...@@ -3474,7 +3497,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
0, 0,
eNB->first_run_I0_measurements); eNB->first_run_I0_measurements);
eNB->first_run_I0_measurements = 0; eNB->first_run_I0_measurements = 0;
} }
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
else { else {
......
...@@ -1196,6 +1196,8 @@ schedule_ue_spec( ...@@ -1196,6 +1196,8 @@ schedule_ue_spec(
} else { } else {
tpc = 1; //0 tpc = 1; //0
} }
//if (tpc != 1)
T(T_ENB_TPC_DLSCH, T_INT(frameP), T_INT(subframeP), T_INT(rnti), T_INT(tpc), T_INT(tpc_accumulated), T_INT(normalized_rx_power), T_INT(target_rx_power));
/* /*
LOG_I(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", LOG_I(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
module_idP,frameP, subframeP,harq_pid,tpc, module_idP,frameP, subframeP,harq_pid,tpc,
......
...@@ -317,6 +317,7 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP) ...@@ -317,6 +317,7 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
printf("MAC: cannot remove UE rnti %x\n", rntiP); printf("MAC: cannot remove UE rnti %x\n", rntiP);
LOG_W(MAC,"rrc_mac_remove_ue: UE %x not found\n", rntiP); LOG_W(MAC,"rrc_mac_remove_ue: UE %x not found\n", rntiP);
mac_phy_remove_ue(mod_idP, rntiP); mac_phy_remove_ue(mod_idP, rntiP);
printf("in rrc_mac_remove_ue %d\n", UE_id);
return 0; return 0;
} }
......
...@@ -139,6 +139,10 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -139,6 +139,10 @@ void rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_template[CC_idP][UE_id].phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET; UE_list->UE_template[CC_idP][UE_id].phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET;
LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n", LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n",
enb_mod_idP, CC_idP, rx_ces[i], UE_list->UE_template[CC_idP][UE_id].phr_info); enb_mod_idP, CC_idP, rx_ces[i], UE_list->UE_template[CC_idP][UE_id].phr_info);
T(T_ENB_TPC_ULSCH_PHR, T_INT(UE_id), T_INT(UE_list->UE_template[CC_idP][UE_id].phr_info));
UE_list->UE_template[CC_idP][UE_id].phr_info_configured=1; UE_list->UE_template[CC_idP][UE_id].phr_info_configured=1;
UE_list->UE_sched_ctrl[UE_id].phr_received = 1; UE_list->UE_sched_ctrl[UE_id].phr_received = 1;
} }
...@@ -726,6 +730,8 @@ void schedule_ulsch_rnti(module_id_t module_idP, ...@@ -726,6 +730,8 @@ void schedule_ulsch_rnti(module_id_t module_idP,
// LOG_I(MAC,"entering ulsch preprocesor\n"); // LOG_I(MAC,"entering ulsch preprocesor\n");
//if (subframeP == 0) return;
ulsch_scheduler_pre_processor(module_idP, ulsch_scheduler_pre_processor(module_idP,
frameP, frameP,
subframeP, subframeP,
...@@ -871,6 +877,10 @@ abort(); ...@@ -871,6 +877,10 @@ abort();
module_idP,frameP,subframeP,harq_pid,tpc, module_idP,frameP,subframeP,harq_pid,tpc,
tpc_accumulated,normalized_rx_power,target_rx_power); tpc_accumulated,normalized_rx_power,target_rx_power);
} }
//if (tpc != 1)
T(T_ENB_TPC_ULSCH, T_INT(frameP), T_INT(subframeP), T_INT(rnti), T_INT(tpc), T_INT(tpc_accumulated), T_INT(normalized_rx_power), T_INT(target_rx_power));
// new transmission // new transmission
if (round==0) { if (round==0) {
...@@ -884,7 +894,7 @@ abort(); ...@@ -884,7 +894,7 @@ abort();
if (UE_template->pre_allocated_rb_table_index_ul >=0) { if (UE_template->pre_allocated_rb_table_index_ul >=0) {
rb_table_index=UE_template->pre_allocated_rb_table_index_ul; rb_table_index=UE_template->pre_allocated_rb_table_index_ul;
} else { } else {
mcs=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs); mcs=4;//cmin (10, openair_daq_vars.target_ue_ul_mcs);
rb_table_index=5; // for PHR rb_table_index=5; // for PHR
} }
......
...@@ -1304,9 +1304,9 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra ...@@ -1304,9 +1304,9 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
continue; continue;
if (UE_list->UE_sched_ctrl[i].phr_received == 1) if (UE_list->UE_sched_ctrl[i].phr_received == 1)
mcs = 20; // if we've received the power headroom information the UE, we can go to maximum mcs mcs = 20; //20 before // if we've received the power headroom information the UE, we can go to maximum mcs
else else
mcs = 10; // otherwise, limit to QPSK PUSCH mcs = 10; //10 before // otherwise, limit to QPSK PUSCH
UE_id = i; UE_id = i;
...@@ -1339,7 +1339,7 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra ...@@ -1339,7 +1339,7 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
// fixme: set use_srs flag // fixme: set use_srs flag
tx_power= mac_xface->estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0); tx_power= mac_xface->estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0);
while ((((UE_template->phr_info - tx_power) < 0 ) || (tbs > UE_template->ul_total_buffer))&& while ((((UE_template->phr_info - tx_power) < -5 ) || (tbs > UE_template->ul_total_buffer))&&
(mcs > 3)) { (mcs > 3)) {
// LOG_I(MAC,"UE_template->phr_info %d tx_power %d mcs %d\n", UE_template->phr_info,tx_power, mcs); // LOG_I(MAC,"UE_template->phr_info %d tx_power %d mcs %d\n", UE_template->phr_info,tx_power, mcs);
mcs--; mcs--;
...@@ -1377,6 +1377,12 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra ...@@ -1377,6 +1377,12 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
UE_template->pre_allocated_rb_table_index_ul, UE_template->pre_allocated_rb_table_index_ul,
UE_template->pre_allocated_nb_rb_ul, UE_template->pre_allocated_nb_rb_ul,
UE_template->phr_info,tx_power); UE_template->phr_info,tx_power);
printf("[eNB %d] frame %d subframe %d: for UE %d CC %d: pre-assigned mcs %d, pre-allocated rb_table[%d]=%d RBs (phr %d, tx power %d)\n",
module_idP, frameP, subframeP, UE_id, CC_id,
UE_template->pre_assigned_mcs_ul,
UE_template->pre_allocated_rb_table_index_ul,
UE_template->pre_allocated_nb_rb_ul,
UE_template->phr_info,tx_power);
} else { } else {
UE_template->pre_allocated_rb_table_index_ul=-1; UE_template->pre_allocated_rb_table_index_ul=-1;
UE_template->pre_allocated_nb_rb_ul=0; UE_template->pre_allocated_nb_rb_ul=0;
......
...@@ -55,6 +55,14 @@ ...@@ -55,6 +55,14 @@
#include "platform_types.h" #include "platform_types.h"
#include "msc.h" #include "msc.h"
#include "sys/socket.h"
#include "sys/types.h"
#include "netinet/in.h"
#include "arpa/inet.h"
#include "system.h"
#include "sys/time.h"
#include "time.h"
#include "T.h" #include "T.h"
//#if defined(Rel10) || defined(Rel14) //#if defined(Rel10) || defined(Rel14)
...@@ -98,6 +106,8 @@ ...@@ -98,6 +106,8 @@
#endif #endif
//#define XER_PRINT //#define XER_PRINT
char measReportLog[2056];
#ifdef PHY_EMUL #ifdef PHY_EMUL
extern EMULATION_VARS *Emul_vars; extern EMULATION_VARS *Emul_vars;
#endif #endif
...@@ -1781,35 +1791,35 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ...@@ -1781,35 +1791,35 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
MeasId0->reportConfigId = 1; MeasId0->reportConfigId = 1;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
MeasId1 = CALLOC(1, sizeof(*MeasId1)); // MeasId1 = CALLOC(1, sizeof(*MeasId1));
MeasId1->measId = 2; // MeasId1->measId = 2;
MeasId1->measObjectId = 1; // MeasId1->measObjectId = 1;
MeasId1->reportConfigId = 2; // MeasId1->reportConfigId = 2;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); // ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
//
MeasId2 = CALLOC(1, sizeof(*MeasId2)); // MeasId2 = CALLOC(1, sizeof(*MeasId2));
MeasId2->measId = 3; // MeasId2->measId = 3;
MeasId2->measObjectId = 1; // MeasId2->measObjectId = 1;
MeasId2->reportConfigId = 3; // MeasId2->reportConfigId = 3;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); // ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
//
MeasId3 = CALLOC(1, sizeof(*MeasId3)); // MeasId3 = CALLOC(1, sizeof(*MeasId3));
MeasId3->measId = 4; // MeasId3->measId = 4;
MeasId3->measObjectId = 1; // MeasId3->measObjectId = 1;
MeasId3->reportConfigId = 4; // MeasId3->reportConfigId = 4;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); // ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
//
MeasId4 = CALLOC(1, sizeof(*MeasId4)); // MeasId4 = CALLOC(1, sizeof(*MeasId4));
MeasId4->measId = 5; // MeasId4->measId = 5;
MeasId4->measObjectId = 1; // MeasId4->measObjectId = 1;
MeasId4->reportConfigId = 5; // MeasId4->reportConfigId = 5;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); // ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
//
MeasId5 = CALLOC(1, sizeof(*MeasId5)); // MeasId5 = CALLOC(1, sizeof(*MeasId5));
MeasId5->measId = 6; // MeasId5->measId = 6;
MeasId5->measObjectId = 1; // MeasId5->measObjectId = 1;
MeasId5->reportConfigId = 6; // MeasId5->reportConfigId = 6;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); // ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
// rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
...@@ -1824,7 +1834,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ...@@ -1824,7 +1834,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
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 = 3350; //band 7, 2.68GHz MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 37850; //band 7, 2.68GHz
//MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz //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;
...@@ -1857,15 +1867,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ...@@ -1857,15 +1867,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); // ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
//
ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); // ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
//
ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); // ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
//
ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); // ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
//
ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); // ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfigId = 1;
ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
...@@ -1881,118 +1891,118 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ...@@ -1881,118 +1891,118 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
ReportConfig_A1->reportConfigId = 2; // ReportConfig_A1->reportConfigId = 2;
ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; // a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
a1_Threshold.choice.threshold_RSRP = 10; // a1_Threshold.choice.threshold_RSRP = 10;
//
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
//
if (ho_state == 1 /*HO_MEASURMENT */ ) { // if (ho_state == 1 /*HO_MEASURMENT */ ) {
LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", // LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
ctxt_pP->module_id, ctxt_pP->frame); // ctxt_pP->module_id, ctxt_pP->frame);
ReportConfig_A2->reportConfigId = 3; // ReportConfig_A2->reportConfigId = 3;
ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; // eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA2.a2_Threshold.choice.threshold_RSRP = 10; // eventA2.a2_Threshold.choice.threshold_RSRP = 10;
//
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
//
ReportConfig_A3->reportConfigId = 4; // ReportConfig_A3->reportConfigId = 4;
ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
//
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA3.reportOnLeave = 1; // eventA3.reportOnLeave = 1;
//
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long!
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger =
TimeToTrigger_ms40; // TimeToTrigger_ms40;
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
//
ReportConfig_A4->reportConfigId = 5; // ReportConfig_A4->reportConfigId = 5;
ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; // eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA4.a4_Threshold.choice.threshold_RSRP = 10; // eventA4.a4_Threshold.choice.threshold_RSRP = 10;
//
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
//
ReportConfig_A5->reportConfigId = 6; // ReportConfig_A5->reportConfigId = 6;
ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; // eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; // eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold1.choice.threshold_RSRP = 10; // eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold2.choice.threshold_RSRP = 10; // eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
//
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
// rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; // // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
//
rsrp = CALLOC(1, sizeof(RSRP_Range_t)); // rsrp = CALLOC(1, sizeof(RSRP_Range_t));
*rsrp = 20; // *rsrp = 20;
Sparams = CALLOC(1, sizeof(*Sparams)); Sparams = CALLOC(1, sizeof(*Sparams));
Sparams->present = MeasConfig__speedStatePars_PR_setup; Sparams->present = MeasConfig__speedStatePars_PR_setup;
...@@ -2017,29 +2027,29 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ...@@ -2017,29 +2027,29 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
LOG_I(RRC, // LOG_I(RRC,
"[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", // "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
ctxt_pP->module_id, ctxt_pP->frame); // ctxt_pP->module_id, ctxt_pP->frame);
// store the information in an intermediate structure for Hanodver management // // store the information in an intermediate structure for Hanodver management
//rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); // //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); // ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
//memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); // //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t));
ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; // ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2;
//memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); // //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t));
ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList; // ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList;
ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; // ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = // ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig =
CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); // CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig));
memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, // memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
(void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); // (void *)mac_MainConfig, sizeof(MAC_MainConfig_t));
ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = // ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated =
CALLOC(1, sizeof(PhysicalConfigDedicated_t)); // CALLOC(1, sizeof(PhysicalConfigDedicated_t));
memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, // memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
(void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); // (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t));
ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; // ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL;
//memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); // //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t));
//
} // }
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
/* Initialize NAS list */ /* Initialize NAS list */
...@@ -2087,14 +2097,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ...@@ -2087,14 +2097,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
(DRB_ToReleaseList_t*)NULL, // DRB2_list, (DRB_ToReleaseList_t*)NULL, // DRB2_list,
(struct SPS_Config*)NULL, // *sps_Config, (struct SPS_Config*)NULL, // *sps_Config,
(struct PhysicalConfigDedicated*)*physicalConfigDedicated, (struct PhysicalConfigDedicated*)*physicalConfigDedicated,
#ifdef EXMIMO_IOT //#ifdef EXMIMO_IOT
NULL, NULL, NULL,NULL, // NULL, NULL, NULL,NULL,
#else //#else
(MeasObjectToAddModList_t*)MeasObj_list, (MeasObjectToAddModList_t*)MeasObj_list,
(ReportConfigToAddModList_t*)ReportConfig_list, (ReportConfigToAddModList_t*)ReportConfig_list,
(QuantityConfig_t*)quantityConfig, (QuantityConfig_t*)quantityConfig,
(MeasIdToAddModList_t*)MeasId_list, (MeasIdToAddModList_t*)MeasId_list,
#endif //#endif
(MAC_MainConfig_t*)mac_MainConfig, (MAC_MainConfig_t*)mac_MainConfig,
(MeasGapConfig_t*)NULL, (MeasGapConfig_t*)NULL,
(MobilityControlInfo_t*)NULL, (MobilityControlInfo_t*)NULL,
...@@ -2246,25 +2256,26 @@ rrc_eNB_process_MeasurementReport( ...@@ -2246,25 +2256,26 @@ rrc_eNB_process_MeasurementReport(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), //T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); //T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n", // LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId); // ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId);
//
if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { // if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
LOG_I(RRC, "Physical Cell Id %d\n", // LOG_I(RRC, "Physical Cell Id %d\n",
(int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); // (int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
LOG_I(RRC, "RSRP of Target %d\n", // LOG_I(RRC, "RSRP of Target %d\n",
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]-> // (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrpResult)); // measResult.rsrpResult));
LOG_I(RRC, "RSRQ of Target %d\n", // LOG_I(RRC, "RSRQ of Target %d\n",
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]-> // (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrqResult)); // measResult.rsrqResult));
} // }
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
T(T_ENB_RRC_RSRP, T_INT(ctxt_pP->rnti), T_INT(measResults2->measResultPCell.rsrpResult));
LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultPCell.rsrpResult); LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultPCell.rsrpResult);
LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultPCell.rsrqResult); LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultPCell.rsrqResult);
#else #else
...@@ -2272,15 +2283,67 @@ rrc_eNB_process_MeasurementReport( ...@@ -2272,15 +2283,67 @@ rrc_eNB_process_MeasurementReport(
LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultServCell.rsrqResult); LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultServCell.rsrqResult);
#endif #endif
if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { //////////////////////////////////////////
rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, /* Send measurement logs to a socket*/
ue_context_pP,
measResults2->measResultNeighCells->choice. int sendfd=0;
measResultListEUTRA.list.array[0]->physCellId); struct sockaddr_in serv_addr;
} else { //char *ipad="192.172.0.3";
LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, char *ipad="10.0.0.2";
ctxt_pP->rnti);
} struct timeval curTime;
gettimeofday(&curTime, NULL);
int milli=curTime.tv_usec/1000;
char buft[80];
strftime(buft,80,"%H,%M,%S",localtime(&curTime.tv_sec));
char currentTime[84]="";
sprintf(currentTime,"%s:%d",buft,milli);
//printf("current time: %s \n", currentTime);
//memset(&measReportLog,'0',sizeof(measReportLog));
#if defined(Rel10) || defined(Rel14)
sprintf(measReportLog,"S%s,%d,%ldd\n",buft,milli, measResults2->measResultPCell.rsrpResult);
#else
sprintf(measReportLog,"S%s,%d,%ldd\n",buft,milli, measResults2->measResultPCell.rsrpResult);
#endif
if( (sendfd=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP))< 0){
printf("\n******* ERROR in creating socket ***********\n");
//exit(-1);
}
memset(&serv_addr,'0',sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(9900);
if(inet_aton(ipad,&serv_addr.sin_addr)<=0){
printf("*******\n inet_pton error \n*****");
}
if(connect(sendfd,(struct sockaddr*)&serv_addr,sizeof(serv_addr)) < 0){
printf("******\n connection failed \n*********");
}
bind(sendfd,(struct sockaddr*)&serv_addr,sizeof(serv_addr));
//write(sendfd,measReportLog,strlen(measReportLog));
sendto(sendfd,measReportLog,2056,0,(struct sockaddr*)&serv_addr,sizeof(serv_addr));
close(sendfd);
/* Send measurement logs to a socket*/
//////////////////////////////////////////
// if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) {
// rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP,
// ue_context_pP,
// measResults2->measResultNeighCells->choice.
// measResultListEUTRA.list.array[0]->physCellId);
// } else {
// LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame,
// ctxt_pP->rnti);
// }
//Look for IP address of the target eNB //Look for IP address of the target eNB
//Send Handover Request -> target eNB //Send Handover Request -> target eNB
...@@ -3008,15 +3071,15 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ...@@ -3008,15 +3071,15 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); // ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
//
ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); // ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
//
ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); // ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
//
ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); // ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
//
ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); // ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfigId = 1;
ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
...@@ -3032,104 +3095,104 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ...@@ -3032,104 +3095,104 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
ReportConfig_A1->reportConfigId = 2; // ReportConfig_A1->reportConfigId = 2;
ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; // a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
a1_Threshold.choice.threshold_RSRP = 10; // a1_Threshold.choice.threshold_RSRP = 10;
//
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
//
ReportConfig_A2->reportConfigId = 3; // ReportConfig_A2->reportConfigId = 3;
ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.
a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; // a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.
a2_Threshold.choice.threshold_RSRP = 10; // a2_Threshold.choice.threshold_RSRP = 10;
//
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
//
ReportConfig_A3->reportConfigId = 4; // ReportConfig_A3->reportConfigId = 4;
ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset =
10; // 10;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA3.reportOnLeave = 1; // eventA3.reportOnLeave = 1;
//
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
//
ReportConfig_A4->reportConfigId = 5; // ReportConfig_A4->reportConfigId = 5;
ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.
a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; // a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.
a4_Threshold.choice.threshold_RSRP = 10; // a4_Threshold.choice.threshold_RSRP = 10;
//
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
//
ReportConfig_A5->reportConfigId = 6; // ReportConfig_A5->reportConfigId = 6;
ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; // ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_event; // ReportConfigEUTRA__triggerType_PR_event;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; // ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; // eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; // eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold1.choice.threshold_RSRP = 10; // eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA5.a5_Threshold2.choice.threshold_RSRP = 10; // eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
//
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; // ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
//
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); // ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
Sparams = CALLOC(1, sizeof(*Sparams)); Sparams = CALLOC(1, sizeof(*Sparams));
Sparams->present = MeasConfig__speedStatePars_PR_setup; Sparams->present = MeasConfig__speedStatePars_PR_setup;
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#include "common_lib.h" #include "common_lib.h"
#include "assertions.h" #include "assertions.h"
#include <uhd/types/tune_request.hpp>
#ifdef __SSE4_1__ #ifdef __SSE4_1__
# include <smmintrin.h> # include <smmintrin.h>
#endif #endif
...@@ -78,6 +80,9 @@ typedef struct { ...@@ -78,6 +80,9 @@ typedef struct {
//! USRP RX Metadata //! USRP RX Metadata
uhd::rx_metadata_t rx_md; uhd::rx_metadata_t rx_md;
uhd::tune_request_t tu_req;
//! Sampling rate //! Sampling rate
double sample_rate; double sample_rate;
...@@ -106,16 +111,33 @@ static int trx_usrp_start(openair0_device *device) { ...@@ -106,16 +111,33 @@ static int trx_usrp_start(openair0_device *device) {
usrp_state_t *s = (usrp_state_t*)device->priv; usrp_state_t *s = (usrp_state_t*)device->priv;
//uint8_t mask=0x0f;
// uint8_t ddr=0x07;
// uint8_t ctrlm=0x07;
// uint8_t atr_r=0x03;
// uint8_t atr_t=0x04;
//
// s->usrp->set_gpio_attr("FP0", "DDR", ddr, 0x1f);
// s->usrp->set_gpio_attr("FP0", "CTRL", ctrlm,0x1f);
// s->usrp->set_gpio_attr("FP0", "ATR_RX", atr_r, 0x1f);
// s->usrp->set_gpio_attr("FP0", "ATR_XX", atr_t, 0x1f);
// setup GPIO for TDD, GPIO(4) = ATR_RX // setup GPIO for TDD, GPIO(4) = ATR_RX
//set data direction register (DDR) to output //set data direction register (DDR) to output
s->usrp->set_gpio_attr("FP0", "DDR", 0x1f, 0x1f); s->usrp->set_gpio_attr("FP0", "DDR", 0x1f, 0x1f);
//set control register to ATR //set control register to ATR
s->usrp->set_gpio_attr("FP0", "CTRL", 0x1f,0x1f); s->usrp->set_gpio_attr("FP0", "CTRL", 0x1f,0x1f);
//set ATR register //set ATR register
s->usrp->set_gpio_attr("FP0", "ATR_RX", 1<<4, 0x1f); s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4), 0x1f);
// init recv and send streaming // init recv and send streaming
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
...@@ -156,7 +178,20 @@ static void trx_usrp_end(openair0_device *device) { ...@@ -156,7 +178,20 @@ static void trx_usrp_end(openair0_device *device) {
@param flags flags must be set to TRUE if timestamp parameter needs to be applied @param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/ */
static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int ret=0; int ret=0,nsamps2;
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2 = (nsamps+7)>>3;
#else
nsamps2 = (nsamps+3)>>2;
#endif
#elif defined(__arm__)
nsamps2 = (nsamps+3)>>2;
#endif
uint32_t tx_buff[nsamps] __attribute__ ((aligned(32)));
usrp_state_t *s = (usrp_state_t*)device->priv; usrp_state_t *s = (usrp_state_t*)device->priv;
s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate); s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate);
...@@ -182,13 +217,28 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -182,13 +217,28 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
s->tx_md.end_of_burst = false; s->tx_md.end_of_burst = false;
} }
// bring RX data into 12 MSBs for USRP::Shift by 4 bits to left
for (int i=0; i<cc; i++) {
for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
((__m256i *)tx_buff)[j] = _mm256_slli_epi16(((__m256i *)buff[i])[j],4);
#else
((__m128i *)tx_buff)[j] = _mm_slli_epi16(((__m128i *)buff[i])[j],4);
#endif
#elif defined(__arm__)
((int16x8_t*)tx_buff)[j] = vshrq_n_s16(buff[i][j],4);
#endif
}
}
if (cc>1) { if (cc>1) {
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
for (int i=0; i<cc; i++) for (int i=0; i<cc; i++)
buff_ptrs.push_back(buff[i]); buff_ptrs.push_back(tx_buff);
ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md,1e-3); ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md,1e-3);
} else } else
ret = (int)s->tx_stream->send(buff[0], nsamps, s->tx_md,1e-3); ret = (int)s->tx_stream->send(tx_buff, nsamps, s->tx_md,1e-3);
...@@ -292,9 +342,17 @@ void *freq_thread(void *arg) { ...@@ -292,9 +342,17 @@ void *freq_thread(void *arg) {
openair0_device *device=(openair0_device *)arg; openair0_device *device=(openair0_device *)arg;
usrp_state_t *s = (usrp_state_t*)device->priv; usrp_state_t *s = (usrp_state_t*)device->priv;
printf("Setting USRP TX Freq %f, RX Freq %f\n",device->openair0_cfg[0].tx_freq[0],device->openair0_cfg[0].rx_freq[0]);
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]); s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]);
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]); s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]);
// change to advanced lo offset from above line
//uhd::tune_request_t rx_tune_req(device->openair0_cfg[0].rx_freq[0],(double)20000000);
//rx_tune_req.rf_freq_policy=uhd::tune_request_t::POLICY_MANUAL;
//rx_tune_req.rf_freq=device->openair0_cfg[0].rx_freq[0]-(double)20000000;
//s->usrp->set_rx_freq(rx_tune_req);
//printf("Actual USRP RX Freq %f\n",s->usrp->get_rx_freq(0));
} }
/*! \brief Set frequencies (TX/RX). Spawns a thread to handle the frequency change to not block the calling thread /*! \brief Set frequencies (TX/RX). Spawns a thread to handle the frequency change to not block the calling thread
* \param device the hardware to use * \param device the hardware to use
...@@ -315,6 +373,12 @@ int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, ...@@ -315,6 +373,12 @@ int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,
else { else {
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]); s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]);
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]); s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]);
// change to advanced lo offset from above line
//uhd::tune_request_t rx_tune_req(device->openair0_cfg[0].rx_freq[0],(double)20000000);
//rx_tune_req.rf_freq_policy=uhd::tune_request_t::POLICY_MANUAL;
//rx_tune_req.rf_freq=device->openair0_cfg[0].rx_freq[0]-(double)20000000;
//s->usrp->set_rx_freq(rx_tune_req);
//printf("Actual USRP RX Freq %f\n",s->usrp->get_rx_freq(0));
} }
return(0); return(0);
...@@ -331,14 +395,15 @@ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *open ...@@ -331,14 +395,15 @@ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *open
usrp_state_t *s = (usrp_state_t*)device->priv; usrp_state_t *s = (usrp_state_t*)device->priv;
static int first_call=1; static int first_call=1;
static double rf_freq,diff; static double rf_freq,diff;
printf("Setting USRP TX RX Freq %f\n",openair0_cfg[0].rx_freq[0]);
uhd::tune_request_t rx_tune_req(openair0_cfg[0].rx_freq[0]); uhd::tune_request_t rx_tune_req(device->openair0_cfg[0].rx_freq[0],(double)20000000);
rx_tune_req.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL; rx_tune_req.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
rx_tune_req.rf_freq = openair0_cfg[0].rx_freq[0]; //rx_tune_req.rf_freq = openair0_cfg[0].rx_freq[0];
rf_freq=openair0_cfg[0].rx_freq[0]; //rf_freq=openair0_cfg[0].rx_freq[0];
s->usrp->set_rx_freq(rx_tune_req); s->usrp->set_rx_freq(rx_tune_req);
printf("Actual USRP RX Freq %f\n",s->usrp->get_rx_freq(0));
return(0); return(0);
} }
...@@ -638,7 +703,16 @@ extern "C" { ...@@ -638,7 +703,16 @@ extern "C" {
for(int i=0; i<s->usrp->get_rx_num_channels(); i++) { for(int i=0; i<s->usrp->get_rx_num_channels(); i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i); s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
// uhd::tune_request_t rx_tune_req(openair0_cfg[0].rx_freq[0],(double)12000000);
//rx_tune_req.rf_freq_policy=uhd::tune_request_t::POLICY_MANUAL;
//rx_tune_req.rf_freq=device->openair0_cfg[0].rx_freq[0]-(double)20000000;
//s->usrp->set_rx_freq(rx_tune_req);
//printf("\n*****\n Desired USRP RX Freq %f\n",openair0_cfg[0].rx_freq[0]);
//printf("\n*****\n Actual USRP RX Freq %f\n",s->usrp->get_rx_freq(0));
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust); set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i); ::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
......
...@@ -308,7 +308,7 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) ...@@ -308,7 +308,7 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,1);
if (phy_vars_eNB->proc.frame_tx==0) LOG_I(PHY,"doing OFDM mod for for slot %d\n",subframe<<1); //if (phy_vars_eNB->proc.frame_tx==0) LOG_I(PHY,"doing OFDM mod for for slot %d\n",subframe<<1);
do_OFDM_mod_symbol(&phy_vars_eNB->common_vars, do_OFDM_mod_symbol(&phy_vars_eNB->common_vars,
0, 0,
subframe<<1, subframe<<1,
...@@ -380,13 +380,6 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) ...@@ -380,13 +380,6 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB)
if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti)) if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti))
tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti; tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti;
/* ((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[0] = ((short*)dummy_tx_b)[2*i]<<openair0_cfg[0].iq_txshift;
((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[1] = ((short*)dummy_tx_b)[2*i+1]<<openair0_cfg[0].iq_txshift; */
((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[0] = ((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[0]<<openair0_cfg[CC_id].iq_txshift;
((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[1] = ((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[1]<<openair0_cfg[CC_id].iq_txshift;
} }
// if S-subframe switch to RX in second subframe // if S-subframe switch to RX in second subframe
if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_S) { if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_S) {
...@@ -494,7 +487,7 @@ void proc_tx_full(PHY_VARS_eNB *eNB, ...@@ -494,7 +487,7 @@ void proc_tx_full(PHY_VARS_eNB *eNB,
// do OFDM modulation // do OFDM modulation
do_OFDM_mod_rt(proc->subframe_tx,eNB); do_OFDM_mod_rt(proc->subframe_tx,eNB);
// if TX fronthaul go ahead // if TX fronthaul go ahead
if (proc->frame_tx == 0) LOG_I(PHY, "Frame 0 : Calling eNB->tx_fh for subframe %d\n",proc->subframe_tx); //if (proc->frame_tx == 0) LOG_I(PHY, "Frame 0 : Calling eNB->tx_fh for subframe %d\n",proc->subframe_tx);
eNB->proc.subframe_tx = proc->subframe_tx; eNB->proc.subframe_tx = proc->subframe_tx;
if (eNB->tx_fh) eNB->tx_fh(eNB,proc); if (eNB->tx_fh) eNB->tx_fh(eNB,proc);
...@@ -608,6 +601,49 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam ...@@ -608,6 +601,49 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
return(0); return(0);
} }
static inline int rxtx_new(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
pthread_mutex_lock(&eNB->proc.mutex_rxnew);
//printf("Entering the RX part for %d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
// ****************************************
// Common RX procedures subframe n
if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5)))
eNB->do_prach(eNB,proc->frame_rx,proc->subframe_rx);
//printf("In the RX part after PRACH for %d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
phy_procedures_eNB_common_RX(eNB,proc);
//printf("In the RX part after common for %d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
// UE-specific RX processing for subframe n
if (eNB->proc_uespec_rx) eNB->proc_uespec_rx(eNB, proc, no_relay );
//printf("Exiting the RX part for %d\n",&eNB->proc.proc_rxtx[0] == proc? 0 : 1);
pthread_mutex_unlock(&eNB->proc.mutex_rxnew);
// *****************************************
// TX processing for subframe n+4
// run PHY TX procedures the one after the other for all CCs to avoid race conditions
// (may be relaxed in the future for performance reasons)
// *****************************************
//if (wait_CCs(proc)<0) return(-1);
if (oai_exit) return(-1);
//pthread_mutex_lock(&proc->mutex_txnew);
pthread_mutex_lock(&eNB->proc.mutex_txnew);
if (eNB->proc_tx) eNB->proc_tx(eNB, proc, no_relay, NULL );
pthread_mutex_unlock(&eNB->proc.mutex_txnew);
// pthread_mutex_unlock(&proc->mutex_txnew);
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
return(0);
}
/*! /*!
* \brief The RX UE-specific and TX thread of eNB. * \brief The RX UE-specific and TX thread of eNB.
* \param param is a \ref eNB_proc_t structure which contains the info what to process. * \param param is a \ref eNB_proc_t structure which contains the info what to process.
...@@ -1046,12 +1082,97 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -1046,12 +1082,97 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
if (rxs != fp->samples_per_tti) if (rxs != fp->samples_per_tti)
exit_fun( "problem receiving samples" ); exit_fun( "problem receiving samples" );
}
void rx_rf_new(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
eNB_proc_t *proc = &eNB->proc;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
void *rxp[fp->nb_antennas_rx];
unsigned int rxs;
int i;
openair0_timestamp ts,old_ts;
for (i=0; i<fp->nb_antennas_rx; i++)
rxp[i] = (void*)&eNB->common_vars.rxdata[0][i][*subframe*fp->samples_per_tti];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
old_ts = proc->timestamp_rx;
rxs = eNB->rfdevice.trx_read_func(&eNB->rfdevice,
&ts,
rxp,
fp->samples_per_tti,
fp->nb_antennas_rx);
start_rf_prev2= start_rf_prev;
start_rf_prev2_ts= start_rf_prev_ts;
start_rf_prev = start_rf_new;
start_rf_prev_ts = start_rf_new_ts;
clock_gettime( CLOCK_MONOTONIC, &start_rf_new);
start_rf_new_ts = ts;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
proc->timestamp_rx = ts-eNB->ts_offset;
if (rxs != fp->samples_per_tti)
LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
if (proc->first_rx == 1) {
eNB->ts_offset = proc->timestamp_rx;
proc->timestamp_rx=0;
}
else {
if (proc->timestamp_rx - old_ts != fp->samples_per_tti) {
LOG_I(PHY,"xx_rf: rfdevice timing drift of %"PRId64" samples\n",proc->timestamp_rx - old_ts - fp->samples_per_tti);
eNB->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti);
proc->timestamp_rx = ts-eNB->ts_offset;
}
}
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023;
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
//proc->subframe_tx = (proc->subframe_rx+4)%10;
proc->frame_rx = (proc->frame_rx+proc->frame_offset)&1023;
//proc->frame_tx = proc->frame_rx;
//if (proc->subframe_rx > 5) proc->frame_tx=(proc->frame_tx+1)&1023;
// synchronize first reception to frame 0 subframe 0
//proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti);
// printf("trx_read <- USRP TS %lu (offset %d sf %d, f %d, first_rx %d)\n", proc->timestamp_rx,eNB->ts_offset,proc->subframe_rx,proc->frame_rx,proc->first_rx);
if (proc->first_rx == 0) {
if (proc->subframe_rx != *subframe){
LOG_E(PHY,"rx_rf: Received Timestamp (%"PRId64") doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->timestamp_rx,proc->subframe_rx,*subframe);
exit_fun("Exiting");
}
int f2 = (*frame+proc->frame_offset)&1023;
if (proc->frame_rx != f2) {
LOG_E(PHY,"rx_rf: Received Timestamp (%"PRId64") doesn't correspond to the time we think it is (proc->frame_rx %d frame %d, frame_offset %d, f2 %d)\n",proc->timestamp_rx,proc->frame_rx,*frame,proc->frame_offset,f2);
exit_fun("Exiting");
}
} else {
proc->first_rx--;
*frame = proc->frame_rx;
*subframe = proc->subframe_rx;
}
proc->ts_offset = eNB->ts_offset;
//printf("timestamp_rx %lu, frame %d(%d), subframe %d(%d)\n",proc->timestamp_rx,proc->frame_rx,frame,proc->subframe_rx,subframe);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, (proc->timestamp_rx+eNB->ts_offset)&0xffffffff );
if (rxs != fp->samples_per_tti)
exit_fun( "problem receiving samples" );
} }
void rx_fh_if5(PHY_VARS_eNB *eNB,int *frame, int *subframe) { void rx_fh_if5(PHY_VARS_eNB *eNB,int *frame, int *subframe) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
...@@ -1541,7 +1662,7 @@ void tx_rf(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) { ...@@ -1541,7 +1662,7 @@ void tx_rf(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) {
int siglen=fp->samples_per_tti,flags=1; int siglen=fp->samples_per_tti,flags=1;
if (SF_type == SF_S) { if (SF_type == SF_S) {
siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0); siglen = (fp->dl_symbols_in_S_subframe+1)*(fp->ofdm_symbol_size+1+fp->nb_prefix_samples0);
flags=3; // end of burst flags=3; // end of burst
} }
if ((fp->frame_type == TDD) && if ((fp->frame_type == TDD) &&
...@@ -1591,6 +1712,82 @@ void tx_rf(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) { ...@@ -1591,6 +1712,82 @@ void tx_rf(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) {
} }
} }
void tx_rf_new(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) {
eNB_proc_t *proc = &eNB->proc;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
void *txp[fp->nb_antennas_tx];
unsigned int txs;
int i;
// Transmit TX buffer based on timestamp from RX
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers
lte_subframe_t SF_type = subframe_select(fp,(proc_rxtx->subframe_tx)%10);
lte_subframe_t prevSF_type = subframe_select(fp,(proc_rxtx->subframe_tx+9)%10);
lte_subframe_t nextSF_type = subframe_select(fp,(proc_rxtx->subframe_tx+1)%10);
int sf_extension = 0;
if ((SF_type == SF_DL) ||
(SF_type == SF_S)) {
int siglen=fp->samples_per_tti,flags=1;
if (SF_type == SF_S) {
siglen = (fp->dl_symbols_in_S_subframe+1)*(fp->ofdm_symbol_size+fp->nb_prefix_samples0);
flags=3; // end of burst
}
if ((fp->frame_type == TDD) &&
(SF_type == SF_DL)&&
(prevSF_type == SF_UL) &&
(nextSF_type == SF_DL)) {
flags = 2; // start of burst
sf_extension = eNB->N_TA_offset<<1;
}
if ((fp->frame_type == TDD) &&
(SF_type == SF_DL)&&
(prevSF_type == SF_UL) &&
(nextSF_type == SF_UL)) {
flags = 4; // start of burst and end of burst (only one DL SF between two UL)
sf_extension = eNB->N_TA_offset<<1;
}
//if (proc->frame_tx == 0) LOG_I(PHY,"siglen = %d, sf_extension = %d (%d,%d)\n",siglen,sf_extension,proc->subframe_tx,proc_rxtx->subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx+eNB->ts_offset-openair0_cfg[0].tx_sample_advance-sf_extension)&0xffffffff );
for (i=0; i<fp->nb_antennas_tx; i++)
txp[i] = (void*)&eNB->common_vars.txdata[0][i][(((proc->subframe_tx)%10)*fp->samples_per_tti) - sf_extension];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS,flags);
txs = eNB->rfdevice.trx_write_func(&eNB->rfdevice,
proc_rxtx->timestamp_tx+proc_rxtx->ts_offset-openair0_cfg[0].tx_sample_advance-sf_extension,
txp,
siglen+sf_extension,
fp->nb_antennas_tx,
flags);
clock_gettime( CLOCK_MONOTONIC, &end_rf);
end_rf_ts = proc_rxtx->timestamp_tx+proc_rxtx->ts_offset-openair0_cfg[0].tx_sample_advance;
if (recv_if_count != 0 ) {
recv_if_count = recv_if_count-1;
LOG_D(HW,"[From Timestamp %llu to Timestamp %llu] RTT_RF: %"PRId64"; RTT_RF\n", (long long unsigned int)start_rf_prev_ts, (long long unsigned int)end_rf_ts, clock_difftime_ns(start_rf_prev, end_rf));
LOG_D(HW,"[From Timestamp %llu to Timestamp %llu] RTT_RF: %"PRId64"; RTT_RF\n", (long long unsigned int)start_rf_prev2_ts, (long long unsigned int)end_rf_ts, clock_difftime_ns(start_rf_prev2, end_rf));
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
if (txs != siglen+sf_extension) {
LOG_E(PHY,"TX : Timeout (sent %d/%d)\n",txs, fp->samples_per_tti);
exit_fun( "problem transmitting samples" );
}
}
}
static void* eNB_thread_single( void* param ) { static void* eNB_thread_single( void* param ) {
static int eNB_thread_single_status; static int eNB_thread_single_status;
...@@ -1760,6 +1957,113 @@ static void* eNB_thread_single( void* param ) { ...@@ -1760,6 +1957,113 @@ static void* eNB_thread_single( void* param ) {
} }
int subframe_th=0;
int frame_th=0;
static void* eNB_thread( void* param ) {
static int eNB_thread_status;
enB_thread_params *args = (enB_thread_params*)param;
eNB_proc_t *proc = args->argeNBProc;
eNB_rxtx_proc_t *proc_rxtx = args->argeNBproc_rxtx;
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][proc->CC_id];
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
eNB->CC_id = proc->CC_id;
void *rxp[2],*rxp2[2];
int32_t dummy_rx[fp->nb_antennas_rx][fp->samples_per_tti] __attribute__((aligned(32)));
int ic;
int rxs;
int i;
// initialize the synchronization buffer to the common_vars.rxdata
for (int i=0;i<fp->nb_antennas_rx;i++)
rxp[i] = &eNB->common_vars.rxdata[0][i][0];
// set default return value
eNB_thread_status = 0;
thread_top_init("eNB_thread",0,870000,1000000,1000000);
wait_sync("eNB_thread");
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
if (eNB->node_function < NGFI_RRU_IF5)
wait_system_ready ("Waiting for eNB application to be ready %s\r", &start_eNB);
#endif
// Start IF device if any
if (eNB->start_if)
if (eNB->start_if(eNB) != 0)
LOG_E(HW,"Could not start the IF device\n");
// Start RF device if any
if (eNB->start_rf)
if (eNB->start_rf(eNB) != 0)
LOG_E(HW,"Could not start the RF device\n");
// wakeup asnych_rxtx thread because the devices are ready at this point
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
proc->instance_cnt_asynch_rxtx=0;
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
pthread_cond_signal(&proc->cond_asynch_rxtx);
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
while (!oai_exit) {
pthread_mutex_lock(&proc->mutex_rxRf );
//printf("Entering in thread %d\n",&proc->proc_rxtx[0] == proc_rxtx ? 0 : 1);
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines.
if (subframe_th==9) {
subframe_th=0;
frame_th++;
frame_th&=1023;
} else {
subframe_th++;
}
if (eNB->CC_id==1)
LOG_D(PHY,"eNB thread single (proc %p, CC_id %d), frame %d (%p), subframe %d (%p)\n",
proc, eNB->CC_id, frame_th,&frame_th,subframe_th,&subframe_th);
// synchronization on FH interface, acquire signals/data and block
if (eNB->rx_fh) eNB->rx_fh(eNB,&frame_th,&subframe_th);
else AssertFatal(1==0, "No fronthaul interface : eNB->node_function %d",eNB->node_function);
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
proc_rxtx->subframe_rx = proc->subframe_rx;
proc_rxtx->frame_rx = proc->frame_rx;
proc_rxtx->subframe_tx = (proc->subframe_rx+4)%10;
proc_rxtx->frame_tx = (proc->subframe_rx>5) ? (1+proc->frame_rx)&1023 : proc->frame_rx;
proc->frame_tx = proc_rxtx->frame_tx;
proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti);
proc_rxtx->timestamp_tx = proc->timestamp_tx;
proc_rxtx->timestamp_rx = proc->timestamp_rx;
proc_rxtx->ts_offset = proc->ts_offset;
// adjust for timing offset between RRU
if (eNB->CC_id!=0) proc_rxtx->frame_tx = (proc_rxtx->frame_tx+proc->frame_offset)&1023;
// printf("Exiting the thread %d\n",&proc->proc_rxtx[0] == proc_rxtx ? 0 : 1);
pthread_mutex_unlock(&proc->mutex_rxRf);
if (rxtx_new(eNB,proc_rxtx,"eNB_thread_single") < 0) break;
}
printf( "Exiting eNB_single thread \n");
eNB_thread_status = 0;
return &eNB_thread_status;
}
extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *); extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *);
extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *); extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *);
extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *); extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *);
...@@ -1834,9 +2138,19 @@ void init_eNB_proc(int inst) { ...@@ -1834,9 +2138,19 @@ void init_eNB_proc(int inst) {
#endif #endif
if (eNB->single_thread_flag==0) { if (eNB->single_thread_flag==0) {
pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); // pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &proc->pthread_FH, attr_FH, eNB_thread_FH, &eNB->proc ); //pthread_create( &proc->pthread_FH, attr_FH, eNB_thread_FH, &eNB->proc );
for (int th=0;th<2;th++){
enB_thread_params *argseNBThread = malloc(sizeof *argseNBThread);
argseNBThread->argeNBProc=proc;
argseNBThread->argeNBproc_rxtx=&proc_rxtx[th];
if(th == 0) pthread_create(&proc->pthread_even, NULL, eNB_thread, argseNBThread);
else pthread_create(&proc->pthread_odd, NULL, eNB_thread, argseNBThread);
}
} }
else { else {
pthread_create(&proc->pthread_single, attr_single, eNB_thread_single, &eNB->proc); pthread_create(&proc->pthread_single, attr_single, eNB_thread_single, &eNB->proc);
...@@ -1856,16 +2170,17 @@ void init_eNB_proc(int inst) { ...@@ -1856,16 +2170,17 @@ void init_eNB_proc(int inst) {
char name[16]; char name[16];
if (eNB->single_thread_flag == 0) { if (eNB->single_thread_flag == 0) {
snprintf( name, sizeof(name), "RXTX0 %d", i ); sprintf(name,"RXn_TXnp4_%d",&proc->proc_rxtx[0] == proc_rxtx ? 0 : 1);
pthread_setname_np( proc_rxtx[0].pthread_rxtx, name ); pthread_setname_np( proc->pthread_even,name);
snprintf( name, sizeof(name), "RXTX1 %d", i ); sprintf(name,"RXn_TXnp4_%d",&proc->proc_rxtx[1] == proc_rxtx? 0 : 1);
pthread_setname_np( proc_rxtx[1].pthread_rxtx, name ); pthread_setname_np( proc->pthread_odd,name);
snprintf( name, sizeof(name), "FH %d", i );
pthread_setname_np( proc->pthread_FH, name ); sprintf(name,"enb_prach");
pthread_setname_np( proc->pthread_prach,name);
} }
else { else {
snprintf( name, sizeof(name), " %d", i ); snprintf( name, sizeof(name), " %d", i );
pthread_setname_np( proc->pthread_single, name ); pthread_setname_np( proc->pthread_single,name);
} }
} }
...@@ -2170,8 +2485,13 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst ...@@ -2170,8 +2485,13 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB->te = dlsch_encoding;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding; eNB->te = dlsch_encoding;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding;
eNB->proc_uespec_rx = phy_procedures_eNB_uespec_RX; eNB->proc_uespec_rx = phy_procedures_eNB_uespec_RX;
eNB->proc_tx = proc_tx_full; eNB->proc_tx = proc_tx_full;
eNB->tx_fh = tx_rf; if(single_thread_flag == 0){
eNB->rx_fh = rx_rf; eNB->tx_fh = tx_rf_new;
eNB->rx_fh = rx_rf_new;
}else{
eNB->tx_fh = tx_rf;
eNB->rx_fh = rx_rf;
}
eNB->start_rf = start_rf; eNB->start_rf = start_rf;
eNB->start_if = NULL; eNB->start_if = NULL;
eNB->fh_asynch = NULL; eNB->fh_asynch = NULL;
......
...@@ -1344,7 +1344,7 @@ void init_openair0() { ...@@ -1344,7 +1344,7 @@ void init_openair0() {
openair0_cfg[card].autocal[i] = 1; openair0_cfg[card].autocal[i] = 1;
openair0_cfg[card].tx_gain[i] = tx_gain[0][i]; openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
if (UE_flag == 0) { if (UE_flag == 0) {
openair0_cfg[card].rx_gain[i] = PHY_vars_eNB_g[0][0]->rx_total_gain_dB; openair0_cfg[card].rx_gain[i] = PHY_vars_eNB_g[0][0]->rx_total_gain_dB- rx_gain_off;
} }
else { else {
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off; openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
...@@ -1661,7 +1661,7 @@ int main( int argc, char **argv ) { ...@@ -1661,7 +1661,7 @@ int main( int argc, char **argv ) {
PHY_vars_eNB_g[0][CC_id]->X_u); PHY_vars_eNB_g[0][CC_id]->X_u);
PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0]; PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0]+ rx_gain_off;
if (frame_parms[CC_id]->frame_type==FDD) { if (frame_parms[CC_id]->frame_type==FDD) {
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0; PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0;
......
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