debugging with AW2S RRU. Added statistics for ULSCH/UCI in PHY and MAC.
This commit is contained in:
@@ -118,8 +118,8 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int temp, i, aa, max_pos=0, max_val=0;
|
||||
short Re,Im;
|
||||
|
||||
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);
|
||||
// uint8_t cyclic_shift = 0;
|
||||
int sync_pos = 0;//(frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
|
||||
|
||||
AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size);
|
||||
AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n",
|
||||
@@ -142,9 +142,5 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
if (max_pos>frame_parms->ofdm_symbol_size/2)
|
||||
max_pos = max_pos-frame_parms->ofdm_symbol_size;
|
||||
|
||||
//#ifdef DEBUG_PHY
|
||||
LOG_D(PHY,"max_pos = %d, sync_pos=%d\n",max_pos,sync_pos);
|
||||
//#endif //DEBUG_PHY
|
||||
|
||||
return max_pos - sync_pos;
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process;
|
||||
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index;
|
||||
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0;
|
||||
// printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
|
||||
LOG_D(PHY,"TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,NPRB);
|
||||
} else {
|
||||
dci_alloc->dci_length = sizeof_DCI1A_20MHz_FDD_t;
|
||||
((DCI1A_20MHz_FDD_t *)dci_pdu)->type = 1;
|
||||
@@ -535,7 +535,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
|
||||
dlsch0->harq_mask |= (1 << rel8->harq_process);
|
||||
|
||||
if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
|
||||
if (rel8->rnti != SI_RNTI) LOG_I(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
|
||||
rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
|
||||
|
||||
break;
|
||||
|
||||
@@ -360,6 +360,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
|
||||
proc->nbEncode=0;
|
||||
|
||||
|
||||
// if (hadlsch->Ndi == 1) { // this is a new packet
|
||||
if (hadlsch->round == 0) { // this is a new packet
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
|
||||
@@ -2375,16 +2375,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
for (l=num_pdcch_symbols; l<nsymb; l++) {
|
||||
|
||||
if (dlsch0 != NULL ) {
|
||||
#ifdef DEBUG_DLSCH_MODULATION
|
||||
LOG_I(PHY,"Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d)\n",
|
||||
harq_pid,
|
||||
LOG_D(PHY,"Generating DLSCH (num_pdcch_symb %d harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %x)\n",
|
||||
num_pdcch_symbols,harq_pid,
|
||||
dlsch0_harq->mimo_mode,
|
||||
pmi2hex_2Ar2(dlsch0_harq->pmi_alloc),
|
||||
mod_order0,
|
||||
mod_order1,
|
||||
rb_alloc[0]
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (frame_parms->Ncp==0) { // normal prefix
|
||||
|
||||
@@ -113,9 +113,6 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell_mbsfn; //this is c_init in 36.211 Sec 6.3.1 for PMCH
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
#endif
|
||||
s = lte_gold_generic(&x1, &x2, 1);
|
||||
|
||||
for (n=0; n<(1+(G>>5)); n++) {
|
||||
|
||||
@@ -1469,7 +1469,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
|
||||
// HYPOTHESIS: first packet per subframe has lowest timestamp of subframe
|
||||
// should detect out of order and act accordingly ....
|
||||
AssertFatal(aid==0 || aid==1,"aid %d != 0 or 1\n",aid);
|
||||
//LOG_I(PHY,"rxp[%d] %p, dest %p, offset %d (%lld,%lld)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(timestamp[packet_id]-timestamp[0]),timestamp[packet_id],timestamp[0]);
|
||||
LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%lld,%lld)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),timestamp[packet_id],timestamp[0]);
|
||||
memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])),
|
||||
(void*)temp_rx,
|
||||
spp_eth<<2);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "prach_extern.h"
|
||||
#include <openair1/PHY/LTE_TRANSPORT/transport_proto.h>
|
||||
#include <executables/split_headers.h>
|
||||
#include "common/utils/lte/prach_utils.h"
|
||||
|
||||
void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
RU_t *ru,
|
||||
@@ -112,7 +113,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
prach_ConfigIndex = fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level];
|
||||
Ncs_config = fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
|
||||
restricted_set = fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag;
|
||||
n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex,
|
||||
n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level],
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
||||
tdd_mapindex,Nf);
|
||||
// update pointers to results for ce_level
|
||||
@@ -124,7 +125,7 @@ void rx_prach0(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;
|
||||
n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex,
|
||||
n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
|
||||
tdd_mapindex,Nf);
|
||||
}
|
||||
@@ -140,7 +141,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((frame_prach)&1023) < 20) LOG_I(PHY,
|
||||
if (((frame_prach)&1023) < 20) LOG_D(PHY,
|
||||
"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
||||
br_flag,ce_level,frame_prach,subframe,
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
||||
@@ -153,24 +154,24 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
prachF = eNB->prach_vars.prachF;
|
||||
rxsigF = eNB->prach_vars.rxsigF[0];
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
|
||||
//if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
||||
}
|
||||
//}
|
||||
}
|
||||
} else {
|
||||
if (br_flag == 1) {
|
||||
rxsigF = ru->prach_rxsigF_br[ce_level];
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
br_flag,ce_level,frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
|
||||
}
|
||||
} else {
|
||||
rxsigF = ru->prach_rxsigF[0];
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
if (((frame_prach)&1023) < 20) 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);
|
||||
}
|
||||
}
|
||||
@@ -299,11 +300,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
case 6:
|
||||
if (prach_fmt == 4) {
|
||||
dft(DFT_256,prach2,rxsigF[aa],1);
|
||||
fft_size=256;
|
||||
} else {
|
||||
dft(DFT_1536,prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1);
|
||||
fft_size=1536;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -311,13 +314,14 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
case 15:
|
||||
if (prach_fmt == 4) {
|
||||
dft(DFT_256,prach2,rxsigF[aa],1);
|
||||
fft_size=256;
|
||||
} else {
|
||||
dft(DFT_3072,prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1);
|
||||
}
|
||||
|
||||
fft_size=3072;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
@@ -339,11 +343,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
case 50:
|
||||
if (prach_fmt == 4) {
|
||||
dft(DFT_2048,prach2,rxsigF[aa],1);
|
||||
fft_size=2048;
|
||||
} else {
|
||||
dft(DFT_12288,prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1);
|
||||
fft_size=12288;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -351,11 +357,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
case 75:
|
||||
if (prach_fmt == 4) {
|
||||
dft(DFT_3072,prach2,rxsigF[aa],1);
|
||||
fft_size=3072;
|
||||
} else {
|
||||
dft(DFT_18432,prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1);
|
||||
fft_size=18432;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -364,20 +372,24 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (fp->threequarter_fs==0) {
|
||||
if (prach_fmt == 4) {
|
||||
dft(DFT_4096,prach2,rxsigF[aa],1);
|
||||
fft_size=2048;
|
||||
} else {
|
||||
dft(DFT_24576,prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1);
|
||||
fft_size=24576;
|
||||
}
|
||||
} else {
|
||||
if (prach_fmt == 4) {
|
||||
dft(DFT_3072,prach2,rxsigF[aa],1);
|
||||
fft_size=3072;
|
||||
} else {
|
||||
dft(DFT_18432,prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1);
|
||||
fft_size=18432;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +559,6 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
log2_ifft_size = 10;
|
||||
fft_size = 6144;
|
||||
|
||||
if (new_dft == 1) {
|
||||
new_dft = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "common/utils/lte/prach_utils.h"
|
||||
|
||||
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
|
||||
uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
|
||||
@@ -44,6 +44,9 @@ int16_t ru[2*839]; // quantized roots of unity
|
||||
uint32_t ZC_inv[839]; // multiplicative inverse for roots u
|
||||
uint16_t du[838];
|
||||
|
||||
extern PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7];
|
||||
|
||||
/*
|
||||
// This is table 5.7.1-4 from 36.211
|
||||
PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
|
||||
// TDD Configuration Index 0
|
||||
@@ -254,7 +257,7 @@ PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
*/
|
||||
|
||||
uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779,
|
||||
2, 837, 1, 838,
|
||||
@@ -377,7 +380,7 @@ uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index) {
|
||||
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms;
|
||||
return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra);
|
||||
}
|
||||
|
||||
/*
|
||||
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) {
|
||||
if (frame_type == FDD) // FDD
|
||||
return(prach_ConfigIndex>>4);
|
||||
@@ -556,14 +559,15 @@ int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex
|
||||
|
||||
return(prach_mask);
|
||||
}
|
||||
*/
|
||||
|
||||
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe) {
|
||||
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
|
||||
int prach_mask = is_prach_subframe0(frame_parms, prach_ConfigIndex, frame, subframe);
|
||||
int prach_mask = is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, prach_ConfigIndex, frame, subframe);
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1)
|
||||
prach_mask |= (is_prach_subframe0(frame_parms, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
|
||||
prach_mask |= (is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
|
||||
frame, subframe) << (i+1));
|
||||
}
|
||||
|
||||
|
||||
@@ -74,17 +74,6 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
|
||||
uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index);
|
||||
|
||||
|
||||
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
|
||||
|
||||
|
||||
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t prach_ConfigIndex,
|
||||
uint8_t n_ra_prboffset,
|
||||
uint8_t tdd_mapindex, uint16_t Nf);
|
||||
|
||||
|
||||
int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
|
||||
|
||||
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe);
|
||||
|
||||
|
||||
|
||||
@@ -65,6 +65,29 @@ int16_t cfo_pucch_ep[24*6] = {24278,-22005,29621,-14010,32412,-4808,32412,4807,2
|
||||
|
||||
|
||||
|
||||
void dump_uci_stats(PHY_VARS_eNB *eNB,int frame) {
|
||||
|
||||
for (int i=0;i<NUMBER_OF_SCH_STATS_MAX;i++)
|
||||
if (eNB->uci_stats[i].rnti>0) {
|
||||
eNB_UCI_STATS_t *uci_stats = &eNB->uci_stats[i];
|
||||
LOG_I(PHY,"UCI RNTI %x: pucch1_trials %d, pucch1_thres %d dB, current pucch1_stat %d dB,positive SR count %d\n",
|
||||
uci_stats->rnti,uci_stats->pucch1_trials,uci_stats->pucch1_thres,dB_fixed(uci_stats->current_pucch1_stat),uci_stats->pucch1_positive_SR);
|
||||
LOG_I(PHY,"UCI RNTI %x: pucch1_low (%d,%d)dB pucch1_high (%d,%d)dB\n",
|
||||
uci_stats->rnti,
|
||||
dB_fixed(uci_stats->pucch1_low_stat[0]),
|
||||
dB_fixed(uci_stats->pucch1_low_stat[1]),
|
||||
dB_fixed(uci_stats->pucch1_high_stat[0]),
|
||||
dB_fixed(uci_stats->pucch1_high_stat[1]));
|
||||
|
||||
LOG_I(PHY,"UCI RNTI %x: pucch1a_trials %d, pucch1a_stat (%d,%d) pucch1ab_DTX %d\n",
|
||||
uci_stats->rnti,
|
||||
uci_stats->pucch1a_trials,
|
||||
uci_stats->current_pucch1a_stat_re,
|
||||
uci_stats->current_pucch1a_stat_im,
|
||||
uci_stats->pucch1ab_DTX);
|
||||
}
|
||||
|
||||
}
|
||||
/* PUCCH format3 >> */
|
||||
/* SubCarrier Demap */
|
||||
uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB,
|
||||
@@ -725,7 +748,7 @@ int16_t pucchfmt3_Decode( int16_t b[48],
|
||||
|
||||
uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
PUCCH_FMT_t fmt,
|
||||
uint8_t UE_id,
|
||||
uint8_t UCI_id,
|
||||
uint16_t n1_pucch,
|
||||
uint16_t n2_pucch,
|
||||
uint8_t shortened_format,
|
||||
@@ -747,7 +770,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
int16_t rxcomp[NB_ANTENNAS_RX][2*12*14];
|
||||
uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1;
|
||||
uint8_t c = (frame_parms->Ncp==0) ? 3 : 2;
|
||||
uint16_t nprime,nprime0,nprime1;
|
||||
int16_t nprime,nprime0,nprime1;
|
||||
uint16_t i,j,re_offset,thres,h,off;
|
||||
uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d;
|
||||
uint8_t m,l,refs,phase,re,l2,phase_max=0;
|
||||
@@ -755,12 +778,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
int16_t tmp_re,tmp_im,W_re=0,W_im=0;
|
||||
int16_t *rxptr;
|
||||
uint32_t symbol_offset;
|
||||
int16_t stat_ref_re,stat_ref_im,*cfo;
|
||||
int16_t stat0_ref_re[NB_ANTENNAS_RX],stat0_ref_im[NB_ANTENNAS_RX],stat1_ref_re[NB_ANTENNAS_RX],stat1_ref_im[NB_ANTENNAS_RX],*cfo;
|
||||
int16_t chest0_re[NB_ANTENNAS_RX][12],chest0_im[NB_ANTENNAS_RX][12];
|
||||
int16_t chest1_re[NB_ANTENNAS_RX][12],chest1_im[NB_ANTENNAS_RX][12];
|
||||
int32_t chest_mag;
|
||||
int32_t stat_re=0,stat_im=0;
|
||||
uint32_t stat,stat_max=0;
|
||||
int32_t stat0_re[NB_ANTENNAS_RX],stat1_re[NB_ANTENNAS_RX],stat0_im[NB_ANTENNAS_RX],stat1_im[NB_ANTENNAS_RX];
|
||||
uint32_t stat0[NB_ANTENNAS_RX],stat1[NB_ANTENNAS_RX],stat_max=0,stat0_max[NB_ANTENNAS_RX],stat1_max[NB_ANTENNAS_RX];
|
||||
uint8_t log2_maxh;
|
||||
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
|
||||
uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI;
|
||||
@@ -808,9 +831,20 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
first_call=0;
|
||||
}
|
||||
|
||||
eNB_UCI_STATS_t *uci_stats = NULL;
|
||||
if(fmt!=pucch_format3) { /* PUCCH format3 */
|
||||
|
||||
eNB_UCI_STATS_t *first_uci_stats=NULL;
|
||||
for (int i=0;i<NUMBER_OF_SCH_STATS_MAX;i++)
|
||||
if (eNB->uci_stats[i].rnti == eNB->ulsch[UCI_id]->rnti) {
|
||||
uci_stats = &eNB->uci_stats[i];
|
||||
break;
|
||||
} else if (eNB->uci_stats[i].rnti == 0) first_uci_stats = &eNB->uci_stats[i];
|
||||
|
||||
if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = eNB->ulsch[UCI_id]->rnti;}
|
||||
|
||||
AssertFatal(uci_stats!=NULL,"No stat index found\n");
|
||||
uci_stats->frame = frame;
|
||||
// TODO
|
||||
// "SR+ACK/NACK" length is only 7 bits.
|
||||
// This restriction will be lifted in the future.
|
||||
@@ -1016,57 +1050,63 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
// Do cfo correction and MRC across symbols
|
||||
|
||||
if (fmt == pucch_format1) {
|
||||
uci_stats->pucch1_trials++;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("Doing PUCCH detection for format 1\n");
|
||||
#endif
|
||||
stat_max = 0;
|
||||
|
||||
for (phase=0; phase<7; phase++) {
|
||||
stat=0;
|
||||
|
||||
int stat=0;
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
stat0[aa]=0;stat1[aa]=0;
|
||||
for (re=0; re<12; re++) {
|
||||
stat_re=0;
|
||||
stat_im=0;
|
||||
stat0_re[aa]=0;
|
||||
stat0_im[aa]=0;
|
||||
stat1_re[aa]=0;
|
||||
stat1_im[aa]=0;
|
||||
off=re<<1;
|
||||
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase];
|
||||
|
||||
for (l=0; l<(nsymb>>1); l++) {
|
||||
stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb;
|
||||
stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb;
|
||||
stat0_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb;
|
||||
stat0_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb;
|
||||
off+=2;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) , stat %d\n",subframe,phase,l,re,
|
||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||
cfo[l<<1],cfo[1+(l<<1)],
|
||||
stat_re,stat_im,stat);
|
||||
stat0_re[aa],stat0_im[aa],stat);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (l2=0,l=(nsymb>>1); l < nsymb; l++,l2++) {
|
||||
stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb;
|
||||
stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb;
|
||||
stat1_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb;
|
||||
stat1_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb;
|
||||
off+=2;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d), stat %d\n",subframe,phase,l2,re,
|
||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||
cfo[l2<<1],cfo[1+(l2<<1)],
|
||||
stat_re,stat_im,stat);
|
||||
stat1_re[aa],stat1_im[aa],stat);
|
||||
#endif
|
||||
}
|
||||
|
||||
stat += ((stat_re*stat_re) + (stat_im*stat_im));
|
||||
|
||||
stat0[aa] += ((stat0_re[aa]*stat0_re[aa]) + (stat0_im[aa]*stat0_im[aa]));
|
||||
stat1[aa] += ((stat1_re[aa]*stat1_re[aa]) + (stat1_im[aa]*stat1_im[aa]));
|
||||
} //re
|
||||
stat+=(stat0[aa]+stat1[aa]);
|
||||
} // aa
|
||||
|
||||
if (stat>stat_max) {
|
||||
stat_max = stat;
|
||||
phase_max = phase;
|
||||
for (aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
|
||||
stat0_max[aa] = stat0[aa];
|
||||
stat1_max[aa] = stat1[aa];
|
||||
}
|
||||
}
|
||||
} //phase
|
||||
|
||||
// stat_max *= nsymb; // normalize to energy per symbol
|
||||
// stat_max /= (frame_parms->N_RB_UL*12); //
|
||||
stat_max /= 12;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
|
||||
@@ -1074,12 +1114,14 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
LOG_I(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max);
|
||||
#endif
|
||||
eNB->pucch1_stats[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = stat_max;
|
||||
eNB->pucch1_stats_thres[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = sigma2_dB+pucch1_thres;
|
||||
eNB->pucch1_stats_cnt[UE_id][subframe] = (eNB->pucch1_stats_cnt[UE_id][subframe]+1)&1023;
|
||||
T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(frame), T_INT(subframe),
|
||||
eNB->pucch1_stats[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = stat_max;
|
||||
eNB->pucch1_stats_thres[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = sigma2_dB+pucch1_thres;
|
||||
eNB->pucch1_stats_cnt[UCI_id][subframe] = (eNB->pucch1_stats_cnt[UCI_id][subframe]+1)&1023;
|
||||
uci_stats->pucch1_thres = sigma2_dB+pucch1_thres;
|
||||
T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(frame), T_INT(subframe),
|
||||
T_INT(stat_max), T_INT(sigma2_dB+pucch1_thres));
|
||||
|
||||
|
||||
/*
|
||||
if (eNB->pucch1_stats_cnt[UE_id][subframe] == 0) {
|
||||
LOG_M("pucch_debug.m","pucch_energy",
|
||||
@@ -1093,11 +1135,17 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
// This is a moving average of the PUCCH1 statistics conditioned on being above or below the threshold
|
||||
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {
|
||||
*payload = 1;
|
||||
uci_stats->current_pucch1_stat = stat_max;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
|
||||
uci_stats->pucch1_low_stat[aa]=stat0_max[aa];
|
||||
uci_stats->pucch1_high_stat[aa]=stat1_max[aa];
|
||||
uci_stats->pucch1_positive_SR++;
|
||||
}
|
||||
} else {
|
||||
*payload = 0;
|
||||
}
|
||||
|
||||
if (UE_id==0) {
|
||||
if (UCI_id==0) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,dB_fixed(stat_max));
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_THRES,sigma2_dB+pucch1_thres);
|
||||
}
|
||||
@@ -1106,29 +1154,30 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
LOG_D(PHY,"Doing PUCCH detection for format 1a/1b\n");
|
||||
#endif
|
||||
|
||||
int stat_re=0,stat_im=0;
|
||||
for (phase=0; phase<7; phase++) {
|
||||
stat=0;
|
||||
|
||||
int stat=0;
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
stat0[aa]=0;
|
||||
stat1[aa]=0;
|
||||
for (re=0; re<12; re++) {
|
||||
// compute received energy first slot, seperately for data and reference
|
||||
// by coherent combining across symbols but not resource elements
|
||||
// Note: assumption is that channel is stationary over symbols in slot after CFO
|
||||
stat_re=0;
|
||||
stat_im=0;
|
||||
stat_ref_re=0;
|
||||
stat_ref_im=0;
|
||||
stat0_re[aa]=0;
|
||||
stat0_im[aa]=0;
|
||||
stat0_ref_re[aa]=0;
|
||||
stat0_ref_im[aa]=0;
|
||||
off=re<<1;
|
||||
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase];
|
||||
|
||||
for (l=0; l<(nsymb>>1); l++) {
|
||||
if ((l<2)||(l>(nsymb>>1) - 3)) { //data symbols
|
||||
stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
stat0_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
stat0_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
} else { //reference symbols
|
||||
stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
stat0_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
stat0_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
}
|
||||
|
||||
off+=2;
|
||||
@@ -1141,21 +1190,21 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
// this is total energy received, summed over data and reference
|
||||
stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
|
||||
((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
|
||||
stat0[aa] += ((((stat0_re[aa]*stat0_re[aa])) + ((stat0_im[aa]*stat0_im[aa])) +
|
||||
((stat0_ref_re[aa]*stat0_ref_re[aa])) + ((stat0_ref_im[aa]*stat0_ref_im[aa])))/nsymb);
|
||||
// now second slot
|
||||
stat_re=0;
|
||||
stat_im=0;
|
||||
stat_ref_re=0;
|
||||
stat_ref_im=0;
|
||||
stat1_re[aa]=0;
|
||||
stat1_im[aa]=0;
|
||||
stat1_ref_re[aa]=0;
|
||||
stat1_ref_im[aa]=0;
|
||||
|
||||
for (l2=0,l=(nsymb>>1); l< nsymb; l++,l2++) {
|
||||
if ((l2<2) || ((l2>(nsymb>>1) - 3)) ) { // data symbols
|
||||
stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
|
||||
stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
|
||||
stat1_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
|
||||
stat1_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
|
||||
} else { //reference_symbols
|
||||
stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
|
||||
stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
|
||||
stat1_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
|
||||
stat1_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
|
||||
}
|
||||
|
||||
off+=2;
|
||||
@@ -1170,15 +1219,16 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat);
|
||||
#endif
|
||||
stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
|
||||
((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
|
||||
stat1[aa] += ((((stat1_re[aa]*stat1_re[aa])) + ((stat1_im[aa]*stat1_im[aa])) +
|
||||
((stat1_ref_re[aa]*stat1_ref_re[aa])) + ((stat1_ref_im[aa]*stat1_ref_im[aa])))/nsymb);
|
||||
} //re
|
||||
stat+=(stat0[aa]+stat1[aa]);
|
||||
} // aa
|
||||
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
LOG_D(PHY,"Format 1A: phase %d : stat %d\n",phase,stat);
|
||||
#endif
|
||||
|
||||
|
||||
if (stat>stat_max) {
|
||||
stat_max = stat;
|
||||
phase_max = phase;
|
||||
@@ -1189,8 +1239,6 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
LOG_I(PHY,"[eNB] PUCCH fmt1a/b: stat_max : %d (%d : sigma2 %d), phase_max : %d\n",stat_max,dB_fixed(stat_max),sigma2_dB,phase_max);
|
||||
#endif
|
||||
stat_re=0;
|
||||
stat_im=0;
|
||||
// Do detection now
|
||||
|
||||
|
||||
@@ -1198,13 +1246,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
// For instance i assume to skip pucch1_thres from the test below.
|
||||
// Not 100% sure
|
||||
|
||||
if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
|
||||
if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
|
||||
chL = (nsymb>>1)-4;
|
||||
chest_mag=0;
|
||||
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
// channel estimates first
|
||||
for (re=0; re<12; re++) {
|
||||
// channel estimate for first slot
|
||||
chest0_re[aa][re]=0;
|
||||
@@ -1238,6 +1285,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
// now do channel matched filter
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
stat0_re[aa]=0;
|
||||
stat0_im[aa]=0;
|
||||
stat1_re[aa]=0;
|
||||
stat1_im[aa]=0;
|
||||
|
||||
for (re=0; re<12; re++) {
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH subframe %d chest0[%d][%d] => (%d,%d)\n",subframe,aa,re,
|
||||
@@ -1249,8 +1301,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
off=(re<<1) + (24*l);
|
||||
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
|
||||
stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
|
||||
stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
|
||||
stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
|
||||
off+=2;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
|
||||
@@ -1266,8 +1318,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
off=(re<<1) + (24*l);
|
||||
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
|
||||
stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
|
||||
stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
|
||||
stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
|
||||
off+=2;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
|
||||
@@ -1288,8 +1340,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
off=(re<<1) + (24*l) + (nsymb>>1)*24;
|
||||
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
|
||||
stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
|
||||
stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
|
||||
stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
|
||||
off+=2;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
|
||||
@@ -1305,8 +1357,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
off=(re<<1) + (24*l) + (nsymb>>1)*24;
|
||||
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
|
||||
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
|
||||
stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
|
||||
stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
|
||||
stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
|
||||
stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
|
||||
off+=2;
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
|
||||
@@ -1321,29 +1373,42 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
printf("aa%d re %d : stat %d,%d\n",aa,re,stat_re,stat_im);
|
||||
#endif
|
||||
} //re
|
||||
stat_re+=stat0_re[aa]+stat1_re[aa];
|
||||
stat_im+=stat0_im[aa]+stat1_im[aa];
|
||||
} // aa
|
||||
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im,
|
||||
(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe]));
|
||||
(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe]));
|
||||
LOG_D(PHY,"In pucch.c PUCCH 1a/b: ACK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re);
|
||||
eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im);
|
||||
eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
|
||||
eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_re);
|
||||
eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_im);
|
||||
eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023;
|
||||
/* frame not available here - set to -1 for the moment */
|
||||
T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im));
|
||||
T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im));
|
||||
*payload = (stat_re<0) ? 1 : 2; // 1 == ACK, 2 == NAK
|
||||
|
||||
if (fmt==pucch_format1b)
|
||||
if (fmt==pucch_format1b) {
|
||||
uci_stats->pucch1b_trials++;
|
||||
*(1+payload) = (stat_im<0) ? 1 : 2;
|
||||
uci_stats->current_pucch1b_stat_re = stat_re;
|
||||
uci_stats->current_pucch1b_stat_im = stat_im;
|
||||
}
|
||||
else {
|
||||
uci_stats->pucch1a_trials++;
|
||||
uci_stats->current_pucch1a_stat_re = stat_re;
|
||||
uci_stats->current_pucch1a_stat_im = stat_im;
|
||||
}
|
||||
|
||||
} else { // insufficient energy on PUCCH so NAK
|
||||
LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
*payload = 4; // DTX
|
||||
((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
|
||||
((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
|
||||
eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
|
||||
((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[0] = (int16_t)(stat_re);
|
||||
((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[1] = (int16_t)(stat_im);
|
||||
eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023;
|
||||
|
||||
if (fmt==pucch_format1b)
|
||||
*(1+payload) = 4;
|
||||
uci_stats->pucch1ab_DTX++;
|
||||
}
|
||||
} else {
|
||||
LOG_E(PHY,"[eNB] PUCCH fmt2/2a/2b not supported\n");
|
||||
|
||||
@@ -223,7 +223,9 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
|
||||
@param frame_type 0-FDD, 1-TDD
|
||||
@returns 0-1 accordingly
|
||||
*/
|
||||
/*
|
||||
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index
|
||||
@@ -306,12 +308,12 @@ void init_scrambling_lut(void);
|
||||
|
||||
void init_unscrambling_lut(void);
|
||||
|
||||
|
||||
/*
|
||||
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t prach_ConfigIndex,
|
||||
uint8_t n_ra_prboffset,
|
||||
uint8_t tdd_mapindex, uint16_t Nf);
|
||||
|
||||
*/
|
||||
uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe);
|
||||
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
|
||||
|
||||
@@ -319,6 +321,6 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL);
|
||||
|
||||
void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2);
|
||||
|
||||
int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
|
||||
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -693,8 +693,6 @@ int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
|
||||
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
|
||||
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
|
||||
|
||||
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
|
||||
|
||||
|
||||
|
||||
@@ -468,6 +468,35 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
|
||||
ulsch_harq->Nsymb_pusch,
|
||||
nb_rb);
|
||||
//#endif
|
||||
|
||||
eNB_SCH_STATS_t *stats=NULL;
|
||||
int first_free=-1;
|
||||
for (int i=0;i<NUMBER_OF_SCH_STATS_MAX;i++) {
|
||||
if (eNB->ulsch_stats[i].rnti == 0 && first_free == -1) {
|
||||
first_free = i;
|
||||
stats=&eNB->ulsch_stats[i];
|
||||
}
|
||||
if (eNB->ulsch_stats[i].rnti == ulsch->rnti) {
|
||||
stats=&eNB->ulsch_stats[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (stats) {
|
||||
stats->rnti = ulsch->rnti;
|
||||
stats->round_trials[ulsch_harq->round]++;
|
||||
stats->frame=proc->frame_rx;
|
||||
}
|
||||
if (ulsch_harq->round == 0) {
|
||||
if (stats) {
|
||||
stats->current_Qm = Q_m;
|
||||
stats->current_RI = 1;
|
||||
stats->total_bytes_tx += ulsch_harq->TBS;
|
||||
stats->current_TBS = ulsch_harq->TBS;
|
||||
stats->current_G = ulsch_harq->G;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (ulsch_harq->round == 0) { // delete for RB shortage pattern
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
ulsch_harq->B = A+24;
|
||||
@@ -1086,3 +1115,42 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
|
||||
ret = ulsch_decoding_data_all(eNB,proc, UE_id,harq_pid,llr8_flag);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
void dump_ulsch_stats(PHY_VARS_eNB *eNB,int frame) {
|
||||
|
||||
for (int i=0;i<NUMBER_OF_ULSCH_MAX;i++)
|
||||
if (eNB->ulsch_stats[i].rnti>0) {
|
||||
for (int aa=0;aa<eNB->frame_parms.nb_antennas_rx;aa++)
|
||||
LOG_I(PHY,"ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",
|
||||
eNB->ulsch_stats[i].rnti, aa,eNB->ulsch_stats[i].ulsch_power[aa],aa,eNB->ulsch_stats[i].ulsch_noise_power[aa]);
|
||||
|
||||
LOG_I(PHY,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d\n",
|
||||
eNB->ulsch_stats[i].rnti,
|
||||
eNB->ulsch_stats[i].round_trials[0],
|
||||
(double)eNB->ulsch_stats[i].round_trials[1]/eNB->ulsch_stats[i].round_trials[0],
|
||||
eNB->ulsch_stats[i].round_trials[1],
|
||||
(double)eNB->ulsch_stats[i].round_trials[2]/eNB->ulsch_stats[i].round_trials[0],
|
||||
eNB->ulsch_stats[i].round_trials[2],
|
||||
(double)eNB->ulsch_stats[i].round_trials[3]/eNB->ulsch_stats[i].round_trials[0],
|
||||
eNB->ulsch_stats[i].round_trials[3]);
|
||||
LOG_I(PHY,"ULSCH RNTI %x: current_Qm %d, current_G %d, current_TBS %d, current_rate %f,current_RI %d, timing_offset %d, total_bytes RX/SCHED %d/%d\n",
|
||||
eNB->ulsch_stats[i].rnti,
|
||||
eNB->ulsch_stats[i].current_Qm,
|
||||
eNB->ulsch_stats[i].current_G,
|
||||
eNB->ulsch_stats[i].current_TBS,
|
||||
(double)eNB->ulsch_stats[i].current_G/eNB->ulsch_stats[i].current_TBS,
|
||||
eNB->ulsch_stats[i].current_RI,
|
||||
eNB->ulsch_stats[i].timing_offset,
|
||||
eNB->ulsch_stats[i].total_bytes_rx,
|
||||
eNB->ulsch_stats[i].total_bytes_tx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void clear_ulsch_stats(PHY_VARS_eNB *eNB) {
|
||||
|
||||
for (int i=0;i<NUMBER_OF_ULSCH_MAX;i++)
|
||||
memset((void*)&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i]));
|
||||
}
|
||||
|
||||
|
||||
@@ -1076,6 +1076,10 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor;
|
||||
LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid,
|
||||
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_times10(pusch_vars->ulsch_power[i]));
|
||||
pusch_vars->ulsch_noise_power[i]=0;
|
||||
for (int rb=0;rb<ulsch[UE_id]->harq_processes[harq_pid]->nb_rb;rb++)
|
||||
pusch_vars->ulsch_noise_power[i]+=eNB->measurements.n0_subband_power[i][rb]/ulsch[UE_id]->harq_processes[harq_pid]->nb_rb;
|
||||
LOG_D(PHY,"noise power[%d] %d\n",i,dB_fixed_times10(pusch_vars->ulsch_noise_power[i]));
|
||||
}
|
||||
|
||||
ulsch_channel_level(pusch_vars->drs_ch_estimates,
|
||||
|
||||
+46
-3
@@ -164,8 +164,10 @@ typedef struct {
|
||||
/// - first index: rx antenna id [0..nb_antennas_rx[
|
||||
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
|
||||
int32_t **ul_ch_magb;
|
||||
/// measured RX power based on DRS
|
||||
int ulsch_power[2];
|
||||
/// measured RX power based on DMRS
|
||||
int ulsch_power[4];
|
||||
/// measured RX power of noise
|
||||
int ulsch_noise_power[4];
|
||||
/// \brief llr values.
|
||||
/// - first index: ? [0..1179743] (hard coded)
|
||||
int16_t *llr;
|
||||
@@ -421,6 +423,42 @@ typedef struct {
|
||||
int prach_I0;
|
||||
} PHY_MEASUREMENTS_eNB;
|
||||
|
||||
typedef struct {
|
||||
uint16_t rnti;
|
||||
int frame;
|
||||
int round_trials[8];
|
||||
int total_bytes_tx;
|
||||
int total_bytes_rx;
|
||||
int current_G;
|
||||
int current_TBS;
|
||||
int current_Qm;
|
||||
int current_mcs;
|
||||
int current_RI;
|
||||
int timing_offset;
|
||||
int ulsch_power[4];
|
||||
int ulsch_noise_power[4];
|
||||
} eNB_SCH_STATS_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t rnti;
|
||||
int frame;
|
||||
int pucch1_trials;
|
||||
int pucch1_thres;
|
||||
int current_pucch1_stat;
|
||||
int pucch1_positive_SR;
|
||||
int pucch1_low_stat[4];
|
||||
int pucch1_high_stat[4];
|
||||
int pucch1_phase;
|
||||
int pucch1a_trials;
|
||||
int current_pucch1a_stat_re;
|
||||
int current_pucch1a_stat_im;
|
||||
int pucch1ab_DTX;
|
||||
int pucch1b_trials;
|
||||
int current_pucch1b_stat_re;
|
||||
int current_pucch1b_stat_im;
|
||||
int pucch3_trials;
|
||||
int current_pucch3_stat;
|
||||
} eNB_UCI_STATS_t;
|
||||
|
||||
/// Top-level PHY Data Structure for eNB
|
||||
typedef struct PHY_VARS_eNB_s {
|
||||
@@ -591,7 +629,12 @@ typedef struct PHY_VARS_eNB_s {
|
||||
/// Information regarding TM5
|
||||
MU_MIMO_mode mu_mimo_mode[NUMBER_OF_UE_MAX];
|
||||
|
||||
|
||||
/// statistics for DLSCH measurement collection
|
||||
eNB_SCH_STATS_t dlsch_stats[NUMBER_OF_SCH_STATS_MAX];
|
||||
/// statistics for ULSCH measurement collection
|
||||
eNB_SCH_STATS_t ulsch_stats[NUMBER_OF_SCH_STATS_MAX];
|
||||
/// statis for UCI (PUCCH) measurement collection
|
||||
eNB_UCI_STATS_t uci_stats[NUMBER_OF_SCH_STATS_MAX];
|
||||
/// target_ue_dl_mcs : only for debug purposes
|
||||
uint32_t target_ue_dl_mcs;
|
||||
/// target_ue_ul_mcs : only for debug purposes
|
||||
|
||||
@@ -1086,72 +1086,5 @@ void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeri
|
||||
}
|
||||
}
|
||||
|
||||
// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id,
|
||||
int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs)
|
||||
{
|
||||
|
||||
/// The payload + CRC size in bits, "B"
|
||||
uint32_t B;
|
||||
/// Number of code segments
|
||||
uint32_t C;
|
||||
/// Number of "small" code segments
|
||||
uint32_t Cminus;
|
||||
/// Number of "large" code segments
|
||||
uint32_t Cplus;
|
||||
/// Number of bits in "small" code segments (<6144)
|
||||
uint32_t Kminus;
|
||||
/// Number of bits in "large" code segments (<6144)
|
||||
uint32_t Kplus;
|
||||
/// Total number of bits across all segments
|
||||
uint32_t sumKr;
|
||||
/// Number of "Filler" bits
|
||||
uint32_t F;
|
||||
// num resource elements
|
||||
uint32_t num_re=0.0;
|
||||
// num symbols
|
||||
uint32_t num_symb=0.0;
|
||||
/// effective spectral efficiency of the PUSCH
|
||||
uint32_t MPR_x100=0;
|
||||
/// beta_offset
|
||||
uint16_t beta_offset_pusch_x8=8;
|
||||
/// delta mcs
|
||||
float delta_mcs=0.0;
|
||||
/// bandwidth factor
|
||||
float bw_factor=0.0;
|
||||
|
||||
B= tbs+24;
|
||||
lte_segmentation(NULL,
|
||||
NULL,
|
||||
B,
|
||||
&C,
|
||||
&Cplus,
|
||||
&Cminus,
|
||||
&Kplus,
|
||||
&Kminus,
|
||||
&F);
|
||||
|
||||
|
||||
sumKr = Cminus*Kminus + Cplus*Kplus;
|
||||
num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
|
||||
num_re = num_symb * nb_rb * 12;
|
||||
|
||||
if (num_re == 0)
|
||||
return(0);
|
||||
|
||||
MPR_x100 = 100*sumKr/num_re;
|
||||
|
||||
if (control_only == 1 )
|
||||
beta_offset_pusch_x8=8; // fixme
|
||||
|
||||
//(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
|
||||
|
||||
// if deltamcs_enabledm
|
||||
delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
|
||||
bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0);
|
||||
#ifdef DEBUG_SEGMENTATION
|
||||
printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
|
||||
(int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
|
||||
#endif
|
||||
return (int16_t)ceil(delta_mcs + bw_factor);
|
||||
|
||||
}
|
||||
|
||||
@@ -480,8 +480,6 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
|
||||
subframe<<1);
|
||||
stop_meas(&eNB->dlsch_scrambling_stats);
|
||||
start_meas(&eNB->dlsch_modulation_stats);
|
||||
if (frame==0) LOG_I(PHY,"Generating pdsch for %d.%d starting in symbol %d, Qm %d, nb_rb %d, rbmask %x\n",
|
||||
frame,subframe,dlsch_harq->pdsch_start,dlsch_harq->Qm,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0]);
|
||||
dlsch_modulation(eNB,
|
||||
eNB->common_vars.txdataF,
|
||||
AMP,
|
||||
@@ -1329,7 +1327,7 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) {
|
||||
int nb=abortTpool(proc->threadPool, req->key);
|
||||
nb+=abortNotifiedFIFO(proc->respDecode, req->key);
|
||||
proc->nbDecode-=nb;
|
||||
LOG_I(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
|
||||
LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
|
||||
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
|
||||
ulsch_harq->processedSegments, nb, rdata->nbSegments);
|
||||
ulsch_harq->processedSegments=rdata->nbSegments;
|
||||
@@ -1385,6 +1383,15 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) {
|
||||
fill_rx_indication(eNB,i,rdata->frame,rdata->subframe); // indicate SDU to MAC
|
||||
ulsch_harq->status = SCH_IDLE;
|
||||
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
|
||||
for (int j=0;j<NUMBER_OF_ULSCH_MAX;j++)
|
||||
if (eNB->ulsch_stats[j].rnti == ulsch->rnti) {
|
||||
eNB->ulsch_stats[j].total_bytes_rx+=ulsch_harq->TBS;
|
||||
for (int aa=0;aa<eNB->frame_parms.nb_antennas_rx;aa++) {
|
||||
eNB->ulsch_stats[j].ulsch_power[aa] = dB_fixed_times10(eNB->pusch_vars[rdata->UEid]->ulsch_power[aa]);
|
||||
eNB->ulsch_stats[j].ulsch_noise_power[aa] = dB_fixed_times10(eNB->pusch_vars[rdata->UEid]->ulsch_noise_power[aa]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
T (T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(rdata->frame), T_INT(rdata->subframe), T_INT(ulsch->rnti),
|
||||
T_INT(rdata->harq_pid));
|
||||
} // ulsch not in error
|
||||
@@ -1541,7 +1548,7 @@ void kill_te_thread(PHY_VARS_eNB *eNB) {
|
||||
}
|
||||
|
||||
void fill_rx_indication(PHY_VARS_eNB *eNB,
|
||||
int UE_id,
|
||||
int ULSCH_id,
|
||||
int frame,
|
||||
int subframe) {
|
||||
nfapi_rx_indication_pdu_t *pdu;
|
||||
@@ -1549,7 +1556,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
|
||||
int sync_pos;
|
||||
uint32_t harq_pid;
|
||||
|
||||
if (eNB->ulsch[UE_id]->ue_type > 0) harq_pid = 0;
|
||||
if (eNB->ulsch[ULSCH_id]->ue_type > 0) harq_pid = 0;
|
||||
else {
|
||||
harq_pid = subframe2harq_pid (&eNB->frame_parms,
|
||||
frame, subframe);
|
||||
@@ -1559,19 +1566,22 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
|
||||
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4| subframe;
|
||||
eNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
|
||||
pdu = &eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
|
||||
// pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle;
|
||||
// pdu->rx_ue_information.handle = eNB->ulsch[ULSCH_id]->handle;
|
||||
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
|
||||
pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti;
|
||||
pdu->rx_ue_information.rnti = eNB->ulsch[ULSCH_id]->rnti;
|
||||
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
|
||||
pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3;
|
||||
pdu->rx_indication_rel8.length = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->TBS>>3;
|
||||
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
|
||||
pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->decodedBytes;
|
||||
pdu->data = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->decodedBytes;
|
||||
// estimate timing advance for MAC
|
||||
sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[UE_id]->drs_ch_estimates_time);
|
||||
timing_advance_update = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check
|
||||
sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[ULSCH_id]->drs_ch_estimates_time);
|
||||
timing_advance_update = sync_pos;
|
||||
|
||||
// if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
|
||||
// if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
|
||||
for (int i=0;i<NUMBER_OF_SCH_STATS_MAX;i++)
|
||||
if (eNB->ulsch_stats[i].rnti == eNB->ulsch[ULSCH_id]->rnti)
|
||||
eNB->ulsch_stats[i].timing_offset = sync_pos;
|
||||
// if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,ULSCH_id); exit(-1);}
|
||||
// if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,ULSCH_id); exit(-1);}
|
||||
switch (eNB->frame_parms.N_RB_DL) {
|
||||
case 6: /* nothing to do */
|
||||
break;
|
||||
@@ -1611,7 +1621,13 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
|
||||
|
||||
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
|
||||
// estimate UL_CQI for MAC
|
||||
int SNRtimes10 = dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0] + ((eNB->frame_parms.nb_antennas_rx>1) ?eNB->pusch_vars[UE_id]->ulsch_power[1] : 0 )) - 10 * eNB->measurements.n0_subband_power_avg_dB;
|
||||
int total_power=0, avg_noise_power=0;
|
||||
for (int i=0;i<eNB->frame_parms.nb_antennas_rx;i++) {
|
||||
total_power+=(eNB->pusch_vars[ULSCH_id]->ulsch_power[i]);
|
||||
avg_noise_power+=(eNB->pusch_vars[ULSCH_id]->ulsch_noise_power[i])/eNB->frame_parms.nb_antennas_rx;
|
||||
}
|
||||
int SNRtimes10 = dB_fixed_times10(total_power) -
|
||||
dB_fixed_times10(avg_noise_power);
|
||||
|
||||
if (SNRtimes10 < -640)
|
||||
pdu->rx_indication_rel8.ul_cqi = 0;
|
||||
@@ -1620,9 +1636,11 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
|
||||
else
|
||||
pdu->rx_indication_rel8.ul_cqi = (640 + SNRtimes10) / 5;
|
||||
|
||||
LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d,%d), timing_advance %d (update %d)\n",
|
||||
harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,eNB->measurements.n0_subband_power_avg_dB,pdu->rx_indication_rel8.timing_advance,
|
||||
timing_advance_update);
|
||||
LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d,%d,%d), timing_advance %d (update %d,sync_pos %d)\n",
|
||||
harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,dB_fixed_times10(total_power),dB_fixed_times10(avg_noise_power),pdu->rx_indication_rel8.timing_advance,timing_advance_update,sync_pos);
|
||||
for (int i=0;i<eNB->frame_parms.nb_antennas_rx;i++)
|
||||
LOG_D(PHY,"antenna %d: ulsch_power %d, noise_power %d\n",i,dB_fixed_times10(eNB->pusch_vars[ULSCH_id]->ulsch_power[i]),dB_fixed_times10(eNB->pusch_vars[ULSCH_id]->ulsch_noise_power[i]));
|
||||
|
||||
eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
|
||||
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | subframe;
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
@@ -2151,6 +2169,29 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
|
||||
LOG_I (PHY, "max_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
|
||||
}
|
||||
|
||||
// figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS
|
||||
if ((frame&127) == 0 && subframe==3) {
|
||||
dump_ulsch_stats(eNB);
|
||||
dump_uci_stats(eNB);
|
||||
}
|
||||
|
||||
// clear unused statistics after 2 seconds
|
||||
for (int i=0;i<NUMBER_OF_SCH_STATS_MAX;i++) {
|
||||
if (eNB->ulsch_stats[i].frame <= frame) {
|
||||
if ((eNB->ulsch_stats[i].frame + 200) < frame) eNB->ulsch_stats[i].rnti = 0;
|
||||
}
|
||||
else {
|
||||
if (eNB->ulsch_stats[i].frame + 200 < (frame+1024)) eNB->ulsch_stats[i].rnti = 0;
|
||||
}
|
||||
if (eNB->uci_stats[i].frame <= frame) {
|
||||
if ((eNB->uci_stats[i].frame + 200) < frame) eNB->uci_stats[i].rnti = 0;
|
||||
}
|
||||
else {
|
||||
if (eNB->uci_stats[i].frame + 200 < (frame+1024)) eNB->uci_stats[i].rnti = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
|
||||
}
|
||||
|
||||
@@ -2188,6 +2229,8 @@ void release_rnti_of_phy(module_id_t mod_id) {
|
||||
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
|
||||
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
|
||||
clean_eNb_ulsch(ulsch);
|
||||
for (j=0;j<NUMBER_OF_ULSCH_MAX;j++)
|
||||
if (eNB_PHY->ulsch_stats[j].rnti == rnti) {eNB_PHY->ulsch_stats[j].rnti=0; break;}
|
||||
}
|
||||
|
||||
for(j=0; j<NUMBER_OF_UCI_VARS_MAX; j++) {
|
||||
|
||||
@@ -148,7 +148,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
|
||||
} else {
|
||||
if ((eNB->prach_energy_counter == 100) &&
|
||||
(max_preamble_energy[0] > eNB->measurements.prach_I0+eNB->prach_DTX_threshold)) {
|
||||
LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
|
||||
LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
|
||||
eNB->Mod_id,
|
||||
eNB->CC_id,
|
||||
frame,
|
||||
|
||||
@@ -474,15 +474,16 @@ void feptx_prec(RU_t *ru,
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+ru->idx , 1);
|
||||
|
||||
for (aa=0;aa<ru->nb_tx;aa++) {
|
||||
memset(ru->common.txdataF_BF[aa],0,sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
|
||||
for (int p=0;p<NB_ANTENNA_PORTS_ENB;p++) {
|
||||
if (ru->do_precoding == 0) {
|
||||
if (p==0)
|
||||
memcpy((void*)ru->common.txdataF_BF[aa],
|
||||
(void*)&eNB->common_vars.txdataF[aa][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size],
|
||||
sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
|
||||
} else {
|
||||
if (p<fp->nb_antenna_ports_eNB) {
|
||||
if (ru->do_precoding == 0) {
|
||||
memcpy((void*)ru->common.txdataF_BF[aa],
|
||||
(void*)&eNB->common_vars.txdataF[aa%fp->nb_antenna_ports_eNB][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size],
|
||||
sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
|
||||
|
||||
}
|
||||
else {
|
||||
memset(ru->common.txdataF_BF[aa],0,sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
|
||||
for (int p=0;p<NB_ANTENNA_PORTS_ENB;p++) {
|
||||
if (p<fp->nb_antenna_ports_eNB) {
|
||||
// For the moment this does nothing different than below, except ignore antenna ports 5,7,8.
|
||||
for (l=0;l<pdcch_vars->num_pdcch_symbols;l++)
|
||||
beam_precoding(eNB->common_vars.txdataF,
|
||||
@@ -494,10 +495,10 @@ void feptx_prec(RU_t *ru,
|
||||
aa,
|
||||
p,
|
||||
eNB->Mod_id);
|
||||
} //if (p<fp->nb_antenna_ports_eNB)
|
||||
} //if (p<fp->nb_antenna_ports_eNB)
|
||||
|
||||
// PDSCH region
|
||||
if (p<fp->nb_antenna_ports_eNB || p==5 || p==7 || p==8) {
|
||||
if (p<fp->nb_antenna_ports_eNB || p==5 || p==7 || p==8) {
|
||||
for (l=pdcch_vars->num_pdcch_symbols;l<fp->symbols_per_tti;l++) {
|
||||
beam_precoding(eNB->common_vars.txdataF,
|
||||
ru->common.txdataF_BF,
|
||||
@@ -510,8 +511,8 @@ void feptx_prec(RU_t *ru,
|
||||
eNB->Mod_id);
|
||||
} // for (l=pdcch_vars ....)
|
||||
} // if (p<fp->nb_antenna_ports_eNB) ...
|
||||
} // ru->do_precoding!=0
|
||||
} // for (p=0...)
|
||||
} // for (p=0...)
|
||||
} // if do_precoding
|
||||
} // for (aa=0 ...)
|
||||
|
||||
if(ru->idx<2)
|
||||
|
||||
Reference in New Issue
Block a user