/******************************************************************************* ################################################################################ # Copyright (c) [2017-2019] [Radisys] # # # # Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # # # # 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. # ################################################################################ *******************************************************************************/ /* This file contains all utility functions */ #include "du_mgr.h" #include "du_sys_info_hdl.h" #include "MIB.h" #include "PLMN-IdentityInfo.h" #include "odu_common_codec.h" extern DuCfgParams duCfgParam; extern char encBuf[ENC_BUF_MAX_LEN]; /* Filling Slot configuration as : * Slot Sym 0 Sym 1 Sym 2 Sym 3 Sym 4 Sym 5 Sym 6 Sym 7 Sym 8 Sym 9 Sym10 Sym11 Sym12 Sym13 * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL * 3 DL DL DL DL DL DL DL DL DL DL GD GD GD UL * 4 UL UL UL UL UL UL UL UL UL UL UL UL UL UL */ /******************************************************************* * * @brief Fills the Slot configuration * * @details * * Function : FillSlotConfig * * Functionality:Fill the Slot configuration values * * @params[in] void * @return ROK - success * RFAILED - failure * * ****************************************************************/ void FillSlotConfig() { U8 slot; U8 symbol; for(slot = 0; slot <= 3; slot++) { for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT; } duCfgParam.macCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT; duCfgParam.macCellCfg.tddCfg.slotCfg[3][11] = GUARD_SLOT; duCfgParam.macCellCfg.tddCfg.slotCfg[3][12] = GUARD_SLOT; duCfgParam.macCellCfg.tddCfg.slotCfg[3][13] = UL_SLOT; for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) duCfgParam.macCellCfg.tddCfg.slotCfg[4][symbol] = UL_SLOT; } /******************************************************************* * * @brief Reads the CL Configuration. * * @details * * Function : readMacCfg * * Functionality: * - Fills up the cell configuration for CL. * - Calls FillSlotConfig() * * @params[in] void * @return ROK - success * RFAILED - failure * * ****************************************************************/ /* This function is used to fill up the cell configuration for CL */ S16 readMacCfg() { duCfgParam.macCellCfg.carrierId = CARRIER_IDX; /* Cell configuration */ duCfgParam.macCellCfg.cellId = NR_CELL_ID; duCfgParam.macCellCfg.phyCellId = NR_PCI; duCfgParam.macCellCfg.dupType = DUPLEX_MODE; /* DL carrier configuration */ duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE; duCfgParam.macCellCfg.dlCarrCfg.bw = BANDWIDTH; duCfgParam.macCellCfg.dlCarrCfg.freq = NR_ARFCN; duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1; duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1; duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1; duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1; duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1; duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 1; duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1; duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1; duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1; duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1; duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT; /* UL Carrier configuration */ duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE; duCfgParam.macCellCfg.ulCarrCfg.bw = SUL_ARFCN; duCfgParam.macCellCfg.ulCarrCfg.freq = NR_ARFCN; duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1; duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1; duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1; duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1; duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1; duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1; duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1; duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1; duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1; duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1; duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT; duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ; /* SSB configuration */ duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD; duCfgParam.macCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING; duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A; duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS; duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY; duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET; duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */ duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0; if(BuildMibPdu() != ROK) { DU_LOG("\nFailed to build MIB PDU"); memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t)); } else { for(uint8_t idx=0; idxbuf == NULL || bitString->size <= 0) { DU_LOG("\nDU_APP : Bit string is empty"); return RFAILED; } for(idx=0; idx< bitString->size-1; idx++) { *val |= bitString->buf[idx]; *val <<= 8; } *val |= bitString->buf[idx]; *val >>= bitString->bits_unused; return ROK; } /********************************************************************** End of file **********************************************************************/