Commit 9714877e authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/remove-NR_UE_PBCH' into integration_2022_wk10

parents e285b003 939b249b
...@@ -346,7 +346,7 @@ typedef struct { ...@@ -346,7 +346,7 @@ typedef struct {
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit) @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1) @param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
*/ */
#define MATLAB_RAW (1<<31) #define MATLAB_RAW (1U<<31)
#define MATLAB_SHORT 0 #define MATLAB_SHORT 0
#define MATLAB_CSHORT 1 #define MATLAB_CSHORT 1
#define MATLAB_INT 2 #define MATLAB_INT 2
......
...@@ -72,10 +72,10 @@ unsigned int crcbit (unsigned char * inputptr, ...@@ -72,10 +72,10 @@ unsigned int crcbit (unsigned char * inputptr,
unsigned int i, crc = 0, c; unsigned int i, crc = 0, c;
while (octetlen-- > 0) { while (octetlen-- > 0) {
c = (*inputptr++) << 24; c = ((unsigned int)(*inputptr++)) << 24;
for (i = 8; i != 0; i--) { for (i = 8; i != 0; i--) {
if ((1 << 31) & (c ^ crc)) if ((1U << 31) & (c ^ crc))
crc = (crc << 1) ^ poly; crc = (crc << 1) ^ poly;
else else
crc <<= 1; crc <<= 1;
......
...@@ -445,29 +445,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -445,29 +445,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
} }
} }
// PBCH // RACH
pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
for (i=0; i<fp->nb_antennas_rx; i++) {
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
int idx = (j*fp->nb_antennas_rx)+i;
pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
}
}
pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64);
} }
// initialization for the last instance of pdsch_vars (used for MU-MIMO) // initialization for the last instance of pdsch_vars (used for MU-MIMO)
...@@ -640,25 +621,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -640,25 +621,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
free_and_zero(ue->srs_vars[gNB_id]); free_and_zero(ue->srs_vars[gNB_id]);
for (int i = 0; i < fp->nb_antennas_rx; i++) {
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext[i]);
for (int j = 0; j < 4; j++) {
int idx = (j*fp->nb_antennas_rx)+i;
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp[idx]);
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates[idx]);
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time[idx]);
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext[idx]);
}
}
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext);
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp);
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates);
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext);
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time);
free_and_zero(ue->pbch_vars[gNB_id]->llr);
free_and_zero(ue->pbch_vars[gNB_id]->decoded_output);
free_and_zero(ue->pbch_vars[gNB_id]); free_and_zero(ue->pbch_vars[gNB_id]);
free_and_zero(ue->prach_vars[gNB_id]->prachF); free_and_zero(ue->prach_vars[gNB_id]->prachF);
......
...@@ -64,7 +64,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, ...@@ -64,7 +64,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
reset = 1; reset = 1;
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
x2 = (x2tmp0+(nid<<1))%(1<<31); //cinit x2 = (x2tmp0+(nid<<1))%(1U<<31); //cinit
for (n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) { for (n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset); ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset);
...@@ -95,7 +95,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, ...@@ -95,7 +95,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
reset = 1; reset = 1;
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit x2 = (x2tmp0+(nid<<1)+nscid)%(1U<<31); //cinit
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid);
for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
module_id_t gNB_id, module_id_t gNB_id,
const int estimateSz, struct complex16 dl_ch_estimates_time[][estimateSz],
uint8_t frame, uint8_t frame,
uint8_t subframe, uint8_t subframe,
unsigned char clear, unsigned char clear,
...@@ -60,8 +61,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, ...@@ -60,8 +61,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
int j = (i < 0) ? (i + frame_parms->ofdm_symbol_size) : i; int j = (i < 0) ? (i + frame_parms->ofdm_symbol_size) : i;
for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
int Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(j<<1)]; int Re = dl_ch_estimates_time[aa][j].r;
int Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(j<<1)]; int Im = dl_ch_estimates_time[aa][j].i;
temp += (Re*Re/2) + (Im*Im/2); temp += (Re*Re/2) + (Im*Im/2);
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "PHY/NR_REFSIG/ptrs_nr.h" #include "PHY/NR_REFSIG/ptrs_nr.h"
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
#include "filt16a_32.h" #include "filt16a_32.h"
#include <openair1/PHY/TOOLS/phy_scope_interface.h>
//#define DEBUG_PDSCH //#define DEBUG_PDSCH
//#define DEBUG_PDCCH //#define DEBUG_PDCCH
...@@ -43,7 +44,6 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, ...@@ -43,7 +44,6 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
NR_UE_SSB *current_ssb) NR_UE_SSB *current_ssb)
{ {
int pilot[200] __attribute__((aligned(16))); int pilot[200] __attribute__((aligned(16)));
unsigned char aarx;
unsigned short k; unsigned short k;
unsigned int pilot_cnt; unsigned int pilot_cnt;
int16_t ch[2],*pil,*rxF; int16_t ch[2],*pil,*rxF;
...@@ -77,7 +77,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, ...@@ -77,7 +77,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
// generate pilot // generate pilot
nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (int aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
int re_offset = ssb_offset; int re_offset = ssb_offset;
pil = (int16_t *)&pilot[0]; pil = (int16_t *)&pilot[0];
...@@ -197,6 +197,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, ...@@ -197,6 +197,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
int estimateSz,
struct complex16 dl_ch_estimates [][estimateSz],
struct complex16 dl_ch_estimates_time [][estimateSz],
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
uint8_t gNB_id, uint8_t gNB_id,
unsigned char Ns, unsigned char Ns,
...@@ -206,16 +209,14 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -206,16 +209,14 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
uint8_t n_hf) uint8_t n_hf)
{ {
int pilot[200] __attribute__((aligned(16))); int pilot[200] __attribute__((aligned(16)));
unsigned char aarx,p;
unsigned short k; unsigned short k;
unsigned int pilot_cnt; unsigned int pilot_cnt;
int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr; int16_t *pil,*rxF,*dl_ch,*fl,*fm,*fr;
int ch_offset,symbol_offset; int ch_offset,symbol_offset;
//int slot_pbch; //int slot_pbch;
uint8_t nushift; uint8_t nushift;
int **dl_ch_estimates =ue->pbch_vars[gNB_id]->dl_ch_estimates; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
nushift = ue->frame_parms.Nid_cell%4; nushift = ue->frame_parms.Nid_cell%4;
ue->frame_parms.nushift = nushift; ue->frame_parms.nushift = nushift;
...@@ -269,17 +270,57 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -269,17 +270,57 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
break; break;
} }
idft_size_idx_t idftsizeidx;
switch (ue->frame_parms.ofdm_symbol_size) {
case 128:
idftsizeidx = IDFT_128;
break;
case 256:
idftsizeidx = IDFT_256;
break;
case 512:
idftsizeidx = IDFT_512;
break;
case 1024:
idftsizeidx = IDFT_1024;
break;
case 1536:
idftsizeidx = IDFT_1536;
break;
case 2048:
idftsizeidx = IDFT_2048;
break;
case 3072:
idftsizeidx = IDFT_3072;
break;
case 4096:
idftsizeidx = IDFT_4096;
break;
default:
printf("unsupported ofdm symbol size \n");
assert(0);
}
// generate pilot // generate pilot
nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (int aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
int re_offset = ssb_offset; int re_offset = ssb_offset;
pil = (int16_t *)&pilot[0]; pil = (int16_t *)&pilot[0];
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); memset(dl_ch,0,sizeof(*dl_ch)*(ue->frame_parms.ofdm_symbol_size));
#ifdef DEBUG_CH #ifdef DEBUG_CH
printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
...@@ -289,6 +330,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -289,6 +330,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
#endif #endif
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
int16_t ch[2];
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
...@@ -402,62 +444,18 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -402,62 +444,18 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
} }
idft_size_idx_t idftsizeidx;
switch (ue->frame_parms.ofdm_symbol_size) {
case 128:
idftsizeidx = IDFT_128;
break;
case 256:
idftsizeidx = IDFT_256;
break;
case 512:
idftsizeidx = IDFT_512;
break;
case 1024:
idftsizeidx = IDFT_1024;
break;
case 1536:
idftsizeidx = IDFT_1536;
break;
case 2048:
idftsizeidx = IDFT_2048;
break;
case 3072:
idftsizeidx = IDFT_3072;
break;
case 4096:
idftsizeidx = IDFT_4096;
break;
default:
printf("unsupported ofdm symbol size \n");
assert(0);
}
if( dmrss == 2) // update time statistics for last PBCH symbol if( dmrss == 2) // update time statistics for last PBCH symbol
{ {
// do ifft of channel estimate // do ifft of channel estimate
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) LOG_D(PHY,"Channel Impulse Computation Slot %d Symbol %d ch_offset %d\n", Ns, symbol, ch_offset);
for (p=0; p<ue->frame_parms.nb_antenna_ports_gNB; p++) { idft(idftsizeidx,
if (ue->pbch_vars[gNB_id]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx]) (int16_t*) &dl_ch_estimates[aarx][ch_offset],
{ (int16_t*) dl_ch_estimates_time[aarx],
LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, proc->thread_id, symbol, ch_offset); 1);
idft(idftsizeidx, }
(int16_t*) &ue->pbch_vars[gNB_id]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx][ch_offset], }
(int16_t*) ue->pbch_vars[gNB_id]->dl_ch_estimates_time[(p*ue->frame_parms.nb_antennas_rx)+aarx],1); if (dmrss == 2)
} UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx);
}
}
}
return(0); return(0);
} }
......
...@@ -56,7 +56,10 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, ...@@ -56,7 +56,10 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
NR_UE_SSB *current_ssb); NR_UE_SSB *current_ssb);
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, int estimateSz,
struct complex16 dl_ch_estimates [][estimateSz],
struct complex16 dl_ch_estimates_time [][estimateSz],
UE_nr_rxtx_proc_t *proc,
uint8_t gNB_id, uint8_t gNB_id,
unsigned char Ns, unsigned char Ns,
unsigned char symbol, unsigned char symbol,
...@@ -79,6 +82,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -79,6 +82,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
module_id_t gNB_id, module_id_t gNB_id,
int estimateSz,
struct complex16 dl_ch_estimates_time [][estimateSz],
uint8_t frame, uint8_t frame,
uint8_t subframe, uint8_t subframe,
unsigned char clear, unsigned char clear,
......
...@@ -146,17 +146,23 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini ...@@ -146,17 +146,23 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
// computing channel estimation for selected best ssb // computing channel estimation for selected best ssb
const int estimateSz=7*2*frame_parms->ofdm_symbol_size;
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz];
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++) for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
nr_pbch_channel_estimation(ue,proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf); nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time,
proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
fapiPbch_t result;
ret = nr_rx_pbch(ue, ret = nr_rx_pbch(ue,
proc, proc,
ue->pbch_vars[0], estimateSz, dl_ch_estimates,
ue->pbch_vars[0],
frame_parms, frame_parms,
0, 0,
temp_ptr->i_ssb, temp_ptr->i_ssb,
SISO); SISO,
&result);
temp_ptr=temp_ptr->next_ssb; temp_ptr=temp_ptr->next_ssb;
} }
......
This diff is collapsed.
...@@ -1152,11 +1152,14 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin ...@@ -1152,11 +1152,14 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin
*/ */
int nr_rx_pbch( PHY_VARS_NR_UE *ue, int nr_rx_pbch( PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
const int estimateSz,
struct complex16 dl_ch_estimates[][estimateSz],
NR_UE_PBCH *nr_ue_pbch_vars, NR_UE_PBCH *nr_ue_pbch_vars,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id, uint8_t eNB_id,
uint8_t i_ssb, uint8_t i_ssb,
MIMO_mode_t mimo_mode); MIMO_mode_t mimo_mode,
fapiPbch_t* result);
int nr_pbch_detection(UE_nr_rxtx_proc_t *proc, int nr_pbch_detection(UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
......
...@@ -861,7 +861,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -861,7 +861,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
/* perform correlation of rx data and pss sequence ie it is a dot product */ /* perform correlation of rx data and pss sequence ie it is a dot product */
result = dot_product64((short*)primary_synchro_time_nr[pss_index], result = dot_product64((short*)primary_synchro_time_nr[pss_index],
(short*) &(rxdata[ar][n+is*frame_parms->samples_per_frame]), (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]),
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
shift); shift);
pss_corr_ue[pss_index][n] += abs64(result); pss_corr_ue[pss_index][n] += abs64(result);
......
This diff is collapsed.
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#ifndef __PHY_SCOPE_INTERFACE_H__ #ifndef __PHY_SCOPE_INTERFACE_H__
#define __PHY_SCOPE_INTERFACE_H__ #define __PHY_SCOPE_INTERFACE_H__
#include <openair1/PHY/defs_gNB.h> #include <openair1/PHY/defs_gNB.h>
#include <openair1/PHY/defs_nr_UE.h>
typedef struct { typedef struct {
int *argc; int *argc;
char **argv; char **argv;
...@@ -39,16 +41,25 @@ typedef struct { ...@@ -39,16 +41,25 @@ typedef struct {
PHY_VARS_gNB *gNB; PHY_VARS_gNB *gNB;
} scopeParms_t; } scopeParms_t;
enum UEdataType {
pbchDlChEstimateTime,
pbchLlr,
pbchRxdataF_comp,
UEdataTypeNumberOfItems
};
typedef struct scopeData_s { typedef struct scopeData_s {
int *argc; int *argc;
char **argv; char **argv;
RU_t *ru; RU_t *ru;
PHY_VARS_gNB *gNB; PHY_VARS_gNB *gNB;
int32_t * rxdataF; void *liveData;
void (*slotFunc)(int32_t* data, int slot, void * scopeData); void (*slotFunc)(int32_t *data, int slot, void *scopeData);
void (*copyData)(PHY_VARS_NR_UE *,enum UEdataType, void *data, int elementSz, int colSz, int lineSz);
} scopeData_t; } scopeData_t;
int load_softscope(char *exectype, void *initarg); int load_softscope(char *exectype, void *initarg);
int end_forms(void) ; int end_forms(void) ;
#define UEscopeCopy(ue, type, ...) if(ue->scopeData) ((scopeData_t*)ue->scopeData)->copyData(ue, type, ##__VA_ARGS__);
#endif #endif
...@@ -837,6 +837,7 @@ typedef struct { ...@@ -837,6 +837,7 @@ typedef struct {
/// RF and Interface devices per CC /// RF and Interface devices per CC
openair0_device rfdevice; openair0_device rfdevice;
void *scopeData;
} PHY_VARS_UE; } PHY_VARS_UE;
/* this structure is used to pass both UE phy vars and /* this structure is used to pass both UE phy vars and
......
...@@ -654,40 +654,6 @@ typedef struct { ...@@ -654,40 +654,6 @@ typedef struct {
#define PBCH_A 24 #define PBCH_A 24
typedef struct { typedef struct {
/// \brief Pointers to extracted PBCH symbols in frequency-domain.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..287] (hard coded)
int32_t **rxdataF_ext;
/// \brief Pointers to extracted and compensated PBCH symbols in frequency-domain.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..287] (hard coded)
int32_t **rxdataF_comp;
/// \brief Hold the channel estimates in frequency domain.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
int32_t **dl_ch_estimates;
/// \brief Pointers to downlink channel estimates in frequency-domain extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..287] (hard coded)
int32_t **dl_ch_estimates_ext;
/// \brief Hold the channel estimates in time domain (used for tracking).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: samples? [0..2*ofdm_symbol_size[
int32_t **dl_ch_estimates_time;
int log2_maxh;
uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
uint32_t pbch_a_interleaved;
uint32_t pbch_a_prime;
uint8_t pbch_e[NR_POLAR_PBCH_E];
int16_t demod_pbch_e[NR_POLAR_PBCH_E];
/// \brief Pointer to PBCH llrs.
/// - first index: ? [0..1919] (hard coded)
int16_t *llr;
/// \brief Pointer to PBCH decoded output.
/// - first index: ? [0..63] (hard coded)
uint8_t *decoded_output;
/// \brief PBCH additional bits
uint8_t xtra_byte;
/// \brief Total number of PDU errors. /// \brief Total number of PDU errors.
uint32_t pdu_errors; uint32_t pdu_errors;
/// \brief Total number of PDU errors 128 frames ago. /// \brief Total number of PDU errors 128 frames ago.
...@@ -695,7 +661,7 @@ typedef struct { ...@@ -695,7 +661,7 @@ typedef struct {
/// \brief Total number of consecutive PDU errors. /// \brief Total number of consecutive PDU errors.
uint32_t pdu_errors_conseq; uint32_t pdu_errors_conseq;
/// \brief FER (in percent) . /// \brief FER (in percent) .
uint32_t pdu_fer; //uint32_t pdu_fer;
} NR_UE_PBCH; } NR_UE_PBCH;
typedef struct { typedef struct {
...@@ -1073,7 +1039,7 @@ typedef struct { ...@@ -1073,7 +1039,7 @@ typedef struct {
#endif #endif
int dl_stats[5]; int dl_stats[5];
void* scopeData;
} PHY_VARS_NR_UE; } PHY_VARS_NR_UE;
/* this structure is used to pass both UE phy vars and /* this structure is used to pass both UE phy vars and
......
...@@ -82,6 +82,11 @@ ...@@ -82,6 +82,11 @@
#define DAQ_AGC_OFF 0 #define DAQ_AGC_OFF 0
typedef struct {
uint8_t decoded_output[64];
uint8_t xtra_byte;
} fapiPbch_t;
/** @addtogroup _PHY_PROCEDURES_ /** @addtogroup _PHY_PROCEDURES_
* @{ * @{
*/ */
...@@ -395,7 +400,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -395,7 +400,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1, NR_UE_DLSCH_t *dlsch1,
uint16_t n_pdus, uint16_t n_pdus,
UE_nr_rxtx_proc_t *proc); UE_nr_rxtx_proc_t *proc,
void * typeSpecific);
bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
......
...@@ -118,7 +118,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -118,7 +118,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1, NR_UE_DLSCH_t *dlsch1,
uint16_t n_pdus, uint16_t n_pdus,
UE_nr_rxtx_proc_t *proc ){ UE_nr_rxtx_proc_t *proc,
void * typeSpecific){
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
...@@ -162,8 +163,11 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -162,8 +163,11 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS / 8; rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS / 8;
break; break;
case FAPI_NR_RX_PDU_TYPE_SSB: case FAPI_NR_RX_PDU_TYPE_SSB:
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu=malloc(sizeof(((fapiPbch_t*)typeSpecific)->decoded_output));
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte; memcpy(rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu,
((fapiPbch_t*)typeSpecific)->decoded_output,
sizeof(((fapiPbch_t*)typeSpecific)->decoded_output));
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ((fapiPbch_t*)typeSpecific)->xtra_byte;
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_index = (frame_parms->ssb_index)&0x7; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_index = (frame_parms->ssb_index)&0x7;
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_length = frame_parms->Lmax; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_length = frame_parms->Lmax;
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell;
...@@ -353,10 +357,9 @@ void nr_ue_measurement_procedures(uint16_t l, ...@@ -353,10 +357,9 @@ void nr_ue_measurement_procedures(uint16_t l,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_OUT);
} }
void nr_ue_pbch_procedures(uint8_t gNB_id, static void nr_ue_pbch_procedures(uint8_t gNB_id,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,int estimateSz, struct complex16 dl_ch_estimates[][estimateSz])
uint8_t abstraction_flag)
{ {
int ret = 0; int ret = 0;
...@@ -368,13 +371,15 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, ...@@ -368,13 +371,15 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN);
LOG_D(PHY,"[UE %d] Frame %d Slot %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,nr_slot_rx,ue->frame_parms.Nid_cell,gNB_id); LOG_D(PHY,"[UE %d] Frame %d Slot %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,nr_slot_rx,ue->frame_parms.Nid_cell,gNB_id);
fapiPbch_t result;
ret = nr_rx_pbch(ue, proc, ret = nr_rx_pbch(ue, proc,
estimateSz, dl_ch_estimates,
ue->pbch_vars[gNB_id], ue->pbch_vars[gNB_id],
&ue->frame_parms, &ue->frame_parms,
gNB_id, gNB_id,
(ue->frame_parms.ssb_index)&7, (ue->frame_parms.ssb_index)&7,
SISO); SISO,
&result);
if (ret==0) { if (ret==0) {
...@@ -444,7 +449,6 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, ...@@ -444,7 +449,6 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
} }
if (frame_rx % 100 == 0) { if (frame_rx % 100 == 0) {
ue->pbch_vars[gNB_id]->pdu_fer = ue->pbch_vars[gNB_id]->pdu_errors - ue->pbch_vars[gNB_id]->pdu_errors_last;
ue->pbch_vars[gNB_id]->pdu_errors_last = ue->pbch_vars[gNB_id]->pdu_errors; ue->pbch_vars[gNB_id]->pdu_errors_last = ue->pbch_vars[gNB_id]->pdu_errors;
} }
...@@ -795,16 +799,16 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -795,16 +799,16 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
switch (pdsch) { switch (pdsch) {
case RA_PDSCH: case RA_PDSCH:
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id);
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus, proc); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus, proc, NULL);
ue->UE_mode[gNB_id] = RA_RESPONSE; ue->UE_mode[gNB_id] = RA_RESPONSE;
break; break;
case PDSCH: case PDSCH:
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id);
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus, proc); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus, proc, NULL);
break; break;
case SI_PDSCH: case SI_PDSCH:
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id);
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus, proc); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus, proc, NULL);
break; break;
default: default:
break; break;
...@@ -1400,6 +1404,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1400,6 +1404,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if (slot_ssb) { if (slot_ssb) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN);
LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
const int estimateSz=7*2*sizeof(int)*fp->ofdm_symbol_size;
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[fp->nb_antennas_rx][estimateSz];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][estimateSz];
for (int i=1; i<4; i++) { for (int i=1; i<4; i++) {
nr_slot_fep(ue, nr_slot_fep(ue,
...@@ -1409,7 +1416,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1409,7 +1416,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
nr_pbch_channel_estimation(ue,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit); nr_pbch_channel_estimation(ue, estimateSz, dl_ch_estimates, dl_ch_estimates_time,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit);
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
} }
...@@ -1418,13 +1425,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1418,13 +1425,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if ((ue->decode_MIB == 1) && slot_pbch) { if ((ue->decode_MIB == 1) && slot_pbch) {
LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
nr_ue_pbch_procedures(gNB_id, ue, proc, 0); nr_ue_pbch_procedures(gNB_id, ue, proc, estimateSz, dl_ch_estimates);
if (ue->no_timing_correction==0) { if (ue->no_timing_correction==0) {
LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_slot_rx, ue->no_timing_correction); LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_slot_rx, ue->no_timing_correction);
nr_adjust_synch_ue(fp, nr_adjust_synch_ue(fp,
ue, ue,
gNB_id, gNB_id,
estimateSz, dl_ch_estimates_time,
frame_rx, frame_rx,
nr_slot_rx, nr_slot_rx,
0, 0,
......
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); } int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); }
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
...@@ -35,4 +36,5 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -35,4 +36,5 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1, NR_UE_DLSCH_t *dlsch1,
uint16_t n_pdus, uint16_t n_pdus,
UE_nr_rxtx_proc_t *proc) {} UE_nr_rxtx_proc_t *proc,
void * typeSpecific ) {}
...@@ -438,6 +438,7 @@ int main(int argc, char **argv) ...@@ -438,6 +438,7 @@ int main(int argc, char **argv)
printf("Initializing gNodeB for mu %d, N_RB_DL %d\n",mu,N_RB_DL); printf("Initializing gNodeB for mu %d, N_RB_DL %d\n",mu,N_RB_DL);
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = malloc16_clear(sizeof(*(RC.gNB[0]))); RC.gNB[0] = malloc16_clear(sizeof(*(RC.gNB[0])));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
...@@ -531,13 +532,13 @@ int main(int argc, char **argv) ...@@ -531,13 +532,13 @@ int main(int argc, char **argv)
s_im = malloc(2*sizeof(double*)); s_im = malloc(2*sizeof(double*));
r_re = malloc(2*sizeof(double*)); r_re = malloc(2*sizeof(double*));
r_im = malloc(2*sizeof(double*)); r_im = malloc(2*sizeof(double*));
txdata = malloc(2*sizeof(int*)); txdata = calloc(2,sizeof(int*));
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
s_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); s_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
s_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); s_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
printf("Allocating %d samples for txdata\n",frame_length_complex_samples); printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
...@@ -550,6 +551,7 @@ int main(int argc, char **argv) ...@@ -550,6 +551,7 @@ int main(int argc, char **argv)
//configure UE //configure UE
UE = malloc16_clear(sizeof(*UE)); UE = malloc16_clear(sizeof(*UE));
memcpy(&UE->frame_parms,frame_parms,sizeof(UE->frame_parms)); memcpy(&UE->frame_parms,frame_parms,sizeof(UE->frame_parms));
//phy_init_nr_top(UE); //called from init_nr_ue_signal //phy_init_nr_top(UE); //called from init_nr_ue_signal
...@@ -722,6 +724,9 @@ int main(int argc, char **argv) ...@@ -722,6 +724,9 @@ int main(int argc, char **argv)
UE_nr_rxtx_proc_t proc={0}; UE_nr_rxtx_proc_t proc={0};
UE->rx_offset=0; UE->rx_offset=0;
uint8_t ssb_index = 0; uint8_t ssb_index = 0;
const int estimateSz=7*2*sizeof(int)*frame_parms->ofdm_symbol_size;
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz];
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index); UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index);
...@@ -732,17 +737,20 @@ int main(int argc, char **argv) ...@@ -732,17 +737,20 @@ int main(int argc, char **argv)
i%frame_parms->symbols_per_slot, i%frame_parms->symbols_per_slot,
ssb_slot); ssb_slot);
nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); nr_pbch_channel_estimation(UE,estimateSz, dl_ch_estimates, dl_ch_estimates_time, &proc,
0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
} }
fapiPbch_t result;
ret = nr_rx_pbch(UE, ret = nr_rx_pbch(UE,
&proc, &proc,
UE->pbch_vars[0], estimateSz, dl_ch_estimates,
UE->pbch_vars[0],
frame_parms, frame_parms,
0, 0,
ssb_index%8, ssb_index%8,
SISO); SISO,
&result);
if (ret==0) { if (ret==0) {
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically //UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
...@@ -751,9 +759,9 @@ int main(int argc, char **argv) ...@@ -751,9 +759,9 @@ int main(int argc, char **argv)
for (int i=0; i<8; i++) for (int i=0; i<8; i++)
gNB_xtra_byte |= ((gNB->pbch.pbch_a>>(31-i))&1)<<(7-i); gNB_xtra_byte |= ((gNB->pbch.pbch_a>>(31-i))&1)<<(7-i);
payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); payload_ret = (result.xtra_byte == gNB_xtra_byte);
for (i=0;i<3;i++){ for (i=0;i<3;i++){
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); payload_ret += (result.decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
} }
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte); //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
//printf("ret %d\n", payload_ret); //printf("ret %d\n", payload_ret);
......
...@@ -1175,7 +1175,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ ...@@ -1175,7 +1175,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_length, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_length,
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_start_subcarrier, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_start_subcarrier,
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB; (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB;
free((dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu);
break; break;
case FAPI_NR_RX_PDU_TYPE_SIB: case FAPI_NR_RX_PDU_TYPE_SIB:
ret_mask |= (handle_bcch_dlsch(dl_info->module_id, ret_mask |= (handle_bcch_dlsch(dl_info->module_id,
......
...@@ -905,30 +905,27 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( ...@@ -905,30 +905,27 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) { for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) {
// if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) { // if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) {
if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) { if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) {
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; pdusession_setup_t * tmp=&NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession];
// NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = 1; tmp->pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id;
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; // tmp->pdusession_id = 1;
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession]; tmp->nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos;
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.pdu_session_type = PDUSessionType_ipv4; tmp->gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession];
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.length = ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].length; tmp->gNB_addr.pdu_session_type = PDUSessionType_ipv4;
memcpy(NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.buffer, tmp->gNB_addr.length = ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].length;
ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, sizeof(uint8_t)*20); memcpy(tmp->gNB_addr.buffer,
for (qos_flow_index = 0; qos_flow_index < NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow; qos_flow_index++) { ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, tmp->gNB_addr.length);
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qfi = for (qos_flow_index = 0; qos_flow_index < tmp->nb_of_qos_flow; qos_flow_index++) {
tmp->associated_qos_flows[qos_flow_index].qfi =
ue_context_pP->ue_context.pduSession[pdusession].param.qos[qos_flow_index].qfi; ue_context_pP->ue_context.pduSession[pdusession].param.qos[qos_flow_index].qfi;
NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL; tmp->associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL;
} }
ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED;
LOG_I (NR_RRC,"gnb_gtp_addr (msg index %d, pdu_sessions index %d, status %d, xid %d): nb_of_pdusessions %d, pdusession_id %d, teid: %u, addr: %d.%d.%d.%d \n ", LOG_I (NR_RRC,"gnb_gtp_addr (msg index %d, pdu_sessions index %d, status %d, xid %d): nb_of_pdusessions %d, pdusession_id %d, teid: %u \n ",
pdu_sessions_done, pdusession, ue_context_pP->ue_context.pduSession[pdusession].status, xid, pdu_sessions_done, pdusession, ue_context_pP->ue_context.pduSession[pdusession].status, xid,
ue_context_pP->ue_context.nb_of_pdusessions, ue_context_pP->ue_context.nb_of_pdusessions,
NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].pdusession_id, NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].pdusession_id,
NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gtp_teid, NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gtp_teid);
NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[0],
NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[1],
NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[2],
NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[3]);
pdu_sessions_done++; pdu_sessions_done++;
} else if ((ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_NEW) || } else if ((ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_NEW) ||
(ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_ESTABLISHED)) { (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_ESTABLISHED)) {
......
...@@ -43,7 +43,7 @@ list_init (list_t * listP, char *nameP) ...@@ -43,7 +43,7 @@ list_init (list_t * listP, char *nameP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
if (nameP) { if (nameP) {
strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR ); strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR-1 );
listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string
} }
......
...@@ -53,7 +53,7 @@ list2_init (list2_t * listP, char *nameP) ...@@ -53,7 +53,7 @@ list2_init (list2_t * listP, char *nameP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
if (nameP) { if (nameP) {
strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR ); strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR-1 );
listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string
} }
......
...@@ -680,24 +680,20 @@ int ngap_gNB_initial_ctxt_resp( ...@@ -680,24 +680,20 @@ int ngap_gNB_initial_ctxt_resp(
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel;
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = (NGAP_GTPTunnel_t *)calloc(1, sizeof(NGAP_GTPTunnel_t)); pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = (NGAP_GTPTunnel_t *)calloc(1, sizeof(NGAP_GTPTunnel_t));
GTP_TEID_TO_ASN1(initial_ctxt_resp_p->pdusessions[i].gtp_teid, &pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->gTP_TEID); struct NGAP_GTPTunnel *tmp=pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel;
GTP_TEID_TO_ASN1(initial_ctxt_resp_p->pdusessions[i].gtp_teid, &tmp->gTP_TEID);
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf = malloc(initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); tmp->transportLayerAddress.buf = malloc(initial_ctxt_resp_p->pdusessions[i].gNB_addr.length);
memcpy(pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf, memcpy(tmp->transportLayerAddress.buf,
initial_ctxt_resp_p->pdusessions[i].gNB_addr.buffer, initial_ctxt_resp_p->pdusessions[i].gNB_addr.buffer,
initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); initial_ctxt_resp_p->pdusessions[i].gNB_addr.length);
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size = initial_ctxt_resp_p->pdusessions[i].gNB_addr.length; tmp->transportLayerAddress.size = initial_ctxt_resp_p->pdusessions[i].gNB_addr.length;
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.bits_unused = 0; tmp->transportLayerAddress.bits_unused = 0;
NGAP_DEBUG("initial_ctxt_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n", NGAP_DEBUG("initial_ctxt_resp_p: pdusession ID %ld\n",
item->pDUSessionID, item->pDUSessionID);
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[0],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[1],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[2],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[3],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size);
/* associatedQosFlowList. number of 1? */ /* associatedQosFlowList. number of 1? */
for(int j=0; j < initial_ctxt_resp_p->pdusessions[i].nb_of_qos_flow; j++) { for(int j=0; j < initial_ctxt_resp_p->pdusessions[i].nb_of_qos_flow; j++) {
...@@ -987,24 +983,25 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ...@@ -987,24 +983,25 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance,
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel;
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel =
calloc(1, sizeof(struct NGAP_GTPTunnel)); calloc(1, sizeof(struct NGAP_GTPTunnel));
struct NGAP_GTPTunnel *tmp=pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel;
GTP_TEID_TO_ASN1(pdusession_setup_resp_p->pdusessions[i].gtp_teid, &pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->gTP_TEID); GTP_TEID_TO_ASN1(pdusession_setup_resp_p->pdusessions[i].gtp_teid, &tmp->gTP_TEID);
if (pdusession_setup_resp_p->pdusessions[i].gNB_addr.length) {
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); tmp->transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length);
memcpy(pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf, memcpy(tmp->transportLayerAddress.buf,
pdusession_setup_resp_p->pdusessions[i].gNB_addr.buffer, pdusession_setup_resp_p->pdusessions[i].gNB_addr.buffer,
pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); pdusession_setup_resp_p->pdusessions[i].gNB_addr.length);
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length; tmp->transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length;
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.bits_unused = 0; tmp->transportLayerAddress.bits_unused = 0;
NGAP_DEBUG("pdusession_setup_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n", NGAP_DEBUG("pdusession_setup_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n",
item->pDUSessionID, item->pDUSessionID,
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[0], tmp->transportLayerAddress.buf[0],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[1], tmp->transportLayerAddress.buf[1],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[2], tmp->transportLayerAddress.buf[2],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[3], tmp->transportLayerAddress.buf[3],
pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size); tmp->transportLayerAddress.size);
}
/* associatedQosFlowList. number of 1? */ /* associatedQosFlowList. number of 1? */
for(int j=0; j < pdusession_setup_resp_p->pdusessions[i].nb_of_qos_flow; j++) { for(int j=0; j < pdusession_setup_resp_p->pdusessions[i].nb_of_qos_flow; j++) {
......
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