Commit 89a9be9b authored by knopp's avatar knopp

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony

Conflicts:
	openair1/SCHED/phy_procedures_lte_ue.c
	targets/RT/USER/lte-softmodem.c
	targets/RT/USER/lte-ue.c
parents 64e3d4f6 5ae509b2
......@@ -963,6 +963,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_mobipass_tools.c
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c
......
......@@ -259,7 +259,7 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
LOG_I(PHY,"[UE%d] Frame %d: Applying radioResourceConfigCommon from eNB%d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx,CH_index);
LOG_I(PHY,"[UE%d] Applying radioResourceConfigCommon from eNB%d\n",Mod_id,CH_index);
frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
......@@ -369,7 +369,7 @@ void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,int mbsfn_Are
LTE_DL_FRAME_PARMS *frame_parms = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
LOG_I(PHY,"[UE%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx,mbsfn_AreaId_r9,mbsfn_Area_idx);
LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %d for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
if (mbsfn_Area_idx == 0) {
frame_parms->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
......@@ -517,8 +517,8 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobility
// uint8_t prach_fmt;
// int u;
LOG_I(PHY,"[UE%d] Frame %d: Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx,eNB_id);
LOG_I(PHY,"[UE%d] Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
Mod_id,eNB_id);
frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
frame_parms->prach_config_common.prach_Config_enabled=1;
......@@ -752,7 +752,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,
if (physicalConfigDedicated) {
LOG_D(PHY,"[UE %d] Frame %d: Received physicalConfigDedicated from eNB %d\n",Mod_id, phy_vars_ue->frame_rx,CH_index);
LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, CH_index);
LOG_D(PHY,"------------------------------------------------------------------------\n");
if (physicalConfigDedicated->pdsch_ConfigDedicated) {
......@@ -843,7 +843,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,
#endif
} else {
LOG_D(PHY,"[PHY][UE %d] Frame %d: Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, phy_vars_ue->frame_rx,CH_index);
LOG_D(PHY,"[PHY][UE %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id,CH_index);
return;
}
......
......@@ -51,7 +51,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
ncoef = 32767 - coef;
#ifdef DEBUG_PHY
LOG_D(PHY,"frame %d, slot %d: rx_offset (before) = %d\n",ue->frame_rx,ue->slot_rx,ue->rx_offset);
LOG_D(PHY,"frame %d: rx_offset (before) = %d\n",ue->proc.proc_rxtx[0].frame_rx,ue->rx_offset);
#endif //DEBUG_PHY
......@@ -95,7 +95,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
#ifdef DEBUG_PHY
LOG_D(PHY,"frame %d: rx_offset (after) = %d : max_pos = %d,max_pos_fil = %d (peak %d)\n",
ue->frame_rx,ue->rx_offset,max_pos,max_pos_fil,temp);
ue->proc.proc_rxtx[0].frame_rx,ue->rx_offset,max_pos,max_pos_fil,temp);
#endif //DEBUG_PHY
......
......@@ -77,7 +77,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
RSoffset = 3;
*/
LOG_D(PHY,"get_PL : Frame %d : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n", ue->frame_rx,
LOG_D(PHY,"get_PL : Frame %d : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n", ue->proc.proc_rxtx[0].frame_rx,
(1.0*dB_fixed_times10(ue->measurements.rsrp[eNB_index])-(10.0*ue->rx_total_gain_dB))/10.0,
10*log10((double)ue->measurements.rsrp[eNB_index]),
ue->frame_parms.pdsch_config_common.referenceSignalPower);
......@@ -172,7 +172,7 @@ int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rs
}
void ue_rrc_measurements(PHY_VARS_UE *ue,
uint8_t slot,
uint8_t subframe,
uint8_t abstraction_flag)
{
......@@ -192,7 +192,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
if (abstraction_flag == 0) {
if ((ue->frame_parms.frame_type == FDD) &&
((slot == 0) || (slot == 10))) { // FDD PSS/SSS, compute noise in DTX REs
((subframe == 0) || (subframe == 5))) { // FDD PSS/SSS, compute noise in DTX REs
if (ue->frame_parms.Ncp==NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
......@@ -240,7 +240,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
}
}
else if ((ue->frame_parms.frame_type == TDD) &&
(slot == 1)) { // TDD SSS, compute noise in DTX REs
(subframe == 0)) { // TDD SSS, compute noise in DTX REs
if (ue->frame_parms.Ncp==NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
......@@ -294,7 +294,7 @@ 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
LOG_I(PHY,"[UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->frame_rx,slot,Nid_cell,nushift,
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,
eNB_offset,k,l);
#endif
......@@ -376,15 +376,15 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
// if (slot == 0) {
if (eNB_offset == 0)
LOG_I(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",ue->Mod_id,
ue->frame_rx,slot,10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
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,
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, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d), rsrq: %3.1f dB\n",
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",
ue->Mod_id,
ue->frame_rx,slot,eNB_offset,
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,
10*log10(ue->measurements.rsrp[eNB_offset])-ue->rx_total_gain_dB,
ue->measurements.rsrp[eNB_offset],
......@@ -699,9 +699,9 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
}
void lte_ue_measurements_emul(PHY_VARS_UE *ue,uint8_t last_slot,uint8_t eNB_id)
void lte_ue_measurements_emul(PHY_VARS_UE *ue,uint8_t subframe,uint8_t eNB_id)
{
msg("[PHY] EMUL UE lte_ue_measurements_emul last slot %d, eNB_id %d\n",last_slot,eNB_id);
msg("[PHY] EMUL UE lte_ue_measurements_emul subframe %d, eNB_id %d\n",subframe,eNB_id);
}
......@@ -48,7 +48,7 @@
#include "SIMULATION/TOOLS/defs.h" // for taus
#include "PHY/sse_intrin.h"
#include "assertions.h"
#include "assertions.h"
//#define DEBUG_DCI_ENCODING 1
//#define DEBUG_DCI_DECODING 1
......@@ -2079,8 +2079,8 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
}
num_pdcch_symbols = get_num_pdcch_symbols(num_ue_spec_dci+num_common_dci,dci_alloc,frame_parms,subframe);
// printf("subframe %d in generate_dci_top num_pdcch_symbols = %d, num_dci %d\n",
// subframe,num_pdcch_symbols,num_ue_spec_dci+num_common_dci);
// printf("subframe %d in generate_dci_top num_pdcch_symbols = %d, num_dci %d\n",
// subframe,num_pdcch_symbols,num_ue_spec_dci+num_common_dci);
generate_pcfich(num_pdcch_symbols,
amp,
frame_parms,
......@@ -2108,7 +2108,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
if (dci_alloc[i].L == (uint8_t)L) {
#ifdef DEBUG_DCI_ENCODING
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,
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,
*(unsigned int*)dci_alloc[i].dci_pdu);
dump_dci(frame_parms,&dci_alloc[i]);
#endif
......@@ -2128,7 +2128,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
if (dci_alloc[i].L == (uint8_t)L) {
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," Generating UE (rnti %x) specific DCI %d of length %d, aggregation %d, format %d (%x)\n",dci_alloc[i].rnti,i,dci_alloc[i].dci_length,1<<dci_alloc[i].L,dci_alloc[i].format,
printf(" Generating UE (rnti %x) (nCCE %d) specific DCI %d of length %d, aggregation %d, format %d (%x)\n",dci_alloc[i].rnti,dci_alloc[i].firstCCE,i,dci_alloc[i].dci_length,1<<dci_alloc[i].L,dci_alloc[i].format,
dci_alloc[i].dci_pdu);
dump_dci(frame_parms,&dci_alloc[i]);
#endif
......@@ -2140,6 +2140,9 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
dci_alloc[i].L,
dci_alloc[i].rnti);
}
else {
}
}
}
}
......@@ -2153,9 +2156,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
//72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH Modulation, Msymb %d\n",Msymb);
#endif
// Now do modulation
if (frame_parms->mode1_flag==1)
......@@ -2165,10 +2166,16 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
e_ptr = e;
#ifdef DEBUG_DCI_ENCODING
printf(" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d\n",Msymb,Msymb2,gain_lin_QPSK);
#endif
if (frame_parms->mode1_flag) { //SISO
for (i=0; i<Msymb2; i++) {
//((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
......@@ -2187,7 +2194,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
for (i=0; i<Msymb2; i+=2) {
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH Modulation (TX diversity): REG %d\n",i>>2);
printf(" PDCCH Modulation (TX diversity): REG %d\n",i>>2);
#endif
// first antenna position n -> x0
((int16_t*)&y[0][i])[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
......@@ -2212,7 +2219,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH Interleaving\n");
printf(" PDCCH Interleaving\n");
#endif
// printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
......@@ -2262,8 +2269,9 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
txdataF[1][tti_offset+i] = wbar[1][mprime];
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
#endif
mprime++;
}
}
......@@ -2292,7 +2300,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
txdataF[1][tti_offset+0] = wbar[1][mprime];
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
#endif
mprime++;
txdataF[0][tti_offset+1] = wbar[0][mprime];
......@@ -2301,7 +2309,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
txdataF[1][tti_offset+1] = wbar[1][mprime];
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+1,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
printf("PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+1,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
#endif
mprime++;
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[0][mprime];
......@@ -2310,7 +2318,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[1][mprime];
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+3,*(short*)&wbar[0][mprime],
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+3,*(short*)&wbar[0][mprime],
*(1+(short*)&wbar[0][mprime]));
#endif
mprime++;
......@@ -2320,7 +2328,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[1][mprime];
#ifdef DEBUG_DCI_ENCODING
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+4,*(short*)&wbar[0][mprime],
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+4,*(short*)&wbar[0][mprime],
*(1+(short*)&wbar[0][mprime]));
#endif
mprime++;
......
......@@ -4477,9 +4477,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
LOG_D(PHY,"UE (%x/%d): Subframe %d Format1 DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d\n",dlsch[0]->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi,
dlsch0_harq->first_tx,dlsch0_harq->status);
// printf("Format2 DCI (UE, hard pid %d): ndi %d, old_ndi %d (first tx %d)\n",harq_pid,ndi,dlsch0_harq->DCINdi,
// dlsch0_harq->first_tx);
if ((ndi!=dlsch0_harq->DCINdi)||
(dlsch0_harq->first_tx==1)) {
// printf("Rate: setting round to zero (ndi %d, DCINdi %d,first_tx %d)\n",ndi,dlsch0_harq->DCINdi,dlsch0_harq->first_tx);
......@@ -6236,6 +6233,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
uint8_t subframe,
DCI_format_t dci_format,
PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
uint16_t si_rnti,
uint16_t ra_rnti,
uint16_t p_rnti,
......@@ -6269,12 +6267,12 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
harq_pid = 0;
else
harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms,ue->frame_rx,subframe),
pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe));
if (harq_pid == 255) {
LOG_E(PHY, "frame %d, subframe %d, rnti %x, format %d: illegal harq_pid!\n",
ue->frame_rx, subframe, rnti, dci_format);
proc->frame_rx, subframe, rnti, dci_format);
return(-1);
}
......@@ -6401,7 +6399,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
if (rballoc > RIV_max) {
LOG_E(PHY,"frame %d, subframe %d, rnti %x, format %d: FATAL ERROR: generate_ue_ulsch_params_from_dci, rb_alloc > RIV_max\n",
ue->frame_rx, subframe, rnti, dci_format);
proc->frame_rx, subframe, rnti, dci_format);
return(-1);
}
......@@ -6416,13 +6414,13 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
if (ue->ul_power_control_dedicated[eNB_id].accumulationEnabled == 1) {
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d: f_pusch (ACC) %d, adjusting by %d (TPC %d)\n",
ue->Mod_id,harq_pid,ue->frame_rx,subframe,ulsch->f_pusch,
ue->Mod_id,harq_pid,proc->frame_rx,subframe,ulsch->f_pusch,
delta_PUSCH_acc[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC],
ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC);
ulsch->f_pusch += delta_PUSCH_acc[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC];
} else {
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d: f_pusch (ABS) %d, adjusting to %d (TPC %d)\n",
ue->Mod_id,harq_pid,ue->frame_rx,subframe,ulsch->f_pusch,
ue->Mod_id,harq_pid,proc->frame_rx,subframe,ulsch->f_pusch,
delta_PUSCH_abs[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC],
ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC);
ulsch->f_pusch = delta_PUSCH_abs[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC];
......@@ -7044,7 +7042,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
}
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d), nb_rb %d, first_rb %d, mcs %d, round %d, rv %d\n",
ue->Mod_id,harq_pid,ue->frame_rx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift,ulsch->harq_processes[harq_pid]->nb_rb,ulsch->harq_processes[harq_pid]->first_rb,
ue->Mod_id,harq_pid,proc->frame_rx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift,ulsch->harq_processes[harq_pid]->nb_rb,ulsch->harq_processes[harq_pid]->first_rb,
ulsch->harq_processes[harq_pid]->mcs,ulsch->harq_processes[harq_pid]->round,ulsch->harq_processes[harq_pid]->rvidx);
// ulsch->n_DMRS2 = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift;
......@@ -7071,7 +7069,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
return(0);
} else {
LOG_E(PHY,"frame %d, subframe %d: FATAL ERROR, generate_ue_ulsch_params_from_dci, Illegal dci_format %d\n",
ue->frame_rx, subframe,dci_format);
proc->frame_rx, subframe,dci_format);
return(-1);
}
......
......@@ -710,6 +710,8 @@ typedef struct {
uint32_t Nsoft;
/// Maximum number of Turbo iterations
uint8_t max_turbo_iterations;
/// number of iterations used in last turbo decoding
uint8_t last_iteration_cnt;
/// accumulated tx power adjustment for PUCCH
int8_t g_pucch;
} LTE_UE_DLSCH_t;
......@@ -735,6 +737,7 @@ typedef enum {
SI_PDSCH=0,
RA_PDSCH,
PDSCH,
PDSCH1,
PMCH
} PDSCH_t;
......
......@@ -670,6 +670,8 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
}
}
dlsch->last_iteration_cnt = ret;
return(ret);
}
......@@ -814,7 +816,7 @@ int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], ui
uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
uint8_t subframe,
uint8_t dlsch_id,
PDSCH_t dlsch_id,
uint8_t eNB_id)
{
......@@ -845,7 +847,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
switch (dlsch_id) {
case 0: // SI
case PDSCH_SI: // SI
dlsch_ue = phy_vars_ue->dlsch_ue_SI[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_SI;
// printf("Doing SI: TBS %d\n",dlsch_ue->harq_processes[0]->TBS>>3);
......@@ -861,7 +863,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
return(1);
break;
case 1: // RA
case PDSCH_RA: // RA
dlsch_ue = phy_vars_ue->dlsch_ue_ra[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_ra;
memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
......@@ -876,7 +878,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
return(1);
break;
case 2: // TB0
case PDSCH: // TB0
dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id][0];
harq_pid = dlsch_ue->current_harq_pid;
ue_id= (uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[(uint32_t)eNB_id]->crnti,PHY_vars_eNB_g[eNB_id2][CC_id]);
......@@ -916,6 +918,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
dlsch_ue->harq_ack[subframe].ack = 0;
dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
dlsch_ue->harq_ack[subframe].send_harq_status = 1;
dlsch->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
return(1+dlsch_ue->max_turbo_iterations);
}
......@@ -940,7 +943,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
break;
}
case 5: // PMCH
case PMCH: // PMCH
dlsch_ue = phy_vars_ue->dlsch_ue_MCH[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_MCH;
......@@ -965,9 +968,11 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
memcpy(dlsch_ue->harq_processes[0]->b,
dlsch_eNB->harq_processes[0]->b,
dlsch_ue->harq_processes[0]->TBS>>3);
dlsch->last_iteration_cnt = 1;
return(1);
} else {
// retransmission
dlsch->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
return(1+dlsch_ue->max_turbo_iterations);
}
......@@ -976,6 +981,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
default:
dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id][0];
LOG_E(PHY,"dlsch_decoding_emul: FATAL, unknown DLSCH_id %d\n",dlsch_id);
dlsch->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
return(1+dlsch_ue->max_turbo_iterations);
}
......
......@@ -123,7 +123,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
break;
default:
LOG_E(PHY,"[UE %d][FATAL] Frame %d subframe %d: Unknown PDSCH format %d\n",ue->frame_rx,subframe,type);
LOG_E(PHY,"[UE %d][FATAL] Frame %d subframe %d: Unknown PDSCH format %d\n",ue->proc.proc_rxtx[0].frame_rx,subframe,type);
return(-1);
break;
}
......
......@@ -43,6 +43,7 @@
//#define DEBUG_DRS
int generate_drs_pusch(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
uint8_t eNB_id,
short amp,
unsigned int subframe,
......@@ -70,7 +71,7 @@ int generate_drs_pusch(PHY_VARS_UE *ue,
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
int32_t ref_re,ref_im;
uint8_t harq_pid = subframe2harq_pid(frame_parms,ue->frame_tx,subframe);
uint8_t harq_pid = subframe2harq_pid(frame_parms,proc->frame_tx,subframe);
cyclic_shift0 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 +
......
......@@ -176,7 +176,7 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
}
void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type, uint32_t *symbol_number) {
void recv_IF4(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_type, uint32_t *symbol_number) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
int32_t **txdataF = eNB->common_vars.txdataF[0];
int32_t **rxdataF = eNB->common_vars.rxdataF[0];
......@@ -208,10 +208,13 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
packet_header = (IF4_header_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES+sizeof_IF4_header_t);
*frame = ((packet_header->frame_status)>>6)&0xffff;
*subframe = ((packet_header->frame_status)>>22)&0x000f;
if (*packet_type == IF4_PDLFFT) {
// Calculate from received packet
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
slotoffsetF = (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
// Do decompression of the two parts and generate txdataF
......@@ -228,7 +231,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
} else if (*packet_type == IF4_PULFFT) {
// Calculate from received packet
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
slotoffsetF = (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
// Do decompression of the two parts and generate rxdataF
......@@ -246,7 +249,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
} else if (*packet_type == IF4_PRACH) {
// FIX: hard coded prach samples length
db_fulllength = 839*2;
// Generate uncompressed data blocks
memcpy((rxsigF[0]+slotoffsetF), data_block, db_fulllength*sizeof(int16_t));
......
......@@ -70,4 +70,4 @@ void gen_IF4_prach_header(IF4_header_t*, int, int);
void send_IF4(PHY_VARS_eNB*, int, int, uint16_t, int);
void recv_IF4(PHY_VARS_eNB*, int, int, uint16_t*, uint32_t*);
void recv_IF4(PHY_VARS_eNB*, int*, int*, uint16_t*, uint32_t*);
#include <stdint.h>
#include "PHY/defs.h"
#include "PHY/LTE_TRANSPORT/if5_mobipass_tools.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
uint8_t send_IF5(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint8_t init_seq) {
uint8_t seqno=init_seq;
void *txp[2];
void *tx_buffer=NULL;
__m128i *data_block=NULL,*main_data_block=NULL;
__m128i *txp128;
__m128i t0, t1;
uint16_t packet_id=0, i;
uint16_t db_fulllength = 640;
tx_buffer = memalign(16, MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t + db_fulllength*sizeof(int16_t));
IF5_mobipass_header_t *header = (IF5_mobipass_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (__m128i *)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t + 4);
main_data_block = data_block;
header->flags = 0;
header->fifo_status = 0;
header->ack = 0;
header->seqno = seqno;
header->rsvd = 0;
txp[0] = (void*)&eNB->common_vars.txdata[0][0][proc->subframe_tx*eNB->frame_parms.samples_per_tti];
txp128 = (__m128i *) txp[0];
for (packet_id=0; packet_id<(7680*2)/640; packet_id++) {
header->time_stamp = proc->timestamp_tx + packet_id*640;
data_block = main_data_block;
for (i=0; i<db_fulllength>>3; i+=2) {
t0 = _mm_srli_epi16(*txp128++, 4);
t1 = _mm_srli_epi16(*txp128++, 4);
*data_block++ = _mm_packs_epi16(t0, t1);
}
// Write the packet to the fronthaul
if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
packet_id,
&tx_buffer,
db_fulllength,
1,
IF5_MOBIPASS)) < 0) {
perror("ETHERNET write for IF5_MOBIPASS\n");
}
header->seqno += 1;
}
seqno = header->seqno;
free(tx_buffer);
return(seqno);
}
#include <stdint.h>
#include "PHY/defs.h"
#define IF5_MOBIPASS 0x0050
struct IF5_mobipass_header {
/// Type
uint16_t flags;
/// Sub-Type
uint16_t fifo_status;
/// Reserved
uint8_t seqno;
uint8_t ack;
uint32_t rsvd;
/// Frame Status
uint32_t time_stamp;
} __attribute__ ((__packed__));
typedef struct IF5_mobipass_header IF5_mobipass_header_t;
#define sizeof_IF5_mobipass_header_t 14
uint8_t send_IF5(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint8_t);
......@@ -239,20 +239,25 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
break;
}
ue->frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
ue->frame_rx += frame_mod4;
ue->proc.proc_rxtx[0].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
ue->proc.proc_rxtx[0].frame_rx += frame_mod4;
ue->proc.proc_rxtx[1].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
ue->proc.proc_rxtx[1].frame_rx += frame_mod4;
#ifndef USER_MODE
// one frame delay
ue->frame_rx ++;
ue->proc.proc_rxtx[0].frame_rx ++;
ue->proc.proc_rxtx[1].frame_rx ++;
#endif
ue->frame_tx = ue->frame_rx;
ue->proc.proc_rxtx[0].frame_tx = ue->proc.proc_rxtx[0].frame_rx;
ue->proc.proc_rxtx[1].frame_tx = ue->proc.proc_rxtx[1].frame_rx;
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d, N_RB_DL %d, phich_duration %d, phich_resource %s!\n",
ue->Mod_id,
frame_parms->mode1_flag,
pbch_tx_ant,
ue->frame_rx,
ue->proc.proc_rxtx[0].frame_rx,
frame_parms->N_RB_DL,
frame_parms->phich_config_common.phich_duration,
phich_resource); //frame_parms->phich_config_common.phich_resource);
......@@ -467,15 +472,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters
#ifdef DEBUG_INITIAL_SYNCH
//#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset);
#endif
//#endif
if (ue->UE_scan_carrier == 0) {
if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch();
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->frame_rx,0,1);//ue->common_vars.eNb_id);
mac_xface->dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
ue->UE_mode[0] = PRACH;
}
else {
......@@ -491,7 +496,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
}
LOG_I(PHY,"[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",ue->Mod_id,
ue->frame_rx,
ue->proc.proc_rxtx[0].frame_rx,
10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
10*log10(ue->measurements.rssi),
ue->rx_total_gain_dB,
......@@ -502,7 +507,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)