Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangjie
OpenXG-RAN
Commits
97f4ec96
Commit
97f4ec96
authored
Mar 26, 2019
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
desparate to get the get_band function to work for all targets
parent
dea31257
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
167 additions
and
161 deletions
+167
-161
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+15
-44
openair2/LAYER2/NR_MAC_gNB/config.c
openair2/LAYER2/NR_MAC_gNB/config.c
+0
-117
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+4
-0
openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c
openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c
+148
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
97f4ec96
...
@@ -167,7 +167,7 @@ endif()
...
@@ -167,7 +167,7 @@ endif()
#
#
set
(
CMAKE_C_FLAGS
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
C_FLAGS_PROCESSOR
}
-std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC
"
)
"
${
CMAKE_C_FLAGS
}
${
C_FLAGS_PROCESSOR
}
-std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC"
)
# add autotools definitions that were maybe used!
# add autotools definitions that were maybe used!
set
(
MKVER
"'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
)
set
(
MKVER
"'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
)
set
(
CMAKE_C_FLAGS
set
(
CMAKE_C_FLAGS
...
@@ -1575,6 +1575,7 @@ add_library(L2
...
@@ -1575,6 +1575,7 @@ add_library(L2
${
ENB_APP_SRC
}
${
ENB_APP_SRC
}
)
)
add_dependencies
(
L2 rrc_flag s1ap_flag x2_flag
)
add_dependencies
(
L2 rrc_flag s1ap_flag x2_flag
)
add_library
(
MAC_NR
add_library
(
MAC_NR
${
MAC_NR_SRC
}
${
MAC_NR_SRC
}
)
)
...
@@ -1593,7 +1594,6 @@ add_dependencies(S1AP_LIB nr_rrc_flag s1ap_flag)
...
@@ -1593,7 +1594,6 @@ add_dependencies(S1AP_LIB nr_rrc_flag s1ap_flag)
add_library
(
L2_UE
add_library
(
L2_UE
${
L2_SRC_UE
}
${
L2_SRC_UE
}
${
MAC_SRC_UE
}
${
MAC_SRC_UE
}
#${MAC_NR_SRC_UE}
)
)
if
(
NOT
${
NOS1
}
)
if
(
NOT
${
NOS1
}
)
target_compile_definitions
(
L2_UE PUBLIC -DPDCP_USE_NETLINK
)
target_compile_definitions
(
L2_UE PUBLIC -DPDCP_USE_NETLINK
)
...
@@ -1602,44 +1602,13 @@ endif()
...
@@ -1602,44 +1602,13 @@ endif()
add_dependencies
(
L2_UE rrc_flag s1ap_flag x2_flag
)
add_dependencies
(
L2_UE rrc_flag s1ap_flag x2_flag
)
add_library
(
NR_L2_UE
add_library
(
NR_L2_UE
#${L2_SRC_UE}
${
NR_L2_SRC_UE
}
${
NR_L2_SRC_UE
}
${
MAC_NR_SRC_UE
}
${
MAC_NR_SRC_UE
}
#${MAC_SRC_UE}
)
)
add_library
(
MAC_NR_COMMON
set
(
NR_LTE_UE_REUSE_SRC
${
OPENAIR2_DIR
}
/LAYER2/NR_MAC_gNB/nr_mac_common.c
${
OPENAIR1_DIR
}
/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
)
${
OPENAIR1_DIR
}
/SCHED/phy_procedures_lte_common.c
#${OPENAIR1_DIR}/SCHED_UE/phy_procedures_lte_ue.c
${
OPENAIR1_DIR
}
/PHY/LTE_TRANSPORT/lte_mcs.c
#${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch_common.c
#${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
#${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
#${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach_common.c
# ${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c
${
OPENAIR1_DIR
}
/PHY/CODING/crc_byte.c
${
OPENAIR1_DIR
}
/PHY/CODING/viterbi_lte.c
${
OPENAIR1_DIR
}
/PHY/CODING/viterbi.c
#${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich_common.c
${
OPENAIR1_DIR
}
/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c
# ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
# ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${
OPENAIR1_DIR
}
/PHY/CODING/ccoding_byte_lte.c
${
OPENAIR1_DIR
}
/PHY/CODING/ccoding_byte.c
${
OPENAIR1_DIR
}
/PHY/LTE_REFSIG/lte_gold.c
${
OPENAIR1_DIR
}
/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
${
OPENAIR1_DIR
}
/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
${
OPENAIR1_DIR
}
/PHY/LTE_ESTIMATION/lte_ue_measurements.c
#${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
#${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
)
add_library
(
NR_LTE_UE_REUSE_LIB
${
NR_LTE_UE_REUSE_SRC
}
)
include_directories
(
"
${
OPENAIR2_DIR
}
/NR_UE_PHY_INTERFACE"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/NR_UE_PHY_INTERFACE"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/LAYER2/NR_MAC_UE"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/LAYER2/NR_MAC_UE"
)
...
@@ -2368,7 +2337,7 @@ target_link_libraries (nr-softmodem
...
@@ -2368,7 +2337,7 @@ target_link_libraries (nr-softmodem
-Wl,--start-group
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
FLEXRAN_AGENT_LIB
}
LFDS7
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
FLEXRAN_AGENT_LIB
}
LFDS7
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2 L2_NR
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2 L2_NR
MAC_NR_COMMON
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl
)
-Wl,--end-group z dl
)
...
@@ -2409,7 +2378,7 @@ target_link_libraries (nr-softmodem-nos1
...
@@ -2409,7 +2378,7 @@ target_link_libraries (nr-softmodem-nos1
-Wl,--start-group
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
FLEXRAN_AGENT_LIB
}
LFDS7
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
MIH_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
FLEXRAN_AGENT_LIB
}
LFDS7
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
MIH_LIB
}
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2 L2_NR
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2 L2_NR
MAC_NR_COMMON
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl
)
-Wl,--end-group z dl
)
...
@@ -2444,7 +2413,7 @@ add_executable(nr-uesoftmodem
...
@@ -2444,7 +2413,7 @@ add_executable(nr-uesoftmodem
target_link_libraries
(
nr-uesoftmodem
target_link_libraries
(
nr-uesoftmodem
-Wl,--start-group
-Wl,--start-group
RRC_LIB NR_RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_UE PHY_RU LFDS NR_L2_UE
#NR_LTE_UE_REUSE_LIB
RRC_LIB NR_RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_UE PHY_RU LFDS NR_L2_UE
MAC_NR_COMMON
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
LFDS7
${
ATLAS_LIBRARIES
}
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
LFDS7
${
ATLAS_LIBRARIES
}
-Wl,--end-group z dl
)
-Wl,--end-group z dl
)
...
@@ -2478,7 +2447,7 @@ add_executable(nr-uesoftmodem-nos1
...
@@ -2478,7 +2447,7 @@ add_executable(nr-uesoftmodem-nos1
target_link_libraries
(
nr-uesoftmodem-nos1
target_link_libraries
(
nr-uesoftmodem-nos1
-Wl,--start-group
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_UE PHY_UE PHY_RU LFDS NR_L2_UE
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_UE PHY_UE PHY_RU LFDS NR_L2_UE
MAC_NR_COMMON
${
MSC_LIB
}
${
RAL_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
LFDS7
${
ATLAS_LIBRARIES
}
${
MSC_LIB
}
${
RAL_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
LFDS7
${
ATLAS_LIBRARIES
}
-Wl,--end-group z dl
)
-Wl,--end-group z dl
)
...
@@ -2555,7 +2524,7 @@ add_executable(nr_dlsim
...
@@ -2555,7 +2524,7 @@ add_executable(nr_dlsim
${
OPENAIR1_DIR
}
/SIMULATION/NR_PHY/dlsim.c
${
OPENAIR1_DIR
}
/SIMULATION/NR_PHY/dlsim.c
${
OPENAIR_DIR
}
/common/utils/backtrace.c
${
OPENAIR_DIR
}
/common/utils/backtrace.c
${
T_SOURCE
}
)
${
T_SOURCE
}
)
target_link_libraries
(
nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread
${
ATLAS_LIBRARIES
}
${
T_LIB
}
dl
)
target_link_libraries
(
nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR
MAC_NR_COMMON
RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread
${
ATLAS_LIBRARIES
}
${
T_LIB
}
dl
)
foreach
(
myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim
)
foreach
(
myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim
)
...
@@ -2688,7 +2657,9 @@ L2
...
@@ -2688,7 +2657,9 @@ L2
L2_NR
L2_NR
L2_UE
L2_UE
NR_L2_UE
NR_L2_UE
NR_LTE_UE_REUSE_LIB
MAC_NR_COMMON
MAC_NR
MAC_UE_NR
CN_UTILS
CN_UTILS
GTPV1U
GTPV1U
SCTP_CLIENT
SCTP_CLIENT
...
...
openair2/LAYER2/NR_MAC_gNB/config.c
View file @
97f4ec96
...
@@ -49,123 +49,6 @@ extern RAN_CONTEXT_t RC;
...
@@ -49,123 +49,6 @@ extern RAN_CONTEXT_t RC;
extern
void
mac_top_init_gNB
(
void
);
extern
void
mac_top_init_gNB
(
void
);
extern
uint8_t
nfapi_mode
;
extern
uint8_t
nfapi_mode
;
//int32_t **rxdata;
//int32_t **txdata;
nr_bandentry_t
nr_bandtable
[]
=
{
{
1
,
1920000
,
1980000
,
2110000
,
2170000
,
20
,
422000
},
{
2
,
1850000
,
1910000
,
1930000
,
1990000
,
20
,
386000
},
{
3
,
1710000
,
1785000
,
1805000
,
1880000
,
20
,
361000
},
{
5
,
824000
,
849000
,
869000
,
894000
,
20
,
173800
},
{
7
,
2500000
,
2570000
,
2620000
,
2690000
,
20
,
524000
},
{
8
,
880000
,
915000
,
925000
,
960000
,
20
,
185000
},
{
12
,
698000
,
716000
,
728000
,
746000
,
20
,
145800
},
{
20
,
832000
,
862000
,
791000
,
821000
,
20
,
158200
},
{
25
,
1850000
,
1915000
,
1930000
,
1995000
,
20
,
386000
},
{
28
,
703000
,
758000
,
758000
,
813000
,
20
,
151600
},
{
34
,
2010000
,
2025000
,
2010000
,
2025000
,
20
,
402000
},
{
38
,
2570000
,
2620000
,
2570000
,
2630000
,
20
,
514000
},
{
39
,
1880000
,
1920000
,
1880000
,
1920000
,
20
,
376000
},
{
40
,
2300000
,
2400000
,
2300000
,
2400000
,
20
,
460000
},
{
41
,
2496000
,
2690000
,
2496000
,
2690000
,
3
,
499200
},
{
50
,
1432000
,
1517000
,
1432000
,
1517000
,
20
,
286400
},
{
51
,
1427000
,
1432000
,
1427000
,
1432000
,
20
,
285400
},
{
66
,
1710000
,
1780000
,
2110000
,
2200000
,
20
,
422000
},
{
70
,
1695000
,
1710000
,
1995000
,
2020000
,
20
,
399000
},
{
71
,
663000
,
698000
,
617000
,
652000
,
20
,
123400
},
{
74
,
1427000
,
1470000
,
1475000
,
1518000
,
20
,
295000
},
{
75
,
000
,
000
,
1432000
,
1517000
,
20
,
286400
},
{
76
,
000
,
000
,
1427000
,
1432000
,
20
,
285400
},
{
77
,
3300000
,
4200000
,
3300000
,
4200000
,
1
,
620000
},
{
78
,
3300000
,
3800000
,
3300000
,
3800000
,
1
,
620000
},
{
79
,
4400000
,
5000000
,
4400000
,
5000000
,
2
,
693334
},
{
80
,
1710000
,
1785000
,
000
,
000
,
20
,
342000
},
{
81
,
860000
,
915000
,
000
,
000
,
20
,
176000
},
{
82
,
832000
,
862000
,
000
,
000
,
20
,
166400
},
{
83
,
703000
,
748000
,
000
,
000
,
20
,
140600
},
{
84
,
1920000
,
1980000
,
000
,
000
,
20
,
384000
},
{
86
,
1710000
,
1785000
,
000
,
000
,
20
,
342000
}
};
void
get_band
(
uint32_t
downlink_frequency
,
uint8_t
*
current_band
,
int32_t
*
current_offset
,
lte_frame_type_t
*
current_type
)
{
int
ind
;
int64_t
dl_freq_khz
=
downlink_frequency
/
1000
;
for
(
ind
=
0
;
ind
<
sizeof
(
nr_bandtable
)
/
sizeof
(
nr_bandtable
[
0
]);
ind
++
)
{
*
current_band
=
nr_bandtable
[
ind
].
band
;
LOG_I
(
PHY
,
"Scanning band %d, dl_min %"
PRIu64
", ul_min %"
PRIu64
"
\n
"
,
ind
,
nr_bandtable
[
ind
].
dl_min
,
nr_bandtable
[
ind
].
ul_min
);
if
(
nr_bandtable
[
ind
].
dl_min
<=
dl_freq_khz
&&
nr_bandtable
[
ind
].
dl_max
>=
dl_freq_khz
)
{
*
current_offset
=
(
nr_bandtable
[
ind
].
ul_min
-
nr_bandtable
[
ind
].
dl_min
)
*
1000
;
if
(
*
current_offset
==
0
)
*
current_type
=
TDD
;
else
*
current_type
=
FDD
;
LOG_I
(
PHY
,
"DL frequency %"
PRIu32
": band %d, frame_type %d, UL frequency %"
PRIu32
"
\n
"
,
downlink_frequency
,
*
current_band
,
*
current_type
,
downlink_frequency
+*
current_offset
);
break
;
}
}
AssertFatal
(
ind
!=
(
sizeof
(
nr_bandtable
)
/
sizeof
(
nr_bandtable
[
0
])),
"Can't find EUTRA band for frequency %d
\n
"
,
downlink_frequency
);
}
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint32_t
bw
)
{
uint64_t
dl_CarrierFreq_by_1k
=
dl_CarrierFreq
/
1000
;
int
bw_kHz
=
bw
/
1000
;
int
i
;
LOG_I
(
MAC
,
"Searching for nr band %d DL Carrier frequency %llu bw %u
\n
"
,
nr_bandP
,(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
);
AssertFatal
(
nr_bandP
<
86
,
"nr_band %d > 86
\n
"
,
nr_bandP
);
for
(
i
=
0
;
i
<
30
&&
nr_bandtable
[
i
].
band
!=
nr_bandP
;
i
++
);
AssertFatal
(
dl_CarrierFreq_by_1k
>=
nr_bandtable
[
i
].
dl_min
,
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu
\n
"
,
nr_bandP
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)
nr_bandtable
[
i
].
dl_min
);
AssertFatal
(
dl_CarrierFreq_by_1k
<=
(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
),
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu
\n
"
,
nr_bandP
,
(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
));
int
deltaFglobal
;
if
(
dl_CarrierFreq
<
3e9
)
deltaFglobal
=
5
;
else
deltaFglobal
=
15
;
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
return
(((
dl_CarrierFreq_by_1k
-
nr_bandtable
[
i
].
dl_min
)
/
deltaFglobal
)
+
nr_bandtable
[
i
].
N_OFFs_DL
);
}
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint32_t
dl_nrarfcn
)
{
int
i
;
int
deltaFglobal
;
if
(
nr_bandP
<
77
||
nr_bandP
>
79
)
deltaFglobal
=
5
;
else
deltaFglobal
=
15
;
AssertFatal
(
nr_bandP
<
87
,
"nr_band %d > 86
\n
"
,
nr_bandP
);
for
(
i
=
0
;
i
<
31
&&
nr_bandtable
[
i
].
band
!=
nr_bandP
;
i
++
);
AssertFatal
(
dl_nrarfcn
>=
nr_bandtable
[
i
].
N_OFFs_DL
,
"dl_nrarfcn %u < N_OFFs_DL %llu
\n
"
,
dl_nrarfcn
,
(
long
long
unsigned
int
)
nr_bandtable
[
i
].
N_OFFs_DL
);
return
1000
*
(
nr_bandtable
[
i
].
dl_min
+
(
dl_nrarfcn
-
nr_bandtable
[
i
].
N_OFFs_DL
)
*
deltaFglobal
);
}
void
config_nr_mib
(
int
Mod_idP
,
void
config_nr_mib
(
int
Mod_idP
,
int
CC_idP
,
int
CC_idP
,
...
...
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
97f4ec96
...
@@ -104,4 +104,8 @@ int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
...
@@ -104,4 +104,8 @@ int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
void
get_band
(
uint32_t
downlink_frequency
,
uint8_t
*
current_band
,
int32_t
*
current_offset
,
lte_frame_type_t
*
current_type
);
void
get_band
(
uint32_t
downlink_frequency
,
uint8_t
*
current_band
,
int32_t
*
current_offset
,
lte_frame_type_t
*
current_type
);
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint32_t
dl_nrarfcn
);
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint32_t
bw
);
#endif
/*__LAYER2_NR_MAC_PROTO_H__*/
#endif
/*__LAYER2_NR_MAC_PROTO_H__*/
openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c
0 → 100644
View file @
97f4ec96
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nr_mac_common.c
* \brief Common MAC functions for NR UE and gNB
* \author Florian Kaltenberger and Raymond Knopp
* \date 2019
* \version 0.1
* \company Eurecom, NTUST
* \email: florian.kalteberger@eurecom.fr, raymond.knopp@eurecom.fr
* @ingroup _mac
*/
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
nr_bandentry_t
nr_bandtable
[]
=
{
{
1
,
1920000
,
1980000
,
2110000
,
2170000
,
20
,
422000
},
{
2
,
1850000
,
1910000
,
1930000
,
1990000
,
20
,
386000
},
{
3
,
1710000
,
1785000
,
1805000
,
1880000
,
20
,
361000
},
{
5
,
824000
,
849000
,
869000
,
894000
,
20
,
173800
},
{
7
,
2500000
,
2570000
,
2620000
,
2690000
,
20
,
524000
},
{
8
,
880000
,
915000
,
925000
,
960000
,
20
,
185000
},
{
12
,
698000
,
716000
,
728000
,
746000
,
20
,
145800
},
{
20
,
832000
,
862000
,
791000
,
821000
,
20
,
158200
},
{
25
,
1850000
,
1915000
,
1930000
,
1995000
,
20
,
386000
},
{
28
,
703000
,
758000
,
758000
,
813000
,
20
,
151600
},
{
34
,
2010000
,
2025000
,
2010000
,
2025000
,
20
,
402000
},
{
38
,
2570000
,
2620000
,
2570000
,
2630000
,
20
,
514000
},
{
39
,
1880000
,
1920000
,
1880000
,
1920000
,
20
,
376000
},
{
40
,
2300000
,
2400000
,
2300000
,
2400000
,
20
,
460000
},
{
41
,
2496000
,
2690000
,
2496000
,
2690000
,
3
,
499200
},
{
50
,
1432000
,
1517000
,
1432000
,
1517000
,
20
,
286400
},
{
51
,
1427000
,
1432000
,
1427000
,
1432000
,
20
,
285400
},
{
66
,
1710000
,
1780000
,
2110000
,
2200000
,
20
,
422000
},
{
70
,
1695000
,
1710000
,
1995000
,
2020000
,
20
,
399000
},
{
71
,
663000
,
698000
,
617000
,
652000
,
20
,
123400
},
{
74
,
1427000
,
1470000
,
1475000
,
1518000
,
20
,
295000
},
{
75
,
000
,
000
,
1432000
,
1517000
,
20
,
286400
},
{
76
,
000
,
000
,
1427000
,
1432000
,
20
,
285400
},
{
77
,
3300000
,
4200000
,
3300000
,
4200000
,
1
,
620000
},
{
78
,
3300000
,
3800000
,
3300000
,
3800000
,
1
,
620000
},
{
79
,
4400000
,
5000000
,
4400000
,
5000000
,
2
,
693334
},
{
80
,
1710000
,
1785000
,
000
,
000
,
20
,
342000
},
{
81
,
860000
,
915000
,
000
,
000
,
20
,
176000
},
{
82
,
832000
,
862000
,
000
,
000
,
20
,
166400
},
{
83
,
703000
,
748000
,
000
,
000
,
20
,
140600
},
{
84
,
1920000
,
1980000
,
000
,
000
,
20
,
384000
},
{
86
,
1710000
,
1785000
,
000
,
000
,
20
,
342000
}
};
void
get_band
(
uint32_t
downlink_frequency
,
uint8_t
*
current_band
,
int32_t
*
current_offset
,
lte_frame_type_t
*
current_type
)
{
int
ind
;
int64_t
dl_freq_khz
=
downlink_frequency
/
1000
;
for
(
ind
=
0
;
ind
<
sizeof
(
nr_bandtable
)
/
sizeof
(
nr_bandtable
[
0
]);
ind
++
)
{
*
current_band
=
nr_bandtable
[
ind
].
band
;
LOG_I
(
PHY
,
"Scanning band %d, dl_min %"
PRIu64
", ul_min %"
PRIu64
"
\n
"
,
ind
,
nr_bandtable
[
ind
].
dl_min
,
nr_bandtable
[
ind
].
ul_min
);
if
(
nr_bandtable
[
ind
].
dl_min
<=
dl_freq_khz
&&
nr_bandtable
[
ind
].
dl_max
>=
dl_freq_khz
)
{
*
current_offset
=
(
nr_bandtable
[
ind
].
ul_min
-
nr_bandtable
[
ind
].
dl_min
)
*
1000
;
if
(
*
current_offset
==
0
)
*
current_type
=
TDD
;
else
*
current_type
=
FDD
;
LOG_I
(
PHY
,
"DL frequency %"
PRIu32
": band %d, frame_type %d, UL frequency %"
PRIu32
"
\n
"
,
downlink_frequency
,
*
current_band
,
*
current_type
,
downlink_frequency
+*
current_offset
);
break
;
}
}
AssertFatal
(
ind
!=
(
sizeof
(
nr_bandtable
)
/
sizeof
(
nr_bandtable
[
0
])),
"Can't find EUTRA band for frequency %d
\n
"
,
downlink_frequency
);
}
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint32_t
bw
)
{
uint64_t
dl_CarrierFreq_by_1k
=
dl_CarrierFreq
/
1000
;
int
bw_kHz
=
bw
/
1000
;
int
i
;
LOG_I
(
MAC
,
"Searching for nr band %d DL Carrier frequency %llu bw %u
\n
"
,
nr_bandP
,(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
);
AssertFatal
(
nr_bandP
<
86
,
"nr_band %d > 86
\n
"
,
nr_bandP
);
for
(
i
=
0
;
i
<
30
&&
nr_bandtable
[
i
].
band
!=
nr_bandP
;
i
++
);
AssertFatal
(
dl_CarrierFreq_by_1k
>=
nr_bandtable
[
i
].
dl_min
,
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu
\n
"
,
nr_bandP
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)
nr_bandtable
[
i
].
dl_min
);
AssertFatal
(
dl_CarrierFreq_by_1k
<=
(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
),
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu
\n
"
,
nr_bandP
,
(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
));
int
deltaFglobal
;
if
(
dl_CarrierFreq
<
3e9
)
deltaFglobal
=
5
;
else
deltaFglobal
=
15
;
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
return
(((
dl_CarrierFreq_by_1k
-
nr_bandtable
[
i
].
dl_min
)
/
deltaFglobal
)
+
nr_bandtable
[
i
].
N_OFFs_DL
);
}
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint32_t
dl_nrarfcn
)
{
int
i
;
int
deltaFglobal
;
if
(
nr_bandP
<
77
||
nr_bandP
>
79
)
deltaFglobal
=
5
;
else
deltaFglobal
=
15
;
AssertFatal
(
nr_bandP
<
87
,
"nr_band %d > 86
\n
"
,
nr_bandP
);
for
(
i
=
0
;
i
<
31
&&
nr_bandtable
[
i
].
band
!=
nr_bandP
;
i
++
);
AssertFatal
(
dl_nrarfcn
>=
nr_bandtable
[
i
].
N_OFFs_DL
,
"dl_nrarfcn %u < N_OFFs_DL %llu
\n
"
,
dl_nrarfcn
,
(
long
long
unsigned
int
)
nr_bandtable
[
i
].
N_OFFs_DL
);
return
1000
*
(
nr_bandtable
[
i
].
dl_min
+
(
dl_nrarfcn
-
nr_bandtable
[
i
].
N_OFFs_DL
)
*
deltaFglobal
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment