Commit 2070c982 authored by WEI-TAI CHEN's avatar WEI-TAI CHEN

Adding the NR MIB scheduler in eNB_ulsch_dlsch_scheduler, re-use LTE MAC

parent b3f68c72
...@@ -1396,6 +1396,7 @@ set(L2_SRC ...@@ -1396,6 +1396,7 @@ set(L2_SRC
${RRC_DIR}/L2_interface_ue.c ${RRC_DIR}/L2_interface_ue.c
${NR_RRC_DIR}/rrc_gNB.c ${NR_RRC_DIR}/rrc_gNB.c
${NR_RRC_DIR}/nr_rrc_common.c ${NR_RRC_DIR}/nr_rrc_common.c
${NR_RRC_DIR}/L2_nr_interface.c
) )
set(L2_SRC_UE set(L2_SRC_UE
...@@ -1465,6 +1466,7 @@ set (MAC_SRC ...@@ -1465,6 +1466,7 @@ set (MAC_SRC
${NR_PHY_INTERFACE_DIR}/NR_IF_Module.c ${NR_PHY_INTERFACE_DIR}/NR_IF_Module.c
${NR_MAC_DIR}/main.c ${NR_MAC_DIR}/main.c
${NR_MAC_DIR}/config.c ${NR_MAC_DIR}/config.c
${NR_MAC_DIR}/gNB_scheduler_bch.c
) )
set (MAC_SRC_UE set (MAC_SRC_UE
......
...@@ -268,12 +268,17 @@ typedef struct{ ...@@ -268,12 +268,17 @@ typedef struct{
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
nfapi_nr_SearchSpaces_t sib1searchSpace; uint16_t length;
nfapi_nr_ControlResourcesSets_t sib1ControlResourceSets; uint16_t pdu_index;
uint16_t transmission_power;
}nfapi_nr_dl_config_bch_pdu_rel15_t; }nfapi_nr_dl_config_bch_pdu_rel15_t;
#define NFAPI_NR_DL_CONFIG_REQUEST_BCH_PDU_REL15_TAG 0x5025
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
nfapi_nr_SearchSpaces_t sib1searchSpace;
nfapi_nr_ControlResourcesSets_t sib1ControlResourceSets;
nfapi_nr_SearchSpaces_t sibssearchSpace; nfapi_nr_SearchSpaces_t sibssearchSpace;
nfapi_nr_ControlResourcesSets_t sibsControlResourceSets; nfapi_nr_ControlResourcesSets_t sibsControlResourceSets;
nfapi_nr_SearchSpaces_t ra_SearchSpace; nfapi_nr_SearchSpaces_t ra_SearchSpace;
...@@ -319,7 +324,7 @@ typedef struct { ...@@ -319,7 +324,7 @@ typedef struct {
uint8_t number_dci; uint8_t number_dci;
uint16_t number_pdu; uint16_t number_pdu;
uint8_t number_pdsch_rnti; uint8_t number_pdsch_rnti;
nfapi_dl_config_request_pdu_t *dl_config_pdu_list; nfapi_nr_dl_config_request_pdu_t *dl_config_pdu_list;
} nfapi_nr_dl_config_request_body_t; } nfapi_nr_dl_config_request_body_t;
typedef struct { typedef struct {
......
...@@ -125,7 +125,7 @@ void *gNB_app_task(void *args_p) ...@@ -125,7 +125,7 @@ void *gNB_app_task(void *args_p)
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
//uint32_t register_gnb_pending; //uint32_t register_gnb_pending;
//uint32_t registered_gnb; //uint32_t registered_gnb;
long gnb_register_retry_timer_id; //long gnb_register_retry_timer_id;
# endif # endif
uint32_t gnb_id; uint32_t gnb_id;
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h" #include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h" #include "UTIL/OPT/opt.h"
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
#include "OCG_extern.h" #include "OCG_extern.h"
#include "RRC/LTE/rrc_extern.h" #include "RRC/LTE/rrc_extern.h"
#include "RRC/NR/nr_rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c" //#include "LAYER2/MAC/pre_processor.c"
...@@ -637,8 +639,14 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, ...@@ -637,8 +639,14 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
// This schedules MIB // This schedules MIB
if ((subframeP == 0) && (frameP & 3) == 0) if ((subframeP == 0) && (frameP & 3) == 0){
schedule_mib(module_idP, frameP, subframeP); schedule_mib(module_idP, frameP, subframeP);
}
if((subframeP == 0) && (frameP & 7) == 0){
schedule_nr_mib(module_idP, frameP, subframeP);
}
if (phy_test == 0){ if (phy_test == 0){
// This schedules SI for legacy LTE and eMTC starting in subframeP // This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI(module_idP, frameP, subframeP); schedule_SI(module_idP, frameP, subframeP);
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file gNB_scheduler.c
* \brief gNB scheduler top level function operates on per subframe basis
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
* \version 0.5
* @ingroup _mac
*/
#include "assertions.h"
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "RRC/LTE/rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
//Agent-related headers
#include "flexran_agent_extern.h"
#include "flexran_agent_mac.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "assertions.h"
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
extern RAN_CONTEXT_t RC;
extern int phy_test;
uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
void
gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP)
{
int mbsfn_status[MAX_NUM_CCs];
protocol_ctxt_t ctxt;
int CC_id, i = -1;
UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
rnti_t rnti;
COMMON_channels_t *cc = RC.mac[module_idP]->common_channels;
start_meas(&RC.mac[module_idP]->eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
VCD_FUNCTION_IN);
RC.mac[module_idP]->frame = frameP;
RC.mac[module_idP]->subframe = subframeP;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
mbsfn_status[CC_id] = 0;
// clear vrb_maps
memset(cc[CC_id].vrb_map, 0, 100);
memset(cc[CC_id].vrb_map_UL, 0, 100);
#if defined(Rel10) || defined(Rel14)
cc[CC_id].mcch_active = 0;
#endif
clear_nfapi_information(RC.mac[module_idP], CC_id, frameP, subframeP);
}
// refresh UE list based on UEs dropped by PHY in previous subframe
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (UE_list->active[i]) {
rnti = UE_RNTI(module_idP, i);
CC_id = UE_PCCID(module_idP, i);
if (((frameP&127) == 0) && (subframeP == 0)) {
LOG_I(MAC,
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
rnti,
UE_list->UE_sched_ctrl[i].ul_out_of_sync ==
0 ? "in synch" : "out of sync",
UE_list->UE_template[CC_id][i].phr_info,
UE_list->UE_sched_ctrl[i].dl_cqi[CC_id],
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
}
RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) +
subframeP] = -63;
if (i == UE_list->head)
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
RC.eNB[module_idP][CC_id]->
pusch_stats_bsr[i][(frameP * 10) + subframeP]);
// increment this, it is cleared when we receive an sdu
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++;
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n", i, rnti,
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].
ul_inactivity_timer,
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
check_ul_failure(module_idP, CC_id, i, frameP, subframeP);
if (RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) {
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++;
if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0;
for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_ENB; ue_id_l++) {
if (reestablish_rnti_map[ue_id_l][0] == rnti) {
// clear currentC-RNTI from map
reestablish_rnti_map[ue_id_l][0] = 0;
reestablish_rnti_map[ue_id_l][1] = 0;
break;
}
}
// Note: This should not be done in the MAC!
for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) {
LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti);
clean_eNb_ulsch(ulsch);
}
}
for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) {
LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)){
LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti);
clean_eNb_dlsch(dlsch);
}
}
for(int j = 0; j < 10; j++){
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
ul_req_tmp = &RC.mac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body;
if(ul_req_tmp){
int pdu_number = ul_req_tmp->number_of_pdus;
for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){
LOG_I(MAC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
if(pdu_index < pdu_number -1){
memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
}
ul_req_tmp->number_of_pdus--;
}
}
}
}
rrc_mac_remove_ue(module_idP,rnti);
}
}
}
}
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,
NOT_A_RNTI, frameP, subframeP,
module_idP);
pdcp_run(&ctxt);
rrc_rx_tx(&ctxt, CC_id);
#if defined(Rel10) || defined(Rel14)
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
if (cc[CC_id].MBMS_flag > 0) {
start_meas(&RC.mac[module_idP]->schedule_mch);
mbsfn_status[CC_id] = schedule_MBMS(module_idP, CC_id, frameP, subframeP);
stop_meas(&RC.mac[module_idP]->schedule_mch);
}
}
#endif
// This schedules MIB
if ((subframeP == 0) && (frameP & 3) == 0)
schedule_mib(module_idP, frameP, subframeP);
if (phy_test == 0){
// This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI(module_idP, frameP, subframeP);
// This schedules Paging in subframeP
schedule_PCH(module_idP,frameP,subframeP);
// This schedules Random-Access for legacy LTE and eMTC starting in subframeP
schedule_RA(module_idP, frameP, subframeP);
// copy previously scheduled UL resources (ULSCH + HARQ)
copy_ulreq(module_idP, frameP, subframeP);
// This schedules SRS in subframeP
schedule_SRS(module_idP, frameP, subframeP);
// This schedules ULSCH in subframeP (dci0)
schedule_ulsch(module_idP, frameP, subframeP);
// This schedules UCI_SR in subframeP
schedule_SR(module_idP, frameP, subframeP);
// This schedules UCI_CSI in subframeP
schedule_CSI(module_idP, frameP, subframeP);
// This schedules DLSCH in subframeP
schedule_dlsch(module_idP, frameP, subframeP, mbsfn_status);
}
else{
schedule_ulsch_phy_test(module_idP,frameP,subframeP);
schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status);
}
if (RC.flexran[module_idP]->enabled)
flexran_agent_send_update_stats(module_idP);
// Allocate CCEs for good after scheduling is done
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
allocate_CCEs(module_idP, CC_id, subframeP, 0);
stop_meas(&RC.mac[module_idP]->eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
VCD_FUNCTION_OUT);
}
\ No newline at end of file
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file eNB_scheduler_bch.c
* \brief procedures related to eNB for the BCH transport channel
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
* \version 1.0
* @ingroup _mac
*/
#include "assertions.h"
#include "LAYER2/NR_MAC_gNB/mac.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "LAYER2/MAC/mac_extern.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "RRC/NR/nr_rrc_extern.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP){
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc;
nfapi_nr_dl_config_request_t *dl_config_request;
nfapi_nr_dl_config_request_body_t *dl_req;
nfapi_nr_dl_config_request_pdu_t *dl_config_pdu;
nfapi_tx_request_pdu_t *TX_req;
int mib_sdu_length;
int CC_id;
uint16_t sfn_sf = frameP << 4 | subframeP;
AssertFatal(subframeP == 0, "Subframe must be 0\n");
AssertFatal((frameP & 7) == 0, "Frame must be a multiple of 8\n");
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
dl_config_request = &gNB->DL_req[CC_id];
dl_req = &dl_config_request->dl_config_request_body;
cc = &gNB->common_channels[CC_id];
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); // not used in this case
LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
if (mib_sdu_length > 0) {
LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length);
if ((frameP & 1023) < 80){
LOG_D(MAC,"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",module_idP, frameP, CC_id, mib_sdu_length);
}
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_BCH_PDU_TYPE;
dl_config_pdu->pdu_size =2 + sizeof(nfapi_nr_dl_config_bch_pdu_rel15_t);
dl_config_pdu->bch_pdu.tl.tag = NFAPI_NR_DL_CONFIG_REQUEST_BCH_PDU_REL15_TAG;
dl_config_pdu->bch_pdu.length = mib_sdu_length;
dl_config_pdu->bch_pdu.pdu_index = gNB->pdu_index[CC_id];
dl_config_pdu->bch_pdu.transmission_power = 6000;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_req->number_pdu++;
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_request->sfn_sf = sfn_sf;
LOG_D(MAC, "gNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu);
// DL request
TX_req = &gNB->TX_req[CC_id].tx_request_body.tx_pdu_list[gNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = 3;
TX_req->pdu_index = gNB->pdu_index[CC_id]++;
TX_req->num_segments = 1;
TX_req->segments[0].segment_length = 3;
TX_req->segments[0].segment_data = cc[CC_id].MIB_pdu.payload;
gNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
gNB->TX_req[CC_id].sfn_sf = sfn_sf;
gNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
gNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
}
}
}
...@@ -58,6 +58,41 @@ ...@@ -58,6 +58,41 @@
#include "LAYER2/MAC/mac.h" // temporary #include "LAYER2/MAC/mac.h" // temporary
/*! \brief eNB common channels */
typedef struct {
int physCellId;
int p_gNB;
int Ncp;
int eutra_band;
uint32_t dl_CarrierFreq;
NR_BCCH_BCH_Message_t *mib;
TDD_Config_t *tdd_Config;
ARFCN_ValueEUTRA_t ul_CarrierFreq;
long ul_Bandwidth;
/// Outgoing MIB PDU for PHY
MIB_PDU MIB_pdu;
/// Outgoing BCCH pdu for PHY
BCCH_PDU BCCH_pdu;
/// Outgoing BCCH DCI allocation
uint32_t BCCH_alloc_pdu;
/// Outgoing CCCH pdu for PHY
CCCH_PDU CCCH_pdu;
/// Outgoing PCCH DCI allocation
uint32_t PCCH_alloc_pdu;
/// Outgoing PCCH pdu for PHY
PCCH_PDU PCCH_pdu;
/// Outgoing RAR pdu for PHY
RAR_PDU RAR_pdu;
/// Template for RA computations
RA_t ra[NB_RA_PROC_MAX];
/// VRB map for common channels
uint8_t vrb_map[100];
/// VRB map for common channels and retransmissions by PHICH
uint8_t vrb_map_UL[100];
/// number of subframe allocation pattern available for MBSFN sync area
uint8_t num_sf_allocation_pattern;
} NR_COMMON_channels_t;
/*! \brief top level eNB MAC structure */ /*! \brief top level eNB MAC structure */
typedef struct gNB_MAC_INST_s { typedef struct gNB_MAC_INST_s {
/// Ethernet parameters for northbound midhaul interface /// Ethernet parameters for northbound midhaul interface
...@@ -75,7 +110,7 @@ typedef struct gNB_MAC_INST_s { ...@@ -75,7 +110,7 @@ typedef struct gNB_MAC_INST_s {
/// NFAPI Config Request Structure /// NFAPI Config Request Structure
nfapi_nr_config_request_t config[NFAPI_CC_MAX]; nfapi_nr_config_request_t config[NFAPI_CC_MAX];
/// NFAPI DL Config Request Structure /// NFAPI DL Config Request Structure
nfapi_dl_config_request_t DL_req[NFAPI_CC_MAX]; nfapi_nr_dl_config_request_t DL_req[NFAPI_CC_MAX];
/// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
nfapi_ul_config_request_t UL_req[NFAPI_CC_MAX]; nfapi_ul_config_request_t UL_req[NFAPI_CC_MAX];
/// Preallocated DL pdu list /// Preallocated DL pdu list
...@@ -87,8 +122,9 @@ typedef struct gNB_MAC_INST_s { ...@@ -87,8 +122,9 @@ typedef struct gNB_MAC_INST_s {
/// NFAPI DL PDU structure /// NFAPI DL PDU structure
nfapi_tx_request_t TX_req[NFAPI_CC_MAX]; nfapi_tx_request_t TX_req[NFAPI_CC_MAX];
/// Common cell resources /// Common cell resources
COMMON_channels_t common_channels[NFAPI_CC_MAX]; NR_COMMON_channels_t common_channels[NFAPI_CC_MAX];
/// current PDU index (BCH,DLSCH)
uint16_t pdu_index[NFAPI_CC_MAX];
UE_list_t UE_list; UE_list_t UE_list;
} gNB_MAC_INST; } gNB_MAC_INST;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "mac.h" #include "mac.h"
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);
void mac_top_init_gNB(void); void mac_top_init_gNB(void);
......
...@@ -45,7 +45,7 @@ extern RAN_CONTEXT_t RC; ...@@ -45,7 +45,7 @@ extern RAN_CONTEXT_t RC;
void mac_top_init_gNB(void) void mac_top_init_gNB(void)
{ {
module_id_t i, j; module_id_t i;
int list_el; int list_el;
UE_list_t *UE_list; UE_list_t *UE_list;
gNB_MAC_INST *nrmac; gNB_MAC_INST *nrmac;
......
#include "platform_types.h"
#include "rrc_defs.h"
#include "rrc_extern.h"
#include "UTIL/LOG/log.h"
#include "pdcp.h"
#include "msc.h"
#include "common/ran_context.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
extern RAN_CONTEXT_t RC;
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t *const buffer_pP ){
asn_enc_rval_t enc_rval;
SRB_INFO *Srb_info;
uint8_t Sdu_size = 0;
uint8_t sfn = (uint8_t)((frameP>>2)&0xff);
#ifdef DEBUG_RRC
int i;
LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
#endif
gNB_RRC_INST *rrc;
rrc_gNB_carrier_data_t *carrier;
NR_BCCH_BCH_Message_t *mib;
rrc = RC.nrrrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.choice.mib->systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message,
NULL,
(void *)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2];
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return(3);
}
//BCCH SIB1 SIBs
//CCCH
return(0);
}
\ No newline at end of file
This diff is collapsed.
...@@ -41,6 +41,14 @@ void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info, ...@@ -41,6 +41,14 @@ void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
uint8_t Lchan_type, uint8_t Lchan_type,
uint8_t Role); uint8_t Role);
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t *const buffer_pP );
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
/**\brief RRC eNB task. /**\brief RRC eNB task.
\param void *args_p Pointer on arguments to start the task. */ \param void *args_p Pointer on arguments to start the task. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment