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
wangwenhui
OpenXG-RAN
Commits
413ab9bc
Commit
413ab9bc
authored
Oct 12, 2020
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MIB NR: pdcch_ConfigSIB1 selection and fill
parent
0fe3e5fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
171 additions
and
66 deletions
+171
-66
openair2/LAYER2/MAC/mac_vars.h
openair2/LAYER2/MAC/mac_vars.h
+15
-0
openair2/RRC/NR/L2_nr_interface.c
openair2/RRC/NR/L2_nr_interface.c
+156
-66
No files found.
openair2/LAYER2/MAC/mac_vars.h
View file @
413ab9bc
...
@@ -35,6 +35,21 @@
...
@@ -35,6 +35,21 @@
#include "mac.h"
#include "mac.h"
#include "COMMON/mac_rrc_primitives.h"
#include "COMMON/mac_rrc_primitives.h"
#define table_38213_13_1_num_indexes 15
#define table_38213_13_2_num_indexes 14
#define table_38213_13_3_num_indexes 9
#define table_38213_13_4_num_indexes 16
#define table_38213_13_5_num_indexes 9
#define table_38213_13_6_num_indexes 10
#define table_38213_13_7_num_indexes 12
#define table_38213_13_8_num_indexes 8
#define table_38213_13_9_num_indexes 4
#define table_38213_13_10_num_indexes 8
#define table_38213_13_11_num_indexes 16
#define table_38213_13_12_num_indexes 14
const
uint32_t
BSR_TABLE
[
BSR_TABLE_SIZE
]
=
{
const
uint32_t
BSR_TABLE
[
BSR_TABLE_SIZE
]
=
{
0
,
10
,
12
,
14
,
17
,
19
,
22
,
26
,
31
,
36
,
42
,
49
,
57
,
67
,
78
,
91
,
0
,
10
,
12
,
14
,
17
,
19
,
22
,
26
,
31
,
36
,
42
,
49
,
57
,
67
,
78
,
91
,
105
,
125
,
146
,
171
,
200
,
234
,
274
,
321
,
376
,
440
,
515
,
603
,
706
,
826
,
105
,
125
,
146
,
171
,
200
,
234
,
274
,
321
,
376
,
440
,
515
,
603
,
706
,
826
,
...
...
openair2/RRC/NR/L2_nr_interface.c
View file @
413ab9bc
...
@@ -30,11 +30,10 @@
...
@@ -30,11 +30,10 @@
#include "platform_types.h"
#include "platform_types.h"
#include "nr_rrc_defs.h"
#include "nr_rrc_defs.h"
#include "nr_rrc_extern.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "pdcp.h"
#include "pdcp.h"
#include "msc.h"
#include "common/ran_context.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/MAC/mac_vars.h"
#include "intertask_interface.h"
#include "intertask_interface.h"
...
@@ -44,74 +43,165 @@
...
@@ -44,74 +43,165 @@
extern
RAN_CONTEXT_t
RC
;
extern
RAN_CONTEXT_t
RC
;
int8_t
mac_rrc_nr_data_req
(
const
module_id_t
Mod_idP
,
int8_t
mac_rrc_nr_data_req
(
const
module_id_t
Mod_idP
,
const
int
CC_id
,
const
int
CC_id
,
const
frame_t
frameP
,
const
frame_t
frameP
,
const
rb_id_t
Srb_id
,
const
rb_id_t
Srb_id
,
const
uint8_t
Nb_tb
,
const
uint8_t
Nb_tb
,
uint8_t
*
const
buffer_pP
)
{
uint8_t
*
const
buffer_pP
)
{
asn_enc_rval_t
enc_rval
;
asn_enc_rval_t
enc_rval
;
uint8_t
Sdu_size
=
0
;
uint8_t
Sdu_size
=
0
;
uint8_t
sfn_msb
=
(
uint8_t
)((
frameP
>>
4
)
&
0x3f
);
uint8_t
sfn_msb
=
(
uint8_t
)
((
frameP
>>
4
)
&
0x3f
);
#ifdef DEBUG_RRC
#ifdef DEBUG_RRC
LOG_D
(
RRC
,
"[eNB %d] mac_rrc_data_req to SRB ID=%ld
\n
"
,
Mod_idP
,
Srb_id
);
LOG_D
(
RRC
,
"[eNB %d] mac_rrc_data_req to SRB ID=%ld
\n
"
,
Mod_idP
,
Srb_id
);
#endif
#endif
gNB_RRC_INST
*
rrc
;
gNB_RRC_INST
*
rrc
;
rrc_gNB_carrier_data_t
*
carrier
;
rrc_gNB_carrier_data_t
*
carrier
;
NR_BCCH_BCH_Message_t
*
mib
;
NR_BCCH_BCH_Message_t
*
mib
;
NR_SRB_INFO
*
srb_info
;
NR_SRB_INFO
*
srb_info
;
char
payload_size
,
*
payload_pP
;
char
payload_size
,
*
payload_pP
;
rrc
=
RC
.
nrrrc
[
Mod_idP
];
rrc
=
RC
.
nrrrc
[
Mod_idP
];
carrier
=
&
rrc
->
carrier
;
carrier
=
&
rrc
->
carrier
;
mib
=
&
carrier
->
mib
;
mib
=
&
carrier
->
mib
;
srb_info
=
&
carrier
->
Srb0
;
srb_info
=
&
carrier
->
Srb0
;
/* MIBCH */
/* MIBCH */
if
(
(
Srb_id
&
RAB_OFFSET
)
==
MIBCH
)
{
if
((
Srb_id
&
RAB_OFFSET
)
==
MIBCH
)
{
mib
->
message
.
choice
.
mib
->
systemFrameNumber
.
buf
[
0
]
=
sfn_msb
<<
2
;
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_BCCH_BCH_Message
,
NULL
,
/// controlResourceSetZero
(
void
*
)
mib
,
carrier
->
MIB
,
switch
(
*
carrier
->
servingcellconfigcommon
->
ssbSubcarrierSpacing
)
{
24
);
LOG_D
(
NR_RRC
,
"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu
\n
"
,
frameP
,
sfn_msb
,
carrier
->
MIB
,
enc_rval
.
encoded
);
case
NR_SubcarrierSpacing_kHz15
:
buffer_pP
[
0
]
=
carrier
->
MIB
[
0
];
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz15
)
{
buffer_pP
[
1
]
=
carrier
->
MIB
[
1
];
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_1_num_indexes
;
buffer_pP
[
2
]
=
carrier
->
MIB
[
2
];
}
else
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz30
)
{
LOG_D
(
NR_RRC
,
"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x
\n
"
,
buffer_pP
[
0
],
buffer_pP
[
1
],
buffer_pP
[
2
]);
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_2_num_indexes
;
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
}
else
{
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
AssertFatal
(
true
,
"Invalid subCarrierSpacingCommon
\n
"
);
return
(
3
);
}
}
break
;
/* TODO BCCH SIB1 SIBs */
case
NR_SubcarrierSpacing_kHz30
:
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz15
)
{
/* CCCH */
if
(
(
Srb_id
&
RAB_OFFSET
)
==
CCCH
)
{
// TODO get min_bw 38.101-1 table 5.3.5-1
//struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
//if ( (min_bw == 5) || (min_bw == 10) {
//if (ue_context_p == NULL) return(0);
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_3_num_indexes
;
//eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
//} else if (min_bw == 40) {
LOG_D
(
RRC
,
"[gNB %d] Frame %d CCCH request (Srb_id %ld)
\n
"
,
Mod_idP
,
frameP
,
Srb_id
);
// mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_5_num_indexes;
//}
// srb_info=&ue_p->Srb0;
}
else
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz30
)
{
payload_size
=
srb_info
->
Tx_buffer
.
payload_size
;
// TODO get min_bw 38.101-1 table 5.3.5-1
// check if data is there for MAC
//if ( (min_bw == 5) || (min_bw == 10) {
if
(
payload_size
>
0
)
{
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_4_num_indexes
;
payload_pP
=
srb_info
->
Tx_buffer
.
Payload
;
//} else if (min_bw == 40) {
LOG_D
(
RRC
,
"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)
\n
"
,
Mod_idP
,
srb_info
,
payload_size
,
buffer_pP
,
payload_pP
);
// mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_6_num_indexes;
// Fill buffer
//}
memcpy
((
void
*
)
buffer_pP
,
(
void
*
)
payload_pP
,
payload_size
);
Sdu_size
=
payload_size
;
}
else
{
srb_info
->
Tx_buffer
.
payload_size
=
0
;
AssertFatal
(
true
,
"Invalid subCarrierSpacingCommon
\n
"
);
}
break
;
case
NR_SubcarrierSpacing_kHz120
:
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz60
)
{
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_7_num_indexes
;
}
else
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz120
)
{
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_8_num_indexes
;
}
else
{
AssertFatal
(
true
,
"Invalid subCarrierSpacingCommon
\n
"
);
}
break
;
case
NR_SubcarrierSpacing_kHz240
:
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz60
)
{
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_9_num_indexes
;
}
else
if
(
mib
->
message
.
choice
.
mib
->
subCarrierSpacingCommon
==
NR_SubcarrierSpacing_kHz120
)
{
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
controlResourceSetZero
=
rand
()
%
table_38213_13_10_num_indexes
;
}
else
{
AssertFatal
(
true
,
"Invalid subCarrierSpacingCommon
\n
"
);
}
break
;
default:
AssertFatal
(
true
,
"Invalid ssbSubcarrierSpacing
\n
"
);
break
;
}
/// TODO: searchSpaceZero
//if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){
mib
->
message
.
choice
.
mib
->
pdcch_ConfigSIB1
.
searchSpaceZero
=
rand
()
%
table_38213_13_11_num_indexes
;
/*}
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_12_num_indexes;
}
if(mac->type0_pdcch_ss_mux_pattern == 2) {
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_13_num_indexes;
} else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_14_num_indexes;
}
}*/
//NR_UE_MAC_INST_t *mac = get_mac_inst(Mod_idP);
//gNB_mac = RC.nrmac[0];
//mac->type0_pdcch_ss_mux_pattern
mib
->
message
.
choice
.
mib
->
systemFrameNumber
.
buf
[
0
]
=
sfn_msb
<<
2
;
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_BCCH_BCH_Message
,
NULL
,
(
void
*
)
mib
,
carrier
->
MIB
,
24
);
LOG_D
(
NR_RRC
,
"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu
\n
"
,
frameP
,
sfn_msb
,
carrier
->
MIB
,
enc_rval
.
encoded
);
buffer_pP
[
0
]
=
carrier
->
MIB
[
0
];
buffer_pP
[
1
]
=
carrier
->
MIB
[
1
];
buffer_pP
[
2
]
=
carrier
->
MIB
[
2
];
LOG_D
(
NR_RRC
,
"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x
\n
"
,
buffer_pP
[
0
],
buffer_pP
[
1
],
buffer_pP
[
2
]);
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
(
3
);
}
/* TODO BCCH SIB1 SIBs */
/* CCCH */
if
((
Srb_id
&
RAB_OFFSET
)
==
CCCH
)
{
//struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
//if (ue_context_p == NULL) return(0);
//eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
LOG_D
(
RRC
,
"[gNB %d] Frame %d CCCH request (Srb_id %ld)
\n
"
,
Mod_idP
,
frameP
,
Srb_id
);
// srb_info=&ue_p->Srb0;
payload_size
=
srb_info
->
Tx_buffer
.
payload_size
;
// check if data is there for MAC
if
(
payload_size
>
0
)
{
payload_pP
=
srb_info
->
Tx_buffer
.
Payload
;
LOG_D
(
RRC
,
"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)
\n
"
,
Mod_idP
,
srb_info
,
payload_size
,
buffer_pP
,
payload_pP
);
// Fill buffer
memcpy
((
void
*
)
buffer_pP
,
(
void
*
)
payload_pP
,
payload_size
);
Sdu_size
=
payload_size
;
srb_info
->
Tx_buffer
.
payload_size
=
0
;
}
return
Sdu_size
;
}
}
return
Sdu_size
;
}
return
(
0
);
return
(
0
);
}
}
\ No newline at end of file
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