Commit 91968d84 authored by Calvin's avatar Calvin

P5 message UL/DL BWP Common/Dedicated finish, primitibes of MIB RX/RRC decode done

parent 7c770135
......@@ -21,66 +21,6 @@
#include "stddef.h"
// Constants - update based on implementation
#define NFAPI_NR_MAX_PHY_RF_INSTANCES 2
#define NFAPI_NR_PNF_PARAM_GENERAL_LOCATION_LENGTH 16
#define NFAPI_NR_PNF_PARAM_GENERAL_OUI_LENGTH 3
#define NFAPI_NR_MAX_NUM_RF_BANDS 16
// The following definition control the size of arrays used in the interface.
// These may be changed if desired. They are used in the encoder to make sure
// that the user has not specified a 'count' larger than the max array, and also
// used by the decoder when decode an array. If the 'count' received is larger
// than the array it is to be stored in the decode fails.
#define NFAPI_NR_MAX_NUM_ANTENNAS 8
#define NFAPI_NR_MAX_NUM_SUBBANDS 13
#define NFAPI_NR_MAX_BF_VECTORS 8
#define NFAPI_NR_MAX_CC 1
#define NFAPI_NR_MAX_NUM_PHYSICAL_ANTENNAS 8
#define NFAPI_NR_MAX_RSSI 8
#define NFAPI_NR_MAX_PSC_LIST 32
#define NFAPI_NR_MAX_PCI_LIST 32
#define NFAPI_NR_MAX_CARRIER_LIST 32
#define NFAPI_NR_MAX_ARFCN_LIST 128
#define NFAPI_NR_MAX_LTE_CELLS_FOUND 8
#define NFAPI_NR_MAX_UTRAN_CELLS_FOUND 8
#define NFAPI_NR_MAX_GSM_CELLS_FOUND 8
#define NFAPI_NR_MAX_NB_IOT_CELLS_FOUND 8
#define NFAPI_NR_MAX_SI_PERIODICITY 8
#define NFAPI_NR_MAX_SI_INDEX 8
#define NFAPI_NR_MAX_MIB_LENGTH 32
#define NFAPI_NR_MAX_SIB_LENGTH 256
#define NFAPI_NR_MAX_SI_LENGTH 256
#define NFAPI_NR_MAX_OPAQUE_DATA 64
#define NFAPI_NR_MAX_NUM_SCHEDULED_UES 8 // Used in the TPM structure
#define NFAPI_NR_MAX_PNF_PHY 5
#define NFAPI_NR_MAX_PNF_PHY_RF_CONFIG 5
#define NFAPI_NR_MAX_PNF_RF 5
#define NFAPI_NR_MAX_NMM_FREQUENCY_BANDS 32
#define NFAPI_NR_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS 100
#define NFAPI_NR_MAX_UL_DL_CONFIGURATIONS 5
#define NFAPI_NR_MAX_CSI_RS_RESOURCE_CONFIG 4
#define NFAPI_NR_MAX_ANTENNA_PORT_COUNT 8
#define NFAPI_NR_MAX_EPDCCH_PRB 8
#define NFAPI_NR_MAX_TX_PHYSICAL_ANTENNA_PORTS 8
#define NFAPI_NR_MAX_NUMBER_ACK_NACK_TDD 8
#define NFAPI_NR_MAX_RO_DL 8
#define NFAPI_NR_HEADER_LENGTH 8
#define NFAPI_NR_P7_HEADER_LENGTH 16
#define NFAPI_NR_VENDOR_EXTENSION_MIN_TAG_VALUE 0xF000
#define NFAPI_NR_VENDOR_EXTENSION_MAX_TAG_VALUE 0xFFFF
#define NFAPI_NR_VERSION_3_0_11 0x000
#define NFAPI_NR_VERSION_3_0_12 0x001
#define NFAPI_NR_HALF_FRAME_INDEX_FIRST_HALF 0
#define NFAPI_NR_HALF_FRAME_INDEX_SECOND_HALF 1
// The IANA agreed port definition of the P5 SCTP VNF enpoint
// http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=7701
#define NFAPI_NR_P5_SCTP_PORT 7701
#define NFAPI_NR_MAX_NUM_DL_ALLOCATIONS 16
......@@ -328,6 +268,7 @@ typedef struct {
} nfapi_nr_dl_config_request_t;
//
// P5
//
......@@ -583,7 +524,28 @@ typedef struct {
} nfapi_nr_ul_bwp_common_config_t;
typedef struct {
uint8_t inter_slot_frequency_hopping;
uint8_t additional_dmrs;
uint8_t max_code_rate;
uint8_t number_of_slots;
uint8_t pi2bpsk;
uint8_t simultaneous_harq_ack_csi;
} nfapi_nr_pucch_format_config_t;
typedef struct {
nfapi_nr_pucch_format_config_t format1;
nfapi_nr_pucch_format_config_t format2;
nfapi_nr_pucch_format_config_t format3;
nfapi_nr_pucch_format_config_t format4;
nfapi_nr_pucch_resource_t multi_csi_pucch_resources[2];
uint8_t dl_data_to_ul_ack[8];
// pucch power control
uint8_t deltaF_pucch_f0;
uint8_t deltaF_pucch_f1;
uint8_t deltaF_pucch_f2;
uint8_t deltaF_pucch_f3;
uint8_t deltaF_pucch_f4;
uint8_t two_pucch_pc_adjusment_states;
} nfapi_nr_ul_bwp_dedicated_config_t;
typedef struct {
......
......@@ -30,97 +30,100 @@
*/
#include "mac_proto.h"
int
nr_rrc_mac_config_req_ue(
module_id_t Mod_idP,
module_id_t module_id,
int CC_idP,
uint8_t eNB_index,
MAC_CellGroupConfig_t *mac_cell_group_config,
PhysicalCellGroupConfig_t *phy_cell_group_config,
SpCellConfig_t *spcell_config){
uint8_t gNB_index,
NR_MIB_t *mibP,
NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
NR_SpCellConfig_t *spcell_configP ){
NR_UE_MAC_INST *mac = get_mac_inst(Mod_idP);
NR_UE_MAC_INST *mac = get_mac_inst(module_id);
ServingCellConfig_t *serving_cell_config = spcell_config->spCellConfigDedicated;
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
if(mac_cell_group_config != (MAC_CellGroupConfig_t *)0){
if(mac_cell_group_config->drx_Config != (drx_Config_t *)0 ){
mac->drx_Config = mac_cell_group_config->drx_Config;
if(mib != NULL){
}
if(mac_cell_group_configP != NULL){
if(mac_cell_group_configP->drx_Config != NULL ){
mac->drx_Config = mac_cell_group_configP->drx_Config;
}
if(mac_cell_group_config->SchedulingRequestConfig != (SchedulingRequestConfig_t *)0 ){
mac->SchedulingRequestConfig = mac_cell_group_config->SchedulingRequestConfig;
if(mac_cell_group_configP->SchedulingRequestConfig != NULL ){
mac->SchedulingRequestConfig = mac_cell_group_configP->SchedulingRequestConfig;
}
if(mac_cell_group_config->BSR_Config != (BSR_Config_t *)0 ){
mac->BSR_Config = mac_cell_group_config->BSR_Config;
if(mac_cell_group_configP->BSR_Config != NULL ){
mac->BSR_Config = mac_cell_group_configP->BSR_Config;
}
if(mac_cell_group_config->TAG_Config != (TAG_Config_t *)0 ){
mac->TAG_Config = mac_cell_group_config->TAG_Config;
if(mac_cell_group_configP->TAG_Config != NULL ){
mac->TAG_Config = mac_cell_group_configP->TAG_Config;
}
if(mac_cell_group_config->phr_Config != (phr_Config_t *)0 ){
mac->phr_Config = mac_cell_group_config->phr_Config;
if(mac_cell_group_configP->phr_Config != NULL ){
mac->phr_Config = mac_cell_group_configP->phr_Config;
}
if(mac_cell_group_config->cs_RNTI != (cs_RNTI_t *)0 ){
mac->cs_RNTI = mac_cell_group_config->cs_RNTI;
if(mac_cell_group_configP->cs_RNTI != NULL ){
mac->cs_RNTI = mac_cell_group_configP->cs_RNTI;
}
}
if(phy_cell_group_config != (PhysicalCellGroupConfig_t *)0){
config_phy(phy_cell_group_config, NULL);
if(phy_cell_group_configP != NULL ){
//config_phy(phy_cell_group_config, NULL);
}
if(serving_cell_config_config != (SpCellConfig_t *)0){
config_phy(NULL, spcell_config);
// TODO check
/*
if(serving_cell_config_configP != NULL ){
//config_phy(NULL, spcell_config);
mac->servCellIndex = spcell_config->servCellIndex;
}
if(serving_cell_config != (spCellConfigDedicated_t *)0){
if(serving_cell_config->tdd_UL_DL_ConfigurationDedicated != (TDD_UL_DL_ConfigDedicated_t *)0){
if(serving_cell_config != NULL ){
if(serving_cell_config->tdd_UL_DL_ConfigurationDedicated != NULL ){
mac->tdd_UL_DL_ConfigurationDedicated = serving_cell_config->tdd_UL_DL_ConfigurationDedicated;
}
if(spcell_config->initialDownlinkBWP != (BWP_DownlinkDedicated_t *)0){
if(spcell_config->initialDownlinkBWP != NULL ){
mac->init_DL_BWP = spcell_config->initialDownlinkBWP;
}
// storage list of DL BWP config. TODO should be modify to maintain(add/release) a list inside MAC instance, this implementation just use for one-shot RRC configuration setting.
if(spcell_config->downlinkBWP_ToAddModList != (struct ServingCellConfig__downlinkBWP_ToAddModList *)0){
if(spcell_config->downlinkBWP_ToAddModList != NULL ){
mac->BWP_Downlink_list = spcell_config->downlinkBWP_ToAddModList->list;
mac->BWP_Downlink_count = spcell_config->downlinkBWP_ToAddModList->count;
}
if(spcell_config->bwp_InactivityTimer != (long *)0){
if(spcell_config->bwp_InactivityTimer != NULL ){
mac->bwp_InactivityTimer = spcell_config->bwp_InactivityTimer;
}
if(spcell_config->defaultDownlinkBWP_Id != (BWP_Id_t *)0){
if(spcell_config->defaultDownlinkBWP_Id != NULL ){
mac->defaultDownlinkBWP_Id = spcell_config->defaultDownlinkBWP_Id;
}
if(spcell_config->pdsch_ServingCellConfig != (PDSCH_ServingCellConfig_t *)0){
if(spcell_config->pdsch_ServingCellConfig != NULL ){
mac->pdsch_ServingCellConfig = spcell_config->pdsch_ServingCellConfig;
}
if(spcell_config->csi_MeasConfig != (CSI_MeasConfig_t *)0){
if(spcell_config->csi_MeasConfig != NULL ){
mac->csi_MeasConfig = spcell_config->csi_MeasConfig;
}
spcell_config->tag_Id = spcell_config.tag_Id;
}
*/
//scell config not yet
return (0);
}
/*
* 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 LAYER2/MAC/defs.h
* \brief MAC data structures, constant, and function prototype
* \author Navid Nikaein and Raymond Knopp
* \date 2011
* \version 0.5
* \email navid.nikaein@eurecom.fr
*/
/** @defgroup _oai2 openair2 Reference Implementation
* @ingroup _ref_implementation_
* @{
*/
/*@}*/
#ifndef __LAYER2_MAC_DEFS_H__
#define __LAYER2_MAC_DEFS_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "COMMON/platform_constants.h"
#include "BCCH-BCH-Message.h"
#include "RadioResourceConfigCommon.h"
#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "MeasGapConfig.h"
#include "SchedulingInfoList.h"
#include "TDD-Config.h"
#include "RACH-ConfigCommon.h"
#include "MeasObjectToAddModList.h"
#include "MobilityControlInfo.h"
#if defined(Rel10) || defined(Rel14)
#include "MBSFN-AreaInfoList-r9.h"
#include "MBSFN-SubframeConfigList.h"
#include "PMCH-InfoList-r9.h"
#include "SCellToAddMod-r10.h"
#endif
#ifdef Rel14
#include "SystemInformationBlockType1-v1310-IEs.h"
#endif
#include "nfapi_interface.h"
#include "PHY_INTERFACE/IF_Module.h"
#include "PHY/TOOLS/time_meas.h"
#include "PHY/defs_common.h" // for PRACH_RESOURCES_t
#include "targets/ARCH/COMMON/common_lib.h"
//solve implicit declaration
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
/** @defgroup _mac MAC
* @ingroup _oai2
* @{
*/
/*!\brief Values of BCCH logical channel (fake)*/
#define NR_BCCH_DL_SCH 3 // SI
/*!\brief Values of PCCH logical channel (fake) */
#define NR_BCCH_BCH 5 // MIB
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
/*
* 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 LAYER2/MAC/proto.h
* \brief MAC functions prototypes for eNB and UE
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email navid.nikaein@eurecom.fr
* \version 1.0
*/
#ifndef __LAYER2_MAC_PROTO_H__
#define __LAYER2_MAC_PROTO_H__
#include "mac_defs.h"
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
\param module_id module id
\param CC_id component carrier id
\param gNB_index gNB index
\param extra_bits extra bits for frame calculation
\param ssb_index SSB index for frame calculation
\param frameP pointer to frame for revising after frame calculation
\param pduP pointer to pdu
\param pdu_length length of pdu*/
void nr_ue_decode_mib(module_id_t module_id, int CC_id, uint8_t gNB_index, uint8_t extra_bits, uint32_t ssb_index, uint32_t *frameP, void *pduP, uint16_t pdu_len);
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
\param module_id module id
\param CC_id component carrier id
\param gNB_index gNB index
\param mibP pointer to RRC message MIB
\param mac_cell_group_configP pointer to RRC message MAC-related in cell group config
\param phy_cell_group_configP pointer to RRC message PHY-related in cell group config
\param spcell_configP pointer to RRC message serving cell config*/
int nr_rrc_mac_config_req_ue( module_id_t module_id, int CC_id, uint8_t gNB_index, NR_MIB_t *mibP, NR_MAC_CellGroupConfig_t *mac_cell_group_configP, NR_PhysicalCellGroupConfig_t *phy_cell_group_configP, NR_SpCellConfig_t *spcell_configP ){
#endif
/** @}*/
/*
* 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 ue_procedures.c
* \brief procedures related to UE
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1
* \email: navid.nikaein@eurecom.fr
* @ingroup _mac
*/
#include "mac_proto.h"
#include "RRC/NR_UE/proto.h"
void
nr_ue_decode_mib(
module_id_t module_id,
int CC_id,
uint8_t gNB_index,
uint8_t extra_bits,
uint32_t ssb_index,
uint32_t *frameP,
void *pduP,
uint16_t pdu_len){
nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index, frameP,
NR_BCCH_BCH, (uint8_t *) pduP, pdu_len );
// frame calculation
}
......@@ -19,53 +19,39 @@
* contact@openairinterface.org
*/
/*! \file rrc_types.h
* \brief rrc types and subtypes
* \author Navid Nikaein and Raymond Knopp
* \date 2011 - 2014
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
*/
#ifndef NR_RRC_TYPES_H_
#define NR_RRC_TYPES_H_
typedef enum nr_rrc_state_e {
//RRC_STATE_INACTIVE=0,
//RRC_STATE_IDLE,
//RRC_STATE_CONNECTED,
//RRC_STATE_FIRST = RRC_STATE_INACTIVE,
//RRC_STATE_LAST = RRC_STATE_CONNECTED,
RRC_STATE_IDLE = 0,
RRC_STATE_INACTIVE,
RRC_STATE_CONNECTED,
RRC_STATE_FIRST = RRC_STATE_IDLE,
RRC_STATE_LAST = RRC_STATE_CONNECTED
} nr_rrc_state_t;
/*! \file l2_interface.c
* \brief layer 2 interface, used to support different RRC sublayer
* \author Raymond Knopp and Navid Nikaein
* \date 2010-2014
* \version 1.0
* \company Eurecom
* \email: raymond.knopp@eurecom.fr
*/
typedef enum nr_rrc_sub_state_e {
//RRC_SUB_STATE_INACTIVE=0,
#include "rrc_defs.h"
#include "rrc_proto.h"
//RRC_SUB_STATE_IDLE_SEARCHING,
//RRC_SUB_STATE_IDLE_RECEIVING_SIB,
//RRC_SUB_STATE_IDLE_SIB_COMPLETE,
//RRC_SUB_STATE_IDLE_CONNECTING,
//RRC_SUB_STATE_IDLE,
typedef uint32_t channel_t;
//RRC_SUB_STATE_CONNECTED,
int8_t
nr_mac_rrc_data_ind_ue(
const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const uint32_t* frameP,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len){
//RRC_SUB_STATE_INACTIVE_FIRST = RRC_SUB_STATE_INACTIVE,
//RRC_SUB_STATE_INACTIVE_LAST = RRC_SUB_STATE_INACTIVE,
switch(channel){
case NR_BCCH_BCH:
nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len);
break;
default:
break;
}
//RRC_SUB_STATE_IDLE_FIRST = RRC_SUB_STATE_IDLE_SEARCHING,
//RRC_SUB_STATE_IDLE_LAST = RRC_SUB_STATE_IDLE,
//RRC_SUB_STATE_CONNECTED_FIRST = RRC_SUB_STATE_CONNECTED,
//RRC_SUB_STATE_CONNECTED_LAST = RRC_SUB_STATE_CONNECTED,
} nr_rrc_sub_state_t;
return(0);
#endif /* RRC_TYPES_H_ */
}
\ No newline at end of file
......@@ -32,119 +32,11 @@
#define RRC_UE_C
#include "rrc_list.h"
// header files for RRC message for NR might be change to add prefix in from of the file name.
#include "assertions.h"
#include "hashtable.h"
#include "asn1_conversions.h"
#include "defs.h"
#include "PHY/TOOLS/dB_routines.h"
#include "extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/mac_rrc_primitives.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#ifndef CELLULAR
#include "RRC/LITE/MESSAGES/asn1_msg.h"
#endif
#include "RRCConnectionRequest.h"
#include "RRCConnectionReconfiguration.h"
#include "UL-CCCH-Message.h"
#include "DL-CCCH-Message.h"
#include "UL-DCCH-Message.h"
#include "DL-DCCH-Message.h"
#include "BCCH-DL-SCH-Message.h"
#include "PCCH-Message.h"
#if defined(Rel10) || defined(Rel14)
#include "MCCH-Message.h"
#endif
#include "MeasConfig.h"
#include "MeasGapConfig.h"
#include "MeasObjectEUTRA.h"
#include "TDD-Config.h"
#include "UECapabilityEnquiry.h"
#include "UE-CapabilityRequest.h"
#include "RRC/NAS/nas_config.h"
#include "RRC/NAS/rb_config.h"
#if ENABLE_RAL
#include "rrc_UE_ral.h"
#endif
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
// from NR SRB3
uint8_t nr_rrc_ue_decode_dcch(
const uint8_t *buffer,
const uint32_t size
){
// uper_decode by nr R15 rrc_connection_reconfiguration
NR_DL_DCCH_Message_t *nr_dl_dcch_msg = (NR_DL_DCCH_Message_t *)0;
uper_decode(NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void**)&nr_dl_dcch_msg,
(uint8_t *)buffer,
size, 0, 0);
if(nr_dl_dcch_msg != NULL){
switch(nr_dl_dcch_msg->message.present){
case DL_DCCH_MessageType_PR_c1:
switch(nr_dl_dcch_msg->message.choice.c1.present){
case DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
nr_rrc_ue_process_rrcReconfiguration(&nr_dl_dcch_msg->message.choice.c1.choice.rrcReconfiguration);
break;
case DL_DCCH_MessageType__c1_PR_NOTHING:
case DL_DCCH_MessageType__c1_PR_spare15:
case DL_DCCH_MessageType__c1_PR_spare14:
case DL_DCCH_MessageType__c1_PR_spare13:
case DL_DCCH_MessageType__c1_PR_spare12:
case DL_DCCH_MessageType__c1_PR_spare11:
case DL_DCCH_MessageType__c1_PR_spare10:
case DL_DCCH_MessageType__c1_PR_spare9:
case DL_DCCH_MessageType__c1_PR_spare8:
case DL_DCCH_MessageType__c1_PR_spare7:
case DL_DCCH_MessageType__c1_PR_spare6:
case DL_DCCH_MessageType__c1_PR_spare5:
case DL_DCCH_MessageType__c1_PR_spare4:
case DL_DCCH_MessageType__c1_PR_spare3:
case DL_DCCH_MessageType__c1_PR_spare2:
case DL_DCCH_MessageType__c1_PR_spare1:
default:
// not support or unuse
break;
}
break;
case DL_DCCH_MessageType_PR_NOTHING:
case DL_DCCH_MessageType_PR_messageClassExtension:
default:
// not support or unuse
break;
}
// release memory allocation
free(nr_dl_dcch_msg);
}else{
// log..
}
return 0;
}
#include "rrc_defs.h"
#include "rrc_proto.h"
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
uint8_t nr_rrc_ue_decode_secondary_cellgroup_config(
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(
const uint8_t *buffer,
const uint32_t size
){
......@@ -161,7 +53,8 @@ uint8_t nr_rrc_ue_decode_secondary_cellgroup_config(
nr_rrc_ue_process_scg_config(cellGroupConfig);
}else{
nr_rrc_ue_process_scg_config(cellGroupConfig);
asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0);
//asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0);
SEQUENCE_free(&asn_DEF_CellGroupConfig, (void *)cellGroupConfig, 0);
}
nr_rrc_mac_config_req_ue();
......@@ -170,7 +63,7 @@ uint8_t nr_rrc_ue_decode_secondary_cellgroup_config(
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (decoded)
// RRCReconfiguration
uint8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfiguration){
int8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfiguration){
switch(rrcReconfiguration.criticalExtensions.present){
case RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration:
......@@ -197,7 +90,8 @@ uint8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfi
}else{
// after first time, update it and free the memory after.
nr_rrc_ue_process_scg_config(cellGroupConfig);
asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0);
//asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0);
SEQUENCE_free(&asn_DEF_CellGroupConfig, (void *)cellGroupConfig, 0);
}
}
......@@ -228,11 +122,11 @@ uint8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfi
nr_rrc_mac_config_req_ue();
}
uint8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config){
int8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config){
}
uint8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config){
int8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config){
int i;
void *listobj;
if(NR_UE_rrc_inst->cell_group_config==NULL){
......@@ -274,12 +168,12 @@ uint8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config){
}
}
}
uint8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_bearer_config){
int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_bearer_config){
}
uint8_t openair_rrc_top_init_ue_nr(void){
int8_t openair_rrc_top_init_ue_nr(void){
if(NB_NR_UE_INST > 0){
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)malloc(NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t));
......@@ -318,22 +212,140 @@ uint8_t openair_rrc_top_init_ue_nr(void){
}
uint8_t nr_ue_process_rlc_bearer_list(NR_CellGroupConfig_t *cell_group_config){
int8_t nr_ue_process_rlc_bearer_list(NR_CellGroupConfig_t *cell_group_config){
};
uint8_t nr_ue_process_secondary_cell_list(NR_CellGroupConfig_t *cell_group_config){
int8_t nr_ue_process_secondary_cell_list(NR_CellGroupConfig_t *cell_group_config){
};
uint8_t nr_ue_process_mac_cell_group_config(NR_MAC_CellGroupConfig_t *mac_cell_group_config){
int8_t nr_ue_process_mac_cell_group_config(NR_MAC_CellGroupConfig_t *mac_cell_group_config){
};
uint8_t nr_ue_process_physical_cell_group_config(NR_PhysicalCellGroupConfig_t *phy_cell_group_config){
int8_t nr_ue_process_physical_cell_group_config(NR_PhysicalCellGroupConfig_t *phy_cell_group_config){
};
uint8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
};
/*brief decode BCCH-BCH (MIB) message*/
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
const module_id_t module_id,
const uint8_t gNB_index,
uint8_t *const bufferP,
const uint8_t buffer_len){
int i;
NR_BCCH_BCH_Message_t *bcch_message = NULL;
NR_MIB_t *mib = NR_UE_rrc_inst->mib;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_BCCH_BCH_Message,
(void **)&bcch_message,
(const void *)bufferP,
buffer_len );
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E( RRC, "[UE %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
module_id,
dec_rval.consumed );
for (i=0; i<buffer_len; i++)
printf("%02x ",bufferP[i]);
printf("\n");
// free the memory
SEQUENCE_free( &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message, 1 );
return -1;
}
// copy into rrc instance
memcpy( (void *)mib,
(void *)&bcch_message->message.choice.mib,
sizeof(NR_MIB_t) );
nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL, NULL, NULL);
return 0;
}
// from NR SRB3
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
const module_id_t module_id,
const uint8_t gNB_index,
const uint8_t *bufferP,
const uint32_t buffer_len){
// uper_decode by nr R15 rrc_connection_reconfiguration
NR_DL_DCCH_Message_t *nr_dl_dcch_msg = (NR_DL_DCCH_Message_t *)0;
asn_dec_rval_t dec_rval = uper_decode( NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void**)&nr_dl_dcch_msg,
(uint8_t *)bufferP,
buffer_len, 0, 0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E( RRC, "[UE %"PRIu8"] Failed to decode NR_DL_DCCH_Message (%zu bits)\n",
module_id,
dec_rval.consumed );
for (i=0; i<buffer_len; i++)
printf("%02x ",bufferP[i]);
printf("\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 );
return -1;
}
if(nr_dl_dcch_msg != NULL){
switch(nr_dl_dcch_msg->message.present){
case DL_DCCH_MessageType_PR_c1:
switch(nr_dl_dcch_msg->message.choice.c1.present){
case DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
nr_rrc_ue_process_rrcReconfiguration(&nr_dl_dcch_msg->message.choice.c1.choice.rrcReconfiguration);
break;
case DL_DCCH_MessageType__c1_PR_NOTHING:
case DL_DCCH_MessageType__c1_PR_spare15:
case DL_DCCH_MessageType__c1_PR_spare14:
case DL_DCCH_MessageType__c1_PR_spare13:
case DL_DCCH_MessageType__c1_PR_spare12:
case DL_DCCH_MessageType__c1_PR_spare11:
case DL_DCCH_MessageType__c1_PR_spare10:
case DL_DCCH_MessageType__c1_PR_spare9:
case DL_DCCH_MessageType__c1_PR_spare8:
case DL_DCCH_MessageType__c1_PR_spare7:
case DL_DCCH_MessageType__c1_PR_spare6:
case DL_DCCH_MessageType__c1_PR_spare5:
case DL_DCCH_MessageType__c1_PR_spare4:
case DL_DCCH_MessageType__c1_PR_spare3:
case DL_DCCH_MessageType__c1_PR_spare2:
case DL_DCCH_MessageType__c1_PR_spare1:
default:
// not support or unuse
break;
}
break;
case DL_DCCH_MessageType_PR_NOTHING:
case DL_DCCH_MessageType_PR_messageClassExtension:
default:
// not support or unuse
break;
}
// release memory allocation
SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 );
}else{
// log..
}
return 0;
}
......@@ -36,123 +36,23 @@
#include <string.h>
#include "rrc_list.h"
/*#include "NR_MeasConfig.h"
#include "NR_CellGroupConfig.h"
#include "NR_RadioBearerConfig.h"
#include "NR_RLC_Bearer_Config_t"
#include "asn1_constants.h"
#include "NR_SchedulingRequestToAddMod.h"*/
#include "collection/tree.h"
#include "rrc_types.h"
#include "PHY/defs.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/platform_constants.h"
#include "COMMON/platform_types.h"
#include "LAYER2/MAC/defs.h"
#include "SystemInformationBlockType1.h"
#include "SystemInformation.h"
#include "RRCConnectionReconfiguration.h"
#include "RRCConnectionReconfigurationComplete.h"
#include "RRCConnectionSetup.h"
#include "RRCConnectionSetupComplete.h"
#include "RRCConnectionRequest.h"
#include "RRCConnectionReestablishmentRequest.h"
#include "BCCH-DL-SCH-Message.h"
#include "BCCH-BCH-Message.h"
#if defined(Rel10) || defined(Rel14)
#include "MCCH-Message.h"
#include "MBSFNAreaConfiguration-r9.h"
#include "SCellToAddMod-r10.h"
#endif
#include "AS-Config.h"
#include "AS-Context.h"
#include "UE-EUTRA-Capability.h"
#include "MeasResults.h"
/* for ImsiMobileIdentity_t */
#include "MobileIdentity.h"
#define NB_NR_UE_INST 1
typedef struct NR_UE_RRC_INST_s {
nr_rrc_state_t rrc_state;
nr_rrc_sub_state_t rrc_sub_state;
#if 0
OAI_UECapability_t *UECap;
uint8_t *UECapability;
uint8_t UECapability_size;
UE_RRC_INFO Info[NB_SIG_CNX_UE];
SRB_INFO Srb0[NB_SIG_CNX_UE];
SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE];
SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
HANDOVER_INFO_UE HandoverInfoUe;
uint8_t *SIB1[NB_CNX_UE];
uint8_t sizeof_SIB1[NB_CNX_UE];
uint8_t *SI[NB_CNX_UE];
uint8_t sizeof_SI[NB_CNX_UE];
uint8_t SIB1Status[NB_CNX_UE];
uint8_t SIStatus[NB_CNX_UE];
SystemInformationBlockType1_t *sib1[NB_CNX_UE];
SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI().
SystemInformationBlockType2_t *sib2[NB_CNX_UE];
SystemInformationBlockType3_t *sib3[NB_CNX_UE];
SystemInformationBlockType4_t *sib4[NB_CNX_UE];
SystemInformationBlockType5_t *sib5[NB_CNX_UE];
SystemInformationBlockType6_t *sib6[NB_CNX_UE];
SystemInformationBlockType7_t *sib7[NB_CNX_UE];
SystemInformationBlockType8_t *sib8[NB_CNX_UE];
SystemInformationBlockType9_t *sib9[NB_CNX_UE];
SystemInformationBlockType10_t *sib10[NB_CNX_UE];
SystemInformationBlockType11_t *sib11[NB_CNX_UE];
#if defined(Rel10) || defined(Rel14)
uint8_t MBMS_flag;
uint8_t *MCCH_MESSAGE[NB_CNX_UE];
uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE];
uint8_t MCCH_MESSAGEStatus[NB_CNX_UE];
MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE];
SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE];
SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE];
#endif
#ifdef CBA
uint8_t num_active_cba_groups;
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
#endif
uint8_t num_srb;
struct SRB_ToAddMod *SRB1_config[NB_CNX_UE];
struct SRB_ToAddMod *SRB2_config[NB_CNX_UE];
struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB
MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
struct QuantityConfig *QuantityConfig[NB_CNX_UE];
struct MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID];
MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID];
uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells
RSRP_Range_t s_measure;
struct MeasConfig__speedStatePars *speedStatePars;
struct PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE];
struct SPS_Config *sps_Config[NB_CNX_UE];
MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE];
MeasGapConfig_t *measGapConfig[NB_CNX_UE];
double filter_coeff_rsrp; // [7] ???
double filter_coeff_rsrq; // [7] ???
float rsrp_db[7];
float rsrq_db[7];
float rsrp_db_filtered[7];
float rsrq_db_filtered[7];
#if defined(ENABLE_SECURITY)
/* KeNB as computed from parameters within USIM card */
uint8_t kenb[32];
uint8_t nh[32];
int8_t nh_ncc;
#endif
/* Used integrity/ciphering algorithms */
CipheringAlgorithm_r12_t ciphering_algorithm;
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
#endif
NR_MeasConfig_t *meas_config;
NR_CellGroupConfig_t *cell_group_config;
NR_RadioBearerConfig_t *radio_bearer_config;
NR_MIB_t *mib;
// lists
// CellGroupConfig.rlc-BearerToAddModList
RRC_LIST_TYPE(NR_RLC_Bearer_Config_t, NR_maxLC_ID) RLC_Bearer_Config_list;
......@@ -201,9 +101,6 @@ typedef struct NR_UE_RRC_INST_s {
// CellGroupConfig.spCellConfig.spCellConfigDedicated
RRC_LIST_TYPE(NR_CSI_ReportConfig_t, NR_maxNrofCSI_ReportConfigurations) CSI_ReportConfig_list;
} NR_UE_RRC_INST_t;
#include "proto.h"
......
#ifndef _RRC_LIST_H_
#define _RRC_LIST_H_
#define RRC_LIST_TYPE(T, N) \
......@@ -78,10 +79,4 @@
#define RRC_LIST_ENTRY(list, i) \
list.entries[i]
#endif
\ No newline at end of file
......@@ -30,8 +30,10 @@
/** \addtogroup _rrc
* @{
*/
#ifndef _RRC_PROTO_H_
#define _RRC_PROTO_H_
#include "defs.h"
#include "rrc_defs.h"
//
// main_rrc.c
......@@ -46,10 +48,7 @@ int nr_l3_init_ue(void);
/**\brief Initial the top level RRC structure instance*/
uint8_t openair_rrc_top_init_ue_nr(void);
/**\brief Decode DCCH from gNB, sent from lower layer through SRB3
\param buffer encoded DCCH bytes stream message
\param size length of buffer*/
int8_t nr_rrc_ue_decode_dcch(const uint8_t *buffer, const uint32_t size);
/**\brief Decode RRC Connection Reconfiguration, sent from E-UTRA RRC Connection Reconfiguration v1510 carring EN-DC config
\param buffer encoded NR-RRC-Connection-Reconfiguration/Secondary-Cell-Group-Config message.
......@@ -76,4 +75,27 @@ int8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config);
\param radio_bearer_config radio bearer configuration*/
int8_t nr_rrc_ue_process_radio_bearer_config(RadioBearerConfig_t *radio_bearer_config);
/**\brief decode NR BCCH-BCH (MIB) message
\param module_idP module id
\param gNB_index gNB index
\param sduP pointer to buffer of ASN message BCCH-BCH
\param sdu_len length of buffer*/
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len);
/**\brief Decode NR DCCH from gNB, sent from lower layer through SRB3
\param buffer encoded DCCH bytes stream message
\param size length of buffer*/
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const uint8_t *buffer, const uint32_t size);
/**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)
\param module_id module id
\param CC_id component carrier id
\param gNB_index gNB index
\param frameP pointer to frame for calculation
\param channel indicator for channel of the pdu
\param pduP pointer to pdu
\param pdu_len data length of pdu*/
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const uint32_t *frameP, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len);
/** @}*/
#endif
\ No newline at end of file
......@@ -38,4 +38,5 @@
#include "LAYER2/MAC/defs.h"
NR_UE_RRC_INST_t *NR_UE_rrc_inst;
#endif
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