nr_ue_procedures.c 2.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * 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
 */

22 23 24 25 26 27 28
/*! \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
29

30 31 32
 */
#include "proto.h"
#include "RRC/NR_UE/rrc_proto.h"
33

34
int8_t nr_ue_decode_mib(
35 36 37
	module_id_t module_id,
	int 		CC_id,
	uint8_t 	gNB_index,
38 39 40 41 42
	uint8_t 	extra_bits,	//	8bits 38.212 c7.1.1
	uint32_t    l_ssb_equal_64,
	uint32_t 	*ssb_index,	//	from decoded MIB
	uint32_t 	*frameP,	//	10 bits = 6(in decoded MIB)+4(in extra bits from L1)
	void 		*pduP,		//	encoded MIB
43
	uint16_t 	pdu_len){
44

45 46
	NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);

47 48 49
    nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index, frameP,
		     NR_BCCH_BCH, (uint8_t *) pduP, pdu_len );
    
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

    uint32_t frame = mac->mib->systemFrameNumber.buf[0];
    uint32_t frame_number_4lsb = (uint32_t)(extra_bits & 0xf);
    uint32_t ssb_subcarrier_offset_msb = (uint32_t)(( extra_bits >> 4 ) & 0x1 );

    frame = frame << 4;
    frame = frame | frame_number_4lsb;

    *frameP = frame;

    if(l_ssb_equal_64){
    	*ssb_index = (( extra_bits >> 4 ) & 0x7 );
    }



    return 0;
67
}