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
Michael Black
OpenXG-RAN
Commits
29fdf1a3
Commit
29fdf1a3
authored
Jul 17, 2016
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modifications for UE on ExpressMIMO2, validation on USRP. Only RX path is activated.
parent
d9501248
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
258 additions
and
125 deletions
+258
-125
openair2/UTIL/LOG/vcd_signal_dumper.c
openair2/UTIL/LOG/vcd_signal_dumper.c
+11
-8
openair2/UTIL/LOG/vcd_signal_dumper.h
openair2/UTIL/LOG/vcd_signal_dumper.h
+11
-8
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+1
-2
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
+163
-51
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h
+1
-0
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+1
-1
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+6
-14
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+45
-25
targets/RT/USER/ue_usrp.gtkw
targets/RT/USER/ue_usrp.gtkw
+19
-16
No files found.
openair2/UTIL/LOG/vcd_signal_dumper.c
View file @
29fdf1a3
...
...
@@ -81,12 +81,14 @@ const char* eurecomVariablesNames[] = {
"subframe_number_RX_eNB"
,
"runtime_TX_eNB"
,
"runtime_RX_eNB"
,
"frame_number_TX_UE"
,
"frame_number_RX_UE"
,
"slot_number_TX_UE"
,
"slot_number_RX_UE"
,
"subframe_number_TX_UE"
,
"subframe_number_RX_UE"
,
"frame_number_TX0_UE"
,
"frame_number_TX1_UE"
,
"frame_number_RX0_UE"
,
"frame_number_RX1_UE"
,
"subframe_TX0_UE"
,
"subframe_TX1_UE"
,
"subframe_RX0_UE"
,
"subframe_RX1_UE"
,
"missed_slot_enb"
,
"daq_mbox"
,
"rx_offset_mbox"
,
...
...
@@ -187,8 +189,9 @@ const char* eurecomFunctionsNames[] = {
"eNB_thread_rxtx1"
,
"eNB_thread_rx"
,
"eNB_thread_prach"
,
"ue_thread_tx"
,
"ue_thread_rx"
,
"ue_thread_synch"
,
"ue_thread_rxtx0"
,
"ue_thread_rxtx1"
,
/* RRH signals */
"eNB_tx"
,
...
...
openair2/UTIL/LOG/vcd_signal_dumper.h
View file @
29fdf1a3
...
...
@@ -53,12 +53,14 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_ENB
,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB
,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB
,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_UE
,
VCD_SIGNAL_DUMPER_VARIABLES_MISSED_SLOTS_ENB
,
VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX
,
VCD_SIGNAL_DUMPER_VARIABLES_UE_OFFSET_MBOX
,
...
...
@@ -161,8 +163,9 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX1
,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX
,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_PRACH
,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_TX
,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX
,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH
,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0
,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1
,
/* RRH signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX
,
...
...
targets/ARCH/COMMON/common_lib.h
View file @
29fdf1a3
...
...
@@ -326,9 +326,8 @@ struct openair0_device_t {
void
(
*
trx_end_func
)(
openair0_device
*
device
);
/*! \brief Stop operation of the transceiver
* \param card RF Card to use
*/
int
(
*
trx_stop_func
)(
int
card
);
int
(
*
trx_stop_func
)(
openair0_device
*
device
);
/* Functions API related to UE*/
...
...
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
View file @
29fdf1a3
...
...
@@ -67,6 +67,7 @@
#define max(a,b) ((a)>(b) ? (a) : (b))
//#define DEBUG_EXMIMO
exmimo_pci_interface_bot_virtual_t
openair0_exmimo_pci
[
MAX_CARDS
];
// contains userspace pointers for each card
...
...
@@ -306,7 +307,7 @@ static void *watchdog_thread(void *arg) {
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
wait
.
tv_nsec
=
5000000
0
L
;
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD threads */
...
...
@@ -410,6 +411,8 @@ static void *watchdog_thread(void *arg) {
}
first_acquisition
=
1
;
printf
(
"Locking watchdog for first acquisition
\n
"
);
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
// main loop to keep up with DMA transfers from exmimo2
int
cnt_diff0
=
0
;
...
...
@@ -428,19 +431,22 @@ static void *watchdog_thread(void *arg) {
}
exm
->
last_mbox
=
mbox
;
if
(
first_acquisition
==
0
)
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
exm
->
ts
+=
(
diff
*
exm
->
samples_per_frame
/
150
)
;
if
(
first_acquisition
==
1
)
//set last read to a closest subframe boundary
exm
->
last_ts_rx
=
(
exm
->
ts
/
(
exm
->
samples_per_frame
/
10
))
*
(
exm
->
samples_per_frame
/
10
);
if
((
diff
>
16
)
&&
(
first_acquisition
==
0
))
{
// we're too late so exit
if
((
exm
->
daq_state
==
running
)
&&
(
diff
>
16
)
&&
(
first_acquisition
==
0
))
{
// we're too late so exit
exm
->
watchdog_exit
=
1
;
printf
(
"exiting, too late to keep up
\n
"
);
}
first_acquisition
=
0
;
if
(
diff
==
0
)
{
if
((
exm
->
daq_state
==
running
)
&&
(
diff
==
0
))
{
cnt_diff0
++
;
if
(
cnt_diff0
==
10
)
{
exm
->
watchdog_exit
=
1
;
...
...
@@ -450,13 +456,19 @@ static void *watchdog_thread(void *arg) {
else
cnt_diff0
=
0
;
if
(
exm
->
ts
-
exm
->
last_ts_rx
>
exm
->
samples_per_frame
)
{
if
((
exm
->
daq_state
==
running
)
&&
(
exm
->
wait_first_read
==
0
)
&&
(
exm
->
ts
-
exm
->
last_ts_rx
>
exm
->
samples_per_frame
))
{
exm
->
watchdog_exit
=
1
;
printf
(
"RX Overflow, exiting
\n
"
);
printf
(
"RX Overflow, exiting (TS %llu, TS last read %llu)
\n
"
,
exm
->
ts
,
exm
->
last_ts_rx
);
}
// printf("ts %lu, last_ts_rx %lu, mbox %d, diff %d\n",exm->ts, exm->last_ts_rx,mbox,diff);
pthread_mutex_unlock
(
&
exm
->
watchdog_mutex
);
}
else
{
first_acquisition
=
1
;
}
rt_sleep
(
&
sleep_time
,
250000L
);
}
...
...
@@ -487,9 +499,10 @@ int trx_exmimo_start(openair0_device *device) {
exmimo_state_t
*
exm
=
device
->
priv
;
printf
(
"Starting ...
\n
"
);
openair0_config
(
device
->
openair0_cfg
,
0
);
openair0_start_rt_acquisition
(
0
);
exm
->
daq_state
=
running
;
exm
->
wait_first_read
=
1
;
return
(
0
);
}
...
...
@@ -498,6 +511,8 @@ int trx_exmimo_write(openair0_device *device,openair0_timestamp ptimestamp, void
return
(
0
);
}
int
trx_exmimo_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
exmimo_state_t
*
exm
=
device
->
priv
;
...
...
@@ -505,25 +520,79 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
openair0_timestamp
old_ts
=
0
,
ts
,
diff
;
struct
timespec
sleep_time
;
unsigned
long
tv_nsec
;
//
int i;
int
i
;
struct
timespec
wait
;
int
n
,
n1
,
n2
,
ntot
,
first_len
;
int
ret
;
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
wait
.
tv_nsec
=
5000000
0
L
;
if
(
exm
->
watchdog_exit
==
1
)
return
(
0
);
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
if
(
exm
->
daq_state
==
idle
)
{
tv_nsec
=
(
unsigned
long
)((
double
)(
nsamps
)
*
1e9
/
cfg
->
sample_rate
);
return
(
0
);
}
ret
=
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
switch
(
ret
)
{
case
EINVAL
:
#ifdef DEBUG_EXMIMO
printf
(
"trx_exmimo_read: mutex_timedlock returned EINVAL
\n
"
);
#endif
return
(
0
);
break
;
case
ETIMEDOUT
:
#ifdef DEBUG_EXMIMO
printf
(
"trx_exmimo_read: mutex_timedlock returned ETIMEDOUT
\n
"
);
#endif
return
(
0
);
break
;
case
EAGAIN
:
#ifdef DEBUG_EXMIMO
printf
(
"trx_exmimo_read: mutex_timedlock returned EAGAIN
\n
"
);
#endif
return
(
0
);
break
;
case
EDEADLK
:
#ifdef DEBUG_EXMIMO
printf
(
"trx_exmimo_read: mutex_timedlock returned EDEADLK
\n
"
);
#endif
return
(
0
);
break
;
}
ts
=
exm
->
ts
;
if
(
exm
->
wait_first_read
==
1
)
{
exm
->
wait_first_read
=
0
;
exm
->
last_ts_rx
=
ts
;
}
pthread_mutex_unlock
(
&
exm
->
watchdog_mutex
);
while
((
ts
<
exm
->
last_ts_rx
+
nsamps
)
&&
// dump_frame_parms(frame_parms[0]);
if
(
nsamps
>
(
exm
->
samples_per_frame
>>
1
))
{
n1
=
nsamps
>>
1
;
n2
=
nsamps
-
n1
;
}
else
{
n1
=
nsamps
;
n2
=
0
;
}
#ifdef DEBUG_EXMIMO
printf
(
"Reading %d samples, ts %lu (%d), last_ts_rx %lu (%lu)
\n
"
,
nsamps
,
ts
,
ts
%
exm
->
samples_per_frame
,
exm
->
last_ts_rx
,
exm
->
last_ts_rx
+
nsamps
);
#endif
for
(
n
=
n1
,
ntot
=
0
;
ntot
<
nsamps
;
n
=
n2
)
{
while
((
ts
<
exm
->
last_ts_rx
+
n
)
&&
(
exm
->
watchdog_exit
==
0
))
{
diff
=
exm
->
last_ts_rx
+
nsamps
-
ts
;
// difference in samples between current timestamp and last RX received sample
diff
=
exm
->
last_ts_rx
+
n
-
ts
;
// difference in samples between current timestamp and last RX received sample
// go to sleep until we should have enough samples (1024 for a bit more)
#ifdef DEBUG_EXMIMO
printf
(
"Reading %d samples, ts %lu, last_ts_rx %lu (%lu) => sleeping %u us
\n
"
,
nsamps
,
ts
,
exm
->
last_ts_rx
,
exm
->
last_ts_rx
+
nsamps
,
printf
(
"portion %d samples, ts %lu, last_ts_rx %lu (%lu) => sleeping %u us
\n
"
,
n
,
ts
,
exm
->
last_ts_rx
,
exm
->
last_ts_rx
+
n
,
(
unsigned
int
)((
double
)(
diff
+
1024
)
*
1e6
/
cfg
->
sample_rate
));
#endif
tv_nsec
=
(
unsigned
long
)((
double
)(
diff
+
3840
)
*
1e9
/
cfg
->
sample_rate
);
...
...
@@ -543,19 +612,42 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
}
}
/*
if (cfg->mmapped_dma == 0) { // if buff is not the dma buffer, do a memcpy, otherwise do nothing
for (i=0;i<cc;i++) {
memcpy(buff[i],
openair0_exmimo_pci[0].adc_head[i]+(exm->last_ts_rx % exm->samples_per_frame),
nsamps*sizeof(int));
if
(
cfg
->
mmapped_dma
==
0
)
{
// if buff is not the dma buffer, do a memcpy, otherwise do nothing
for
(
i
=
0
;
i
<
cc
;
i
++
)
{
#ifdef DEBUG_EXMIMO
printf
(
"copying to %p (%lu), from %llu
\n
"
,
buff
[
i
]
+
(
ntot
*
sizeof
(
int
)),
ntot
*
sizeof
(
int
),(
exm
->
last_ts_rx
%
exm
->
samples_per_frame
));
#endif
if
((
n
+
(
exm
->
last_ts_rx
%
exm
->
samples_per_frame
))
<
exm
->
samples_per_frame
)
{
memcpy
(
buff
[
i
]
+
(
ntot
*
sizeof
(
int
)),
(
void
*
)(
openair0_exmimo_pci
[
0
].
adc_head
[
i
]
+
(
exm
->
last_ts_rx
%
exm
->
samples_per_frame
)),
n
*
sizeof
(
int
));
}
}*/
else
{
first_len
=
(
exm
->
samples_per_frame
-
(
exm
->
last_ts_rx
%
exm
->
samples_per_frame
));
#ifdef DEBUG_EXMIMO
printf
(
"split: first_len %d, remainder %d
\n
"
,
first_len
,
n
-
first_len
);
#endif
memcpy
(
buff
[
i
]
+
(
ntot
*
sizeof
(
int
)),
(
void
*
)(
openair0_exmimo_pci
[
0
].
adc_head
[
i
]
+
(
exm
->
last_ts_rx
%
exm
->
samples_per_frame
)),
first_len
*
sizeof
(
int
));
memcpy
(
buff
[
i
]
+
(
ntot
+
first_len
)
*
sizeof
(
int
),
(
void
*
)
openair0_exmimo_pci
[
0
].
adc_head
[
i
],
(
n
-
first_len
)
*
sizeof
(
int
));
}
}
}
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
exm
->
last_ts_rx
+=
n
;
pthread_mutex_unlock
(
&
exm
->
watchdog_mutex
);
if
(
n
==
n1
)
{
*
ptimestamp
=
exm
->
last_ts_rx
;
exm
->
last_ts_rx
+=
nsamps
;
}
ntot
+=
n
;
}
return
(
nsamps
);
...
...
@@ -582,14 +674,21 @@ int trx_exmimo_reset_stats(openair0_device* device) {
}
int
trx_exmimo_stop
(
int
card
)
{
int
trx_exmimo_stop
(
openair0_device
*
device
)
{
exmimo_state_t
*
exm
=
device
->
priv
;
printf
(
"Stopping ...
\n
"
);
exm
->
daq_state
=
idle
;
openair0_stop
(
0
);
return
(
0
);
}
int
trx_exmimo_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
1
,
int
exmimo_dump_config
)
{
int
trx_exmimo_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
)
{
openair0_set_frequencies
(
device
,
openair0_cfg
,
0
);
return
(
0
);
}
...
...
@@ -663,7 +762,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device
->
openair0_cfg
=
openair0_cfg
;
device
->
priv
=
(
void
*
)
exm
;
openair0_config
(
openair0_cfg
,
0
);
create_watchdog
(
device
);
...
...
@@ -684,6 +783,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
int
resampling_factor
=
2
;
int
rx_filter
=
RXLPF25
,
tx_filter
=
TXLPF25
;
int
ACTIVE_RF
=
0
;
int
i
;
exmimo_config_t
*
p_exmimo_config
;
exmimo_id_t
*
p_exmimo_id
;
...
...
@@ -713,7 +813,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
/* device specific */
openair0_cfg
[
card
].
iq_txshift
=
4
;
//shift
openair0_cfg
[
card
].
iq_rxrescale
=
15
;
//rescale iqs
openair0_cfg
[
card
].
mmapped_dma
=
1
;
if
(
openair0_cfg
[
card
].
sample_rate
==
30.72e6
)
{
resampling_factor
=
0
;
...
...
@@ -761,6 +861,12 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
=
(
unsigned
int
)
openair0_cfg
[
card
].
tx_freq
[
ant
];
p_exmimo_config
->
rf
.
tx_gain
[
ant
][
0
]
=
(
unsigned
int
)
openair0_cfg
[
card
].
tx_gain
[
ant
];
printf
(
"openair0 : programming card %d TX antenna %d (freq %u, gain %d)
\n
"
,
card
,
ant
,
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
],
p_exmimo_config
->
rf
.
tx_gain
[
ant
][
0
]);
printf
(
"Setting TX buffer to all-RX
\n
"
);
for
(
i
=
0
;
i
<
307200
;
i
++
)
{
((
uint32_t
*
)
openair0_exmimo_pci
[
card
].
dac_head
[
ant
])[
i
]
=
0x00010001
;
}
}
if
(
openair0_cfg
[
card
].
rx_freq
[
ant
]
>
0
)
{
...
...
@@ -813,7 +919,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config
->
rf
.
rf_local
[
ant
]
=
rf_local
[
ant
];
p_exmimo_config
->
rf
.
rf_rxdc
[
ant
]
=
rf_rxdc
[
ant
];
if
((
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
>=
85
0000000
)
&&
(
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
<=
865000000
))
{
if
((
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
>=
79
0000000
)
&&
(
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
<=
865000000
))
{
p_exmimo_config
->
rf
.
rf_vcocal
[
ant
]
=
rf_vcocal_850
[
ant
];
p_exmimo_config
->
rf
.
rffe_band_mode
[
ant
]
=
DD_TDD
;
}
else
if
((
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
>=
1900000000
)
&&
(
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
<=
2000000000
))
{
...
...
@@ -826,7 +932,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
}
if
(
openair0_cfg
[
card
].
duplex_mode
==
duplex_mode_FDD
)
{
p_exmimo_config
->
framing
.
tdd_config
=
DUPLEXMODE_FDD
;
p_exmimo_config
->
framing
.
tdd_config
=
DUPLEXMODE_FDD
;
// + TXRXSWITCH_LSB + TXRXSWITCH_LSB + ACTIVE_RF+ ACTIVE_RF;
printf
(
"!!!!!setting FDD (tdd_config=%d)
\n
"
,
p_exmimo_config
->
framing
.
tdd_config
);
}
else
{
...
...
@@ -857,6 +963,9 @@ int openair0_reconfig(openair0_config_t *openair0_cfg)
return
(
-
1
);
}
#ifdef DEBUG_EXMIMO
printf
(
"Reconfiguration of gains/frequencies
\n
"
);
#endif
for
(
card
=
0
;
card
<
openair0_num_detected_cards
;
card
++
)
{
p_exmimo_config
=
openair0_exmimo_pci
[
card
].
exmimo_config_ptr
;
...
...
@@ -866,15 +975,18 @@ int openair0_reconfig(openair0_config_t *openair0_cfg)
if
(
openair0_cfg
[
card
].
tx_freq
[
ant
])
{
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
]
=
(
unsigned
int
)
openair0_cfg
[
card
].
tx_freq
[
ant
];
p_exmimo_config
->
rf
.
tx_gain
[
ant
][
0
]
=
(
unsigned
int
)
openair0_cfg
[
card
].
tx_gain
[
ant
];
printf
(
"openair0 : programming TX antenna %d (freq %u, gain %d)
\n
"
,
ant
,
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
],
p_exmimo_config
->
rf
.
tx_gain
[
ant
][
0
]);
#ifdef DEBUG_EXMIMO
printf
(
"openair0 - %d : programming TX antenna %d (freq %u, gain %d)
\n
"
,
card
,
ant
,
p_exmimo_config
->
rf
.
rf_freq_tx
[
ant
],
p_exmimo_config
->
rf
.
tx_gain
[
ant
][
0
]);
#endif
}
if
(
openair0_cfg
[
card
].
rx_freq
[
ant
])
{
p_exmimo_config
->
rf
.
rf_freq_rx
[
ant
]
=
(
unsigned
int
)
openair0_cfg
[
card
].
rx_freq
[
ant
];
p_exmimo_config
->
rf
.
rx_gain
[
ant
][
0
]
=
(
unsigned
int
)
openair0_cfg
[
card
].
rx_gain
[
ant
];
printf
(
"openair0 : programming RX antenna %d (freq %u, gain %d)
\n
"
,
ant
,
p_exmimo_config
->
rf
.
rf_freq_rx
[
ant
],
p_exmimo_config
->
rf
.
rx_gain
[
ant
][
0
]);
#ifdef DEBUG_EXMIMO
printf
(
"openair0 - %d : programming RX antenna %d (freq %u, gain %d)
\n
"
,
card
,
ant
,
p_exmimo_config
->
rf
.
rf_freq_rx
[
ant
],
p_exmimo_config
->
rf
.
rx_gain
[
ant
][
0
]);
#endif
switch
(
openair0_cfg
[
card
].
rxg_mode
[
ant
])
{
default:
case
max_gain
:
...
...
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h
View file @
29fdf1a3
...
...
@@ -58,6 +58,7 @@ typedef struct {
struct
sched_param
watchdog_sched_param
;
pthread_mutex_t
watchdog_mutex
;
int
watchdog_exit
;
int
wait_first_read
;
exmimo_daq_state_t
daq_state
;
openair0_timestamp
ts
;
openair0_timestamp
last_ts_rx
;
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
29fdf1a3
...
...
@@ -377,7 +377,7 @@ int trx_usrp_set_gains(openair0_device* device,
/*! \brief Stop USRP
* \param card refers to the hardware index to use
*/
int
trx_usrp_stop
(
int
card
)
{
int
trx_usrp_stop
(
openair0_device
*
device
)
{
return
(
0
);
}
...
...
targets/RT/USER/lte-softmodem.c
View file @
29fdf1a3
...
...
@@ -1514,6 +1514,11 @@ int main( int argc, char **argv )
for
(
card
=
0
;
card
<
MAX_CARDS
;
card
++
)
{
if
(
UE_flag
==
0
)
openair0_cfg
[
card
].
mmapped_dma
=
1
;
else
openair0_cfg
[
card
].
mmapped_dma
=
0
;
if
(
frame_parms
[
0
]
->
N_RB_DL
==
100
)
{
if
(
frame_parms
[
0
]
->
threequarter_fs
)
{
openair0_cfg
[
card
].
sample_rate
=
23.04e6
;
...
...
@@ -1796,14 +1801,7 @@ int main( int argc, char **argv )
exit
(
-
1
);
}
printf
(
"Setting UE buffer to all-RX
\n
"
);
// Set LSBs for antenna switch (ExpressMIMO)
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
for
(
i
=
0
;
i
<
frame_parms
[
CC_id
]
->
samples_per_tti
*
10
;
i
++
)
for
(
aa
=
0
;
aa
<
frame_parms
[
CC_id
]
->
nb_antennas_tx
;
aa
++
)
UE
[
CC_id
]
->
common_vars
.
txdata
[
aa
][
i
]
=
0x00010001
;
}
if
(
input_fd
)
{
printf
(
"Reading in from file to antenna buffer %d
\n
"
,
0
);
...
...
@@ -1905,18 +1903,12 @@ int main( int argc, char **argv )
else
init_eNB
(
node_function
);
// Sleep to allow all threads to setup
sleep
(
1
);
sleep
(
3
);
// *** Handle per CC_id openair0
#ifndef USRP_DEBUG
if
((
UE_flag
==
1
)
&&
(
mode
!=
loop_through_memory
))
if
(
openair0
.
trx_start_func
(
&
openair0
)
!=
0
)
LOG_E
(
HW
,
"Could not start the device
\n
"
);
#endif
printf
(
"Sending sync to all threads
\n
"
);
...
...
targets/RT/USER/lte-ue.c
View file @
29fdf1a3
...
...
@@ -297,14 +297,7 @@ static void *UE_thread_synch(void *arg)
#endif
pthread_mutex_lock
(
&
sync_mutex
);
printf
(
"Locked sync_mutex, waiting (UE_sync_thread)
\n
"
);
while
(
sync_var
<
0
)
pthread_cond_wait
(
&
sync_cond
,
&
sync_mutex
);
pthread_mutex_unlock
(
&
sync_mutex
);
printf
(
"unlocked sync_mutex (UE_sync_thread)
\n
"
);
printf
(
"starting UE synch thread (IC %d)
\n
"
,
UE
->
proc
.
instance_cnt_synch
);
ind
=
0
;
...
...
@@ -344,6 +337,10 @@ static void *UE_thread_synch(void *arg)
openair0_cfg
[
0
].
rx_freq
[
i
]
=
downlink_frequency
[
0
][
i
];
openair0_cfg
[
0
].
tx_freq
[
i
]
=
downlink_frequency
[
0
][
i
]
+
uplink_frequency_offset
[
0
][
i
];
openair0_cfg
[
0
].
autocal
[
i
]
=
1
;
if
(
uplink_frequency_offset
[
0
][
i
]
!=
0
)
//
openair0_cfg
[
0
].
duplex_mode
=
duplex_mode_FDD
;
else
//FDD
openair0_cfg
[
0
].
duplex_mode
=
duplex_mode_TDD
;
}
sync_mode
=
pbch
;
...
...
@@ -365,6 +362,19 @@ static void *UE_thread_synch(void *arg)
}
if
(
openair0
.
trx_start_func
(
&
openair0
)
!=
0
)
{
LOG_E
(
HW
,
"Could not start the device
\n
"
);
oai_exit
=
1
;
}
pthread_mutex_lock
(
&
sync_mutex
);
printf
(
"Locked sync_mutex, waiting (UE_sync_thread)
\n
"
);
while
(
sync_var
<
0
)
pthread_cond_wait
(
&
sync_cond
,
&
sync_mutex
);
pthread_mutex_unlock
(
&
sync_mutex
);
printf
(
"Started device, unlocked sync_mutex (UE_sync_thread)
\n
"
);
while
(
oai_exit
==
0
)
{
if
(
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
)
!=
0
)
{
...
...
@@ -385,7 +395,7 @@ static void *UE_thread_synch(void *arg)
return
&
UE_thread_synch_retval
;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_
THREAD_
SYNCH
,
1
);
switch
(
sync_mode
)
{
case
pss
:
...
...
@@ -474,11 +484,15 @@ static void *UE_thread_synch(void *arg)
break
;
}
openair0
.
trx_set_freq_func
(
&
openair0
,
&
openair0_cfg
[
0
],
0
);
//
openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
//openair0.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//openair0.trx_stop_func(
0);
openair0
.
trx_stop_func
(
&
openair
0
);
sleep
(
1
);
init_frame_parms
(
&
UE
->
frame_parms
,
1
);
if
(
openair0
.
trx_start_func
(
&
openair0
)
!=
0
)
{
LOG_E
(
HW
,
"Could not start the device
\n
"
);
oai_exit
=
1
;
}
}
else
{
UE
->
is_synchronized
=
1
;
...
...
@@ -546,7 +560,7 @@ static void *UE_thread_synch(void *arg)
openair0_cfg
[
card
].
rx_freq
[
i
]
=
downlink_frequency
[
card
][
i
]
+
freq_offset
;
openair0_cfg
[
card
].
tx_freq
[
i
]
=
downlink_frequency
[
card
][
i
]
+
uplink_frequency_offset
[
card
][
i
]
+
freq_offset
;
openair0
.
trx_set_freq_func
(
&
openair0
,
&
openair0_cfg
[
0
],
0
);
openair0_cfg
[
card
].
rx_gain
[
i
]
=
UE
->
rx_total_gain_dB
;
//-USRP_GAIN_OFFSET;
...
...
@@ -554,10 +568,12 @@ static void *UE_thread_synch(void *arg)
}
}
if
(
UE
->
UE_scan_carrier
==
1
)
{
for
(
i
=
0
;
i
<
openair0_cfg
[
0
].
rx_num_channels
;
i
++
)
openair0_cfg
[
0
].
autocal
[
i
]
=
1
;
// openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
if
(
UE
->
UE_scan_carrier
==
1
)
{
for
(
i
=
0
;
i
<
openair0_cfg
[
0
].
rx_num_channels
;
i
++
)
{
// openair0_cfg[0].autocal[i] = 1;
}
}
}
// initial_sync=0
...
...
@@ -568,9 +584,6 @@ static void *UE_thread_synch(void *arg)
break
;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH
,
0
);
if
(
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
)
!=
0
)
{
LOG_E
(
PHY
,
"[SCHED][UE] error locking mutex for UE synch
\n
"
);
...
...
@@ -587,7 +600,7 @@ static void *UE_thread_synch(void *arg)
return
&
UE_thread_synch_retval
;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_
THREAD_
SYNCH
,
0
);
}
// while !oai_exit
return
&
UE_thread_synch_retval
;
...
...
@@ -923,7 +936,11 @@ static void *UE_thread_rxn_txnp4(void *arg)
return
&
UE_thread_rx_retval
;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0
+
(
proc
->
subframe_rx
&
1
),
1
);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_UE
+
(
proc
->
subframe_rx
&
1
),
proc
->
subframe_rx
);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_UE
+
(
proc
->
subframe_tx
&
1
),
proc
->
subframe_tx
);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE
+
(
proc
->
subframe_rx
&
1
),
proc
->
frame_rx
);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE
+
(
proc
->
subframe_tx
&
1
),
proc
->
frame_tx
);
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
)
==
SF_DL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
...
...
@@ -955,8 +972,8 @@ static void *UE_thread_rxn_txnp4(void *arg)
UE
->
UE_mode
[
0
]
=
PRACH
;
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0
+
(
proc
->
subframe_rx
&
1
),
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX
,
0
);
if
(
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
)
!=
0
)
{
LOG_E
(
PHY
,
"[SCHED][UE] error locking mutex for UE RX
\n
"
);
...
...
@@ -1114,6 +1131,7 @@ void *UE_thread(void *arg) {
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
dummy_rx
[
i
][
0
];
for
(
int
sf
=
0
;
sf
<
10
;
sf
++
)
{
// printf("Reading dummy sf %d\n",sf);
rxs
=
openair0
.
trx_read_func
(
&
openair0
,
&
timestamp
,
rxp
,
...
...
@@ -1164,7 +1182,6 @@ void *UE_thread(void *arg) {
}
// start_rx_stream==0
else
{
// printf("Frame %d, rx_offset %d (diff %d, timer %d)\n",UE->proc.proc_rxtx[0].frame_rx,UE->rx_offset,rx_off_diff,rx_correction_timer);
UE
->
proc
.
proc_rxtx
[
0
].
frame_rx
++
;
UE
->
proc
.
proc_rxtx
[
1
].
frame_rx
++
;
...
...
@@ -1172,6 +1189,7 @@ void *UE_thread(void *arg) {
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
rxdata
[
i
][
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
+
(
sf
*
UE
->
frame_parms
.
samples_per_tti
)];
// grab signal for subframe
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ
,
1
);
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
(
sf
<
9
)
{
rxs
=
openair0
.
trx_read_func
(
&
openair0
,
...
...
@@ -1196,7 +1214,7 @@ void *UE_thread(void *arg) {
rx_off_diff
=
0
;
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ
,
0
);
// operate on thread sf mod 2
UE_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
sf
&
1
];
...
...
@@ -1650,8 +1668,8 @@ void *UE_thread_old(void *arg)
/*!
* \brief Initialize the UE theads.
* Creates the UE threads:
* - UE_thread_
tx
* - UE_thread_rx
* - UE_thread_
rxtx0
* - UE_thread_rx
tx1
* - UE_thread_synch
* and the locking between them.
*/
...
...
@@ -1751,6 +1769,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
free
(
phy_vars_ue
[
CC_id
]
->
common_vars
.
rxdata
[
i
]
);
rxdata
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
307200
*
sizeof
(
int32_t
)
);
phy_vars_ue
[
CC_id
]
->
common_vars
.
rxdata
[
i
]
=
rxdata
[
i
];
// what about the "-N_TA_offset" ? // N_TA offset for TDD
printf
(
"rxdata[%d] : %p
\n
"
,
i
,
rxdata
[
i
]);
}
for
(
i
=
0
;
i
<
frame_parms
->
nb_antennas_tx
;
i
++
)
{
...
...
@@ -1758,6 +1777,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
free
(
phy_vars_ue
[
CC_id
]
->
common_vars
.
txdata
[
i
]
);
txdata
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
307200
*
sizeof
(
int32_t
)
);
phy_vars_ue
[
CC_id
]
->
common_vars
.
txdata
[
i
]
=
txdata
[
i
];
printf
(
"txdata[%d] : %p
\n
"
,
i
,
txdata
[
i
]);
}
// rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x]
...
...
targets/RT/USER/ue_usrp.gtkw
View file @
29fdf1a3
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Sun
Mar 20 18:27:06
2016
[*] Sun
Jul 17 20:46:59
2016
[*]
[dumpfile] "/tmp/openair_dump_UE.vcd"
[dumpfile_mtime] "Sun
Mar 20 18:14:17
2016"
[dumpfile_size]
92262400
[savefile] "/home/
papillon
/openairinterface5g/targets/RT/USER/ue_usrp.gtkw"
[timestart]
300328
30000
[dumpfile_mtime] "Sun
Jul 17 20:46:29
2016"
[dumpfile_size]
10932224
[savefile] "/home/
fourmi
/openairinterface5g/targets/RT/USER/ue_usrp.gtkw"
[timestart]
116969
30000
[size] 1215 640
[pos] 105 102
*-22.292629 30041590000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
...
...
@@ -19,22 +19,25 @@ variables.hw_subframe[63:0]
@28
functions.trx_read
functions.trx_write
functions.ue_thread_synch
functions.ue_thread_rxtx0
@24
variables.subframe_number_RX_UE[63:0]
variables.subframe_number_TX_UE[63:0]
variables.subframe_RX0_UE[63:0]
variables.subframe_TX0_UE[63:0]
variables.frame_number_RX0_UE[63:0]
variables.frame_number_TX0_UE[63:0]
@28
functions.ue_thread_rx
functions.ue_thread_tx
@420
variables.ue_inst_cnt_rx[63:0]
variables.ue_inst_cnt_tx[63:0]
functions.ue_thread_rxtx1
@24
variables.subframe_RX1_UE[63:0]
variables.subframe_TX1_UE[63:0]
@25
variables.frame_number_RX1_UE[63:0]
@24
variables.frame_number_TX1_UE[63:0]
@28
functions.phy_procedures_ue_rx
functions.phy_procedures_ue_tx
@24
variables.frame_number_RX_UE[63:0]
variables.frame_number_TX_UE[63:0]
@28
functions.ue_slot_fep
functions.lte_ue_measurement_procedures
functions.ue_rrc_measurements
...
...
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