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
lizhongxiao
OpenXG-RAN
Commits
e47493a8
Commit
e47493a8
authored
Oct 31, 2023
by
liuxu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
231031 ue rb\rsrp\velocity\mcs\bler finish
parent
1112fa2e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
185 additions
and
1 deletion
+185
-1
executables/Manager_sever.c
executables/Manager_sever.c
+95
-0
executables/gnbSendToManager_client.c
executables/gnbSendToManager_client.c
+73
-0
executables/manager_s
executables/manager_s
+0
-0
executables/nr-softmodem-common.h
executables/nr-softmodem-common.h
+5
-0
executables/nr-softmodem.c
executables/nr-softmodem.c
+12
-1
No files found.
executables/Manager_sever.c
0 → 100644
View file @
e47493a8
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define GNBSENDTOMANAGER_PORT 7789
#define GNBSENDTOMANAGER_MAX_LEN 2990
/*
gcc -o manager_s Manager_sever.c -pthread
*/
int
main
(
void
){
uint16_t
r_buf
[
GNBSENDTOMANAGER_MAX_LEN
];
struct
sockaddr_in
addr
,
cli_addr
;
int
len
=
sizeof
(
addr
);
int
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
//IPV4,tcp
if
(
sockfd
==-
1
)
{
perror
(
"error socket"
);
return
-
1
;
}
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
GNBSENDTOMANAGER_PORT
);
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
int
ret
=
bind
(
sockfd
,(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
if
(
ret
==-
1
)
{
perror
(
"bind error"
);
return
-
1
;
}
ret
=
listen
(
sockfd
,
1
);
if
(
ret
==
0
)
{
printf
(
"listen successfully!
\n
"
);
}
else
{
return
-
1
;
}
int
comfd
=
accept
(
sockfd
,(
struct
sockaddr
*
)
&
cli_addr
,
&
len
);
if
(
comfd
==-
1
)
{
perror
(
"accept error"
);
return
-
1
;
}
printf
(
"client %s connected!
\n
"
,
inet_ntoa
(
cli_addr
.
sin_addr
));
float
dl_velocity
;
float
ul_velocity
;
uint16_t
dl_mcs
;
uint16_t
ul_mcs
;
float
dl_bler
;
float
ul_bler
;
// int16_t snr;
int16_t
rsrp
;
int
rec_len
,
data_len
,
UE_id
,
frame
,
slot
,
count
;
while
(
1
)
{
count
=
0
;
memset
(
r_buf
,
-
1
,
sizeof
(
r_buf
));
rec_len
=
recv
(
comfd
,(
void
*
)
r_buf
,
GNBSENDTOMANAGER_MAX_LEN
,
0
);
data_len
=
r_buf
[
0
];
printf
(
"recv length:%d, data length:%d
\n
"
,
rec_len
,
data_len
);
UE_id
=
r_buf
[
1
];
frame
=
r_buf
[
2
];
slot
=
r_buf
[
3
];
dl_velocity
=
r_buf
[
4
]
*
1
.
0
/
1000
;
ul_velocity
=
(
float
)
r_buf
[
5
]
*
1
.
0
/
1000
;
dl_mcs
=
r_buf
[
6
];
ul_mcs
=
r_buf
[
7
];
dl_bler
=
r_buf
[
8
]
*
1
.
0
/
100
;
ul_bler
=
r_buf
[
9
]
*
1
.
0
/
100
;
rsrp
=
r_buf
[
10
];
printf
(
"%d.%d: dl_velocity %fMpbs ul_velocity %fMpbs dl_mcs %d ul_mcs %d dl_bler %f ul_bler %f rsrp %ddBm
\n
"
,
frame
,
slot
,
dl_velocity
,
ul_velocity
,
dl_mcs
,
ul_mcs
,
dl_bler
,
ul_bler
,
rsrp
);
for
(
int
rb
=
0
;
rb
<
5
;
rb
++
){
for
(
int
symbol
=
0
;
symbol
<
14
;
symbol
++
){
printf
(
"%d "
,
r_buf
[
11
+
count
]);
count
++
;
}
printf
(
"
\n
"
);
}
}
close
(
sockfd
);
close
(
comfd
);
return
0
;
}
\ No newline at end of file
executables/gnbSendToManager_client.c
0 → 100644
View file @
e47493a8
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <semaphore.h>
#include "nr-softmodem-common.h"
#define GNBSENDTOMANAGER_PORT 7788
#define GNBSENDTOMANAGER_MAX_LEN (sizeof(sim_socket_t))
#define GNBSENDTOMANAGER_IP "127.0.0.1"
//#define GNBSENDTOMANAGER_MAX_LEN 65536
sem_t
gnbSendToManager_sem
;
uint16_t
*
gnbSendToManager_buf
;
unsigned
int
gnbSendToManager_len
;
void
*
gnbSendToManager_task
(
void
*
args_p
)
{
struct
sockaddr_in
addr
;
int
len
=
sizeof
(
addr
);
int
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sockfd
==-
1
)
{
perror
(
"error socket"
);
return
;
}
else
{
printf
(
"create socket successfully
\n
"
);
}
int
gnb_flag
=
*
(
int
*
)
args_p
;
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
GNBSENDTOMANAGER_PORT
+
gnb_flag
);
addr
.
sin_addr
.
s_addr
=
inet_addr
(
GNBSENDTOMANAGER_IP
);
if
(
connect
(
sockfd
,(
struct
sockaddr
*
)
&
addr
,
len
)
<
0
){
printf
(
"connect failed!
\n
"
);
return
;
}
// int data_len, UE_id, frame, slot, count;
int
send_len
;
while
(
1
)
{
sem_wait
(
&
gnbSendToManager_sem
);
// printf("client send...\n");
// for (int rb = 0; rb < 5; rb++){
// printf("gnbSendToManager_buf[%d+0]= %d\n",rb,gnbSendToManager_buf[rb+0]);
// }
// data_len = gnbSendToManager_buf[0];
// UE_id = gnbSendToManager_buf[1];
// frame = gnbSendToManager_buf[2];
// slot = gnbSendToManager_buf[3];
// printf("%d.%d:\n", frame, slot);
// for (int rb = 0; rb < 106; rb++){
// for (int symbol = 0; symbol < 14; symbol++){
// printf("%d ", gnbSendToManager_buf[4+count]);
// count++;
// }
// printf("\n");
// }
send_len
=
send
(
sockfd
,
(
void
*
)
gnbSendToManager_buf
,
gnbSendToManager_len
,
0
);
// printf("send_len=%d\n", send_len);
}
close
(
sockfd
);
}
\ No newline at end of file
executables/manager_s
0 → 100755
View file @
e47493a8
File added
executables/nr-softmodem-common.h
View file @
e47493a8
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <sys/sysinfo.h>
#include <sys/sysinfo.h>
#include <sys/types.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
#include <semaphore.h>
#include <sys/sysinfo.h>
#include <sys/sysinfo.h>
#include "radio/COMMON/common_lib.h"
#include "radio/COMMON/common_lib.h"
...
@@ -156,4 +157,8 @@ extern int emulate_rf;
...
@@ -156,4 +157,8 @@ extern int emulate_rf;
extern
int
numerology
;
extern
int
numerology
;
extern
int
usrp_tx_thread
;
extern
int
usrp_tx_thread
;
extern
sem_t
gnbSendToManager_sem
;
extern
uint16_t
*
gnbSendToManager_buf
;
extern
unsigned
int
gnbSendToManager_len
;
extern
void
*
gnbSendToManager_task
(
void
*
args_p
);
#endif
#endif
executables/nr-softmodem.c
View file @
e47493a8
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#define _GNU_SOURCE
/* See feature_test_macros(7) */
#define _GNU_SOURCE
/* See feature_test_macros(7) */
#include <sched.h>
#include <sched.h>
#include "nr-softmodem-common.h"
#include "T.h"
#include "T.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
...
@@ -81,6 +81,7 @@ unsigned short config_frames[4] = {2,9,11,13};
...
@@ -81,6 +81,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "gnb_config.h"
#include "gnb_config.h"
#include "openair2/E1AP/e1ap_common.h"
#include "openair2/E1AP/e1ap_common.h"
#ifdef E2_AGENT
#ifdef E2_AGENT
#include "openair2/E2AP/flexric/src/agent/e2_agent_api.h"
#include "openair2/E2AP/flexric/src/agent/e2_agent_api.h"
#include "openair2/E2AP/RAN_FUNCTION/init_ran_func.h"
#include "openair2/E2AP/RAN_FUNCTION/init_ran_func.h"
...
@@ -175,6 +176,7 @@ openair0_config_t openair0_cfg[MAX_CARDS];
...
@@ -175,6 +176,7 @@ openair0_config_t openair0_cfg[MAX_CARDS];
double
cpuf
;
double
cpuf
;
/* hack: pdcp_run() is required by 4G scheduler which is compiled into
/* hack: pdcp_run() is required by 4G scheduler which is compiled into
* nr-softmodem because of linker issues */
* nr-softmodem because of linker issues */
void
pdcp_run
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
void
pdcp_run
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
...
@@ -633,6 +635,15 @@ int main( int argc, char **argv ) {
...
@@ -633,6 +635,15 @@ int main( int argc, char **argv ) {
#endif
#endif
LOG_I
(
HW
,
"Version: %s
\n
"
,
PACKAGE_VERSION
);
LOG_I
(
HW
,
"Version: %s
\n
"
,
PACKAGE_VERSION
);
sem_init
(
&
gnbSendToManager_sem
,
0
,
0
);
pthread_t
ntid
;
int
gnb_flag
=
1
;
if
(
pthread_create
(
&
ntid
,
NULL
,
gnbSendToManager_task
,
&
gnb_flag
)
<
0
)
{
fprintf
(
stderr
,
"gnbSendToManager_task: Failed to create thread: %s
\n
"
,
strerror
(
errno
));
exit
(
0
);
}
if
(
RC
.
nb_nr_L1_inst
>
0
)
if
(
RC
.
nb_nr_L1_inst
>
0
)
RCconfig_NR_L1
();
RCconfig_NR_L1
();
...
...
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