Commit 0234d377 authored by Guy De Souza's avatar Guy De Souza

Merge branch 'nr-rrc-additions' into develop-nr

parents 22cd5d61 36dedfa4
...@@ -1471,6 +1471,7 @@ set (MAC_SRC ...@@ -1471,6 +1471,7 @@ set (MAC_SRC
${NR_MAC_DIR}/config.c ${NR_MAC_DIR}/config.c
${NR_MAC_DIR}/gNB_scheduler.c ${NR_MAC_DIR}/gNB_scheduler.c
${NR_MAC_DIR}/gNB_scheduler_bch.c ${NR_MAC_DIR}/gNB_scheduler_bch.c
${NR_MAC_DIR}/gNB_scheduler_primitives.c
) )
......
...@@ -45,7 +45,7 @@ void handle_nr_nfapi_bch_pdu(PHY_VARS_gNB *gNB, ...@@ -45,7 +45,7 @@ void handle_nr_nfapi_bch_pdu(PHY_VARS_gNB *gNB,
AssertFatal(dl_config_pdu->bch_pdu_rel15.length == 3, "BCH PDU has length %d != 3\n", AssertFatal(dl_config_pdu->bch_pdu_rel15.length == 3, "BCH PDU has length %d != 3\n",
dl_config_pdu->bch_pdu_rel15.length); dl_config_pdu->bch_pdu_rel15.length);
LOG_D(PHY,"bch_pdu: %x,%x,%x\n",sdu[0],sdu[1],sdu[2]); LOG_I(PHY,"pbch_pdu[0]: %x,pbch_pdu[1]: %x,gNB->pbch_pdu[2]: %x\n",sdu[0],sdu[1],sdu[2]);
gNB->pbch_pdu[0] = sdu[2]; gNB->pbch_pdu[0] = sdu[2];
gNB->pbch_pdu[1] = sdu[1]; gNB->pbch_pdu[1] = sdu[1];
gNB->pbch_pdu[2] = sdu[0]; gNB->pbch_pdu[2] = sdu[0];
......
...@@ -81,6 +81,8 @@ static void configure_nr_rrc(uint32_t gnb_id) ...@@ -81,6 +81,8 @@ static void configure_nr_rrc(uint32_t gnb_id)
} }
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
/*
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties) static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties)
{ {
...@@ -92,7 +94,7 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, ...@@ -92,7 +94,7 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//,
{ {
s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse
/* note: there is an implicit relationship between the data structure and the message name */ // note: there is an implicit relationship between the data structure and the message name
msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_ENB_REQ); //Message Temporarily reuse msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_ENB_REQ); //Message Temporarily reuse
RCconfig_NR_S1(msg_p, gnb_id); RCconfig_NR_S1(msg_p, gnb_id);
...@@ -113,8 +115,10 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, ...@@ -113,8 +115,10 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//,
return register_gnb_pending; return register_gnb_pending;
} }
# endif # endif
*/
#endif #endif
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
void *gNB_app_task(void *args_p) void *gNB_app_task(void *args_p)
{ {
......
...@@ -599,7 +599,7 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ...@@ -599,7 +599,7 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
int32_t srb1_poll_byte = 0; int32_t srb1_poll_byte = 0;
int32_t srb1_max_retx_threshold = 0; int32_t srb1_max_retx_threshold = 0;
int32_t my_int; //int32_t my_int;
paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
////////// Identification parameters ////////// Identification parameters
......
...@@ -176,13 +176,14 @@ void check_nr_ul_failure(module_id_t module_idP, ...@@ -176,13 +176,14 @@ void check_nr_ul_failure(module_id_t module_idP,
} }
*/ */
/*
void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
{ {
gNB_MAC_INST *gNB = RC.nrmac[module_idP]; gNB_MAC_INST *gNB = RC.nrmac[module_idP];
UE_list_t *UE_list = &gNB->UE_list; UE_list_t *UE_list = &gNB->UE_list;
nfapi_ul_config_request_body_t *ul_req; nfapi_ul_config_request_body_t *ul_req;
int CC_id, UE_id; int CC_id, UE_id;
COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels; NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
SoundingRS_UL_ConfigCommon_t *soundingRS_UL_ConfigCommon; SoundingRS_UL_ConfigCommon_t *soundingRS_UL_ConfigCommon;
struct SoundingRS_UL_ConfigDedicated *soundingRS_UL_ConfigDedicated; struct SoundingRS_UL_ConfigDedicated *soundingRS_UL_ConfigDedicated;
uint8_t TSFC; uint8_t TSFC;
...@@ -257,7 +258,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -257,7 +258,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
} // SRS config } // SRS config
} }
} }
*/
void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
{ {
int CC_id; int CC_id;
......
/*
* 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_primitives.c
* \brief primitives used by eNB for BCH, RACH, ULSCH, DLSCH scheduling
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
* \version 1.0
* @ingroup _mac
*/
#include "assertions.h"
#include "LAYER2/MAC/mac.h"
#include "LAYER2/NR_MAC_gNB/mac.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/NR_MAC_gNB/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/NR/nr_rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "T.h"
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_gNB_SCHEDULER 1
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
extern int n_active_slices;
int is_nr_UL_sf(NR_COMMON_channels_t * ccP, sub_frame_t subframeP){
// if FDD return dummy value
if (ccP->tdd_Config == NULL)
return (0);
switch (ccP->tdd_Config->subframeAssignment) {
case 1:
switch (subframeP) {
case 0:
case 4:
case 5:
case 9:
return (0);
break;
case 2:
case 3:
case 7:
case 8:
return (1);
break;
default:
return (0);
break;
}
break;
case 3:
if ((subframeP <= 1) || (subframeP >= 5))
return (0);
else if ((subframeP > 1) && (subframeP < 5))
return (1);
else
AssertFatal(1 == 0, "Unknown subframe number\n");
break;
case 4:
if ((subframeP <= 1) || (subframeP >= 4))
return (0);
else if ((subframeP > 1) && (subframeP < 4))
return (1);
else
AssertFatal(1 == 0, "Unknown subframe number\n");
break;
case 5:
if ((subframeP <= 1) || (subframeP >= 3))
return (0);
else if ((subframeP > 1) && (subframeP < 3))
return (1);
else
AssertFatal(1 == 0, "Unknown subframe number\n");
break;
default:
AssertFatal(1 == 0,
"subframe %d Unsupported TDD configuration %d\n",
subframeP, (int) ccP->tdd_Config->subframeAssignment);
break;
}
}
\ No newline at end of file
...@@ -119,7 +119,7 @@ typedef struct gNB_MAC_INST_s { ...@@ -119,7 +119,7 @@ typedef struct gNB_MAC_INST_s {
/// 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
nfapi_dl_config_request_pdu_t dl_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_DL_PDU]; nfapi_nr_dl_config_request_pdu_t dl_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_DL_PDU];
/// Preallocated UL pdu list /// Preallocated UL pdu list
nfapi_ul_config_request_pdu_t ul_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_UL_PDU]; nfapi_ul_config_request_pdu_t ul_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_UL_PDU];
/// Preallocated UL pdu list for ULSCH (n+k delay) /// Preallocated UL pdu list for ULSCH (n+k delay)
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#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);
int rrc_mac_config_req_gNB(module_id_t Mod_idP, int rrc_mac_config_req_gNB(module_id_t Mod_idP,
...@@ -19,8 +17,17 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -19,8 +17,17 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_ServingCellConfigCommon_t *servingcellconfigcommon
); );
int is_nr_UL_sf(NR_COMMON_channels_t * ccP, sub_frame_t subframeP);
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
int CC_idP,
frame_t frameP,
sub_frame_t subframeP);
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframeP); sub_frame_t subframeP);
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);
#endif /*__LAYER2_NR_MAC_PROTO_H__*/ #endif /*__LAYER2_NR_MAC_PROTO_H__*/
\ No newline at end of file
...@@ -300,7 +300,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) ...@@ -300,7 +300,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info)
sched_info->DL_req = &mac->DL_req[CC_id]; sched_info->DL_req = &mac->DL_req[CC_id];
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id]; sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id];
if ((mac->common_channels[CC_id].tdd_Config==NULL) || if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
(is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0)) (is_nr_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0))
sched_info->UL_req = &mac->UL_req[CC_id]; sched_info->UL_req = &mac->UL_req[CC_id];
else else
sched_info->UL_req = NULL; sched_info->UL_req = NULL;
......
...@@ -22,7 +22,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -22,7 +22,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
//SRB_INFO *Srb_info; //SRB_INFO *Srb_info;
//uint8_t Sdu_size = 0; //uint8_t Sdu_size = 0;
uint8_t sfn = (uint8_t)((frameP>>4)&0xff); uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f);
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
int i; int i;
...@@ -38,16 +38,17 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -38,16 +38,17 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
mib = &carrier->mib; mib = &carrier->mib;
if( (Srb_id & RAB_OFFSET ) == MIBCH) { if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.choice.mib->systemFrameNumber.buf = &sfn; mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2;
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message,
NULL, NULL,
(void *)mib, (void *)mib,
carrier->MIB, carrier->MIB,
24); 24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); LOG_I(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[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1]; buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2]; buffer_pP[2]=carrier->MIB[2];
LOG_I(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", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return(3); return(3);
......
...@@ -205,10 +205,11 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier, ...@@ -205,10 +205,11 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
mib->message.choice.mib = CALLOC(1,sizeof(struct NR_MIB)); mib->message.choice.mib = CALLOC(1,sizeof(struct NR_MIB));
memset(mib->message.choice.mib,0,sizeof(struct NR_MIB)); memset(mib->message.choice.mib,0,sizeof(struct NR_MIB));
//36.331 SFN BIT STRING (SIZE (8) , 38.331 SFN BIT STRING (SIZE (6)) //36.331 SFN BIT STRING (SIZE (8) , 38.331 SFN BIT STRING (SIZE (6))
uint8_t sfn = (uint8_t)((frame>>4)&0xff); uint8_t sfn_msb = (uint8_t)((frame>>4)&0x3f);
mib->message.choice.mib->systemFrameNumber.buf = &sfn; mib->message.choice.mib->systemFrameNumber.buf = CALLOC(1,sizeof(uint8_t));
mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2;
mib->message.choice.mib->systemFrameNumber.size = 1; mib->message.choice.mib->systemFrameNumber.size = 1;
mib->message.choice.mib->systemFrameNumber.bits_unused=0; mib->message.choice.mib->systemFrameNumber.bits_unused=2;
//38.331 spare BIT STRING (SIZE (1)) //38.331 spare BIT STRING (SIZE (1))
uint16_t *spare= calloc(1, sizeof(uint16_t)); uint16_t *spare= calloc(1, sizeof(uint16_t));
......
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