Commit 1f9cadc7 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'nr_pdcch_updates' of...

Merge branch 'nr_pdcch_updates' of https://gitlab.eurecom.fr/oai/openairinterface5g into nr_pdcch_updates
parents 9eecd211 7ee8af50
...@@ -67,7 +67,7 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m ...@@ -67,7 +67,7 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m
C = N_reg/(bsize*R); C = N_reg/(bsize*R);
} }
tmp = L * (( Y + (m*N_cce)/(L*M_s_max) + n_CI ) % (N_cce/L)); tmp = L * (( Y + (m*N_cce)/(L*M_s_max) + n_CI ) % CEILIDIV(N_cce,L));
LOG_I(PHY, "CCE list generation for candidate %d: bundle size %d ilv size %d tmp %d\n", m, bsize, R, tmp); LOG_I(PHY, "CCE list generation for candidate %d: bundle size %d ilv size %d tmp %d\n", m, bsize, R, tmp);
for (uint8_t cce_idx=0; cce_idx<L; cce_idx++) { for (uint8_t cce_idx=0; cce_idx<L; cce_idx++) {
......
...@@ -708,7 +708,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -708,7 +708,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
printf("xtra_byte %x payload %x\n", xtra_byte, payload); printf("xtra_byte %x payload %x\n", xtra_byte, payload);
for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++){ for (int i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++){
// printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]); // printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]);
printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]); printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]);
} }
......
...@@ -803,25 +803,47 @@ static inline int64_t abs64(int64_t x) ...@@ -803,25 +803,47 @@ static inline int64_t abs64(int64_t x)
#define DOT_PRODUCT_SCALING_SHIFT (17) #define DOT_PRODUCT_SCALING_SHIFT (17)
int max3(int64_t a, int64_t b, int64_t c) {
if (a>b) {
if (a>c) {
return(0);
}
else {
return(2);
}
}
else {
if (b>c) {
return(1);
}
else {
return(2);
}
}
}
int pss_search_time_nr(int **rxdata, ///rx data in time domain int pss_search_time_nr(int **rxdata, ///rx data in time domain
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
int *eNB_id) int *eNB_id)
{ {
unsigned int n, ar, peak_position, pss_source; uint8_t L_max = 4;
int64_t peak_value; unsigned int m, n, ar, n_peaks=0;
unsigned int peak_position[3*L_max], pss_source[3*L_max];
int64_t peak_value, threshold;
int64_t result; int64_t result;
int64_t avg[NUMBER_PSS_SEQUENCE]; int64_t avg[NUMBER_PSS_SEQUENCE];
uint8_t found_peak=0;
unsigned int length = (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe); /* 1 frame for now, it should be 2 TODO_NR */ unsigned int length = (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe); /* 1 frame for now, it should be 2 TODO_NR */
AssertFatal(length>0,"illegal length %d\n",length); AssertFatal(length>0,"illegal length %d\n",length);
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) AssertFatal(pss_corr_ue[i] != NULL,"pss_corr_ue[%d] not yet allocated! Exiting.\n", i); for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) AssertFatal(pss_corr_ue[i] != NULL,"pss_corr_ue[%d] not yet allocated! Exiting.\n", i);
for (int i=0;i<4;i++) {
peak_value = 0; peak_position[i] = length; //max possible value
peak_position = 0; pss_source[i] = 0;
pss_source = 0; }
int maxval=0; int maxval=0;
for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) {
...@@ -844,10 +866,10 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -844,10 +866,10 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
memset(pss_corr_ue[pss_index],0,length*sizeof(int64_t)); memset(pss_corr_ue[pss_index],0,length*sizeof(int64_t));
} }
for (n=0; n < length; n+=4) { //
for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) { for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) {
for (n=0; n < length; n+=4) { //
if ( n < (length - frame_parms->ofdm_symbol_size)) { if ( n < (length - frame_parms->ofdm_symbol_size)) {
/* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */ /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */
...@@ -870,27 +892,40 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -870,27 +892,40 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
/* calculate the absolute value of sync_corr[n] */ /* calculate the absolute value of sync_corr[n] */
avg[pss_index]+=pss_corr_ue[pss_index][n]; avg[pss_index]+=pss_corr_ue[pss_index][n];
if (pss_corr_ue[pss_index][n] > peak_value) {
peak_value = pss_corr_ue[pss_index][n];
peak_position = n;
pss_source = pss_index;
#ifdef DEBUG_PSS_NR
printf("pss_index %d: n %6d peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[pss_index][n]);
#endif
}
} }
avg[pss_index]/=(length/4);
} }
for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) avg[pss_index]/=(length/4); threshold = 10*avg[max3(avg[0],avg[1],avg[2])];
peak_value = threshold;
*eNB_id = pss_source; for (n=0; n < length; n+=4) {
LOG_I(PHY,"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB\n", pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source])); m = max3(pss_corr_ue[0][n],pss_corr_ue[1][n],pss_corr_ue[2][n]);
if (pss_corr_ue[m][n] > peak_value) {
peak_value = pss_corr_ue[m][n];
peak_position[n_peaks] = n;
pss_source[n_peaks] = m;
found_peak = 1;
}
if ((peak_position[n_peaks]+4*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)<n) &&
(found_peak==1)) {
//#ifdef DEBUG_PSS_NR
printf("peak %d found at pss_index %d, n %6d, peak_value %15llu\n", n_peaks, pss_source[n_peaks], peak_position[n_peaks], (unsigned long long)pss_corr_ue[ pss_source[n_peaks]][peak_position[n_peaks]]);
//#endif
peak_value = threshold;
found_peak = 0;
n_peaks++;
//if (n_peaks==L_max) break;
}
}
if (peak_value < 5*avg[pss_source]) *eNB_id = pss_source[0];
return(-1);
//LOG_I(PHY,"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB\n", pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]));
#ifdef DBG_PSS_NR #ifdef DBG_PSS_NR
...@@ -907,6 +942,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -907,6 +942,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
#endif #endif
return(peak_position); return(peak_position[0]);
} }
...@@ -322,9 +322,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( ...@@ -322,9 +322,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
(const void *)bufferP, (const void *)bufferP,
buffer_len ); buffer_len );
if(bcch_message->message.choice.mib->systemFrameNumber.buf != 0){
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
printf("NR_CellGroupConfig decode error\n"); printf("NR_BCCH_BCH decode error\n");
for (i=0; i<buffer_len; i++){ for (i=0; i<buffer_len; i++){
printf("%02x ",bufferP[i]); printf("%02x ",bufferP[i]);
} }
...@@ -333,7 +332,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( ...@@ -333,7 +332,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 ); SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
return -1; return -1;
} }
else {
// link to rrc instance // link to rrc instance
mib = bcch_message->message.choice.mib; mib = bcch_message->message.choice.mib;
//memcpy( (void *)mib, //memcpy( (void *)mib,
......
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