# Trace the OAI source code and use figures and flowchart to describe the following questions:
:::success
**References**
- [Figures](https://hackmd.io/@ferlinda/H1rhidRTc?view)
- [openairinterface5G](https://gitlab.eurecom.fr/oai/openairinterface5g.git)
- [nr-softmodem](https://blog.csdn.net/HiWangWenBing/article/details/120790128)
- [Source code file](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/NR_SA_F1AP_5GRECORDS/executables/nr-softmodem.c)
- [5G Wikipedia](https://wiki.patras5g.eu/radio-equipment/g-node-bs)
:::
:::info
**Question List:**
1. What is GNBSParams?
2. What are the functions involved to get it?
3. How does nr-softmodem decide the mode to run?
4. What function is called first to run in OAI CU + OAI DU mode?
:::
:::success
**Goal:** Understand the how nr-softmodem decide the mode to run and what function is called first to run in OAI CU + OAI DU mode.
:::
# Background:
**GNodeBs (gNBs)** are the 5G wireless base stations that transmit and receive communications between the user equipment and the mobile network.
## Source Code Tracing
:::warning
**Questions: What is GNBSParams? What are the functions involved to get it?**
:::
#### 1. Functions
| Function Name | Location | Functions | Description |
| ------------- | -------- | ----------------- | ---------------- |
| GNBSParams | nr_softmodem.c | get number of gNBs; for gNB ID; GNBParamList| allows setting parameters to test/improve it & controls the behavior of nr-softmodem without changing the compiled code |
#### 2. Flowchart
Loading....................
# Background:
**nr-softmodem** is an executable program on the 5G NR base station side, which is an interface program for the software on the 5G NR base station side.
## Source Code Tracing
:::warning
**Questions:How does nr-softmodem decide the mode to run? What function is called first to run it in OAI CU + OAI DU mode?**
:::


#### 1. Functions
| Function Name | Location | Description |
| ------------- | -------- | ----------- |
| CONFIG & LIBCONFIG| nr_softmodem.c | sets parameters the first function's to run it OAI CU + OAI DU mode|
| Function Name | Location | Source code/libraries | Description |
| ------------- | -------- | ----------------- | ---------------- |
|GNB_APP |nr_softmodem.c|gnb_app.h;phy_scope_interface.h;nr_phy_scope.h;nr-softmodem.h|This function allows nr-softmodem to decide a mode|
:::spoiler Detail of `How does nr-softmodem decide the mode to run?`
"system.h"
<openair2/GNB_APP/gnb_app.h>
PHY/TOOLS/phy_scope_interface.h"
"PHY/TOOLS/nr_phy_scope.h"
"stats.h"
"nr-softmodem.h"
#"executables/softmodem-common.h"
"executables/thread-common.h"
"NB_IoT_interface.h"
"x2ap_eNB.h"
"ngap_gNB.h"
"gnb_paramdef.h"
<openair3/ocp-gtpu/gtp_itf.h>
"nfapi/oai_integration/vendor_ext.h"
```
:::