Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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 UE
Commits
64a0dac2
Commit
64a0dac2
authored
Dec 20, 2019
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop-nr' into NR_RRCConfiguration
parents
148ceeb8
fa17bd52
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1056 additions
and
653 deletions
+1056
-653
ci-scripts/main.py
ci-scripts/main.py
+17
-1
ci-scripts/oai-ci-vm-tool
ci-scripts/oai-ci-vm-tool
+5
-1
ci-scripts/reportTestLocally.sh
ci-scripts/reportTestLocally.sh
+128
-2
ci-scripts/runTestOnVM.sh
ci-scripts/runTestOnVM.sh
+313
-33
ci-scripts/xml_files/gnb_usrp_build.xml
ci-scripts/xml_files/gnb_usrp_build.xml
+1
-0
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-0
common/config/config_userapi.c
common/config/config_userapi.c
+2
-3
executables/nr-ru.c
executables/nr-ru.c
+3
-0
executables/nr-softmodem.c
executables/nr-softmodem.c
+0
-1
executables/nr-softmodem.h
executables/nr-softmodem.h
+0
-1
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+1
-1
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+1
-1
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+1
-1
openair1/PHY/NR_TRANSPORT/nr_ulsch.h
openair1/PHY/NR_TRANSPORT/nr_ulsch.h
+1
-1
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+11
-14
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+27
-26
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+5
-4
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+1
-1
openair1/PHY/NR_UE_TRANSPORT/pbch_nr.c
openair1/PHY/NR_UE_TRANSPORT/pbch_nr.c
+1
-1
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+8
-6
openair1/SIMULATION/NR_PHY/dlschsim.c
openair1/SIMULATION/NR_PHY/dlschsim.c
+1
-1
openair2/COMMON/platform_types.h
openair2/COMMON/platform_types.h
+7
-0
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
+5
-5
openair2/NETWORK_DRIVER/UE_IP/common.c
openair2/NETWORK_DRIVER/UE_IP/common.c
+3
-3
openair2/UTIL/OTG/otg_rx_socket.c
openair2/UTIL/OTG/otg_rx_socket.c
+1
-1
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+2
-0
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+381
-531
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
+55
-13
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
+73
-0
targets/RT/USER/lte-softmodem.h
targets/RT/USER/lte-softmodem.h
+1
-1
No files found.
ci-scripts/main.py
View file @
64a0dac2
...
@@ -128,6 +128,7 @@ class SSHConnection():
...
@@ -128,6 +128,7 @@ class SSHConnection():
self
.
Build_eNB_args
=
''
self
.
Build_eNB_args
=
''
self
.
backgroundBuild
=
False
self
.
backgroundBuild
=
False
self
.
backgroundBuildTestId
=
[
''
,
''
,
''
]
self
.
backgroundBuildTestId
=
[
''
,
''
,
''
]
self
.
Build_eNB_forced_workspace_cleanup
=
False
self
.
Initialize_eNB_args
=
''
self
.
Initialize_eNB_args
=
''
self
.
air_interface
=
'lte'
self
.
air_interface
=
'lte'
self
.
eNB_instance
=
''
self
.
eNB_instance
=
''
...
@@ -370,9 +371,16 @@ class SSHConnection():
...
@@ -370,9 +371,16 @@ class SSHConnection():
self
.
air_interface
=
'nr'
self
.
air_interface
=
'nr'
else
:
else
:
self
.
air_interface
=
'lte'
self
.
air_interface
=
'lte'
if
self
.
Build_eNB_forced_workspace_cleanup
:
self
.
command
(
'echo '
+
lPassWord
+
' | sudo -S rm -Rf '
+
lSourcePath
,
'\$'
,
15
)
result
=
re
.
search
(
'([a-zA-Z0-9\:\-\.\/])+\.git'
,
self
.
ranRepository
)
if
result
is
not
None
:
full_ran_repo_name
=
self
.
ranRepository
else
:
full_ran_repo_name
=
self
.
ranRepository
+
'.git'
self
.
command
(
'mkdir -p '
+
lSourcePath
,
'\$'
,
5
)
self
.
command
(
'mkdir -p '
+
lSourcePath
,
'\$'
,
5
)
self
.
command
(
'cd '
+
lSourcePath
,
'\$'
,
5
)
self
.
command
(
'cd '
+
lSourcePath
,
'\$'
,
5
)
self
.
command
(
'if [ ! -e .git ]; then stdbuf -o0 git clone '
+
self
.
ranRepository
+
' .; else stdbuf -o0 git fetch --prune; fi'
,
'\$'
,
600
)
self
.
command
(
'if [ ! -e .git ]; then stdbuf -o0 git clone '
+
full_ran_repo_name
+
' .; else stdbuf -o0 git fetch --prune; fi'
,
'\$'
,
600
)
# Raphael: here add a check if git clone or git fetch went smoothly
# Raphael: here add a check if git clone or git fetch went smoothly
self
.
command
(
'git config user.email "jenkins@openairinterface.org"'
,
'\$'
,
5
)
self
.
command
(
'git config user.email "jenkins@openairinterface.org"'
,
'\$'
,
5
)
self
.
command
(
'git config user.name "OAI Jenkins"'
,
'\$'
,
5
)
self
.
command
(
'git config user.name "OAI Jenkins"'
,
'\$'
,
5
)
...
@@ -4158,6 +4166,14 @@ def CheckClassValidity(action,id):
...
@@ -4158,6 +4166,14 @@ def CheckClassValidity(action,id):
def
GetParametersFromXML
(
action
):
def
GetParametersFromXML
(
action
):
if
action
==
'Build_eNB'
:
if
action
==
'Build_eNB'
:
SSH
.
Build_eNB_args
=
test
.
findtext
(
'Build_eNB_args'
)
SSH
.
Build_eNB_args
=
test
.
findtext
(
'Build_eNB_args'
)
forced_workspace_cleanup
=
test
.
findtext
(
'forced_workspace_cleanup'
)
if
(
forced_workspace_cleanup
is
None
):
SSH
.
Build_eNB_forced_workspace_cleanup
=
False
else
:
if
re
.
match
(
'true'
,
forced_workspace_cleanup
,
re
.
IGNORECASE
):
SSH
.
Build_eNB_forced_workspace_cleanup
=
True
else
:
SSH
.
Build_eNB_forced_workspace_cleanup
=
False
SSH
.
eNB_instance
=
test
.
findtext
(
'eNB_instance'
)
SSH
.
eNB_instance
=
test
.
findtext
(
'eNB_instance'
)
if
(
SSH
.
eNB_instance
is
None
):
if
(
SSH
.
eNB_instance
is
None
):
SSH
.
eNB_instance
=
'0'
SSH
.
eNB_instance
=
'0'
...
...
ci-scripts/oai-ci-vm-tool
View file @
64a0dac2
...
@@ -197,11 +197,15 @@ function variant__v4__cppcheck {
...
@@ -197,11 +197,15 @@ function variant__v4__cppcheck {
}
}
function
variant__v5__gnb_usrp
{
function
variant__v5__gnb_usrp
{
VM_MEMORY
=
8192
VM_CPU
=
8
NB_PATTERN_FILES
=
9
NB_PATTERN_FILES
=
9
BUILD_OPTIONS
=
"--gNB -w USRP"
BUILD_OPTIONS
=
"--gNB -w USRP"
}
}
function
variant__v6__nr_ue_usrp
{
function
variant__v6__nr_ue_usrp
{
VM_MEMORY
=
4096
VM_CPU
=
4
NB_PATTERN_FILES
=
9
NB_PATTERN_FILES
=
9
BUILD_OPTIONS
=
"--nrUE -w USRP"
BUILD_OPTIONS
=
"--nrUE -w USRP"
}
}
...
@@ -234,8 +238,8 @@ function variant__v20__l1_sim {
...
@@ -234,8 +238,8 @@ function variant__v20__l1_sim {
}
}
function
variant__v21__rf_sim
{
function
variant__v21__rf_sim
{
ARCHIVES_LOC
=
rf_sim
RUN_OPTIONS
=
"complex"
RUN_OPTIONS
=
"complex"
EXPERIMENTAL
=
"true"
}
}
function
variant__v22__l2_sim
{
function
variant__v22__l2_sim
{
...
...
ci-scripts/reportTestLocally.sh
View file @
64a0dac2
...
@@ -97,14 +97,20 @@ function analyzeIperfFiles {
...
@@ -97,14 +97,20 @@ function analyzeIperfFiles {
FILE_COMPLETE
=
`
egrep
-c
"Server Report"
$IPERF_CASE
`
FILE_COMPLETE
=
`
egrep
-c
"Server Report"
$IPERF_CASE
`
if
[
$FILE_COMPLETE
-eq
0
]
if
[
$FILE_COMPLETE
-eq
0
]
then
then
echo
" <td bgcolor =
\"
red
\"
>KO</td>"
>>
./test_simulator_results.html
SERVER_FILE
=
`
echo
$IPERF_CASE
|
sed
-e
"s#client#server#"
`
SERVER_FILE
=
`
echo
$IPERF_CASE
|
sed
-e
"s#client#server#"
`
FLOAT_EFF_BITRATE
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*Bytes *##"
-e
"s#sec *.*#sec#"
|
awk
'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'
`
FLOAT_EFF_BITRATE
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*Bytes *##"
-e
"s#sec *.*#sec#"
|
awk
'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'
`
EFFECTIVE_BITRATE
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*Bytes *##"
-e
"s#sec *.*#sec#"
|
awk
'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}}'
`
EFFECTIVE_BITRATE
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*Bytes *##"
-e
"s#sec *.*#sec#"
|
awk
'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}
else{printf "%.2f KBits/sec", br/1000}
}'
`
PERF
=
`
echo
"100 *
$FLOAT_EFF_BITRATE
/
$FLOAT_REQ_BITRATE
"
| bc
-l
|
awk
'{printf "%.2f", $0}'
`
PERF
=
`
echo
"100 *
$FLOAT_EFF_BITRATE
/
$FLOAT_REQ_BITRATE
"
| bc
-l
|
awk
'{printf "%.2f", $0}'
`
PERF_INT
=
`
echo
"100 *
$FLOAT_EFF_BITRATE
/
$FLOAT_REQ_BITRATE
"
| bc
-l
|
awk
'{printf "%.0f", $0}'
`
JITTER
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*/sec *##"
-e
"s# *ms.*##"
|
awk
'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'
`
JITTER
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*/sec *##"
-e
"s# *ms.*##"
|
awk
'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'
`
PACKETLOSS_NOSIGN
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*(##"
-e
"s#%.*##"
|
awk
'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'
`
PACKETLOSS_NOSIGN
=
`
grep
--color
=
never sec
$SERVER_FILE
|
sed
-e
"s#^.*(##"
-e
"s#%.*##"
|
awk
'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'
`
PACKETLOSS
=
`
echo
"
${
PACKETLOSS_NOSIGN
}
%"
`
PACKETLOSS
=
`
echo
"
${
PACKETLOSS_NOSIGN
}
%"
`
if
[[
$PERF_INT
-lt
80
]]
then
echo
" <td bgcolor =
\"
red
\"
>KO</td>"
>>
./test_simulator_results.html
else
echo
" <td bgcolor =
\"
green
\"
>OK</td>"
>>
./test_simulator_results.html
fi
else
else
EFFECTIVE_BITRATE
=
`
tail
-n3
$IPERF_CASE
| egrep
"Mbits/sec"
|
sed
-e
"s#^.*MBytes *##"
-e
"s#sec.*#sec#"
`
EFFECTIVE_BITRATE
=
`
tail
-n3
$IPERF_CASE
| egrep
"Mbits/sec"
|
sed
-e
"s#^.*MBytes *##"
-e
"s#sec.*#sec#"
`
if
[[
$EFFECTIVE_BITRATE
=
~ .
*
Kbits/sec.
*
]]
if
[[
$EFFECTIVE_BITRATE
=
~ .
*
Kbits/sec.
*
]]
...
@@ -394,6 +400,126 @@ function report_test {
...
@@ -394,6 +400,126 @@ function report_test {
echo
" </div>"
>>
./test_simulator_results.html
echo
" </div>"
>>
./test_simulator_results.html
fi
fi
ARCHIVES_LOC
=
archives/rf_sim/test
if
[
-d
$ARCHIVES_LOC
]
then
echo
" <h3>5G NR RF Simulator Check</h3>"
>>
./test_simulator_results.html
if
[
-f
$ARCHIVES_LOC
/test_final_status.log
]
then
if
[
`
grep
-c
TEST_OK
$ARCHIVES_LOC
/test_final_status.log
`
-eq
1
]
then
echo
" <div class=
\"
alert alert-success
\"
>"
>>
./test_simulator_results.html
echo
" <strong>TEST was SUCCESSFUL <span class=
\"
glyphicon glyphicon-ok-circle
\"
></span></strong>"
>>
./test_simulator_results.html
echo
" </div>"
>>
./test_simulator_results.html
else
echo
" <div class=
\"
alert alert-danger
\"
>"
>>
./test_simulator_results.html
echo
" <strong>TEST was a FAILURE! <span class=
\"
glyphicon glyphicon-ban-circle
\"
></span></strong>"
>>
./test_simulator_results.html
echo
" </div>"
>>
./test_simulator_results.html
fi
else
echo
" <div class=
\"
alert alert-danger
\"
>"
>>
./test_simulator_results.html
echo
" <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=
\"
glyphicon glyphicon-ban-circle
\"
></span></strong>"
>>
./test_simulator_results.html
echo
" </div>"
>>
./test_simulator_results.html
fi
echo
" <button data-toggle=
\"
collapse
\"
data-target=
\"
#oai-rf-sim-test-details
\"
>More details on 5G RF Simulator test results</button>"
>>
./test_simulator_results.html
echo
" <div id=
\"
oai-rf-sim-test-details
\"
class=
\"
collapse
\"
>"
>>
./test_simulator_results.html
echo
" <table border =
\"
1
\"
>"
>>
./test_simulator_results.html
echo
" <tr bgcolor =
\"
#33CCFF
\"
>"
>>
./test_simulator_results.html
echo
" <th>Log File Name</th>"
>>
./test_simulator_results.html
echo
" <th>Command</th>"
>>
./test_simulator_results.html
echo
" <th>Status</th>"
>>
./test_simulator_results.html
echo
" <th>Statistics</th>"
>>
./test_simulator_results.html
echo
" </tr>"
>>
./test_simulator_results.html
EPC_CONFIGS
=(
"noS1"
)
TRANS_MODES
=(
"tdd"
)
BW_CASES
=(
106
)
for
CN_CONFIG
in
${
EPC_CONFIGS
[@]
}
do
for
TMODE
in
${
TRANS_MODES
[@]
}
do
for
BW
in
${
BW_CASES
[@]
}
do
echo
" <tr bgcolor =
\"
#8FBC8F
\"
>"
>>
./test_simulator_results.html
if
[[
$CN_CONFIG
=
~ .
*
wS1.
*
]]
then
echo
" <td align =
\"
center
\"
colspan = 4 >Test with EPC (aka withS1):
${
TMODE
}
--
${
BW
}
PRB </td>"
>>
./test_simulator_results.html
else
echo
" <td align =
\"
center
\"
colspan = 4 >Test without EPC (aka noS1):
${
TMODE
}
--
${
BW
}
PRB </td>"
>>
./test_simulator_results.html
fi
echo
" </tr>"
>>
./test_simulator_results.html
ENB_LOG
=
$ARCHIVES_LOC
/
${
TMODE
}
_
${
BW
}
prb_
${
CN_CONFIG
}
_gnb.log
UE_LOG
=
`
echo
$ENB_LOG
|
sed
-e
"s#gnb#ue#"
`
if
[
-f
$ENB_LOG
]
&&
[
-f
$UE_LOG
]
then
NAME_ENB
=
`
echo
$ENB_LOG
|
sed
-e
"s#
$ARCHIVES_LOC
/##"
`
NAME_UE
=
`
echo
$UE_LOG
|
sed
-e
"s#
$ARCHIVES_LOC
/##"
`
echo
" <tr>"
>>
./test_simulator_results.html
echo
" <td>
$NAME_ENB
---
$NAME_UE
</td>"
>>
./test_simulator_results.html
echo
" <td>N/A</td>"
>>
./test_simulator_results.html
NB_ENB_GOT_SYNC
=
`
egrep
-c
"got sync"
$ENB_LOG
`
NB_ENB_TUNNEL_UP
=
`
egrep
-c
"Interface oaitun_enb1 successfuly configured"
$ENB_LOG
`
NB_UE_GOT_SYNC
=
`
egrep
-c
"rfsimulator: Success"
$UE_LOG
`
NB_ENB_SYNCED_WITH_UE
=
`
egrep
-c
"Initial sync: starting PBCH detection"
$UE_LOG
`
NB_UE_TUNNEL_UP
=
`
egrep
-c
"Interface oaitun_ue1 successfuly configured"
$UE_LOG
`
if
[
$NB_ENB_GOT_SYNC
-gt
0
]
&&
[
$NB_UE_GOT_SYNC
-gt
0
]
&&
[
$NB_ENB_SYNCED_WITH_UE
-gt
0
]
then
echo
" <td bgcolor =
\"
green
\"
>OK</td>"
>>
./test_simulator_results.html
else
echo
" <td bgcolor =
\"
red
\"
>KO</td>"
>>
./test_simulator_results.html
fi
echo
" <td><pre>"
>>
./test_simulator_results.html
if
[
$NB_ENB_GOT_SYNC
-gt
0
]
then
echo
"<font color =
\"
blue
\"
>- gNB --> got sync</font>"
>>
./test_simulator_results.html
else
echo
"<font color =
\"
red
\"
><b>- gNB NEVER got sync</b></font>"
>>
./test_simulator_results.html
fi
if
[
$NB_ENB_TUNNEL_UP
-gt
0
]
then
echo
"<font color =
\"
blue
\"
>- gNB mounted oaitun_enb1 interface</font>"
>>
./test_simulator_results.html
else
echo
"<font color =
\"
red
\"
><b>- gNB NEVER mounted oaitun_enb1 interface</b></font>"
>>
./test_simulator_results.html
fi
if
[
$NB_UE_GOT_SYNC
-gt
0
]
then
echo
"<font color =
\"
blue
\"
>- NR UE --> got sync</font>"
>>
./test_simulator_results.html
else
echo
"<font color =
\"
red
\"
><b>- NR UE NEVER got sync</b></font>"
>>
./test_simulator_results.html
fi
if
[
$NB_ENB_SYNCED_WITH_UE
-gt
0
]
then
echo
"<font color =
\"
blue
\"
>- NR UE attached to gNB</font>"
>>
./test_simulator_results.html
else
echo
"<font color =
\"
red
\"
><b>- NR UE NEVER attached to eNB</b></font>"
>>
./test_simulator_results.html
fi
if
[
$NB_UE_TUNNEL_UP
-gt
0
]
then
echo
"<font color =
\"
blue
\"
>- NR UE mounted oaitun_ue1 interface</font>"
>>
./test_simulator_results.html
else
echo
"<font color =
\"
red
\"
><b>- NR UE NEVER mounted oaitun_ue1 interface</b></font>"
>>
./test_simulator_results.html
fi
echo
" </pre></td>"
>>
./test_simulator_results.html
echo
" </tr>"
>>
./test_simulator_results.html
fi
#PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null`
#analyzePingFiles
IPERF_TESTS
=
`
ls
$ARCHIVES_LOC
/
${
TMODE
}
_
${
BW
}
prb_
${
CN_CONFIG
}
_iperf_dl
*
client
*
txt 2> /dev/null
`
analyzeIperfFiles
#IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
#analyzeIperfFiles
done
done
done
echo
" </table>"
>>
./test_simulator_results.html
echo
" </div>"
>>
./test_simulator_results.html
fi
ARCHIVES_LOC
=
archives/l2_sim/test
ARCHIVES_LOC
=
archives/l2_sim/test
if
[
-d
$ARCHIVES_LOC
]
if
[
-d
$ARCHIVES_LOC
]
then
then
...
...
ci-scripts/runTestOnVM.sh
View file @
64a0dac2
...
@@ -274,21 +274,30 @@ function generic_iperf {
...
@@ -274,21 +274,30 @@ function generic_iperf {
local
LOC_BASE_LOG_FILE
=
$8
local
LOC_BASE_LOG_FILE
=
$8
local
LOC_PORT_ID
=
$[$9
+5001]
local
LOC_PORT_ID
=
$[$9
+5001]
local
LOC_FG_OR_BG
=
${
10
}
local
LOC_FG_OR_BG
=
${
10
}
# By default the requested bandwidth is in Mbits/sec
if
[[
$LOC_REQ_BANDWIDTH
=
~ .
*
K.
*
]]
then
local
IPERF_FORMAT
=
"-fk"
local
FORMATTED_REQ_BW
=
$LOC_REQ_BANDWIDTH
else
local
IPERF_FORMAT
=
"-fm"
local
FORMATTED_REQ_BW
=
${
LOC_REQ_BANDWIDTH
}
"M"
fi
# Starting Iperf Server
# Starting Iperf Server
echo
"iperf -B
${
LOC_ISERVER_BOND_IP
}
-u -s -i 1
-fm
-p
${
LOC_PORT_ID
}
"
echo
"iperf -B
${
LOC_ISERVER_BOND_IP
}
-u -s -i 1
${
IPERF_FORMAT
}
-p
${
LOC_PORT_ID
}
"
echo
"nohup iperf -B
${
LOC_ISERVER_BOND_IP
}
-u -s -i 1
-fm
-p
${
LOC_PORT_ID
}
>
${
LOC_BASE_LOG_FILE
}
_server.txt 2>&1 &"
>
${
LOC_ISERVER_CMD
}
echo
"nohup iperf -B
${
LOC_ISERVER_BOND_IP
}
-u -s -i 1
${
IPERF_FORMAT
}
-p
${
LOC_PORT_ID
}
>
${
LOC_BASE_LOG_FILE
}
_server.txt 2>&1 &"
>
${
LOC_ISERVER_CMD
}
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
${
LOC_ISERVER_IP
}
<
${
LOC_ISERVER_CMD
}
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
${
LOC_ISERVER_IP
}
<
${
LOC_ISERVER_CMD
}
rm
${
LOC_ISERVER_CMD
}
rm
${
LOC_ISERVER_CMD
}
# Starting Iperf Client
# Starting Iperf Client
echo
"iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
LOC_REQ_BANDWIDTH
}
M -i 1 -fm
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
"
echo
"iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
FORMATTED_REQ_BW
}
-i 1
${
IPERF_FORMAT
}
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
"
echo
"echo
\"
COMMAND IS: iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
LOC_REQ_BANDWIDTH
}
M -i 1 -fm
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
\"
>
${
LOC_BASE_LOG_FILE
}
_client.txt"
>
${
LOC_ICLIENT_CMD
}
echo
"echo
\"
COMMAND IS: iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
FORMATTED_REQ_BW
}
-i 1
${
IPERF_FORMAT
}
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
\"
>
${
LOC_BASE_LOG_FILE
}
_client.txt"
>
${
LOC_ICLIENT_CMD
}
if
[
$LOC_FG_OR_BG
-eq
0
]
if
[
$LOC_FG_OR_BG
-eq
0
]
then
then
echo
"iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
LOC_REQ_BANDWIDTH
}
M -i 1 -fm
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
>>
${
LOC_BASE_LOG_FILE
}
_client.txt 2>&1"
>>
${
LOC_ICLIENT_CMD
}
echo
"iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
FORMATTED_REQ_BW
}
-i 1
${
IPERF_FORMAT
}
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
>>
${
LOC_BASE_LOG_FILE
}
_client.txt 2>&1"
>>
${
LOC_ICLIENT_CMD
}
echo
"tail -3
${
LOC_BASE_LOG_FILE
}
_client.txt | grep -v datagram"
>>
${
LOC_ICLIENT_CMD
}
echo
"tail -3
${
LOC_BASE_LOG_FILE
}
_client.txt | grep -v datagram"
>>
${
LOC_ICLIENT_CMD
}
else
else
echo
"nohup iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
LOC_REQ_BANDWIDTH
}
M -i 1 -fm
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
>>
${
LOC_BASE_LOG_FILE
}
_client.txt 2>&1 &"
>>
${
LOC_ICLIENT_CMD
}
echo
"nohup iperf -c
${
LOC_ISERVER_BOND_IP
}
-u -t 30 -b
${
FORMATTED_REQ_BW
}
-i 1
${
IPERF_FORMAT
}
-B
${
LOC_ICLIENT_BOND_IP
}
-p
${
LOC_PORT_ID
}
>>
${
LOC_BASE_LOG_FILE
}
_client.txt 2>&1 &"
>>
${
LOC_ICLIENT_CMD
}
fi
fi
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
${
LOC_ICLIENT_IP
}
<
${
LOC_ICLIENT_CMD
}
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
${
LOC_ICLIENT_IP
}
<
${
LOC_ICLIENT_CMD
}
rm
-f
${
LOC_ICLIENT_CMD
}
rm
-f
${
LOC_ICLIENT_CMD
}
...
@@ -305,19 +314,46 @@ function generic_iperf {
...
@@ -305,19 +314,46 @@ function generic_iperf {
function
check_iperf
{
function
check_iperf
{
local
LOC_BASE_LOG
=
$1
local
LOC_BASE_LOG
=
$1
local
LOC_REQ_BW
=
$2
local
LOC_REQ_BW
=
`
echo
$2
|
sed
-e
"s#K##"
`
local
LOC_REQ_BW_MINUS_ONE
=
`
echo
"
$LOC_REQ_BW
- 1"
| bc
-l
`
local
LOC_REQ_BW_MINUS_ONE
=
`
echo
"
$LOC_REQ_BW
- 1"
| bc
-l
`
local
LOC_REQ_BW_MINUS_TWO
=
`
echo
"
$LOC_REQ_BW
- 2"
| bc
-l
`
local
LOC_REQ_BW_MINUS_TWO
=
`
echo
"
$LOC_REQ_BW
- 2"
| bc
-l
`
local
LOC_REQ_BW_MINUS_THREE
=
`
echo
"
$LOC_REQ_BW
- 3"
| bc
-l
`
local
LOC_REQ_BW_MINUS_THREE
=
`
echo
"
$LOC_REQ_BW
- 3"
| bc
-l
`
local
LOC_IS_DL
=
`
echo
$LOC_BASE_LOG
|
grep
-c
_dl
`
local
LOC_IS_DL
=
`
echo
$LOC_BASE_LOG
|
grep
-c
_dl
`
local
LOC_IS_BASIC_SIM
=
`
echo
$LOC_BASE_LOG
|
grep
-c
basic_sim
`
local
LOC_IS_BASIC_SIM
=
`
echo
$LOC_BASE_LOG
|
grep
-c
basic_sim
`
local
LOC_IS_RF_SIM
=
`
echo
$LOC_BASE_LOG
|
grep
-c
rf_sim
`
local
LOC_IS_NR
=
`
echo
$LOC_BASE_LOG
|
grep
-c
tdd_106prb
`
if
[
-f
${
LOC_BASE_LOG
}
_client.txt
]
if
[
-f
${
LOC_BASE_LOG
}
_client.txt
]
then
then
local
FILE_COMPLETE
=
`
egrep
-c
"Server Report"
${
LOC_BASE_LOG
}
_client.txt
`
local
FILE_COMPLETE
=
`
egrep
-c
"Server Report"
${
LOC_BASE_LOG
}
_client.txt
`
if
[
$FILE_COMPLETE
-eq
0
]
if
[
$FILE_COMPLETE
-eq
0
]
then
then
IPERF_STATUS
=
-1
if
[[
$LOC_IS_RF_SIM
-eq
1
]]
&&
[[
$LOC_IS_NR
-eq
1
]]
echo
"File Report not found"
then
echo
"no UL integration right now --> normal to have no server report"
if
[
-f
${
LOC_BASE_LOG
}
_server.txt
]
then
local
EFFECTIVE_BANDWIDTH
=
`
tail
-n1
${
LOC_BASE_LOG
}
_server.txt |
sed
-e
"s#^.*MBytes *##"
-e
"s#^.*KBytes *##"
-e
"s#sec.*#sec#"
`
if
[[
$2
=
~ .
*
K.
*
]]
then
local
BW_SUFFIX
=
"K"
else
local
BW_SUFFIX
=
"M"
fi
if
[[
$EFFECTIVE_BANDWIDTH
=
~ .
*${
LOC_REQ_BW
}
.
*${
BW_SUFFIX
}
bits.
*
]]
||
[[
$EFFECTIVE_BANDWIDTH
=
~ .
*${
LOC_REQ_BW_MINUS_ONE
}
.
*${
BW_SUFFIX
}
bits.
*
]]
then
echo
"got requested DL bandwidth:
$EFFECTIVE_BANDWIDTH
"
else
echo
"got LESS than requested DL bandwidth:
$EFFECTIVE_BANDWIDTH
"
IPERF_STATUS
=
-1
fi
else
IPERF_STATUS
=
-1
echo
"Server File Report not found"
fi
else
IPERF_STATUS
=
-1
echo
"File Report not found"
fi
else
else
local
EFFECTIVE_BANDWIDTH
=
`
tail
-n3
${
LOC_BASE_LOG
}
_client.txt | egrep
"Mbits/sec"
|
sed
-e
"s#^.*MBytes *##"
-e
"s#sec.*#sec#"
`
local
EFFECTIVE_BANDWIDTH
=
`
tail
-n3
${
LOC_BASE_LOG
}
_client.txt | egrep
"Mbits/sec"
|
sed
-e
"s#^.*MBytes *##"
-e
"s#sec.*#sec#"
`
if
[
$LOC_IS_DL
-eq
1
]
&&
[
$LOC_IS_BASIC_SIM
-eq
1
]
if
[
$LOC_IS_DL
-eq
1
]
&&
[
$LOC_IS_BASIC_SIM
-eq
1
]
...
@@ -351,40 +387,26 @@ function check_iperf {
...
@@ -351,40 +387,26 @@ function check_iperf {
}
}
function
terminate_enb_ue_basic_sim
{
function
terminate_enb_ue_basic_sim
{
# mode = 0 : eNB + UE
# mode = 0 : eNB + UE
or gNB and NR-UE
# mode = 1 : eNB
# mode = 1 : eNB
or gNB
# mode = 2 : UE
# mode = 2 : UE
or NR-UE
local
LOC_MODE
=
$3
local
LOC_MODE
=
$3
echo
"NB_OAI_PROCESSES=
\`
ps -aux | grep modem | grep -v grep | grep -c softmodem
\`
"
>
$1
echo
"NB_OAI_PROCESSES=
\`
ps -aux | grep modem | grep -v grep | grep -c softmodem
\`
"
>
$1
if
[
$LOC_MODE
-eq
0
]
||
[
$LOC_MODE
-eq
1
]
if
[
$LOC_MODE
-eq
0
]
||
[
$LOC_MODE
-eq
1
]
then
then
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo daemon --name=enb_daemon --stop
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo killall -r --signal SIGINT .*-softmodem
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=enb_daemon --stop; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo killall -r --signal SIGINT .*-softmodem; fi"
>>
$1
fi
if
[
$LOC_MODE
-eq
0
]
||
[
$LOC_MODE
-eq
2
]
then
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo daemon --name=ue_daemon --stop
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=ue_daemon --stop; fi"
>>
$1
fi
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi"
>>
$1
echo
"echo
\"
ps -aux | grep softmodem
\"
"
>>
$1
echo
"ps -aux | grep softmodem | grep -v grep"
>>
$1
echo
"NB_OAI_PROCESSES=
\`
ps -aux | grep modem | grep -v grep | grep -c softmodem
\`
"
>>
$1
if
[
$LOC_MODE
-eq
0
]
||
[
$LOC_MODE
-eq
1
]
then
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo killall --signal SIGINT lte-softmodem
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGINT lte-softmodem; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi"
>>
$1
echo
"echo
\"
ps -aux | grep softmodem
\"
"
>>
$1
echo
"echo
\"
ps -aux | grep softmodem
\"
"
>>
$1
echo
"ps -aux | grep softmodem | grep -v grep"
>>
$1
echo
"ps -aux | grep softmodem | grep -v grep"
>>
$1
echo
"NB_OAI_PROCESSES=
\`
ps -aux | grep modem | grep -v grep | grep -c softmodem
\`
"
>>
$1
echo
"NB_OAI_PROCESSES=
\`
ps -aux | grep modem | grep -v grep | grep -c softmodem
\`
"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo killall -
-signal SIGKILL lte
-softmodem
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo killall -
r --signal SIGKILL .*
-softmodem
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo killall -
-signal SIGKILL lte
-softmodem; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo killall -
r --signal SIGKILL .*
-softmodem; fi"
>>
$1
fi
fi
if
[
$LOC_MODE
-eq
0
]
||
[
$LOC_MODE
-eq
2
]
if
[
$LOC_MODE
-eq
0
]
||
[
$LOC_MODE
-eq
2
]
then
then
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo killall -
-signal SIGKILL lte
-uesoftmodem
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then echo
\"
sudo killall -
r --signal SIGKILL .*
-uesoftmodem
\"
; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo killall -
-signal SIGKILL lte
-uesoftmodem; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sudo killall -
r --signal SIGKILL .*
-uesoftmodem; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi"
>>
$1
echo
"if [
\$
NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi"
>>
$1
fi
fi
echo
"echo
\"
ps -aux | grep softmodem
\"
"
>>
$1
echo
"echo
\"
ps -aux | grep softmodem
\"
"
>>
$1
...
@@ -1075,6 +1097,162 @@ function start_rf_sim_ue {
...
@@ -1075,6 +1097,162 @@ function start_rf_sim_ue {
}
}
function
start_rf_sim_gnb
{
local
LOC_GNB_VM_IP_ADDR
=
$2
local
LOC_LOG_FILE
=
$3
local
LOC_NB_RBS
=
$4
local
LOC_CONF_FILE
=
$5
# 1 is with S1 and 0 without S1 aka noS1
local
LOC_S1_CONFIGURATION
=
$6
echo
"cd /home/ubuntu/tmp"
>
$1
echo
"echo
\"
sudo apt-get --yes --quiet install daemon
\"
"
>>
$1
echo
"sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1"
>>
$1
echo
"echo
\"
source oaienv
\"
"
>>
$1
echo
"source oaienv"
>>
$1
echo
"cd ci-scripts/conf_files/"
>>
$1
echo
"cp
$LOC_CONF_FILE
ci-
$LOC_CONF_FILE
"
>>
$1
#echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
#echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
#echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
echo
"echo
\"
cd /home/ubuntu/tmp/cmake_targets/ran_build/build/
\"
"
>>
$1
echo
"sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/"
>>
$1
echo
"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/"
>>
$1
if
[
$LOC_S1_CONFIGURATION
-eq
0
]
then
echo
"echo
\"
RFSIMULATOR=server ./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-
$LOC_CONF_FILE
--log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim
\"
> ./my-nr-softmodem-run.sh "
>>
$1
fi
echo
"chmod 775 ./my-nr-softmodem-run.sh"
>>
$1
echo
"cat ./my-nr-softmodem-run.sh"
>>
$1
echo
"if [ -e /home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
; fi"
>>
$1
echo
"sudo -E daemon --inherit --unsafe --name=gnb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/ran_build/build/ -o /home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
./my-nr-softmodem-run.sh"
>>
$1
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
$LOC_GNB_VM_IP_ADDR
<
$1
rm
$1
local
i
=
"0"
echo
"egrep -c
\"
got sync
\"
/home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
"
>
$1
while
[
$i
-lt
10
]
do
sleep
5
CONNECTED
=
`
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
$LOC_GNB_VM_IP_ADDR
<
$1
`
if
[
$CONNECTED
-ne
0
]
then
i
=
"100"
else
i
=
$[$i
+1]
fi
done
rm
$1
if
[
$i
-lt
50
]
then
GNB_SYNC
=
0
echo
"RF-SIM gNB is NOT sync'ed: process still alive?"
else
GNB_SYNC
=
1
echo
"RF-SIM gNB is sync'ed: waiting for UE(s) to connect"
fi
if
[
$LOC_S1_CONFIGURATION
-eq
0
]
then
echo
"ifconfig oaitun_enb1 | egrep -c
\"
inet addr
\"
"
>
$1
# Checking oaitun_enb1 interface has now an IP address
i
=
"0"
while
[
$i
-lt
10
]
do
CONNECTED
=
`
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
$LOC_GNB_VM_IP_ADDR
<
$1
`
if
[
$CONNECTED
-eq
1
]
then
i
=
"100"
else
i
=
$[$i
+1]
sleep
5
fi
done
rm
$1
if
[
$i
-lt
50
]
then
GNB_SYNC
=
0
echo
"RF-SIM gNB oaitun_enb1 is DOWN or NOT CONFIGURED"
else
echo
"RF-SIM gNB oaitun_enb1 is UP and CONFIGURED"
fi
fi
sleep
10
}
function
start_rf_sim_nr_ue
{
local
LOC_NR_UE_VM_IP_ADDR
=
$2
local
LOC_GNB_VM_IP_ADDR
=
$3
local
LOC_LOG_FILE
=
$4
local
LOC_PRB
=
$5
local
LOC_FREQUENCY
=
$6
# 1 is with S1 and 0 without S1 aka noS1
local
LOC_S1_CONFIGURATION
=
$7
echo
"echo
\"
sudo apt-get --yes --quiet install daemon
\"
"
>
$1
echo
"sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1"
>>
$1
echo
"echo
\"
cd /home/ubuntu/tmp/cmake_targets/ran_build/build/
\"
"
>>
$1
echo
"sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/"
>>
$1
echo
"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/"
>>
$1
if
[
$LOC_S1_CONFIGURATION
-eq
0
]
then
echo
"echo
\"
RFSIMULATOR=
${
LOC_GNB_VM_IP_ADDR
}
./nr-uesoftmodem --numerology 1 -C
${
LOC_FREQUENCY
}
000000 -r
$LOC_PRB
--nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor --noS1
\"
> ./my-nr-softmodem-run.sh "
>>
$1
fi
echo
"chmod 775 ./my-nr-softmodem-run.sh"
>>
$1
echo
"cat ./my-nr-softmodem-run.sh"
>>
$1
echo
"if [ -e /home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
; fi"
>>
$1
echo
"sudo -E daemon --inherit --unsafe --name=nr_ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/ran_build/build/ -o /home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
./my-nr-softmodem-run.sh"
>>
$1
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
$LOC_NR_UE_VM_IP_ADDR
<
$1
rm
$1
local
i
=
"0"
echo
"egrep -c
\"
rfsimulator: Success
\"
/home/ubuntu/tmp/cmake_targets/log/
$LOC_LOG_FILE
"
>
$1
while
[
$i
-lt
10
]
do
sleep
5
CONNECTED
=
`
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
$LOC_NR_UE_VM_IP_ADDR
<
$1
`
if
[
$CONNECTED
-ne
0
]
then
i
=
"100"
else
i
=
$[$i
+1]
fi
done
NR_UE_SYNC
=
1
rm
$1
if
[
$i
-lt
50
]
then
NR_UE_SYNC
=
0
echo
"RF-SIM NR-UE is NOT sync'ed w/ gNB"
return
else
echo
"RF-SIM NR-UE is sync'ed w/ gNB"
fi
# Checking oaitun_ue1 interface has now an IP address
i
=
"0"
echo
"ifconfig oaitun_ue1 | egrep -c
\"
inet addr
\"
"
>
$1
while
[
$i
-lt
10
]
do
sleep
5
CONNECTED
=
`
ssh
-T
-o
StrictHostKeyChecking
=
no ubuntu@
$LOC_NR_UE_VM_IP_ADDR
<
$1
`
if
[
$CONNECTED
-eq
1
]
then
i
=
"100"
else
i
=
$[$i
+1]
fi
done
rm
$1
if
[
$i
-lt
50
]
then
NR_UE_SYNC
=
0
echo
"RF-SIM NR-UE oaitun_ue1 is DOWN or NOT CONFIGURED"
else
echo
"RF-SIM NR-UE oaitun_ue1 is UP and CONFIGURED"
fi
sleep
10
}
function
run_test_on_vm
{
function
run_test_on_vm
{
echo
"############################################################"
echo
"############################################################"
echo
"OAI CI VM script"
echo
"OAI CI VM script"
...
@@ -1089,6 +1267,14 @@ function run_test_on_vm {
...
@@ -1089,6 +1267,14 @@ function run_test_on_vm {
UE_VM_CMDS
=
${
UE_VM_NAME
}
_cmds.txt
UE_VM_CMDS
=
${
UE_VM_NAME
}
_cmds.txt
echo
"UE_VM_NAME =
$UE_VM_NAME
"
echo
"UE_VM_NAME =
$UE_VM_NAME
"
echo
"UE_VM_CMD_FILE =
$UE_VM_CMDS
"
echo
"UE_VM_CMD_FILE =
$UE_VM_CMDS
"
GNB_VM_NAME
=
`
echo
$VM_NAME
|
sed
-e
"s#l2-sim#gnb-usrp#"
-e
"s#rf-sim#gnb-usrp#"
`
GNB_VM_CMDS
=
${
GNB_VM_NAME
}
_cmds.txt
echo
"GNB_VM_NAME =
$GNB_VM_NAME
"
echo
"GNB_VM_CMD_FILE =
$GNB_VM_CMDS
"
NR_UE_VM_NAME
=
`
echo
$VM_NAME
|
sed
-e
"s#l2-sim#nr-ue-usrp#"
-e
"s#rf-sim#nr-ue-usrp#"
`
NR_UE_VM_CMDS
=
${
UE_VM_NAME
}
_cmds.txt
echo
"NR_UE_VM_NAME =
$NR_UE_VM_NAME
"
echo
"NR_UE_VM_CMD_FILE =
$NR_UE_VM_CMDS
"
else
else
echo
"VM_NAME =
$VM_NAME
"
echo
"VM_NAME =
$VM_NAME
"
echo
"VM_CMD_FILE =
$VM_CMDS
"
echo
"VM_CMD_FILE =
$VM_CMDS
"
...
@@ -1113,6 +1299,22 @@ function run_test_on_vm {
...
@@ -1113,6 +1299,22 @@ function run_test_on_vm {
UE_VM_IP_ADDR
=
`
uvt-kvm ip
$UE_VM_NAME
`
UE_VM_IP_ADDR
=
`
uvt-kvm ip
$UE_VM_NAME
`
echo
"
$UE_VM_NAME
has for IP addr =
$UE_VM_IP_ADDR
"
echo
"
$UE_VM_NAME
has for IP addr =
$UE_VM_IP_ADDR
"
echo
"############################################################"
echo
"Waiting for GNB VM to be started"
echo
"############################################################"
uvt-kvm
wait
$GNB_VM_NAME
--insecure
GNB_VM_IP_ADDR
=
`
uvt-kvm ip
$GNB_VM_NAME
`
echo
"
$GNB_VM_NAME
has for IP addr =
$GNB_VM_IP_ADDR
"
echo
"############################################################"
echo
"Waiting for NR-UE VM to be started"
echo
"############################################################"
uvt-kvm
wait
$NR_UE_VM_NAME
--insecure
NR_UE_VM_IP_ADDR
=
`
uvt-kvm ip
$NR_UE_VM_NAME
`
echo
"
$NR_UE_VM_NAME
has for IP addr =
$NR_UE_VM_IP_ADDR
"
else
else
echo
"############################################################"
echo
"############################################################"
echo
"Waiting for VM to be started"
echo
"Waiting for VM to be started"
...
@@ -1466,7 +1668,7 @@ function run_test_on_vm {
...
@@ -1466,7 +1668,7 @@ function run_test_on_vm {
fi
fi
fi
fi
if
[[
"
$RUN_OPTIONS
"
==
"complex"
]]
&&
[[
$VM_NAME
=
~ .
*
-r
f
-sim
.
*
]]
if
[[
"
$RUN_OPTIONS
"
==
"complex"
]]
&&
[[
$VM_NAME
=
~ .
*
-r
u
-sim
.
*
]]
then
then
PING_STATUS
=
0
PING_STATUS
=
0
IPERF_STATUS
=
0
IPERF_STATUS
=
0
...
@@ -1666,6 +1868,84 @@ function run_test_on_vm {
...
@@ -1666,6 +1868,84 @@ function run_test_on_vm {
fi
fi
fi
fi
if
[[
"
$RUN_OPTIONS
"
==
"complex"
]]
&&
[[
$VM_NAME
=
~ .
*
-rf-sim
.
*
]]
then
PING_STATUS
=
0
IPERF_STATUS
=
0
if
[
-d
$ARCHIVES_LOC
]
then
rm
-Rf
$ARCHIVES_LOC
fi
mkdir
--parents
$ARCHIVES_LOC
CN_CONFIG
=
"noS1"
CONF_FILE
=
gnb.band78.tm1.106PRB.usrpn300.conf
S1_NOS1_CFG
=
0
PRB
=
106
FREQUENCY
=
3510
######### start of loop
echo
"############################################################"
echo
"
${
CN_CONFIG
}
: Starting the gNB"
echo
"############################################################"
CURRENT_GNB_LOG_FILE
=
tdd_
${
PRB
}
prb_
${
CN_CONFIG
}
_gnb.log
start_rf_sim_gnb
$GNB_VM_CMDS
"
$GNB_VM_IP_ADDR
"
$CURRENT_GNB_LOG_FILE
$PRB
$CONF_FILE
$S1_NOS1_CFG
echo
"############################################################"
echo
"
${
CN_CONFIG
}
: Starting the NR-UE"
echo
"############################################################"
CURRENT_NR_UE_LOG_FILE
=
tdd_
${
PRB
}
prb_
${
CN_CONFIG
}
_ue.log
start_rf_sim_nr_ue
$NR_UE_VM_CMDS
$NR_UE_VM_IP_ADDR
$GNB_VM_IP_ADDR
$CURRENT_NR_UE_LOG_FILE
$PRB
$FREQUENCY
$S1_NOS1_CFG
if
[
$NR_UE_SYNC
-eq
0
]
then
echo
"Problem w/ gNB and NR-UE not syncing"
terminate_enb_ue_basic_sim
$NR_UE_VM_CMDS
$NR_UE_VM_IP_ADDR
2
terminate_enb_ue_basic_sim
$GNB_VM_CMDS
$GNB_VM_IP_ADDR
1
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$GNB_VM_IP_ADDR
:/home/ubuntu/tmp/cmake_targets/log/
$CURRENT_GNB_LOG_FILE
$ARCHIVES_LOC
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$NR_UE_VM_IP_ADDR
:/home/ubuntu/tmp/cmake_targets/log/
$CURRENT_NR_UE_LOG_FILE
$ARCHIVES_LOC
echo
"TEST_KO"
>
$ARCHIVES_LOC
/test_final_status.log
STATUS
=
-1
return
fi
echo
"############################################################"
echo
"
${
CN_CONFIG
}
: iperf DL -- UE is server and eNB is client"
echo
"############################################################"
THROUGHPUT
=
"30K"
CURR_IPERF_LOG_BASE
=
tdd_
${
PRB
}
prb_
${
CN_CONFIG
}
_iperf_dl
get_enb_noS1_ip_addr
$GNB_VM_CMDS
$GNB_VM_IP_ADDR
get_ue_ip_addr
$NR_UE_VM_CMDS
$NR_UE_VM_IP_ADDR
1
generic_iperf
$NR_UE_VM_CMDS
$NR_UE_VM_IP_ADDR
$UE_IP_ADDR
$GNB_VM_CMDS
$GNB_VM_IP_ADDR
$ENB_IP_ADDR
$THROUGHPUT
$CURR_IPERF_LOG_BASE
1 0
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$GNB_VM_IP_ADDR
:/home/ubuntu/
${
CURR_IPERF_LOG_BASE
}
_client.txt
$ARCHIVES_LOC
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$NR_UE_VM_IP_ADDR
:/home/ubuntu/
${
CURR_IPERF_LOG_BASE
}
_server.txt
$ARCHIVES_LOC
check_iperf
$ARCHIVES_LOC
/
$CURR_IPERF_LOG_BASE
$THROUGHPUT
echo
"############################################################"
echo
"
${
CN_CONFIG
}
: Terminate gNB/NR-UE simulators"
echo
"############################################################"
terminate_enb_ue_basic_sim
$NR_UE_VM_CMDS
$NR_UE_VM_IP_ADDR
2
terminate_enb_ue_basic_sim
$GNB_VM_CMDS
$GNB_VM_IP_ADDR
1
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$GNB_VM_IP_ADDR
:/home/ubuntu/tmp/cmake_targets/log/
$CURRENT_GNB_LOG_FILE
$ARCHIVES_LOC
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$NR_UE_VM_IP_ADDR
:/home/ubuntu/tmp/cmake_targets/log/
$CURRENT_NR_UE_LOG_FILE
$ARCHIVES_LOC
######### end of loop
full_l2_sim_destroy
echo
"############################################################"
echo
"Checking run status"
echo
"############################################################"
if
[
$PING_STATUS
-ne
0
]
;
then
STATUS
=
-1
;
fi
if
[
$IPERF_STATUS
-ne
0
]
;
then
STATUS
=
-1
;
fi
if
[
$STATUS
-eq
0
]
then
echo
"TEST_OK"
>
$ARCHIVES_LOC
/test_final_status.log
else
echo
"TEST_KO"
>
$ARCHIVES_LOC
/test_final_status.log
fi
fi
if
[[
"
$RUN_OPTIONS
"
==
"complex"
]]
&&
[[
$VM_NAME
=
~ .
*
-l2-sim
.
*
]]
if
[[
"
$RUN_OPTIONS
"
==
"complex"
]]
&&
[[
$VM_NAME
=
~ .
*
-l2-sim
.
*
]]
then
then
PING_STATUS
=
0
PING_STATUS
=
0
...
...
ci-scripts/xml_files/gnb_usrp_build.xml
View file @
64a0dac2
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
<class>
Build_eNB
</class>
<class>
Build_eNB
</class>
<desc>
Build gNB (USRP)
</desc>
<desc>
Build gNB (USRP)
</desc>
<Build_eNB_args>
--gNB -w USRP
</Build_eNB_args>
<Build_eNB_args>
--gNB -w USRP
</Build_eNB_args>
<forced_workspace_cleanup>
True
</forced_workspace_cleanup>
</testCase>
</testCase>
</testCaseList>
</testCaseList>
cmake_targets/CMakeLists.txt
View file @
64a0dac2
...
@@ -530,6 +530,7 @@ set (SHLIB_LOADER_SOURCES
...
@@ -530,6 +530,7 @@ set (SHLIB_LOADER_SOURCES
include_directories
(
"
${
OPENAIR_TARGETS
}
/ARCH/USRP/USERSPACE/LIB/"
)
include_directories
(
"
${
OPENAIR_TARGETS
}
/ARCH/USRP/USERSPACE/LIB/"
)
set
(
HWLIB_USRP_SOURCE
set
(
HWLIB_USRP_SOURCE
${
OPENAIR_TARGETS
}
/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
${
OPENAIR_TARGETS
}
/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
${
OPENAIR_TARGETS
}
/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
)
)
add_library
(
oai_usrpdevif MODULE
${
HWLIB_USRP_SOURCE
}
)
add_library
(
oai_usrpdevif MODULE
${
HWLIB_USRP_SOURCE
}
)
target_link_libraries
(
oai_usrpdevif uhd
)
target_link_libraries
(
oai_usrpdevif uhd
)
...
...
common/config/config_userapi.c
View file @
64a0dac2
...
@@ -386,13 +386,12 @@ int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
...
@@ -386,13 +386,12 @@ int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
status
=
1
;
status
=
1
;
if
(
cfgoptions
->
numelt
==
0
)
{
if
(
cfgoptions
->
numelt
==
0
)
{
config_check_valptr
(
cfgoptions
,
(
char
**
)(
cfgoptions
->
strptr
),
sizeof
(
char
*
));
config_check_valptr
(
cfgoptions
,
cfgoptions
->
strptr
,
strlen
(
cfgoptions
->
defstrval
)
+
1
);
config_check_valptr
(
cfgoptions
,
cfgoptions
->
strptr
,
strlen
(
cfgoptions
->
defstrval
)
+
1
);
sprintf
(
*
(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
sprintf
(
*
(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
*
(
cfgoptions
->
strptr
));
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
*
(
cfgoptions
->
strptr
));
}
else
{
}
else
{
sprintf
((
char
*
)
*
(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
sprintf
((
char
*
)(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
(
char
*
)
*
(
cfgoptions
->
strptr
));
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
(
char
*
)(
cfgoptions
->
strptr
));
}
}
}
}
...
...
executables/nr-ru.c
View file @
64a0dac2
...
@@ -2284,6 +2284,9 @@ void RCconfig_RU(void)
...
@@ -2284,6 +2284,9 @@ void RCconfig_RU(void)
LOG_E
(
PHY
,
"Erroneous RU clock source in the provided configuration file: '%s'
\n
"
,
*
(
RUParamList
.
paramarray
[
j
][
RU_SDR_CLK_SRC
].
strptr
));
LOG_E
(
PHY
,
"Erroneous RU clock source in the provided configuration file: '%s'
\n
"
,
*
(
RUParamList
.
paramarray
[
j
][
RU_SDR_CLK_SRC
].
strptr
));
}
}
}
}
else
{
RC
.
ru
[
j
]
->
openair0_cfg
.
clock_source
=
unset
;
}
if
(
strcmp
(
*
(
RUParamList
.
paramarray
[
j
][
RU_LOCAL_RF_IDX
].
strptr
),
"yes"
)
==
0
)
{
if
(
strcmp
(
*
(
RUParamList
.
paramarray
[
j
][
RU_LOCAL_RF_IDX
].
strptr
),
"yes"
)
==
0
)
{
if
(
!
(
config_isparamset
(
RUParamList
.
paramarray
[
j
],
RU_LOCAL_IF_NAME_IDX
))
)
{
if
(
!
(
config_isparamset
(
RUParamList
.
paramarray
[
j
],
RU_LOCAL_IF_NAME_IDX
))
)
{
...
...
executables/nr-softmodem.c
View file @
64a0dac2
...
@@ -106,7 +106,6 @@ int config_sync_var=-1;
...
@@ -106,7 +106,6 @@ int config_sync_var=-1;
#endif
#endif
volatile
int
oai_exit
=
0
;
volatile
int
oai_exit
=
0
;
static
clock_source_t
clock_source
=
internal
;
static
int
wait_for_sync
=
0
;
static
int
wait_for_sync
=
0
;
unsigned
int
mmapped_dma
=
0
;
unsigned
int
mmapped_dma
=
0
;
...
...
executables/nr-softmodem.h
View file @
64a0dac2
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
...
...
executables/nr-uesoftmodem.c
View file @
64a0dac2
...
@@ -116,7 +116,7 @@ volatile int start_eNB = 0;
...
@@ -116,7 +116,7 @@ volatile int start_eNB = 0;
volatile
int
start_UE
=
0
;
volatile
int
start_UE
=
0
;
volatile
int
oai_exit
=
0
;
volatile
int
oai_exit
=
0
;
static
clock_source_t
clock_source
=
internal
;
static
clock_source_t
clock_source
=
unset
;
int
single_thread_flag
=
1
;
int
single_thread_flag
=
1
;
static
double
snr_dB
=
20
;
static
double
snr_dB
=
20
;
...
...
executables/nr-uesoftmodem.h
View file @
64a0dac2
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"
external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, u
ptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"
clock-source", CONFIG_HLP_EXCCLK, 0, i
ptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
64a0dac2
...
@@ -278,7 +278,7 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -278,7 +278,7 @@ int nr_dlsch_encoding(unsigned char *a,
unsigned
int
G
;
unsigned
int
G
;
unsigned
int
crc
=
1
;
unsigned
int
crc
=
1
;
uint8_t
harq_pid
=
dlsch
->
harq_ids
[
frame
&
2
][
slot
];
uint8_t
harq_pid
=
dlsch
->
harq_ids
[
frame
%
2
][
slot
];
AssertFatal
(
harq_pid
<
8
&&
harq_pid
>=
0
,
"illegal harq_pid %d
\b
"
,
harq_pid
);
AssertFatal
(
harq_pid
<
8
&&
harq_pid
>=
0
,
"illegal harq_pid %d
\b
"
,
harq_pid
);
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
dlsch
->
harq_processes
[
harq_pid
]
->
pdsch_pdu
.
pdsch_pdu_rel15
;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
dlsch
->
harq_processes
[
harq_pid
]
->
pdsch_pdu
.
pdsch_pdu_rel15
;
uint16_t
nb_rb
=
rel15
->
rbSize
;
uint16_t
nb_rb
=
rel15
->
rbSize
;
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch.h
View file @
64a0dac2
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include "PHY/defs_gNB.h"
#include "PHY/defs_gNB.h"
void
free_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
);
void
free_gNB_ulsch
(
NR_gNB_ULSCH_t
*
*
ulsch
);
NR_gNB_ULSCH_t
*
new_gNB_ulsch
(
uint8_t
max_ldpc_iterations
,
uint8_t
N_RB_UL
,
uint8_t
abstraction_flag
);
NR_gNB_ULSCH_t
*
new_gNB_ulsch
(
uint8_t
max_ldpc_iterations
,
uint8_t
N_RB_UL
,
uint8_t
abstraction_flag
);
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
View file @
64a0dac2
...
@@ -58,10 +58,9 @@ static uint64_t nb_error_decod =0;
...
@@ -58,10 +58,9 @@ static uint64_t nb_error_decod =0;
//extern double cpuf;
//extern double cpuf;
void
free_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
)
void
free_gNB_ulsch
(
NR_gNB_ULSCH_t
**
ulschptr
)
{
{
int
i
,
r
;
int
i
,
r
;
NR_gNB_ULSCH_t
*
ulsch
=
*
ulschptr
;
if
(
ulsch
)
{
if
(
ulsch
)
{
for
(
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
for
(
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
...
@@ -92,7 +91,7 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
...
@@ -92,7 +91,7 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
}
}
}
}
free16
(
ulsch
,
sizeof
(
NR_gNB_ULSCH_t
));
free16
(
ulsch
,
sizeof
(
NR_gNB_ULSCH_t
));
ulsch
=
NULL
;
*
ulschptr
=
NULL
;
}
}
}
}
...
@@ -168,8 +167,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8
...
@@ -168,8 +167,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8
}
}
printf
(
"new_gNB_ulsch with size %zu: exit_flag = %u
\n
"
,
sizeof
(
NR_UL_gNB_HARQ_t
),
exit_flag
);
printf
(
"new_gNB_ulsch with size %zu: exit_flag = %u
\n
"
,
sizeof
(
NR_UL_gNB_HARQ_t
),
exit_flag
);
free_gNB_ulsch
(
ulsch
);
free_gNB_ulsch
(
&
ulsch
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -307,6 +305,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -307,6 +305,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
t_nrLDPC_dec_params
*
p_decParams
=
&
decParams
;
t_nrLDPC_dec_params
*
p_decParams
=
&
decParams
;
t_nrLDPC_time_stats
procTime
;
t_nrLDPC_time_stats
procTime
;
t_nrLDPC_time_stats
*
p_procTime
=
&
procTime
;
t_nrLDPC_time_stats
*
p_procTime
=
&
procTime
;
if
(
!
harq_process
)
{
printf
(
"ulsch_decoding.c: NULL harq_process pointer
\n
"
);
return
(
ulsch
->
max_ldpc_iterations
+
1
);
}
t_nrLDPC_procBuf
**
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
;
t_nrLDPC_procBuf
**
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
;
int16_t
z
[
68
*
384
];
int16_t
z
[
68
*
384
];
...
@@ -338,11 +340,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -338,11 +340,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
return
(
ulsch
->
max_ldpc_iterations
+
1
);
return
(
ulsch
->
max_ldpc_iterations
+
1
);
}
}
if
(
!
harq_process
)
{
printf
(
"ulsch_decoding.c: NULL harq_process pointer
\n
"
);
return
(
ulsch
->
max_ldpc_iterations
+
1
);
}
if
(
!
frame_parms
)
{
if
(
!
frame_parms
)
{
printf
(
"ulsch_decoding.c: NULL frame_parms pointer
\n
"
);
printf
(
"ulsch_decoding.c: NULL frame_parms pointer
\n
"
);
return
(
ulsch
->
max_ldpc_iterations
+
1
);
return
(
ulsch
->
max_ldpc_iterations
+
1
);
...
@@ -531,7 +528,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -531,7 +528,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
}
}
printf
(
"decoder input(segment %
d
) :"
,
r
);
printf
(
"decoder input(segment %
u
) :"
,
r
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
...
@@ -620,7 +617,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -620,7 +617,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
for
(
int
k
=
0
;
k
<
A
>>
3
;
k
++
)
for
(
int
k
=
0
;
k
<
A
>>
3
;
k
++
)
printf
(
"output decoder [%d] = 0x%02x
\n
"
,
k
,
harq_process
->
c
[
r
][
k
]);
printf
(
"output decoder [%d] = 0x%02x
\n
"
,
k
,
harq_process
->
c
[
r
][
k
]);
printf
(
"no_iterations_ldpc %d (ret %
d
)
\n
"
,
no_iteration_ldpc
,
ret
);
printf
(
"no_iterations_ldpc %d (ret %
u
)
\n
"
,
no_iteration_ldpc
,
ret
);
//write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4);
//write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4);
#endif
#endif
...
@@ -708,7 +705,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -708,7 +705,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
#ifdef DEBUG_ULSCH_DECODING
#ifdef DEBUG_ULSCH_DECODING
printf
(
"Segment %
d : Kr= %d
bytes
\n
"
,
r
,
Kr_bytes
);
printf
(
"Segment %
u : Kr= %u
bytes
\n
"
,
r
,
Kr_bytes
);
printf
(
"copied %d bytes to b sequence (harq_pid %d)
\n
"
,
printf
(
"copied %d bytes to b sequence (harq_pid %d)
\n
"
,
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
)),
harq_pid
);
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
)),
harq_pid
);
printf
(
"b[0] = %x,c[%d] = %x
\n
"
,
printf
(
"b[0] = %x,c[%d] = %x
\n
"
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
View file @
64a0dac2
...
@@ -56,11 +56,11 @@ notifiedFIFO_elt_t *msgToPush;
...
@@ -56,11 +56,11 @@ notifiedFIFO_elt_t *msgToPush;
//extern double cpuf;
//extern double cpuf;
void
free_nr_ue_dlsch
(
NR_UE_DLSCH_t
*
dlsch
)
void
free_nr_ue_dlsch
(
NR_UE_DLSCH_t
*
*
dlschptr
)
{
{
int
i
,
r
;
int
i
,
r
;
NR_UE_DLSCH_t
*
dlsch
=*
dlschptr
;
if
(
dlsch
)
{
if
(
dlsch
)
{
for
(
i
=
0
;
i
<
dlsch
->
Mdlharq
;
i
++
)
{
for
(
i
=
0
;
i
<
dlsch
->
Mdlharq
;
i
++
)
{
if
(
dlsch
->
harq_processes
[
i
])
{
if
(
dlsch
->
harq_processes
[
i
])
{
...
@@ -175,7 +175,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
...
@@ -175,7 +175,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
}
}
printf
(
"new_ue_dlsch with size %zu: exit_flag = %u
\n
"
,
sizeof
(
NR_DL_UE_HARQ_t
),
exit_flag
);
printf
(
"new_ue_dlsch with size %zu: exit_flag = %u
\n
"
,
sizeof
(
NR_DL_UE_HARQ_t
),
exit_flag
);
free_nr_ue_dlsch
(
dlsch
);
free_nr_ue_dlsch
(
&
dlsch
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -232,6 +232,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -232,6 +232,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
t_nrLDPC_dec_params
*
p_decParams
=
&
decParams
;
t_nrLDPC_dec_params
*
p_decParams
=
&
decParams
;
t_nrLDPC_time_stats
procTime
;
t_nrLDPC_time_stats
procTime
;
t_nrLDPC_time_stats
*
p_procTime
=&
procTime
;
t_nrLDPC_time_stats
*
p_procTime
=&
procTime
;
if
(
!
harq_process
)
{
printf
(
"dlsch_decoding.c: NULL harq_process pointer
\n
"
);
return
(
dlsch
->
max_ldpc_iterations
+
1
);
}
t_nrLDPC_procBuf
**
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
;
t_nrLDPC_procBuf
**
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
;
int16_t
z
[
68
*
384
];
int16_t
z
[
68
*
384
];
...
@@ -265,11 +270,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -265,11 +270,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
return
(
dlsch
->
max_ldpc_iterations
+
1
);
return
(
dlsch
->
max_ldpc_iterations
+
1
);
}
}
if
(
!
harq_process
)
{
printf
(
"dlsch_decoding.c: NULL harq_process pointer
\n
"
);
return
(
dlsch
->
max_ldpc_iterations
+
1
);
}
if
(
!
frame_parms
)
{
if
(
!
frame_parms
)
{
printf
(
"dlsch_decoding.c: NULL frame_parms pointer
\n
"
);
printf
(
"dlsch_decoding.c: NULL frame_parms pointer
\n
"
);
return
(
dlsch
->
max_ldpc_iterations
+
1
);
return
(
dlsch
->
max_ldpc_iterations
+
1
);
...
@@ -503,7 +503,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -503,7 +503,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
}
}
printf
(
"decoder input(segment %
d
) :"
,
r
);
printf
(
"decoder input(segment %
u
) :"
,
r
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
...
@@ -569,7 +569,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -569,7 +569,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
printf
(
"
\x1B
[34m"
"Segment %
d
CRC OK
\n\033
[0m"
,
r
);
printf
(
"
\x1B
[34m"
"Segment %
u
CRC OK
\n\033
[0m"
,
r
);
//Temporary hack
//Temporary hack
no_iteration_ldpc
=
dlsch
->
max_ldpc_iterations
;
no_iteration_ldpc
=
dlsch
->
max_ldpc_iterations
;
ret
=
no_iteration_ldpc
;
ret
=
no_iteration_ldpc
;
...
@@ -599,7 +599,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -599,7 +599,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
for
(
int
k
=
0
;
k
<
A
>>
3
;
k
++
)
for
(
int
k
=
0
;
k
<
A
>>
3
;
k
++
)
printf
(
"output decoder [%d] = 0x%02x
\n
"
,
k
,
harq_process
->
c
[
r
][
k
]);
printf
(
"output decoder [%d] = 0x%02x
\n
"
,
k
,
harq_process
->
c
[
r
][
k
]);
printf
(
"no_iterations_ldpc %d (ret %
d
)
\n
"
,
no_iteration_ldpc
,
ret
);
printf
(
"no_iterations_ldpc %d (ret %
u
)
\n
"
,
no_iteration_ldpc
,
ret
);
//write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4);
//write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4);
#endif
#endif
...
@@ -701,7 +701,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -701,7 +701,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
#ifdef DEBUG_DLSCH_DECODING
#ifdef DEBUG_DLSCH_DECODING
printf
(
"Segment %
d : Kr= %d
bytes
\n
"
,
r
,
Kr_bytes
);
printf
(
"Segment %
u : Kr= %u
bytes
\n
"
,
r
,
Kr_bytes
);
printf
(
"copied %d bytes to b sequence (harq_pid %d)
\n
"
,
printf
(
"copied %d bytes to b sequence (harq_pid %d)
\n
"
,
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
)),
harq_pid
);
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
)),
harq_pid
);
printf
(
"b[0] = %x,c[%d] = %x
\n
"
,
printf
(
"b[0] = %x,c[%d] = %x
\n
"
,
...
@@ -771,6 +771,10 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -771,6 +771,10 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
t_nrLDPC_time_stats
procTime
;
t_nrLDPC_time_stats
procTime
;
t_nrLDPC_time_stats
*
p_procTime
=&
procTime
;
t_nrLDPC_time_stats
*
p_procTime
=&
procTime
;
int8_t
llrProcBuf
[
OAI_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
int8_t
llrProcBuf
[
OAI_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
if
(
!
harq_process
)
{
printf
(
"dlsch_decoding.c: NULL harq_process pointer
\n
"
);
return
(
dlsch
->
max_ldpc_iterations
);
}
t_nrLDPC_procBuf
*
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
[
0
];
t_nrLDPC_procBuf
*
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
[
0
];
uint8_t
Nl
=
4
;
uint8_t
Nl
=
4
;
int16_t
z
[
68
*
384
];
int16_t
z
[
68
*
384
];
...
@@ -801,10 +805,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -801,10 +805,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
return
(
dlsch
->
max_ldpc_iterations
);
return
(
dlsch
->
max_ldpc_iterations
);
}
}
if
(
!
harq_process
)
{
printf
(
"dlsch_decoding.c: NULL harq_process pointer
\n
"
);
return
(
dlsch
->
max_ldpc_iterations
);
}
if
(
!
frame_parms
)
{
if
(
!
frame_parms
)
{
printf
(
"dlsch_decoding.c: NULL frame_parms pointer
\n
"
);
printf
(
"dlsch_decoding.c: NULL frame_parms pointer
\n
"
);
...
@@ -1011,7 +1012,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -1011,7 +1012,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
#ifdef DEBUG_DLSCH_DECODING
#ifdef DEBUG_DLSCH_DECODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"rx output deinterleaving w[%d]= %d r_offset %
d
\n
"
,
i
,
harq_process
->
w
[
r
][
i
],
r_offset
);
printf
(
"rx output deinterleaving w[%d]= %d r_offset %
u
\n
"
,
i
,
harq_process
->
w
[
r
][
i
],
r_offset
);
#endif
#endif
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
...
@@ -1070,7 +1071,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -1070,7 +1071,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
#ifdef DEBUG_DLSCH_DECODING
#ifdef DEBUG_DLSCH_DECODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"rx output ratematching d[%d]= %d r_offset %
d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
],
r_offset
);
printf
(
"rx output ratematching d[%d]= %d r_offset %
u
\n
"
,
i
,
harq_process
->
d
[
r
][
i
],
r_offset
);
#endif
#endif
#ifdef DEBUG_DLSCH_DECODING
#ifdef DEBUG_DLSCH_DECODING
...
@@ -1080,7 +1081,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -1080,7 +1081,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
96
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
96
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
}
}
printf
(
"decoder input(segment %
d
) :"
,
r
);
printf
(
"decoder input(segment %
u
) :"
,
r
);
for
(
int
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
);
i
++
)
for
(
int
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
);
i
++
)
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -1158,7 +1159,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -1158,7 +1159,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
}
}
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
printf
(
"Segment %
d
CRC OK
\n
"
,
r
);
printf
(
"Segment %
u
CRC OK
\n
"
,
r
);
ret
=
2
;
ret
=
2
;
}
}
else
{
else
{
...
@@ -1167,7 +1168,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -1167,7 +1168,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
}
}
//if (!nb_total_decod%10000){
//if (!nb_total_decod%10000){
printf
(
"Error number of iteration LPDC %d %l
d/%ld
\n
"
,
no_iteration_ldpc
,
nb_error_decod
,
nb_total_decod
);
fflush
(
stdout
);
printf
(
"Error number of iteration LPDC %d %l
u/%lu
\n
"
,
no_iteration_ldpc
,
nb_error_decod
,
nb_total_decod
);
fflush
(
stdout
);
//}
//}
//else
//else
...
@@ -1308,7 +1309,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -1308,7 +1309,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
#ifdef DEBUG_DLSCH_DECODING
#ifdef DEBUG_DLSCH_DECODING
printf
(
"Segment %
d : Kr= %d
bytes
\n
"
,
r
,
Kr_bytes
);
printf
(
"Segment %
u : Kr= %u
bytes
\n
"
,
r
,
Kr_bytes
);
printf
(
"copied %d bytes to b sequence (harq_pid %d)
\n
"
,
printf
(
"copied %d bytes to b sequence (harq_pid %d)
\n
"
,
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
)),
harq_pid
);
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
)),
harq_pid
);
printf
(
"b[0] = %x,c[%d] = %x
\n
"
,
printf
(
"b[0] = %x,c[%d] = %x
\n
"
,
...
@@ -1396,7 +1397,7 @@ void *nr_dlsch_decoding_process(void *arg)
...
@@ -1396,7 +1397,7 @@ void *nr_dlsch_decoding_process(void *arg)
//printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag);
//printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag);
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
[
r
];
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
[
r
];
nb_symb_sch
=
harq_process
->
nb_symbols
;
nb_symb_sch
=
harq_process
->
nb_symbols
;
printf
(
"dlsch decoding process frame %d slot %d segment %d r %
d
nb symb %d
\n
"
,
frame
,
proc
->
nr_tti_rx
,
proc
->
num_seg
,
r
,
harq_process
->
nb_symbols
);
printf
(
"dlsch decoding process frame %d slot %d segment %d r %
u
nb symb %d
\n
"
,
frame
,
proc
->
nr_tti_rx
,
proc
->
num_seg
,
r
,
harq_process
->
nb_symbols
);
/*
/*
...
@@ -1559,7 +1560,7 @@ void *nr_dlsch_decoding_process(void *arg)
...
@@ -1559,7 +1560,7 @@ void *nr_dlsch_decoding_process(void *arg)
#ifdef DEBUG_DLSCH_DECODING
#ifdef DEBUG_DLSCH_DECODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"rx output thread 0 deinterleaving w[%d]= %d r_offset %
d
\n
"
,
i
,
harq_process
->
w
[
r
][
i
],
r_offset
);
printf
(
"rx output thread 0 deinterleaving w[%d]= %d r_offset %
u
\n
"
,
i
,
harq_process
->
w
[
r
][
i
],
r_offset
);
#endif
#endif
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
...
@@ -1620,7 +1621,7 @@ void *nr_dlsch_decoding_process(void *arg)
...
@@ -1620,7 +1621,7 @@ void *nr_dlsch_decoding_process(void *arg)
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
}
}
printf
(
"decoder input(segment %
d
) :"
,
r
);
printf
(
"decoder input(segment %
u
) :"
,
r
);
int
i
;
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
int
i
;
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -1689,7 +1690,7 @@ void *nr_dlsch_decoding_process(void *arg)
...
@@ -1689,7 +1690,7 @@ void *nr_dlsch_decoding_process(void *arg)
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
printf
(
"Segment %
d
CRC OK
\n
"
,
r
);
printf
(
"Segment %
u
CRC OK
\n
"
,
r
);
ret
=
2
;
ret
=
2
;
}
}
else
{
else
{
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
64a0dac2
...
@@ -71,7 +71,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
...
@@ -71,7 +71,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
rxF
=
&
rxdataF
[
aarx
][(
symbol
+
s_offset
)
*
frame_parms
->
ofdm_symbol_size
];
rxF
=
&
rxdataF
[
aarx
][(
symbol
+
s_offset
)
*
frame_parms
->
ofdm_symbol_size
];
rxF_ext
=
&
rxdataF_ext
[
aarx
][
symbol
*
20
*
12
];
rxF_ext
=
&
rxdataF_ext
[
aarx
][
symbol
*
20
*
12
];
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
printf
(
"extract_rbs (nushift %d): rx_offset=%d, symbol %
d
\n
"
,
frame_parms
->
nushift
,
printf
(
"extract_rbs (nushift %d): rx_offset=%d, symbol %
u
\n
"
,
frame_parms
->
nushift
,
(
rx_offset
+
((
symbol
+
s_offset
)
*
(
frame_parms
->
ofdm_symbol_size
))),
symbol
);
(
rx_offset
+
((
symbol
+
s_offset
)
*
(
frame_parms
->
ofdm_symbol_size
))),
symbol
);
int16_t
*
p
=
(
int16_t
*
)
rxF
;
int16_t
*
p
=
(
int16_t
*
)
rxF
;
...
@@ -425,7 +425,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -425,7 +425,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
int
max_h
=
0
;
int
max_h
=
0
;
int
symbol
;
int
symbol
;
//uint8_t pbch_a[64];
//uint8_t pbch_a[64];
uint8_t
*
pbch_a
=
malloc
(
sizeof
(
uint8_t
)
*
32
);
//FT ?? cppcheck doesn't like pbch_a allocation because of line 525..and i don't get what this variable is for..
//uint8_t *pbch_a = malloc(sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
//uint32_t pbch_a_prime;
//uint32_t pbch_a_prime;
int16_t
*
pbch_e_rx
;
int16_t
*
pbch_e_rx
;
uint8_t
*
decoded_output
=
nr_ue_pbch_vars
->
decoded_output
;
uint8_t
*
decoded_output
=
nr_ue_pbch_vars
->
decoded_output
;
...
@@ -438,7 +439,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -438,7 +439,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
//uint8_t decoderListSize = 8, pathMetricAppr = 0;
//uint8_t decoderListSize = 8, pathMetricAppr = 0;
//time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving;
//time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving;
//time_stats_t path_metric,sorting,update_LLR;
//time_stats_t path_metric,sorting,update_LLR;
memset
(
&
pbch_a
[
0
],
0
,
sizeof
(
uint8_t
)
*
NR_POLAR_PBCH_PAYLOAD_BITS
);
// FT ?? cppcheck fix
memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
pbch_e_rx
=
&
nr_ue_pbch_vars
->
llr
[
0
];
pbch_e_rx
=
&
nr_ue_pbch_vars
->
llr
[
0
];
...
@@ -522,7 +523,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -522,7 +523,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
#endif
#endif
pbch_e_rx
=
nr_ue_pbch_vars
->
llr
;
pbch_e_rx
=
nr_ue_pbch_vars
->
llr
;
//demod_pbch_e = nr_ue_pbch_vars->demod_pbch_e;
//demod_pbch_e = nr_ue_pbch_vars->demod_pbch_e;
pbch_a
=
nr_ue_pbch_vars
->
pbch_a
;
// FT?? cppcheck fix -
pbch_a = nr_ue_pbch_vars->pbch_a;
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
//pbch_e_rx = &nr_ue_pbch_vars->llr[0];
//pbch_e_rx = &nr_ue_pbch_vars->llr[0];
short
*
p
=
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
20
*
12
]);
short
*
p
=
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
20
*
12
]);
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
View file @
64a0dac2
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
\brief This function frees memory allocated for a particular DLSCH at UE
\brief This function frees memory allocated for a particular DLSCH at UE
@param dlsch Pointer to DLSCH to be removed
@param dlsch Pointer to DLSCH to be removed
*/
*/
void
free_nr_ue_dlsch
(
NR_UE_DLSCH_t
*
dlsch
);
void
free_nr_ue_dlsch
(
NR_UE_DLSCH_t
*
*
dlsch
);
/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
\brief This function allocates structures for a particular DLSCH at UE
\brief This function allocates structures for a particular DLSCH at UE
...
...
openair1/PHY/NR_UE_TRANSPORT/pbch_nr.c
View file @
64a0dac2
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
uint32_t
*
pseudo_random_gold_sequence
(
length
M_PN
,
uint32_t
cinit
)
uint32_t
*
pseudo_random_gold_sequence
(
length
M_PN
,
uint32_t
cinit
)
{
{
int
size
=
M_PN
*
sizeof
(
uint32_t
);
int
size
=
M_PN
*
sizeof
(
uint32_t
);
int
size_x
=
(
sizeof
(
int
)
*
M_PN
+
size
;
int
size_x
=
sizeof
(
int
)
*
M_PN
+
size
;
int
*
x1
=
malloc
(
size_x
);
int
*
x1
=
malloc
(
size_x
);
int
*
x2
=
malloc
(
size_x
);
int
*
x2
=
malloc
(
size_x
);
...
...
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
View file @
64a0dac2
...
@@ -42,14 +42,16 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
...
@@ -42,14 +42,16 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
int8_t
nr_ue_scheduled_response
(
nr_scheduled_response_t
*
scheduled_response
)
int8_t
nr_ue_scheduled_response
(
nr_scheduled_response_t
*
scheduled_response
)
{
{
/// module id
module_id_t
module_id
=
scheduled_response
->
module_id
;
/// component carrier id
uint8_t
cc_id
=
scheduled_response
->
CC_id
;
uint32_t
i
;
int
slot
=
scheduled_response
->
slot
;
if
(
scheduled_response
!=
NULL
){
if
(
scheduled_response
!=
NULL
){
/// module id
module_id_t
module_id
=
scheduled_response
->
module_id
;
/// component carrier id
uint8_t
cc_id
=
scheduled_response
->
CC_id
;
uint32_t
i
;
int
slot
=
scheduled_response
->
slot
;
// Note: we have to handle the thread IDs for this. To be revisited completely.
// Note: we have to handle the thread IDs for this. To be revisited completely.
uint8_t
thread_id
=
PHY_vars_UE_g
[
module_id
][
cc_id
]
->
current_thread_id
[
slot
];
uint8_t
thread_id
=
PHY_vars_UE_g
[
module_id
][
cc_id
]
->
current_thread_id
[
slot
];
NR_UE_PDCCH
*
pdcch_vars2
=
PHY_vars_UE_g
[
module_id
][
cc_id
]
->
pdcch_vars
[
thread_id
][
0
];
NR_UE_PDCCH
*
pdcch_vars2
=
PHY_vars_UE_g
[
module_id
][
cc_id
]
->
pdcch_vars
[
thread_id
][
0
];
...
...
openair1/SIMULATION/NR_PHY/dlschsim.c
View file @
64a0dac2
...
@@ -623,7 +623,7 @@ int main(int argc, char **argv)
...
@@ -623,7 +623,7 @@ int main(int argc, char **argv)
printf
(
"gNB %d
\n
"
,
i
);
printf
(
"gNB %d
\n
"
,
i
);
free_gNB_dlsch
(
gNB
->
dlsch
[
0
][
i
]);
free_gNB_dlsch
(
gNB
->
dlsch
[
0
][
i
]);
printf
(
"UE %d
\n
"
,
i
);
printf
(
"UE %d
\n
"
,
i
);
free_nr_ue_dlsch
(
UE
->
dlsch
[
0
][
0
][
i
]
);
free_nr_ue_dlsch
(
&
(
UE
->
dlsch
[
0
][
0
][
i
])
);
}
}
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
...
...
openair2/COMMON/platform_types.h
View file @
64a0dac2
...
@@ -302,5 +302,12 @@ typedef struct protocol_ctxt_s {
...
@@ -302,5 +302,12 @@ typedef struct protocol_ctxt_s {
#define CHECK_CTXT_ARGS(CTXT_Pp)
#define CHECK_CTXT_ARGS(CTXT_Pp)
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
#ifdef __cplusplus
extern
"C"
{
#endif
void
exit_function
(
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
s
);
void
exit_function
(
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
s
);
#ifdef __cplusplus
}
#endif
#endif
#endif
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
View file @
64a0dac2
...
@@ -221,7 +221,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
...
@@ -221,7 +221,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
nr_rlc_ue_t
*
ue
;
nr_rlc_ue_t
*
ue
;
nr_rlc_entity_t
*
rb
;
nr_rlc_entity_t
*
rb
;
LOG_D
(
RLC
,
"%s rnti %d srb_flag %d rb_id %d mui %d confirm %d sdu_size %d MBMS_flag %d
\n
"
,
LOG_D
(
RLC
,
"%s rnti %d srb_flag %d rb_id %
l
d mui %d confirm %d sdu_size %d MBMS_flag %d
\n
"
,
__FUNCTION__
,
rnti
,
srb_flagP
,
rb_idP
,
muiP
,
confirmP
,
sdu_sizeP
,
__FUNCTION__
,
rnti
,
srb_flagP
,
rb_idP
,
muiP
,
confirmP
,
sdu_sizeP
,
MBMS_flagP
);
MBMS_flagP
);
...
@@ -824,24 +824,24 @@ rlc_op_status_t rrc_rlc_config_req (
...
@@ -824,24 +824,24 @@ rlc_op_status_t rrc_rlc_config_req (
}
}
if
((
srb_flagP
&&
!
(
rb_idP
>=
1
&&
rb_idP
<=
2
))
||
if
((
srb_flagP
&&
!
(
rb_idP
>=
1
&&
rb_idP
<=
2
))
||
(
!
srb_flagP
&&
!
(
rb_idP
>=
1
&&
rb_idP
<=
5
)))
{
(
!
srb_flagP
&&
!
(
rb_idP
>=
1
&&
rb_idP
<=
5
)))
{
LOG_E
(
RLC
,
"%s:%d:%s: bad rb_id (%d) (is_srb %d)
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
rb_idP
,
srb_flagP
);
LOG_E
(
RLC
,
"%s:%d:%s: bad rb_id (%
l
d) (is_srb %d)
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
rb_idP
,
srb_flagP
);
exit
(
1
);
exit
(
1
);
}
}
nr_rlc_manager_lock
(
nr_rlc_ue_manager
);
nr_rlc_manager_lock
(
nr_rlc_ue_manager
);
LOG_D
(
RLC
,
"%s:%d:%s: remove rb %d (is_srb %d) for UE %d
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
rb_idP
,
srb_flagP
,
ctxt_pP
->
rnti
);
LOG_D
(
RLC
,
"%s:%d:%s: remove rb %
l
d (is_srb %d) for UE %d
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
rb_idP
,
srb_flagP
,
ctxt_pP
->
rnti
);
ue
=
nr_rlc_manager_get_ue
(
nr_rlc_ue_manager
,
ctxt_pP
->
rnti
);
ue
=
nr_rlc_manager_get_ue
(
nr_rlc_ue_manager
,
ctxt_pP
->
rnti
);
if
(
srb_flagP
)
{
if
(
srb_flagP
)
{
if
(
ue
->
srb
[
rb_idP
-
1
]
!=
NULL
)
{
if
(
ue
->
srb
[
rb_idP
-
1
]
!=
NULL
)
{
ue
->
srb
[
rb_idP
-
1
]
->
delete
(
ue
->
srb
[
rb_idP
-
1
]);
ue
->
srb
[
rb_idP
-
1
]
->
delete
(
ue
->
srb
[
rb_idP
-
1
]);
ue
->
srb
[
rb_idP
-
1
]
=
NULL
;
ue
->
srb
[
rb_idP
-
1
]
=
NULL
;
}
else
}
else
LOG_W
(
RLC
,
"removing non allocated SRB %d, do nothing
\n
"
,
rb_idP
);
LOG_W
(
RLC
,
"removing non allocated SRB %
l
d, do nothing
\n
"
,
rb_idP
);
}
else
{
}
else
{
if
(
ue
->
drb
[
rb_idP
-
1
]
!=
NULL
)
{
if
(
ue
->
drb
[
rb_idP
-
1
]
!=
NULL
)
{
ue
->
drb
[
rb_idP
-
1
]
->
delete
(
ue
->
drb
[
rb_idP
-
1
]);
ue
->
drb
[
rb_idP
-
1
]
->
delete
(
ue
->
drb
[
rb_idP
-
1
]);
ue
->
drb
[
rb_idP
-
1
]
=
NULL
;
ue
->
drb
[
rb_idP
-
1
]
=
NULL
;
}
else
}
else
LOG_W
(
RLC
,
"removing non allocated DRB %d, do nothing
\n
"
,
rb_idP
);
LOG_W
(
RLC
,
"removing non allocated DRB %
l
d, do nothing
\n
"
,
rb_idP
);
}
}
/* remove UE if it has no more RB configured */
/* remove UE if it has no more RB configured */
for
(
i
=
0
;
i
<
2
;
i
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
...
...
openair2/NETWORK_DRIVER/UE_IP/common.c
View file @
64a0dac2
...
@@ -193,7 +193,7 @@ ue_ip_common_class_wireless2ip(
...
@@ -193,7 +193,7 @@ ue_ip_common_class_wireless2ip(
break
;
break
;
default:
default:
printk
(
"[UE_IP_DRV][%s] begin RB %d Inst %d Length %d bytes
\n
"
,
__FUNCTION__
,
rb_idP
,
instP
,
data_lenP
);
printk
(
"[UE_IP_DRV][%s] begin RB %
l
d Inst %d Length %d bytes
\n
"
,
__FUNCTION__
,
rb_idP
,
instP
,
data_lenP
);
printk
(
"[UE_IP_DRV][%s] Inst %d: receive unknown message (version=%d)
\n
"
,
__FUNCTION__
,
instP
,
ipv_p
->
version
);
printk
(
"[UE_IP_DRV][%s] Inst %d: receive unknown message (version=%d)
\n
"
,
__FUNCTION__
,
instP
,
ipv_p
->
version
);
}
}
...
@@ -318,7 +318,7 @@ ue_ip_common_ip2wireless(
...
@@ -318,7 +318,7 @@ ue_ip_common_ip2wireless(
if
(
bytes_wrote
!=
UE_IP_PDCPH_SIZE
)
{
if
(
bytes_wrote
!=
UE_IP_PDCPH_SIZE
)
{
printk
(
"[UE_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d)
\n
"
,
__FUNCTION__
,
bytes_wrote
);
printk
(
"[UE_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d)
\n
"
,
__FUNCTION__
,
bytes_wrote
);
printk
(
"rb_id %d, Wrote %d, Header Size %d
\n
"
,
pdcph
.
rb_id
,
bytes_wrote
,
UE_IP_PDCPH_SIZE
);
printk
(
"rb_id %
l
d, Wrote %d, Header Size %d
\n
"
,
pdcph
.
rb_id
,
bytes_wrote
,
UE_IP_PDCPH_SIZE
);
priv_p
->
stats
.
tx_dropped
++
;
priv_p
->
stats
.
tx_dropped
++
;
return
;
return
;
}
}
...
@@ -326,7 +326,7 @@ ue_ip_common_ip2wireless(
...
@@ -326,7 +326,7 @@ ue_ip_common_ip2wireless(
bytes_wrote
+=
ue_ip_netlink_send
((
char
*
)
skb_pP
->
data
,
skb_pP
->
len
);
bytes_wrote
+=
ue_ip_netlink_send
((
char
*
)
skb_pP
->
data
,
skb_pP
->
len
);
if
(
bytes_wrote
!=
skb_pP
->
len
+
UE_IP_PDCPH_SIZE
)
{
if
(
bytes_wrote
!=
skb_pP
->
len
+
UE_IP_PDCPH_SIZE
)
{
printk
(
"[UE_IP_DRV][%s] Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %d
\n
"
,
printk
(
"[UE_IP_DRV][%s] Inst %d, RB_ID %
l
d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %d
\n
"
,
__FUNCTION__
,
__FUNCTION__
,
instP
,
instP
,
pdcph
.
rb_id
,
pdcph
.
rb_id
,
...
...
openair2/UTIL/OTG/otg_rx_socket.c
View file @
64a0dac2
...
@@ -195,7 +195,7 @@ void server_socket_tcp_ip4()
...
@@ -195,7 +195,7 @@ void server_socket_tcp_ip4()
/* create new thread for the new connection */
/* create new thread for the new connection */
threadCreate
(
&
id
,
(
void
*
)
recv_ip4_tcp
,
(
void
*
)
csock
)
,
"OTG"
,
-
1
,
OAI_PRIORITY_RT_LOW
);
threadCreate
(
&
id
,
(
void
*
)
recv_ip4_tcp
,
(
void
*
)
csock
,
"OTG"
,
-
1
,
OAI_PRIORITY_RT_LOW
);
LOG_I
(
OTG
,
"SOCKET:: TCP-IP4 :: Client n=%d finish transmission
\n
"
,
cmpt_cl
);
LOG_I
(
OTG
,
"SOCKET:: TCP-IP4 :: Client n=%d finish transmission
\n
"
,
cmpt_cl
);
cmpt_cl
+=
1
;
cmpt_cl
+=
1
;
}
}
...
...
targets/ARCH/COMMON/common_lib.h
View file @
64a0dac2
...
@@ -135,6 +135,8 @@ typedef struct {
...
@@ -135,6 +135,8 @@ typedef struct {
/*! \brief Clock source types */
/*! \brief Clock source types */
typedef
enum
{
typedef
enum
{
//! this means the paramter has not been set
unset
=-
1
,
//! This tells the underlying hardware to use the internal reference
//! This tells the underlying hardware to use the internal reference
internal
=
0
,
internal
=
0
,
//! This tells the underlying hardware to use the external reference
//! This tells the underlying hardware to use the external reference
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
64a0dac2
...
@@ -30,9 +30,9 @@
...
@@ -30,9 +30,9 @@
#include <stdio.h>
#include <stdio.h>
#include <uhd/version.hpp>
#include <uhd/version.hpp>
#if UHD_VERSION < 3110000
#if UHD_VERSION < 3110000
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/thread_priority.hpp>
#else
#else
#include <uhd/utils/thread.hpp>
#include <uhd/utils/thread.hpp>
#endif
#endif
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/version.hpp>
#include <uhd/version.hpp>
...
@@ -48,26 +48,28 @@
...
@@ -48,26 +48,28 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "common_lib.h"
#include "common_lib.h"
#include "assertions.h"
#include "assertions.h"
#include <sys/sysinfo.h>
#include <sys/resource.h>
#include <sys/resource.h>
#include "usrp_lib.h"
#ifdef __SSE4_1__
#ifdef __SSE4_1__
#
include <smmintrin.h>
#
include <smmintrin.h>
#endif
#endif
#ifdef __AVX2__
#ifdef __AVX2__
#
include <immintrin.h>
#
include <immintrin.h>
#endif
#endif
#ifdef __arm__
#ifdef __arm__
#
include <arm_neon.h>
#
include <arm_neon.h>
#endif
#endif
/** @addtogroup _USRP_PHY_RF_INTERFACE_
/** @addtogroup _USRP_PHY_RF_INTERFACE_
* @{
* @{
*/
*/
/*! \brief USRP Configuration */
typedef
struct
{
typedef
struct
{
// --------------------------------
// --------------------------------
...
@@ -106,7 +108,8 @@ typedef struct {
...
@@ -106,7 +108,8 @@ typedef struct {
int
first_tx
;
int
first_tx
;
//! timestamp of RX packet
//! timestamp of RX packet
openair0_timestamp
rx_timestamp
;
openair0_timestamp
rx_timestamp
;
uint32_t
recplay_mode
;
recplay_state_t
*
recplay_state
;
}
usrp_state_t
;
}
usrp_state_t
;
//void print_notes(void)
//void print_notes(void)
...
@@ -128,10 +131,10 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
...
@@ -128,10 +131,10 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
for
(
int
i
=
0
;
i
<
30
and
not
ref_locked
;
i
++
)
{
for
(
int
i
=
0
;
i
<
30
and
not
ref_locked
;
i
++
)
{
ref_locked
=
s
->
usrp
->
get_mboard_sensor
(
"ref_locked"
,
mboard
).
to_bool
();
ref_locked
=
s
->
usrp
->
get_mboard_sensor
(
"ref_locked"
,
mboard
).
to_bool
();
if
(
not
ref_locked
)
{
if
(
not
ref_locked
)
{
std
::
cout
<<
"."
<<
std
::
flush
;
std
::
cout
<<
"."
<<
std
::
flush
;
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
seconds
(
1
));
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
seconds
(
1
));
}
}
}
}
...
@@ -140,13 +143,11 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
...
@@ -140,13 +143,11 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
}
else
{
}
else
{
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
}
}
}
else
{
}
else
{
std
::
cout
<<
boost
::
format
(
"ref_locked sensor not present on this board.
\n
"
);
std
::
cout
<<
boost
::
format
(
"ref_locked sensor not present on this board.
\n
"
);
}
}
return
ref_locked
;
return
ref_locked
;
}
}
static
int
sync_to_gps
(
openair0_device
*
device
)
{
static
int
sync_to_gps
(
openair0_device
*
device
)
{
...
@@ -179,14 +180,13 @@ static int sync_to_gps(openair0_device *device) {
...
@@ -179,14 +180,13 @@ static int sync_to_gps(openair0_device *device) {
for
(
size_t
mboard
=
0
;
mboard
<
num_mboards
;
mboard
++
)
{
for
(
size_t
mboard
=
0
;
mboard
<
num_mboards
;
mboard
++
)
{
std
::
cout
<<
"Synchronizing mboard "
<<
mboard
<<
": "
<<
s
->
usrp
->
get_mboard_name
(
mboard
)
<<
std
::
endl
;
std
::
cout
<<
"Synchronizing mboard "
<<
mboard
<<
": "
<<
s
->
usrp
->
get_mboard_name
(
mboard
)
<<
std
::
endl
;
bool
ref_locked
=
check_ref_locked
(
s
,
mboard
);
bool
ref_locked
=
check_ref_locked
(
s
,
mboard
);
if
(
ref_locked
)
{
if
(
ref_locked
)
{
std
::
cout
<<
boost
::
format
(
"Ref Locked
\n
"
);
std
::
cout
<<
boost
::
format
(
"Ref Locked
\n
"
);
}
else
{
}
else
{
std
::
cout
<<
"Failed to lock to GPSDO 10 MHz Reference. Exiting."
<<
std
::
endl
;
std
::
cout
<<
"Failed to lock to GPSDO 10 MHz Reference. Exiting."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
//Wait for GPS lock
//Wait for GPS lock
...
@@ -265,175 +265,137 @@ static int sync_to_gps(openair0_device *device) {
...
@@ -265,175 +265,137 @@ static int sync_to_gps(openair0_device *device) {
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
#if defined(USRP_REC_PLAY)
#include "usrp_lib.h"
static
FILE
*
pFile
=
NULL
;
int
mmapfd
=
0
;
int
iqfd
=
0
;
int
use_mmap
=
1
;
// default is to use mmap
struct
stat
sb
;
iqrec_t
*
ms_sample
=
NULL
;
// memory for all subframes
unsigned
int
nb_samples
=
0
;
unsigned
int
cur_samples
=
0
;
int64_t
wrap_count
=
0
;
int64_t
wrap_ts
=
0
;
unsigned
int
u_sf_mode
=
0
;
// 1=record, 2=replay
unsigned
int
u_sf_record
=
0
;
// record mode
unsigned
int
u_sf_replay
=
0
;
// replay mode
char
u_sf_filename
[
1024
]
=
""
;
// subframes file path
unsigned
int
u_sf_max
=
DEF_NB_SF
;
// max number of recorded subframes
unsigned
int
u_sf_loops
=
DEF_SF_NB_LOOP
;
// number of loops in replay mode
unsigned
int
u_sf_read_delay
=
DEF_SF_DELAY_READ
;
// read delay in replay mode
unsigned
int
u_sf_write_delay
=
DEF_SF_DELAY_WRITE
;
// write delay in replay mode
char
config_opt_sf_file
[]
=
CONFIG_OPT_SF_FILE
;
char
config_def_sf_file
[]
=
DEF_SF_FILE
;
char
config_hlp_sf_file
[]
=
CONFIG_HLP_SF_FILE
;
char
config_opt_sf_rec
[]
=
CONFIG_OPT_SF_REC
;
char
config_hlp_sf_rec
[]
=
CONFIG_HLP_SF_REC
;
char
config_opt_sf_rep
[]
=
CONFIG_OPT_SF_REP
;
char
config_hlp_sf_rep
[]
=
CONFIG_HLP_SF_REP
;
char
config_opt_sf_max
[]
=
CONFIG_OPT_SF_MAX
;
char
config_hlp_sf_max
[]
=
CONFIG_HLP_SF_MAX
;
char
config_opt_sf_loops
[]
=
CONFIG_OPT_SF_LOOPS
;
char
config_hlp_sf_loops
[]
=
CONFIG_HLP_SF_LOOPS
;
char
config_opt_sf_rdelay
[]
=
CONFIG_OPT_SF_RDELAY
;
char
config_hlp_sf_rdelay
[]
=
CONFIG_HLP_SF_RDELAY
;
char
config_opt_sf_wdelay
[]
=
CONFIG_OPT_SF_WDELAY
;
char
config_hlp_sf_wdelay
[]
=
CONFIG_HLP_SF_WDELAY
;
#endif
/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
@param device pointer to the device structure specific to the RF hardware target
@param device pointer to the device structure specific to the RF hardware target
*/
*/
static
int
trx_usrp_start
(
openair0_device
*
device
)
{
static
int
trx_usrp_start
(
openair0_device
*
device
)
{
#if defined(USRP_REC_PLAY)
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
if
(
u_sf_mode
!=
2
)
{
// not replay mode
if
(
s
->
recplay_mode
==
RECPLAY_REPLAYMODE
)
#endif
return
0
;
uhd
::
set_thread_priority_safe
(
1.0
);
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
// setup GPIO for TDD, GPIO(4) = ATR_RX
//set data direction register (DDR) to output
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"DDR"
,
0x7f
,
0x7f
);
//set control register to ATR
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"CTRL"
,
0x7f
,
0x7f
);
//set ATR register
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"ATR_RX"
,
(
1
<<
4
)
|
(
1
<<
6
),
0x7f
);
// init recv and send streaming
uhd
::
stream_cmd_t
cmd
(
uhd
::
stream_cmd_t
::
STREAM_MODE_START_CONTINUOUS
);
LOG_I
(
HW
,
"Time in secs now: %llu
\n
"
,
s
->
usrp
->
get_time_now
().
to_ticks
(
s
->
sample_rate
));
LOG_I
(
HW
,
"Time in secs last pps: %llu
\n
"
,
s
->
usrp
->
get_time_last_pps
().
to_ticks
(
s
->
sample_rate
));
if
(
s
->
use_gps
==
1
||
device
->
openair0_cfg
[
0
].
time_source
==
external
)
{
s
->
wait_for_first_pps
=
1
;
cmd
.
time_spec
=
s
->
usrp
->
get_time_last_pps
()
+
uhd
::
time_spec_t
(
1.0
);
}
else
{
s
->
wait_for_first_pps
=
0
;
cmd
.
time_spec
=
s
->
usrp
->
get_time_now
()
+
uhd
::
time_spec_t
(
0.005
);
}
cmd
.
stream_now
=
false
;
// start at constant delay
// setup GPIO for TDD, GPIO(4) = ATR_RX
s
->
rx_stream
->
issue_stream_cmd
(
cmd
);
//set data direction register (DDR) to output
/*s->tx_md.time_spec = cmd.time_spec + uhd::time_spec_t(1-(double)s->tx_forward_nsamps/s->sample_rate);
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"DDR"
,
0x7f
,
0x7f
);
s->tx_md.has_time_spec = true;
//set control register to ATR
s->tx_md.start_of_burst = true;
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"CTRL"
,
0x7f
,
0x7f
);
s->tx_md.end_of_burst = false;*/
//set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX)
s
->
rx_count
=
0
;
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"ATR_RX"
,
(
1
<<
4
)
|
(
1
<<
6
),
0x7f
);
s
->
tx_count
=
0
;
// set pin 5 (Shutdown LNA) to 1 when the radio is transmitting and receiveing (ATR_XX)
s
->
rx_timestamp
=
0
;
// (we use full duplex here, because our RX is on all the time - this might need to change later)
#if defined(USRP_REC_PLAY)
s
->
usrp
->
set_gpio_attr
(
"FP0"
,
"ATR_XX"
,
(
1
<<
5
),
0x7f
);
// init recv and send streaming
uhd
::
stream_cmd_t
cmd
(
uhd
::
stream_cmd_t
::
STREAM_MODE_START_CONTINUOUS
);
LOG_I
(
HW
,
"Time in secs now: %llu
\n
"
,
s
->
usrp
->
get_time_now
().
to_ticks
(
s
->
sample_rate
));
LOG_I
(
HW
,
"Time in secs last pps: %llu
\n
"
,
s
->
usrp
->
get_time_last_pps
().
to_ticks
(
s
->
sample_rate
));
if
(
s
->
use_gps
==
1
||
device
->
openair0_cfg
[
0
].
time_source
==
external
)
{
s
->
wait_for_first_pps
=
1
;
cmd
.
time_spec
=
s
->
usrp
->
get_time_last_pps
()
+
uhd
::
time_spec_t
(
1.0
);
}
else
{
s
->
wait_for_first_pps
=
0
;
cmd
.
time_spec
=
s
->
usrp
->
get_time_now
()
+
uhd
::
time_spec_t
(
0.005
);
}
}
#endif
cmd
.
stream_now
=
false
;
// start at constant delay
s
->
rx_stream
->
issue_stream_cmd
(
cmd
);
/*s->tx_md.time_spec = cmd.time_spec + uhd::time_spec_t(1-(double)s->tx_forward_nsamps/s->sample_rate);
s->tx_md.has_time_spec = true;
s->tx_md.start_of_burst = true;
s->tx_md.end_of_burst = false;*/
s
->
rx_count
=
0
;
s
->
tx_count
=
0
;
s
->
rx_timestamp
=
0
;
return
0
;
return
0
;
}
}
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
* \param device the hardware to use
* \param device the hardware to use
*/
*/
static
void
trx_usrp_end
(
openair0_device
*
device
)
{
static
void
trx_usrp_end
(
openair0_device
*
device
)
{
#if defined(USRP_REC_PLAY) // For some ugly reason, this can be called several times...
if
(
device
==
NULL
)
static
int
done
=
0
;
return
;
if
(
done
==
1
)
return
;
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
done
=
1
;
if
(
s
==
NULL
)
return
;
if
(
u_sf_mode
!=
2
)
{
// not subframes replay
if
(
s
->
recplay_mode
!=
RECPLAY_REPLAYMODE
)
{
// not subframes replay
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
s
->
rx_stream
->
issue_stream_cmd
(
uhd
::
stream_cmd_t
::
STREAM_MODE_STOP_CONTINUOUS
);
s
->
rx_stream
->
issue_stream_cmd
(
uhd
::
stream_cmd_t
::
STREAM_MODE_STOP_CONTINUOUS
);
//send a mini EOB packet
//send a mini EOB packet
s
->
tx_md
.
end_of_burst
=
true
;
s
->
tx_md
.
end_of_burst
=
true
;
s
->
tx_stream
->
send
(
""
,
0
,
s
->
tx_md
);
s
->
tx_stream
->
send
(
""
,
0
,
s
->
tx_md
);
s
->
tx_md
.
end_of_burst
=
false
;
s
->
tx_md
.
end_of_burst
=
false
;
sleep
(
1
);
sleep
(
1
);
#if defined(USRP_REC_PLAY)
}
}
#endif
if
(
s
->
recplay_mode
==
RECPLAY_RECORDMODE
)
{
// subframes store
#if defined(USRP_REC_PLAY)
s
->
recplay_state
->
pFile
=
fopen
(
s
->
recplay_state
->
u_sf_filename
,
"wb+"
);
if
(
u_sf_mode
==
1
)
{
// subframes store
if
(
s
->
recplay_state
->
pFile
==
NULL
)
{
pFile
=
fopen
(
u_sf_filename
,
"wb+"
);
std
::
cerr
<<
"Cannot open "
<<
s
->
recplay_state
->
u_sf_filename
<<
std
::
endl
;
if
(
pFile
==
NULL
)
{
std
::
cerr
<<
"Cannot open "
<<
u_sf_filename
<<
std
::
endl
;
}
else
{
}
else
{
unsigned
int
i
=
0
;
unsigned
int
i
=
0
;
unsigned
int
modu
=
0
;
unsigned
int
modu
=
0
;
if
((
modu
=
nb_samples
%
10
)
!=
0
)
{
if
((
modu
=
s
->
recplay_state
->
nb_samples
%
10
)
!=
0
)
{
nb_samples
-=
modu
;
// store entire number of frames
s
->
recplay_state
->
nb_samples
-=
modu
;
// store entire number of frames
}
}
std
::
cerr
<<
"Writing "
<<
nb_samples
<<
" subframes to "
<<
u_sf_filename
<<
" ..."
<<
std
::
endl
;
std
::
cerr
<<
"Writing "
<<
s
->
recplay_state
->
nb_samples
<<
" subframes to "
<<
s
->
recplay_state
->
u_sf_filename
<<
" ..."
<<
std
::
endl
;
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
recplay_state
->
nb_samples
;
i
++
)
{
fwrite
(
ms_sample
+
i
,
sizeof
(
unsigned
char
),
sizeof
(
iqrec_t
),
pFile
);
fwrite
(
s
->
recplay_state
->
ms_sample
+
i
,
sizeof
(
unsigned
char
),
sizeof
(
iqrec_t
),
s
->
recplay_state
->
pFile
);
}
}
fclose
(
pFile
);
fclose
(
s
->
recplay_state
->
pFile
);
std
::
cerr
<<
"File "
<<
u_sf_filename
<<
" closed."
<<
std
::
endl
;
std
::
cerr
<<
"File "
<<
s
->
recplay_state
->
u_sf_filename
<<
" closed."
<<
std
::
endl
;
}
}
}
if
(
u_sf_mode
==
1
)
{
// record
if
(
s
->
recplay_state
->
ms_sample
!=
NULL
)
{
if
(
ms_sample
!=
NULL
)
{
free
((
void
*
)
s
->
recplay_state
->
ms_sample
);
free
((
void
*
)
ms_sample
);
s
->
recplay_state
->
ms_sample
=
NULL
;
ms_sample
=
NULL
;
}
}
}
}
else
if
(
s
->
recplay_mode
==
RECPLAY_REPLAYMODE
)
{
// replay
if
(
s
->
recplay_state
->
use_mmap
)
{
if
(
u_sf_mode
==
2
)
{
// replay
if
(
s
->
recplay_state
->
ms_sample
!=
MAP_FAILED
)
{
if
(
use_mmap
)
{
munmap
(
s
->
recplay_state
->
ms_sample
,
s
->
recplay_state
->
mapsize
);
if
(
ms_sample
!=
MAP_FAILED
)
{
s
->
recplay_state
->
ms_sample
=
NULL
;
munmap
(
ms_sample
,
sb
.
st_size
);
ms_sample
=
NULL
;
}
}
if
(
mmapfd
!=
0
)
{
if
(
s
->
recplay_state
->
mmapfd
!=
0
)
{
close
(
mmapfd
);
close
(
s
->
recplay_state
->
mmapfd
);
mmapfd
=
0
;
s
->
recplay_state
->
mmapfd
=
0
;
}
}
}
else
{
}
else
{
if
(
ms_sample
!=
NULL
)
{
if
(
s
->
recplay_state
->
ms_sample
!=
NULL
)
{
free
(
ms_sample
);
free
(
s
->
recplay_state
->
ms_sample
);
ms_sample
=
NULL
;
s
->
recplay_state
->
ms_sample
=
NULL
;
}
}
if
(
iqfd
!=
0
)
{
if
(
s
->
recplay_state
->
iqfd
!=
0
)
{
close
(
iqfd
);
close
(
s
->
recplay_state
->
iqfd
);
iqfd
=
0
;
s
->
recplay_state
->
iqfd
=
0
;
}
}
}
}
}
}
#endif
}
}
/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
@param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at which the first sample MUST be sent
@param buff Buffer which holds the samples
@param nsamps number of samples to be sent
@param antenna_id index of the antenna if the device has multiple antennas
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/
static
int
trx_usrp_write_recplay
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
struct
timespec
req
;
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
req
.
tv_sec
=
0
;
req
.
tv_nsec
=
s
->
recplay_state
->
u_sf_write_delay
*
1000
;
nanosleep
(
&
req
,
NULL
);
return
nsamps
;
}
/*! \brief Called to send samples to the USRP RF target
/*! \brief Called to send samples to the USRP RF target
@param device pointer to the device structure specific to the RF hardware target
@param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at which the first sample MUST be sent
@param timestamp The timestamp at which the first sample MUST be sent
...
@@ -444,14 +406,8 @@ static void trx_usrp_end(openair0_device *device) {
...
@@ -444,14 +406,8 @@ static void trx_usrp_end(openair0_device *device) {
*/
*/
static
int
trx_usrp_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
static
int
trx_usrp_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
int
ret
=
0
;
int
ret
=
0
;
#if defined(USRP_REC_PLAY)
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
int
nsamps2
;
// aligned to upper 32 or 16 byte boundary
if
(
u_sf_mode
!=
2
)
{
// not replay mode
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
int
nsamps2
;
// aligned to upper 32 or 16 byte boundary
#if defined(__x86_64) || defined(__i386__)
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
#ifdef __AVX2__
nsamps2
=
(
nsamps
+
7
)
>>
3
;
nsamps2
=
(
nsamps
+
7
)
>>
3
;
...
@@ -464,23 +420,24 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
...
@@ -464,23 +420,24 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
nsamps2
=
(
nsamps
+
3
)
>>
2
;
nsamps2
=
(
nsamps
+
3
)
>>
2
;
int16x8_t
buff_tx
[
8
][
nsamps2
];
int16x8_t
buff_tx
[
8
][
nsamps2
];
#else
#else
#error Unsupported CPU architecture, USRP device cannot be built
#error Unsupported CPU architecture, USRP device cannot be built
#endif
#endif
// bring RX data into 12 LSBs for softmodem RX
// bring RX data into 12 LSBs for softmodem RX
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
{
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nsamps2
;
j
++
)
{
for
(
int
j
=
0
;
j
<
nsamps2
;
j
++
)
{
#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
#ifdef __AVX2__
buff_tx
[
i
][
j
]
=
_mm256_slli_epi16
(((
__m256i
*
)
buff
[
i
])[
j
],
4
);
buff_tx
[
i
][
j
]
=
_mm256_slli_epi16
(((
__m256i
*
)
buff
[
i
])[
j
],
4
);
#else
#else
buff_tx
[
i
][
j
]
=
_mm_slli_epi16
(((
__m128i
*
)
buff
[
i
])[
j
],
4
);
buff_tx
[
i
][
j
]
=
_mm_slli_epi16
(((
__m128i
*
)
buff
[
i
])[
j
],
4
);
#endif
#endif
#elif defined(__arm__)
#elif defined(__arm__)
buff_tx
[
i
][
j
]
=
vshlq_n_s16
(((
int16x8_t
*
)
buff
[
i
])[
j
],
4
);
buff_tx
[
i
][
j
]
=
vshlq_n_s16
(((
int16x8_t
*
)
buff
[
i
])[
j
],
4
);
#endif
#endif
}
}
}
}
boolean_t
first_packet_state
=
false
,
last_packet_state
=
false
;
boolean_t
first_packet_state
=
false
,
last_packet_state
=
false
;
...
@@ -495,56 +452,43 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
...
@@ -495,56 +452,43 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
first_packet_state
=
false
;
first_packet_state
=
false
;
last_packet_state
=
true
;
last_packet_state
=
true
;
}
else
if
(
flags
==
4
)
{
// start and end
}
else
if
(
flags
==
4
)
{
// start and end
// s->tx_md.start_of_burst = true;
// s->tx_md.start_of_burst = true;
// s->tx_md.end_of_burst = true;
// s->tx_md.end_of_burst = true;
first_packet_state
=
true
;
first_packet_state
=
true
;
last_packet_state
=
true
;
last_packet_state
=
true
;
}
else
if
(
flags
==
1
)
{
// middle of burst
}
else
if
(
flags
==
1
)
{
// middle of burst
// s->tx_md.start_of_burst = false;
// s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = false;
// s->tx_md.end_of_burst = false;
first_packet_state
=
false
;
first_packet_state
=
false
;
last_packet_state
=
false
;
last_packet_state
=
false
;
}
}
else
if
(
flags
==
10
)
{
// fail safe mode
else
if
(
flags
==
10
)
{
// fail safe mode
// s->tx_md.has_time_spec = false;
// s->tx_md.has_time_spec = false;
// s->tx_md.start_of_burst = false;
// s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = true;
// s->tx_md.end_of_burst = true;
first_packet_state
=
false
;
first_packet_state
=
false
;
last_packet_state
=
true
;
last_packet_state
=
true
;
}
}
s
->
tx_md
.
has_time_spec
=
true
;
s
->
tx_md
.
has_time_spec
=
true
;
s
->
tx_md
.
start_of_burst
=
(
s
->
tx_count
==
0
)
?
true
:
first_packet_state
;
s
->
tx_md
.
start_of_burst
=
(
s
->
tx_count
==
0
)
?
true
:
first_packet_state
;
s
->
tx_md
.
end_of_burst
=
last_packet_state
;
s
->
tx_md
.
end_of_burst
=
last_packet_state
;
s
->
tx_md
.
time_spec
=
uhd
::
time_spec_t
::
from_ticks
(
timestamp
,
s
->
sample_rate
);
s
->
tx_md
.
time_spec
=
uhd
::
time_spec_t
::
from_ticks
(
timestamp
,
s
->
sample_rate
);
s
->
tx_count
++
;
s
->
tx_count
++
;
if
(
cc
>
1
)
{
if
(
cc
>
1
)
{
std
::
vector
<
void
*>
buff_ptrs
;
std
::
vector
<
void
*>
buff_ptrs
;
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
buff_ptrs
.
push_back
(
&
(((
int16_t
*
)
buff_tx
[
i
])[
0
]));
buff_ptrs
.
push_back
(
&
(((
int16_t
*
)
buff_tx
[
i
])[
0
]));
ret
=
(
int
)
s
->
tx_stream
->
send
(
buff_ptrs
,
nsamps
,
s
->
tx_md
);
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
);
}
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
);
if
(
ret
!=
nsamps
)
LOG_E
(
HW
,
"[xmit] tx samples %d != %d
\n
"
,
ret
,
nsamps
);
#if defined(USRP_REC_PLAY)
}
else
{
struct
timespec
req
;
req
.
tv_sec
=
0
;
req
.
tv_nsec
=
u_sf_write_delay
*
1000
;
nanosleep
(
&
req
,
NULL
);
ret
=
nsamps
;
}
#endif
return
ret
;
return
ret
;
}
}
/*! \brief Receive samples from
hardwar
e.
/*! \brief Receive samples from
iq fil
e.
* Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
* Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
* the first channel. *ptimestamp is the time at which the first sample
* the first channel. *ptimestamp is the time at which the first sample
* was received.
* was received.
...
@@ -555,190 +499,206 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
...
@@ -555,190 +499,206 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
* \param antenna_id Index of antenna for which to receive samples
* \param antenna_id Index of antenna for which to receive samples
* \returns the number of sample read
* \returns the number of sample read
*/
*/
static
int
trx_usrp_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
static
int
trx_usrp_read_recplay
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
int
samples_received
=
0
;
int
samples_received
=
0
;
int
nsamps2
;
// aligned to upper 32 or 16 byte boundary
static
unsigned
int
cur_samples
;
#if defined(USRP_REC_PLAY)
static
int64_t
wrap_count
;
static
int64_t
wrap_ts
;
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
if
(
u_sf_mode
!=
2
)
{
// not replay mode
#endif
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2
=
(
nsamps
+
7
)
>>
3
;
__m256i
buff_tmp
[
8
][
nsamps2
];
#else
nsamps2
=
(
nsamps
+
3
)
>>
2
;
__m128i
buff_tmp
[
8
][
nsamps2
];
#endif
#elif defined(__arm__)
nsamps2
=
(
nsamps
+
3
)
>>
2
;
int16x8_t
buff_tmp
[
8
][
nsamps2
];
#endif
if
(
device
->
type
==
USRP_B200_DEV
)
{
if
(
cur_samples
==
s
->
recplay_state
->
nb_samples
)
{
if
(
cc
>
1
)
{
cur_samples
=
0
;
// receive multiple channels (e.g. RF A and RF B)
wrap_count
++
;
std
::
vector
<
void
*>
buff_ptrs
;
if
(
wrap_count
==
s
->
recplay_state
->
u_sf_loops
)
{
std
::
cerr
<<
"USRP device terminating subframes replay mode after "
<<
s
->
recplay_state
->
u_sf_loops
<<
" loops."
<<
std
::
endl
;
exit_function
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
"replay ended, triggering process termination
\n
"
);
}
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
buff_ptrs
.
push_back
(
buff_tmp
[
i
]
);
wrap_ts
=
wrap_count
*
(
s
->
recplay_state
->
nb_samples
*
(((
int
)(
device
->
openair0_cfg
[
0
].
sample_rate
))
/
1000
)
);
samples_received
=
s
->
rx_stream
->
recv
(
buff_ptrs
,
nsamps
,
s
->
rx_md
);
if
(
!
s
->
recplay_state
->
use_mmap
)
{
if
(
lseek
(
s
->
recplay_state
->
iqfd
,
0
,
SEEK_SET
)
==
0
)
{
std
::
cerr
<<
"Seeking at the beginning of IQ file"
<<
std
::
endl
;
}
else
{
}
else
{
// receive a single channel (e.g. from connector RF A)
std
::
cerr
<<
"Problem seeking at the beginning of IQ file"
<<
std
::
endl
;
samples_received
=
0
;
}
}
}
while
(
samples_received
!=
nsamps
)
{
if
(
s
->
recplay_state
->
use_mmap
)
{
samples_received
+=
s
->
rx_stream
->
recv
(
buff_tmp
[
0
]
+
samples_received
,
if
(
cur_samples
<
s
->
recplay_state
->
nb_samples
)
{
nsamps
-
samples_received
,
s
->
rx_md
)
;
*
ptimestamp
=
(
s
->
recplay_state
->
ms_sample
[
0
].
ts
+
(
cur_samples
*
(((
int
)(
device
->
openair0_cfg
[
0
].
sample_rate
))
/
1000
)))
+
wrap_ts
;
if
((
s
->
wait_for_first_pps
==
0
)
&&
(
s
->
rx_md
.
error_code
!=
uhd
::
rx_metadata_t
::
ERROR_CODE_NONE
))
if
(
cur_samples
==
0
)
{
break
;
std
::
cerr
<<
"starting subframes file with wrap_count="
<<
wrap_count
<<
" wrap_ts="
<<
wrap_ts
<<
" ts="
<<
*
ptimestamp
<<
std
::
endl
;
}
if
((
s
->
wait_for_first_pps
==
1
)
&&
(
samples_received
!=
nsamps
))
{
memcpy
(
buff
[
0
],
&
s
->
recplay_state
->
ms_sample
[
cur_samples
].
samples
[
0
],
nsamps
*
4
);
printf
(
"sleep...
\n
"
);
//usleep(100);
cur_samples
++
;
}
}
}
}
else
{
// read sample from file
if
(
read
(
s
->
recplay_state
->
iqfd
,
s
->
recplay_state
->
ms_sample
,
sizeof
(
iqrec_t
))
!=
sizeof
(
iqrec_t
))
{
std
::
cerr
<<
"pb reading iqfile at index "
<<
sizeof
(
iqrec_t
)
*
cur_samples
<<
std
::
endl
;
close
(
s
->
recplay_state
->
iqfd
);
free
(
s
->
recplay_state
->
ms_sample
);
s
->
recplay_state
->
ms_sample
=
NULL
;
s
->
recplay_state
->
iqfd
=
0
;
exit
(
-
1
);
}
if
(
samples_received
==
nsamps
)
s
->
wait_for_first_pps
=
0
;
if
(
cur_samples
<
s
->
recplay_state
->
nb_samples
)
{
static
int64_t
ts0
=
0
;
if
((
cur_samples
==
0
)
&&
(
wrap_count
==
0
))
{
ts0
=
s
->
recplay_state
->
ms_sample
->
ts
;
}
}
// bring RX data into 12 LSBs for softmodem RX
*
ptimestamp
=
ts0
+
(
cur_samples
*
(((
int
)(
device
->
openair0_cfg
[
0
].
sample_rate
))
/
1000
))
+
wrap_ts
;
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nsamps2
;
j
++
)
{
if
(
cur_samples
==
0
)
{
#if defined(__x86_64__) || defined(__i386__)
std
::
cerr
<<
"starting subframes file with wrap_count="
<<
wrap_count
<<
" wrap_ts="
<<
wrap_ts
#ifdef __AVX2__
<<
" ts="
<<
*
ptimestamp
<<
std
::
endl
;
// FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
if
((((
uintptr_t
)
buff
[
i
])
&
0x1F
)
==
0
)
{
((
__m256i
*
)
buff
[
i
])[
j
]
=
_mm256_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
}
else
{
((
__m128i
*
)
buff
[
i
])[
2
*
j
]
=
_mm_srai_epi16
(((
__m128i
*
)
buff_tmp
[
i
])[
2
*
j
],
4
);
((
__m128i
*
)
buff
[
i
])[
2
*
j
+
1
]
=
_mm_srai_epi16
(((
__m128i
*
)
buff_tmp
[
i
])[
2
*
j
+
1
],
4
);
}
#else
((
__m128i
*
)
buff
[
i
])[
j
]
=
_mm_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
#endif
#elif defined(__arm__)
((
int16x8_t
*
)
buff
[
i
])[
j
]
=
vshrq_n_s16
(
buff_tmp
[
i
][
j
],
4
);
#endif
}
}
}
}
else
if
(
device
->
type
==
USRP_X300_DEV
)
{
if
(
cc
>
1
)
{
// receive multiple channels (e.g. RF A and RF B)
std
::
vector
<
void
*>
buff_ptrs
;
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
buff_ptrs
.
push_back
(
buff
[
i
]);
memcpy
(
buff
[
0
],
&
s
->
recplay_state
->
ms_sample
->
samples
[
0
],
nsamps
*
4
);
cur_samples
++
;
// Prepare for next read
off_t
where
=
lseek
(
s
->
recplay_state
->
iqfd
,
cur_samples
*
sizeof
(
iqrec_t
),
SEEK_SET
);
samples_received
=
s
->
rx_stream
->
recv
(
buff_ptrs
,
nsamps
,
s
->
rx_md
,
1.0
);
if
(
where
<
0
)
{
}
else
{
LOG_E
(
HW
,
"Cannot lseek in iqfile: %s
\n
"
,
strerror
(
errno
));
// receive a single channel (e.g. from connector RF A)
samples_received
=
s
->
rx_stream
->
recv
(
buff
[
0
],
nsamps
,
s
->
rx_md
,
1.0
);
}
}
}
}
}
if
(
samples_received
<
nsamps
)
struct
timespec
req
;
LOG_E
(
HW
,
"[recv] received %d samples out of %d
\n
"
,
samples_received
,
nsamps
);
if
(
s
->
rx_md
.
error_code
!=
uhd
::
rx_metadata_t
::
ERROR_CODE_NONE
)
req
.
tv_sec
=
0
;
LOG_E
(
HW
,
"%s
\n
"
,
s
->
rx_md
.
to_pp_string
(
true
).
c_str
());
s
->
rx_count
+=
nsamps
;
req
.
tv_nsec
=
s
->
recplay_state
->
u_sf_read_delay
*
1000
;
s
->
rx_timestamp
=
s
->
rx_md
.
time_spec
.
to_ticks
(
s
->
sample_rate
);
*
ptimestamp
=
s
->
rx_timestamp
;
#if defined (USRP_REC_PLAY)
}
#endif
nanosleep
(
&
req
,
NULL
);
#if defined(USRP_REC_PLAY)
if
(
u_sf_mode
==
1
)
{
// record mode
return
nsamps
;
// Copy subframes to memory (later dump on a file)
if
(
nb_samples
<
u_sf_max
)
{
(
ms_sample
+
nb_samples
)
->
header
=
BELL_LABS_IQ_HEADER
;
(
ms_sample
+
nb_samples
)
->
ts
=
*
ptimestamp
;
memcpy
((
ms_sample
+
nb_samples
)
->
samples
,
buff
[
0
],
nsamps
*
4
);
nb_samples
++
;
}
}
else
if
(
u_sf_mode
==
2
)
{
// replay mode
if
(
cur_samples
==
nb_samples
)
{
cur_samples
=
0
;
wrap_count
++
;
if
(
wrap_count
==
u_sf_loops
)
{
std
::
cerr
<<
"USRP device terminating subframes replay mode after "
<<
u_sf_loops
<<
" loops."
<<
std
::
endl
;
return
0
;
// should make calling process exit
}
wrap_ts
=
wrap_count
*
(
nb_samples
*
(((
int
)(
device
->
openair0_cfg
[
0
].
sample_rate
))
/
1000
));
return
samples_received
;
}
if
(
!
use_mmap
)
{
if
(
lseek
(
iqfd
,
0
,
SEEK_SET
)
==
0
)
{
std
::
cerr
<<
"Seeking at the beginning of IQ file"
<<
std
::
endl
;
}
else
{
std
::
cerr
<<
"Problem seeking at the beginning of IQ file"
<<
std
::
endl
;
}
}
}
if
(
use_mmap
)
{
/*! \brief Receive samples from hardware.
if
(
cur_samples
<
nb_samples
)
{
* Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
*
ptimestamp
=
(
ms_sample
[
0
].
ts
+
(
cur_samples
*
(((
int
)(
device
->
openair0_cfg
[
0
].
sample_rate
))
/
1000
)))
+
wrap_ts
;
* the first channel. *ptimestamp is the time at which the first sample
* was received.
* \param device the hardware to use
* \param[out] ptimestamp the time at which the first sample was received.
* \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps.
* \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
* \param antenna_id Index of antenna for which to receive samples
* \returns the number of sample read
*/
static
int
trx_usrp_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
int
samples_received
=
0
;
int
nsamps2
;
// aligned to upper 32 or 16 byte boundary
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2
=
(
nsamps
+
7
)
>>
3
;
__m256i
buff_tmp
[
2
][
nsamps2
];
#else
nsamps2
=
(
nsamps
+
3
)
>>
2
;
__m128i
buff_tmp
[
2
][
nsamps2
];
#endif
#elif defined(__arm__)
nsamps2
=
(
nsamps
+
3
)
>>
2
;
int16x8_t
buff_tmp
[
2
][
nsamps2
];
#endif
if
(
cur_samples
==
0
)
{
if
(
device
->
type
==
USRP_B200_DEV
)
{
std
::
cerr
<<
"starting subframes file with wrap_count="
<<
wrap_count
<<
" wrap_ts="
<<
wrap_ts
if
(
cc
>
1
)
{
<<
" ts="
<<
*
ptimestamp
<<
std
::
endl
;
// receive multiple channels (e.g. RF A and RF B)
}
std
::
vector
<
void
*>
buff_ptrs
;
memcpy
(
buff
[
0
],
&
ms_sample
[
cur_samples
].
samples
[
0
],
nsamps
*
4
);
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
buff_ptrs
.
push_back
(
buff_tmp
[
i
]
);
cur_samples
++
;
}
samples_received
=
s
->
rx_stream
->
recv
(
buff_ptrs
,
nsamps
,
s
->
rx_md
);
}
else
{
}
else
{
// read sample from file
// receive a single channel (e.g. from connector RF A)
if
(
read
(
iqfd
,
ms_sample
,
sizeof
(
iqrec_t
))
!=
sizeof
(
iqrec_t
))
{
samples_received
=
0
;
std
::
cerr
<<
"pb reading iqfile at index "
<<
sizeof
(
iqrec_t
)
*
cur_samples
<<
std
::
endl
;
close
(
iqfd
);
while
(
samples_received
!=
nsamps
)
{
free
(
ms_sample
);
samples_received
+=
s
->
rx_stream
->
recv
(
buff_tmp
[
0
]
+
samples_received
,
ms_sample
=
NULL
;
nsamps
-
samples_received
,
s
->
rx_md
);
iqfd
=
0
;
exit
(
-
1
);
}
if
(
cur_samples
<
nb_samples
)
{
if
((
s
->
wait_for_first_pps
==
0
)
&&
(
s
->
rx_md
.
error_code
!=
uhd
::
rx_metadata_t
::
ERROR_CODE_NONE
))
static
int64_t
ts0
=
0
;
break
;
if
((
cur_samples
==
0
)
&&
(
wrap_count
==
0
))
{
if
((
s
->
wait_for_first_pps
==
1
)
&&
(
samples_received
!=
nsamps
))
{
ts0
=
ms_sample
->
ts
;
printf
(
"sleep...
\n
"
);
//usleep(100)
;
}
}
}
if
(
samples_received
==
nsamps
)
s
->
wait_for_first_pps
=
0
;
}
*
ptimestamp
=
ts0
+
(
cur_samples
*
(((
int
)(
device
->
openair0_cfg
[
0
].
sample_rate
))
/
1000
))
+
wrap_ts
;
// bring RX data into 12 LSBs for softmodem RX
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nsamps2
;
j
++
)
{
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
// FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
if
(
cur_samples
==
0
)
{
if
((((
uintptr_t
)
buff
[
i
])
&
0x1F
)
==
0
)
{
std
::
cerr
<<
"starting subframes file with wrap_count="
<<
wrap_count
<<
" wrap_ts="
<<
wrap_ts
((
__m256i
*
)
buff
[
i
])[
j
]
=
_mm256_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
<<
" ts="
<<
*
ptimestamp
<<
std
::
endl
;
}
else
{
((
__m128i
*
)
buff
[
i
])[
2
*
j
]
=
_mm_srai_epi16
(((
__m128i
*
)
buff_tmp
[
i
])[
2
*
j
],
4
);
((
__m128i
*
)
buff
[
i
])[
2
*
j
+
1
]
=
_mm_srai_epi16
(((
__m128i
*
)
buff_tmp
[
i
])[
2
*
j
+
1
],
4
);
}
}
memcpy
(
buff
[
0
],
&
ms_sample
->
samples
[
0
],
nsamps
*
4
);
#else
cur_samples
++
;
((
__m128i
*
)
buff
[
i
])[
j
]
=
_mm_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
// Prepare for next read
#endif
off_t
where
=
lseek
(
iqfd
,
cur_samples
*
sizeof
(
iqrec_t
),
SEEK_SET
);
#elif defined(__arm__)
((
int16x8_t
*
)
buff
[
i
])[
j
]
=
vshrq_n_s16
(
buff_tmp
[
i
][
j
],
4
);
#endif
}
}
}
}
}
else
if
(
device
->
type
==
USRP_X300_DEV
)
{
if
(
cc
>
1
)
{
// receive multiple channels (e.g. RF A and RF B)
std
::
vector
<
void
*>
buff_ptrs
;
struct
timespec
req
;
for
(
int
i
=
0
;
i
<
cc
;
i
++
)
buff_ptrs
.
push_back
(
buff
[
i
])
;
req
.
tv_sec
=
0
;
samples_received
=
s
->
rx_stream
->
recv
(
buff_ptrs
,
nsamps
,
s
->
rx_md
,
1.0
);
}
else
{
// receive a single channel (e.g. from connector RF A)
samples_received
=
s
->
rx_stream
->
recv
(
buff
[
0
],
nsamps
,
s
->
rx_md
,
1.0
);
}
}
if
(
samples_received
<
nsamps
)
LOG_E
(
HW
,
"[recv] received %d samples out of %d
\n
"
,
samples_received
,
nsamps
);
req
.
tv_nsec
=
u_sf_read_delay
*
1000
;
if
(
s
->
rx_md
.
error_code
!=
uhd
::
rx_metadata_t
::
ERROR_CODE_NONE
)
LOG_E
(
HW
,
"%s
\n
"
,
s
->
rx_md
.
to_pp_string
(
true
).
c_str
());
nanosleep
(
&
req
,
NULL
);
s
->
rx_count
+=
nsamps
;
s
->
rx_timestamp
=
s
->
rx_md
.
time_spec
.
to_ticks
(
s
->
sample_rate
);
*
ptimestamp
=
s
->
rx_timestamp
;
return
nsamps
;
if
(
s
->
recplay_mode
==
RECPLAY_RECORDMODE
)
{
// record mode
// Copy subframes to memory (later dump on a file)
if
(
s
->
recplay_state
->
nb_samples
<
s
->
recplay_state
->
u_sf_max
)
{
(
s
->
recplay_state
->
ms_sample
+
s
->
recplay_state
->
nb_samples
)
->
header
=
BELL_LABS_IQ_HEADER
;
(
s
->
recplay_state
->
ms_sample
+
s
->
recplay_state
->
nb_samples
)
->
ts
=
*
ptimestamp
;
memcpy
((
s
->
recplay_state
->
ms_sample
+
s
->
recplay_state
->
nb_samples
)
->
samples
,
buff
[
0
],
nsamps
*
4
);
s
->
recplay_state
->
nb_samples
++
;
}
else
exit_function
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
"Recording reaches max iq limit
\n
"
);
}
}
#endif
return
samples_received
;
return
samples_received
;
}
}
...
@@ -868,7 +828,6 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
...
@@ -868,7 +828,6 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
if
(
bw_gain_adjust
==
1
)
{
if
(
bw_gain_adjust
==
1
)
{
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
case
46080000
:
case
46080000
:
break
;
break
;
...
@@ -940,117 +899,37 @@ static void uhd_set_thread_priority(void) {
...
@@ -940,117 +899,37 @@ static void uhd_set_thread_priority(void) {
uhd
::
set_thread_priority_safe
(
1.0
);
uhd
::
set_thread_priority_safe
(
1.0
);
}
}
#if defined(USRP_REC_PLAY)
void
noop_func
(
void
)
{
extern
"C"
{
return
;
/*! \brief Initializer for USRP record/playback config
* \param parameter array description
* \returns 0 on success
*/
int
trx_usrp_recplay_config_init
(
paramdef_t
*
usrp_recplay_params
)
{
// --subframes-file
memcpy
(
usrp_recplay_params
[
0
].
optname
,
config_opt_sf_file
,
strlen
(
config_opt_sf_file
));
usrp_recplay_params
[
0
].
helpstr
=
config_hlp_sf_file
;
usrp_recplay_params
[
0
].
paramflags
=
PARAMFLAG_NOFREE
;
usrp_recplay_params
[
0
].
strptr
=
(
char
**
)
&
u_sf_filename
;
usrp_recplay_params
[
0
].
defstrval
=
NULL
;
usrp_recplay_params
[
0
].
type
=
TYPE_STRING
;
usrp_recplay_params
[
0
].
numelt
=
sizeof
(
u_sf_filename
);
// --subframes-record
memcpy
(
usrp_recplay_params
[
1
].
optname
,
config_opt_sf_rec
,
strlen
(
config_opt_sf_rec
));
usrp_recplay_params
[
1
].
helpstr
=
config_hlp_sf_rec
;
usrp_recplay_params
[
1
].
paramflags
=
PARAMFLAG_BOOL
;
usrp_recplay_params
[
1
].
uptr
=&
u_sf_record
;
usrp_recplay_params
[
1
].
defuintval
=
0
;
usrp_recplay_params
[
1
].
type
=
TYPE_UINT
;
usrp_recplay_params
[
1
].
numelt
=
0
;
// --subframes-replay
memcpy
(
usrp_recplay_params
[
2
].
optname
,
config_opt_sf_rep
,
strlen
(
config_opt_sf_rep
));
usrp_recplay_params
[
2
].
helpstr
=
config_hlp_sf_rep
;
usrp_recplay_params
[
2
].
paramflags
=
PARAMFLAG_BOOL
;
usrp_recplay_params
[
2
].
uptr
=&
u_sf_replay
;
usrp_recplay_params
[
2
].
defuintval
=
0
;
usrp_recplay_params
[
2
].
type
=
TYPE_UINT
;
usrp_recplay_params
[
2
].
numelt
=
0
;
// --subframes-max
memcpy
(
usrp_recplay_params
[
3
].
optname
,
config_opt_sf_max
,
strlen
(
config_opt_sf_max
));
usrp_recplay_params
[
3
].
helpstr
=
config_hlp_sf_max
;
usrp_recplay_params
[
3
].
paramflags
=
0
;
usrp_recplay_params
[
3
].
uptr
=&
u_sf_max
;
usrp_recplay_params
[
3
].
defuintval
=
DEF_NB_SF
;
usrp_recplay_params
[
3
].
type
=
TYPE_UINT
;
usrp_recplay_params
[
3
].
numelt
=
0
;
// --subframes-loops
memcpy
(
usrp_recplay_params
[
4
].
optname
,
config_opt_sf_loops
,
strlen
(
config_opt_sf_loops
));
usrp_recplay_params
[
4
].
helpstr
=
config_hlp_sf_loops
;
usrp_recplay_params
[
4
].
paramflags
=
0
;
usrp_recplay_params
[
4
].
uptr
=&
u_sf_loops
;
usrp_recplay_params
[
4
].
defuintval
=
DEF_SF_NB_LOOP
;
usrp_recplay_params
[
4
].
type
=
TYPE_UINT
;
usrp_recplay_params
[
4
].
numelt
=
0
;
// --subframes-read-delay
memcpy
(
usrp_recplay_params
[
5
].
optname
,
config_opt_sf_rdelay
,
strlen
(
config_opt_sf_rdelay
));
usrp_recplay_params
[
5
].
helpstr
=
config_hlp_sf_rdelay
;
usrp_recplay_params
[
5
].
paramflags
=
0
;
usrp_recplay_params
[
5
].
uptr
=&
u_sf_read_delay
;
usrp_recplay_params
[
5
].
defuintval
=
DEF_SF_DELAY_READ
;
usrp_recplay_params
[
5
].
type
=
TYPE_UINT
;
usrp_recplay_params
[
5
].
numelt
=
0
;
// --subframes-write-delay
memcpy
(
usrp_recplay_params
[
6
].
optname
,
config_opt_sf_wdelay
,
strlen
(
config_opt_sf_wdelay
));
usrp_recplay_params
[
6
].
helpstr
=
config_hlp_sf_wdelay
;
usrp_recplay_params
[
6
].
paramflags
=
0
;
usrp_recplay_params
[
6
].
uptr
=&
u_sf_write_delay
;
usrp_recplay_params
[
6
].
defuintval
=
DEF_SF_DELAY_WRITE
;
usrp_recplay_params
[
6
].
type
=
TYPE_UINT
;
usrp_recplay_params
[
6
].
numelt
=
0
;
return
0
;
// always ok
}
}
}
#endif
extern
"C"
{
extern
"C"
{
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
#if defined(USRP_REC_PLAY)
LOG_D
(
HW
,
"openair0_cfg[0].sdr_addrs == '%s'
\n
"
,
openair0_cfg
[
0
].
sdr_addrs
);
paramdef_t
usrp_recplay_params
[
7
];
LOG_D
(
HW
,
"openair0_cfg[0].clock_source == '%d'
\n
"
,
openair0_cfg
[
0
].
clock_source
);
struct
sysinfo
systeminfo
;
usrp_state_t
*
s
;
// to check
static
int
done
=
0
;
if
(
device
->
priv
==
NULL
)
{
s
=
(
usrp_state_t
*
)
calloc
(
sizeof
(
usrp_state_t
),
1
);
if
(
done
==
1
)
{
device
->
priv
=
s
;
AssertFatal
(
s
!=
NULL
,
"USRP device: memory allocation failure
\n
"
);
}
else
{
LOG_E
(
HW
,
"multiple device init detected
\n
"
);
return
0
;
return
0
;
}
// prevent from multiple init
done
=
1
;
// end to check
// Use mmap for IQ files for systems with less than 6GB total RAM
sysinfo
(
&
systeminfo
);
if
(
systeminfo
.
totalram
<
6144000000
)
{
use_mmap
=
0
;
}
memset
(
usrp_recplay_params
,
0
,
7
*
sizeof
(
paramdef_t
));
memset
(
&
u_sf_filename
[
0
],
0
,
1024
);
if
(
trx_usrp_recplay_config_init
(
usrp_recplay_params
)
!=
0
)
{
std
::
cerr
<<
"USRP device record/replay mode configuration error exiting"
<<
std
::
endl
;
return
-
1
;
}
config_process_cmdline
(
usrp_recplay_params
,
sizeof
(
usrp_recplay_params
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
strlen
(
u_sf_filename
)
==
0
)
{
(
void
)
strcpy
(
u_sf_filename
,
DEF_SF_FILE
);
}
}
if
(
u_sf_replay
==
1
)
u_sf_mode
=
2
;
device
->
openair0_cfg
=
openair0_cfg
;
read_usrpconfig
(
&
(
s
->
recplay_mode
),
&
(
s
->
recplay_state
));
if
(
u_sf_record
==
1
)
u_sf_mode
=
1
;
device
->
trx_start_func
=
trx_usrp_start
;
device
->
trx_get_stats_func
=
trx_usrp_get_stats
;
if
(
u_sf_mode
==
2
)
{
device
->
trx_reset_stats_func
=
trx_usrp_reset_stats
;
device
->
trx_end_func
=
trx_usrp_end
;
device
->
trx_stop_func
=
trx_usrp_stop
;
device
->
trx_set_freq_func
=
trx_usrp_set_freq
;
device
->
trx_set_gains_func
=
trx_usrp_set_gains
;
if
(
s
->
recplay_mode
==
RECPLAY_REPLAYMODE
)
{
// Replay subframes from from file
// Replay subframes from from file
int
bw_gain_adjust
=
0
;
int
bw_gain_adjust
=
0
;
device
->
openair0_cfg
=
openair0_cfg
;
device
->
type
=
USRP_B200_DEV
;
device
->
type
=
USRP_B200_DEV
;
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_b210_38
;
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_b210_38
;
bw_gain_adjust
=
1
;
bw_gain_adjust
=
1
;
...
@@ -1060,45 +939,30 @@ extern "C" {
...
@@ -1060,45 +939,30 @@ extern "C" {
openair0_cfg
[
0
].
iq_txshift
=
4
;
//shift
openair0_cfg
[
0
].
iq_txshift
=
4
;
//shift
openair0_cfg
[
0
].
iq_rxrescale
=
15
;
//rescale iqs
openair0_cfg
[
0
].
iq_rxrescale
=
15
;
//rescale iqs
set_rx_gain_offset
(
&
openair0_cfg
[
0
],
0
,
bw_gain_adjust
);
set_rx_gain_offset
(
&
openair0_cfg
[
0
],
0
,
bw_gain_adjust
);
device
->
priv
=
NULL
;
device
->
trx_write_func
=
trx_usrp_write_recplay
;
device
->
trx_start_func
=
trx_usrp_start
;
device
->
trx_read_func
=
trx_usrp_read_recplay
;
device
->
trx_write_func
=
trx_usrp_write
;
device
->
uhd_set_thread_priority
=
noop_func
;
device
->
trx_read_func
=
trx_usrp_read
;
std
::
cerr
<<
"USRP device initialized in subframes replay mode for "
<<
s
->
recplay_state
->
u_sf_loops
<<
" loops. Use mmap="
device
->
trx_get_stats_func
=
trx_usrp_get_stats
;
<<
s
->
recplay_state
->
use_mmap
<<
std
::
endl
;
device
->
trx_reset_stats_func
=
trx_usrp_reset_stats
;
device
->
trx_end_func
=
trx_usrp_end
;
device
->
trx_stop_func
=
trx_usrp_stop
;
device
->
trx_set_freq_func
=
trx_usrp_set_freq
;
device
->
trx_set_gains_func
=
trx_usrp_set_gains
;
device
->
openair0_cfg
=
openair0_cfg
;
device
->
uhd_set_thread_priority
=
uhd_set_thread_priority
;
std
::
cerr
<<
"USRP device initialized in subframes replay mode for "
<<
u_sf_loops
<<
" loops. Use mmap="
<<
use_mmap
<<
std
::
endl
;
}
else
{
}
else
{
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
calloc
(
sizeof
(
usrp_state_t
),
1
);
// Initialize USRP device
// Initialize USRP device
device
->
openair0_cfg
=
openair0_cfg
;
int
vers
=
0
,
subvers
=
0
,
subsubvers
=
0
;
int
vers
=
0
,
subvers
=
0
,
subsubvers
=
0
;
int
bw_gain_adjust
=
0
;
int
bw_gain_adjust
=
0
;
#if defined(USRP_REC_PLAY)
if
(
u_sf_mode
==
1
)
{
if
(
s
->
recplay_mode
==
RECPLAY_RECORDMODE
)
{
std
::
cerr
<<
"USRP device initialized in subframes record mode"
<<
std
::
endl
;
std
::
cerr
<<
"USRP device initialized in subframes record mode"
<<
std
::
endl
;
}
}
#endif
sscanf
(
uhd
::
get_version_string
().
c_str
(),
"%d.%d.%d"
,
&
vers
,
&
subvers
,
&
subsubvers
);
sscanf
(
uhd
::
get_version_string
().
c_str
(),
"%d.%d.%d"
,
&
vers
,
&
subvers
,
&
subsubvers
);
LOG_I
(
HW
,
"UHD version %s (%d.%d.%d)
\n
"
,
LOG_I
(
HW
,
"UHD version %s (%d.%d.%d)
\n
"
,
uhd
::
get_version_string
().
c_str
(),
vers
,
subvers
,
subsubvers
);
uhd
::
get_version_string
().
c_str
(),
vers
,
subvers
,
subsubvers
);
std
::
string
args
;
std
::
string
args
;
if
(
openair0_cfg
[
0
].
sdr_addrs
==
NULL
)
{
if
(
openair0_cfg
[
0
].
sdr_addrs
==
NULL
)
{
args
=
"type=b200"
;
args
=
"type=b200"
;
}
else
{
}
else
{
args
=
openair0_cfg
[
0
].
sdr_addrs
;
args
=
openair0_cfg
[
0
].
sdr_addrs
;
LOG_I
(
HW
,
"Checking for USRP with args %s
\n
"
,
openair0_cfg
[
0
].
sdr_addrs
);
LOG_I
(
HW
,
"Checking for USRP with args %s
\n
"
,
openair0_cfg
[
0
].
sdr_addrs
);
}
}
uhd
::
device_addrs_t
device_adds
=
uhd
::
device
::
find
(
args
);
uhd
::
device_addrs_t
device_adds
=
uhd
::
device
::
find
(
args
);
...
@@ -1109,8 +973,8 @@ extern "C" {
...
@@ -1109,8 +973,8 @@ extern "C" {
return
-
1
;
return
-
1
;
}
else
if
(
device_adds
.
size
()
>
1
)
{
}
else
if
(
device_adds
.
size
()
>
1
)
{
LOG_E
(
HW
,
"More than one USRP Device Found. Please specify device more precisely in config file.
\n
"
);
LOG_E
(
HW
,
"More than one USRP Device Found. Please specify device more precisely in config file.
\n
"
);
free
(
s
);
free
(
s
);
return
-
1
;
return
-
1
;
}
}
LOG_I
(
HW
,
"Found USRP %s
\n
"
,
device_adds
[
0
].
get
(
"type"
).
c_str
());
LOG_I
(
HW
,
"Found USRP %s
\n
"
,
device_adds
[
0
].
get
(
"type"
).
c_str
());
...
@@ -1123,6 +987,7 @@ extern "C" {
...
@@ -1123,6 +987,7 @@ extern "C" {
args
+=
boost
::
str
(
boost
::
format
(
",master_clock_rate=%f"
)
%
usrp_master_clock
);
args
+=
boost
::
str
(
boost
::
format
(
",master_clock_rate=%f"
)
%
usrp_master_clock
);
args
+=
",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680"
;
args
+=
",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680"
;
}
}
if
(
device_adds
[
0
].
get
(
"type"
)
==
"n3xx"
)
{
if
(
device_adds
[
0
].
get
(
"type"
)
==
"n3xx"
)
{
printf
(
"Found USRP n300
\n
"
);
printf
(
"Found USRP n300
\n
"
);
device
->
type
=
USRP_X300_DEV
;
//treat it as X300 for now
device
->
type
=
USRP_X300_DEV
;
//treat it as X300 for now
...
@@ -1136,60 +1001,64 @@ extern "C" {
...
@@ -1136,60 +1001,64 @@ extern "C" {
device
->
type
=
USRP_X300_DEV
;
device
->
type
=
USRP_X300_DEV
;
usrp_master_clock
=
184.32e6
;
usrp_master_clock
=
184.32e6
;
args
+=
boost
::
str
(
boost
::
format
(
",master_clock_rate=%f"
)
%
usrp_master_clock
);
args
+=
boost
::
str
(
boost
::
format
(
",master_clock_rate=%f"
)
%
usrp_master_clock
);
// USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
// USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
if
(
0
!=
system
(
"sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432"
)
)
if
(
0
!=
system
(
"sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432"
)
)
LOG_W
(
HW
,
"Can't set kernel parameters for X3xx
\n
"
);
LOG_W
(
HW
,
"Can't set kernel parameters for X3xx
\n
"
);
}
}
s
->
usrp
=
uhd
::
usrp
::
multi_usrp
::
make
(
args
);
s
->
usrp
=
uhd
::
usrp
::
multi_usrp
::
make
(
args
);
device
->
priv
=
s
;
if
(
args
.
find
(
"clock_source"
)
==
std
::
string
::
npos
)
{
if
(
args
.
find
(
"clock_source"
)
==
std
::
string
::
npos
)
{
LOG_I
(
HW
,
"Using clock_source == '%d'
\n
"
,
openair0_cfg
[
0
].
clock_source
);
if
(
openair0_cfg
[
0
].
clock_source
==
internal
)
{
if
(
openair0_cfg
[
0
].
clock_source
==
internal
)
{
//in UHD 3.14 we could use
//in UHD 3.14 we could use
//s->usrp->set_sync_source("clock_source=internal","time_source=internal");
//s->usrp->set_sync_source("clock_source=internal","time_source=internal");
s
->
usrp
->
set_time_source
(
"internal"
);
s
->
usrp
->
set_time_source
(
"internal"
);
s
->
usrp
->
set_clock_source
(
"internal"
);
s
->
usrp
->
set_clock_source
(
"internal"
);
LOG_D
(
HW
,
"Setting time and clock source to internal
\n
"
);
}
}
else
if
(
openair0_cfg
[
0
].
clock_source
==
external
)
{
else
if
(
openair0_cfg
[
0
].
clock_source
==
external
)
{
//s->usrp->set_sync_source("clock_source=external","time_source=external");
//s->usrp->set_sync_source("clock_source=external","time_source=external");
s
->
usrp
->
set_time_source
(
"external"
);
s
->
usrp
->
set_time_source
(
"external"
);
s
->
usrp
->
set_clock_source
(
"external"
);
s
->
usrp
->
set_clock_source
(
"external"
);
LOG_D
(
HW
,
"Setting time and clock source to external
\n
"
);
}
}
else
if
(
openair0_cfg
[
0
].
clock_source
==
gpsdo
)
{
else
if
(
openair0_cfg
[
0
].
clock_source
==
gpsdo
)
{
s
->
usrp
->
set_clock_source
(
"gpsdo"
);
s
->
usrp
->
set_clock_source
(
"gpsdo"
);
s
->
usrp
->
set_time_source
(
"gpsdo"
);
s
->
usrp
->
set_time_source
(
"gpsdo"
);
LOG_D
(
HW
,
"Setting time and clock source to gpsdo
\n
"
);
}
else
{
LOG_W
(
HW
,
"Clock source set neither in usrp_args nor on command line, using default!
\n
"
);
}
}
}
else
{
LOG_W
(
HW
,
"clock_source already specified in device arguments! Ignoring command line parameter
\n
"
);
}
}
else
{
if
(
openair0_cfg
[
0
].
clock_source
!=
unset
)
{
LOG_W
(
HW
,
"Clock source set in both usrp_args and in clock_source, ingnoring the latter!
\n
"
);
}
}
if
(
s
->
usrp
->
get_clock_source
(
0
)
==
"gpsdo"
)
{
if
(
s
->
usrp
->
get_clock_source
(
0
)
==
"gpsdo"
)
{
s
->
use_gps
=
1
;
s
->
use_gps
=
1
;
if
(
sync_to_gps
(
device
)
==
EXIT_SUCCESS
)
{
if
(
sync_to_gps
(
device
)
==
EXIT_SUCCESS
)
{
LOG_I
(
HW
,
"USRP synced with GPS!
\n
"
);
LOG_I
(
HW
,
"USRP synced with GPS!
\n
"
);
}
}
else
{
else
{
LOG_I
(
HW
,
"USRP fails to sync with GPS. Exiting.
\n
"
);
LOG_I
(
HW
,
"USRP fails to sync with GPS. Exiting.
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
else
if
(
s
->
usrp
->
get_clock_source
(
0
)
==
"external"
)
{
}
else
if
(
s
->
usrp
->
get_clock_source
(
0
)
==
"external"
)
{
if
(
check_ref_locked
(
s
,
0
))
{
if
(
check_ref_locked
(
s
,
0
))
{
LOG_I
(
HW
,
"USRP locked to external reference!
\n
"
);
LOG_I
(
HW
,
"USRP locked to external reference!
\n
"
);
}
else
{
}
else
{
LOG_I
(
HW
,
"Failed to lock to external reference. Exiting.
\n
"
);
LOG_I
(
HW
,
"Failed to lock to external reference. Exiting.
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
if
(
device
->
type
==
USRP_X300_DEV
)
{
if
(
device
->
type
==
USRP_X300_DEV
)
{
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_x310
;
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_x310
;
#if defined(USRP_REC_PLAY)
std
::
cerr
<<
"-- Using calibration table: calib_table_x310"
<<
std
::
endl
;
// Bell Labs info
std
::
cerr
<<
"-- Using calibration table: calib_table_x310"
<<
std
::
endl
;
// Bell Labs info
#endif
LOG_I
(
HW
,
"%s() sample_rate:%u
\n
"
,
__FUNCTION__
,
(
int
)
openair0_cfg
[
0
].
sample_rate
);
LOG_I
(
HW
,
"%s() sample_rate:%u
\n
"
,
__FUNCTION__
,
(
int
)
openair0_cfg
[
0
].
sample_rate
);
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
...
@@ -1208,7 +1077,7 @@ extern "C" {
...
@@ -1208,7 +1077,7 @@ extern "C" {
openair0_cfg
[
0
].
tx_bw
=
80e6
;
openair0_cfg
[
0
].
tx_bw
=
80e6
;
openair0_cfg
[
0
].
rx_bw
=
80e6
;
openair0_cfg
[
0
].
rx_bw
=
80e6
;
break
;
break
;
case
61440000
:
case
61440000
:
// from usrp_time_offset
// from usrp_time_offset
//openair0_cfg[0].samples_per_packet = 2048;
//openair0_cfg[0].samples_per_packet = 2048;
...
@@ -1264,19 +1133,15 @@ extern "C" {
...
@@ -1264,19 +1133,15 @@ extern "C" {
if
((
vers
==
3
)
&&
(
subvers
==
9
)
&&
(
subsubvers
>=
2
))
{
if
((
vers
==
3
)
&&
(
subvers
==
9
)
&&
(
subsubvers
>=
2
))
{
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_b210
;
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_b210
;
bw_gain_adjust
=
0
;
bw_gain_adjust
=
0
;
#if defined(USRP_REC_PLAY)
std
::
cerr
<<
"-- Using calibration table: calib_table_b210"
<<
std
::
endl
;
// Bell Labs info
std
::
cerr
<<
"-- Using calibration table: calib_table_b210"
<<
std
::
endl
;
// Bell Labs info
#endif
}
else
{
}
else
{
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_b210_38
;
openair0_cfg
[
0
].
rx_gain_calib_table
=
calib_table_b210_38
;
bw_gain_adjust
=
1
;
bw_gain_adjust
=
1
;
#if defined(USRP_REC_PLAY)
std
::
cerr
<<
"-- Using calibration table: calib_table_b210_38"
<<
std
::
endl
;
// Bell Labs info
std
::
cerr
<<
"-- Using calibration table: calib_table_b210_38"
<<
std
::
endl
;
// Bell Labs info
#endif
}
}
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
case
46080000
:
case
46080000
:
s
->
usrp
->
set_master_clock_rate
(
46.08e6
);
s
->
usrp
->
set_master_clock_rate
(
46.08e6
);
//openair0_cfg[0].samples_per_packet = 1024;
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg
[
0
].
tx_sample_advance
=
115
;
openair0_cfg
[
0
].
tx_sample_advance
=
115
;
...
@@ -1284,7 +1149,7 @@ extern "C" {
...
@@ -1284,7 +1149,7 @@ extern "C" {
openair0_cfg
[
0
].
rx_bw
=
40e6
;
openair0_cfg
[
0
].
rx_bw
=
40e6
;
break
;
break
;
case
30720000
:
case
30720000
:
s
->
usrp
->
set_master_clock_rate
(
30.72e6
);
s
->
usrp
->
set_master_clock_rate
(
30.72e6
);
//openair0_cfg[0].samples_per_packet = 1024;
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg
[
0
].
tx_sample_advance
=
115
;
openair0_cfg
[
0
].
tx_sample_advance
=
115
;
...
@@ -1373,7 +1238,6 @@ extern "C" {
...
@@ -1373,7 +1238,6 @@ extern "C" {
// display USRP settings
// display USRP settings
LOG_I
(
HW
,
"Actual master clock: %fMHz...
\n
"
,
s
->
usrp
->
get_master_clock_rate
()
/
1e6
);
LOG_I
(
HW
,
"Actual master clock: %fMHz...
\n
"
,
s
->
usrp
->
get_master_clock_rate
()
/
1e6
);
sleep
(
1
);
sleep
(
1
);
// create tx & rx streamer
// create tx & rx streamer
uhd
::
stream_args_t
stream_args_rx
(
"sc16"
,
"sc16"
);
uhd
::
stream_args_t
stream_args_rx
(
"sc16"
,
"sc16"
);
int
samples
=
openair0_cfg
[
0
].
sample_rate
;
int
samples
=
openair0_cfg
[
0
].
sample_rate
;
...
@@ -1422,21 +1286,12 @@ extern "C" {
...
@@ -1422,21 +1286,12 @@ extern "C" {
LOG_I
(
HW
,
" Actual TX gain: %f...
\n
"
,
s
->
usrp
->
get_tx_gain
(
i
));
LOG_I
(
HW
,
" Actual TX gain: %f...
\n
"
,
s
->
usrp
->
get_tx_gain
(
i
));
LOG_I
(
HW
,
" Actual TX bandwidth: %fM...
\n
"
,
s
->
usrp
->
get_tx_bandwidth
(
i
)
/
1e6
);
LOG_I
(
HW
,
" Actual TX bandwidth: %fM...
\n
"
,
s
->
usrp
->
get_tx_bandwidth
(
i
)
/
1e6
);
LOG_I
(
HW
,
" Actual TX antenna: %s...
\n
"
,
s
->
usrp
->
get_tx_antenna
(
i
).
c_str
());
LOG_I
(
HW
,
" Actual TX antenna: %s...
\n
"
,
s
->
usrp
->
get_tx_antenna
(
i
).
c_str
());
LOG_I
(
HW
,
" Actual TX packet size: %lu
\n
"
,
s
->
tx_stream
->
get_max_num_samps
());
LOG_I
(
HW
,
" Actual TX packet size: %lu
\n
"
,
s
->
tx_stream
->
get_max_num_samps
());
}
}
LOG_I
(
HW
,
"Device timestamp: %f...
\n
"
,
s
->
usrp
->
get_time_now
().
get_real_secs
());
LOG_I
(
HW
,
"Device timestamp: %f...
\n
"
,
s
->
usrp
->
get_time_now
().
get_real_secs
());
device
->
priv
=
s
;
device
->
trx_start_func
=
trx_usrp_start
;
device
->
trx_write_func
=
trx_usrp_write
;
device
->
trx_write_func
=
trx_usrp_write
;
device
->
trx_read_func
=
trx_usrp_read
;
device
->
trx_read_func
=
trx_usrp_read
;
device
->
trx_get_stats_func
=
trx_usrp_get_stats
;
device
->
trx_reset_stats_func
=
trx_usrp_reset_stats
;
device
->
trx_end_func
=
trx_usrp_end
;
device
->
trx_stop_func
=
trx_usrp_stop
;
device
->
trx_set_freq_func
=
trx_usrp_set_freq
;
device
->
trx_set_gains_func
=
trx_usrp_set_gains
;
device
->
openair0_cfg
=
openair0_cfg
;
device
->
uhd_set_thread_priority
=
uhd_set_thread_priority
;
device
->
uhd_set_thread_priority
=
uhd_set_thread_priority
;
s
->
sample_rate
=
openair0_cfg
[
0
].
sample_rate
;
s
->
sample_rate
=
openair0_cfg
[
0
].
sample_rate
;
...
@@ -1450,87 +1305,82 @@ extern "C" {
...
@@ -1450,87 +1305,82 @@ extern "C" {
if
(
is_equal
(
s
->
sample_rate
,
(
double
)
7.68e6
))
if
(
is_equal
(
s
->
sample_rate
,
(
double
)
7.68e6
))
s
->
tx_forward_nsamps
=
50
;
s
->
tx_forward_nsamps
=
50
;
#if defined(USRP_REC_PLAY)
}
}
#endif
if
(
s
->
recplay_mode
==
RECPLAY_RECORDMODE
)
{
// record mode
#if defined(USRP_REC_PLAY)
s
->
recplay_state
->
ms_sample
=
(
iqrec_t
*
)
malloc
(
s
->
recplay_state
->
u_sf_max
*
sizeof
(
iqrec_t
));
if
(
u_sf_mode
==
1
)
{
// record mode
ms_sample
=
(
iqrec_t
*
)
malloc
(
u_sf_max
*
sizeof
(
iqrec_t
));
if
(
ms_sample
==
NULL
)
{
if
(
s
->
recplay_state
->
ms_sample
==
NULL
)
{
std
::
cerr
<<
"Memory allocation failed for subframe record or replay mode."
<<
std
::
endl
;
std
::
cerr
<<
"Memory allocation failed for subframe record or replay mode."
<<
std
::
endl
;
exit
(
-
1
);
exit
(
-
1
);
}
}
memset
(
ms_sample
,
0
,
u_sf_max
*
BELL_LABS_IQ_BYTES_PER_SF
);
memset
(
s
->
recplay_state
->
ms_sample
,
0
,
s
->
recplay_state
->
u_sf_max
*
BELL_LABS_IQ_BYTES_PER_SF
);
}
}
else
if
(
s
->
recplay_mode
==
RECPLAY_REPLAYMODE
)
{
if
(
s
->
recplay_state
->
use_mmap
)
{
if
(
u_sf_mode
==
2
)
{
if
(
use_mmap
)
{
// use mmap
// use mmap
mmapfd
=
open
(
u_sf_filename
,
O_RDONLY
|
O_LARGEFILE
);
s
->
recplay_state
->
mmapfd
=
open
(
s
->
recplay_state
->
u_sf_filename
,
O_RDONLY
|
O_LARGEFILE
);
if
(
mmapfd
!=
0
)
{
if
(
s
->
recplay_state
->
mmapfd
!=
0
)
{
fstat
(
mmapfd
,
&
sb
);
struct
stat
sb
;
std
::
cerr
<<
"Loading subframes using mmap() from "
<<
u_sf_filename
<<
" size="
<<
(
uint64_t
)
sb
.
st_size
<<
" bytes ..."
<<
std
::
endl
;
fstat
(
s
->
recplay_state
->
mmapfd
,
&
sb
);
ms_sample
=
(
iqrec_t
*
)
mmap
(
NULL
,
sb
.
st_size
,
PROT_WRITE
,
MAP_PRIVATE
,
mmapfd
,
0
);
s
->
recplay_state
->
mapsize
=
sb
.
st_size
;
std
::
cerr
<<
"Loading subframes using mmap() from "
<<
s
->
recplay_state
->
u_sf_filename
<<
" size="
<<
(
uint64_t
)
sb
.
st_size
<<
" bytes ..."
<<
std
::
endl
;
s
->
recplay_state
->
ms_sample
=
(
iqrec_t
*
)
mmap
(
NULL
,
sb
.
st_size
,
PROT_WRITE
,
MAP_PRIVATE
,
s
->
recplay_state
->
mmapfd
,
0
);
if
(
ms_sample
!=
MAP_FAILED
)
{
if
(
s
->
recplay_state
->
ms_sample
!=
MAP_FAILED
)
{
nb_samples
=
(
sb
.
st_size
/
sizeof
(
iqrec_t
));
s
->
recplay_state
->
nb_samples
=
(
sb
.
st_size
/
sizeof
(
iqrec_t
));
int
aligned
=
(((
unsigned
long
)
ms_sample
&
31
)
==
0
)
?
1
:
0
;
int
aligned
=
(((
unsigned
long
)
s
->
recplay_state
->
ms_sample
&
31
)
==
0
)
?
1
:
0
;
std
::
cerr
<<
"Loaded "
<<
nb_samples
<<
" subframes."
<<
std
::
endl
;
std
::
cerr
<<
"Loaded "
<<
s
->
recplay_state
->
nb_samples
<<
" subframes."
<<
std
::
endl
;
if
(
aligned
==
0
)
{
if
(
aligned
==
0
)
{
std
::
cerr
<<
"mmap address is not 32 bytes aligned, exiting."
<<
std
::
endl
;
std
::
cerr
<<
"mmap address is not 32 bytes aligned, exiting."
<<
std
::
endl
;
close
(
mmapfd
);
close
(
s
->
recplay_state
->
mmapfd
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
else
{
}
else
{
std
::
cerr
<<
"Cannot mmap file, exiting."
<<
std
::
endl
;
std
::
cerr
<<
"Cannot mmap file, exiting."
<<
std
::
endl
;
close
(
mmapfd
);
close
(
s
->
recplay_state
->
mmapfd
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
else
{
}
else
{
std
::
cerr
<<
"Cannot open "
<<
u_sf_filename
<<
" , exiting."
<<
std
::
endl
;
std
::
cerr
<<
"Cannot open "
<<
s
->
recplay_state
->
u_sf_filename
<<
" , exiting."
<<
std
::
endl
;
exit
(
-
1
);
exit
(
-
1
);
}
}
}
else
{
}
else
{
iqfd
=
open
(
u_sf_filename
,
O_RDONLY
|
O_LARGEFILE
);
s
->
recplay_state
->
iqfd
=
open
(
s
->
recplay_state
->
u_sf_filename
,
O_RDONLY
|
O_LARGEFILE
);
if
(
iqfd
!=
0
)
{
if
(
s
->
recplay_state
->
iqfd
!=
0
)
{
fstat
(
iqfd
,
&
sb
);
struct
stat
sb
;
nb_samples
=
(
sb
.
st_size
/
sizeof
(
iqrec_t
));
fstat
(
s
->
recplay_state
->
iqfd
,
&
sb
);
std
::
cerr
<<
"Loading "
<<
nb_samples
<<
" subframes from "
<<
u_sf_filename
s
->
recplay_state
->
mapsize
=
sb
.
st_size
;
s
->
recplay_state
->
nb_samples
=
(
sb
.
st_size
/
sizeof
(
iqrec_t
));
std
::
cerr
<<
"Loading "
<<
s
->
recplay_state
->
nb_samples
<<
" subframes from "
<<
s
->
recplay_state
->
u_sf_filename
<<
" size="
<<
(
uint64_t
)
sb
.
st_size
<<
" bytes ..."
<<
std
::
endl
;
<<
" size="
<<
(
uint64_t
)
sb
.
st_size
<<
" bytes ..."
<<
std
::
endl
;
// allocate buffer for 1 sample at a time
// allocate buffer for 1 sample at a time
ms_sample
=
(
iqrec_t
*
)
malloc
(
sizeof
(
iqrec_t
));
s
->
recplay_state
->
ms_sample
=
(
iqrec_t
*
)
malloc
(
sizeof
(
iqrec_t
));
if
(
ms_sample
==
NULL
)
{
if
(
s
->
recplay_state
->
ms_sample
==
NULL
)
{
std
::
cerr
<<
"Memory allocation failed for individual subframe replay mode."
<<
std
::
endl
;
std
::
cerr
<<
"Memory allocation failed for individual subframe replay mode."
<<
std
::
endl
;
close
(
iqfd
);
close
(
s
->
recplay_state
->
iqfd
);
exit
(
-
1
);
exit
(
-
1
);
}
}
memset
(
ms_sample
,
0
,
sizeof
(
iqrec_t
));
memset
(
s
->
recplay_state
->
ms_sample
,
0
,
sizeof
(
iqrec_t
));
// point at beginning of file
// point at beginning of file
if
(
lseek
(
iqfd
,
0
,
SEEK_SET
)
==
0
)
{
if
(
lseek
(
s
->
recplay_state
->
iqfd
,
0
,
SEEK_SET
)
==
0
)
{
std
::
cerr
<<
"Initial seek at beginning of the file"
<<
std
::
endl
;
std
::
cerr
<<
"Initial seek at beginning of the file"
<<
std
::
endl
;
}
else
{
}
else
{
std
::
cerr
<<
"Problem initial seek at beginning of the file"
<<
std
::
endl
;
std
::
cerr
<<
"Problem initial seek at beginning of the file"
<<
std
::
endl
;
}
}
}
else
{
}
else
{
std
::
cerr
<<
"Cannot open "
<<
u_sf_filename
<<
" , exiting."
<<
std
::
endl
;
std
::
cerr
<<
"Cannot open "
<<
s
->
recplay_state
->
u_sf_filename
<<
" , exiting."
<<
std
::
endl
;
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
}
}
#endif
return
0
;
return
0
;
}
}
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
View file @
64a0dac2
...
@@ -26,8 +26,6 @@
...
@@ -26,8 +26,6 @@
* \author: bruno.mongazon-cazavet@nokia-bell-labs.com
* \author: bruno.mongazon-cazavet@nokia-bell-labs.com
*/
*/
#if defined (USRP_REC_PLAY)
#include <sys/mman.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
...
@@ -35,6 +33,29 @@
...
@@ -35,6 +33,29 @@
#include "common/config/config_paramdesc.h"
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
#include "common/config/config_userapi.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define CONFIG_OPT_RECPLAY "enable_recplay"
#define CONFIG_HLP_RECPLAY "Allow record player"
#define USRP_SECTION "device.usrp"
/* inclusion for device configuration */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for USRP record/playback */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define USRP_DEVICE_PARAMS_DESC { \
{CONFIG_OPT_RECPLAY, CONFIG_HLP_RECPLAY, PARAMFLAG_BOOL, uptr:&enable_recplay, defuintval:0, TYPE_UINT, 0} \
}
/* inclusions for record player */
#define RECPLAY_DISABLED 0
#define RECPLAY_RECORDMODE 1
#define RECPLAY_REPLAYMODE 2
#define BELL_LABS_IQ_HEADER 0xabababababababab
#define BELL_LABS_IQ_HEADER 0xabababababababab
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
...
@@ -46,13 +67,13 @@ typedef struct {
...
@@ -46,13 +67,13 @@ typedef struct {
unsigned
char
samples
[
BELL_LABS_IQ_BYTES_PER_SF
];
// iq's for one subframe
unsigned
char
samples
[
BELL_LABS_IQ_BYTES_PER_SF
];
// iq's for one subframe
}
iqrec_t
;
}
iqrec_t
;
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
#define DEF_SF_FILE "/
home/nokia/iqfile"
// default subframes file name
#define DEF_SF_FILE "/
tmp/iqfile"
// default subframes file name
#define DEF_SF_DELAY_READ 700 // default read delay µs (860=real)
#define DEF_SF_DELAY_READ 700 // default read delay µs (860=real)
#define DEF_SF_DELAY_WRITE 15 // default write delay µs (15=real)
#define DEF_SF_DELAY_WRITE 15 // default write delay µs (15=real)
#define DEF_SF_NB_LOOP 5 // default nb loops
#define DEF_SF_NB_LOOP 5 // default nb loops
/* help strings definition for co
mmand line
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
/* help strings definition for co
nfig
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_HLP_SF_FILE "Path of the file used for subframes record or replay"
#define CONFIG_HLP_SF_FILE "Path of the file used for subframes record or replay"
#define CONFIG_HLP_SF_REC "Record subframes from USRP driver into a file for later replay"
#define CONFIG_HLP_SF_REC "Record subframes from USRP driver into a file for later replay"
#define CONFIG_HLP_SF_REP "Replay subframes into USRP driver from a file"
#define CONFIG_HLP_SF_REP "Replay subframes into USRP driver from a file"
...
@@ -61,7 +82,7 @@ typedef struct {
...
@@ -61,7 +82,7 @@ typedef struct {
#define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode"
#define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode"
#define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode"
#define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode"
/* keyword strings for co
mmand line
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
/* keyword strings for co
nfig
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_OPT_SF_FILE "subframes-file"
#define CONFIG_OPT_SF_FILE "subframes-file"
#define CONFIG_OPT_SF_REC "subframes-record"
#define CONFIG_OPT_SF_REC "subframes-record"
#define CONFIG_OPT_SF_REP "subframes-replay"
#define CONFIG_OPT_SF_REP "subframes-replay"
...
@@ -70,20 +91,41 @@ typedef struct {
...
@@ -70,20 +91,41 @@ typedef struct {
#define CONFIG_OPT_SF_RDELAY "subframes-read-delay"
#define CONFIG_OPT_SF_RDELAY "subframes-read-delay"
#define CONFIG_OPT_SF_WDELAY "subframes-write-delay"
#define CONFIG_OPT_SF_WDELAY "subframes-write-delay"
#define USRP_RECPLAY_SECTION "device.recplay"
/* For information only - the macro is not usable in C++ */
/* For information only - the macro is not usable in C++ */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for USRP record/playback */
/* command line parameters for USRP record/playback */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define USRP_RECPLAY_PARAMS_DESC { \
#define USRP_RECPLAY_PARAMS_DESC { \
{"subframes-file", CONFIG_HLP_SF_FILE, 0, strptr:(char **)&u_sf_filename, defstrval:DEF_SF_FILE, TYPE_STRING, sizeof(u_sf_filename)}, \
{CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:(char **)((*recplay_state)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 1024}, \
{"subframes-record", CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&u_sf_record, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \
{"subframes-replay", CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&u_sf_replay, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \
{"subframes-max", CONFIG_HLP_SF_MAX, 0, uptr:&u_sf_max, defintval:DEF_NB_SF, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_state)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \
{"subframes-loops", CONFIG_HLP_SF_LOOPS, 0, uptr:&u_sf_loops, defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_LOOPS, CONFIG_HLP_SF_LOOPS, 0, uptr:&((*recplay_state)->u_sf_loops), defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \
{"subframes-read-delay", CONFIG_HLP_SF_RDELAY, 0, uptr:&u_sf_read_delay, defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, uptr:&((*recplay_state)->u_sf_read_delay), defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \
{"subframes-write-delay", CONFIG_HLP_SF_WDELAY, 0, uptr:&u_sf_write_delay, defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, uptr:&((*recplay_state)->u_sf_write_delay), defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \
}
/*! \brief USRP Configuration and state */
typedef
struct
{
FILE
*
pFile
;
int
mmapfd
;
int
iqfd
;
int
use_mmap
;
// default is to use mmap
size_t
mapsize
;
iqrec_t
*
ms_sample
;
// memory for all subframes
unsigned
int
nb_samples
;
char
u_sf_filename
[
1024
];
// subframes file path
unsigned
int
u_sf_max
;
// max number of recorded subframes
unsigned
int
u_sf_loops
;
// number of loops in replay mode
unsigned
int
u_sf_read_delay
;
// read delay in replay mode
unsigned
int
u_sf_write_delay
;
// write delay in replay mode
}
recplay_state_t
;
extern
int
read_usrpconfig
(
uint32_t
*
recplay_mode
,
recplay_state_t
**
recplay_state
);
#ifdef __cplusplus
}
}
#endif
// BELL_LABS_MUST
#endif
#endif // __USRP_LIB_H
#endif // __USRP_LIB_H
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
0 → 100644
View file @
64a0dac2
/*
* 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
*
* 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
*/
/** usrp_lib_config.c
*
* \author: HongliangXU : hong-liang-xu@agilent.com
*/
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/sysinfo.h>
#include <sys/resource.h>
#include "common/utils/LOG/log.h"
#include "assertions.h"
#include "common_lib.h"
#include "usrp_lib.h"
int
read_usrpconfig
(
uint32_t
*
recplay_mode
,
recplay_state_t
**
recplay_state
)
{
unsigned
int
u_sf_record
=
0
;
// record mode
unsigned
int
u_sf_replay
=
0
;
// replay mode
uint32_t
enable_recplay
;
paramdef_t
usrp_params
[]
=
USRP_DEVICE_PARAMS_DESC
;
config_get
(
usrp_params
,
sizeof
(
usrp_params
)
/
sizeof
(
paramdef_t
),
USRP_SECTION
);
if
(
enable_recplay
)
{
*
recplay_state
=
calloc
(
sizeof
(
recplay_state_t
),
1
);
paramdef_t
usrp_recplay_params
[]
=
USRP_RECPLAY_PARAMS_DESC
;
struct
sysinfo
systeminfo
;
// Use mmap for IQ files for systems with less than 6GB total RAM
sysinfo
(
&
systeminfo
);
if
(
systeminfo
.
totalram
<
6144000000
)
{
(
*
recplay_state
)
->
use_mmap
=
0
;
}
else
{
(
*
recplay_state
)
->
use_mmap
=
1
;
}
memset
((
*
recplay_state
)
->
u_sf_filename
,
0
,
1024
);
config_get
(
usrp_recplay_params
,
sizeof
(
usrp_recplay_params
)
/
sizeof
(
paramdef_t
),
USRP_RECPLAY_SECTION
);
if
(
strlen
((
*
recplay_state
)
->
u_sf_filename
)
==
0
)
{
(
void
)
strcpy
((
*
recplay_state
)
->
u_sf_filename
,
DEF_SF_FILE
);
}
}
/* record player enabled */
if
(
u_sf_replay
==
1
)
*
recplay_mode
=
RECPLAY_REPLAYMODE
;
if
(
u_sf_record
==
1
)
*
recplay_mode
=
RECPLAY_RECORDMODE
;
return
0
;
}
\ No newline at end of file
targets/RT/USER/lte-softmodem.h
View file @
64a0dac2
...
@@ -146,7 +146,7 @@
...
@@ -146,7 +146,7 @@
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"clock
", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT,
0}, \
{"clock
-source", CONFIG_HLP_CLK, 0, iptr:&clock_source, defintval:0, TYPE_INT,
0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 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