Merge branch 'integration_2023_w23' into 'develop'

integration_2023_w23

See merge request oai/openairinterface5g!2156

* !2115 Enable 100MHz on USRP X310
* !2118 Cleanup code in PSS/SSS procedures
* !2123 improving NR UE RRC handling of timers and constants
* !2150 Fix type0_pdcch_ss_mux_pattern for FR2
* !2153 Fix UE DURATION_RX_TO_TX assertions
* !2155 chore(ci): saw a little missing version on HTML report
* !2117 remove some dead code
This commit is contained in:
Robert Schmidt
2023-06-10 10:05:17 +00:00
54 changed files with 1317 additions and 848 deletions
+1 -1
View File
@@ -1457,7 +1457,7 @@ set(NR_L2_SRC_UE
${NR_RRC_DIR}/nr_rrc_config.c
${NR_UE_RRC_DIR}/rrc_UE.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NR_RRC_DIR}/nr_rrc_config.c
${NR_UE_RRC_DIR}/rrc_timers_and_constants.c
)
set (MAC_SRC
+1 -1
View File
@@ -163,7 +163,7 @@ class StaticCodeAnalysis():
xmlStart = False
with open('./cppcheck-'+ variant + '.txt', 'r') as logfile:
for line in logfile:
ret = re.search('Unpacking cppcheck \((?P<version>[0-9\.]+)', str(line))
ret = re.search('cppcheck version="(?P<version>[0-9\.]+)"', str(line))
if ret is not None:
CCR.versions[vId] = ret.group('version')
if re.search('RUN cat cmake_targets/log/cppcheck.xml', str(line)) is not None:
+16 -13
View File
@@ -66,24 +66,27 @@ static telnetsrv_params_t telnetparams;
#define TELNETSRV_OPTNAME_STATICMOD "staticmod"
#define TELNETSRV_OPTNAME_SHRMOD "shrmod"
// clang-format off
paramdef_t telnetoptions[] = {
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* configuration parameters for telnet utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
{"listenaddr", "<listen ip address>\n", 0, uptr : &telnetparams.listenaddr, defstrval : "0.0.0.0", TYPE_IPV4ADDR, 0},
{"listenport", "<local port>\n", 0, uptr : &(telnetparams.listenport), defuintval : 9090, TYPE_UINT, 0},
{"listenstdin", "enable input from stdin\n", PARAMFLAG_BOOL, uptr : &(telnetparams.listenstdin), defuintval : 0, TYPE_UINT, 0},
{"priority", "<scheduling policy (0-99)\n", 0, iptr : &telnetparams.priority, defuintval : 0, TYPE_INT, 0},
{"debug", "<debug level>\n", 0, uptr : NULL, defuintval : 0, TYPE_UINT, 0},
{"loopcount", "<loop command iterations>\n", 0, uptr : &(telnetparams.loopcount), defuintval : 10, TYPE_UINT, 0},
{"loopdelay", "<loop command delay (ms)>\n", 0, uptr : &(telnetparams.loopdelay), defuintval : 5000, TYPE_UINT, 0},
{"histfile", "<history file name>\n", PARAMFLAG_NOFREE, strptr : &(telnetparams.histfile), defstrval : "oaitelnet.history", TYPE_STRING, 0},
{"histsize", "<history sizes>\n", 0, iptr : &(telnetparams.histsize), defuintval : 50, TYPE_INT, 0},
{"logfile", "log file when redirecting", PARAMFLAG_NOFREE, strptr : &(telnetparams.logfile), defstrval : "oaisoftmodem.log", TYPE_STRING, 0},
{"phypbsize", "<phy dump buff size (bytes)>\n", 0, uptr : &(telnetparams.phyprntbuff_size), defuintval : 65000, TYPE_UINT, 0},
{TELNETSRV_OPTNAME_STATICMOD, "<static modules selection>\n", 0, strlistptr : NULL, defstrlistval : telnet_defstatmod, TYPE_STRINGLIST, (sizeof(telnet_defstatmod) / sizeof(char *))},
{TELNETSRV_OPTNAME_SHRMOD, "<dynamic modules selection>\n", 0, strlistptr : NULL, defstrlistval : NULL, TYPE_STRINGLIST, 0}};
{"listenaddr", "<listen ip address>\n", 0, .uptr = &telnetparams.listenaddr, .defstrval = "0.0.0.0", TYPE_IPV4ADDR, 0},
{"listenport", "<local port>\n", 0, .uptr = &telnetparams.listenport, .defuintval = 9090, TYPE_UINT, 0},
{"listenstdin", "enable input from stdin\n", PARAMFLAG_BOOL, .uptr = &telnetparams.listenstdin, .defuintval = 0, TYPE_UINT, 0},
{"priority", "<scheduling policy (0-99)\n", 0, .iptr = &telnetparams.priority, .defuintval = 0, TYPE_INT, 0},
{"debug", "<debug level>\n", 0, .uptr = NULL, .defuintval = 0, TYPE_UINT, 0},
{"loopcount", "<loop command iterations>\n", 0, .uptr = &telnetparams.loopcount, .defuintval = 10, TYPE_UINT, 0},
{"loopdelay", "<loop command delay (ms)>\n", 0, .uptr = &telnetparams.loopdelay, .defuintval = 5000, TYPE_UINT, 0},
{"histfile", "<history file name>\n", PARAMFLAG_NOFREE, .strptr = &telnetparams.histfile, .defstrval = "oaitelnet.history", TYPE_STRING, 0},
{"histsize", "<history sizes>\n", 0, .iptr = &telnetparams.histsize, .defuintval = 50, TYPE_INT, 0},
{"logfile", "log file when redirecting", PARAMFLAG_NOFREE, .strptr = &telnetparams.logfile, .defstrval = "oaisoftmodem.log", TYPE_STRING, 0},
{"phypbsize", "<phy dump buff size (bytes)>\n", 0, .uptr = &telnetparams.phyprntbuff_size, .defuintval = 65000, TYPE_UINT, 0},
{TELNETSRV_OPTNAME_STATICMOD, "<static modules selection>\n", 0, .strlistptr = NULL, .defstrlistval = telnet_defstatmod, TYPE_STRINGLIST, (sizeof(telnet_defstatmod) / sizeof(char *))},
{TELNETSRV_OPTNAME_SHRMOD, "<dynamic modules selection>\n", 0, .strlistptr = NULL, .defstrlistval = NULL, TYPE_STRINGLIST, 0}
};
// clang-format on
int get_phybsize(void) {
return telnetparams.phyprntbuff_size;
+1 -1
View File
@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Wno-unused-function --cmake-opt -DCMAKE_CXX_FLAGS=-Wno-unused-function
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP --verbose-ci --noavx512 -c
+1 -1
View File
@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror --cmake-opt -DCMAKE_C_FLAGS=-Wno-unused-function --cmake-opt -DCMAKE_CXX_FLAGS=-Wno-unused-function
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
+1 -1
View File
@@ -40,4 +40,4 @@ RUN /bin/sh oaienv && \
mkdir -p log && \
export CC=/usr/bin/clang && \
export CXX=/usr/bin/clang++ && \
./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror --cmake-opt -DCMAKE_C_FLAGS=-Wno-unused-function --cmake-opt -DCMAKE_CXX_FLAGS=-Wno-unused-function
./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
+1 -1
View File
@@ -38,7 +38,7 @@ RUN dnf install -y libasan libubsan
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --phy_simulators --ninja --verbose-ci --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror --cmake-opt -DCMAKE_C_FLAGS=-Wno-unused-function --cmake-opt -DCMAKE_CXX_FLAGS=-Wno-unused-function
./build_oai --phy_simulators --ninja --verbose-ci --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
#start from scratch for target executable
FROM registry.access.redhat.com/ubi9/ubi:latest as oai-physim
-2
View File
@@ -212,7 +212,6 @@ void fh_if4p5_south_in(RU_t *ru,
uint16_t packet_type;
uint32_t symbol_number=0;
uint32_t symbol_mask_full;
int pultick_received=0;
if ((fp->frame_type == TDD) && (subframe_select(fp,*subframe)==SF_S))
symbol_mask_full = (1<<fp->ul_symbols_in_S_subframe)-1;
@@ -232,7 +231,6 @@ void fh_if4p5_south_in(RU_t *ru,
if (packet_type == IF4p5_PULFFT) proc->symbol_mask[sf] = proc->symbol_mask[sf] | (1<<symbol_number);
else if (packet_type == IF4p5_PULTICK) {
proc->symbol_mask[sf] = 0xffff;
pultick_received++;
/*
if ((proc->first_rx==0) && (f!=*frame)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received frame %d != expected %d (RU %d) \n",f,*frame, ru->idx);
else if ((proc->first_rx==0) && (sf!=*subframe)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received subframe %d != expected %d (first_rx %d)\n",sf,*subframe,proc->first_rx);
+2
View File
@@ -938,6 +938,8 @@ void *UE_thread(void *arg) {
timing_advance = UE->timing_advance;
}
nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_tx, curMsg.proc.nr_slot_tx);
// Start TX slot processing here. It runs in parallel with RX slot processing
notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, &txFifo, processSlotTX);
nr_rxtx_thread_data_t *curMsgTx = (nr_rxtx_thread_data_t *) NotifiedFifoData(newElt);
-4
View File
@@ -214,10 +214,6 @@ int create_tasks_nrue(uint32_t ue_nb) {
itti_wait_ready(0);
// Thread to update the RRC timers (in msec) at UE
pthread_t timers_update;
threadCreate(&timers_update, nr_rrc_timers_update, NULL, "nr_rrc_timer_update", -1, OAI_PRIORITY_RT_LOW);
return 0;
}
+2 -2
View File
@@ -11,7 +11,7 @@ static inline void set_parallel_conf(char *parallel_conf) {
{NULL,-1}
};
thread_struct.parallel_conf = (PARALLEL_CONF_t)map_str_to_int(config, parallel_conf);
if (thread_struct.parallel_conf == -1 ) {
if (thread_struct.parallel_conf == (unsigned int)-1) {
LOG_E(ENB_APP,"Impossible value: %s\n", parallel_conf);
thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
}
@@ -24,7 +24,7 @@ static inline void set_worker_conf(char *worker_conf) {
{NULL, -1}
};
thread_struct.worker_conf = (WORKER_CONF_t)map_str_to_int(config, worker_conf);
if (thread_struct.worker_conf == -1 ) {
if (thread_struct.worker_conf == (unsigned int)-1) {
LOG_E(ENB_APP,"Impossible value: %s\n", worker_conf);
thread_struct.worker_conf = WORKER_DISABLE ;
}
-3
View File
@@ -793,7 +793,6 @@ void lte_rate_matching_cc_rx(uint32_t RCC,
int8_t *soft_input) {
uint32_t ind=0,k;
uint16_t Kw = 3*(RCC<<5);
uint32_t acc=1;
int16_t w16[Kw];
#ifdef RM_DEBUG_CC
uint32_t nulled=0;
@@ -827,13 +826,11 @@ void lte_rate_matching_cc_rx(uint32_t RCC,
if (ind==Kw) {
ind=0;
acc++;
}
}
// rescale
for (ind=0; ind<Kw; ind++) {
// w16[ind]=(w16[ind]/acc);
if (w16[ind]>7)
w[ind]=7;
else if (w16[ind]<-8)
@@ -371,8 +371,8 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
// rate matching table
int iplast=polarParams->rate_matching_pattern[0];
int ccnt=0;
int groupcnt=0;
#ifdef DEBUG_POLAR_ENCODER
int groupcnt=0;
int firstingroup_out=0;
int firstingroup_in=iplast;
#endif
@@ -386,8 +386,8 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
#endif
if ((ip - iplast) == 1) ccnt++;
else {
groupcnt++;
#ifdef DEBUG_POLAR_ENCODER
groupcnt++;
printf("group %d (size %d): (%d:%d) => (%d:%d)\n",groupcnt,ccnt+1,
firstingroup_in,firstingroup_in+ccnt,
firstingroup_out,firstingroup_out+ccnt);
@@ -404,7 +404,9 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
iplast=ip;
}
#ifdef DEBUG_POLAR_ENCODER
groupcnt++;
#endif
if ((ccnt+1)<mingroupsize) mingroupsize=ccnt+1;
#ifdef DEBUG_POLAR_ENCODER
printf("group %d (size %d): (%d:%d) => (%d:%d)\n",groupcnt,ccnt+1,
+3 -2
View File
@@ -572,16 +572,17 @@ void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PR
harq_list[j][i].c = malloc16(a_segments*sizeof(uint8_t *));
harq_list[j][i].d = malloc16(a_segments*sizeof(int16_t *));
const int sz=5*8448*sizeof(int16_t);
for (int r=0; r<a_segments; r++) {
harq_list[j][i].c[r] = malloc16(1056);
harq_list[j][i].d[r] = malloc16(5*8448*sizeof(int16_t));
harq_list[j][i].d[r] = malloc16(sz);
if (harq_list[j][i].c[r])
memset(harq_list[j][i].c[r],0,1056);
else
AssertFatal(true, "Unable to reset harq memory \"c\"\n");
if (harq_list[j][i].d[r])
memset(harq_list[j][i].d[r],0,5*8448);
memset(harq_list[j][i].d[r], 0, sz);
else
AssertFatal(true, "Unable to reset harq memory \"d\"\n");
}
@@ -34,8 +34,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
unsigned char p,
unsigned char symbol)
{
unsigned short rb,nb_rb=0;
unsigned short rb;
unsigned char aarx,l,lprime,nsymb,skip_half=0,sss_symb,pss_symb=0,rb_alloc_ind,harq_pid,uespec_pilots=0;
int beamforming_mode, ch_offset;
uint8_t subframe;
@@ -241,7 +240,6 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c): transmission mode not supported.\n");
}
}
nb_rb++;
}
rxF+=24;
@@ -395,8 +393,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
} else {
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n");
}
}
nb_rb++;
}
}
rxF+=24;
@@ -645,7 +642,6 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n");
}
}
nb_rb++;
}
rxF+=24;
+2 -25
View File
@@ -512,9 +512,7 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
uint32_t high_speed_flag,
LTE_DL_FRAME_PARMS *frame_parms)
{
uint16_t rb,nb_rb=0;
uint16_t rb;
uint8_t i,j,aarx;
int32_t *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext;
@@ -558,7 +556,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
}
nb_rb++;
dl_ch0_ext+=12;
rxF_ext+=12;
@@ -579,7 +576,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
rxF_ext+=8;
@@ -596,7 +592,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
for (i=0; i<12; i++)
rxF_ext[i]=rxF[i];
nb_rb++;
dl_ch0_ext+=12;
rxF_ext+=12;
@@ -617,7 +612,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
rxF_ext+=8;
@@ -652,8 +646,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
rxF_ext+=8;
dl_ch0+=12;
@@ -672,8 +664,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
rxF_ext[i]=rxF[(1+i-6)];
}
nb_rb++;
dl_ch0_ext+=12;
rxF_ext+=12;
dl_ch0+=12;
@@ -688,7 +678,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
for (i=0; i<12; i++)
rxF_ext[i]=rxF[i];
nb_rb++;
dl_ch0_ext+=12;
rxF_ext+=12;
@@ -708,7 +697,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
rxF_ext+=8;
@@ -728,9 +716,7 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
uint32_t high_speed_flag,
LTE_DL_FRAME_PARMS *frame_parms)
{
uint16_t rb,nb_rb=0;
uint16_t rb;
uint8_t i,aarx,j;
int32_t *dl_ch0,*dl_ch0_ext,*dl_ch1,*dl_ch1_ext,*rxF,*rxF_ext;
uint8_t symbol_mod;
@@ -785,7 +771,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
// ((int16_t*)&rxF[i<<1])[0],((int16_t*)&rxF[i<<1])[0]);
}
nb_rb++;
dl_ch0_ext+=12;
dl_ch1_ext+=12;
rxF_ext+=12;
@@ -804,7 +789,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
dl_ch1_ext+=8;
rxF_ext+=8;
@@ -827,7 +811,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
for (i=0; i<12; i++)
rxF_ext[i]=rxF[i];
nb_rb++;
dl_ch0_ext+=12;
dl_ch1_ext+=12;
rxF_ext+=12;
@@ -852,7 +835,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
dl_ch1_ext+=8;
rxF_ext+=8;
@@ -881,7 +863,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
rxF_ext[i]=rxF[(1+i)];
}
nb_rb++;
dl_ch0_ext+=12;
dl_ch1_ext+=12;
rxF_ext+=12;
@@ -915,8 +896,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
dl_ch1_ext+=8;
rxF_ext+=8;
@@ -936,7 +915,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
for (i=0; i<12; i++)
rxF_ext[i]=rxF[i];
nb_rb++;
dl_ch0_ext+=12;
dl_ch1_ext+=12;
rxF_ext+=12;
@@ -959,7 +937,6 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF,
}
}
nb_rb++;
dl_ch0_ext+=8;
dl_ch1_ext+=8;
rxF_ext+=8;
@@ -68,6 +68,9 @@ void freq2time(uint16_t ofdm_symbol_size,
case 4096:
idft(IDFT_4096, freq_signal, time_signal, 1);
break;
case 6144:
idft(IDFT_6144, freq_signal, time_signal, 1);
break;
case 8192:
idft(IDFT_8192, freq_signal, time_signal, 1);
break;
+1 -52
View File
@@ -37,12 +37,6 @@
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
#ifdef DEFINE_VARIABLES_PSS_NR_H
#define EXTERN
#else
#define EXTERN extern
#endif
/************** CODE GENERATION ***********************************/
//#define PSS_DECIMATOR /* decimation of sample is done between time correlation */
@@ -81,55 +75,10 @@
#define SYNC_TMP_SIZE (NB_ANTENNAS_RX*SYNCHRO_FFT_SIZE_MAX*IQ_SIZE) /* to be aligned with existing lte synchro */
#define SYNCF_TMP_SIZE (SYNCHRO_FFT_SIZE_MAX*IQ_SIZE)
/************* STRUCTURES *****************************************/
/************** VARIABLES *****************************************/
//#define STATIC_SYNC_BUFFER
#ifdef STATIC_SYNC_BUFFER
/* buffer defined in file lte_sync_time */
EXTERN int16_t synchro_tmp[SYNC_TMP_SIZE] __attribute__((aligned(32)));
EXTERN int16_t synchroF_tmp[SYNCF_TMP_SIZE] __attribute__((aligned(32)));
#else
EXTERN int16_t *synchro_tmp;
EXTERN int16_t *synchroF_tmp;
#endif
EXTERN int16_t *primary_synchro_nr[NUMBER_PSS_SEQUENCE]
#ifdef INIT_VARIABLES_PSS_NR_H
= { NULL, NULL, NULL}
#endif
;
EXTERN int16_t *primary_synchro_nr2[NUMBER_PSS_SEQUENCE]
#ifdef INIT_VARIABLES_PSS_NR_H
= { NULL, NULL, NULL}
#endif
;
EXTERN int16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE]
#ifdef INIT_VARIABLES_PSS_NR_H
= { NULL, NULL, NULL}
#endif
;
/* profiling structure */
EXTERN time_stats_t generic_time[TIME_LAST];
#ifndef DEFINE_HEADER_ONLY
/************** FUNCTION ******************************************/
void init_context_synchro_nr(NR_DL_FRAME_PARMS *frame_parms_ue);
void free_context_synchro_nr(void);
void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue);
void free_context_pss_nr(void);
int set_pss_nr(int ofdm_symbol_size);
int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change);
int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is);
#endif
#undef EXTERN
int16_t *get_primary_synchro_nr2(const int nid2);
#endif /* PSS_NR_H */
+1 -1
View File
@@ -67,7 +67,7 @@
#define NB_SYMBOLS_PBCH (3)
#define NR_N_SYMBOLS_SSB (4)
#define IQ_SIZE (sizeof(int16_t) * 2) /* I and Q are alternatively stored into buffers */
#define IQ_SIZE sizeof(c16_t) /* I and Q are alternatively stored into buffers */
#define N_SYMB_SLOT (14)
/* SS/PBCH parameters : see from TS 38.211 table 7.4.3.1-1: Resources within an SS/PBCH block for PSS... */
+7 -36
View File
@@ -38,13 +38,6 @@
#include "pss_nr.h"
#ifdef DEFINE_VARIABLES_SSS_NR_H
#define EXTERN
#define INIT_VARIABLES_SSS_NR_H
#else
#define EXTERN extern
#endif
/************** DEFINE ********************************************/
#define SAMPLES_IQ (sizeof(int16_t)*2)
@@ -64,26 +57,7 @@
/************** VARIABLES *****************************************/
#define PHASE_HYPOTHESIS_NUMBER (16)
#define INDEX_NO_PHASE_DIFFERENCE (3) /* this is for no phase shift case */
EXTERN const int16_t phase_re_nr[PHASE_HYPOTHESIS_NUMBER]
#ifdef INIT_VARIABLES_SSS_NR_H
// -pi/3 ---- pi/3
= {16384,20173,23571,26509,28932,30791,32051,32687,32687,32051,30791,
28932,26509,23571,20173,16384}
#endif
;
EXTERN const int16_t phase_im_nr[PHASE_HYPOTHESIS_NUMBER]
#ifdef INIT_VARIABLES_SSS_NR_H
// -pi/3 ---- pi/3
= {-28377,-25821,-22762,-19260,-15383,-11207,-6813,-2286,2286,6813,11207,
15383,19260,22762,25821,28377}
#endif
;
EXTERN int16_t d_sss[N_ID_2_NUMBER][N_ID_1_NUMBER][LENGTH_SSS_NR];
#define INDEX_NO_PHASE_DIFFERENCE (3) /* this is for no phase shift case */
/************** FUNCTION ******************************************/
void init_context_sss_nr(int amp);
@@ -92,14 +66,11 @@ void free_context_sss_nr(void);
void insert_sss_nr(int16_t *sss_time,
NR_DL_FRAME_PARMS *frame_parms);
int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR]);
int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max, int *freq_offset_sss, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
#undef INIT_VARIABLES_SSS_NR_H
#undef EXTERN
int rx_sss_nr(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int32_t *tot_metric,
uint8_t *phase_max,
int *freq_offset_sss,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
#endif /* SSS_NR_H */
+6
View File
@@ -344,6 +344,12 @@ void rx_nr_prach_ru(RU_t *ru,
dftlen <<= 2;
break;
case 184320:
// 100 MHz @ 184.32 Ms/s
Ncp = Ncp*6;
dftlen = dftlen*6;
break;
default:
AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu);
}
+3 -2
View File
@@ -22,7 +22,8 @@
#include "nr_transport_common_proto.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#define DEBUG_SCRAMBLING(a)
//#define DEBUG_SCRAMBLING(a) a
void nr_codeword_scrambling(uint8_t *in,
uint32_t size,
uint8_t q,
@@ -39,7 +40,7 @@ void nr_codeword_scrambling(uint8_t *in,
__m256i c = ((__m256i*)in)[i];
uint32_t in32 = simde_mm256_movemask_epi8(simde_mm256_slli_epi16(c,7));
out[i]=(in32^s);
LOG_D(PHY,"in[%d] %x => %x\n",i,in32,out[i]);
DEBUG_SCRAMBLING(LOG_D(PHY, "in[%d] %x => %x\n", i, in32, out[i]));
s=lte_gold_generic(&x1, &x2, 0);
}
}
@@ -483,6 +483,11 @@ int nr_prs_channel_estimation(uint8_t rsc_id,
case 4096:
idftsizeidx = IDFT_4096;
break;
case 6144:
idftsizeidx = IDFT_6144;
break;
// 16x IDFT oversampling
case 8192:
idftsizeidx = IDFT_8192;
@@ -833,7 +838,11 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
case 4096:
idftsizeidx = IDFT_4096;
break;
case 6144:
idftsizeidx = IDFT_6144;
break;
default:
printf("unsupported ofdm symbol size \n");
assert(0);
+1 -3
View File
@@ -364,7 +364,7 @@ void nr_pdcch_extract_rbs_single(uint32_t rxdataF_sz,
#define NBR_RE_PER_RB_WITH_DMRS 12
// after removing the 3 DMRS RE, the RB contains 9 RE with PDCCH
#define NBR_RE_PER_RB_WITHOUT_DMRS 9
uint16_t c_rb, nb_rb = 0;
uint16_t c_rb;
//uint8_t rb_count_bit;
uint8_t i, j, aarx;
int32_t *dl_ch0, *dl_ch0_ext, *rxF, *rxF_ext;
@@ -484,7 +484,6 @@ void nr_pdcch_extract_rbs_single(uint32_t rxdataF_sz,
}
}
nb_rb++;
dl_ch0_ext += NBR_RE_PER_RB_WITHOUT_DMRS;
rxF_ext += NBR_RE_PER_RB_WITHOUT_DMRS;
dl_ch0 += 12;
@@ -506,7 +505,6 @@ void nr_pdcch_extract_rbs_single(uint32_t rxdataF_sz,
}
}
nb_rb++;
dl_ch0_ext += NBR_RE_PER_RB_WITHOUT_DMRS;
rxF_ext += NBR_RE_PER_RB_WITHOUT_DMRS;
dl_ch0 += 12;
@@ -254,7 +254,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
ue->ssb_offset = sync_pos - fp->nb_prefix_samples;
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
LOG_I(PHY, "[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos, ue->common_vars.nid2);
LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
#endif
@@ -453,7 +453,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
} else {
#ifdef DEBUG_INITIAL_SYNC
LOG_I(PHY,"[UE%d] Initial sync : PBCH not ok\n",ue->Mod_id);
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",ue->Mod_id,sync_pos,ue->common_vars.eNb_id);
LOG_I(PHY, "[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos, ue->common_vars.nid2);
LOG_I(PHY,"[UE%d] Initial sync : Estimated Nid_cell %d, Frame_type %d\n",ue->Mod_id,
frame_parms->Nid_cell,frame_parms->frame_type);
#endif
+6
View File
@@ -362,6 +362,12 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t
dftlen <<= 2;
break;
case 184320:
// 100 MHz @ 184.32 Ms/s
Ncp = Ncp*6;
dftlen = dftlen*6;
break;
default:
AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu);
}
+53 -139
View File
@@ -49,6 +49,15 @@
#include "PHY/NR_UE_TRANSPORT/cic_filter_nr.h"
//#define DBG_PSS_NR
static time_stats_t generic_time[TIME_LAST];
static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is);
static int16_t *primary_synchro_nr2[NUMBER_PSS_SEQUENCE] = {0};
static c16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE] = {0};
int16_t *get_primary_synchro_nr2(const int nid2)
{
return primary_synchro_nr2[nid2];
}
/*******************************************************************
*
@@ -70,47 +79,28 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
AssertFatal(N_ID_2>=0 && N_ID_2 <=2,"Illegal N_ID_2 %d\n",N_ID_2);
int16_t d_pss[LENGTH_PSS_NR];
int16_t x[LENGTH_PSS_NR];
int16_t *primary_synchro_time = primary_synchro_time_nr[N_ID_2];
unsigned int length = fp->ofdm_symbol_size;
unsigned int size = length * IQ_SIZE; /* i & q */
int16_t *primary_synchro = primary_synchro_nr[N_ID_2]; /* pss in complex with alternatively i then q */
c16_t primary_synchro[LENGTH_PSS_NR] = {0};
int16_t *primary_synchro2 = primary_synchro_nr2[N_ID_2]; /* pss in complex with alternatively i then q */
#define INITIAL_PSS_NR (7)
const int x_initial[INITIAL_PSS_NR] = {0, 1, 1 , 0, 1, 1, 1};
#define INITIAL_PSS_NR (7)
const int16_t x_initial[INITIAL_PSS_NR] = {0, 1, 1, 0, 1, 1, 1};
assert(N_ID_2 < NUMBER_PSS_SEQUENCE);
assert(size <= SYNCF_TMP_SIZE);
assert(size <= SYNC_TMP_SIZE);
bzero(synchroF_tmp, size);
bzero(synchro_tmp, size);
for (int i=0; i < INITIAL_PSS_NR; i++) {
x[i] = x_initial[i];
}
memcpy(x, x_initial, sizeof(x_initial));
for (int i=0; i < (LENGTH_PSS_NR - INITIAL_PSS_NR); i++) {
x[i+INITIAL_PSS_NR] = (x[i + 4] + x[i])%(2);
}
for (int n=0; n < LENGTH_PSS_NR; n++) {
int m = (n + 43*N_ID_2)%(LENGTH_PSS_NR);
const int m = (n + 43 * N_ID_2) % (LENGTH_PSS_NR);
d_pss[n] = 1 - 2*x[m];
}
/* PSS is directly mapped to subcarrier without modulation 38.211 */
for (int i=0; i < LENGTH_PSS_NR; i++) {
#if 1
primary_synchro[2*i] = (d_pss[i] * SHRT_MAX)>>SCALING_PSS_NR; /* Maximum value for type short int ie int16_t */
primary_synchro[2*i+1] = 0;
primary_synchro[i].r = (d_pss[i] * SHRT_MAX) >> SCALING_PSS_NR; /* Maximum value for type short int ie int16_t */
primary_synchro2[i] = d_pss[i];
#else
primary_synchro[2*i] = d_pss[i] * AMP;
primary_synchro[2*i+1] = 0;
primary_synchro2[i] = d_pss[i];
#endif
}
#ifdef DBG_PSS_NR
@@ -118,8 +108,8 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
if (N_ID_2 == 0) {
char output_file[255];
char sequence_name[255];
sprintf(output_file, "pss_seq_%d_%u.m", N_ID_2, length);
sprintf(sequence_name, "pss_seq_%d_%u", N_ID_2, length);
sprintf(output_file, "pss_seq_%d_%u.m", N_ID_2, fp->ofdm_symbol_size);
sprintf(sequence_name, "pss_seq_%d_%u", N_ID_2, fp->ofdm_symbol_size);
printf("file %s sequence %s\n", output_file, sequence_name);
LOG_M(output_file, sequence_name, primary_synchro, LENGTH_PSS_NR, 1, 1);
@@ -151,31 +141,18 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
unsigned int k = fp->first_carrier_offset + fp->ssb_start_subcarrier + 56; //and
if (k>= fp->ofdm_symbol_size) k-=fp->ofdm_symbol_size;
c16_t synchroF_tmp[fp->ofdm_symbol_size] __attribute__((aligned(32)));
memset(synchroF_tmp, 0, sizeof(synchroF_tmp));
for (int i=0; i < LENGTH_PSS_NR; i++) {
synchroF_tmp[2*k] = primary_synchro[2*i];
synchroF_tmp[2*k+1] = primary_synchro[2*i+1];
synchroF_tmp[k % fp->ofdm_symbol_size] = primary_synchro[i];
k++;
if (k == length) k=0;
}
/* IFFT will give temporal signal of Pss */
idft((int16_t)get_idft(length),
synchroF_tmp, /* complex input */
synchro_tmp, /* complex output */
1); /* scaling factor */
/* then get final pss in time */
for (unsigned int i=0; i<length; i++) {
((int32_t *)primary_synchro_time)[i] = ((int32_t *)synchro_tmp)[i];
}
idft((int16_t)get_idft(fp->ofdm_symbol_size),
(int16_t *)synchroF_tmp, /* complex input but legacy type is wrong*/
(int16_t *)primary_synchro_time_nr[N_ID_2], /* complex output */
1); /* scaling factor */
#ifdef DBG_PSS_NR
@@ -226,12 +203,12 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
#define LIMIT_ERROR_FFT (10)
for (int i=0; i < LENGTH_PSS_NR; i++) {
if (abs(synchroF_tmp[2*k] - primary_synchro[2*i]) > LIMIT_ERROR_FFT) {
printf("Pss Error[%d] Compute %d Reference %d \n", k, synchroF_tmp[2*k], primary_synchro[2*i]);
if (abs(synchroF_tmp[2*k] - primary_synchro[i].r) > LIMIT_ERROR_FFT) {
printf("Pss Error[%d] Compute %d Reference %d \n", k, synchroF_tmp[2*k], primary_synchro[i].r);
}
if (abs(synchroF_tmp[2*k+1] - primary_synchro[2*i+1]) > LIMIT_ERROR_FFT) {
printf("Pss Error[%d] Compute %d Reference %d\n", (2*k+1), synchroF_tmp[2*k+1], primary_synchro[2*i+1]);
if (abs(synchroF_tmp[2*k+1] - primary_synchro[i].i) > LIMIT_ERROR_FFT) {
printf("Pss Error[%d] Compute %d Reference %d\n", (2*k+1), synchroF_tmp[2*k+1], primary_synchro[i].i);
}
k++;
@@ -257,40 +234,14 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
*
*********************************************************************/
void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
static void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
{
int ofdm_symbol_size = frame_parms_ue->ofdm_symbol_size;
int sizePss = LENGTH_PSS_NR * IQ_SIZE; /* complex value i & q signed 16 bits */
int size = ofdm_symbol_size * IQ_SIZE; /* i and q samples signed 16 bits */
int16_t *p = NULL;
AssertFatal(ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n",ofdm_symbol_size);
AssertFatal(frame_parms_ue->ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n", frame_parms_ue->ofdm_symbol_size);
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
p = malloc16(sizePss); /* pss in complex with alternatively i then q */
if (p != NULL) {
primary_synchro_nr[i] = p;
bzero( primary_synchro_nr[i], sizePss);
}
else {
LOG_E(PHY,"Fatal memory allocation problem \n");
assert(0);
}
p = malloc(LENGTH_PSS_NR*2);
if (p != NULL) {
primary_synchro_nr2[i] = p;
bzero( primary_synchro_nr2[i],LENGTH_PSS_NR*2);
}
p = malloc16(size);
if (p != NULL) {
primary_synchro_time_nr[i] = p;
bzero( primary_synchro_time_nr[i], size);
}
else {
LOG_E(PHY,"Fatal memory allocation problem \n");
assert(0);
}
primary_synchro_nr2[i] = malloc16_clear(LENGTH_PSS_NR * sizeof(int16_t));
AssertFatal(primary_synchro_nr2[i], "Fatal memory allocation problem \n");
primary_synchro_time_nr[i] = malloc16_clear(frame_parms_ue->ofdm_symbol_size * sizeof(c16_t));
AssertFatal(primary_synchro_time_nr[i], "Fatal memory allocation problem \n");
generate_pss_nr(frame_parms_ue,i);
}
}
@@ -307,10 +258,9 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
*
*********************************************************************/
void free_context_pss_nr(void)
static void free_context_pss_nr(void)
{
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
free_and_zero(primary_synchro_nr[i]);
free_and_zero(primary_synchro_nr2[i]);
free_and_zero(primary_synchro_time_nr[i]);
}
@@ -330,25 +280,8 @@ void free_context_pss_nr(void)
void init_context_synchro_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
{
#ifndef STATIC_SYNC_BUFFER
/* initialise global buffers for synchronisation */
synchroF_tmp = malloc16(SYNCF_TMP_SIZE);
if (synchroF_tmp == NULL) {
LOG_E(PHY,"Fatal memory allocation problem \n");
assert(0);
}
synchro_tmp = malloc16(SYNC_TMP_SIZE);
if (synchro_tmp == NULL) {
LOG_E(PHY,"Fatal memory allocation problem \n");
assert(0);
}
#endif
init_context_pss_nr(frame_parms_ue);
init_context_sss_nr(AMP);
}
@@ -366,28 +299,6 @@ void init_context_synchro_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
void free_context_synchro_nr(void)
{
#ifndef STATIC_SYNC_BUFFER
if (synchroF_tmp != NULL) {
free(synchroF_tmp);
synchroF_tmp = NULL;
}
else {
LOG_E(PHY,"Fatal memory deallocation problem \n");
assert(0);
}
if (synchro_tmp != NULL) {
free(synchro_tmp);
synchro_tmp = NULL;
}
else {
LOG_E(PHY,"Fatal memory deallocation problem \n");
assert(0);
}
#endif
free_context_pss_nr();
}
@@ -647,10 +558,10 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change)
*
*********************************************************************/
int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
{
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int *eNB_id = (int *)&ue->common_vars.eNb_id;
int *nid2 = (int *)&ue->common_vars.nid2;
int *f_off = (int *)&ue->common_vars.freq_offset;
unsigned int n, ar, peak_position, pss_source;
int64_t peak_value;
@@ -672,14 +583,11 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
pss_source = 0;
int maxval=0;
for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) {
maxval = max(maxval,primary_synchro_time_nr[0][i]);
maxval = max(maxval,-primary_synchro_time_nr[0][i]);
maxval = max(maxval,primary_synchro_time_nr[1][i]);
maxval = max(maxval,-primary_synchro_time_nr[1][i]);
maxval = max(maxval,primary_synchro_time_nr[2][i]);
maxval = max(maxval,-primary_synchro_time_nr[2][i]);
}
for (int j = 0; j < NUMBER_PSS_SEQUENCE; j++)
for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) {
maxval = max(maxval, abs(primary_synchro_time_nr[j][i].r));
maxval = max(maxval, abs(primary_synchro_time_nr[j][i].i));
}
int shift = log2_approx(maxval);//*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*2);
/* Search pss in the received buffer each 4 samples which ensures a memory alignment on 128 bits (32 bits x 4 ) */
@@ -702,7 +610,10 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
/* perform correlation of rx data and pss sequence ie it is a dot product */
const c32_t result = dot_product((c16_t *)primary_synchro_time_nr[pss_index], &(rxdata[ar][n + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size, shift);
const c32_t result = dot_product(primary_synchro_time_nr[pss_index],
&(rxdata[ar][n + is * frame_parms->samples_per_frame]),
frame_parms->ofdm_symbol_size,
shift);
const c64_t r64 = {.r = result.r, .i = result.i};
pss_corr_ue += squaredMod(r64);
//((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */
@@ -732,10 +643,13 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
// Shoujun Huang, Yongtao Su, Ying He and Shan Tang, "Joint time and frequency offset estimation in LTE downlink," 7th International Conference on Communications and Networking in China, 2012.
// Computing cross-correlation at peak on half the symbol size for first half of data
c32_t r1 = dot_product((c16_t *)primary_synchro_time_nr[pss_source], &(rxdata[0][peak_position + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size >> 1, shift);
c32_t r1 = dot_product(primary_synchro_time_nr[pss_source],
&(rxdata[0][peak_position + is * frame_parms->samples_per_frame]),
frame_parms->ofdm_symbol_size >> 1,
shift);
// Computing cross-correlation at peak on half the symbol size for data shifted by half symbol size
// as it is real and complex it is necessary to shift by a value equal to symbol size to obtain such shift
c32_t r2 = dot_product((c16_t *)primary_synchro_time_nr[pss_source] + (frame_parms->ofdm_symbol_size >> 1),
c32_t r2 = dot_product(primary_synchro_time_nr[pss_source] + (frame_parms->ofdm_symbol_size >> 1),
&(rxdata[0][peak_position + is * frame_parms->samples_per_frame]) + (frame_parms->ofdm_symbol_size >> 1),
frame_parms->ofdm_symbol_size >> 1,
shift);
@@ -754,7 +668,7 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
for (int pss_index = pss_index_start; pss_index < pss_index_end; pss_index++)
avg[pss_index] /= (length / 4);
*eNB_id = pss_source;
*nid2 = pss_source;
LOG_I(PHY,"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB, ffo %lf\n", pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]),ffo_est);
+33 -7
View File
@@ -1077,7 +1077,9 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
//txptr = &txdataF[0][re_offset];
int k=0;
#ifdef DEBUG_NR_PUCCH_TX
int kk=0;
#endif
for (int n=0; n<12; n++) {
if ((n==6) && ((rb+startingPRB) == (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) {
@@ -1089,9 +1091,21 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
((int16_t *)&txdataF[0][re_offset])[0] = d_re[i+k];
((int16_t *)&txdataF[0][re_offset])[1] = d_im[i+k];
#ifdef DEBUG_NR_PUCCH_TX
printf("\t [nr_generate_pucch2] (n=%d,i=%d) mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n",
n,i,amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+k,re_offset,
l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]);
printf(
"\t [nr_generate_pucch2] (n=%d,i=%d) mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d "
"\tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n",
n,
i,
amp,
frame_parms->ofdm_symbol_size,
frame_parms->N_RB_DL,
frame_parms->first_carrier_offset,
i + k,
re_offset,
l,
n,
((int16_t *)&txdataF[0][re_offset])[0],
((int16_t *)&txdataF[0][re_offset])[1]);
#endif
k++;
}
@@ -1101,11 +1115,23 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
((int16_t *)&txdataF[0][re_offset])[1] = (int16_t)((int32_t)(amp*ONE_OVER_SQRT2*(1-(2*((uint8_t)((s>>((2*m)+1))&1)))))>>15);
m++;
#ifdef DEBUG_NR_PUCCH_TX
printf("\t [nr_generate_pucch2] (n=%d,i=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n",
n,i,amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+kk,re_offset,
l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]);
#endif
printf(
"\t [nr_generate_pucch2] (n=%d,i=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d "
"\tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n",
n,
i,
amp,
frame_parms->ofdm_symbol_size,
frame_parms->N_RB_DL,
frame_parms->first_carrier_offset,
i + kk,
re_offset,
l,
n,
((int16_t *)&txdataF[0][re_offset])[0],
((int16_t *)&txdataF[0][re_offset])[1]);
kk++;
#endif
}
re_offset++;
+68 -128
View File
@@ -63,6 +63,15 @@
#define INITIAL_SSS_NR (7)
static const int16_t phase_re_nr[PHASE_HYPOTHESIS_NUMBER]
// -pi/3 ---- pi/3
= {16384, 20173, 23571, 26509, 28932, 30791, 32051, 32687, 32687, 32051, 30791, 28932, 26509, 23571, 20173, 16384};
static const int16_t phase_im_nr[PHASE_HYPOTHESIS_NUMBER] // -pi/3 ---- pi/3
= {-28377, -25821, -22762, -19260, -15383, -11207, -6813, -2286, 2286, 6813, 11207, 15383, 19260, 22762, 25821, 28377};
static int16_t d_sss[N_ID_2_NUMBER][N_ID_1_NUMBER][LENGTH_SSS_NR];
void init_context_sss_nr(int amp)
{
int16_t x0[LENGTH_SSS_NR];
@@ -132,15 +141,7 @@ void init_context_sss_nr(int amp)
void insert_sss_nr(int16_t *sss_time,
NR_DL_FRAME_PARMS *frame_parms)
{
unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
unsigned int size = ofdm_symbol_size * IQ_SIZE; /* i & q */
assert(size <= SYNCF_TMP_SIZE);
assert(size <= SYNC_TMP_SIZE);
bzero(synchroF_tmp, size);
bzero(synchro_tmp, size);
const unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
int Nid2 = GET_NID2(frame_parms->Nid_cell);
int Nid1 = GET_NID1(frame_parms->Nid_cell);
@@ -167,29 +168,24 @@ void insert_sss_nr(int16_t *sss_time,
*/
unsigned int k = ofdm_symbol_size - ((LENGTH_SSS_NR/2)+1);
c16_t synchroF_tmp[2048] __attribute__((aligned(32)));
c16_t synchro_tmp[2048] __attribute__((aligned(32)));
bzero(synchroF_tmp, sizeof(synchroF_tmp));
/* SSS is directly mapped to subcarrier */
for (int i=0; i<LENGTH_SSS_NR; i++) {
synchroF_tmp[2*k] = d_sss[Nid2][Nid1][i];
synchroF_tmp[2*k+1] = 0;
synchroF_tmp[k % ofdm_symbol_size].r = d_sss[Nid2][Nid1][i];
k++;
if (k >= ofdm_symbol_size) {
k++;
k-=ofdm_symbol_size;
}
}
/* get sss in the frequency domain by applying an inverse FFT */
idft(IDFT_2048,synchroF_tmp, /* complex input */
synchro_tmp, /* complex output */
1); /* scaling factor */
idft(IDFT_2048,
(int16_t *)synchroF_tmp, /* complex input */
(int16_t *)synchro_tmp, /* complex output */
1); /* scaling factor */
/* then get final sss in time */
for (unsigned int i=0; i<ofdm_symbol_size; i++) {
((int32_t *)sss_time)[i] = ((int32_t *)synchro_tmp)[i];
}
memcpy(sss_time, synchro_tmp, ofdm_symbol_size * sizeof(c16_t));
}
/*******************************************************************
@@ -204,81 +200,34 @@ void insert_sss_nr(int16_t *sss_time,
*
*********************************************************************/
int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR])
static int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR])
{
int16_t *pss;
int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2;
uint8_t aarx,i;
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
pss = primary_synchro_nr2[ue->common_vars.eNb_id];
sss_ext3 = (int16_t*)&sss_ext[0][0];
#if 0
int16_t chest[2*LENGTH_PSS_NR];
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
sss_ext2 = (int16_t*)&sss_ext[aarx][0];
pss_ext2 = (int16_t*)&pss_ext[aarx][0];
#if 0
int16_t *p = pss;
for (int i = 0; i < LENGTH_PSS_NR; i++) {
printf(" pss ref [%d] %d %d at address %p\n", i, p[2*i], p[2*i+1], &p[2*i]);
printf(" pss ext [%d] %d %d at address %p\n", i, pss_ext2[2*i], pss_ext2[2*i+1], &pss_ext2[2*i]);
}
#endif
#if 0
for (int i = 0; i < LENGTH_PSS_NR; i++) {
printf(" sss ext 2 [%d] %d %d at address %p\n", i, sss_ext2[2*i], sss_ext2[2*i+1], &sss_ext2[2*i]);
printf(" sss ref [%d] %d %d at address %p\n", i, d_sss[0][0][i], d_sss[0][0][i], &d_sss[0][0][i]);
}
#endif
int32_t amp;
int shift;
for (i = 0; i < LENGTH_PSS_NR; i++) {
int16_t *pss = get_primary_synchro_nr2(ue->common_vars.nid2);
for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
c16_t *sss_ext2 = sss_ext[aarx];
c16_t *pss_ext2 = pss_ext[aarx];
for (int i = 0; i < LENGTH_PSS_NR; i++) {
// This is H*(PSS) = R* \cdot PSS
tmp_re = pss_ext2[i*2] * pss[i];
tmp_im = -pss_ext2[i*2+1] * pss[i];
const int tmp_re = pss_ext2[i].r * pss[i];
const int tmp_im = -pss_ext2[i].i * pss[i];
amp = (((int32_t)tmp_re)*tmp_re) + ((int32_t)tmp_im)*tmp_im;
shift = log2_approx(amp)/2;
#if 0
printf("H*(%d,%d) : (%d,%d)\n",aarx,i,tmp_re,tmp_im);
printf("pss(%d,%d) : (%d,%d)\n",aarx,i,pss[2*i],pss[2*i+1]);
printf("pss_ext(%d,%d) : (%d,%d)\n",aarx,i,pss_ext2[2*i],pss_ext2[2*i+1]);
if (aarx==0) {
chest[i<<1]=tmp_re;
chest[1+(i<<1)]=tmp_im;
}
#endif
const int32_t amp = tmp_re * tmp_re + tmp_im * tmp_im;
const int shift = log2_approx(amp) / 2;
// This is R(SSS) \cdot H*(PSS)
tmp_re2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i*2])>>shift) - ((tmp_im * (int32_t)sss_ext2[i*2+1]>>shift)));
tmp_im2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i*2+1])>>shift) + ((tmp_im * (int32_t)sss_ext2[i*2]>>shift)));
const c16_t tmp = {(tmp_re * sss_ext2[i].r - tmp_im * sss_ext2[i].i) >> shift,
(tmp_re * sss_ext2[i].i + tmp_im * sss_ext2[i].r) >> shift};
// printf("SSSi(%d,%d) : (%d,%d)\n",aarx,i,sss_ext2[i<<1],sss_ext2[1+(i<<1)]);
// printf("SSSo(%d,%d) : (%d,%d)\n",aarx,i,tmp_re2,tmp_im2);
// MRC on RX antennas
if (aarx==0) {
sss_ext3[i<<1] = tmp_re2;
sss_ext3[1+(i<<1)] = tmp_im2;
if (aarx == 0) {
sss_ext2[i].r = tmp.r;
sss_ext2[i].i = tmp.i;
} else {
sss_ext3[i<<1] += tmp_re2;
sss_ext3[1+(i<<1)] += tmp_im2;
sss_ext2[i].r += tmp.r;
sss_ext2[i].i += tmp.i;
}
}
}
@@ -313,32 +262,29 @@ int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
*
*********************************************************************/
int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
uint8_t doPss, uint8_t doSss,
uint8_t subframe,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) // add flag to indicate extracting only PSS, only SSS, or both
static int do_pss_sss_extract_nr(
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
uint8_t doPss,
uint8_t doSss,
uint8_t subframe,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) // add flag to indicate extracting only PSS, only SSS, or both
{
uint8_t aarx;
int32_t *pss_rxF,*pss_rxF_ext;
int32_t *sss_rxF,*sss_rxF_ext;
uint8_t pss_symbol, sss_symbol;
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
pss_symbol = 0;
sss_symbol = SSS_SYMBOL_NB-PSS_SYMBOL_NB;
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
int pss_symbol = 0;
int sss_symbol = SSS_SYMBOL_NB - PSS_SYMBOL_NB;
unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
pss_rxF = (int32_t *)&rxdataF[aarx][pss_symbol*ofdm_symbol_size];
sss_rxF = (int32_t *)&rxdataF[aarx][sss_symbol*ofdm_symbol_size];
c16_t *pss_rxF = rxdataF[aarx] + pss_symbol * ofdm_symbol_size;
c16_t *sss_rxF = rxdataF[aarx] + sss_symbol * ofdm_symbol_size;
pss_rxF_ext = &pss_ext[aarx][0];
sss_rxF_ext = &sss_ext[aarx][0];
c16_t *pss_rxF_ext = pss_ext[aarx];
c16_t *sss_rxF_ext = sss_ext[aarx];
unsigned int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56;
@@ -396,12 +342,12 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
*
*********************************************************************/
int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
UE_nr_rxtx_proc_t *proc,
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
uint8_t subframe,
c16_t rxdataF[][phy_vars_ue->frame_parms.samples_per_slot_wCP])
static int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
UE_nr_rxtx_proc_t *proc,
c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
uint8_t subframe,
c16_t rxdataF[][phy_vars_ue->frame_parms.samples_per_slot_wCP])
{
return do_pss_sss_extract_nr(phy_vars_ue, proc, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe, rxdataF);
}
@@ -422,12 +368,11 @@ int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max, int *freq_offset_sss, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
{
uint8_t i;
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR];
uint8_t Nid2 = GET_NID2(ue->common_vars.eNb_id);
c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR];
uint8_t Nid2 = GET_NID2(ue->common_vars.nid2);
uint16_t Nid1;
uint8_t phase;
int16_t *sss;
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int32_t metric, metric_re;
int16_t *d;
@@ -473,7 +418,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
// now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h
*tot_metric = INT_MIN;
sss = (int16_t*)&sss_ext[0][0];
c16_t *sss = sss_ext[0];
#ifdef DEBUG_PLOT_SSS
@@ -498,7 +443,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
for (int i = 0; i < LENGTH_SSS_NR; i++) {
printf("sss ref [%i] : %d \n", i, d_sss[0][0][i]);
printf("sss ext [%i] : %d %d \n", i, sss[2*i], sss[2*i+1]);
printf("sss ext [%i] : %d %d \n", i, sss[i].r, sss[i].i);
printf("pss ref [%i] : %d %d \n", i, primary_synchro_nr2[0][2*i], primary_synchro_nr2[0][2*i+1]);
printf("pss ext [%i] : %d %d \n", i, ps[2*i], ps[2*i+1]);
@@ -528,12 +473,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
// This is the inner product using one particular value of each unknown parameter
for (i=0; i < LENGTH_SSS_NR; i++) {
metric_re += d[i]*(((phase_re_nr[phase]*sss[2*i])>>SCALING_METRIC_SSS_NR) - ((phase_im_nr[phase]*sss[2*i+1])>>SCALING_METRIC_SSS_NR));
#if 0
printf("i %d, phase %d/%d: metric %d, phase (%d,%d) sss (%d,%d) d %d\n",i,phase,PHASE_HYPOTHESIS_NUMBER,metric_re,phase_re_nr[phase],phase_im_nr[phase],sss[2*i],sss[1+(2*i)],d[i]);
#endif
metric_re += d[i] * ((phase_re_nr[phase] * sss[i].r - phase_im_nr[phase] * sss[i].i) >> SCALING_METRIC_SSS_NR);
}
metric = metric_re;
@@ -574,8 +514,8 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
}
d = (int16_t *)&d_sss[Nid2][Nid1];
for(i = 0; i<LENGTH_SSS_NR; i++) {
re += d[i]*sss[2*i];
im += d[i]*sss[2*i+1];
re += d[i] * sss[i].r;
im += d[i] * sss[i].i;
}
double ffo_sss = atan2(im,re)/M_PI/4.3;
*freq_offset_sss = (int)(ffo_sss*frame_parms->subcarrier_spacing);
+4 -6
View File
@@ -251,9 +251,8 @@ static OAIgraph_t nrUEcommonGraph( void (*funct) (scopeGraphData_t **data, OAIgr
}
#ifndef WEBSRVSCOPE
static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) {
if ( maxX > graph->maxX || minX < graph->minX ||
abs(maxX-graph->maxX)>abs(graph->maxX)/2 ||
abs(maxX-graph->maxX)>abs(graph->maxX)/2 ) {
if (maxX > graph->maxX || minX < graph->minX || fabs(maxX - graph->maxX) > fabs(graph->maxX) / 2
|| fabs(maxX - graph->maxX) > fabs(graph->maxX) / 2) {
graph->maxX/=2;
graph->minX/=2;
graph->maxX=max(graph->maxX,maxX);
@@ -261,9 +260,8 @@ static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, floa
fl_set_xyplot_xbounds(graph->graph, graph->minX*1.2, graph->maxX*1.2);
}
if ( maxY > graph->maxY || minY < graph->minY ||
abs(maxY-graph->maxY)>abs(graph->maxY)/2 ||
abs(maxY-graph->maxY)>abs(graph->maxY)/2 ) {
if (maxY > graph->maxY || minY < graph->minY || fabs(maxY - graph->maxY) > fabs(graph->maxY) / 2
|| fabs(maxY - graph->maxY) > fabs(graph->maxY) / 2) {
graph->maxY/=2;
graph->minY/=2;
graph->maxY=max(graph->maxY,maxY);
+56 -46
View File
@@ -124,7 +124,7 @@ static inline void cmac_256(__m256i a,__m256i b, __m256i *re32, __m256i *im32)
*re32 = simde_mm256_add_epi32(*re32,cmac_tmp_re32);
*im32 = simde_mm256_add_epi32(*im32,cmac_tmp_im32);
}
#if 0
static inline void cmacc_256(__m256i a,__m256i b, __m256i *re32, __m256i *im32) __attribute__((always_inline));
static inline void cmacc_256(__m256i a,__m256i b, __m256i *re32, __m256i *im32)
{
@@ -142,7 +142,7 @@ static inline void cmacc_256(__m256i a,__m256i b, __m256i *re32, __m256i *im32)
*re32 = simde_mm256_add_epi32(*re32,cmac_tmp_re32);
*im32 = simde_mm256_add_epi32(*im32,cmac_tmp_im32);
}
#endif
static inline void cmult(__m128i a,__m128i b, __m128i *re32, __m128i *im32) __attribute__((always_inline));
static inline void cmult(__m128i a,__m128i b, __m128i *re32, __m128i *im32)
@@ -262,7 +262,7 @@ static inline void packed_cmultc(__m128i a,__m128i b, __m128i *c)
*c = cpack(cre,cim);
}
#if 0
static inline void packed_cmultc_256(__m256i a,__m256i b, __m256i *c) __attribute__((always_inline));
static inline void packed_cmultc_256(__m256i a,__m256i b, __m256i *c)
@@ -274,7 +274,7 @@ static inline void packed_cmultc_256(__m256i a,__m256i b, __m256i *c)
*c = cpack_256(cre,cim);
}
#endif
static inline __m128i packed_cmult2(__m128i a,__m128i b,__m128i b2) __attribute__((always_inline));
static inline __m128i packed_cmult2(__m128i a,__m128i b,__m128i b2)
@@ -619,7 +619,7 @@ static inline void bfly2_tw1(int16x8_t *x0, int16x8_t *x1, int16x8_t *y0, int16x
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void bfly2_16(__m128i *x0, __m128i *x1, __m128i *y0, __m128i *y1, __m128i *tw, __m128i *twb)__attribute__((always_inline));
static inline void bfly2_16(__m128i *x0, __m128i *x1, __m128i *y0, __m128i *y1, __m128i *tw, __m128i *twb)
@@ -640,7 +640,7 @@ static inline void bfly2_16(__m128i *x0, __m128i *x1, __m128i *y0, __m128i *y1,
/* print_shorts("y0",(int16_t*)y0);
print_shorts("y1",(int16_t*)y1);*/
}
#endif
static inline void bfly2_16_256(__m256i *x0, __m256i *x1, __m256i *y0, __m256i *y1, __m256i *tw, __m256i *twb)__attribute__((always_inline));
static inline void bfly2_16_256(__m256i *x0, __m256i *x1, __m256i *y0, __m256i *y1, __m256i *tw, __m256i *twb)
@@ -664,7 +664,7 @@ static inline void bfly2_16_256(__m256i *x0, __m256i *x1, __m256i *y0, __m256i *
}
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void bfly2_16(int16x8_t *x0, int16x8_t *x1, int16x8_t *y0, int16x8_t *y1, int16x8_t *tw, int16x8_t *twb)__attribute__((always_inline));
static inline void bfly2_16(int16x8_t *x0, int16x8_t *x1, int16x8_t *y0, int16x8_t *y1, int16x8_t *tw, int16x8_t *twb)
@@ -674,9 +674,11 @@ static inline void bfly2_16(int16x8_t *x0, int16x8_t *x1, int16x8_t *y0, int16x8
*y1 = vqsubq_s16(*x0,*x1);
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void ibfly2(__m128i *x0, __m128i *x1,__m128i *y0, __m128i *y1,__m128i *tw)__attribute__((always_inline));
static inline void ibfly2(__m128i *x0, __m128i *x1,__m128i *y0, __m128i *y1,__m128i *tw)
@@ -702,7 +704,7 @@ static inline void ibfly2(__m128i *x0, __m128i *x1,__m128i *y0, __m128i *y1,__m1
bfly2_tmp2 = _mm_unpackhi_epi32(dy1r,dy1i);
*y1 = _mm_packs_epi32(bfly2_tmp1,bfly2_tmp2);
}
#endif
static inline void ibfly2_256(__m256i *x0, __m256i *x1,__m256i *y0, __m256i *y1,__m256i *tw)__attribute__((always_inline));
static inline void ibfly2_256(__m256i *x0, __m256i *x1,__m256i *y0, __m256i *y1,__m256i *tw)
@@ -730,6 +732,7 @@ static inline void ibfly2_256(__m256i *x0, __m256i *x1,__m256i *y0, __m256i *y1,
}
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void ibfly2(int16x8_t *x0, int16x8_t *x1,int16x8_t *y0, int16x8_t *y1,int16x8_t *tw)
{
@@ -747,7 +750,7 @@ static inline void ibfly2(int16x8_t *x0, int16x8_t *x1,int16x8_t *y0, int16x8_t
*y1 = cpack(dy1r,dy1i);
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
@@ -855,7 +858,7 @@ static inline void ibfly3(__m128i *x0,__m128i *x1,__m128i *x2,
*(y2) = cpack(tmpre,tmpim);
*(y2) = _mm_adds_epi16(*(x0),*(y2));
}
#if 0
static inline void ibfly3_256(__m256i *x0,__m256i *x1,__m256i *x2,
__m256i *y0,__m256i *y1,__m256i *y2,
__m256i *tw1,__m256i *tw2) __attribute__((always_inline));
@@ -879,7 +882,7 @@ static inline void ibfly3_256(__m256i *x0,__m256i *x1,__m256i *x2,
*(y2) = cpack_256(tmpre,tmpim);
*(y2) = simde_mm256_adds_epi16(*(x0),*(y2));
}
#endif
#elif defined(__arm__) || defined(__aarch64__)
static inline void ibfly3(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,
int16x8_t *y0,int16x8_t *y1,int16x8_t *y2,
@@ -1100,6 +1103,7 @@ static inline void bfly4(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t *x3
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void ibfly4(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
__m128i *y0,__m128i *y1,__m128i *y2,__m128i *y3,
__m128i *tw1,__m128i *tw2,__m128i *tw3)__attribute__((always_inline));
@@ -1129,7 +1133,7 @@ static inline void ibfly4(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
dy1i = _mm_sub_epi32(x1r_2,_mm_add_epi32(x2i_2,x3r_2));
*(y1) = _mm_add_epi16(*(x0),cpack(dy1r,dy1i));
}
#endif
static inline void ibfly4_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3,
__m256i *y0,__m256i *y1,__m256i *y2,__m256i *y3,
__m256i *tw1,__m256i *tw2,__m256i *tw3)__attribute__((always_inline));
@@ -1161,7 +1165,7 @@ static inline void ibfly4_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3,
}
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void ibfly4(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t *x3,
int16x8_t *y0,int16x8_t *y1,int16x8_t *y2,int16x8_t *y3,
int16x8_t *tw1,int16x8_t *tw2,int16x8_t *tw3)__attribute__((always_inline));
@@ -1191,11 +1195,10 @@ static inline void ibfly4(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t *x
dy1i = vqsubq_s32(x1r_2,vqaddq_s32(x2i_2,x3r_2));
*(y1) = vqaddq_s16(*(x0),cpack(dy1r,dy1i));
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
static inline void bfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
__m128i *y0,__m128i *y1,__m128i *y2,__m128i *y3)__attribute__((always_inline));
@@ -1229,7 +1232,6 @@ static inline void bfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
*(y3) = _mm_subs_epi16(*(x0),_mm_adds_epi16(x1_flip,_mm_subs_epi16(*(x2),x3_flip)));
*/
}
static inline void bfly4_tw1_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3,
__m256i *y0,__m256i *y1,__m256i *y2,__m256i *y3)__attribute__((always_inline));
@@ -1254,7 +1256,6 @@ static inline void bfly4_tw1_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3
}
#elif defined(__arm__) || defined(__aarch64__)
static inline void bfly4_tw1(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t *x3,
int16x8_t *y0,int16x8_t *y1,int16x8_t *y2,int16x8_t *y3)__attribute__((always_inline));
@@ -1271,11 +1272,10 @@ static inline void bfly4_tw1(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t
*(y2) = vqsubq_s16(*(x0),vqsubq_s16(*(x1),vqsubq_s16(*(x2),*(x3))));
*(y3) = vqsubq_s16(*(x0),vqaddq_s16(x1_flip,vqsubq_s16(*(x2),x3_flip)));
}
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void ibfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
__m128i *y0,__m128i *y1,__m128i *y2,__m128i *y3)__attribute__((always_inline));
@@ -1299,9 +1299,10 @@ static inline void ibfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
*(y2) = _mm_subs_epi16(*(x0),_mm_subs_epi16(*(x1),_mm_subs_epi16(*(x2),*(x3))));
*(y3) = _mm_adds_epi16(*(x0),_mm_subs_epi16(x1_flip,_mm_adds_epi16(*(x2),x3_flip)));
}
#endif
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void ibfly4_tw1(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t *x3,
int16x8_t *y0,int16x8_t *y1,int16x8_t *y2,int16x8_t *y3)__attribute__((always_inline));
@@ -1318,10 +1319,11 @@ static inline void ibfly4_tw1(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_
*(y2) = vqsubq_s16(*(x0),vqsubq_s16(*(x1),vqsubq_s16(*(x2),*(x3))));
*(y3) = vqaddq_s16(*(x0),vqsubq_s16(x1_flip,vqaddq_s16(*(x2),x3_flip)));
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void bfly4_16(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
__m128i *y0,__m128i *y1,__m128i *y2,__m128i *y3,
__m128i *tw1,__m128i *tw2,__m128i *tw3,
@@ -1369,7 +1371,7 @@ static inline void bfly4_16(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
*(y3) = _mm_subs_epi16(x02t,x13t); // x0 - x1f - x2 + x3f
}
#endif
static inline void bfly4_16_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3,
__m256i *y0,__m256i *y1,__m256i *y2,__m256i *y3,
__m256i *tw1,__m256i *tw2,__m256i *tw3,
@@ -1445,6 +1447,7 @@ static inline void bfly4_16(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void ibfly4_16(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
__m128i *y0,__m128i *y1,__m128i *y2,__m128i *y3,
__m128i *tw1,__m128i *tw2,__m128i *tw3,
@@ -1492,7 +1495,7 @@ static inline void ibfly4_16(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
*(y1) = _mm_subs_epi16(x02t,x13t); // x0 - x1f - x2 + x3f
}
#endif
static inline void ibfly4_16_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3,
__m256i *y0,__m256i *y1,__m256i *y2,__m256i *y3,
__m256i *tw1,__m256i *tw2,__m256i *tw3,
@@ -1533,6 +1536,7 @@ static inline void ibfly4_16_256(__m256i *x0,__m256i *x1,__m256i *x2,__m256i *x3
}
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void ibfly4_16(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t *x3,
int16x8_t *y0,int16x8_t *y1,int16x8_t *y2,int16x8_t *y3,
int16x8_t *tw1,int16x8_t *tw2,int16x8_t *tw3,
@@ -1562,7 +1566,7 @@ static inline void ibfly4_16(int16x8_t *x0,int16x8_t *x1,int16x8_t *x2,int16x8_t
*(y3) = vqaddq_s16(x02t,x13t); // x0 - x1f - x2 + x3f
*(y1) = vqsubq_s16(x02t,x13t); // x0 + x1f - x2 - x3f
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
@@ -1615,7 +1619,7 @@ static inline void bfly5(__m128i *x0, __m128i *x1, __m128i *x2, __m128i *x3,__m1
}
#if 0
static inline void bfly5_256(__m256i *x0, __m256i *x1, __m256i *x2, __m256i *x3,__m256i *x4,
__m256i *y0, __m256i *y1, __m256i *y2, __m256i *y3,__m256i *y4,
__m256i *tw1,__m256i *tw2,__m256i *tw3,__m256i *tw4)__attribute__((always_inline));
@@ -1665,7 +1669,7 @@ static inline void bfly5_256(__m256i *x0, __m256i *x1, __m256i *x2, __m256i *x3,
}
#endif
#elif defined(__arm__) || defined(__aarch64__)
static inline void bfly5(int16x8_t *x0, int16x8_t *x1, int16x8_t *x2, int16x8_t *x3,int16x8_t *x4,
int16x8_t *y0, int16x8_t *y1, int16x8_t *y2, int16x8_t *y3,int16x8_t *y4,
@@ -1757,7 +1761,7 @@ static inline void bfly5_tw1(__m128i *x0, __m128i *x1, __m128i *x2, __m128i *x3,
*(y4) = cpack(tmpre,tmpim);
*(y4) = _mm_adds_epi16(*(x0),*(y4));
}
#if 0
static inline void bfly5_tw1_256(__m256i *x0, __m256i *x1, __m256i *x2, __m256i *x3,__m256i *x4,
__m256i *y0, __m256i *y1, __m256i *y2, __m256i *y3,__m256i *y4) __attribute__((always_inline));
@@ -1793,7 +1797,7 @@ static inline void bfly5_tw1_256(__m256i *x0, __m256i *x1, __m256i *x2, __m256i
*(y4) = cpack_256(tmpre,tmpim);
*(y4) = simde_mm256_adds_epi16(*(x0),*(y4));
}
#endif
#elif defined(__arm__) || defined(__aarch64__)
static inline void bfly5_tw1(int16x8_t *x0, int16x8_t *x1, int16x8_t *x2, int16x8_t *x3,int16x8_t *x4,
int16x8_t *y0, int16x8_t *y1, int16x8_t *y2, int16x8_t *y3,int16x8_t *y4) __attribute__((always_inline));
@@ -1837,6 +1841,7 @@ static inline void bfly5_tw1(int16x8_t *x0, int16x8_t *x1, int16x8_t *x2, int16x
// i.e. x = [x0r x0i x1r x1i ... x15r x15i], y = [x0r x0i x4r x4i x8r x8i x12r x12i x1r x1i x5r x5i x9r x9i x13r x13i x2r x2i ... x15r x15i]
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void transpose16(__m128i *x,__m128i *y) __attribute__((always_inline));
static inline void transpose16(__m128i *x,__m128i *y)
{
@@ -1851,8 +1856,9 @@ static inline void transpose16(__m128i *x,__m128i *y)
y[2] = _mm_unpacklo_epi64(ytmp1,ytmp3);
y[3] = _mm_unpackhi_epi64(ytmp1,ytmp3);
}
#endif
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void transpose16(int16x8_t *x,int16x8_t *y) __attribute__((always_inline));
static inline void transpose16(int16x8_t *x,int16x8_t *y)
{
@@ -1866,11 +1872,12 @@ static inline void transpose16(int16x8_t *x,int16x8_t *y)
y[2] = vcombine_s16(vget_low_s16((int16x8_t)ytmp0.val[1]),vget_low_s16((int16x8_t)ytmp1.val[1]));
y[3] = vcombine_s16(vget_high_s16((int16x8_t)ytmp0.val[1]),vget_high_s16((int16x8_t)ytmp1.val[1]));
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
// same as above but output is offset by off
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void transpose16_ooff(__m128i *x,__m128i *y,int off) __attribute__((always_inline));
static inline void transpose16_ooff(__m128i *x,__m128i *y,int off)
@@ -1890,7 +1897,7 @@ static inline void transpose16_ooff(__m128i *x,__m128i *y,int off)
y2+=off;
*y2 = _mm_unpackhi_epi64(ytmp1,ytmp3); // x03 x13 x23 x33
}
#endif
static inline void transpose16_ooff_simd256(__m256i *x,__m256i *y,int off) __attribute__((always_inline));
static inline void transpose16_ooff_simd256(__m256i *x,__m256i *y,int off)
{
@@ -1917,6 +1924,7 @@ static inline void transpose16_ooff_simd256(__m256i *x,__m256i *y,int off)
}
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void transpose16_ooff(int16x8_t *x,int16x8_t *y,int off) __attribute__((always_inline));
static inline void transpose16_ooff(int16x8_t *x,int16x8_t *y,int off)
@@ -1934,11 +1942,11 @@ static inline void transpose16_ooff(int16x8_t *x,int16x8_t *y,int off)
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#if 0
static inline void transpose4_ooff(__m64 *x,__m64 *y,int off)__attribute__((always_inline));
static inline void transpose4_ooff(__m64 *x,__m64 *y,int off)
{
@@ -1950,7 +1958,7 @@ static inline void transpose4_ooff(__m64 *x,__m64 *y,int off)
// y[0] = [x0 x2]
// y[off] = [x1 x3]
}
#endif
static inline void transpose4_ooff_simd256(__m256i *x,__m256i *y,int off)__attribute__((always_inline));
static inline void transpose4_ooff_simd256(__m256i *x,__m256i *y,int off)
{
@@ -1968,7 +1976,7 @@ static inline void transpose4_ooff_simd256(__m256i *x,__m256i *y,int off)
}
#elif defined(__arm__) || defined(__aarch64__)
#if 0
static inline void transpose4_ooff(int16x4_t *x,int16x4_t *y,int off)__attribute__((always_inline));
static inline void transpose4_ooff(int16x4_t *x,int16x4_t *y,int off)
{
@@ -1977,7 +1985,7 @@ static inline void transpose4_ooff(int16x4_t *x,int16x4_t *y,int off)
y[0] = (int16x4_t)ytmp.val[0];
y[off] = (int16x4_t)ytmp.val[1];
}
#endif
#endif // defined(__x86_64__) || defined(__i386__)
// 16-point optimized DFT kernel
@@ -1987,16 +1995,6 @@ const static int16_t tw16[24] __attribute__((aligned(32))) = { 32767,0,30272,-12
32767,0,12539,-30273,-23170,-23170,-30273,12539
};
const static int16_t tw16a[24] __attribute__((aligned(32))) = {32767,0,30272,12540,23169 ,23170,12539 ,30273,
32767,0,23169,23170,0 ,32767,-23170,23170,
32767,0,12539,30273,-23170,23170,-30273,-12539
};
const static int16_t tw16b[24] __attribute__((aligned(32))) = { 0,32767,-12540,30272,-23170,23169 ,-30273,12539,
0,32767,-23170,23169,-32767,0 ,-23170,-23170,
0,32767,-30273,12539,-23170,-23170,12539 ,-30273
};
const static int16_t tw16c[24] __attribute__((aligned(32))) = { 0,32767,12540,30272,23170,23169 ,30273 ,12539,
0,32767,23170,23169,32767,0 ,23170 ,-23170,
0,32767,30273,12539,23170,-23170,-12539,-30273
@@ -2021,6 +2019,17 @@ const static int16_t tw16crep[48] __attribute__((aligned(32))) = { 0,32767,12540
0,32767,23170,23169,32767,0 ,23170 ,-23170,0,32767,23170,23169,32767,0 ,23170 ,-23170,
0,32767,30273,12539,23170,-23170,-12539,-30273,0,32767,30273,12539,23170,-23170,-12539,-30273
};
#if 0
const static int16_t tw16a[24] __attribute__((aligned(32))) = {32767,0,30272,12540,23169 ,23170,12539 ,30273,
32767,0,23169,23170,0 ,32767,-23170,23170,
32767,0,12539,30273,-23170,23170,-30273,-12539
};
const static int16_t tw16b[24] __attribute__((aligned(32))) = { 0,32767,-12540,30272,-23170,23169 ,-30273,12539,
0,32767,-23170,23169,-32767,0 ,-23170,-23170,
0,32767,-30273,12539,-23170,-23170,12539 ,-30273
};
static inline void dft16(int16_t *x,int16_t *y) __attribute__((always_inline));
@@ -2160,6 +2169,7 @@ static inline void dft16(int16_t *x,int16_t *y)
#endif // defined(__x86_64__) || defined(__i386__)
}
#endif
#if defined(__x86_64__) || defined(__i386__)
+2 -2
View File
@@ -244,8 +244,8 @@ typedef struct {
int32_t *sync_corr;
/// estimated frequency offset (in radians) for all subcarriers
int32_t freq_offset;
/// eNb_id user is synched to
int32_t eNb_id;
/// nid2 is the PSS value, the PCI (physical cell id) will be: 3*NID1 (SSS value) + NID2 (PSS value)
int32_t nid2;
} NR_UE_COMMON;
#define NR_PRS_IDFT_OVERSAMP_FACTOR 1 // IDFT oversampling factor for NR PRS channel estimates in time domain, ALLOWED value 16x, and 1x is default(ie. IDFT size is frame_params->ofdm_symbol_size)
@@ -38,7 +38,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const int slot,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
-23
View File
@@ -504,10 +504,6 @@ int main(int argc, char **argv)
short channel_output_fixed[16 * 68 * 384];
short channel_output_uncoded[16 * 68 * 384];
unsigned int errors_bit_uncoded = 0;
unsigned int errors_bit = 0;
unsigned char test_input_bit[16 * 68 * 384];
unsigned char estimated_output_bit[16 * 68 * 384];
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
///////////
@@ -626,25 +622,6 @@ int main(int argc, char **argv)
if (ret)
n_errors++;
//count errors
errors_bit = 0;
for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
if (estimated_output_bit[i] != test_input_bit[i]) {
errors_bit++;
}
}
/*
if (errors_bit > 0) {
n_false_positive++;
if (n_trials == 1)
printf("errors_bit %u (trial %d)\n", errors_bit, trial);
}
printf("\n");*/
}
printf("*****************************************\n");
@@ -359,11 +359,6 @@ static struct complexd R_sqrt_22_EPA_medium[16] = {{0.8375,0.0}, {0.5249,0.0}, {
void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS_TDL, channel_desc_t *chan_desc ) {
int nb_rx=chan_desc-> nb_rx;
int nb_tx=chan_desc-> nb_tx;
int tdl_pathsby3 = tdl_paths/3;
if ((tdl_paths%3)>0)
tdl_pathsby3++;
chan_desc->nb_taps = tdl_paths;
chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL;
printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td);
+2 -2
View File
@@ -91,7 +91,7 @@ typedef struct RrcMacBcchDataInd_s {
typedef struct NRRrcMacBcchDataInd_s {
uint32_t frame;
uint8_t sub_frame;
uint8_t slot;
uint32_t sdu_size;
uint8_t sdu[BCCH_SDU_SIZE];
uint8_t gnb_index;
@@ -140,7 +140,7 @@ typedef struct RrcMacCcchDataInd_s {
typedef struct NRRrcMacCcchDataInd_s {
uint32_t frame;
uint8_t sub_frame;
uint8_t slot;
uint16_t rnti;
uint32_t sdu_size;
uint8_t sdu[CCCH_SDU_SIZE];
+1
View File
@@ -79,6 +79,7 @@ MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd
// eNB: realtime -> RRC messages
MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process)
MESSAGE_DEF(NRRRC_SLOT_PROCESS, MESSAGE_PRIORITY_MED, NRRrcSlotProcess, nr_rrc_slot_process)
// eNB: RLC -> RRC messages
MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication)
+7 -1
View File
@@ -88,6 +88,7 @@
#define NAS_DOWNLINK_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_ind
#define RRC_SUBFRAME_PROCESS(mSGpTR) (mSGpTR)->ittiMsg.rrc_subframe_process
#define NRRRC_SLOT_PROCESS(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_slot_process
#define RLC_SDU_INDICATION(mSGpTR) (mSGpTR)->ittiMsg.rlc_sdu_indication
#define NRDuDlReq(mSGpTR) (mSGpTR)->ittiMsg.nr_du_dl_req
@@ -460,9 +461,14 @@ typedef dl_info_transfer_ind_t NasDlDataInd;
// eNB: realtime -> RRC messages
typedef struct rrc_subframe_process_s {
protocol_ctxt_t ctxt;
int CC_id;
int CC_id;
} RrcSubframeProcess;
typedef struct nrrrc_slot_process_s {
int frame;
int slot;
} NRRrcSlotProcess;
// eNB: RLC -> RRC messages
typedef struct rlc_sdu_indication_s {
int rnti;
+3 -5
View File
@@ -252,8 +252,7 @@ void RCconfig_macrlc(void)
int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
int num_enbs = 0;
int j,k = 0;
int32_t enb_id = 0;
int nb_cc = 0;
int32_t enb_id = 0;
int32_t offsetMaxLimit = 0;
int32_t cycleNb = 0;
@@ -390,9 +389,8 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
sprintf(ccspath,"%s.%s.[%i]",enbpath,ENB_CONFIG_STRING_COMPONENT_CARRIERS,j);
LOG_I(RRC, "enb_config::RCconfig_RRC() parameter number: %d, total number of parameters: %zd, ccspath: %s \n \n", j, sizeof(CCsParams)/sizeof(paramdef_t), ccspath);
config_get( CCsParams,sizeof(CCsParams)/sizeof(paramdef_t),ccspath);
//printf("Component carrier %d\n",component_carrier);
nb_cc++;
// Cell params, MIB/SIB1
// printf("Component carrier %d\n",component_carrier);
// Cell params, MIB/SIB1
RRCcfg->tdd_config[j] = ccparams_lte.tdd_config;
AssertFatal (ccparams_lte.tdd_config <= LTE_TDD_Config__subframeAssignment_sa6,
"Failed to parse eNB configuration file %s, enb %u illegal tdd_config %d (should be 0-%d)!",
+4 -4
View File
@@ -115,12 +115,12 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ccch_sdu_len = rrccont->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, rrccont->value.choice.RRCContainer.buf,
ccch_sdu_len);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).slot = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
NR_RRC_MAC_CCCH_DATA_IND (message_p).nr_cellid = nr_cellid; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
if (du2cu) {
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t));
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = du2cu->value.choice.DUtoCURRCContainer.size;
+7 -28
View File
@@ -2591,27 +2591,6 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
}
}
static inline uint8_t is_codeword_disabled(uint8_t format, uint8_t Imcs, uint8_t rv) {
return ((format==NFAPI_NR_DL_DCI_FORMAT_1_1)&&(Imcs==26)&&(rv==1));
}
static inline uint8_t get_table_idx(uint8_t mcs_table, uint8_t dci_format, uint8_t rnti_type, uint8_t ss_type) {
if ((mcs_table == NFAPI_NR_MCS_TABLE_QAM256) && (dci_format == NFAPI_NR_DL_DCI_FORMAT_1_1) && ((rnti_type==NFAPI_NR_RNTI_C)||(rnti_type==NFAPI_NR_RNTI_CS)))
return 2;
else if ((mcs_table == NFAPI_NR_MCS_TABLE_QAM64_LOW_SE) && (rnti_type!=NFAPI_NR_RNTI_new) && (rnti_type==NFAPI_NR_RNTI_C) && (ss_type==NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC))
return 3;
else if (rnti_type==NFAPI_NR_RNTI_new)
return 3;
else if ((mcs_table == NFAPI_NR_MCS_TABLE_QAM256) && (rnti_type==NFAPI_NR_RNTI_CS) && (dci_format == NFAPI_NR_DL_DCI_FORMAT_1_1))
return 2; // Condition mcs_table not configured in sps_config necessary here but not yet implemented
/*else if((mcs_table == NFAPI_NR_MCS_TABLE_QAM64_LOW_SE) && (rnti_type==NFAPI_NR_RNTI_CS))
* table_idx = 3;
* Note: the commented block refers to the case where the mcs_table is from sps_config*/
else
return 1;
}
// Table 5.1.2.2.1-1 38.214
uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) {
@@ -4225,11 +4204,11 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
case (NR_SubcarrierSpacing_kHz120 << 3) | NR_SubcarrierSpacing_kHz60:
AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n");
if(index_4msb & 0x7){
if (index_4msb < 8) {
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
}else if(index_4msb & 0x18){
} else if (index_4msb < 12) {
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2;
}else{ ; }
}
type0_PDCCH_CSS_config->num_rbs = table_38213_13_7_c2[index_4msb];
type0_PDCCH_CSS_config->num_symbols = table_38213_13_7_c3[index_4msb];
@@ -4242,9 +4221,9 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
case (NR_SubcarrierSpacing_kHz120 << 3) | NR_SubcarrierSpacing_kHz120:
AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n");
if(index_4msb & 0x3){
if (index_4msb < 4) {
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
}else if(index_4msb & 0x0c){
} else if (index_4msb < 8) {
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 3;
}
@@ -4267,9 +4246,9 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
case (NR_SubcarrierSpacing_kHz240 << 3) | NR_SubcarrierSpacing_kHz120:
AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n");
if(index_4msb & 0x3){
if (index_4msb < 4) {
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
}else if(index_4msb & 0x0c){
} else if (index_4msb < 8) {
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2;
}
type0_PDCCH_CSS_config->num_rbs = table_38213_13_10_c2[index_4msb];
@@ -40,15 +40,6 @@
#include <stdio.h>
#include "nfapi_nr_interface.h"
#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
#define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a)
#else
#define LOG_DCI_D(a...)
#endif
#define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a)
//#define DEBUG_DCI
void fill_dci_search_candidates(const NR_SearchSpace_t *ss,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15,
const uint32_t Y)
+5 -3
View File
@@ -806,7 +806,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
}
if(rnti != ra->ra_rnti && rnti != SI_RNTI)
AssertFatal(1 + dci->pdsch_to_harq_feedback_timing_indicator.val >= DURATION_RX_TO_TX, "PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d).\n",
AssertFatal(1 + dci->pdsch_to_harq_feedback_timing_indicator.val > DURATION_RX_TO_TX,
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d).\n",
1 + dci->pdsch_to_harq_feedback_timing_indicator.val, DURATION_RX_TO_TX);
// set the harq status at MAC for feedback
@@ -1132,8 +1133,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
// according to TS 38.213 Table 9.2.3-1
uint8_t feedback_ti = pucch_Config->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0];
AssertFatal(feedback_ti>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d). Min feedback time set in config file (min_rxtxtime).\n",
feedback_ti,DURATION_RX_TO_TX);
AssertFatal(feedback_ti > DURATION_RX_TO_TX,
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d). Min feedback time set in config file (min_rxtxtime).\n",
feedback_ti, DURATION_RX_TO_TX);
// set the harq status at MAC for feedback
set_harq_status(mac,
+6 -5
View File
@@ -854,7 +854,8 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger
return;
}
AssertFatal(slot_offset >= DURATION_RX_TO_TX,"Slot offset between DCI and aperiodic SRS (%d) cannot be less than DURATION_RX_TO_TX (%d)\n",
AssertFatal(slot_offset > DURATION_RX_TO_TX,
"Slot offset between DCI and aperiodic SRS (%d) needs to be higher than DURATION_RX_TO_TX (%d)\n",
slot_offset, DURATION_RX_TO_TX);
int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs];
int sched_slot = (slot + slot_offset) % n_slots_frame;
@@ -1415,8 +1416,8 @@ int nr_get_sf_retxBSRTimer(uint8_t sf_offset) {
// Note: Msg3 tx in the uplink symbols of mixed slot
int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t current_frame, int current_slot, frame_t *frame_tx, int *slot_tx, long k2)
{
AssertFatal(k2 >= DURATION_RX_TO_TX,
"Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
AssertFatal(k2 > DURATION_RX_TO_TX,
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
k2,
DURATION_RX_TO_TX,
DURATION_RX_TO_TX,
@@ -1450,8 +1451,8 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren
AssertFatal(1 == 0, "Invalid numerology %i\n", mu);
}
AssertFatal((k2 + delta) >= DURATION_RX_TO_TX,
"Slot offset (%ld) for Msg3 cannot be less than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
AssertFatal((k2 + delta) > DURATION_RX_TO_TX,
"Slot offset (%ld) for Msg3 needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
k2,
DURATION_RX_TO_TX,
DURATION_RX_TO_TX,
-26
View File
@@ -98,32 +98,6 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
}
static void process_drx_Config(NR_UE_sched_ctrl_t *sched_ctrl, NR_SetupRelease_DRX_Config_t *drx_Config)
{
AssertFatal(false, "%s() not implemented\n", __func__);
AssertFatal(drx_Config->present != NR_SetupRelease_DRX_Config_PR_NOTHING, "Cannot have NR_SetupRelease_DRX_Config_PR_NOTHING\n");
}
static void process_schedulingRequestConfig(NR_UE_sched_ctrl_t *sched_ctrl, NR_SchedulingRequestConfig_t *schedulingRequestConfig)
{
AssertFatal(false, "%s() not implemented\n", __func__);
}
static void process_bsrConfig(NR_UE_sched_ctrl_t *sched_ctrl, NR_BSR_Config_t *bsr_Config)
{
AssertFatal(false, "%s() not implemented\n", __func__);
}
static void process_tag_Config(NR_UE_sched_ctrl_t *sched_ctrl, NR_TAG_Config_t *tag_Config)
{
AssertFatal(false, "%s() not implemented\n", __func__);
}
static void process_phr_Config(NR_UE_sched_ctrl_t *sched_ctrl, NR_SetupRelease_PHR_Config_t *phr_Config)
{
AssertFatal(false, "%s() not implemented\n", __func__);
}
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl)
{
/* we assume that this function is mutex-protected from outside */
-3
View File
@@ -241,7 +241,6 @@ void rlc_entity_um_recv_pdu(rlc_entity_t *_entity, char *buffer, int size)
int data_e;
int data_li;
int packet_count;
int data_size;
int data_start;
int indicated_data_size;
@@ -277,7 +276,6 @@ void rlc_entity_um_recv_pdu(rlc_entity_t *_entity, char *buffer, int size)
return;
}
packet_count = 1;
/* go to start of data */
indicated_data_size = 0;
@@ -292,7 +290,6 @@ void rlc_entity_um_recv_pdu(rlc_entity_t *_entity, char *buffer, int size)
return;
}
indicated_data_size += data_li;
packet_count++;
}
rlc_pdu_decoder_align(&data_decoder);
@@ -206,8 +206,6 @@ typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
*/
typedef int (nr_ue_ul_indication_f)(nr_uplink_indication_t *ul_info);
typedef int (nr_ue_dcireq_f)(nr_dcireq_t *ul_info);
// TODO check this stuff can be reuse of need modification
typedef struct nr_ue_if_module_s {
nr_ue_scheduled_response_f *scheduled_response;
@@ -215,7 +213,6 @@ typedef struct nr_ue_if_module_s {
nr_ue_synch_request_f *synch_request;
nr_ue_dl_indication_f *dl_indication;
nr_ue_ul_indication_f *ul_indication;
//nr_ue_dcireq_f *dcireq;
uint32_t cc_mask;
uint32_t current_frame;
uint32_t current_slot;
+71 -72
View File
@@ -39,91 +39,90 @@
typedef uint32_t channel_t;
int8_t
nr_mac_rrc_data_ind_ue(
const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len){
sdu_size_t sdu_size = 0;
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const frame_t frame,
const int slot,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len)
{
sdu_size_t sdu_size = 0;
switch(channel){
case NR_BCCH_BCH:
AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
break;
switch(channel){
case NR_BCCH_BCH:
AssertFatal(nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
break;
case NR_BCCH_DL_SCH:
if (pdu_len>0) {
LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET,
gNB_index);
case NR_BCCH_DL_SCH:
if (pdu_len>0) {
LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET,
gNB_index);
MessageDef *message_p;
int msg_sdu_size = BCCH_SDU_SIZE;
MessageDef *message_p;
int msg_sdu_size = BCCH_SDU_SIZE;
if (pdu_len > msg_sdu_size) {
LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = pdu_len;
}
message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND);
memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
if (pdu_len > msg_sdu_size) {
LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = pdu_len;
}
break;
case CCCH:
if (pdu_len>0) {
LOG_T(NR_RRC,"[UE %d] Received SDU for CCCH on SRB %u from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index);
message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND);
memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
}
break;
MessageDef *message_p;
int msg_sdu_size = CCCH_SDU_SIZE;
case CCCH:
if (pdu_len>0) {
LOG_T(NR_RRC,"[UE %d] Received SDU for CCCH on SRB %u from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index);
if (pdu_len > msg_sdu_size) {
LOG_E(NR_RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = pdu_len;
}
MessageDef *message_p;
int msg_sdu_size = CCCH_SDU_SIZE;
message_p = itti_alloc_new_message (TASK_MAC_UE, 0, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP
itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p);
if (pdu_len > msg_sdu_size) {
LOG_E(NR_RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = pdu_len;
}
break;
default:
break;
}
message_p = itti_alloc_new_message (TASK_MAC_UE, 0, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP
itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p);
}
break;
return(0);
default:
break;
}
return(0);
}
int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
const int CC_id,
const uint8_t gNB_id,
const frame_t frameP,
const rb_id_t Srb_id,
uint8_t *buffer_pP){
switch(Srb_id){
const int CC_id,
const uint8_t gNB_id,
const frame_t frameP,
const rb_id_t Srb_id,
uint8_t *buffer_pP)
{
switch(Srb_id) {
case CCCH:
@@ -148,9 +147,9 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
int8_t nr_rrc_RA_succeeded(const module_id_t mod_id, const uint8_t gNB_index)
{
if (NR_UE_rrc_inst[mod_id].timers_and_constants.T304_active == 1) {
if (NR_UE_rrc_inst[mod_id].timers_and_constants.T304_active == true) {
LOG_W(NR_RRC, "T304 was stoped with value %i\n", NR_UE_rrc_inst[mod_id].timers_and_constants.T304_cnt);
NR_UE_rrc_inst[mod_id].timers_and_constants.T304_active = 0;
NR_UE_rrc_inst[mod_id].timers_and_constants.T304_active = false;
NR_UE_rrc_inst[mod_id].timers_and_constants.T304_cnt = 0;
}
return 0;
+207 -153
View File
@@ -229,7 +229,7 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
LOG_E(NR_RRC, "%02x ",buffer[i]);
LOG_E(NR_RRC, "\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 1 );
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 1);
return -1;
}
@@ -238,6 +238,9 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
else
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 0);
if(cell_group_config->spCellConfig != NULL)
configure_spcell(&NR_UE_rrc_inst[module_id], cell_group_config->spCellConfig);
return 0;
}
@@ -268,7 +271,7 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
(uint8_t *)rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->buf,
rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->size, 0, 0);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig);
}
@@ -280,6 +283,10 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)NR_UE_rrc_inst[module_id].cell_group_config, 0);
NR_UE_rrc_inst[module_id].cell_group_config = cellGroupConfig;
}
if(cellGroupConfig->spCellConfig != NULL)
configure_spcell(&NR_UE_rrc_inst[module_id], cellGroupConfig->spCellConfig);
if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_scg(0, 0, cellGroupConfig);
}
@@ -386,24 +393,28 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
}
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* rrc_config_path){
int nr_ue;
if(NB_NR_UE_INST > 0){
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* rrc_config_path)
{
if(NB_NR_UE_INST > 0) {
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t));
for(nr_ue=0;nr_ue<NB_NR_UE_INST;nr_ue++){
for(int nr_ue = 0; nr_ue < NB_NR_UE_INST; nr_ue++) {
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[nr_ue];
// fill UE-NR-Capability @ UE-CapabilityRAT-Container here.
NR_UE_rrc_inst[nr_ue].selected_plmn_identity = 1;
rrc->selected_plmn_identity = 1;
rrc->bwpd = NULL;
rrc->ubwpd = NULL;
// TODO: Put the appropriate list of SIBs
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf = CALLOC(1,4);
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[0] = SIB2 | SIB3 | SIB5; // SIB2 - SIB9
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[1] = 0; // SIB10 - SIB17
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[2] = 0; // SIB18 - SIB25
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[3] = 0; // SIB26 - SIB32
NR_UE_rrc_inst[nr_ue].requested_SI_List.size= 4;
NR_UE_rrc_inst[nr_ue].requested_SI_List.bits_unused= 0;
rrc->requested_SI_List.buf = CALLOC(1,4);
rrc->requested_SI_List.buf[0] = SIB2 | SIB3 | SIB5; // SIB2 - SIB9
rrc->requested_SI_List.buf[1] = 0; // SIB10 - SIB17
rrc->requested_SI_List.buf[2] = 0; // SIB18 - SIB25
rrc->requested_SI_List.buf[3] = 0; // SIB26 - SIB32
rrc->requested_SI_List.size= 4;
rrc->requested_SI_List.bits_unused= 0;
NR_UE_rrc_inst[nr_ue].ra_trigger = RA_NOT_RUNNING;
rrc->ra_trigger = RA_NOT_RUNNING;
}
NR_UE_rrc_inst->uecap_file = uecap_file;
@@ -473,11 +484,6 @@ int8_t nr_ue_process_physical_cell_group_config(NR_PhysicalCellGroupConfig_t *ph
return 0;
}
int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
return 0;
}
/*brief decode BCCH-BCH (MIB) message*/
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len)
{
@@ -1014,42 +1020,49 @@ int8_t nr_rrc_ue_generate_ra_msg(module_id_t module_id, uint8_t gNB_index) {
return 0;
}
int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
const uint8_t gNB_index,
uint8_t *const Sdu,
const uint8_t Sdu_len,
const uint8_t rsrq,
const uint8_t rsrp) {
/**\brief decode NR BCCH-DLSCH (SI) messages
\param module_idP module id
\param gNB_index gNB index
\param sduP pointer to buffer of ASN message BCCH-DLSCH
\param sdu_len length of buffer
\param rsrq RSRQ
\param rsrp RSRP*/
static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
const uint8_t gNB_index,
uint8_t *const Sdu,
const uint8_t Sdu_len,
const uint8_t rsrq,
const uint8_t rsrp)
{
NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index];
NR_SIB1_t *sib1 = SI_info->sib1;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN);
if (((SI_info->SIStatus & 1) == 1) && sib1->si_SchedulingInfo &&// SIB1 received
(SI_info->SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count)) {
// to prevent memory bloating
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT);
return 0;
}
nr_rrc_set_sub_state( module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR );
nr_rrc_set_sub_state(module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR);
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_BCCH_DL_SCH_Message,
(void **)&bcch_message,
(const void *)Sdu,
Sdu_len );
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_DL_SCH_Message,
(void **)&bcch_message,
(const void *)Sdu,
Sdu_len);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message,(void *)bcch_message );
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message,(void *)bcch_message);
}
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E( NR_RRC, "[UE %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
LOG_E(NR_RRC, "[UE %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
module_id,
dec_rval.consumed );
log_dump(NR_RRC, Sdu, Sdu_len, LOG_DUMP_CHAR," Received bytes:\n" );
dec_rval.consumed);
log_dump(NR_RRC, Sdu, Sdu_len, LOG_DUMP_CHAR," Received bytes:\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT );
@@ -1060,14 +1073,14 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
switch (bcch_message->message.choice.c1->present) {
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
if ((SI_info->SIStatus & 1) == 0) {
if(sib1 != NULL){
SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)sib1, 1 );
if(sib1 != NULL) {
SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)sib1, 1);
}
SI_info->SIStatus |= 1;
sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
if (*(int64_t*)sib1 != 1) {
SI_info->sib1 = sib1;
if( g_log->log_component[NR_RRC].level >= OAILOG_DEBUG ) {
if(g_log->log_component[NR_RRC].level >= OAILOG_DEBUG) {
xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) SI_info->sib1);
}
LOG_A(NR_RRC, "SIB1 decoded\n");
@@ -1076,11 +1089,13 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
// FIXME: improve condition for the RA trigger
// Check for on-demand not broadcasted SI
check_requested_SI_List(module_id, NR_UE_rrc_inst[module_id].requested_SI_List, *sib1);
if( nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR ) {
if(nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR) {
NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE;
LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n");
nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR);
}
// configure timers and constant
nr_rrc_set_sib1_timers_and_constants(&NR_UE_rrc_inst[module_id].timers_and_constants, sib1);
// take ServingCellConfigCommon and configure L1/L2
NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
nr_rrc_mac_config_req_sib1(module_id, 0, sib1->servingCellConfigCommon);
@@ -1128,88 +1143,55 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
return 0;
}
//-----------------------------------------------------------------------------
void nr_rrc_ue_process_masterCellGroup(const protocol_ctxt_t *const ctxt_pP,
uint8_t gNB_index,
OCTET_STRING_t *masterCellGroup)
//-----------------------------------------------------------------------------
OCTET_STRING_t *masterCellGroup,
long *fullConfig)
{
NR_CellGroupConfig_t *cellGroupConfig=NULL;
NR_CellGroupConfig_t *cellGroupConfig = NULL;
uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
(void **)&cellGroupConfig,
(uint8_t *)masterCellGroup->buf,
masterCellGroup->size, 0, 0);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig);
}
// TS 38.331 - Section 5.3.5.5.2 Reconfiguration with sync
if (cellGroupConfig->spCellConfig != NULL && cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL) {
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[ctxt_pP->module_id];
LOG_A(NR_RRC, "Received the reconfigurationWithSync in %s\n", __FUNCTION__);
NR_ReconfigurationWithSync_t *reconfigurationWithSync = cellGroupConfig->spCellConfig->reconfigurationWithSync;
NR_UE_Timers_Constants_t *timers_and_constants = &NR_UE_rrc_inst[ctxt_pP->module_id].timers_and_constants;
timers_and_constants->T304_active = 1;
switch (reconfigurationWithSync->t304) {
case NR_ReconfigurationWithSync__t304_ms100:
timers_and_constants->T304_cnt = 100;
break;
case NR_ReconfigurationWithSync__t304_ms150:
timers_and_constants->T304_cnt = 150;
break;
case NR_ReconfigurationWithSync__t304_ms200:
timers_and_constants->T304_cnt = 200;
break;
case NR_ReconfigurationWithSync__t304_ms500:
timers_and_constants->T304_cnt = 500;
break;
case NR_ReconfigurationWithSync__t304_ms1000:
timers_and_constants->T304_cnt = 1000;
break;
case NR_ReconfigurationWithSync__t304_ms2000:
timers_and_constants->T304_cnt = 2000;
break;
case NR_ReconfigurationWithSync__t304_ms10000:
timers_and_constants->T304_cnt = 10000;
break;
default:
timers_and_constants->T304_cnt = 50;
}
if(rrc->cell_group_config == NULL){
rrc->cell_group_config = calloc(1,sizeof(NR_CellGroupConfig_t));
}
if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config == NULL){
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = calloc(1,sizeof(NR_CellGroupConfig_t));
}
if( cellGroupConfig->rlc_BearerToReleaseList != NULL){
if(cellGroupConfig->rlc_BearerToReleaseList != NULL){
//TODO (perform RLC bearer release as specified in 5.3.5.5.3)
}
if( cellGroupConfig->rlc_BearerToAddModList != NULL){
if(cellGroupConfig->rlc_BearerToAddModList != NULL){
//TODO (perform the RLC bearer addition/modification as specified in 5.3.5.5.4)
if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList != NULL){
if(rrc->cell_group_config->rlc_BearerToAddModList != NULL){
// Laurent: there are cases where the not NULL value is also not coming from a previous malloc
// so it is better to let the potential memory leak than corrupting the heap //free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
// so it is better to let the potential memory leak than corrupting the heap //free(rrc->cell_group_config->rlc_BearerToAddModList);
}
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList = calloc(1, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList,cellGroupConfig->rlc_BearerToAddModList,
rrc->cell_group_config->rlc_BearerToAddModList = calloc(1, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
memcpy(rrc->cell_group_config->rlc_BearerToAddModList,cellGroupConfig->rlc_BearerToAddModList,
sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
}
if( cellGroupConfig->mac_CellGroupConfig != NULL){
if(cellGroupConfig->mac_CellGroupConfig != NULL){
//TODO (configure the MAC entity of this cell group as specified in 5.3.5.5.5)
LOG_I(RRC, "Received mac_CellGroupConfig from gNB\n");
if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig != NULL){
if(rrc->cell_group_config->mac_CellGroupConfig != NULL){
LOG_E(RRC, "UE RRC instance already contains mac CellGroupConfig which will be overwritten\n");
// Laurent: there are cases where the not NULL value is also not coming from a previous malloc
// so it is better to let the potential memory leak than corrupting the heap
//free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig);
//free(rrc->cell_group_config->mac_CellGroupConfig);
}
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig = malloc(sizeof(struct NR_MAC_CellGroupConfig));
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig,cellGroupConfig->mac_CellGroupConfig,
rrc->cell_group_config->mac_CellGroupConfig = malloc(sizeof(struct NR_MAC_CellGroupConfig));
memcpy(rrc->cell_group_config->mac_CellGroupConfig,cellGroupConfig->mac_CellGroupConfig,
sizeof(struct NR_MAC_CellGroupConfig));
}
@@ -1218,21 +1200,34 @@ void nr_rrc_ue_process_masterCellGroup(const protocol_ctxt_t *const ctxt_pP,
}
if(cellGroupConfig->spCellConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config &&
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig,cellGroupConfig->spCellConfig,
configure_spcell(rrc, cellGroupConfig->spCellConfig);
// TS 38.331 - Section 5.3.5.5.2 Reconfiguration with sync
if (cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL) {
if(fullConfig)
set_default_timers_and_constants(&rrc->timers_and_constants);
LOG_A(NR_RRC, "Received the reconfigurationWithSync in %s\n", __FUNCTION__);
NR_ReconfigurationWithSync_t *reconfigurationWithSync = cellGroupConfig->spCellConfig->reconfigurationWithSync;
nr_rrc_set_T304(&rrc->timers_and_constants, reconfigurationWithSync);
}
if (rrc->cell_group_config &&
rrc->cell_group_config->spCellConfig) {
memcpy(rrc->cell_group_config->spCellConfig,cellGroupConfig->spCellConfig,
sizeof(struct NR_SpCellConfig));
} else {
if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config)
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig;
if (rrc->cell_group_config)
rrc->cell_group_config->spCellConfig = cellGroupConfig->spCellConfig;
else
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = cellGroupConfig;
rrc->cell_group_config = cellGroupConfig;
}
LOG_D(RRC,"Sending CellGroupConfig to MAC\n");
nr_rrc_mac_config_req_mcg(ctxt_pP->module_id, 0, cellGroupConfig);
//TODO (configure the SpCell as specified in 5.3.5.5.7)
}
if(fullConfig)
// full configuration after re-establishment or during RRC resume
nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, rrc->SInfo[gNB_index].sib1);
if( cellGroupConfig->sCellToAddModList != NULL){
//TODO (perform SCell addition/modification as specified in 5.3.5.5.9)
}
@@ -1246,6 +1241,51 @@ void nr_rrc_ue_process_masterCellGroup(const protocol_ctxt_t *const ctxt_pP,
}
}
void configure_spcell(NR_UE_RRC_INST_t *rrc, NR_SpCellConfig_t *spcell_config)
{
nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(rrc, spcell_config->rlf_TimersAndConstants);
if(spcell_config->spCellConfigDedicated) {
NR_ServingCellConfig_t *scd = spcell_config->spCellConfigDedicated;
if(scd->firstActiveDownlinkBWP_Id) {
if(*scd->firstActiveDownlinkBWP_Id == 0)
rrc->bwpd = scd->initialDownlinkBWP;
else {
AssertFatal(scd->downlinkBWP_ToAddModList, "No DL BWP list configured\n");
const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = scd->downlinkBWP_ToAddModList;
NR_BWP_Downlink_t *dl_bwp = NULL;
for (int i = 0; i < bwpList->list.count; i++) {
dl_bwp = bwpList->list.array[i];
if(dl_bwp->bwp_Id == *scd->firstActiveDownlinkBWP_Id)
break;
}
AssertFatal(dl_bwp != NULL,"Couldn't find DLBWP corresponding to BWP ID %ld\n", *scd->firstActiveDownlinkBWP_Id);
rrc->bwpd = dl_bwp->bwp_Dedicated;
}
// if any of the reference signal(s) that are used for radio link monitoring are reconfigured by the received spCellConfigDedicated
// reset RLF timers and constants
if (rrc->bwpd->radioLinkMonitoringConfig)
reset_rlf_timers_and_constants(&rrc->timers_and_constants);
}
if(scd->uplinkConfig && scd->uplinkConfig->firstActiveUplinkBWP_Id) {
if(*scd->uplinkConfig->firstActiveUplinkBWP_Id == 0)
rrc->ubwpd = scd->uplinkConfig->initialUplinkBWP;
else {
AssertFatal(scd->uplinkConfig->uplinkBWP_ToAddModList, "No UL BWP list configured\n");
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = scd->uplinkConfig->uplinkBWP_ToAddModList;
NR_BWP_Uplink_t *ul_bwp = NULL;
for (int i = 0; i < ubwpList->list.count; i++) {
ul_bwp = ubwpList->list.array[i];
if(ul_bwp->bwp_Id == *scd->uplinkConfig->firstActiveUplinkBWP_Id)
break;
}
AssertFatal(ul_bwp != NULL,"Couldn't find DLBWP corresponding to BWP ID %ld\n", *scd->uplinkConfig->firstActiveUplinkBWP_Id);
rrc->ubwpd = ul_bwp->bwp_Dedicated;
}
}
}
}
/*--------------------------------------------------*/
static void rrc_ue_generate_RRCSetupComplete(
const protocol_ctxt_t *const ctxt_pP,
@@ -1338,7 +1378,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
// Release T300 timer
NR_UE_rrc_inst[ctxt_pP->module_id].timers_and_constants.T300_active = 0;
nr_rrc_ue_process_masterCellGroup(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup);
nr_rrc_ue_process_masterCellGroup(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup, NULL);
nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
nr_rrc_set_state(ctxt_pP->module_id, RRC_STATE_CONNECTED_NR);
nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED_NR);
@@ -2037,11 +2077,11 @@ nr_rrc_ue_establish_srb2(
// nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig);
}
if((ie->nonCriticalExtension) && (ie->nonCriticalExtension->masterCellGroup!=NULL)) {
nr_rrc_ue_process_masterCellGroup(
ctxt_pP,
gNB_index,
ie->nonCriticalExtension->masterCellGroup);
if((ie->nonCriticalExtension) && (ie->nonCriticalExtension->masterCellGroup != NULL)) {
nr_rrc_ue_process_masterCellGroup(ctxt_pP,
gNB_index,
ie->nonCriticalExtension->masterCellGroup,
ie->nonCriticalExtension->fullConfig);
}
if (ie->radioBearerConfig != NULL) {
@@ -2224,15 +2264,33 @@ nr_rrc_ue_establish_srb2(
return 0;
}
//-----------------------------------------------------------------------------
void *rrc_nrue_task( void *args_p ) {
MessageDef *msg_p;
instance_t instance;
unsigned int ue_mod_id;
int result;
NR_SRB_INFO *srb_info_p;
protocol_ctxt_t ctxt;
itti_mark_task_ready (TASK_RRC_NRUE);
void nr_rrc_handle_timers(unsigned int mod_id)
{
NR_UE_Timers_Constants_t *timers = &NR_UE_rrc_inst[mod_id].timers_and_constants;
// T304
if (timers->T304_active == true) {
timers->T304_cnt += 10;
if(timers->T304_cnt >= timers->T304_k) {
// TODO
// For T304 of MCG, in case of the handover from NR or intra-NR
// handover, initiate the RRC re-establishment procedure;
// In case of handover to NR, perform the actions defined in the
// specifications applicable for the source RAT.
}
}
}
void *rrc_nrue_task(void *args_p)
{
MessageDef *msg_p;
instance_t instance;
unsigned int ue_mod_id;
int result;
NR_SRB_INFO *srb_info_p;
protocol_ctxt_t ctxt;
itti_mark_task_ready(TASK_RRC_NRUE);
while(1) {
// Wait for a message
@@ -2250,16 +2308,22 @@ nr_rrc_ue_establish_srb2(
LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break;
case NRRRC_SLOT_PROCESS:
LOG_D(NR_RRC, "[UE %d] Receided %s: frame %d slot %d\n",
ue_mod_id, ITTI_MSG_NAME (msg_p), NRRRC_SLOT_PROCESS (msg_p).frame, NRRRC_SLOT_PROCESS (msg_p).slot);
nr_rrc_handle_timers(ue_mod_id);
break;
case NR_RRC_MAC_BCCH_DATA_IND:
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
break;
case NR_RRC_MAC_CCCH_DATA_IND:
@@ -2271,18 +2335,24 @@ nr_rrc_ue_establish_srb2(
NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
srb_info_p = &NR_UE_rrc_inst[ue_mod_id].Srb0[NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index];
memcpy (srb_info_p->Rx_buffer.Payload, NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size);
NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size);
srb_info_p->Rx_buffer.payload_size = NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0);
// PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_ccch (&ctxt,
srb_info_p,
NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
// PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_ccch (&ctxt,
srb_info_p,
NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
break;
/* PDCP messages */
case NR_RRC_DCCH_DATA_IND:
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, NR_RRC_DCCH_DATA_IND (msg_p).module_id, GNB_FLAG_NO, NR_RRC_DCCH_DATA_IND (msg_p).rnti, NR_RRC_DCCH_DATA_IND (msg_p).frame, 0,NR_RRC_DCCH_DATA_IND (msg_p).gNB_index);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,
NR_RRC_DCCH_DATA_IND (msg_p).module_id,
GNB_FLAG_NO,
NR_RRC_DCCH_DATA_IND (msg_p).rnti,
NR_RRC_DCCH_DATA_IND (msg_p).frame,
0,
NR_RRC_DCCH_DATA_IND (msg_p).gNB_index);
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, DCCH %d, gNB %d\n",
NR_RRC_DCCH_DATA_IND (msg_p).module_id,
ITTI_MSG_NAME (msg_p),
@@ -2718,28 +2788,12 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len)
}
}
void *nr_rrc_timers_update() {
while (1) {
for (int mod_id = 0; mod_id < NB_NR_UE_INST; mod_id++) {
for (int i = 0; i < NB_SIG_CNX_UE; i++) {
NR_UE_Timers_Constants_t *timers = &NR_UE_rrc_inst[mod_id].timers_and_constants;
// T304
if (timers->T304_active == 1) {
if ((timers->T304_cnt % 100) == 0) {
LOG_W(NR_RRC, "T304: %u\n", timers->T304_cnt);
}
if (timers->T304_cnt == 1) {
timers->T304_active = 0;
}
timers->T304_cnt--;
}
}
}
usleep(1000);
}
void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_SLOT_PROCESS);
NRRRC_SLOT_PROCESS(message_p).frame = frame;
NRRRC_SLOT_PROCESS(message_p).slot = slot;
LOG_D(NR_RRC, "RRC timer trigger: frame %d slot %d \n", frame, slot);
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
}
+4
View File
@@ -224,6 +224,10 @@ typedef struct NR_UE_RRC_INST_s {
NR_MIB_t *mib;
// active BWPs
NR_BWP_DownlinkDedicated_t *bwpd;
NR_BWP_UplinkDedicated_t *ubwpd;
/* KeNB as computed from parameters within USIM card */
uint8_t kgnb[32];
/* Used integrity/ciphering algorithms */
+11 -15
View File
@@ -94,20 +94,6 @@ int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_beare
\param sdu_len length of buffer*/
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len);
/**\brief decode NR BCCH-DLSCH (SI) messages
\param module_idP module id
\param gNB_index gNB index
\param sduP pointer to buffer of ASN message BCCH-DLSCH
\param sdu_len length of buffer
\param rsrq RSRQ
\param rsrp RSRP*/
int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len, const uint8_t rsrq, const uint8_t rsrp);
/**\brief Decode NR DCCH from gNB, sent from lower layer through SRB3
\param module_id module id
\param gNB_index gNB index
\param buffer encoded DCCH bytes stream message
\param size length of buffer*/
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const uint8_t gNB_index, const uint8_t *buffer, const uint32_t size);
/**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)
@@ -121,7 +107,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const int slot,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
@@ -169,6 +155,16 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len);
int get_from_lte_ue_fd();
void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot);
void configure_spcell(NR_UE_RRC_INST_t *rrc, NR_SpCellConfig_t *spcell_config);
void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac);
void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac);
void nr_rrc_set_sib1_timers_and_constants(NR_UE_Timers_Constants_t *tac, NR_SIB1_t *sib1);
void nr_rrc_set_T304(NR_UE_Timers_Constants_t *tac, NR_ReconfigurationWithSync_t *reconfigurationWithSync);
void nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(NR_UE_RRC_INST_t *rrc,
struct NR_SetupRelease_RLF_TimersAndConstants *rlf_TimersAndConstants);
/** @}*/
#endif
@@ -0,0 +1,422 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "openair2/RRC/NR_UE/rrc_proto.h"
void nr_rrc_set_T304(NR_UE_Timers_Constants_t *tac, NR_ReconfigurationWithSync_t *reconfigurationWithSync)
{
if(reconfigurationWithSync) {
switch (reconfigurationWithSync->t304) {
case NR_ReconfigurationWithSync__t304_ms50 :
tac->T304_k = 50;
break;
case NR_ReconfigurationWithSync__t304_ms100 :
tac->T304_k = 100;
break;
case NR_ReconfigurationWithSync__t304_ms150 :
tac->T304_k = 150;
break;
case NR_ReconfigurationWithSync__t304_ms200 :
tac->T304_k = 200;
break;
case NR_ReconfigurationWithSync__t304_ms500 :
tac->T304_k = 500;
break;
case NR_ReconfigurationWithSync__t304_ms1000 :
tac->T304_k = 1000;
break;
case NR_ReconfigurationWithSync__t304_ms2000 :
tac->T304_k = 2000;
break;
case NR_ReconfigurationWithSync__t304_ms10000 :
tac->T304_k = 10000;
break;
default :
AssertFatal(false, "Invalid T304 %ld\n", reconfigurationWithSync->t304);
}
}
}
void set_rlf_sib1_timers_and_constants(NR_UE_Timers_Constants_t *tac, NR_SIB1_t *sib1)
{
if(sib1 && sib1->ue_TimersAndConstants) {
switch (sib1->ue_TimersAndConstants->t301) {
case NR_UE_TimersAndConstants__t301_ms100 :
tac->T301_k = 100;
break;
case NR_UE_TimersAndConstants__t301_ms200 :
tac->T301_k = 200;
break;
case NR_UE_TimersAndConstants__t301_ms300 :
tac->T301_k = 300;
break;
case NR_UE_TimersAndConstants__t301_ms400 :
tac->T301_k = 400;
break;
case NR_UE_TimersAndConstants__t301_ms600 :
tac->T301_k = 600;
break;
case NR_UE_TimersAndConstants__t301_ms1000 :
tac->T301_k = 1000;
break;
case NR_UE_TimersAndConstants__t301_ms1500 :
tac->T301_k = 1500;
break;
case NR_UE_TimersAndConstants__t301_ms2000 :
tac->T301_k = 2000;
break;
default :
AssertFatal(false, "Invalid T301 %ld\n", sib1->ue_TimersAndConstants->t301);
}
switch (sib1->ue_TimersAndConstants->t310) {
case NR_UE_TimersAndConstants__t310_ms0 :
tac->T310_k = 0;
break;
case NR_UE_TimersAndConstants__t310_ms50 :
tac->T310_k = 50;
break;
case NR_UE_TimersAndConstants__t310_ms100 :
tac->T310_k = 100;
break;
case NR_UE_TimersAndConstants__t310_ms200 :
tac->T310_k = 200;
break;
case NR_UE_TimersAndConstants__t310_ms500 :
tac->T310_k = 500;
break;
case NR_UE_TimersAndConstants__t310_ms1000 :
tac->T310_k = 1000;
break;
case NR_UE_TimersAndConstants__t310_ms2000 :
tac->T310_k = 2000;
break;
default :
AssertFatal(false, "Invalid T310 %ld\n", sib1->ue_TimersAndConstants->t310);
}
switch (sib1->ue_TimersAndConstants->t311) {
case NR_UE_TimersAndConstants__t311_ms1000 :
tac->T311_k = 1000;
break;
case NR_UE_TimersAndConstants__t311_ms3000 :
tac->T311_k = 3000;
break;
case NR_UE_TimersAndConstants__t311_ms5000 :
tac->T311_k = 5000;
break;
case NR_UE_TimersAndConstants__t311_ms10000 :
tac->T311_k = 10000;
break;
case NR_UE_TimersAndConstants__t311_ms15000 :
tac->T311_k = 15000;
break;
case NR_UE_TimersAndConstants__t311_ms20000 :
tac->T311_k = 20000;
break;
case NR_UE_TimersAndConstants__t311_ms30000 :
tac->T311_k = 30000;
break;
default :
AssertFatal(false, "Invalid T311 %ld\n", sib1->ue_TimersAndConstants->t311);
}
switch (sib1->ue_TimersAndConstants->n310) {
case NR_UE_TimersAndConstants__n310_n1 :
tac->N310_k = 1;
break;
case NR_UE_TimersAndConstants__n310_n2 :
tac->N310_k = 2;
break;
case NR_UE_TimersAndConstants__n310_n3 :
tac->N310_k = 3;
break;
case NR_UE_TimersAndConstants__n310_n4 :
tac->N310_k = 4;
break;
case NR_UE_TimersAndConstants__n310_n6 :
tac->N310_k = 6;
break;
case NR_UE_TimersAndConstants__n310_n8 :
tac->N310_k = 8;
break;
case NR_UE_TimersAndConstants__n310_n10 :
tac->N310_k = 10;
break;
case NR_UE_TimersAndConstants__n310_n20 :
tac->N310_k = 20;
break;
default :
AssertFatal(false, "Invalid N310 %ld\n", sib1->ue_TimersAndConstants->n310);
}
switch (sib1->ue_TimersAndConstants->n311) {
case NR_UE_TimersAndConstants__n311_n1 :
tac->N311_k = 1;
break;
case NR_UE_TimersAndConstants__n311_n2 :
tac->N311_k = 2;
break;
case NR_UE_TimersAndConstants__n311_n3 :
tac->N311_k = 3;
break;
case NR_UE_TimersAndConstants__n311_n4 :
tac->N311_k = 4;
break;
case NR_UE_TimersAndConstants__n311_n5 :
tac->N311_k = 5;
break;
case NR_UE_TimersAndConstants__n311_n6 :
tac->N311_k = 6;
break;
case NR_UE_TimersAndConstants__n311_n8 :
tac->N311_k = 8;
break;
case NR_UE_TimersAndConstants__n311_n10 :
tac->N311_k = 10;
break;
default :
AssertFatal(false, "Invalid N311 %ld\n", sib1->ue_TimersAndConstants->n311);
}
}
else
LOG_E(NR_RRC,"SIB1 should not be NULL and neither UE_Timers_Constants\n");
}
void nr_rrc_set_sib1_timers_and_constants(NR_UE_Timers_Constants_t *tac, NR_SIB1_t *sib1)
{
set_rlf_sib1_timers_and_constants(tac, sib1);
if(sib1 && sib1->ue_TimersAndConstants) {
switch (sib1->ue_TimersAndConstants->t300) {
case NR_UE_TimersAndConstants__t300_ms100 :
tac->T300_k = 100;
break;
case NR_UE_TimersAndConstants__t300_ms200 :
tac->T300_k = 200;
break;
case NR_UE_TimersAndConstants__t300_ms300 :
tac->T300_k = 300;
break;
case NR_UE_TimersAndConstants__t300_ms400 :
tac->T300_k = 400;
break;
case NR_UE_TimersAndConstants__t300_ms600 :
tac->T300_k = 600;
break;
case NR_UE_TimersAndConstants__t300_ms1000 :
tac->T300_k = 1000;
break;
case NR_UE_TimersAndConstants__t300_ms1500 :
tac->T300_k = 1500;
break;
case NR_UE_TimersAndConstants__t300_ms2000 :
tac->T300_k = 2000;
break;
default :
AssertFatal(false, "Invalid T300 %ld\n", sib1->ue_TimersAndConstants->t300);
}
switch (sib1->ue_TimersAndConstants->t319) {
case NR_UE_TimersAndConstants__t319_ms100 :
tac->T319_k = 100;
break;
case NR_UE_TimersAndConstants__t319_ms200 :
tac->T319_k = 200;
break;
case NR_UE_TimersAndConstants__t319_ms300 :
tac->T319_k = 300;
break;
case NR_UE_TimersAndConstants__t319_ms400 :
tac->T319_k = 400;
break;
case NR_UE_TimersAndConstants__t319_ms600 :
tac->T319_k = 600;
break;
case NR_UE_TimersAndConstants__t319_ms1000 :
tac->T319_k = 1000;
break;
case NR_UE_TimersAndConstants__t319_ms1500 :
tac->T319_k = 1500;
break;
case NR_UE_TimersAndConstants__t319_ms2000 :
tac->T319_k = 2000;
break;
default :
AssertFatal(false, "Invalid T319 %ld\n", sib1->ue_TimersAndConstants->t319);
}
}
else
LOG_E(NR_RRC,"SIB1 should not be NULL and neither UE_Timers_Constants\n");
}
void nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(NR_UE_RRC_INST_t *rrc,
struct NR_SetupRelease_RLF_TimersAndConstants *rlf_TimersAndConstants)
{
if(rlf_TimersAndConstants == NULL)
return;
NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants;
NR_RLF_TimersAndConstants_t *rlf_tac = NULL;
switch(rlf_TimersAndConstants->present){
case NR_SetupRelease_RLF_TimersAndConstants_PR_release :
// use values for timers T301, T310, T311 and constants N310, N311, as included in ue-TimersAndConstants received in SIB1
set_rlf_sib1_timers_and_constants(tac, rrc->SInfo[0].sib1);
break;
case NR_SetupRelease_RLF_TimersAndConstants_PR_setup :
rlf_tac = rlf_TimersAndConstants->choice.setup;
if (rlf_tac == NULL)
return;
// (re-)configure the value of timers and constants in accordance with received rlf-TimersAndConstants
switch (rlf_tac->t310) {
case NR_RLF_TimersAndConstants__t310_ms0 :
tac->T310_k = 0;
break;
case NR_RLF_TimersAndConstants__t310_ms50 :
tac->T310_k = 50;
break;
case NR_RLF_TimersAndConstants__t310_ms100 :
tac->T310_k = 100;
break;
case NR_RLF_TimersAndConstants__t310_ms200 :
tac->T310_k = 200;
break;
case NR_RLF_TimersAndConstants__t310_ms500 :
tac->T310_k = 500;
break;
case NR_RLF_TimersAndConstants__t310_ms1000 :
tac->T310_k = 1000;
break;
case NR_RLF_TimersAndConstants__t310_ms2000 :
tac->T310_k = 2000;
break;
case NR_RLF_TimersAndConstants__t310_ms4000 :
tac->T310_k = 4000;
break;
case NR_RLF_TimersAndConstants__t310_ms6000 :
tac->T310_k = 6000;
break;
default :
AssertFatal(false, "Invalid T310 %ld\n", rlf_tac->t310);
}
switch (rlf_tac->n310) {
case NR_RLF_TimersAndConstants__n310_n1 :
tac->N310_k = 1;
break;
case NR_RLF_TimersAndConstants__n310_n2 :
tac->N310_k = 2;
break;
case NR_RLF_TimersAndConstants__n310_n3 :
tac->N310_k = 3;
break;
case NR_RLF_TimersAndConstants__n310_n4 :
tac->N310_k = 4;
break;
case NR_RLF_TimersAndConstants__n310_n6 :
tac->N310_k = 6;
break;
case NR_RLF_TimersAndConstants__n310_n8 :
tac->N310_k = 8;
break;
case NR_RLF_TimersAndConstants__n310_n10 :
tac->N310_k = 10;
break;
case NR_RLF_TimersAndConstants__n310_n20 :
tac->N310_k = 20;
break;
default :
AssertFatal(false, "Invalid N310 %ld\n", rlf_tac->n310);
}
switch (rlf_tac->n311) {
case NR_RLF_TimersAndConstants__n311_n1 :
tac->N311_k = 1;
break;
case NR_RLF_TimersAndConstants__n311_n2 :
tac->N311_k = 2;
break;
case NR_RLF_TimersAndConstants__n311_n3 :
tac->N311_k = 3;
break;
case NR_RLF_TimersAndConstants__n311_n4 :
tac->N311_k = 4;
break;
case NR_RLF_TimersAndConstants__n311_n5 :
tac->N311_k = 5;
break;
case NR_RLF_TimersAndConstants__n311_n6 :
tac->N311_k = 6;
break;
case NR_RLF_TimersAndConstants__n311_n8 :
tac->N311_k = 8;
break;
case NR_RLF_TimersAndConstants__n311_n10 :
tac->N311_k = 10;
break;
default :
AssertFatal(false, "Invalid N311 %ld\n", rlf_tac->n311);
}
if (rlf_tac->ext1) {
switch (rlf_tac->ext1->t311) {
case NR_RLF_TimersAndConstants__ext1__t311_ms1000 :
tac->T311_k = 1000;
break;
case NR_RLF_TimersAndConstants__ext1__t311_ms3000 :
tac->T311_k = 3000;
break;
case NR_RLF_TimersAndConstants__ext1__t311_ms5000 :
tac->T311_k = 5000;
break;
case NR_RLF_TimersAndConstants__ext1__t311_ms10000 :
tac->T311_k = 10000;
break;
case NR_RLF_TimersAndConstants__ext1__t311_ms15000 :
tac->T311_k = 15000;
break;
case NR_RLF_TimersAndConstants__ext1__t311_ms20000 :
tac->T311_k = 20000;
break;
case NR_RLF_TimersAndConstants__ext1__t311_ms30000 :
tac->T311_k = 30000;
break;
default :
AssertFatal(false, "Invalid T311 %ld\n", rlf_tac->ext1->t311);
}
}
reset_rlf_timers_and_constants(tac);
break;
default :
AssertFatal(false, "Invalid rlf_TimersAndConstants\n");
}
}
void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac)
{
// 38.331 9.2.3 Default values timers and constants
tac->T310_k = 1000;
tac->N310_k = 1;
tac->T311_k = 30000;
tac->N311_k = 1;
}
void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac)
{
// stop timer T310 for this cell group, if running
tac->T310_active = false;
tac->T310_cnt = 0;
// reset the counters N310 and N311
tac->N310_cnt = 0;
tac->N311_cnt = 0;
}
+2
View File
@@ -1228,6 +1228,8 @@ extern "C" {
// from usrp_time_offset
//openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15; //to be checked
openair0_cfg[0].tx_bw = 100e6;
openair0_cfg[0].rx_bw = 100e6;
break;
case 122880000:
@@ -0,0 +1,271 @@
Active_gNBs = ( "gNB-OAI");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
gNBs = (
{
////////// Identification parameters:
gNB_ID = 0xe00;
gNB_name = "gNB-OAI";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ({ mcc = 505; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }); });
nr_cellid = 12345678L;
////////// Physical parameters:
pdsch_AntennaPorts_XP = 1;
pusch_AntennaPorts = 1;
do_CSIRS = 1;
do_SRS = 1;
ul_prbblacklist = "135,136,137,138"
servingCellConfigCommon = (
{
# spCellConfigCommon
physCellId = 0;
# downlinkConfigCommon
# frequencyInfoDL
# this is 3900.60 MHz + (134 PRBs + 4 SCs)@30kHz SCS (GSCN: 8158)
absoluteFrequencySSB = 663264;
dl_frequencyBand = 77;
# this is 3900.60 MHz
dl_absoluteFrequencyPointA = 660040;
# scs-SpecificCarrierList
dl_offstToCarrier = 0;
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_subcarrierSpacing = 1;
dl_carrierBandwidth = 273;
# initialDownlinkBWP
# genericParameters
initialDLBWPlocationAndBandwidth = 1099;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
# pdcch-ConfigCommon
initialDLBWPcontrolResourceSetZero = 12;
initialDLBWPsearchSpaceZero = 0;
# uplinkConfigCommon
# frequencyInfoUL
ul_frequencyBand = 77;
# scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_subcarrierSpacing = 1;
ul_carrierBandwidth = 273;
pMax = 20;
# initialUplinkBWP
# genericParameters
initialULBWPlocationAndBandwidth = 1099;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
# rach-ConfigCommon
# rach-ConfigGeneric
prach_ConfigurationIndex = 98;
# prach_msg1_FDM
# 0 = one, 1=two, 2=four, 3=eight
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 0;
zeroCorrelationZoneConfig = 12;
preambleReceivedTargetPower = -90;
# preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
preambleTransMax = 6;
# powerRampingStep
# 0=dB0,1=dB2,2=dB4,3=dB6
powerRampingStep = 1;
# ra_ReponseWindow
# 1,2,4,8,10,20,40,80
ra_ResponseWindow = 4;
# ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
# 1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
# oneHalf (0..15) 4,8,12,16,...60,64
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
# ra_ContentionResolutionTimer
# (0..7) 8,16,24,32,40,48,56,64
ra_ContentionResolutionTimer = 7;
rsrp_ThresholdSSB = 19;
# prach-RootSequenceIndex_PR
# 1 = 839, 2 = 139
prach_RootSequenceIndex_PR = 2;
prach_RootSequenceIndex = 1;
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
msg1_SubcarrierSpacing = 1,
# restrictedSetConfig
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
# pucch-ConfigCommon
# pucchGroupHopping
# 0 = neither, 1= group hopping, 2=sequence hopping
pucchGroupHopping = 0;
hoppingId = 40;
p0_nominal = -70;
# dmrs_TypeA_position
# 0 = pos2, 1 = pos3
dmrs_TypeA_Position = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
subcarrierSpacing = 1;
# ssb_PositionsInBurs_BitmapPR
# 1=short, 2=medium, 3=long
ssb_PositionsInBurst_PR = 2;
ssb_PositionsInBurst_Bitmap = 1;
# ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
ssb_periodicityServingCell = 2;
#tdd-UL-DL-ConfigurationCommon
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
referenceSubcarrierSpacing = 1;
# pattern1
# dl_UL_TransmissionPeriodicity
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
dl_UL_TransmissionPeriodicity = 6;
nrofDownlinkSlots = 7;
nrofDownlinkSymbols = 6;
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
ssPBCH_BlockPower = -25;
}
);
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// AMF parameters:
amf_ip_address = (
{
ipv4 = "192.168.80.132";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai";
GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.80.129/24";
GNB_INTERFACE_NAME_FOR_NGU = "demo-oai";
GNB_IPV4_ADDRESS_FOR_NGU = "192.168.80.129/24";
GNB_PORT_FOR_S1U = 2152; # Spec 2152
}
}
);
MACRLCs = (
{
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
pusch_TargetSNRx10 = 300;
pucch_TargetSNRx10 = 200;
pusch_FailureThres = 1000;
ulsch_max_frame_inactivity = 0;
ul_max_mcs = 28;
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 120;
pucch0_dtx_threshold = 80;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1;
nb_rx = 1;
att_tx = 0;
att_rx = 0;
bands = [77];
max_pdschReferenceSignalPower = -27;
max_rxgain = 75;
eNB_instances = [0];
##beamforming 1x2 matrix: 1 layer x 2 antennas
bf_weights = [0x00007fff, 0x0000];
#clock_src = "internal";
sdr_addrs = "addr=192.168.30.2,second_addr=192.168.40.2,clock_source=internal,time_source=internal"
}
);
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";
};
security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
# valid values: nia0, nia1, nia2, nia3
integrity_algorithms = ( "nia2", "nia0" );
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="debug";
f1ap_log_level ="debug";
};