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
d27f52e0
Commit
d27f52e0
authored
Apr 21, 2021
by
Laurent THOMAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add SMVB convertion tool and one old bug fix in command line processing discovered while testing
parent
f207b202
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
227 additions
and
7 deletions
+227
-7
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+6
-1
common/config/config_userapi.c
common/config/config_userapi.c
+6
-1
common/utils/LOG/log.h
common/utils/LOG/log.h
+1
-0
executables/softmodem-common.c
executables/softmodem-common.c
+0
-1
targets/ARCH/rfsimulator/SMVB100-RS-signal-generator.png
targets/ARCH/rfsimulator/SMVB100-RS-signal-generator.png
+0
-0
targets/ARCH/rfsimulator/convert_SMVB.c
targets/ARCH/rfsimulator/convert_SMVB.c
+198
-0
targets/ARCH/rfsimulator/stored_node.c
targets/ARCH/rfsimulator/stored_node.c
+16
-4
No files found.
cmake_targets/CMakeLists.txt
View file @
d27f52e0
...
...
@@ -2871,6 +2871,11 @@ add_executable(replay_node
)
target_link_libraries
(
replay_node minimal_lib
)
add_executable
(
convertSMVB
${
OPENAIR_TARGETS
}
/ARCH/rfsimulator/convert_SMVB.c
)
target_link_libraries
(
convertSMVB minimal_lib
)
add_executable
(
measurement_display
${
OPENAIR_DIR
}
/common/utils/threadPool/measurement_display.c
)
target_link_libraries
(
measurement_display minimal_lib
)
...
...
@@ -3496,7 +3501,7 @@ if (${T_TRACER})
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB
CN_UTILS
${
GTPV1U
}
SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts
)
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts
)
if
(
TARGET
${
i
}
)
add_dependencies
(
${
i
}
generate_T
)
endif
()
...
...
common/config/config_userapi.c
View file @
d27f52e0
...
...
@@ -83,9 +83,14 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
}
if
(
*
ptr
==
NULL
)
{
*
ptr
=
malloc
(
length
>
40
?
length
:
40
);
// LTS: dummy fix, waiting Francois full fix in 4G branch
// the issue is we don't know at this point the size we will get
// for parmeters on the command line,
// The length sould probably managed, in a later version
// 100 is a very large value for a string parameter of today OAI
if
(
length
<
100
)
length
=
100
;
*
ptr
=
malloc
(
length
);
if
(
*
ptr
!=
NULL
)
{
memset
(
*
ptr
,
0
,
length
);
...
...
common/utils/LOG/log.h
View file @
d27f52e0
...
...
@@ -434,6 +434,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
# define LOG_VAR(A,B) A B
# define T_ACTIVE(a) (0)
# endif
/* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define GCC_NOTUSED __attribute__((unused))
...
...
executables/softmodem-common.c
View file @
d27f52e0
...
...
@@ -45,7 +45,6 @@
static
softmodem_params_t
softmodem_params
;
char
*
parallel_config
=
NULL
;
char
*
worker_config
=
NULL
;
msc_interface_t
msc_interface
;
int
usrp_tx_thread
=
0
;
uint8_t
nfapi_mode
=
0
;
...
...
targets/ARCH/rfsimulator/SMVB100-RS-signal-generator.png
0 → 100644
View file @
d27f52e0
190 KB
targets/ARCH/rfsimulator/convert_SMVB.c
0 → 100644
View file @
d27f52e0
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Author and copyright: Laurent Thomas, open-cells.com
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <common/utils/simple_executable.h>
#include <sys/sendfile.h>
volatile
int
oai_exit
=
0
;
#define shift 4
int32_t
signal_energy
(
int32_t
*
input
,
uint32_t
length
)
{
int32_t
i
;
int32_t
temp
,
temp2
;
register
__m64
mm0
,
mm1
,
mm2
,
mm3
;
__m64
*
in
=
(
__m64
*
)
input
;
mm0
=
_mm_setzero_si64
();
//pxor(mm0,mm0);
mm3
=
_mm_setzero_si64
();
//pxor(mm3,mm3);
for
(
i
=
0
;
i
<
length
>>
1
;
i
++
)
{
mm1
=
in
[
i
];
mm2
=
mm1
;
mm1
=
_m_pmaddwd
(
mm1
,
mm1
);
mm1
=
_m_psradi
(
mm1
,
shift
);
// shift any 32 bits blocs of the word by the value shift
mm0
=
_m_paddd
(
mm0
,
mm1
);
// add the two 64 bits words 4 bytes by 4 bytes
// mm2 = _m_psrawi(mm2,shift_DC);
mm3
=
_m_paddw
(
mm3
,
mm2
);
// add the two 64 bits words 2 bytes by 2 bytes
}
mm1
=
mm0
;
mm0
=
_m_psrlqi
(
mm0
,
32
);
mm0
=
_m_paddd
(
mm0
,
mm1
);
temp
=
_m_to_int
(
mm0
);
temp
/=
length
;
temp
<<=
shift
;
// this is the average of x^2
// now remove the DC component
mm2
=
_m_psrlqi
(
mm3
,
32
);
mm2
=
_m_paddw
(
mm2
,
mm3
);
mm2
=
_m_pmaddwd
(
mm2
,
mm2
);
temp2
=
_m_to_int
(
mm2
);
temp2
/=
(
length
*
length
);
// temp2<<=(2*shift_DC);
temp
-=
temp2
;
_mm_empty
();
_m_empty
();
return
((
temp
>
0
)
?
temp
:
1
);
}
#define RS_head 256
void
write_RS_header
(
int
fd
,
ssize_t
sz
,
int
samplingRate
)
{
const
char
l1
[]
=
"{TYPE: SMU-WV,0}"
;
const
char
l2
[]
=
"{COMMENT: Generated by OAI}"
;
const
char
l3
[]
=
"{DATE: %Y-%m-%d;%H:%M:%S}"
;
const
char
l4
[]
=
"{LEVEL OFFS: 0.000000,0.00000}"
;
const
char
l5
[]
=
"{CLOCK: %d}"
;
const
char
l6
[]
=
"{SAMPLES: %ld}"
;
const
char
l7
[]
=
"{WAVEFORM-%ld: #"
;
int
ret
=
0
;
ret
+=
write
(
fd
,
l1
,
strlen
(
l1
));
ret
+=
write
(
fd
,
l2
,
strlen
(
l2
));
time_t
t
=
time
(
NULL
);
struct
tm
*
tmp
=
localtime
(
&
t
);
AssertFatal
(
tmp
!=
NULL
,
""
);
char
outstr
[
200
];
strftime
(
outstr
,
sizeof
(
outstr
),
l3
,
tmp
);
ret
+=
write
(
fd
,
outstr
,
strlen
(
outstr
));
ret
+=
write
(
fd
,
l4
,
strlen
(
l4
));
sprintf
(
outstr
,
l5
,
samplingRate
);
ret
+=
write
(
fd
,
outstr
,
strlen
(
outstr
));
sprintf
(
outstr
,
l6
,
sz
);
ret
+=
write
(
fd
,
outstr
,
strlen
(
outstr
));
sprintf
(
outstr
,
l7
,
sz
*
4
+
1
);
for
(
int
i
=
lseek
(
fd
,
0
,
SEEK_CUR
)
+
strlen
(
outstr
);
i
<
RS_head
;
i
++
)
ret
+=
write
(
fd
,
" "
,
1
);
ret
+=
write
(
fd
,
outstr
,
strlen
(
outstr
));
AssertFatal
(
ret
==
RS_head
,
""
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
5
)
{
printf
(
"This program converts
\n
a stored I/Q file in rfsimulator saved IQ format or
\n
a raw I/Q file (signed 16bits)
\n
to R&S format
\n
Need parameters: source file, destination file,
\n
sampling rate in Hz,
\n
nb max of samples in output
\n
"
);
exit
(
1
);
}
int
fdIn
=
open
(
argv
[
1
],
O_RDONLY
);
AssertFatal
(
fdIn
!=
-
1
,
"file: %s"
,
argv
[
1
]);
off_t
fileSize
=
lseek
(
fdIn
,
0
,
SEEK_END
);
lseek
(
fdIn
,
0
,
SEEK_SET
);
int
fdOut
=
creat
(
argv
[
2
],
0660
);
AssertFatal
(
fdOut
!=
-
1
,
"file: %s"
,
argv
[
1
]);
int
samplingRate
=
atoi
(
argv
[
3
]);
boolean_t
raw
=
true
;
uint64_t
magic
;
int
ret
=
read
(
fdIn
,
&
magic
,
sizeof
(
magic
));
AssertFatal
(
ret
==
sizeof
(
magic
),
""
);
if
(
magic
==
UE_MAGICDL
||
magic
==
UE_MAGICUL
||
magic
==
ENB_MAGICDL
||
magic
==
ENB_MAGICUL
)
raw
=
false
;
lseek
(
fdIn
,
0
,
SEEK_SET
);
int
maxSamples
=
atoi
(
argv
[
4
]);
if
(
raw
)
{
// sequence of 2*16 bits ints, as R&S we need only to add the header
if
(
maxSamples
*
4
<
fileSize
)
fileSize
=
maxSamples
*
4
;
write_RS_header
(
fdOut
,
fileSize
,
samplingRate
);
ssize_t
bytesCopied
=
0
;
// We could consider rescaling
while
(
bytesCopied
!=
fileSize
)
{
ssize_t
res
=
sendfile
(
fdOut
,
fdIn
,
&
bytesCopied
,
fileSize
);
AssertFatal
(
res
>
0
,
""
);
}
}
else
{
samplesBlockHeader_t
header
,
firstHeader
;
int
bufSize
=
100000
;
void
*
buff
=
malloc
(
bufSize
);
AssertFatal
(
buff
!=
NULL
,
""
);
int
ret
=
read
(
fdIn
,
&
firstHeader
,
sizeof
(
header
));
AssertFatal
(
ret
==
sizeof
(
header
),
""
);
lseek
(
fdIn
,
0
,
SEEK_SET
);
AssertFatal
(
firstHeader
.
nbAnt
==
1
,
"R&S SMBV is one Tx
\n
"
);
uint64_t
timestamp
=
firstHeader
.
timestamp
;
uint32_t
zero
=
0
,
zeros
[
64
]
=
{
0
};
// Reserve room for the header
lseek
(
fdOut
,
RS_head
,
SEEK_SET
);
int
nb
=
0
;
while
(
read
(
fdIn
,
&
header
,
sizeof
(
header
))
==
sizeof
(
header
)
&&
nb
<
maxSamples
)
{
int
dataSize
=
sizeof
(
int32_t
)
*
header
.
size
*
header
.
nbAnt
;
AssertFatal
(
header
.
nbAnt
==
1
,
""
);
if
(
dataSize
>
bufSize
)
{
void
*
new_buff
=
realloc
(
buff
,
dataSize
);
if
(
new_buff
==
NULL
)
AssertFatal
(
false
,
"Could not reallocate"
);
else
buff
=
new_buff
;
}
while
(
timestamp
+
64
<
header
.
timestamp
&&
nb
+
64
<
maxSamples
){
int
ret
=
write
(
fdOut
,
&
zeros
,
sizeof
(
zeros
));
AssertFatal
(
ret
==
sizeof
(
zeros
),
""
);
timestamp
+=
64
;
nb
+=
64
;
}
while
(
timestamp
<
header
.
timestamp
&&
nb
<
maxSamples
){
int
ret
=
write
(
fdOut
,
&
zero
,
sizeof
(
zero
));
AssertFatal
(
ret
==
sizeof
(
zero
),
""
);
timestamp
++
;
nb
++
;
}
ssize_t
ret
=
read
(
fdIn
,
buff
,
dataSize
);
AssertFatal
(
ret
==
dataSize
,
""
);
for
(
int
i
=
0
;
i
<
header
.
size
*
header
.
nbAnt
*
2
;
i
++
)
((
int16_t
*
)
buff
)[
i
]
*=
16
;
if
(
nb
>=
maxSamples
)
break
;
// we have already all samples
if
(
nb
+
header
.
size
>
maxSamples
)
{
header
.
size
=
maxSamples
-
nb
;
dataSize
=
sizeof
(
int32_t
)
*
header
.
size
*
header
.
nbAnt
;
}
ret
=
write
(
fdOut
,
buff
,
dataSize
);
AssertFatal
(
ret
==
dataSize
,
"%ld, %s"
,
ret
,
strerror
(
errno
));
timestamp
+=
header
.
size
;
nb
+=
header
.
size
;
}
printf
(
"converted %ld samples, control: %d
\n
"
,
timestamp
-
firstHeader
.
timestamp
,
nb
);
free
(
buff
);
lseek
(
fdOut
,
0
,
SEEK_SET
);
write_RS_header
(
fdOut
,
timestamp
-
firstHeader
.
timestamp
,
samplingRate
);
lseek
(
fdOut
,
0
,
SEEK_END
);
}
int
ret2
=
write
(
fdOut
,
"}"
,
1
);
AssertFatal
(
ret2
=
1
,
""
);
close
(
fdOut
);
close
(
fdIn
);
return
0
;
}
targets/ARCH/rfsimulator/stored_node.c
View file @
d27f52e0
...
...
@@ -178,6 +178,7 @@ int main(int argc, char *argv[]) {
int
fd
;
AssertFatal
((
fd
=
open
(
argv
[
1
],
O_RDONLY
))
!=
-
1
,
"file: %s"
,
argv
[
1
]);
off_t
fileSize
=
lseek
(
fd
,
0
,
SEEK_END
);
lseek
(
fd
,
0
,
SEEK_SET
);
int
serviceSock
;
if
(
strcmp
(
argv
[
2
],
"server"
)
==
0
)
{
...
...
@@ -193,21 +194,33 @@ int main(int argc, char *argv[]) {
raw
=
true
;
if
(
strcmp
(
argv
[
4
],
"UL"
)
==
0
)
typeStamp
=
UE_MAGIC
D
L
;
typeStamp
=
UE_MAGIC
U
L
;
}
uint64_t
magic
;
read
(
fd
,
&
magic
,
sizeof
(
magic
));
if
(
magic
==
UE_MAGICDL
||
magic
==
UE_MAGICUL
||
magic
==
ENB_MAGICDL
||
magic
==
ENB_MAGICUL
)
{
printf
(
"detected rfsimulator recorded file
\n
"
);
raw
=
false
;
}
lseek
(
fd
,
0
,
SEEK_SET
);
samplesBlockHeader_t
header
;
int
bufSize
=
100000
;
void
*
buff
=
malloc
(
bufSize
);
uint64_t
timestamp
=
0
;
const
int
blockSize
=
1920
;
// If fileSize is not multiple of blockSize*4 then discard remaining samples
fileSize
=
(
fileSize
/
(
blockSize
<<
2
))
*
(
blockSize
<<
2
);
while
(
1
)
{
//Rewind the file to loop on the samples
if
(
lseek
(
fd
,
0
,
SEEK_CUR
)
>=
fileSize
)
if
(
lseek
(
fd
,
0
,
SEEK_CUR
)
>=
fileSize
)
{
lseek
(
fd
,
0
,
SEEK_SET
);
// we will increment timestamp when we roll on the file
timestamp
+=
header
.
timestamp
+
header
.
size
;
}
// Read one block and send it
setblocking
(
serviceSock
,
blocking
);
...
...
@@ -222,6 +235,7 @@ int main(int argc, char *argv[]) {
header
.
option_flag
=
0
;
}
else
{
AssertFatal
(
read
(
fd
,
&
header
,
sizeof
(
header
)),
""
);
header
.
timestamp
+=
timestamp
;
}
fullwrite
(
serviceSock
,
&
header
,
sizeof
(
header
));
...
...
@@ -239,11 +253,9 @@ int main(int argc, char *argv[]) {
}
AssertFatal
(
read
(
fd
,
buff
,
dataSize
)
==
dataSize
,
""
);
if
(
raw
)
// UHD shifts the 12 ADC values in MSB
for
(
int
i
=
0
;
i
<
header
.
size
*
header
.
nbAnt
*
2
;
i
++
)
((
int16_t
*
)
buff
)[
i
]
/=
16
;
usleep
(
1000
);
printf
(
"sending at ts: %lu, number of samples: %d, energy: %d
\n
"
,
header
.
timestamp
,
header
.
size
,
signal_energy
(
buff
,
header
.
size
));
...
...
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