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
48a103ea
Commit
48a103ea
authored
Apr 03, 2019
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
parent
2df82e34
Changes
27
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
764 additions
and
3494 deletions
+764
-3494
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+3
-3
common/utils/LOG/log.c
common/utils/LOG/log.c
+284
-344
common/utils/LOG/log.h
common/utils/LOG/log.h
+179
-174
common/utils/threadPool/thread-pool.h
common/utils/threadPool/thread-pool.h
+7
-3
common/utils/utils.h
common/utils/utils.h
+16
-0
executables/nr-ue.c
executables/nr-ue.c
+47
-30
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+1
-0
openair1/PHY/NR_TRANSPORT/nr_dci_tools.c
openair1/PHY/NR_TRANSPORT/nr_dci_tools.c
+2
-2
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+4
-4
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+6
-5
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+5
-3
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+1
-1
openair1/PHY/TOOLS/cdot_prod.c
openair1/PHY/TOOLS/cdot_prod.c
+0
-116
openair1/PHY/TOOLS/tools_defs.h
openair1/PHY/TOOLS/tools_defs.h
+108
-2
openair1/PHY/defs_nr_UE.h
openair1/PHY/defs_nr_UE.h
+3
-103
openair1/PHY/thread_NR_UE.h
openair1/PHY/thread_NR_UE.h
+78
-0
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+1
-1
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+1
-1
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+2
-1
openair1/SIMULATION/NR_PHY/pbchsim.c
openair1/SIMULATION/NR_PHY/pbchsim.c
+4
-2
openair2/LAYER2/NR_MAC_UE/mac_proto.h
openair2/LAYER2/NR_MAC_UE/mac_proto.h
+2
-0
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+2
-0
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+5
-3
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h
+3
-1
targets/RT/USER/nr-ue.c
targets/RT/USER/nr-ue.c
+0
-1175
targets/RT/USER/nr-uesoftmodem.c
targets/RT/USER/nr-uesoftmodem.c
+0
-1262
targets/RT/USER/nr-uesoftmodem.h
targets/RT/USER/nr-uesoftmodem.h
+0
-258
No files found.
cmake_targets/CMakeLists.txt
View file @
48a103ea
...
@@ -2397,7 +2397,7 @@ add_executable(nr-uesoftmodem
...
@@ -2397,7 +2397,7 @@ add_executable(nr-uesoftmodem
${
s1ap_h
}
${
s1ap_h
}
# ${OPENAIR_BIN_DIR}/messages_xml.h
# ${OPENAIR_BIN_DIR}/messages_xml.h
${
OPENAIR_DIR
}
/common/utils/threadPool/thread-pool.c
${
OPENAIR_DIR
}
/common/utils/threadPool/thread-pool.c
${
OPENAIR_DIR
}
/executables/
/
nr-uesoftmodem.c
${
OPENAIR_DIR
}
/executables/nr-uesoftmodem.c
${
OPENAIR_DIR
}
/executables/nr-ue.c
${
OPENAIR_DIR
}
/executables/nr-ue.c
${
OPENAIR1_DIR
}
/SIMULATION/TOOLS/taus.c
${
OPENAIR1_DIR
}
/SIMULATION/TOOLS/taus.c
${
OPENAIR_TARGETS
}
/ARCH/COMMON/common_lib.c
${
OPENAIR_TARGETS
}
/ARCH/COMMON/common_lib.c
...
@@ -2431,8 +2431,8 @@ add_executable(nr-uesoftmodem-nos1
...
@@ -2431,8 +2431,8 @@ add_executable(nr-uesoftmodem-nos1
${
s1ap_h
}
${
s1ap_h
}
# ${OPENAIR_BIN_DIR}/messages_xml.h
# ${OPENAIR_BIN_DIR}/messages_xml.h
${
OPENAIR_TARGETS
}
/RT/USER/rt_wrapper.c
${
OPENAIR_TARGETS
}
/RT/USER/rt_wrapper.c
${
OPENAIR_
TARGETS
}
/RT/USER
/nr-ue.c
${
OPENAIR_
DIR
}
/executables
/nr-ue.c
${
OPENAIR_
TARGETS
}
/RT/USER
/nr-uesoftmodem.c
${
OPENAIR_
DIR
}
/executables
/nr-uesoftmodem.c
${
OPENAIR1_DIR
}
/SIMULATION/TOOLS/taus.c
${
OPENAIR1_DIR
}
/SIMULATION/TOOLS/taus.c
#${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
#${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${
OPENAIR_TARGETS
}
/ARCH/COMMON/common_lib.c
${
OPENAIR_TARGETS
}
/ARCH/COMMON/common_lib.c
...
...
common/utils/LOG/log.c
View file @
48a103ea
This diff is collapsed.
Click to expand it.
common/utils/LOG/log.h
View file @
48a103ea
...
@@ -45,14 +45,15 @@
...
@@ -45,14 +45,15 @@
#include <time.h>
#include <time.h>
#include <stdint.h>
#include <stdint.h>
#ifndef __STDC_FORMAT_MACROS
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#endif
#include <inttypes.h>
#include <inttypes.h>
#ifndef _GNU_SOURCE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif
#include <pthread.h>
#include <pthread.h>
#include "T.h"
#include "T.h"
#include <common/utils/utils.h>
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
#ifdef __cplusplus
...
@@ -165,7 +166,7 @@ extern "C" {
...
@@ -165,7 +166,7 @@ extern "C" {
{"NAS", DEBUG_NAS},\
{"NAS", DEBUG_NAS},\
{"UE_TIMING", UE_TIMING},\
{"UE_TIMING", UE_TIMING},\
{NULL,-1}\
{NULL,-1}\
}
}
...
@@ -256,7 +257,7 @@ typedef struct {
...
@@ -256,7 +257,7 @@ typedef struct {
log_component_t
log_component
[
MAX_LOG_COMPONENTS
];
log_component_t
log_component
[
MAX_LOG_COMPONENTS
];
char
level2string
[
NUM_LOG_LEVEL
];
char
level2string
[
NUM_LOG_LEVEL
];
int
flag
;
int
flag
;
char
*
filelog_name
;
char
*
filelog_name
;
uint64_t
debug_mask
;
uint64_t
debug_mask
;
uint64_t
dump_mask
;
uint64_t
dump_mask
;
}
log_t
;
}
log_t
;
...
@@ -277,9 +278,9 @@ void log_set_instance_type (log_instance_type_t instance);
...
@@ -277,9 +278,9 @@ void log_set_instance_type (log_instance_type_t instance);
log_t
*
g_log
;
log_t
*
g_log
;
#else
#else
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
extern
log_t
*
g_log
;
extern
log_t
*
g_log
;
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
@@ -289,7 +290,7 @@ extern log_t *g_log;
...
@@ -289,7 +290,7 @@ extern log_t *g_log;
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
int
logInit
(
void
);
int
logInit
(
void
);
void
logRecord_mt
(
const
char
*
file
,
const
char
*
func
,
int
line
,
int
comp
,
int
level
,
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
6
,
7
)));
void
logRecord_mt
(
const
char
*
file
,
const
char
*
func
,
int
line
,
int
comp
,
int
level
,
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
6
,
7
)));
void
log_dump
(
int
component
,
void
*
buffer
,
int
buffsize
,
int
datatype
,
const
char
*
format
,
...
);
void
log_dump
(
int
component
,
void
*
buffer
,
int
buffsize
,
int
datatype
,
const
char
*
format
,
...
);
int
set_log
(
int
component
,
int
level
);
int
set_log
(
int
component
,
int
level
);
void
set_glog
(
int
level
);
void
set_glog
(
int
level
);
...
@@ -344,10 +345,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
...
@@ -344,10 +345,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* optname help paramflags XXXptr defXXXval type numelt */
/* optname help paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOG_GLOBALPARAMS_DESC { \
#define LOG_GLOBALPARAMS_DESC { \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0,
strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0,
strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0,
iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0,
iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0,
strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0,
strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
}
}
#define LOG_OPTIONS_IDX 2
#define LOG_OPTIONS_IDX 2
/*----------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------*/
...
@@ -360,22 +361,22 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
...
@@ -360,22 +361,22 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
// debugging macros
// debugging macros
#define LOG_F LOG_I
/* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
#define LOG_F LOG_I
/* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
# if T_TRACER
# if T_TRACER
/* per component, level dependant macros */
/* per component, level dependant macros */
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0)
/* */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0)
/* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0)
/* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0)
/* */
/* bitmask dependant macros, to isolate debugging code */
/* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
/* bitmask dependant macros, to generate debug file such as matlab file or message dump */
/* bitmask dependant macros, to generate debug file such as matlab file or message dump */
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
/* */
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
/* */
/* define variable only used in LOG macro's */
/* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B
# define LOG_VAR(A,B) A B
# else
/* T_TRACER: remove all debugging and tracing messages, except errors */
# else
/* T_TRACER: remove all debugging and tracing messages, except errors */
# define LOG_I(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
/* */
# define LOG_I(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
/* */
...
@@ -425,7 +426,7 @@ static __inline__ uint64_t rdtsc(void) {
...
@@ -425,7 +426,7 @@ static __inline__ uint64_t rdtsc(void) {
extern
double
cpuf
;
extern
double
cpuf
;
static
inline
uint64_t
checkTCPU
(
int
timeout
,
char
*
file
,
int
line
)
{
static
inline
uint64_t
checkTCPU
(
int
timeout
,
char
*
file
,
int
line
)
{
static
__thread
uint64_t
lastCPUTime
=
0
;
static
__thread
uint64_t
lastCPUTime
=
0
;
static
__thread
uint64_t
last
=
0
;
static
__thread
uint64_t
last
=
0
;
uint64_t
cur
=
rdtsc
();
uint64_t
cur
=
rdtsc
();
...
@@ -434,25 +435,29 @@ static inline uint64_t checkTCPU(int timeout, char * file, int line) {
...
@@ -434,25 +435,29 @@ static inline uint64_t checkTCPU(int timeout, char * file, int line) {
uint64_t
CPUTime
=
CPUt
.
tv_sec
*
1000
*
1000
+
CPUt
.
tv_nsec
/
1000
;
uint64_t
CPUTime
=
CPUt
.
tv_sec
*
1000
*
1000
+
CPUt
.
tv_nsec
/
1000
;
double
microCycles
=
(
double
)(
cpuf
*
1000
);
double
microCycles
=
(
double
)(
cpuf
*
1000
);
int
duration
=
(
int
)((
cur
-
last
)
/
microCycles
);
int
duration
=
(
int
)((
cur
-
last
)
/
microCycles
);
if
(
last
!=
0
&&
duration
>
timeout
)
{
if
(
last
!=
0
&&
duration
>
timeout
)
{
//struct timespec ts;
//struct timespec ts;
//clock_gettime(CLOCK_MONOTONIC, &ts);
//clock_gettime(CLOCK_MONOTONIC, &ts);
printf
(
"%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld
\n
"
,
file
,
line
,
printf
(
"%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld
\n
"
,
file
,
line
,
duration
,
timeout
,
(
long
long
)
CPUTime
-
lastCPUTime
);
duration
,
timeout
,
(
long
long
)
CPUTime
-
lastCPUTime
);
}
}
last
=
cur
;
last
=
cur
;
lastCPUTime
=
CPUTime
;
lastCPUTime
=
CPUTime
;
return
cur
;
return
cur
;
}
}
static
inline
unsigned
long
long
checkT
(
int
timeout
,
char
*
file
,
int
line
)
{
static
inline
unsigned
long
long
checkT
(
int
timeout
,
char
*
file
,
int
line
)
{
static
__thread
unsigned
long
long
last
=
0
;
static
__thread
unsigned
long
long
last
=
0
;
unsigned
long
long
cur
=
rdtsc
();
unsigned
long
long
cur
=
rdtsc
();
int
microCycles
=
(
int
)(
cpuf
*
1000
);
int
microCycles
=
(
int
)(
cpuf
*
1000
);
int
duration
=
(
int
)((
cur
-
last
)
/
microCycles
);
int
duration
=
(
int
)((
cur
-
last
)
/
microCycles
);
if
(
last
!=
0
&&
duration
>
timeout
)
if
(
last
!=
0
&&
duration
>
timeout
)
printf
(
"%s:%d lte-ue delay %d (exceed %d)
\n
"
,
file
,
line
,
printf
(
"%s:%d lte-ue delay %d (exceed %d)
\n
"
,
file
,
line
,
duration
,
timeout
);
duration
,
timeout
);
last
=
cur
;
last
=
cur
;
return
cur
;
return
cur
;
}
}
...
@@ -463,7 +468,7 @@ typedef struct m {
...
@@ -463,7 +468,7 @@ typedef struct m {
uint64_t
maxArray
[
11
];
uint64_t
maxArray
[
11
];
}
Meas
;
}
Meas
;
static
inline
void
printMeas
(
char
*
txt
,
Meas
*
M
,
int
period
)
{
static
inline
void
printMeas
(
char
*
txt
,
Meas
*
M
,
int
period
)
{
if
(
M
->
iterations
%
period
==
0
)
{
if
(
M
->
iterations
%
period
==
0
)
{
char
txt2
[
512
];
char
txt2
[
512
];
sprintf
(
txt2
,
"%s avg=%"
PRIu64
" iterations=%"
PRIu64
" max=%"
sprintf
(
txt2
,
"%s avg=%"
PRIu64
" iterations=%"
PRIu64
" max=%"
...
@@ -481,13 +486,13 @@ static inline void printMeas(char * txt, Meas *M, int period) {
...
@@ -481,13 +486,13 @@ static inline void printMeas(char * txt, Meas *M, int period) {
}
}
}
}
static
inline
int
cmpint
(
const
void
*
a
,
const
void
*
b
)
{
static
inline
int
cmpint
(
const
void
*
a
,
const
void
*
b
)
{
uint64_t
*
aa
=
(
uint64_t
*
)
a
;
uint64_t
*
aa
=
(
uint64_t
*
)
a
;
uint64_t
*
bb
=
(
uint64_t
*
)
b
;
uint64_t
*
bb
=
(
uint64_t
*
)
b
;
return
(
int
)(
*
aa
-*
bb
);
return
(
int
)(
*
aa
-*
bb
);
}
}
static
inline
void
updateTimes
(
uint64_t
start
,
Meas
*
M
,
int
period
,
char
*
txt
)
{
static
inline
void
updateTimes
(
uint64_t
start
,
Meas
*
M
,
int
period
,
char
*
txt
)
{
if
(
start
!=
0
)
{
if
(
start
!=
0
)
{
uint64_t
end
=
rdtsc
();
uint64_t
end
=
rdtsc
();
long
long
diff
=
(
end
-
start
)
/
(
cpuf
*
1000
);
long
long
diff
=
(
end
-
start
)
/
(
cpuf
*
1000
);
...
...
common/utils/threadPool/thread-pool.h
View file @
48a103ea
...
@@ -92,7 +92,7 @@ static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg)
...
@@ -92,7 +92,7 @@ static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg)
if
(
nf
->
outF
==
NULL
)
if
(
nf
->
outF
==
NULL
)
nf
->
outF
=
msg
;
nf
->
outF
=
msg
;
if
(
nf
->
inF
)
if
(
nf
->
inF
!=
NULL
)
nf
->
inF
->
next
=
msg
;
nf
->
inF
->
next
=
msg
;
nf
->
inF
=
msg
;
nf
->
inF
=
msg
;
...
@@ -103,7 +103,7 @@ static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg)
...
@@ -103,7 +103,7 @@ static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg)
static
inline
notifiedFIFO_elt_t
*
pullNotifiedFIFO
(
notifiedFIFO_t
*
nf
)
{
static
inline
notifiedFIFO_elt_t
*
pullNotifiedFIFO
(
notifiedFIFO_t
*
nf
)
{
mutexlock
(
nf
->
lockF
);
mutexlock
(
nf
->
lockF
);
while
(
!
nf
->
outF
)
while
(
nf
->
outF
==
NULL
)
condwait
(
nf
->
notifF
,
nf
->
lockF
);
condwait
(
nf
->
notifF
,
nf
->
lockF
);
notifiedFIFO_elt_t
*
ret
=
nf
->
outF
;
notifiedFIFO_elt_t
*
ret
=
nf
->
outF
;
...
@@ -124,8 +124,12 @@ static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
...
@@ -124,8 +124,12 @@ static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
notifiedFIFO_elt_t
*
ret
=
nf
->
outF
;
notifiedFIFO_elt_t
*
ret
=
nf
->
outF
;
if
(
ret
!=
NULL
)
if
(
ret
!=
NULL
)
{
if
(
nf
->
outF
==
nf
->
outF
->
next
)
LOG_E
(
TMR
,
"Circular list in thread pool: push several times the same buffer is forbidden
\n
"
);
nf
->
outF
=
nf
->
outF
->
next
;
nf
->
outF
=
nf
->
outF
->
next
;
}
if
(
nf
->
outF
==
NULL
)
if
(
nf
->
outF
==
NULL
)
nf
->
inF
=
NULL
;
nf
->
inF
=
NULL
;
...
...
common/utils/utils.h
View file @
48a103ea
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
#include <stdint.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/types.h>
#ifdef __cplusplus
extern
"C"
{
#endif
void
*
calloc_or_fail
(
size_t
size
);
void
*
calloc_or_fail
(
size_t
size
);
void
*
malloc_or_fail
(
size_t
size
);
void
*
malloc_or_fail
(
size_t
size
);
...
@@ -14,4 +17,17 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz
...
@@ -14,4 +17,17 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz
char
*
itoa
(
int
i
);
char
*
itoa
(
int
i
);
#define findInList(keY, result, list, element_type) {\
int i;\
for (i=0; i<sizeof(list)/sizeof(element_type) ; i++)\
if (list[i].key==keY) {\
result=list[i].val;\
break;\
}\
AssertFatal(i < sizeof(list)/sizeof(element_type), "List %s doesn't contain %s\n",#list, #keY); \
}
#ifdef __cplusplus
}
#endif
#endif
#endif
executables/nr-ue.c
View file @
48a103ea
...
@@ -138,13 +138,9 @@ PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -138,13 +138,9 @@ PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms,
{
{
PHY_VARS_NR_UE
*
ue
;
PHY_VARS_NR_UE
*
ue
;
if
(
frame_parms
!=
(
NR_DL_FRAME_PARMS
*
)
NULL
)
{
// if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
ue
=
(
PHY_VARS_NR_UE
*
)
malloc
(
sizeof
(
PHY_VARS_NR_UE
));
ue
=
(
PHY_VARS_NR_UE
*
)
malloc
(
sizeof
(
PHY_VARS_NR_UE
));
memset
(
ue
,
0
,
sizeof
(
PHY_VARS_NR_UE
));
memset
(
ue
,
0
,
sizeof
(
PHY_VARS_NR_UE
));
memcpy
(
&
(
ue
->
frame_parms
),
frame_parms
,
sizeof
(
NR_DL_FRAME_PARMS
));
memcpy
(
&
(
ue
->
frame_parms
),
frame_parms
,
sizeof
(
NR_DL_FRAME_PARMS
));
}
else
ue
=
PHY_vars_UE_g
[
UE_id
][
0
];
ue
->
Mod_id
=
UE_id
;
ue
->
Mod_id
=
UE_id
;
ue
->
mac_enabled
=
1
;
ue
->
mac_enabled
=
1
;
// initialize all signal buffers
// initialize all signal buffers
...
@@ -160,6 +156,7 @@ PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -160,6 +156,7 @@ PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms,
*/
*/
typedef
struct
syncData_s
{
typedef
struct
syncData_s
{
UE_nr_rxtx_proc_t
*
proc
;
PHY_VARS_NR_UE
*
UE
;
PHY_VARS_NR_UE
*
UE
;
}
syncData_t
;
}
syncData_t
;
...
@@ -167,18 +164,13 @@ static void UE_synch(void *arg) {
...
@@ -167,18 +164,13 @@ static void UE_synch(void *arg) {
syncData_t
*
syncD
=
(
syncData_t
*
)
arg
;
syncData_t
*
syncD
=
(
syncData_t
*
)
arg
;
int
i
,
hw_slot_offset
;
int
i
,
hw_slot_offset
;
PHY_VARS_NR_UE
*
UE
=
syncD
->
UE
;
PHY_VARS_NR_UE
*
UE
=
syncD
->
UE
;
int
current_band
=
0
;
int
current_offset
=
0
;
sync_mode_t
sync_mode
=
pbch
;
sync_mode_t
sync_mode
=
pbch
;
int
CC_id
=
UE
->
CC_id
;
int
CC_id
=
UE
->
CC_id
;
int
freq_offset
=
0
;
int
freq_offset
=
0
;
UE
->
is_synchronized
=
0
;
UE
->
is_synchronized
=
0
;
if
(
UE
->
UE_scan
==
0
)
{
if
(
UE
->
UE_scan
==
0
)
{
int
ind
;
get_band
(
downlink_frequency
[
CC_id
][
0
],
&
UE
->
frame_parms
.
eutra_band
,
&
uplink_frequency_offset
[
CC_id
][
0
],
&
UE
->
frame_parms
.
frame_type
);
get_band
(
downlink_frequency
[
CC_id
][
0
],
&
UE
->
frame_parms
.
eutra_band
,
&
uplink_frequency_offset
[
CC_id
][
0
],
&
UE
->
frame_parms
.
frame_type
);
LOG_I
(
PHY
,
"[SCHED][UE] Check absolute frequency DL %"
PRIu32
", UL %"
PRIu32
" (oai_exit %d, rx_num_channels %d)
\n
"
,
LOG_I
(
PHY
,
"[SCHED][UE] Check absolute frequency DL %"
PRIu32
", UL %"
PRIu32
" (oai_exit %d, rx_num_channels %d)
\n
"
,
downlink_frequency
[
0
][
0
],
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
],
downlink_frequency
[
0
][
0
],
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
],
oai_exit
,
openair0_cfg
[
0
].
rx_num_channels
);
oai_exit
,
openair0_cfg
[
0
].
rx_num_channels
);
...
@@ -197,7 +189,6 @@ static void UE_synch(void *arg) {
...
@@ -197,7 +189,6 @@ static void UE_synch(void *arg) {
sync_mode
=
pbch
;
sync_mode
=
pbch
;
}
else
{
}
else
{
current_band
=
0
;
LOG_E
(
PHY
,
"Fixme!
\n
"
);
LOG_E
(
PHY
,
"Fixme!
\n
"
);
/*
/*
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
...
@@ -245,11 +236,10 @@ static void UE_synch(void *arg) {
...
@@ -245,11 +236,10 @@ static void UE_synch(void *arg) {
break;
break;
*/
*/
case
pbch
:
case
pbch
:
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
if
(
nr_initial_sync
(
UE
,
UE
->
mode
)
==
0
)
{
if
(
nr_initial_sync
(
syncD
->
proc
,
UE
,
UE
->
mode
)
==
0
)
{
freq_offset
=
UE
->
common_vars
.
freq_offset
;
// frequency offset computed with pss in initial sync
freq_offset
=
UE
->
common_vars
.
freq_offset
;
// frequency offset computed with pss in initial sync
hw_slot_offset
=
(
UE
->
rx_offset
<<
1
)
/
UE
->
frame_parms
.
samples_per_slot
;
hw_slot_offset
=
(
UE
->
rx_offset
<<
1
)
/
UE
->
frame_parms
.
samples_per_slot
;
LOG_I
(
PHY
,
"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d
\n
"
,
LOG_I
(
PHY
,
"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d
\n
"
,
...
@@ -377,7 +367,6 @@ void processSubframeRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
...
@@ -377,7 +367,6 @@ void processSubframeRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
UE_mac
->
scheduled_response
.
slot
=
proc
->
nr_tti_rx
;
UE_mac
->
scheduled_response
.
slot
=
proc
->
nr_tti_rx
;
nr_ue_scheduled_response
(
&
UE_mac
->
scheduled_response
);
nr_ue_scheduled_response
(
&
UE_mac
->
scheduled_response
);
//write_output("uerxdata_frame.m", "uerxdata_frame", UE->common_vars.rxdata[0], UE->frame_parms.samples_per_frame, 1, 1);
//write_output("uerxdata_frame.m", "uerxdata_frame", UE->common_vars.rxdata[0], UE->frame_parms.samples_per_frame, 1, 1);
printf
(
"Processing slot %d
\n
"
,
proc
->
nr_tti_rx
);
#ifdef UE_SLOT_PARALLELISATION
#ifdef UE_SLOT_PARALLELISATION
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
...
@@ -548,10 +537,6 @@ void *UE_thread(void *arg) {
...
@@ -548,10 +537,6 @@ void *UE_thread(void *arg) {
AssertFatal
(
UE
->
rfdevice
.
trx_start_func
(
&
UE
->
rfdevice
)
==
0
,
"Could not start the device
\n
"
);
AssertFatal
(
UE
->
rfdevice
.
trx_start_func
(
&
UE
->
rfdevice
)
==
0
,
"Could not start the device
\n
"
);
notifiedFIFO_t
nf
;
notifiedFIFO_t
nf
;
initNotifiedFIFO
(
&
nf
);
initNotifiedFIFO
(
&
nf
);
bool
syncRunning
=
false
;
notifiedFIFO_elt_t
*
syncMsg
=
newNotifiedFIFO_elt
(
sizeof
(
syncData_t
),
0
,
&
nf
,
UE_synch
);
syncData_t
*
syncD
=
(
syncData_t
*
)
NotifiedFifoData
(
syncMsg
);
syncD
->
UE
=
UE
;
int
nbSlotProcessing
=
0
;
int
nbSlotProcessing
=
0
;
int
thread_idx
=
0
;
int
thread_idx
=
0
;
notifiedFIFO_elt_t
*
processingMsg
[
RX_NB_TH
];
notifiedFIFO_elt_t
*
processingMsg
[
RX_NB_TH
];
...
@@ -562,8 +547,13 @@ void *UE_thread(void *arg) {
...
@@ -562,8 +547,13 @@ void *UE_thread(void *arg) {
tmp
->
UE
=
UE
;
tmp
->
UE
=
UE
;
}
}
bool
syncRunning
=
false
;
notifiedFIFO_elt_t
*
syncMsg
=
newNotifiedFIFO_elt
(
sizeof
(
syncData_t
),
0
,
&
nf
,
UE_synch
);
syncData_t
*
syncD
=
(
syncData_t
*
)
NotifiedFifoData
(
syncMsg
);
syncD
->
UE
=
UE
;
syncD
->
proc
=&
((
processingData_t
*
)
NotifiedFifoData
(
processingMsg
[
0
]))
->
proc
;
const
int
nb_slot_frame
=
10
*
UE
->
frame_parms
.
slots_per_subframe
;
const
int
nb_slot_frame
=
10
*
UE
->
frame_parms
.
slots_per_subframe
;
int
absolute_slot
=-
1
;
int
absolute_slot
,
decoded_frame_rx
=
INT_MAX
,
trashed_frames
=
0
;
while
(
!
oai_exit
)
{
while
(
!
oai_exit
)
{
if
(
!
syncD
->
UE
->
is_synchronized
)
{
if
(
!
syncD
->
UE
->
is_synchronized
)
{
...
@@ -572,11 +562,14 @@ void *UE_thread(void *arg) {
...
@@ -572,11 +562,14 @@ void *UE_thread(void *arg) {
if
(
res
)
{
if
(
res
)
{
syncRunning
=
false
;
syncRunning
=
false
;
}
else
}
else
{
trashFrame
(
UE
,
&
timestamp
);
trashFrame
(
UE
,
&
timestamp
);
trashed_frames
++
;
}
}
else
{
}
else
{
readFrame
(
UE
,
&
timestamp
);
readFrame
(
UE
,
&
timestamp
);
pushTpool
(
Tpool
,
syncMsg
);
pushTpool
(
Tpool
,
syncMsg
);
trashed_frames
=
0
;
syncRunning
=
true
;
syncRunning
=
true
;
}
}
...
@@ -588,7 +581,6 @@ void *UE_thread(void *arg) {
...
@@ -588,7 +581,6 @@ void *UE_thread(void *arg) {
syncInFrame
(
UE
,
&
timestamp
);
syncInFrame
(
UE
,
&
timestamp
);
UE
->
rx_offset
=
0
;
UE
->
rx_offset
=
0
;
UE
->
time_sync_cell
=
0
;
UE
->
time_sync_cell
=
0
;
//printf("first stream frame rx %d\n",UE->proc.proc_rxtx[0].frame_rx);
// read in first symbol
// read in first symbol
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
==
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
...
@@ -596,12 +588,21 @@ void *UE_thread(void *arg) {
...
@@ -596,12 +588,21 @@ void *UE_thread(void *arg) {
(
void
**
)
UE
->
common_vars
.
rxdata
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
,
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
// we have the decoded frame index in the return of the synch process
// and we shifted above to the first slot of next frame
// the synch thread proc context is hard linked to regular processing thread context, thread id = 0
UE_nr_rxtx_proc_t
*
proc
=&
(((
processingData_t
*
)
NotifiedFifoData
(
processingMsg
[
0
]))
->
proc
);
// shift the frame index with all the frames we trashed meanwhile we perform the synch search
proc
->
decoded_frame_rx
=
(
proc
->
decoded_frame_rx
+
trashed_frames
)
%
MAX_FRAME_NUMBER
;
decoded_frame_rx
=
proc
->
decoded_frame_rx
;
// we do ++ first in the regular processing, so it will be 0;
absolute_slot
=
decoded_frame_rx
*
nb_slot_frame
+
nb_slot_frame
-
1
;
continue
;
continue
;
}
}
absolute_slot
++
;
absolute_slot
++
;
thread_idx
=
absolute_slot
%
RX_NB_TH
;
thread_idx
=
absolute_slot
%
RX_NB_TH
;
int
slot_nr
=
absolute_slot
%
nb_slot_frame
;
int
slot_nr
=
absolute_slot
%
nb_slot_frame
;
UE_nr_rxtx_proc_t
*
proc
=&
(((
processingData_t
*
)
NotifiedFifoData
(
processingMsg
[
thread_idx
]))
->
proc
);
UE_nr_rxtx_proc_t
*
proc
=&
(((
processingData_t
*
)
NotifiedFifoData
(
processingMsg
[
thread_idx
]))
->
proc
);
// update thread index for received subframe
// update thread index for received subframe
proc
->
nr_tti_rx
=
slot_nr
;
proc
->
nr_tti_rx
=
slot_nr
;
...
@@ -611,6 +612,7 @@ void *UE_thread(void *arg) {
...
@@ -611,6 +612,7 @@ void *UE_thread(void *arg) {
proc
->
subframe_tx
=
proc
->
nr_tti_rx
;
proc
->
subframe_tx
=
proc
->
nr_tti_rx
;
proc
->
frame_rx
=
(
absolute_slot
/
nb_slot_frame
)
%
MAX_FRAME_NUMBER
;
proc
->
frame_rx
=
(
absolute_slot
/
nb_slot_frame
)
%
MAX_FRAME_NUMBER
;
proc
->
frame_tx
=
(
(
absolute_slot
+
DURATION_RX_TO_TX
)
/
nb_slot_frame
)
%
MAX_FRAME_NUMBER
;
proc
->
frame_tx
=
(
(
absolute_slot
+
DURATION_RX_TO_TX
)
/
nb_slot_frame
)
%
MAX_FRAME_NUMBER
;
proc
->
decoded_frame_rx
=-
1
;
LOG_D
(
PHY
,
"Process slot %d thread Idx %d
\n
"
,
slot_nr
,
thread_idx
);
LOG_D
(
PHY
,
"Process slot %d thread Idx %d
\n
"
,
slot_nr
,
thread_idx
);
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
...
@@ -671,21 +673,37 @@ void *UE_thread(void *arg) {
...
@@ -671,21 +673,37 @@ void *UE_thread(void *arg) {
proc
->
timestamp_tx
=
timestamp
+
proc
->
timestamp_tx
=
timestamp
+
(
DURATION_RX_TO_TX
*
UE
->
frame_parms
.
samples_per_slot
)
-
(
DURATION_RX_TO_TX
*
UE
->
frame_parms
.
samples_per_slot
)
-
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
;
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
;
notifiedFIFO_elt_t
*
res
;
if
(
getenv
(
"RFSIMULATOR"
))
{
if
(
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
while
(
!
tryPullTpool
(
&
nf
,
Tpool
))
{
// We must receive one message, that proves the slot processing is done
nbSlotProcessing
--
;
while
((
res
=
tryPullTpool
(
&
nf
,
Tpool
))
==
NULL
)
usleep
(
200
);
usleep
(
200
);
}
nbSlotProcessing
--
;
processingData_t
*
tmp
=
(
processingData_t
*
)
res
->
msgData
;
if
(
tmp
->
proc
.
decoded_frame_rx
!=
-
1
)
decoded_frame_rx
=
tmp
->
proc
.
decoded_frame_rx
;
}
}
while
(
nbSlotProcessing
>=
RX_NB_TH
&&
!
tryPullTpool
(
&
nf
,
Tpool
)
)
{
while
(
nbSlotProcessing
>=
RX_NB_TH
&&
(
res
=
tryPullTpool
(
&
nf
,
Tpool
))
!=
NULL
)
{
nbSlotProcessing
--
;
nbSlotProcessing
--
;
processingData_t
*
tmp
=
(
processingData_t
*
)
res
->
msgData
;
if
(
tmp
->
proc
.
decoded_frame_rx
!=
-
1
)
decoded_frame_rx
=
tmp
->
proc
.
decoded_frame_rx
;
usleep
(
200
);
usleep
(
200
);
}
}
if
(
decoded_frame_rx
!=
proc
->
frame_rx
&&
((
decoded_frame_rx
+
1
)
%
MAX_FRAME_NUMBER
)
!=
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
"
,
decoded_frame_rx
,
proc
->
frame_rx
);
pushTpool
(
Tpool
,
processingMsg
[
thread_idx
]);
pushTpool
(
Tpool
,
processingMsg
[
thread_idx
]);
}
// while !oai_exit
}
// while !oai_exit
...
@@ -709,7 +727,6 @@ void init_UE(int nb_inst) {
...
@@ -709,7 +727,6 @@ void init_UE(int nb_inst) {
// UE->rfdevice.type = NONE_DEV;
// UE->rfdevice.type = NONE_DEV;
//PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
//PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
LOG_I
(
PHY
,
"Initializing memory for UE instance %d (%p)
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
]);
LOG_I
(
PHY
,
"Initializing memory for UE instance %d (%p)
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
]);
PHY_vars_UE_g
[
inst
][
0
]
=
init_nr_ue_vars
(
NULL
,
inst
,
0
);
PHY_VARS_NR_UE
*
UE
=
PHY_vars_UE_g
[
inst
][
0
];
PHY_VARS_NR_UE
*
UE
=
PHY_vars_UE_g
[
inst
][
0
];
AssertFatal
((
UE
->
if_inst
=
nr_ue_if_module_init
(
inst
))
!=
NULL
,
"can not initial IF module
\n
"
);
AssertFatal
((
UE
->
if_inst
=
nr_ue_if_module_init
(
inst
))
!=
NULL
,
"can not initial IF module
\n
"
);
nr_l3_init_ue
();
nr_l3_init_ue
();
...
...
executables/nr-uesoftmodem.h
View file @
48a103ea
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_nr_UE.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include <threadPool/thread-pool.h>
#include <threadPool/thread-pool.h>
#include <openair2/LAYER2/NR_MAC_gNB/mac_proto.h>
#if defined(ENABLE_ITTI)
#if defined(ENABLE_ITTI)
...
...
openair1/PHY/NR_TRANSPORT/nr_dci_tools.c
View file @
48a103ea
...
@@ -46,7 +46,7 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m
...
@@ -46,7 +46,7 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m
uint8_t
bsize
=
pdcch_params
->
reg_bundle_size
;
uint8_t
bsize
=
pdcch_params
->
reg_bundle_size
;
uint8_t
R
=
pdcch_params
->
interleaver_size
;
uint8_t
R
=
pdcch_params
->
interleaver_size
;
uint16_t
N_reg
=
pdcch_params
->
n_rb
*
pdcch_params
->
n_symb
;
uint16_t
N_reg
=
pdcch_params
->
n_rb
*
pdcch_params
->
n_symb
;
uint16_t
Y
,
N_cce
,
M_s_max
,
n_CI
=
0
,
tmp
,
C
;
uint16_t
Y
,
N_cce
,
M_s_max
,
n_CI
=
0
,
tmp
,
C
=
0
;
uint16_t
n_RNTI
=
(
pdcch_params
->
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
pdcch_params
->
rnti
:
0
;
uint16_t
n_RNTI
=
(
pdcch_params
->
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
pdcch_params
->
rnti
:
0
;
uint32_t
A
[
3
]
=
{
39827
,
39829
,
39839
};
uint32_t
A
[
3
]
=
{
39827
,
39829
,
39839
};
...
@@ -64,7 +64,7 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m
...
@@ -64,7 +64,7 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m
}
}
if
(
pdcch_params
->
cr_mapping_type
==
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED
)
{
if
(
pdcch_params
->
cr_mapping_type
==
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED
)
{
AssertFatal
((
N_reg
%
(
bsize
*
R
))
==
0
,
"CCE to REG interleaving: Invalid configuration leading to non integer C (N_reg %
d
, bsize %d R %d)
\n
"
,
AssertFatal
((
N_reg
%
(
bsize
*
R
))
==
0
,
"CCE to REG interleaving: Invalid configuration leading to non integer C (N_reg %
us
, bsize %d R %d)
\n
"
,
N_reg
,
bsize
,
R
);
N_reg
,
bsize
,
R
);
C
=
N_reg
/
(
bsize
*
R
);
C
=
N_reg
/
(
bsize
*
R
);
}
}
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
48a103ea
...
@@ -102,7 +102,7 @@ void free_list(NR_UE_SSB *node) {
...
@@ -102,7 +102,7 @@ void free_list(NR_UE_SSB *node) {
}
}
int
nr_pbch_detection
(
PHY_VARS_NR_UE
*
ue
,
int
pbch_initial_symbol
,
runmode_t
mode
)
int
nr_pbch_detection
(
UE_nr_rxtx_proc_t
*
proc
,
PHY_VARS_NR_UE
*
ue
,
int
pbch_initial_symbol
,
runmode_t
mode
)
{
{
NR_DL_FRAME_PARMS
*
frame_parms
=&
ue
->
frame_parms
;
NR_DL_FRAME_PARMS
*
frame_parms
=&
ue
->
frame_parms
;
int
ret
=-
1
;
int
ret
=-
1
;
...
@@ -160,7 +160,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mod
...
@@ -160,7 +160,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mod
#endif
#endif
ret
=
nr_rx_pbch
(
ue
,
ret
=
nr_rx_pbch
(
ue
,
0
,
proc
,
ue
->
pbch_vars
[
0
],
ue
->
pbch_vars
[
0
],
frame_parms
,
frame_parms
,
0
,
0
,
...
@@ -201,7 +201,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mod
...
@@ -201,7 +201,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mod
char
duplex_string
[
2
][
4
]
=
{
"FDD"
,
"TDD"
};
char
duplex_string
[
2
][
4
]
=
{
"FDD"
,
"TDD"
};
char
prefix_string
[
2
][
9
]
=
{
"NORMAL"
,
"EXTENDED"
};
char
prefix_string
[
2
][
9
]
=
{
"NORMAL"
,
"EXTENDED"
};
int
nr_initial_sync
(
PHY_VARS_NR_UE
*
ue
,
runmode_t
mode
)
int
nr_initial_sync
(
UE_nr_rxtx_proc_t
*
proc
,
PHY_VARS_NR_UE
*
ue
,
runmode_t
mode
)
{
{
int32_t
sync_pos
,
sync_pos_frame
;
// k_ssb, N_ssb_crb, sync_pos2,
int32_t
sync_pos
,
sync_pos_frame
;
// k_ssb, N_ssb_crb, sync_pos2,
...
@@ -309,7 +309,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -309,7 +309,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
//nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0);
//nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0);
nr_gold_pbch
(
ue
);
nr_gold_pbch
(
ue
);
ret
=
nr_pbch_detection
(
ue
,
1
,
mode
);
// start pbch detection at first symbol after pss
ret
=
nr_pbch_detection
(
proc
,
ue
,
1
,
mode
);
// start pbch detection at first symbol after pss
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
// sync at symbol ue->symbol_offset
// sync at symbol ue->symbol_offset
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
48a103ea
...
@@ -410,7 +410,7 @@ unsigned char sign(int8_t x) {
...
@@ -410,7 +410,7 @@ unsigned char sign(int8_t x) {
uint8_t
pbch_deinterleaving_pattern
[
32
]
=
{
28
,
0
,
31
,
30
,
7
,
29
,
25
,
27
,
5
,
8
,
24
,
9
,
10
,
11
,
12
,
13
,
1
,
4
,
3
,
14
,
15
,
16
,
17
,
2
,
26
,
18
,
19
,
20
,
21
,
22
,
6
,
23
};
uint8_t
pbch_deinterleaving_pattern
[
32
]
=
{
28
,
0
,
31
,
30
,
7
,
29
,
25
,
27
,
5
,
8
,
24
,
9
,
10
,
11
,
12
,
13
,
1
,
4
,
3
,
14
,
15
,
16
,
17
,
2
,
26
,
18
,
19
,
20
,
21
,
22
,
6
,
23
};
int
nr_rx_pbch
(
PHY_VARS_NR_UE
*
ue
,
int
nr_rx_pbch
(
PHY_VARS_NR_UE
*
ue
,
int
subframe_rx
,
UE_nr_rxtx_proc_t
*
proc
,
NR_UE_PBCH
*
nr_ue_pbch_vars
,
NR_UE_PBCH
*
nr_ue_pbch_vars
,
NR_DL_FRAME_PARMS
*
frame_parms
,
NR_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
eNB_id
,
uint8_t
eNB_id
,
...
@@ -448,15 +448,15 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -448,15 +448,15 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
symbol_offset
=
0
;
symbol_offset
=
0
;
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
//printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF);
//printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[
proc->
subframe_rx]].rxdataF);
write_output
(
"rxdataF0_pbch.m"
,
"rxF0pbch"
,
write_output
(
"rxdataF0_pbch.m"
,
"rxF0pbch"
,
&
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe_rx
]].
rxdataF
[
0
][(
symbol_offset
+
1
)
*
frame_parms
->
ofdm_symbol_size
],
frame_parms
->
ofdm_symbol_size
*
3
,
1
,
1
);
&
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
proc
->
subframe_rx
]].
rxdataF
[
0
][(
symbol_offset
+
1
)
*
frame_parms
->
ofdm_symbol_size
],
frame_parms
->
ofdm_symbol_size
*
3
,
1
,
1
);
#endif
#endif
// symbol refers to symbol within SSB. symbol_offset is the offset of the SSB wrt start of slot
// symbol refers to symbol within SSB. symbol_offset is the offset of the SSB wrt start of slot
for
(
symbol
=
1
;
symbol
<
4
;
symbol
++
)
{
for
(
symbol
=
1
;
symbol
<
4
;
symbol
++
)
{
nr_pbch_extract
(
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe_rx
]].
rxdataF
,
nr_pbch_extract
(
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
proc
->
subframe_rx
]].
rxdataF
,
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe_rx
]].
dl_ch_estimates
[
eNB_id
],
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
proc
->
subframe_rx
]].
dl_ch_estimates
[
eNB_id
],
nr_ue_pbch_vars
->
rxdataF_ext
,
nr_ue_pbch_vars
->
rxdataF_ext
,
nr_ue_pbch_vars
->
dl_ch_estimates_ext
,
nr_ue_pbch_vars
->
dl_ch_estimates_ext
,
symbol
,
symbol
,
...
@@ -591,6 +591,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -591,6 +591,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
#endif
#endif
ue
->
dl_indication
.
rx_ind
=
&
ue
->
rx_ind
;
// hang on rx_ind instance
ue
->
dl_indication
.
rx_ind
=
&
ue
->
rx_ind
;
// hang on rx_ind instance
ue
->
dl_indication
.
proc
=
proc
;
//ue->rx_ind.sfn_slot = 0; //should be set by higher-1-layer, i.e. clean_and_set_if_instance()
//ue->rx_ind.sfn_slot = 0; //should be set by higher-1-layer, i.e. clean_and_set_if_instance()
ue
->
rx_ind
.
rx_indication_body
[
0
].
pdu_type
=
FAPI_NR_RX_PDU_TYPE_MIB
;
ue
->
rx_ind
.
rx_indication_body
[
0
].
pdu_type
=
FAPI_NR_RX_PDU_TYPE_MIB
;
ue
->
rx_ind
.
rx_indication_body
[
0
].
mib_pdu
.
pdu
=
&
decoded_output
[
0
];
ue
->
rx_ind
.
rx_indication_body
[
0
].
mib_pdu
.
pdu
=
&
decoded_output
[
0
];
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
View file @
48a103ea
...
@@ -1137,7 +1137,7 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin
...
@@ -1137,7 +1137,7 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin
\returns number of tx antennas or -1 if error
\returns number of tx antennas or -1 if error
*/
*/
int
nr_rx_pbch
(
PHY_VARS_NR_UE
*
ue
,
int
nr_rx_pbch
(
PHY_VARS_NR_UE
*
ue
,
int
subframe_rx
,
UE_nr_rxtx_proc_t
*
proc
,
NR_UE_PBCH
*
nr_ue_pbch_vars
,
NR_UE_PBCH
*
nr_ue_pbch_vars
,
NR_DL_FRAME_PARMS
*
frame_parms
,
NR_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
eNB_id
,
uint8_t
eNB_id
,
...
@@ -1145,7 +1145,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -1145,7 +1145,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
MIMO_mode_t
mimo_mode
,
MIMO_mode_t
mimo_mode
,
uint32_t
high_speed_flag
);
uint32_t
high_speed_flag
);
int
nr_pbch_detection
(
PHY_VARS_NR_UE
*
ue
,
int
nr_pbch_detection
(
UE_nr_rxtx_proc_t
*
proc
,
PHY_VARS_NR_UE
*
ue
,
int
pbch_initial_symbol
,
int
pbch_initial_symbol
,
runmode_t
mode
);
runmode_t
mode
);
...
@@ -1433,7 +1434,8 @@ void generate_RIV_tables(void);
...
@@ -1433,7 +1434,8 @@ void generate_RIV_tables(void);
@param phy_vars_ue Pointer to UE variables
@param phy_vars_ue Pointer to UE variables
@param mode current running mode
@param mode current running mode
*/
*/
int
nr_initial_sync
(
PHY_VARS_NR_UE
*
phy_vars_ue
,
runmode_t
mode
);
int
nr_initial_sync
(
UE_nr_rxtx_proc_t
*
proc
,
PHY_VARS_NR_UE
*
phy_vars_ue
,
runmode_t
mode
);
/*!
/*!
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
View file @
48a103ea
...
@@ -277,7 +277,7 @@ typedef struct {
...
@@ -277,7 +277,7 @@ typedef struct {
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t
w
[
MAX_NUM_NR_DLSCH_SEGMENTS
][
3
*
8448
];
int16_t
w
[
MAX_NUM_NR_DLSCH_SEGMENTS
][
3
*
8448
];
/// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
/// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
double
w_abs
[
MAX_NUM_NR_DLSCH_SEGMENTS
][
3
*
8448
];
//
double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t
*
d
[
MAX_NUM_NR_DLSCH_SEGMENTS
];
int16_t
*
d
[
MAX_NUM_NR_DLSCH_SEGMENTS
];
/// LDPC processing buffers
/// LDPC processing buffers
...
...
openair1/PHY/TOOLS/cdot_prod.c
View file @
48a103ea
...
@@ -158,122 +158,6 @@ int32_t dot_product(int16_t *x,
...
@@ -158,122 +158,6 @@ int32_t dot_product(int16_t *x,
#endif
#endif
}
}
int64_t
dot_product64
(
int16_t
*
x
,
int16_t
*
y
,
uint32_t
N
,
//must be a multiple of 8
uint8_t
output_shift
)
{
uint32_t
n
;
#if defined(__x86_64__) || defined(__i386__)
__m128i
*
x128
,
*
y128
,
mmtmp1
,
mmtmp2
,
mmtmp3
,
mmcumul
,
mmcumul_re
,
mmcumul_im
;
__m128i
minus_i
=
_mm_set_epi16
(
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
);
int64_t
result
;
x128
=
(
__m128i
*
)
x
;
y128
=
(
__m128i
*
)
y
;
mmcumul_re
=
_mm_setzero_si128
();
mmcumul_im
=
_mm_setzero_si128
();
for
(
n
=
0
;
n
<
(
N
>>
2
);
n
++
)
{
// printf("n=%d, x128=%p, y128=%p\n",n,x128,y128);
// print_shorts("x",&x128[0]);
// print_shorts("y",&y128[0]);
// this computes Re(z) = Re(x)*Re(y) + Im(x)*Im(y)
mmtmp1
=
_mm_madd_epi16
(
x128
[
0
],
y128
[
0
]);
// print_ints("retmp",&mmtmp1);
// mmtmp1 contains real part of 4 consecutive outputs (32-bit)
// shift and accumulate results
mmtmp1
=
_mm_srai_epi32
(
mmtmp1
,
output_shift
);
mmcumul_re
=
_mm_add_epi32
(
mmcumul_re
,
mmtmp1
);
//print_ints("re",&mmcumul_re);
// this computes Im(z) = Re(x)*Im(y) - Re(y)*Im(x)
mmtmp2
=
_mm_shufflelo_epi16
(
y128
[
0
],
_MM_SHUFFLE
(
2
,
3
,
0
,
1
));
//print_shorts("y",&mmtmp2);
mmtmp2
=
_mm_shufflehi_epi16
(
mmtmp2
,
_MM_SHUFFLE
(
2
,
3
,
0
,
1
));
//print_shorts("y",&mmtmp2);
mmtmp2
=
_mm_sign_epi16
(
mmtmp2
,
minus_i
);
// print_shorts("y",&mmtmp2);
mmtmp3
=
_mm_madd_epi16
(
x128
[
0
],
mmtmp2
);
//print_ints("imtmp",&mmtmp3);
// mmtmp3 contains imag part of 4 consecutive outputs (32-bit)
// shift and accumulate results
mmtmp3
=
_mm_srai_epi32
(
mmtmp3
,
output_shift
);
mmcumul_im
=
_mm_add_epi32
(
mmcumul_im
,
mmtmp3
);
//print_ints("im",&mmcumul_im);
x128
++
;
y128
++
;
}
// this gives Re Re Im Im
mmcumul
=
_mm_hadd_epi32
(
mmcumul_re
,
mmcumul_im
);
//print_ints("cumul1",&mmcumul);
// this gives Re Im Re Im
mmcumul
=
_mm_hadd_epi32
(
mmcumul
,
mmcumul
);
//print_ints("cumul2",&mmcumul);
//mmcumul = _mm_srai_epi32(mmcumul,output_shift);
// extract the lower half
result
=
_mm_extract_epi64
(
mmcumul
,
0
);
//printf("result: (%d,%d)\n",((int32_t*)&result)[0],((int32_t*)&result)[1]);
_mm_empty
();
_m_empty
();
return
(
result
);
#elif defined(__arm__)
int16x4_t
*
x_128
=
(
int16x4_t
*
)
x
;
int16x4_t
*
y_128
=
(
int16x4_t
*
)
y
;
int32x4_t
tmp_re
,
tmp_im
;
int32x4_t
tmp_re1
,
tmp_im1
;
int32x4_t
re_cumul
,
im_cumul
;
int32x2_t
re_cumul2
,
im_cumul2
;
int32x4_t
shift
=
vdupq_n_s32
(
-
output_shift
);
int32x2x2_t
result2
;
int16_t
conjug
[
4
]
__attribute__
((
aligned
(
16
)))
=
{
-
1
,
1
,
-
1
,
1
}
;
re_cumul
=
vdupq_n_s32
(
0
);
im_cumul
=
vdupq_n_s32
(
0
);
for
(
n
=
0
;
n
<
(
N
>>
2
);
n
++
)
{
tmp_re
=
vmull_s16
(
*
x_128
++
,
*
y_128
++
);
//tmp_re = [Re(x[0])Re(y[0]) Im(x[0])Im(y[0]) Re(x[1])Re(y[1]) Im(x[1])Im(y[1])]
tmp_re1
=
vmull_s16
(
*
x_128
++
,
*
y_128
++
);
//tmp_re1 = [Re(x1[1])Re(x2[1]) Im(x1[1])Im(x2[1]) Re(x1[1])Re(x2[2]) Im(x1[1])Im(x2[2])]
tmp_re
=
vcombine_s32
(
vpadd_s32
(
vget_low_s32
(
tmp_re
),
vget_high_s32
(
tmp_re
)),
vpadd_s32
(
vget_low_s32
(
tmp_re1
),
vget_high_s32
(
tmp_re1
)));
//tmp_re = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2]) Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])]
tmp_im
=
vmull_s16
(
vrev32_s16
(
vmul_s16
(
*
x_128
++
,
*
(
int16x4_t
*
)
conjug
)),
*
y_128
++
);
//tmp_im = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])]
tmp_im1
=
vmull_s16
(
vrev32_s16
(
vmul_s16
(
*
x_128
++
,
*
(
int16x4_t
*
)
conjug
)),
*
y_128
++
);
//tmp_im1 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])]
tmp_im
=
vcombine_s32
(
vpadd_s32
(
vget_low_s32
(
tmp_im
),
vget_high_s32
(
tmp_im
)),
vpadd_s32
(
vget_low_s32
(
tmp_im1
),
vget_high_s32
(
tmp_im1
)));
//tmp_im = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])]
re_cumul
=
vqaddq_s32
(
re_cumul
,
vqshlq_s32
(
tmp_re
,
shift
));
im_cumul
=
vqaddq_s32
(
im_cumul
,
vqshlq_s32
(
tmp_im
,
shift
));
}
re_cumul2
=
vpadd_s32
(
vget_low_s32
(
re_cumul
),
vget_high_s32
(
re_cumul
));
im_cumul2
=
vpadd_s32
(
vget_low_s32
(
im_cumul
),
vget_high_s32
(
im_cumul
));
re_cumul2
=
vpadd_s32
(
re_cumul2
,
re_cumul2
);
im_cumul2
=
vpadd_s32
(
im_cumul2
,
im_cumul2
);
result2
=
vzip_s32
(
re_cumul2
,
im_cumul2
);
return
(
vget_lane_s32
(
result2
.
val
[
0
],
0
));
#endif
}
#ifdef MAIN
#ifdef MAIN
...
...
openair1/PHY/TOOLS/tools_defs.h
View file @
48a103ea
...
@@ -354,10 +354,116 @@ int32_t dot_product(int16_t *x,
...
@@ -354,10 +354,116 @@ int32_t dot_product(int16_t *x,
uint32_t
N
,
//must be a multiple of 8
uint32_t
N
,
//must be a multiple of 8
uint8_t
output_shift
);
uint8_t
output_shift
);
int64_t
dot_product64
(
int16_t
*
x
,
static
inline
int64_t
dot_product64
(
int16_t
*
x
,
int16_t
*
y
,
int16_t
*
y
,
uint32_t
N
,
//must be a multiple of 8
uint32_t
N
,
//must be a multiple of 8
uint8_t
output_shift
);
uint8_t
output_shift
)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i
*
x128
,
*
y128
,
mmtmp1
,
mmtmp2
,
mmtmp3
,
mmcumul
,
mmcumul_re
,
mmcumul_im
;
__m128i
minus_i
=
_mm_set_epi16
(
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
);
int64_t
result
;
x128
=
(
__m128i
*
)
x
;
y128
=
(
__m128i
*
)
y
;
mmcumul_re
=
_mm_setzero_si128
();
mmcumul_im
=
_mm_setzero_si128
();
__m128i
*
end
=
x128
+
(
N
>>
2
);
for
(
__m128i
*
inPtr
=
x128
;
inPtr
<
end
;
inPtr
++
)
{
// printf("n=%d, x128=%p, y128=%p\n",n,x128,y128);
// print_shorts("x",&x128[0]);
// print_shorts("y",&y128[0]);
// this computes Re(z) = Re(x)*Re(y) + Im(x)*Im(y)
mmtmp1
=
_mm_madd_epi16
(
*
inPtr
,
*
y128
);
// print_ints("retmp",&mmtmp1);
// mmtmp1 contains real part of 4 consecutive outputs (32-bit)
// shift and accumulate results
mmtmp1
=
_mm_srai_epi32
(
mmtmp1
,
output_shift
);
mmcumul_re
=
_mm_add_epi32
(
mmcumul_re
,
mmtmp1
);
//print_ints("re",&mmcumul_re);
// this computes Im(z) = Re(x)*Im(y) - Re(y)*Im(x)
mmtmp2
=
_mm_shufflelo_epi16
(
*
y128
,
_MM_SHUFFLE
(
2
,
3
,
0
,
1
));
//print_shorts("y",&mmtmp2);
mmtmp2
=
_mm_shufflehi_epi16
(
mmtmp2
,
_MM_SHUFFLE
(
2
,
3
,
0
,
1
));
//print_shorts("y",&mmtmp2);
mmtmp2
=
_mm_sign_epi16
(
mmtmp2
,
minus_i
);
// print_shorts("y",&mmtmp2);
mmtmp3
=
_mm_madd_epi16
(
*
inPtr
,
mmtmp2
);
//print_ints("imtmp",&mmtmp3);
// mmtmp3 contains imag part of 4 consecutive outputs (32-bit)
// shift and accumulate results
mmtmp3
=
_mm_srai_epi32
(
mmtmp3
,
output_shift
);
mmcumul_im
=
_mm_add_epi32
(
mmcumul_im
,
mmtmp3
);
//print_ints("im",&mmcumul_im);
y128
++
;
}
// this gives Re Re Im Im
mmcumul
=
_mm_hadd_epi32
(
mmcumul_re
,
mmcumul_im
);
//print_ints("cumul1",&mmcumul);
// this gives Re Im Re Im
mmcumul
=
_mm_hadd_epi32
(
mmcumul
,
mmcumul
);
//print_ints("cumul2",&mmcumul);
//mmcumul = _mm_srai_epi32(mmcumul,output_shift);
// extract the lower half
result
=
_mm_extract_epi64
(
mmcumul
,
0
);
//printf("result: (%d,%d)\n",((int32_t*)&result)[0],((int32_t*)&result)[1]);
return
(
result
);
#elif defined(__arm__)
int16x4_t
*
x_128
=
(
int16x4_t
*
)
x
;
int16x4_t
*
y_128
=
(
int16x4_t
*
)
y
;
int32x4_t
tmp_re
,
tmp_im
;
int32x4_t
tmp_re1
,
tmp_im1
;
int32x4_t
re_cumul
,
im_cumul
;
int32x2_t
re_cumul2
,
im_cumul2
;
int32x4_t
shift
=
vdupq_n_s32
(
-
output_shift
);
int32x2x2_t
result2
;
int16_t
conjug
[
4
]
__attribute__
((
aligned
(
16
)))
=
{
-
1
,
1
,
-
1
,
1
}
;
re_cumul
=
vdupq_n_s32
(
0
);
im_cumul
=
vdupq_n_s32
(
0
);
for
(
n
=
0
;
n
<
(
N
>>
2
);
n
++
)
{
tmp_re
=
vmull_s16
(
*
x_128
++
,
*
y_128
++
);
//tmp_re = [Re(x[0])Re(y[0]) Im(x[0])Im(y[0]) Re(x[1])Re(y[1]) Im(x[1])Im(y[1])]
tmp_re1
=
vmull_s16
(
*
x_128
++
,
*
y_128
++
);
//tmp_re1 = [Re(x1[1])Re(x2[1]) Im(x1[1])Im(x2[1]) Re(x1[1])Re(x2[2]) Im(x1[1])Im(x2[2])]
tmp_re
=
vcombine_s32
(
vpadd_s32
(
vget_low_s32
(
tmp_re
),
vget_high_s32
(
tmp_re
)),
vpadd_s32
(
vget_low_s32
(
tmp_re1
),
vget_high_s32
(
tmp_re1
)));
//tmp_re = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2]) Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])]
tmp_im
=
vmull_s16
(
vrev32_s16
(
vmul_s16
(
*
x_128
++
,
*
(
int16x4_t
*
)
conjug
)),
*
y_128
++
);
//tmp_im = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])]
tmp_im1
=
vmull_s16
(
vrev32_s16
(
vmul_s16
(
*
x_128
++
,
*
(
int16x4_t
*
)
conjug
)),
*
y_128
++
);
//tmp_im1 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])]
tmp_im
=
vcombine_s32
(
vpadd_s32
(
vget_low_s32
(
tmp_im
),
vget_high_s32
(
tmp_im
)),
vpadd_s32
(
vget_low_s32
(
tmp_im1
),
vget_high_s32
(
tmp_im1
)));
//tmp_im = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])]
re_cumul
=
vqaddq_s32
(
re_cumul
,
vqshlq_s32
(
tmp_re
,
shift
));
im_cumul
=
vqaddq_s32
(
im_cumul
,
vqshlq_s32
(
tmp_im
,
shift
));
}
re_cumul2
=
vpadd_s32
(
vget_low_s32
(
re_cumul
),
vget_high_s32
(
re_cumul
));
im_cumul2
=
vpadd_s32
(
vget_low_s32
(
im_cumul
),
vget_high_s32
(
im_cumul
));
re_cumul2
=
vpadd_s32
(
re_cumul2
,
re_cumul2
);
im_cumul2
=
vpadd_s32
(
im_cumul2
,
im_cumul2
);
result2
=
vzip_s32
(
re_cumul2
,
im_cumul2
);
return
(
vget_lane_s32
(
result2
.
val
[
0
],
0
));
#endif
}
void
dft12
(
int16_t
*
x
,
int16_t
*
y
);
void
dft12
(
int16_t
*
x
,
int16_t
*
y
);
void
dft24
(
int16_t
*
x
,
int16_t
*
y
,
uint8_t
scale_flag
);
void
dft24
(
int16_t
*
x
,
int16_t
*
y
,
uint8_t
scale_flag
);
...
...
openair1/PHY/defs_nr_UE.h
View file @
48a103ea
...
@@ -157,109 +157,6 @@
...
@@ -157,109 +157,6 @@
#include "targets/ARCH/COMMON/common_lib.h"
#include "targets/ARCH/COMMON/common_lib.h"
#include "NR_IF_Module.h"
/// Context data structure for RX/TX portion of subframe processing
typedef
struct
{
/// index of the current UE RX/TX proc
int
proc_id
;
/// Component Carrier index
uint8_t
CC_id
;
/// timestamp transmitted to HW
openair0_timestamp
timestamp_tx
;
//#ifdef UE_NR_PHY_DEMO
/// NR TTI index within subframe_tx [0 .. ttis_per_subframe - 1] to act upon for transmission
int
nr_tti_tx
;
/// NR TTI index within subframe_rx [0 .. ttis_per_subframe - 1] to act upon for reception
int
nr_tti_rx
;
//#endif
/// subframe to act upon for transmission
int
subframe_tx
;
/// subframe to act upon for reception
int
subframe_rx
;
/// frame to act upon for transmission
int
frame_tx
;
/// frame to act upon for reception
int
frame_rx
;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int
instance_cnt_rxtx
;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t
pthread_rxtx
;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t
attr_rxtx
;
/// condition variable for tx processing thread
pthread_cond_t
cond_rxtx
;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t
mutex_rxtx
;
/// scheduling parameters for RXn-TXnp4 thread
struct
sched_param
sched_param_rxtx
;
/// internal This variable is protected by ref mutex_fep_slot1.
//int instance_cnt_slot0_dl_processing;
int
instance_cnt_slot1_dl_processing
;
/// pthread descriptor fep_slot1 thread
//pthread_t pthread_slot0_dl_processing;
pthread_t
pthread_slot1_dl_processing
;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t
attr_slot1_dl_processing
;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t
cond_slot1_dl_processing
;
/// mutex for UE synch thread
//pthread_mutex_t mutex_slot0_dl_processing;
pthread_mutex_t
mutex_slot1_dl_processing
;
//int instance_cnt_slot0_dl_processing;
int
instance_cnt_dlsch_td
;
/// pthread descriptor fep_slot1 thread
//pthread_t pthread_slot0_dl_processing;
pthread_t
pthread_dlsch_td
;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t
attr_dlsch_td
;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t
cond_dlsch_td
;
/// mutex for UE synch thread
//pthread_mutex_t mutex_slot0_dl_processing;
pthread_mutex_t
mutex_dlsch_td
;
//
uint8_t
chan_est_pilot0_slot1_available
;
uint8_t
chan_est_slot1_available
;
uint8_t
llr_slot1_available
;
uint8_t
dci_slot0_available
;
uint8_t
first_symbol_available
;
uint8_t
decoder_thread_available
;
uint8_t
decoder_main_available
;
uint8_t
decoder_switch
;
int
counter_decoder
;
uint8_t
channel_level
;
int
eNB_id
;
int
harq_pid
;
int
llr8_flag
;
/// scheduling parameters for fep_slot1 thread
struct
sched_param
sched_param_fep_slot1
;
int
sub_frame_start
;
int
sub_frame_step
;
unsigned
long
long
gotIQs
;
uint8_t
decoder_thread_available1
;
int
instance_cnt_dlsch_td1
;
/// pthread descriptor fep_slot1 thread
//pthread_t pthread_slot0_dl_processing;
pthread_t
pthread_dlsch_td1
;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t
attr_dlsch_td1
;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t
cond_dlsch_td1
;
/// mutex for UE synch thread
//pthread_mutex_t mutex_slot0_dl_processing;
pthread_mutex_t
mutex_dlsch_td1
;
int
dci_err_cnt
;
}
UE_nr_rxtx_proc_t
;
/// Context data structure for eNB subframe processing
/// Context data structure for eNB subframe processing
typedef
struct
{
typedef
struct
{
...
@@ -956,6 +853,9 @@ typedef struct UE_NR_SCAN_INFO_s {
...
@@ -956,6 +853,9 @@ typedef struct UE_NR_SCAN_INFO_s {
int32_t
freq_offset_Hz
[
3
][
10
];
int32_t
freq_offset_Hz
[
3
][
10
];
}
UE_NR_SCAN_INFO_t
;
}
UE_NR_SCAN_INFO_t
;
#include "NR_IF_Module.h"
/// Top-level PHY Data Structure for UE
/// Top-level PHY Data Structure for UE
typedef
struct
{
typedef
struct
{
/// \brief Module ID indicator for this instance
/// \brief Module ID indicator for this instance
...
...
openair1/PHY/thread_NR_UE.h
0 → 100644
View file @
48a103ea
#ifndef __thread_NR_UE__
#define __thread_NR_UE__
#include <pthread.h>
#include <targets/ARCH/COMMON/common_lib.h>
/// Context data structure for RX/TX portion of subframe processing
typedef
struct
{
/// index of the current UE RX/TX proc
int
proc_id
;
/// Component Carrier index
uint8_t
CC_id
;
/// timestamp transmitted to HW
openair0_timestamp
timestamp_tx
;
//#ifdef UE_NR_PHY_DEMO
/// NR TTI index within subframe_tx [0 .. ttis_per_subframe - 1] to act upon for transmission
int
nr_tti_tx
;
/// NR TTI index within subframe_rx [0 .. ttis_per_subframe - 1] to act upon for reception
int
nr_tti_rx
;
//#endif
/// subframe to act upon for transmission
int
subframe_tx
;
/// subframe to act upon for reception
int
subframe_rx
;
/// frame to act upon for transmission
int
frame_tx
;
/// frame to act upon for reception
int
frame_rx
;
int
decoded_frame_rx
;
/// internal This variable is protected by ref mutex_fep_slot1.
//int instance_cnt_slot0_dl_processing;
int
instance_cnt_slot1_dl_processing
;
/// pthread descriptor fep_slot1 thread
//pthread_t pthread_slot0_dl_processing;
pthread_t
pthread_slot1_dl_processing
;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t
attr_slot1_dl_processing
;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t
cond_slot1_dl_processing
;
/// mutex for UE synch thread
//pthread_mutex_t mutex_slot0_dl_processing;
pthread_mutex_t
mutex_slot1_dl_processing
;
//int instance_cnt_slot0_dl_processing;
int
instance_cnt_dlsch_td
;
/// pthread descriptor fep_slot1 thread
//pthread_t pthread_slot0_dl_processing;
pthread_t
pthread_dlsch_td
;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t
attr_dlsch_td
;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t
cond_dlsch_td
;
/// mutex for UE synch thread
uint8_t
chan_est_pilot0_slot1_available
;
uint8_t
chan_est_slot1_available
;
uint8_t
llr_slot1_available
;
uint8_t
dci_slot0_available
;
uint8_t
first_symbol_available
;
uint8_t
decoder_thread_available
;
uint8_t
decoder_main_available
;
uint8_t
decoder_switch
;
int
counter_decoder
;
uint8_t
channel_level
;
int
eNB_id
;
int
harq_pid
;
int
llr8_flag
;
/// scheduling parameters for fep_slot1 thread
struct
sched_param
sched_param_fep_slot1
;
int
sub_frame_start
;
int
sub_frame_step
;
unsigned
long
long
gotIQs
;
uint8_t
decoder_thread_available1
;
int
dci_err_cnt
;
}
UE_nr_rxtx_proc_t
;
#endif
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
View file @
48a103ea
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
48a103ea
...
@@ -2824,7 +2824,7 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
...
@@ -2824,7 +2824,7 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES
,
VCD_FUNCTION_IN
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES
,
VCD_FUNCTION_IN
);
//LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id);
//LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id);
ret
=
nr_rx_pbch
(
ue
,
proc
->
subframe_rx
,
ret
=
nr_rx_pbch
(
ue
,
proc
,
ue
->
pbch_vars
[
eNB_id
],
ue
->
pbch_vars
[
eNB_id
],
&
ue
->
frame_parms
,
&
ue
->
frame_parms
,
eNB_id
,
eNB_id
,
...
...
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
48a103ea
...
@@ -684,7 +684,8 @@ int main(int argc, char **argv)
...
@@ -684,7 +684,8 @@ int main(int argc, char **argv)
LOG_M
(
"rxsig1.m"
,
"rxs1"
,
UE
->
common_vars
.
rxdata
[
1
],
frame_length_complex_samples
,
1
,
1
);
LOG_M
(
"rxsig1.m"
,
"rxs1"
,
UE
->
common_vars
.
rxdata
[
1
],
frame_length_complex_samples
,
1
,
1
);
}
}
if
(
UE
->
is_synchronized
==
0
)
{
if
(
UE
->
is_synchronized
==
0
)
{
ret
=
nr_initial_sync
(
UE
,
normal_txrx
);
UE_nr_rxtx_proc_t
proc
=
{
0
};
ret
=
nr_initial_sync
(
&
proc
,
UE
,
normal_txrx
);
printf
(
"nr_initial_sync1 returns %d
\n
"
,
ret
);
printf
(
"nr_initial_sync1 returns %d
\n
"
,
ret
);
if
(
ret
<
0
)
n_errors
++
;
if
(
ret
<
0
)
n_errors
++
;
}
}
...
...
openair1/SIMULATION/NR_PHY/pbchsim.c
View file @
48a103ea
...
@@ -600,7 +600,8 @@ int main(int argc, char **argv)
...
@@ -600,7 +600,8 @@ int main(int argc, char **argv)
}
}
if
(
UE
->
is_synchronized
==
0
)
{
if
(
UE
->
is_synchronized
==
0
)
{
ret
=
nr_initial_sync
(
UE
,
normal_txrx
);
UE_nr_rxtx_proc_t
proc
=
{
0
};
ret
=
nr_initial_sync
(
&
proc
,
UE
,
normal_txrx
);
printf
(
"nr_initial_sync1 returns %d
\n
"
,
ret
);
printf
(
"nr_initial_sync1 returns %d
\n
"
,
ret
);
if
(
ret
<
0
)
n_errors
++
;
if
(
ret
<
0
)
n_errors
++
;
}
}
...
@@ -621,9 +622,10 @@ int main(int argc, char **argv)
...
@@ -621,9 +622,10 @@ int main(int argc, char **argv)
nr_pbch_channel_estimation
(
UE
,
0
,
0
,
i
,
i
-
(
UE
->
symbol_offset
+
1
),
ssb_index
%
8
,
n_hf
);
nr_pbch_channel_estimation
(
UE
,
0
,
0
,
i
,
i
-
(
UE
->
symbol_offset
+
1
),
ssb_index
%
8
,
n_hf
);
}
}
UE_nr_rxtx_proc_t
proc
=
{
0
};
ret
=
nr_rx_pbch
(
UE
,
ret
=
nr_rx_pbch
(
UE
,
0
,
&
proc
,
UE
->
pbch_vars
[
0
],
UE
->
pbch_vars
[
0
],
frame_parms
,
frame_parms
,
0
,
0
,
...
...
openair2/LAYER2/NR_MAC_UE/mac_proto.h
View file @
48a103ea
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "mac_defs.h"
#include "mac_defs.h"
#include "mac.h"
#include "mac.h"
#include <openair1/PHY/defs_nr_UE.h>
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
\param module_id module id
\param module_id module id
...
@@ -46,6 +47,7 @@
...
@@ -46,6 +47,7 @@
\param pdu_length length of pdu
\param pdu_length length of pdu
\param cell_id cell id */
\param cell_id cell id */
int8_t
nr_ue_decode_mib
(
int8_t
nr_ue_decode_mib
(
UE_nr_rxtx_proc_t
*
proc
,
module_id_t
module_id
,
module_id_t
module_id
,
int
cc_id
,
int
cc_id
,
uint8_t
gNB_index
,
uint8_t
gNB_index
,
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
View file @
48a103ea
...
@@ -193,6 +193,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index,
...
@@ -193,6 +193,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index,
}
}
int8_t
nr_ue_decode_mib
(
int8_t
nr_ue_decode_mib
(
UE_nr_rxtx_proc_t
*
proc
,
module_id_t
module_id
,
module_id_t
module_id
,
int
cc_id
,
int
cc_id
,
uint8_t
gNB_index
,
uint8_t
gNB_index
,
...
@@ -594,6 +595,7 @@ int8_t nr_ue_decode_mib(
...
@@ -594,6 +595,7 @@ int8_t nr_ue_decode_mib(
if
(
mac
->
if_module
!=
NULL
&&
mac
->
if_module
->
phy_config_request
!=
NULL
){
if
(
mac
->
if_module
!=
NULL
&&
mac
->
if_module
->
phy_config_request
!=
NULL
){
mac
->
if_module
->
phy_config_request
(
&
mac
->
phy_config
);
mac
->
if_module
->
phy_config_request
(
&
mac
->
phy_config
);
}
}
proc
->
decoded_frame_rx
=
frame
;
//}
//}
return
0
;
return
0
;
}
}
...
...
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
View file @
48a103ea
...
@@ -42,9 +42,10 @@
...
@@ -42,9 +42,10 @@
static
nr_ue_if_module_t
*
nr_ue_if_module_inst
[
MAX_IF_MODULES
];
static
nr_ue_if_module_t
*
nr_ue_if_module_inst
[
MAX_IF_MODULES
];
// L2 Abstraction Layer
// L2 Abstraction Layer
int
handle_bcch_bch
(
module_id_t
module_id
,
int
cc_id
,
unsigned
int
gNB_index
,
uint8_t
*
pduP
,
unsigned
int
additional_bits
,
uint32_t
ssb_index
,
uint32_t
ssb_length
,
uint16_t
cell_id
){
int
handle_bcch_bch
(
UE_nr_rxtx_proc_t
*
proc
,
module_id_t
module_id
,
int
cc_id
,
unsigned
int
gNB_index
,
uint8_t
*
pduP
,
unsigned
int
additional_bits
,
uint32_t
ssb_index
,
uint32_t
ssb_length
,
uint16_t
cell_id
){
return
nr_ue_decode_mib
(
module_id
,
return
nr_ue_decode_mib
(
proc
,
module_id
,
cc_id
,
cc_id
,
gNB_index
,
gNB_index
,
additional_bits
,
additional_bits
,
...
@@ -197,7 +198,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
...
@@ -197,7 +198,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
for
(
i
=
0
;
i
<
dl_info
->
rx_ind
->
number_pdus
;
++
i
){
for
(
i
=
0
;
i
<
dl_info
->
rx_ind
->
number_pdus
;
++
i
){
switch
(
dl_info
->
rx_ind
->
rx_indication_body
[
i
].
pdu_type
){
switch
(
dl_info
->
rx_ind
->
rx_indication_body
[
i
].
pdu_type
){
case
FAPI_NR_RX_PDU_TYPE_MIB
:
case
FAPI_NR_RX_PDU_TYPE_MIB
:
ret_mask
|=
(
handle_bcch_bch
(
dl_info
->
module_id
,
dl_info
->
cc_id
,
dl_info
->
gNB_index
,
ret_mask
|=
(
handle_bcch_bch
(
dl_info
->
proc
,
dl_info
->
module_id
,
dl_info
->
cc_id
,
dl_info
->
gNB_index
,
(
dl_info
->
rx_ind
->
rx_indication_body
+
i
)
->
mib_pdu
.
pdu
,
(
dl_info
->
rx_ind
->
rx_indication_body
+
i
)
->
mib_pdu
.
pdu
,
(
dl_info
->
rx_ind
->
rx_indication_body
+
i
)
->
mib_pdu
.
additional_bits
,
(
dl_info
->
rx_ind
->
rx_indication_body
+
i
)
->
mib_pdu
.
additional_bits
,
(
dl_info
->
rx_ind
->
rx_indication_body
+
i
)
->
mib_pdu
.
ssb_index
,
(
dl_info
->
rx_ind
->
rx_indication_body
+
i
)
->
mib_pdu
.
ssb_index
,
...
...
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h
View file @
48a103ea
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#define __NR_IF_MODULE_H__
#define __NR_IF_MODULE_H__
#include "platform_types.h"
#include "platform_types.h"
#include <openair1/PHY/thread_NR_UE.h>
#include "fapi_nr_ue_interface.h"
#include "fapi_nr_ue_interface.h"
...
@@ -64,6 +65,7 @@ typedef struct {
...
@@ -64,6 +65,7 @@ typedef struct {
frame_t
frame
;
frame_t
frame
;
/// slot
/// slot
int
slot
;
int
slot
;
UE_nr_rxtx_proc_t
*
proc
;
/// NR UE FAPI-like P7 message, direction: L1 to L2
/// NR UE FAPI-like P7 message, direction: L1 to L2
/// data reception indication structure
/// data reception indication structure
...
@@ -209,7 +211,7 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq);
...
@@ -209,7 +211,7 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq);
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
\param ssb_length corresponding to L1 parameter L_ssb
\param ssb_length corresponding to L1 parameter L_ssb
\param cell_id cell id */
\param cell_id cell id */
int
handle_bcch_bch
(
module_id_t
module_id
,
int
cc_id
,
unsigned
int
gNB_index
,
uint8_t
*
pduP
,
unsigned
int
additional_bits
,
uint32_t
ssb_index
,
uint32_t
ssb_length
,
uint16_t
cell_id
);
int
handle_bcch_bch
(
UE_nr_rxtx_proc_t
*
proc
,
module_id_t
module_id
,
int
cc_id
,
unsigned
int
gNB_index
,
uint8_t
*
pduP
,
unsigned
int
additional_bits
,
uint32_t
ssb_index
,
uint32_t
ssb_length
,
uint16_t
cell_id
);
// TODO check
// TODO check
/**\brief handle BCCH-DL-SCH message from dl_indication
/**\brief handle BCCH-DL-SCH message from dl_indication
...
...
targets/RT/USER/nr-ue.c
deleted
100644 → 0
View file @
2df82e34
This diff is collapsed.
Click to expand it.
targets/RT/USER/nr-uesoftmodem.c
deleted
100644 → 0
View file @
2df82e34
This diff is collapsed.
Click to expand it.
targets/RT/USER/nr-uesoftmodem.h
deleted
100644 → 0
View file @
2df82e34
This diff is collapsed.
Click to expand it.
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