Merge branch 'develop' into NR_FAPI_beamindex_SSB_RO
Fixed merge conflicts.
This commit is contained in:
@@ -178,6 +178,8 @@ function build_on_vm {
|
|||||||
echo "mkdir -p cmake_targets/log" >> $VM_CMDS
|
echo "mkdir -p cmake_targets/log" >> $VM_CMDS
|
||||||
echo "chmod 777 cmake_targets/log" >> $VM_CMDS
|
echo "chmod 777 cmake_targets/log" >> $VM_CMDS
|
||||||
echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS
|
echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS
|
||||||
|
# Patching the pistache build for Xenial (cmake too old for new commits)
|
||||||
|
echo "sed -i -e 's@cd pistache@cd pistache \&\& git checkout -f 9a65f40975fafca5bb5370ba6d0d00f42cbc4356@' ./tools/install_dependencies" >> $VM_CMDS
|
||||||
echo "echo \"./tools/install_dependencies \"" >> $VM_CMDS
|
echo "echo \"./tools/install_dependencies \"" >> $VM_CMDS
|
||||||
echo "./tools/install_dependencies > cmake_targets/log/install-build.txt 2>&1" >> $VM_CMDS
|
echo "./tools/install_dependencies > cmake_targets/log/install-build.txt 2>&1" >> $VM_CMDS
|
||||||
echo "echo \"mkdir build\"" >> $VM_CMDS
|
echo "echo \"mkdir build\"" >> $VM_CMDS
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<testCase id="090102">
|
<testCase id="090102">
|
||||||
<class>Initialize_OAI_UE</class>
|
<class>Initialize_OAI_UE</class>
|
||||||
<desc>Initialize NR UE USRP</desc>
|
<desc>Initialize NR UE USRP</desc>
|
||||||
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
|
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path .</Initialize_OAI_UE_args>
|
||||||
<air_interface>NR</air_interface>
|
<air_interface>NR</air_interface>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<testCase id="090104">
|
<testCase id="090104">
|
||||||
<class>Initialize_OAI_UE</class>
|
<class>Initialize_OAI_UE</class>
|
||||||
<desc>Initialize NR UE USRP</desc>
|
<desc>Initialize NR UE USRP</desc>
|
||||||
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
|
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path .</Initialize_OAI_UE_args>
|
||||||
<air_interface>NR</air_interface>
|
<air_interface>NR</air_interface>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
|||||||
@@ -3232,6 +3232,7 @@ add_executable(nr_dlschsim
|
|||||||
${OPENAIR_DIR}/common/utils/system.c
|
${OPENAIR_DIR}/common/utils/system.c
|
||||||
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||||
${OPENAIR_DIR}/common/utils/utils.c
|
${OPENAIR_DIR}/common/utils/utils.c
|
||||||
|
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
|
||||||
${UTIL_SRC}
|
${UTIL_SRC}
|
||||||
${T_SOURCE}
|
${T_SOURCE}
|
||||||
${SHLIB_LOADER_SOURCES}
|
${SHLIB_LOADER_SOURCES}
|
||||||
@@ -3246,6 +3247,7 @@ add_executable(nr_pbchsim
|
|||||||
${OPENAIR_DIR}/common/utils/system.c
|
${OPENAIR_DIR}/common/utils/system.c
|
||||||
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||||
${OPENAIR_DIR}/common/utils/utils.c
|
${OPENAIR_DIR}/common/utils/utils.c
|
||||||
|
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
|
||||||
${UTIL_SRC}
|
${UTIL_SRC}
|
||||||
${T_SOURCE}
|
${T_SOURCE}
|
||||||
${SHLIB_LOADER_SOURCES}
|
${SHLIB_LOADER_SOURCES}
|
||||||
@@ -3262,6 +3264,7 @@ add_executable(nr_pucchsim
|
|||||||
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||||
${OPENAIR_DIR}/common/utils/system.c
|
${OPENAIR_DIR}/common/utils/system.c
|
||||||
${OPENAIR_DIR}/common/utils/utils.c
|
${OPENAIR_DIR}/common/utils/utils.c
|
||||||
|
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
|
||||||
${UTIL_SRC}
|
${UTIL_SRC}
|
||||||
${T_SOURCE}
|
${T_SOURCE}
|
||||||
${SHLIB_LOADER_SOURCES}
|
${SHLIB_LOADER_SOURCES}
|
||||||
@@ -3280,6 +3283,7 @@ add_executable(nr_dlsim
|
|||||||
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
||||||
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
||||||
${NFAPI_USER_DIR}/nfapi.c
|
${NFAPI_USER_DIR}/nfapi.c
|
||||||
|
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
|
||||||
${UTIL_SRC}
|
${UTIL_SRC}
|
||||||
${T_SOURCE}
|
${T_SOURCE}
|
||||||
${SHLIB_LOADER_SOURCES}
|
${SHLIB_LOADER_SOURCES}
|
||||||
@@ -3299,6 +3303,7 @@ add_executable(nr_prachsim
|
|||||||
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
||||||
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
||||||
${NFAPI_USER_DIR}/nfapi.c
|
${NFAPI_USER_DIR}/nfapi.c
|
||||||
|
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
|
||||||
${UTIL_SRC}
|
${UTIL_SRC}
|
||||||
${T_SOURCE}
|
${T_SOURCE}
|
||||||
${SHLIB_LOADER_SOURCES})
|
${SHLIB_LOADER_SOURCES})
|
||||||
|
|||||||
@@ -1098,7 +1098,9 @@
|
|||||||
(Test13: HARQ test 50% TP (2 rounds),
|
(Test13: HARQ test 50% TP (2 rounds),
|
||||||
(Test14: 3 PTRS, 8 Interpolated Symbols),
|
(Test14: 3 PTRS, 8 Interpolated Symbols),
|
||||||
(Test15: 6 PTRS, 5 Interpolated Symbols),
|
(Test15: 6 PTRS, 5 Interpolated Symbols),
|
||||||
(Test16: 11 PTRS, 0 Interpolated Symbols)</desc>
|
(Test16: 11 PTRS, 0 Interpolated Symbols),
|
||||||
|
(Test17: 2 DMRS Symbols),
|
||||||
|
(Test18: 3 DMRS Symbols)</desc>
|
||||||
<pre_compile_prog></pre_compile_prog>
|
<pre_compile_prog></pre_compile_prog>
|
||||||
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
||||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||||
@@ -1120,8 +1122,10 @@
|
|||||||
-n100 -s1 -t50
|
-n100 -s1 -t50
|
||||||
-n100 -s5 -T 2 2 2
|
-n100 -s5 -T 2 2 2
|
||||||
-n100 -s5 -T 2 1 2
|
-n100 -s5 -T 2 1 2
|
||||||
-n100 -s5 -T 2 0 4</main_exec_args>
|
-n100 -s5 -T 2 0 4
|
||||||
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16</tags>
|
-n100 -s2 -U 2 0 1
|
||||||
|
-n100 -s2 -U 2 0 2</main_exec_args>
|
||||||
|
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18</tags>
|
||||||
<search_expr_true>PDSCH test OK</search_expr_true>
|
<search_expr_true>PDSCH test OK</search_expr_true>
|
||||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||||
<nruns>3</nruns>
|
<nruns>3</nruns>
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ extern "C" {
|
|||||||
#define DEBUG_SECURITY (1<<11)
|
#define DEBUG_SECURITY (1<<11)
|
||||||
#define DEBUG_NAS (1<<12)
|
#define DEBUG_NAS (1<<12)
|
||||||
#define DEBUG_RLC (1<<13)
|
#define DEBUG_RLC (1<<13)
|
||||||
|
#define DEBUG_DLSCH_DECOD (1<<14)
|
||||||
#define UE_TIMING (1<<20)
|
#define UE_TIMING (1<<20)
|
||||||
|
|
||||||
|
|
||||||
@@ -166,6 +167,7 @@ extern "C" {
|
|||||||
{"SECURITY", DEBUG_SECURITY},\
|
{"SECURITY", DEBUG_SECURITY},\
|
||||||
{"NAS", DEBUG_NAS},\
|
{"NAS", DEBUG_NAS},\
|
||||||
{"RLC", DEBUG_RLC},\
|
{"RLC", DEBUG_RLC},\
|
||||||
|
{"DLSCH_DECOD", DEBUG_DLSCH_DECOD},\
|
||||||
{"UE_TIMING", UE_TIMING},\
|
{"UE_TIMING", UE_TIMING},\
|
||||||
{NULL,-1}\
|
{NULL,-1}\
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void *one_thread(void *arg) {
|
|||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
|
void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name) {
|
||||||
memset(pool,0,sizeof(*pool));
|
memset(pool,0,sizeof(*pool));
|
||||||
char *measr=getenv("threadPoolMeasurements");
|
char *measr=getenv("threadPoolMeasurements");
|
||||||
pool->measurePerf=performanceMeas;
|
pool->measurePerf=performanceMeas;
|
||||||
@@ -116,6 +116,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
|
|||||||
pool->restrictRNTI=false;
|
pool->restrictRNTI=false;
|
||||||
curptr=strtok_r(parms_cpy,",",&saveptr);
|
curptr=strtok_r(parms_cpy,",",&saveptr);
|
||||||
struct one_thread * ptr;
|
struct one_thread * ptr;
|
||||||
|
char *tname = (name == NULL ? "Tpool" : name);
|
||||||
while ( curptr!=NULL ) {
|
while ( curptr!=NULL ) {
|
||||||
int c=toupper(curptr[0]);
|
int c=toupper(curptr[0]);
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ptr=pool->allthreads;
|
ptr=pool->allthreads;
|
||||||
pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread));
|
pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread));
|
||||||
pool->allthreads->next=ptr;
|
pool->allthreads->next=ptr;
|
||||||
printf("create a thread for core %d\n", atoi(curptr));
|
printf("create a thread for core %d\n", atoi(curptr));
|
||||||
@@ -138,7 +139,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
|
|||||||
pool->allthreads->pool=pool;
|
pool->allthreads->pool=pool;
|
||||||
//Configure the thread scheduler policy for Linux
|
//Configure the thread scheduler policy for Linux
|
||||||
// set the thread name for debugging
|
// set the thread name for debugging
|
||||||
sprintf(pool->allthreads->name,"Tpool_%d",pool->allthreads->coreID);
|
sprintf(pool->allthreads->name,"%s%d_%d",tname,pool->nbThreads,pool->allthreads->coreID);
|
||||||
threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads,
|
threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads,
|
||||||
pool->allthreads->name, pool->allthreads->coreID, OAI_PRIORITY_RT);
|
pool->allthreads->name, pool->allthreads->coreID, OAI_PRIORITY_RT);
|
||||||
pool->nbThreads++;
|
pool->nbThreads++;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
|
#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
|
||||||
#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
|
#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
|
||||||
#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
|
#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
|
||||||
|
#define tpool_nbthreads(tpool) (tpool.nbThreads)
|
||||||
typedef struct notifiedFIFO_elt_s {
|
typedef struct notifiedFIFO_elt_s {
|
||||||
struct notifiedFIFO_elt_s *next;
|
struct notifiedFIFO_elt_s *next;
|
||||||
uint64_t key; //To filter out elements
|
uint64_t key; //To filter out elements
|
||||||
@@ -294,6 +294,6 @@ static inline int abortTpool(tpool_t *t, uint64_t key) {
|
|||||||
mutexunlock(nf->lockF);
|
mutexunlock(nf->lockF);
|
||||||
return nbRemoved;
|
return nbRemoved;
|
||||||
}
|
}
|
||||||
void initTpool(char *params,tpool_t *pool, bool performanceMeas);
|
void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name);
|
||||||
|
#define initTpool(PARAMPTR,TPOOLPTR, MEASURFLAG) initNamedTpool(PARAMPTR,TPOOLPTR, MEASURFLAG, NULL)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -112,13 +112,13 @@ No delete() call, same principle as not thread safe queues
|
|||||||
# Thread pools
|
# Thread pools
|
||||||
|
|
||||||
## initialization
|
## initialization
|
||||||
The clients can create one or more thread pools with init_tpool()
|
The clients can create one or more thread pools with `initTpool(char *params,tpool_t *pool, bool performanceMeas )` or `initNamedTpool(char *params,tpool_t *pool, bool performanceMeas , char *name)`
|
||||||
|
|
||||||
the params string structure: describes a list of cores, separated by "," that run a worker thread
|
the params string structure: describes a list of cores, separated by "," that run a worker thread
|
||||||
|
|
||||||
If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core).
|
If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core).
|
||||||
|
|
||||||
The threads are all Linux real time scheduler, their name is set automatically is "Tpool_<core id>"
|
The threads are all Linux real time scheduler, their name is set automatically to `Tpool<thread index>_<core id>` if initTpool is used or to `<name><thread index>_<core id>` when initNamedTpool is used.
|
||||||
|
|
||||||
## adding jobs
|
## adding jobs
|
||||||
The client create their jobs messages as a notifiedFIFO_elt_t, then they push it with pushTpool() (that internally calls push_notifiedFIFO())
|
The client create their jobs messages as a notifiedFIFO_elt_t, then they push it with pushTpool() (that internally calls push_notifiedFIFO())
|
||||||
@@ -132,11 +132,13 @@ A abort service abortTpool() allows to abort all jobs that match a key (see jobs
|
|||||||
Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue.
|
Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue.
|
||||||
|
|
||||||
## API details
|
## API details
|
||||||
Each thread pool (there can be several in the same process) should be initialized
|
Each thread pool (there can be several in the same process) should be initialized once using one of the two API's:
|
||||||
|
|
||||||
### initTpool(char *params,tpool_t *pool, bool performanceMeas) is to be called oncepool
|
### initNamedTpool(char *params,tpool_t *pool, bool performanceMeas,char *name)
|
||||||
|
|
||||||
the configuration parameter is a string, elements separated by ",":
|
### initTpool(char *params,tpool_t *pool, bool performanceMeas)
|
||||||
|
|
||||||
|
`params`: the configuration parameter is a string, elements separator is a comma ",". An element can be:
|
||||||
|
|
||||||
* N: if a N is in the parameter list, no threads are created
|
* N: if a N is in the parameter list, no threads are created
|
||||||
The purpose is to keep the same API in any case
|
The purpose is to keep the same API in any case
|
||||||
@@ -151,9 +153,11 @@ example: "-1,-1,-1"
|
|||||||
as there is no core number -1, the thread pool is made of 3 floating threads
|
as there is no core number -1, the thread pool is made of 3 floating threads
|
||||||
be careful with fix allocation: it is hard to be more clever than Linux kernel
|
be careful with fix allocation: it is hard to be more clever than Linux kernel
|
||||||
|
|
||||||
pool is the memory you allocated before to store the thread pool internal state (same concept as above queues)
|
`pool` is the memory you allocated before to store the thread pool internal state (same concept as above queues)
|
||||||
|
|
||||||
performanceMeas is a flag to enable measurements (well described in documentation)
|
`performanceMeas` is a flag to enable measurements (well described in documentation)
|
||||||
|
|
||||||
|
`name` is used to build the thread names.
|
||||||
|
|
||||||
### pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg)
|
### pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg)
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -27,7 +27,7 @@ $ cd cmake_targets
|
|||||||
$ ./build_oai --eNB --UE
|
$ ./build_oai --eNB --UE
|
||||||
```
|
```
|
||||||
|
|
||||||
Both eNB (lte-softmodem) and UE (lte-uesoftmodem) are present on `cmake_targets/lte_build_oai/build` folder.
|
Both eNB (lte-softmodem) and UE (lte-uesoftmodem) are present on `cmake_targets/ran_build/build` folder.
|
||||||
|
|
||||||
More details are available on the [build page](BUILD.md).
|
More details are available on the [build page](BUILD.md).
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ Example 1: running in FDD mode with EPC.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ source oaienv
|
$ source oaienv
|
||||||
$ cd cmake_targets/lte_build_oai/build
|
$ cd cmake_targets/ran_build/build
|
||||||
$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-fdd-basic-sim.conf --basicsim
|
$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-fdd-basic-sim.conf --basicsim
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ Example 2: running in TDD mode without any EPC.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ source oaienv
|
$ source oaienv
|
||||||
$ cd cmake_targets/lte_build_oai/build
|
$ cd cmake_targets/ran_build/build
|
||||||
$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-tdd-basic-sim.conf --basicsim --noS1
|
$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-tdd-basic-sim.conf --basicsim --noS1
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ You need to set the correct OPC, USIM_API_K, MSIN (this is the end par of the IM
|
|||||||
```bash
|
```bash
|
||||||
$ source oaienv
|
$ source oaienv
|
||||||
# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
|
# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
|
||||||
$ cd cmake_targets/lte_build_oai/build
|
$ cd cmake_targets/ran_build/build
|
||||||
$ ../../nas_sim_tools/build/conf2uedata -c $OPENAIR_HOME/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .
|
$ ../../nas_sim_tools/build/conf2uedata -c $OPENAIR_HOME/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .
|
||||||
$ sudo -E ./lte-uesoftmodem -C 2625000000 -r 25 --ue-rxgain 140 --basicsim [--noS1]
|
$ sudo -E ./lte-uesoftmodem -C 2625000000 -r 25 --ue-rxgain 140 --basicsim [--noS1]
|
||||||
```
|
```
|
||||||
|
|||||||
+10
-6
@@ -295,6 +295,7 @@ The following features are valid for the gNB and the 5G-NR UE.
|
|||||||
- NR RRC (38.331) Rel 15 messages using new asn1c
|
- NR RRC (38.331) Rel 15 messages using new asn1c
|
||||||
- LTE RRC (36.331) also updated to Rel 15
|
- LTE RRC (36.331) also updated to Rel 15
|
||||||
- Generation of CellGroupConfig (for eNB) and MIB
|
- Generation of CellGroupConfig (for eNB) and MIB
|
||||||
|
- Generation of system information block 1 (SIB1)
|
||||||
- Application to read configuration file and program gNB RRC
|
- Application to read configuration file and program gNB RRC
|
||||||
- RRC can configure PDCP, RLC, MAC
|
- RRC can configure PDCP, RLC, MAC
|
||||||
|
|
||||||
@@ -305,7 +306,8 @@ The following features are valid for the gNB and the 5G-NR UE.
|
|||||||
**gNB MAC**
|
**gNB MAC**
|
||||||
- MAC -> PHY configuration using NR FAPI P5 interface
|
- MAC -> PHY configuration using NR FAPI P5 interface
|
||||||
- MAC <-> PHY data interface using FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU
|
- MAC <-> PHY data interface using FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU
|
||||||
- Scheduler for RA procedreat gNB
|
- Scheduler procedures for SIB1
|
||||||
|
- Scheduler procedures for RA
|
||||||
- MAC downlink scheduler (fixed allocations)
|
- MAC downlink scheduler (fixed allocations)
|
||||||
- MAC header generation (including timing advance)
|
- MAC header generation (including timing advance)
|
||||||
- ACK / NACK handling and HARQ procedures for downlink
|
- ACK / NACK handling and HARQ procedures for downlink
|
||||||
@@ -350,11 +352,13 @@ The following features are valid for the gNB and the 5G-NR UE.
|
|||||||
|
|
||||||
## UE Higher Layers ##
|
## UE Higher Layers ##
|
||||||
|
|
||||||
**gNB MAC**
|
**UE MAC**
|
||||||
- Initial sync and MIB detection
|
* Minimum system information (MSI)
|
||||||
- MAC -> PHY configuration of PHY via UE FAPI P5 interface
|
- Initial sync and MIB detection
|
||||||
- Basic MAC to control PHY via UE FAPI P7 interface
|
- System information block 1 (SIB1) reception
|
||||||
- Random access procedure
|
* MAC -> PHY configuration of PHY via UE FAPI P5 interface
|
||||||
|
* Basic MAC to control PHY via UE FAPI P7 interface
|
||||||
|
* Random access procedure
|
||||||
|
|
||||||
|
|
||||||
**RLC**
|
**RLC**
|
||||||
|
|||||||
@@ -132,6 +132,40 @@ With the RF simulator (on the same machine):
|
|||||||
|
|
||||||
`sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --do-ra --rfsim --parallel-config PARALLEL_SINGLE_THREAD`
|
`sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --do-ra --rfsim --parallel-config PARALLEL_SINGLE_THREAD`
|
||||||
|
|
||||||
|
## sa setup with OAI
|
||||||
|
|
||||||
|
The sa flag is used to run gNB in standalone mode. Currently OAI in NR standalone mode transmits and receives SIB1.
|
||||||
|
|
||||||
|
In order to run gNB in standalone mode, the following flag is needed at gNB:
|
||||||
|
|
||||||
|
`--sa`
|
||||||
|
|
||||||
|
### Run OAI in sa mode
|
||||||
|
|
||||||
|
At the gNB the --sa flag does the following
|
||||||
|
- it reads the RRC configuration from the configuration file
|
||||||
|
- it encodes the RRCConfiguration and the RBconfig message and stores them in the binary files rbconfig.raw and reconfig.raw
|
||||||
|
- the RRC encodes SIB1 according the configuration file and transmits it through PDSCH
|
||||||
|
|
||||||
|
At the UE the --sa flag will
|
||||||
|
- read the binary files rbconfig.raw and reconfig.raw from the current directory (a different directory can be specified with the flag --rrc_config_path) and process them.
|
||||||
|
|
||||||
|
From the `cmake_targets/ran_build/build` folder:
|
||||||
|
|
||||||
|
gNB on machine 1:
|
||||||
|
|
||||||
|
`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --sa`
|
||||||
|
|
||||||
|
UE on machine 2:
|
||||||
|
|
||||||
|
`sudo ./nr-uesoftmodem --rrc_config_path . --sa`
|
||||||
|
|
||||||
|
With the RF simulator (on the same machine):
|
||||||
|
|
||||||
|
`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa`
|
||||||
|
|
||||||
|
`sudo ./nr-uesoftmodem --rrc_config_path . --rfsim --sa`
|
||||||
|
|
||||||
## IF setup with OAI
|
## IF setup with OAI
|
||||||
|
|
||||||
The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment.
|
The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment.
|
||||||
|
|||||||
@@ -300,87 +300,11 @@ void exit_function(const char *file, const char *function, const int line, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *l2l1_task(void *arg) {
|
|
||||||
MessageDef *message_p = NULL;
|
|
||||||
int result;
|
|
||||||
itti_set_task_real_time(TASK_L2L1);
|
|
||||||
itti_mark_task_ready(TASK_L2L1);
|
|
||||||
/* Wait for the initialize message */
|
|
||||||
printf("Wait for the ITTI initialize message\n");
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (message_p != NULL) {
|
|
||||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
|
||||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
itti_receive_msg (TASK_L2L1, &message_p);
|
|
||||||
|
|
||||||
switch (ITTI_MSG_ID(message_p)) {
|
|
||||||
case INITIALIZE_MESSAGE:
|
|
||||||
/* Start gNB thread */
|
|
||||||
LOG_D(EMU, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
|
|
||||||
start_gNB = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TERMINATE_MESSAGE:
|
|
||||||
printf("received terminate message\n");
|
|
||||||
oai_exit=1;
|
|
||||||
start_gNB = 0;
|
|
||||||
itti_exit_task ();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
|
|
||||||
|
|
||||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
|
||||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
|
||||||
/* ???? no else but seems to be UE only ???
|
|
||||||
do {
|
|
||||||
// Wait for a message
|
|
||||||
itti_receive_msg (TASK_L2L1, &message_p);
|
|
||||||
|
|
||||||
switch (ITTI_MSG_ID(message_p)) {
|
|
||||||
case TERMINATE_MESSAGE:
|
|
||||||
oai_exit=1;
|
|
||||||
itti_exit_task ();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ACTIVATE_MESSAGE:
|
|
||||||
start_UE = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEACTIVATE_MESSAGE:
|
|
||||||
start_UE = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MESSAGE_TEST:
|
|
||||||
LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
|
||||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
|
||||||
} while(!oai_exit);
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int create_gNB_tasks(uint32_t gnb_nb) {
|
int create_gNB_tasks(uint32_t gnb_nb) {
|
||||||
LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
|
LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
|
||||||
itti_wait_ready(1);
|
itti_wait_ready(1);
|
||||||
|
|
||||||
if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
|
|
||||||
LOG_E(PDCP, "Create task for L2L1 failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gnb_nb > 0) {
|
if (gnb_nb > 0) {
|
||||||
/* Last task to create, others task must be ready before its start */
|
/* Last task to create, others task must be ready before its start */
|
||||||
@@ -419,7 +343,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) {
|
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0 && get_softmodem_params()->sa==0)) {
|
||||||
if (gnb_nb > 0) {
|
if (gnb_nb > 0) {
|
||||||
/*
|
/*
|
||||||
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
|
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
|
||||||
@@ -717,7 +641,6 @@ int stop_L1L2(module_id_t gnb_id) {
|
|||||||
|
|
||||||
/* these tasks need to pick up new configuration */
|
/* these tasks need to pick up new configuration */
|
||||||
terminate_task(TASK_RRC_ENB, gnb_id);
|
terminate_task(TASK_RRC_ENB, gnb_id);
|
||||||
terminate_task(TASK_L2L1, gnb_id);
|
|
||||||
LOG_I(GNB_APP, "calling kill_gNB_proc() for instance %d\n", gnb_id);
|
LOG_I(GNB_APP, "calling kill_gNB_proc() for instance %d\n", gnb_id);
|
||||||
kill_gNB_proc(gnb_id);
|
kill_gNB_proc(gnb_id);
|
||||||
LOG_I(GNB_APP, "calling kill_NR_RU_proc() for instance %d\n", gnb_id);
|
LOG_I(GNB_APP, "calling kill_NR_RU_proc() for instance %d\n", gnb_id);
|
||||||
@@ -753,13 +676,6 @@ int restart_L1L2(module_id_t gnb_id) {
|
|||||||
rrc_enb_init();
|
rrc_enb_init();
|
||||||
itti_mark_task_ready(TASK_RRC_ENB);
|
itti_mark_task_ready(TASK_RRC_ENB);
|
||||||
|
|
||||||
if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
|
|
||||||
LOG_E(PDCP, "Create task for L2L1 failed\n");
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
LOG_I(PDCP, "Re-created task for L2L1 successfully\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pass a reconfiguration request which will configure everything down to
|
/* pass a reconfiguration request which will configure everything down to
|
||||||
* RC.eNB[i][j]->frame_parms, too */
|
* RC.eNB[i][j]->frame_parms, too */
|
||||||
msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
|
msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
|
||||||
@@ -851,6 +767,9 @@ int main( int argc, char **argv )
|
|||||||
if (get_softmodem_params()->do_ra)
|
if (get_softmodem_params()->do_ra)
|
||||||
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
|
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
|
||||||
|
|
||||||
|
if (get_softmodem_params()->sa)
|
||||||
|
AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n");
|
||||||
|
|
||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
T_Config_Init();
|
T_Config_Init();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+28
-44
@@ -411,7 +411,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
|||||||
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||||
#else
|
#else
|
||||||
uint64_t a=rdtsc();
|
uint64_t a=rdtsc();
|
||||||
phy_procedures_nrUE_RX( UE, proc, 0, UE->mode);
|
phy_procedures_nrUE_RX( UE, proc, 0, UE->mode,get_nrUE_params()->nr_dlsch_parallel);
|
||||||
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_slot_rx, (rdtsc()-a)/3500);
|
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_slot_rx, (rdtsc()-a)/3500);
|
||||||
//printf(">>> nr_ue_pdcch_procedures ended\n");
|
//printf(">>> nr_ue_pdcch_procedures ended\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -460,32 +460,13 @@ void UE_processing(void *arg) {
|
|||||||
processingData_t *rxtxD = (processingData_t *) arg;
|
processingData_t *rxtxD = (processingData_t *) arg;
|
||||||
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
||||||
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
||||||
|
int slot_tx = proc->nr_slot_tx;
|
||||||
|
int frame_tx = proc->frame_tx;
|
||||||
|
|
||||||
processSlotRX(UE, proc);
|
processSlotRX(UE, proc);
|
||||||
processSlotTX(UE, proc);
|
processSlotTX(UE, proc);
|
||||||
|
ue_ta_procedures(UE, slot_tx, frame_tx);
|
||||||
|
|
||||||
/* UL time alignment
|
|
||||||
// If the current tx frame and slot match the TA configuration in ul_time_alignment
|
|
||||||
// then timing advance is processed and set to be applied in the next UL transmission */
|
|
||||||
if (UE->mac_enabled == 1) {
|
|
||||||
uint8_t gNB_id = 0;
|
|
||||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &UE->ul_time_alignment[gNB_id];
|
|
||||||
int slot_tx = proc->nr_slot_tx;
|
|
||||||
int frame_tx = proc->frame_tx;
|
|
||||||
|
|
||||||
if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) {
|
|
||||||
uint8_t numerology = UE->frame_parms.numerology_index;
|
|
||||||
uint16_t bwp_ul_NB_RB = UE->frame_parms.N_RB_UL;
|
|
||||||
|
|
||||||
LOG_D(PHY,"Applying timing advance -- frame %d -- slot %d\n", frame_tx, slot_tx);
|
|
||||||
|
|
||||||
//if (nfapi_mode!=3){
|
|
||||||
nr_process_timing_advance(UE->Mod_id, UE->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB);
|
|
||||||
ul_time_alignment->ta_frame = -1;
|
|
||||||
ul_time_alignment->ta_slot = -1;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
|
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
|
||||||
@@ -622,7 +603,7 @@ void *UE_thread(void *arg) {
|
|||||||
|
|
||||||
while (!oai_exit) {
|
while (!oai_exit) {
|
||||||
if (syncRunning) {
|
if (syncRunning) {
|
||||||
notifiedFIFO_elt_t *res=tryPullTpool(&nf, Tpool);
|
notifiedFIFO_elt_t *res=tryPullTpool(&nf,&(get_nrUE_params()->Tpool));
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
syncRunning=false;
|
syncRunning=false;
|
||||||
@@ -648,7 +629,7 @@ void *UE_thread(void *arg) {
|
|||||||
syncData_t *syncMsg=(syncData_t *)NotifiedFifoData(Msg);
|
syncData_t *syncMsg=(syncData_t *)NotifiedFifoData(Msg);
|
||||||
syncMsg->UE=UE;
|
syncMsg->UE=UE;
|
||||||
memset(&syncMsg->proc, 0, sizeof(syncMsg->proc));
|
memset(&syncMsg->proc, 0, sizeof(syncMsg->proc));
|
||||||
pushTpool(Tpool, Msg);
|
pushTpool(&(get_nrUE_params()->Tpool), Msg);
|
||||||
trashed_frames=0;
|
trashed_frames=0;
|
||||||
syncRunning=true;
|
syncRunning=true;
|
||||||
continue;
|
continue;
|
||||||
@@ -728,11 +709,6 @@ void *UE_thread(void *arg) {
|
|||||||
UE->rx_offset_diff;
|
UE->rx_offset_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UE->timing_advance != timing_advance) {
|
|
||||||
writeBlockSize -= UE->timing_advance - timing_advance;
|
|
||||||
timing_advance = UE->timing_advance;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertFatal(readBlockSize ==
|
AssertFatal(readBlockSize ==
|
||||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||||
×tamp,
|
×tamp,
|
||||||
@@ -756,6 +732,7 @@ void *UE_thread(void *arg) {
|
|||||||
LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
|
LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use previous timing_advance value to compute writeTimestamp
|
||||||
curMsg->proc.timestamp_tx = timestamp+
|
curMsg->proc.timestamp_tx = timestamp+
|
||||||
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
|
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
|
||||||
- firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - UE->timing_advance;
|
- firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - UE->timing_advance;
|
||||||
@@ -763,23 +740,28 @@ void *UE_thread(void *arg) {
|
|||||||
notifiedFIFO_elt_t *res;
|
notifiedFIFO_elt_t *res;
|
||||||
|
|
||||||
while (nbSlotProcessing >= RX_NB_TH) {
|
while (nbSlotProcessing >= RX_NB_TH) {
|
||||||
res=pullTpool(&nf, Tpool);
|
res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
|
||||||
nbSlotProcessing--;
|
nbSlotProcessing--;
|
||||||
processingData_t *tmp=(processingData_t *)res->msgData;
|
processingData_t *tmp=(processingData_t *)res->msgData;
|
||||||
|
|
||||||
if (tmp->proc.decoded_frame_rx != -1)
|
if (tmp->proc.decoded_frame_rx != -1)
|
||||||
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
|
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
|
||||||
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
else
|
||||||
|
decoded_frame_rx=-1;
|
||||||
|
|
||||||
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
|
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (decoded_frame_rx != curMsg->proc.frame_rx) &&
|
if ( decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx)
|
||||||
(((decoded_frame_rx+1) % MAX_FRAME_NUMBER) != curMsg->proc.frame_rx) &&
|
|
||||||
(((decoded_frame_rx+2) % MAX_FRAME_NUMBER) != curMsg->proc.frame_rx))
|
|
||||||
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
|
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
|
||||||
decoded_frame_rx, curMsg->proc.frame_rx );
|
decoded_frame_rx, curMsg->proc.frame_rx );
|
||||||
|
|
||||||
|
// but use current UE->timing_advance value to compute writeBlockSize
|
||||||
|
if (UE->timing_advance != timing_advance) {
|
||||||
|
writeBlockSize -= UE->timing_advance - timing_advance;
|
||||||
|
timing_advance = UE->timing_advance;
|
||||||
|
}
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
|
uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
|
||||||
uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots +
|
uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots +
|
||||||
@@ -794,7 +776,7 @@ void *UE_thread(void *arg) {
|
|||||||
|
|
||||||
if (flags || IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1)
|
if (flags || IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1)
|
||||||
AssertFatal( writeBlockSize ==
|
AssertFatal( writeBlockSize ==
|
||||||
UE->rfdevice.trx_write_func(&UE->rfdevice,
|
UE->rfdevice.trx_write_func(&UE->rfdevice,
|
||||||
curMsg->proc.timestamp_tx,
|
curMsg->proc.timestamp_tx,
|
||||||
txp,
|
txp,
|
||||||
writeBlockSize,
|
writeBlockSize,
|
||||||
@@ -806,18 +788,20 @@ void *UE_thread(void *arg) {
|
|||||||
|
|
||||||
nbSlotProcessing++;
|
nbSlotProcessing++;
|
||||||
msgToPush->key=slot_nr;
|
msgToPush->key=slot_nr;
|
||||||
pushTpool(Tpool, msgToPush);
|
pushTpool(&(get_nrUE_params()->Tpool), msgToPush);
|
||||||
|
|
||||||
if (IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR")
|
if ( IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR")
|
||||||
// FixMe: Wait previous thread is done, because race conditions seems too bad
|
// FixMe: Wait previous thread is done, because race conditions seems too bad
|
||||||
// in case of actual RF board, the overlap between threads mitigate the issue
|
// in case of actual RF board, the overlap between threads mitigate the issue
|
||||||
// We must receive one message, that proves the slot processing is done
|
// We must receive one message, that proves the slot processing is done
|
||||||
res=pullTpool(&nf, Tpool);
|
res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
|
||||||
nbSlotProcessing--;
|
nbSlotProcessing--;
|
||||||
processingData_t *tmp=(processingData_t *)res->msgData;
|
processingData_t *tmp=(processingData_t *)res->msgData;
|
||||||
|
|
||||||
if (tmp->proc.decoded_frame_rx != -1)
|
if (tmp->proc.decoded_frame_rx != -1)
|
||||||
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
|
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
|
||||||
|
else
|
||||||
|
decoded_frame_rx=-1;
|
||||||
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
||||||
|
|
||||||
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
|
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
|
||||||
@@ -851,11 +835,11 @@ void init_NR_UE_threads(int nb_inst) {
|
|||||||
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
|
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
|
||||||
threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX);
|
threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX);
|
||||||
|
|
||||||
#ifdef UE_DLSCH_PARALLELISATION
|
if(get_nrUE_params()->nr_dlsch_parallel)
|
||||||
pthread_t dlsch0_threads;
|
{
|
||||||
threadCreate(&dlsch0_threads, dlsch_thread, (void *)UE, "DLthread", -1, OAI_PRIORITY_RT_MAX-1);
|
pthread_t dlsch0_threads;
|
||||||
#endif
|
threadCreate(&dlsch0_threads, dlsch_thread, (void *)UE, "DLthread", -1, OAI_PRIORITY_RT_MAX-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+86
-109
@@ -43,6 +43,7 @@
|
|||||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||||
#include "SCHED/sched_common_vars.h"
|
#include "SCHED/sched_common_vars.h"
|
||||||
#include "PHY/MODULATION/modulation_vars.h"
|
#include "PHY/MODULATION/modulation_vars.h"
|
||||||
|
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||||
//#include "../../SIMU/USER/init_lte.h"
|
//#include "../../SIMU/USER/init_lte.h"
|
||||||
|
|
||||||
#include "LAYER2/MAC/mac_vars.h"
|
#include "LAYER2/MAC/mac_vars.h"
|
||||||
@@ -81,6 +82,7 @@ unsigned short config_frames[4] = {2,9,11,13};
|
|||||||
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
|
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
|
||||||
#include "PHY/TOOLS/phy_scope_interface.h"
|
#include "PHY/TOOLS/phy_scope_interface.h"
|
||||||
#include "PHY/TOOLS/nr_phy_scope.h"
|
#include "PHY/TOOLS/nr_phy_scope.h"
|
||||||
|
#define NRUE_MAIN
|
||||||
#include <executables/nr-uesoftmodem.h>
|
#include <executables/nr-uesoftmodem.h>
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include "executables/thread-common.h"
|
#include "executables/thread-common.h"
|
||||||
@@ -96,33 +98,23 @@ pthread_cond_t sync_cond;
|
|||||||
pthread_mutex_t sync_mutex;
|
pthread_mutex_t sync_mutex;
|
||||||
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
|
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
|
||||||
int config_sync_var=-1;
|
int config_sync_var=-1;
|
||||||
tpool_t *Tpool;
|
|
||||||
#ifdef UE_DLSCH_PARALLELISATION
|
|
||||||
tpool_t *Tpool_dl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RAN_CONTEXT_t RC;
|
RAN_CONTEXT_t RC;
|
||||||
volatile int start_eNB = 0;
|
volatile int start_eNB = 0;
|
||||||
volatile int start_UE = 0;
|
volatile int start_UE = 0;
|
||||||
volatile int oai_exit = 0;
|
volatile int oai_exit = 0;
|
||||||
|
|
||||||
// Command line options
|
|
||||||
|
|
||||||
extern int16_t nr_dlsch_demod_shift;
|
extern int16_t nr_dlsch_demod_shift;
|
||||||
static int tx_max_power[MAX_NUM_CCs] = {0};
|
static int tx_max_power[MAX_NUM_CCs] = {0};
|
||||||
|
|
||||||
int single_thread_flag = 1;
|
int single_thread_flag = 1;
|
||||||
int threequarter_fs = 0;
|
|
||||||
int UE_scan_carrier = 0;
|
|
||||||
int UE_fo_compensation = 0;
|
|
||||||
int UE_no_timing_correction = 0;
|
|
||||||
int N_RB_DL = 0;
|
|
||||||
int tddflag = 0;
|
int tddflag = 0;
|
||||||
int vcdflag = 0;
|
int vcdflag = 0;
|
||||||
uint8_t nb_antenna_tx = 1;
|
|
||||||
uint8_t nb_antenna_rx = 1;
|
|
||||||
double rx_gain_off = 0.0;
|
double rx_gain_off = 0.0;
|
||||||
uint32_t timing_advance = 0;
|
|
||||||
char *usrp_args = NULL;
|
char *usrp_args = NULL;
|
||||||
char *rrc_config_path = NULL;
|
char *rrc_config_path = NULL;
|
||||||
int dumpframe = 0;
|
int dumpframe = 0;
|
||||||
@@ -148,9 +140,9 @@ int16_t node_synch_ref[MAX_NUM_CCs];
|
|||||||
int otg_enabled;
|
int otg_enabled;
|
||||||
double cpuf;
|
double cpuf;
|
||||||
|
|
||||||
runmode_t mode = normal_txrx;
|
|
||||||
int UE_scan = 0;
|
|
||||||
int chain_offset = 0;
|
int chain_offset = 0;
|
||||||
|
int card_offset = 0;
|
||||||
uint64_t num_missed_slots = 0; // counter for the number of missed slots
|
uint64_t num_missed_slots = 0; // counter for the number of missed slots
|
||||||
int transmission_mode = 1;
|
int transmission_mode = 1;
|
||||||
int numerology = 0;
|
int numerology = 0;
|
||||||
@@ -208,74 +200,35 @@ void exit_function(const char *file, const char *function, const int line, const
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *l2l1_task(void *arg) {
|
uint64_t get_nrUE_optmask(void) {
|
||||||
MessageDef *message_p = NULL;
|
return nrUE_params.optmask;
|
||||||
int result;
|
|
||||||
itti_set_task_real_time(TASK_L2L1);
|
|
||||||
itti_mark_task_ready(TASK_L2L1);
|
|
||||||
|
|
||||||
do {
|
|
||||||
// Wait for a message
|
|
||||||
itti_receive_msg (TASK_L2L1, &message_p);
|
|
||||||
|
|
||||||
switch (ITTI_MSG_ID(message_p)) {
|
|
||||||
case TERMINATE_MESSAGE:
|
|
||||||
oai_exit=1;
|
|
||||||
itti_exit_task ();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ACTIVATE_MESSAGE:
|
|
||||||
start_UE = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEACTIVATE_MESSAGE:
|
|
||||||
start_UE = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MESSAGE_TEST:
|
|
||||||
LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
|
||||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
|
||||||
} while(!oai_exit);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t set_nrUE_optmask(uint64_t bitmask) {
|
||||||
|
nrUE_params.optmask = nrUE_params.optmask | bitmask;
|
||||||
|
return nrUE_params.optmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
nrUE_params_t *get_nrUE_params(void) {
|
||||||
|
return &nrUE_params;
|
||||||
|
}
|
||||||
|
/* initialie thread pools used for NRUE processing paralleliation */
|
||||||
|
void init_tpools(uint8_t nun_dlsch_threads) {
|
||||||
|
char *params=calloc(1,(RX_NB_TH*3)+1);
|
||||||
|
for (int i=0; i<RX_NB_TH; i++) {
|
||||||
|
memcpy(params+(i*3),"-1,",3);
|
||||||
|
}
|
||||||
|
initTpool(params, &(nrUE_params.Tpool), false);
|
||||||
|
free(params);
|
||||||
|
init_dlsch_tpool( nun_dlsch_threads);
|
||||||
|
}
|
||||||
static void get_options(void) {
|
static void get_options(void) {
|
||||||
|
|
||||||
char *loopfile=NULL;
|
paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ;
|
||||||
|
int numparams = sizeof(cmdline_params)/sizeof(paramdef_t);
|
||||||
|
config_process_cmdline( cmdline_params,numparams,NULL);
|
||||||
|
|
||||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ;
|
|
||||||
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
|
||||||
paramdef_t cmdline_uemodeparams[] = CMDLINE_UEMODEPARAMS_DESC;
|
|
||||||
paramdef_t cmdline_ueparams[] = CMDLINE_NRUEPARAMS_DESC;
|
|
||||||
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
|
|
||||||
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
|
|
||||||
|
|
||||||
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
|
|
||||||
|
|
||||||
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
|
|
||||||
|
|
||||||
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp;
|
|
||||||
|
|
||||||
if (cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr)
|
|
||||||
if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach;
|
|
||||||
|
|
||||||
if (cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr)
|
|
||||||
if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect;
|
|
||||||
|
|
||||||
if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr)
|
|
||||||
if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx;
|
|
||||||
|
|
||||||
if ((cmdline_uemodeparams[CMDLINE_DUMPMEMORY_IDX].paramflags & PARAMFLAG_PARAMSET) != 0)
|
|
||||||
mode = rx_dump_frame;
|
|
||||||
|
|
||||||
if (vcdflag > 0)
|
if (vcdflag > 0)
|
||||||
ouput_vcd = 1;
|
ouput_vcd = 1;
|
||||||
@@ -287,10 +240,43 @@ static void get_options(void) {
|
|||||||
printf("%s\n",uecap_xer);
|
printf("%s\n",uecap_xer);
|
||||||
uecap_xer_in=1;
|
uecap_xer_in=1;
|
||||||
} /* UE with config file */
|
} /* UE with config file */
|
||||||
|
init_tpools(nrUE_params.nr_dlsch_parallel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set PHY vars from command line
|
// set PHY vars from command line
|
||||||
void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
||||||
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
|
paramdef_t cmdline_params[] = CMDLINE_NRUE_PHYPARAMS_DESC ;
|
||||||
|
int numparams = sizeof(cmdline_params)/sizeof(paramdef_t);
|
||||||
|
|
||||||
|
UE->mode = normal_txrx;
|
||||||
|
|
||||||
|
config_process_cmdline( cmdline_params,numparams,NULL);
|
||||||
|
|
||||||
|
int pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRX_OPT);
|
||||||
|
if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue;
|
||||||
|
|
||||||
|
pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRXMED_OPT);
|
||||||
|
if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue_med;
|
||||||
|
|
||||||
|
pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRXBYP_OPT);
|
||||||
|
if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue_byp;
|
||||||
|
|
||||||
|
pindex = config_paramidx_fromname(cmdline_params,numparams, DBGPRACH_OPT);
|
||||||
|
if (cmdline_params[pindex].uptr)
|
||||||
|
if ( *(cmdline_params[pindex].uptr) > 0) UE->mode = debug_prach;
|
||||||
|
|
||||||
|
pindex = config_paramidx_fromname(cmdline_params,numparams,NOL2CONNECT_OPT );
|
||||||
|
if (cmdline_params[pindex].uptr)
|
||||||
|
if ( *(cmdline_params[pindex].uptr) > 0) UE->mode = no_L2_connect;
|
||||||
|
|
||||||
|
pindex = config_paramidx_fromname(cmdline_params,numparams,CALIBPRACH_OPT );
|
||||||
|
if (cmdline_params[pindex].uptr)
|
||||||
|
if ( *(cmdline_params[pindex].uptr) > 0) UE->mode = calib_prach_tx;
|
||||||
|
|
||||||
|
pindex = config_paramidx_fromname(cmdline_params,numparams,DUMPFRAME_OPT );
|
||||||
|
if ((cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0)
|
||||||
|
UE->mode = rx_dump_frame;
|
||||||
|
|
||||||
// Init power variables
|
// Init power variables
|
||||||
tx_max_power[CC_id] = tx_max_power[0];
|
tx_max_power[CC_id] = tx_max_power[0];
|
||||||
@@ -298,32 +284,29 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
|||||||
tx_gain[0][CC_id] = tx_gain[0][0];
|
tx_gain[0][CC_id] = tx_gain[0][0];
|
||||||
|
|
||||||
// Set UE variables
|
// Set UE variables
|
||||||
UE->UE_scan = UE_scan;
|
|
||||||
UE->UE_scan_carrier = UE_scan_carrier;
|
|
||||||
UE->UE_fo_compensation = UE_fo_compensation;
|
|
||||||
UE->no_timing_correction = UE_no_timing_correction;
|
|
||||||
UE->mode = mode;
|
|
||||||
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
||||||
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
||||||
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
||||||
|
UE->rf_map.card = card_offset;
|
||||||
|
UE->rf_map.chain = CC_id + chain_offset;
|
||||||
|
|
||||||
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction);
|
|
||||||
|
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n",
|
||||||
|
UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction);
|
||||||
|
|
||||||
// Set FP variables
|
// Set FP variables
|
||||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
|
||||||
fp->nb_antennas_tx = nb_antenna_tx;
|
|
||||||
fp->nb_antennas_rx = nb_antenna_rx;
|
|
||||||
fp->threequarter_fs = threequarter_fs;
|
|
||||||
if (tddflag){
|
if (tddflag){
|
||||||
fp->frame_type = TDD;
|
fp->frame_type = TDD;
|
||||||
LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type);
|
LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type);
|
||||||
}
|
}
|
||||||
if (N_RB_DL){
|
|
||||||
fp->N_RB_DL = N_RB_DL;
|
|
||||||
LOG_I(PHY, "Set UE N_RB_DL %d\n", N_RB_DL);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", nb_antenna_rx, nb_antenna_tx, threequarter_fs);
|
LOG_I(PHY, "Set UE N_RB_DL %d\n", fp->N_RB_DL);
|
||||||
|
|
||||||
|
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,23 +475,17 @@ int main( int argc, char **argv ) {
|
|||||||
// initialize logging
|
// initialize logging
|
||||||
logInit();
|
logInit();
|
||||||
// get options and fill parameters from configuration file
|
// get options and fill parameters from configuration file
|
||||||
get_options(); //Command-line options
|
|
||||||
|
get_options (); //Command-line options specific for NRUE
|
||||||
|
|
||||||
get_common_options(SOFTMODEM_5GUE_BIT );
|
get_common_options(SOFTMODEM_5GUE_BIT );
|
||||||
|
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
T_Config_Init();
|
T_Config_Init();
|
||||||
#endif
|
#endif
|
||||||
//randominit (0);
|
//randominit (0);
|
||||||
set_taus_seed (0);
|
set_taus_seed (0);
|
||||||
tpool_t pool;
|
|
||||||
Tpool = &pool;
|
|
||||||
char params[]="-1,-1";
|
|
||||||
initTpool(params, Tpool, false);
|
|
||||||
#ifdef UE_DLSCH_PARALLELISATION
|
|
||||||
tpool_t pool_dl;
|
|
||||||
Tpool_dl = &pool_dl;
|
|
||||||
char params_dl[]="-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1";
|
|
||||||
initTpool(params_dl, Tpool_dl, false);
|
|
||||||
#endif
|
|
||||||
cpuf=get_cpu_freq_GHz();
|
cpuf=get_cpu_freq_GHz();
|
||||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||||
|
|
||||||
@@ -536,8 +513,12 @@ int main( int argc, char **argv ) {
|
|||||||
if (get_softmodem_params()->do_ra)
|
if (get_softmodem_params()->do_ra)
|
||||||
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
|
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
|
||||||
|
|
||||||
|
if (get_softmodem_params()->sa)
|
||||||
|
AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n");
|
||||||
|
|
||||||
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||||
|
|
||||||
|
|
||||||
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
|
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
|
||||||
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
||||||
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
|
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
|
||||||
@@ -575,13 +556,9 @@ int main( int argc, char **argv ) {
|
|||||||
load_softscope("nr",PHY_vars_UE_g[0][0]);
|
load_softscope("nr",PHY_vars_UE_g[0][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
|
||||||
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
|
|
||||||
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
|
|
||||||
PHY_vars_UE_g[0][CC_id]->timing_advance = timing_advance;
|
|
||||||
}
|
|
||||||
|
|
||||||
init_NR_UE_threads(1);
|
init_NR_UE_threads(1);
|
||||||
|
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||||
printf("UE threads created by %ld\n", gettid());
|
printf("UE threads created by %ld\n", gettid());
|
||||||
|
|
||||||
// wait for end of program
|
// wait for end of program
|
||||||
|
|||||||
@@ -5,71 +5,76 @@
|
|||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization"
|
||||||
/***************************************************************************************************************************************/
|
/***************************************************************************************************************************************/
|
||||||
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
|
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
|
||||||
when calling config_get or config_getlist functions */
|
when calling config_get or config_getlist functions */
|
||||||
|
|
||||||
|
#define CALIBRX_OPT "calib-ue-rx"
|
||||||
|
#define CALIBRXMED_OPT "calib-ue-rx-med"
|
||||||
|
#define CALIBRXBYP_OPT "calib-ue-rx-byp"
|
||||||
|
#define DBGPRACH_OPT "debug-ue-prach"
|
||||||
|
#define NOL2CONNECT_OPT "no-L2-connect"
|
||||||
|
#define CALIBPRACH_OPT "calib-prach-tx"
|
||||||
|
#define DUMPFRAME_OPT "ue-dump-frame"
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
/* command line parameters defining UE running mode */
|
||||||
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
|
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
#define CMDLINE_NRUEPARAMS_DESC { \
|
||||||
|
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
|
||||||
|
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
|
||||||
|
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \
|
||||||
|
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||||
|
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
|
||||||
|
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* command line parameters defining UE running mode */
|
/* command line parameters defining UE running mode */
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define CMDLINE_UEMODEPARAMS_DESC { \
|
#define CMDLINE_NRUE_PHYPARAMS_DESC { \
|
||||||
{"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
{ CALIBRX_OPT, CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||||
{"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
{ CALIBRXMED_OPT, CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||||
{"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
{ CALIBRXBYP_OPT, CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||||
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
{ DBGPRACH_OPT, CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||||
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
{ NOL2CONNECT_OPT, CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||||
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
{CALIBPRACH_OPT, CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||||
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
|
{ DUMPFRAME_OPT, CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
|
||||||
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
|
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
}
|
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
#define CMDLINE_CALIBUERX_IDX 0
|
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
#define CMDLINE_CALIBUERXMED_IDX 1
|
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
|
||||||
#define CMDLINE_CALIBUERXBYP_IDX 2
|
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
|
||||||
#define CMDLINE_DEBUGUEPRACH_IDX 3
|
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
|
||||||
#define CMDLINE_NOL2CONNECT_IDX 4
|
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \
|
||||||
#define CMDLINE_CALIBPRACHTX_IDX 5
|
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
|
||||||
#define CMDLINE_MEMLOOP_IDX 6
|
{"r" , CONFIG_HLP_PRB, 0, iptr:&(fp->N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
||||||
#define CMDLINE_DUMPMEMORY_IDX 7
|
{"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \
|
||||||
|
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||||
|
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
|
||||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
|
||||||
/* command line parameters specific to UE */
|
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
|
||||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
|
||||||
#define CMDLINE_NRUEPARAMS_DESC { \
|
|
||||||
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
|
||||||
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
|
||||||
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
|
||||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
|
|
||||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
|
|
||||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&UE_fo_compensation, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
|
|
||||||
{"r" , CONFIG_HLP_PRB, 0, iptr:&(N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
|
||||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
|
||||||
/* command line parameters common to gNB and UE */
|
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
|
||||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
|
||||||
#define CMDLINE_PARAMS_DESC_UE { \
|
|
||||||
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
|
|
||||||
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
|
|
||||||
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int T_port;
|
|
||||||
extern int T_nowait;
|
typedef struct {
|
||||||
extern int T_dont_fork;
|
uint64_t optmask; //mask to store boolean config options
|
||||||
|
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
|
||||||
|
tpool_t Tpool; // thread pool
|
||||||
|
} nrUE_params_t;
|
||||||
|
extern uint64_t get_nrUE_optmask(void);
|
||||||
|
extern uint64_t set_nrUE_optmask(uint64_t bitmask);
|
||||||
|
extern nrUE_params_t *get_nrUE_params(void);
|
||||||
|
|
||||||
|
#ifdef NRUE_MAIN
|
||||||
|
nrUE_params_t nrUE_params;
|
||||||
|
#endif
|
||||||
|
|
||||||
// In nr-ue.c
|
// In nr-ue.c
|
||||||
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||||
@@ -80,6 +85,5 @@ extern void reset_opp_meas(void);
|
|||||||
extern void print_opp_meas(void);
|
extern void print_opp_meas(void);
|
||||||
void *UE_thread(void *arg);
|
void *UE_thread(void *arg);
|
||||||
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag);
|
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag);
|
||||||
extern tpool_t *Tpool;
|
|
||||||
extern tpool_t *Tpool_dl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ extern "C"
|
|||||||
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
|
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
|
||||||
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
|
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
|
||||||
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
|
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
|
||||||
|
#define CONFIG_HLP_SA "run gNB in standalone mode\n"
|
||||||
#define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n"
|
#define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n"
|
||||||
#define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0"
|
#define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0"
|
||||||
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
|
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
|
||||||
@@ -100,6 +101,7 @@ extern "C"
|
|||||||
#define TP_CONFIG softmodem_params.threadPoolConfig
|
#define TP_CONFIG softmodem_params.threadPoolConfig
|
||||||
#define PHY_TEST softmodem_params.phy_test
|
#define PHY_TEST softmodem_params.phy_test
|
||||||
#define DO_RA softmodem_params.do_ra
|
#define DO_RA softmodem_params.do_ra
|
||||||
|
#define SA softmodem_params.sa
|
||||||
#define WAIT_FOR_SYNC softmodem_params.wait_for_sync
|
#define WAIT_FOR_SYNC softmodem_params.wait_for_sync
|
||||||
#define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag
|
#define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag
|
||||||
#define CHAIN_OFFSET softmodem_params.chain_offset
|
#define CHAIN_OFFSET softmodem_params.chain_offset
|
||||||
@@ -119,6 +121,7 @@ extern "C"
|
|||||||
{"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \
|
{"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \
|
||||||
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
|
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
|
||||||
{"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \
|
{"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \
|
||||||
|
{"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \
|
||||||
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
|
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
|
||||||
{"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
{"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
||||||
{"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
{"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
||||||
@@ -213,6 +216,7 @@ typedef struct {
|
|||||||
char threadPoolConfig[1024];
|
char threadPoolConfig[1024];
|
||||||
int phy_test;
|
int phy_test;
|
||||||
int do_ra;
|
int do_ra;
|
||||||
|
int sa;
|
||||||
uint8_t usim_test;
|
uint8_t usim_test;
|
||||||
int emulate_rf;
|
int emulate_rf;
|
||||||
int wait_for_sync; //eNodeB only
|
int wait_for_sync; //eNodeB only
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#define FAPI_NR_DL_CONFIG_TYPE_DCI 0x01
|
#define FAPI_NR_DL_CONFIG_TYPE_DCI 0x01
|
||||||
#define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02
|
#define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02
|
||||||
#define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03
|
#define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03
|
||||||
|
#define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04
|
||||||
|
|
||||||
#define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
|
#define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
|
||||||
#define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
|
#define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
|
||||||
|
|||||||
@@ -474,6 +474,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
ue->total_TBS_last[eNB_id] = 0;
|
ue->total_TBS_last[eNB_id] = 0;
|
||||||
ue->bitrate[eNB_id] = 0;
|
ue->bitrate[eNB_id] = 0;
|
||||||
ue->total_received_bits[eNB_id] = 0;
|
ue->total_received_bits[eNB_id] = 0;
|
||||||
|
|
||||||
|
ue->ul_time_alignment[eNB_id].apply_ta = 0;
|
||||||
|
ue->ul_time_alignment[eNB_id].ta_frame = -1;
|
||||||
|
ue->ul_time_alignment[eNB_id].ta_slot = -1;
|
||||||
}
|
}
|
||||||
// init NR modulation lookup tables
|
// init NR modulation lookup tables
|
||||||
nr_generate_modulation_table();
|
nr_generate_modulation_table();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue)
|
|||||||
reset = 1;
|
reset = 1;
|
||||||
x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3);
|
x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3);
|
||||||
|
|
||||||
for (n=0; n<NR_PBCH_DMRS_LENGTH_DWORD; n++) {
|
for (n=0; n<NR_PBCH_DMRS_LENGTH_DWORD; n++) {
|
||||||
ue->nr_gold_pbch[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset);
|
ue->nr_gold_pbch[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset);
|
||||||
reset = 0;
|
reset = 0;
|
||||||
}
|
}
|
||||||
@@ -77,8 +77,8 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
|
|||||||
void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
|
void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
|
||||||
unsigned short *n_idDMRS)
|
unsigned short *n_idDMRS)
|
||||||
{
|
{
|
||||||
unsigned char ns,l;
|
unsigned char l;
|
||||||
unsigned int n,x1,x2,x2tmp0;
|
unsigned int n,x1,x2,x2tmp0,ns;
|
||||||
int nscid;
|
int nscid;
|
||||||
unsigned int nid;
|
unsigned int nid;
|
||||||
uint8_t reset;
|
uint8_t reset;
|
||||||
@@ -87,17 +87,22 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
|
|||||||
//unsigned short lbar = 0;
|
//unsigned short lbar = 0;
|
||||||
|
|
||||||
for (nscid=0; nscid<2; nscid++) {
|
for (nscid=0; nscid<2; nscid++) {
|
||||||
|
|
||||||
nid = n_idDMRS[nscid];
|
|
||||||
for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) {
|
for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) {
|
||||||
|
|
||||||
|
nid = n_idDMRS[nscid];
|
||||||
|
|
||||||
for (l=0; l<ue->frame_parms.symbols_per_slot; l++) {
|
for (l=0; l<ue->frame_parms.symbols_per_slot; l++) {
|
||||||
|
|
||||||
reset = 1;
|
reset = 1;
|
||||||
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
|
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
|
||||||
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
|
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
|
||||||
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid);
|
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid);
|
||||||
|
|
||||||
|
reset = 1;
|
||||||
|
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
|
||||||
|
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
|
||||||
|
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid);
|
||||||
|
|
||||||
for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||||
ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset);
|
ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset);
|
||||||
reset = 0;
|
reset = 0;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LAYER2/NR_MAC_gNB/nr_mac_gNB.h>
|
||||||
#include "nr_dci.h"
|
#include "nr_dci.h"
|
||||||
#include "nr_dlsch.h"
|
#include "nr_dlsch.h"
|
||||||
#include "nr_sch_dmrs.h"
|
#include "nr_sch_dmrs.h"
|
||||||
@@ -81,17 +82,13 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
int rb_offset;
|
int rb_offset;
|
||||||
int n_rb;
|
int n_rb;
|
||||||
|
|
||||||
nr_fill_cce_list(gNB,0,pdcch_pdu_rel15);
|
|
||||||
|
|
||||||
get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset);
|
|
||||||
|
|
||||||
// compute rb_offset and n_prb based on frequency allocation
|
// compute rb_offset and n_prb based on frequency allocation
|
||||||
|
nr_fill_cce_list(gNB,0,pdcch_pdu_rel15);
|
||||||
|
get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset);
|
||||||
|
cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB;
|
||||||
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) {
|
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) {
|
||||||
cset_start_sc = frame_parms.first_carrier_offset +
|
cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB;
|
||||||
(frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB + rb_offset)*NR_NB_SC_PER_RB;
|
}
|
||||||
} else
|
|
||||||
cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB;
|
|
||||||
|
|
||||||
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
|
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
|
||||||
/*The coreset is initialised
|
/*The coreset is initialised
|
||||||
@@ -105,8 +102,6 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb);
|
LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb);
|
||||||
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
|
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
|
||||||
// DMRS length is per OFDM symbol
|
// DMRS length is per OFDM symbol
|
||||||
AssertFatal(pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED,
|
|
||||||
"Interleaved CCE REG MAPPING not supported\n");
|
|
||||||
uint32_t dmrs_length = (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)?
|
uint32_t dmrs_length = (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)?
|
||||||
(n_rb*6) : (pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE)
|
(n_rb*6) : (pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE)
|
||||||
uint32_t encoded_length = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE)
|
uint32_t encoded_length = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE)
|
||||||
@@ -198,7 +193,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
for (int m=0; m<NR_NB_SC_PER_RB; m++) {
|
for (int m=0; m<NR_NB_SC_PER_RB; m++) {
|
||||||
if ( m == (k_prime<<2)+1) { // DMRS if not already mapped
|
if ( m == (k_prime<<2)+1) { // DMRS if not already mapped
|
||||||
if (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED) {
|
//if (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED) {
|
||||||
((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[l][dmrs_idx<<1]) >> 15;
|
((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[l][dmrs_idx<<1]) >> 15;
|
||||||
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
|
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
|
||||||
#ifdef DEBUG_PDCCH_DMRS
|
#ifdef DEBUG_PDCCH_DMRS
|
||||||
@@ -206,7 +201,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
|
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
|
||||||
#endif
|
#endif
|
||||||
dmrs_idx++;
|
dmrs_idx++;
|
||||||
}
|
//}
|
||||||
|
|
||||||
k_prime++;
|
k_prime++;
|
||||||
} else { // DCI payload
|
} else { // DCI payload
|
||||||
@@ -225,7 +220,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
|||||||
k -= frame_parms.ofdm_symbol_size;
|
k -= frame_parms.ofdm_symbol_size;
|
||||||
} // m
|
} // m
|
||||||
} // reg_idx
|
} // reg_idx
|
||||||
|
|
||||||
|
LOG_I(PHY, "DCI: payloadSize = %d | payload = %llx\n",
|
||||||
|
*pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload);
|
||||||
|
|
||||||
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
|
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
|||||||
/// Resource mapping
|
/// Resource mapping
|
||||||
|
|
||||||
// Non interleaved VRB to PRB mapping
|
// Non interleaved VRB to PRB mapping
|
||||||
uint16_t start_sc = frame_parms->first_carrier_offset + rel15->rbStart*NR_NB_SC_PER_RB;
|
uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB;
|
||||||
if (start_sc >= frame_parms->ofdm_symbol_size)
|
if (start_sc >= frame_parms->ofdm_symbol_size)
|
||||||
start_sc -= frame_parms->ofdm_symbol_size;
|
start_sc -= frame_parms->ofdm_symbol_size;
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
time_stats_t *dlsch_interleaving_stats,
|
time_stats_t *dlsch_interleaving_stats,
|
||||||
time_stats_t *dlsch_segmentation_stats);
|
time_stats_t *dlsch_segmentation_stats);
|
||||||
|
|
||||||
|
void init_dlsch_tpool(uint8_t nun_dlsch_threads);
|
||||||
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
|
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
|
||||||
|
|
||||||
void dump_pdsch_stats(PHY_VARS_gNB *gNB);
|
void dump_pdsch_stats(PHY_VARS_gNB *gNB);
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ void nr_processULSegment(void* arg) {
|
|||||||
int no_iteration_ldpc;
|
int no_iteration_ldpc;
|
||||||
int Kr;
|
int Kr;
|
||||||
int Kr_bytes;
|
int Kr_bytes;
|
||||||
int K_bytes_F;
|
int K_bits_F;
|
||||||
uint8_t crc_type;
|
uint8_t crc_type;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
@@ -318,8 +318,7 @@ void nr_processULSegment(void* arg) {
|
|||||||
|
|
||||||
Kr = ulsch_harq->K;
|
Kr = ulsch_harq->K;
|
||||||
Kr_bytes = Kr>>3;
|
Kr_bytes = Kr>>3;
|
||||||
|
K_bits_F = Kr-ulsch_harq->F;
|
||||||
K_bytes_F = Kr_bytes-(ulsch_harq->F>>3);
|
|
||||||
|
|
||||||
t_nrLDPC_time_stats procTime;
|
t_nrLDPC_time_stats procTime;
|
||||||
t_nrLDPC_time_stats* p_procTime = &procTime ;
|
t_nrLDPC_time_stats* p_procTime = &procTime ;
|
||||||
@@ -402,23 +401,19 @@ void nr_processULSegment(void* arg) {
|
|||||||
|
|
||||||
//start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
|
//start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
|
||||||
|
|
||||||
memset(pv,0,2*ulsch_harq->Z*sizeof(int16_t));
|
//set first 2*Z_c bits to zeros
|
||||||
memset((pv+K_bytes_F),127,ulsch_harq->F*sizeof(int16_t));
|
memset(&z[0],0,2*ulsch_harq->Z*sizeof(int16_t));
|
||||||
|
//set Filler bits
|
||||||
for (i=((2*p_decoderParms->Z)>>3), j = 0; i < K_bytes_F; i++, j++) {
|
memset((&z[0]+K_bits_F),127,ulsch_harq->F*sizeof(int16_t));
|
||||||
pv[i]= _mm_loadu_si128((__m128i*)(&ulsch_harq->d[r][8*j]));
|
//Move coded bits before filler bits
|
||||||
}
|
memcpy((&z[0]+2*ulsch_harq->Z),ulsch_harq->d[r],(K_bits_F-2*ulsch_harq->Z)*sizeof(int16_t));
|
||||||
|
//skip filler bits
|
||||||
AssertFatal(kc!=255,"");
|
memcpy((&z[0]+Kr),ulsch_harq->d[r]+(Kr-2*ulsch_harq->Z),(kc*ulsch_harq->Z-Kr)*sizeof(int16_t));
|
||||||
j+=(ulsch_harq->F>>3);
|
//Saturate coded bits before decoding into 8 bits values
|
||||||
for (i=Kr_bytes; i < ((kc*p_decoderParms->Z)>>3); i++, j++) {
|
for (i=0, j=0; j < ((kc*ulsch_harq->Z)>>4)+1; i+=2, j++)
|
||||||
pv[i]= _mm_loadu_si128((__m128i*)(&ulsch_harq->d[r][8*j]));
|
{
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0, j=0; j < ((kc*p_decoderParms->Z)>>4); i+=2, j++) {
|
|
||||||
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
|
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -523,31 +518,27 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
|
|
||||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
|
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
|
||||||
p_decParams->BG = 2;
|
p_decParams->BG = 2;
|
||||||
|
kc = 52;
|
||||||
if (Coderate < 0.3333) {
|
if (Coderate < 0.3333) {
|
||||||
p_decParams->R = 15;
|
p_decParams->R = 15;
|
||||||
kc = 52;
|
|
||||||
}
|
}
|
||||||
else if (Coderate <0.6667) {
|
else if (Coderate <0.6667) {
|
||||||
p_decParams->R = 13;
|
p_decParams->R = 13;
|
||||||
kc = 32;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_decParams->R = 23;
|
p_decParams->R = 23;
|
||||||
kc = 17;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p_decParams->BG = 1;
|
p_decParams->BG = 1;
|
||||||
|
kc = 68;
|
||||||
if (Coderate < 0.6667) {
|
if (Coderate < 0.6667) {
|
||||||
p_decParams->R = 13;
|
p_decParams->R = 13;
|
||||||
kc = 68;
|
|
||||||
}
|
}
|
||||||
else if (Coderate <0.8889) {
|
else if (Coderate <0.8889) {
|
||||||
p_decParams->R = 23;
|
p_decParams->R = 23;
|
||||||
kc = 35;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_decParams->R = 89;
|
p_decParams->R = 89;
|
||||||
kc = 27;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void
|
|||||||
phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
|
phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
LOG_I(PHY,"Gain control: rssi %d (%d,%d)\n",
|
LOG_D(PHY,"Gain control: rssi %d (%d,%d)\n",
|
||||||
rx_power_fil_dB,
|
rx_power_fil_dB,
|
||||||
ue->measurements.rssi,
|
ue->measurements.rssi,
|
||||||
ue->measurements.rx_power_avg_dB[eNB_id]
|
ue->measurements.rx_power_avg_dB[eNB_id]
|
||||||
@@ -61,7 +61,7 @@ phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id
|
|||||||
ue->rx_total_gain_dB = MIN_RF_GAIN;
|
ue->rx_total_gain_dB = MIN_RF_GAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_I(PHY,"Gain control: rx_total_gain_dB = %d TARGET_RX_POWER %d (max %d,rxpf %d)\n",ue->rx_total_gain_dB,TARGET_RX_POWER,MAX_RF_GAIN,rx_power_fil_dB);
|
LOG_D(PHY,"Gain control: rx_total_gain_dB = %d TARGET_RX_POWER %d (max %d,rxpf %d)\n",ue->rx_total_gain_dB,TARGET_RX_POWER,MAX_RF_GAIN,rx_power_fil_dB);
|
||||||
|
|
||||||
#ifdef DEBUG_PHY
|
#ifdef DEBUG_PHY
|
||||||
/* if ((ue->frame%100==0) || (ue->frame < 10))
|
/* if ((ue->frame%100==0) || (ue->frame < 10))
|
||||||
|
|||||||
@@ -660,6 +660,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned short p,
|
unsigned short p,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
|
unsigned short BWPStart,
|
||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
unsigned short nb_rb_pdsch)
|
unsigned short nb_rb_pdsch)
|
||||||
{
|
{
|
||||||
@@ -693,7 +694,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// generate pilot for gNB port number 1000+p
|
// generate pilot for gNB port number 1000+p
|
||||||
uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12;
|
uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12 - BWPStart;
|
||||||
uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type;
|
uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type;
|
||||||
int8_t delta = get_delta(p, config_type);
|
int8_t delta = get_delta(p, config_type);
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned short p,
|
unsigned short p,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
|
unsigned short BWPStart,
|
||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
unsigned short nb_rb_pdsch);
|
unsigned short nb_rb_pdsch);
|
||||||
|
|
||||||
@@ -86,17 +87,17 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
|
|
||||||
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
unsigned int subframe_offset,
|
uint8_t slot);
|
||||||
unsigned char N0_symbol,
|
|
||||||
unsigned char abstraction_flag,
|
|
||||||
unsigned char rank_adaptation,
|
|
||||||
uint8_t subframe);
|
|
||||||
|
|
||||||
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
uint8_t abstraction_flag);
|
uint8_t abstraction_flag);
|
||||||
|
|
||||||
|
void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
||||||
|
UE_nr_rxtx_proc_t *proc,
|
||||||
|
uint8_t slot);
|
||||||
|
|
||||||
void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
|
void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
|
||||||
uint32_t rx_power_fil_dB,
|
uint32_t rx_power_fil_dB,
|
||||||
uint8_t eNB_id);
|
uint8_t eNB_id);
|
||||||
|
|||||||
@@ -19,6 +19,18 @@
|
|||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*! \file nr_ue_measurements.c
|
||||||
|
* \brief UE measurements routines
|
||||||
|
* \author R. Knopp, G. Casati
|
||||||
|
* \date 2020
|
||||||
|
* \version 0.1
|
||||||
|
* \company Eurecom, Fraunhofer IIS
|
||||||
|
* \email: knopp@eurecom.fr, guido.casati@iis.fraunhofer.de
|
||||||
|
* \note
|
||||||
|
* \warning
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "nr-softmodem-common.h"
|
||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
#include "PHY/phy_extern_nr_ue.h"
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
@@ -33,29 +45,6 @@
|
|||||||
//#define DEBUG_MEAS_UE
|
//#define DEBUG_MEAS_UE
|
||||||
//#define DEBUG_RANK_EST
|
//#define DEBUG_RANK_EST
|
||||||
|
|
||||||
#if 0
|
|
||||||
int16_t cond_num_threshold = 0;
|
|
||||||
|
|
||||||
void print_shorts(char *s,short *x)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
printf("%s : %d,%d,%d,%d,%d,%d,%d,%d\n",s,
|
|
||||||
x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
void print_ints(char *s,int *x)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
printf("%s : %d,%d,%d,%d\n",s,
|
|
||||||
x[0],x[1],x[2],x[3]
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
||||||
|
|
||||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||||
@@ -105,117 +94,84 @@ float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index)
|
|||||||
return -140.0;
|
return -140.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
unsigned int subframe_offset,
|
uint8_t slot)
|
||||||
unsigned char N0_symbol,
|
|
||||||
unsigned char abstraction_flag,
|
|
||||||
unsigned char rank_adaptation,
|
|
||||||
uint8_t subframe)
|
|
||||||
{
|
{
|
||||||
int aarx,aatx,eNB_id=0; //,gain_offset=0;
|
int aarx, aatx, gNB_id = 0;
|
||||||
//int rx_power[NUMBER_OF_CONNECTED_eNB_MAX];
|
|
||||||
|
|
||||||
/*#if defined(__x86_64__) || defined(__i386__)
|
|
||||||
__m128i *dl_ch0_128, *dl_ch1_128;
|
|
||||||
#elif defined(__arm__)
|
|
||||||
int16x8_t *dl_ch0_128, *dl_ch1_128get_PL;
|
|
||||||
#endif*/
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||||
//unsigned int limit, subband;
|
int ch_offset = frame_parms->ofdm_symbol_size*2;
|
||||||
//int nb_subbands, subband_size, last_subband_size, *dl_ch0, *dl_ch1, N_RB_DL = frame_parms->N_RB_DL;
|
NR_UE_DLSCH_t *dlsch = ue->dlsch[proc->thread_id][gNB_id][0];
|
||||||
|
uint8_t harq_pid = dlsch->current_harq_pid;
|
||||||
int ch_offset, rank_tm3_tm4 = 0;
|
int N_RB_DL = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||||
|
|
||||||
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
|
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
|
||||||
|
|
||||||
/*int16_t *dl_ch;
|
|
||||||
dl_ch = (int16_t *)&ue->pdsch_vars[proc->thread_id][0]->dl_ch_estimates[eNB_id][ch_offset];*/
|
|
||||||
|
|
||||||
ch_offset = ue->frame_parms.ofdm_symbol_size*2;
|
|
||||||
|
|
||||||
//printf("testing measurements\n");
|
|
||||||
// signal measurements
|
// signal measurements
|
||||||
|
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++){
|
||||||
|
|
||||||
for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
|
ue->measurements.rx_power_tot[gNB_id] = 0;
|
||||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
|
||||||
for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) {
|
|
||||||
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] =
|
|
||||||
(signal_energy_nodc(&ue->pdsch_vars[proc->thread_id][0]->dl_ch_estimates[eNB_id][ch_offset],
|
|
||||||
(50*12)));
|
|
||||||
//- ue->measurements.n0_power[aarx];
|
|
||||||
|
|
||||||
if (ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]<0)
|
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++){
|
||||||
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = 0; //ue->measurements.n0_power[aarx];
|
|
||||||
|
|
||||||
ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]);
|
ue->measurements.rx_power[gNB_id][aarx] = 0;
|
||||||
|
|
||||||
if (aatx==0)
|
for (aatx = 0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++){
|
||||||
ue->measurements.rx_power[eNB_id][aarx] = ue->measurements.rx_spatial_power[eNB_id][aatx][aarx];
|
|
||||||
else
|
|
||||||
ue->measurements.rx_power[eNB_id][aarx] += ue->measurements.rx_spatial_power[eNB_id][aatx][aarx];
|
|
||||||
} //aatx
|
|
||||||
|
|
||||||
ue->measurements.rx_power_dB[eNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[eNB_id][aarx]);
|
ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = (signal_energy_nodc(&ue->pdsch_vars[proc->thread_id][0]->dl_ch_estimates[gNB_id][ch_offset], N_RB_DL*NR_NB_SC_PER_RB));
|
||||||
|
|
||||||
if (aarx==0)
|
if (ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]<0)
|
||||||
ue->measurements.rx_power_tot[eNB_id] = ue->measurements.rx_power[eNB_id][aarx];
|
ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = 0;
|
||||||
else
|
|
||||||
ue->measurements.rx_power_tot[eNB_id] += ue->measurements.rx_power[eNB_id][aarx];
|
|
||||||
} //aarx
|
|
||||||
|
|
||||||
ue->measurements.rx_power_tot_dB[eNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[eNB_id]);
|
ue->measurements.rx_spatial_power_dB[gNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]);
|
||||||
|
ue->measurements.rx_power[gNB_id][aarx] += ue->measurements.rx_spatial_power[gNB_id][aatx][aarx];
|
||||||
|
|
||||||
} //eNB_id
|
}
|
||||||
|
|
||||||
//printf("ue measurement addr dlch %p\n", dl_ch);
|
|
||||||
|
|
||||||
eNB_id=0;
|
ue->measurements.rx_power_dB[gNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[gNB_id][aarx]);
|
||||||
|
ue->measurements.rx_power_tot[gNB_id] += ue->measurements.rx_power[gNB_id][aarx];
|
||||||
|
|
||||||
if (ue->transmission_mode[eNB_id]!=4 && ue->transmission_mode[eNB_id]!=3)
|
}
|
||||||
ue->measurements.rank[eNB_id] = 0;
|
|
||||||
else
|
ue->measurements.rx_power_tot_dB[gNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[gNB_id]);
|
||||||
ue->measurements.rank[eNB_id] = rank_tm3_tm4;
|
|
||||||
// printf ("tx mode %d\n", ue->transmission_mode[eNB_id]);
|
}
|
||||||
// printf ("rank %d\n", ue->PHY_measurements.rank[eNB_id]);
|
|
||||||
|
|
||||||
// filter to remove jitter
|
// filter to remove jitter
|
||||||
if (ue->init_averaging == 0) {
|
if (ue->init_averaging == 0) {
|
||||||
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++)
|
|
||||||
ue->measurements.rx_power_avg[eNB_id] = (int)
|
|
||||||
(((k1*((long long int)(ue->measurements.rx_power_avg[eNB_id]))) +
|
|
||||||
(k2*((long long int)(ue->measurements.rx_power_tot[eNB_id]))))>>10);
|
|
||||||
|
|
||||||
//LOG_I(PHY,"Noise Power Computation: k1 %d k2 %d n0 avg %d n0 tot %d\n", k1, k2, ue->measurements.n0_power_avg,
|
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++)
|
||||||
// ue->measurements.n0_power_tot);
|
ue->measurements.rx_power_avg[gNB_id] = (int)(((k1*((long long int)(ue->measurements.rx_power_avg[gNB_id]))) + (k2*((long long int)(ue->measurements.rx_power_tot[gNB_id])))) >> 10);
|
||||||
ue->measurements.n0_power_avg = (int)
|
|
||||||
(((k1*((long long int) (ue->measurements.n0_power_avg))) +
|
ue->measurements.n0_power_avg = (int)(((k1*((long long int) (ue->measurements.n0_power_avg))) + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
|
||||||
(k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
|
|
||||||
|
LOG_D(PHY, "Noise Power Computation: k1 %lld k2 %lld n0 avg %u n0 tot %u\n", k1, k2, ue->measurements.n0_power_avg, ue->measurements.n0_power_tot);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++)
|
|
||||||
ue->measurements.rx_power_avg[eNB_id] = ue->measurements.rx_power_tot[eNB_id];
|
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++)
|
||||||
|
ue->measurements.rx_power_avg[gNB_id] = ue->measurements.rx_power_tot[gNB_id];
|
||||||
|
|
||||||
ue->measurements.n0_power_avg = ue->measurements.n0_power_tot;
|
ue->measurements.n0_power_avg = ue->measurements.n0_power_tot;
|
||||||
ue->init_averaging = 0;
|
ue->init_averaging = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
|
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++) {
|
||||||
ue->measurements.rx_power_avg_dB[eNB_id] = dB_fixed( ue->measurements.rx_power_avg[eNB_id]);
|
|
||||||
ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot);
|
ue->measurements.rx_power_avg_dB[gNB_id] = dB_fixed( ue->measurements.rx_power_avg[gNB_id]);
|
||||||
ue->measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg);
|
ue->measurements.wideband_cqi_tot[gNB_id] = dB_fixed2(ue->measurements.rx_power_tot[gNB_id], ue->measurements.n0_power_tot);
|
||||||
ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id] - ue->rx_total_gain_dB;
|
ue->measurements.wideband_cqi_avg[gNB_id] = dB_fixed2(ue->measurements.rx_power_avg[gNB_id], ue->measurements.n0_power_avg);
|
||||||
//#ifdef DEBUG_MEAS_UE
|
ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - ue->rx_total_gain_dB;
|
||||||
LOG_D(PHY,"[eNB %d] Subframe %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
|
|
||||||
eNB_id,
|
LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
|
||||||
subframe,
|
gNB_id,
|
||||||
ue->measurements.rx_rssi_dBm[eNB_id],
|
slot,
|
||||||
ue->measurements.rx_power_avg_dB[eNB_id],
|
ue->measurements.rx_rssi_dBm[gNB_id],
|
||||||
ue->measurements.wideband_cqi_avg[eNB_id],
|
ue->measurements.rx_power_avg_dB[gNB_id],
|
||||||
ue->measurements.rx_power_avg[eNB_id],
|
ue->measurements.wideband_cqi_avg[gNB_id],
|
||||||
ue->measurements.n0_power_tot);
|
ue->measurements.rx_power_avg[gNB_id],
|
||||||
//#endif
|
ue->measurements.n0_power_tot);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
@@ -286,7 +242,7 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
if (eNB_offset == 0)
|
if (eNB_offset == 0)
|
||||||
|
|
||||||
LOG_I(PHY,"[UE %d] slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d)\n",
|
LOG_D(PHY,"[UE %d] slot %d RSRP Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d)\n",
|
||||||
ue->Mod_id,
|
ue->Mod_id,
|
||||||
slot,eNB_offset,
|
slot,eNB_offset,
|
||||||
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
|
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
|
||||||
@@ -294,3 +250,66 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
ue->measurements.rsrp[eNB_offset]);
|
ue->measurements.rsrp[eNB_offset]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
||||||
|
UE_nr_rxtx_proc_t *proc,
|
||||||
|
uint8_t slot){
|
||||||
|
|
||||||
|
uint8_t k;
|
||||||
|
int aarx, nb_nulls;
|
||||||
|
int16_t *rxF_sss;
|
||||||
|
uint8_t k_left = 48;
|
||||||
|
uint8_t k_right = 183;
|
||||||
|
uint8_t k_length = 8;
|
||||||
|
uint8_t l_sss = ue->symbol_offset + 2;
|
||||||
|
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||||
|
ue->measurements.n0_power_tot = 0;
|
||||||
|
|
||||||
|
LOG_D(PHY, "In %s doing measurements for ssb_offset %d l_sss %d \n", __FUNCTION__, ssb_offset, l_sss);
|
||||||
|
|
||||||
|
for (aarx = 0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||||
|
|
||||||
|
nb_nulls = 0;
|
||||||
|
ue->measurements.n0_power[aarx] = 0;
|
||||||
|
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset];
|
||||||
|
|
||||||
|
//-ve spectrum from SSS
|
||||||
|
for(k = k_left; k < k_left + k_length; k++){
|
||||||
|
|
||||||
|
#ifdef DEBUG_MEAS_RRC
|
||||||
|
LOG_I(PHY, "In %s -rxF_sss %d %d\n", __FUNCTION__, rxF_sss[k*2], rxF_sss[k*2 + 1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[k*2]*rxF_sss[k*2]) + ((int32_t)rxF_sss[k*2 + 1]*rxF_sss[k*2 + 1]));
|
||||||
|
nb_nulls++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//+ve spectrum from SSS
|
||||||
|
for(k = k_right; k < k_right + k_length; k++){
|
||||||
|
|
||||||
|
#ifdef DEBUG_MEAS_RRC
|
||||||
|
LOG_I(PHY, "In %s +rxF_sss %d %d\n", __FUNCTION__, rxF_sss[k*2], rxF_sss[k*2 + 1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[k*2]*rxF_sss[k*2]) + ((int32_t)rxF_sss[k*2 + 1]*rxF_sss[k*2 + 1]));
|
||||||
|
nb_nulls++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ue->measurements.n0_power[aarx] /= nb_nulls;
|
||||||
|
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]);
|
||||||
|
ue->measurements.n0_power_tot += ue->measurements.n0_power[aarx];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/aarx);
|
||||||
|
|
||||||
|
#ifdef DEBUG_MEAS_RRC
|
||||||
|
int nf_usrp = ue->measurements.n0_power_tot_dB + 30 - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - 90 - (-174 + dB_fixed(30000/*scs*/) + dB_fixed(ue->frame_parms.ofdm_symbol_size));
|
||||||
|
LOG_D(PHY, "In %s slot %d NF USRP %d dBm\n", __FUNCTION__, nf_usrp);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
LOG_D(PHY, "In %s slot %d Noise Level %d ue->measurements.n0_power_tot_dB %d \n", __FUNCTION__, slot, ue->measurements.n0_power_tot, ue->measurements.n0_power_tot_dB);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <LAYER2/NR_MAC_UE/mac_defs.h>
|
||||||
|
#include <LAYER2/NR_MAC_UE/mac_proto.h>
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
|
|
||||||
#include "nr_transport_proto_ue.h"
|
#include "nr_transport_proto_ue.h"
|
||||||
@@ -154,9 +156,11 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
|
|||||||
|
|
||||||
for (int i=0; i<9; i++) {
|
for (int i=0; i<9; i++) {
|
||||||
z[index_z + i] = llr[index_llr + i];
|
z[index_z + i] = llr[index_llr + i];
|
||||||
|
#ifdef NR_PDCCH_DCI_DEBUG
|
||||||
LOG_D(PHY,"[reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n",
|
LOG_D(PHY,"[reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n",
|
||||||
reg,bundle_j,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
|
reg,bundle_j,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
|
||||||
f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
|
f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((reg%reg_bundle_size_L) == 0) r++;
|
if ((reg%reg_bundle_size_L) == 0) r++;
|
||||||
@@ -369,7 +373,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
|
|
||||||
LOG_DDD("n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb);
|
LOG_DDD("n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb);
|
||||||
int c_rb_by6;
|
int c_rb_by6;
|
||||||
c_rb = n_BWP_start;
|
c_rb = 0;
|
||||||
for (int rb=0;rb<coreset_nbr_rb;rb++,c_rb++) {
|
for (int rb=0;rb<coreset_nbr_rb;rb++,c_rb++) {
|
||||||
c_rb_by6 = c_rb/6;
|
c_rb_by6 = c_rb/6;
|
||||||
// skip zeros in frequency domain bitmap
|
// skip zeros in frequency domain bitmap
|
||||||
@@ -384,7 +388,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
// first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
|
// first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
|
||||||
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
||||||
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
|
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
|
||||||
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))];
|
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
||||||
LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
||||||
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
||||||
}
|
}
|
||||||
@@ -392,7 +396,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
|
||||||
// number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC)
|
// number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC)
|
||||||
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF
|
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF
|
||||||
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
|
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol
|
||||||
LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
||||||
c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))));
|
c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))));
|
||||||
//rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
|
//rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
|
||||||
@@ -404,7 +408,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
|
|
||||||
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
||||||
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case
|
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case
|
||||||
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))];
|
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
||||||
#ifdef NR_PDCCH_DCI_DEBUG
|
#ifdef NR_PDCCH_DCI_DEBUG
|
||||||
LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
||||||
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
||||||
@@ -414,7 +418,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
|
||||||
// number of RBs is odd and c_rb is higher than half system bandwidth + 1
|
// number of RBs is odd and c_rb is higher than half system bandwidth + 1
|
||||||
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC
|
// if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC
|
||||||
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
|
rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol
|
||||||
#ifdef NR_PDCCH_DCI_DEBUG
|
#ifdef NR_PDCCH_DCI_DEBUG
|
||||||
LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
||||||
c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size))));
|
c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size))));
|
||||||
@@ -424,7 +428,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC
|
if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC
|
||||||
// if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC)
|
// if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC)
|
||||||
// we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table)
|
// we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table)
|
||||||
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))];
|
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12];
|
||||||
#ifdef NR_PDCCH_DCI_DEBUG
|
#ifdef NR_PDCCH_DCI_DEBUG
|
||||||
LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
|
||||||
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
|
||||||
@@ -885,7 +889,8 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
|||||||
n_rnti = rel15->rnti;
|
n_rnti = rel15->rnti;
|
||||||
|
|
||||||
if (crc == n_rnti) {
|
if (crc == n_rnti) {
|
||||||
LOG_D(PHY,"Decoded crc %x matches rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]);
|
LOG_I(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||||
|
proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation);
|
||||||
dci_ind->SFN = proc->frame_rx;
|
dci_ind->SFN = proc->frame_rx;
|
||||||
dci_ind->slot = proc->nr_slot_rx;
|
dci_ind->slot = proc->nr_slot_rx;
|
||||||
dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti;
|
dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti;
|
||||||
@@ -896,7 +901,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
|||||||
dci_ind->number_of_dcis++;
|
dci_ind->number_of_dcis++;
|
||||||
break; // If DCI is found, no need to check for remaining DCI lengths
|
break; // If DCI is found, no need to check for remaining DCI lengths
|
||||||
} else {
|
} else {
|
||||||
LOG_D(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]);
|
LOG_D(PHY,"(%i.%i) Decoded crc %x does not match rnti %x for DCI format %d\n", proc->frame_rx, proc->nr_slot_rx, crc, n_rnti, rel15->dci_format_options[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -404,7 +404,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
symbol,
|
symbol,
|
||||||
pilots,
|
pilots,
|
||||||
config_type,
|
config_type,
|
||||||
start_rb,
|
start_rb + dlsch0_harq->BWPStart,
|
||||||
nb_rb_pdsch,
|
nb_rb_pdsch,
|
||||||
nr_slot_rx,
|
nr_slot_rx,
|
||||||
ue->high_speed_flag,
|
ue->high_speed_flag,
|
||||||
@@ -422,7 +422,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
len = (pilots==1)? ((config_type==pdsch_dmrs_type1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12);
|
len = (pilots==1)? ((config_type==pdsch_dmrs_type1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12);
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
@@ -1621,6 +1621,8 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
|
|||||||
int16_t y = (len)>>x;
|
int16_t y = (len)>>x;
|
||||||
//printf("len = %d = %d * 2^(%d)\n",len,y,x);
|
//printf("len = %d = %d * 2^(%d)\n",len,y,x);
|
||||||
|
|
||||||
|
AssertFatal(y!=0,"Cannot divide by zero: in function %s of file %s\n", __func__, __FILE__);
|
||||||
|
|
||||||
for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++)
|
for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++)
|
||||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||||
//clear average level
|
//clear average level
|
||||||
|
|||||||
@@ -25,21 +25,18 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "nr_phy_scope.h"
|
#include "nr_phy_scope.h"
|
||||||
#include "executables/nr-softmodem-common.h"
|
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
|
#include "executables/nr-softmodem-common.h"
|
||||||
#include <forms.h>
|
#include <forms.h>
|
||||||
|
|
||||||
#define TPUT_WINDOW_LENGTH 100
|
#define TPUT_WINDOW_LENGTH 100
|
||||||
|
#define ScaleZone 4
|
||||||
#define localBuff(NaMe,SiZe) float NaMe[SiZe]; memset(NaMe,0,sizeof(NaMe));
|
#define localBuff(NaMe,SiZe) float NaMe[SiZe]; memset(NaMe,0,sizeof(NaMe));
|
||||||
|
|
||||||
int otg_enabled;
|
int otg_enabled;
|
||||||
|
|
||||||
FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW};
|
const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW};
|
||||||
|
const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED};
|
||||||
float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
|
||||||
float tput_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
|
||||||
float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
|
||||||
float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
|
||||||
float tput_ue_max[NUMBER_OF_UE_MAX] = {0};
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int16_t r;
|
int16_t r;
|
||||||
@@ -49,10 +46,18 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct OAIgraph {
|
typedef struct OAIgraph {
|
||||||
FL_OBJECT *graph;
|
FL_OBJECT *graph;
|
||||||
|
FL_OBJECT *text;
|
||||||
float maxX;
|
float maxX;
|
||||||
float maxY;
|
float maxY;
|
||||||
float minX;
|
float minX;
|
||||||
float minY;
|
float minY;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
int waterFallh;
|
||||||
|
double *waterFallAvg;
|
||||||
|
boolean_t initDone;
|
||||||
int iteration;
|
int iteration;
|
||||||
void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id);
|
void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id);
|
||||||
void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id);
|
void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id);
|
||||||
@@ -94,57 +99,114 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FL_OBJECT *commonGraph( int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
#define WATERFALL 10000
|
||||||
FL_OBJECT *graph;
|
|
||||||
graph=fl_add_xyplot(type, x, y, w, h, label);
|
static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
||||||
fl_set_object_lcolor(graph, FL_WHITE ); // Label color
|
if (type==WATERFALL) {
|
||||||
fl_set_object_color(graph, FL_BLACK, pointColor);
|
graph->waterFallh=h-15;
|
||||||
fl_set_xyplot_symbol(graph, -1, drawsymbol);
|
graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh);
|
||||||
return graph;
|
|
||||||
|
for (int i=0; i< graph->waterFallh; i++)
|
||||||
|
graph->waterFallAvg[i]=0;
|
||||||
|
|
||||||
|
graph->graph=fl_add_canvas(FL_NORMAL_CANVAS, x, y, w, graph->waterFallh, label);
|
||||||
|
graph->text=fl_add_text(FL_NORMAL_TEXT, x, y+graph->waterFallh, w, 15, label);
|
||||||
|
fl_set_object_lcolor(graph->text,FL_WHITE);
|
||||||
|
fl_set_object_color(graph->text, FL_BLACK, FL_BLACK);
|
||||||
|
fl_set_object_lalign(graph->text, FL_ALIGN_CENTER );
|
||||||
|
} else {
|
||||||
|
graph->graph=fl_add_xyplot(type, x, y, w, h, label);
|
||||||
|
fl_set_object_lcolor(graph->graph, FL_WHITE ); // Label color
|
||||||
|
fl_set_object_color(graph->graph, FL_BLACK, pointColor);
|
||||||
|
|
||||||
|
for (int i=0; i< FL_MAX_XYPLOTOVERLAY; i++)
|
||||||
|
fl_set_xyplot_symbol(graph->graph, i, drawsymbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
graph->x=x;
|
||||||
|
graph->y=y;
|
||||||
|
graph->w=w;
|
||||||
|
graph->h=h;
|
||||||
|
graph->maxX=0;
|
||||||
|
graph->maxY=0;
|
||||||
|
graph->minX=0;
|
||||||
|
graph->minY=0;
|
||||||
|
graph->initDone=false;
|
||||||
|
graph->iteration=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id),
|
static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id),
|
||||||
int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
||||||
OAIgraph_t graph;
|
OAIgraph_t graph;
|
||||||
graph.graph=commonGraph(type, x, y, w, h, label, pointColor);
|
commonGraph(&graph, type, x, y, w, h, label, pointColor);
|
||||||
graph.gNBfunct=funct;
|
graph.gNBfunct=funct;
|
||||||
graph.nrUEfunct=NULL;
|
graph.nrUEfunct=NULL;
|
||||||
graph.maxX=0;
|
|
||||||
graph.maxY=0;
|
|
||||||
graph.minX=0;
|
|
||||||
graph.minY=0;
|
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
static OAIgraph_t nrUEcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id),
|
static OAIgraph_t nrUEcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id),
|
||||||
int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
||||||
OAIgraph_t graph;
|
OAIgraph_t graph;
|
||||||
graph.graph=commonGraph(type, x, y, w, h, label, pointColor);
|
commonGraph(&graph, type, x, y, w, h, label, pointColor);
|
||||||
graph.gNBfunct=NULL;
|
graph.gNBfunct=NULL;
|
||||||
graph.nrUEfunct=funct;
|
graph.nrUEfunct=funct;
|
||||||
graph.maxX=0;
|
|
||||||
graph.maxY=0;
|
|
||||||
graph.minX=0;
|
|
||||||
graph.minY=0;
|
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) {
|
static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) {
|
||||||
if ( maxX > graph->maxX || maxY > graph->maxY || minX < graph->minX || minY < graph->minY ) {
|
if ( maxX > graph->maxX || minX < graph->minX ||
|
||||||
|
abs(maxX-graph->maxX)>abs(graph->maxX)/2 ||
|
||||||
|
abs(maxX-graph->maxX)>abs(graph->maxX)/2 ) {
|
||||||
|
graph->maxX/=2;
|
||||||
|
graph->minX/=2;
|
||||||
graph->maxX=max(graph->maxX,maxX);
|
graph->maxX=max(graph->maxX,maxX);
|
||||||
graph->minX=min(graph->minX,minX);
|
graph->minX=min(graph->minX,minX);
|
||||||
|
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 ) {
|
||||||
|
graph->maxY/=2;
|
||||||
|
graph->minY/=2;
|
||||||
graph->maxY=max(graph->maxY,maxY);
|
graph->maxY=max(graph->maxY,maxY);
|
||||||
graph->minY=min(graph->minY,minY);
|
graph->minY=min(graph->minY,minY);
|
||||||
fl_set_xyplot_ybounds(graph->graph, graph->minY, graph->maxY);
|
fl_set_xyplot_ybounds(graph->graph, graph->minY*1.2, graph->maxY*1.2);
|
||||||
fl_set_xyplot_xbounds(graph->graph, graph->minX, graph->maxX);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, int NoAutoScale) {
|
static void oai_xygraph_getbuff(OAIgraph_t *graph, float **x, float **y, int len, int layer) {
|
||||||
if (layer==0)
|
float *old_x;
|
||||||
fl_set_xyplot_data(graph->graph,x,y,len,"","","");
|
float *old_y;
|
||||||
else
|
int old_len=-1;
|
||||||
fl_add_xyplot_overlay(graph->graph,layer,x,y,len,rx_antenna_colors[layer]);
|
|
||||||
|
if (graph->iteration >1)
|
||||||
|
fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len);
|
||||||
|
|
||||||
|
if (old_len != len) {
|
||||||
|
LOG_W(HW,"allocating graph of %d scope\n", len);
|
||||||
|
float values[len];
|
||||||
|
float time[len];
|
||||||
|
|
||||||
|
// make time in case we will use it
|
||||||
|
for (int i=0; i<len; i++)
|
||||||
|
time[i] = values[i] = i;
|
||||||
|
|
||||||
|
if (layer==0)
|
||||||
|
fl_set_xyplot_data(graph->graph,time,values,len,"","","");
|
||||||
|
else
|
||||||
|
fl_add_xyplot_overlay(graph->graph,layer,time,values,len,rx_antenna_colors[layer]);
|
||||||
|
|
||||||
|
fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len);
|
||||||
|
AssertFatal(old_len==len,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
*x=old_x;
|
||||||
|
*y=old_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, boolean_t NoAutoScale) {
|
||||||
|
fl_redraw_object(graph->graph);
|
||||||
|
|
||||||
if ( NoAutoScale && graph->iteration%NoAutoScale == 0) {
|
if ( NoAutoScale && graph->iteration%NoAutoScale == 0) {
|
||||||
float maxX=0, maxY=0, minX=0, minY=0;
|
float maxX=0, maxY=0, minX=0, minY=0;
|
||||||
@@ -156,46 +218,100 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye
|
|||||||
minY=min(minY,y[k]);
|
minY=min(minY,y[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
setRange(graph,minX,maxX, minY, maxY);
|
setRange(graph, minX-5, maxX+5, minY-5, maxY+5);
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->iteration++;
|
graph->iteration++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) {
|
||||||
|
fl_winset(FL_ObjWin(graph->graph));
|
||||||
|
const int samplesPerPixel=datasize/graph->w;
|
||||||
|
int displayPart=graph->waterFallh-ScaleZone;
|
||||||
|
int row=graph->iteration%displayPart;
|
||||||
|
double avg=0;
|
||||||
|
|
||||||
|
for (int i=0; i < displayPart; i++)
|
||||||
|
avg+=graph->waterFallAvg[i];
|
||||||
|
|
||||||
|
avg/=displayPart;
|
||||||
|
graph->waterFallAvg[row]=0;
|
||||||
|
|
||||||
|
for (int pix=0; pix<graph->w; pix++) {
|
||||||
|
scopeSample_t *end=values+(pix+1)*samplesPerPixel;
|
||||||
|
end-=2;
|
||||||
|
AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize);
|
||||||
|
double val=0;
|
||||||
|
|
||||||
|
for (scopeSample_t *s=values+(pix)*samplesPerPixel;
|
||||||
|
s <end;
|
||||||
|
s++)
|
||||||
|
val += SquaredNorm(*s);
|
||||||
|
|
||||||
|
val/=samplesPerPixel;
|
||||||
|
graph->waterFallAvg[row]+=val/graph->w;
|
||||||
|
int col=0;
|
||||||
|
|
||||||
|
if (val > avg*2 )
|
||||||
|
col=1;
|
||||||
|
|
||||||
|
if (val > avg*10 )
|
||||||
|
col=2;
|
||||||
|
|
||||||
|
if (val > avg*100 )
|
||||||
|
col=3;
|
||||||
|
|
||||||
|
fl_point(pix, graph->iteration%displayPart, water_colors[col]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (graph->initDone==false) {
|
||||||
|
for ( int i=0; i < graph->waterFallh; i++ )
|
||||||
|
for ( int j = 0 ; j < graph->w ; j++ )
|
||||||
|
fl_point(j, i, FL_BLACK);
|
||||||
|
|
||||||
|
for ( int i=1; i<divisions; i++)
|
||||||
|
for (int j= displayPart; j<graph->waterFallh; j++)
|
||||||
|
fl_point(i*(graph->w/divisions),j, FL_WHITE);
|
||||||
|
|
||||||
|
graph->initDone=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg));
|
||||||
|
graph->iteration++;
|
||||||
|
}
|
||||||
|
|
||||||
static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
||||||
float *values=malloc(len*sizeof(*values));
|
float *values, *time;
|
||||||
float *time=malloc(len*sizeof(*time));
|
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||||
|
|
||||||
for (int ant=0; ant<nb_ant; ant++) {
|
for (int ant=0; ant<nb_ant; ant++) {
|
||||||
if (data[ant] != NULL) {
|
if (data[ant] != NULL) {
|
||||||
|
float *values, *time;
|
||||||
|
oai_xygraph_getbuff(graph, &time, &values, len, ant);
|
||||||
|
|
||||||
for (int i=0; i<len; i+=8) {
|
for (int i=0; i<len; i+=8) {
|
||||||
float *vals=values+i;
|
float *vals=values+i;
|
||||||
float *tim=time+i;
|
|
||||||
const scopeSample_t *in=&(data[ant][i]);
|
const scopeSample_t *in=&(data[ant][i]);
|
||||||
|
|
||||||
|
// TRY AUTOMATIC simd BY GCC
|
||||||
for (int k=0; k<8; k++ ) {
|
for (int k=0; k<8; k++ ) {
|
||||||
vals[k] = 10*log10(1.0+SquaredNorm(in[k]));
|
vals[k] = 10*log10(1.0+SquaredNorm(in[k]));
|
||||||
tim[k] = i+k;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,time,values, len, ant, 10);
|
oai_xygraph(graph,time,values, len, ant, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(values);
|
|
||||||
free(time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
||||||
float values[len];
|
float *values, *time;
|
||||||
float time[len];
|
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||||
|
|
||||||
for (int ant=0; ant<nb_ant; ant++) {
|
for (int ant=0; ant<nb_ant; ant++) {
|
||||||
if (data[ant] != NULL) {
|
if (data[ant] != NULL) {
|
||||||
for (int i=0; i<len; i++) {
|
for (int i=0; i<len; i++) {
|
||||||
values[i] = SquaredNorm(data[ant][i]);
|
values[i] = SquaredNorm(data[ant][i]);
|
||||||
time[i] = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,time,values, len, ant, 10);
|
oai_xygraph(graph,time,values, len, ant, 10);
|
||||||
@@ -203,6 +319,15 @@ static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const sc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gNBWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms;
|
||||||
|
//use 1st antenna
|
||||||
|
genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0],
|
||||||
|
frame_parms->samples_per_frame, frame_parms->slots_per_frame,
|
||||||
|
"X axis:one frame in time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* replaced by waterfall
|
||||||
static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, const int nb_UEs) {
|
static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, const int nb_UEs) {
|
||||||
// Received signal in time domain of receive antenna 0
|
// Received signal in time domain of receive antenna 0
|
||||||
if (!phy_vars_ru->common.rxdata)
|
if (!phy_vars_ru->common.rxdata)
|
||||||
@@ -213,11 +338,12 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy
|
|||||||
(const scopeSample_t **)phy_vars_ru->common.rxdata,
|
(const scopeSample_t **)phy_vars_ru->common.rxdata,
|
||||||
frame_parms->samples_per_frame);
|
frame_parms->samples_per_frame);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size;
|
const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size;
|
||||||
float values[len];
|
float *values, *time;
|
||||||
float time[len];
|
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||||
const int ant=0; // display antenna 0 for each UE
|
const int ant=0; // display antenna 0 for each UE
|
||||||
|
|
||||||
for (int ue=0; ue<nb_UEs; ue++) {
|
for (int ue=0; ue<nb_UEs; ue++) {
|
||||||
@@ -226,7 +352,6 @@ static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *p
|
|||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
for (int i=0; i<len; i++) {
|
for (int i=0; i<len; i++) {
|
||||||
values[i] = SquaredNorm(data[i]);
|
values[i] = SquaredNorm(data[i]);
|
||||||
time[i] = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,time,values, len, ue, 10);
|
oai_xygraph(graph,time,values, len, ue, 10);
|
||||||
@@ -234,26 +359,35 @@ static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gNBfreqWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms;
|
||||||
|
//use 1st antenna
|
||||||
|
genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP,
|
||||||
|
frame_parms->slots_per_frame,
|
||||||
|
"X axis: Frequency domain, one frame");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms;
|
||||||
genericLogPowerPerAntena(graph, frame_parms->nb_antennas_rx,
|
genericLogPowerPerAntena(graph, frame_parms->nb_antennas_rx,
|
||||||
(const scopeSample_t **)phy_vars_ru->common.rxdataF,
|
(const scopeSample_t **)phy_vars_ru->common.rxdataF,
|
||||||
frame_parms->samples_per_slot_wCP);
|
frame_parms->samples_per_slot_wCP);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
//int Qm = 2;
|
//int Qm = 2;
|
||||||
int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti;
|
int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti;
|
||||||
float llr[coded_bits_per_codeword];
|
|
||||||
float bit[coded_bits_per_codeword];
|
|
||||||
|
|
||||||
for (int ue=0; ue<nb_UEs; ue++) {
|
for (int ue=0; ue<nb_UEs; ue++) {
|
||||||
int16_t *pusch_llr = (int16_t *)phy_vars_gnb->pusch_vars[ue]->llr;
|
int16_t *pusch_llr = (int16_t *)phy_vars_gnb->pusch_vars[ue]->llr;
|
||||||
|
float *llr, *bit;
|
||||||
|
oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue);
|
||||||
|
|
||||||
if (pusch_llr) {
|
if (pusch_llr) {
|
||||||
for (int i=0; i<coded_bits_per_codeword; i++) {
|
for (int i=0; i<coded_bits_per_codeword; i++) {
|
||||||
llr[i] = (float) pusch_llr[i];
|
llr[i] = (float) pusch_llr[i];
|
||||||
bit[i] = (float) i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,bit,llr,coded_bits_per_codeword,ue,10);
|
oai_xygraph(graph,bit,llr,coded_bits_per_codeword,ue,10);
|
||||||
@@ -264,10 +398,11 @@ static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_v
|
|||||||
static void puschIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
static void puschIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms;
|
||||||
int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot;
|
int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot;
|
||||||
float I[sz], Q[sz];
|
|
||||||
|
|
||||||
for (int ue=0; ue<nb_UEs; ue++) {
|
for (int ue=0; ue<nb_UEs; ue++) {
|
||||||
scopeSample_t *pusch_comp = (scopeSample_t *) phy_vars_gnb->pusch_vars[ue]->rxdataF_comp[0];
|
scopeSample_t *pusch_comp = (scopeSample_t *) phy_vars_gnb->pusch_vars[ue]->rxdataF_comp[0];
|
||||||
|
float *I, *Q;
|
||||||
|
oai_xygraph_getbuff(graph, &I, &Q, sz, ue);
|
||||||
|
|
||||||
if (pusch_comp) {
|
if (pusch_comp) {
|
||||||
for (int k=0; k<sz; k++ ) {
|
for (int k=0; k<sz; k++ ) {
|
||||||
@@ -312,6 +447,9 @@ static void pucchIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_va
|
|||||||
static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) {
|
||||||
// PUSCH Throughput
|
// PUSCH Throughput
|
||||||
/*
|
/*
|
||||||
|
float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||||
|
float tput_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||||
|
|
||||||
memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) 0;
|
tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) 0;
|
||||||
@@ -332,18 +470,18 @@ static OAI_phy_scope_t *create_phy_scope_gnb(void) {
|
|||||||
fl_set_object_color( obj, FL_BLACK, FL_WHITE );
|
fl_set_object_color( obj, FL_BLACK, FL_WHITE );
|
||||||
int curY=0,x,y,w,h;
|
int curY=0,x,y,w,h;
|
||||||
// Received signal
|
// Received signal
|
||||||
fdui->graph[0] = gNBcommonGraph( timeSignal, FL_NORMAL_XYPLOT, 0, curY, 400, 100,
|
fdui->graph[0] = gNBcommonGraph( gNBWaterFall, WATERFALL, 0, curY, 400, 100,
|
||||||
"Received Signal (Time-Domain, dB)", FL_RED );
|
"Received Signal (Time-Domain, one frame)", FL_RED );
|
||||||
// Time-domain channel response
|
// Time-domain channel response
|
||||||
fdui->graph[1] = gNBcommonGraph( timeResponse, FL_NORMAL_XYPLOT, 410, curY, 400, 100,
|
fdui->graph[1] = gNBcommonGraph( timeResponse, FL_NORMAL_XYPLOT, 410, curY, 400, 100,
|
||||||
"SRS Frequency Response (samples, abs)", FL_RED );
|
"SRS Frequency Response (samples, abs)", FL_RED );
|
||||||
fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h);
|
fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h);
|
||||||
curY+=h;
|
curY+=h;
|
||||||
// Frequency-domain channel response
|
// Frequency-domain channel response
|
||||||
fdui->graph[2] = gNBcommonGraph( frequencyResponse, FL_NORMAL_XYPLOT, 0, curY, 800, 100,
|
fdui->graph[2] = gNBcommonGraph( gNBfreqWaterFall, WATERFALL, 0, curY, 800, 100,
|
||||||
"Channel Frequency Response (RE, dB)", FL_RED );
|
"Channel Frequency domain (RE, one frame)", FL_RED );
|
||||||
fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h);
|
fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h);
|
||||||
curY+=h;
|
curY+=h+20;
|
||||||
// LLR of PUSCH
|
// LLR of PUSCH
|
||||||
fdui->graph[3] = gNBcommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200,
|
fdui->graph[3] = gNBcommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200,
|
||||||
"PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW );
|
"PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW );
|
||||||
@@ -376,14 +514,15 @@ void phy_scope_gNB(OAI_phy_scope_t *form,
|
|||||||
PHY_VARS_gNB *phy_vars_gnb,
|
PHY_VARS_gNB *phy_vars_gnb,
|
||||||
RU_t *phy_vars_ru,
|
RU_t *phy_vars_ru,
|
||||||
int UE_id) {
|
int UE_id) {
|
||||||
static OAI_phy_scope_t *remeberForm=NULL;
|
static OAI_phy_scope_t *rememberForm=NULL;
|
||||||
|
|
||||||
if (form==NULL)
|
if (form==NULL)
|
||||||
form=remeberForm;
|
form=rememberForm;
|
||||||
else
|
else
|
||||||
remeberForm=form;
|
rememberForm=form;
|
||||||
|
|
||||||
if (form==NULL) return;
|
if (form==NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
@@ -392,7 +531,7 @@ void phy_scope_gNB(OAI_phy_scope_t *form,
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_check_forms();
|
//fl_check_forms();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *scope_thread_gNB(void *arg) {
|
static void *scope_thread_gNB(void *arg) {
|
||||||
@@ -406,7 +545,9 @@ static void *scope_thread_gNB(void *arg) {
|
|||||||
pthread_attr_getstacksize(&atr, &stksize);
|
pthread_attr_getstacksize(&atr, &stksize);
|
||||||
pthread_attr_setstacksize(&atr,32*1024*1024 );
|
pthread_attr_setstacksize(&atr,32*1024*1024 );
|
||||||
sleep(3); // no clean interthread barriers
|
sleep(3); // no clean interthread barriers
|
||||||
fl_initialize (p->argc, p->argv, NULL, 0, 0);
|
int fl_argc=1;
|
||||||
|
char *name="5G-gNB-scope";
|
||||||
|
fl_initialize (&fl_argc, &name, NULL, 0, 0);
|
||||||
int nb_ue=min(NUMBER_OF_UE_MAX, scope_enb_num_ue);
|
int nb_ue=min(NUMBER_OF_UE_MAX, scope_enb_num_ue);
|
||||||
OAI_phy_scope_t *form_gnb = create_phy_scope_gnb();
|
OAI_phy_scope_t *form_gnb = create_phy_scope_gnb();
|
||||||
|
|
||||||
@@ -425,12 +566,23 @@ void gNBinitScope(scopeParms_t *p) {
|
|||||||
threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW);
|
threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
|
// Received signal in time domain of receive antenna 0
|
||||||
|
genericWaterFall(graph,
|
||||||
|
(scopeSample_t *) phy_vars_ue->common_vars.rxdata[0],
|
||||||
|
phy_vars_ue->frame_parms.samples_per_frame,
|
||||||
|
phy_vars_ue->frame_parms.slots_per_frame,
|
||||||
|
"X axis: one frame time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* replaced by waterfall
|
||||||
static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
// Received signal in time domain of receive antenna 0
|
// Received signal in time domain of receive antenna 0
|
||||||
genericLogPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx,
|
genericLogPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx,
|
||||||
(const scopeSample_t **) phy_vars_ue->common_vars.rxdata,
|
(const scopeSample_t **) phy_vars_ue->common_vars.rxdata,
|
||||||
phy_vars_ue->frame_parms.samples_per_frame);
|
phy_vars_ue->frame_parms.samples_per_frame);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
// Channel Impulse Response
|
// Channel Impulse Response
|
||||||
@@ -439,6 +591,17 @@ static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
phy_vars_ue->frame_parms.ofdm_symbol_size>>3);
|
phy_vars_ue->frame_parms.ofdm_symbol_size>>3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) {
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms;
|
||||||
|
//use 1st antenna
|
||||||
|
genericWaterFall(graph,
|
||||||
|
(scopeSample_t *)phy_vars_ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[0],
|
||||||
|
frame_parms->samples_per_slot_wCP,
|
||||||
|
phy_vars_ue->frame_parms.slots_per_frame,
|
||||||
|
"X axis: one frame frequency" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
// Channel Frequency Response (includes 5 complex sample for filter)
|
// Channel Frequency Response (includes 5 complex sample for filter)
|
||||||
if (!phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates)
|
if (!phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates)
|
||||||
@@ -449,12 +612,13 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue
|
|||||||
uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB;
|
uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB;
|
||||||
scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates;
|
scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates;
|
||||||
int ind = 0;
|
int ind = 0;
|
||||||
float chest_f_abs[frame_parms->ofdm_symbol_size];
|
float *freq, *chest_f_abs;
|
||||||
float freq[frame_parms->ofdm_symbol_size];
|
oai_xygraph_getbuff(graph, &freq, &chest_f_abs, frame_parms->ofdm_symbol_size, 0);
|
||||||
|
|
||||||
for (int atx=0; atx<nb_antennas_tx; atx++) {
|
for (int atx=0; atx<nb_antennas_tx; atx++) {
|
||||||
for (int arx=0; arx<nb_antennas_rx; arx++) {
|
for (int arx=0; arx<nb_antennas_rx; arx++) {
|
||||||
if (chest_f[(atx<<1)+arx] != NULL) {
|
if (chest_f[(atx<<1)+arx] != NULL) {
|
||||||
|
|
||||||
for (int k=0; k<frame_parms->ofdm_symbol_size; k++) {
|
for (int k=0; k<frame_parms->ofdm_symbol_size; k++) {
|
||||||
freq[ind] = (float)ind;
|
freq[ind] = (float)ind;
|
||||||
chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k]));
|
chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k]));
|
||||||
@@ -471,6 +635,7 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue
|
|||||||
//fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR);
|
//fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR);
|
||||||
oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10);
|
oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
// PBCH LLRs
|
// PBCH LLRs
|
||||||
@@ -478,11 +643,11 @@ static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr;
|
int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr;
|
||||||
float llr_pbch[864], bit_pbch[864];
|
float *llr_pbch, *bit_pbch;
|
||||||
|
oai_xygraph_getbuff(graph, &bit_pbch, &llr_pbch, 864, 0);
|
||||||
|
|
||||||
for (int i=0; i<864; i++) {
|
for (int i=0; i<864; i++) {
|
||||||
llr_pbch[i] = (float) pbch_llr[i];
|
llr_pbch[i] = (float) pbch_llr[i];
|
||||||
bit_pbch[i] = (float) i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10);
|
oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10);
|
||||||
@@ -494,8 +659,10 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0];
|
scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0];
|
||||||
localBuff(I,180*3);
|
float *I, *Q;
|
||||||
localBuff(Q,180*3);
|
oai_xygraph_getbuff(graph, &I, &Q, 180*3, 0);
|
||||||
|
memset(I,0,180*3*sizeof(*I));
|
||||||
|
memset(Q,0,180*3*sizeof(*Q));
|
||||||
int first_symbol=1;
|
int first_symbol=1;
|
||||||
int base=0;
|
int base=0;
|
||||||
|
|
||||||
@@ -517,7 +684,8 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i
|
|||||||
base+=nb_re;
|
base+=nb_re;
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,I,Q,base,0,10);
|
AssertFatal(base <= 180*3,"");
|
||||||
|
oai_xygraph(graph,I,Q,base,0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
@@ -528,8 +696,8 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
|||||||
int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols
|
int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols
|
||||||
int Qm = 2;
|
int Qm = 2;
|
||||||
int coded_bits_per_codeword = num_re*Qm;
|
int coded_bits_per_codeword = num_re*Qm;
|
||||||
localBuff(llr,coded_bits_per_codeword*RX_NB_TH_MAX);
|
float *llr, *bit;
|
||||||
localBuff(bit,coded_bits_per_codeword*RX_NB_TH_MAX);
|
oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0);
|
||||||
int base=0;
|
int base=0;
|
||||||
|
|
||||||
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
||||||
@@ -537,12 +705,12 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
|||||||
|
|
||||||
for (int i=0; i<coded_bits_per_codeword; i++) {
|
for (int i=0; i<coded_bits_per_codeword; i++) {
|
||||||
llr[base+i] = (float) pdcch_llr[i];
|
llr[base+i] = (float) pdcch_llr[i];
|
||||||
bit[base+i] = (float) base+i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base+=coded_bits_per_codeword;
|
base+=coded_bits_per_codeword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, "");
|
||||||
oai_xygraph(graph,bit,llr,base,0,10);
|
oai_xygraph(graph,bit,llr,base,0,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,8 +720,8 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int nb=4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols
|
int nb=4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols
|
||||||
localBuff(I,nb*RX_NB_TH_MAX);
|
float *I, *Q;
|
||||||
localBuff(Q,nb*RX_NB_TH_MAX);
|
oai_xygraph_getbuff(graph, &I, &Q, nb*RX_NB_TH_MAX, 0);
|
||||||
int base=0;
|
int base=0;
|
||||||
|
|
||||||
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
||||||
@@ -567,6 +735,7 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i
|
|||||||
base+=nb;
|
base+=nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertFatal(base <= nb*RX_NB_TH_MAX, "");
|
||||||
oai_xygraph(graph,I,Q,base,0,10);
|
oai_xygraph(graph,I,Q,base,0,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,8 +747,8 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB
|
|||||||
int num_re = 4500;
|
int num_re = 4500;
|
||||||
int Qm = 2;
|
int Qm = 2;
|
||||||
int coded_bits_per_codeword = num_re*Qm;
|
int coded_bits_per_codeword = num_re*Qm;
|
||||||
localBuff(llr,coded_bits_per_codeword*RX_NB_TH_MAX);
|
float *llr, *bit;
|
||||||
localBuff(bit,coded_bits_per_codeword*RX_NB_TH_MAX);
|
oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0);
|
||||||
int base=0;
|
int base=0;
|
||||||
|
|
||||||
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
||||||
@@ -593,6 +762,7 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB
|
|||||||
base+=coded_bits_per_codeword;
|
base+=coded_bits_per_codeword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, "");
|
||||||
//fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
|
//fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
|
||||||
oai_xygraph(graph,bit,llr,base,0,10);
|
oai_xygraph(graph,bit,llr,base,0,10);
|
||||||
}
|
}
|
||||||
@@ -604,9 +774,11 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
|||||||
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
|
||||||
int sz=7*2*frame_parms->N_RB_DL*12; // size of the malloced buffer
|
int sz=7*2*frame_parms->N_RB_DL*12; // size of the malloced buffer
|
||||||
localBuff(I,sz*RX_NB_TH_MAX);
|
float *I, *Q;
|
||||||
localBuff(Q,sz*RX_NB_TH_MAX);
|
oai_xygraph_getbuff(graph, &I, &Q, sz*RX_NB_TH_MAX, 0);
|
||||||
int base=0;
|
int base=0;
|
||||||
|
memset(I+base, 0, sz*RX_NB_TH_MAX * sizeof(*I));
|
||||||
|
memset(Q+base, 0, sz*RX_NB_TH_MAX * sizeof(*Q));
|
||||||
|
|
||||||
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
|
||||||
scopeSample_t *pdsch_comp = (scopeSample_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->rxdataF_comp0[0];
|
scopeSample_t *pdsch_comp = (scopeSample_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->rxdataF_comp0[0];
|
||||||
@@ -619,11 +791,16 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
|||||||
base+=sz;
|
base+=sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
oai_xygraph(graph,I,Q,base,0,10);
|
AssertFatal(base <= sz*RX_NB_TH_MAX, "");
|
||||||
|
oai_xygraph(graph,I,Q,sz*RX_NB_TH_MAX,0,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||||
/*
|
/*
|
||||||
|
float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||||
|
float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||||
|
float tput_ue_max[NUMBER_OF_UE_MAX] = {0};
|
||||||
|
|
||||||
|
|
||||||
// PDSCH Throughput
|
// PDSCH Throughput
|
||||||
memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
@@ -652,18 +829,18 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) {
|
|||||||
fl_set_object_color( obj, FL_BLACK, FL_BLACK );
|
fl_set_object_color( obj, FL_BLACK, FL_BLACK );
|
||||||
int curY=0,x,y,w,h;
|
int curY=0,x,y,w,h;
|
||||||
// Received signal
|
// Received signal
|
||||||
fdui->graph[0] = nrUEcommonGraph(ueTimeResponse,
|
fdui->graph[0] = nrUEcommonGraph(ueWaterFall,
|
||||||
FL_NORMAL_XYPLOT, 0, curY, 400, 100, "Received Signal (Time-Domain, dB)", FL_RED );
|
WATERFALL, 0, curY, 400, 100, "Received Signal (Time-Domain, one frame)", FL_RED );
|
||||||
// Time-domain channel response
|
// Time-domain channel response
|
||||||
fdui->graph[1] = nrUEcommonGraph(ueChannelResponse,
|
fdui->graph[1] = nrUEcommonGraph(ueChannelResponse,
|
||||||
FL_NORMAL_XYPLOT, 400, curY, 400, 100, "Channel Impulse Response (samples, abs)", FL_RED );
|
FL_NORMAL_XYPLOT, 400, curY, 400, 100, "Channel Impulse Response (samples, abs)", FL_RED );
|
||||||
fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h);
|
fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h);
|
||||||
curY+=h;
|
curY+=h;
|
||||||
// Frequency-domain channel response
|
// Frequency-domain channel response
|
||||||
fdui->graph[2] = nrUEcommonGraph(uePbchFrequencyResp,
|
fdui->graph[2] = nrUEcommonGraph(ueFreqWaterFall,
|
||||||
FL_IMPULSE_XYPLOT, 0, curY, 800, 100, "Channel Frequency data (RE, dB)", FL_RED );
|
WATERFALL, 0, curY, 800, 100, "Channel Frequency (RE, one slot)", FL_RED );
|
||||||
fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h);
|
fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h);
|
||||||
curY+=h;
|
curY+=h+20;
|
||||||
// LLR of PBCH
|
// LLR of PBCH
|
||||||
fdui->graph[3] = nrUEcommonGraph(uePbchLLR,
|
fdui->graph[3] = nrUEcommonGraph(uePbchLLR,
|
||||||
FL_POINTS_XYPLOT, 0, curY, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)", FL_GREEN );
|
FL_POINTS_XYPLOT, 0, curY, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)", FL_GREEN );
|
||||||
@@ -733,7 +910,7 @@ void phy_scope_nrUE(OAI_phy_scope_t *form,
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_check_forms();
|
//fl_check_forms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -749,9 +926,12 @@ static void *nrUEscopeThread(void *arg) {
|
|||||||
OAI_phy_scope_t *form_nrue=create_phy_scope_nrue(0);
|
OAI_phy_scope_t *form_nrue=create_phy_scope_nrue(0);
|
||||||
|
|
||||||
while (!oai_exit) {
|
while (!oai_exit) {
|
||||||
|
fl_freeze_form(form_nrue->phy_scope);
|
||||||
phy_scope_nrUE(form_nrue,
|
phy_scope_nrUE(form_nrue,
|
||||||
ue,
|
ue,
|
||||||
0,0);
|
0,0);
|
||||||
|
fl_unfreeze_form(form_nrue->phy_scope);
|
||||||
|
fl_redraw_form(form_nrue->phy_scope);
|
||||||
usleep(99*1000);
|
usleep(99*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,11 +946,11 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) {
|
|||||||
|
|
||||||
void nrscope_autoinit(void *dataptr) {
|
void nrscope_autoinit(void *dataptr) {
|
||||||
AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context");
|
AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context");
|
||||||
|
|
||||||
if (IS_SOFTMODEM_GNB_BIT)
|
if (IS_SOFTMODEM_GNB_BIT)
|
||||||
gNBinitScope(dataptr);
|
gNBinitScope(dataptr);
|
||||||
else
|
else
|
||||||
nrUEinitScope(dataptr);
|
nrUEinitScope(dataptr);
|
||||||
}
|
}
|
||||||
// Kept to put back the functionality soon
|
// Kept to put back the functionality soon
|
||||||
#if 0
|
#if 0
|
||||||
@@ -799,8 +979,6 @@ static void reset_stats_gNB(FL_OBJECT *button,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FD_stats_form *create_form_stats_form(int ID) {
|
static FD_stats_form *create_form_stats_form(int ID) {
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
|
FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
|
||||||
@@ -820,7 +998,3 @@ static FD_stats_form *create_form_stats_form(int ID) {
|
|||||||
return fdui;
|
return fdui;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+13
-12
@@ -630,32 +630,33 @@ typedef struct {
|
|||||||
short n0_subband_power_tot_dB[275];
|
short n0_subband_power_tot_dB[275];
|
||||||
//! estimated avg noise power per RB (dBm)
|
//! estimated avg noise power per RB (dBm)
|
||||||
short n0_subband_power_tot_dBm[275];
|
short n0_subband_power_tot_dBm[275];
|
||||||
|
|
||||||
// gNB measurements (per user)
|
// gNB measurements (per user)
|
||||||
//! estimated received spatial signal power (linear)
|
//! estimated received spatial signal power (linear)
|
||||||
unsigned int rx_spatial_power[NUMBER_OF_NR_DLSCH_MAX][2][2];
|
unsigned int rx_spatial_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
||||||
//! estimated received spatial signal power (dB)
|
//! estimated received spatial signal power (dB)
|
||||||
unsigned short rx_spatial_power_dB[NUMBER_OF_NR_DLSCH_MAX][2][2];
|
unsigned short rx_spatial_power_dB[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
||||||
//! estimated rssi (dBm)
|
//! estimated rssi (dBm)
|
||||||
short rx_rssi_dBm[NUMBER_OF_NR_DLSCH_MAX];
|
short rx_rssi_dBm[NUMBER_OF_NR_ULSCH_MAX];
|
||||||
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
||||||
int rx_correlation[NUMBER_OF_NR_DLSCH_MAX][2];
|
int rx_correlation[NUMBER_OF_NR_ULSCH_MAX][2];
|
||||||
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
||||||
int rx_correlation_dB[NUMBER_OF_NR_DLSCH_MAX][2];
|
int rx_correlation_dB[NUMBER_OF_NR_ULSCH_MAX][2];
|
||||||
|
|
||||||
/// Wideband CQI (= SINR)
|
/// Wideband CQI (= SINR)
|
||||||
int wideband_cqi[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB];
|
int wideband_cqi[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB];
|
||||||
/// Wideband CQI in dB (= SINR dB)
|
/// Wideband CQI in dB (= SINR dB)
|
||||||
int wideband_cqi_dB[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB];
|
int wideband_cqi_dB[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB];
|
||||||
/// Wideband CQI (sum of all RX antennas, in dB)
|
/// Wideband CQI (sum of all RX antennas, in dB)
|
||||||
char wideband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX];
|
char wideband_cqi_tot[NUMBER_OF_NR_ULSCH_MAX];
|
||||||
/// Subband CQI per RX antenna and RB (= SINR)
|
/// Subband CQI per RX antenna and RB (= SINR)
|
||||||
int subband_cqi[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][275];
|
int subband_cqi[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB][275];
|
||||||
/// Total Subband CQI and RB (= SINR)
|
/// Total Subband CQI and RB (= SINR)
|
||||||
int subband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX][275];
|
int subband_cqi_tot[NUMBER_OF_NR_ULSCH_MAX][275];
|
||||||
/// Subband CQI in dB and RB (= SINR dB)
|
/// Subband CQI in dB and RB (= SINR dB)
|
||||||
int subband_cqi_dB[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][275];
|
int subband_cqi_dB[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB][275];
|
||||||
/// Total Subband CQI and RB
|
/// Total Subband CQI and RB
|
||||||
int subband_cqi_tot_dB[NUMBER_OF_NR_DLSCH_MAX][275];
|
int subband_cqi_tot_dB[NUMBER_OF_NR_ULSCH_MAX][275];
|
||||||
/// PRACH background noise level
|
/// PRACH background noise level
|
||||||
int prach_I0;
|
int prach_I0;
|
||||||
} PHY_MEASUREMENTS_gNB;
|
} PHY_MEASUREMENTS_gNB;
|
||||||
|
|||||||
@@ -212,10 +212,8 @@ typedef struct {
|
|||||||
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
|
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
|
||||||
|
|
||||||
/// estimated received signal power (sum over all TX antennas)
|
/// estimated received signal power (sum over all TX antennas)
|
||||||
//int wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
|
||||||
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
||||||
/// estimated received signal power (sum over all TX antennas)
|
/// estimated received signal power (sum over all TX antennas)
|
||||||
//int wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
|
||||||
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
||||||
|
|
||||||
/// estimated received signal power (sum over all TX/RX antennas)
|
/// estimated received signal power (sum over all TX/RX antennas)
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
#define NR_MAX_PDSCH_ENCODED_LENGTH NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS // 8 is the maximum modulation order (it was 950984 before !!)
|
#define NR_MAX_PDSCH_ENCODED_LENGTH NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS // 8 is the maximum modulation order (it was 950984 before !!)
|
||||||
#define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH
|
#define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH
|
||||||
#define NR_MAX_PDSCH_TBS 3824
|
#define NR_MAX_PDSCH_TBS 3824
|
||||||
|
#define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits.
|
||||||
|
|
||||||
#define MAX_NUM_NR_DLSCH_SEGMENTS 34
|
#define MAX_NUM_NR_DLSCH_SEGMENTS 34
|
||||||
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
|
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
|
||||||
|
|||||||
@@ -110,15 +110,17 @@ int phy_procedures_RN_UE_RX(unsigned char last_slot, unsigned char next_slot, re
|
|||||||
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id);
|
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id);
|
||||||
|
|
||||||
/*! \brief Scheduling for UE RX procedures in normal subframes.
|
/*! \brief Scheduling for UE RX procedures in normal subframes.
|
||||||
@param ue Pointer to UE variables on which to act
|
@param ue Pointer to UE variables on which to act
|
||||||
@param proc Pointer to proc information
|
@param proc Pointer to proc information
|
||||||
@param gNB_id Local id of eNB on which to act
|
@param gNB_id Local id of eNB on which to act
|
||||||
@param mode calibration/debug mode
|
@param mode calibration/debug mode
|
||||||
|
@param dlsch_parallel use multithreaded dlsch processing
|
||||||
*/
|
*/
|
||||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
runmode_t mode);
|
runmode_t mode,
|
||||||
|
uint8_t dlsch_parallel);
|
||||||
|
|
||||||
int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type);
|
int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type);
|
||||||
|
|
||||||
@@ -296,6 +298,13 @@ uint16_t nr_get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
|
|||||||
|
|
||||||
int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
||||||
|
|
||||||
|
/*! \brief UL time alignment procedures for TA application
|
||||||
|
@param PHY_VARS_NR_UE ue
|
||||||
|
@param int slot_tx
|
||||||
|
@param int frame_tx
|
||||||
|
*/
|
||||||
|
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx);
|
||||||
|
|
||||||
/*! \brief Compute the timing adjustment at UE side from the old TA offset and the new received TA command
|
/*! \brief Compute the timing adjustment at UE side from the old TA offset and the new received TA command
|
||||||
@param Mod_id Local UE index on which to act
|
@param Mod_id Local UE index on which to act
|
||||||
@param CC_id Component Carrier Index
|
@param CC_id Component Carrier Index
|
||||||
|
|||||||
@@ -61,13 +61,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
if(scheduled_response->dl_config != NULL){
|
if(scheduled_response->dl_config != NULL){
|
||||||
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
|
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
|
||||||
|
|
||||||
LOG_D(PHY,"Received %d DL pdus\n",dl_config->number_pdus);
|
LOG_D(PHY,"Received %d DL pdus:\n",dl_config->number_pdus);
|
||||||
pdcch_vars->nb_search_space = 0;
|
pdcch_vars->nb_search_space = 0;
|
||||||
|
|
||||||
for (i = 0; i < dl_config->number_pdus; ++i){
|
for (i = 0; i < dl_config->number_pdus; ++i){
|
||||||
|
|
||||||
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
|
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
|
||||||
|
|
||||||
|
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DCI\n");
|
||||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
|
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
|
||||||
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
|
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
|
||||||
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
|
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
|
||||||
@@ -76,11 +77,18 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
|
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
|
||||||
|
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DLSCH\n");
|
||||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
|
||||||
}
|
}
|
||||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
||||||
|
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH\n");
|
||||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
||||||
}
|
}
|
||||||
|
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
|
||||||
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0];
|
||||||
|
dlsch0->rnti_type = _SI_RNTI_;
|
||||||
|
dlsch0->harq_processes[dlsch0->current_harq_pid]->status = ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
|
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
|
||||||
uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr;
|
uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr;
|
||||||
@@ -91,6 +99,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
|
dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
|
||||||
dlsch0_harq = dlsch0->harq_processes[current_harq_pid];
|
dlsch0_harq = dlsch0->harq_processes[current_harq_pid];
|
||||||
|
|
||||||
|
LOG_D(PHY,"current_harq_pid = %d\n", current_harq_pid);
|
||||||
|
|
||||||
if (dlsch0_harq){
|
if (dlsch0_harq){
|
||||||
|
|
||||||
dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart;
|
dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart;
|
||||||
@@ -110,6 +120,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
dlsch0_harq->Nl=1;
|
dlsch0_harq->Nl=1;
|
||||||
dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table;
|
dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table;
|
||||||
dlsch0_harq->harq_ack.rx_status = downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type);
|
dlsch0_harq->harq_ack.rx_status = downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type);
|
||||||
|
if (dlsch0_harq->status != ACTIVE) {
|
||||||
|
// dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the
|
||||||
|
// following flag to skip PDSCH procedures in that case.
|
||||||
|
dlsch0->active = 0;
|
||||||
|
}
|
||||||
dlsch0_harq->harq_ack.vDAI_DL = dlsch_config_pdu->dai;
|
dlsch0_harq->harq_ack.vDAI_DL = dlsch_config_pdu->dai;
|
||||||
/* PTRS */
|
/* PTRS */
|
||||||
dlsch0_harq->PTRSFreqDensity = dlsch_config_pdu->PTRSFreqDensity;
|
dlsch0_harq->PTRSFreqDensity = dlsch_config_pdu->PTRSFreqDensity;
|
||||||
@@ -118,8 +133,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
dlsch0_harq->nEpreRatioOfPDSCHToPTRS = dlsch_config_pdu->nEpreRatioOfPDSCHToPTRS;
|
dlsch0_harq->nEpreRatioOfPDSCHToPTRS = dlsch_config_pdu->nEpreRatioOfPDSCHToPTRS;
|
||||||
dlsch0_harq->PTRSReOffset = dlsch_config_pdu->PTRSReOffset;
|
dlsch0_harq->PTRSReOffset = dlsch_config_pdu->PTRSReOffset;
|
||||||
dlsch0_harq->pduBitmap = dlsch_config_pdu->pduBitmap;
|
dlsch0_harq->pduBitmap = dlsch_config_pdu->pduBitmap;
|
||||||
LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs);
|
LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\tpdsch_to_harq_feedback_time_ind = %d\tslot_for_feedback_ack = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs, dlsch_config_pdu->pdsch_to_harq_feedback_time_ind, dlsch0_harq->harq_ack.slot_for_feedback_ack);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
|
|
||||||
result_harq = NEW_TRANSMISSION_HARQ;
|
result_harq = NEW_TRANSMISSION_HARQ;
|
||||||
|
|
||||||
NR_TST_PHY_PRINTF("[HARQ-UL-PUSCH harqId : %d] first new transmission \n", harq_pid);
|
LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] first new transmission \n", harq_pid);
|
||||||
}
|
}
|
||||||
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
|
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
|
||||||
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
|
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
|
||||||
@@ -313,7 +313,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
|
|
||||||
result_harq = NEW_TRANSMISSION_HARQ;
|
result_harq = NEW_TRANSMISSION_HARQ;
|
||||||
|
|
||||||
NR_TST_PHY_PRINTF("[HARQ-UL-PUSCH harqId : %d] new transmission due to toogle of ndi \n", harq_pid);
|
LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] new transmission due to toogle of ndi \n", harq_pid);
|
||||||
}
|
}
|
||||||
/* 38.321 5.4.2.1 2> else (i.e. retransmission): */
|
/* 38.321 5.4.2.1 2> else (i.e. retransmission): */
|
||||||
else {
|
else {
|
||||||
@@ -322,7 +322,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
|
|
||||||
result_harq = RETRANSMISSION_HARQ;
|
result_harq = RETRANSMISSION_HARQ;
|
||||||
|
|
||||||
NR_TST_PHY_PRINTF("[HARQ-UL-PUSCH harqId : %d] retransmission \n", harq_pid);
|
LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] retransmission \n", harq_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result_harq);
|
return (result_harq);
|
||||||
@@ -476,7 +476,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
|
|||||||
|
|
||||||
result_harq = NEW_TRANSMISSION_HARQ;
|
result_harq = NEW_TRANSMISSION_HARQ;
|
||||||
|
|
||||||
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid);
|
LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid);
|
||||||
}
|
}
|
||||||
else if (dl_harq->DCINdi != ndi) {
|
else if (dl_harq->DCINdi != ndi) {
|
||||||
dl_harq->round = 0;
|
dl_harq->round = 0;
|
||||||
@@ -485,7 +485,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
|
|||||||
|
|
||||||
result_harq = NEW_TRANSMISSION_HARQ;
|
result_harq = NEW_TRANSMISSION_HARQ;
|
||||||
|
|
||||||
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid);
|
LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@@ -495,7 +495,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
|
|||||||
|
|
||||||
result_harq = RETRANSMISSION_HARQ;
|
result_harq = RETRANSMISSION_HARQ;
|
||||||
|
|
||||||
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] reception of a retransmission \n", harq_pid);
|
LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] reception of a retransmission \n", harq_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result_harq);
|
return (result_harq);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include "nr/nr_common.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
#include "SCHED/phy_procedures_emos.h"
|
#include "SCHED/phy_procedures_emos.h"
|
||||||
#endif
|
#endif
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
|
#include "executables/nr-uesoftmodem.h"
|
||||||
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
||||||
|
|
||||||
//#define DEBUG_PHY_PROC
|
//#define DEBUG_PHY_PROC
|
||||||
@@ -134,10 +136,10 @@ UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_id){
|
|||||||
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]);
|
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){
|
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
||||||
|
uint16_t get_bw_scaling(uint16_t nb_rb){
|
||||||
uint16_t bw_scaling;
|
uint16_t bw_scaling;
|
||||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
switch (nb_rb) {
|
||||||
switch (bwp_ul_NB_RB) {
|
|
||||||
case 32: bw_scaling = 4; break;
|
case 32: bw_scaling = 4; break;
|
||||||
case 66: bw_scaling = 8; break;
|
case 66: bw_scaling = 8; break;
|
||||||
case 106: bw_scaling = 16; break;
|
case 106: bw_scaling = 16; break;
|
||||||
@@ -149,6 +151,32 @@ uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){
|
|||||||
return bw_scaling;
|
return bw_scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* UL time alignment
|
||||||
|
// If the current tx frame and slot match the TA configuration in ul_time_alignment
|
||||||
|
// then timing advance is processed and set to be applied in the next UL transmission */
|
||||||
|
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
||||||
|
|
||||||
|
if (ue->mac_enabled == 1) {
|
||||||
|
|
||||||
|
uint8_t gNB_id = 0;
|
||||||
|
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[gNB_id];
|
||||||
|
|
||||||
|
if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) {
|
||||||
|
|
||||||
|
uint8_t numerology = ue->frame_parms.numerology_index;
|
||||||
|
uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL;
|
||||||
|
|
||||||
|
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d\n", __FUNCTION__, frame_tx, slot_tx);
|
||||||
|
|
||||||
|
nr_process_timing_advance(ue->Mod_id, ue->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB);
|
||||||
|
|
||||||
|
ul_time_alignment->ta_frame = -1;
|
||||||
|
ul_time_alignment->ta_slot = -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB){
|
void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB){
|
||||||
|
|
||||||
// 3GPP TS 38.213 p4.2
|
// 3GPP TS 38.213 p4.2
|
||||||
@@ -178,10 +206,8 @@ void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot
|
|||||||
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id) {
|
uint8_t gNB_id) {
|
||||||
//int32_t ulsch_start=0;
|
|
||||||
int slot_tx = proc->nr_slot_tx;
|
int slot_tx = proc->nr_slot_tx;
|
||||||
int frame_tx = proc->frame_tx;
|
int frame_tx = proc->frame_tx;
|
||||||
uint8_t harq_pid = 0;
|
|
||||||
runmode_t mode = normal_txrx;
|
runmode_t mode = normal_txrx;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
||||||
@@ -196,16 +222,18 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
if (ue->UE_mode[gNB_id] <= PUSCH){
|
if (ue->UE_mode[gNB_id] <= PUSCH){
|
||||||
|
|
||||||
if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE)
|
for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id][0]->number_harq_processes_for_pusch; harq_pid++) {
|
||||||
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id);
|
if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE)
|
||||||
|
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (get_softmodem_params()->usim_test==0) {
|
if (get_softmodem_params()->usim_test==0) {
|
||||||
LOG_D(PHY, "Generating PUCCH\n");
|
LOG_D(PHY, "Generating PUCCH\n");
|
||||||
pucch_procedures_ue_nr(ue,
|
pucch_procedures_ue_nr(ue,
|
||||||
gNB_id,
|
gNB_id,
|
||||||
proc,
|
proc,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(PHY, "Sending Uplink data \n");
|
LOG_D(PHY, "Sending Uplink data \n");
|
||||||
nr_ue_pusch_common_procedures(ue,
|
nr_ue_pusch_common_procedures(ue,
|
||||||
@@ -230,14 +258,12 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0..6]
|
void nr_ue_measurement_procedures(uint16_t l,
|
||||||
PHY_VARS_NR_UE *ue,
|
PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t eNB_id,
|
uint8_t eNB_id,
|
||||||
uint16_t slot, // slot index of each radio frame [0..19]
|
uint16_t slot,
|
||||||
runmode_t mode)
|
runmode_t mode){
|
||||||
{
|
|
||||||
LOG_D(PHY,"ue_measurement_procedures l %u Ncp %d\n",l,ue->frame_parms.Ncp);
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||||
int frame_rx = proc->frame_rx;
|
int frame_rx = proc->frame_rx;
|
||||||
@@ -245,18 +271,14 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
if (l==2) {
|
if (l==2) {
|
||||||
// UE measurements on symbol 0
|
|
||||||
LOG_D(PHY,"Calling measurements nr_slot_rx %d, rxdata %p\n",nr_slot_rx,ue->common_vars.rxdata);
|
LOG_D(PHY,"Doing UE measurement procedures in symbol l %u Ncp %d nr_slot_rx %d, rxdata %p\n",
|
||||||
/*
|
l,
|
||||||
nr_ue_measurements(ue,
|
ue->frame_parms.Ncp,
|
||||||
proc,
|
nr_slot_rx,
|
||||||
0,
|
ue->common_vars.rxdata);
|
||||||
0,
|
|
||||||
0,
|
nr_ue_measurements(ue, proc, nr_slot_rx);
|
||||||
0,
|
|
||||||
nr_slot_rx);
|
|
||||||
*/
|
|
||||||
//(nr_slot_rx*frame_parms->samples_per_slot+ue->rx_offset) % frame_parms->samples_per_frame
|
|
||||||
|
|
||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
if(slot == 0)
|
if(slot == 0)
|
||||||
@@ -270,21 +292,6 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0
|
|||||||
T_INT((int)ue->common_vars.freq_offset));
|
T_INT((int)ue->common_vars.freq_offset));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (l==(6-ue->frame_parms.Ncp)) {
|
|
||||||
|
|
||||||
// make sure we have signal from PSS/SSS for N0 measurement
|
|
||||||
// LOG_I(PHY," l==(6-ue->frame_parms.Ncp) ue_rrc_measurements\n");
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN);
|
|
||||||
ue_rrc_measurements(ue,
|
|
||||||
slot,
|
|
||||||
abstraction_flag);
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// accumulate and filter timing offset estimation every subframe (instead of every frame)
|
// accumulate and filter timing offset estimation every subframe (instead of every frame)
|
||||||
if (( slot == 2) && (l==(2-frame_parms->Ncp))) {
|
if (( slot == 2) && (l==(2-frame_parms->Ncp))) {
|
||||||
@@ -723,12 +730,12 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
|
|
||||||
if (!dlsch1) {
|
if (!dlsch1) {
|
||||||
int harq_pid = dlsch0->current_harq_pid;
|
int harq_pid = dlsch0->current_harq_pid;
|
||||||
uint16_t BWPStart = dlsch0->harq_processes[harq_pid]->BWPStart;
|
NR_DL_UE_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid];
|
||||||
// uint16_t BWPSize = dlsch0->harq_processes[harq_pid]->BWPSize;
|
uint16_t BWPStart = dlsch0_harq->BWPStart;
|
||||||
uint16_t pdsch_start_rb = dlsch0->harq_processes[harq_pid]->start_rb;
|
uint16_t pdsch_start_rb = dlsch0_harq->start_rb;
|
||||||
uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb;
|
uint16_t pdsch_nb_rb = dlsch0_harq->nb_rb;
|
||||||
uint16_t s0 = dlsch0->harq_processes[harq_pid]->start_symbol;
|
uint16_t s0 = dlsch0_harq->start_symbol;
|
||||||
uint16_t s1 = dlsch0->harq_processes[harq_pid]->nb_symbols;
|
uint16_t s1 = dlsch0_harq->nb_symbols;
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos);
|
LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos);
|
||||||
|
|
||||||
@@ -741,6 +748,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
nr_slot_rx,
|
nr_slot_rx,
|
||||||
aatx /*p*/,
|
aatx /*p*/,
|
||||||
m,
|
m,
|
||||||
|
BWPStart,
|
||||||
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
|
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
|
||||||
pdsch_nb_rb);
|
pdsch_nb_rb);
|
||||||
LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_slot_rx,m);
|
LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_slot_rx,m);
|
||||||
@@ -759,16 +767,29 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t first_symbol_with_data = s0;
|
||||||
|
uint32_t dmrs_data_re;
|
||||||
|
|
||||||
|
if (ue->dmrs_DownlinkConfig.pdsch_dmrs_type == pdsch_dmrs_type1)
|
||||||
|
dmrs_data_re = 12 - 6 * dlsch0_harq->n_dmrs_cdm_groups;
|
||||||
|
else
|
||||||
|
dmrs_data_re = 12 - 4 * dlsch0_harq->n_dmrs_cdm_groups;
|
||||||
|
|
||||||
|
while ((dmrs_data_re == 0) && (dlsch0_harq->dlDmrsSymbPos & (1 << first_symbol_with_data))) {
|
||||||
|
first_symbol_with_data++;
|
||||||
|
}
|
||||||
|
|
||||||
for (m = s0; m < (s1 + s0); m++) {
|
for (m = s0; m < (s1 + s0); m++) {
|
||||||
|
|
||||||
dual_stream_UE = 0;
|
dual_stream_UE = 0;
|
||||||
eNB_id_i = eNB_id+1;
|
eNB_id_i = eNB_id+1;
|
||||||
i_mod = 0;
|
i_mod = 0;
|
||||||
|
if (( m==first_symbol_with_data ) && (m<4))
|
||||||
if ((m==s0) && (m<3))
|
first_symbol_flag = 1;
|
||||||
first_symbol_flag = 1;
|
|
||||||
else
|
else
|
||||||
first_symbol_flag = 0;
|
first_symbol_flag = 0;
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
uint8_t slot = 0;
|
uint8_t slot = 0;
|
||||||
if(m >= ue->frame_parms.symbols_per_slot>>1)
|
if(m >= ue->frame_parms.symbols_per_slot>>1)
|
||||||
@@ -778,7 +799,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
// process DLSCH received in first slot
|
// process DLSCH received in first slot
|
||||||
// skip DMRS symbols (will have to check later if PDSCH/DMRS are multiplexed
|
// skip DMRS symbols (will have to check later if PDSCH/DMRS are multiplexed
|
||||||
if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) == 0) {
|
if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) == 0) {
|
||||||
if (nr_rx_pdsch(ue,
|
if (nr_rx_pdsch(ue,
|
||||||
proc,
|
proc,
|
||||||
pdsch,
|
pdsch,
|
||||||
eNB_id,
|
eNB_id,
|
||||||
@@ -791,10 +812,10 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
i_mod,
|
i_mod,
|
||||||
dlsch0->current_harq_pid) < 0)
|
dlsch0->current_harq_pid) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS)
|
else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS)
|
||||||
if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1];
|
if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1];
|
||||||
else if (pdsch == PDSCH) {
|
else if (pdsch == PDSCH || pdsch == SI_PDSCH) {
|
||||||
if (nr_rx_pdsch(ue,
|
if (nr_rx_pdsch(ue,
|
||||||
proc,
|
proc,
|
||||||
pdsch,
|
pdsch,
|
||||||
@@ -809,7 +830,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
dlsch0->current_harq_pid) < 0)
|
dlsch0->current_harq_pid) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else AssertFatal(1==0,"not RA_PDSCH or PDSCH\n");
|
else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n");
|
||||||
}
|
}
|
||||||
if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]);
|
if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]);
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
@@ -916,7 +937,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
NR_UE_DLSCH_t *dlsch0,
|
NR_UE_DLSCH_t *dlsch0,
|
||||||
NR_UE_DLSCH_t *dlsch1,
|
NR_UE_DLSCH_t *dlsch1,
|
||||||
int *dlsch_errors,
|
int *dlsch_errors,
|
||||||
runmode_t mode) {
|
runmode_t mode,
|
||||||
|
uint8_t dlsch_parallel) {
|
||||||
|
|
||||||
if (dlsch0==NULL)
|
if (dlsch0==NULL)
|
||||||
AssertFatal(0,"dlsch0 should be defined at this level \n");
|
AssertFatal(0,"dlsch0 should be defined at this level \n");
|
||||||
@@ -945,7 +967,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size;
|
uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size;
|
||||||
uint16_t nb_prefix_samples = ue->frame_parms.nb_prefix_samples;
|
uint16_t nb_prefix_samples = ue->frame_parms.nb_prefix_samples;
|
||||||
uint32_t t_subframe = 1; // subframe duration of 1 msec
|
uint32_t t_subframe = 1; // subframe duration of 1 msec
|
||||||
uint16_t bw_scaling, start_symbol;
|
uint16_t start_symbol;
|
||||||
float tc_factor;
|
float tc_factor;
|
||||||
|
|
||||||
is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
|
is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
|
||||||
@@ -1047,8 +1069,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
start_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
start_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UE_DLSCH_PARALLELISATION
|
if( dlsch_parallel)
|
||||||
ret = nr_dlsch_decoding_mthread(ue,
|
{
|
||||||
|
ret = nr_dlsch_decoding_mthread(ue,
|
||||||
proc,
|
proc,
|
||||||
eNB_id,
|
eNB_id,
|
||||||
pdsch_vars->llr[0],
|
pdsch_vars->llr[0],
|
||||||
@@ -1061,9 +1084,11 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
harq_pid,
|
harq_pid,
|
||||||
pdsch==PDSCH?1:0,
|
pdsch==PDSCH?1:0,
|
||||||
dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
|
dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
|
||||||
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret = %d\n", ret);
|
LOG_T(PHY,"dlsch decoding is parallelized, ret = %d\n", ret);
|
||||||
#else
|
}
|
||||||
ret = nr_dlsch_decoding(ue,
|
else
|
||||||
|
{
|
||||||
|
ret = nr_dlsch_decoding(ue,
|
||||||
proc,
|
proc,
|
||||||
eNB_id,
|
eNB_id,
|
||||||
pdsch_vars->llr[0],
|
pdsch_vars->llr[0],
|
||||||
@@ -1076,9 +1101,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
harq_pid,
|
harq_pid,
|
||||||
pdsch==PDSCH?1:0,
|
pdsch==PDSCH?1:0,
|
||||||
dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
|
dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
|
||||||
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret = %d\n", ret);
|
LOG_T(PHY,"Sequential dlsch decoding , ret = %d\n", ret);
|
||||||
//printf("start cW0 dlsch decoding\n");
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
||||||
@@ -1130,38 +1155,40 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
start_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
start_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UE_DLSCH_PARALLELISATION
|
if(dlsch_parallel)
|
||||||
ret1 = nr_dlsch_decoding_mthread(ue,
|
{
|
||||||
proc,
|
ret1 = nr_dlsch_decoding_mthread(ue,
|
||||||
eNB_id,
|
proc,
|
||||||
pdsch_vars->llr[1],
|
eNB_id,
|
||||||
&ue->frame_parms,
|
pdsch_vars->llr[1],
|
||||||
dlsch1,
|
&ue->frame_parms,
|
||||||
dlsch1->harq_processes[harq_pid],
|
dlsch1,
|
||||||
frame_rx,
|
dlsch1->harq_processes[harq_pid],
|
||||||
nb_symb_sch,
|
frame_rx,
|
||||||
nr_slot_rx,
|
nb_symb_sch,
|
||||||
harq_pid,
|
nr_slot_rx,
|
||||||
pdsch==PDSCH?1:0,
|
harq_pid,
|
||||||
dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
|
pdsch==PDSCH?1:0,
|
||||||
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret1 = %d\n", ret1);
|
dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
|
||||||
#else
|
LOG_T(PHY,"CW dlsch decoding is parallelized, ret1 = %d\n", ret1);
|
||||||
ret1 = nr_dlsch_decoding(ue,
|
}
|
||||||
proc,
|
else
|
||||||
eNB_id,
|
{
|
||||||
pdsch_vars->llr[1],
|
ret1 = nr_dlsch_decoding(ue,
|
||||||
&ue->frame_parms,
|
proc,
|
||||||
dlsch1,
|
eNB_id,
|
||||||
dlsch1->harq_processes[harq_pid],
|
pdsch_vars->llr[1],
|
||||||
frame_rx,
|
&ue->frame_parms,
|
||||||
nb_symb_sch,
|
dlsch1,
|
||||||
nr_slot_rx,
|
dlsch1->harq_processes[harq_pid],
|
||||||
harq_pid,
|
frame_rx,
|
||||||
pdsch==PDSCH?1:0,//proc->decoder_switch,
|
nb_symb_sch,
|
||||||
dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
|
nr_slot_rx,
|
||||||
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret1 = %d\n", ret1);
|
harq_pid,
|
||||||
printf("start cw1 dlsch decoding\n");
|
pdsch==PDSCH?1:0,//proc->decoder_switch,
|
||||||
#endif
|
dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
|
||||||
|
LOG_T(PHY,"CWW sequential dlsch decoding, ret1 = %d\n", ret1);
|
||||||
|
}
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
||||||
@@ -1207,6 +1234,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
case PDSCH:
|
case PDSCH:
|
||||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
|
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||||
break;
|
break;
|
||||||
|
case SI_PDSCH:
|
||||||
|
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1256,16 +1286,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
if (ue->mac_enabled == 1) {
|
if (ue->mac_enabled == 1) {
|
||||||
|
|
||||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
uint16_t bw_scaling = get_bw_scaling(ue->frame_parms.N_RB_DL);
|
||||||
switch (ue->frame_parms.N_RB_DL) {
|
|
||||||
case 32: bw_scaling = 4; break;
|
|
||||||
case 66: bw_scaling = 8; break;
|
|
||||||
case 106: bw_scaling = 16; break;
|
|
||||||
case 217: bw_scaling = 32; break;
|
|
||||||
case 245: bw_scaling = 32; break;
|
|
||||||
case 273: bw_scaling = 32; break;
|
|
||||||
default: abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Time Alignment procedure
|
/* Time Alignment procedure
|
||||||
// - UE processing capability 1
|
// - UE processing capability 1
|
||||||
@@ -1704,8 +1725,10 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
|
|||||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
runmode_t mode)
|
runmode_t mode,
|
||||||
{
|
uint8_t dlsch_parallel
|
||||||
|
)
|
||||||
|
{
|
||||||
int frame_rx = proc->frame_rx;
|
int frame_rx = proc->frame_rx;
|
||||||
int nr_slot_rx = proc->nr_slot_rx;
|
int nr_slot_rx = proc->nr_slot_rx;
|
||||||
int slot_pbch;
|
int slot_pbch;
|
||||||
@@ -1716,8 +1739,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0;
|
uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0;
|
||||||
uint8_t dci_cnt = 0;
|
uint8_t dci_cnt = 0;
|
||||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||||
|
|
||||||
//NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
@@ -1777,6 +1798,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
0,
|
0,
|
||||||
16384);
|
16384);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_D(PHY, "Doing N0 measurements in %s\n", __FUNCTION__);
|
||||||
|
nr_ue_rrc_measurements(ue, proc, nr_slot_rx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1790,7 +1814,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||||
for (uint16_t l=0; l<nb_symb_pdcch; l++) {
|
for (uint16_t l=0; l<nb_symb_pdcch; l++) {
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
start_meas(&ue->ofdm_demod_stats);
|
start_meas(&ue->ofdm_demod_stats);
|
||||||
#endif
|
#endif
|
||||||
@@ -1802,29 +1826,30 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
dci_cnt = 0;
|
||||||
|
for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) {
|
||||||
|
|
||||||
// note: this only works if RBs for PDCCH are contigous!
|
// note: this only works if RBs for PDCCH are contigous!
|
||||||
LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n",
|
LOG_D(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n",
|
||||||
fp->first_carrier_offset,pdcch_vars->pdcch_config[0].BWPStart,coreset_start_rb);
|
fp->first_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb);
|
||||||
|
|
||||||
if (coreset_nb_rb > 0)
|
if (coreset_nb_rb > 0)
|
||||||
nr_pdcch_channel_estimation(ue,
|
nr_pdcch_channel_estimation(ue,
|
||||||
proc,
|
proc,
|
||||||
0,
|
0,
|
||||||
nr_slot_rx,
|
nr_slot_rx,
|
||||||
l,
|
l,
|
||||||
fp->first_carrier_offset+(pdcch_vars->pdcch_config[0].BWPStart + coreset_start_rb)*12,
|
fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12,
|
||||||
coreset_nb_rb);
|
coreset_nb_rb);
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT);
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
stop_meas(&ue->ofdm_demod_stats);
|
stop_meas(&ue->ofdm_demod_stats);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//printf("phy procedure pdcch start measurement l =%d\n",l);
|
|
||||||
//nr_ue_measurement_procedures(l,ue,proc,gNB_id,(nr_slot_rx),mode);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dci_cnt = nr_ue_pdcch_procedures(gNB_id, ue, proc);
|
dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dci_cnt > 0) {
|
if (dci_cnt > 0) {
|
||||||
|
|
||||||
@@ -1833,6 +1858,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
NR_UE_DLSCH_t *dlsch = NULL;
|
NR_UE_DLSCH_t *dlsch = NULL;
|
||||||
if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1){
|
if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1){
|
||||||
dlsch = ue->dlsch[proc->thread_id][gNB_id][0];
|
dlsch = ue->dlsch[proc->thread_id][gNB_id][0];
|
||||||
|
} else if (ue->dlsch_SI[0]->active == 1){
|
||||||
|
dlsch = ue->dlsch_SI[0];
|
||||||
} else if (ue->dlsch_ra[0]->active == 1){
|
} else if (ue->dlsch_ra[0]->active == 1){
|
||||||
dlsch = ue->dlsch_ra[0];
|
dlsch = ue->dlsch_ra[0];
|
||||||
}
|
}
|
||||||
@@ -1845,7 +1872,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||||
//to update from pdsch config
|
//to update from pdsch config
|
||||||
|
|
||||||
for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){
|
for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){
|
||||||
nr_slot_fep(ue,
|
nr_slot_fep(ue,
|
||||||
proc,
|
proc,
|
||||||
@@ -1875,19 +1902,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch[proc->thread_id][gNB_id][0],
|
ue->dlsch[proc->thread_id][gNB_id][0],
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
//printf("phy procedure pdsch start measurement\n");
|
nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx, mode);
|
||||||
nr_ue_measurement_procedures(2,ue,proc,gNB_id,nr_slot_rx,mode);
|
|
||||||
|
|
||||||
/*
|
|
||||||
write_output("rxF.m","rxF",&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0],fp->ofdm_symbol_size*14,1,1);
|
|
||||||
write_output("rxF_ch.m","rxFch",&ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates[0][0],fp->ofdm_symbol_size*14,1,1);
|
|
||||||
write_output("rxF_ch_ext.m","rxFche",&ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[0][2*50*12],50*12,1,1);
|
|
||||||
write_output("rxF_ext.m","rxFe",&ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_ext[0][0],50*12*14,1,1);
|
|
||||||
write_output("rxF_comp.m","rxFc",&ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_comp0[0][0],fp->N_RB_DL*12*14,1,1);
|
|
||||||
write_output("rxF_llr.m","rxFllr",ue->pdsch_vars[proc->thread_id][gNB_id]->llr[0],(nb_symb_sch-1)*50*12+50*6,1,0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// do procedures for SI-RNTI
|
// do procedures for SI-RNTI
|
||||||
@@ -1907,7 +1922,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_SI[gNB_id],
|
ue->dlsch_SI[gNB_id],
|
||||||
NULL,
|
NULL,
|
||||||
&ue->dlsch_SI_errors[gNB_id],
|
&ue->dlsch_SI_errors[gNB_id],
|
||||||
mode);
|
mode,
|
||||||
|
dlsch_parallel);
|
||||||
|
|
||||||
// deactivate dlsch once dlsch proc is done
|
// deactivate dlsch once dlsch proc is done
|
||||||
ue->dlsch_SI[gNB_id]->active = 0;
|
ue->dlsch_SI[gNB_id]->active = 0;
|
||||||
@@ -1932,7 +1948,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_p[gNB_id],
|
ue->dlsch_p[gNB_id],
|
||||||
NULL,
|
NULL,
|
||||||
&ue->dlsch_p_errors[gNB_id],
|
&ue->dlsch_p_errors[gNB_id],
|
||||||
mode);
|
mode,
|
||||||
|
dlsch_parallel);
|
||||||
|
|
||||||
// deactivate dlsch once dlsch proc is done
|
// deactivate dlsch once dlsch proc is done
|
||||||
ue->dlsch_p[gNB_id]->active = 0;
|
ue->dlsch_p[gNB_id]->active = 0;
|
||||||
@@ -1957,7 +1974,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_ra[gNB_id],
|
ue->dlsch_ra[gNB_id],
|
||||||
NULL,
|
NULL,
|
||||||
&ue->dlsch_ra_errors[gNB_id],
|
&ue->dlsch_ra_errors[gNB_id],
|
||||||
mode);
|
mode,
|
||||||
|
dlsch_parallel);
|
||||||
|
|
||||||
// deactivate dlsch once dlsch proc is done
|
// deactivate dlsch once dlsch proc is done
|
||||||
ue->dlsch_ra[gNB_id]->active = 0;
|
ue->dlsch_ra[gNB_id]->active = 0;
|
||||||
@@ -1983,7 +2001,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch[proc->thread_id][gNB_id][0],
|
ue->dlsch[proc->thread_id][gNB_id][0],
|
||||||
ue->dlsch[proc->thread_id][gNB_id][1],
|
ue->dlsch[proc->thread_id][gNB_id][1],
|
||||||
&ue->dlsch_errors[gNB_id],
|
&ue->dlsch_errors[gNB_id],
|
||||||
mode);
|
mode,
|
||||||
|
dlsch_parallel);
|
||||||
|
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
G_b_f_c = ue->dlsch[proc->thread_id][gNB_id][0]->g_pucch;
|
G_b_f_c = ue->dlsch[proc->thread_id][gNB_id][0]->g_pucch;
|
||||||
LOG_W(PHY,"PUCCH Transmit power control command not yet implemented for NR : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
|
LOG_D(PHY,"PUCCH Transmit power control command not yet implemented for NR : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
|
||||||
return (PUCCH_POWER_DEFAULT);
|
return (PUCCH_POWER_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,6 +247,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
|||||||
pucch_resource_indicator = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack.pucch_resource_indicator;
|
pucch_resource_indicator = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack.pucch_resource_indicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_D(PHY, "PUCCH: %d.%d dl_harq_pid = %d, pucch_resource_indicator = %d\n", frame_tx, nr_slot_tx, dl_harq_pid, pucch_resource_indicator);
|
||||||
|
|
||||||
/* Part - I
|
/* Part - I
|
||||||
* Collect feedback that should be transmitted at this nr_slot_tx :
|
* Collect feedback that should be transmitted at this nr_slot_tx :
|
||||||
* - ACK/NACK, SR, CSI (CQI, RI, ...)
|
* - ACK/NACK, SR, CSI (CQI, RI, ...)
|
||||||
@@ -445,7 +447,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int max_code_rate = 0;
|
//int max_code_rate = 0;
|
||||||
//int Q_m = BITS_PER_SYMBOL_QPSK; /* default pucch modulation type is QPSK with 2 bits per symbol */
|
//int Q_m = BITS_PER_SYMBOL_QPSK; /* default pucch modulation type is QPSK with 2 bits per symbol */
|
||||||
int N_sc_ctrl_RB = 0;
|
int N_sc_ctrl_RB = 0;
|
||||||
int O_CRC = 0;
|
int O_CRC = 0;
|
||||||
@@ -502,7 +504,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
|||||||
if (format != pucch_format0_nr) {
|
if (format != pucch_format0_nr) {
|
||||||
|
|
||||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) {
|
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) {
|
||||||
max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */
|
//max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */
|
||||||
|
|
||||||
if ((O_ACK != 0) && (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->simultaneousHARQ_ACK_CSI[0] == 0)) {
|
if ((O_ACK != 0) && (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->simultaneousHARQ_ACK_CSI[0] == 0)) {
|
||||||
N_UCI = N_UCI - O_CSI;
|
N_UCI = N_UCI - O_CSI;
|
||||||
|
|||||||
@@ -146,6 +146,10 @@ int is_x2ap_enabled(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// needed for some functions
|
// needed for some functions
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg);
|
void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg);
|
||||||
@@ -270,7 +274,7 @@ int main(int argc, char **argv)
|
|||||||
uint16_t ptrsSymbPerSlot = 0;
|
uint16_t ptrsSymbPerSlot = 0;
|
||||||
uint16_t rbSize = 106;
|
uint16_t rbSize = 106;
|
||||||
uint8_t mcsIndex = 9;
|
uint8_t mcsIndex = 9;
|
||||||
|
uint8_t dlsch_threads = 0;
|
||||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||||
exit_fun("[NR_DLSIM] Error, configuration module init failed\n");
|
exit_fun("[NR_DLSIM] Error, configuration module init failed\n");
|
||||||
}
|
}
|
||||||
@@ -281,7 +285,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
FILE *scg_fd=NULL;
|
FILE *scg_fd=NULL;
|
||||||
|
|
||||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:w:T:U:q")) != -1) {
|
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:q")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'f':
|
case 'f':
|
||||||
scg_fd = fopen(optarg,"r");
|
scg_fd = fopen(optarg,"r");
|
||||||
@@ -448,7 +452,9 @@ int main(int argc, char **argv)
|
|||||||
case 'b':
|
case 'b':
|
||||||
g_rbSize = atoi(optarg);
|
g_rbSize = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
dlsch_threads = atoi(optarg);
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
g_mcsIndex = atoi(optarg);
|
g_mcsIndex = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
@@ -519,11 +525,12 @@ int main(int argc, char **argv)
|
|||||||
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2}, e.g. -U 2 0 2 \n");
|
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2}, e.g. -U 2 0 2 \n");
|
||||||
printf("-P Print DLSCH performances\n");
|
printf("-P Print DLSCH performances\n");
|
||||||
printf("-w Write txdata to binary file (one frame)\n");
|
printf("-w Write txdata to binary file (one frame)\n");
|
||||||
|
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logInit();
|
logInit();
|
||||||
set_glog(loglvl);
|
set_glog(loglvl);
|
||||||
T_stdout = 1;
|
T_stdout = 1;
|
||||||
@@ -534,6 +541,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (snr1set==0)
|
if (snr1set==0)
|
||||||
snr1 = snr0+10;
|
snr1 = snr0+10;
|
||||||
|
init_dlsch_tpool(dlsch_threads);
|
||||||
|
|
||||||
|
|
||||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||||
@@ -752,16 +760,16 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
nr_l2_init_ue(NULL);
|
nr_l2_init_ue(NULL);
|
||||||
UE_mac = get_mac_inst(0);
|
UE_mac = get_mac_inst(0);
|
||||||
|
|
||||||
UE->if_inst = nr_ue_if_module_init(0);
|
UE->if_inst = nr_ue_if_module_init(0);
|
||||||
UE->if_inst->scheduled_response = nr_ue_scheduled_response;
|
UE->if_inst->scheduled_response = nr_ue_scheduled_response;
|
||||||
UE->if_inst->phy_config_request = nr_ue_phy_config_request;
|
UE->if_inst->phy_config_request = nr_ue_phy_config_request;
|
||||||
UE->if_inst->dl_indication = nr_ue_dl_indication;
|
UE->if_inst->dl_indication = nr_ue_dl_indication;
|
||||||
UE->if_inst->ul_indication = dummy_nr_ue_ul_indication;
|
UE->if_inst->ul_indication = dummy_nr_ue_ul_indication;
|
||||||
|
|
||||||
|
|
||||||
UE_mac->if_module = nr_ue_if_module_init(0);
|
UE_mac->if_module = nr_ue_if_module_init(0);
|
||||||
|
|
||||||
unsigned int available_bits=0;
|
unsigned int available_bits=0;
|
||||||
unsigned char *estimated_output_bit;
|
unsigned char *estimated_output_bit;
|
||||||
unsigned char *test_input_bit;
|
unsigned char *test_input_bit;
|
||||||
@@ -819,7 +827,7 @@ int main(int argc, char **argv)
|
|||||||
reset_meas(&gNB->tinput);
|
reset_meas(&gNB->tinput);
|
||||||
reset_meas(&gNB->tprep);
|
reset_meas(&gNB->tprep);
|
||||||
reset_meas(&gNB->tparity);
|
reset_meas(&gNB->tparity);
|
||||||
reset_meas(&gNB->toutput);
|
reset_meas(&gNB->toutput);
|
||||||
|
|
||||||
clear_pdsch_stats(gNB);
|
clear_pdsch_stats(gNB);
|
||||||
|
|
||||||
@@ -918,7 +926,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||||
if (n_trials==1) printf("tx_offset %d, txdataF_offset %d \n", tx_offset,txdataF_offset);
|
if (n_trials==1) printf("tx_offset %d, txdataF_offset %d \n", tx_offset,txdataF_offset);
|
||||||
|
|
||||||
//TODO: loop over slots
|
//TODO: loop over slots
|
||||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||||
|
|
||||||
@@ -980,19 +988,20 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
|
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
|
||||||
nr_ue_scheduled_response(&scheduled_response);
|
nr_ue_scheduled_response(&scheduled_response);
|
||||||
|
|
||||||
phy_procedures_nrUE_RX(UE,
|
phy_procedures_nrUE_RX(UE,
|
||||||
&UE_proc,
|
&UE_proc,
|
||||||
0,
|
0,
|
||||||
normal_txrx);
|
normal_txrx,
|
||||||
|
dlsch_threads);
|
||||||
|
|
||||||
//printf("dlsim round %d ends\n",round);
|
//printf("dlsim round %d ends\n",round);
|
||||||
round++;
|
round++;
|
||||||
} // round
|
} // round
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
//---------------------- count errors ----------------------
|
//---------------------- count errors ----------------------
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
@@ -1031,7 +1040,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
}
|
}
|
||||||
for (i = 0; i < TBS; i++) {
|
for (i = 0; i < TBS; i++) {
|
||||||
|
|
||||||
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||||
test_input_bit[i] = (gNB_dlsch->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
|
test_input_bit[i] = (gNB_dlsch->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ int is_x2ap_enabled(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ int is_x2ap_enabled(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// needed for some functions
|
// needed for some functions
|
||||||
uint16_t n_rnti = 0x1234;
|
uint16_t n_rnti = 0x1234;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
|||||||
@@ -399,8 +399,8 @@ typedef struct NbIoTRrcConfigurationReq_s {
|
|||||||
|
|
||||||
// gNB: GNB_APP -> RRC messages
|
// gNB: GNB_APP -> RRC messages
|
||||||
typedef struct NRRrcConfigurationReq_s {
|
typedef struct NRRrcConfigurationReq_s {
|
||||||
uint32_t cell_identity;
|
uint64_t cell_identity;
|
||||||
uint16_t tac;
|
uint32_t tac;
|
||||||
uint16_t mcc[PLMN_LIST_MAX_SIZE];
|
uint16_t mcc[PLMN_LIST_MAX_SIZE];
|
||||||
uint16_t mnc[PLMN_LIST_MAX_SIZE];
|
uint16_t mnc[PLMN_LIST_MAX_SIZE];
|
||||||
uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE];
|
uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE];
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
/* cell configuration section name */
|
/* cell configuration section name */
|
||||||
#define GNB_CONFIG_STRING_GNB_LIST "gNBs"
|
#define GNB_CONFIG_STRING_GNB_LIST "gNBs"
|
||||||
|
|
||||||
|
#define GNB_CONFIG_STRING_PDCCH_CONFIGSIB1 "pdcch_ConfigSIB1"
|
||||||
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon"
|
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon"
|
||||||
#define GNB_CONFIG_STRING_PHYSCELLID "physCellId"
|
#define GNB_CONFIG_STRING_PHYSCELLID "physCellId"
|
||||||
#define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset"
|
#define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset"
|
||||||
@@ -210,6 +211,21 @@
|
|||||||
|
|
||||||
#define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273}
|
#define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
/* pdcch_ConfigSIB1 parameters */
|
||||||
|
/*--------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
#define CONTROL_RESOURCE_SET_ZERO "controlResourceSetZero"
|
||||||
|
#define SEARCH_SPACE_ZERO "searchSpaceZero"
|
||||||
|
|
||||||
|
#define PDCCH_CONFIGSIB1PARAMS_DESC(pdcch_ConfigSIB1) { \
|
||||||
|
{CONTROL_RESOURCE_SET_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->controlResourceSetZero, defintval:0, TYPE_INT64, 0}, \
|
||||||
|
{SEARCH_SPACE_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->searchSpaceZero, defintval:0, TYPE_INT64, 0} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CONTROL_RESOURCE_SET_ZERO_IDX 0
|
||||||
|
#define SEARCH_SPACE_ZERO_IDX 1
|
||||||
|
/*--------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* Serving Cell Config Common configuration parameters */
|
/* Serving Cell Config Common configuration parameters */
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
|
|||||||
@@ -574,6 +574,17 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
|||||||
gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr);
|
gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pdcch_ConfigSIB1
|
||||||
|
rrc->carrier.pdcch_ConfigSIB1 = calloc(1,sizeof(NR_PDCCH_ConfigSIB1_t));
|
||||||
|
paramdef_t pdcch_ConfigSIB1[] = PDCCH_CONFIGSIB1PARAMS_DESC(rrc->carrier.pdcch_ConfigSIB1);
|
||||||
|
paramlist_def_t pdcch_ConfigSIB1ParamList = {GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, NULL, 0};
|
||||||
|
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||||
|
config_getlist(&pdcch_ConfigSIB1ParamList, NULL, 0, aprefix);
|
||||||
|
if (pdcch_ConfigSIB1ParamList.numelt > 0) {
|
||||||
|
sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, 0);
|
||||||
|
config_get(pdcch_ConfigSIB1,sizeof(pdcch_ConfigSIB1)/sizeof(paramdef_t),aprefix);
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
|
||||||
|
|
||||||
config_getlist(&SCCsParamList, NULL, 0, aprefix);
|
config_getlist(&SCCsParamList, NULL, 0, aprefix);
|
||||||
@@ -1009,7 +1020,7 @@ void NRRCConfig(void) {
|
|||||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||||
|
|
||||||
/* get global parameters, defined outside any section in the config file */
|
/* get global parameters, defined outside any section in the config file */
|
||||||
|
|
||||||
LOG_I(GNB_APP, "Getting GNBSParams\n");
|
LOG_I(GNB_APP, "Getting GNBSParams\n");
|
||||||
|
|
||||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ typedef enum {
|
|||||||
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none"
|
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none"
|
||||||
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING "annoying"
|
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING "annoying"
|
||||||
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_INFO "info"
|
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_INFO "info"
|
||||||
|
|
||||||
|
|
||||||
/* global parameters, not under a specific section */
|
/* global parameters, not under a specific section */
|
||||||
#define GNB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity"
|
#define GNB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity"
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#define reserved 0xffff
|
||||||
|
|
||||||
const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160};
|
const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160};
|
||||||
|
|
||||||
// Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz
|
// Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz
|
||||||
@@ -48,6 +50,73 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8
|
|||||||
// Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3}
|
// Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3}
|
||||||
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
|
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
|
||||||
|
|
||||||
|
|
||||||
|
// specification mapping talbe, table_38$x_$y_$z_c$a
|
||||||
|
// - $x: specification
|
||||||
|
// - $y: subclause-major
|
||||||
|
// - $z: subclause-minor
|
||||||
|
// - $a: ($a)th of column in table, start from zero
|
||||||
|
const int32_t table_38213_13_1_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved}; // index 15 reserved
|
||||||
|
const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved
|
||||||
|
const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved
|
||||||
|
const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_13_2_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved}; // index 14-15 reserved
|
||||||
|
const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved
|
||||||
|
const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved
|
||||||
|
const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_13_3_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_13_4_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
|
const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48};
|
||||||
|
const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2};
|
||||||
|
const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16};
|
||||||
|
|
||||||
|
const int32_t table_38213_13_5_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_13_6_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
||||||
|
const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
||||||
|
const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
||||||
|
const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_13_7_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved}; // index 12-15 reserved
|
||||||
|
const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved
|
||||||
|
const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved
|
||||||
|
const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default
|
||||||
|
|
||||||
|
const int32_t table_38213_13_8_c1[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
|
||||||
|
const int32_t table_38213_13_8_c2[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
|
||||||
|
const int32_t table_38213_13_8_c3[16] = { 2, 2, 1, 2, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
|
||||||
|
const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default
|
||||||
|
|
||||||
|
const int32_t table_38213_13_9_c1[16] = {1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
||||||
|
const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
||||||
|
const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
||||||
|
const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_13_10_c1[16] = {1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
|
||||||
|
const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
|
||||||
|
const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
|
||||||
|
const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default
|
||||||
|
|
||||||
|
const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O
|
||||||
|
const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
|
const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M
|
||||||
|
const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default
|
||||||
|
|
||||||
|
const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved
|
||||||
|
const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved
|
||||||
|
const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved
|
||||||
|
|
||||||
|
const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 };
|
||||||
|
|
||||||
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
||||||
const char *duplex_mode[]={"FDD","TDD"};
|
const char *duplex_mode[]={"FDD","TDD"};
|
||||||
|
|
||||||
@@ -2158,6 +2227,10 @@ int get_num_dmrs(uint16_t dmrs_mask ) {
|
|||||||
for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1);
|
for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1);
|
||||||
return(num_dmrs);
|
return(num_dmrs);
|
||||||
}
|
}
|
||||||
|
/* returns the total DMRS symbols in a slot*/
|
||||||
|
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols){
|
||||||
|
return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols));
|
||||||
|
}
|
||||||
|
|
||||||
// Table 5.1.2.2.1-1 38.214
|
// Table 5.1.2.2.1-1 38.214
|
||||||
uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) {
|
uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) {
|
||||||
@@ -2320,11 +2393,19 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc,
|
|||||||
long rbg_size_config;
|
long rbg_size_config;
|
||||||
int num_entries = 0;
|
int num_entries = 0;
|
||||||
int pusch_antenna_ports = 1; // TODO hardcoded number of antenna ports for pusch
|
int pusch_antenna_ports = 1; // TODO hardcoded number of antenna ports for pusch
|
||||||
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
|
||||||
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
NR_BWP_Downlink_t *bwp = NULL;
|
||||||
NR_PDSCH_Config_t *pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup;
|
NR_BWP_Uplink_t *ubwp = NULL;
|
||||||
NR_PUSCH_Config_t *pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup;
|
NR_PDSCH_Config_t *pdsch_config = NULL;
|
||||||
NR_SRS_Config_t *srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup;
|
NR_PUSCH_Config_t *pusch_Config = NULL;
|
||||||
|
NR_SRS_Config_t *srs_config = NULL;
|
||||||
|
if(bwp_id > 0) {
|
||||||
|
bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||||
|
ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||||
|
pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||||
|
pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup;
|
||||||
|
srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup;
|
||||||
|
}
|
||||||
|
|
||||||
switch(format) {
|
switch(format) {
|
||||||
/*Only sizes for 0_0 and 1_0 are correct at the moment*/
|
/*Only sizes for 0_0 and 1_0 are correct at the moment*/
|
||||||
@@ -2529,8 +2610,13 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc,
|
|||||||
|
|
||||||
case NR_DL_DCI_FORMAT_1_0:
|
case NR_DL_DCI_FORMAT_1_0:
|
||||||
/// fixed: Format identifier 1, VRB2PRB 1, MCS 5, NDI 1, RV 2, HARQ PID 4, DAI 2, PUCCH TPC 2, PUCCH RInd 3, PDSCH to HARQ TInd 3 Time Domain assgnmt 4 -- 28
|
/// fixed: Format identifier 1, VRB2PRB 1, MCS 5, NDI 1, RV 2, HARQ PID 4, DAI 2, PUCCH TPC 2, PUCCH RInd 3, PDSCH to HARQ TInd 3 Time Domain assgnmt 4 -- 28
|
||||||
size += 28;
|
size = 28;
|
||||||
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment
|
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment
|
||||||
|
|
||||||
|
dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||||
|
dci_pdu->time_domain_assignment.nbits = 4;
|
||||||
|
dci_pdu->vrb_to_prb_mapping.nbits = 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_DL_DCI_FORMAT_1_1:
|
case NR_DL_DCI_FORMAT_1_1:
|
||||||
@@ -2780,8 +2866,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
|||||||
case 5 :
|
case 5 :
|
||||||
case 6 :
|
case 6 :
|
||||||
case 7 :
|
case 7 :
|
||||||
AssertFatal(1==0,"Incoompatible NrOfSymbols %d and dmrs_Additional_Position %d\n",
|
return(1<<l0);
|
||||||
NrOfSymbols,(int)*dmrs_config->dmrs_AdditionalPosition);
|
|
||||||
break;
|
break;
|
||||||
case 8 :
|
case 8 :
|
||||||
case 9:
|
case 9:
|
||||||
@@ -2789,26 +2874,26 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
|||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
case 11:
|
case 11:
|
||||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
||||||
return(1<<l0 | 1<<9);
|
return(1<<l0 | 1<<9);
|
||||||
else
|
else
|
||||||
return(1<<l0 | 1<<6 | 1<<9);
|
return(1<<l0 | 1<<6 | 1<<9);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
||||||
return(1<<l0 | 1<<9);
|
return(1<<l0 | 1<<9);
|
||||||
else if (pos2==1)
|
else if (pos2==1)
|
||||||
return(1<<l0 | 1<<6 | 1<<9);
|
return(1<<l0 | 1<<6 | 1<<9);
|
||||||
else if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
|
else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
|
||||||
return(1<<l0 | 1<<5 | 1<<8 | 1<<11);
|
return(1<<l0 | 1<<5 | 1<<8 | 1<<11);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
case 14:
|
case 14:
|
||||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
||||||
return(1<<l0 | 1<<11);
|
return(1<<l0 | 1<<11);
|
||||||
else if (pos2==1)
|
else if (pos2==1)
|
||||||
return(1<<l0 | 1<<7 | 1<<11);
|
return(1<<l0 | 1<<7 | 1<<11);
|
||||||
else if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
|
else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
|
||||||
return(1<<l0 | 1<<5 | 1<<8 | 1<<11);
|
return(1<<l0 | 1<<5 | 1<<8 | 1<<11);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2954,3 +3039,373 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
|
|||||||
//printf("[MAC] PTRS is set K= %u L= %u\n", *K_ptrs,1<<*L_ptrs);
|
//printf("[MAC] PTRS is set K= %u L= %u\n", *K_ptrs,1<<*L_ptrs);
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
uint32_t get_ssb_slot(uint32_t ssb_index){
|
||||||
|
// this function now only support f <= 3GHz
|
||||||
|
return ssb_index & 0x3 ;
|
||||||
|
|
||||||
|
// return first_symbol(case, freq, ssb_index) / 14
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||||
|
NR_MIB_t *mib,
|
||||||
|
uint8_t extra_bits,
|
||||||
|
uint32_t ssb_length,
|
||||||
|
uint32_t ssb_index,
|
||||||
|
uint32_t ssb_offset_point_a) {
|
||||||
|
|
||||||
|
// deafult for testing
|
||||||
|
subcarrier_spacing_t scs_ssb = scs_30kHz;
|
||||||
|
channel_bandwidth_t min_channel_bw = bw_10MHz;
|
||||||
|
frequency_range_t frequency_range = FR1;
|
||||||
|
const uint32_t num_slot_per_frame = 20;
|
||||||
|
|
||||||
|
type0_PDCCH_CSS_config->ssb_length = ssb_length;
|
||||||
|
type0_PDCCH_CSS_config->ssb_index = ssb_index;
|
||||||
|
type0_PDCCH_CSS_config->frame = (mib->systemFrameNumber.buf[0] >> mib->systemFrameNumber.bits_unused);
|
||||||
|
|
||||||
|
uint16_t frame_number_4lsb = 0;
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5]
|
||||||
|
uint8_t ssb_subcarrier_offset = (uint8_t)mib->ssb_SubcarrierOffset;
|
||||||
|
|
||||||
|
type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame << 4;
|
||||||
|
type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame | frame_number_4lsb;
|
||||||
|
|
||||||
|
if(type0_PDCCH_CSS_config->ssb_length == 64){
|
||||||
|
type0_PDCCH_CSS_config->ssb_index = type0_PDCCH_CSS_config->ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] }
|
||||||
|
}else{
|
||||||
|
if(ssb_subcarrier_offset_msb){
|
||||||
|
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// assume carrier frequency < 6GHz
|
||||||
|
subcarrier_spacing_t scs_pdcch;
|
||||||
|
if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){
|
||||||
|
scs_pdcch = scs_15kHz;
|
||||||
|
}else{ //NR_MIB__subCarrierSpacingCommon_scs30or120
|
||||||
|
scs_pdcch = scs_30kHz;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13
|
||||||
|
uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero);
|
||||||
|
uint32_t index_4lsb = (mib->pdcch_ConfigSIB1.searchSpaceZero);
|
||||||
|
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = -1;
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = -1;
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = -1;
|
||||||
|
|
||||||
|
// type0-pdcch coreset
|
||||||
|
switch( (scs_ssb << 5) | scs_pdcch ){
|
||||||
|
case (scs_15kHz << 5) | scs_15kHz :
|
||||||
|
AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n");
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_1_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_1_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_1_c4[index_4msb];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_15kHz << 5) | scs_30kHz:
|
||||||
|
AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n");
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_2_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_2_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_2_c4[index_4msb];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_30kHz << 5) | scs_15kHz:
|
||||||
|
if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){
|
||||||
|
AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n");
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_3_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_3_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_3_c4[index_4msb];
|
||||||
|
}else if(min_channel_bw & bw_40MHz){
|
||||||
|
AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n");
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_5_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_5_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_5_c4[index_4msb];
|
||||||
|
}else{ ; }
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_30kHz << 5) | scs_30kHz:
|
||||||
|
if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_4_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_4_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_4_c4[index_4msb];
|
||||||
|
|
||||||
|
}else if(min_channel_bw & bw_40MHz){
|
||||||
|
AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n");
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_6_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_6_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_6_c4[index_4msb];
|
||||||
|
}else{ ; }
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_120kHz << 5) | scs_60kHz:
|
||||||
|
AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n");
|
||||||
|
if(index_4msb & 0x7){
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
}else if(index_4msb & 0x18){
|
||||||
|
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];
|
||||||
|
if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_7_c4[index_4msb] - 1;
|
||||||
|
}else{
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_7_c4[index_4msb];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_120kHz << 5) | scs_120kHz:
|
||||||
|
AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n");
|
||||||
|
if(index_4msb & 0x3){
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
}else if(index_4msb & 0x0c){
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_8_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_8_c3[index_4msb];
|
||||||
|
if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_8_c4[index_4msb] - 1;
|
||||||
|
}else{
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_8_c4[index_4msb];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_240kHz << 5) | scs_60kHz:
|
||||||
|
AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n");
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_9_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_9_c3[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_9_c4[index_4msb];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (scs_240kHz << 5) | scs_120kHz:
|
||||||
|
AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n");
|
||||||
|
if(index_4msb & 0x3){
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1;
|
||||||
|
}else if(index_4msb & 0x0c){
|
||||||
|
type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2;
|
||||||
|
}
|
||||||
|
type0_PDCCH_CSS_config->num_rbs = table_38213_13_10_c2[index_4msb];
|
||||||
|
type0_PDCCH_CSS_config->num_symbols = table_38213_13_10_c3[index_4msb];
|
||||||
|
if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_10_c4[index_4msb]-1;
|
||||||
|
}else{
|
||||||
|
type0_PDCCH_CSS_config->rb_offset = table_38213_13_10_c4[index_4msb];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_D(MAC,"Coreset0: index_4msb=%d, num_rbs=%d, num_symb=%d, rb_offset=%d\n",
|
||||||
|
index_4msb,type0_PDCCH_CSS_config->num_rbs,type0_PDCCH_CSS_config->num_symbols,type0_PDCCH_CSS_config->rb_offset );
|
||||||
|
|
||||||
|
AssertFatal(type0_PDCCH_CSS_config->num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined");
|
||||||
|
AssertFatal(type0_PDCCH_CSS_config->num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined");
|
||||||
|
AssertFatal(type0_PDCCH_CSS_config->rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined");
|
||||||
|
|
||||||
|
|
||||||
|
//uint32_t cell_id = 0; // obtain from L1 later
|
||||||
|
|
||||||
|
//mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset;
|
||||||
|
//mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1;
|
||||||
|
|
||||||
|
// uint64_t mask = 0x0;
|
||||||
|
// uint8_t i;
|
||||||
|
// for(i=0; i<(type0_PDCCH_CSS_config->num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs
|
||||||
|
// mask = mask >> 1;
|
||||||
|
// mask = mask | 0x100000000000;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset);
|
||||||
|
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask;
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset
|
||||||
|
//
|
||||||
|
// //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols;
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED;
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id;
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id;
|
||||||
|
|
||||||
|
|
||||||
|
// type0-pdcch search space
|
||||||
|
float big_o = 0.0f;
|
||||||
|
float big_m = 0.0f;
|
||||||
|
type0_PDCCH_CSS_config->sfn_c = SFN_C_IMPOSSIBLE; // only valid for mux=1
|
||||||
|
type0_PDCCH_CSS_config->n_c = UINT_MAX;
|
||||||
|
type0_PDCCH_CSS_config->number_of_search_space_per_slot = UINT_MAX;
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = UINT_MAX;
|
||||||
|
type0_PDCCH_CSS_config->search_space_duration = 0; // element of search space
|
||||||
|
// 38.213 table 10.1-1
|
||||||
|
|
||||||
|
/// MUX PATTERN 1
|
||||||
|
if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){
|
||||||
|
big_o = table_38213_13_11_c1[index_4lsb];
|
||||||
|
type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb];
|
||||||
|
big_m = table_38213_13_11_c3[index_4lsb];
|
||||||
|
|
||||||
|
uint32_t temp = (uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m);
|
||||||
|
type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame;
|
||||||
|
if((temp/num_slot_per_frame) & 0x1){
|
||||||
|
type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1;
|
||||||
|
}else{
|
||||||
|
type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (type0_PDCCH_CSS_config->ssb_index&1)){
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = type0_PDCCH_CSS_config->num_symbols;
|
||||||
|
}else{
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = table_38213_13_11_c4[index_4lsb];
|
||||||
|
}
|
||||||
|
// 38.213 chapter 13: over two consecutive slots
|
||||||
|
type0_PDCCH_CSS_config->search_space_duration = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){
|
||||||
|
big_o = table_38213_13_12_c1[index_4lsb];
|
||||||
|
type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb];
|
||||||
|
big_m = table_38213_13_12_c3[index_4lsb];
|
||||||
|
|
||||||
|
if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (type0_PDCCH_CSS_config->ssb_index&1)){
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 7;
|
||||||
|
}else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (type0_PDCCH_CSS_config->ssb_index&1)){
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = type0_PDCCH_CSS_config->num_symbols;
|
||||||
|
}else{
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 0;
|
||||||
|
}
|
||||||
|
// 38.213 chapter 13: over two consecutive slots
|
||||||
|
type0_PDCCH_CSS_config->search_space_duration = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// MUX PATTERN 2
|
||||||
|
if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 2){
|
||||||
|
|
||||||
|
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){
|
||||||
|
// 38.213 Table 13-13
|
||||||
|
AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n");
|
||||||
|
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
||||||
|
// sfn_c = SFN_C_EQ_SFN_SSB;
|
||||||
|
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index);
|
||||||
|
switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4
|
||||||
|
case 0:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 6;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 7;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){
|
||||||
|
// 38.213 Table 13-14
|
||||||
|
AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n");
|
||||||
|
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
||||||
|
// sfn_c = SFN_C_EQ_SFN_SSB;
|
||||||
|
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index);
|
||||||
|
switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8
|
||||||
|
case 0:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 3;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 12;
|
||||||
|
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 13;
|
||||||
|
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 0;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 1;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}else{ ; }
|
||||||
|
// 38.213 chapter 13: over one slot
|
||||||
|
type0_PDCCH_CSS_config->search_space_duration = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// MUX PATTERN 3
|
||||||
|
if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 3){
|
||||||
|
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){
|
||||||
|
// 38.213 Table 13-15
|
||||||
|
AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n");
|
||||||
|
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
||||||
|
// sfn_c = SFN_C_EQ_SFN_SSB;
|
||||||
|
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index);
|
||||||
|
switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4
|
||||||
|
case 0:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 4;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
type0_PDCCH_CSS_config->first_symbol_index = 6;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}else{ ; }
|
||||||
|
// 38.213 chapter 13: over one slot
|
||||||
|
type0_PDCCH_CSS_config->search_space_duration = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssertFatal(type0_PDCCH_CSS_config->number_of_search_space_per_slot!=UINT_MAX,"");
|
||||||
|
|
||||||
|
// uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot;
|
||||||
|
// mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0];
|
||||||
|
// mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1];
|
||||||
|
// mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4
|
||||||
|
// mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8
|
||||||
|
// mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16
|
||||||
|
// mac->type0_pdcch_dci_config.duration = search_space_duration;
|
||||||
|
// mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset
|
||||||
|
// AssertFatal(first_symbol_index!=UINT_MAX,"");
|
||||||
|
// mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff;
|
||||||
|
|
||||||
|
AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,"");
|
||||||
|
AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,"");
|
||||||
|
|
||||||
|
type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame;
|
||||||
|
type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,9 +32,24 @@
|
|||||||
#ifndef __LAYER2_NR_MAC_COMMON_H__
|
#ifndef __LAYER2_NR_MAC_COMMON_H__
|
||||||
#define __LAYER2_NR_MAC_COMMON_H__
|
#define __LAYER2_NR_MAC_COMMON_H__
|
||||||
|
|
||||||
|
#include "NR_MIB.h"
|
||||||
#include "NR_PDSCH-Config.h"
|
#include "NR_PDSCH-Config.h"
|
||||||
#include "NR_CellGroupConfig.h"
|
#include "NR_CellGroupConfig.h"
|
||||||
#include "nr_mac.h"
|
#include "nr_mac.h"
|
||||||
|
#include "openair1/PHY/impl_defs_nr.h"
|
||||||
|
|
||||||
|
#define TABLE_38213_13_1_NUM_INDEXES 15
|
||||||
|
#define TABLE_38213_13_2_NUM_INDEXES 14
|
||||||
|
#define TABLE_38213_13_3_NUM_INDEXES 9
|
||||||
|
#define TABLE_38213_13_4_NUM_INDEXES 16
|
||||||
|
#define TABLE_38213_13_5_NUM_INDEXES 9
|
||||||
|
#define TABLE_38213_13_6_NUM_INDEXES 10
|
||||||
|
#define TABLE_38213_13_7_NUM_INDEXES 12
|
||||||
|
#define TABLE_38213_13_8_NUM_INDEXES 8
|
||||||
|
#define TABLE_38213_13_9_NUM_INDEXES 4
|
||||||
|
#define TABLE_38213_13_10_NUM_INDEXES 8
|
||||||
|
#define TABLE_38213_13_11_NUM_INDEXES 16
|
||||||
|
#define TABLE_38213_13_12_NUM_INDEXES 14
|
||||||
|
|
||||||
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
@@ -45,8 +60,8 @@
|
|||||||
#define MAX_FDM (8) // Maximum nb of PRACH occasions FDMed in a slot
|
#define MAX_FDM (8) // Maximum nb of PRACH occasions FDMed in a slot
|
||||||
|
|
||||||
typedef enum frequency_range_e {
|
typedef enum frequency_range_e {
|
||||||
FR1 = 0,
|
FR1 = 0,
|
||||||
FR2
|
FR2
|
||||||
} frequency_range_t;
|
} frequency_range_t;
|
||||||
|
|
||||||
// PRACH occasion details
|
// PRACH occasion details
|
||||||
@@ -99,6 +114,52 @@ typedef enum {
|
|||||||
NR_RNTI_MCS_C,
|
NR_RNTI_MCS_C,
|
||||||
} nr_rnti_type_t;
|
} nr_rnti_type_t;
|
||||||
|
|
||||||
|
typedef enum subcarrier_spacing_e {
|
||||||
|
scs_15kHz = 0x1,
|
||||||
|
scs_30kHz = 0x2,
|
||||||
|
scs_60kHz = 0x4,
|
||||||
|
scs_120kHz = 0x8,
|
||||||
|
scs_240kHz = 0x16
|
||||||
|
} subcarrier_spacing_t;
|
||||||
|
|
||||||
|
typedef enum channel_bandwidth_e {
|
||||||
|
bw_5MHz = 0x1,
|
||||||
|
bw_10MHz = 0x2,
|
||||||
|
bw_20MHz = 0x4,
|
||||||
|
bw_40MHz = 0x8,
|
||||||
|
bw_80MHz = 0x16,
|
||||||
|
bw_100MHz = 0x32
|
||||||
|
} channel_bandwidth_t;
|
||||||
|
|
||||||
|
typedef enum nr_ssb_and_cset_mux_pattern_type_e {
|
||||||
|
NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1,
|
||||||
|
NR_SSB_AND_CSET_MUX_PATTERN_TYPE2,
|
||||||
|
NR_SSB_AND_CSET_MUX_PATTERN_TYPE3
|
||||||
|
} nr_ssb_and_cset_mux_pattern_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SFN_C_MOD_2_EQ_0,
|
||||||
|
SFN_C_MOD_2_EQ_1,
|
||||||
|
SFN_C_IMPOSSIBLE
|
||||||
|
} SFN_C_TYPE;
|
||||||
|
|
||||||
|
typedef struct Type0_PDCCH_CSS_config_s {
|
||||||
|
int32_t num_rbs;
|
||||||
|
int32_t num_symbols;
|
||||||
|
int32_t rb_offset; // Offset from SSB RB0
|
||||||
|
uint32_t type0_pdcch_ss_mux_pattern;
|
||||||
|
uint16_t frame;
|
||||||
|
SFN_C_TYPE sfn_c;
|
||||||
|
uint32_t n_c;
|
||||||
|
uint32_t n_0;
|
||||||
|
uint32_t number_of_search_space_per_slot;
|
||||||
|
uint32_t first_symbol_index;
|
||||||
|
uint32_t search_space_duration;
|
||||||
|
uint32_t ssb_length;
|
||||||
|
uint32_t ssb_index;
|
||||||
|
uint32_t cset_start_rb;
|
||||||
|
} NR_Type0_PDCCH_CSS_config_t;
|
||||||
|
|
||||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
||||||
|
|
||||||
void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type);
|
void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type);
|
||||||
@@ -188,6 +249,13 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr
|
|||||||
uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table);
|
uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table);
|
||||||
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB);
|
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB);
|
||||||
|
|
||||||
|
int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||||
|
NR_MIB_t *mib,
|
||||||
|
uint8_t extra_bits,
|
||||||
|
uint32_t ssb_length,
|
||||||
|
uint32_t ssb_index,
|
||||||
|
uint32_t ssb_offset_point_a);
|
||||||
|
|
||||||
int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH);
|
int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH);
|
||||||
|
|
||||||
bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
|
bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
|
||||||
@@ -195,4 +263,7 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
|
|||||||
uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex,
|
uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex,
|
||||||
uint8_t *nERatio,uint8_t *reOffset,
|
uint8_t *nERatio,uint8_t *reOffset,
|
||||||
uint8_t NrOfSymbols);
|
uint8_t NrOfSymbols);
|
||||||
|
|
||||||
|
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -77,5 +77,66 @@ extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
|
|||||||
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
|
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
|
||||||
#endif*/
|
#endif*/
|
||||||
|
|
||||||
|
// Type0-PDCCH search space
|
||||||
|
extern const int32_t table_38213_13_1_c1[16];
|
||||||
|
extern const int32_t table_38213_13_1_c2[16];
|
||||||
|
extern const int32_t table_38213_13_1_c3[16];
|
||||||
|
extern const int32_t table_38213_13_1_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_2_c1[16];
|
||||||
|
extern const int32_t table_38213_13_2_c2[16];
|
||||||
|
extern const int32_t table_38213_13_2_c3[16];
|
||||||
|
extern const int32_t table_38213_13_2_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_3_c1[16];
|
||||||
|
extern const int32_t table_38213_13_3_c2[16];
|
||||||
|
extern const int32_t table_38213_13_3_c3[16];
|
||||||
|
extern const int32_t table_38213_13_3_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_4_c1[16];
|
||||||
|
extern const int32_t table_38213_13_4_c2[16];
|
||||||
|
extern const int32_t table_38213_13_4_c3[16];
|
||||||
|
extern const int32_t table_38213_13_4_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_5_c1[16];
|
||||||
|
extern const int32_t table_38213_13_5_c2[16];
|
||||||
|
extern const int32_t table_38213_13_5_c3[16];
|
||||||
|
extern const int32_t table_38213_13_5_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_6_c1[16];
|
||||||
|
extern const int32_t table_38213_13_6_c2[16];
|
||||||
|
extern const int32_t table_38213_13_6_c3[16];
|
||||||
|
extern const int32_t table_38213_13_6_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_7_c1[16];
|
||||||
|
extern const int32_t table_38213_13_7_c2[16];
|
||||||
|
extern const int32_t table_38213_13_7_c3[16];
|
||||||
|
extern const int32_t table_38213_13_7_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_8_c1[16];
|
||||||
|
extern const int32_t table_38213_13_8_c2[16];
|
||||||
|
extern const int32_t table_38213_13_8_c3[16];
|
||||||
|
extern const int32_t table_38213_13_8_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_9_c1[16];
|
||||||
|
extern const int32_t table_38213_13_9_c2[16];
|
||||||
|
extern const int32_t table_38213_13_9_c3[16];
|
||||||
|
extern const int32_t table_38213_13_9_c4[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_13_10_c1[16];
|
||||||
|
extern const int32_t table_38213_13_10_c2[16];
|
||||||
|
extern const int32_t table_38213_13_10_c3[16];
|
||||||
|
extern const int32_t table_38213_13_10_c4[16];
|
||||||
|
|
||||||
|
extern const float table_38213_13_11_c1[16];
|
||||||
|
extern const int32_t table_38213_13_11_c2[16];
|
||||||
|
extern const float table_38213_13_11_c3[16];
|
||||||
|
extern const int32_t table_38213_13_11_c4[16];
|
||||||
|
|
||||||
|
extern const float table_38213_13_12_c1[16];
|
||||||
|
extern const int32_t table_38213_13_12_c2[16];
|
||||||
|
extern const float table_38213_13_12_c3[16];
|
||||||
|
|
||||||
|
extern const int32_t table_38213_10_1_1_c2[5];
|
||||||
|
|
||||||
#endif //DEF_H
|
#endif //DEF_H
|
||||||
|
|||||||
@@ -391,13 +391,71 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
|||||||
NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id];
|
NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id];
|
||||||
AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
|
AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
|
||||||
AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
||||||
AssertFatal(css->searchSpaceId != 0, "css->searchSpaceId is 0\n");
|
|
||||||
AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n");
|
AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n");
|
||||||
AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n");
|
AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n");
|
||||||
AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n");
|
AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n");
|
||||||
mac->SSpace[0][0][ss_id] = css;
|
mac->SSpace[0][0][ss_id] = css;
|
||||||
ss_id++;
|
ss_id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Merge this code in a single function as fill_default_searchSpaceZero() in rrc_gNB_reconfig.c
|
||||||
|
// Search space zero
|
||||||
|
if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero));
|
||||||
|
if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId));
|
||||||
|
if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot));
|
||||||
|
if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||||
|
if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates));
|
||||||
|
if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType));
|
||||||
|
if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common));
|
||||||
|
if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||||
|
mac->search_space_zero->searchSpaceId = 0;
|
||||||
|
*mac->search_space_zero->controlResourceSetId = 0;
|
||||||
|
mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset));
|
||||||
|
mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
|
||||||
|
mac->search_space_zero->duration=NULL;
|
||||||
|
// should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed
|
||||||
|
mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0;
|
||||||
|
mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6);
|
||||||
|
mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2;
|
||||||
|
mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2;
|
||||||
|
|
||||||
|
// FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1
|
||||||
|
mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||||
|
mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||||
|
mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0;
|
||||||
|
mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1;
|
||||||
|
mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||||
|
mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||||
|
|
||||||
|
// Coreset0
|
||||||
|
if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0));
|
||||||
|
mac->coreset0->controlResourceSetId = 0;
|
||||||
|
// frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B,
|
||||||
|
if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||||
|
mac->coreset0->frequencyDomainResources.buf[0] = 0xff;
|
||||||
|
mac->coreset0->frequencyDomainResources.buf[1] = 0;
|
||||||
|
mac->coreset0->frequencyDomainResources.buf[2] = 0;
|
||||||
|
mac->coreset0->frequencyDomainResources.buf[3] = 0;
|
||||||
|
mac->coreset0->frequencyDomainResources.buf[4] = 0;
|
||||||
|
mac->coreset0->frequencyDomainResources.buf[5] = 0;
|
||||||
|
mac->coreset0->frequencyDomainResources.size = 6;
|
||||||
|
mac->coreset0->frequencyDomainResources.bits_unused = 3;
|
||||||
|
mac->coreset0->duration = 1;
|
||||||
|
mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved));
|
||||||
|
mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||||
|
mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL;
|
||||||
|
mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||||
|
if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList));
|
||||||
|
NR_TCI_StateId_t *tci[8];
|
||||||
|
for (int i=0;i<8;i++) {
|
||||||
|
tci[i]=calloc(1,sizeof(*tci[i]));
|
||||||
|
*tci[i] = i;
|
||||||
|
ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
|
||||||
|
}
|
||||||
|
mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||||
|
mac->coreset0->tci_PresentInDCI = NULL;
|
||||||
|
mac->coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_rrc_mac_config_req_ue(
|
int nr_rrc_mac_config_req_ue(
|
||||||
@@ -422,6 +480,8 @@ int nr_rrc_mac_config_req_ue(
|
|||||||
mac->scg = cell_group_config;
|
mac->scg = cell_group_config;
|
||||||
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
||||||
config_control_ue(mac);
|
config_control_ue(mac);
|
||||||
|
mac->msg3_frame = -1; // initialize to an invalid value
|
||||||
|
mac->msg3_slot = -1;
|
||||||
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||||
mac->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
mac->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||||
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||||
|
|||||||
@@ -76,13 +76,6 @@
|
|||||||
/*!\brief value for indicating BSR Timer is not running */
|
/*!\brief value for indicating BSR Timer is not running */
|
||||||
#define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
|
#define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SFN_C_MOD_2_EQ_0,
|
|
||||||
SFN_C_MOD_2_EQ_1,
|
|
||||||
SFN_C_IMPOSSIBLE
|
|
||||||
} SFN_C_TYPE;
|
|
||||||
|
|
||||||
// LTE structure, might need to be adapted for NR
|
// LTE structure, might need to be adapted for NR
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// buffer status for each lcgid
|
/// buffer status for each lcgid
|
||||||
@@ -267,6 +260,11 @@ typedef struct {
|
|||||||
|
|
||||||
/// PHR
|
/// PHR
|
||||||
uint8_t PHR_reporting_active;
|
uint8_t PHR_reporting_active;
|
||||||
|
|
||||||
|
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
|
||||||
|
NR_SearchSpace_t *search_space_zero;
|
||||||
|
NR_ControlResourceSet_t *coreset0;
|
||||||
|
|
||||||
} NR_UE_MAC_INST_t;
|
} NR_UE_MAC_INST_t;
|
||||||
|
|
||||||
typedef enum seach_space_mask_e {
|
typedef enum seach_space_mask_e {
|
||||||
@@ -277,24 +275,6 @@ typedef enum seach_space_mask_e {
|
|||||||
type3_pdcch = 0x10
|
type3_pdcch = 0x10
|
||||||
} search_space_mask_t;
|
} search_space_mask_t;
|
||||||
|
|
||||||
typedef enum subcarrier_spacing_e {
|
|
||||||
scs_15kHz = 0x1,
|
|
||||||
scs_30kHz = 0x2,
|
|
||||||
scs_60kHz = 0x4,
|
|
||||||
scs_120kHz = 0x8,
|
|
||||||
scs_240kHz = 0x16
|
|
||||||
} subcarrier_spacing_t;
|
|
||||||
|
|
||||||
typedef enum channel_bandwidth_e {
|
|
||||||
bw_5MHz = 0x1,
|
|
||||||
bw_10MHz = 0x2,
|
|
||||||
bw_20MHz = 0x4,
|
|
||||||
bw_40MHz = 0x8,
|
|
||||||
bw_80MHz = 0x16,
|
|
||||||
bw_100MHz = 0x32
|
|
||||||
} channel_bandwidth_t;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS:
|
uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS:
|
||||||
uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213]
|
uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213]
|
||||||
|
|||||||
@@ -34,58 +34,6 @@
|
|||||||
|
|
||||||
//extern NR_UE_MAC_INST_t *UE_mac_inst;
|
//extern NR_UE_MAC_INST_t *UE_mac_inst;
|
||||||
|
|
||||||
// Type0-PDCCH search space
|
|
||||||
extern const int32_t table_38213_13_1_c2[16];
|
|
||||||
extern const int32_t table_38213_13_1_c3[16];
|
|
||||||
extern const int32_t table_38213_13_1_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_2_c2[16];
|
|
||||||
extern const int32_t table_38213_13_2_c3[16];
|
|
||||||
extern const int32_t table_38213_13_2_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_3_c2[16];
|
|
||||||
extern const int32_t table_38213_13_3_c3[16];
|
|
||||||
extern const int32_t table_38213_13_3_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_4_c2[16];
|
|
||||||
extern const int32_t table_38213_13_4_c3[16];
|
|
||||||
extern const int32_t table_38213_13_4_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_5_c2[16];
|
|
||||||
extern const int32_t table_38213_13_5_c3[16];
|
|
||||||
extern const int32_t table_38213_13_5_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_6_c2[16];
|
|
||||||
extern const int32_t table_38213_13_6_c3[16];
|
|
||||||
extern const int32_t table_38213_13_6_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_7_c2[16];
|
|
||||||
extern const int32_t table_38213_13_7_c3[16];
|
|
||||||
extern const int32_t table_38213_13_7_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_8_c2[16];
|
|
||||||
extern const int32_t table_38213_13_8_c3[16];
|
|
||||||
extern const int32_t table_38213_13_8_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_9_c2[16];
|
|
||||||
extern const int32_t table_38213_13_9_c3[16];
|
|
||||||
extern const int32_t table_38213_13_9_c4[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_13_10_c2[16];
|
|
||||||
extern const int32_t table_38213_13_10_c3[16];
|
|
||||||
extern const int32_t table_38213_13_10_c4[16];
|
|
||||||
|
|
||||||
extern const float table_38213_13_11_c1[16];
|
|
||||||
extern const int32_t table_38213_13_11_c2[16];
|
|
||||||
extern const float table_38213_13_11_c3[16];
|
|
||||||
extern const int32_t table_38213_13_11_c4[16];
|
|
||||||
|
|
||||||
extern const float table_38213_13_12_c1[16];
|
|
||||||
extern const int32_t table_38213_13_12_c2[16];
|
|
||||||
extern const float table_38213_13_12_c3[16];
|
|
||||||
|
|
||||||
extern const int32_t table_38213_10_1_1_c2[5];
|
|
||||||
|
|
||||||
// DCI extraction
|
// DCI extraction
|
||||||
// for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
// for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
||||||
extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||||
|
|||||||
@@ -58,6 +58,19 @@ int8_t nr_ue_decode_mib(
|
|||||||
void *pduP,
|
void *pduP,
|
||||||
uint16_t cell_id );
|
uint16_t cell_id );
|
||||||
|
|
||||||
|
/**\brief decode sib1 pdu in NR_UE, from if_module dl_ind
|
||||||
|
\param module_id module id
|
||||||
|
\param cc_id component carrier id
|
||||||
|
\param gNB_index gNB index
|
||||||
|
\param sibs_mask sibs mask
|
||||||
|
\param pduP pointer to pdu
|
||||||
|
\param pdu_length length of pdu */
|
||||||
|
int8_t nr_ue_decode_sib1(module_id_t module_id,
|
||||||
|
int cc_id,
|
||||||
|
unsigned int gNB_index,
|
||||||
|
uint32_t sibs_mask,
|
||||||
|
uint8_t *pduP,
|
||||||
|
uint32_t pdu_len);
|
||||||
|
|
||||||
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
|
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
|
||||||
\param module_id module id
|
\param module_id module id
|
||||||
@@ -125,8 +138,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id, int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
|
int nr_ue_process_dci_indication_pdu(module_id_t module_id, int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
|
||||||
|
|
||||||
uint32_t get_ssb_frame(uint32_t test);
|
uint32_t get_ssb_frame(uint32_t test);
|
||||||
uint32_t get_ssb_slot(uint32_t ssb_index);
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||||
|
|
||||||
|
|||||||
@@ -32,64 +32,6 @@
|
|||||||
|
|
||||||
#include "mac_defs.h"
|
#include "mac_defs.h"
|
||||||
|
|
||||||
#define reserved 0xffff
|
|
||||||
|
|
||||||
// specification mapping talbe, table_38$x_$y_$z_c$a
|
|
||||||
// - $x: specification
|
|
||||||
// - $y: subclause-major
|
|
||||||
// - $z: subclause-minor
|
|
||||||
// - $a: ($a)th of column in table, start from zero
|
|
||||||
const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved
|
|
||||||
const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved
|
|
||||||
const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved
|
|
||||||
const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved
|
|
||||||
const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
|
||||||
const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
|
||||||
const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48};
|
|
||||||
const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2};
|
|
||||||
const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16};
|
|
||||||
|
|
||||||
const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
|
||||||
const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
|
||||||
const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
|
||||||
const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
|
||||||
const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved
|
|
||||||
const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved
|
|
||||||
const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default
|
|
||||||
|
|
||||||
const int32_t table_38213_13_8_c2[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
|
|
||||||
const int32_t table_38213_13_8_c3[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
|
|
||||||
const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default
|
|
||||||
|
|
||||||
const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
|
||||||
const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
|
||||||
const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
|
|
||||||
const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
|
|
||||||
const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default
|
|
||||||
|
|
||||||
const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O
|
|
||||||
const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1};
|
|
||||||
const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M
|
|
||||||
const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default
|
|
||||||
|
|
||||||
const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved
|
|
||||||
const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved
|
|
||||||
const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved
|
|
||||||
|
|
||||||
const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 };
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define mu_pusch 1
|
#define mu_pusch 1
|
||||||
// definition table j Table 6.1.2.1.1-4
|
// definition table j Table 6.1.2.1.1-4
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
|
|||||||
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST);
|
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST);
|
||||||
if (rrc_inst) {
|
if (rrc_inst) {
|
||||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config);
|
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config);
|
||||||
|
|
||||||
if (IS_SOFTMODEM_NOS1){
|
if (IS_SOFTMODEM_NOS1){
|
||||||
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
|
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
|
||||||
pdcp_layer_init();
|
pdcp_layer_init();
|
||||||
|
|||||||
@@ -499,8 +499,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
mac->RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
mac->RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||||
mac->RA_PREAMBLE_POWER_RAMPING_COUNTER = 1;
|
mac->RA_PREAMBLE_POWER_RAMPING_COUNTER = 1;
|
||||||
mac->RA_Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
|
mac->RA_Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||||
mac->msg3_frame = -1; // initialize to an invalid value
|
|
||||||
mac->msg3_slot = -1;
|
|
||||||
mac->RA_prachMaskIndex = 0;
|
mac->RA_prachMaskIndex = 0;
|
||||||
// todo: add the backoff condition here
|
// todo: add the backoff condition here
|
||||||
mac->RA_backoff_cnt = 0;
|
mac->RA_backoff_cnt = 0;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/nr/nr_common.h"
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "nfapi_nr_interface.h"
|
||||||
|
|
||||||
#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
|
#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
|
||||||
#define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a)
|
#define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a)
|
||||||
@@ -54,6 +55,23 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
|
|||||||
|
|
||||||
LOG_D(MAC,"Filling search candidates for DCI\n");
|
LOG_D(MAC,"Filling search candidates for DCI\n");
|
||||||
|
|
||||||
|
if(ss->searchSpaceId == 0) {
|
||||||
|
// TODO: Update the maximum number of PDCCH candidates accordingly with Aggregation Level
|
||||||
|
rel15->number_of_candidates=1;
|
||||||
|
rel15->CCE[0]=0;
|
||||||
|
rel15->L[0]=6;
|
||||||
|
} else {
|
||||||
|
rel15->number_of_candidates=4;
|
||||||
|
rel15->CCE[0]=0;
|
||||||
|
rel15->L[0]=4;
|
||||||
|
rel15->CCE[1]=4;
|
||||||
|
rel15->L[1]=4;
|
||||||
|
rel15->CCE[2]=8;
|
||||||
|
rel15->L[2]=4;
|
||||||
|
rel15->CCE[3]=12;
|
||||||
|
rel15->L[3]=4;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t aggregation;
|
uint8_t aggregation;
|
||||||
find_aggregation_candidates(&aggregation,
|
find_aggregation_candidates(&aggregation,
|
||||||
&rel15->number_of_candidates,
|
&rel15->number_of_candidates,
|
||||||
@@ -75,11 +93,21 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
|
NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
|
||||||
NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
|
NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
|
||||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
|
|
||||||
|
|
||||||
// CORESET configuration
|
NR_SearchSpace_t *ss;
|
||||||
NR_ControlResourceSet_t *coreset = mac->coreset[bwp_id - 1][coreset_id - 1];
|
NR_ControlResourceSet_t *coreset;
|
||||||
|
if(ss_id>=0) {
|
||||||
|
ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
|
||||||
|
coreset = mac->coreset[bwp_id - 1][coreset_id - 1];
|
||||||
|
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG;
|
||||||
|
} else {
|
||||||
|
ss = mac->search_space_zero;
|
||||||
|
coreset = mac->coreset0;
|
||||||
|
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||||
|
}
|
||||||
|
|
||||||
rel15->coreset.duration = coreset->duration;
|
rel15->coreset.duration = coreset->duration;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i];
|
rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i];
|
||||||
rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED;
|
rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED;
|
||||||
@@ -94,7 +122,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
rel15->coreset.InterleaverSize = 0;
|
rel15->coreset.InterleaverSize = 0;
|
||||||
rel15->coreset.ShiftIndex = 0;
|
rel15->coreset.ShiftIndex = 0;
|
||||||
}
|
}
|
||||||
rel15->coreset.CoreSetType = 1;
|
|
||||||
rel15->coreset.precoder_granularity = coreset->precoderGranularity;
|
rel15->coreset.precoder_granularity = coreset->precoderGranularity;
|
||||||
|
|
||||||
// Scrambling RNTI
|
// Scrambling RNTI
|
||||||
@@ -144,6 +172,20 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
case NR_RNTI_SP_CSI:
|
case NR_RNTI_SP_CSI:
|
||||||
break;
|
break;
|
||||||
case NR_RNTI_SI:
|
case NR_RNTI_SI:
|
||||||
|
// we use DL BWP dedicated
|
||||||
|
sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||||
|
|
||||||
|
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||||
|
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||||
|
|
||||||
|
rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
|
||||||
|
rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||||
|
rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
|
||||||
|
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
|
||||||
|
|
||||||
|
for (int i = 0; i < rel15->num_dci_options; i++) {
|
||||||
|
rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NR_RNTI_SFI:
|
case NR_RNTI_SFI:
|
||||||
break;
|
break;
|
||||||
@@ -170,8 +212,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
rel15->BWPSize,
|
rel15->BWPSize,
|
||||||
rel15->BWPStart,
|
rel15->BWPStart,
|
||||||
rel15->SubcarrierSpacing,
|
rel15->SubcarrierSpacing,
|
||||||
rel15->dci_format,
|
rel15->dci_format_options[0],
|
||||||
rel15->dci_length,
|
rel15->dci_length_options[0],
|
||||||
sps,
|
sps,
|
||||||
monitoringSymbolsWithinSlot);
|
monitoringSymbolsWithinSlot);
|
||||||
#endif
|
#endif
|
||||||
@@ -205,16 +247,19 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
|||||||
// Fetch configuration for searchSpaceZero
|
// Fetch configuration for searchSpaceZero
|
||||||
// note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
|
// note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
|
||||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
|
if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
|
||||||
|
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){
|
||||||
|
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1));
|
||||||
|
}
|
||||||
|
*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
|
||||||
LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
|
LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
|
||||||
LOG_W(MAC, "[DCI_CONFIG] This should not be available yet...");
|
|
||||||
}
|
}
|
||||||
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
|
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
|
||||||
// check available SS IDs
|
// check available SS IDs
|
||||||
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
|
|
||||||
switch(mac->ra_state){
|
switch(mac->ra_state){
|
||||||
case WAIT_RAR:
|
case WAIT_RAR:
|
||||||
|
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
|
||||||
rel15->num_dci_options = 1;
|
rel15->num_dci_options = 1;
|
||||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||||
@@ -326,4 +371,25 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search space 0, CORESET ID 0
|
||||||
|
|
||||||
|
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||||
|
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||||
|
|
||||||
|
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||||
|
|
||||||
|
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||||
|
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||||
|
|
||||||
|
if (ss0->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||||
|
if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){
|
||||||
|
rel15->num_dci_options = 1;
|
||||||
|
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||||
|
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1);
|
||||||
|
fill_dci_search_candidates(ss0, rel15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
#include "NR_MAC_COMMON/nr_mac.h"
|
#include "NR_MAC_COMMON/nr_mac.h"
|
||||||
#include "NR_MAC_UE/mac_proto.h"
|
#include "NR_MAC_UE/mac_proto.h"
|
||||||
#include "NR_MAC_UE/mac_extern.h"
|
#include "NR_MAC_UE/mac_extern.h"
|
||||||
|
#include "NR_MAC_COMMON/nr_mac_extern.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/nr/nr_common.h"
|
||||||
|
|
||||||
/* PHY */
|
/* PHY */
|
||||||
@@ -788,13 +789,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
|||||||
scheduled_response->thread_id = thread_id;
|
scheduled_response->thread_id = thread_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_ssb_slot(uint32_t ssb_index){
|
|
||||||
// this function now only support f <= 3GHz
|
|
||||||
return ssb_index & 0x3 ;
|
|
||||||
|
|
||||||
// return first_symbol(case, freq, ssb_index) / 14
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t table_9_2_2_1[16][8]={
|
uint8_t table_9_2_2_1[16][8]={
|
||||||
{0,12,2, 0, 0,3,0,0},
|
{0,12,2, 0, 0,3,0,0},
|
||||||
{0,12,2, 0, 0,4,8,0},
|
{0,12,2, 0, 0,4,8,0},
|
||||||
@@ -999,346 +993,29 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
|||||||
//storing ssb index in the mac structure
|
//storing ssb index in the mac structure
|
||||||
mac->mib_ssb = ssb_index;
|
mac->mib_ssb = ssb_index;
|
||||||
|
|
||||||
subcarrier_spacing_t scs_ssb = scs_30kHz; // default for
|
get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index,
|
||||||
//const uint32_t scs_index = 0;
|
mac->phy_config.config_req.ssb_table.ssb_offset_point_a);
|
||||||
const uint32_t num_slot_per_frame = 20;
|
|
||||||
subcarrier_spacing_t scs_pdcch;
|
|
||||||
|
|
||||||
// assume carrier frequency < 6GHz
|
ssb_index = mac->type0_PDCCH_CSS_config.ssb_index; // TODO: ssb_index should obtain from L1 in case Lssb != 64
|
||||||
if(mac->mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){
|
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
|
||||||
scs_pdcch = scs_15kHz;
|
mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c;
|
||||||
}else{ //NR_MIB__subCarrierSpacingCommon_scs30or120
|
mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c;
|
||||||
scs_pdcch = scs_30kHz;
|
mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame;
|
||||||
}
|
mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS
|
||||||
|
|
||||||
channel_bandwidth_t min_channel_bw = bw_10MHz; // deafult for testing
|
|
||||||
|
|
||||||
uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13
|
|
||||||
frequency_range_t frequency_range = FR1;
|
|
||||||
uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1.controlResourceSetZero);
|
|
||||||
uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1.searchSpaceZero);
|
|
||||||
int32_t num_rbs = -1;
|
|
||||||
int32_t num_symbols = -1;
|
|
||||||
int32_t rb_offset = -1;
|
|
||||||
LOG_D(MAC,"<<<<<<<<<configSIB1: controlResourceSetZero %d searchSpaceZero %d scs_ssb %d scs_pdcch %d switch %d ",
|
|
||||||
index_4msb,index_4lsb,scs_ssb,scs_pdcch, (scs_ssb << 5)|scs_pdcch);
|
|
||||||
|
|
||||||
// type0-pdcch coreset
|
|
||||||
switch( (scs_ssb << 5)|scs_pdcch ){
|
|
||||||
case (scs_15kHz << 5) | scs_15kHz :
|
|
||||||
AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n");
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_1_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_1_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_1_c4[index_4msb];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_15kHz << 5) | scs_30kHz:
|
|
||||||
AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n");
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_2_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_2_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_2_c4[index_4msb];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_30kHz << 5) | scs_15kHz:
|
|
||||||
if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){
|
|
||||||
AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n");
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_3_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_3_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_3_c4[index_4msb];
|
|
||||||
}else if(min_channel_bw & bw_40MHz){
|
|
||||||
AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n");
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_5_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_5_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_5_c4[index_4msb];
|
|
||||||
}else{ ; }
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_30kHz << 5) | scs_30kHz:
|
|
||||||
if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_4_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_4_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_4_c4[index_4msb];
|
|
||||||
LOG_I(MAC,"<<<<<<<<<index_4msb %d num_rbs %d num_symb %d rb_offset %d\n",index_4msb,num_rbs,num_symbols,rb_offset );
|
|
||||||
}else if(min_channel_bw & bw_40MHz){
|
|
||||||
AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n");
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_6_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_6_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_6_c4[index_4msb];
|
|
||||||
}else{ ; }
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_120kHz << 5) | scs_60kHz:
|
|
||||||
AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n");
|
|
||||||
if(index_4msb & 0x7){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
}else if(index_4msb & 0x18){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 2;
|
|
||||||
}else{ ; }
|
|
||||||
|
|
||||||
num_rbs = table_38213_13_7_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_7_c3[index_4msb];
|
|
||||||
if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){
|
|
||||||
rb_offset = table_38213_13_7_c4[index_4msb] - 1;
|
|
||||||
}else{
|
|
||||||
rb_offset = table_38213_13_7_c4[index_4msb];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_120kHz << 5) | scs_120kHz:
|
|
||||||
AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n");
|
|
||||||
if(index_4msb & 0x3){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
}else if(index_4msb & 0x0c){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
num_rbs = table_38213_13_8_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_8_c3[index_4msb];
|
|
||||||
if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){
|
|
||||||
rb_offset = table_38213_13_8_c4[index_4msb] - 1;
|
|
||||||
}else{
|
|
||||||
rb_offset = table_38213_13_8_c4[index_4msb];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_240kHz << 5) | scs_60kHz:
|
|
||||||
AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n");
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
num_rbs = table_38213_13_9_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_9_c3[index_4msb];
|
|
||||||
rb_offset = table_38213_13_9_c4[index_4msb];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (scs_240kHz << 5) | scs_120kHz:
|
|
||||||
AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n");
|
|
||||||
if(index_4msb & 0x3){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 1;
|
|
||||||
}else if(index_4msb & 0x0c){
|
|
||||||
mac->type0_pdcch_ss_mux_pattern = 2;
|
|
||||||
}
|
|
||||||
num_rbs = table_38213_13_10_c2[index_4msb];
|
|
||||||
num_symbols = table_38213_13_10_c3[index_4msb];
|
|
||||||
if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){
|
|
||||||
rb_offset = table_38213_13_10_c4[index_4msb]-1;
|
|
||||||
}else{
|
|
||||||
rb_offset = table_38213_13_10_c4[index_4msb];
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertFatal(num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined");
|
|
||||||
AssertFatal(num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined");
|
|
||||||
AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined");
|
|
||||||
|
|
||||||
//uint32_t cell_id = 0; // obtain from L1 later
|
|
||||||
|
|
||||||
//mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset;
|
|
||||||
//mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1;
|
|
||||||
uint64_t mask = 0x0;
|
|
||||||
uint8_t i;
|
|
||||||
for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs
|
|
||||||
mask = mask >> 1;
|
|
||||||
mask = mask | 0x100000000000;
|
|
||||||
}
|
|
||||||
//LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset);
|
|
||||||
/*
|
|
||||||
mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask;
|
|
||||||
mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset
|
|
||||||
|
|
||||||
//mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols;
|
|
||||||
mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED;
|
|
||||||
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2
|
|
||||||
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2
|
|
||||||
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id;
|
|
||||||
mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
|
|
||||||
mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// type0-pdcch search space
|
|
||||||
float big_o;
|
|
||||||
float big_m;
|
|
||||||
uint32_t temp;
|
|
||||||
SFN_C_TYPE sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1
|
|
||||||
uint32_t n_c=UINT_MAX;
|
|
||||||
uint32_t number_of_search_space_per_slot=UINT_MAX;
|
|
||||||
// uint32_t first_symbol_index=UINT_MAX;
|
|
||||||
// uint32_t search_space_duration; // element of search space
|
|
||||||
// 38.213 table 10.1-1
|
|
||||||
|
|
||||||
/// MUX PATTERN 1
|
|
||||||
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){
|
|
||||||
big_o = table_38213_13_11_c1[index_4lsb];
|
|
||||||
number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb];
|
|
||||||
big_m = table_38213_13_11_c3[index_4lsb];
|
|
||||||
|
|
||||||
temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(ssb_index*big_m);
|
|
||||||
n_c = temp / num_slot_per_frame;
|
|
||||||
if((temp/num_slot_per_frame) & 0x1){
|
|
||||||
sfn_c = SFN_C_MOD_2_EQ_1;
|
|
||||||
}else{
|
|
||||||
sfn_c = SFN_C_MOD_2_EQ_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){
|
|
||||||
// first_symbol_index = num_symbols;
|
|
||||||
// }else{
|
|
||||||
// first_symbol_index = table_38213_13_11_c4[index_4lsb];
|
|
||||||
// }
|
|
||||||
// 38.213 chapter 13: over two consecutive slots
|
|
||||||
// search_space_duration = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){
|
|
||||||
big_o = table_38213_13_12_c1[index_4lsb];
|
|
||||||
number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb];
|
|
||||||
big_m = table_38213_13_12_c3[index_4lsb];
|
|
||||||
|
|
||||||
// if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (ssb_index&1)){
|
|
||||||
// first_symbol_index = 7;
|
|
||||||
// }else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (ssb_index&1)){
|
|
||||||
// first_symbol_index = num_symbols;
|
|
||||||
// }else{
|
|
||||||
// first_symbol_index = 0;
|
|
||||||
// }
|
|
||||||
// 38.213 chapter 13: over two consecutive slots
|
|
||||||
//search_space_duration = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// MUX PATTERN 2
|
|
||||||
if(mac->type0_pdcch_ss_mux_pattern == 2){
|
|
||||||
|
|
||||||
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){
|
|
||||||
// 38.213 Table 13-13
|
|
||||||
AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n");
|
|
||||||
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
|
||||||
// sfn_c = SFN_C_EQ_SFN_SSB;
|
|
||||||
n_c = get_ssb_slot(ssb_index);
|
|
||||||
// switch(ssb_index & 0x3){ // ssb_index(i) mod 4
|
|
||||||
// case 0:
|
|
||||||
// first_symbol_index = 0;
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// first_symbol_index = 1;
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// first_symbol_index = 6;
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// first_symbol_index = 7;
|
|
||||||
// break;
|
|
||||||
// default: break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){
|
|
||||||
// 38.213 Table 13-14
|
|
||||||
AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n");
|
|
||||||
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
|
||||||
// sfn_c = SFN_C_EQ_SFN_SSB;
|
|
||||||
n_c = get_ssb_slot(ssb_index);
|
|
||||||
switch(ssb_index & 0x7){ // ssb_index(i) mod 8
|
|
||||||
case 0:
|
|
||||||
// first_symbol_index = 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
// first_symbol_index = 1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
// first_symbol_index = 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// first_symbol_index = 3;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
// first_symbol_index = 12;
|
|
||||||
n_c = get_ssb_slot(ssb_index) - 1;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
// first_symbol_index = 13;
|
|
||||||
n_c = get_ssb_slot(ssb_index) - 1;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
// first_symbol_index = 0;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
// first_symbol_index = 1;
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}else{ ; }
|
|
||||||
// 38.213 chapter 13: over one slot
|
|
||||||
// search_space_duration = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// MUX PATTERN 3
|
|
||||||
if(mac->type0_pdcch_ss_mux_pattern == 3){
|
|
||||||
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){
|
|
||||||
// 38.213 Table 13-15
|
|
||||||
AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n");
|
|
||||||
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
|
||||||
// sfn_c = SFN_C_EQ_SFN_SSB;
|
|
||||||
n_c = get_ssb_slot(ssb_index);
|
|
||||||
// switch(ssb_index & 0x3){ // ssb_index(i) mod 4
|
|
||||||
// case 0:
|
|
||||||
// first_symbol_index = 4;
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// first_symbol_index = 8;
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// first_symbol_index = 2;
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// first_symbol_index = 6;
|
|
||||||
// break;
|
|
||||||
// default: break;
|
|
||||||
// }
|
|
||||||
}else{ ; }
|
|
||||||
// 38.213 chapter 13: over one slot
|
|
||||||
// search_space_duration = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertFatal(number_of_search_space_per_slot!=UINT_MAX,"");
|
|
||||||
/*
|
|
||||||
uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot;
|
|
||||||
mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0];
|
|
||||||
mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1];
|
|
||||||
mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4
|
|
||||||
mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8
|
|
||||||
mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16
|
|
||||||
mac->type0_pdcch_dci_config.duration = search_space_duration;
|
|
||||||
mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset
|
|
||||||
AssertFatal(first_symbol_index!=UINT_MAX,"");
|
|
||||||
mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff;
|
|
||||||
*/
|
|
||||||
AssertFatal(sfn_c!=SFN_C_IMPOSSIBLE,"");
|
|
||||||
AssertFatal(n_c!=UINT_MAX,"");
|
|
||||||
mac->type0_pdcch_ss_sfn_c = sfn_c;
|
|
||||||
mac->type0_pdcch_ss_n_c = n_c;
|
|
||||||
|
|
||||||
// fill in the elements in config request inside P5 message
|
|
||||||
mac->phy_config.Mod_id = module_id;
|
|
||||||
mac->phy_config.CC_id = cc_id;
|
|
||||||
|
|
||||||
mac->dl_config_request.sfn = frame;
|
|
||||||
mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS
|
|
||||||
|
|
||||||
//}
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t nr_ue_decode_sib1(module_id_t module_id,
|
||||||
|
int cc_id,
|
||||||
|
unsigned int gNB_index,
|
||||||
|
uint32_t sibs_mask,
|
||||||
|
uint8_t *pduP,
|
||||||
|
uint32_t pdu_len) {
|
||||||
|
LOG_D(MAC, "Decode sib1\n");
|
||||||
|
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms
|
// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms
|
||||||
uint32_t get_ssb_frame(uint32_t test){
|
uint32_t get_ssb_frame(uint32_t test){
|
||||||
@@ -1428,6 +1105,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
// check type0 from 38.213 13 if we have no CellGroupConfig
|
// check type0 from 38.213 13 if we have no CellGroupConfig
|
||||||
// TODO: implementation to be completed
|
// TODO: implementation to be completed
|
||||||
if (mac->scg == NULL) {
|
if (mac->scg == NULL) {
|
||||||
|
|
||||||
if(dl_info->ssb_index != -1){
|
if(dl_info->ssb_index != -1){
|
||||||
|
|
||||||
if(mac->type0_pdcch_ss_mux_pattern == 1){
|
if(mac->type0_pdcch_ss_mux_pattern == 1){
|
||||||
@@ -2906,6 +2584,11 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_D(MAC,"riv = %i\n", riv);
|
||||||
|
LOG_D(MAC,"n_RB_DLBWP = %i\n", n_RB_DLBWP);
|
||||||
|
LOG_D(MAC,"number_rbs = %i\n", dlsch_config_pdu->number_rbs);
|
||||||
|
LOG_D(MAC,"start_rb = %i\n", dlsch_config_pdu->start_rb);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(pusch_config_pdu != NULL){
|
if(pusch_config_pdu != NULL){
|
||||||
/*
|
/*
|
||||||
@@ -3077,6 +2760,11 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
|||||||
SLIV2SL(startSymbolAndLength,&S,&L);
|
SLIV2SL(startSymbolAndLength,&S,&L);
|
||||||
dlsch_config_pdu->start_symbol=S;
|
dlsch_config_pdu->start_symbol=S;
|
||||||
dlsch_config_pdu->number_symbols=L;
|
dlsch_config_pdu->number_symbols=L;
|
||||||
|
|
||||||
|
LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength);
|
||||||
|
LOG_D(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol);
|
||||||
|
LOG_D(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {// Default configuration from tables
|
else {// Default configuration from tables
|
||||||
// k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
// k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
||||||
@@ -3231,14 +2919,14 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
pusch_config_pdu_0_0->transform_precoding = 1;
|
pusch_config_pdu_0_0->transform_precoding = 1;
|
||||||
else
|
else
|
||||||
pusch_config_pdu_0_0->transform_precoding = 0;
|
pusch_config_pdu_0_0->transform_precoding = 0;
|
||||||
|
|
||||||
if (pusch_config_pdu_0_0->transform_precoding == transform_precoder_disabled)
|
if (pusch_config_pdu_0_0->transform_precoding == transform_precoder_disabled)
|
||||||
pusch_config_pdu_0_0->mcs_table = get_pusch_mcs_table(pusch_config->mcs_Table, 0,
|
pusch_config_pdu_0_0->mcs_table = get_pusch_mcs_table(pusch_config->mcs_Table, 0,
|
||||||
dci_format, NR_RNTI_TC, NR_SearchSpace__searchSpaceType_PR_common, false);
|
dci_format, NR_RNTI_TC, NR_SearchSpace__searchSpaceType_PR_common, false);
|
||||||
else
|
else
|
||||||
pusch_config_pdu_0_0->mcs_table = get_pusch_mcs_table(pusch_config->mcs_TableTransformPrecoder, 1,
|
pusch_config_pdu_0_0->mcs_table = get_pusch_mcs_table(pusch_config->mcs_TableTransformPrecoder, 1,
|
||||||
dci_format, NR_RNTI_TC, NR_SearchSpace__searchSpaceType_PR_common, false);
|
dci_format, NR_RNTI_TC, NR_SearchSpace__searchSpaceType_PR_common, false);
|
||||||
|
|
||||||
pusch_config_pdu_0_0->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu_0_0->mcs_index, pusch_config_pdu_0_0->mcs_table);
|
pusch_config_pdu_0_0->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu_0_0->mcs_index, pusch_config_pdu_0_0->mcs_table);
|
||||||
pusch_config_pdu_0_0->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu_0_0->mcs_index, pusch_config_pdu_0_0->mcs_table);
|
pusch_config_pdu_0_0->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu_0_0->mcs_index, pusch_config_pdu_0_0->mcs_table);
|
||||||
if (pusch_config_pdu_0_0->target_code_rate == 0 || pusch_config_pdu_0_0->qam_mod_order == 0) {
|
if (pusch_config_pdu_0_0->target_code_rate == 0 || pusch_config_pdu_0_0->qam_mod_order == 0) {
|
||||||
@@ -3686,14 +3374,31 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
|
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
|
||||||
//fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_pdu_1_0 = dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
|
||||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
||||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
|
uint16_t BWPSize = 0;
|
||||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
|
|
||||||
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
if(rnti == SI_RNTI) {
|
||||||
|
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
|
||||||
|
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||||
|
dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
|
||||||
|
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
|
||||||
|
pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2'
|
||||||
|
BWPSize = dlsch_config_pdu_1_0->BWPSize;
|
||||||
|
} else {
|
||||||
|
if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){
|
||||||
|
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
|
||||||
|
} else {
|
||||||
|
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
||||||
|
}
|
||||||
|
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||||
|
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||||
|
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||||
|
BWPSize = n_RB_DLBWP;
|
||||||
|
}
|
||||||
|
|
||||||
/* IDENTIFIER_DCI_FORMATS */
|
/* IDENTIFIER_DCI_FORMATS */
|
||||||
/* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */
|
/* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */
|
||||||
if (nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val) < 0)
|
if (nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,BWPSize,dci->frequency_domain_assignment.val) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
||||||
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0)
|
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0)
|
||||||
@@ -3701,7 +3406,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
/* dmrs symbol positions*/
|
/* dmrs symbol positions*/
|
||||||
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
||||||
mac->scc->dmrs_TypeA_Position,
|
mac->scc->dmrs_TypeA_Position,
|
||||||
dlsch_config_pdu_1_0->number_symbols);
|
dlsch_config_pdu_1_0->start_symbol+dlsch_config_pdu_1_0->number_symbols);
|
||||||
dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
||||||
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
|
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
|
||||||
if (dlsch_config_pdu_1_0->number_symbols == 2)
|
if (dlsch_config_pdu_1_0->number_symbols == 2)
|
||||||
@@ -3789,12 +3494,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
dlsch_config_pdu_1_0->pucch_resource_id,
|
dlsch_config_pdu_1_0->pucch_resource_id,
|
||||||
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind);
|
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind);
|
||||||
|
|
||||||
if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){
|
|
||||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
|
|
||||||
} else {
|
|
||||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
// dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = n_RB_DLBWP;
|
// dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = n_RB_DLBWP;
|
||||||
|
|
||||||
LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
|
LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
|
||||||
@@ -4117,7 +3816,6 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){
|
|||||||
case NR_RNTI_RA:
|
case NR_RNTI_RA:
|
||||||
case NR_RNTI_TC:
|
case NR_RNTI_TC:
|
||||||
case NR_RNTI_P:
|
case NR_RNTI_P:
|
||||||
case NR_RNTI_SI:
|
|
||||||
if (mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) {
|
if (mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) {
|
||||||
uint8_t bwp_id = 1;
|
uint8_t bwp_id = 1;
|
||||||
uint8_t coreset_id = 0; // assuming controlResourceSetId is 0 for controlResourceSetZero
|
uint8_t coreset_id = 0; // assuming controlResourceSetId is 0 for controlResourceSetZero
|
||||||
@@ -4127,8 +3825,11 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){
|
|||||||
N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NR_RNTI_SI:
|
||||||
|
N_RB = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||||
|
break;
|
||||||
case NR_RNTI_C:
|
case NR_RNTI_C:
|
||||||
N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return N_RB;
|
return N_RB;
|
||||||
@@ -4366,23 +4067,42 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RNTI_SI:
|
case NR_RNTI_SI:
|
||||||
/*
|
|
||||||
// Freq domain assignment 0-16 bit
|
// Freq domain assignment 0-16 bit
|
||||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||||
for (int i=0; i<fsize; i++)
|
pos+=fsize;
|
||||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++);
|
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||||
// Time domain assignment 4 bit
|
|
||||||
for (int i=0; i<4; i++)
|
// Time domain assignment 4 bit
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
pos+=4;
|
||||||
// VRB to PRB mapping 1 bit
|
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++);
|
|
||||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
// VRB to PRB mapping 1 bit
|
||||||
for (int i=0; i<5; i++)
|
pos++;
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1;
|
||||||
// Redundancy version 2bit
|
|
||||||
for (int i=0; i<2; i++)
|
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++);
|
pos+=5;
|
||||||
*/
|
dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||||
|
|
||||||
|
// Redundancy version 2 bit
|
||||||
|
pos+=2;
|
||||||
|
dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3;
|
||||||
|
|
||||||
|
// System information indicator 1 bit
|
||||||
|
pos++;
|
||||||
|
dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1;
|
||||||
|
|
||||||
|
LOG_D(MAC,"N_RB = %i\n", N_RB);
|
||||||
|
LOG_D(MAC,"dci_size = %i\n", dci_size);
|
||||||
|
LOG_D(MAC,"fsize = %i\n", fsize);
|
||||||
|
LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||||
|
LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||||
|
LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||||
|
LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||||
|
LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||||
|
LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RNTI_TC:
|
case NR_RNTI_TC:
|
||||||
@@ -5165,9 +4885,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
|||||||
module_idP, frameP, subframe, buflen);
|
module_idP, frameP, subframe, buflen);
|
||||||
AssertFatal(CC_id == 0,
|
AssertFatal(CC_id == 0,
|
||||||
"Transmission on secondary CCs is not supported yet\n");
|
"Transmission on secondary CCs is not supported yet\n");
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check for DCCH first
|
// Check for DCCH first
|
||||||
// TO DO: Multiplex in the order defined by the logical channel prioritization
|
// TO DO: Multiplex in the order defined by the logical channel prioritization
|
||||||
|
|||||||
@@ -401,6 +401,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
|||||||
|
|
||||||
if (secondaryCellGroup) {
|
if (secondaryCellGroup) {
|
||||||
|
|
||||||
|
RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup;
|
||||||
|
|
||||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||||
if (add_ue == 1 && get_softmodem_params()->phy_test) {
|
if (add_ue == 1 && get_softmodem_params()->phy_test) {
|
||||||
const int UE_id = add_new_nr_ue(Mod_idP,rnti);
|
const int UE_id = add_new_nr_ue(Mod_idP,rnti);
|
||||||
|
|||||||
@@ -394,6 +394,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
|||||||
// This schedules MIB
|
// This schedules MIB
|
||||||
schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing],nb_periods_per_frame);
|
schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing],nb_periods_per_frame);
|
||||||
|
|
||||||
|
// This schedules SIB1
|
||||||
|
if ( get_softmodem_params()->sa == 1 )
|
||||||
|
schedule_nr_sib1(module_idP, frame, slot);
|
||||||
|
|
||||||
|
|
||||||
// This schedule PRACH if we are not in phy_test mode
|
// This schedule PRACH if we are not in phy_test mode
|
||||||
if (get_softmodem_params()->phy_test == 0) {
|
if (get_softmodem_params()->phy_test == 0) {
|
||||||
/* we need to make sure that resources for PRACH are free. To avoid that
|
/* we need to make sure that resources for PRACH are free. To avoid that
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "GNB_APP/RRC_nr_paramsvalues.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
||||||
#include "NR_MAC_gNB/mac_proto.h"
|
#include "NR_MAC_gNB/mac_proto.h"
|
||||||
@@ -38,21 +39,19 @@
|
|||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "UTIL/OPT/opt.h"
|
#include "UTIL/OPT/opt.h"
|
||||||
#include "OCG.h"
|
#include "OCG.h"
|
||||||
#include "OCG_extern.h"
|
|
||||||
|
|
||||||
#include "RRC/NR/nr_rrc_extern.h"
|
#include "RRC/NR/nr_rrc_extern.h"
|
||||||
|
#include "common/utils/nr/nr_common.h"
|
||||||
|
|
||||||
|
|
||||||
//#include "LAYER2/MAC/pre_processor.c"
|
|
||||||
#include "pdcp.h"
|
#include "pdcp.h"
|
||||||
|
|
||||||
#include "intertask_interface.h"
|
|
||||||
|
|
||||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||||
#define DEBUG_eNB_SCHEDULER 1
|
#define DEBUG_eNB_SCHEDULER 1
|
||||||
|
|
||||||
#include "common/ran_context.h"
|
#include "common/ran_context.h"
|
||||||
|
|
||||||
|
#include "executables/softmodem-common.h"
|
||||||
|
|
||||||
extern RAN_CONTEXT_t RC;
|
extern RAN_CONTEXT_t RC;
|
||||||
uint8_t SSB_Slot[64]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,
|
uint8_t SSB_Slot[64]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,
|
||||||
10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,
|
10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,
|
||||||
@@ -168,6 +167,17 @@ void schedule_nr_mib(module_id_t module_idP,
|
|||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = beam_index;
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = beam_index;
|
||||||
dl_req->nPDUs++;
|
dl_req->nPDUs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get type0_PDCCH_CSS_config parameters
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms = &RC.gNB[module_idP]->frame_parms;
|
||||||
|
NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib;
|
||||||
|
uint8_t gNB_xtra_byte = 0;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
gNB_xtra_byte |= ((RC.gNB[module_idP]->pbch.pbch_a >> (31 - i)) & 1) << (7 - i);
|
||||||
|
}
|
||||||
|
get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax,
|
||||||
|
frame_parms->ssb_index, frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// checking if there is any SSB in slot
|
// checking if there is any SSB in slot
|
||||||
@@ -255,3 +265,284 @@ void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) {
|
|||||||
for (int rb = 0; rb < 20; rb++)
|
for (int rb = 0; rb < 20; rb++)
|
||||||
vrb_map[rbStart + rb] = 1;
|
vrb_map[rbStart + rb] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void schedule_control_sib1(module_id_t module_id,
|
||||||
|
int CC_id,
|
||||||
|
int time_domain_allocation,
|
||||||
|
uint8_t mcsTableIdx,
|
||||||
|
uint8_t mcs,
|
||||||
|
int num_total_bytes) {
|
||||||
|
|
||||||
|
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
|
||||||
|
NR_ServingCellConfigCommon_t *servingcellconfigcommon = gNB_mac->common_channels[CC_id].ServingCellConfigCommon;
|
||||||
|
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
||||||
|
|
||||||
|
if (gNB_mac->sched_ctrlCommon == NULL){
|
||||||
|
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
|
||||||
|
gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space));
|
||||||
|
gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp));
|
||||||
|
gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset));
|
||||||
|
gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp));
|
||||||
|
fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space);
|
||||||
|
fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon);
|
||||||
|
fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon);
|
||||||
|
}
|
||||||
|
gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL;
|
||||||
|
|
||||||
|
gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation;
|
||||||
|
gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx;
|
||||||
|
gNB_mac->sched_ctrlCommon->mcs = mcs;
|
||||||
|
gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes;
|
||||||
|
|
||||||
|
uint8_t nr_of_candidates;
|
||||||
|
find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space);
|
||||||
|
|
||||||
|
gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id],
|
||||||
|
gNB_mac->sched_ctrlCommon->active_bwp,
|
||||||
|
gNB_mac->sched_ctrlCommon->coreset,
|
||||||
|
gNB_mac->sched_ctrlCommon->aggregation_level,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
nr_of_candidates);
|
||||||
|
|
||||||
|
if (gNB_mac->sched_ctrlCommon->cce_index < 0) {
|
||||||
|
LOG_E(MAC, "%s(): could not find CCE for coreset0\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs;
|
||||||
|
int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb;
|
||||||
|
|
||||||
|
// Calculate number of symbols
|
||||||
|
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||||
|
const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength;
|
||||||
|
int startSymbolIndex, nrOfSymbols;
|
||||||
|
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||||
|
|
||||||
|
if (nrOfSymbols == 2) {
|
||||||
|
gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1;
|
||||||
|
} else {
|
||||||
|
gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate number of PRB_DMRS
|
||||||
|
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6;
|
||||||
|
uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols);
|
||||||
|
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||||
|
|
||||||
|
int rbSize = 0;
|
||||||
|
uint32_t TBS = 0;
|
||||||
|
do {
|
||||||
|
rbSize++;
|
||||||
|
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
||||||
|
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
||||||
|
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
|
||||||
|
|
||||||
|
// FIXME: Something is not working in nr_modulation() for TBS = 84, so we need to skip it
|
||||||
|
} while ( (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes) || (TBS==84) );
|
||||||
|
|
||||||
|
gNB_mac->sched_ctrlCommon->rbSize = rbSize;
|
||||||
|
gNB_mac->sched_ctrlCommon->rbStart = 0;
|
||||||
|
|
||||||
|
LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength);
|
||||||
|
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
|
||||||
|
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
|
||||||
|
LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize);
|
||||||
|
LOG_D(MAC,"TBS = %i\n", TBS);
|
||||||
|
|
||||||
|
// Mark the corresponding RBs as used
|
||||||
|
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) {
|
||||||
|
vrb_map[rb + rbStart] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||||
|
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||||
|
uint32_t TBS,
|
||||||
|
int StartSymbolIndex,
|
||||||
|
int NrOfSymbols) {
|
||||||
|
|
||||||
|
gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP];
|
||||||
|
NR_COMMON_channels_t *cc = gNB_mac->common_channels;
|
||||||
|
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||||
|
NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon;
|
||||||
|
NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp;
|
||||||
|
|
||||||
|
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||||
|
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||||
|
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
|
||||||
|
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||||
|
|
||||||
|
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
|
||||||
|
memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||||
|
dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE;
|
||||||
|
dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu));
|
||||||
|
|
||||||
|
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||||
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
||||||
|
|
||||||
|
pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||||
|
|
||||||
|
pdsch_pdu_rel15->pduBitmap = 0;
|
||||||
|
pdsch_pdu_rel15->rnti = SI_RNTI;
|
||||||
|
pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++;
|
||||||
|
|
||||||
|
pdsch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs;
|
||||||
|
pdsch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb;
|
||||||
|
|
||||||
|
pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||||
|
if (bwp->bwp_Common->genericParameters.cyclicPrefix) {
|
||||||
|
pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||||
|
} else {
|
||||||
|
pdsch_pdu_rel15->CyclicPrefix = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdsch_pdu_rel15->NrOfCodewords = 1;
|
||||||
|
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0);
|
||||||
|
pdsch_pdu_rel15->qamModOrder[0] = 2;
|
||||||
|
pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs;
|
||||||
|
pdsch_pdu_rel15->mcsTable[0] = 0;
|
||||||
|
pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0];
|
||||||
|
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
|
||||||
|
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||||
|
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||||
|
pdsch_pdu_rel15->refPoint = 1;
|
||||||
|
pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
||||||
|
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||||
|
pdsch_pdu_rel15->SCID = 0;
|
||||||
|
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData;
|
||||||
|
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||||
|
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||||
|
pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart;
|
||||||
|
pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize;
|
||||||
|
pdsch_pdu_rel15->VRBtoPRBMapping = 0;
|
||||||
|
pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx);
|
||||||
|
pdsch_pdu_rel15->TBSize[0] = TBS;
|
||||||
|
pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx;
|
||||||
|
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
||||||
|
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
||||||
|
|
||||||
|
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->StartSymbolIndex+pdsch_pdu_rel15->NrOfSymbols);
|
||||||
|
|
||||||
|
LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos);
|
||||||
|
|
||||||
|
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
|
||||||
|
memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET);
|
||||||
|
|
||||||
|
dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id;
|
||||||
|
|
||||||
|
// frequency domain assignment
|
||||||
|
dci_pdu_rel15[0].frequency_domain_assignment.val =
|
||||||
|
PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||||
|
pdsch_pdu_rel15->rbStart,
|
||||||
|
gNB_mac->type0_PDCCH_CSS_config.num_rbs);
|
||||||
|
|
||||||
|
dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation;
|
||||||
|
dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs;
|
||||||
|
dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0];
|
||||||
|
dci_pdu_rel15[0].harq_pid = 0;
|
||||||
|
dci_pdu_rel15[0].ndi = 0;
|
||||||
|
dci_pdu_rel15[0].dai[0].val = 0;
|
||||||
|
dci_pdu_rel15[0].tpc = 0; // table 7.2.1-1 in 38.213
|
||||||
|
dci_pdu_rel15[0].pucch_resource_indicator = 0;
|
||||||
|
dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = 0;
|
||||||
|
dci_pdu_rel15[0].antenna_ports.val = 0;
|
||||||
|
dci_pdu_rel15[0].dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID;
|
||||||
|
|
||||||
|
nr_configure_pdcch(gNB_mac,
|
||||||
|
pdcch_pdu_rel15,
|
||||||
|
SI_RNTI,
|
||||||
|
gNB_mac->sched_ctrlCommon->search_space,
|
||||||
|
gNB_mac->sched_ctrlCommon->coreset,
|
||||||
|
scc,
|
||||||
|
bwp,
|
||||||
|
gNB_mac->sched_ctrlCommon->aggregation_level,
|
||||||
|
gNB_mac->sched_ctrlCommon->cce_index);
|
||||||
|
|
||||||
|
int dci_formats[2];
|
||||||
|
int rnti_types[2];
|
||||||
|
|
||||||
|
dci_formats[0] = NR_DL_DCI_FORMAT_1_0;
|
||||||
|
rnti_types[0] = NR_RNTI_SI;
|
||||||
|
|
||||||
|
fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id);
|
||||||
|
|
||||||
|
dl_req->nPDUs += 2;
|
||||||
|
|
||||||
|
LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize);
|
||||||
|
LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart);
|
||||||
|
LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing);
|
||||||
|
LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix);
|
||||||
|
LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex);
|
||||||
|
LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols);
|
||||||
|
for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]);
|
||||||
|
LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType);
|
||||||
|
LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize);
|
||||||
|
LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize);
|
||||||
|
LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType);
|
||||||
|
LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex);
|
||||||
|
LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity);
|
||||||
|
LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
|
||||||
|
|
||||||
|
LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP);
|
||||||
|
|
||||||
|
// TODO: Get these values from RRC
|
||||||
|
const int CC_id = 0;
|
||||||
|
int time_domain_allocation = 0;
|
||||||
|
uint8_t mcsTableIdx = 0;
|
||||||
|
uint8_t mcs = 6;
|
||||||
|
|
||||||
|
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
|
||||||
|
|
||||||
|
if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) && (gNB_mac->type0_PDCCH_CSS_config.num_rbs > 0) ) {
|
||||||
|
|
||||||
|
LOG_D(MAC,"> SIB1 transmission\n");
|
||||||
|
|
||||||
|
// Get SIB1
|
||||||
|
uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8];
|
||||||
|
uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload);
|
||||||
|
LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length);
|
||||||
|
LOG_D(MAC,"SIB1: \n");
|
||||||
|
for (int i=0;i<sib1_sdu_length;i++) LOG_D(MAC,"byte %d : %x\n",i,((uint8_t*)sib1_payload)[i]);
|
||||||
|
|
||||||
|
// Configure sched_ctrlCommon for SIB1
|
||||||
|
schedule_control_sib1(module_idP, CC_id, time_domain_allocation, mcsTableIdx, mcs, sib1_sdu_length);
|
||||||
|
|
||||||
|
// Calculate number of symbols
|
||||||
|
int startSymbolIndex, nrOfSymbols;
|
||||||
|
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||||
|
const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength;
|
||||||
|
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||||
|
|
||||||
|
// Calculate number of PRB_DMRS
|
||||||
|
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6;
|
||||||
|
uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols);
|
||||||
|
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||||
|
|
||||||
|
const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
||||||
|
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
||||||
|
gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3;
|
||||||
|
|
||||||
|
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
||||||
|
nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols);
|
||||||
|
|
||||||
|
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
|
||||||
|
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req];
|
||||||
|
|
||||||
|
// Data to be transmitted
|
||||||
|
bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||||
|
memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length);
|
||||||
|
|
||||||
|
tx_req->PDU_length = TBS;
|
||||||
|
tx_req->PDU_index = gNB_mac->pdu_index[0]++;
|
||||||
|
tx_req->num_TLV = 1;
|
||||||
|
tx_req->TLVs[0].length = TBS + 2;
|
||||||
|
gNB_mac->TX_req[CC_id].Number_of_PDUs++;
|
||||||
|
gNB_mac->TX_req[CC_id].SFN = frameP;
|
||||||
|
gNB_mac->TX_req[CC_id].Slot = slotP;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -504,6 +504,9 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
|||||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||||
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
|
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
|
||||||
sched_ctrl->time_domain_allocation);
|
sched_ctrl->time_domain_allocation);
|
||||||
|
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||||
|
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
|
||||||
|
nrOfSymbols);
|
||||||
|
|
||||||
int rbSize = 0;
|
int rbSize = 0;
|
||||||
const int oh = 2 + (sched_ctrl->num_total_bytes >= 256)
|
const int oh = 2 + (sched_ctrl->num_total_bytes >= 256)
|
||||||
@@ -515,8 +518,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
|||||||
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
rbSize,
|
rbSize,
|
||||||
nrOfSymbols,
|
nrOfSymbols,
|
||||||
N_PRB_DMRS, // FIXME // This should be multiplied by the
|
N_PRB_DMRS * N_DMRS_SLOT,
|
||||||
// number of dmrs symbols
|
|
||||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||||
0 /* tb_scaling */,
|
0 /* tb_scaling */,
|
||||||
1 /* nrOfLayers */)
|
1 /* nrOfLayers */)
|
||||||
@@ -576,13 +578,16 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
|
|
||||||
uint8_t N_PRB_DMRS =
|
uint8_t N_PRB_DMRS =
|
||||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||||
|
|
||||||
|
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||||
|
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
|
||||||
|
nrOfSymbols);
|
||||||
const uint32_t TBS =
|
const uint32_t TBS =
|
||||||
nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
sched_ctrl->rbSize,
|
sched_ctrl->rbSize,
|
||||||
nrOfSymbols,
|
nrOfSymbols,
|
||||||
N_PRB_DMRS, // FIXME // This should be multiplied by the
|
N_PRB_DMRS * N_DMRS_SLOT,
|
||||||
// number of dmrs symbols
|
|
||||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||||
0 /* tb_scaling */,
|
0 /* tb_scaling */,
|
||||||
1 /* nrOfLayers */)
|
1 /* nrOfLayers */)
|
||||||
|
|||||||
@@ -176,7 +176,13 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
|||||||
// NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
// NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||||
|
|
||||||
int coreset_id = coreset->controlResourceSetId;
|
int coreset_id = coreset->controlResourceSetId;
|
||||||
int *cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id];
|
|
||||||
|
int *cce_list;
|
||||||
|
if(bwp->bwp_Id == 0) {
|
||||||
|
cce_list = nr_mac->cce_list[1][0];
|
||||||
|
} else {
|
||||||
|
cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id];
|
||||||
|
}
|
||||||
|
|
||||||
int n_rb=0;
|
int n_rb=0;
|
||||||
for (int i=0;i<6;i++)
|
for (int i=0;i<6;i++)
|
||||||
@@ -830,8 +836,12 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac,
|
|||||||
pdcch_pdu->ShiftIndex = 0;
|
pdcch_pdu->ShiftIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdcch_pdu->CoreSetType = 1;
|
if(coreset->controlResourceSetId == 0) {
|
||||||
|
pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||||
|
} else{
|
||||||
|
pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
//precoderGranularity
|
//precoderGranularity
|
||||||
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
||||||
|
|
||||||
@@ -1326,22 +1336,42 @@ void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RNTI_SI:
|
case NR_RNTI_SI:
|
||||||
// Freq domain assignment 0-16 bit
|
pos=1;
|
||||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
|
||||||
for (int i=0; i<fsize; i++)
|
// Freq domain assignment 0-16 bit
|
||||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++);
|
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||||
// Time domain assignment 4 bit
|
for (int i=0; i<fsize; i++)
|
||||||
for (int i=0; i<4; i++)
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-1-i))&1)<<(dci_size-pos++);
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
|
||||||
// VRB to PRB mapping 1 bit
|
// Time domain assignment 4 bit
|
||||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++);
|
for (int i=0; i<4; i++)
|
||||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
||||||
for (int i=0; i<5; i++)
|
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
// VRB to PRB mapping 1 bit
|
||||||
// Redundancy version 2bit
|
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++);
|
||||||
for (int i=0; i<2; i++)
|
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++);
|
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||||
|
for (int i=0; i<5; i++)
|
||||||
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
||||||
|
|
||||||
|
// Redundancy version 2 bit
|
||||||
|
for (int i=0; i<2; i++)
|
||||||
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++);
|
||||||
|
|
||||||
|
// System information indicator 1bit
|
||||||
|
*dci_pdu |= ((uint64_t)dci_pdu_rel15->system_info_indicator&1)<<(dci_size-pos++);
|
||||||
|
|
||||||
|
// reserved 15 bits
|
||||||
|
|
||||||
|
LOG_D(PHY,"dci_size = %i\n", dci_size);
|
||||||
|
LOG_D(PHY,"fsize = %i\n", fsize);
|
||||||
|
LOG_D(PHY,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||||
|
LOG_D(PHY,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||||
|
LOG_D(PHY,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||||
|
LOG_D(PHY,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||||
|
LOG_D(PHY,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||||
|
LOG_D(PHY,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RNTI_TC:
|
case NR_RNTI_TC:
|
||||||
|
|||||||
@@ -80,6 +80,15 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
sub_frame_t slot,
|
sub_frame_t slot,
|
||||||
int num_slots_per_tdd);
|
int num_slots_per_tdd);
|
||||||
|
|
||||||
|
void schedule_control_sib1(module_id_t module_id,
|
||||||
|
int CC_id,
|
||||||
|
int time_domain_allocation,
|
||||||
|
uint8_t mcsTableIdx,
|
||||||
|
uint8_t mcs,
|
||||||
|
int num_total_bytes);
|
||||||
|
|
||||||
|
void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);
|
||||||
|
|
||||||
/* \brief default preprocessor */
|
/* \brief default preprocessor */
|
||||||
void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
||||||
frame_t frame,
|
frame_t frame,
|
||||||
|
|||||||
@@ -62,6 +62,8 @@
|
|||||||
#include "NR_PHY_INTERFACE/NR_IF_Module.h"
|
#include "NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||||
|
|
||||||
/* MAC */
|
/* MAC */
|
||||||
|
#include "LAYER2/MAC/mac.h"
|
||||||
|
#include "LAYER2/MAC/mac_proto.h"
|
||||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||||
#include "NR_TAG.h"
|
#include "NR_TAG.h"
|
||||||
@@ -553,6 +555,11 @@ typedef struct gNB_MAC_INST_s {
|
|||||||
nr_pp_impl_dl pre_processor_dl;
|
nr_pp_impl_dl pre_processor_dl;
|
||||||
/// UL preprocessor for differentiated scheduling
|
/// UL preprocessor for differentiated scheduling
|
||||||
nr_pp_impl_ul pre_processor_ul;
|
nr_pp_impl_ul pre_processor_ul;
|
||||||
|
|
||||||
|
NR_UE_sched_ctrl_t *sched_ctrlCommon;
|
||||||
|
NR_CellGroupConfig_t *secondaryCellGroupCommon;
|
||||||
|
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
|
||||||
|
|
||||||
} gNB_MAC_INST;
|
} gNB_MAC_INST;
|
||||||
|
|
||||||
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
||||||
|
|||||||
@@ -358,16 +358,7 @@ boolean_t pdcp_data_req(
|
|||||||
LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %x, node_type %d \n",
|
LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %x, node_type %d \n",
|
||||||
rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc ? RC.rrc[ctxt_pP->module_id]->node_type: -1);
|
rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc ? RC.rrc[ctxt_pP->module_id]->node_type: -1);
|
||||||
|
|
||||||
// The check on nos1 is done only for the use case of LTE stack running over 5g-nr PHY. This should be changed
|
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) {
|
||||||
// before future merge of develop with develop-nr and instead of a check of IS_SOFTMODEM_NOS1, we should use a check
|
|
||||||
// with a new execution option capturing the nr-ip-over-LTE-stack use case.
|
|
||||||
ngran_node_t node_type;
|
|
||||||
if (IS_SOFTMODEM_NOS1)
|
|
||||||
node_type = ngran_gNB;
|
|
||||||
else
|
|
||||||
node_type = RC.rrc[ctxt_pP->module_id]->node_type;
|
|
||||||
|
|
||||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(node_type)) { //RC.rrc[ctxt_pP->module_id]->node_type
|
|
||||||
LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type);
|
LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type);
|
||||||
ret=FALSE;
|
ret=FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -13,6 +13,3 @@ RLC AM
|
|||||||
- 36.322 5.1.3.2.3 Actions when a RLC data PDU is placed in the reception
|
- 36.322 5.1.3.2.3 Actions when a RLC data PDU is placed in the reception
|
||||||
buffer
|
buffer
|
||||||
[...] and in-sequence byte segments of the AMD PDU with SN = VR(R) [...]
|
[...] and in-sequence byte segments of the AMD PDU with SN = VR(R) [...]
|
||||||
|
|
||||||
- use SOstart/SOend in NACK reporting, do not NACK full PDU if
|
|
||||||
parts of it have been received
|
|
||||||
|
|||||||
@@ -898,6 +898,64 @@ static tx_pdu_size_t compute_new_pdu_size(rlc_entity_am_t *entity, int maxsize)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return number of missing parts of a sn
|
||||||
|
* if everything is missing (nothing received), return 0
|
||||||
|
*/
|
||||||
|
static int count_nack_missing_parts(rlc_entity_am_t *entity, int sn)
|
||||||
|
{
|
||||||
|
rlc_rx_pdu_segment_t *l = entity->rx_list;
|
||||||
|
int last_byte;
|
||||||
|
int new_last_byte;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
while (l != NULL) {
|
||||||
|
if (l->sn == sn)
|
||||||
|
break;
|
||||||
|
l = l->next;
|
||||||
|
}
|
||||||
|
/* nothing received, everything is missing, return 0 */
|
||||||
|
if (l == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
last_byte = -1;
|
||||||
|
count = 0;
|
||||||
|
while (l != NULL && l->sn == sn) {
|
||||||
|
if (l->so > last_byte + 1)
|
||||||
|
/* missing part detected */
|
||||||
|
count++;
|
||||||
|
if (l->is_last)
|
||||||
|
/* end of PDU reached - no more missing part to add */
|
||||||
|
return count;
|
||||||
|
new_last_byte = l->so + l->size - l->data_offset - 1;
|
||||||
|
if (new_last_byte > last_byte)
|
||||||
|
last_byte = new_last_byte;
|
||||||
|
l = l->next;
|
||||||
|
}
|
||||||
|
/* at this point: end of PDU not received, one more missing part */
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return size of nack reporting for sn, in bits */
|
||||||
|
static int segment_nack_size(rlc_entity_am_t *entity, int sn)
|
||||||
|
{
|
||||||
|
/* nack + e1 + e2 = 12 bits
|
||||||
|
* SOstart + SOend = 30 bits
|
||||||
|
*/
|
||||||
|
int count;
|
||||||
|
|
||||||
|
count = count_nack_missing_parts(entity, sn);
|
||||||
|
|
||||||
|
/* count_nack_missing_parts returns 0 when everything is missing
|
||||||
|
* in which case we don't have SOstart/SOend, so only 12 bits
|
||||||
|
*/
|
||||||
|
if (count == 0)
|
||||||
|
return 12;
|
||||||
|
|
||||||
|
return count * (12 + 30);
|
||||||
|
}
|
||||||
|
|
||||||
static int status_size(rlc_entity_am_t *entity, int maxsize)
|
static int status_size(rlc_entity_am_t *entity, int maxsize)
|
||||||
{
|
{
|
||||||
/* let's count bits */
|
/* let's count bits */
|
||||||
@@ -912,11 +970,16 @@ static int status_size(rlc_entity_am_t *entity, int maxsize)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* each NACK adds 12 bits */
|
/* add size of NACKs */
|
||||||
sn = entity->vr_r;
|
sn = entity->vr_r;
|
||||||
while (bits + 12 <= maxsize && sn_compare_rx(entity, sn, entity->vr_ms) < 0) {
|
while (sn_compare_rx(entity, sn, entity->vr_ms) < 0) {
|
||||||
if (!(rlc_am_segment_full(entity, sn)))
|
if (!(rlc_am_segment_full(entity, sn))) {
|
||||||
bits += 12;
|
int nack_size = segment_nack_size(entity, sn);
|
||||||
|
/* stop there if not enough room */
|
||||||
|
if (bits + nack_size > maxsize)
|
||||||
|
break;
|
||||||
|
bits += nack_size;
|
||||||
|
}
|
||||||
sn = (sn + 1) % 1024;
|
sn = (sn + 1) % 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +992,8 @@ static int generate_status(rlc_entity_am_t *entity, char *buffer, int size)
|
|||||||
int bits = 15; /* minimum size is 15 (header+ack_sn+e1) */
|
int bits = 15; /* minimum size is 15 (header+ack_sn+e1) */
|
||||||
int sn;
|
int sn;
|
||||||
rlc_pdu_encoder_t encoder;
|
rlc_pdu_encoder_t encoder;
|
||||||
int has_nack = 0;
|
rlc_pdu_encoder_t encoder_ack;
|
||||||
|
rlc_pdu_encoder_t previous_e1;
|
||||||
int ack;
|
int ack;
|
||||||
|
|
||||||
rlc_pdu_encoder_init(&encoder, buffer, size);
|
rlc_pdu_encoder_init(&encoder, buffer, size);
|
||||||
@@ -947,24 +1011,68 @@ static int generate_status(rlc_entity_am_t *entity, char *buffer, int size)
|
|||||||
rlc_pdu_encoder_put_bits(&encoder, 0, 3); /* CPT */
|
rlc_pdu_encoder_put_bits(&encoder, 0, 3); /* CPT */
|
||||||
|
|
||||||
/* reserve room for ACK (it will be set after putting the NACKs) */
|
/* reserve room for ACK (it will be set after putting the NACKs) */
|
||||||
|
encoder_ack = encoder;
|
||||||
rlc_pdu_encoder_put_bits(&encoder, 0, 10);
|
rlc_pdu_encoder_put_bits(&encoder, 0, 10);
|
||||||
|
/* put 0 for e1, will be set to 1 later in the code if needed */
|
||||||
|
previous_e1 = encoder;
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, 0, 1);
|
||||||
|
|
||||||
/* at this point, ACK is VR(R) */
|
/* at this point, ACK is VR(R) */
|
||||||
ack = entity->vr_r;
|
ack = entity->vr_r;
|
||||||
|
|
||||||
/* each NACK adds 12 bits */
|
|
||||||
sn = entity->vr_r;
|
sn = entity->vr_r;
|
||||||
while (bits + 12 <= size && sn_compare_rx(entity, sn, entity->vr_ms) < 0) {
|
while (sn_compare_rx(entity, sn, entity->vr_ms) < 0) {
|
||||||
if (!(rlc_am_segment_full(entity, sn))) {
|
if (!(rlc_am_segment_full(entity, sn))) {
|
||||||
/* put previous e1 (is 1) */
|
rlc_rx_pdu_segment_t *l;
|
||||||
rlc_pdu_encoder_put_bits(&encoder, 1, 1);
|
int i;
|
||||||
/* if previous was NACK, put previous e2 (0, we don't do 'so' thing) */
|
int count = count_nack_missing_parts(entity, sn);
|
||||||
if (has_nack)
|
int nack_bits = count == 0 ? 12 : count * (12 + 30);
|
||||||
rlc_pdu_encoder_put_bits(&encoder, 0, 1);
|
int last_byte;
|
||||||
/* put NACKed sn */
|
int new_last_byte;
|
||||||
rlc_pdu_encoder_put_bits(&encoder, sn, 10);
|
int so_start;
|
||||||
has_nack = 1;
|
int so_end;
|
||||||
bits += 12;
|
/* if not enough room, stop putting NACKs */
|
||||||
|
if (bits + nack_bits > size)
|
||||||
|
break;
|
||||||
|
/* set previous e1 to 1 */
|
||||||
|
rlc_pdu_encoder_put_bits(&previous_e1, 1, 1);
|
||||||
|
|
||||||
|
if (count == 0) {
|
||||||
|
/* simply NACK, no SOstart/SOend */
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, sn, 10); /* nack */
|
||||||
|
previous_e1 = encoder;
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, 0, 2); /* e1, e2 */
|
||||||
|
} else {
|
||||||
|
/* count is not 0, so we have 'count' NACK+e1+e2+SOstart+SOend */
|
||||||
|
l = entity->rx_list;
|
||||||
|
last_byte = -1;
|
||||||
|
while (l->sn != sn) l = l->next;
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, sn, 10); /* nack */
|
||||||
|
previous_e1 = encoder;
|
||||||
|
/* all NACKs but the last have a following NACK, set e1 for them */
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, i != count - 1, 1); /* e1 */
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, 1, 1); /* e2 */
|
||||||
|
/* look for the next segment with missing data before it */
|
||||||
|
while (l != NULL && l->sn == sn && !(l->so > last_byte + 1)) {
|
||||||
|
new_last_byte = l->so + l->size - l->data_offset - 1;
|
||||||
|
if (new_last_byte > last_byte)
|
||||||
|
last_byte = new_last_byte;
|
||||||
|
l = l->next;
|
||||||
|
}
|
||||||
|
so_start = last_byte + 1;
|
||||||
|
if (l == NULL)
|
||||||
|
so_end = 0x7fff;
|
||||||
|
else
|
||||||
|
so_end = l->so - 1;
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, so_start, 15);
|
||||||
|
rlc_pdu_encoder_put_bits(&encoder, so_end, 15);
|
||||||
|
if (l != NULL)
|
||||||
|
last_byte = l->so + l->size - l->data_offset - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bits += nack_bits;
|
||||||
} else {
|
} else {
|
||||||
/* this sn is full and we put all NACKs before it, use it for ACK */
|
/* this sn is full and we put all NACKs before it, use it for ACK */
|
||||||
ack = (sn + 1) % 1024;
|
ack = (sn + 1) % 1024;
|
||||||
@@ -972,24 +1080,10 @@ static int generate_status(rlc_entity_am_t *entity, char *buffer, int size)
|
|||||||
sn = (sn + 1) % 1024;
|
sn = (sn + 1) % 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* go to highest full sn+1 for ACK, VR(MS) is the limit */
|
|
||||||
while (sn_compare_rx(entity, sn, entity->vr_ms) < 0 &&
|
|
||||||
rlc_am_segment_full(entity, sn)) {
|
|
||||||
ack = (sn + 1) % 1024;
|
|
||||||
sn = (sn + 1) % 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* at this point, if last put was NACK then put 2 bits else put 1 bit */
|
|
||||||
if (has_nack)
|
|
||||||
rlc_pdu_encoder_put_bits(&encoder, 0, 2);
|
|
||||||
else
|
|
||||||
rlc_pdu_encoder_put_bits(&encoder, 0, 1);
|
|
||||||
|
|
||||||
rlc_pdu_encoder_align(&encoder);
|
rlc_pdu_encoder_align(&encoder);
|
||||||
|
|
||||||
/* let's put the ACK */
|
/* let's put the ACK */
|
||||||
buffer[0] |= ack >> 6;
|
rlc_pdu_encoder_put_bits(&encoder_ack, ack, 10);
|
||||||
buffer[1] |= (ack & 0x3f) << 2;
|
|
||||||
|
|
||||||
/* reset the trigger */
|
/* reset the trigger */
|
||||||
entity->status_triggered = 0;
|
entity->status_triggered = 0;
|
||||||
|
|||||||
@@ -233,9 +233,10 @@ static void put_bit(rlc_pdu_encoder_t *encoder, int bit)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder->buffer[encoder->byte] <<= 1;
|
|
||||||
if (bit)
|
if (bit)
|
||||||
encoder->buffer[encoder->byte] |= 1;
|
encoder->buffer[encoder->byte] |= 1 << (7 - encoder->bit);
|
||||||
|
else
|
||||||
|
encoder->buffer[encoder->byte] &= ~(1 << (7 - encoder->bit));
|
||||||
|
|
||||||
encoder->bit++;
|
encoder->bit++;
|
||||||
if (encoder->bit == 8) {
|
if (encoder->bit == 8) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_count=45
|
test_count=49
|
||||||
|
|
||||||
for i in `seq $test_count`
|
for i in `seq $test_count`
|
||||||
do
|
do
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* rlc am test ack/nack reporting with segmented SDUs
|
||||||
|
* eNB sends SDU in big PDU, not received
|
||||||
|
* eNB retx with smaller PDUs, not received except a few
|
||||||
|
* after some time, RX works again, UE should NACK with SOstart/SOend
|
||||||
|
*
|
||||||
|
* this test was written because in the past we didn't generate NACKs with
|
||||||
|
* SOstart/SOend, potentially leading to infinite retransmissions, even with
|
||||||
|
* good radio conditions (well, there will be max ReTX reached at some point).
|
||||||
|
* The scenario is as follows:
|
||||||
|
* the eNB transmits many many PDUs segments and asks for status
|
||||||
|
* report at some point (but before sending all the segments). The UE then
|
||||||
|
* generates a (wrong) NACK without SOstart/SOend, and then the eNB has to
|
||||||
|
* resend everything from start (all bytes of the PDU have been NACKed because
|
||||||
|
* there is no SOstart/SOend). Then the eNB will again ask for status report
|
||||||
|
* before sending everything and the process repeats all over again.
|
||||||
|
*/
|
||||||
|
TIME, 1,
|
||||||
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
ENB_RECV_FAILS, 1,
|
||||||
|
ENB_SDU, 0, 300,
|
||||||
|
ENB_PDU_SIZE, 500,
|
||||||
|
UE_PDU_SIZE, 1000,
|
||||||
|
TIME, 2,
|
||||||
|
ENB_PDU_SIZE, 7,
|
||||||
|
TIME, 50,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
TIME, 51,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
TIME, 60,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
TIME, 61,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
TIME, 70,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
TIME, 71,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
TIME, 80,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
TIME, 81,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
TIME, 140,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
ENB_RECV_FAILS, 0,
|
||||||
|
TIME, 150,
|
||||||
|
ENB_PDU_SIZE, 200,
|
||||||
|
TIME, -1
|
||||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* am: test function segment_nack_size, case "if (count == 0) return 12;"
|
||||||
|
* The eNB sends 5 PDUs, only first and last received by the UE. Then we
|
||||||
|
* ask for the UE's buffer status to trigger the case.
|
||||||
|
*/
|
||||||
|
TIME, 1,
|
||||||
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
ENB_RECV_FAILS, 1,
|
||||||
|
ENB_PDU_SIZE, 100,
|
||||||
|
UE_PDU_SIZE, 100,
|
||||||
|
TIME, 2,
|
||||||
|
ENB_SDU, 0, 10,
|
||||||
|
TIME, 3,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
ENB_SDU, 1, 10,
|
||||||
|
TIME, 4,
|
||||||
|
ENB_SDU, 2, 10,
|
||||||
|
TIME, 5,
|
||||||
|
ENB_SDU, 3, 10,
|
||||||
|
TIME, 6,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
ENB_RECV_FAILS, 0,
|
||||||
|
ENB_SDU, 4, 10,
|
||||||
|
TIME, 42,
|
||||||
|
UE_BUFFER_STATUS,
|
||||||
|
TIME, -1
|
||||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* am: test case "if (bits + nack_size > maxsize)" in functions status_size
|
||||||
|
* and generate_status.
|
||||||
|
* The eNB sends 5 PDUs, only first and last received by the UE. Then we
|
||||||
|
* ask for the UE's buffer status to trigger the case. UE PDU size is
|
||||||
|
* limited to 6 to trigger the case.
|
||||||
|
*/
|
||||||
|
TIME, 1,
|
||||||
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
ENB_RECV_FAILS, 1,
|
||||||
|
ENB_PDU_SIZE, 100,
|
||||||
|
UE_PDU_SIZE, 6,
|
||||||
|
TIME, 2,
|
||||||
|
ENB_SDU, 0, 10,
|
||||||
|
TIME, 3,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
ENB_SDU, 1, 10,
|
||||||
|
TIME, 4,
|
||||||
|
ENB_SDU, 2, 10,
|
||||||
|
TIME, 5,
|
||||||
|
ENB_SDU, 3, 10,
|
||||||
|
TIME, 6,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
ENB_RECV_FAILS, 0,
|
||||||
|
ENB_SDU, 4, 10,
|
||||||
|
TIME, 42,
|
||||||
|
UE_BUFFER_STATUS,
|
||||||
|
TIME, -1
|
||||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* rlc am test ack/nack reporting with segmented SDUs
|
||||||
|
*
|
||||||
|
* 5 SDUs put into 6 PDUs, all PDUs received expect the 3rd. Then
|
||||||
|
* retransmission happens with smaller PDU size.
|
||||||
|
*/
|
||||||
|
TIME, 1,
|
||||||
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
ENB_SDU, 0, 60,
|
||||||
|
ENB_SDU, 1, 160,
|
||||||
|
ENB_SDU, 2, 130,
|
||||||
|
ENB_SDU, 3, 120,
|
||||||
|
ENB_SDU, 4, 100,
|
||||||
|
ENB_PDU_SIZE, 100,
|
||||||
|
UE_PDU_SIZE, 1000,
|
||||||
|
TIME, 3,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
TIME, 4,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
TIME, 7,
|
||||||
|
ENB_PDU_SIZE, 40,
|
||||||
|
TIME, 42,
|
||||||
|
UE_RECV_FAILS, 1,
|
||||||
|
TIME, 80,
|
||||||
|
UE_RECV_FAILS, 0,
|
||||||
|
TIME, -1
|
||||||
Binary file not shown.
@@ -5,9 +5,6 @@
|
|||||||
* [1..600] is received but ACK/NACK not
|
* [1..600] is received but ACK/NACK not
|
||||||
* eNB retx with still smaller PDUs [1..400] [401..600] [601..900]
|
* eNB retx with still smaller PDUs [1..400] [401..600] [601..900]
|
||||||
* all is received, ACKs/NACKs go through
|
* all is received, ACKs/NACKs go through
|
||||||
*
|
|
||||||
* this test will fail if NACK mechanism uses SOstart/SOend
|
|
||||||
* (not implemented for the moment)
|
|
||||||
*/
|
*/
|
||||||
TIME, 1,
|
TIME, 1,
|
||||||
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
|||||||
Binary file not shown.
@@ -6,9 +6,6 @@
|
|||||||
* eNB retx with still smaller PDUs [1..400] [401..600] [601..900]
|
* eNB retx with still smaller PDUs [1..400] [401..600] [601..900]
|
||||||
* [401..600] received, ACK goes through
|
* [401..600] received, ACK goes through
|
||||||
* link clean, all goes through
|
* link clean, all goes through
|
||||||
*
|
|
||||||
* this test will fail if NACK mechanism uses SOstart/SOend
|
|
||||||
* (not implemented for the moment)
|
|
||||||
*/
|
*/
|
||||||
TIME, 1,
|
TIME, 1,
|
||||||
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
|||||||
Binary file not shown.
@@ -11,9 +11,6 @@
|
|||||||
* In the current RLC implementation, this is impossible. If we send [12..21]
|
* In the current RLC implementation, this is impossible. If we send [12..21]
|
||||||
* it means [1..21] has been split and so we won't sent it later on.
|
* it means [1..21] has been split and so we won't sent it later on.
|
||||||
* Maybe with HARQ retransmissions in PHY/MAC in bad radio conditions?
|
* Maybe with HARQ retransmissions in PHY/MAC in bad radio conditions?
|
||||||
*
|
|
||||||
* this test will fail if NACK mechanism uses SOstart/SOend
|
|
||||||
* (not implemented for the moment)
|
|
||||||
*/
|
*/
|
||||||
TIME, 1,
|
TIME, 1,
|
||||||
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4,
|
||||||
|
|||||||
Binary file not shown.
@@ -60,9 +60,9 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, ui
|
|||||||
|
|
||||||
// L2 Abstraction Layer
|
// L2 Abstraction Layer
|
||||||
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len){
|
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len){
|
||||||
|
return nr_ue_decode_sib1(module_id, cc_id, gNB_index, sibs_mask, pduP, pdu_len);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// L2 Abstraction Layer
|
// L2 Abstraction Layer
|
||||||
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){
|
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#include "pdcp.h"
|
#include "pdcp.h"
|
||||||
#include "msc.h"
|
#include "msc.h"
|
||||||
#include "common/ran_context.h"
|
#include "common/ran_context.h"
|
||||||
|
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||||
|
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||||
|
|
||||||
#include "intertask_interface.h"
|
#include "intertask_interface.h"
|
||||||
|
|
||||||
@@ -43,6 +45,103 @@
|
|||||||
|
|
||||||
extern RAN_CONTEXT_t RC;
|
extern RAN_CONTEXT_t RC;
|
||||||
|
|
||||||
|
int generate_pdcch_ConfigSIB1(NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1,
|
||||||
|
long ssbSubcarrierSpacing,
|
||||||
|
long subCarrierSpacingCommon,
|
||||||
|
channel_bandwidth_t min_channel_bw) {
|
||||||
|
|
||||||
|
nr_ssb_and_cset_mux_pattern_type_t mux_pattern = 0;
|
||||||
|
|
||||||
|
switch (ssbSubcarrierSpacing) {
|
||||||
|
|
||||||
|
case NR_SubcarrierSpacing_kHz15:
|
||||||
|
if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_1_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_1_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_2_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_2_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else {
|
||||||
|
AssertFatal(true,"Invalid subCarrierSpacingCommon\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_SubcarrierSpacing_kHz30:
|
||||||
|
if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) {
|
||||||
|
|
||||||
|
if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_3_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_3_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else if (min_channel_bw == bw_40MHz) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_5_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_5_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else {
|
||||||
|
AssertFatal(true,"Invalid min_bandwidth\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) {
|
||||||
|
|
||||||
|
if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_4_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_4_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else if (min_channel_bw == bw_40MHz) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_6_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_6_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else {
|
||||||
|
AssertFatal(true,"Invalid min_bandwidth\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
AssertFatal(true,"Invalid subCarrierSpacingCommon\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_SubcarrierSpacing_kHz120:
|
||||||
|
if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_7_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_7_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_8_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_8_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else {
|
||||||
|
AssertFatal(true,"Invalid subCarrierSpacingCommon\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_SubcarrierSpacing_kHz240:
|
||||||
|
if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_9_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_9_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) {
|
||||||
|
pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_10_NUM_INDEXES;
|
||||||
|
mux_pattern = table_38213_13_10_c1[pdcch_ConfigSIB1->controlResourceSetZero];
|
||||||
|
} else {
|
||||||
|
AssertFatal(true,"Invalid subCarrierSpacingCommon\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
AssertFatal(true,"Invalid ssbSubcarrierSpacing\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
frequency_range_t frequency_range = FR1;
|
||||||
|
if(ssbSubcarrierSpacing>=60) {
|
||||||
|
frequency_range = FR2;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdcch_ConfigSIB1->searchSpaceZero = 0;
|
||||||
|
if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR1){
|
||||||
|
pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_11_NUM_INDEXES;
|
||||||
|
}
|
||||||
|
if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR2){
|
||||||
|
pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_12_NUM_INDEXES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nr_rrc_mac_remove_ue(module_id_t mod_idP,
|
nr_rrc_mac_remove_ue(module_id_t mod_idP,
|
||||||
rnti_t rntiP){
|
rnti_t rntiP){
|
||||||
@@ -129,41 +228,54 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
|
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gNB_RRC_INST *rrc;
|
rrc_gNB_carrier_data_t *carrier;
|
||||||
rrc_gNB_carrier_data_t *carrier;
|
NR_BCCH_BCH_Message_t *mib;
|
||||||
NR_BCCH_BCH_Message_t *mib;
|
NR_SRB_INFO *srb_info;
|
||||||
NR_SRB_INFO * srb_info;
|
char payload_size, *payload_pP;
|
||||||
char payload_size, *payload_pP;
|
|
||||||
|
|
||||||
rrc = RC.nrrrc[Mod_idP];
|
|
||||||
carrier = &rrc->carrier;
|
|
||||||
mib = &carrier->mib;
|
|
||||||
srb_info = &carrier->Srb0;
|
|
||||||
|
|
||||||
/* MIBCH */
|
carrier = &RC.nrrrc[Mod_idP]->carrier;
|
||||||
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
|
mib = &carrier->mib;
|
||||||
mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2;
|
srb_info = &carrier->Srb0;
|
||||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message,
|
|
||||||
NULL,
|
/* MIBCH */
|
||||||
(void *)mib,
|
if ((Srb_id & RAB_OFFSET) == MIBCH) {
|
||||||
carrier->MIB,
|
|
||||||
24);
|
// Currently we are getting the pdcch_ConfigSIB1 from the configuration file.
|
||||||
LOG_D(NR_RRC,"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n",frameP,sfn_msb,carrier->MIB,enc_rval.encoded);
|
// Uncomment this function for a dynamic pdcch_ConfigSIB1.
|
||||||
buffer_pP[0]=carrier->MIB[0];
|
//channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1
|
||||||
buffer_pP[1]=carrier->MIB[1];
|
//generate_pdcch_ConfigSIB1(carrier->pdcch_ConfigSIB1,
|
||||||
buffer_pP[2]=carrier->MIB[2];
|
// *carrier->servingcellconfigcommon->ssbSubcarrierSpacing,
|
||||||
LOG_D(NR_RRC,"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n",buffer_pP[0],buffer_pP[1],buffer_pP[2]);
|
// carrier->mib.message.choice.mib->subCarrierSpacingCommon,
|
||||||
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
// min_channel_bw);
|
||||||
enc_rval.failed_type->name, enc_rval.encoded);
|
|
||||||
return(3);
|
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = carrier->pdcch_ConfigSIB1->controlResourceSetZero;
|
||||||
}
|
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = carrier->pdcch_ConfigSIB1->searchSpaceZero;
|
||||||
|
|
||||||
|
mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2;
|
||||||
|
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message,
|
||||||
|
NULL,
|
||||||
|
(void *) mib,
|
||||||
|
carrier->MIB,
|
||||||
|
24);
|
||||||
|
LOG_D(NR_RRC, "Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n", frameP, sfn_msb, carrier->MIB,
|
||||||
|
enc_rval.encoded);
|
||||||
|
buffer_pP[0] = carrier->MIB[0];
|
||||||
|
buffer_pP[1] = carrier->MIB[1];
|
||||||
|
buffer_pP[2] = carrier->MIB[2];
|
||||||
|
LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1],
|
||||||
|
buffer_pP[2]);
|
||||||
|
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
||||||
|
enc_rval.failed_type->name, enc_rval.encoded);
|
||||||
|
return (3);
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO BCCH SIB1 SIBs */
|
/* TODO BCCH SIB1 SIBs */
|
||||||
if ((Srb_id & RAB_OFFSET ) == BCCH) {
|
if ((Srb_id & RAB_OFFSET ) == BCCH) {
|
||||||
memcpy(&buffer_pP[0],
|
memcpy(&buffer_pP[0],
|
||||||
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS,
|
RC.nrrrc[Mod_idP]->carrier.SIB1,
|
||||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS);
|
RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1);
|
||||||
|
|
||||||
|
return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CCCH */
|
/* CCCH */
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
#include "NR_SDAP-Config.h"
|
#include "NR_SDAP-Config.h"
|
||||||
#include "NR_RRCReconfigurationComplete.h"
|
#include "NR_RRCReconfigurationComplete.h"
|
||||||
#include "NR_RRCReconfigurationComplete-IEs.h"
|
#include "NR_RRCReconfigurationComplete-IEs.h"
|
||||||
|
#include "PHY/defs_nr_common.h"
|
||||||
#if defined(NR_Rel16)
|
#if defined(NR_Rel16)
|
||||||
#include "NR_SCS-SpecificCarrier.h"
|
#include "NR_SCS-SpecificCarrier.h"
|
||||||
#include "NR_TDD-UL-DL-ConfigCommon.h"
|
#include "NR_TDD-UL-DL-ConfigCommon.h"
|
||||||
@@ -226,12 +227,19 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
|
|||||||
mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits
|
mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits
|
||||||
|
|
||||||
mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15;
|
mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables
|
* The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables
|
||||||
* the reverse allocation is in nr_ue_decode_mib()
|
* the reverse allocation is in nr_ue_decode_mib()
|
||||||
*/
|
*/
|
||||||
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
if(rrc->carrier.pdcch_ConfigSIB1) {
|
||||||
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero;
|
||||||
|
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero;
|
||||||
|
} else {
|
||||||
|
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
||||||
|
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
||||||
|
}
|
||||||
|
|
||||||
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
||||||
switch (*scc->ssbSubcarrierSpacing) {
|
switch (*scc->ssbSubcarrierSpacing) {
|
||||||
case NR_SubcarrierSpacing_kHz15:
|
case NR_SubcarrierSpacing_kHz15:
|
||||||
@@ -297,27 +305,28 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
asn_enc_rval_t enc_rval;
|
asn_enc_rval_t enc_rval;
|
||||||
|
|
||||||
// TODO : Add support for more than one PLMN
|
// TODO : Add support for more than one PLMN
|
||||||
//int num_plmn = configuration->num_plmn;
|
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
|
||||||
int num_plmn = 1;
|
|
||||||
struct NR_PLMN_Identity nr_plmn[num_plmn];
|
struct NR_PLMN_Identity nr_plmn[num_plmn];
|
||||||
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
|
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
|
||||||
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
|
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
|
||||||
memset(nr_plmn,0,sizeof(nr_plmn));
|
memset(nr_plmn,0,sizeof(nr_plmn));
|
||||||
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
|
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
|
||||||
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
|
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
|
||||||
|
|
||||||
// struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet;
|
|
||||||
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||||
carrier->siblock1 = sib1_message;
|
carrier->siblock1 = sib1_message;
|
||||||
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
|
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
|
||||||
sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
||||||
sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
|
sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
|
||||||
sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1));
|
sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1));
|
||||||
|
|
||||||
struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
|
struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||||
|
|
||||||
|
// cellSelectionInfo
|
||||||
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
||||||
sib1->cellSelectionInfo->q_RxLevMin = -50;
|
sib1->cellSelectionInfo->q_RxLevMin = -50;
|
||||||
|
|
||||||
|
// cellAccessRelatedInfo
|
||||||
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
|
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
|
||||||
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
|
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
|
||||||
for (int i = 0; i < num_plmn; ++i) {
|
for (int i = 0; i < num_plmn; ++i) {
|
||||||
@@ -329,44 +338,133 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]);
|
||||||
nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
|
if(configuration->mnc_digit_length[i] == 3) nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
|
||||||
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
|
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
|
||||||
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
|
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
|
||||||
nr_plmn[i].mnc.list.size=0;
|
nr_plmn[i].mnc.list.size=0;
|
||||||
nr_plmn[i].mnc.list.count=0;
|
nr_plmn[i].mnc.list.count=0;
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
|
if(configuration->mnc_digit_length[i] == 3) ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
|
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
|
||||||
}//end plmn loop
|
}//end plmn loop
|
||||||
|
|
||||||
nr_plmn_info->cellIdentity.buf = CALLOC(1,8);
|
nr_plmn_info->cellIdentity.buf = CALLOC(1,5);
|
||||||
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
|
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 28) & 0xff;
|
||||||
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
|
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 20) & 0xff;
|
||||||
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
|
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 12) & 0xff;
|
||||||
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
|
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity >> 4) & 0xff;
|
||||||
nr_plmn_info->cellIdentity.size= 4;
|
nr_plmn_info->cellIdentity.buf[4]= (configuration->cell_identity << 4) & 0xff;
|
||||||
|
nr_plmn_info->cellIdentity.size= 5;
|
||||||
nr_plmn_info->cellIdentity.bits_unused= 4;
|
nr_plmn_info->cellIdentity.bits_unused= 4;
|
||||||
nr_plmn_info->cellReservedForOperatorUse = 0;
|
nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_reserved;
|
||||||
|
|
||||||
|
nr_plmn_info->trackingAreaCode = CALLOC(1,sizeof(NR_TrackingAreaCode_t));
|
||||||
|
nr_plmn_info->trackingAreaCode->buf = CALLOC(1,3);
|
||||||
|
nr_plmn_info->trackingAreaCode->buf[0] = ( ((uint32_t)configuration->tac) >> 16) & 0xff;
|
||||||
|
nr_plmn_info->trackingAreaCode->buf[1] = ( ((uint32_t)configuration->tac) >> 8) & 0xff;
|
||||||
|
nr_plmn_info->trackingAreaCode->buf[2] = ( ((uint32_t)configuration->tac) >> 0) & 0xff;
|
||||||
|
nr_plmn_info->trackingAreaCode->size = 3;
|
||||||
|
nr_plmn_info->trackingAreaCode->bits_unused = 0;
|
||||||
|
|
||||||
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
|
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
|
||||||
#if 0
|
|
||||||
sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
|
// connEstFailureControl
|
||||||
memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo));
|
// TODO: add connEstFailureControl
|
||||||
nr_uac_BarringInfoSet.uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95;
|
|
||||||
nr_uac_BarringInfoSet.uac_BarringTime = NR_UAC_BarringInfoSet__uac_BarringTime_s4;
|
//si-SchedulingInfo
|
||||||
nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.buf = MALLOC(1);
|
/*sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo));
|
||||||
memset(nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.buf,0,1);
|
asn_set_empty(&sib1->si_SchedulingInfo->schedulingInfoList.list);
|
||||||
nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.size = 1;
|
sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s20;
|
||||||
nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.bits_unused = 1;
|
struct NR_SchedulingInfo *schedulingInfo = CALLOC(1,sizeof(struct NR_SchedulingInfo));
|
||||||
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet);
|
schedulingInfo->si_BroadcastStatus = NR_SchedulingInfo__si_BroadcastStatus_broadcasting;
|
||||||
#endif
|
schedulingInfo->si_Periodicity = NR_SchedulingInfo__si_Periodicity_rf8;
|
||||||
//encode SIB1 to data
|
asn_set_empty(&schedulingInfo->sib_MappingInfo.list);
|
||||||
carrier->SIB1=(uint8_t *) malloc16(128);
|
e_NR_SIB_TypeInfo__type *sib_type = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
|
||||||
|
*sib_type = NR_SIB_TypeInfo__type_sibType3;
|
||||||
|
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type);
|
||||||
|
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/
|
||||||
|
|
||||||
|
// servingCellConfigCommon
|
||||||
|
sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB));
|
||||||
|
|
||||||
|
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list);
|
||||||
|
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list);
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.cyclicPrefix = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix;
|
||||||
|
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) {
|
||||||
|
struct NR_NR_MultiBandInfo *nrMultiBandInfo = CALLOC(1,sizeof(struct NR_NR_MultiBandInfo));
|
||||||
|
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
|
||||||
|
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo);
|
||||||
|
}
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||||
|
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) {
|
||||||
|
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
|
||||||
|
}
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle = 0;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_oneT;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_four;
|
||||||
|
|
||||||
|
sib1->servingCellConfigCommon->uplinkConfigCommon = CALLOC(1,sizeof(struct NR_UplinkConfigCommonSIB));
|
||||||
|
asn_set_empty(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list);
|
||||||
|
for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) {
|
||||||
|
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list,configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
|
||||||
|
}
|
||||||
|
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||||
|
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon;
|
||||||
|
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
|
||||||
|
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon;
|
||||||
|
|
||||||
|
sib1->servingCellConfigCommon->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset;
|
||||||
|
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap;
|
||||||
|
sib1->servingCellConfigCommon->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell;
|
||||||
|
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon));
|
||||||
|
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||||
|
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
||||||
|
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2;
|
||||||
|
sib1->servingCellConfigCommon->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower;
|
||||||
|
|
||||||
|
// ims-EmergencySupport
|
||||||
|
// TODO: add ims-EmergencySupport
|
||||||
|
|
||||||
|
// eCallOverIMS-Support
|
||||||
|
// TODO: add eCallOverIMS-Support
|
||||||
|
|
||||||
|
// ue-TimersAndConstants
|
||||||
|
// TODO: add ue-TimersAndConstants
|
||||||
|
|
||||||
|
// uac-BarringInfo
|
||||||
|
/*sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
|
||||||
|
NR_UAC_BarringInfoSet_t *nr_uac_BarringInfoSet = CALLOC(1, sizeof(NR_UAC_BarringInfoSet_t));
|
||||||
|
asn_set_empty(&sib1->uac_BarringInfo->uac_BarringInfoSetList);
|
||||||
|
nr_uac_BarringInfoSet->uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95;
|
||||||
|
nr_uac_BarringInfoSet->uac_BarringTime = NR_UAC_BarringInfoSet__uac_BarringTime_s4;
|
||||||
|
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.buf = CALLOC(1, 1);
|
||||||
|
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.size = 1;
|
||||||
|
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.bits_unused = 1;
|
||||||
|
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, nr_uac_BarringInfoSet);*/
|
||||||
|
|
||||||
|
// useFullResumeID
|
||||||
|
// TODO: add useFullResumeID
|
||||||
|
|
||||||
|
// lateNonCriticalExtension
|
||||||
|
// TODO: add lateNonCriticalExtension
|
||||||
|
|
||||||
|
// nonCriticalExtension
|
||||||
|
// TODO: add nonCriticalExtension
|
||||||
|
|
||||||
|
xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1_message->message.choice.c1->choice.systemInformationBlockType1);
|
||||||
|
|
||||||
|
if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(NR_MAX_SIB_LENGTH/8);
|
||||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
|
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||||
NULL,
|
NULL,
|
||||||
(void *)sib1_message,
|
(void *)sib1_message,
|
||||||
carrier->SIB1,
|
carrier->SIB1,
|
||||||
128);
|
NR_MAX_SIB_LENGTH/8);
|
||||||
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
||||||
enc_rval.failed_type->name, enc_rval.encoded);
|
enc_rval.failed_type->name, enc_rval.encoded);
|
||||||
|
|
||||||
|
|||||||
@@ -403,6 +403,7 @@ typedef struct {
|
|||||||
int pucch_TargetSNRx10;
|
int pucch_TargetSNRx10;
|
||||||
NR_BCCH_DL_SCH_Message_t *siblock1;
|
NR_BCCH_DL_SCH_Message_t *siblock1;
|
||||||
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
|
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
|
||||||
|
NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1;
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
|
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
|
||||||
NR_SRB_INFO SI;
|
NR_SRB_INFO SI;
|
||||||
NR_SRB_INFO Srb0;
|
NR_SRB_INFO Srb0;
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
|||||||
|
|
||||||
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti);
|
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti);
|
||||||
|
|
||||||
|
void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon);
|
||||||
|
|
||||||
|
void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon);
|
||||||
|
|
||||||
|
void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0);
|
||||||
|
|
||||||
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||||
int scg_id,
|
int scg_id,
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
|
|||||||
(NR_CellGroupConfig_t *)NULL
|
(NR_CellGroupConfig_t *)NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
|
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa > 0) {
|
||||||
// This is for phytest only, emulate first X2 message if uecap.raw file is present
|
// This is for phytest only, emulate first X2 message if uecap.raw file is present
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
fd = fopen("uecap.raw","r");
|
fd = fopen("uecap.raw","r");
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
|||||||
total_size = (enc_rval.encoded+7)>>3;
|
total_size = (enc_rval.encoded+7)>>3;
|
||||||
|
|
||||||
FILE *fd; // file to be generated for nr-ue
|
FILE *fd; // file to be generated for nr-ue
|
||||||
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) {
|
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa == 1) {
|
||||||
// This is for phytest only, emulate first X2 message if uecap.raw file is present
|
// This is for phytest only, emulate first X2 message if uecap.raw file is present
|
||||||
LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
|
LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
|
||||||
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
|
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
|
||||||
@@ -108,8 +108,8 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
|||||||
fd = fopen("reconfig.raw","w");
|
fd = fopen("reconfig.raw","w");
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
|
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
|
||||||
|
fclose(fd);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024);
|
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024);
|
||||||
@@ -123,7 +123,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) {
|
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa == 1) {
|
||||||
|
|
||||||
LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
|
LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
|
||||||
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
|
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
|
||||||
@@ -134,8 +134,8 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
|||||||
fd = fopen("rbconfig.raw","w");
|
fd = fopen("rbconfig.raw","w");
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
|
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
|
||||||
|
fclose(fd);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
total_size = total_size + ((enc_rval.encoded+7)>>3);
|
total_size = total_size + ((enc_rval.encoded+7)>>3);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
|||||||
NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
|
NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
|
||||||
ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
|
ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
|
||||||
carrier->initial_csi_index[rrc->Nb_ue] = 0;
|
carrier->initial_csi_index[rrc->Nb_ue] = 0;
|
||||||
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1){
|
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){
|
||||||
ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
|
ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
|
||||||
fill_default_rbconfig(ue_context_p->ue_context.rb_config);
|
fill_default_rbconfig(ue_context_p->ue_context.rb_config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,99 @@
|
|||||||
#define false 0
|
#define false 0
|
||||||
#define true 1
|
#define true 1
|
||||||
|
|
||||||
|
void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon) {
|
||||||
|
|
||||||
|
bwp->bwp_Id = 0;
|
||||||
|
|
||||||
|
bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common));
|
||||||
|
memcpy((void*)&bwp->bwp_Common,
|
||||||
|
&servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP,
|
||||||
|
sizeof(bwp->bwp_Common));
|
||||||
|
|
||||||
|
bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated));
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config));
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup));
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA));
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
|
||||||
|
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
|
||||||
|
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon) {
|
||||||
|
|
||||||
|
coreset0->controlResourceSetId = 0;
|
||||||
|
|
||||||
|
// frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B,
|
||||||
|
if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||||
|
coreset0->frequencyDomainResources.buf[0] = 0xff;
|
||||||
|
coreset0->frequencyDomainResources.buf[1] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[2] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[3] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[4] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[5] = 0;
|
||||||
|
coreset0->frequencyDomainResources.size = 6;
|
||||||
|
coreset0->frequencyDomainResources.bits_unused = 3;
|
||||||
|
coreset0->duration = 1;
|
||||||
|
coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved));
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6;
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = servingcellconfigcommon->physCellId;
|
||||||
|
coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||||
|
|
||||||
|
if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList));
|
||||||
|
|
||||||
|
NR_TCI_StateId_t *tci[8];
|
||||||
|
for (int i=0;i<8;i++) {
|
||||||
|
tci[i]=calloc(1,sizeof(*tci[i]));
|
||||||
|
*tci[i] = i;
|
||||||
|
ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
|
||||||
|
}
|
||||||
|
coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||||
|
coreset0->tci_PresentInDCI = NULL;
|
||||||
|
coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) {
|
||||||
|
|
||||||
|
if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId=calloc(1,sizeof(*ss0->controlResourceSetId));
|
||||||
|
if(ss0->monitoringSymbolsWithinSlot == NULL) ss0->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss0->monitoringSymbolsWithinSlot));
|
||||||
|
if(ss0->monitoringSymbolsWithinSlot->buf == NULL) ss0->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||||
|
if(ss0->nrofCandidates == NULL) ss0->nrofCandidates = calloc(1,sizeof(*ss0->nrofCandidates));
|
||||||
|
if(ss0->searchSpaceType == NULL) ss0->searchSpaceType = calloc(1,sizeof(*ss0->searchSpaceType));
|
||||||
|
if(ss0->searchSpaceType->choice.common == NULL) ss0->searchSpaceType->choice.common=calloc(1,sizeof(*ss0->searchSpaceType->choice.common));
|
||||||
|
if(ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||||
|
|
||||||
|
ss0->searchSpaceId = 0;
|
||||||
|
*ss0->controlResourceSetId = 0;
|
||||||
|
ss0->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss0->monitoringSlotPeriodicityAndOffset));
|
||||||
|
ss0->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
|
||||||
|
ss0->duration=NULL;
|
||||||
|
|
||||||
|
// should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed
|
||||||
|
ss0->monitoringSymbolsWithinSlot->buf[1] = 0;
|
||||||
|
ss0->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6);
|
||||||
|
ss0->monitoringSymbolsWithinSlot->size = 2;
|
||||||
|
ss0->monitoringSymbolsWithinSlot->bits_unused = 2;
|
||||||
|
|
||||||
|
// FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1
|
||||||
|
ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||||
|
ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||||
|
ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0;
|
||||||
|
ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1;
|
||||||
|
ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||||
|
|
||||||
|
ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||||
|
}
|
||||||
|
|
||||||
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||||
@@ -457,7 +550,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
|||||||
ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss);
|
ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss);
|
||||||
|
|
||||||
|
|
||||||
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=NULL;
|
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1));
|
||||||
|
*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0;
|
||||||
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL;
|
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL;
|
||||||
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL;
|
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL;
|
||||||
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace));
|
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace));
|
||||||
|
|||||||
@@ -46,16 +46,17 @@ nr_mac_rrc_data_ind_ue(
|
|||||||
const sdu_size_t pdu_len){
|
const sdu_size_t pdu_len){
|
||||||
|
|
||||||
switch(channel){
|
switch(channel){
|
||||||
case NR_BCCH_BCH:
|
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");
|
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;
|
break;
|
||||||
default:
|
case NR_BCCH_DL_SCH:
|
||||||
break;
|
AssertFatal( nr_rrc_ue_decode_NR_SIB1_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-DLSCH error!\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
|
int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
|
|||||||
RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations);
|
RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) {
|
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1 || get_softmodem_params()->sa == 1) {
|
||||||
// read in files for RRCReconfiguration and RBconfig
|
// read in files for RRCReconfiguration and RBconfig
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
@@ -1477,6 +1477,39 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*brief decode SIB1 message*/
|
||||||
|
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||||
|
|
||||||
|
NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
|
||||||
|
|
||||||
|
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
|
||||||
|
&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||||
|
(void **)&bcch_message,
|
||||||
|
(const void *)bufferP,
|
||||||
|
buffer_len);
|
||||||
|
|
||||||
|
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
|
||||||
|
LOG_D(RRC,"NR_BCCH_DL_SCH decode error\n");
|
||||||
|
SEQUENCE_free( &asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index];
|
||||||
|
if(sib1 != NULL){
|
||||||
|
SEQUENCE_free(&asn_DEF_NR_BCCH_BCH_Message, (void *)sib1, 1 );
|
||||||
|
}
|
||||||
|
sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||||
|
if (*(int64_t*)sib1 != 1) {
|
||||||
|
LOG_D(RRC, "SIB1 address: %lx\n", *(int64_t*)sib1);
|
||||||
|
xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LOG_E(PHY, "sib1 is starting by 8 times 0\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// from NR SRB3
|
// from NR SRB3
|
||||||
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
|
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include "NR_asn_constant.h"
|
#include "NR_asn_constant.h"
|
||||||
#include "NR_SchedulingRequestToAddMod.h"
|
#include "NR_SchedulingRequestToAddMod.h"
|
||||||
#include "NR_MIB.h"
|
#include "NR_MIB.h"
|
||||||
|
#include "NR_SIB1.h"
|
||||||
#include "NR_BCCH-BCH-Message.h"
|
#include "NR_BCCH-BCH-Message.h"
|
||||||
#include "NR_DL-DCCH-Message.h"
|
#include "NR_DL-DCCH-Message.h"
|
||||||
#include "../NR/nr_rrc_defs.h"
|
#include "../NR/nr_rrc_defs.h"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user