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
zzha zzha
OpenXG-RAN
Commits
06cd5665
Commit
06cd5665
authored
8 years ago
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui.c was forgotten in the previous commit
parent
e7faea35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
0 deletions
+101
-0
common/utils/T/tracer/gui.c
common/utils/T/tracer/gui.c
+101
-0
No files found.
common/utils/T/tracer/gui.c
0 → 100644
View file @
06cd5665
#include "defs.h"
#include "gui/gui.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
static
struct
{
gui
*
g
;
widget
*
input_signal
;
/* CC_id 0 antenna 0 */
volatile
int
input_signal_length
;
/* unit: byte */
void
*
input_signal_iq
;
pthread_mutex_t
input_signal_lock
;
}
eNB_data
;
static
void
*
gui_thread
(
void
*
g
)
{
gui_loop
(
g
);
exit
(
0
);
}
static
void
*
input_signal_plotter
(
void
*
_
)
{
short
*
iqbuf
;
float
*
x
;
float
*
y
;
int
i
;
int
length
=
eNB_data
.
input_signal_length
/
4
;
x
=
calloc
(
1
,
sizeof
(
float
)
*
eNB_data
.
input_signal_length
/
4
);
y
=
calloc
(
1
,
sizeof
(
float
)
*
eNB_data
.
input_signal_length
/
4
);
if
(
x
==
NULL
||
y
==
NULL
)
abort
();
while
(
1
)
{
usleep
(
100
*
1000
);
if
(
pthread_mutex_lock
(
&
eNB_data
.
input_signal_lock
))
abort
();
if
(
length
*
4
!=
eNB_data
.
input_signal_length
)
{
free
(
x
);
free
(
y
);
x
=
calloc
(
1
,
sizeof
(
float
)
*
eNB_data
.
input_signal_length
/
4
);
y
=
calloc
(
1
,
sizeof
(
float
)
*
eNB_data
.
input_signal_length
/
4
);
if
(
x
==
NULL
||
y
==
NULL
)
abort
();
length
=
eNB_data
.
input_signal_length
/
4
;
}
iqbuf
=
eNB_data
.
input_signal_iq
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
x
[
i
]
=
i
;
y
[
i
]
=
10
*
log10
(
1
.
0
+
(
float
)(
iqbuf
[
2
*
i
]
*
iqbuf
[
2
*
i
]
+
iqbuf
[
2
*
i
+
1
]
*
iqbuf
[
2
*
i
+
1
]));
}
xy_plot_set_points
(
eNB_data
.
g
,
eNB_data
.
input_signal
,
length
,
x
,
y
);
if
(
pthread_mutex_unlock
(
&
eNB_data
.
input_signal_lock
))
abort
();
}
}
void
t_gui_start
(
void
)
{
gui
*
g
=
gui_init
();
widget
*
win
=
new_toplevel_window
(
g
,
550
,
140
,
"input signal"
);
widget
*
plot
=
new_xy_plot
(
g
,
512
,
100
,
"eNB 0 input signal"
,
20
);
widget_add_child
(
g
,
win
,
plot
,
-
1
);
xy_plot_set_range
(
g
,
plot
,
0
,
76800
,
30
,
70
);
eNB_data
.
input_signal
=
plot
;
eNB_data
.
input_signal_length
=
76800
*
4
;
eNB_data
.
input_signal_iq
=
calloc
(
1
,
76800
*
4
);
if
(
eNB_data
.
input_signal_iq
==
NULL
)
abort
();
pthread_mutex_init
(
&
eNB_data
.
input_signal_lock
,
NULL
);
eNB_data
.
g
=
g
;
new_thread
(
gui_thread
,
g
);
new_thread
(
input_signal_plotter
,
NULL
);
}
void
t_gui_set_input_signal
(
int
eNB
,
int
frame
,
int
subframe
,
int
antenna
,
int
size
,
void
*
buf
)
{
if
(
pthread_mutex_lock
(
&
eNB_data
.
input_signal_lock
))
abort
();
if
(
eNB_data
.
input_signal_length
!=
size
*
10
)
{
free
(
eNB_data
.
input_signal_iq
);
eNB_data
.
input_signal_length
=
size
*
10
;
eNB_data
.
input_signal_iq
=
calloc
(
1
,
eNB_data
.
input_signal_length
);
if
(
eNB_data
.
input_signal_iq
==
NULL
)
abort
();
}
memcpy
((
char
*
)
eNB_data
.
input_signal_iq
+
subframe
*
size
,
buf
,
size
);
if
(
pthread_mutex_unlock
(
&
eNB_data
.
input_signal_lock
))
abort
();
}
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