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
常顺宇
OpenXG-RAN
Commits
753c2f44
Commit
753c2f44
authored
Mar 10, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply astyle, fix compilation warnings in raw aeth transport and kernel modules
parent
49f4bdc2
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1612 additions
and
1738 deletions
+1612
-1738
openair1/PHY/INIT/lte_param_init.c
openair1/PHY/INIT/lte_param_init.c
+22
-44
openair1/PHY/LTE_TRANSPORT/dci.c
openair1/PHY/LTE_TRANSPORT/dci.c
+85
-151
openair1/PHY/LTE_TRANSPORT/pss.c
openair1/PHY/LTE_TRANSPORT/pss.c
+20
-27
openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
+0
-1
openair1/SIMULATION/LTE_PHY/dlsim.c
openair1/SIMULATION/LTE_PHY/dlsim.c
+9
-7
openair1/SIMULATION/LTE_PHY/ulsim.c
openair1/SIMULATION/LTE_PHY/ulsim.c
+0
-2
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+136
-135
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+9
-12
openair2/LAYER2/RLC/rlc.c
openair2/LAYER2/RLC/rlc.c
+0
-2
openair2/NETWORK_DRIVER/MESH/constant.h
openair2/NETWORK_DRIVER/MESH/constant.h
+2
-1
openair2/NETWORK_DRIVER/MESH/ioctl.h
openair2/NETWORK_DRIVER/MESH/ioctl.h
+2
-1
openair2/RRC/LTE/rrc_UE.c
openair2/RRC/LTE/rrc_UE.c
+27
-29
openair2/RRC/LTE/rrc_eNB.c
openair2/RRC/LTE/rrc_eNB.c
+2
-0
openair2/RRC/NAS/nas_config.c
openair2/RRC/NAS/nas_config.c
+65
-88
openair2/RRC/NAS/nas_config.h
openair2/RRC/NAS/nas_config.h
+13
-6
targets/ARCH/COMMON/common_lib.c
targets/ARCH/COMMON/common_lib.c
+78
-70
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+53
-53
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
+13
-25
targets/RT/USER/lte-ru.c
targets/RT/USER/lte-ru.c
+5
-6
targets/RT/USER/lte-softmodem-common.c
targets/RT/USER/lte-softmodem-common.c
+3
-1
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+3
-1
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+1063
-1074
targets/RT/USER/lte-uesoftmodem.c
targets/RT/USER/lte-uesoftmodem.c
+2
-2
No files found.
openair1/PHY/INIT/lte_param_init.c
View file @
753c2f44
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
extern
PHY_VARS_eNB
*
eNB
;
extern
PHY_VARS_eNB
*
eNB
;
extern
PHY_VARS_UE
*
UE
;
extern
PHY_VARS_UE
*
UE
;
extern
RU_t
*
ru
;
extern
RU_t
*
ru
;
extern
void
phy_init_RU
(
RU_t
*
);
extern
void
phy_init_RU
(
RU_t
*
);
void
lte_param_init
(
PHY_VARS_eNB
**
eNBp
,
void
lte_param_init
(
PHY_VARS_eNB
**
eNBp
,
PHY_VARS_UE
**
UEp
,
PHY_VARS_UE
**
UEp
,
...
@@ -55,9 +55,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -55,9 +55,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
uint8_t
pa
,
uint8_t
pa
,
uint8_t
threequarter_fs
,
uint8_t
threequarter_fs
,
uint8_t
osf
,
uint8_t
osf
,
uint32_t
perfect_ce
)
uint32_t
perfect_ce
)
{
{
LTE_DL_FRAME_PARMS
*
frame_parms
;
LTE_DL_FRAME_PARMS
*
frame_parms
;
int
i
;
int
i
;
PHY_VARS_eNB
*
eNB
;
PHY_VARS_eNB
*
eNB
;
...
@@ -71,23 +69,16 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -71,23 +69,16 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
UE
=
*
UEp
;
UE
=
*
UEp
;
ru
=
*
rup
;
ru
=
*
rup
;
printf
(
"eNB %p, UE %p, ru %p
\n
"
,
eNB
,
UE
,
ru
);
printf
(
"eNB %p, UE %p, ru %p
\n
"
,
eNB
,
UE
,
ru
);
memset
((
void
*
)
eNB
,
0
,
sizeof
(
PHY_VARS_eNB
));
memset
((
void
*
)
UE
,
0
,
sizeof
(
PHY_VARS_UE
));
memset
((
void
*
)
ru
,
0
,
sizeof
(
RU_t
));
memset
((
void
*
)
eNB
,
0
,
sizeof
(
PHY_VARS_eNB
));
memset
((
void
*
)
UE
,
0
,
sizeof
(
PHY_VARS_UE
));
memset
((
void
*
)
ru
,
0
,
sizeof
(
RU_t
));
ru
->
eNB_list
[
0
]
=
eNB
;
ru
->
eNB_list
[
0
]
=
eNB
;
eNB
->
RU_list
[
0
]
=
ru
;
eNB
->
RU_list
[
0
]
=
ru
;
ru
->
num_eNB
=
1
;
ru
->
num_eNB
=
1
;
srand
(
0
);
srand
(
0
);
randominit
(
0
);
randominit
(
0
);
set_taus_seed
(
0
);
set_taus_seed
(
0
);
frame_parms
=
&
(
eNB
->
frame_parms
);
frame_parms
=
&
(
eNB
->
frame_parms
);
frame_parms
->
N_RB_DL
=
N_RB_DL
;
//50 for 10MHz and 25 for 5 MHz
frame_parms
->
N_RB_DL
=
N_RB_DL
;
//50 for 10MHz and 25 for 5 MHz
frame_parms
->
N_RB_UL
=
N_RB_DL
;
frame_parms
->
N_RB_UL
=
N_RB_DL
;
frame_parms
->
threequarter_fs
=
threequarter_fs
;
frame_parms
->
threequarter_fs
=
threequarter_fs
;
...
@@ -106,13 +97,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -106,13 +97,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
// frame_parms->Bsrs = 0;
// frame_parms->Bsrs = 0;
// frame_parms->kTC = 0;44
// frame_parms->kTC = 0;44
// frame_parms->n_RRC = 0;
// frame_parms->n_RRC = 0;
init_frame_parms
(
frame_parms
,
osf
);
init_frame_parms
(
frame_parms
,
osf
);
//copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
//copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
// phy_init_top(frame_parms); //allocation
// phy_init_top(frame_parms); //allocation
UE
->
is_secondary_ue
=
0
;
UE
->
is_secondary_ue
=
0
;
UE
->
frame_parms
=
*
frame_parms
;
UE
->
frame_parms
=
*
frame_parms
;
UE
->
frame_parms
.
nb_antennas_rx
=
N_rx_ue
;
UE
->
frame_parms
.
nb_antennas_rx
=
N_rx_ue
;
...
@@ -121,14 +108,10 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -121,14 +108,10 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
ru
->
nb_tx
=
N_tx_phy
;
ru
->
nb_tx
=
N_tx_phy
;
ru
->
nb_rx
=
N_rx_ru
;
ru
->
nb_rx
=
N_rx_ru
;
ru
->
if_south
=
LOCAL_RF
;
ru
->
if_south
=
LOCAL_RF
;
eNB
->
configured
=
1
;
eNB
->
configured
=
1
;
eNB
->
transmission_mode
[
0
]
=
transmission_mode
;
eNB
->
transmission_mode
[
0
]
=
transmission_mode
;
UE
->
transmission_mode
[
0
]
=
transmission_mode
;
UE
->
transmission_mode
[
0
]
=
transmission_mode
;
dump_frame_parms
(
frame_parms
);
dump_frame_parms
(
frame_parms
);
UE
->
measurements
.
n_adj_cells
=
0
;
UE
->
measurements
.
n_adj_cells
=
0
;
UE
->
measurements
.
adj_cell_id
[
0
]
=
Nid_cell
+
1
;
UE
->
measurements
.
adj_cell_id
[
0
]
=
Nid_cell
+
1
;
UE
->
measurements
.
adj_cell_id
[
1
]
=
Nid_cell
+
2
;
UE
->
measurements
.
adj_cell_id
[
1
]
=
Nid_cell
+
2
;
...
@@ -144,7 +127,6 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -144,7 +127,6 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
phy_init_RU
(
ru
);
phy_init_RU
(
ru
);
generate_pcfich_reg_mapping
(
&
UE
->
frame_parms
);
generate_pcfich_reg_mapping
(
&
UE
->
frame_parms
);
generate_phich_reg_mapping
(
&
UE
->
frame_parms
);
generate_phich_reg_mapping
(
&
UE
->
frame_parms
);
// DL power control init
// DL power control init
//if (transmission_mode == 1) {
//if (transmission_mode == 1) {
UE
->
pdsch_config_dedicated
->
p_a
=
pa
;
UE
->
pdsch_config_dedicated
->
p_a
=
pa
;
...
@@ -166,8 +148,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -166,8 +148,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
if
(
eNB
->
frame_parms
.
N_RB_DL
==
100
)
ru
->
N_TA_offset
=
624
;
if
(
eNB
->
frame_parms
.
N_RB_DL
==
100
)
ru
->
N_TA_offset
=
624
;
else
if
(
eNB
->
frame_parms
.
N_RB_DL
==
50
)
ru
->
N_TA_offset
=
624
/
2
;
else
if
(
eNB
->
frame_parms
.
N_RB_DL
==
50
)
ru
->
N_TA_offset
=
624
/
2
;
else
if
(
eNB
->
frame_parms
.
N_RB_DL
==
25
)
ru
->
N_TA_offset
=
624
/
4
;
else
if
(
eNB
->
frame_parms
.
N_RB_DL
==
25
)
ru
->
N_TA_offset
=
624
/
4
;
}
}
else
ru
->
N_TA_offset
=
0
;
else
ru
->
N_TA_offset
=
0
;
if
(
IS_SOFTMODEM_BASICSIM
)
if
(
IS_SOFTMODEM_BASICSIM
)
/* this is required for the basic simulator in TDD mode
/* this is required for the basic simulator in TDD mode
...
@@ -175,8 +156,5 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
...
@@ -175,8 +156,5 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
*/
*/
UE
->
N_TA_offset
=
0
;
UE
->
N_TA_offset
=
0
;
printf
(
"Done lte_param_init
\n
"
);
printf
(
"Done lte_param_init
\n
"
);
}
}
openair1/PHY/LTE_TRANSPORT/dci.c
View file @
753c2f44
...
@@ -64,35 +64,26 @@ void dci_encoding(uint8_t *a,
...
@@ -64,35 +64,26 @@ void dci_encoding(uint8_t *a,
uint8_t
A
,
uint8_t
A
,
uint16_t
E
,
uint16_t
E
,
uint8_t
*
e
,
uint8_t
*
e
,
uint16_t
rnti
)
uint16_t
rnti
)
{
{
uint8_t
D
=
(
A
+
16
);
uint8_t
D
=
(
A
+
16
);
uint32_t
RCC
;
uint32_t
RCC
;
uint8_t
d
[
3
*
(
MAX_DCI_SIZE_BITS
+
16
)
+
96
];
uint8_t
d
[
3
*
(
MAX_DCI_SIZE_BITS
+
16
)
+
96
];
uint8_t
w
[
3
*
3
*
(
MAX_DCI_SIZE_BITS
+
16
)];
uint8_t
w
[
3
*
3
*
(
MAX_DCI_SIZE_BITS
+
16
)];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
int32_t
i
;
int32_t
i
;
#endif
#endif
// encode dci
// encode dci
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
"Doing DCI encoding for %d bits, e %p, rnti %x, E %d
\n
"
,
A
,
e
,
rnti
,
E
);
printf
(
"Doing DCI encoding for %d bits, e %p, rnti %x, E %d
\n
"
,
A
,
e
,
rnti
,
E
);
#endif
#endif
memset
((
void
*
)
d
,
LTE_NULL
,
96
);
memset
((
void
*
)
d
,
LTE_NULL
,
96
);
ccodelte_encode
(
A
,
2
,
a
,
d
+
96
,
rnti
);
ccodelte_encode
(
A
,
2
,
a
,
d
+
96
,
rnti
);
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
for
(
i
=
0
;
i
<
16
+
A
;
i
++
)
for
(
i
=
0
;
i
<
16
+
A
;
i
++
)
printf
(
"%d : (%d,%d,%d)
\n
"
,
i
,
*
(
d
+
96
+
(
3
*
i
)),
*
(
d
+
97
+
(
3
*
i
)),
*
(
d
+
98
+
(
3
*
i
)));
printf
(
"%d : (%d,%d,%d)
\n
"
,
i
,
*
(
d
+
96
+
(
3
*
i
)),
*
(
d
+
97
+
(
3
*
i
)),
*
(
d
+
98
+
(
3
*
i
)));
#endif
#endif
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
"Doing DCI interleaving for %d coded bits, e %p
\n
"
,
D
*
3
,
e
);
printf
(
"Doing DCI interleaving for %d coded bits, e %p
\n
"
,
D
*
3
,
e
);
#endif
#endif
...
@@ -100,11 +91,9 @@ void dci_encoding(uint8_t *a,
...
@@ -100,11 +91,9 @@ void dci_encoding(uint8_t *a,
//#ifdef DEBUG_DCI_ENCODING
//#ifdef DEBUG_DCI_ENCODING
if
(
E
>
1000
)
printf
(
"Doing DCI rate matching for %d channel bits, RCC %d, e %p
\n
"
,
E
,
RCC
,
e
);
if
(
E
>
1000
)
printf
(
"Doing DCI rate matching for %d channel bits, RCC %d, e %p
\n
"
,
E
,
RCC
,
e
);
//#endif
//#endif
lte_rate_matching_cc
(
RCC
,
E
,
w
,
e
);
lte_rate_matching_cc
(
RCC
,
E
,
w
,
e
);
}
}
...
@@ -112,15 +101,14 @@ uint8_t *generate_dci0(uint8_t *dci,
...
@@ -112,15 +101,14 @@ uint8_t *generate_dci0(uint8_t *dci,
uint8_t
*
e
,
uint8_t
*
e
,
uint8_t
DCI_LENGTH
,
uint8_t
DCI_LENGTH
,
uint16_t
coded_bits
,
uint16_t
coded_bits
,
uint16_t
rnti
)
uint16_t
rnti
)
{
{
uint8_t
dci_flip
[
8
];
uint8_t
dci_flip
[
8
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
for
(
int
i
=
0
;
i
<
1
+
((
DCI_LENGTH
+
16
)
/
8
);
i
++
)
for
(
int
i
=
0
;
i
<
1
+
((
DCI_LENGTH
+
16
)
/
8
);
i
++
)
printf
(
"i %d : %x
\n
"
,
i
,
dci
[
i
]);
printf
(
"i %d : %x
\n
"
,
i
,
dci
[
i
]);
#endif
#endif
if
(
DCI_LENGTH
<=
32
)
{
if
(
DCI_LENGTH
<=
32
)
{
dci_flip
[
0
]
=
dci
[
3
];
dci_flip
[
0
]
=
dci
[
3
];
...
@@ -130,7 +118,6 @@ uint8_t *generate_dci0(uint8_t *dci,
...
@@ -130,7 +118,6 @@ uint8_t *generate_dci0(uint8_t *dci,
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
"DCI => %x,%x,%x,%x
\n
"
,
printf
(
"DCI => %x,%x,%x,%x
\n
"
,
dci_flip
[
0
],
dci_flip
[
1
],
dci_flip
[
2
],
dci_flip
[
3
]);
dci_flip
[
0
],
dci_flip
[
1
],
dci_flip
[
2
],
dci_flip
[
3
]);
#endif
#endif
}
else
{
}
else
{
dci_flip
[
0
]
=
dci
[
7
];
dci_flip
[
0
]
=
dci
[
7
];
...
@@ -149,7 +136,6 @@ uint8_t *generate_dci0(uint8_t *dci,
...
@@ -149,7 +136,6 @@ uint8_t *generate_dci0(uint8_t *dci,
}
}
dci_encoding
(
dci_flip
,
DCI_LENGTH
,
coded_bits
,
e
,
rnti
);
dci_encoding
(
dci_flip
,
DCI_LENGTH
,
coded_bits
,
e
,
rnti
);
return
(
e
+
coded_bits
);
return
(
e
+
coded_bits
);
}
}
...
@@ -160,9 +146,7 @@ uint8_t *generate_dci0(uint8_t *dci,
...
@@ -160,9 +146,7 @@ uint8_t *generate_dci0(uint8_t *dci,
void
pdcch_interleaving
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
int32_t
**
z
,
int32_t
**
wbar
,
uint8_t
n_symbols_pdcch
,
uint8_t
mi
)
void
pdcch_interleaving
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
int32_t
**
z
,
int32_t
**
wbar
,
uint8_t
n_symbols_pdcch
,
uint8_t
mi
)
{
{
int32_t
*
wptr
,
*
wptr2
,
*
zptr
;
int32_t
*
wptr
,
*
wptr2
,
*
zptr
;
uint32_t
Mquad
=
get_nquad
(
n_symbols_pdcch
,
frame_parms
,
mi
);
uint32_t
Mquad
=
get_nquad
(
n_symbols_pdcch
,
frame_parms
,
mi
);
uint32_t
RCC
=
(
Mquad
>>
5
),
ND
;
uint32_t
RCC
=
(
Mquad
>>
5
),
ND
;
...
@@ -180,7 +164,6 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
...
@@ -180,7 +164,6 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
Kpi
=
(
RCC
<<
5
);
Kpi
=
(
RCC
<<
5
);
ND
=
Kpi
-
Mquad
;
ND
=
Kpi
-
Mquad
;
k
=
0
;
k
=
0
;
for
(
col
=
0
;
col
<
32
;
col
++
)
{
for
(
col
=
0
;
col
<
32
;
col
++
)
{
...
@@ -191,12 +174,9 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
...
@@ -191,12 +174,9 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
if
(
index
>=
ND
)
{
if
(
index
>=
ND
)
{
for
(
a
=
0
;
a
<
frame_parms
->
nb_antenna_ports_eNB
;
a
++
)
{
for
(
a
=
0
;
a
<
frame_parms
->
nb_antenna_ports_eNB
;
a
++
)
{
//printf("a %d k %d\n",a,k);
//printf("a %d k %d\n",a,k);
wptr
=
&
wtemp
[
a
][
k
<<
2
];
wptr
=
&
wtemp
[
a
][
k
<<
2
];
zptr
=
&
z
[
a
][(
index
-
ND
)
<<
2
];
zptr
=
&
z
[
a
][(
index
-
ND
)
<<
2
];
//printf("wptr=%p, zptr=%p\n",wptr,zptr);
//printf("wptr=%p, zptr=%p\n",wptr,zptr);
wptr
[
0
]
=
zptr
[
0
];
wptr
[
0
]
=
zptr
[
0
];
wptr
[
1
]
=
zptr
[
1
];
wptr
[
1
]
=
zptr
[
1
];
wptr
[
2
]
=
zptr
[
2
];
wptr
[
2
]
=
zptr
[
2
];
...
@@ -212,9 +192,7 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
...
@@ -212,9 +192,7 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
// permutation
// permutation
for
(
i
=
0
;
i
<
Mquad
;
i
++
)
{
for
(
i
=
0
;
i
<
Mquad
;
i
++
)
{
for
(
a
=
0
;
a
<
frame_parms
->
nb_antenna_ports_eNB
;
a
++
)
{
for
(
a
=
0
;
a
<
frame_parms
->
nb_antenna_ports_eNB
;
a
++
)
{
//wptr = &wtemp[a][i<<2];
//wptr = &wtemp[a][i<<2];
//wptr2 = &wbar[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
//wptr2 = &wbar[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
wptr
=
&
wtemp
[
a
][((
i
+
frame_parms
->
Nid_cell
)
%
Mquad
)
<<
2
];
wptr
=
&
wtemp
[
a
][((
i
+
frame_parms
->
Nid_cell
)
%
Mquad
)
<<
2
];
...
@@ -230,17 +208,13 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
...
@@ -230,17 +208,13 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
void
pdcch_scrambling
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
void
pdcch_scrambling
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
subframe
,
uint8_t
subframe
,
uint8_t
*
e
,
uint8_t
*
e
,
uint32_t
length
)
uint32_t
length
)
{
{
int
i
;
int
i
;
uint8_t
reset
;
uint8_t
reset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint32_t
x1
,
x2
,
s
=
0
;
//LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
//LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
reset
=
1
;
reset
=
1
;
// x1 is set in lte_gold_generic
// x1 is set in lte_gold_generic
x2
=
(
subframe
<<
9
)
+
frame_parms
->
Nid_cell
;
//this is c_init in 36.211 Sec 6.8.2
x2
=
(
subframe
<<
9
)
+
frame_parms
->
Nid_cell
;
//this is c_init in 36.211 Sec 6.8.2
for
(
i
=
0
;
i
<
length
;
i
++
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
...
@@ -263,10 +237,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -263,10 +237,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
int16_t
amp
,
int16_t
amp
,
LTE_DL_FRAME_PARMS
*
frame_parms
,
LTE_DL_FRAME_PARMS
*
frame_parms
,
int32_t
**
txdataF
,
int32_t
**
txdataF
,
uint32_t
subframe
)
uint32_t
subframe
)
{
{
uint8_t
*
e_ptr
;
uint8_t
*
e_ptr
;
int8_t
L
;
int8_t
L
;
uint32_t
i
,
lprime
;
uint32_t
i
,
lprime
;
...
@@ -276,12 +247,9 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -276,12 +247,9 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
uint8_t
e
[
DCI_BITS_MAX
];
uint8_t
e
[
DCI_BITS_MAX
];
uint32_t
Msymb
=
(
DCI_BITS_MAX
/
2
);
uint32_t
Msymb
=
(
DCI_BITS_MAX
/
2
);
int32_t
yseq0
[
Msymb
],
yseq1
[
Msymb
],
wbar0
[
Msymb
],
wbar1
[
Msymb
];
int32_t
yseq0
[
Msymb
],
yseq1
[
Msymb
],
wbar0
[
Msymb
],
wbar1
[
Msymb
];
int32_t
*
y
[
2
];
int32_t
*
y
[
2
];
int32_t
*
wbar
[
2
];
int32_t
*
wbar
[
2
];
int
nushiftmod3
=
frame_parms
->
nushift
%
3
;
int
nushiftmod3
=
frame_parms
->
nushift
%
3
;
int
Msymb2
;
int
Msymb2
;
int
split_flag
=
0
;
int
split_flag
=
0
;
...
@@ -315,7 +283,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -315,7 +283,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
break
;
break
;
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH
,
1
);
generate_pcfich
(
num_pdcch_symbols
,
generate_pcfich
(
num_pdcch_symbols
,
amp
,
amp
,
...
@@ -328,12 +295,12 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -328,12 +295,12 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
y
[
0
]
=
&
yseq0
[
0
];
y
[
0
]
=
&
yseq0
[
0
];
y
[
1
]
=
&
yseq1
[
0
];
y
[
1
]
=
&
yseq1
[
0
];
if
(
IS_SOFTMODEM_BASICSIM
){
if
(
IS_SOFTMODEM_BASICSIM
)
{
/* this should be the normal case
/* this should be the normal case
* but it has to be validated for all the various cases
* but it has to be validated for all the various cases
* so let's just do it for the basic simulator
* so let's just do it for the basic simulator
*/
*/
// memset(e, 2, DCI_BITS_MAX);
// memset(e, 2, DCI_BITS_MAX);
}
else
{
}
else
{
// reset all bits to <NIL>, here we set <NIL> elements as 2
// reset all bits to <NIL>, here we set <NIL> elements as 2
// memset(e, 2, DCI_BITS_MAX);
// memset(e, 2, DCI_BITS_MAX);
...
@@ -341,7 +308,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -341,7 +308,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
for
(
i
=
0
;
i
<
DCI_BITS_MAX
;
i
++
)
for
(
i
=
0
;
i
<
DCI_BITS_MAX
;
i
++
)
e
[
i
]
=
taus
()
&
1
;
e
[
i
]
=
taus
()
&
1
;
/* clear all bits, the above code may generate too much false detections
/* clear all bits, the above code may generate too much false detections
* (not sure about this, to be checked somehow)
* (not sure about this, to be checked somehow)
*/
*/
...
@@ -349,19 +315,16 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -349,19 +315,16 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
}
/* BASIC_SIMULATOR */
}
/* BASIC_SIMULATOR */
e_ptr
=
e
;
e_ptr
=
e
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0
,
1
);
// generate DCIs in order of decreasing aggregation level, then common/ue spec
// generate DCIs in order of decreasing aggregation level, then common/ue spec
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
for
(
L
=
8
;
L
>=
1
;
L
>>=
1
)
{
for
(
L
=
8
;
L
>=
1
;
L
>>=
1
)
{
for
(
i
=
0
;
i
<
num_dci
;
i
++
)
{
for
(
i
=
0
;
i
<
num_dci
;
i
++
)
{
if
(
dci_alloc
[
i
].
L
==
(
uint8_t
)
L
)
{
if
(
dci_alloc
[
i
].
L
==
(
uint8_t
)
L
)
{
LOG_D
(
PHY
,
"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x
\n
"
,
LOG_D
(
PHY
,
"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x
\n
"
,
i
,
num_dci
,
dci_alloc
[
i
].
firstCCE
,
dci_alloc
[
i
].
dci_length
,
dci_alloc
[
i
].
L
,
i
,
num_dci
,
dci_alloc
[
i
].
firstCCE
,
dci_alloc
[
i
].
dci_length
,
dci_alloc
[
i
].
L
,
*
(
unsigned
int
*
)
dci_alloc
[
i
].
dci_pdu
,
*
(
unsigned
int
*
)
dci_alloc
[
i
].
dci_pdu
,
dci_alloc
[
i
].
rnti
);
dci_alloc
[
i
].
rnti
);
if
(
dci_alloc
[
i
].
firstCCE
>=
0
)
{
if
(
dci_alloc
[
i
].
firstCCE
>=
0
)
{
...
@@ -374,14 +337,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -374,14 +337,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
}
}
}
}
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0
,
0
);
// Scrambling
// Scrambling
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
"pdcch scrambling
\n
"
);
printf
(
"pdcch scrambling
\n
"
);
#endif
#endif
//LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
//LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING
,
1
);
pdcch_scrambling
(
frame_parms
,
pdcch_scrambling
(
frame_parms
,
subframe
,
subframe
,
...
@@ -389,11 +351,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -389,11 +351,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
8
*
get_nquad
(
num_pdcch_symbols
,
frame_parms
,
mi
));
8
*
get_nquad
(
num_pdcch_symbols
,
frame_parms
,
mi
));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING
,
0
);
//72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
//72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION
,
1
);
// Now do modulation
// Now do modulation
if
(
frame_parms
->
nb_antenna_ports_eNB
==
1
)
if
(
frame_parms
->
nb_antenna_ports_eNB
==
1
)
gain_lin_QPSK
=
(
int16_t
)((
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
);
gain_lin_QPSK
=
(
int16_t
)((
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
);
...
@@ -401,7 +360,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -401,7 +360,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
gain_lin_QPSK
=
amp
/
2
;
gain_lin_QPSK
=
amp
/
2
;
e_ptr
=
e
;
e_ptr
=
e
;
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d
\n
"
,
Msymb
,
Msymb2
,
gain_lin_QPSK
);
printf
(
" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d
\n
"
,
Msymb
,
Msymb2
,
gain_lin_QPSK
);
#endif
#endif
...
@@ -409,68 +367,54 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -409,68 +367,54 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
//LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
//LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
if
(
frame_parms
->
nb_antenna_ports_eNB
==
1
)
{
//SISO
if
(
frame_parms
->
nb_antenna_ports_eNB
==
1
)
{
//SISO
for
(
i
=
0
;
i
<
Msymb2
;
i
++
)
{
for
(
i
=
0
;
i
<
Msymb2
;
i
++
)
{
//((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
((
int16_t
*
)(
&
(
y
[
0
][
i
])))[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)(
&
(
y
[
0
][
i
])))[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)(
&
(
y
[
1
][
i
])))[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)(
&
(
y
[
1
][
i
])))[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
e_ptr
++
;
e_ptr
++
;
//((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
((
int16_t
*
)(
&
(
y
[
0
][
i
])))[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)(
&
(
y
[
0
][
i
])))[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)(
&
(
y
[
1
][
i
])))[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)(
&
(
y
[
1
][
i
])))[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
e_ptr
++
;
e_ptr
++
;
}
}
}
else
{
//ALAMOUTI
}
else
{
//ALAMOUTI
for
(
i
=
0
;
i
<
Msymb2
;
i
+=
2
)
{
for
(
i
=
0
;
i
<
Msymb2
;
i
+=
2
)
{
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH Modulation (TX diversity): REG %d
\n
"
,
i
>>
2
);
printf
(
" PDCCH Modulation (TX diversity): REG %d
\n
"
,
i
>>
2
);
#endif
#endif
// first antenna position n -> x0
// first antenna position n -> x0
((
int16_t
*
)
&
y
[
0
][
i
])[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)
&
y
[
0
][
i
])[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
e_ptr
++
;
e_ptr
++
;
((
int16_t
*
)
&
y
[
0
][
i
])[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)
&
y
[
0
][
i
])[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
e_ptr
++
;
e_ptr
++
;
// second antenna position n -> -x1*
// second antenna position n -> -x1*
((
int16_t
*
)
&
y
[
1
][
i
])[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
gain_lin_QPSK
:
-
gain_lin_QPSK
;
((
int16_t
*
)
&
y
[
1
][
i
])[
0
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
gain_lin_QPSK
:
-
gain_lin_QPSK
;
e_ptr
++
;
e_ptr
++
;
((
int16_t
*
)
&
y
[
1
][
i
])[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
((
int16_t
*
)
&
y
[
1
][
i
])[
1
]
=
(
*
e_ptr
==
2
)
?
0
:
(
*
e_ptr
==
1
)
?
-
gain_lin_QPSK
:
gain_lin_QPSK
;
e_ptr
++
;
e_ptr
++
;
// fill in the rest of the ALAMOUTI precoding
// fill in the rest of the ALAMOUTI precoding
((
int16_t
*
)
&
y
[
0
][
i
+
1
])[
0
]
=
-
((
int16_t
*
)
&
y
[
1
][
i
])[
0
];
((
int16_t
*
)
&
y
[
0
][
i
+
1
])[
0
]
=
-
((
int16_t
*
)
&
y
[
1
][
i
])[
0
];
((
int16_t
*
)
&
y
[
0
][
i
+
1
])[
1
]
=
((
int16_t
*
)
&
y
[
1
][
i
])[
1
];
((
int16_t
*
)
&
y
[
0
][
i
+
1
])[
1
]
=
((
int16_t
*
)
&
y
[
1
][
i
])[
1
];
((
int16_t
*
)
&
y
[
1
][
i
+
1
])[
0
]
=
((
int16_t
*
)
&
y
[
0
][
i
])[
0
];
((
int16_t
*
)
&
y
[
1
][
i
+
1
])[
0
]
=
((
int16_t
*
)
&
y
[
0
][
i
])[
0
];
((
int16_t
*
)
&
y
[
1
][
i
+
1
])[
1
]
=
-
((
int16_t
*
)
&
y
[
0
][
i
])[
1
];
((
int16_t
*
)
&
y
[
1
][
i
+
1
])[
1
]
=
-
((
int16_t
*
)
&
y
[
0
][
i
])[
1
];
}
}
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION
,
0
);
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH Interleaving
\n
"
);
printf
(
" PDCCH Interleaving
\n
"
);
#endif
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING
,
1
);
// printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
// printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
// This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
// This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
pdcch_interleaving
(
frame_parms
,
&
y
[
0
],
&
wbar
[
0
],
num_pdcch_symbols
,
mi
);
pdcch_interleaving
(
frame_parms
,
&
y
[
0
],
&
wbar
[
0
],
num_pdcch_symbols
,
mi
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX
,
1
);
mprime
=
0
;
mprime
=
0
;
nsymb
=
(
frame_parms
->
Ncp
==
0
)
?
14
:
12
;
nsymb
=
(
frame_parms
->
Ncp
==
0
)
?
14
:
12
;
re_offset
=
frame_parms
->
first_carrier_offset
;
re_offset
=
frame_parms
->
first_carrier_offset
;
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
...
@@ -485,15 +429,11 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -485,15 +429,11 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
frame_parms
->
nb_antenna_ports_eNB
frame_parms
->
nb_antenna_ports_eNB
);
);
#endif
#endif
for
(
kprime
=
0
;
kprime
<
frame_parms
->
N_RB_DL
*
12
;
kprime
++
)
{
for
(
kprime
=
0
;
kprime
<
frame_parms
->
N_RB_DL
*
12
;
kprime
++
)
{
for
(
lprime
=
0
;
lprime
<
num_pdcch_symbols
;
lprime
++
)
{
for
(
lprime
=
0
;
lprime
<
num_pdcch_symbols
;
lprime
++
)
{
symbol_offset
=
(
uint32_t
)
frame_parms
->
ofdm_symbol_size
*
(
lprime
+
(
subframe
*
nsymb
));
symbol_offset
=
(
uint32_t
)
frame_parms
->
ofdm_symbol_size
*
(
lprime
+
(
subframe
*
nsymb
));
tti_offset
=
symbol_offset
+
re_offset
;
tti_offset
=
symbol_offset
+
re_offset
;
(
re_offset
==
(
frame_parms
->
ofdm_symbol_size
-
2
))
?
(
split_flag
=
1
)
:
(
split_flag
=
0
);
(
re_offset
==
(
frame_parms
->
ofdm_symbol_size
-
2
))
?
(
split_flag
=
1
)
:
(
split_flag
=
0
);
// printf("kprime %d, lprime %d => REG %d (symbol %d)\n",kprime,lprime,(lprime==0)?(kprime/6) : (kprime>>2),symbol_offset);
// printf("kprime %d, lprime %d => REG %d (symbol %d)\n",kprime,lprime,(lprime==0)?(kprime/6) : (kprime>>2),symbol_offset);
...
@@ -504,16 +444,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -504,16 +444,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
#endif
#endif
}
else
{
}
else
{
// Copy REG to TX buffer
// Copy REG to TX buffer
if
((
lprime
==
0
)
||
if
((
lprime
==
0
)
||
((
lprime
==
1
)
&&
(
frame_parms
->
nb_antenna_ports_eNB
==
4
)))
{
((
lprime
==
1
)
&&
(
frame_parms
->
nb_antenna_ports_eNB
==
4
)))
{
// first symbol, or second symbol+4 TX antennas skip pilots
// first symbol, or second symbol+4 TX antennas skip pilots
kprime_mod12
=
kprime
%
12
;
kprime_mod12
=
kprime
%
12
;
if
((
kprime_mod12
==
0
)
||
(
kprime_mod12
==
6
))
{
if
((
kprime_mod12
==
0
)
||
(
kprime_mod12
==
6
))
{
// kprime represents REG
// kprime represents REG
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
if
((
i
!=
(
nushiftmod3
))
&&
(
i
!=
(
nushiftmod3
+
3
)))
{
if
((
i
!=
(
nushiftmod3
))
&&
(
i
!=
(
nushiftmod3
+
3
)))
{
txdataF
[
0
][
tti_offset
+
i
]
=
wbar
[
0
][
mprime
];
txdataF
[
0
][
tti_offset
+
i
]
=
wbar
[
0
][
mprime
];
...
@@ -522,9 +459,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -522,9 +459,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
txdataF
[
1
][
tti_offset
+
i
]
=
wbar
[
1
][
mprime
];
txdataF
[
1
][
tti_offset
+
i
]
=
wbar
[
1
][
mprime
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
+
i
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
+
i
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
#endif
#endif
mprime
++
;
mprime
++
;
}
}
}
}
...
@@ -542,7 +478,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -542,7 +478,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
txdataF
[
1
][
tti_offset
+
i
]
=
wbar
[
1
][
mprime
];
txdataF
[
1
][
tti_offset
+
i
]
=
wbar
[
1
][
mprime
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
LOG_I
(
PHY
,
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
+
i
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
LOG_I
(
PHY
,
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
+
i
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
#endif
#endif
mprime
++
;
mprime
++
;
}
}
...
@@ -553,7 +489,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -553,7 +489,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
txdataF
[
1
][
tti_offset
+
0
]
=
wbar
[
1
][
mprime
];
txdataF
[
1
][
tti_offset
+
0
]
=
wbar
[
1
][
mprime
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
#endif
#endif
mprime
++
;
mprime
++
;
txdataF
[
0
][
tti_offset
+
1
]
=
wbar
[
0
][
mprime
];
txdataF
[
0
][
tti_offset
+
1
]
=
wbar
[
0
][
mprime
];
...
@@ -562,7 +498,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -562,7 +498,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
txdataF
[
1
][
tti_offset
+
1
]
=
wbar
[
1
][
mprime
];
txdataF
[
1
][
tti_offset
+
1
]
=
wbar
[
1
][
mprime
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
"PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
+
1
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
printf
(
"PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
+
1
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
#endif
#endif
mprime
++
;
mprime
++
;
txdataF
[
0
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
3
]
=
wbar
[
0
][
mprime
];
txdataF
[
0
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
3
]
=
wbar
[
0
][
mprime
];
...
@@ -571,8 +507,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -571,8 +507,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
txdataF
[
1
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
3
]
=
wbar
[
1
][
mprime
];
txdataF
[
1
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
3
]
=
wbar
[
1
][
mprime
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
-
frame_parms
->
ofdm_symbol_size
+
3
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
-
frame_parms
->
ofdm_symbol_size
+
3
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
#endif
#endif
mprime
++
;
mprime
++
;
txdataF
[
0
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
4
]
=
wbar
[
0
][
mprime
];
txdataF
[
0
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
4
]
=
wbar
[
0
][
mprime
];
...
@@ -581,11 +517,10 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -581,11 +517,10 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
txdataF
[
1
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
4
]
=
wbar
[
1
][
mprime
];
txdataF
[
1
][
tti_offset
-
frame_parms
->
ofdm_symbol_size
+
4
]
=
wbar
[
1
][
mprime
];
#ifdef DEBUG_DCI_ENCODING
#ifdef DEBUG_DCI_ENCODING
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
-
frame_parms
->
ofdm_symbol_size
+
4
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
printf
(
" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)
\n
"
,
mprime
,
tti_offset
,
symbol_offset
,
re_offset
-
frame_parms
->
ofdm_symbol_size
+
4
,
*
(
short
*
)
&
wbar
[
0
][
mprime
],
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
*
(
1
+
(
short
*
)
&
wbar
[
0
][
mprime
]));
#endif
#endif
mprime
++
;
mprime
++
;
}
}
}
}
}
}
...
@@ -593,7 +528,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -593,7 +528,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
if
(
mprime
>=
Msymb2
)
if
(
mprime
>=
Msymb2
)
return
(
num_pdcch_symbols
);
return
(
num_pdcch_symbols
);
}
// check_phich_reg
}
// check_phich_reg
}
//lprime loop
}
//lprime loop
re_offset
++
;
re_offset
++
;
...
@@ -601,8 +535,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
...
@@ -601,8 +535,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
if
(
re_offset
==
(
frame_parms
->
ofdm_symbol_size
))
if
(
re_offset
==
(
frame_parms
->
ofdm_symbol_size
))
re_offset
=
1
;
re_offset
=
1
;
}
// kprime loop
}
// kprime loop
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX
,
0
);
return
(
num_pdcch_symbols
);
return
(
num_pdcch_symbols
);
}
}
...
...
openair1/PHY/LTE_TRANSPORT/pss.c
View file @
753c2f44
...
@@ -44,15 +44,11 @@ int generate_pss(int32_t **txdataF,
...
@@ -44,15 +44,11 @@ int generate_pss(int32_t **txdataF,
short
amp
,
short
amp
,
LTE_DL_FRAME_PARMS
*
frame_parms
,
LTE_DL_FRAME_PARMS
*
frame_parms
,
unsigned
short
symbol
,
unsigned
short
symbol
,
unsigned
short
slot_offset
)
unsigned
short
slot_offset
)
{
{
unsigned
int
Nsymb
;
unsigned
int
Nsymb
;
unsigned
short
k
,
m
,
aa
,
a
;
unsigned
short
k
,
m
,
aa
,
a
;
uint8_t
Nid2
;
uint8_t
Nid2
;
short
*
primary_sync
;
short
*
primary_sync
;
Nid2
=
frame_parms
->
Nid_cell
%
3
;
Nid2
=
frame_parms
->
Nid_cell
%
3
;
switch
(
Nid2
)
{
switch
(
Nid2
)
{
...
@@ -84,26 +80,23 @@ int generate_pss(int32_t **txdataF,
...
@@ -84,26 +80,23 @@ int generate_pss(int32_t **txdataF,
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antenna_ports_eNB
;
aa
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antenna_ports_eNB
;
aa
++
)
{
// aa = 0;
// aa = 0;
// The PSS occupies the inner 6 RBs, which start at
// The PSS occupies the inner 6 RBs, which start at
k
=
frame_parms
->
ofdm_symbol_size
-
3
*
12
+
5
;
k
=
frame_parms
->
ofdm_symbol_size
-
3
*
12
+
5
;
//printf("[PSS] k = %d\n",k);
//printf("[PSS] k = %d\n",k);
for
(
m
=
5
;
m
<
67
;
m
++
)
{
for
(
m
=
5
;
m
<
67
;
m
++
)
{
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)]
=
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)]
=
(
a
*
primary_sync
[
2
*
m
])
>>
15
;
(
a
*
primary_sync
[
2
*
m
])
>>
15
;
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)
+
1
]
=
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)
+
1
]
=
(
a
*
primary_sync
[
2
*
m
+
1
])
>>
15
;
(
a
*
primary_sync
[
2
*
m
+
1
])
>>
15
;
k
+=
1
;
k
+=
1
;
if
(
k
>=
frame_parms
->
ofdm_symbol_size
)
{
if
(
k
>=
frame_parms
->
ofdm_symbol_size
)
{
k
++
;
//skip DC
k
++
;
//skip DC
k
-=
frame_parms
->
ofdm_symbol_size
;
k
-=
frame_parms
->
ofdm_symbol_size
;
}
}
}
}
}
}
...
...
openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
View file @
753c2f44
...
@@ -63,7 +63,6 @@ struct msghdr nas_msg_rx;
...
@@ -63,7 +63,6 @@ struct msghdr nas_msg_rx;
#define GRAAL_NETLINK_ID 31
#define GRAAL_NETLINK_ID 31
static
int
tun_alloc
(
char
*
dev
)
{
static
int
tun_alloc
(
char
*
dev
)
{
struct
ifreq
ifr
;
struct
ifreq
ifr
;
int
fd
,
err
;
int
fd
,
err
;
...
...
openair1/SIMULATION/LTE_PHY/dlsim.c
View file @
753c2f44
...
@@ -783,12 +783,14 @@ int main(int argc, char **argv) {
...
@@ -783,12 +783,14 @@ int main(int argc, char **argv) {
case
'u'
:
case
'u'
:
dual_stream_UE
=
1
;
dual_stream_UE
=
1
;
if
(
UE
!=
NULL
)
if
(
UE
!=
NULL
)
UE
->
use_ia_receiver
=
1
;
UE
->
use_ia_receiver
=
1
;
else
{
else
{
printf
(
"UE is NULL
\n
"
);
printf
(
"UE is NULL
\n
"
);
exit
(
-
1
);
exit
(
-
1
);
}
}
if
((
n_tx_port
!=
2
)
||
(
transmission_mode
!=
5
))
{
if
((
n_tx_port
!=
2
)
||
(
transmission_mode
!=
5
))
{
printf
(
"IA receiver only supported for TM5!"
);
printf
(
"IA receiver only supported for TM5!"
);
exit
(
-
1
);
exit
(
-
1
);
...
...
openair1/SIMULATION/LTE_PHY/ulsim.c
View file @
753c2f44
...
@@ -1211,9 +1211,7 @@ int main(int argc, char **argv) {
...
@@ -1211,9 +1211,7 @@ int main(int argc, char **argv) {
}
}
dump_ulsch
(
eNB
,
eNB
->
proc
.
frame_rx
,
subframe
,
0
,
round
);
dump_ulsch
(
eNB
,
eNB
->
proc
.
frame_rx
,
subframe
,
0
,
round
);
round
=
5
;
round
=
5
;
}
}
if
(
n_frames
==
1
)
printf
(
"round %d errors %u/%u
\n
"
,
round
,
errs
[
round
],
trials
);
if
(
n_frames
==
1
)
printf
(
"round %d errors %u/%u
\n
"
,
round
,
errs
[
round
],
trials
);
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
View file @
753c2f44
...
@@ -440,7 +440,6 @@ pdcp_data_ind(
...
@@ -440,7 +440,6 @@ pdcp_data_ind(
uint32_t
rx_hfn_for_count
;
uint32_t
rx_hfn_for_count
;
int
pdcp_sn_for_count
;
int
pdcp_sn_for_count
;
int
security_ok
;
int
security_ok
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND
,
VCD_FUNCTION_IN
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND
,
VCD_FUNCTION_IN
);
LOG_DUMPMSG
(
PDCP
,
DEBUG_PDCP
,(
char
*
)
sdu_buffer_pP
->
data
,
sdu_buffer_sizeP
,
LOG_DUMPMSG
(
PDCP
,
DEBUG_PDCP
,(
char
*
)
sdu_buffer_pP
->
data
,
sdu_buffer_sizeP
,
"[MSG] PDCP UL %s PDU on rb_id %d
\n
"
,
(
srb_flagP
)
?
"CONTROL"
:
"DATA"
,
rb_idP
);
"[MSG] PDCP UL %s PDU on rb_id %d
\n
"
,
(
srb_flagP
)
?
"CONTROL"
:
"DATA"
,
rb_idP
);
...
@@ -567,6 +566,7 @@ pdcp_data_ind(
...
@@ -567,6 +566,7 @@ pdcp_data_ind(
}
}
#if 0
#if 0
/* Removed by Cedric */
/* Removed by Cedric */
if (pdcp_is_rx_seq_number_valid(sequence_number, pdcp_p, srb_flagP) == TRUE) {
if (pdcp_is_rx_seq_number_valid(sequence_number, pdcp_p, srb_flagP) == TRUE) {
LOG_T(PDCP, "Incoming PDU has a sequence number (%d) in accordance with RX window\n", sequence_number);
LOG_T(PDCP, "Incoming PDU has a sequence number (%d) in accordance with RX window\n", sequence_number);
...
@@ -588,6 +588,7 @@ pdcp_data_ind(
...
@@ -588,6 +588,7 @@ pdcp_data_ind(
free_mem_block(sdu_buffer_pP, __func__);
free_mem_block(sdu_buffer_pP, __func__);
return FALSE;
return FALSE;
}
}
#endif
#endif
// SRB1/2: control-plane data
// SRB1/2: control-plane data
...
@@ -698,26 +699,23 @@ pdcp_data_ind(
...
@@ -698,26 +699,23 @@ pdcp_data_ind(
free_mem_block
(
sdu_buffer_pP
,
__func__
);
free_mem_block
(
sdu_buffer_pP
,
__func__
);
/* TODO: indicate integrity verification failure to upper layer */
/* TODO: indicate integrity verification failure to upper layer */
return
FALSE
;
return
FALSE
;
}
else
if
(
pdcp_p
->
next_pdcp_rx_sn
-
sequence_number
>
reordering_window
)
{
}
else
if
(
pdcp_p
->
next_pdcp_rx_sn
-
sequence_number
>
reordering_window
)
{
pdcp_p
->
rx_hfn
++
;
pdcp_p
->
rx_hfn
++
;
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_p
->
next_pdcp_rx_sn
=
sequence_number
+
1
;
pdcp_p
->
next_pdcp_rx_sn
=
sequence_number
+
1
;
}
else
if
(
sequence_number
-
pdcp_p
->
next_pdcp_rx_sn
>=
reordering_window
)
{
}
else
if
(
sequence_number
-
pdcp_p
->
next_pdcp_rx_sn
>=
reordering_window
)
{
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
-
1
;
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
-
1
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_sn_for_count
=
sequence_number
;
}
else
if
(
sequence_number
>=
pdcp_p
->
next_pdcp_rx_sn
)
{
}
else
if
(
sequence_number
>=
pdcp_p
->
next_pdcp_rx_sn
)
{
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_p
->
next_pdcp_rx_sn
=
sequence_number
+
1
;
pdcp_p
->
next_pdcp_rx_sn
=
sequence_number
+
1
;
if
(
pdcp_p
->
next_pdcp_rx_sn
>
pdcp_p
->
maximum_pdcp_rx_sn
)
{
if
(
pdcp_p
->
next_pdcp_rx_sn
>
pdcp_p
->
maximum_pdcp_rx_sn
)
{
pdcp_p
->
next_pdcp_rx_sn
=
0
;
pdcp_p
->
next_pdcp_rx_sn
=
0
;
pdcp_p
->
rx_hfn
++
;
pdcp_p
->
rx_hfn
++
;
}
}
}
else
{
/* sequence_number < pdcp_p->next_pdcp_rx_sn */
}
else
{
/* sequence_number < pdcp_p->next_pdcp_rx_sn */
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_sn_for_count
=
sequence_number
;
...
@@ -770,20 +768,21 @@ pdcp_data_ind(
...
@@ -770,20 +768,21 @@ pdcp_data_ind(
* TODO: we also have to deal with re-establishment PDU (control PDUs)
* TODO: we also have to deal with re-establishment PDU (control PDUs)
* that contain no SDU.
* that contain no SDU.
*/
*/
pdcp_p
->
last_submitted_pdcp_rx_sn
=
sequence_number
;
pdcp_p
->
last_submitted_pdcp_rx_sn
=
sequence_number
;
break
;
break
;
}
/* case RLC_MODE_AM */
}
/* case RLC_MODE_AM */
case
RLC_MODE_UM
:
case
RLC_MODE_UM
:
/* process as described in 36.323 5.1.2.1.3 */
/* process as described in 36.323 5.1.2.1.3 */
if
(
sequence_number
<
pdcp_p
->
next_pdcp_rx_sn
)
{
if
(
sequence_number
<
pdcp_p
->
next_pdcp_rx_sn
)
{
pdcp_p
->
rx_hfn
++
;
pdcp_p
->
rx_hfn
++
;
}
}
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
rx_hfn_for_count
=
pdcp_p
->
rx_hfn
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_sn_for_count
=
sequence_number
;
pdcp_p
->
next_pdcp_rx_sn
=
sequence_number
+
1
;
pdcp_p
->
next_pdcp_rx_sn
=
sequence_number
+
1
;
if
(
pdcp_p
->
next_pdcp_rx_sn
>
pdcp_p
->
maximum_pdcp_rx_sn
)
{
if
(
pdcp_p
->
next_pdcp_rx_sn
>
pdcp_p
->
maximum_pdcp_rx_sn
)
{
pdcp_p
->
next_pdcp_rx_sn
=
0
;
pdcp_p
->
next_pdcp_rx_sn
=
0
;
pdcp_p
->
rx_hfn
++
;
pdcp_p
->
rx_hfn
++
;
...
@@ -1145,7 +1144,7 @@ pdcp_run (
...
@@ -1145,7 +1144,7 @@ pdcp_run (
}
while
(
msg_p
!=
NULL
);
}
while
(
msg_p
!=
NULL
);
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
// if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) {
// if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) {
if
(
!
EPC_MODE_ENABLED
||
ctxt_pP
->
enb_flag
==
ENB_FLAG_NO
)
{
if
(
!
EPC_MODE_ENABLED
||
ctxt_pP
->
enb_flag
==
ENB_FLAG_NO
)
{
pdcp_fifo_read_input_sdus
(
ctxt_pP
);
pdcp_fifo_read_input_sdus
(
ctxt_pP
);
}
}
...
@@ -2042,6 +2041,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
...
@@ -2042,6 +2041,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
((
PDCP_USE_NETLINK
)
?
"usenetlink"
:
""
));
((
PDCP_USE_NETLINK
)
?
"usenetlink"
:
""
));
if
(
PDCP_USE_NETLINK
)
{
if
(
PDCP_USE_NETLINK
)
{
nas_getparams
();
if
(
UE_NAS_USE_TUN
)
{
if
(
UE_NAS_USE_TUN
)
{
netlink_init_tun
(
"ue"
);
netlink_init_tun
(
"ue"
);
LOG_I
(
PDCP
,
"UE pdcp will use tun interface
\n
"
);
LOG_I
(
PDCP
,
"UE pdcp will use tun interface
\n
"
);
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
View file @
753c2f44
...
@@ -146,7 +146,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
...
@@ -146,7 +146,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
int
pdcp_fifo_read_input_sdus
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
{
int
pdcp_fifo_read_input_sdus
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
{
pdcp_data_req_header_t
pdcp_read_header_g
;
pdcp_data_req_header_t
pdcp_read_header_g
;
if
(
UE_NAS_USE_TUN
||
ENB_NAS_USE_TUN
)
{
if
(
UE_NAS_USE_TUN
||
ENB_NAS_USE_TUN
)
{
protocol_ctxt_t
ctxt
=
*
ctxt_pP
;
protocol_ctxt_t
ctxt
=
*
ctxt_pP
;
hash_key_t
key
=
HASHTABLE_NOT_A_KEY_VALUE
;
hash_key_t
key
=
HASHTABLE_NOT_A_KEY_VALUE
;
...
@@ -163,7 +162,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
...
@@ -163,7 +162,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
if
(
len
<=
0
)
continue
;
if
(
len
<=
0
)
continue
;
if
(
UE_NAS_USE_TUN
)
{
if
(
UE_NAS_USE_TUN
)
{
key
=
PDCP_COLL_KEY_DEFAULT_DRB_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
key
=
PDCP_COLL_KEY_DEFAULT_DRB_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
...
@@ -174,11 +172,10 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
...
@@ -174,11 +172,10 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
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_YES
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
}
}
LOG_D
(
PDCP
,
"PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)
\n
"
,
LOG_D
(
PDCP
,
"PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)
\n
"
,
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
if
(
h_rc
==
HASH_TABLE_OK
)
{
if
(
h_rc
==
HASH_TABLE_OK
)
{
LOG_D
(
PDCP
,
"[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d
\n
"
,
LOG_D
(
PDCP
,
"[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d
\n
"
,
ctxt
.
frame
,
ctxt
.
instance
,
len
,
rab_id
);
ctxt
.
frame
,
ctxt
.
instance
,
len
,
rab_id
);
...
...
openair2/LAYER2/RLC/rlc.c
View file @
753c2f44
...
@@ -584,14 +584,12 @@ void rlc_data_ind (
...
@@ -584,14 +584,12 @@ void rlc_data_ind (
const
sdu_size_t
sdu_sizeP
,
const
sdu_size_t
sdu_sizeP
,
mem_block_t
*
sdu_pP
)
{
mem_block_t
*
sdu_pP
)
{
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
LOG_D
(
RLC
,
PROTOCOL_CTXT_FMT
"[%s %u] Display of rlc_data_ind: size %u
\n
"
,
LOG_D
(
RLC
,
PROTOCOL_CTXT_FMT
"[%s %u] Display of rlc_data_ind: size %u
\n
"
,
PROTOCOL_CTXT_ARGS
(
ctxt_pP
),
PROTOCOL_CTXT_ARGS
(
ctxt_pP
),
(
srb_flagP
)
?
"SRB"
:
"DRB"
,
(
srb_flagP
)
?
"SRB"
:
"DRB"
,
rb_idP
,
rb_idP
,
sdu_sizeP
);
sdu_sizeP
);
rlc_util_print_hex_octets
(
RLC
,
(
unsigned
char
*
)
sdu_pP
->
data
,
sdu_sizeP
);
rlc_util_print_hex_octets
(
RLC
,
(
unsigned
char
*
)
sdu_pP
->
data
,
sdu_sizeP
);
#if T_TRACER
#if T_TRACER
if
(
ctxt_pP
->
enb_flag
)
if
(
ctxt_pP
->
enb_flag
)
...
...
openair2/NETWORK_DRIVER/MESH/constant.h
View file @
753c2f44
...
@@ -47,7 +47,8 @@
...
@@ -47,7 +47,8 @@
#define NAS_INET6_ADDRSTRLEN 46
#define NAS_INET6_ADDRSTRLEN 46
#define NAS_INET_ADDRSTRLEN 16
#define NAS_INET_ADDRSTRLEN 16
#define NAS_CX_MAX 128 // 32 //Identical to RRC constant
#define NAS_CX_MAX 32 //128 //Identical to RRC constant: no you cannot
/* increase to 128 without risking stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
//#define NAS_CX_MULTICAST_ALLNODE 2
//#define NAS_CX_MULTICAST_ALLNODE 2
#define NAS_RETRY_LIMIT_DEFAULT 5
#define NAS_RETRY_LIMIT_DEFAULT 5
...
...
openair2/NETWORK_DRIVER/MESH/ioctl.h
View file @
753c2f44
...
@@ -64,7 +64,8 @@
...
@@ -64,7 +64,8 @@
// Max number of entry of a message list
// Max number of entry of a message list
#define NAS_LIST_CX_MAX 32
#define NAS_LIST_CX_MAX 32
#define NAS_LIST_RB_MAX 32
#define NAS_LIST_RB_MAX 32
#define NAS_LIST_CLASS_MAX 32
#define NAS_LIST_CLASS_MAX 16 // 32 is too high!!:
/* risk of stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
typedef
unsigned
short
nasMsgType_t
;
typedef
unsigned
short
nasMsgType_t
;
...
...
openair2/RRC/LTE/rrc_UE.c
View file @
753c2f44
...
@@ -801,7 +801,6 @@ rrc_ue_establish_drb(
...
@@ -801,7 +801,6 @@ rrc_ue_establish_drb(
(
void
)
ip_addr_offset4
;
(
void
)
ip_addr_offset4
;
LOG_I
(
RRC
,
"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d
\n
"
,
LOG_I
(
RRC
,
"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d
\n
"
,
ue_mod_idP
,
frameP
,
DRB_config
->
drb_Identity
,
(
int
)
*
DRB_config
->
logicalChannelIdentity
);
ue_mod_idP
,
frameP
,
DRB_config
->
drb_Identity
,
(
int
)
*
DRB_config
->
logicalChannelIdentity
);
/*
/*
rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD,
rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD,
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity, UNDEF_SECURITY_MODE);
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity, UNDEF_SECURITY_MODE);
...
@@ -810,8 +809,8 @@ rrc_ue_establish_drb(
...
@@ -810,8 +809,8 @@ rrc_ue_establish_drb(
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,
RADIO_ACCESS_BEARER,Rlc_info_um);
RADIO_ACCESS_BEARER,Rlc_info_um);
*/
*/
// if(!EPC_MODE_ENABLED) {
// if(!EPC_MODE_ENABLED) {
//# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
//# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
ip_addr_offset3
=
0
;
ip_addr_offset3
=
0
;
ip_addr_offset4
=
1
;
ip_addr_offset4
=
1
;
LOG_I
(
OIP
,
"[UE %d] trying to bring up the OAI interface oip%d, IP 10.0.%d.%d
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
LOG_I
(
OIP
,
"[UE %d] trying to bring up the OAI interface oip%d, IP 10.0.%d.%d
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
...
@@ -836,9 +835,8 @@ rrc_ue_establish_drb(
...
@@ -836,9 +835,8 @@ rrc_ue_establish_drb(
LOG_D
(
RRC
,
"[UE %d] State = Attached (eNB %d)
\n
"
,
ue_mod_idP
,
eNB_index
);
LOG_D
(
RRC
,
"[UE %d] State = Attached (eNB %d)
\n
"
,
ue_mod_idP
,
eNB_index
);
}
}
//# endif
//# endif
// }
// }
return
(
0
);
return
(
0
);
}
}
...
...
openair2/RRC/LTE/rrc_eNB.c
View file @
753c2f44
...
@@ -6269,6 +6269,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
...
@@ -6269,6 +6269,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
LOG_D
(
RRC
,
LOG_D
(
RRC
,
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active
\n
"
,
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
(
int
)
DRB_configList
->
list
.
array
[
i
]
->
drb_Identity
);
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
(
int
)
DRB_configList
->
list
.
array
[
i
]
->
drb_Identity
);
if
(
!
EPC_MODE_ENABLED
&&
!
ENB_NAS_USE_TUN
)
{
if
(
!
EPC_MODE_ENABLED
&&
!
ENB_NAS_USE_TUN
)
{
LOG_I
(
OIP
,
"[eNB %d] trying to bring up the OAI interface oai%d
\n
"
,
LOG_I
(
OIP
,
"[eNB %d] trying to bring up the OAI interface oai%d
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
...
@@ -6278,6 +6279,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
...
@@ -6278,6 +6279,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
ctxt_pP
->
module_id
+
1
,
// thrid octet
ctxt_pP
->
module_id
+
1
,
// thrid octet
ctxt_pP
->
module_id
+
1
,
// fourth octet
ctxt_pP
->
module_id
+
1
,
// fourth octet
"oai"
);
"oai"
);
if
(
oip_ifup
==
0
)
{
// interface is up --> send a config the DRB
if
(
oip_ifup
==
0
)
{
// interface is up --> send a config the DRB
module_id_t
ue_module_id
;
module_id_t
ue_module_id
;
dest_ip_offset
=
8
;
dest_ip_offset
=
8
;
...
...
openair2/RRC/NAS/nas_config.c
View file @
753c2f44
...
@@ -45,47 +45,55 @@
...
@@ -45,47 +45,55 @@
#include "nas_config.h"
#include "nas_config.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "common/config/config_userapi.h"
//default values according to the examples,
//default values according to the examples,
char
*
baseNetAddress
=
"10.0"
;
char
*
baseNetAddress
;
char
*
netMask
=
"255.255.255.0"
;
char
*
netMask
;
char
*
broadcastAddr
=
"10.0.255.255"
;
char
*
broadcastAddr
;
#define NASHLP_NETPREFIX "<NAS network prefix, two first bytes of network addresses>\n"
#define NASHLP_NETMASK "<NAS network mask>\n"
#define NASHLP_BROADCASTADDR "<NAS network broadcast address>\n"
void
nas_getparams
(
void
)
{
paramdef_t
nasoptions
[]
=
{
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* configuration parameters for netlink, includes network parameters when running in noS1 mode */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
{
"NetworkPrefix"
,
NASHLP_NETPREFIX
,
0
,
strptr
:&
baseNetAddress
,
defstrval
:
"10.0"
,
TYPE_STRING
,
0
},
{
"NetworkMask"
,
NASHLP_NETMASK
,
0
,
strptr
:&
netMask
,
defstrval
:
"255.255.255.0"
,
TYPE_STRING
,
0
},
{
"BroadcastAddr"
,
NASHLP_BROADCASTADDR
,
0
,
strptr
:&
broadcastAddr
,
defstrval
:
"10.0.255.255"
,
TYPE_STRING
,
0
},
};
config_get
(
nasoptions
,
sizeof
(
nasoptions
)
/
sizeof
(
paramdef_t
),
"nas.noS1"
);
}
void
setBaseNetAddress
(
char
*
baseAddr
)
void
setBaseNetAddress
(
char
*
baseAddr
)
{
{
strcpy
(
baseNetAddress
,
baseAddr
);
strcpy
(
baseNetAddress
,
baseAddr
);
}
}
char
*
getBaseNetAddress
(
void
)
char
*
getBaseNetAddress
(
void
)
{
{
return
baseNetAddress
;
return
baseNetAddress
;
}
}
void
setNetMask
(
char
*
baseAddr
)
void
setNetMask
(
char
*
baseAddr
)
{
{
strcpy
(
netMask
,
baseAddr
);
strcpy
(
netMask
,
baseAddr
);
}
}
char
*
getNetMask
(
void
)
char
*
getNetMask
(
void
)
{
{
return
netMask
;
return
netMask
;
}
}
void
setBroadcastAddress
(
char
*
baseAddr
)
void
setBroadcastAddress
(
char
*
baseAddr
)
{
{
strcpy
(
broadcastAddr
,
baseAddr
);
strcpy
(
broadcastAddr
,
baseAddr
);
}
}
char
*
getBroadcastAddress
(
void
)
char
*
getBroadcastAddress
(
void
)
{
{
return
broadcastAddr
;
return
broadcastAddr
;
}
}
//Add Gateway to the interface
//Add Gateway to the interface
int
set_gateway
(
char
*
interfaceName
,
char
*
gateway
)
int
set_gateway
(
char
*
interfaceName
,
char
*
gateway
)
{
{
int
sock_fd
;
int
sock_fd
;
struct
rtentry
rt
;
struct
rtentry
rt
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
...
@@ -96,20 +104,16 @@ int set_gateway(char *interfaceName, char *gateway)
...
@@ -96,20 +104,16 @@ int set_gateway(char *interfaceName, char *gateway)
}
}
memset
(
&
rt
,
0
,
sizeof
(
rt
));
memset
(
&
rt
,
0
,
sizeof
(
rt
));
addr
.
sin_family
=
AF_INET
;
addr
.
sin_family
=
AF_INET
;
/*set Destination addr*/
/*set Destination addr*/
inet_aton
(
"0.0.0.0"
,
&
addr
.
sin_addr
);
inet_aton
(
"0.0.0.0"
,
&
addr
.
sin_addr
);
memcpy
(
&
rt
.
rt_dst
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
memcpy
(
&
rt
.
rt_dst
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
/*set gateway addr*/
/*set gateway addr*/
inet_aton
(
gateway
,
&
addr
.
sin_addr
);
inet_aton
(
gateway
,
&
addr
.
sin_addr
);
memcpy
(
&
rt
.
rt_gateway
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
memcpy
(
&
rt
.
rt_gateway
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
/*set genmask addr*/
/*set genmask addr*/
inet_aton
(
"0.0.0.0"
,
&
addr
.
sin_addr
);
inet_aton
(
"0.0.0.0"
,
&
addr
.
sin_addr
);
memcpy
(
&
rt
.
rt_genmask
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
memcpy
(
&
rt
.
rt_genmask
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
rt
.
rt_dev
=
interfaceName
;
rt
.
rt_dev
=
interfaceName
;
//rt.rt_flags = RTF_UP|RTF_GATEWAY|RTF_DEFAULT;
//rt.rt_flags = RTF_UP|RTF_GATEWAY|RTF_DEFAULT;
/* SR: rt_flags on 16 bits but RTF_DEFAULT = 0x00010000
/* SR: rt_flags on 16 bits but RTF_DEFAULT = 0x00010000
...
@@ -129,19 +133,16 @@ int set_gateway(char *interfaceName, char *gateway)
...
@@ -129,19 +133,16 @@ int set_gateway(char *interfaceName, char *gateway)
LOG_I
(
OIP
,
"set_gateway OK!
\n
"
);
LOG_I
(
OIP
,
"set_gateway OK!
\n
"
);
return
0
;
return
0
;
}
}
}
}
close
(
sock_fd
);
close
(
sock_fd
);
LOG_D
(
OIP
,
"Set Gateway OK!
\n
"
);
LOG_D
(
OIP
,
"Set Gateway OK!
\n
"
);
return
0
;
return
0
;
}
}
// sets a genneric interface parameter
// sets a genneric interface parameter
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
int
setInterfaceParameter
(
char
*
interfaceName
,
char
*
settingAddress
,
int
operation
)
int
setInterfaceParameter
(
char
*
interfaceName
,
char
*
settingAddress
,
int
operation
)
{
{
int
sock_fd
;
int
sock_fd
;
struct
ifreq
ifr
;
struct
ifreq
ifr
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
...
@@ -154,10 +155,8 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
...
@@ -154,10 +155,8 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
strncpy
(
ifr
.
ifr_name
,
interfaceName
,
sizeof
(
ifr
.
ifr_name
)
-
1
);
strncpy
(
ifr
.
ifr_name
,
interfaceName
,
sizeof
(
ifr
.
ifr_name
)
-
1
);
memset
(
&
addr
,
0
,
sizeof
(
struct
sockaddr_in
));
memset
(
&
addr
,
0
,
sizeof
(
struct
sockaddr_in
));
addr
.
sin_family
=
AF_INET
;
addr
.
sin_family
=
AF_INET
;
inet_aton
(
settingAddress
,
&
addr
.
sin_addr
);
inet_aton
(
settingAddress
,
&
addr
.
sin_addr
);
memcpy
(
&
ifr
.
ifr_ifru
.
ifru_addr
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
memcpy
(
&
ifr
.
ifr_ifru
.
ifru_addr
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
...
@@ -169,15 +168,13 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
...
@@ -169,15 +168,13 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
}
}
close
(
sock_fd
);
close
(
sock_fd
);
// printf("Set OK!\n");
// printf("Set OK!\n");
return
0
;
return
0
;
}
}
// sets a genneric interface parameter
// sets a genneric interface parameter
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
)
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
)
{
{
int
sock_fd
;
int
sock_fd
;
struct
ifreq
ifr
;
struct
ifreq
ifr
;
...
@@ -213,8 +210,7 @@ int bringInterfaceUp(char *interfaceName, int up)
...
@@ -213,8 +210,7 @@ int bringInterfaceUp(char *interfaceName, int up)
return
0
;
return
0
;
}
}
// non blocking full configuration of the interface (address, net mask, and broadcast mask)
// non blocking full configuration of the interface (address, net mask, and broadcast mask)
int
NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
int
NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
{
{
bringInterfaceUp
(
interfaceName
,
0
);
bringInterfaceUp
(
interfaceName
,
0
);
// sets the machine address
// sets the machine address
int
returnValue
=
setInterfaceParameter
(
interfaceName
,
ipAddress
,
SIOCSIFADDR
);
int
returnValue
=
setInterfaceParameter
(
interfaceName
,
ipAddress
,
SIOCSIFADDR
);
...
@@ -229,28 +225,21 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
...
@@ -229,28 +225,21 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
// if(!returnValue)
// if(!returnValue)
// returnValue=set_gateway(interfaceName, broadcastAddress);
// returnValue=set_gateway(interfaceName, broadcastAddress);
bringInterfaceUp
(
interfaceName
,
1
);
bringInterfaceUp
(
interfaceName
,
1
);
return
returnValue
;
return
returnValue
;
}
}
// non blocking full configuration of the interface (address, and the two lest octets of the address)
// non blocking full configuration of the interface (address, and the two lest octets of the address)
int
nas_config
(
int
interface_id
,
int
thirdOctet
,
int
fourthOctet
,
char
*
ifname
)
int
nas_config
(
int
interface_id
,
int
thirdOctet
,
int
fourthOctet
,
char
*
ifname
)
{
{
//char buf[5];
//char buf[5];
char
ipAddress
[
20
];
char
ipAddress
[
20
];
char
broadcastAddress
[
20
];
char
broadcastAddress
[
20
];
char
interfaceName
[
20
];
char
interfaceName
[
20
];
int
returnValue
;
int
returnValue
;
sprintf
(
ipAddress
,
"10.0.%d.%d"
,
thirdOctet
,
fourthOctet
);
sprintf
(
ipAddress
,
"10.0.%d.%d"
,
thirdOctet
,
fourthOctet
);
sprintf
(
broadcastAddress
,
"10.0.%d.255"
,
thirdOctet
);
sprintf
(
broadcastAddress
,
"10.0.%d.255"
,
thirdOctet
);
sprintf
(
interfaceName
,
"%s%s%d"
,
(
UE_NAS_USE_TUN
||
ENB_NAS_USE_TUN
)
?
"oaitun_"
:
ifname
,
sprintf
(
interfaceName
,
"%s%s%d"
,
(
UE_NAS_USE_TUN
||
ENB_NAS_USE_TUN
)
?
"oaitun_"
:
ifname
,
UE_NAS_USE_TUN
?
"ue"
:
(
ENB_NAS_USE_TUN
?
"enb"
:
""
),
interface_id
);
UE_NAS_USE_TUN
?
"ue"
:
(
ENB_NAS_USE_TUN
?
"enb"
:
""
),
interface_id
);
bringInterfaceUp
(
interfaceName
,
0
);
bringInterfaceUp
(
interfaceName
,
0
);
// sets the machine address
// sets the machine address
returnValue
=
setInterfaceParameter
(
interfaceName
,
ipAddress
,
SIOCSIFADDR
);
returnValue
=
setInterfaceParameter
(
interfaceName
,
ipAddress
,
SIOCSIFADDR
);
...
@@ -264,18 +253,13 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
...
@@ -264,18 +253,13 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
returnValue
=
setInterfaceParameter
(
interfaceName
,
broadcastAddress
,
SIOCSIFBRDADDR
);
returnValue
=
setInterfaceParameter
(
interfaceName
,
broadcastAddress
,
SIOCSIFBRDADDR
);
bringInterfaceUp
(
interfaceName
,
1
);
bringInterfaceUp
(
interfaceName
,
1
);
return
returnValue
;
return
returnValue
;
}
}
// Blocking full configuration of the interface (address, net mask, and broadcast mask)
// Blocking full configuration of the interface (address, net mask, and broadcast mask)
int
blocking_NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
int
blocking_NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
{
{
char
command
[
200
];
char
command
[
200
];
command
[
0
]
=
'\0'
;
command
[
0
]
=
'\0'
;
strcat
(
command
,
"ifconfig "
);
strcat
(
command
,
"ifconfig "
);
strncat
(
command
,
interfaceName
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
interfaceName
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
" "
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
" "
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
...
@@ -284,16 +268,13 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask,
...
@@ -284,16 +268,13 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask,
strncat
(
command
,
networkMask
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
networkMask
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
" broadcast "
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
" broadcast "
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
broadcastAddress
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
broadcastAddress
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
int
i
=
system
(
command
);
int
i
=
system
(
command
);
return
i
;
return
i
;
}
}
// program help
// program help
void
helpOptions
(
char
**
argv
)
void
helpOptions
(
char
**
argv
)
{
{
printf
(
"Help for %s
\n
"
,
argv
[
0
]);
printf
(
"Help for %s
\n
"
,
argv
[
0
]);
printf
(
" -i <interfaceName>
\n
"
);
printf
(
" -i <interfaceName>
\n
"
);
printf
(
" -a <IP address>
\n
"
);
printf
(
" -a <IP address>
\n
"
);
...
@@ -305,13 +286,11 @@ void helpOptions(char **argv)
...
@@ -305,13 +286,11 @@ void helpOptions(char **argv)
printf
(
" IP Address: 10.0.1.1
\n
"
);
printf
(
" IP Address: 10.0.1.1
\n
"
);
printf
(
" Net mask: 255.255.255.0
\n
"
);
printf
(
" Net mask: 255.255.255.0
\n
"
);
printf
(
" Broadcast address: [Beginning of the IP address].255
\n
"
);
printf
(
" Broadcast address: [Beginning of the IP address].255
\n
"
);
exit
(
1
);
exit
(
1
);
}
}
// creates the broadcast address if it wasn't set before
// creates the broadcast address if it wasn't set before
void
createBroadcast
(
char
*
broadcastAddress
)
void
createBroadcast
(
char
*
broadcastAddress
)
{
{
int
pos
=
strlen
(
broadcastAddress
)
-
1
;
int
pos
=
strlen
(
broadcastAddress
)
-
1
;
while
(
broadcastAddress
[
pos
]
!=
'.'
)
while
(
broadcastAddress
[
pos
]
!=
'.'
)
...
@@ -333,7 +312,6 @@ int main(int argc,char **argv)
...
@@ -333,7 +312,6 @@ int main(int argc,char **argv)
char
ipAddress
[
100
];
char
ipAddress
[
100
];
char
networkMask
[
100
];
char
networkMask
[
100
];
char
broadcastAddress
[
100
];
char
broadcastAddress
[
100
];
strcpy
(
interfaceName
,
"oai0"
);
strcpy
(
interfaceName
,
"oai0"
);
strcpy
(
ipAddress
,
"10.0.1.1"
);
strcpy
(
ipAddress
,
"10.0.1.1"
);
strcpy
(
networkMask
,
"255.255.255.0"
);
strcpy
(
networkMask
,
"255.255.255.0"
);
...
@@ -385,7 +363,6 @@ int main(int argc,char **argv)
...
@@ -385,7 +363,6 @@ int main(int argc,char **argv)
//test
//test
// setBaseNetAddress("11.11");
// setBaseNetAddress("11.11");
// nas_config(interfaceName, 33, 44);
// nas_config(interfaceName, 33, 44);
}
}
#endif
#endif
openair2/RRC/NAS/nas_config.h
View file @
753c2f44
...
@@ -31,6 +31,13 @@
...
@@ -31,6 +31,13 @@
#include <netinet/in.h>
#include <netinet/in.h>
/*! \fn void void nas_getparams(void)(void)
* \brief This function get parameters used to configure network interface when running in noS1 mode
* \note
* @ingroup ?????
*/
void
nas_getparams
(
void
);
/*! \fn int NAS_config(char*, char*, char*, char*)
/*! \fn int NAS_config(char*, char*, char*, char*)
* \brief This function initializes the nasmesh interface
* \brief This function initializes the nasmesh interface
* \param[in] interfaceName, the name of the interface, e.g. nasmesh0 or nasmesh1
* \param[in] interfaceName, the name of the interface, e.g. nasmesh0 or nasmesh1
...
@@ -98,7 +105,7 @@ int set_gateway(char *interfaceName, char *gateway);
...
@@ -98,7 +105,7 @@ int set_gateway(char *interfaceName, char *gateway);
* \note
* \note
* @ingroup ?????
* @ingroup ?????
*/
*/
void
setBaseNetAddress
(
char
*
baseAddr
);
void
setBaseNetAddress
(
char
*
baseAddr
);
/*! \fn char* getBaseNetAddress()
/*! \fn char* getBaseNetAddress()
* \brief This function returns the basic network address used
* \brief This function returns the basic network address used
...
@@ -106,7 +113,7 @@ void setBaseNetAddress(char* baseAddr);
...
@@ -106,7 +113,7 @@ void setBaseNetAddress(char* baseAddr);
* \note
* \note
* @ingroup ?????
* @ingroup ?????
*/
*/
char
*
getBaseNetAddress
(
void
);
char
*
getBaseNetAddress
(
void
);
/*! \fn void setNetMask(char*)
/*! \fn void setNetMask(char*)
* \brief This function sets the new default network mask used
* \brief This function sets the new default network mask used
...
@@ -114,7 +121,7 @@ char* getBaseNetAddress(void);
...
@@ -114,7 +121,7 @@ char* getBaseNetAddress(void);
* \note
* \note
* @ingroup ?????
* @ingroup ?????
*/
*/
void
setNetMask
(
char
*
baseAddr
);
void
setNetMask
(
char
*
baseAddr
);
/*! \fn char* getNetMask()
/*! \fn char* getNetMask()
* \brief This function returns the network mask address in use
* \brief This function returns the network mask address in use
...
@@ -122,7 +129,7 @@ void setNetMask(char* baseAddr);
...
@@ -122,7 +129,7 @@ void setNetMask(char* baseAddr);
* \note
* \note
* @ingroup ?????
* @ingroup ?????
*/
*/
char
*
getNetMask
(
void
);
char
*
getNetMask
(
void
);
/*! \fn coid setBroadcastAddress(char*)
/*! \fn coid setBroadcastAddress(char*)
* \brief This function sets the new broadcast address used
* \brief This function sets the new broadcast address used
...
@@ -130,7 +137,7 @@ char* getNetMask(void);
...
@@ -130,7 +137,7 @@ char* getNetMask(void);
* \note
* \note
* @ingroup ?????
* @ingroup ?????
*/
*/
void
setBroadcastAddress
(
char
*
baseAddr
);
void
setBroadcastAddress
(
char
*
baseAddr
);
/*! \fn char* getBroadcastAddress()
/*! \fn char* getBroadcastAddress()
* \brief This function returns the broadcast address in use
* \brief This function returns the broadcast address in use
...
@@ -138,7 +145,7 @@ void setBroadcastAddress(char* baseAddr);
...
@@ -138,7 +145,7 @@ void setBroadcastAddress(char* baseAddr);
* \note
* \note
* @ingroup ?????
* @ingroup ?????
*/
*/
char
*
getBroadcastAddress
(
void
);
char
*
getBroadcastAddress
(
void
);
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
);
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
);
...
...
targets/ARCH/COMMON/common_lib.c
View file @
753c2f44
...
@@ -40,68 +40,72 @@
...
@@ -40,68 +40,72 @@
#include "targets/RT/USER/lte-softmodem.h"
#include "targets/RT/USER/lte-softmodem.h"
int
set_device
(
openair0_device
*
device
)
{
int
set_device
(
openair0_device
*
device
)
{
switch
(
device
->
type
)
{
switch
(
device
->
type
)
{
case
EXMIMO_DEV
:
case
EXMIMO_DEV
:
printf
(
"[%s] has loaded EXPRESS MIMO device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded EXPRESS MIMO device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
case
USRP_B200_DEV
:
case
USRP_B200_DEV
:
printf
(
"[%s] has loaded USRP B200 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded USRP B200 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
case
USRP_X300_DEV
:
case
USRP_X300_DEV
:
printf
(
"[%s] has loaded USRP X300 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded USRP X300 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
case
BLADERF_DEV
:
case
BLADERF_DEV
:
printf
(
"[%s] has loaded BLADERF device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded BLADERF device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
case
LMSSDR_DEV
:
case
LMSSDR_DEV
:
printf
(
"[%s] has loaded LMSSDR device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded LMSSDR device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
case
IRIS_DEV
:
case
IRIS_DEV
:
printf
(
"[%s] has loaded Iris device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded Iris device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
case
NONE_DEV
:
case
NONE_DEV
:
printf
(
"[%s] has not loaded a HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has not loaded a HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
break
;
default:
default:
printf
(
"[%s] invalid HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] invalid HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
}
}
int
set_transport
(
openair0_device
*
device
)
{
int
set_transport
(
openair0_device
*
device
)
{
switch
(
device
->
transp_type
)
{
switch
(
device
->
transp_type
)
{
case
ETHERNET_TP
:
case
ETHERNET_TP
:
printf
(
"[%s] has loaded ETHERNET trasport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has loaded ETHERNET trasport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
0
;
return
0
;
break
;
break
;
case
NONE_TP
:
case
NONE_TP
:
printf
(
"[%s] has not loaded a transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] has not loaded a transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
0
;
return
0
;
break
;
break
;
default:
default:
printf
(
"[%s] invalid transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
printf
(
"[%s] invalid transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
-
1
;
return
-
1
;
break
;
break
;
}
}
}
}
typedef
int
(
*
devfunc_t
)(
openair0_device
*
,
openair0_config_t
*
,
eth_params_t
*
);
typedef
int
(
*
devfunc_t
)(
openair0_device
*
,
openair0_config_t
*
,
eth_params_t
*
);
/* look for the interface library and load it */
/* look for the interface library and load it */
int
load_lib
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
cfg
,
uint8_t
flag
)
{
int
load_lib
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
cfg
,
uint8_t
flag
)
{
loader_shlibfunc_t
shlib_fdesc
[
1
];
loader_shlibfunc_t
shlib_fdesc
[
1
];
int
ret
=
0
;
int
ret
=
0
;
char
*
libname
;
char
*
libname
;
if
(
IS_SOFTMODEM_BASICSIM
)
{
if
(
IS_SOFTMODEM_BASICSIM
)
{
libname
=
OAI_BASICSIM_LIBNAME
;
libname
=
OAI_BASICSIM_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
}
else
}
else
if
(
IS_SOFTMODEM_RFSIM
)
{
if
(
IS_SOFTMODEM_RFSIM
)
{
libname
=
OAI_RFSIM_LIBNAME
;
libname
=
OAI_RFSIM_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
}
else
if
(
flag
==
RAU_LOCAL_RADIO_HEAD
)
{
}
else
if
(
flag
==
RAU_LOCAL_RADIO_HEAD
)
{
...
@@ -111,19 +115,21 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
...
@@ -111,19 +115,21 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
libname
=
OAI_TP_LIBNAME
;
libname
=
OAI_TP_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"transport_init"
;
shlib_fdesc
[
0
].
fname
=
"transport_init"
;
}
}
ret
=
load_module_shlib
(
libname
,
shlib_fdesc
,
1
,
NULL
);
ret
=
load_module_shlib
(
libname
,
shlib_fdesc
,
1
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Library %s couldn't be loaded
\n
"
,
libname
);
fprintf
(
stderr
,
"Library %s couldn't be loaded
\n
"
,
libname
);
}
else
{
}
else
{
ret
=
((
devfunc_t
)
shlib_fdesc
[
0
].
fptr
)(
device
,
openair0_cfg
,
cfg
);
ret
=
((
devfunc_t
)
shlib_fdesc
[
0
].
fptr
)(
device
,
openair0_cfg
,
cfg
);
}
}
return
ret
;
return
ret
;
}
}
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
rc
=
0
;
int
rc
=
0
;
rc
=
load_lib
(
device
,
openair0_cfg
,
NULL
,
RAU_LOCAL_RADIO_HEAD
);
rc
=
load_lib
(
device
,
openair0_cfg
,
NULL
,
RAU_LOCAL_RADIO_HEAD
);
...
@@ -133,20 +139,22 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
...
@@ -133,20 +139,22 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
return
-
1
;
return
-
1
;
}
}
}
}
return
rc
;
return
rc
;
}
}
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
)
{
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
)
{
int
rc
;
int
rc
;
rc
=
load_lib
(
device
,
openair0_cfg
,
eth_params
,
RAU_REMOTE_RADIO_HEAD
);
rc
=
load_lib
(
device
,
openair0_cfg
,
eth_params
,
RAU_REMOTE_RADIO_HEAD
);
if
(
rc
>=
0
)
{
if
(
rc
>=
0
)
{
if
(
set_transport
(
device
)
<
0
)
{
if
(
set_transport
(
device
)
<
0
)
{
fprintf
(
stderr
,
"%s %d:Unsupported transport protocol
\n
"
,
__FILE__
,
__LINE__
);
fprintf
(
stderr
,
"%s %d:Unsupported transport protocol
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
return
-
1
;
}
}
}
}
return
rc
;
return
rc
;
}
}
...
...
targets/ARCH/COMMON/common_lib.h
View file @
753c2f44
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
#define RAU_REMOTE_RADIO_HEAD 1
#define RAU_REMOTE_RADIO_HEAD 1
#ifndef MAX_CARDS
#ifndef MAX_CARDS
#define MAX_CARDS 8
#define MAX_CARDS 8
#endif
#endif
typedef
int64_t
openair0_timestamp
;
typedef
int64_t
openair0_timestamp
;
...
@@ -129,7 +129,7 @@ typedef enum {
...
@@ -129,7 +129,7 @@ typedef enum {
RRU_HOST
,
RRU_HOST
,
MAX_HOST_TYPE
MAX_HOST_TYPE
}
host_type_t
;
}
host_type_t
;
/*! \brief RF Gain clibration */
/*! \brief RF Gain clibration */
...
@@ -175,9 +175,9 @@ typedef struct {
...
@@ -175,9 +175,9 @@ typedef struct {
//! number of TX channels (=TX antennas)
//! number of TX channels (=TX antennas)
int
tx_num_channels
;
int
tx_num_channels
;
//! \brief RX base addresses for mmapped_dma
//! \brief RX base addresses for mmapped_dma
int32_t
*
rxbase
[
4
];
int32_t
*
rxbase
[
4
];
//! \brief TX base addresses for mmapped_dma
//! \brief TX base addresses for mmapped_dma
int32_t
*
txbase
[
4
];
int32_t
*
txbase
[
4
];
//! \brief Center frequency in Hz for RX.
//! \brief Center frequency in Hz for RX.
//! index: [0..rx_num_channels[
//! index: [0..rx_num_channels[
double
rx_freq
[
4
];
double
rx_freq
[
4
];
...
@@ -364,26 +364,26 @@ struct openair0_device_t {
...
@@ -364,26 +364,26 @@ struct openair0_device_t {
* \param exmimo_dump_config dump EXMIMO configuration
* \param exmimo_dump_config dump EXMIMO configuration
* \returns 0 in success
* \returns 0 in success
*/
*/
int
(
*
trx_set_freq_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
);
int
(
*
trx_set_freq_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
);
/*! \brief Set gains
/*! \brief Set gains
* \param device the hardware to use
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \param openair0_cfg RF frontend parameters set by application
* \returns 0 in success
* \returns 0 in success
*/
*/
int
(
*
trx_set_gains_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
int
(
*
trx_set_gains_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*! \brief RRU Configuration callback
/*! \brief RRU Configuration callback
* \param idx RU index
* \param idx RU index
* \param arg pointer to capabilities or configuration
* \param arg pointer to capabilities or configuration
*/
*/
void
(
*
configure_rru
)(
int
idx
,
void
*
arg
);
void
(
*
configure_rru
)(
int
idx
,
void
*
arg
);
};
};
/* type of device init function, implemented in shared lib */
/* type of device init function, implemented in shared lib */
typedef
int
(
*
oai_device_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
typedef
int
(
*
oai_device_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/* type of transport init function, implemented in shared lib */
/* type of transport init function, implemented in shared lib */
typedef
int
(
*
oai_transport_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
typedef
int
(
*
oai_transport_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
...
@@ -391,23 +391,23 @@ extern "C"
...
@@ -391,23 +391,23 @@ extern "C"
#endif
#endif
/*! \brief Initialize openair RF target. It returns 0 if OK */
/*! \brief Initialize openair RF target. It returns 0 if OK */
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*! \brief Initialize transport protocol . It returns 0 if OK */
/*! \brief Initialize transport protocol . It returns 0 if OK */
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
/*! \brief Get current timestamp of USRP
/*! \brief Get current timestamp of USRP
* \param device the hardware to use
* \param device the hardware to use
*/
*/
openair0_timestamp
get_usrp_time
(
openair0_device
*
device
);
openair0_timestamp
get_usrp_time
(
openair0_device
*
device
);
/*! \brief Set RX frequencies
/*! \brief Set RX frequencies
* \param device the hardware to use
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \param openair0_cfg RF frontend parameters set by application
* \returns 0 in success
* \returns 0 in success
*/
*/
int
openair0_set_rx_frequencies
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
int
openair0_set_rx_frequencies
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*@}*/
/*@}*/
...
...
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
View file @
753c2f44
...
@@ -138,7 +138,7 @@ int eth_socket_init_raw(openair0_device *device) {
...
@@ -138,7 +138,7 @@ int eth_socket_init_raw(openair0_device *device) {
return
0
;
return
0
;
}
}
/* 09/03/2019: fix obvious inconsistencies, but this code hasn't be tested for sure */
int
trx_eth_write_raw
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
int
trx_eth_write_raw
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
int
bytes_sent
=
0
;
int
bytes_sent
=
0
;
...
@@ -148,7 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
...
@@ -148,7 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
//sendto_flag|=flags;
//sendto_flag|=flags;
eth
->
tx_nsamps
=
nsamps
;
eth
->
tx_nsamps
=
nsamps
;
int
pktsize
;
if
(
eth
->
compression
==
ALAW_COMPRESS
)
{
pktsize
=
RAW_PACKET_SIZE_BYTES_ALAW
(
nsamps
);
}
else
{
pktsize
=
RAW_PACKET_SIZE_BYTES
(
nsamps
);
}
for
(
i
=
0
;
i
<
cc
;
i
++
)
{
for
(
i
=
0
;
i
<
cc
;
i
++
)
{
/* buff[i] points to the position in tx buffer where the payload to be sent is
/* buff[i] points to the position in tx buffer where the payload to be sent is
buff2 points to the position in tx buffer where the packet header will be placed */
buff2 points to the position in tx buffer where the packet header will be placed */
...
@@ -164,40 +169,23 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
...
@@ -164,40 +169,23 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
*
(
int16_t
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int16_t
))
=
1
+
(
i
<<
1
);
*
(
int16_t
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int16_t
))
=
1
+
(
i
<<
1
);
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
))
=
timestamp
;
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
))
=
timestamp
;
int
sent_byte
;
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
while
(
bytes_sent
<
sent_byte
)
{
while
(
bytes_sent
<
pktsize
)
{
#if DEBUG
printf
(
"------- TX ------: buff2 current position=%d remaining_bytes=%d bytes_sent=%d
\n
"
,
(
void
*
)(
buff2
+
bytes_sent
),
sent_byte
-
bytes_sent
,
bytes_sent
);
#endif
/* Send packet */
/* Send packet */
bytes_sent
+=
send
(
eth
->
sockfdd
,
bytes_sent
+=
send
(
eth
->
sockfdd
,
buff2
,
buff2
,
sent_byt
e
,
pktsiz
e
,
sendto_flag
);
sendto_flag
);
if
(
bytes_sent
==
-
1
)
{
if
(
bytes_sent
==
-
1
)
{
eth
->
num_tx_errors
++
;
eth
->
num_tx_errors
++
;
perror
(
"ETHERNET WRITE: "
);
perror
(
"ETHERNET WRITE: "
);
exit
(
-
1
);
exit
(
-
1
);
}
else
{
}
else
{
#if DEBUG
printf
(
"------- TX ------: nu=%x an_id=%d ts%d bytes_sent=%d
\n
"
,
*
(
uint8_t
*
)(
buff2
+
ETH_ALEN
),
*
(
int16_t
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int16_t
)),
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
)),
bytes_sent
);
dump_packet
((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
,
buff2
,
sent_byte
,
TX_FLAG
);
#endif
eth
->
tx_actual_nsamps
=
bytes_sent
>>
2
;
eth
->
tx_actual_nsamps
=
bytes_sent
>>
2
;
eth
->
tx_count
++
;
eth
->
tx_count
++
;
}
}
...
...
targets/RT/USER/lte-ru.c
View file @
753c2f44
...
@@ -1386,7 +1386,6 @@ int setup_RU_buffers(RU_t *ru) {
...
@@ -1386,7 +1386,6 @@ int setup_RU_buffers(RU_t *ru) {
* TODO: find a proper cleaner solution
* TODO: find a proper cleaner solution
*/
*/
ru
->
N_TA_offset
=
0
;
ru
->
N_TA_offset
=
0
;
}
}
if
(
ru
->
openair0_cfg
.
mmapped_dma
==
1
)
{
if
(
ru
->
openair0_cfg
.
mmapped_dma
==
1
)
{
...
...
targets/RT/USER/lte-softmodem-common.c
View file @
753c2f44
...
@@ -99,9 +99,11 @@ void get_common_options(void) {
...
@@ -99,9 +99,11 @@ void get_common_options(void) {
if
(
basicsim
)
{
if
(
basicsim
)
{
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
}
}
#if BASIC_SIMULATOR
#if BASIC_SIMULATOR
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
#endif
#endif
if
(
parallel_config
!=
NULL
)
set_parallel_conf
(
parallel_config
);
if
(
parallel_config
!=
NULL
)
set_parallel_conf
(
parallel_config
);
if
(
worker_config
!=
NULL
)
set_worker_conf
(
worker_config
);
if
(
worker_config
!=
NULL
)
set_worker_conf
(
worker_config
);
...
...
targets/RT/USER/lte-softmodem.c
View file @
753c2f44
...
@@ -655,8 +655,10 @@ int main( int argc, char **argv ) {
...
@@ -655,8 +655,10 @@ int main( int argc, char **argv ) {
fill_modeled_runtime_table
(
runtime_phy_rx
,
runtime_phy_tx
);
fill_modeled_runtime_table
(
runtime_phy_rx
,
runtime_phy_tx
);
uint32_t
pdcp_initmask
=
(
IS_SOFTMODEM_NOS1
)
?
(
PDCP_USE_NETLINK_BIT
|
LINK_ENB_PDCP_TO_IP_DRIVER_BIT
)
:
LINK_ENB_PDCP_TO_GTPV1U_BIT
;
uint32_t
pdcp_initmask
=
(
IS_SOFTMODEM_NOS1
)
?
(
PDCP_USE_NETLINK_BIT
|
LINK_ENB_PDCP_TO_IP_DRIVER_BIT
)
:
LINK_ENB_PDCP_TO_GTPV1U_BIT
;
#
#
if
(
IS_SOFTMODEM_NOS1
)
if
(
IS_SOFTMODEM_NOS1
)
pdcp_initmask
=
pdcp_initmask
|
ENB_NAS_USE_TUN_BIT
|
SOFTMODEM_NOKRNMOD_BIT
;
pdcp_initmask
=
pdcp_initmask
|
ENB_NAS_USE_TUN_BIT
|
SOFTMODEM_NOKRNMOD_BIT
;
pdcp_module_init
(
pdcp_initmask
);
pdcp_module_init
(
pdcp_initmask
);
if
(
RC
.
nb_inst
>
0
)
{
if
(
RC
.
nb_inst
>
0
)
{
...
...
targets/RT/USER/lte-ue.c
View file @
753c2f44
...
@@ -80,8 +80,8 @@ void init_UE_threads_stub(int);
...
@@ -80,8 +80,8 @@ void init_UE_threads_stub(int);
void
init_UE_single_thread_stub
(
int
);
void
init_UE_single_thread_stub
(
int
);
void
*
UE_thread
(
void
*
arg
);
void
*
UE_thread
(
void
*
arg
);
void
init_UE
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
int
timing_correction
,
int
phy_test
,
int
UE_scan
,
int
UE_scan_carrier
,
runmode_t
mode
,
int
rxgain
,
int
txpowermax
,
LTE_DL_FRAME_PARMS
*
fp
);
void
init_UE
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
int
timing_correction
,
int
phy_test
,
int
UE_scan
,
int
UE_scan_carrier
,
runmode_t
mode
,
int
rxgain
,
int
txpowermax
,
LTE_DL_FRAME_PARMS
*
fp
);
void
init_UE_stub
(
int
nb_inst
,
int
,
int
,
char
*
);
void
init_UE_stub
(
int
nb_inst
,
int
,
int
,
char
*
);
void
init_UE_stub_single_thread
(
int
nb_inst
,
int
,
int
,
char
*
);
void
init_UE_stub_single_thread
(
int
nb_inst
,
int
,
int
,
char
*
);
int
init_timer_thread
(
void
);
int
init_timer_thread
(
void
);
extern
void
oai_subframe_ind
(
uint16_t
sfn
,
uint16_t
sf
);
extern
void
oai_subframe_ind
(
uint16_t
sfn
,
uint16_t
sf
);
extern
void
multicast_link_start
(
void
(
*
rx_handlerP
)
(
unsigned
int
,
char
*
),
extern
void
multicast_link_start
(
void
(
*
rx_handlerP
)
(
unsigned
int
,
char
*
),
...
@@ -169,21 +169,18 @@ struct sched_param sched_param_UE_thread;
...
@@ -169,21 +169,18 @@ struct sched_param sched_param_UE_thread;
void
get_uethreads_params
(
void
)
{
void
get_uethreads_params
(
void
)
{
paramdef_t
cmdline_threadsparams
[]
=
CMDLINE_UETHREADSPARAMS_DESC
;
paramdef_t
cmdline_threadsparams
[]
=
CMDLINE_UETHREADSPARAMS_DESC
;
config_process_cmdline
(
cmdline_threadsparams
,
sizeof
(
cmdline_threadsparams
)
/
sizeof
(
paramdef_t
),
NULL
);
config_process_cmdline
(
cmdline_threadsparams
,
sizeof
(
cmdline_threadsparams
)
/
sizeof
(
paramdef_t
),
NULL
);
}
}
void
phy_init_lte_ue_transport
(
PHY_VARS_UE
*
ue
,
int
absraction_flag
);
void
phy_init_lte_ue_transport
(
PHY_VARS_UE
*
ue
,
int
absraction_flag
);
PHY_VARS_UE
*
init_ue_vars
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
PHY_VARS_UE
*
init_ue_vars
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
UE_id
,
uint8_t
UE_id
,
uint8_t
abstraction_flag
)
uint8_t
abstraction_flag
)
{
{
PHY_VARS_UE
*
ue
=
(
PHY_VARS_UE
*
)
malloc
(
sizeof
(
PHY_VARS_UE
));
PHY_VARS_UE
*
ue
=
(
PHY_VARS_UE
*
)
malloc
(
sizeof
(
PHY_VARS_UE
));
memset
(
ue
,
0
,
sizeof
(
PHY_VARS_UE
));
memset
(
ue
,
0
,
sizeof
(
PHY_VARS_UE
));
if
(
frame_parms
!=
(
LTE_DL_FRAME_PARMS
*
)
NULL
)
{
// if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
if
(
frame_parms
!=
(
LTE_DL_FRAME_PARMS
*
)
NULL
)
{
// if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
...
@@ -195,8 +192,7 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
...
@@ -195,8 +192,7 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
ue
->
mac_enabled
=
1
;
ue
->
mac_enabled
=
1
;
// In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct?
// In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct?
if
(
nfapi_mode
!=
3
)
if
(
nfapi_mode
!=
3
)
{
{
// initialize all signal buffers
// initialize all signal buffers
init_lte_ue_signal
(
ue
,
1
,
abstraction_flag
);
init_lte_ue_signal
(
ue
,
1
,
abstraction_flag
);
// intialize transport
// intialize transport
...
@@ -211,9 +207,9 @@ char uecap_xer[1024];
...
@@ -211,9 +207,9 @@ char uecap_xer[1024];
void
init_thread
(
int
sched_runtime
,
int
sched_deadline
,
int
sched_fifo
,
cpu_set_t
*
cpuset
,
char
*
name
)
{
void
init_thread
(
int
sched_runtime
,
int
sched_deadline
,
int
sched_fifo
,
cpu_set_t
*
cpuset
,
char
*
name
)
{
#ifdef DEADLINE_SCHEDULER
#ifdef DEADLINE_SCHEDULER
if
(
sched_runtime
!=
0
)
{
if
(
sched_runtime
!=
0
)
{
struct
sched_attr
attr
=
{
0
};
struct
sched_attr
attr
=
{
0
};
attr
.
size
=
sizeof
(
attr
);
attr
.
size
=
sizeof
(
attr
);
...
@@ -226,44 +222,48 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_
...
@@ -226,44 +222,48 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_
LOG_I
(
HW
,
"[SCHED][eNB] %s deadline thread %lu started on CPU %d
\n
"
,
LOG_I
(
HW
,
"[SCHED][eNB] %s deadline thread %lu started on CPU %d
\n
"
,
name
,
(
unsigned
long
)
gettid
(),
sched_getcpu
());
name
,
(
unsigned
long
)
gettid
(),
sched_getcpu
());
}
}
#else
#else
if
(
CPU_COUNT
(
cpuset
)
>
0
)
if
(
CPU_COUNT
(
cpuset
)
>
0
)
AssertFatal
(
0
==
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
cpuset
),
""
);
AssertFatal
(
0
==
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
cpuset
),
""
);
struct
sched_param
sp
;
struct
sched_param
sp
;
sp
.
sched_priority
=
sched_fifo
;
sp
.
sched_priority
=
sched_fifo
;
AssertFatal
(
pthread_setschedparam
(
pthread_self
(),
SCHED_FIFO
,
&
sp
)
==
0
,
AssertFatal
(
pthread_setschedparam
(
pthread_self
(),
SCHED_FIFO
,
&
sp
)
==
0
,
"Can't set thread priority, Are you root?
\n
"
);
"Can't set thread priority, Are you root?
\n
"
);
/* Check the actual affinity mask assigned to the thread */
/* Check the actual affinity mask assigned to the thread */
cpu_set_t
*
cset
=
CPU_ALLOC
(
CPU_SETSIZE
);
cpu_set_t
*
cset
=
CPU_ALLOC
(
CPU_SETSIZE
);
if
(
0
==
pthread_getaffinity_np
(
pthread_self
(),
CPU_ALLOC_SIZE
(
CPU_SETSIZE
),
cset
))
{
if
(
0
==
pthread_getaffinity_np
(
pthread_self
(),
CPU_ALLOC_SIZE
(
CPU_SETSIZE
),
cset
))
{
char
txt
[
512
]
=
{
0
};
char
txt
[
512
]
=
{
0
};
for
(
int
j
=
0
;
j
<
CPU_SETSIZE
;
j
++
)
for
(
int
j
=
0
;
j
<
CPU_SETSIZE
;
j
++
)
if
(
CPU_ISSET
(
j
,
cset
))
if
(
CPU_ISSET
(
j
,
cset
))
sprintf
(
txt
+
strlen
(
txt
),
" %d "
,
j
);
sprintf
(
txt
+
strlen
(
txt
),
" %d "
,
j
);
printf
(
"CPU Affinity of thread %s is %s
\n
"
,
name
,
txt
);
printf
(
"CPU Affinity of thread %s is %s
\n
"
,
name
,
txt
);
}
}
CPU_FREE
(
cset
);
CPU_FREE
(
cset
);
#endif
#endif
}
}
void
init_UE
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
int
timing_correction
,
int
phy_test
,
int
UE_scan
,
int
UE_scan_carrier
,
runmode_t
mode
,
int
rxgain
,
int
txpowermax
,
LTE_DL_FRAME_PARMS
*
fp0
)
{
void
init_UE
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
int
timing_correction
,
int
phy_test
,
int
UE_scan
,
int
UE_scan_carrier
,
runmode_t
mode
,
int
rxgain
,
int
txpowermax
,
LTE_DL_FRAME_PARMS
*
fp0
)
{
PHY_VARS_UE
*
UE
;
PHY_VARS_UE
*
UE
;
int
inst
;
int
inst
;
int
ret
;
int
ret
;
LTE_DL_FRAME_PARMS
*
fp
;
LTE_DL_FRAME_PARMS
*
fp
;
LOG_I
(
PHY
,
"UE : Calling Layer 2 for initialization
\n
"
);
LOG_I
(
PHY
,
"UE : Calling Layer 2 for initialization
\n
"
);
l2_init_ue
(
eMBMS_active
,(
uecap_xer_in
==
1
)
?
uecap_xer
:
NULL
,
l2_init_ue
(
eMBMS_active
,(
uecap_xer_in
==
1
)
?
uecap_xer
:
NULL
,
0
,
// cba_group_active
0
,
// cba_group_active
0
);
// HO flag
0
);
// HO flag
if
(
PHY_vars_UE_g
==
NULL
)
PHY_vars_UE_g
=
(
PHY_VARS_UE
***
)
calloc
(
1
+
nb_inst
,
sizeof
(
PHY_VARS_UE
**
));
if
(
PHY_vars_UE_g
==
NULL
)
PHY_vars_UE_g
=
(
PHY_VARS_UE
***
)
calloc
(
1
+
nb_inst
,
sizeof
(
PHY_VARS_UE
**
));
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
if
(
PHY_vars_UE_g
[
inst
]
==
NULL
)
PHY_vars_UE_g
[
inst
]
=
(
PHY_VARS_UE
**
)
calloc
(
1
+
MAX_NUM_CCs
,
sizeof
(
PHY_VARS_UE
*
));
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
if
(
PHY_vars_UE_g
[
inst
]
==
NULL
)
PHY_vars_UE_g
[
inst
]
=
(
PHY_VARS_UE
**
)
calloc
(
1
+
MAX_NUM_CCs
,
sizeof
(
PHY_VARS_UE
*
));
LOG_I
(
PHY
,
"Allocating UE context %d
\n
"
,
inst
);
LOG_I
(
PHY
,
"Allocating UE context %d
\n
"
,
inst
);
if
(
simL1flag
==
0
)
PHY_vars_UE_g
[
inst
][
0
]
=
init_ue_vars
(
fp0
,
inst
,
0
);
if
(
simL1flag
==
0
)
PHY_vars_UE_g
[
inst
][
0
]
=
init_ue_vars
(
fp0
,
inst
,
0
);
...
@@ -273,9 +273,9 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
...
@@ -273,9 +273,9 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
RC
.
ru
[
0
]
->
frame_parms
.
nb_antennas_tx
=
fp0
->
nb_antennas_tx
;
RC
.
ru
[
0
]
->
frame_parms
.
nb_antennas_tx
=
fp0
->
nb_antennas_tx
;
PHY_vars_UE_g
[
inst
][
0
]
=
init_ue_vars
(
&
RC
.
ru
[
0
]
->
frame_parms
,
inst
,
0
);
PHY_vars_UE_g
[
inst
][
0
]
=
init_ue_vars
(
&
RC
.
ru
[
0
]
->
frame_parms
,
inst
,
0
);
}
}
// turn off timing control loop in UE
// turn off timing control loop in UE
PHY_vars_UE_g
[
inst
][
0
]
->
no_timing_correction
=
timing_correction
;
PHY_vars_UE_g
[
inst
][
0
]
->
no_timing_correction
=
timing_correction
;
UE
=
PHY_vars_UE_g
[
inst
][
0
];
UE
=
PHY_vars_UE_g
[
inst
][
0
];
fp
=
&
UE
->
frame_parms
;
fp
=
&
UE
->
frame_parms
;
printf
(
"PHY_vars_UE_g[0][0] = %p
\n
"
,
UE
);
printf
(
"PHY_vars_UE_g[0][0] = %p
\n
"
,
UE
);
...
@@ -290,7 +290,6 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
...
@@ -290,7 +290,6 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
UE
->
pusch_config_dedicated
[
i
].
betaOffset_ACK_Index
=
0
;
UE
->
pusch_config_dedicated
[
i
].
betaOffset_ACK_Index
=
0
;
UE
->
pusch_config_dedicated
[
i
].
betaOffset_RI_Index
=
0
;
UE
->
pusch_config_dedicated
[
i
].
betaOffset_RI_Index
=
0
;
UE
->
pusch_config_dedicated
[
i
].
betaOffset_CQI_Index
=
2
;
UE
->
pusch_config_dedicated
[
i
].
betaOffset_CQI_Index
=
2
;
UE
->
scheduling_request_config
[
i
].
sr_PUCCH_ResourceIndex
=
0
;
UE
->
scheduling_request_config
[
i
].
sr_PUCCH_ResourceIndex
=
0
;
UE
->
scheduling_request_config
[
i
].
sr_ConfigIndex
=
7
+
(
0
%
3
);
UE
->
scheduling_request_config
[
i
].
sr_ConfigIndex
=
7
+
(
0
%
3
);
UE
->
scheduling_request_config
[
i
].
dsr_TransMax
=
sr_n4
;
UE
->
scheduling_request_config
[
i
].
dsr_TransMax
=
sr_n4
;
...
@@ -305,44 +304,49 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
...
@@ -305,44 +304,49 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
if
(
UE
->
mac_enabled
==
1
)
{
if
(
UE
->
mac_enabled
==
1
)
{
UE
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1234
;
UE
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1234
;
UE
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1234
;
UE
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1234
;
}
else
{
}
else
{
UE
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1235
;
UE
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1235
;
UE
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1235
;
UE
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1235
;
}
}
UE
->
rx_total_gain_dB
=
rxgain
;
UE
->
rx_total_gain_dB
=
rxgain
;
UE
->
tx_power_max_dBm
=
txpowermax
;
UE
->
tx_power_max_dBm
=
txpowermax
;
UE
->
frame_parms
.
nb_antennas_tx
=
fp0
->
nb_antennas_tx
;
UE
->
frame_parms
.
nb_antennas_tx
=
fp0
->
nb_antennas_tx
;
UE
->
frame_parms
.
nb_antennas_rx
=
fp0
->
nb_antennas_rx
;
UE
->
frame_parms
.
nb_antennas_rx
=
fp0
->
nb_antennas_rx
;
if
(
fp
->
frame_type
==
TDD
)
{
if
(
fp
->
frame_type
==
TDD
)
{
switch
(
fp
->
N_RB_DL
)
{
switch
(
fp
->
N_RB_DL
)
{
case
100
:
case
100
:
if
(
fp
->
threequarter_fs
)
UE
->
N_TA_offset
=
(
624
*
3
)
/
4
;
if
(
fp
->
threequarter_fs
)
UE
->
N_TA_offset
=
(
624
*
3
)
/
4
;
else
UE
->
N_TA_offset
=
624
;
else
UE
->
N_TA_offset
=
624
;
break
;
break
;
case
75
:
case
75
:
UE
->
N_TA_offset
=
(
624
*
3
)
/
4
;
UE
->
N_TA_offset
=
(
624
*
3
)
/
4
;
break
;
break
;
case
50
:
case
50
:
UE
->
N_TA_offset
=
624
/
2
;
UE
->
N_TA_offset
=
624
/
2
;
break
;
break
;
case
25
:
case
25
:
UE
->
N_TA_offset
=
624
/
4
;
UE
->
N_TA_offset
=
624
/
4
;
break
;
break
;
case
15
:
case
15
:
UE
->
N_TA_offset
=
624
/
8
;
UE
->
N_TA_offset
=
624
/
8
;
break
;
break
;
case
6
:
case
6
:
UE
->
N_TA_offset
=
624
/
16
;
UE
->
N_TA_offset
=
624
/
16
;
break
;
break
;
default:
default:
AssertFatal
(
1
==
0
,
"illegal N_RB_DL %d
\n
"
,
fp
->
N_RB_DL
);
AssertFatal
(
1
==
0
,
"illegal N_RB_DL %d
\n
"
,
fp
->
N_RB_DL
);
break
;
break
;
}
}
}
}
else
UE
->
N_TA_offset
=
0
;
else
UE
->
N_TA_offset
=
0
;
if
(
IS_SOFTMODEM_BASICSIM
)
if
(
IS_SOFTMODEM_BASICSIM
)
/* this is required for the basic simulator in TDD mode
/* this is required for the basic simulator in TDD mode
...
@@ -350,24 +354,25 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
...
@@ -350,24 +354,25 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
*/
*/
UE
->
N_TA_offset
=
0
;
UE
->
N_TA_offset
=
0
;
if
(
simL1flag
==
1
)
init_ue_devices
(
UE
);
if
(
simL1flag
==
1
)
init_ue_devices
(
UE
);
LOG_I
(
PHY
,
"Intializing UE Threads for instance %d (%p,%p)...
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
],
PHY_vars_UE_g
[
inst
][
0
]);
LOG_I
(
PHY
,
"Intializing UE Threads for instance %d (%p,%p)...
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
],
PHY_vars_UE_g
[
inst
][
0
]);
init_UE_threads
(
inst
);
init_UE_threads
(
inst
);
if
(
simL1flag
==
0
)
{
if
(
simL1flag
==
0
)
{
ret
=
openair0_device_load
(
&
(
UE
->
rfdevice
),
&
openair0_cfg
[
0
]);
ret
=
openair0_device_load
(
&
(
UE
->
rfdevice
),
&
openair0_cfg
[
0
]);
if
(
ret
!=
0
){
if
(
ret
!=
0
)
{
exit_fun
(
"Error loading device library"
);
exit_fun
(
"Error loading device library"
);
}
}
}
}
UE
->
rfdevice
.
host_type
=
RAU_HOST
;
UE
->
rfdevice
.
host_type
=
RAU_HOST
;
// UE->rfdevice.type = NONE_DEV;
// UE->rfdevice.type = NONE_DEV;
AssertFatal
(
0
==
pthread_create
(
&
UE
->
proc
.
pthread_ue
,
AssertFatal
(
0
==
pthread_create
(
&
UE
->
proc
.
pthread_ue
,
&
UE
->
proc
.
attr_ue
,
&
UE
->
proc
.
attr_ue
,
UE_thread
,
UE_thread
,
(
void
*
)
UE
),
""
);
(
void
*
)
UE
),
""
);
}
}
printf
(
"UE threads created by %ld
\n
"
,
gettid
());
printf
(
"UE threads created by %ld
\n
"
,
gettid
());
...
@@ -376,31 +381,24 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
...
@@ -376,31 +381,24 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
// Initiating all UEs within a single set of threads for PHY_STUB. Future extensions -> multiple
// Initiating all UEs within a single set of threads for PHY_STUB. Future extensions -> multiple
// set of threads for multiple UEs.
// set of threads for multiple UEs.
void
init_UE_stub_single_thread
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
char
*
emul_iface
)
{
void
init_UE_stub_single_thread
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
char
*
emul_iface
)
{
int
inst
;
int
inst
;
LOG_I
(
PHY
,
"UE : Calling Layer 2 for initialization, nb_inst: %d
\n
"
,
nb_inst
);
LOG_I
(
PHY
,
"UE : Calling Layer 2 for initialization, nb_inst: %d
\n
"
,
nb_inst
);
l2_init_ue
(
eMBMS_active
,(
uecap_xer_in
==
1
)
?
uecap_xer
:
NULL
,
l2_init_ue
(
eMBMS_active
,(
uecap_xer_in
==
1
)
?
uecap_xer
:
NULL
,
0
,
// cba_group_active
0
,
// cba_group_active
0
);
// HO flag
0
);
// HO flag
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
LOG_I
(
PHY
,
"Initializing memory for UE instance %d (%p)
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
]);
LOG_I
(
PHY
,
"Initializing memory for UE instance %d (%p)
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
]);
// PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
// PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
}
}
init_timer_thread
();
init_timer_thread
();
init_UE_single_thread_stub
(
nb_inst
);
init_UE_single_thread_stub
(
nb_inst
);
printf
(
"UE threads created
\n
"
);
printf
(
"UE threads created
\n
"
);
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
if
(
nfapi_mode
!=
3
)
if
(
nfapi_mode
!=
3
)
multicast_link_start
(
ue_stub_rx_handler
,
0
,
emul_iface
);
multicast_link_start
(
ue_stub_rx_handler
,
0
,
emul_iface
);
}
}
...
@@ -408,36 +406,29 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in,
...
@@ -408,36 +406,29 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in,
void
init_UE_stub
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
char
*
emul_iface
)
{
void
init_UE_stub
(
int
nb_inst
,
int
eMBMS_active
,
int
uecap_xer_in
,
char
*
emul_iface
)
{
int
inst
;
int
inst
;
LOG_I
(
PHY
,
"UE : Calling Layer 2 for initialization
\n
"
);
LOG_I
(
PHY
,
"UE : Calling Layer 2 for initialization
\n
"
);
l2_init_ue
(
eMBMS_active
,(
uecap_xer_in
==
1
)
?
uecap_xer
:
NULL
,
l2_init_ue
(
eMBMS_active
,(
uecap_xer_in
==
1
)
?
uecap_xer
:
NULL
,
0
,
// cba_group_active
0
,
// cba_group_active
0
);
// HO flag
0
);
// HO flag
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
LOG_I
(
PHY
,
"Initializing memory for UE instance %d (%p)
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
]);
LOG_I
(
PHY
,
"Initializing memory for UE instance %d (%p)
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
]);
PHY_vars_UE_g
[
inst
][
0
]
=
init_ue_vars
(
NULL
,
inst
,
0
);
PHY_vars_UE_g
[
inst
][
0
]
=
init_ue_vars
(
NULL
,
inst
,
0
);
}
}
init_timer_thread
();
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
init_timer_thread
();
for
(
inst
=
0
;
inst
<
nb_inst
;
inst
++
)
{
LOG_I
(
PHY
,
"Intializing UE Threads for instance %d (%p,%p)...
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
],
PHY_vars_UE_g
[
inst
][
0
]);
LOG_I
(
PHY
,
"Intializing UE Threads for instance %d (%p,%p)...
\n
"
,
inst
,
PHY_vars_UE_g
[
inst
],
PHY_vars_UE_g
[
inst
][
0
]);
init_UE_threads_stub
(
inst
);
init_UE_threads_stub
(
inst
);
}
}
printf
(
"UE threads created
\n
"
);
printf
(
"UE threads created
\n
"
);
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
if
(
nfapi_mode
!=
3
)
if
(
nfapi_mode
!=
3
)
multicast_link_start
(
ue_stub_rx_handler
,
0
,
emul_iface
);
multicast_link_start
(
ue_stub_rx_handler
,
0
,
emul_iface
);
}
}
...
@@ -450,11 +441,10 @@ void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_ifa
...
@@ -450,11 +441,10 @@ 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.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
*/
static
void
*
UE_thread_synch
(
void
*
arg
)
static
void
*
UE_thread_synch
(
void
*
arg
)
{
{
static
int
UE_thread_synch_retval
;
static
int
UE_thread_synch_retval
;
int
i
;
int
i
;
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
int
current_band
=
0
;
int
current_band
=
0
;
int
current_offset
=
0
;
int
current_offset
=
0
;
sync_mode_t
sync_mode
=
pbch
;
sync_mode_t
sync_mode
=
pbch
;
...
@@ -463,22 +453,20 @@ static void *UE_thread_synch(void *arg)
...
@@ -463,22 +453,20 @@ static void *UE_thread_synch(void *arg)
int
found
;
int
found
;
int
freq_offset
=
0
;
int
freq_offset
=
0
;
char
threadname
[
128
];
char
threadname
[
128
];
printf
(
"UE_thread_sync in with PHY_vars_UE %p
\n
"
,
arg
);
printf
(
"UE_thread_sync in with PHY_vars_UE %p
\n
"
,
arg
);
cpu_set_t
cpuset
;
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
CPU_ZERO
(
&
cpuset
);
if
(
threads
.
iq
!=
-
1
)
if
(
threads
.
iq
!=
-
1
)
CPU_SET
(
threads
.
iq
,
&
cpuset
);
CPU_SET
(
threads
.
iq
,
&
cpuset
);
// this thread priority must be lower that the main acquisition thread
// this thread priority must be lower that the main acquisition thread
sprintf
(
threadname
,
"sync UE %d
\n
"
,
UE
->
Mod_id
);
sprintf
(
threadname
,
"sync UE %d
\n
"
,
UE
->
Mod_id
);
init_thread
(
100000
,
500000
,
FIFO_PRIORITY
-
1
,
&
cpuset
,
threadname
);
init_thread
(
100000
,
500000
,
FIFO_PRIORITY
-
1
,
&
cpuset
,
threadname
);
printf
(
"starting UE synch thread (IC %d)
\n
"
,
UE
->
proc
.
instance_cnt_synch
);
printf
(
"starting UE synch thread (IC %d)
\n
"
,
UE
->
proc
.
instance_cnt_synch
);
ind
=
0
;
ind
=
0
;
found
=
0
;
found
=
0
;
if
(
UE
->
UE_scan
==
0
)
{
if
(
UE
->
UE_scan
==
0
)
{
do
{
do
{
current_band
=
eutra_bands
[
ind
].
band
;
current_band
=
eutra_bands
[
ind
].
band
;
...
@@ -501,13 +489,14 @@ static void *UE_thread_synch(void *arg)
...
@@ -501,13 +489,14 @@ static void *UE_thread_synch(void *arg)
return
&
UE_thread_synch_retval
;
return
&
UE_thread_synch_retval
;
}
}
LOG_I
(
PHY
,
"[SCHED][UE] Check absolute frequency DL %"
PRIu32
", UL %"
PRIu32
" (oai_exit %d, rx_num_channels %d)
\n
"
,
UE
->
frame_parms
.
dl_CarrierFreq
,
UE
->
frame_parms
.
ul_CarrierFreq
,
oai_exit
,
openair0_cfg
[
0
].
rx_num_channels
);
LOG_I
(
PHY
,
"[SCHED][UE] Check absolute frequency DL %"
PRIu32
", UL %"
PRIu32
" (oai_exit %d, rx_num_channels %d)
\n
"
,
UE
->
frame_parms
.
dl_CarrierFreq
,
UE
->
frame_parms
.
ul_CarrierFreq
,
oai_exit
,
openair0_cfg
[
0
].
rx_num_channels
);
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
frame_parms
.
dl_CarrierFreq
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
frame_parms
.
dl_CarrierFreq
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
frame_parms
.
ul_CarrierFreq
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
frame_parms
.
ul_CarrierFreq
;
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
if
(
uplink_frequency_offset
[
CC_id
][
i
]
!=
0
)
//
if
(
uplink_frequency_offset
[
CC_id
][
i
]
!=
0
)
//
openair0_cfg
[
UE
->
rf_map
.
card
].
duplex_mode
=
duplex_mode_FDD
;
openair0_cfg
[
UE
->
rf_map
.
card
].
duplex_mode
=
duplex_mode_FDD
;
else
//FDD
else
//FDD
...
@@ -515,7 +504,6 @@ static void *UE_thread_synch(void *arg)
...
@@ -515,7 +504,6 @@ static void *UE_thread_synch(void *arg)
}
}
sync_mode
=
pbch
;
sync_mode
=
pbch
;
}
else
if
(
UE
->
UE_scan
==
1
)
{
}
else
if
(
UE
->
UE_scan
==
1
)
{
current_band
=
0
;
current_band
=
0
;
...
@@ -530,20 +518,21 @@ static void *UE_thread_synch(void *arg)
...
@@ -530,20 +518,21 @@ static void *UE_thread_synch(void *arg)
}
}
}
}
/*
/*
while (sync_var<0)
while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_mutex_unlock(&sync_mutex);
pthread_mutex_unlock(&sync_mutex);
*/
*/
wait_sync
(
"UE_thread_sync"
);
wait_sync
(
"UE_thread_sync"
);
printf
(
"Started device, unlocked sync_mutex (UE_sync_thread)
\n
"
);
printf
(
"Started device, unlocked sync_mutex (UE_sync_thread)
\n
"
);
while
(
oai_exit
==
0
)
{
while
(
oai_exit
==
0
)
{
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
while
(
UE
->
proc
.
instance_cnt_synch
<
0
)
while
(
UE
->
proc
.
instance_cnt_synch
<
0
)
// the thread waits here most of the time
// the thread waits here most of the time
pthread_cond_wait
(
&
UE
->
proc
.
cond_synch
,
&
UE
->
proc
.
mutex_synch
);
pthread_cond_wait
(
&
UE
->
proc
.
cond_synch
,
&
UE
->
proc
.
mutex_synch
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
switch
(
sync_mode
)
{
switch
(
sync_mode
)
{
...
@@ -565,10 +554,10 @@ static void *UE_thread_synch(void *arg)
...
@@ -565,10 +554,10 @@ static void *UE_thread_synch(void *arg)
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
downlink_frequency
[
UE
->
rf_map
.
card
][
UE
->
rf_map
.
chain
+
i
]
=
bands_to_scan
.
band_info
[
current_band
].
dl_min
+
current_offset
;
downlink_frequency
[
UE
->
rf_map
.
card
][
UE
->
rf_map
.
chain
+
i
]
=
bands_to_scan
.
band_info
[
current_band
].
dl_min
+
current_offset
;
uplink_frequency_offset
[
UE
->
rf_map
.
card
][
UE
->
rf_map
.
chain
+
i
]
=
bands_to_scan
.
band_info
[
current_band
].
ul_min
-
bands_to_scan
.
band_info
[
0
].
dl_min
+
current_offset
;
uplink_frequency_offset
[
UE
->
rf_map
.
card
][
UE
->
rf_map
.
chain
+
i
]
=
bands_to_scan
.
band_info
[
current_band
].
ul_min
-
bands_to_scan
.
band_info
[
0
].
dl_min
+
current_offset
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
];
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
];
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
uplink_frequency_offset
[
CC_id
][
i
];
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
uplink_frequency_offset
[
CC_id
][
i
];
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_gain
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
rx_total_gain_dB
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_gain
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
rx_total_gain_dB
;
if
(
UE
->
UE_scan_carrier
)
{
if
(
UE
->
UE_scan_carrier
)
{
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
}
}
...
@@ -577,10 +566,9 @@ static void *UE_thread_synch(void *arg)
...
@@ -577,10 +566,9 @@ static void *UE_thread_synch(void *arg)
break
;
break
;
case
pbch
:
case
pbch
:
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
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
,
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
"
,
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
,
(
UE
->
rx_offset
<<
1
)
/
UE
->
frame_parms
.
samples_per_tti
,
freq_offset
,
freq_offset
,
...
@@ -589,15 +577,16 @@ static void *UE_thread_synch(void *arg)
...
@@ -589,15 +577,16 @@ static void *UE_thread_synch(void *arg)
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
]
+
freq_offset
,
UE
->
UE_scan_carrier
);
UE
->
UE_scan_carrier
);
// rerun with new cell parameters and frequency-offset
// rerun with new cell parameters and frequency-offset
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_gain
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
rx_total_gain_dB
;
//-USRP_GAIN_OFFSET;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_gain
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
rx_total_gain_dB
;
//-USRP_GAIN_OFFSET;
if
(
UE
->
UE_scan_carrier
==
1
)
{
if
(
UE
->
UE_scan_carrier
==
1
)
{
if
(
freq_offset
>=
0
)
if
(
freq_offset
>=
0
)
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
+=
abs
(
UE
->
common_vars
.
freq_offset
);
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
+=
abs
(
UE
->
common_vars
.
freq_offset
);
else
else
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
-=
abs
(
UE
->
common_vars
.
freq_offset
);
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
-=
abs
(
UE
->
common_vars
.
freq_offset
);
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
+
uplink_frequency_offset
[
CC_id
][
i
];
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
+
uplink_frequency_offset
[
CC_id
][
i
];
downlink_frequency
[
CC_id
][
i
]
=
openair0_cfg
[
CC_id
].
rx_freq
[
i
];
downlink_frequency
[
CC_id
][
i
]
=
openair0_cfg
[
CC_id
].
rx_freq
[
i
];
...
@@ -613,18 +602,21 @@ static void *UE_thread_synch(void *arg)
...
@@ -613,18 +602,21 @@ static void *UE_thread_synch(void *arg)
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_bw
=
.96e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_bw
=
.96e6
;
// openair0_cfg[0].rx_gain[0] -= 12;
// openair0_cfg[0].rx_gain[0] -= 12;
break
;
break
;
case
25
:
case
25
:
openair0_cfg
[
UE
->
rf_map
.
card
].
sample_rate
=
7.68e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
sample_rate
=
7.68e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_bw
=
2.5e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_bw
=
2.5e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_bw
=
2.5e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_bw
=
2.5e6
;
// openair0_cfg[0].rx_gain[0] -= 6;
// openair0_cfg[0].rx_gain[0] -= 6;
break
;
break
;
case
50
:
case
50
:
openair0_cfg
[
UE
->
rf_map
.
card
].
sample_rate
=
15.36e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
sample_rate
=
15.36e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_bw
=
5.0e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_bw
=
5.0e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_bw
=
5.0e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_bw
=
5.0e6
;
// openair0_cfg[0].rx_gain[0] -= 3;
// openair0_cfg[0].rx_gain[0] -= 3;
break
;
break
;
case
100
:
case
100
:
openair0_cfg
[
UE
->
rf_map
.
card
].
sample_rate
=
30.72e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
sample_rate
=
30.72e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_bw
=
10.0e6
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_bw
=
10.0e6
;
...
@@ -638,13 +630,13 @@ static void *UE_thread_synch(void *arg)
...
@@ -638,13 +630,13 @@ static void *UE_thread_synch(void *arg)
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
sleep
(
1
);
sleep
(
1
);
init_frame_parms
(
&
UE
->
frame_parms
,
1
);
init_frame_parms
(
&
UE
->
frame_parms
,
1
);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
oai_exit=1;
}*/
}*/
if
(
UE
->
UE_scan_carrier
==
1
)
{
if
(
UE
->
UE_scan_carrier
==
1
)
{
UE
->
UE_scan_carrier
=
0
;
UE
->
UE_scan_carrier
=
0
;
}
else
{
}
else
{
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
...
@@ -653,9 +645,10 @@ static void *UE_thread_synch(void *arg)
...
@@ -653,9 +645,10 @@ static void *UE_thread_synch(void *arg)
if
(
UE
->
mode
==
rx_dump_frame
)
{
if
(
UE
->
mode
==
rx_dump_frame
)
{
FILE
*
fd
;
FILE
*
fd
;
if
((
UE
->
proc
.
proc_rxtx
[
0
].
frame_rx
&
1
)
==
0
)
{
// this guarantees SIB1 is present
if
((
UE
->
proc
.
proc_rxtx
[
0
].
frame_rx
&
1
)
==
0
)
{
// this guarantees SIB1 is present
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
fwrite
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
fwrite
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
sizeof
(
int32_t
),
sizeof
(
int32_t
),
10
*
UE
->
frame_parms
.
samples_per_tti
,
10
*
UE
->
frame_parms
.
samples_per_tti
,
fd
);
fd
);
...
@@ -670,7 +663,6 @@ static void *UE_thread_synch(void *arg)
...
@@ -670,7 +663,6 @@ static void *UE_thread_synch(void *arg)
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
UE
->
is_synchronized
=
0
;
UE
->
is_synchronized
=
0
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
}
}
}
}
}
}
...
@@ -680,13 +672,15 @@ static void *UE_thread_synch(void *arg)
...
@@ -680,13 +672,15 @@ static void *UE_thread_synch(void *arg)
if
(
UE
->
UE_scan_carrier
==
1
)
{
if
(
UE
->
UE_scan_carrier
==
1
)
{
if
(
freq_offset
>=
0
)
if
(
freq_offset
>=
0
)
freq_offset
+=
100
;
freq_offset
+=
100
;
freq_offset
*=
-
1
;
freq_offset
*=
-
1
;
if
(
abs
(
freq_offset
)
>
7500
)
{
if
(
abs
(
freq_offset
)
>
7500
)
{
LOG_I
(
PHY
,
"[initial_sync] No cell synchronization found, abandoning
\n
"
);
LOG_I
(
PHY
,
"[initial_sync] No cell synchronization found, abandoning
\n
"
);
FILE
*
fd
;
FILE
*
fd
;
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
fwrite
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
fwrite
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
sizeof
(
int32_t
),
sizeof
(
int32_t
),
10
*
UE
->
frame_parms
.
samples_per_tti
,
10
*
UE
->
frame_parms
.
samples_per_tti
,
fd
);
fd
);
...
@@ -694,10 +688,12 @@ static void *UE_thread_synch(void *arg)
...
@@ -694,10 +688,12 @@ static void *UE_thread_synch(void *arg)
fclose
(
fd
);
fclose
(
fd
);
exit
(
0
);
exit
(
0
);
}
}
AssertFatal
(
1
==
0
,
"No cell synchronization found, abandoning"
);
AssertFatal
(
1
==
0
,
"No cell synchronization found, abandoning"
);
return
&
UE_thread_synch_retval
;
// not reached
return
&
UE_thread_synch_retval
;
// not reached
}
}
}
}
LOG_I
(
PHY
,
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
LOG_I
(
PHY
,
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
freq_offset
,
UE
->
rx_total_gain_dB
,
UE
->
rx_total_gain_dB
,
...
@@ -708,12 +704,16 @@ static void *UE_thread_synch(void *arg)
...
@@ -708,12 +704,16 @@ static void *UE_thread_synch(void *arg)
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
freq_offset
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
freq_offset
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
uplink_frequency_offset
[
CC_id
][
i
]
+
freq_offset
;
openair0_cfg
[
UE
->
rf_map
.
card
].
tx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
uplink_frequency_offset
[
CC_id
][
i
]
+
freq_offset
;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_gain
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
rx_total_gain_dB
;
//-USRP_GAIN_OFFSET;
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_gain
[
UE
->
rf_map
.
chain
+
i
]
=
UE
->
rx_total_gain_dB
;
//-USRP_GAIN_OFFSET;
if
(
UE
->
UE_scan_carrier
==
1
)
if
(
UE
->
UE_scan_carrier
==
1
)
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
}
}
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
}
// initial_sync=0
}
// initial_sync=0
break
;
break
;
case
si
:
case
si
:
default:
default:
break
;
break
;
...
@@ -723,7 +723,6 @@ static void *UE_thread_synch(void *arg)
...
@@ -723,7 +723,6 @@ static void *UE_thread_synch(void *arg)
// indicate readiness
// indicate readiness
UE
->
proc
.
instance_cnt_synch
--
;
UE
->
proc
.
instance_cnt_synch
--
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH
,
0
);
}
// while !oai_exit
}
// while !oai_exit
...
@@ -737,15 +736,18 @@ static void *UE_thread_synch(void *arg)
...
@@ -737,15 +736,18 @@ static void *UE_thread_synch(void *arg)
* \param arg is a pointer to a \ref PHY_VARS_UE structure.
* \param arg is a pointer to a \ref PHY_VARS_UE structure.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
*/
const
char
*
get_connectionloss_errstr
(
int
errcode
)
{
const
char
*
get_connectionloss_errstr
(
int
errcode
)
{
switch
(
errcode
)
{
switch
(
errcode
)
{
case
CONNECTION_LOST
:
case
CONNECTION_LOST
:
return
"RRC Connection lost, returning to PRACH"
;
return
"RRC Connection lost, returning to PRACH"
;
case
PHY_RESYNCH
:
case
PHY_RESYNCH
:
return
"RRC Connection lost, trying to resynch"
;
return
"RRC Connection lost, trying to resynch"
;
case
RESYNCH
:
case
RESYNCH
:
return
"return to PRACH and perform a contention-free access"
;
return
"return to PRACH and perform a contention-free access"
;
};
};
return
"UNKNOWN RETURN CODE"
;
return
"UNKNOWN RETURN CODE"
;
}
}
...
@@ -754,9 +756,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -754,9 +756,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
struct
rx_tx_thread_data
*
rtd
=
arg
;
struct
rx_tx_thread_data
*
rtd
=
arg
;
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
PHY_VARS_UE
*
UE
=
rtd
->
UE
;
PHY_VARS_UE
*
UE
=
rtd
->
UE
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
char
threadname
[
256
];
char
threadname
[
256
];
sprintf
(
threadname
,
"UE_%d_proc_%d"
,
UE
->
Mod_id
,
proc
->
sub_frame_start
);
sprintf
(
threadname
,
"UE_%d_proc_%d"
,
UE
->
Mod_id
,
proc
->
sub_frame_start
);
cpu_set_t
cpuset
;
cpu_set_t
cpuset
;
...
@@ -764,12 +764,15 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -764,12 +764,15 @@ static void *UE_thread_rxn_txnp4(void *arg) {
if
(
(
proc
->
sub_frame_start
+
1
)
%
RX_NB_TH
==
0
&&
threads
.
one
!=
-
1
)
if
(
(
proc
->
sub_frame_start
+
1
)
%
RX_NB_TH
==
0
&&
threads
.
one
!=
-
1
)
CPU_SET
(
threads
.
one
,
&
cpuset
);
CPU_SET
(
threads
.
one
,
&
cpuset
);
if
(
(
proc
->
sub_frame_start
+
1
)
%
RX_NB_TH
==
1
&&
threads
.
two
!=
-
1
)
if
(
(
proc
->
sub_frame_start
+
1
)
%
RX_NB_TH
==
1
&&
threads
.
two
!=
-
1
)
CPU_SET
(
threads
.
two
,
&
cpuset
);
CPU_SET
(
threads
.
two
,
&
cpuset
);
if
(
(
proc
->
sub_frame_start
+
1
)
%
RX_NB_TH
==
2
&&
threads
.
three
!=
-
1
)
if
(
(
proc
->
sub_frame_start
+
1
)
%
RX_NB_TH
==
2
&&
threads
.
three
!=
-
1
)
CPU_SET
(
threads
.
three
,
&
cpuset
);
CPU_SET
(
threads
.
three
,
&
cpuset
);
//CPU_SET(threads.three, &cpuset);
//CPU_SET(threads.three, &cpuset);
init_thread
(
900000
,
1000000
,
FIFO_PRIORITY
-
1
,
&
cpuset
,
init_thread
(
900000
,
1000000
,
FIFO_PRIORITY
-
1
,
&
cpuset
,
threadname
);
threadname
);
while
(
!
oai_exit
)
{
while
(
!
oai_exit
)
{
...
@@ -777,22 +780,23 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -777,22 +780,23 @@ static void *UE_thread_rxn_txnp4(void *arg) {
LOG_E
(
PHY
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
LOG_E
(
PHY
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
while
(
proc
->
instance_cnt_rxtx
<
0
)
{
while
(
proc
->
instance_cnt_rxtx
<
0
)
{
// most of the time, the thread is waiting here
// most of the time, the thread is waiting here
pthread_cond_wait
(
&
proc
->
cond_rxtx
,
&
proc
->
mutex_rxtx
);
pthread_cond_wait
(
&
proc
->
cond_rxtx
,
&
proc
->
mutex_rxtx
);
}
}
//printf("Processing sub frqme %d in %s\n", proc->subframe_rx, threadname);
//printf("Processing sub frqme %d in %s\n", proc->subframe_rx, threadname);
initRefTimes
(
t2
);
initRefTimes
(
t2
);
initRefTimes
(
t3
);
initRefTimes
(
t3
);
pickTime
(
current
);
pickTime
(
current
);
updateTimes
(
proc
->
gotIQs
,
&
t2
,
10000
,
"Delay to wake up UE_Thread_Rx (case 2)"
);
updateTimes
(
proc
->
gotIQs
,
&
t2
,
10000
,
"Delay to wake up UE_Thread_Rx (case 2)"
);
// Process Rx data for one sub-frame
// Process Rx data for one sub-frame
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
if
((
sf_type
==
SF_DL
)
||
if
((
sf_type
==
SF_DL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
(
sf_type
==
SF_S
))
{
(
sf_type
==
SF_S
))
{
if
(
UE
->
frame_parms
.
frame_type
==
TDD
)
{
if
(
UE
->
frame_parms
.
frame_type
==
TDD
)
{
LOG_D
(
PHY
,
"%s,TDD%d,%s: calling UE_RX
\n
"
,
LOG_D
(
PHY
,
"%s,TDD%d,%s: calling UE_RX
\n
"
,
threadname
,
threadname
,
...
@@ -809,6 +813,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -809,6 +813,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
(
sf_type
==
SF_UL
?
"SF_UL"
:
(
sf_type
==
SF_UL
?
"SF_UL"
:
(
sf_type
==
SF_S
?
"SF_S"
:
"UNKNOWN_SF_TYPE"
))));
(
sf_type
==
SF_S
?
"SF_S"
:
"UNKNOWN_SF_TYPE"
))));
}
}
#ifdef UE_SLOT_PARALLELISATION
#ifdef UE_SLOT_PARALLELISATION
phy_procedures_slot_parallelization_UE_RX
(
UE
,
proc
,
0
,
0
,
1
,
UE
->
mode
,
no_relay
,
NULL
);
phy_procedures_slot_parallelization_UE_RX
(
UE
,
proc
,
0
,
0
,
1
,
UE
->
mode
,
no_relay
,
NULL
);
#else
#else
...
@@ -819,8 +824,8 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -819,8 +824,8 @@ static void *UE_thread_rxn_txnp4(void *arg) {
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
start_meas
(
&
UE
->
generic_stat
);
start_meas
(
&
UE
->
generic_stat
);
#endif
#endif
if
(
UE
->
mac_enabled
==
1
)
{
if
(
UE
->
mac_enabled
==
1
)
{
int
ret
=
ue_scheduler
(
UE
->
Mod_id
,
int
ret
=
ue_scheduler
(
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
subframe_rx
,
...
@@ -829,16 +834,17 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -829,16 +834,17 @@ static void *UE_thread_rxn_txnp4(void *arg) {
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
),
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
),
0
,
0
,
0
/*FIXME CC_id*/
);
0
/*FIXME CC_id*/
);
if
(
ret
!=
CONNECTION_OK
)
{
if
(
ret
!=
CONNECTION_OK
)
{
LOG_E
(
PHY
,
"[UE %"
PRIu8
"] Frame %"
PRIu32
", subframe %u %s
\n
"
,
LOG_E
(
PHY
,
"[UE %"
PRIu8
"] Frame %"
PRIu32
", subframe %u %s
\n
"
,
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_tx
,
get_connectionloss_errstr
(
ret
)
);
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_tx
,
get_connectionloss_errstr
(
ret
)
);
}
}
}
}
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
stop_meas
(
&
UE
->
generic_stat
);
stop_meas
(
&
UE
->
generic_stat
);
#endif
#endif
// Prepare the future Tx data
// Prepare the future Tx data
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_UL
)
||
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_UL
)
||
...
@@ -846,18 +852,18 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -846,18 +852,18 @@ static void *UE_thread_rxn_txnp4(void *arg) {
if
(
UE
->
mode
!=
loop_through_memory
)
if
(
UE
->
mode
!=
loop_through_memory
)
phy_procedures_UE_TX
(
UE
,
proc
,
0
,
0
,
UE
->
mode
);
phy_procedures_UE_TX
(
UE
,
proc
,
0
,
0
,
UE
->
mode
);
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_S
)
&&
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_S
)
&&
(
UE
->
frame_parms
.
frame_type
==
TDD
))
(
UE
->
frame_parms
.
frame_type
==
TDD
))
if
(
UE
->
mode
!=
loop_through_memory
)
if
(
UE
->
mode
!=
loop_through_memory
)
phy_procedures_UE_S_TX
(
UE
,
0
,
0
);
phy_procedures_UE_S_TX
(
UE
,
0
,
0
);
updateTimes
(
current
,
&
t3
,
10000
,
"Delay to process sub-frame (case 3)"
);
updateTimes
(
current
,
&
t3
,
10000
,
"Delay to process sub-frame (case 3)"
);
proc
->
instance_cnt_rxtx
--
;
proc
->
instance_cnt_rxtx
--
;
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
)
{
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
)
{
if
(
pthread_cond_signal
(
&
proc
->
cond_rxtx
)
!=
0
)
abort
();
if
(
pthread_cond_signal
(
&
proc
->
cond_rxtx
)
!=
0
)
abort
();
}
}
if
(
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
)
!=
0
)
{
if
(
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
)
!=
0
)
{
LOG_E
(
PHY
,
"[SCHED][UE] error unlocking mutex for UE RXTX
\n
"
);
LOG_E
(
PHY
,
"[SCHED][UE] error unlocking mutex for UE RXTX
\n
"
);
exit_fun
(
"noting to add"
);
exit_fun
(
"noting to add"
);
...
@@ -874,30 +880,28 @@ static void *UE_thread_rxn_txnp4(void *arg) {
...
@@ -874,30 +880,28 @@ static void *UE_thread_rxn_txnp4(void *arg) {
unsigned
int
emulator_absSF
;
unsigned
int
emulator_absSF
;
void
ue_stub_rx_handler
(
unsigned
int
num_bytes
,
char
*
rx_buffer
)
{
void
ue_stub_rx_handler
(
unsigned
int
num_bytes
,
char
*
rx_buffer
)
{
PHY_VARS_UE
*
UE
;
PHY_VARS_UE
*
UE
;
UE
=
PHY_vars_UE_g
[
0
][
0
];
UE
=
PHY_vars_UE_g
[
0
][
0
];
UE_tport_t
*
pdu
=
(
UE_tport_t
*
)
rx_buffer
;
SLSCH_t
*
slsch
=
(
SLSCH_t
*
)
&
pdu
->
slsch
;
SLDCH_t
*
sldch
=
(
SLDCH_t
*
)
&
pdu
->
sldch
;
UE_tport_t
*
pdu
=
(
UE_tport_t
*
)
rx_buffer
;
switch
(((
UE_tport_header_t
*
)
rx_buffer
)
->
packet_type
)
{
SLSCH_t
*
slsch
=
(
SLSCH_t
*
)
&
pdu
->
slsch
;
SLDCH_t
*
sldch
=
(
SLDCH_t
*
)
&
pdu
->
sldch
;
switch
(((
UE_tport_header_t
*
)
rx_buffer
)
->
packet_type
)
{
case
TTI_SYNC
:
case
TTI_SYNC
:
emulator_absSF
=
((
UE_tport_header_t
*
)
rx_buffer
)
->
absSF
;
emulator_absSF
=
((
UE_tport_header_t
*
)
rx_buffer
)
->
absSF
;
wakeup_thread
(
&
UE
->
timer_mutex
,
&
UE
->
timer_cond
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
wakeup_thread
(
&
UE
->
timer_mutex
,
&
UE
->
timer_cond
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
break
;
break
;
case
SLSCH
:
case
SLSCH
:
LOG_I
(
PHY
,
"Emulator SFN.SF %d.%d, Got SLSCH packet
\n
"
,
emulator_absSF
/
10
,
emulator_absSF
%
10
);
LOG_I
(
PHY
,
"Emulator SFN.SF %d.%d, Got SLSCH packet
\n
"
,
emulator_absSF
/
10
,
emulator_absSF
%
10
);
LOG_I
(
PHY
,
"Received %d bytes on UE-UE link for SFN.SF %d.%d, sending SLSCH payload (%d bytes) to MAC
\n
"
,
num_bytes
,
LOG_I
(
PHY
,
"Received %d bytes on UE-UE link for SFN.SF %d.%d, sending SLSCH payload (%d bytes) to MAC
\n
"
,
num_bytes
,
pdu
->
header
.
absSF
/
10
,
pdu
->
header
.
absSF
%
10
,
pdu
->
header
.
absSF
/
10
,
pdu
->
header
.
absSF
%
10
,
slsch
->
payload_length
);
slsch
->
payload_length
);
printf
(
"SLSCH:"
);
printf
(
"SLSCH:"
);
for
(
int
i
=
0
;
i
<
sizeof
(
SLSCH_t
);
i
++
)
printf
(
"%x "
,((
uint8_t
*
)
slsch
)[
i
]);
printf
(
"
\n
"
);
for
(
int
i
=
0
;
i
<
sizeof
(
SLSCH_t
);
i
++
)
printf
(
"%x "
,((
uint8_t
*
)
slsch
)[
i
]);
printf
(
"
\n
"
);
ue_send_sl_sdu
(
0
,
ue_send_sl_sdu
(
0
,
0
,
0
,
pdu
->
header
.
absSF
/
10
,
pdu
->
header
.
absSF
/
10
,
...
@@ -909,16 +913,15 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
...
@@ -909,16 +913,15 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
break
;
break
;
case
SLDCH
:
case
SLDCH
:
LOG_I
(
PHY
,
"Emulator SFN.SF %d.%d, Got SLDCH packet
\n
"
,
emulator_absSF
/
10
,
emulator_absSF
%
10
);
LOG_I
(
PHY
,
"Emulator SFN.SF %d.%d, Got SLDCH packet
\n
"
,
emulator_absSF
/
10
,
emulator_absSF
%
10
);
LOG_I
(
PHY
,
"Received %d bytes on UE-UE link for SFN.SF %d.%d, sending SLDCH payload (%d bytes) to MAC
\n
"
,
num_bytes
,
LOG_I
(
PHY
,
"Received %d bytes on UE-UE link for SFN.SF %d.%d, sending SLDCH payload (%d bytes) to MAC
\n
"
,
num_bytes
,
pdu
->
header
.
absSF
/
10
,
pdu
->
header
.
absSF
%
10
,
pdu
->
header
.
absSF
/
10
,
pdu
->
header
.
absSF
%
10
,
sldch
->
payload_length
);
sldch
->
payload_length
);
printf
(
"SLDCH:"
);
printf
(
"SLDCH:"
);
for
(
int
i
=
0
;
i
<
sizeof
(
SLDCH_t
);
i
++
)
printf
(
"%x "
,((
uint8_t
*
)
sldch
)[
i
]);
printf
(
"
\n
"
);
for
(
int
i
=
0
;
i
<
sizeof
(
SLDCH_t
);
i
++
)
printf
(
"%x "
,((
uint8_t
*
)
sldch
)[
i
]);
printf
(
"
\n
"
);
ue_send_sl_sdu
(
0
,
ue_send_sl_sdu
(
0
,
0
,
0
,
pdu
->
header
.
absSF
/
10
,
pdu
->
header
.
absSF
/
10
,
...
@@ -928,7 +931,6 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
...
@@ -928,7 +931,6 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
0
,
0
,
SL_DISCOVERY_FLAG_YES
);
SL_DISCOVERY_FLAG_YES
);
break
;
break
;
}
}
}
}
...
@@ -942,21 +944,19 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
...
@@ -942,21 +944,19 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
*/
*/
static
void
*
UE_phy_stub_single_thread_rxn_txnp4
(
void
*
arg
)
{
static
void
*
UE_phy_stub_single_thread_rxn_txnp4
(
void
*
arg
)
{
thread_top_init
(
"UE_phy_stub_thread_rxn_txnp4"
,
1
,
870000L
,
1000000L
,
1000000L
);
thread_top_init
(
"UE_phy_stub_thread_rxn_txnp4"
,
1
,
870000L
,
1000000L
,
1000000L
);
// for multipule UE's L2-emulator
// for multipule UE's L2-emulator
//module_id_t Mod_id = 0;
//module_id_t Mod_id = 0;
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
static
__thread
int
UE_thread_rxtx_retval
;
static
__thread
int
UE_thread_rxtx_retval
;
struct
rx_tx_thread_data
*
rtd
=
arg
;
struct
rx_tx_thread_data
*
rtd
=
arg
;
if
(
rtd
==
NULL
)
{
if
(
rtd
==
NULL
)
{
LOG_E
(
MAC
,
"[SCHED][UE] rx_tx_thread_data *rtd: NULL pointer
\n
"
);
LOG_E
(
MAC
,
"[SCHED][UE] rx_tx_thread_data *rtd: NULL pointer
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
// settings for nfapi-L2-emulator mode
// settings for nfapi-L2-emulator mode
module_id_t
ue_thread_id
=
rtd
->
ue_thread_id
;
module_id_t
ue_thread_id
=
rtd
->
ue_thread_id
;
uint16_t
ue_index
=
0
;
uint16_t
ue_index
=
0
;
...
@@ -967,11 +967,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -967,11 +967,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
uint8_t
end_flag
;
uint8_t
end_flag
;
proc
=
&
PHY_vars_UE_g
[
0
][
0
]
->
proc
.
proc_rxtx
[
0
];
proc
=
&
PHY_vars_UE_g
[
0
][
0
]
->
proc
.
proc_rxtx
[
0
];
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
UE
=
rtd
->
UE
;
UE
=
rtd
->
UE
;
if
(
ue_thread_id
==
0
)
{
if
(
ue_thread_id
==
0
){
phy_stub_ticking
->
ticking_var
=
-
1
;
phy_stub_ticking
->
ticking_var
=
-
1
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
// Initializations for nfapi-L2-emulator mode
// Initializations for nfapi-L2-emulator mode
...
@@ -981,35 +979,38 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -981,35 +979,38 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
tx_request_pdu_list
=
NULL
;
tx_request_pdu_list
=
NULL
;
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
do
{
do
{
end_flag
=
1
;
end_flag
=
1
;
for
(
uint16_t
i
=
0
;
i
<
NB_THREAD_INST
;
i
++
){
if
(
phy_stub_ticking
->
num_single_thread
[
i
]
==
0
){
for
(
uint16_t
i
=
0
;
i
<
NB_THREAD_INST
;
i
++
)
{
if
(
phy_stub_ticking
->
num_single_thread
[
i
]
==
0
)
{
end_flag
=
0
;
end_flag
=
0
;
}
}
}
}
}
while
(
end_flag
==
0
);
}
while
(
end_flag
==
0
);
sync_var
=
0
;
sync_var
=
0
;
}
}
//PANOS: CAREFUL HERE!
//PANOS: CAREFUL HERE!
wait_sync
(
"UE_phy_stub_single_thread_rxn_txnp4"
);
wait_sync
(
"UE_phy_stub_single_thread_rxn_txnp4"
);
while
(
!
oai_exit
)
{
while
(
!
oai_exit
)
{
if
(
ue_thread_id
==
0
){
if
(
ue_thread_id
==
0
)
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
while
(
phy_stub_ticking
->
ticking_var
<
0
)
{
while
(
phy_stub_ticking
->
ticking_var
<
0
)
{
// most of the time, the thread is waiting here
// most of the time, the thread is waiting here
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
LOG_D
(
MAC
,
"Waiting for ticking_var
\n
"
);
LOG_D
(
MAC
,
"Waiting for ticking_var
\n
"
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_ticking
,
&
phy_stub_ticking
->
mutex_ticking
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_ticking
,
&
phy_stub_ticking
->
mutex_ticking
);
}
}
phy_stub_ticking
->
ticking_var
--
;
phy_stub_ticking
->
ticking_var
--
;
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for UE RXn_TXnp4
\n
"
);
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for UE RXn_TXnp4
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
...
@@ -1017,7 +1018,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1017,7 +1018,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
proc
->
subframe_rx
=
timer_subframe
;
proc
->
subframe_rx
=
timer_subframe
;
proc
->
frame_rx
=
timer_frame
;
proc
->
frame_rx
=
timer_frame
;
// FDD and TDD tx timing settings.
// FDD and TDD tx timing settings.
// XXX:It is the result of timing adjustment in debug.
// XXX:It is the result of timing adjustment in debug.
// It is necessary to investigate why this will work in the future.
// It is necessary to investigate why this will work in the future.
...
@@ -1041,33 +1041,26 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1041,33 +1041,26 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
initRefTimes(t3);
initRefTimes(t3);
pickTime(current);
pickTime(current);
updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
// Not sure whether we should put the memory allocation here and not sure how much memory
// Not sure whether we should put the memory allocation here and not sure how much memory
//we should allocate for each subframe cycle.
//we should allocate for each subframe cycle.
UL_INFO
=
(
UL_IND_t
*
)
malloc
(
sizeof
(
UL_IND_t
));
UL_INFO
=
(
UL_IND_t
*
)
malloc
(
sizeof
(
UL_IND_t
));
UL_INFO
->
rx_ind
.
rx_indication_body
.
rx_pdu_list
=
(
nfapi_rx_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_rx_indication_pdu_t
));
UL_INFO
->
rx_ind
.
rx_indication_body
.
rx_pdu_list
=
(
nfapi_rx_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_rx_indication_pdu_t
));
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
=
0
;
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
=
0
;
UL_INFO
->
crc_ind
.
crc_indication_body
.
crc_pdu_list
=
(
nfapi_crc_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_crc_indication_pdu_t
));
UL_INFO
->
crc_ind
.
crc_indication_body
.
crc_pdu_list
=
(
nfapi_crc_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_crc_indication_pdu_t
));
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
=
0
;
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
=
0
;
UL_INFO
->
harq_ind
.
harq_indication_body
.
harq_pdu_list
=
(
nfapi_harq_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_harq_indication_pdu_t
));
UL_INFO
->
harq_ind
.
harq_indication_body
.
harq_pdu_list
=
(
nfapi_harq_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_harq_indication_pdu_t
));
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
=
0
;
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
=
0
;
UL_INFO
->
sr_ind
.
sr_indication_body
.
sr_pdu_list
=
(
nfapi_sr_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_sr_indication_pdu_t
));
UL_INFO
->
sr_ind
.
sr_indication_body
.
sr_pdu_list
=
(
nfapi_sr_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_sr_indication_pdu_t
));
UL_INFO
->
sr_ind
.
sr_indication_body
.
number_of_srs
=
0
;
UL_INFO
->
sr_ind
.
sr_indication_body
.
number_of_srs
=
0
;
UL_INFO
->
cqi_ind
.
cqi_pdu_list
=
(
nfapi_cqi_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_cqi_indication_pdu_t
));
UL_INFO
->
cqi_ind
.
cqi_pdu_list
=
(
nfapi_cqi_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_cqi_indication_pdu_t
));
UL_INFO
->
cqi_ind
.
cqi_raw_pdu_list
=
(
nfapi_cqi_indication_raw_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_cqi_indication_raw_pdu_t
));
UL_INFO
->
cqi_ind
.
cqi_raw_pdu_list
=
(
nfapi_cqi_indication_raw_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_cqi_indication_raw_pdu_t
));
UL_INFO
->
cqi_ind
.
number_of_cqis
=
0
;
UL_INFO
->
cqi_ind
.
number_of_cqis
=
0
;
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
memset
(
&
phy_stub_ticking
->
num_single_thread
[
0
],
0
,
sizeof
(
int
)
*
NB_THREAD_INST
);
memset
(
&
phy_stub_ticking
->
num_single_thread
[
0
],
0
,
sizeof
(
int
)
*
NB_THREAD_INST
);
pthread_cond_broadcast
(
&
phy_stub_ticking
->
cond_single_thread
);
pthread_cond_broadcast
(
&
phy_stub_ticking
->
cond_single_thread
);
...
@@ -1075,16 +1068,18 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1075,16 +1068,18 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
}
else
{
}
else
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
while
(
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
<
0
)
{
while
(
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
<
0
)
{
// most of the time, the thread is waiting here
// most of the time, the thread is waiting here
LOG_D
(
MAC
,
"Waiting for single_thread (ue_thread_id %d)
\n
"
,
ue_thread_id
);
LOG_D
(
MAC
,
"Waiting for single_thread (ue_thread_id %d)
\n
"
,
ue_thread_id
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_single_thread
,
&
phy_stub_ticking
->
mutex_single_thread
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_single_thread
,
&
phy_stub_ticking
->
mutex_single_thread
);
}
}
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
...
@@ -1098,10 +1093,10 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1098,10 +1093,10 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
//LOG_D(MAC, "UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
//LOG_D(MAC, "UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
//UE = PHY_vars_UE_g[Mod_id][0];
//UE = PHY_vars_UE_g[Mod_id][0];
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
if
((
sf_type
==
SF_DL
)
||
if
((
sf_type
==
SF_DL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
(
sf_type
==
SF_S
))
{
(
sf_type
==
SF_S
))
{
if
(
UE
->
frame_parms
.
frame_type
==
TDD
)
{
if
(
UE
->
frame_parms
.
frame_type
==
TDD
)
{
LOG_D
(
PHY
,
"TDD%d,%s: calling UE_RX
\n
"
,
LOG_D
(
PHY
,
"TDD%d,%s: calling UE_RX
\n
"
,
UE
->
frame_parms
.
tdd_config
,
UE
->
frame_parms
.
tdd_config
,
...
@@ -1117,22 +1112,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1117,22 +1112,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
(
sf_type
==
SF_S
?
"SF_S"
:
"UNKNOWN_SF_TYPE"
))));
(
sf_type
==
SF_S
?
"SF_S"
:
"UNKNOWN_SF_TYPE"
))));
}
}
phy_procedures_UE_SL_RX
(
UE
,
proc
);
phy_procedures_UE_SL_RX
(
UE
,
proc
);
if
(
dl_config_req
!=
NULL
&&
tx_request_pdu_list
!=
NULL
)
{
if
(
dl_config_req
!=
NULL
&&
tx_request_pdu_list
!=
NULL
)
{
//if(dl_config_req!= NULL) {
//if(dl_config_req!= NULL) {
dl_config_req_UE_MAC
(
dl_config_req
,
ue_Mod_id
);
dl_config_req_UE_MAC
(
dl_config_req
,
ue_Mod_id
);
}
}
if
(
hi_dci0_req
!=
NULL
&&
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
)
{
if
(
hi_dci0_req
!=
NULL
&&
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
)
{
hi_dci0_req_UE_MAC
(
hi_dci0_req
,
ue_Mod_id
);
hi_dci0_req_UE_MAC
(
hi_dci0_req
,
ue_Mod_id
);
}
}
if
(
nfapi_mode
!=
3
)
if
(
nfapi_mode
!=
3
)
phy_procedures_UE_SL_TX
(
UE
,
proc
);
phy_procedures_UE_SL_TX
(
UE
,
proc
);
}
}
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
...
@@ -1140,7 +1132,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1140,7 +1132,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
#endif
#endif
if
(
UE
->
mac_enabled
==
1
)
{
if
(
UE
->
mac_enabled
==
1
)
{
ret
=
ue_scheduler
(
ue_Mod_id
,
ret
=
ue_scheduler
(
ue_Mod_id
,
proc
->
frame_rx
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
subframe_rx
,
...
@@ -1149,39 +1140,38 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1149,39 +1140,38 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
),
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
),
0
,
0
,
0
/*FIXME CC_id*/
);
0
/*FIXME CC_id*/
);
if
(
ret
!=
CONNECTION_OK
)
{
if
(
ret
!=
CONNECTION_OK
)
{
LOG_E
(
PHY
,
"[UE %"
PRIu8
"] Frame %"
PRIu32
", subframe %u %s
\n
"
,
LOG_E
(
PHY
,
"[UE %"
PRIu8
"] Frame %"
PRIu32
", subframe %u %s
\n
"
,
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_tx
,
get_connectionloss_errstr
(
ret
)
);
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_tx
,
get_connectionloss_errstr
(
ret
)
);
}
}
}
}
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
stop_meas
(
&
UE
->
generic_stat
);
stop_meas
(
&
UE
->
generic_stat
);
#endif
#endif
// Prepare the future Tx data
// Prepare the future Tx data
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_UL
)
||
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_UL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
)
(
UE
->
frame_parms
.
frame_type
==
FDD
)
)
if
(
UE
->
mode
!=
loop_through_memory
){
if
(
UE
->
mode
!=
loop_through_memory
)
{
// We make the start of RA between consecutive UEs differ by 20 frames
// We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if
(
UE_mac_inst
[
ue_Mod_id
].
UE_mode
[
0
]
==
PRACH
&&
ue_Mod_id
==
next_Mod_id
)
{
if
(
UE_mac_inst
[
ue_Mod_id
].
UE_mode
[
0
]
==
PRACH
&&
ue_Mod_id
==
next_Mod_id
)
{
next_ra_frame
++
;
next_ra_frame
++
;
if
(
next_ra_frame
>
200
){
// check if we have PRACH opportunity
if
(
next_ra_frame
>
200
)
{
// check if we have PRACH opportunity
if
(
is_prach_subframe
(
&
UE
->
frame_parms
,
proc
->
frame_tx
,
proc
->
subframe_tx
)
&&
UE_mac_inst
[
ue_Mod_id
].
SI_Decoded
==
1
)
{
if
(
is_prach_subframe
(
&
UE
->
frame_parms
,
proc
->
frame_tx
,
proc
->
subframe_tx
)
&&
UE_mac_inst
[
ue_Mod_id
].
SI_Decoded
==
1
)
{
// The one working strangely...
// The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
//if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
PRACH_RESOURCES_t
*
prach_resources
=
ue_get_rach
(
ue_Mod_id
,
0
,
proc
->
frame_tx
,
0
,
proc
->
subframe_tx
);
PRACH_RESOURCES_t
*
prach_resources
=
ue_get_rach
(
ue_Mod_id
,
0
,
proc
->
frame_tx
,
0
,
proc
->
subframe_tx
);
if
(
prach_resources
!=
NULL
)
{
if
(
prach_resources
!=
NULL
)
{
UE_mac_inst
[
ue_Mod_id
].
ra_frame
=
proc
->
frame_rx
;
UE_mac_inst
[
ue_Mod_id
].
ra_frame
=
proc
->
frame_rx
;
LOG_D
(
MAC
,
"UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d
\n
"
,
ue_Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
LOG_D
(
MAC
,
"UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d
\n
"
,
ue_Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
fill_rach_indication_UE_MAC
(
ue_Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
UL_INFO
,
prach_resources
->
ra_PreambleIndex
,
prach_resources
->
ra_RNTI
);
fill_rach_indication_UE_MAC
(
ue_Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
UL_INFO
,
prach_resources
->
ra_PreambleIndex
,
prach_resources
->
ra_RNTI
);
Msg1_transmitted
(
ue_Mod_id
,
0
,
proc
->
frame_tx
,
0
);
Msg1_transmitted
(
ue_Mod_id
,
0
,
proc
->
frame_tx
,
0
);
UE_mac_inst
[
ue_Mod_id
].
UE_mode
[
0
]
=
RA_RESPONSE
;
UE_mac_inst
[
ue_Mod_id
].
UE_mode
[
0
]
=
RA_RESPONSE
;
next_Mod_id
=
ue_Mod_id
+
1
;
next_Mod_id
=
ue_Mod_id
+
1
;
...
@@ -1193,62 +1183,61 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1193,62 +1183,61 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
}
}
}
}
}
// mode is PRACH
}
// mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic.
// Generate UL_indications which correspond to UL traffic.
if
(
ul_config_req
!=
NULL
)
{
//&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
if
(
ul_config_req
!=
NULL
)
{
//&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC
(
ul_config_req
,
timer_frame
,
timer_subframe
,
ue_Mod_id
);
ul_config_req_UE_MAC
(
ul_config_req
,
timer_frame
,
timer_subframe
,
ue_Mod_id
);
}
}
}
}
phy_procedures_UE_SL_RX
(
UE
,
proc
);
phy_procedures_UE_SL_RX
(
UE
,
proc
);
}
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
}
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
if
(
ue_thread_id
==
0
){
if
(
ue_thread_id
==
0
)
{
do
{
do
{
end_flag
=
1
;
end_flag
=
1
;
for
(
uint16_t
i
=
0
;
i
<
NB_THREAD_INST
;
i
++
){
if
(
phy_stub_ticking
->
num_single_thread
[
i
]
==
0
){
for
(
uint16_t
i
=
0
;
i
<
NB_THREAD_INST
;
i
++
)
{
if
(
phy_stub_ticking
->
num_single_thread
[
i
]
==
0
)
{
end_flag
=
0
;
end_flag
=
0
;
}
}
}
}
}
while
(
end_flag
==
0
);
}
while
(
end_flag
==
0
);
if
(
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
>
0
)
if
(
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
>
0
)
{
{
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
oai_nfapi_crc_indication
(
&
UL_INFO
->
crc_ind
);
oai_nfapi_crc_indication
(
&
UL_INFO
->
crc_ind
);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n");
//LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n");
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
=
0
;
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
=
0
;
}
}
if
(
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
>
0
)
{
if
(
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
>
0
)
{
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
oai_nfapi_rx_ind
(
&
UL_INFO
->
rx_ind
);
oai_nfapi_rx_ind
(
&
UL_INFO
->
rx_ind
);
for
(
uint8_t
num_pdu
=
0
;
num_pdu
<
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
;
num_pdu
++
){
for
(
uint8_t
num_pdu
=
0
;
num_pdu
<
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
;
num_pdu
++
)
{
free
(
UL_INFO
->
rx_ind
.
rx_indication_body
.
rx_pdu_list
[
num_pdu
].
data
);
free
(
UL_INFO
->
rx_ind
.
rx_indication_body
.
rx_pdu_list
[
num_pdu
].
data
);
}
}
//LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
//LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
=
0
;
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
=
0
;
}
}
if
(
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
>
0
)
{
if
(
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
>
0
)
{
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
oai_nfapi_harq_indication
(
&
UL_INFO
->
harq_ind
);
oai_nfapi_harq_indication
(
&
UL_INFO
->
harq_ind
);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
//LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
=
0
;
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
=
0
;
}
}
if
(
UL_INFO
->
sr_ind
.
sr_indication_body
.
number_of_srs
>
0
)
{
if
(
UL_INFO
->
sr_ind
.
sr_indication_body
.
number_of_srs
>
0
)
{
//LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
oai_nfapi_sr_indication
(
&
UL_INFO
->
sr_ind
);
oai_nfapi_sr_indication
(
&
UL_INFO
->
sr_ind
);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
//LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
...
@@ -1280,43 +1269,48 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1280,43 +1269,48 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
UL_INFO
=
NULL
;
UL_INFO
=
NULL
;
// De-allocate memory of nfapi requests copies before next subframe round
// De-allocate memory of nfapi requests copies before next subframe round
if
(
dl_config_req
!=
NULL
){
if
(
dl_config_req
!=
NULL
)
{
if
(
dl_config_req
->
vendor_extension
!=
NULL
)
{
if
(
dl_config_req
->
vendor_extension
!=
NULL
)
{
free
(
dl_config_req
->
vendor_extension
);
free
(
dl_config_req
->
vendor_extension
);
dl_config_req
->
vendor_extension
=
NULL
;
dl_config_req
->
vendor_extension
=
NULL
;
}
}
if
(
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
!=
NULL
){
if
(
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
!=
NULL
)
{
free
(
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
);
free
(
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
);
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
=
NULL
;
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
=
NULL
;
}
}
free
(
dl_config_req
);
free
(
dl_config_req
);
dl_config_req
=
NULL
;
dl_config_req
=
NULL
;
}
}
if
(
tx_request_pdu_list
!=
NULL
){
if
(
tx_request_pdu_list
!=
NULL
)
{
free
(
tx_request_pdu_list
);
free
(
tx_request_pdu_list
);
tx_request_pdu_list
=
NULL
;
tx_request_pdu_list
=
NULL
;
}
}
if
(
ul_config_req
!=
NULL
){
if
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
!=
NULL
){
if
(
ul_config_req
!=
NULL
)
{
if
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
!=
NULL
)
{
free
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
);
free
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
);
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
=
NULL
;
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
=
NULL
;
}
}
free
(
ul_config_req
);
free
(
ul_config_req
);
ul_config_req
=
NULL
;
ul_config_req
=
NULL
;
}
}
if
(
hi_dci0_req
!=
NULL
){
if
(
hi_dci0_req
!=
NULL
)
{
if
(
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
)
{
if
(
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
)
{
free
(
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
);
free
(
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
);
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
=
NULL
;
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
=
NULL
;
}
}
free
(
hi_dci0_req
);
free
(
hi_dci0_req
);
hi_dci0_req
=
NULL
;
hi_dci0_req
=
NULL
;
}
}
}
}
}
}
// thread finished
// thread finished
free
(
arg
);
free
(
arg
);
return
&
UE_thread_rxtx_retval
;
return
&
UE_thread_rxtx_retval
;
...
@@ -1334,34 +1328,32 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
...
@@ -1334,34 +1328,32 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
*/
*/
static
void
*
UE_phy_stub_thread_rxn_txnp4
(
void
*
arg
)
{
static
void
*
UE_phy_stub_thread_rxn_txnp4
(
void
*
arg
)
{
thread_top_init
(
"UE_phy_stub_thread_rxn_txnp4"
,
1
,
870000L
,
1000000L
,
1000000L
);
thread_top_init
(
"UE_phy_stub_thread_rxn_txnp4"
,
1
,
870000L
,
1000000L
,
1000000L
);
module_id_t
Mod_id
=
0
;
module_id_t
Mod_id
=
0
;
static
__thread
int
UE_thread_rxtx_retval
;
static
__thread
int
UE_thread_rxtx_retval
;
struct
rx_tx_thread_data
*
rtd
=
arg
;
struct
rx_tx_thread_data
*
rtd
=
arg
;
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
PHY_VARS_UE
*
UE
=
rtd
->
UE
;
PHY_VARS_UE
*
UE
=
rtd
->
UE
;
phy_stub_ticking
->
ticking_var
=
-
1
;
phy_stub_ticking
->
ticking_var
=
-
1
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
// CAREFUL HERE!
// CAREFUL HERE!
wait_sync
(
"UE_phy_stub_thread_rxn_txnp4"
);
wait_sync
(
"UE_phy_stub_thread_rxn_txnp4"
);
while
(
!
oai_exit
)
{
while
(
!
oai_exit
)
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
while
(
phy_stub_ticking
->
ticking_var
<
0
)
{
while
(
phy_stub_ticking
->
ticking_var
<
0
)
{
// most of the time, the thread is waiting here
// most of the time, the thread is waiting here
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
LOG_D
(
MAC
,
"Waiting for ticking_var
\n
"
);
LOG_D
(
MAC
,
"Waiting for ticking_var
\n
"
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_ticking
,
&
phy_stub_ticking
->
mutex_ticking
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_ticking
,
&
phy_stub_ticking
->
mutex_ticking
);
}
}
phy_stub_ticking
->
ticking_var
--
;
phy_stub_ticking
->
ticking_var
--
;
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for UE RXn_TXnp4
\n
"
);
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for UE RXn_TXnp4
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
...
@@ -1371,14 +1363,12 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
...
@@ -1371,14 +1363,12 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
proc
->
frame_rx
=
timer_frame
;
proc
->
frame_rx
=
timer_frame
;
proc
->
subframe_tx
=
(
timer_subframe
+
4
)
%
10
;
proc
->
subframe_tx
=
(
timer_subframe
+
4
)
%
10
;
proc
->
frame_tx
=
proc
->
frame_rx
+
(
proc
->
subframe_rx
>
5
?
1
:
0
);
proc
->
frame_tx
=
proc
->
frame_rx
+
(
proc
->
subframe_rx
>
5
?
1
:
0
);
// Process Rx data for one sub-frame
// Process Rx data for one sub-frame
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
if
((
sf_type
==
SF_DL
)
||
if
((
sf_type
==
SF_DL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
(
sf_type
==
SF_S
))
{
(
sf_type
==
SF_S
))
{
if
(
UE
->
frame_parms
.
frame_type
==
TDD
)
{
if
(
UE
->
frame_parms
.
frame_type
==
TDD
)
{
LOG_D
(
PHY
,
"TDD%d,%s: calling UE_RX
\n
"
,
LOG_D
(
PHY
,
"TDD%d,%s: calling UE_RX
\n
"
,
UE
->
frame_parms
.
tdd_config
,
UE
->
frame_parms
.
tdd_config
,
...
@@ -1394,18 +1384,15 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
...
@@ -1394,18 +1384,15 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
(
sf_type
==
SF_S
?
"SF_S"
:
"UNKNOWN_SF_TYPE"
))));
(
sf_type
==
SF_S
?
"SF_S"
:
"UNKNOWN_SF_TYPE"
))));
}
}
phy_procedures_UE_SL_RX
(
UE
,
proc
);
phy_procedures_UE_SL_RX
(
UE
,
proc
);
oai_subframe_ind
(
timer_frame
,
timer_subframe
);
oai_subframe_ind
(
timer_frame
,
timer_subframe
);
if
(
dl_config_req
!=
NULL
)
{
if
(
dl_config_req
!=
NULL
)
{
dl_config_req_UE_MAC
(
dl_config_req
,
Mod_id
);
dl_config_req_UE_MAC
(
dl_config_req
,
Mod_id
);
}
}
//if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
//if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
if
(
hi_dci0_req
!=
NULL
&&
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
){
if
(
hi_dci0_req
!=
NULL
&&
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
)
{
hi_dci0_req_UE_MAC
(
hi_dci0_req
,
Mod_id
);
hi_dci0_req_UE_MAC
(
hi_dci0_req
,
Mod_id
);
//if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
//if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
free
(
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
);
free
(
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
);
...
@@ -1413,23 +1400,20 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
...
@@ -1413,23 +1400,20 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
//}
//}
free
(
hi_dci0_req
);
free
(
hi_dci0_req
);
hi_dci0_req
=
NULL
;
hi_dci0_req
=
NULL
;
}
}
else
if
(
hi_dci0_req
!=
NULL
)
{
else
if
(
hi_dci0_req
!=
NULL
){
free
(
hi_dci0_req
);
free
(
hi_dci0_req
);
hi_dci0_req
=
NULL
;
hi_dci0_req
=
NULL
;
}
}
if
(
nfapi_mode
!=
3
)
if
(
nfapi_mode
!=
3
)
phy_procedures_UE_SL_TX
(
UE
,
proc
);
phy_procedures_UE_SL_TX
(
UE
,
proc
);
}
}
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
start_meas
(
&
UE
->
generic_stat
);
start_meas
(
&
UE
->
generic_stat
);
#endif
#endif
if
(
UE
->
mac_enabled
==
1
)
{
if
(
UE
->
mac_enabled
==
1
)
{
int
ret
=
ue_scheduler
(
UE
->
Mod_id
,
int
ret
=
ue_scheduler
(
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
subframe_rx
,
...
@@ -1438,29 +1422,28 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
...
@@ -1438,29 +1422,28 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
),
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
),
0
,
0
,
0
);
0
);
if
(
ret
!=
CONNECTION_OK
)
if
(
ret
!=
CONNECTION_OK
)
LOG_E
(
PHY
,
"[UE %"
PRIu8
"] Frame %"
PRIu32
", subframe %u %s
\n
"
,
LOG_E
(
PHY
,
"[UE %"
PRIu8
"] Frame %"
PRIu32
", subframe %u %s
\n
"
,
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_tx
,
get_connectionloss_errstr
(
ret
)
);
UE
->
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_tx
,
get_connectionloss_errstr
(
ret
)
);
}
}
#if UE_TIMING_TRACE
#if UE_TIMING_TRACE
stop_meas
(
&
UE
->
generic_stat
);
stop_meas
(
&
UE
->
generic_stat
);
#endif
#endif
// Prepare the future Tx data
// Prepare the future Tx data
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_UL
)
||
if
((
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_tx
)
==
SF_UL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
)
(
UE
->
frame_parms
.
frame_type
==
FDD
)
)
if
(
UE
->
mode
!=
loop_through_memory
){
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
((
UE_mac_inst
[
Mod_id
].
UE_mode
[
0
]
==
PRACH
)
)
{
if
((
UE_mac_inst
[
Mod_id
].
UE_mode
[
0
]
==
PRACH
)
)
{
// check if we have PRACH opportunity
// check if we have PRACH opportunity
if
(
is_prach_subframe
(
&
UE
->
frame_parms
,
proc
->
frame_tx
,
proc
->
subframe_tx
))
{
if
(
is_prach_subframe
(
&
UE
->
frame_parms
,
proc
->
frame_tx
,
proc
->
subframe_tx
))
{
PRACH_RESOURCES_t
*
prach_resources
=
ue_get_rach
(
Mod_id
,
0
,
proc
->
frame_tx
,
0
,
proc
->
subframe_tx
);
PRACH_RESOURCES_t
*
prach_resources
=
ue_get_rach
(
Mod_id
,
0
,
proc
->
frame_tx
,
0
,
proc
->
subframe_tx
);
if
(
prach_resources
!=
NULL
)
{
if
(
prach_resources
!=
NULL
)
{
fill_rach_indication_UE_MAC
(
Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
UL_INFO
,
prach_resources
->
ra_PreambleIndex
,
prach_resources
->
ra_RNTI
);
fill_rach_indication_UE_MAC
(
Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
UL_INFO
,
prach_resources
->
ra_PreambleIndex
,
prach_resources
->
ra_RNTI
);
Msg1_transmitted
(
Mod_id
,
0
,
proc
->
frame_tx
,
0
);
Msg1_transmitted
(
Mod_id
,
0
,
proc
->
frame_tx
,
0
);
UE_mac_inst
[
Mod_id
].
UE_mode
[
0
]
=
RA_RESPONSE
;
UE_mac_inst
[
Mod_id
].
UE_mode
[
0
]
=
RA_RESPONSE
;
}
}
...
@@ -1468,28 +1451,30 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
...
@@ -1468,28 +1451,30 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
}
}
// mode is PRACH
}
// mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic.
// Generate UL_indications which correspond to UL traffic.
if
(
ul_config_req
!=
NULL
&&
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
!=
NULL
)
{
if
(
ul_config_req
!=
NULL
&&
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
!=
NULL
)
{
//LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
//LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
ul_config_req_UE_MAC
(
ul_config_req
,
timer_frame
,
timer_subframe
,
Mod_id
);
ul_config_req_UE_MAC
(
ul_config_req
,
timer_frame
,
timer_subframe
,
Mod_id
);
if
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
!=
NULL
){
if
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
!=
NULL
)
{
free
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
);
free
(
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
);
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
=
NULL
;
ul_config_req
->
ul_config_request_body
.
ul_config_pdu_list
=
NULL
;
}
}
free
(
ul_config_req
);
free
(
ul_config_req
);
ul_config_req
=
NULL
;
ul_config_req
=
NULL
;
}
}
else
if
(
ul_config_req
!=
NULL
)
{
else
if
(
ul_config_req
!=
NULL
){
free
(
ul_config_req
);
free
(
ul_config_req
);
ul_config_req
=
NULL
;
ul_config_req
=
NULL
;
}
}
}
}
phy_procedures_UE_SL_RX
(
UE
,
proc
);
phy_procedures_UE_SL_RX
(
UE
,
proc
);
}
}
// thread finished
// thread finished
free
(
arg
);
free
(
arg
);
return
&
UE_thread_rxtx_retval
;
return
&
UE_thread_rxtx_retval
;
...
@@ -1508,39 +1493,34 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
...
@@ -1508,39 +1493,34 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
*/
*/
void
*
UE_thread
(
void
*
arg
)
{
void
*
UE_thread
(
void
*
arg
)
{
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
// int tx_enabled = 0;
// int tx_enabled = 0;
int
dummy_rx
[
UE
->
frame_parms
.
nb_antennas_rx
][
UE
->
frame_parms
.
samples_per_tti
]
__attribute__
((
aligned
(
32
)));
int
dummy_rx
[
UE
->
frame_parms
.
nb_antennas_rx
][
UE
->
frame_parms
.
samples_per_tti
]
__attribute__
((
aligned
(
32
)));
openair0_timestamp
timestamp
,
timestamp1
;
openair0_timestamp
timestamp
,
timestamp1
;
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
int
start_rx_stream
=
0
;
int
start_rx_stream
=
0
;
int
i
;
int
i
;
int
th_id
;
int
th_id
;
static
uint8_t
thread_idx
=
0
;
static
uint8_t
thread_idx
=
0
;
cpu_set_t
cpuset
;
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
CPU_ZERO
(
&
cpuset
);
if
(
threads
.
iq
!=
-
1
)
if
(
threads
.
iq
!=
-
1
)
CPU_SET
(
threads
.
iq
,
&
cpuset
);
CPU_SET
(
threads
.
iq
,
&
cpuset
);
init_thread
(
100000
,
500000
,
FIFO_PRIORITY
,
&
cpuset
,
init_thread
(
100000
,
500000
,
FIFO_PRIORITY
,
&
cpuset
,
"UHD Threads"
);
"UHD Threads"
);
/*
/*
while (sync_var<0)
while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_mutex_unlock(&sync_mutex);
pthread_mutex_unlock(&sync_mutex);
*/
*/
wait_sync
(
"UE thread"
);
wait_sync
(
"UE thread"
);
#ifdef NAS_UE
#ifdef NAS_UE
MessageDef
*
message_p
;
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_NAS_UE
,
INITIALIZE_MESSAGE
);
message_p
=
itti_alloc_new_message
(
TASK_NAS_UE
,
INITIALIZE_MESSAGE
);
itti_send_msg_to_task
(
TASK_NAS_UE
,
UE
->
Mod_id
+
NB_eNB_INST
,
message_p
);
itti_send_msg_to_task
(
TASK_NAS_UE
,
UE
->
Mod_id
+
NB_eNB_INST
,
message_p
);
#endif
#endif
int
sub_frame
=-
1
;
int
sub_frame
=-
1
;
//int cumulated_shift=0;
//int cumulated_shift=0;
...
@@ -1556,7 +1536,6 @@ void *UE_thread(void *arg) {
...
@@ -1556,7 +1536,6 @@ void *UE_thread(void *arg) {
usleep
(
500
*
1000
);
usleep
(
500
*
1000
);
}
}
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
int
instance_cnt_synch
=
UE
->
proc
.
instance_cnt_synch
;
int
instance_cnt_synch
=
UE
->
proc
.
instance_cnt_synch
;
int
is_synchronized
=
UE
->
is_synchronized
;
int
is_synchronized
=
UE
->
is_synchronized
;
...
@@ -1566,7 +1545,7 @@ void *UE_thread(void *arg) {
...
@@ -1566,7 +1545,7 @@ void *UE_thread(void *arg) {
if
(
instance_cnt_synch
<
0
)
{
// we can invoke the synch
if
(
instance_cnt_synch
<
0
)
{
// we can invoke the synch
// grab 10 ms of signal and wakeup synch thread
// grab 10 ms of signal and wakeup synch thread
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
rxdata
[
i
][
0
];
rxp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
rxdata
[
i
][
0
];
if
(
UE
->
mode
!=
loop_through_memory
)
if
(
UE
->
mode
!=
loop_through_memory
)
AssertFatal
(
UE
->
frame_parms
.
samples_per_tti
*
10
==
AssertFatal
(
UE
->
frame_parms
.
samples_per_tti
*
10
==
...
@@ -1575,24 +1554,29 @@ void *UE_thread(void *arg) {
...
@@ -1575,24 +1554,29 @@ void *UE_thread(void *arg) {
rxp
,
rxp
,
UE
->
frame_parms
.
samples_per_tti
*
10
,
UE
->
frame_parms
.
samples_per_tti
*
10
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
instance_cnt_synch
=
++
UE
->
proc
.
instance_cnt_synch
;
instance_cnt_synch
=
++
UE
->
proc
.
instance_cnt_synch
;
if
(
instance_cnt_synch
==
0
)
{
if
(
instance_cnt_synch
==
0
)
{
AssertFatal
(
0
==
pthread_cond_signal
(
&
UE
->
proc
.
cond_synch
),
""
);
AssertFatal
(
0
==
pthread_cond_signal
(
&
UE
->
proc
.
cond_synch
),
""
);
}
else
{
}
else
{
LOG_E
(
PHY
,
"[SCHED][UE] UE sync thread busy!!
\n
"
);
LOG_E
(
PHY
,
"[SCHED][UE] UE sync thread busy!!
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
}
else
{
}
else
{
#if OAISIM
#if OAISIM
(
void
)
dummy_rx
;
/* avoid gcc warnings */
(
void
)
dummy_rx
;
/* avoid gcc warnings */
usleep
(
500
);
usleep
(
500
);
#else
#else
// grab 10 ms of signal into dummy buffer
// grab 10 ms of signal into dummy buffer
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
(
UE
->
mode
!=
loop_through_memory
)
{
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
dummy_rx
[
i
][
0
];
rxp
[
i
]
=
(
void
*
)
&
dummy_rx
[
i
][
0
];
for
(
int
sf
=
0
;
sf
<
10
;
sf
++
)
for
(
int
sf
=
0
;
sf
<
10
;
sf
++
)
// printf("Reading dummy sf %d\n",sf);
// printf("Reading dummy sf %d\n",sf);
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
...
@@ -1601,25 +1585,28 @@ void *UE_thread(void *arg) {
...
@@ -1601,25 +1585,28 @@ void *UE_thread(void *arg) {
UE
->
frame_parms
.
samples_per_tti
,
UE
->
frame_parms
.
samples_per_tti
,
UE
->
frame_parms
.
nb_antennas_rx
);
UE
->
frame_parms
.
nb_antennas_rx
);
}
}
#endif
#endif
}
}
}
// UE->is_synchronized==0
}
// UE->is_synchronized==0
else
{
else
{
if
(
start_rx_stream
==
0
)
{
if
(
start_rx_stream
==
0
)
{
start_rx_stream
=
1
;
start_rx_stream
=
1
;
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
(
UE
->
no_timing_correction
==
0
)
{
if
(
UE
->
no_timing_correction
==
0
)
{
LOG_I
(
PHY
,
"Resynchronizing RX by %d samples (mode = %d)
\n
"
,
UE
->
rx_offset
,
UE
->
mode
);
LOG_I
(
PHY
,
"Resynchronizing RX by %d samples (mode = %d)
\n
"
,
UE
->
rx_offset
,
UE
->
mode
);
AssertFatal
(
UE
->
rx_offset
==
AssertFatal
(
UE
->
rx_offset
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
&
timestamp
,
&
timestamp
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
UE
->
rx_offset
,
UE
->
rx_offset
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
}
}
UE
->
rx_offset
=
0
;
UE
->
rx_offset
=
0
;
UE
->
time_sync_cell
=
0
;
UE
->
time_sync_cell
=
0
;
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++;
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
...
@@ -1630,14 +1617,13 @@ void *UE_thread(void *arg) {
...
@@ -1630,14 +1617,13 @@ void *UE_thread(void *arg) {
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
==
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
&
timestamp
,
&
timestamp
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
,
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
slot_fep
(
UE
,
0
,
0
,
0
,
0
,
0
);
slot_fep
(
UE
,
0
,
0
,
0
,
0
,
0
);
}
//UE->mode != loop_through_memory
}
//UE->mode != loop_through_memory
else
else
rt_sleep_ns
(
1000
*
1000
);
rt_sleep_ns
(
1000
*
1000
);
}
else
{
}
else
{
sub_frame
++
;
sub_frame
++
;
sub_frame
%=
10
;
sub_frame
%=
10
;
...
@@ -1647,35 +1633,39 @@ void *UE_thread(void *arg) {
...
@@ -1647,35 +1633,39 @@ void *UE_thread(void *arg) {
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
)
{
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
)
{
int
t
;
int
t
;
for
(
t
=
0
;
t
<
2
;
t
++
)
{
for
(
t
=
0
;
t
<
2
;
t
++
)
{
UE_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
t
];
UE_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
t
];
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
);
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
);
while
(
proc
->
instance_cnt_rxtx
>=
0
)
pthread_cond_wait
(
&
proc
->
cond_rxtx
,
&
proc
->
mutex_rxtx
);
while
(
proc
->
instance_cnt_rxtx
>=
0
)
pthread_cond_wait
(
&
proc
->
cond_rxtx
,
&
proc
->
mutex_rxtx
);
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
);
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
);
}
}
}
}
LOG_D
(
PHY
,
"Process Subframe %d thread Idx %d
\n
"
,
sub_frame
,
UE
->
current_thread_id
[
sub_frame
]);
LOG_D
(
PHY
,
"Process Subframe %d thread Idx %d
\n
"
,
sub_frame
,
UE
->
current_thread_id
[
sub_frame
]);
thread_idx
++
;
thread_idx
++
;
if
(
thread_idx
>=
RX_NB_TH
)
if
(
thread_idx
>=
RX_NB_TH
)
thread_idx
=
0
;
thread_idx
=
0
;
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
(
UE
->
mode
!=
loop_through_memory
)
{
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
rxdata
[
i
][
UE
->
frame_parms
.
ofdm_symbol_size
+
rxp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
rxdata
[
i
][
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
+
UE
->
frame_parms
.
nb_prefix_samples0
+
sub_frame
*
UE
->
frame_parms
.
samples_per_tti
];
sub_frame
*
UE
->
frame_parms
.
samples_per_tti
];
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_tx
;
i
++
)
for
(
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_tx
;
i
++
)
txp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
txdata
[
i
][((
sub_frame
+
2
)
%
10
)
*
UE
->
frame_parms
.
samples_per_tti
];
txp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
txdata
[
i
][((
sub_frame
+
2
)
%
10
)
*
UE
->
frame_parms
.
samples_per_tti
];
int
readBlockSize
,
writeBlockSize
;
int
readBlockSize
,
writeBlockSize
;
if
(
sub_frame
<
9
)
{
if
(
sub_frame
<
9
)
{
readBlockSize
=
UE
->
frame_parms
.
samples_per_tti
;
readBlockSize
=
UE
->
frame_parms
.
samples_per_tti
;
writeBlockSize
=
UE
->
frame_parms
.
samples_per_tti
;
writeBlockSize
=
UE
->
frame_parms
.
samples_per_tti
;
}
else
{
}
else
{
// set TO compensation to zero
// set TO compensation to zero
UE
->
rx_offset_diff
=
0
;
UE
->
rx_offset_diff
=
0
;
// compute TO compensation that should be applied for this frame
// compute TO compensation that should be applied for this frame
...
@@ -1684,6 +1674,7 @@ void *UE_thread(void *arg) {
...
@@ -1684,6 +1674,7 @@ void *UE_thread(void *arg) {
if
(
UE
->
rx_offset
<
5
*
UE
->
frame_parms
.
samples_per_tti
&&
if
(
UE
->
rx_offset
<
5
*
UE
->
frame_parms
.
samples_per_tti
&&
UE
->
rx_offset
>
0
)
UE
->
rx_offset
>
0
)
UE
->
rx_offset_diff
=
-
1
;
UE
->
rx_offset_diff
=
-
1
;
if
(
UE
->
rx_offset
>
5
*
UE
->
frame_parms
.
samples_per_tti
&&
if
(
UE
->
rx_offset
>
5
*
UE
->
frame_parms
.
samples_per_tti
&&
UE
->
rx_offset
<
10
*
UE
->
frame_parms
.
samples_per_tti
)
UE
->
rx_offset
<
10
*
UE
->
frame_parms
.
samples_per_tti
)
UE
->
rx_offset_diff
=
1
;
UE
->
rx_offset_diff
=
1
;
...
@@ -1714,24 +1705,30 @@ void *UE_thread(void *arg) {
...
@@ -1714,24 +1705,30 @@ void *UE_thread(void *arg) {
writeBlockSize
,
writeBlockSize
,
UE
->
frame_parms
.
nb_antennas_tx
,
UE
->
frame_parms
.
nb_antennas_tx
,
1
),
""
);
1
),
""
);
if
(
sub_frame
==
9
)
{
if
(
sub_frame
==
9
)
{
// read in first symbol of next frame and adjust for timing drift
// read in first symbol of next frame and adjust for timing drift
int
first_symbols
=
writeBlockSize
-
readBlockSize
;
int
first_symbols
=
writeBlockSize
-
readBlockSize
;
if
(
first_symbols
>
0
)
if
(
first_symbols
>
0
)
AssertFatal
(
first_symbols
==
AssertFatal
(
first_symbols
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
&
timestamp1
,
&
timestamp1
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
first_symbols
,
first_symbols
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
if
(
first_symbols
<
0
)
if
(
first_symbols
<
0
)
LOG_E
(
PHY
,
"can't compensate: diff =%d
\n
"
,
first_symbols
);
LOG_E
(
PHY
,
"can't compensate: diff =%d
\n
"
,
first_symbols
);
}
}
pickTime
(
gotIQs
);
pickTime
(
gotIQs
);
struct
timespec
tv
=
{
0
};
struct
timespec
tv
=
{
0
};
tv
.
tv_nsec
=
10
*
1000
;
tv
.
tv_nsec
=
10
*
1000
;
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
)
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
)
tv
.
tv_sec
=
INT_MAX
;
tv
.
tv_sec
=
INT_MAX
;
// operate on thread sf mod 2
// operate on thread sf mod 2
if
(
pthread_mutex_timedlock
(
&
proc
->
mutex_rxtx
,
&
tv
)
!=
0
)
{
if
(
pthread_mutex_timedlock
(
&
proc
->
mutex_rxtx
,
&
tv
)
!=
0
)
{
if
(
errno
==
ETIMEDOUT
)
{
if
(
errno
==
ETIMEDOUT
)
{
...
@@ -1742,6 +1739,7 @@ void *UE_thread(void *arg) {
...
@@ -1742,6 +1739,7 @@ void *UE_thread(void *arg) {
abort
();
abort
();
}
}
}
}
//usleep(3000);
//usleep(3000);
if
(
sub_frame
==
0
)
{
if
(
sub_frame
==
0
)
{
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[0].frame_rx++;
...
@@ -1750,36 +1748,35 @@ void *UE_thread(void *arg) {
...
@@ -1750,36 +1748,35 @@ void *UE_thread(void *arg) {
UE
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
++
;
UE
->
proc
.
proc_rxtx
[
th_id
].
frame_rx
++
;
}
}
}
}
//UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs);
//UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs);
//UE->proc.proc_rxtx[1].gotIQs=readTime(gotIQs);
//UE->proc.proc_rxtx[1].gotIQs=readTime(gotIQs);
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
for
(
th_id
=
0
;
th_id
<
RX_NB_TH
;
th_id
++
)
{
UE
->
proc
.
proc_rxtx
[
th_id
].
gotIQs
=
readTime
(
gotIQs
);
UE
->
proc
.
proc_rxtx
[
th_id
].
gotIQs
=
readTime
(
gotIQs
);
}
}
proc
->
subframe_rx
=
sub_frame
;
proc
->
subframe_rx
=
sub_frame
;
proc
->
subframe_tx
=
(
sub_frame
+
4
)
%
10
;
proc
->
subframe_tx
=
(
sub_frame
+
4
)
%
10
;
proc
->
frame_tx
=
proc
->
frame_rx
+
(
proc
->
subframe_rx
>
5
?
1
:
0
);
proc
->
frame_tx
=
proc
->
frame_rx
+
(
proc
->
subframe_rx
>
5
?
1
:
0
);
proc
->
timestamp_tx
=
timestamp
+
proc
->
timestamp_tx
=
timestamp
+
(
4
*
UE
->
frame_parms
.
samples_per_tti
)
-
(
4
*
UE
->
frame_parms
.
samples_per_tti
)
-
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
;
UE
->
frame_parms
.
ofdm_symbol_size
-
UE
->
frame_parms
.
nb_prefix_samples0
;
proc
->
instance_cnt_rxtx
++
;
proc
->
instance_cnt_rxtx
++
;
LOG_D
(
PHY
,
"[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!
\n
"
,
UE
->
Mod_id
,
proc
->
instance_cnt_rxtx
,
proc
->
subframe_rx
);
LOG_D
(
PHY
,
"[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!
\n
"
,
UE
->
Mod_id
,
proc
->
instance_cnt_rxtx
,
proc
->
subframe_rx
);
AssertFatal
(
pthread_cond_signal
(
&
proc
->
cond_rxtx
)
==
0
,
""
);
AssertFatal
(
pthread_cond_signal
(
&
proc
->
cond_rxtx
)
==
0
,
""
);
AssertFatal
(
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
)
==
0
,
""
);
AssertFatal
(
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
)
==
0
,
""
);
initRefTimes
(
t1
);
initRefTimes
(
t1
);
initStaticTime
(
lastTime
);
initStaticTime
(
lastTime
);
updateTimes
(
lastTime
,
&
t1
,
20000
,
"Delay between two IQ acquisitions (case 1)"
);
updateTimes
(
lastTime
,
&
t1
,
20000
,
"Delay between two IQ acquisitions (case 1)"
);
pickStaticTime
(
lastTime
);
pickStaticTime
(
lastTime
);
}
else
{
}
else
{
printf
(
"Processing subframe %d"
,
proc
->
subframe_rx
);
printf
(
"Processing subframe %d"
,
proc
->
subframe_rx
);
getchar
();
getchar
();
}
}
}
// start_rx_stream==1
}
// start_rx_stream==1
}
// UE->is_synchronized==1
}
// UE->is_synchronized==1
}
// while !oai_exit
}
// while !oai_exit
return
NULL
;
return
NULL
;
}
}
...
@@ -1799,28 +1796,26 @@ void *UE_thread(void *arg) {
...
@@ -1799,28 +1796,26 @@ void *UE_thread(void *arg) {
void
init_UE_threads
(
int
inst
)
{
void
init_UE_threads
(
int
inst
)
{
struct
rx_tx_thread_data
*
rtd
;
struct
rx_tx_thread_data
*
rtd
;
PHY_VARS_UE
*
UE
;
PHY_VARS_UE
*
UE
;
AssertFatal
(
PHY_vars_UE_g
!=
NULL
,
"PHY_vars_UE_g is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
!=
NULL
,
"PHY_vars_UE_g is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
]
!=
NULL
,
"PHY_vars_UE_g[inst] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
]
!=
NULL
,
"PHY_vars_UE_g[inst] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
][
0
]
!=
NULL
,
"PHY_vars_UE_g[inst][0] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
][
0
]
!=
NULL
,
"PHY_vars_UE_g[inst][0] is NULL
\n
"
);
UE
=
PHY_vars_UE_g
[
inst
][
0
];
UE
=
PHY_vars_UE_g
[
inst
][
0
];
pthread_attr_init
(
&
UE
->
proc
.
attr_ue
);
pthread_attr_init
(
&
UE
->
proc
.
attr_ue
);
pthread_attr_setstacksize
(
&
UE
->
proc
.
attr_ue
,
8192
);
//5*PTHREAD_STACK_MIN);
pthread_attr_setstacksize
(
&
UE
->
proc
.
attr_ue
,
8192
);
//5*PTHREAD_STACK_MIN);
pthread_mutex_init
(
&
UE
->
proc
.
mutex_synch
,
NULL
);
pthread_mutex_init
(
&
UE
->
proc
.
mutex_synch
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
cond_synch
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
cond_synch
,
NULL
);
UE
->
proc
.
instance_cnt_synch
=
-
1
;
UE
->
proc
.
instance_cnt_synch
=
-
1
;
UE
->
is_synchronized
=
0
;
UE
->
is_synchronized
=
0
;
// the threads are not yet active, therefore access is allowed without locking
// the threads are not yet active, therefore access is allowed without locking
int
nb_threads
=
RX_NB_TH
;
int
nb_threads
=
RX_NB_TH
;
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
if
(
rtd
==
NULL
)
abort
();
if
(
rtd
==
NULL
)
abort
();
rtd
->
UE
=
UE
;
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_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
].
instance_cnt_rxtx
=
-
1
;
...
@@ -1828,19 +1823,17 @@ void init_UE_threads(int inst) {
...
@@ -1828,19 +1823,17 @@ void init_UE_threads(int inst) {
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_step
=
nb_threads
;
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
);
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
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_thread_rxn_txnp4
,
rtd
);
#ifdef UE_SLOT_PARALLELISATION
#ifdef UE_SLOT_PARALLELISATION
//pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot0_dl_processing,NULL);
//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);
//pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot0_dl_processing,NULL);
//pthread_create(&UE->proc.proc_rxtx[i].pthread_slot0_dl_processing,NULL,UE_thread_slot0_dl_processing, rtd);
//pthread_create(&UE->proc.proc_rxtx[i].pthread_slot0_dl_processing,NULL,UE_thread_slot0_dl_processing, rtd);
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_slot1_dl_processing
,
NULL
);
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_slot1_dl_processing
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_slot1_dl_processing
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_slot1_dl_processing
,
NULL
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_slot1_dl_processing
,
NULL
,
UE_thread_slot1_dl_processing
,
rtd
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_slot1_dl_processing
,
NULL
,
UE_thread_slot1_dl_processing
,
rtd
);
#endif
#endif
}
}
pthread_create
(
&
UE
->
proc
.
pthread_synch
,
NULL
,
UE_thread_synch
,(
void
*
)
UE
);
pthread_create
(
&
UE
->
proc
.
pthread_synch
,
NULL
,
UE_thread_synch
,(
void
*
)
UE
);
}
}
...
@@ -1860,11 +1853,12 @@ void init_UE_single_thread_stub(int nb_inst) {
...
@@ -1860,11 +1853,12 @@ void init_UE_single_thread_stub(int nb_inst) {
struct
rx_tx_thread_data
*
rtd
;
struct
rx_tx_thread_data
*
rtd
;
PHY_VARS_UE
*
UE
;
PHY_VARS_UE
*
UE
;
for
(
int
i
=
0
;
i
<
nb_inst
;
i
++
){
for
(
int
i
=
0
;
i
<
nb_inst
;
i
++
)
{
AssertFatal
(
PHY_vars_UE_g
!=
NULL
,
"PHY_vars_UE_g is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
!=
NULL
,
"PHY_vars_UE_g is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
i
]
!=
NULL
,
"PHY_vars_UE_g[inst] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
i
]
!=
NULL
,
"PHY_vars_UE_g[inst] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
i
][
0
]
!=
NULL
,
"PHY_vars_UE_g[inst][0] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
i
][
0
]
!=
NULL
,
"PHY_vars_UE_g[inst][0] is NULL
\n
"
);
if
(
nfapi_mode
==
3
){
if
(
nfapi_mode
==
3
)
{
#ifdef NAS_UE
#ifdef NAS_UE
MessageDef
*
message_p
;
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_NAS_UE
,
INITIALIZE_MESSAGE
);
message_p
=
itti_alloc_new_message
(
TASK_NAS_UE
,
INITIALIZE_MESSAGE
);
...
@@ -1872,28 +1866,29 @@ void init_UE_single_thread_stub(int nb_inst) {
...
@@ -1872,28 +1866,29 @@ void init_UE_single_thread_stub(int nb_inst) {
#endif
#endif
}
}
}
}
UE
=
PHY_vars_UE_g
[
0
][
0
];
UE
=
PHY_vars_UE_g
[
0
][
0
];
pthread_attr_init
(
&
UE
->
proc
.
attr_ue
);
pthread_attr_init
(
&
UE
->
proc
.
attr_ue
);
pthread_attr_setstacksize
(
&
UE
->
proc
.
attr_ue
,
8192
);
//5*PTHREAD_STACK_MIN);
pthread_attr_setstacksize
(
&
UE
->
proc
.
attr_ue
,
8192
);
//5*PTHREAD_STACK_MIN);
// Don't need synch for phy_stub mode
// Don't need synch for phy_stub mode
//pthread_mutex_init(&UE->proc.mutex_synch,NULL);
//pthread_mutex_init(&UE->proc.mutex_synch,NULL);
//pthread_cond_init(&UE->proc.cond_synch,NULL);
//pthread_cond_init(&UE->proc.cond_synch,NULL);
// the threads are not yet active, therefore access is allowed without locking
// the threads are not yet active, therefore access is allowed without locking
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads
//int nb_threads=RX_NB_TH;
//int nb_threads=RX_NB_TH;
int
nb_threads
=
1
;
int
nb_threads
=
1
;
for
(
uint16_t
ue_thread_id
=
0
;
ue_thread_id
<
NB_THREAD_INST
;
ue_thread_id
++
){
for
(
uint16_t
ue_thread_id
=
0
;
ue_thread_id
<
NB_THREAD_INST
;
ue_thread_id
++
)
{
UE
=
PHY_vars_UE_g
[
ue_thread_id
][
0
];
UE
=
PHY_vars_UE_g
[
ue_thread_id
][
0
];
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
if
(
rtd
==
NULL
)
abort
();
if
(
rtd
==
NULL
)
abort
();
rtd
->
UE
=
UE
;
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
rtd
->
ue_thread_id
=
ue_thread_id
;
rtd
->
ue_thread_id
=
ue_thread_id
;
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_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_start
=
i
;
...
@@ -1902,6 +1897,7 @@ void init_UE_single_thread_stub(int nb_inst) {
...
@@ -1902,6 +1897,7 @@ void init_UE_single_thread_stub(int nb_inst) {
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_phy_stub_single_thread_rxn_txnp4
,
rtd
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_phy_stub_single_thread_rxn_txnp4
,
rtd
);
}
}
}
}
// Remove thread for UE_sync in phy_stub_UE mode.
// Remove thread for UE_sync in phy_stub_UE mode.
//pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
//pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
}
}
...
@@ -1923,38 +1919,35 @@ void init_UE_single_thread_stub(int nb_inst) {
...
@@ -1923,38 +1919,35 @@ void init_UE_single_thread_stub(int nb_inst) {
void
init_UE_threads_stub
(
int
inst
)
{
void
init_UE_threads_stub
(
int
inst
)
{
struct
rx_tx_thread_data
*
rtd
;
struct
rx_tx_thread_data
*
rtd
;
PHY_VARS_UE
*
UE
;
PHY_VARS_UE
*
UE
;
AssertFatal
(
PHY_vars_UE_g
!=
NULL
,
"PHY_vars_UE_g is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
!=
NULL
,
"PHY_vars_UE_g is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
]
!=
NULL
,
"PHY_vars_UE_g[inst] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
]
!=
NULL
,
"PHY_vars_UE_g[inst] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
][
0
]
!=
NULL
,
"PHY_vars_UE_g[inst][0] is NULL
\n
"
);
AssertFatal
(
PHY_vars_UE_g
[
inst
][
0
]
!=
NULL
,
"PHY_vars_UE_g[inst][0] is NULL
\n
"
);
UE
=
PHY_vars_UE_g
[
inst
][
0
];
UE
=
PHY_vars_UE_g
[
inst
][
0
];
pthread_attr_init
(
&
UE
->
proc
.
attr_ue
);
pthread_attr_init
(
&
UE
->
proc
.
attr_ue
);
pthread_attr_setstacksize
(
&
UE
->
proc
.
attr_ue
,
8192
);
//5*PTHREAD_STACK_MIN);
pthread_attr_setstacksize
(
&
UE
->
proc
.
attr_ue
,
8192
);
//5*PTHREAD_STACK_MIN);
// Don't need synch for phy_stub mode
// Don't need synch for phy_stub mode
//pthread_mutex_init(&UE->proc.mutex_synch,NULL);
//pthread_mutex_init(&UE->proc.mutex_synch,NULL);
//pthread_cond_init(&UE->proc.cond_synch,NULL);
//pthread_cond_init(&UE->proc.cond_synch,NULL);
// the threads are not yet active, therefore access is allowed without locking
// the threads are not yet active, therefore access is allowed without locking
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads
//int nb_threads=RX_NB_TH;
//int nb_threads=RX_NB_TH;
int
nb_threads
=
1
;
int
nb_threads
=
1
;
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
if
(
rtd
==
NULL
)
abort
();
if
(
rtd
==
NULL
)
abort
();
rtd
->
UE
=
UE
;
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_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_start
=
i
;
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_step
=
nb_threads
;
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
);
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
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_phy_stub_thread_rxn_txnp4
,
rtd
);
}
}
// Remove thread for UE_sync in phy_stub_UE mode.
// Remove thread for UE_sync in phy_stub_UE mode.
//pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
//pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
}
}
...
@@ -1964,20 +1957,16 @@ void init_UE_threads_stub(int inst) {
...
@@ -1964,20 +1957,16 @@ void init_UE_threads_stub(int inst) {
#ifdef OPENAIR2
#ifdef OPENAIR2
void
fill_ue_band_info
(
void
)
{
void
fill_ue_band_info
(
void
)
{
LTE_UE_EUTRA_Capability_t
*
UE_EUTRA_Capability
=
UE_rrc_inst
[
0
].
UECap
->
UE_EUTRA_Capability
;
LTE_UE_EUTRA_Capability_t
*
UE_EUTRA_Capability
=
UE_rrc_inst
[
0
].
UECap
->
UE_EUTRA_Capability
;
int
i
,
j
;
int
i
,
j
;
bands_to_scan
.
nbands
=
UE_EUTRA_Capability
->
rf_Parameters
.
supportedBandListEUTRA
.
list
.
count
;
bands_to_scan
.
nbands
=
UE_EUTRA_Capability
->
rf_Parameters
.
supportedBandListEUTRA
.
list
.
count
;
for
(
i
=
0
;
i
<
bands_to_scan
.
nbands
;
i
++
)
{
for
(
i
=
0
;
i
<
bands_to_scan
.
nbands
;
i
++
)
{
for
(
j
=
0
;
j
<
sizeof
(
eutra_bands
)
/
sizeof
(
eutra_bands
[
0
]);
j
++
)
for
(
j
=
0
;
j
<
sizeof
(
eutra_bands
)
/
sizeof
(
eutra_bands
[
0
]);
j
++
)
if
(
eutra_bands
[
j
].
band
==
UE_EUTRA_Capability
->
rf_Parameters
.
supportedBandListEUTRA
.
list
.
array
[
i
]
->
bandEUTRA
)
{
if
(
eutra_bands
[
j
].
band
==
UE_EUTRA_Capability
->
rf_Parameters
.
supportedBandListEUTRA
.
list
.
array
[
i
]
->
bandEUTRA
)
{
memcpy
(
&
bands_to_scan
.
band_info
[
i
],
memcpy
(
&
bands_to_scan
.
band_info
[
i
],
&
eutra_bands
[
j
],
&
eutra_bands
[
j
],
sizeof
(
eutra_band_t
));
sizeof
(
eutra_band_t
));
printf
(
"Band %d (%lu) : DL %u..%u Hz, UL %u..%u Hz, Duplex %s
\n
"
,
printf
(
"Band %d (%lu) : DL %u..%u Hz, UL %u..%u Hz, Duplex %s
\n
"
,
bands_to_scan
.
band_info
[
i
].
band
,
bands_to_scan
.
band_info
[
i
].
band
,
UE_EUTRA_Capability
->
rf_Parameters
.
supportedBandListEUTRA
.
list
.
array
[
i
]
->
bandEUTRA
,
UE_EUTRA_Capability
->
rf_Parameters
.
supportedBandListEUTRA
.
list
.
array
[
i
]
->
bandEUTRA
,
...
@@ -1993,24 +1982,21 @@ void fill_ue_band_info(void) {
...
@@ -1993,24 +1982,21 @@ void fill_ue_band_info(void) {
#endif
#endif
int
setup_ue_buffers
(
PHY_VARS_UE
**
phy_vars_ue
,
openair0_config_t
*
openair0_cfg
)
{
int
setup_ue_buffers
(
PHY_VARS_UE
**
phy_vars_ue
,
openair0_config_t
*
openair0_cfg
)
{
int
i
,
CC_id
;
int
i
,
CC_id
;
LTE_DL_FRAME_PARMS
*
frame_parms
;
LTE_DL_FRAME_PARMS
*
frame_parms
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
AssertFatal
(
phy_vars_ue
[
CC_id
]
!=
0
,
""
);
AssertFatal
(
phy_vars_ue
[
CC_id
]
!=
0
,
""
);
frame_parms
=
&
(
phy_vars_ue
[
CC_id
]
->
frame_parms
);
frame_parms
=
&
(
phy_vars_ue
[
CC_id
]
->
frame_parms
);
// replace RX signal buffers with mmaped HW versions
// replace RX signal buffers with mmaped HW versions
rxdata
=
(
int32_t
**
)
malloc16
(
frame_parms
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
rxdata
=
(
int32_t
**
)
malloc16
(
frame_parms
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
txdata
=
(
int32_t
**
)
malloc16
(
frame_parms
->
nb_antennas_tx
*
sizeof
(
int32_t
*
)
);
txdata
=
(
int32_t
**
)
malloc16
(
frame_parms
->
nb_antennas_tx
*
sizeof
(
int32_t
*
)
);
for
(
i
=
0
;
i
<
frame_parms
->
nb_antennas_rx
;
i
++
)
{
for
(
i
=
0
;
i
<
frame_parms
->
nb_antennas_rx
;
i
++
)
{
LOG_I
(
PHY
,
"Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d
\n
"
,
LOG_I
(
PHY
,
"Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d
\n
"
,
CC_id
,
i
,
downlink_frequency
[
CC_id
][
i
],
phy_vars_ue
[
CC_id
]
->
rf_map
.
card
,
(
phy_vars_ue
[
CC_id
]
->
rf_map
.
chain
)
+
i
);
CC_id
,
i
,
downlink_frequency
[
CC_id
][
i
],
phy_vars_ue
[
CC_id
]
->
rf_map
.
card
,
(
phy_vars_ue
[
CC_id
]
->
rf_map
.
chain
)
+
i
);
free
(
phy_vars_ue
[
CC_id
]
->
common_vars
.
rxdata
[
i
]
);
free
(
phy_vars_ue
[
CC_id
]
->
common_vars
.
rxdata
[
i
]
);
rxdata
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
307200
*
sizeof
(
int32_t
)
);
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
phy_vars_ue
[
CC_id
]
->
common_vars
.
rxdata
[
i
]
=
rxdata
[
i
];
// what about the "-N_TA_offset" ? // N_TA offset for TDD
}
}
...
@@ -2018,7 +2004,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
...
@@ -2018,7 +2004,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
LOG_I
(
PHY
,
"Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d
\n
"
,
LOG_I
(
PHY
,
"Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d
\n
"
,
CC_id
,
i
,
downlink_frequency
[
CC_id
][
i
],
phy_vars_ue
[
CC_id
]
->
rf_map
.
card
,
(
phy_vars_ue
[
CC_id
]
->
rf_map
.
chain
)
+
i
);
CC_id
,
i
,
downlink_frequency
[
CC_id
][
i
],
phy_vars_ue
[
CC_id
]
->
rf_map
.
card
,
(
phy_vars_ue
[
CC_id
]
->
rf_map
.
chain
)
+
i
);
free
(
phy_vars_ue
[
CC_id
]
->
common_vars
.
txdata
[
i
]
);
free
(
phy_vars_ue
[
CC_id
]
->
common_vars
.
txdata
[
i
]
);
txdata
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
307200
*
sizeof
(
int32_t
)
);
txdata
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
307200
*
sizeof
(
int32_t
)
);
phy_vars_ue
[
CC_id
]
->
common_vars
.
txdata
[
i
]
=
txdata
[
i
];
phy_vars_ue
[
CC_id
]
->
common_vars
.
txdata
[
i
]
=
txdata
[
i
];
}
}
...
@@ -2027,6 +2013,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
...
@@ -2027,6 +2013,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
// be careful when releasing memory!
// be careful when releasing memory!
// because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes)
// because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes)
}
}
return
0
;
return
0
;
}
}
...
@@ -2039,7 +2026,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
...
@@ -2039,7 +2026,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
// playing the role of nfapi-pnf.
// playing the role of nfapi-pnf.
//02/02/2018
//02/02/2018
static
void
*
timer_thread
(
void
*
param
)
{
static
void
*
timer_thread
(
void
*
param
)
{
thread_top_init
(
"timer_thread"
,
1
,
870000L
,
1000000L
,
1000000L
);
thread_top_init
(
"timer_thread"
,
1
,
870000L
,
1000000L
,
1000000L
);
timer_subframe
=
9
;
timer_subframe
=
9
;
timer_frame
=
1023
;
timer_frame
=
1023
;
...
@@ -2049,15 +2036,13 @@ static void* timer_thread( void* param ) {
...
@@ -2049,15 +2036,13 @@ static void* timer_thread( void* param ) {
UE
=
PHY_vars_UE_g
[
0
][
0
];
UE
=
PHY_vars_UE_g
[
0
][
0
];
//double t_diff;
//double t_diff;
int
external_timer
=
0
;
int
external_timer
=
0
;
wait_sync
(
"timer_thread"
);
wait_sync
(
"timer_thread"
);
opp_enabled
=
1
;
opp_enabled
=
1
;
// first check if we are receiving timing indications
// first check if we are receiving timing indications
if
(
nfapi_mode
==
4
)
{
if
(
nfapi_mode
==
4
)
{
usleep
(
10000
);
usleep
(
10000
);
if
(
UE
->
instance_cnt_timer
>
0
)
{
if
(
UE
->
instance_cnt_timer
>
0
)
{
external_timer
=
1
;
external_timer
=
1
;
int
absSFm1
=
((
emulator_absSF
+
10239
)
%
10240
);
int
absSFm1
=
((
emulator_absSF
+
10239
)
%
10240
);
...
@@ -2067,25 +2052,32 @@ static void* timer_thread( void* param ) {
...
@@ -2067,25 +2052,32 @@ static void* timer_thread( void* param ) {
UE
->
instance_cnt_timer
=
-
1
;
UE
->
instance_cnt_timer
=
-
1
;
pthread_mutex_unlock
(
&
UE
->
timer_mutex
);
pthread_mutex_unlock
(
&
UE
->
timer_mutex
);
LOG_I
(
PHY
,
"Running with external timer
\n
"
);
LOG_I
(
PHY
,
"Running with external timer
\n
"
);
}
}
else
LOG_I
(
PHY
,
"Running with internal timer
\n
"
);
else
LOG_I
(
PHY
,
"Running with internal timer
\n
"
);
}
}
struct
timespec
t_start
;
struct
timespec
t_start
;
struct
timespec
t_now
;
struct
timespec
t_now
;
struct
timespec
t_sleep
;
struct
timespec
t_sleep
;
uint64_t
T_0
;
uint64_t
T_0
;
uint64_t
T_now
;
uint64_t
T_now
;
uint64_t
T_next_SF
;
uint64_t
T_next_SF
;
uint64_t
T_sleep
;
uint64_t
T_sleep
;
uint64_t
sf_cnt
=
0
;
//Total Subframe counter
uint64_t
sf_cnt
=
0
;
//Total Subframe counter
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_start
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_start
);
T_0
=
(
uint64_t
)
t_start
.
tv_sec
*
1000000000
+
t_start
.
tv_nsec
;
T_0
=
(
uint64_t
)
t_start
.
tv_sec
*
1000000000
+
t_start
.
tv_nsec
;
LOG_D
(
MAC
,
"timer_thread(), T_0 value: %"
PRId64
"
\n
"
,
T_0
);
LOG_D
(
MAC
,
"timer_thread(), T_0 value: %"
PRId64
"
\n
"
,
T_0
);
while
(
!
oai_exit
)
{
while
(
!
oai_exit
)
{
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines.
// They are set on the first rx/tx in the underly FH routines.
if
(
timer_subframe
==
9
)
{
if
(
timer_subframe
==
9
)
{
...
@@ -2099,8 +2091,9 @@ static void* timer_thread( void* param ) {
...
@@ -2099,8 +2091,9 @@ static void* timer_thread( void* param ) {
//AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), "");
//AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), "");
AssertFatal
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
==
0
,
""
);
AssertFatal
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
==
0
,
""
);
phy_stub_ticking
->
ticking_var
++
;
phy_stub_ticking
->
ticking_var
++
;
// This should probably be a call to pthread_cond_broadcast when we introduce support for multiple UEs (threads)
// This should probably be a call to pthread_cond_broadcast when we introduce support for multiple UEs (threads)
if
(
phy_stub_ticking
->
ticking_var
==
0
){
if
(
phy_stub_ticking
->
ticking_var
==
0
)
{
//AssertFatal(phy_stub_ticking->ticking_var == 0,"phy_stub_ticking->ticking_var = %d",
//AssertFatal(phy_stub_ticking->ticking_var == 0,"phy_stub_ticking->ticking_var = %d",
//phy_stub_ticking->ticking_var);
//phy_stub_ticking->ticking_var);
if
(
pthread_cond_signal
(
&
phy_stub_ticking
->
cond_ticking
)
!=
0
)
{
if
(
pthread_cond_signal
(
&
phy_stub_ticking
->
cond_ticking
)
!=
0
)
{
...
@@ -2108,57 +2101,54 @@ static void* timer_thread( void* param ) {
...
@@ -2108,57 +2101,54 @@ static void* timer_thread( void* param ) {
LOG_E
(
PHY
,
"timer_thread ERROR pthread_cond_signal for UE_thread
\n
"
);
LOG_E
(
PHY
,
"timer_thread ERROR pthread_cond_signal for UE_thread
\n
"
);
exit_fun
(
"nothing to add"
);
exit_fun
(
"nothing to add"
);
}
}
}
}
else
else
LOG_D
(
MAC
,
"timer_thread() Timing problem! ticking_var value:%d
\n
\n
\n
"
,
phy_stub_ticking
->
ticking_var
);
LOG_D
(
MAC
,
"timer_thread() Timing problem! ticking_var value:%d
\n
\n
\n
"
,
phy_stub_ticking
->
ticking_var
);
AssertFatal
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_ticking
)
==
0
,
""
);
AssertFatal
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_ticking
)
==
0
,
""
);
start_meas
(
&
UE
->
timer_stats
);
start_meas
(
&
UE
->
timer_stats
);
//clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); // get initial time-stamp
//clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); // get initial time-stamp
if
(
external_timer
==
0
)
{
if
(
external_timer
==
0
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_now
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_now
);
sf_cnt
++
;
sf_cnt
++
;
T_next_SF
=
T_0
+
sf_cnt
*
1000000
;
T_next_SF
=
T_0
+
sf_cnt
*
1000000
;
T_now
=
(
uint64_t
)
t_now
.
tv_sec
*
1000000000
+
t_now
.
tv_nsec
;
T_now
=
(
uint64_t
)
t_now
.
tv_sec
*
1000000000
+
t_now
.
tv_nsec
;
if
(
T_now
>
T_next_SF
){
if
(
T_now
>
T_next_SF
)
{
t_sleep
.
tv_sec
=
0
;
t_sleep
.
tv_sec
=
0
;
t_sleep
.
tv_nsec
=
0
;
t_sleep
.
tv_nsec
=
0
;
}
}
else
{
else
{
T_sleep
=
T_next_SF
-
T_now
;
T_sleep
=
T_next_SF
-
T_now
;
t_sleep
.
tv_sec
=
0
;
t_sleep
.
tv_sec
=
0
;
t_sleep
.
tv_nsec
=
(
__syscall_slong_t
)
T_sleep
;
t_sleep
.
tv_nsec
=
(
__syscall_slong_t
)
T_sleep
;
}
}
nanosleep
(
&
t_sleep
,
(
struct
timespec
*
)
NULL
);
nanosleep
(
&
t_sleep
,
(
struct
timespec
*
)
NULL
);
UE_tport_t
pdu
;
UE_tport_t
pdu
;
pdu
.
header
.
packet_type
=
TTI_SYNC
;
pdu
.
header
.
packet_type
=
TTI_SYNC
;
pdu
.
header
.
absSF
=
(
timer_frame
*
10
)
+
timer_subframe
;
pdu
.
header
.
absSF
=
(
timer_frame
*
10
)
+
timer_subframe
;
if
(
nfapi_mode
!=
3
){
if
(
nfapi_mode
!=
3
)
{
multicast_link_write_sock
(
0
,
multicast_link_write_sock
(
0
,
(
char
*
)
&
pdu
,
(
char
*
)
&
pdu
,
sizeof
(
UE_tport_header_t
));
sizeof
(
UE_tport_header_t
));
}
}
}
else
{
}
else
{
wait_on_condition
(
&
UE
->
timer_mutex
,
&
UE
->
timer_cond
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
wait_on_condition
(
&
UE
->
timer_mutex
,
&
UE
->
timer_cond
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
release_thread
(
&
UE
->
timer_mutex
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
release_thread
(
&
UE
->
timer_mutex
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
}
}
/*stop_meas(&UE->timer_stats);
/*stop_meas(&UE->timer_stats);
t_diff = get_time_meas_us(&UE->timer_stats);
t_diff = get_time_meas_us(&UE->timer_stats);
stop_meas(&UE->timer_stats);
stop_meas(&UE->timer_stats);
t_diff = get_time_meas_us(&UE->timer_stats);*/
t_diff = get_time_meas_us(&UE->timer_stats);*/
}
}
free
(
phy_stub_ticking
);
free
(
phy_stub_ticking
);
pthread_cond_destroy
(
&
phy_stub_ticking
->
cond_ticking
);
pthread_cond_destroy
(
&
phy_stub_ticking
->
cond_ticking
);
pthread_mutex_destroy
(
&
phy_stub_ticking
->
mutex_ticking
);
pthread_mutex_destroy
(
&
phy_stub_ticking
->
mutex_ticking
);
return
0
;
return
0
;
}
}
...
@@ -2166,7 +2156,7 @@ static void* timer_thread( void* param ) {
...
@@ -2166,7 +2156,7 @@ static void* timer_thread( void* param ) {
int
init_timer_thread
(
void
)
{
int
init_timer_thread
(
void
)
{
//PHY_VARS_UE *UE=PHY_vars_UE_g[0];
//PHY_VARS_UE *UE=PHY_vars_UE_g[0];
PHY_VARS_UE
*
UE
=
PHY_vars_UE_g
[
0
][
0
];
PHY_VARS_UE
*
UE
=
PHY_vars_UE_g
[
0
][
0
];
phy_stub_ticking
=
(
SF_ticking
*
)
malloc
(
sizeof
(
SF_ticking
));
phy_stub_ticking
=
(
SF_ticking
*
)
malloc
(
sizeof
(
SF_ticking
));
pthread_mutex_init
(
&
UE
->
timer_mutex
,
NULL
);
pthread_mutex_init
(
&
UE
->
timer_mutex
,
NULL
);
pthread_cond_init
(
&
UE
->
timer_cond
,
NULL
);
pthread_cond_init
(
&
UE
->
timer_cond
,
NULL
);
UE
->
instance_cnt_timer
=
-
1
;
UE
->
instance_cnt_timer
=
-
1
;
...
@@ -2183,8 +2173,7 @@ int init_timer_thread(void) {
...
@@ -2183,8 +2173,7 @@ int init_timer_thread(void) {
/* HACK: this function is needed to compile the UE
/* HACK: this function is needed to compile the UE
* fix it somehow
* fix it somehow
*/
*/
int8_t
find_dlsch
(
uint16_t
rnti
,
PHY_VARS_eNB
*
eNB
,
find_type_t
type
)
int8_t
find_dlsch
(
uint16_t
rnti
,
PHY_VARS_eNB
*
eNB
,
find_type_t
type
)
{
{
printf
(
"you cannot read this
\n
"
);
printf
(
"you cannot read this
\n
"
);
abort
();
abort
();
}
}
...
...
targets/RT/USER/lte-uesoftmodem.c
View file @
753c2f44
...
@@ -760,22 +760,22 @@ int main( int argc, char **argv ) {
...
@@ -760,22 +760,22 @@ int main( int argc, char **argv ) {
}
}
MSC_INIT
(
MSC_E_UTRAN
,
THREAD_MAX
+
TASK_MAX
);
MSC_INIT
(
MSC_E_UTRAN
,
THREAD_MAX
+
TASK_MAX
);
init_opt
();
init_opt
();
uint32_t
pdcp_initmask
=
(
!
IS_SOFTMODEM_NOS1
)
?
LINK_ENB_PDCP_TO_GTPV1U_BIT
:
(
LINK_ENB_PDCP_TO_GTPV1U_BIT
|
PDCP_USE_NETLINK_BIT
|
LINK_ENB_PDCP_TO_IP_DRIVER_BIT
);
uint32_t
pdcp_initmask
=
(
!
IS_SOFTMODEM_NOS1
)
?
LINK_ENB_PDCP_TO_GTPV1U_BIT
:
(
LINK_ENB_PDCP_TO_GTPV1U_BIT
|
PDCP_USE_NETLINK_BIT
|
LINK_ENB_PDCP_TO_IP_DRIVER_BIT
);
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
||
(
nfapi_mode
==
3
)
)
{
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
||
(
nfapi_mode
==
3
)
)
{
pdcp_initmask
=
pdcp_initmask
|
UE_NAS_USE_TUN_BIT
;
pdcp_initmask
=
pdcp_initmask
|
UE_NAS_USE_TUN_BIT
;
}
}
if
(
IS_SOFTMODEM_NOKRNMOD
)
if
(
IS_SOFTMODEM_NOKRNMOD
)
pdcp_initmask
=
pdcp_initmask
|
UE_NAS_USE_TUN_BIT
;
pdcp_initmask
=
pdcp_initmask
|
UE_NAS_USE_TUN_BIT
;
pdcp_module_init
(
pdcp_initmask
);
pdcp_module_init
(
pdcp_initmask
);
//TTN for D2D
//TTN for D2D
printf
(
"RRC control socket
\n
"
);
printf
(
"RRC control socket
\n
"
);
rrc_control_socket_init
();
rrc_control_socket_init
();
printf
(
"PDCP PC5S socket
\n
"
);
printf
(
"PDCP PC5S socket
\n
"
);
pdcp_pc5_socket_init
();
pdcp_pc5_socket_init
();
// to make a graceful exit when ctrl-c is pressed
// to make a graceful exit when ctrl-c is pressed
signal
(
SIGSEGV
,
signal_handler
);
signal
(
SIGSEGV
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
...
...
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