Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
trx_test
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
FANG WANG
trx_test
Commits
a326f804
Commit
a326f804
authored
Apr 25, 2023
by
111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 4ant
parent
54f5383e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
trx_test.c
trx_test.c
+27
-17
No files found.
trx_test.c
View file @
a326f804
...
...
@@ -5,14 +5,16 @@
#include "trx_test.h"
int
txdata_size
=
57344
;
int
rxdata_size
=
2465792
;
#define NB_ANTENNAS_RX 1
#define NB_ANTENNAS_TX 4
#define SAMPLE_RATE (122880000)
int
txdata_size
=
61440
*
4
;
int
rxdata_size
=
61440
*
4
;
int
absolute_slot
=
0
;
int
nb_slot_frame
=
2
;
int
samples_per_subframe
=
3072
0
;
int
samples_per_subframe
=
SAMPLE_RATE
/
100
0
;
int
NB_ANTENNAS_RX
=
4
;
int
NB_ANTENNAS_TX
=
4
;
//samples_per_subframe 30720, samples_per_slot_wCP 14336.
//txdata_size 57344, txdataF_size 57344, rxdata_size 2465792.
...
...
@@ -63,8 +65,8 @@ int main( int argc, char **argv ) {
openair0_device
rfdevice
;
int
card
=
0
;
openair0_cfg
[
card
].
sample_rate
=
30720
*
1e3
;
openair0_cfg
[
card
].
samples_per_frame
=
30720
;
openair0_cfg
[
card
].
sample_rate
=
30720
*
1e3
*
4
;
openair0_cfg
[
card
].
samples_per_frame
=
30720
*
4
;
openair0_cfg
[
card
].
duplex_mode
=
duplex_mode_TDD
;
...
...
@@ -72,8 +74,8 @@ int main( int argc, char **argv ) {
openair0_cfg
[
card
].
num_rb_dl
=
51
;
openair0_cfg
[
card
].
clock_source
=
0
;
openair0_cfg
[
card
].
time_source
=
0
;
openair0_cfg
[
card
].
tx_num_channels
=
1
;
openair0_cfg
[
card
].
rx_num_channels
=
1
;
openair0_cfg
[
card
].
tx_num_channels
=
NB_ANTENNAS_TX
;
openair0_cfg
[
card
].
rx_num_channels
=
NB_ANTENNAS_RX
;
printf
(
"HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %d
\n
"
,
card
,
...
...
@@ -116,7 +118,7 @@ int main( int argc, char **argv ) {
openair0_cfg
[
card
].
sdr_addrs
=
"dev=pciex:0,auxdac1=300"
;
openair0_timestamp
timestamp
,
writeTimestamp
;
openair0_timestamp
timestamp
,
timestampold
,
writeTimestamp
;
int32_t
*
rxp
[
NB_ANTENNAS_RX
];
int32_t
*
txp
[
NB_ANTENNAS_TX
];
int
start_rx_stream
=
1
;
...
...
@@ -128,9 +130,12 @@ int main( int argc, char **argv ) {
for
(
int
i
=
0
;
i
<
NB_ANTENNAS_RX
;
i
++
)
{
txp
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
txdata_size
);
rxp
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
rxdata_size
);
}
for
(
int
i
=
0
;
i
<
NB_ANTENNAS_TX
;
i
++
)
{
txp
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
txdata_size
);
}
int
readBlockSize
,
writeBlockSize
;
...
...
@@ -150,7 +155,7 @@ int main( int argc, char **argv ) {
(
void
**
)
rxp
,
readBlockSize
,
1
);
timestampold
=
timestamp
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ
,
VCD_FUNCTION_OUT
);
clock_gettime
(
CLOCK_REALTIME
,
&
time_stop
);
clock_gettime_cur
=
NR_TIMESPEC_TO_DOUBLE_US
(
nr_get_timespec_diff
(
&
time_start
,
&
time_stop
));
//us
...
...
@@ -162,10 +167,13 @@ int main( int argc, char **argv ) {
clock_gettime
(
CLOCK_REALTIME
,
&
time_stop
);
clock_gettime_cur
=
NR_TIMESPEC_TO_DOUBLE_US
(
nr_get_timespec_diff
(
&
time_start
,
&
time_stop
));
//us
if
(
clock_gettime_cur
>
1000
)
printf
(
"slot_num %d, time = %.2f sec, delay_time=%.2lf msec
\n
"
,
absolute_slot
,
((
float
)
absolute_slot
)
/
2
/
1000
,
clock_gettime_cur
/
1000
);
if
(
clock_gettime_cur
>
510
)
printf
(
"slot_num %d, timestamp %ld, writeTimestamp %ld,time = %.2f sec, delay_time=%.2lf msec. readBlockSize %d. real read %ld.
\n
"
,
absolute_slot
,
timestamp
,
writeTimestamp
,
((
float
)
absolute_slot
)
/
2
/
1000
,
clock_gettime_cur
/
1000
,
readBlockSize
,(
timestamp
-
timestampold
));
clock_gettime
(
CLOCK_REALTIME
,
&
time_start
);
timestampold
=
timestamp
;
#if 1
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ
,
VCD_FUNCTION_IN
);
rfdevice
.
trx_read_func
(
&
rfdevice
,
&
timestamp
,
...
...
@@ -174,10 +182,12 @@ int main( int argc, char **argv ) {
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ
,
VCD_FUNCTION_OUT
);
#endif
#if 1
// use previous timing_advance value to compute writeTimestamp
//writeTimestamp = timestamp+samples_per_subframe/20*5;// sent after 5 slot.
writeTimestamp
=
timestamp
+
samples_per_subframe
/
2
*
5
;
// sent after 5 slot.
writeTimestamp
+=
timestamp
+
samples_per_subframe
/
2
;
// sent after 5 slot.
// but use current UE->timing_advance value to compute writeBlockSize
...
...
@@ -189,8 +199,8 @@ int main( int argc, char **argv ) {
1
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE
,
VCD_FUNCTION_OUT
);
}
// while !oai_exit
#endif
}
// while !oai_exit
return
0
;
}
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