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
904a198c
Commit
904a198c
authored
Apr 15, 2019
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clarify decoded frame number
parent
4e580adc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
174 deletions
+108
-174
openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
+18
-56
openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
+1
-1
openair1/PHY/TOOLS/lte_phy_scope.c
openair1/PHY/TOOLS/lte_phy_scope.c
+1
-1
openair1/PHY/defs_UE.h
openair1/PHY/defs_UE.h
+1
-1
openair1/SCHED_UE/phy_procedures_lte_ue.c
openair1/SCHED_UE/phy_procedures_lte_ue.c
+8
-40
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+79
-75
No files found.
openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
View file @
904a198c
...
...
@@ -45,7 +45,7 @@ extern openair0_config_t openair0_cfg[];
//#define DEBUG_INITIAL_SYNCH
int
pbch_detection
(
PHY_VARS_UE
*
ue
,
runmode_t
mode
)
int
pbch_detection
(
PHY_VARS_UE
*
ue
,
UE_rxtx_proc_t
*
proc
,
runmode_t
mode
)
{
uint8_t
l
,
pbch_decoded
,
frame_mod4
,
pbch_tx_ant
,
dummy
;
...
...
@@ -234,23 +234,17 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
break
;
}
for
(
int
i
=
0
;
i
<
RX_NB_TH
;
i
++
)
{
ue
->
proc
.
proc_rxtx
[
i
].
frame_rx
=
(((
ue
->
pbch_vars
[
0
]
->
decoded_output
[
2
]
&
3
)
<<
6
)
+
(
ue
->
pbch_vars
[
0
]
->
decoded_output
[
1
]
>>
2
))
<<
2
;
ue
->
proc
.
proc_rxtx
[
i
].
frame_rx
=
(((
ue
->
pbch_vars
[
0
]
->
decoded_output
[
2
]
&
3
)
<<
6
)
+
(
ue
->
pbch_vars
[
0
]
->
decoded_output
[
1
]
>>
2
))
<<
2
;
proc
->
decoded_frame_rx
=
(((
ue
->
pbch_vars
[
0
]
->
decoded_output
[
2
]
&
3
)
<<
6
)
+
(
ue
->
pbch_vars
[
0
]
->
decoded_output
[
1
]
>>
2
))
<<
2
;
proc
->
frame_rx
=
proc
->
frame_tx
=
proc
->
decoded_frame_rx
;
ue
->
proc
.
proc_rxtx
[
i
].
frame_tx
=
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
;
}
#ifdef DEBUG_INITIAL_SYNCH
LOG_I
(
PHY
,
"[UE%d] Initial sync: pbch decoded sucessfully p %d, tx_ant %d, frame %d, N_RB_DL %d, phich_duration %d, phich_resource %s!
\n
"
,
ue
->
Mod_id
,
frame_parms
->
nb_antenna_ports_eNB
,
pbch_tx_ant
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
proc
->
decoded_
frame_rx
,
frame_parms
->
N_RB_DL
,
frame_parms
->
phich_config_common
.
phich_duration
,
phich_resource
);
//frame_parms->phich_config_common.phich_resource);
#endif
return
(
0
);
}
else
{
return
(
-
1
);
...
...
@@ -262,7 +256,7 @@ char phich_string[13][4] = {"","1/6","","1/2","","","one","","","","","","two"};
char
duplex_string
[
2
][
4
]
=
{
"FDD"
,
"TDD"
};
char
prefix_string
[
2
][
9
]
=
{
"NORMAL"
,
"EXTENDED"
};
int
initial_sync
(
PHY_VARS_UE
*
ue
,
runmode_t
mode
)
int
initial_sync
(
PHY_VARS_UE
*
ue
,
UE_rxtx_proc_t
*
proc
,
runmode_t
mode
)
{
int32_t
sync_pos
,
sync_pos2
,
sync_pos_slot
;
...
...
@@ -324,7 +318,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms
(
&
ue
->
frame_parms
,
1
);
lte_gold
(
frame_parms
,
ue
->
lte_gold_table
[
0
],
frame_parms
->
Nid_cell
);
ret
=
pbch_detection
(
ue
,
mode
);
ret
=
pbch_detection
(
ue
,
proc
,
mode
);
// LOG_M("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
...
...
@@ -371,7 +365,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms
(
&
ue
->
frame_parms
,
1
);
lte_gold
(
frame_parms
,
ue
->
lte_gold_table
[
0
],
frame_parms
->
Nid_cell
);
ret
=
pbch_detection
(
ue
,
mode
);
ret
=
pbch_detection
(
ue
,
proc
,
mode
);
// LOG_M("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I
(
PHY
,
"FDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d
\n
"
,
...
...
@@ -415,7 +409,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms
(
&
ue
->
frame_parms
,
1
);
lte_gold
(
frame_parms
,
ue
->
lte_gold_table
[
0
],
frame_parms
->
Nid_cell
);
ret
=
pbch_detection
(
ue
,
mode
);
ret
=
pbch_detection
(
ue
,
proc
,
mode
);
// LOG_M("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
...
...
@@ -452,7 +446,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms
(
&
ue
->
frame_parms
,
1
);
lte_gold
(
frame_parms
,
ue
->
lte_gold_table
[
0
],
frame_parms
->
Nid_cell
);
ret
=
pbch_detection
(
ue
,
mode
);
ret
=
pbch_detection
(
ue
,
proc
,
mode
);
// LOG_M("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
...
...
@@ -467,11 +461,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
if
(
(
abs
(
ue
->
common_vars
.
freq_offset
)
>
150
)
&&
(
ret
==
0
)
)
{
ret
=-
1
;
#if DISABLE_LOG_X
printf
(
"Ignore MIB with high freq offset [%d Hz] estimation
\n
"
,
ue
->
common_vars
.
freq_offset
);
#else
LOG_E
(
HW
,
"Ignore MIB with high freq offset [%d Hz] estimation
\n
"
,
ue
->
common_vars
.
freq_offset
);
#endif
}
if
(
ret
==
0
)
{
// PBCH found so indicate sync to higher layers and configure frame parameters
...
...
@@ -489,7 +481,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
#if UE_AUTOTEST_TRACE
LOG_I
(
PHY
,
"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
proc
->
frame_rx
,
ue
->
rx_offset
,
ue
->
common_vars
.
freq_offset
);
#endif
...
...
@@ -504,30 +496,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
}
#if DISABLE_LOG_X
printf
(
"[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
10
*
log10
(
ue
->
measurements
.
rssi
)
-
ue
->
rx_total_gain_dB
,
10
*
log10
(
ue
->
measurements
.
rssi
),
ue
->
rx_total_gain_dB
,
ue
->
measurements
.
n0_power_tot_dBm
,
10
*
log10
(
ue
->
measurements
.
rsrp
[
0
])
-
ue
->
rx_total_gain_dB
,
(
10
*
log10
(
ue
->
measurements
.
rsrq
[
0
])));
printf
(
"[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
duplex_string
[
ue
->
frame_parms
.
frame_type
],
prefix_string
[
ue
->
frame_parms
.
Ncp
],
ue
->
frame_parms
.
Nid_cell
,
ue
->
frame_parms
.
N_RB_DL
,
ue
->
frame_parms
.
phich_config_common
.
phich_duration
,
phich_string
[
ue
->
frame_parms
.
phich_config_common
.
phich_resource
],
ue
->
frame_parms
.
nb_antenna_ports_eNB
);
#else
LOG_I
(
PHY
,
"[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
LOG_I
(
PHY
,
"[UE %d] FRAME %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB
\n
"
,
ue
->
Mod_id
,
proc
->
frame_rx
,
10
*
log10
(
ue
->
measurements
.
rssi
)
-
ue
->
rx_total_gain_dB
,
10
*
log10
(
ue
->
measurements
.
rssi
),
ue
->
rx_total_gain_dB
,
...
...
@@ -535,9 +506,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
10
*
log10
(
ue
->
measurements
.
rsrp
[
0
])
-
ue
->
rx_total_gain_dB
,
(
10
*
log10
(
ue
->
measurements
.
rsrq
[
0
])));
LOG_I
(
PHY
,
"[UE %d] F
rame
%d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d
\n
"
,
LOG_I
(
PHY
,
"[UE %d] F
RAME
%d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
proc
->
frame_rx
,
duplex_string
[
ue
->
frame_parms
.
frame_type
],
prefix_string
[
ue
->
frame_parms
.
Ncp
],
ue
->
frame_parms
.
Nid_cell
,
...
...
@@ -545,22 +516,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue
->
frame_parms
.
phich_config_common
.
phich_duration
,
phich_string
[
ue
->
frame_parms
.
phich_config_common
.
phich_resource
],
ue
->
frame_parms
.
nb_antenna_ports_eNB
);
#endif
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
# if DISABLE_LOG_X
printf
(
"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
openair0_cfg
[
0
].
rx_freq
[
0
]
-
ue
->
common_vars
.
freq_offset
,
ue
->
common_vars
.
freq_offset
);
# else
LOG_I
(
PHY
,
"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
proc
->
frame_rx
,
openair0_cfg
[
0
].
rx_freq
[
0
]
-
ue
->
common_vars
.
freq_offset
,
ue
->
common_vars
.
freq_offset
);
# endif
#endif
}
else
{
#ifdef DEBUG_INITIAL_SYNC
...
...
openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
View file @
904a198c
...
...
@@ -1451,7 +1451,7 @@ void generate_RIV_tables(void);
parameters are know, the routine calls some basic initialization routines (cell-specific reference signals, etc.)
@param phy_vars_ue Pointer to UE variables
*/
int
initial_sync
(
PHY_VARS_UE
*
phy_vars_ue
,
runmode_t
mode
);
int
initial_sync
(
PHY_VARS_UE
*
phy_vars_ue
,
UE_rxtx_proc_t
*
proc
,
runmode_t
mode
);
/*!
...
...
openair1/PHY/TOOLS/lte_phy_scope.c
View file @
904a198c
...
...
@@ -508,7 +508,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
float
**
chest_t_abs
;
float
time
[
FRAME_LENGTH_COMPLEX_SAMPLES
];
float
freq
[
nsymb_ce
*
nb_antennas_rx
*
nb_antennas_tx
];
int
frame
=
phy_vars_ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
;
int
frame
=
0
;
//
phy_vars_ue->proc.proc_rxtx[0].frame_rx;
uint32_t
total_dlsch_bitrate
=
phy_vars_ue
->
bitrate
[
eNB_id
];
int
coded_bits_per_codeword
=
0
;
int
mcs
=
0
;
...
...
openair1/PHY/defs_UE.h
View file @
904a198c
...
...
@@ -118,6 +118,7 @@ typedef struct {
int
frame_tx
;
/// frame to act upon for reception
int
frame_rx
;
int
decoded_frame_rx
;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int
instance_cnt_rxtx
;
...
...
@@ -190,7 +191,6 @@ typedef struct {
/// instance count for eNBs
int
instance_cnt_eNBs
;
/// set of scheduling variables RXn-TXnp4 threads
UE_rxtx_proc_t
proc_rxtx
[
RX_NB_TH
];
}
UE_proc_t
;
/// Structure holding timer_thread related elements (phy_stub_UE mode)
...
...
openair1/SCHED_UE/phy_procedures_lte_ue.c
View file @
904a198c
...
...
@@ -2400,48 +2400,15 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
ue
->
UE_mode
[
eNB_id
]
==
NOT_SYNCHED
?
1
:
0
);
}
proc
->
decoded_frame_rx
=
(
proc
->
frame_rx
&
0xFFFFFC00
)
|
(
frame_tx
&
0x000003FF
);
if
(
proc
->
decoded_frame_rx
!=
proc
->
frame_tx
||
proc
->
decoded_frame_rx
!=
proc
->
frame_rx
)
LOG_W
(
PHY
,
"decoded frame: %d, computed rx: %d, tx: %d
\n
"
,
proc
->
decoded_frame_rx
,
proc
->
frame_rx
,
proc
->
frame_tx
);
frame_rx
=
proc
->
frame_tx
=
proc
->
frame_rx
=
proc
->
decoded_frame_rx
;
// if this is the first PBCH after initial synchronization and no timing correction is performed, make L1 state = PRACH
if
(
ue
->
UE_mode
[
eNB_id
]
==
NOT_SYNCHED
&&
ue
->
no_timing_correction
==
1
)
ue
->
UE_mode
[
eNB_id
]
=
PRACH
;
if
(
first_run
)
{
first_run
=
0
;
proc
->
frame_rx
=
(
proc
->
frame_rx
&
0xFFFFFC00
)
|
(
frame_tx
&
0x000003FF
);
proc
->
frame_tx
=
proc
->
frame_rx
;
for
(
int
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
ue
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
=
proc
->
frame_rx
;
ue
->
proc
.
proc_rxtx
[
th_id
].
frame_tx
=
proc
->
frame_tx
;
printf
(
"[UE %d] frame %d, subframe %d: Adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, phase %d, rx_offset %d) => new frame %d
\n
"
,
ue
->
Mod_id
,
ue
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
,
subframe_rx
,
pbch_tx_ant
,
frame_tx
,
pbch_phase
,
ue
->
rx_offset
,
proc
->
frame_rx
);
}
if
(
ue
->
UE_mode
[
eNB_id
]
==
NOT_SYNCHED
&&
ue
->
no_timing_correction
==
1
)
ue
->
UE_mode
[
eNB_id
]
=
PRACH
;
frame_rx
=
proc
->
frame_rx
;
}
else
if
(((
frame_tx
&
0x03FF
)
!=
(
proc
->
frame_rx
&
0x03FF
)))
{
//(pbch_tx_ant != ue->frame_parms.nb_antennas_tx)) {
LOG_D
(
PHY
,
"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%%1024=%d, phase %d).
\n
"
,
ue
->
Mod_id
,
proc
->
frame_rx
,
subframe_rx
,
pbch_tx_ant
,
frame_tx
,
frame_rx
&
0x03FF
,
pbch_phase
);
proc
->
frame_rx
=
(
proc
->
frame_rx
&
0xFFFFFC00
)
|
(
frame_tx
&
0x000003FF
);
proc
->
frame_tx
=
proc
->
frame_rx
;
frame_rx
=
proc
->
frame_rx
;
for
(
int
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
ue
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
=
(
proc
->
frame_rx
&
0xFFFFFC00
)
|
(
frame_tx
&
0x000003FF
);
ue
->
proc
.
proc_rxtx
[
th_id
].
frame_tx
=
proc
->
frame_rx
;
}
}
if
(
LOG_DEBUGFLAG
(
DEBUG_UE_PHYPROC
))
{
LOG_UI
(
PHY
,
"[UE %d] frame %d, subframe %d, Received PBCH (MIB): nb_antenna_ports_eNB %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!
\n
"
,
...
...
@@ -2456,6 +2423,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
ue
->
frame_parms
.
phich_config_common
.
phich_resource
);
}
}
else
{
LOG_W
(
PHY
,
"Failed to decode BCH, frame: %d
\n
"
,
frame_rx
);
if
(
LOG_DUMPFLAG
(
DEBUG_UE_PHYPROC
))
{
LOG_E
(
PHY
,
"[UE %d] frame %d, subframe %d, Error decoding PBCH!
\n
"
,
ue
->
Mod_id
,
frame_rx
,
subframe_rx
);
...
...
targets/RT/USER/lte-ue.c
View file @
904a198c
...
...
@@ -441,10 +441,17 @@ void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_ifa
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
typedef
struct
syncData_s
{
UE_rxtx_proc_t
proc
;
PHY_VARS_UE
*
UE
;
}
syncData_t
;
static
void
*
UE_thread_synch
(
void
*
arg
)
{
struct
rx_tx_thread_data
*
syncD
=
(
struct
rx_tx_thread_data
*
)
arg
;
static
int
UE_thread_synch_retval
;
int
i
;
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
PHY_VARS_UE
*
UE
=
syncD
->
UE
;
int
current_band
=
0
;
int
current_offset
=
0
;
sync_mode_t
sync_mode
=
pbch
;
...
...
@@ -568,7 +575,7 @@ static void *UE_thread_synch(void *arg) {
case
pbch
:
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
if
(
initial_sync
(
UE
,
UE
->
mode
)
==
0
)
{
if
(
initial_sync
(
UE
,
syncD
->
proc
,
UE
->
mode
)
==
0
)
{
LOG_I
(
HW
,
"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d
\n
"
,
(
UE
->
rx_offset
<<
1
)
/
UE
->
frame_parms
.
samples_per_tti
,
freq_offset
,
...
...
@@ -642,31 +649,31 @@ static void *UE_thread_synch(void *arg) {
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
UE
->
is_synchronized
=
1
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
if
(
UE
->
mode
==
rx_dump_frame
)
{
FILE
*
fd
;
if
((
UE
->
proc
.
proc_rxtx
[
0
].
frame_rx
&
1
)
==
0
)
{
// this guarantees SIB1 is present
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
fwrite
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
sizeof
(
int32_t
),
10
*
UE
->
frame_parms
.
samples_per_tti
,
fd
);
LOG_I
(
PHY
,
"Dummping Frame ... bye bye
\n
"
);
fclose
(
fd
);
exit
(
0
);
}
else
{
LOG_E
(
PHY
,
"Cannot open file for writing
\n
"
);
exit
(
0
);
}
}
else
{
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
UE
->
is_synchronized
=
0
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
if
((
syncD
->
proc
->
frame_rx
&
1
)
==
0
)
{
// this guarantees SIB1 is present
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
fwrite
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
sizeof
(
int32_t
),
10
*
UE
->
frame_parms
.
samples_per_tti
,
fd
);
LOG_I
(
PHY
,
"Dummping Frame ... bye bye
\n
"
);
fclose
(
fd
);
exit
(
0
);
}
else
{
LOG_E
(
PHY
,
"Cannot open file for writing
\n
"
);
exit
(
0
);
}
}
else
{
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
UE
->
is_synchronized
=
0
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
}
}
}
}
else
{
}
}
}
else
{
// initial sync failed
// calculate new offset and try again
if
(
UE
->
UE_scan_carrier
==
1
)
{
...
...
@@ -954,7 +961,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
if
(
rtd
==
NULL
)
{
LOG_E
(
MAC
,
"[SCHED][UE] rx_tx_thread_data *rtd: NULL pointer
\n
"
);
exit_fun
(
"nothing to add"
);
}
}
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
// settings for nfapi-L2-emulator mode
...
...
@@ -965,7 +972,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
PHY_VARS_UE
*
UE
=
NULL
;
int
ret
;
uint8_t
end_flag
;
proc
=
&
PHY_vars_UE_g
[
0
][
0
]
->
proc
.
proc_rxtx
[
0
]
;
proc
=
rtd
->
proc
;
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
UE
=
rtd
->
UE
;
...
...
@@ -1481,6 +1488,8 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
}
struct
rx_tx_thread_data
syncData
[
NUMBER_OF_UE_MAX
];
struct
rx_tx_thread_data
procs
[
RX_NB_TH
];
/*!
* \brief This is the main UE thread.
...
...
@@ -1500,8 +1509,8 @@ void *UE_thread(void *arg) {
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
int
start_rx_stream
=
0
;
int
i
;
int
th_id
;
static
uint8_t
thread_idx
=
0
;
uint8_t
thread_idx
=
0
;
int
current_frame_rx
=-
1
;
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
...
...
@@ -1609,9 +1618,7 @@ void *UE_thread(void *arg) {
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++;
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
UE
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
++
;
}
current_frame_rx
=
syncData
[
0
].
proc
->
decoded_frame_rx
+
1
;
// read in first symbol
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
==
...
...
@@ -1625,9 +1632,9 @@ void *UE_thread(void *arg) {
else
rt_sleep_ns
(
1000
*
1000
);
}
else
{
sub_frame
++
;
sub_frame
%=
10
;
UE_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
thread_idx
]
;
sub_frame
=
(
sub_frame
+
1
)
%
10
;
thread_idx
=
sub_frame
%
RX_NB_TH
;
UE_rxtx_proc_t
*
proc
=
procs
[
thread_idx
].
proc
;
// update thread index for received subframe
UE
->
current_thread_id
[
sub_frame
]
=
thread_idx
;
...
...
@@ -1635,7 +1642,7 @@ void *UE_thread(void *arg) {
int
t
;
for
(
t
=
0
;
t
<
2
;
t
++
)
{
UE_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
t
]
;
UE_rxtx_proc_t
*
proc
=
procs
[
t
].
proc
;
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
);
while
(
proc
->
instance_cnt_rxtx
>=
0
)
pthread_cond_wait
(
&
proc
->
cond_rxtx
,
&
proc
->
mutex_rxtx
);
...
...
@@ -1646,10 +1653,6 @@ void *UE_thread(void *arg) {
}
LOG_D
(
PHY
,
"Process Subframe %d thread Idx %d
\n
"
,
sub_frame
,
UE
->
current_thread_id
[
sub_frame
]);
thread_idx
++
;
if
(
thread_idx
>=
RX_NB_TH
)
thread_idx
=
0
;
if
(
UE
->
mode
!=
loop_through_memory
)
{
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
...
...
@@ -1741,21 +1744,16 @@ void *UE_thread(void *arg) {
}
}
//usleep(3000);
if
(
sub_frame
==
0
)
{
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++;
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
UE
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
++
;
}
}
//UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs);
//UE->proc.proc_rxtx[1].gotIQs=readTime(gotIQs);
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
UE
->
proc
.
proc_rxtx
[
th_id
].
gotIQs
=
readTime
(
gotIQs
);
for
(
int
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
procs
[
th_id
].
proc
->
gotIQs
=
readTime
(
gotIQs
);
if
(
procs
[
th_id
].
proc
->
decoded_frame_rx
>
current_frame_rx
)
current_frame_rx
=
procs
[
th_id
].
proc
->
decoded_frame_rx
;
procs
[
th_id
].
proc
->
decoded_frame_rx
=-
1
;
}
proc
->
frame_rx
=
current_frame_rx
;
proc
->
subframe_rx
=
sub_frame
;
proc
->
subframe_tx
=
(
sub_frame
+
4
)
%
10
;
proc
->
frame_tx
=
proc
->
frame_rx
+
(
proc
->
subframe_rx
>
5
?
1
:
0
);
...
...
@@ -1794,6 +1792,7 @@ void *UE_thread(void *arg) {
* - UE_thread_dlsch_proc_slot1
* and the locking between them.
*/
void
init_UE_threads
(
int
inst
)
{
struct
rx_tx_thread_data
*
rtd
;
PHY_VARS_UE
*
UE
;
...
...
@@ -1814,16 +1813,18 @@ void init_UE_threads(int inst) {
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
if
(
rtd
==
NULL
)
abort
();
procs
[
i
].
UE
=
UE
;
procs
[
i
].
proc
=
calloc
(
sizeof
(
*
procs
[
i
].
proc
),
1
);
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_rxtx
,
NULL
);
UE
->
proc
.
proc_rxtx
[
i
].
instance_cnt_rxtx
=
-
1
;
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
=
i
;
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_step
=
nb_threads
;
printf
(
"Init_UE_threads rtd %d proc %d nb_threads %d i %d
\n
"
,
rtd
->
proc
->
sub_frame_start
,
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
,
nb_threads
,
i
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_thread_rxn_txnp4
,
rtd
);
rtd
->
proc
=
procs
[
i
].
proc
;
pthread_mutex_init
(
&
procs
[
i
].
proc
->
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
procs
[
i
].
proc
->
cond_rxtx
,
NULL
);
procs
[
i
].
proc
->
instance_cnt_rxtx
=
-
1
;
procs
[
i
].
proc
->
sub_frame_start
=
i
;
procs
[
i
].
proc
->
sub_frame_step
=
nb_threads
;
pthread_create
(
&
procs
[
i
].
proc
->
pthread_rxtx
,
NULL
,
UE_thread_rxn_txnp4
,
rtd
);
#ifdef UE_SLOT_PARALLELISATION
//pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot0_dl_processing,NULL);
//pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot0_dl_processing,NULL);
...
...
@@ -1833,8 +1834,10 @@ void init_UE_threads(int inst) {
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_slot1_dl_processing
,
NULL
,
UE_thread_slot1_dl_processing
,
rtd
);
#endif
}
pthread_create
(
&
UE
->
proc
.
pthread_synch
,
NULL
,
UE_thread_synch
,(
void
*
)
UE
);
syncData
[
inst
].
UE
=
UE
;
syncData
[
inst
].
proc
=
calloc
(
sizeof
(
*
syncData
[
inst
].
proc
),
1
);
pthread_create
(
&
UE
->
proc
.
pthread_synch
,
NULL
,
UE_thread_synch
,(
void
*
)
&
syncData
[
inst
]);
}
...
...
@@ -1886,16 +1889,16 @@ void init_UE_single_thread_stub(int nb_inst) {
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
if
(
rtd
==
NULL
)
abort
();
procs
[
i
].
proc
=
calloc
(
sizeof
(
*
procs
[
i
].
proc
),
1
);
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
]
;
rtd
->
proc
=
procs
[
i
].
proc
;
rtd
->
ue_thread_id
=
ue_thread_id
;
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_rxtx
,
NULL
);
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
=
i
;
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_step
=
nb_threads
;
printf
(
"Init_UE_threads rtd %d proc %d nb_threads %d i %d
\n
"
,
rtd
->
proc
->
sub_frame_start
,
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
,
nb_threads
,
i
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_phy_stub_single_thread_rxn_txnp4
,
rtd
);
pthread_mutex_init
(
&
rtd
->
proc
->
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
rtd
->
proc
->
cond_rxtx
,
NULL
);
rtd
->
proc
->
sub_frame_start
=
i
;
rtd
->
proc
->
sub_frame_step
=
nb_threads
;
pthread_create
(
&
rtd
->
proc
->
pthread_rxtx
,
NULL
,
UE_phy_stub_single_thread_rxn_txnp4
,
rtd
);
}
}
...
...
@@ -1940,13 +1943,14 @@ void init_UE_threads_stub(int inst) {
if
(
rtd
==
NULL
)
abort
();
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_rxtx
,
NULL
);
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
=
i
;
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_step
=
nb_threads
;
printf
(
"Init_UE_threads rtd %d proc %d nb_threads %d i %d
\n
"
,
rtd
->
proc
->
sub_frame_start
,
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
,
nb_threads
,
i
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_phy_stub_thread_rxn_txnp4
,
rtd
);
procs
[
i
].
proc
=
calloc
(
sizeof
(
*
procs
[
i
].
proc
),
1
);
rtd
->
proc
=
procs
[
i
].
proc
;
pthread_mutex_init
(
&
rtd
->
proc
->
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
rtd
->
proc
->
cond_rxtx
,
NULL
);
rtd
->
proc
->
sub_frame_start
=
i
;
rtd
->
proc
->
sub_frame_step
=
nb_threads
;
pthread_create
(
&
rtd
->
proc
->
pthread_rxtx
,
NULL
,
UE_phy_stub_thread_rxn_txnp4
,
rtd
);
}
// Remove thread for UE_sync in phy_stub_UE mode.
...
...
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