Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
ffc53b4c
Commit
ffc53b4c
authored
Nov 13, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to fix LTE UE connection problem
parent
d0866ddb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
132 deletions
+123
-132
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+2
-2
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+121
-129
targets/ARCH/USRP/USERSPACE/LIB/usrp_liblte.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_liblte.cpp
+0
-1
No files found.
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
View file @
ffc53b4c
...
@@ -166,7 +166,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
...
@@ -166,7 +166,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
ctxt
.
rnti
=
pdcp_eNB_UE_instance_to_rnti
[
0
];
ctxt
.
rnti
=
pdcp_eNB_UE_instance_to_rnti
[
0
];
ctxt
.
enb_flag
=
ENB_FLAG_YES
;
ctxt
.
enb_flag
=
ENB_FLAG_YES
;
ctxt
.
module_id
=
0
;
ctxt
.
module_id
=
0
;
key
=
PDCP_COLL_KEY_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
,
rab_id
,
SRB_FLAG_
YES
);
key
=
PDCP_COLL_KEY_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
,
rab_id
,
SRB_FLAG_
NO
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
}
}
...
@@ -716,7 +716,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t *const ctxt_pP)
...
@@ -716,7 +716,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t *const ctxt_pP)
ctxt_pP
->
subframe
,
ctxt_pP
->
subframe
,
ctxt_pP
->
module_id
);
ctxt_pP
->
module_id
);
for
(
dst_id
=
0
;
dst_id
<
MAX_MOBILES_PER_ENB
;
dst_id
++
)
{
for
(
dst_id
=
0
;
dst_id
<
NUMBER_OF_UE_MAX
;
dst_id
++
)
{
ctxt
.
rnti
=
oai_emulation
.
info
.
eNB_ue_module_id_to_rnti
[
ctxt
.
module_id
][
dst_id
];
ctxt
.
rnti
=
oai_emulation
.
info
.
eNB_ue_module_id_to_rnti
[
ctxt
.
module_id
][
dst_id
];
}
}
}
}
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
ffc53b4c
...
@@ -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>
...
@@ -52,15 +52,15 @@
...
@@ -52,15 +52,15 @@
#include <sys/resource.h>
#include <sys/resource.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_
...
@@ -128,10 +128,10 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
...
@@ -128,10 +128,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 +140,11 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
...
@@ -140,13 +140,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 +177,13 @@ static int sync_to_gps(openair0_device *device) {
...
@@ -179,14 +177,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
...
@@ -266,41 +263,41 @@ static int sync_to_gps(openair0_device *device) {
...
@@ -266,41 +263,41 @@ static int sync_to_gps(openair0_device *device) {
}
}
#if defined(USRP_REC_PLAY)
#if defined(USRP_REC_PLAY)
#include "usrp_lib.h"
#include "usrp_lib.h"
static
FILE
*
pFile
=
NULL
;
static
FILE
*
pFile
=
NULL
;
int
mmapfd
=
0
;
int
mmapfd
=
0
;
int
iqfd
=
0
;
int
iqfd
=
0
;
int
use_mmap
=
1
;
// default is to use mmap
int
use_mmap
=
1
;
// default is to use mmap
struct
stat
sb
;
struct
stat
sb
;
iqrec_t
*
ms_sample
=
NULL
;
// memory for all subframes
iqrec_t
*
ms_sample
=
NULL
;
// memory for all subframes
unsigned
int
nb_samples
=
0
;
unsigned
int
nb_samples
=
0
;
unsigned
int
cur_samples
=
0
;
unsigned
int
cur_samples
=
0
;
int64_t
wrap_count
=
0
;
int64_t
wrap_count
=
0
;
int64_t
wrap_ts
=
0
;
int64_t
wrap_ts
=
0
;
unsigned
int
u_sf_mode
=
0
;
// 1=record, 2=replay
unsigned
int
u_sf_mode
=
0
;
// 1=record, 2=replay
unsigned
int
u_sf_record
=
0
;
// record mode
unsigned
int
u_sf_record
=
0
;
// record mode
unsigned
int
u_sf_replay
=
0
;
// replay mode
unsigned
int
u_sf_replay
=
0
;
// replay mode
char
u_sf_filename
[
1024
]
=
""
;
// subframes file path
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_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_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_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
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_opt_sf_file
[]
=
CONFIG_OPT_SF_FILE
;
char
config_def_sf_file
[]
=
DEF_SF_FILE
;
char
config_def_sf_file
[]
=
DEF_SF_FILE
;
char
config_hlp_sf_file
[]
=
CONFIG_HLP_SF_FILE
;
char
config_hlp_sf_file
[]
=
CONFIG_HLP_SF_FILE
;
char
config_opt_sf_rec
[]
=
CONFIG_OPT_SF_REC
;
char
config_opt_sf_rec
[]
=
CONFIG_OPT_SF_REC
;
char
config_hlp_sf_rec
[]
=
CONFIG_HLP_SF_REC
;
char
config_hlp_sf_rec
[]
=
CONFIG_HLP_SF_REC
;
char
config_opt_sf_rep
[]
=
CONFIG_OPT_SF_REP
;
char
config_opt_sf_rep
[]
=
CONFIG_OPT_SF_REP
;
char
config_hlp_sf_rep
[]
=
CONFIG_HLP_SF_REP
;
char
config_hlp_sf_rep
[]
=
CONFIG_HLP_SF_REP
;
char
config_opt_sf_max
[]
=
CONFIG_OPT_SF_MAX
;
char
config_opt_sf_max
[]
=
CONFIG_OPT_SF_MAX
;
char
config_hlp_sf_max
[]
=
CONFIG_HLP_SF_MAX
;
char
config_hlp_sf_max
[]
=
CONFIG_HLP_SF_MAX
;
char
config_opt_sf_loops
[]
=
CONFIG_OPT_SF_LOOPS
;
char
config_opt_sf_loops
[]
=
CONFIG_OPT_SF_LOOPS
;
char
config_hlp_sf_loops
[]
=
CONFIG_HLP_SF_LOOPS
;
char
config_hlp_sf_loops
[]
=
CONFIG_HLP_SF_LOOPS
;
char
config_opt_sf_rdelay
[]
=
CONFIG_OPT_SF_RDELAY
;
char
config_opt_sf_rdelay
[]
=
CONFIG_OPT_SF_RDELAY
;
char
config_hlp_sf_rdelay
[]
=
CONFIG_HLP_SF_RDELAY
;
char
config_hlp_sf_rdelay
[]
=
CONFIG_HLP_SF_RDELAY
;
char
config_opt_sf_wdelay
[]
=
CONFIG_OPT_SF_WDELAY
;
char
config_opt_sf_wdelay
[]
=
CONFIG_OPT_SF_WDELAY
;
char
config_hlp_sf_wdelay
[]
=
CONFIG_HLP_SF_WDELAY
;
char
config_hlp_sf_wdelay
[]
=
CONFIG_HLP_SF_WDELAY
;
#endif
#endif
...
@@ -360,7 +357,6 @@ static void trx_usrp_end(openair0_device *device) {
...
@@ -360,7 +357,6 @@ static void trx_usrp_end(openair0_device *device) {
done
=
1
;
done
=
1
;
if
(
u_sf_mode
!=
2
)
{
// not subframes replay
if
(
u_sf_mode
!=
2
)
{
// not subframes replay
#endif
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
...
@@ -449,22 +445,20 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
...
@@ -449,22 +445,20 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
if
(
u_sf_mode
!=
2
)
{
// not replay mode
if
(
u_sf_mode
!=
2
)
{
// not replay mode
#endif
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
usrp_state_t
*
s
=
(
usrp_state_t
*
)
device
->
priv
;
int
nsamps2
;
// aligned to upper 32 or 16 byte boundary
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
;
__m256i
buff_tx
[
2
][
nsamps2
];
__m256i
buff_tx
[
2
][
nsamps2
];
#else
#else
nsamps2
=
(
nsamps
+
3
)
>>
2
;
nsamps2
=
(
nsamps
+
3
)
>>
2
;
__m128i
buff_tx
[
2
][
nsamps2
];
__m128i
buff_tx
[
2
][
nsamps2
];
#endif
#endif
#elif defined(__arm__)
#elif defined(__arm__)
nsamps2
=
(
nsamps
+
3
)
>>
2
;
nsamps2
=
(
nsamps
+
3
)
>>
2
;
int16x8_t
buff_tx
[
2
][
nsamps2
];
int16x8_t
buff_tx
[
2
][
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
...
@@ -495,42 +489,40 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
...
@@ -495,42 +489,40 @@ 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)
#if defined(USRP_REC_PLAY)
}
else
{
}
else
{
struct
timespec
req
;
struct
timespec
req
;
...
@@ -608,15 +600,15 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
...
@@ -608,15 +600,15 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
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__
// FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
// FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
if
((((
uintptr_t
)
buff
[
i
])
&
0x1F
)
==
0
)
{
if
((((
uintptr_t
)
buff
[
i
])
&
0x1F
)
==
0
)
{
((
__m256i
*
)
buff
[
i
])[
j
]
=
_mm256_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
((
__m256i
*
)
buff
[
i
])[
j
]
=
_mm256_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
}
}
else
{
else
{
((
__m128i
*
)
buff
[
i
])[
2
*
j
]
=
_mm_srai_epi16
(((
__m128i
*
)
buff_tmp
[
i
])[
2
*
j
],
4
);
((
__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
);
((
__m128i
*
)
buff
[
i
])[
2
*
j
+
1
]
=
_mm_srai_epi16
(((
__m128i
*
)
buff_tmp
[
i
])[
2
*
j
+
1
],
4
);
}
}
#else
#else
((
__m128i
*
)
buff
[
i
])[
j
]
=
_mm_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
((
__m128i
*
)
buff
[
i
])[
j
]
=
_mm_srai_epi16
(
buff_tmp
[
i
][
j
],
4
);
#endif
#endif
...
@@ -868,7 +860,6 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
...
@@ -868,7 +860,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
;
...
@@ -1077,7 +1068,6 @@ extern "C" {
...
@@ -1077,7 +1068,6 @@ extern "C" {
}
else
{
}
else
{
#endif
#endif
usrp_state_t
*
s
=
(
usrp_state_t
*
)
calloc
(
sizeof
(
usrp_state_t
),
1
);
usrp_state_t
*
s
=
(
usrp_state_t
*
)
calloc
(
sizeof
(
usrp_state_t
),
1
);
// Initialize USRP device
// Initialize USRP device
device
->
openair0_cfg
=
openair0_cfg
;
device
->
openair0_cfg
=
openair0_cfg
;
int
vers
=
0
,
subvers
=
0
,
subsubvers
=
0
;
int
vers
=
0
,
subvers
=
0
,
subsubvers
=
0
;
...
@@ -1092,13 +1082,13 @@ extern "C" {
...
@@ -1092,13 +1082,13 @@ extern "C" {
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 +1099,8 @@ extern "C" {
...
@@ -1109,8 +1099,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 +1113,7 @@ extern "C" {
...
@@ -1123,6 +1113,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,55 +1127,53 @@ extern "C" {
...
@@ -1136,55 +1127,53 @@ 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
;
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
);
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"
);
}
}
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"
);
}
else
if
(
openair0_cfg
[
0
].
clock_source
==
gpsdo
)
{
}
s
->
usrp
->
set_clock_source
(
"gpsdo"
);
else
if
(
openair0_cfg
[
0
].
clock_source
==
gpsdo
)
{
s
->
usrp
->
set_time_source
(
"gpsdo"
);
s
->
usrp
->
set_clock_source
(
"gpsdo"
);
}
s
->
usrp
->
set_time_source
(
"gpsdo"
);
}
}
else
{
}
else
{
LOG_W
(
HW
,
"clock_source already specified in device arguments! Ignoring command line parameter
\n
"
);
LOG_W
(
HW
,
"clock_source already specified in device arguments! Ignoring command line parameter
\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)
#if defined(USRP_REC_PLAY)
...
@@ -1208,7 +1197,7 @@ extern "C" {
...
@@ -1208,7 +1197,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;
...
@@ -1218,8 +1207,13 @@ extern "C" {
...
@@ -1218,8 +1207,13 @@ extern "C" {
break
;
break
;
case
46080000
:
case
46080000
:
<<<<<<<
HEAD
//openair0_cfg[0].samples_per_packet = 2048;
//openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg
[
0
].
tx_sample_advance
=
15
;
openair0_cfg
[
0
].
tx_sample_advance
=
15
;
=======
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg
[
0
].
tx_sample_advance
=
115
;
>>>>>>>
Try
to
fix
LTE
UE
connection
problem
openair0_cfg
[
0
].
tx_bw
=
40e6
;
openair0_cfg
[
0
].
tx_bw
=
40e6
;
openair0_cfg
[
0
].
rx_bw
=
40e6
;
openair0_cfg
[
0
].
rx_bw
=
40e6
;
break
;
break
;
...
@@ -1276,7 +1270,7 @@ extern "C" {
...
@@ -1276,7 +1270,7 @@ extern "C" {
}
}
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 +1278,7 @@ extern "C" {
...
@@ -1284,7 +1278,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 +1367,6 @@ extern "C" {
...
@@ -1373,7 +1367,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,7 +1415,7 @@ extern "C" {
...
@@ -1422,7 +1415,7 @@ 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
());
...
@@ -1451,7 +1444,6 @@ extern "C" {
...
@@ -1451,7 +1444,6 @@ 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)
#if defined(USRP_REC_PLAY)
}
}
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_liblte.cpp
View file @
ffc53b4c
...
@@ -448,7 +448,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
...
@@ -448,7 +448,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
nsamps2
=
(
nsamps
+
3
)
>>
2
;
nsamps2
=
(
nsamps
+
3
)
>>
2
;
__m128i
buff_tx
[
2
][
nsamps2
];
__m128i
buff_tx
[
2
][
nsamps2
];
#endif
#endif
#elif defined(__arm__)
#elif defined(__arm__)
nsamps2
=
(
nsamps
+
3
)
>>
2
;
nsamps2
=
(
nsamps
+
3
)
>>
2
;
int16x8_t
buff_tx
[
2
][
nsamps2
];
int16x8_t
buff_tx
[
2
][
nsamps2
];
...
...
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