Commit 413df163 authored by Raymond Knopp's avatar Raymond Knopp

first working version with oaisim. This is prior to MAC interface reworking

parent 63a18b81
......@@ -41,7 +41,7 @@ int N_RB_DL_array[6] = {6,15,25,50,75,100};
void phy_config_mib_eNB(int Mod_id,
int CC_id,
int eutra_band,
int eutra_band,
int dl_Bandwidth,
PHICH_Config_t *phich_config,
int Nid_cell,
......@@ -52,9 +52,10 @@ void phy_config_mib_eNB(int Mod_id,
LTE_DL_FRAME_PARMS *fp;
PHICH_RESOURCE_t phich_resource_table[4]={oneSixth,half,one,two};
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u)\n",
Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,dl_CarrierFreq);
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,dl_CarrierFreq,phich_config->phich_Resource,phich_config->phich_Duration);
if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
......@@ -84,7 +85,9 @@ void phy_config_mib_eNB(int Mod_id,
fp->eutra_band = eutra_band;
fp->Ncp = Ncp;
fp->nb_antenna_ports_eNB = p_eNB;
fp->phich_config_common.phich_resource = phich_config->phich_Resource;
AssertFatal(phich_config->phich_Resource < 4, "Illegal phich_Resource\n");
fp->phich_config_common.phich_resource = phich_resource_table[phich_config->phich_Resource];
fp->phich_config_common.phich_duration = phich_config->phich_Duration;
fp->dl_CarrierFreq = dl_CarrierFreq;
fp->ul_CarrierFreq = ul_CarrierFreq;
......@@ -168,6 +171,8 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
LOG_D(PHY,"prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig = %d\n",fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig);
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
LOG_D(PHY,"prach_config_common.prach_ConfigInfo.prach_FreqOffset = %d\n",fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset);
init_prach_tables(839);
compute_prach_seq(&fp->prach_config_common,fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u);
......@@ -245,7 +250,6 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
init_ul_hopping(fp);
// MBSFN
if (mbsfn_SubframeConfigList != NULL) {
fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
......@@ -1563,15 +1567,15 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
if (abstraction_flag==0) {
for (eNB_id=0; eNB_id<3; eNB_id++) {
pusch_vars[UE_id]->rxdataF_ext = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->rxdataF_ext2 = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->drs_ch_estimates = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->rxdataF_comp = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->ul_ch_mag = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->ul_ch_magb = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->rxdataF_ext = (int32_t**)malloc16( 2*sizeof(int32_t*) );
pusch_vars[UE_id]->rxdataF_ext2 = (int32_t**)malloc16( 2*sizeof(int32_t*) );
pusch_vars[UE_id]->drs_ch_estimates = (int32_t**)malloc16( 2*sizeof(int32_t*) );
pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t**)malloc16( 2*sizeof(int32_t*) );
pusch_vars[UE_id]->rxdataF_comp = (int32_t**)malloc16( 2*sizeof(int32_t*) );
pusch_vars[UE_id]->ul_ch_mag = (int32_t**)malloc16( 2*sizeof(int32_t*) );
pusch_vars[UE_id]->ul_ch_magb = (int32_t**)malloc16( 2*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) {
for (i=0; i<2; i++) {
// RK 2 times because of output format of FFT!
// FIXME We should get rid of this
pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
......@@ -1594,7 +1598,6 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
eNB->pdsch_config_dedicated->p_a = dB0; //defaul value until overwritten by RRCConnectionReconfiguration
init_prach_tables(839);
return (0);
......
......@@ -206,7 +206,7 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time[0];
int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time;
uint8_t cyclic_shift = 0;
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
......
......@@ -344,10 +344,10 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3) {
k = (nu + nushift)%6;
#ifdef DEBUG_MEAS_RRC
LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
//#ifdef DEBUG_MEAS_RRC
LOG_D(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l);
#endif
//#endif
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
rxF = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(l*ue->frame_parms.ofdm_symbol_size)];
......@@ -422,18 +422,18 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
}
#ifdef DEBUG_MEAS_RRC
//#ifdef DEBUG_MEAS_RRC
// if (slot == 0) {
if (eNB_offset == 0)
LOG_I(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",ue->Mod_id,
LOG_D(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",ue->Mod_id,
ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
10*log10(ue->measurements.rssi),
ue->rx_total_gain_dB,
ue->measurements.n0_power_tot_dBm);
LOG_I(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d), rsrq: %3.1f dB\n",
LOG_D(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d), rsrq: %3.1f dB\n",
ue->Mod_id,
ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,eNB_offset,
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
......@@ -448,7 +448,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
// }
#endif
//#endif
}
}
......
......@@ -42,6 +42,7 @@
#include "assertions.h"
#include "T.h"
#include "UTIL/LOG/log.h"
//#define DEBUG_DCI_ENCODING 1
//#define DEBUG_DCI_DECODING 1
......@@ -452,10 +453,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
// printf("Mquad %d, RCC %d\n",Mquad,RCC);
if (!z) {
printf("dci.c: pdcch_deinterleaving: FATAL z is Null\n");
return;
}
AssertFatal(z!=NULL,"dci.c: pdcch_deinterleaving: FATAL z is Null\n");
// undo permutation
for (i=0; i<Mquad; i++) {
......@@ -1881,9 +1879,9 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
#ifdef DEBUG_DCI_DECODING
printf("[PDCCH] subframe %d n_pdcch_symbols from PCFICH =%d\n",subframe,n_pdcch_symbols);
LOG_I(PHY,"[PDCCH] subframe %d n_pdcch_symbols from PCFICH =%d\n",subframe,n_pdcch_symbols);
printf("demapping: subframe %d, mi %d, tdd_config %d\n",subframe,get_mi(frame_parms,subframe),frame_parms->tdd_config);
LOG_I(PHY,"demapping: subframe %d, mi %d, tdd_config %d\n",subframe,get_mi(frame_parms,subframe),frame_parms->tdd_config);
#endif
pdcch_demapping(pdcch_vars[eNB_id]->llr,
......@@ -2020,7 +2018,7 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci,
}
LOG_I(PHY," dci.c: get_num_pdcch_symbols subframe %d FATAL, illegal numCCE %d (num_dci %d)\n",subframe,numCCE,num_dci);
// LOG_I(PHY," dci.c: get_num_pdcch_symbols subframe %d FATAL, illegal numCCE %d (num_dci %d)\n",subframe,numCCE,num_dci);
//for (i=0;i<num_dci;i++) {
// printf("dci_alloc[%d].L = %d\n",i,dci_alloc[i].L);
//}
......@@ -2114,7 +2112,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
if (dci_alloc[i].L == (uint8_t)L) {
#ifdef DEBUG_DCI_ENCODING
printf("Generating common DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x)\n",i,num_common_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,1<<dci_alloc[i].L,
LOG_I(PHY,"Generating common DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x)\n",i,num_common_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,1<<dci_alloc[i].L,
*(unsigned int*)dci_alloc[i].dci_pdu);
dump_dci(frame_parms,&dci_alloc[i]);
#endif
......@@ -2792,14 +2790,13 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
// CCE is not allocated yet
if (CCEmap_cand == 0) {
#ifdef DEBUG_DCI_DECODING
if (do_common == 1)
LOG_I(PHY,"[DCI search - common] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x)\n",m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask);
LOG_D(PHY,"[DCI search - common] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x)\n",m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask);
else
LOG_I(PHY,"[DCI search - ue spec] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x)\n",m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask);
LOG_D(PHY,"[DCI search - ue spec] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x)\n",m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask);
#endif
dci_decoding(sizeof_bits,
L,
......@@ -2810,9 +2807,9 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
printf("dci_decoded_output[%d] => %x\n",i,dci_decoded_output[i]);
*/
crc = (crc16(dci_decoded_output,sizeof_bits)>>16) ^ extract_crc(dci_decoded_output,sizeof_bits);
#ifdef DEBUG_DCI_DECODING
printf("crc =>%x\n",crc);
#endif
//LOG_I(PHY,"crc =>%x\n",crc);
if (((L>1) && ((crc == si_rnti)||
(crc == p_rnti)||
......@@ -2828,9 +2825,9 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
dci_alloc[*dci_cnt].dci_pdu[2] = dci_decoded_output[1];
dci_alloc[*dci_cnt].dci_pdu[1] = dci_decoded_output[2];
dci_alloc[*dci_cnt].dci_pdu[0] = dci_decoded_output[3];
#ifdef DEBUG_DCI_DECODING
printf("DCI => %x,%x,%x,%x\n",dci_decoded_output[0],dci_decoded_output[1],dci_decoded_output[2],dci_decoded_output[3]);
#endif
//LOG_I(PHY,"DCI => %x,%x,%x,%x\n",dci_decoded_output[0],dci_decoded_output[1],dci_decoded_output[2],dci_decoded_output[3]);
} else {
dci_alloc[*dci_cnt].dci_pdu[7] = dci_decoded_output[0];
dci_alloc[*dci_cnt].dci_pdu[6] = dci_decoded_output[1];
......@@ -2840,11 +2837,9 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
dci_alloc[*dci_cnt].dci_pdu[2] = dci_decoded_output[5];
dci_alloc[*dci_cnt].dci_pdu[1] = dci_decoded_output[6];
dci_alloc[*dci_cnt].dci_pdu[0] = dci_decoded_output[7];
#ifdef DEBUG_DCI_DECODING
printf("DCI => %x,%x,%x,%x,%x,%x,%x,%x\n",
dci_decoded_output[0],dci_decoded_output[1],dci_decoded_output[2],dci_decoded_output[3],
dci_decoded_output[4],dci_decoded_output[5],dci_decoded_output[6],dci_decoded_output[7]);
#endif
//LOG_I(PHY,"DCI => %x,%x,%x,%x,%x,%x,%x,%x\n",
// dci_decoded_output[0],dci_decoded_output[1],dci_decoded_output[2],dci_decoded_output[3],
// dci_decoded_output[4],dci_decoded_output[5],dci_decoded_output[6],dci_decoded_output[7]);
}
if (crc==si_rnti) {
......
......@@ -3039,14 +3039,14 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
break;
case 50:
LOG_D(PHY,"DCI format1A(FDD, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]);
LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type);
LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]);
LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs);
LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid);
LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi);
LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rv);
LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC);
LOG_I(PHY,"DCI format1A(FDD, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]);
LOG_I(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type);
LOG_I(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]);
LOG_I(PHY,"MCS %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs);
LOG_I(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid);
LOG_I(PHY,"NDI %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi);
LOG_I(PHY,"RV %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rv);
LOG_I(PHY,"TPC %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC);
break;
case 100:
......@@ -3800,7 +3800,6 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
return(0);
}
int generate_ue_dlsch_params_from_dci(int frame,
uint8_t subframe,
void *dci_pdu,
......
......@@ -39,7 +39,7 @@
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type, int k) {
void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
int32_t **txdataF = ru->common.txdataF_BF;
......@@ -132,7 +132,8 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type, int k)
if (packet_type == IF4p5_PULFFT) {
for (symbol_id=fp->symbols_per_tti-nsym; symbol_id<fp->symbols_per_tti; symbol_id++) {
LOG_D(PHY,"IF4p5_PULFFT: frame %d, subframe %d, symbol %d\n",frame,subframe,symbol_id);
LOG_D(PHY,"IF4p5_PULFFT: frame %d, subframe %d, symbol %d: %d dB\n",frame,subframe,symbol_id,
dB_fixed(signal_energy((int32_t*)&rxdataF[0][blockoffsetF],db_halflength)));
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | ((uint16_t)(lin2alaw[*(i+1)]<<8));
......@@ -172,7 +173,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type, int k)
} else if (packet_type == IF4p5_PRACH) {
// FIX: hard coded prach samples length
LOG_D(PHY,"IF4p5_PRACH: frame %d, subframe %d\n",frame,subframe);
db_fulllength = PRACH_HARD_CODED_NUM_SAMPLES;
db_fulllength = PRACH_NUM_SAMPLES;
if (eth->flags == ETH_RAW_IF4p5_MODE) {
packet_header = (IF4p5_header_t *)(tx_buffer_prach + MAC_HEADER_SIZE_BYTES);
......@@ -185,11 +186,11 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type, int k)
if (eth->flags == ETH_RAW_IF4p5_MODE) {
memcpy((int16_t*)(tx_buffer_prach + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t),
(&prach_rxsigF[0][k]),
(&prach_rxsigF[0][0]),
PRACH_BLOCK_SIZE_BYTES);
} else {
memcpy((int16_t*)(tx_buffer_prach + sizeof_IF4p5_header_t),
(&prach_rxsigF[0][k]),
(&prach_rxsigF[0][0]),
PRACH_BLOCK_SIZE_BYTES);
}
......@@ -209,6 +210,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type, int k)
return;
}
extern void wakeup_prach(PHY_VARS_eNB *eNB,RU_t *ru);
void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint32_t *symbol_number) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
......@@ -221,6 +223,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
uint16_t db_fulllength, db_halflength;
int slotoffsetF=0, blockoffsetF=0;
eth_state_t *eth = (eth_state_t*) (ru->ifdevice.priv);
int idx;
if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 );
......@@ -297,10 +300,9 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
}
} else if (*packet_type == IF4p5_PRACH) {
LOG_D(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d\n",ru->idx,*frame,*subframe);
// FIX: hard coded prach samples length
db_fulllength = PRACH_HARD_CODED_NUM_SAMPLES;
db_fulllength = PRACH_NUM_SAMPLES;
if (eth->flags == ETH_RAW_IF4p5_MODE) {
memcpy((&prach_rxsigF[0][0]),
......@@ -311,6 +313,11 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
(int16_t*) (rx_buffer+sizeof_IF4p5_header_t),
PRACH_BLOCK_SIZE_BYTES);
}
LOG_I(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d => %d dB\n",ru->idx,*frame,*subframe,
dB_fixed(signal_energy(&prach_rxsigF[0][0],839)));
for (idx=0;idx<ru->num_eNB;idx++) ru->wakeup_prach_eNB(ru->eNB_list[idx],ru);
} else if (*packet_type == IF4p5_PULTICK) {
} else {
......
......@@ -62,7 +62,7 @@ void gen_IF4p5_ul_header(IF4p5_header_t*, uint16_t, int, int);
void gen_IF4p5_prach_header(IF4p5_header_t*, int, int);
void send_IF4p5(RU_t*, int, int, uint16_t, int);
void send_IF4p5(RU_t*, int, int, uint16_t);
void recv_IF4p5(RU_t*, int*, int*, uint16_t*, uint32_t*);
......
......@@ -31,9 +31,6 @@
*/
#include "PHY/defs.h"
//uint16_t pcfich_reg[4];
//uint8_t pcfich_first_reg_idx = 0;
//#define DEBUG_PCFICH
void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
......@@ -69,9 +66,9 @@ void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
first_reg = pcfich_reg[3];
}
//#ifdef DEBUG_PCFICH
#ifdef DEBUG_PCFICH
printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]);
//#endif
#endif
}
void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -95,7 +92,6 @@ void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
}
bt[i] = (b[i]&1) ^ ((s>>(i&0x1f))&1);
// printf("scrambling %d : b %d => bt %d, c %d\n",i,b[i],bt[i],((s>>(i&0x1f))&1));
}
}
......@@ -122,7 +118,6 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
if (((s>>(i&0x1f))&1) == 1)
d[i]=-d[i];
// printf("scrambling %d : b %d => bt %d, c %d\n",i,b[i],bt[i],((s>>(i&0x1f))&1));
}
}
......@@ -148,7 +143,7 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
int nushiftmod3 = frame_parms->nushift%3;
#ifdef DEBUG_PCFICH
msg("[PHY] Generating PCFICH for %d PDCCH symbols, AMP %d\n",num_pdcch_symbols,amp);
printf("[PHY] Generating PCFICH for %d PDCCH symbols, AMP %d\n",num_pdcch_symbols,amp);
#endif
// scrambling
......@@ -247,12 +242,12 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
pcfich_d_ptr[0] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[0]; // RE component
pcfich_d_ptr[1] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[1]; // IM component
/*
printf("rx_pcfich: quad %d, i %d, offset %d => m%d (%d,%d) => pcfich_d_ptr[0] %d \n",pcfich_quad,i,reg_offset+i,m,
#ifdef DEBUG_PCFICH
printf("rx_pcfich: quad %d, i %d, offset %d => (%d,%d) => pcfich_d_ptr[0] %d \n",pcfich_quad,i,reg_offset+i,
((int16_t*)&rxdataF_comp[0][reg_offset+i])[0],
((int16_t*)&rxdataF_comp[0][reg_offset+i])[1],
pcfich_d_ptr[0]);
*/
#endif
pcfich_d_ptr+=2;
}
......@@ -295,12 +290,12 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
metric = 0;
for (j=0; j<32; j++) {
//printf("pcfich_b[%d][%d] %d => pcfich_d[%d] %d\n",i,j,pcfich_b[i][j],j,pcfich_d[j]);
// printf("pcfich_b[%d][%d] %d => pcfich_d[%d] %d\n",i,j,pcfich_b[i][j],j,pcfich_d[j]);
metric += (int32_t)(((pcfich_b[i][j]==0) ? (pcfich_d[j]) : (-pcfich_d[j])));
}
#ifdef DEBUG_PCFICH
msg("metric %d : %d\n",i,metric);
printf("metric %d : %d\n",i,metric);
#endif
if (metric > old_metric) {
......@@ -310,7 +305,7 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
}
#ifdef DEBUG_PCFICH
msg("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols);
printf("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols);
#endif
return(num_pdcch_symbols);
}
......@@ -1077,7 +1077,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
}
#ifdef PRACH_DEBUG
#if 0
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
......@@ -1109,9 +1109,16 @@ void rx_prach(PHY_VARS_eNB *eNB,
int16_t *prachF=NULL;
int16_t **rxsigF=NULL;
int16_t **prach_ifft=NULL;
int nb_rx;
if (ru) fp = &ru->frame_parms;
else if (eNB) fp = &eNB->frame_parms;
if (ru) {
fp = &ru->frame_parms;
nb_rx = ru->nb_rx;
}
else if (eNB) {
fp = &eNB->frame_parms;
nb_rx = fp->nb_antennas_rx;
}
else AssertFatal(1==0,"rx_prach called without valid RU or eNB descriptor\n");
frame_type = fp->frame_type;
......@@ -1119,7 +1126,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
prach_ConfigIndex = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
Ncs_config = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
restricted_set = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag;
int16_t *prach[fp->nb_antennas_rx];
int16_t *prach[nb_rx];
if (eNB) {
subframe = eNB->proc.subframe_prach;
......@@ -1130,6 +1137,8 @@ void rx_prach(PHY_VARS_eNB *eNB,
else {
subframe = ru->proc.subframe_prach;
rxsigF = ru->prach_rxsigF;
LOG_D(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex);
}
int16_t *prach2;
......@@ -1157,14 +1166,19 @@ void rx_prach(PHY_VARS_eNB *eNB,
int32_t lev;
int16_t levdB;
int fft_size,log2_ifft_size;
uint8_t nb_ant_rx = 1; //eNB->frame_parms.nb_antennas_rx;
#ifdef PRACH_DEBUG
int en;
int en,en0=0;
#endif
for (aa=0; aa<nb_ant_rx; aa++) {
if (ru) prach[aa] = (int16_t*)&ru->common.rxdata[aa][subframe*fp->samples_per_tti-ru->N_TA_offset];
for (aa=0; aa<nb_rx; aa++) {
if ((eNB==NULL) &&
(ru!=NULL)) {
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
#ifdef PRACH_DEBUG
LOG_D(PHY,"RU %d, subframe %d, : prach %p (energy %d)\n",ru->idx,subframe,prach[aa],dB_fixed(en0=signal_energy(prach[aa],fp->samples_per_tti)));
#endif
}
}
// First compute physical root sequence
......@@ -1250,10 +1264,11 @@ void rx_prach(PHY_VARS_eNB *eNB,
}
if (((eNB!=NULL) && (ru!=NULL) && (ru->function != NGFI_RRU_IF4p5))||
if (((eNB!=NULL) && (ru!=NULL) && (ru->function != NGFI_RAU_IF4p5))||
((eNB==NULL) && (ru!=NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources
// Do forward transform
for (aa=0; aa<nb_ant_rx; aa++) {
LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d\n",fp->N_RB_UL);
for (aa=0; aa<nb_rx; aa++) {
prach2 = prach[aa] + (Ncp<<1);
// do DFT
......@@ -1345,49 +1360,53 @@ void rx_prach(PHY_VARS_eNB *eNB,
break;
}
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
if (k<0) {
k+=(fp->ofdm_symbol_size);
}
k*=12;
k+=13;
k*=2;
int dftsize_x2 = fp->ofdm_symbol_size*24;
LOG_D(PHY,"Shifting prach_rxF from %d to 0\n",k);
if ((k+(839*2)) > dftsize_x2) { // PRACH signal is split around DC
memmove((void*)&rxsigF[aa][dftsize_x2-k],(void*)&rxsigF[aa][0],(k+(839*2)-dftsize_x2)*2);
memmove((void*)&rxsigF[aa][0],(void*)(&rxsigF[aa][k]),(dftsize_x2-k)*2);
}
else // PRACH signal is not split around DC
memmove((void*)&rxsigF[aa][0],(void*)(&rxsigF[aa][k]),839*4);
}
}
if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) {
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
if (k<0) {
k+=(fp->ofdm_symbol_size);
}
k*=12;
k+=13;
k*=2;
/// **** send_IF4 of rxsigF to RAU **** ///
send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH, k);
send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH);
#if 0
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
if (en>60)
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
if (dB_fixed(en0)>30) {
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
// if (en>60)
printf("PRACH (if4p5), k %d, n_ra_prb %d: Frame %d, Subframe %d => %d dB\n",k,n_ra_prb,ru->proc.frame_rx,ru->proc.subframe_rx,en);
write_output("rxsigF.m","prach_rxF",rxsigF[0],12288,1,1);
exit(-1);
}
#endif
return;
} else if (eNB!=NULL) {
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
if (k<0) k+=fp->ofdm_symbol_size;
k*=12;
k+=13;
k*=2;
// Adjust received rxsigF offset
memmove((&rxsigF[0][k]),
(&rxsigF[0][0]),
839*2*sizeof(int16_t));
#if 0
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
/*if (en>60)
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);*/
en = dB_fixed(signal_energy(&rxsigF[0][0],840));
/*if (en>60)*/
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
#endif
}
......@@ -1493,18 +1512,6 @@ void rx_prach(PHY_VARS_eNB *eNB,
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
if (k<0)
k+=fp->ofdm_symbol_size;
k*=12;
k+=13; // phi + K/2
k*=2;
memset( prachF, 0, sizeof(int16_t)*2*1024 );
#ifdef PRACH_DEBUG
if (prach[0]!= NULL) write_output("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
......@@ -1513,30 +1520,14 @@ void rx_prach(PHY_VARS_eNB *eNB,
// write_output("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
// write_output("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
for (aa=0;aa<nb_ant_rx; aa++) {
for (aa=0;aa<nb_rx; aa++) {
// Do componentwise product with Xu*
k=0;
for (offset=0; offset<(N_ZC<<1); offset+=2) {
prachF[offset] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][k] + (int32_t)Xu[offset+1]*rxsigF[aa][k+1])>>15);
prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][k+1] - (int32_t)Xu[offset+1]*rxsigF[aa][k])>>15);
/*
if (offset<16)
printf("Xu[%d] %d %d, rxsigF[%d][%d] %d %d\n",offset,Xu[offset],Xu[offset+1],aa,k,rxsigF[aa][k],rxsigF[aa][k+1]);
*/
/*
mmtmpX0 = _mm_madd_epi16(*(__m128i*)&Xu[offset],*(__m128i*)&rxsigF[aa][k<<1]);
mmtmpX1 = _mm_shufflelo_epi16(*(__m128i*)&Xu[offset],_MM_SHUFFLE(2,3,0,1));
mmtmpX1 = _mm_shufflehi_epi16(mmtmpX1,_MM_SHUFFLE(2,3,0,1));
mmtmpX1 = _mm_sign_epi16(mmtmpX1,*(__m128i*)&conjugate[0]);
mmtmpX1 = _mm_madd_epi16(mmtmpX1,*(__m128i*)&rxsigF[aa][k<<1]);
mmtmpX0 = _mm_srai_epi32(mmtmpX0,15);
mmtmpX1 = _mm_srai_epi32(mmtmpX1,15);
mmtmpX2 = _mm_unpacklo_epi32(mmtmpX0,mmtmpX1);
mmtmpX3 = _mm_unpackhi_epi32(mmtmpX0,mmtmpX1);
*(__m128i*)&prachF[offset] = _mm_packs_epi32(mmtmpX2,mmtmpX3);
*/
k+=2;
if (k==(12*2*fp->ofdm_symbol_size))
k=0;
}
......@@ -1566,8 +1557,9 @@ void rx_prach(PHY_VARS_eNB *eNB,
k+=13;
k*=2;
printf("Dumping prach, k = %d (n_ra_prb %d)\n",k,n_ra_prb);
write_output("rxsigF.m","prach_rxF",&rxsigF[0][k],840,1,1);
write_output("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
write_output("Xu.m","xu",Xu,N_ZC,1,1);
write_output("prach_ifft0.m","prach_t0",prach_ifft[0],1024,1,1);
exit(-1);
}
......@@ -1581,7 +1573,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
for (i=0; i<NCS2; i++) {
lev = 0;
for (aa=0; aa<nb_ant_rx; aa++) {
for (aa=0; aa<nb_rx; aa++) {
lev += (int32_t)prach_ifft[aa][(preamble_shift2+i)<<1]*prach_ifft[aa][(preamble_shift2+i)<<1] + (int32_t)prach_ifft[aa][1+((preamble_shift2+i)<<1)]*prach_ifft[aa][1+((preamble_shift2+i)<<1)];
}
......
......@@ -550,7 +550,7 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
return len;
} // is_clusterhead
/*
int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
{
......@@ -593,14 +593,12 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
}
len += sprintf(&buffer[len],"\n");
len += sprintf(&buffer[len],"\nPERFORMANCE PARAMETERS\n");
/*
len += sprintf(&buffer[len],"[eNB PROC] Total DLSCH Bitrate for the System %dkbps\n",((eNB->UE_stats[0].dlsch_bitrate + eNB->UE_stats[1].dlsch_bitrate)/1000));
len += sprintf(&buffer[len],"[eNB PROC] Total Bits successfully transitted %dKbits in %dframe(s)\n",((eNB->UE_stats[0].total_transmitted_bits + eNB->UE_stats[1].total_transmitted_bits)/1000),eNB->frame+1);
len += sprintf(&buffer[len],"[eNB PROC] Average System Throughput %dKbps\n",(eNB->UE_stats[0].total_transmitted_bits + eNB->UE_stats[1].total_transmitted_bits)/((eNB->frame+1)*10));
*/
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
if ((eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&&
if (eNB &&
(eNB->dlsch!=NULL) &&
(eNB->dlsch[(uint8_t)UE_id]!=NULL) &&
(eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&&
(eNB->UE_stats[UE_id].mode == PUSCH)) {
eNB->total_dlsch_bitrate = eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate;
......@@ -643,15 +641,6 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
eNB->measurements.wideband_cqi_dB[UE_id][0],
eNB->measurements.wideband_cqi_dB[UE_id][1]);
/* len += sprintf(&buffer[len],"[eNB PROC] Subband CQI: ");
for (i=0; i<eNB->frame_parms.N_RB_DL; i++)
len += sprintf(&buffer[len],"%2d ",
eNB->measurements[eNB_id].subband_cqi_tot_dB[UE_id][i]);
len += sprintf(&buffer[len],"\n");
*/
len += sprintf(&buffer[len],"DL TM %d, DL_cqi %d, DL_pmi_single %jx ",
eNB->transmission_mode[UE_id],
eNB->UE_stats[UE_id].DL_cqi[0],
......@@ -802,27 +791,6 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
len += sprintf(&buffer[len],"DLSCH total bits ack'ed: %dkbit ",(eNB->UE_stats[UE_id].total_TBS)/1000);
len += sprintf(&buffer[len],"DLSCH Average throughput (100 frames): %dkbps\n",(eNB->UE_stats[UE_id].dlsch_bitrate/1000));
// len += sprintf(&buffer[len],"[eNB PROC] Transmission Mode %d\n",eNB->transmission_mode[UE_id]);
/*
if(eNB->transmission_mode[UE_id] == 5) {
if(eNB->mu_mimo_mode[UE_id].dl_pow_off == 0)
len += sprintf(&buffer[len],"[eNB PROC] ****UE %d is in MU-MIMO mode****\n",UE_id);
else if(eNB->mu_mimo_mode[UE_id].dl_pow_off == 1)
len += sprintf(&buffer[len],"[eNB PROC] ****UE %d is in SU-MIMO mode****\n",UE_id);
else
len += sprintf(&buffer[len],"[eNB PROC] ****UE %d is not scheduled****\n",UE_id);
}
*/
/*
len += sprintf(&buffer[len],"[eNB PROC] RB Allocation on Sub-bands: ");
// for (j=0;j< mac_xface->frame_parms->N_RBGS;j++)
for (j=0; j<7; j++)
len += sprintf(&buffer[len],"%d ",
eNB->mu_mimo_mode[UE_id].rballoc_sub[j]);
len += sprintf(&buffer[len],"\n");
len += sprintf(&buffer[len],"[eNB PROC] Total Number of Allocated PRBs = %d\n",eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs);
*/
}
}
......@@ -833,3 +801,4 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
return len;
}
*/
......@@ -1810,11 +1810,11 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
//#ifndef OAI_EMU
write_output("/tmp/ulsch_d.m","ulsch_dseq",&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
write_output("/tmp/rxsig0.m","rxs0", &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
if (eNB->common_vars.rxdata) write_output("/tmp/rxsig0.m","rxs0", &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
if (eNB->frame_parms.nb_antennas_rx>1)
write_output("/tmp/rxsig1.m","rxs1", &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
if (eNB->common_vars.rxdata) write_output("/tmp/rxsig1.m","rxs1", &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
write_output("/tmp/rxsigF0.m","rxsF0", &eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
......@@ -1827,11 +1827,12 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
if (eNB->frame_parms.nb_antennas_rx>1)
write_output("/tmp/rxsigF1_ext.m","rxsF1_ext", &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
write_output("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
/*
if (eNB->srs_vars[UE_id].srs_ch_estimates) write_output("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
if (eNB->frame_parms.nb_antennas_rx>1)
write_output("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
if (eNB->srs_vars[UE_id].srs_ch_estimates) write_output("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
*/
write_output("/tmp/drs_est0.m","drsest0",eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
......
......@@ -71,8 +71,7 @@ int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
int sample_offset,
int no_prefix);
int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
RU_COMMON *common,
int slot_fep_ul(RU_t *ru,
unsigned char l,
unsigned char Ns,
int no_prefix);
......
......@@ -24,8 +24,7 @@
#include "defs.h"
//#define DEBUG_FEP
int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
RU_COMMON *common,
int slot_fep_ul(RU_t *ru,
unsigned char l,
unsigned char Ns,
int no_prefix)
......@@ -34,19 +33,23 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
char fname[40], vname[40];
#endif
unsigned char aa;
unsigned char symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
RU_COMMON *common=&ru->common;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
RU_proc_t *proc = &ru->proc;
unsigned char symbol = l+((7-fp->Ncp)*(Ns&1)); ///symbol within sub-frame
unsigned int nb_prefix_samples = (no_prefix ? 0 : fp->nb_prefix_samples);
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : fp->nb_prefix_samples0);
// unsigned int subframe_offset;
unsigned int slot_offset;
void (*dft)(int16_t *,int16_t *, int);
int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
unsigned int frame_length_samples = fp->samples_per_tti * 10;
unsigned int rx_offset;
switch (frame_parms->ofdm_symbol_size) {
switch (fp->ofdm_symbol_size) {
case 128:
dft = dft128;
break;
......@@ -78,14 +81,14 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
if (no_prefix) {
// subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns&1);
slot_offset = fp->ofdm_symbol_size * (fp->symbols_per_tti>>1) * (Ns&1);
} else {
// subframe_offset = frame_parms->samples_per_tti * (Ns>>1);
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns&1);
slot_offset = (fp->samples_per_tti>>1) * (Ns&1);
}
if (l<0 || l>=7-frame_parms->Ncp) {
LOG_E(PHY,"slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
if (l<0 || l>=7-fp->Ncp) {
LOG_E(PHY,"slot_fep: l must be between 0 and %d\n",7-fp->Ncp);
return(-1);
}
......@@ -98,39 +101,33 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
LOG_D(PHY,"slot_fep: Ns %d offset %d, symbol %d, nb_prefix_samples %d\n",Ns,slot_offset,symbol, nb_prefix_samples);
#endif
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
for (aa=0; aa<ru->nb_rx; aa++) {
rx_offset = slot_offset +nb_prefix_samples0;
if (l==0) {
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: symbol 0 %d dB\n",
dB_fixed(signal_energy(&common->rxdata_7_5kHz[aa][rx_offset],fp->ofdm_symbol_size)));
#endif
dft( (int16_t *)&common->rxdata_7_5kHz[aa][rx_offset],
(int16_t *)&common->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
(int16_t *)&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],
1
);
} else {
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;
/* should never happen for eNB
if(rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
{
memcpy((void *)&eNB_common_vars->rxdata_7_5kHz[aa][frame_length_samples],
(void *)&eNB_common_vars->rxdata_7_5kHz[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
}
*/
rx_offset += (fp->ofdm_symbol_size+nb_prefix_samples)*l;
// check for 256-bit alignment of input buffer and do DFT directly, else do via intermediate buffer
if( (rx_offset & 15) != 0){
memcpy((void *)&tmp_dft_in,
(void *)&common->rxdata_7_5kHz[aa][(rx_offset % frame_length_samples)],
frame_parms->ofdm_symbol_size*sizeof(int));
fp->ofdm_symbol_size*sizeof(int));
dft( (short *) tmp_dft_in,
(short*) &common->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
(short*) &common->rxdataF[aa][fp->ofdm_symbol_size*symbol],
1
);
}
else{
dft( (short *)&common->rxdata_7_5kHz[aa][rx_offset],
(short*)&common->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
(short*)&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],
1
);
}
......
......@@ -197,7 +197,7 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
len = frame_parms->samples_per_tti/2;
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
for (aa=0; aa<ru->nb_rx; aa++) {
#if defined(__x86_64__) || defined(__i386__)
rxptr128 = (__m128i *)&rxdata[aa][slot_offset];
......
......@@ -288,6 +288,8 @@ typedef struct RU_proc_t_s {
int frame_rx;
/// frame to act upon for transmission
int frame_tx;
/// unwrapped frame count
int frame_tx_unwrap;
/// frame to act upon for reception of prach
int frame_prach;
/// frame offset for slave RUs (to correct for frame asynchronism at startup)
......@@ -452,6 +454,14 @@ typedef struct eNB_proc_t_s {
pthread_mutex_t mutex_prach;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// mutex for RU access to eNB processing (PDSCH/PUSCH)
pthread_mutex_t mutex_RU;
/// mutex for RU access to eNB processing (PRACH)
pthread_mutex_t mutex_RU_PRACH;
/// mask for RUs serving eNB (PDSCH/PUSCH)
int RU_mask;
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach;
/// parameters for turbo-decoding worker thread
td_params tdp;
/// parameters for turbo-encoding worker thread
......@@ -612,6 +622,8 @@ typedef struct RU_t_s{
void (*feptx_prec)(struct RU_t_s *ru);
/// function pointer to wakeup routine in lte-enb.
int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB,int frame_rx,int subframe_rx);
/// function pointer to wakeup routine in lte-enb.
int (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru);
/// function pointer to eNB entry routine
void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string);
/// Timing statistics
......
......@@ -495,6 +495,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe);
// generate Cell-Specific Reference Signals for both slots
if (eNB->abstraction_flag==0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
......@@ -695,12 +697,12 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
P_RNTI,
eNB->UE_stats[0].DL_pmi_single,
0);
LOG_I(PHY,"frame %d, subframe %d : SI with mcs %d\n",frame,subframe,eNB->dlsch_SI->harq_processes[0]->mcs);
eNB->dlsch_SI->nCCE[subframe] = dci_alloc->firstCCE;
LOG_T(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for common DCI (SI) => %"PRIu8"\n",eNB->Mod_id,frame,subframe,
eNB->dlsch_SI->nCCE[subframe]);
LOG_I(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for common DCI (SI) => %"PRIu8", aggregation %d\n",eNB->Mod_id,frame,subframe,
eNB->dlsch_SI->nCCE[subframe],1<<dci_alloc->L);
#if defined(SMBV)
......@@ -824,7 +826,7 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
int frame = proc->frame_tx;
int subframe = proc->subframe_tx;
LOG_D(PHY,
LOG_I(PHY,
"[eNB %"PRIu8"][PUSCH %"PRIu8"] Frame %d subframe %d UL Frame %"PRIu32", UL Subframe %"PRIu8", Generated ULSCH (format0) DCI (rnti %"PRIx16", dci %"PRIx8"), aggregation %d\n",
eNB->Mod_id,
subframe2harq_pid(fp,
......@@ -849,7 +851,6 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
P_RNTI,
CBA_RNTI,
0); // do_srs
LOG_T(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resources for UE spec DCI (PUSCH %"PRIx16") => %d\n",
eNB->Mod_id,frame,subframe,dci_alloc->rnti,
dci_alloc->firstCCE);
......@@ -1391,7 +1392,10 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
fp,
eNB->common_vars.txdataF,
subframe);
if (DCI_pdu->Num_ue_spec_dci+DCI_pdu->Num_common_dci > 0) {
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: num_pdcch_symbols %d\n",eNB->Mod_id,frame, subframe,
num_pdcch_symbols);
}
}
#ifdef PHY_ABSTRACTION // FIXME this ifdef seems suspicious
......@@ -1965,7 +1969,7 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
}
if (eNB->abstraction_flag == 0) {
rx_prach(eNB,
NULL,
eNB->RU_list[0],
preamble_energy_list,
preamble_delay_list,
frame,
......@@ -1999,12 +2003,13 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
}
}
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[RAPROC] Most likely preamble %d, energy %d dB delay %d\n",
preamble_max,
//#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d\n",
frame,subframe,
preamble_max,
preamble_energy_list[preamble_max],
preamble_delay_list[preamble_max]);
#endif
//#endif
if (preamble_energy_list[preamble_max] > 580) {
......@@ -2867,14 +2872,14 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
if (eNB->ulsch[i]->Msg3_flag == 1) {
LOG_D(PHY,"[eNB %d/%d][RAPROC] frame %d, subframe %d, UE %d: Error receiving ULSCH (Msg3), round %d/%d\n",
LOG_I(PHY,"[eNB %d/%d][RAPROC] frame %d, subframe %d, UE %d: Error receiving ULSCH (Msg3), round %d/%d\n",
eNB->Mod_id,
eNB->CC_id,
frame,subframe, i,
eNB->ulsch[i]->harq_processes[harq_pid]->round-1,
fp->maxHARQ_Msg3Tx-1);
/*dump_ulsch(eNB,proc,i);
exit(-1);*/
dump_ulsch(eNB,proc,i);
exit(-1);
LOG_D(PHY,"[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,
......
......@@ -2562,7 +2562,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
proc->frame_tx = proc->frame_rx;
ue->proc.proc_rxtx[1].frame_rx = proc->frame_rx;
ue->proc.proc_rxtx[1].frame_tx = proc->frame_tx;
LOG_I(PHY,"[UE %d] frame %d, subframe %d: Adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, phase %d, rx_offset %d) => new frame %d\n",
LOG_I(PHY,"[UE %d] TXPATH frame %d, subframe %d: Adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, phase %d, rx_offset %d) => new frame %d\n",
ue->Mod_id,
frame_rx,
subframe_rx,
......@@ -2575,7 +2575,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
} else if (((frame_tx & 0x03FF) != (proc->frame_rx & 0x03FF))) {
//(pbch_tx_ant != ue->frame_parms.nb_antennas_tx)) {
LOG_D(PHY,"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%%1024=%d, phase %d).\n",
LOG_I(PHY,"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%%1024=%d, phase %d).\n",
ue->Mod_id,
proc->frame_rx,
subframe_rx,
......@@ -2834,9 +2834,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
else if ((dci_alloc_rx[i].rnti == SI_RNTI) &&
((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) {
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i);
#endif
if (generate_ue_dlsch_params_from_dci(frame_rx,
......@@ -2852,7 +2850,9 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
P_RNTI,
ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id],
0)==0) {
#ifdef DEBUG_PHY_PROC
LOG_I(PHY,"[UE %d] frame %d subframe %d: Found rnti %x, format 1%s, dci_cnt %d, mcs %d\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i,ue->dlsch_SI[eNB_id]->harq_processes[0]->mcs);
#endif
ue->dlsch_SI_received[eNB_id]++;
......@@ -3570,6 +3570,16 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n",
(r_type == multicast_relay) ? "RN/UE" : "UE",
ue->Mod_id,frame_rx, subframe_rx);
LOG_D(PHY,"phy_procedures_UR_RX: Frame %d, subframe %d : energy %d\n",
frame_rx,subframe_rx,
dB_fixed(signal_energy(&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti],
ue->frame_parms.samples_per_tti)));
/*
if ((subframe_rx == 5) && ((frame_rx &1) == 0)) {
write_output("rxsig5.m","rxs5",&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti],ue->frame_parms.samples_per_tti,1,1);
exit(-1);
}*/
#endif
if (ue->frame_parms.Ncp == 0) { // normal prefix
......
......@@ -150,6 +150,7 @@ void feptx_ofdm(RU_t *ru) {
}
}
else {
LOG_D(PHY,"feptx_ofdm: Writing to position %d\n",slot_offset);
tx_offset = (int)slot_offset;
txdata = (int16_t*)&ru->common.txdata[aa][tx_offset];
......@@ -184,8 +185,8 @@ void feptx_ofdm(RU_t *ru) {
ru->common.txdata[aa][tx_offset] = 0x00000000;
}
}
LOG_D(PHY,"feptx_ofdm: frame %d, subframe %d: txp (time) %d dB, txp (freq) %d dB\n",
ru->proc.frame_tx,subframe,dB_fixed(signal_energy(txdata,fp->samples_per_tti)),
LOG_D(PHY,"feptx_ofdm (TXPATH): frame %d, subframe %d: txp (time %p) %d dB, txp (freq) %d dB\n",
ru->proc.frame_tx,subframe,txdata,dB_fixed(signal_energy(txdata,fp->samples_per_tti)),
dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF)));
}
}
......@@ -248,10 +249,9 @@ void fep0(RU_t *ru,int slot) {
remove_7_5_kHz(ru,(slot&1)+(proc->subframe_rx<<1));
for (l=0; l<fp->symbols_per_tti/2; l++) {
slot_fep_ul(fp,
&ru->common,
slot_fep_ul(ru,
l,
(slot&1)+(proc->subframe_rx<<1),
(slot&1),
0
);
}
......@@ -353,16 +353,14 @@ void fep_full(RU_t *ru) {
remove_7_5_kHz(ru,proc->subframe_rx<<1);
remove_7_5_kHz(ru,1+(proc->subframe_rx<<1));
for (l=0; l<fp->symbols_per_tti/2; l++) {
slot_fep_ul(fp,
&ru->common,
slot_fep_ul(ru,
l,
proc->subframe_rx<<1,
0,
0
);
slot_fep_ul(fp,
&ru->common,
slot_fep_ul(ru,
l,
1+(proc->subframe_rx<<1),
1,
0
);
}
......
......@@ -84,24 +84,33 @@ double dac_fixed_gain(double *s_re[2],
uint32_t length_meas,
uint8_t B,
double txpwr_dBm,
uint8_t do_amp_compute,
double *amp1,
int NB_RE)
{
int i;
int aa;
double amp,amp1;
double amp,amp1_local,*amp1p;
amp = //sqrt(NB_RE)*pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
amp1 = 0;
for (aa=0; aa<nb_tx_antennas; aa++) {
amp1 += sqrt((double)signal_energy((int32_t*)&input[aa][input_offset_meas],length_meas)/NB_RE);
if (amp1==NULL) amp1p = &amp1_local;
else amp1p = amp1;
if (do_amp_compute==1) {
*amp1p = 0;
for (aa=0; aa<nb_tx_antennas; aa++) {
*amp1p += (double)signal_energy((int32_t*)&input[aa][input_offset_meas],length_meas)/NB_RE;
}
*amp1p/=nb_tx_antennas;
*amp1p=sqrt(*amp1p);
}
amp1/=nb_tx_antennas;
// printf("DAC: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
// printf("DAC: amp %f, amp1 %f dB (%d,%d), tx_power %f (%f),length %d,pos %d\n",20*log10(amp),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm,length, 10*log10((double)signal_energy((int32_t*)&input[0][input_offset_meas],length_meas)/NB_RE),input_offset_meas);
/*
if (nb_tx_antennas==2)
......@@ -117,12 +126,12 @@ double dac_fixed_gain(double *s_re[2],
for (i=0; i<length; i++) {
for (aa=0; aa<nb_tx_antennas; aa++) {
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/amp1; ///(1<<(B-1));
s_im[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)+1])/amp1; ///(1<<(B-1));
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p);
s_im[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)+1])/(*amp1p);
}
}
// printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length,0));
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length_meas,0)/NB_RE);
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE);
}
......@@ -95,4 +95,6 @@ double dac_fixed_gain(double *s_re[2],
unsigned int length_meas,
unsigned char B,
double gain,
uint8_t do_amp_compute,
double *amp1,
int NB_RE);
......@@ -1274,27 +1274,31 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
RC.config_file_name, i, pusch_nDMRS1);
if (strcmp(phich_duration,"NORMAL")==0) {
RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = normal;
RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_normal;
} else if (strcmp(phich_duration,"EXTENDED")==0) {
RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = extended;
RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_extended;
} else
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n",
RC.config_file_name, i, phich_duration);
if (strcmp(phich_resource,"ONESIXTH")==0) {
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = oneSixth;
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_oneSixth ;
} else if (strcmp(phich_resource,"HALF")==0) {
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = half;
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_half;
} else if (strcmp(phich_resource,"ONE")==0) {
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = one;
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_one;
} else if (strcmp(phich_resource,"TWO")==0) {
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = two;
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_two;
} else
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n",
RC.config_file_name, i, phich_resource);
printf("phich.resource %d (%s), phich.duration %d (%s)\n",
RRC_CONFIGURATION_REQ (msg_p).phich_resource[j],phich_resource,
RRC_CONFIGURATION_REQ (msg_p).phich_duration[j],phich_duration);
if (strcmp(srs_enable, "ENABLE") == 0) {
RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] = TRUE;
} else if (strcmp(srs_enable, "DISABLE") == 0) {
......
......@@ -146,6 +146,9 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band = eutra_band;
RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq = dl_CarrierFreq;
LOG_I(MAC,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_idP, CC_idP, eutra_band, mib->message.dl_Bandwidth, physCellId, p_eNB,dl_CarrierFreq,mib->message.phich_Config.phich_Resource,mib->message.phich_Config.phich_Duration);
mac_xface->phy_config_mib_eNB(Mod_idP,CC_idP,
eutra_band,
mib->message.dl_Bandwidth,
......@@ -178,6 +181,8 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
RC.mac[Mod_idP]->common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon;
if (ul_CarrierFreq>0) RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = ul_CarrierFreq;
if (ul_Bandwidth) RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = *ul_Bandwidth;
else RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.dl_Bandwidth;
mac_xface->phy_config_sib2_eNB(Mod_idP, CC_idP, radioResourceConfigCommon, NULL, ul_Bandwidth, additionalSpectrumEmission, mbsfn_SubframeConfigList);
......
......@@ -790,16 +790,18 @@ abort();
N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
aggregation=get_aggregation(get_bw_index(module_idP,CC_id),
eNB_UE_stats->DL_cqi[0],
format0);
if (CCE_allocation_infeasible(module_idP,CC_id,0,subframeP,aggregation,rnti)) {
LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: not enough nCCE\n", module_idP,frameP,subframeP,UE_id,rnti,CC_id);
continue; // break;
} else{
LOG_D(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d mode %s: aggregation level %d\n",
module_idP,frameP,subframeP,UE_id,rnti,CC_id, mode_string[eNB_UE_stats->mode], 1<<aggregation);
LOG_D(MAC,"[eNB %d] frame %d subframe %d,Scheduling PUSCH for UE %d/%x CC %d mode %s: aggregation level %d, N_RB_UL %d\n",
module_idP,frameP,subframeP,UE_id,rnti,CC_id, mode_string[eNB_UE_stats->mode], 1<<aggregation,N_RB_UL);
}
......@@ -910,7 +912,7 @@ abort();
T_INT(TBS), T_INT(ndi));
if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED)
LOG_I(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n",
LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n",
module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,mcs,
first_rb[CC_id],rb_table[rb_table_index],
rb_table_index,TBS,harq_pid);
......
......@@ -536,6 +536,10 @@ int l2_init_ue(int eMBMS_active, char *uecap_xer,uint8_t cba_group_active, uint8
mac_xface->ue_process_rar = ue_process_rar;
mac_xface->ue_scheduler = ue_scheduler;
mac_xface->process_timing_advance = process_timing_advance;
mac_xface->Msg3_transmitted = Msg3_tx;
mac_xface->Msg1_transmitted = Msg1_tx;
mac_xface->ra_failed = ra_failed;
mac_xface->ra_succeeded = ra_succeeded;
LOG_I(MAC,"[MAIN] PHY Frame configuration \n");
......@@ -641,10 +645,6 @@ int l2_init_eNB()
mac_xface->get_prb = get_prb;
// mac_xface->get_SB_size = Get_SB_size;
mac_xface->get_subframe_direction = get_subframe_direction;
mac_xface->Msg3_transmitted = Msg3_tx;
mac_xface->Msg1_transmitted = Msg1_tx;
mac_xface->ra_failed = ra_failed;
mac_xface->ra_succeeded = ra_succeeded;
mac_xface->mac_phy_remove_ue = mac_phy_remove_ue;
LOG_I(MAC,"[MAIN] PHY Frame configuration \n");
......
......@@ -223,36 +223,20 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
case 100:
mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100;
break;
default:
mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6;
break;
}
switch (phich_Resource) {
case oneSixth:
mib->message.phich_Config.phich_Resource = 0;
break;
case half:
mib->message.phich_Config.phich_Resource = 1;
break;
case one:
mib->message.phich_Config.phich_Resource = 2;
break;
case two:
mib->message.phich_Config.phich_Resource = 3;
break;
AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL);
}
AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n");
mib->message.phich_Config.phich_Resource = phich_Resource;
AssertFatal(phich_Resource <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
mib->message.phich_Config.phich_Duration = phich_duration;
LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n",
(uint32_t)mib->message.dl_Bandwidth,
(uint32_t)phich_duration,
(uint32_t)phich_Resource,
(uint32_t)sfn);
mib->message.phich_Config.phich_Duration = phich_duration;
mib->message.systemFrameNumber.buf = &sfn;
mib->message.systemFrameNumber.size = 1;
mib->message.systemFrameNumber.bits_unused=0;
......
......@@ -140,6 +140,10 @@ init_SI(
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id];
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id];
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
configuration->N_RB_DL[CC_id],
configuration->phich_resource[CC_id],
configuration->phich_duration[CC_id]);
do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
#ifdef ENABLE_ITTI
configuration->N_RB_DL[CC_id],
......
......@@ -106,6 +106,8 @@ const char* eurecomVariablesNames[] = {
"rxcnt",
"trx_ts",
"trx_tst",
"trx_ts_ue",
"trx_tst_ue",
"trx_write_flags",
"tx_ts",
"rx_ts",
......@@ -196,6 +198,8 @@ const char* eurecomFunctionsNames[] = {
"rt_sleep",
"trx_read",
"trx_write",
"trx_read_ue",
"trx_write_ue",
"trx_read_if",
"trx_write_if",
"eNB_thread_rxtx0",
......
......@@ -78,6 +78,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_RXCNT,
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS,
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST,
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS_UE,
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE,
VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS,
VCD_SIGNAL_DUMPER_VARIABLES_TX_TS,
VCD_SIGNAL_DUMPER_VARIABLES_RX_TS,
......@@ -170,6 +172,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP=0,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_UE,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_UE,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0,
......
......@@ -61,8 +61,8 @@
// Packet sizes for IF4p5 interface format
#define DATA_BLOCK_SIZE_BYTES(scaled_nblocks) (sizeof(uint16_t)*scaled_nblocks)
#define PRACH_HARD_CODED_NUM_SAMPLES (839*4)
#define PRACH_BLOCK_SIZE_BYTES (sizeof(int16_t)*PRACH_HARD_CODED_NUM_SAMPLES) // FIX hard coded prach size
#define PRACH_NUM_SAMPLES (839)
#define PRACH_BLOCK_SIZE_BYTES (sizeof(int32_t)*PRACH_NUM_SAMPLES)
#define RAW_IF4p5_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
......
......@@ -104,7 +104,6 @@ struct timing_info_t {
// Fix per CC openair rf/if device update
// extern openair0_device openair0;
void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe);
#if defined(ENABLE_ITTI)
extern volatile int start_eNB;
......@@ -141,7 +140,7 @@ void exit_fun(const char* s);
void init_eNB(int,int);
void stop_eNB(int nb_inst);
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru);
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
......@@ -150,8 +149,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
// ****************************************
// Common RX procedures subframe n
do_prach(eNB,proc->frame_rx,proc->subframe_rx);
// phy_procedures_eNB_common_RX(eNB,proc);
// if this is IF5 or 3GPP_eNB
if (eNB->RU_list[0]->function < NGFI_RAU_IF4p5) wakeup_prach_eNB(eNB,NULL);
// UE-specific RX processing for subframe n
phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
......@@ -278,11 +277,38 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) {
}
int wakeup_rxtx(eNB_proc_t *proc,eNB_rxtx_proc_t *proc_rxtx,LTE_DL_FRAME_PARMS *fp) {
int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
eNB_proc_t *proc=&eNB->proc;
eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1];
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
int i;
struct timespec wait;
pthread_mutex_lock(&proc->mutex_RU);
for (i=0;i<eNB->num_RU;i++) {
if (ru == eNB->RU_list[i]) {
if ((proc->RU_mask&(1<<i)) > 0)
LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n",
eNB->Mod_id,proc->frame_rx,proc->subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask);
proc->RU_mask |= (1<<i);
}
}
if (proc->RU_mask != (1<<eNB->num_RU)-1) { // not all RUs have provided their information so return
pthread_mutex_unlock(&proc->mutex_RU);
return(0);
}
else { // all RUs have provided their information so continue on and wakeup eNB processing
proc->RU_mask = 0;
pthread_mutex_unlock(&proc->mutex_RU);
}
wait.tv_sec=0;
wait.tv_nsec=5000000L;
......@@ -330,18 +356,37 @@ int wakeup_rxtx(eNB_proc_t *proc,eNB_rxtx_proc_t *proc_rxtx,LTE_DL_FRAME_PARMS *
return(0);
}
void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe) {
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru) {
eNB_proc_t *proc = &eNB->proc;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
int i;
if (ru!=NULL) {
pthread_mutex_lock(&proc->mutex_RU_PRACH);
for (i=0;i<eNB->num_RU;i++) {
if (ru == eNB->RU_list[i]) {
if ((proc->RU_mask_prach&(1<<i)) > 0)
LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information (PRACH) from RU %d (num_RU %d, mask %x) has not been served yet!\n",
eNB->Mod_id,proc->frame_rx,proc->subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask_prach);
proc->RU_mask_prach |= (1<<i);
}
}
if (proc->RU_mask_prach != (1<<eNB->num_RU)-1) { // not all RUs have provided their information so return
pthread_mutex_unlock(&proc->mutex_RU_PRACH);
return(0);
}
else { // all RUs have provided their information so continue on and wakeup eNB processing
proc->RU_mask_prach = 0;
pthread_mutex_unlock(&proc->mutex_RU_PRACH);
}
}
// check if we have to detect PRACH first
if (is_prach_subframe(fp,frame,subframe)>0) {
LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe);
if (is_prach_subframe(fp,proc->frame_rx,proc->subframe_rx)>0) {
LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",proc->frame_rx,proc->subframe_rx);
if (proc->instance_cnt_prach == 0) {
LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe);
LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH\n", proc->frame_rx,proc->subframe_rx);
return;
}
......@@ -354,8 +399,8 @@ void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe) {
++proc->instance_cnt_prach;
// set timing for prach thread
proc->frame_prach = frame;
proc->subframe_prach = subframe;
proc->frame_prach = proc->frame_rx;
proc->subframe_prach = proc->subframe_rx;
// the thread can now be woken up
if (pthread_cond_signal(&proc->cond_prach) != 0) {
......@@ -435,6 +480,8 @@ void init_eNB_proc(int inst) {
proc->first_rx=1;
proc->first_tx=1;
proc->RU_mask=0;
proc->RU_mask_prach=0;
pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
......@@ -443,6 +490,8 @@ void init_eNB_proc(int inst) {
pthread_mutex_init( &proc->mutex_prach, NULL);
pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL);
pthread_mutex_init( &proc->mutex_RU,NULL);
pthread_mutex_init( &proc->mutex_RU_PRACH,NULL);
pthread_cond_init( &proc->cond_prach, NULL);
pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
......@@ -672,8 +721,9 @@ void init_eNB_afterRU() {
if (RC.ru[ru_id]==NULL) RC.ru[ru_id] = (RU_t*)malloc(sizeof(RU_t));
RC.ru[ru_id]->wakeup_rxtx = wakeup_rxtx;
RC.ru[ru_id]->eNB_top = eNB_top;
RC.ru[ru_id]->wakeup_rxtx = wakeup_rxtx;
RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_eNB;
RC.ru[ru_id]->eNB_top = eNB_top;
}
}
void init_eNB(int single_thread_flag,int wait_for_sync) {
......
This diff is collapsed.
......@@ -526,6 +526,7 @@ static void *scope_thread(void *arg)
0,7);
} else {
/*
if (RC.eNB[0][0]->mac_enabled==1) {
len = dump_eNB_l2_stats (stats_buffer, 0);
//fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
......@@ -540,7 +541,7 @@ static void *scope_thread(void *arg)
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser(form_stats->stats_text);
fl_add_browser_line(form_stats->stats_text, stats_buffer);
*/
ue_cnt=0;
for(UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -705,7 +705,6 @@ l2l1_task (void *args_p)
for (sf = 0; sf < 10; sf++) {
LOG_D(EMU,"************************* Subframe %d\n",sf);
start_meas (&oaisim_stats_f);
wait_for_slot_isr ();
......@@ -732,12 +731,13 @@ l2l1_task (void *args_p)
CC_id=0;
int all_done=0;
while (all_done==0) {
pthread_mutex_lock(&subframe_mutex);
int subframe_ru_mask_local = subframe_ru_mask;
int subframe_UE_mask_local = subframe_UE_mask;
pthread_mutex_unlock(&subframe_mutex);
LOG_D(EMU,"Frame %d, Subframe %d: Checking masks %x,%x\n",frame,sf,subframe_ru_mask,subframe_UE_mask);
LOG_D(EMU,"Frame %d, Subframe %d: Checking masks %x,%x\n",frame,sf,subframe_ru_mask_local,subframe_UE_mask_local);
if ((subframe_ru_mask_local == ((1<<NB_RU)-1)) &&
(subframe_UE_mask_local == ((1<<NB_UE_INST)-1)))
all_done=1;
......@@ -745,6 +745,7 @@ l2l1_task (void *args_p)
usleep(1500);
}
//clear subframe masks for next round
pthread_mutex_lock(&subframe_mutex);
subframe_ru_mask=0;
......@@ -761,9 +762,11 @@ l2l1_task (void *args_p)
*/
for (ru_id=0;ru_id<NB_RU;ru_id++) {
current_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
LOG_D(EMU,"RU %d/%d: TS %llu\n",ru_id,CC_id,current_ru_rx_timestamp[ru_id][CC_id]);
}
for (UE_inst = 0; UE_inst<NB_UE_INST;UE_inst++) {
current_UE_rx_timestamp[UE_inst][CC_id] += PHY_vars_UE_g[UE_inst][CC_id]->frame_parms.samples_per_tti;
LOG_D(EMU,"UE %d/%d: TS %llu\n",UE_id,CC_id,current_UE_rx_timestamp[UE_inst][CC_id]);
}
......@@ -817,14 +820,14 @@ l2l1_task (void *args_p)
if(eNB_avg_thr)
fprintf(eNB_avg_thr,"%d %d\n",RC.eNB[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx,
(RC.eNB[eNB_inst][0]->total_system_throughput)/((RC.eNB[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx+1)*10));
/*
if (eNB_stats[eNB_inst]) {
len = dump_eNB_stats(RC.eNB[eNB_inst][0], stats_buffer, 0);
rewind (eNB_stats[eNB_inst]);
fwrite (stats_buffer, 1, len, eNB_stats[eNB_inst]);
fflush(eNB_stats[eNB_inst]);
}
*/
#ifdef OPENAIR2
if (eNB_l2_stats) {
......@@ -1214,6 +1217,7 @@ void wait_RUs() {
// copy frame parameters from RU to UEs
for (i=0;i<NB_UE_INST;i++) {
PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL = RC.ru[0]->frame_parms.N_RB_DL;
PHY_vars_UE_g[i][0]->frame_parms.N_RB_UL = RC.ru[0]->frame_parms.N_RB_UL;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_tx = 1;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_rx = 1;
// set initially to 2, it will be revised after initial synchronization
......@@ -1229,7 +1233,7 @@ void wait_RUs() {
PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq,
PHY_vars_UE_g[i][0]->frame_parms.eutra_band);
current_UE_rx_timestamp[i][0] = RC.ru[0]->frame_parms.samples_per_tti;
current_UE_rx_timestamp[i][0] = RC.ru[0]->frame_parms.samples_per_tti + RC.ru[0]->frame_parms.ofdm_symbol_size + RC.ru[0]->frame_parms.nb_prefix_samples0;
}
......
......@@ -48,7 +48,11 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
uint32_t frame,int eNB_id,uint8_t CC_id);
void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,
uint16_t offset,
uint16_t length,
uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
void init_ue(node_desc_t *ue_data, UE_Antenna ue_ant);//Abstraction changes
void init_enb(node_desc_t *enb_data, eNB_Antenna enb_ant);//Abstraction changes
......
......@@ -1064,10 +1064,6 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
usleep(500);
}
// tell top-level we are busy
pthread_mutex_lock(&subframe_mutex);
subframe_ru_mask|=(1<<ru_id);
pthread_mutex_unlock(&subframe_mutex);
subframe = (last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms.samples_per_tti)%10;
LOG_D(EMU,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n",
......@@ -1097,13 +1093,13 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
int UE_id = device->Mod_id;
int CC_id = device->CC_id;
int subframe;
int subframe,new_subframe;
int sample_count=0;
int read_size;
*ptimestamp = last_UE_rx_timestamp[UE_id][CC_id];
LOG_D(EMU,"UE_trx_read nsamps %d TS(%llu,%llu) antenna %d\n",nsamps,
LOG_D(EMU,"[TXPATH]UE_trx_read nsamps %d TS %llu (%llu) antenna %d\n",nsamps,
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
(unsigned long long)last_UE_rx_timestamp[UE_id][CC_id],
cc);
......@@ -1116,29 +1112,23 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
while (sample_count<nsamps) {
while (current_UE_rx_timestamp[UE_id][CC_id] <
(last_UE_rx_timestamp[UE_id][CC_id]+read_size)) {
LOG_D(EMU,"UE_trx_read : current TS %d, last TS %d, sleeping\n",current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
LOG_D(EMU,"[TXPATH]UE_trx_read : current TS %d, last TS %d, sleeping\n",current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
usleep(500);
}
// LOG_D(EMU,"UE_trx_read : current TS %d, last TS %d, sleeping\n",current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
// tell top-level we are busy
pthread_mutex_lock(&subframe_mutex);
subframe_UE_mask|=(1<<UE_id);
pthread_mutex_unlock(&subframe_mutex);
// otherwise we have one subframe here so generate the received signal
// if we cross a subframe-boundary
subframe = (last_UE_rx_timestamp[UE_id][CC_id]/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10;
if ((last_UE_rx_timestamp[UE_id][CC_id]%PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti) > 0)
subframe++;
new_subframe = ((last_UE_rx_timestamp[UE_id][CC_id]+read_size)/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10;
if (new_subframe!=subframe) {
// tell top-level we are busy
pthread_mutex_lock(&subframe_mutex);
subframe_UE_mask|=(1<<UE_id);
LOG_D(EMU,"Setting UE_id %d mask to busy (%d)\n",UE_id,subframe_UE_mask);
pthread_mutex_unlock(&subframe_mutex);
last_UE_rx_timestamp[UE_id][CC_id] += read_size;
sample_count += read_size;
if (subframe > 9)
return(nsamps);
}
LOG_D(PHY,"UE_trx_read generating DL subframe %d (Ts %llu, current TS %llu)\n",
subframe,(unsigned long long)*ptimestamp,
......@@ -1147,11 +1137,24 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
enb_data,
ue_data,
subframe,
last_UE_rx_timestamp[UE_id][CC_id]%PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti,
nsamps,
0, //abstraction_flag,
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
UE_id,
CC_id);
LOG_D(EMU,"[TXPATH]UE_trx_read @ TS %llu (%llu)=> frame %d, subframe %d\n",
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
(unsigned long long)last_UE_rx_timestamp[UE_id][CC_id],
((unsigned long long)last_UE_rx_timestamp[UE_id][CC_id]/(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti*10))&1023,
subframe);
last_UE_rx_timestamp[UE_id][CC_id] += read_size;
sample_count += read_size;
}
......@@ -1159,8 +1162,34 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
return(nsamps);
}
extern double ru_amp[NUMBER_OF_RU_MAX];
int ru_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int ru_id = device->Mod_id;
LTE_DL_FRAME_PARMS *frame_parms = &RC.ru[ru_id]->frame_parms;
pthread_mutex_lock(&subframe_mutex);
LOG_D(EMU,"[TXPATH] ru_trx_write: RU %d mask %d\n",ru_id,subframe_ru_mask);
pthread_mutex_unlock(&subframe_mutex);
// compute amplitude of TX signal from first symbol in subframe
// note: assumes that the packet is an entire subframe
ru_amp[ru_id] = 0;
for (int aa=0; aa<RC.ru[ru_id]->nb_tx; aa++) {
ru_amp[ru_id] += (double)signal_energy((int32_t*)buff[aa],frame_parms->ofdm_symbol_size)/(12*frame_parms->N_RB_DL);
}
ru_amp[ru_id] = sqrt(ru_amp[ru_id]);
LOG_D(EMU,"Setting amp for RU %d to %f (%d)\n",ru_id,ru_amp[ru_id], dB_fixed((double)signal_energy((int32_t*)buff[0],frame_parms->ofdm_symbol_size)));
// tell top-level we are done
pthread_mutex_lock(&subframe_mutex);
subframe_ru_mask|=(1<<ru_id);
LOG_D(EMU,"Setting RU %d to busy\n",ru_id);
pthread_mutex_unlock(&subframe_mutex);
return(nsamps);
}
......
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