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
d30a28c3
Commit
d30a28c3
authored
Feb 25, 2020
by
WANG Tsu-Han
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding check for overflow, removing prints and parameter setting fix
parent
c2b3867f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
31 deletions
+20
-31
executables/nr-ru.c
executables/nr-ru.c
+1
-6
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+5
-4
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+14
-21
No files found.
executables/nr-ru.c
View file @
d30a28c3
...
...
@@ -717,7 +717,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
NR_DL_FRAME_PARMS
*
fp
=
ru
->
nr_frame_parms
;
//nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config;
void
*
txp
[
ru
->
nb_tx
];
char
*
print_test
[
ru
->
nb_tx
];
unsigned
int
txs
;
int
i
;
T
(
T_ENB_PHY_OUTPUT_SIGNAL
,
T_INT
(
0
),
T_INT
(
0
),
T_INT
(
frame
),
T_INT
(
slot
),
...
...
@@ -762,27 +761,23 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
for
(
i
=
0
;
i
<
ru
->
nb_tx
;
i
++
){
txp
[
i
]
=
(
void
*
)
&
ru
->
common
.
txdata
[
i
][(
slot
*
fp
->
samples_per_slot
)
-
sf_extension
];
}
print_test
[
0
]
=
(
char
*
)
&
ru
->
common
.
txdata
[
0
][(
slot
*
fp
->
samples_per_slot
)
-
sf_extension
];
printf
(
"txdata[0] = %p
\n
"
,
print_test
[
0
]);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST
,
(
timestamp
-
ru
->
openair0_cfg
.
tx_sample_advance
)
&
0xffffffff
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE
,
1
);
// prepare tx buffer pointers
start_meas
(
&
ru
->
tx_fhaul
);
printf
(
"sending trx write from tx_rf
\n
"
);
txs
=
ru
->
rfdevice
.
trx_write_func
(
&
ru
->
rfdevice
,
timestamp
+
ru
->
ts_offset
-
ru
->
openair0_cfg
.
tx_sample_advance
-
sf_extension
,
txp
,
siglen
+
sf_extension
,
ru
->
nb_tx
,
flags
);
//printf("txp = %s\n", (char*)txp[0]);
stop_meas
(
&
ru
->
tx_fhaul
);
LOG_D
(
PHY
,
"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d
\n
"
,
ru
->
idx
,
(
long
long
unsigned
int
)
timestamp
,
frame
,
proc
->
frame_tx_unwrap
,
slot
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE
,
0
);
//AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen
);
AssertFatal
(
txs
==
0
,
"trx write function error %d
\n
"
,
txs
);
}
}
...
...
targets/ARCH/COMMON/common_lib.h
View file @
d30a28c3
...
...
@@ -48,6 +48,9 @@
#define RAU_LOCAL_RADIO_HEAD 0
#define RAU_REMOTE_RADIO_HEAD 1
#define WRITE_THREAD_PACKAGE 10
#define WRITE_THREAD_BUFFER_SIZE 8
#ifndef MAX_CARDS
#define MAX_CARDS 8
#endif
...
...
@@ -278,7 +281,7 @@ typedef struct {
typedef
struct
{
openair0_timestamp
timestamp
;
void
*
buff
[
8
];
// buffer to be write;
void
*
buff
[
WRITE_THREAD_BUFFER_SIZE
];
// buffer to be write;
int
nsamps
;
int
cc
;
signed
char
first_packet
;
...
...
@@ -286,9 +289,7 @@ typedef struct {
}
openair0_write_package_t
;
typedef
struct
{
openair0_write_package_t
write_package
[
10
];
/// write package number
int
num_package
;
openair0_write_package_t
write_package
[
WRITE_THREAD_PACKAGE
];
int
start
;
int
end
;
/// \internal This variable is protected by \ref mutex_write
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
d30a28c3
...
...
@@ -405,11 +405,11 @@ static int trx_usrp_write_recplay(openair0_device *device, openair0_timestamp ti
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/
static
int
trx_usrp_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
int
ret
=
0
;
int
end
;
openair0_thread_t
*
write_thread
=
&
device
->
write_thread
;
openair0_write_package_t
*
write_package
=
write_thread
->
write_package
;
AssertFatal
(
WRITE_THREAD_BUFFER_SIZE
>=
cc
,
"Do not support more than %d cc number
\n
"
,
WRITE_THREAD_BUFFER_SIZE
);
boolean_t
first_packet_state
=
false
,
last_packet_state
=
false
;
...
...
@@ -440,10 +440,15 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
first_packet_state
=
false
;
last_packet_state
=
true
;
}
printf
(
"~~~1 buff in usrp write = %p
\n
"
,
buff
[
0
]);
pthread_mutex_lock
(
&
write_thread
->
mutex_write
);
if
(
write_thread
->
instance_cnt_write
>=
WRITE_THREAD_PACKAGE
){
LOG_W
(
HW
,
"Buffer overflow, resetting write package
\n
"
);
write_thread
->
end
=
write_thread
->
start
;
write_thread
->
instance_cnt_write
=
0
;
}
end
=
write_thread
->
end
;
printf
(
"package being write is %d
\n
"
,
end
);
write_package
[
end
].
timestamp
=
timestamp
;
write_package
[
end
].
nsamps
=
nsamps
;
write_package
[
end
].
cc
=
cc
;
...
...
@@ -451,11 +456,9 @@ printf("package being write is %d\n", end);
write_package
[
end
].
last_packet
=
last_packet_state
;
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
write_package
[
end
].
buff
[
i
]
=
buff
[
i
];
printf
(
"~~~2 write_package buff in usrp write = %p
\n
"
,
write_package
[
end
].
buff
[
0
]);
write_thread
->
instance_cnt_write
=
0
;
write_thread
->
end
=
(
write_thread
->
end
+
1
)
%
write_thread
->
num_package
;
++
write_thread
->
instance_cnt_write
;
write_thread
->
end
=
(
write_thread
->
end
+
1
)
%
WRITE_THREAD_PACKAGE
;
pthread_cond_signal
(
&
write_thread
->
cond_write
);
printf
(
"trx_usrp_write signal end
\n
"
);
pthread_mutex_unlock
(
&
write_thread
->
mutex_write
);
...
...
@@ -489,28 +492,20 @@ void *trx_usrp_write_thread(void * arg){
while
(
1
){
pthread_mutex_lock
(
&
write_thread
->
mutex_write
);
printf
(
"waiting for signal
\n
"
);
while
(
write_thread
->
instance_cnt_write
<
0
)
{
while
(
write_thread
->
instance_cnt_write
==
0
)
{
pthread_cond_wait
(
&
write_thread
->
cond_write
,
&
write_thread
->
mutex_write
);
// this unlocks mutex_rxtx while waiting and then locks it again
}
printf
(
"signal unlock
\n
"
);
s
=
(
usrp_state_t
*
)
device
->
priv
;
start
=
write_thread
->
start
;
printf
(
"package bing use is start = %d, end = %d
\n
"
,
start
,
write_thread
->
end
);
timestamp
=
write_package
[
start
].
timestamp
;
buff
=
write_package
[
start
].
buff
;
nsamps
=
write_package
[
start
].
nsamps
;
cc
=
write_package
[
start
].
cc
;
first_packet
=
write_package
[
start
].
first_packet
;
last_packet
=
write_package
[
start
].
last_packet
;
write_thread
->
start
=
(
write_thread
->
start
+
1
)
%
write_thread
->
num_package
;
if
(
write_thread
->
end
==
write_thread
->
start
){
write_thread
->
instance_cnt_write
=
-
1
;
}
write_thread
->
start
=
(
write_thread
->
start
+
1
)
%
WRITE_THREAD_PACKAGE
;
--
write_thread
->
instance_cnt_write
;
pthread_mutex_unlock
(
&
write_thread
->
mutex_write
);
printf
(
"end of write thread signal getting
\n
"
);
printf
(
"~~~2.5 write_package buff in thread = %p
\n
"
,
write_package
[
start
].
buff
[
0
]);
printf
(
"~~~3 buff in tx write thread= %p
\n
"
,
buff
[
0
]);
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
...
...
@@ -557,7 +552,6 @@ printf("~~~3 buff in tx write thread= %p\n", buff[0]);
ret
=
(
int
)
s
->
tx_stream
->
send
(
buff_ptrs
,
nsamps
,
s
->
tx_md
);
}
else
ret
=
(
int
)
s
->
tx_stream
->
send
(
&
(((
int16_t
*
)
buff_tx
[
0
])[
0
]),
nsamps
,
s
->
tx_md
);
if
(
ret
!=
nsamps
)
LOG_E
(
HW
,
"[xmit] tx samples %d != %d
\n
"
,
ret
,
nsamps
);
printf
(
"end of sending buffer in trx write thread
\n
"
);
if
(
0
)
break
;
}
...
...
@@ -571,10 +565,9 @@ int trx_write_init(openair0_device *device){
openair0_thread_t
*
write_thread
=
&
device
->
write_thread
;
printf
(
"initializing tx write thread
\n
"
);
write_thread
->
num_package
=
10
;
write_thread
->
start
=
0
;
write_thread
->
end
=
0
;
write_thread
->
instance_cnt_write
=
-
1
;
write_thread
->
instance_cnt_write
=
0
;
printf
(
"end of tx write thread
\n
"
);
pthread_create
(
&
write_thread
->
pthread_write
,
NULL
,
trx_usrp_write_thread
,(
void
*
)
device
);
...
...
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