From: Balaji Shankaran Date: Tue, 14 Apr 2020 06:53:35 +0000 (+0000) Subject: Merge "SIB1 optional parameters, Cell start request, stop request and slot indication" X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=80a4fa9d0aede180472530cab6efa6acc925424b;hp=aa016a0a037017083dd793b564b47ed7855069ec;p=o-du%2Fl2.git Merge "SIB1 optional parameters, Cell start request, stop request and slot indication" --- diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c new file mode 100644 index 000000000..9a9e3f1a4 --- /dev/null +++ b/src/5gnrmac/mac_msg_hdl.c @@ -0,0 +1,121 @@ +/******************************************************************************* +################################################################################ +# 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. # +################################################################################ +*******************************************************************************/ + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system services */ +#include "cm5.h" /* common timers defines */ +#include "cm_hash.h" /* common hash list defines */ +#include "cm_llist.h" /* common linked list defines */ +#include "cm_mblk.h" /* memory management */ +#include "cm_tkns.h" /* common tokens */ +#include "cm_lte.h" /* common tokens */ +#include "rgu.h" +#include "tfu.h" +#include "rg_sch_inf.h" +#include "rg_env.h" +#include "lrg.h" +#include "crg.h" +#include "rg.h" +#include "du_log.h" + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "rgu.x" +#include "tfu.x" +#include "rg_sch_inf.x" +#include "lrg.x" +#include "crg.x" +#include "rg_prg.x" +#include "du_app_mac_inf.h" +#include "rg.x" +#include "fapi_interface.h" + +/* This file contains message handling functionality for MAC */ + +/******************************************************************* + * + * @brief Handles cell start reuqest from DU APP + * + * @details + * + * Function : MacHdlCellStartReq + * + * Functionality: + * Handles cell start reuqest from DU APP + * + * @params[in] Post structure pointer + * Cell Start Request info pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) +{ + DU_LOG("\nMAC : Handling cell start request"); + //sendToLowerMac(START_REQ, 0, cellStartInfo); + + MAC_FREE_MEM(pst->region, pst->pool, cellStartInfo, \ + sizeof(MacCellStartInfo)); + + return ROK; +} + +/******************************************************************* + * + * @brief Handles cell stop request from DU APP + * + * @details + * + * Function : MacHdlCellStartReq + * + * Functionality: + * Handles cell stop request from DU APP + * + * @params[in] Post structure pointer + * Mac Cell stop information + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) +{ + DU_LOG("\nMAC : Handling cell start request"); + //sendToLowerMac(STOP_REQ, 0, cellStopInfo); + + MAC_FREE_MEM(pst->region, pst->pool, cellStopInfo, \ + sizeof(MacCellStopInfo)); + + return ROK; +} + +/********************************************************************** + End of file +**********************************************************************/ + diff --git a/src/5gnrmac/mac_upr_inf_api.c b/src/5gnrmac/mac_upr_inf_api.c new file mode 100644 index 000000000..fb212da64 --- /dev/null +++ b/src/5gnrmac/mac_upr_inf_api.c @@ -0,0 +1,58 @@ +/******************************************************************************* +################################################################################ +# 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 the definitions for Upper Interface APIs that are + * invoked from MAC */ + +#include "mac_upr_inf_api.h" + +/* Funtion pointer options for slot indication */ +DuMacSlotInd packMacSlotIndOpts[] = +{ + packMacSlotInd, + duHandleSlotInd, + packMacSlotInd +}; + +/******************************************************************* + * + * @brief Send slot indication to MAC + * + * @details + * + * Function : MacDuAppSlotInd + * + * Functionality: + * Select appropriate function using selector value and + * send to MAC + * + * @params[in] Post structure pointer + * Slot info pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t MacDuAppSlotInd(Pst *pst, SlotInfo *slotInfo) +{ + return (*packMacSlotIndOpts[pst->selector])(pst, slotInfo); +} + +/********************************************************************** + End of file +**********************************************************************/ + diff --git a/src/5gnrmac/mac_upr_inf_api.h b/src/5gnrmac/mac_upr_inf_api.h new file mode 100644 index 000000000..37300457f --- /dev/null +++ b/src/5gnrmac/mac_upr_inf_api.h @@ -0,0 +1,53 @@ +/******************************************************************************* +################################################################################ +# 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 the definitions for Upper Interface APIs that are + * invoked from MAC */ + +/* header include files -- defines (.h) */ +#include "envopt.h" /* environment options */ +#include "envdep.h" /* environment dependent */ +#include "envind.h" /* environment independent */ +#include "gen.h" /* general layer */ +#include "ssi.h" /* system services */ +#include "cm5.h" /* common timers defines */ +#include "cm_hash.h" /* common hash list defines */ +#include "cm_llist.h" /* common linked list defines */ +#include "cm_mblk.h" /* memory management */ +#include "cm_tkns.h" /* common tokens */ +#include "cm_lte.h" /* common tokens */ + +/* header/extern include files (.x) */ +#include "gen.x" /* general layer typedefs */ +#include "ssi.x" /* system services typedefs */ +#include "cm5.x" /* common timers */ +#include "cm_hash.x" /* common hash list */ +#include "cm_lib.x" /* common library */ +#include "cm_llist.x" /* common linked list */ +#include "cm_mblk.x" /* memory management */ +#include "cm_tkns.x" /* common tokens */ +#include "cm_lte.x" /* common tokens */ +#include "du_app_mac_inf.h" + + +uint16_t MacDuAppSlotInd(Pst *pst, SlotInfo *slotInfo); + +/********************************************************************** + End of file +**********************************************************************/ + diff --git a/src/5gnrmac/rg.h b/src/5gnrmac/rg.h index 571bd05f6..545aaf2f3 100755 --- a/src/5gnrmac/rg.h +++ b/src/5gnrmac/rg.h @@ -264,6 +264,12 @@ U32 macHeader[2]; SPutSBuf(MAC_MEM_REGION, MAC_POOL, \ (Data *)_datPtr, _size); +/* Free shared memory, received through LWLC */ +#define MAC_FREE_MEM(_region, _pool, _datPtr, _size) \ + if(_datPtr) \ + SPutSBuf(_region, _pool,(Data *)_datPtr, _size); \ + _datPtr = NULL; + #define RG_LCG_ISCFGD(lcg) ((lcg)->lcgId != RG_INVALID_LCG_ID) /* Corrected the check for dlCcchId */ #define RG_DLCCCH_ISCFGD(cell) ((cell)->dlCcchId != RG_INVALID_LC_ID) diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index 915d8bbad..0e6caf230 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -133,6 +133,14 @@ Buffer *mBuf; /* message buffer */ /* Process MAC cell config */ unpackDuMacCellCfg(MacHdlCellCfgReq, pst, mBuf); break; + case EVENT_MAC_CELL_START_REQ: + /* Process MAC cell start request */ + unpackMacCellStartReq(MacHdlCellStartReq, pst, mBuf); + break; + case EVENT_MAC_CELL_STOP_REQ: + /* Process MAC cell stop request */ + unpackMacCellStopReq(MacHdlCellStopReq, pst, mBuf); + break; default: RG_FREE_MSG(mBuf); break; diff --git a/src/5gnrmac/rg_lim.c b/src/5gnrmac/rg_lim.c index 00011bee8..38620fe6a 100755 --- a/src/5gnrmac/rg_lim.c +++ b/src/5gnrmac/rg_lim.c @@ -76,10 +76,8 @@ static int RLOG_MODULE_ID=4096; #include "rg.x" /* typedefs for MAC */ #include "mac_sch_interface.h" -/* local defines */ +#include "mac_upr_inf_api.h" -/* local typedefs */ - /* local externs */ #ifdef UNUSED_FUNC PRIVATE S16 rgLIMValidateSap ARGS((Inst inst,SuId suId)); @@ -636,6 +634,55 @@ int sendSlotIndMacToSch(SlotIndInfo *slotInd) return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd); } + +/******************************************************************* + * + * @brief Send slot indication to DU APP + * + * @details + * + * Function : sendSlotIndMacToDuApp + * + * Functionality: + * Send slot indication to DU APP + * + * @params[in] Slot indication info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) +{ + Pst pst; + SlotInfo *slotInfo; + + /* Send Slot Indication to DU APP */ + MAC_ALLOC(slotInfo, sizeof(SlotInfo)); + if(!slotInfo) + { + DU_LOG("\nMAC : Slot Indication memory allocation failed"); + return RFAILED; + } + + /* Fill Pst */ + pst.selector = DU_MAC_LWLC; + pst.srcEnt = ENTRG; + pst.dstEnt = ENTDUAPP; + pst.dstInst = 0; + pst.srcInst = 0; + pst.dstProcId = rgCb[pst.srcInst].rgInit.procId; + pst.srcProcId = rgCb[pst.srcInst].rgInit.procId; + pst.region = MAC_MEM_REGION; + pst.pool = MAC_POOL; + pst.event = EVENT_MAC_SLOT_IND; + pst.route = 0; + pst.prior = 0; + pst.intfVer = 0; + + return MacDuAppSlotInd(&pst, slotInfo); + +} + /** * @brief Transmission time interval indication from PHY. * @@ -662,6 +709,8 @@ SlotIndInfo *slotInd VOLATILE U32 startTime=0; Inst inst; + DU_LOG("\nMAC : Slot Indication received"); + RG_IS_INST_VALID(pst->dstInst); inst = pst->dstInst - RG_INST_START; /*starting Task*/ @@ -671,7 +720,7 @@ SlotIndInfo *slotInd ret = sendSlotIndMacToSch(slotInd); if(ret != ROK) { - DU_LOG("\nsending of slot ind msg from MAC to SCH failed"); + DU_LOG("\nMAC : Sending of slot ind msg from MAC to SCH failed"); RETVALUE(ret); } @@ -679,10 +728,17 @@ SlotIndInfo *slotInd ret = macProcessSlotInd(inst,*slotInd); if(ret != ROK) { - DU_LOG("\nmacProcessSlotInd failed"); + DU_LOG("\nMAC : macProcessSlotInd failed"); RETVALUE(ret); } + /* send slot indication to du app */ + ret = sendSlotIndMacToDuApp(slotInd); + if(ret != ROK) + { + DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed"); + RETVALUE(ret); + } /*stoping Task*/ SStopTask(startTime, PID_MAC_TTI_IND); diff --git a/src/5gnrrlc/mac_stub.c b/src/5gnrrlc/mac_stub.c index bd0e1dfa8..df05b9901 100644 --- a/src/5gnrrlc/mac_stub.c +++ b/src/5gnrrlc/mac_stub.c @@ -28,7 +28,7 @@ PUBLIC S16 macStubBOStatus(Pst *pst, SpId spId, RlcMacBOStatus *boSta) Pst rspPst; RlcMacSchedRep *schRep; - DU_LOG("\nMAC_STUB : Received BO status from RLC"); + DU_LOG("\nMAC : Received BO status from RLC"); // SGetSBuf(pst->region, pst->pool, (Data **)&rspPst, sizeof(Pst)); @@ -51,7 +51,7 @@ PUBLIC S16 macStubBOStatus(Pst *pst, SpId spId, RlcMacBOStatus *boSta) schRep->lchSta[0].lchStaInd.lcId = boSta->lcId; schRep->lchSta[0].lchStaInd.totBufSize = boSta->bo + 5; /* Extra buffer space including RLC and MAC Header size */ - DU_LOG("\nMAC_STUB : Sending scheduling report to RLC"); + DU_LOG("\nMAC : Sending scheduling report to RLC"); RlcMacProcSchedRep(&rspPst, 1, schRep); diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index ee8bb9526..1a00339ac 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -53,7 +53,7 @@ * RFAILED - failure * ***************************************************************************/ -U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +uint16_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) { if(pst->selector == DU_SELECTOR_LC) { @@ -135,7 +135,7 @@ void unpackDuMacCellCfg( * RFAILED - failure * ***************************************************************************/ -U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) +uint16_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) { if(pst->selector == DU_SELECTOR_LC) { @@ -176,7 +176,7 @@ U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) * RFAILED - failure * ***************************************************************************/ -U16 unpackMacCellCfgCfm( +uint16_t unpackMacCellCfgCfm( DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf) @@ -195,6 +195,244 @@ U16 unpackMacCellCfgCfm( { /* only loose coupling is suported */ } +} + +/******************************************************************* + * + * @brief Packs and Send Cell Start Request to MAC + * + * @details + * + * Function : packMacCellStartReq + * + * Functionality: + * Packs and Sends Cell Start Request to MAC + * + * @params[in] Post structure pointer + * MacCellStartInfo pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) +{ + if(pst->selector == DU_SELECTOR_LC) + { + /* Loose coupling not supported */ + return RFAILED; + } + else if(pst->selector == DU_SELECTOR_LWLC) + { + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); + RETVALUE(RFAILED); + } + + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)cellStartInfo, mBuf); + + return SPstTsk(pst,mBuf); + } + return ROK; +} + +/******************************************************************* + * + * @brief Unpacks MAC Cell Start Request from DU APP + * + * @details + * + * Function : unpackMaCellStartReq + * + * Functionality: + * Unpacks MAC Cell Start Request from DU APP + * + * @params[in] Function pointer of cell start request handler + * Post structure pointer + * Cell Start Request Info Pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf) +{ + MacCellStartInfo *cellStartInfo; + + if(pst->selector == DU_SELECTOR_LWLC) + { + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStartInfo, mBuf); + SPutMsg(mBuf); + return (*func)(pst, cellStartInfo); + } + else + { + /* Nothing to do for loose coupling */ + SPutMsg(mBuf); + return ROK; + } +} + +/******************************************************************* + * + * @brief Packs and Send cell stop request to MAC + * + * @details + * + * Function : packMacCellStopReq + * + * Functionality: + * Packs and Send cell stop request to MAC + * + * @params[in] Post structure pointer + * Cell stop info structure + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) +{ + if(pst->selector == DU_SELECTOR_LC) + { + /* Loose coupling not supported */ + return RFAILED; + } + else if(pst->selector == DU_SELECTOR_LWLC) + { + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack"); + RETVALUE(RFAILED); + } + + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)cellStopInfo, mBuf); + + return SPstTsk(pst,mBuf); + } + return ROK; +} + +/******************************************************************* + * + * @brief Unpacks cell stop request from DU APP + * + * @details + * + * Function : unpackMaCellStopReq + * + * Functionality: + * Unpacks cell stop request from DU APP + * + * @params[in] Handler function pointer + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) +{ + MacCellStopInfo *cellStopInfo; + + if(pst->selector == DU_SELECTOR_LWLC) + { + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStopInfo, mBuf); + SPutMsg(mBuf); + return (*func)(pst, cellStopInfo); + } + else + { + /* Nothing to do for loose coupling */ + SPutMsg(mBuf); + return ROK; + } +} + +/******************************************************************* + * + * @brief Packs and Sends slot ind from MAC to DUAPP + * + * @details + * + * Function : packMacSlotInd + * + * Functionality: + * Packs and Sends slot ind from MAC to DUAPP + * + * @params[in] Post structure pointer + * Slot Info pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ) +{ + if(pst->selector == DU_SELECTOR_LC || pst->selector == DU_SELECTOR_TC) + { + /* Loose coupling not supported */ + DU_LOG("\nDU APP : Only LWLC supported"); + return RFAILED; + } + else if(pst->selector == DU_SELECTOR_LWLC) + { + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); + RETVALUE(RFAILED); + } + + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)slotInfo, mBuf); + + return SPstTsk(pst,mBuf); + } + return ROK; +} + +/******************************************************************* + * + * @brief Unpacks slot indication from MAC + * + * @details + * + * Function : unpackMacSlotInd + * + * Functionality: + * Unpacks slot indication from MAC + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) +{ + SlotInfo *slotInfo; + + if(pst->selector == DU_SELECTOR_LWLC) + { + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&slotInfo, mBuf); + SPutMsg(mBuf); + return (*func)(pst, slotInfo); + } + else + { + /* Nothing to do for loose coupling */ + SPutMsg(mBuf); + return ROK; + } return ROK; } diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 08169a127..2f2a4e670 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -32,10 +32,17 @@ #define SEARCHSPACE_0_INDEX 0 #define SIB1_MCS 4 +/* Macros for coupling */ +#define DU_MAC_LC 0 +#define DU_MAC_TC 1 +#define DU_MAC_LWLC 2 /* Event IDs */ #define EVENT_MAC_CELL_CONFIG_REQ 200 #define EVENT_MAC_CELL_CONFIG_CFM 201 +#define EVENT_MAC_CELL_START_REQ 202 +#define EVENT_MAC_CELL_STOP_REQ 203 +#define EVENT_MAC_SLOT_IND 204 typedef enum { @@ -195,48 +202,70 @@ typedef struct macCellCfgCfm U16 transId; }MacCellCfgCfm; -/* function pointers for packing macCellCfg Request */ -typedef U16 (*packMacCellCfgReq) ARGS(( +typedef struct slotInfo +{ + uint16_t sfn; + uint16_t slot; +}SlotInfo; + +typedef struct macCellStartInfo +{ + uint16_t cellId; +}MacCellStartInfo; + +typedef struct macCellStopInfo +{ + uint16_t cellId; +}MacCellStopInfo; + +/* Functions for slot Ind from MAC to DU APP*/ +typedef uint16_t (*DuMacSlotInd) ARGS(( + Pst *pst, + SlotInfo *slotInfo )); + +extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ); +extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf); +extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo); + +/* Functions for mac cell start req */ +typedef uint16_t (*DuMacCellStartReq) ARGS(( + Pst *pst, + MacCellStartInfo *cellStartInfo )); + +extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo); +extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf); +extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo); + +/* Functions for mac cell stop request */ +typedef uint16_t (*DuMacCellStopReq) ARGS(( + Pst *pst, + MacCellStopInfo *cellStopInfo )); + +extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo); +extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf); +extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo); + +/* Function pointers for packing macCellCfg Request and Confirm */ +typedef uint16_t (*packMacCellCfgReq) ARGS(( Pst *pst, - MacCellCfg *macCellCfg -)); + MacCellCfg *macCellCfg )); -typedef S16 (*packMacCellCfgConfirm) ARGS(( +typedef uint16_t (*packMacCellCfgConfirm) ARGS(( Pst *pst, - MacCellCfgCfm *macCellCfgCfm -)); - -typedef S16 (*DuMacCellCfgReq) ARGS(( - Pst *pst, /* Post Structure */ - MacCellCfg *macCellCfg /* Config Structure */ - )); - -typedef S16 (*DuMacCellCfgCfm) ARGS(( - MacCellCfgCfm *macCellCfgCfm /* Config Structure */ - )); - -U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); - -EXTERN int MacHdlCellCfgReq -( - Pst *pst, - MacCellCfg *macCellCfg -); - -void cmUnpackLwLcMacCellCfg( - DuMacCellCfgReq func, - Pst *pst, - Buffer *mBuf); - -U16 unpackMacCellCfgCfm( - DuMacCellCfgCfm func, - Pst *pst, - Buffer *mBuf); - -EXTERN S16 duHandleMacCellCfgCfm -( - MacCellCfgCfm *macCellCfgCfm -); + MacCellCfgCfm *macCellCfgCfm )); + +typedef uint16_t (*DuMacCellCfgReq) ARGS(( + Pst *pst, + MacCellCfg *macCellCfg)); + +typedef uint16_t (*DuMacCellCfgCfm) ARGS(( + MacCellCfgCfm *macCellCfgCfm )); + +extern uint16_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); +extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg); +extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf); +extern uint16_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf); +extern uint16_t duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm); #endif diff --git a/src/cm/legtp.c b/src/cm/legtp.c index a1ba6b1fb..6d763d155 100644 --- a/src/cm/legtp.c +++ b/src/cm/legtp.c @@ -27,7 +27,7 @@ * * @details * - * Function : cmPkEgtpCfmStatus + * Function : packEgtpCfmStatus * * Functionality: * Packs EGTP confirm status @@ -38,7 +38,7 @@ * RFAILED - failure * ******************************************************************/ -S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) +S16 packEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) { SPkU16(cfm.status, mBuf); SPkU16(cfm.reason, mBuf); @@ -52,7 +52,7 @@ S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) * * @details * - * Function : cmUnpkEgtpCfmStatus + * Function : unpackEgtpCfmStatus * * Functionality: * Packs EGTP confirm status @@ -64,7 +64,7 @@ S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) * ******************************************************************/ -S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) +S16 unpackEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) { SUnpkU16(&(cfm->reason), mBuf); SUnpkU16(&(cfm->status), mBuf); @@ -78,7 +78,7 @@ S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) * * @details * - * Function : cmPkEgtpCfgReq + * Function : packEgtpCfgReq * * Functionality: * Packs EGTP configuration @@ -89,7 +89,7 @@ S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) * RFAILED - failure * ******************************************************************/ -S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) +S16 packEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) { Buffer *mBuf; @@ -126,7 +126,7 @@ S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) * * @details * - * Function : cmUnpkEgtpCfgReq + * Function : unpackEgtpCfgReq * * Functionality: * Unpacks EGTP configuration @@ -138,7 +138,7 @@ S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) * RFAILED - failure * * ****************************************************************/ -S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) +S16 unpackEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) { EgtpConfig egtpCfg; @@ -173,7 +173,7 @@ S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : cmPkEgtpCfgCfm + * Function : packEgtpCfgCfm * * Functionality: * Packs EGTP configuration result @@ -185,7 +185,7 @@ S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) * ******************************************************************/ -S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) +S16 packEgtpCfgCfm(Pst *pst, CmStatus cfm) { Buffer *mBuf; @@ -195,7 +195,7 @@ S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) RETVALUE(RFAILED); } - cmPkEgtpCfmStatus(cfm, mBuf); + packEgtpCfmStatus(cfm, mBuf); SPstTsk(pst, mBuf); RETVALUE(ROK); } @@ -206,7 +206,7 @@ S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) * * @details * - * Function : cmUnpkEgtpCfgCfm + * Function : unpackEgtpCfgCfm * * Functionality: * Unpacks EGTP configuration result @@ -218,12 +218,12 @@ S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) * ******************************************************************/ -S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) +S16 unpackEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) { CmStatus cfm; cmMemset((U8 *)&cfm, 0, sizeof(CmStatus)); - cmUnpkEgtpCfmStatus(&cfm, mBuf); + unpackEgtpCfmStatus(&cfm, mBuf); RETVALUE((*func)(cfm)); } @@ -234,7 +234,7 @@ S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) * * @details * - * Function : cmPkEgtpSrvOpenReq + * Function : packEgtpSrvOpenReq * * Functionality: * Packs EGTP server open request @@ -244,7 +244,7 @@ S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpSrvOpenReq(Pst *pst) +S16 packEgtpSrvOpenReq(Pst *pst) { Buffer *mBuf; @@ -264,7 +264,7 @@ S16 cmPkEgtpSrvOpenReq(Pst *pst) * * @details * - * Function : cmUnpkEgtpSrvOpenReq + * Function : unpackEgtpSrvOpenReq * * Functionality: * Unpacks EGTP server open req @@ -275,7 +275,7 @@ S16 cmPkEgtpSrvOpenReq(Pst *pst) * RFAILED - failure * ******************************************************************/ -S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) +S16 unpackEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) { RETVALUE((*func)(pst)); } @@ -287,7 +287,7 @@ S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : cmPkEgtpSrvOpenCfm + * Function : packEgtpSrvOpenCfm * * Functionality: * Packs EGTP server open confirm @@ -297,7 +297,7 @@ S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) +S16 packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) { Buffer *mBuf; @@ -307,7 +307,7 @@ S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) RETVALUE(RFAILED); } - cmPkEgtpCfmStatus(cfm, mBuf); + packEgtpCfmStatus(cfm, mBuf); SPstTsk(pst, mBuf); RETVALUE(ROK); @@ -319,7 +319,7 @@ S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) * * @details * - * Function : cmUnpkEgtpSrvOpenCfm + * Function : unpackEgtpSrvOpenCfm * * Functionality: * Unpacks EGTP server open confirm @@ -330,12 +330,12 @@ S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) * RFAILED - failure * *******************************************************************/ -S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) +S16 unpackEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) { CmStatus cfm; cmMemset((U8 *)&cfm, 0, sizeof(CmStatus)); - cmUnpkEgtpCfmStatus(&cfm, mBuf); + unpackEgtpCfmStatus(&cfm, mBuf); RETVALUE((*func)(cfm)); } @@ -346,7 +346,7 @@ S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) * * @details * - * Function : cmPkEgtpTnlMgmtReq + * Function : packEgtpTnlMgmtReq * * Functionality: * Packs EGTP tunnel management request @@ -359,7 +359,7 @@ S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) +S16 packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { Buffer *mBuf; @@ -384,7 +384,7 @@ S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) * * @details * - * Function : cmUnpkEgtpTnlMgmtReq + * Function : unpackEgtpTnlMgmtReq * * Functionality: * Unpacks EGTP tunnel management request @@ -396,7 +396,7 @@ S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) * RFAILED - failure * * *******************************************************************/ -S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) +S16 unpackEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) { EgtpTnlEvt tnlEvt; @@ -416,7 +416,7 @@ S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : cmPkEgtpTnlMgmtCfm + * Function : packEgtpTnlMgmtCfm * * Functionality: * Packs EGTP tunnel management cfm @@ -429,7 +429,7 @@ S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) * ********************************************************************/ -S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) +S16 packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) { Buffer *mBuf; @@ -443,7 +443,7 @@ S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) SPkU32(tnlEvt.lclTeid, mBuf); SPkU32(tnlEvt.remTeid, mBuf); - cmPkEgtpCfmStatus(tnlEvt.cfmStatus, mBuf); + packEgtpCfmStatus(tnlEvt.cfmStatus, mBuf); SPstTsk(pst, mBuf); RETVALUE(ROK); @@ -456,7 +456,7 @@ S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) * * @details * - * Function : cmUnpkEgtpTnlMgmtCfm + * Function : unpackEgtpTnlMgmtCfm * * Functionality: * Unpacks EGTP tunnel management confirm @@ -468,13 +468,13 @@ S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) * RFAILED - failure * * *******************************************************************/ -S16 cmUnpkEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) +S16 unpackEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) { EgtpTnlEvt tnlEvt; cmMemset((U8 *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); - cmUnpkEgtpCfmStatus(&(tnlEvt.cfmStatus), mBuf); + unpackEgtpCfmStatus(&(tnlEvt.cfmStatus), mBuf); SUnpkU32(&(tnlEvt.remTeid), mBuf); SUnpkU32(&(tnlEvt.lclTeid), mBuf); SUnpkU8(&(tnlEvt.action), mBuf); @@ -485,21 +485,21 @@ S16 cmUnpkEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) /******************************************************************* * - * @brief Packs TTI indication and sends to EGTP + * @brief Packs Slot indication and sends to EGTP * * @details * - * Function : cmPkEgtpTTIInd + * Function : packEgtpSlotInd * * Functionality: - * Packs TTI indication and sends tp EGTP + * Packs slot indication and sends tp EGTP * * @params[in] Post structure * @return ROK - success * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpTTIInd(Pst *pst) +S16 packEgtpSlotInd(Pst *pst) { Buffer *mBuf; @@ -516,21 +516,21 @@ S16 cmPkEgtpTTIInd(Pst *pst) /******************************************************************* * - * @brief Unpacks TTI indication + * @brief Unpacks slot indication * * @details * - * Function : cmUnpkEgtpTTIInd + * Function : unpackEgtpSlotInd * * Functionality: - * Unpacks TTI indication + * Unpacks slot indication * * @params[in] * @return ROK - success * RFAILED - failure * ******************************************************************/ -S16 cmUnpkEgtpTTIInd(EgtpTTIInd func, Pst *pst, Buffer *mBuf) +S16 unpackEgtpSlotInd(EgtpSlotInd func, Pst *pst, Buffer *mBuf) { RETVALUE((*func)()); } diff --git a/src/cm/legtp.h b/src/cm/legtp.h index f77b401d5..dfbf4eedd 100644 --- a/src/cm/legtp.h +++ b/src/cm/legtp.h @@ -94,21 +94,21 @@ typedef S16 (*EgtpSrvOpenReq) ARGS(()); typedef S16 (*EgtpSrvOpenCfm) ARGS((CmStatus cfm)); typedef S16 (*EgtpTnlMgmtReq) ARGS((Pst *pst, EgtpTnlEvt tnlEvt)); typedef S16 (*EgtpTnlMgmtCfm) ARGS((EgtpTnlEvt tnlEvt)); -typedef S16 (*EgtpTTIInd) ARGS(()); +typedef S16 (*EgtpSlotInd) ARGS(()); -S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg); -S16 cmUnpkEgtpCfgReq(EgtpCfgReq func , Pst *pst, Buffer *mBuf); -S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm); -S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf); -S16 cmPkEgtpSrvOpenReq(Pst *pst); -S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf); -S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm); -S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf); -S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt); -S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf); -S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt); -S16 cmUnpkEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf); -S16 cmPkEgtpTTIInd(Pst *pst); -S16 cmUnpkEgtpTTIInd(EgtpTTIInd func, Pst *pst, Buffer *mBuf); +S16 packEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg); +S16 unpackEgtpCfgReq(EgtpCfgReq func , Pst *pst, Buffer *mBuf); +S16 packEgtpCfgCfm(Pst *pst, CmStatus cfm); +S16 unpackEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf); +S16 packEgtpSrvOpenReq(Pst *pst); +S16 unpackkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf); +S16 packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm); +S16 unpackEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf); +S16 packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt); +S16 unpackEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf); +S16 packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt); +S16 unpackEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf); +S16 packEgtpSlotInd(Pst *pst); +S16 unpackEgtpSlotInd(EgtpSlotInd func, Pst *pst, Buffer *mBuf); #endif diff --git a/src/cm/lphy_stub.h b/src/cm/lphy_stub.h index 25f69f8dd..67a3a2f28 100644 --- a/src/cm/lphy_stub.h +++ b/src/cm/lphy_stub.h @@ -10,4 +10,4 @@ #include "ssi.x" /* System services */ void duStartTtiThread(); -S16 duSendEgtpTTIInd(); +S16 duSendEgtpSlotInd(); diff --git a/src/cm/rgu.c b/src/cm/rgu.c index 25cd9ffb1..f7645455f 100755 --- a/src/cm/rgu.c +++ b/src/cm/rgu.c @@ -2702,7 +2702,7 @@ Buffer *mBuf; for (i=param->nmbPdu-1; i >= 0; i--) { - MsgLen msgLen = 0; + msgLen = 0; if (SFndLenMsg(param->pduInfo[i].pduBuf, &msgLen) != ROK) RETVALUE(RFAILED); if (SCatMsg(mBuf, param->pduInfo[i].pduBuf, M1M2) != ROK) @@ -2762,7 +2762,7 @@ Buffer *mBuf; CMCHKUNPK(cmUnpkBool, ¶m->pduInfo[i].commCh, mBuf); CMCHKUNPK(cmUnpkLteLcId, ¶m->pduInfo[i].lcId, mBuf); - CMCHKUNPK(cmPkMsgLen, ¶m->pduInfo[i].pduLen, mBuf); + CMCHKUNPK(cmUnpkMsgLen, ¶m->pduInfo[i].pduLen, mBuf); if (SFndLenMsg(mBuf, &totalMsgLen) != ROK) RETVALUE(RFAILED); if (SSegMsg(mBuf, totalMsgLen-param->pduInfo[i].pduLen, ¶m->pduInfo[i].pduBuf) != ROK) @@ -3155,7 +3155,6 @@ RlcMacSchedRep *param; Buffer *mBuf; #endif { - S32 i; S32 idx; TRC3(packSchedRepInfo); @@ -3203,7 +3202,6 @@ RlcMacSchedRep *param; Buffer *mBuf; #endif { - S32 i; S32 idx; TRC3(unpackSchedRepInfo); diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index 1af02edaa..522801e46 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -16,7 +16,7 @@ ################################################################################ *******************************************************************************/ -/* This file contains message handling functionality for DU APP */ +/* This file contains message handling functionality for DU cell management */ #include "du_cell_mgr.h" extern DuCfgParams duCfgParam; @@ -76,7 +76,7 @@ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) cellCb->cellInfo.nrPci = pci; /* Now remove this cell from configured list and move to active list */ - duCb.cfgCellLst[nci-1] = NULLP; + duCb.cfgCellLst[nci-1] = NULL; duCb.actvCellLst[nci-1] = cellCb; /* Build and send Mac Cell Cfg for the number of active cells */ diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index f67ef9e96..f435a1c6d 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -20,8 +20,26 @@ #include "du_mgr.h" #include "du_sys_info_hdl.h" #include "MIB.h" +#include "SearchSpace.h" +#include "SIB-TypeInfo.h" +#include "SchedulingInfo.h" +#include "SI-SchedulingInfo.h" +#include "ConnEstFailureControl.h" #include "PLMN-IdentityInfo.h" #include "odu_common_codec.h" +#include "PDSCH-TimeDomainResourceAllocation.h" +#include "BCCH-Config.h" +#include "PagingCycle.h" +#include "PCCH-Config.h" +#include "TimeAlignmentTimer.h" +#include "RACH-ConfigGeneric.h" +#include "PUSCH-TimeDomainResourceAllocation.h" +#include "PUCCH-ConfigCommon.h" +#include "SubcarrierSpacing.h" +#include "TDD-UL-DL-Pattern.h" +#include "RACH-ConfigCommon.h" +#include "BWP-DownlinkCommon.h" +#include "BWP-UplinkCommon.h" extern DuCfgParams duCfgParam; extern char encBuf[ENC_BUF_MAX_LEN]; @@ -141,7 +159,7 @@ S16 readMacCfg() 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.ssbPeriod = SSB_PERIODICITY; duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET; duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */ duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0; @@ -234,6 +252,145 @@ S16 fillDuPort(U16 *duPort) +/******************************************************************* + * + * @brief Configures serving cell config common in sib1 + * + * @details + * + * Function : fillServCellCfgCommSib + * + * Functionality: + * - fills Serving cell config common for SIB1 + * + * @params[in] SrvCellCfgCommSib pointer + * @return ROK - success + * RFAILED - failure + * + ** ****************************************************************/ +S16 fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) +{ + PdcchCfgCommon pdcchCfg; + PdschCfgCommon pdschCfg; + PcchCfg pcchCfg; + RachCfgCommon rachCfg; + PuschCfgCommon puschCfg; + PucchCfgCommon pucchCfg; + TddUlDlCfgCommon tddCfg; + + /* Configuring DL Config Common for SIB1*/ + srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND_IND; + srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A; + srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET; + srvCellCfgComm->dlCfg.dlScsCarrier.scs = SUBCARRIER_SPACING; + srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = SCS_CARRIER_BANDWIDTH; + srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW; + + /* Configuring PDCCH Config Common For SIB1 */ + pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup; + pdcchCfg.ctrlRsrcSetZero = PDCCH_CTRL_RSRC_SET_ZERO; + pdcchCfg.searchSpcZero = PDCCH_SEARCH_SPACE_ZERO; + pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID; + pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID; + pdcchCfg.monitorSlotPrdAndOffPresent = \ + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + //pdcchCfg.monitorSlotPrdAndOff = \ + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + pdcchCfg.monitorSymbolsInSlot[0] = 128; + pdcchCfg.monitorSymbolsInSlot[1] = 0; + pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8; + pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4; + pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2; + pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1; + pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0; + pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common; + pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT; + pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1; + pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING; + pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING; + srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg; + + /* Configuring PDSCH Config Common For SIB1 */ + pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup; + pdschCfg.k0 = PDSCH_K0; + pdschCfg.mapType = \ + PDSCH_TimeDomainResourceAllocation__mappingType_typeA; + pdschCfg.startSymbAndLen = PDSCH_START_SYMB_AND_LEN; + srvCellCfgComm->dlCfg.pdschCfg = pdschCfg; + + /* Configuring BCCH Config for SIB1 */ + srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \ + BCCH_Config__modificationPeriodCoeff_n16; + + /* Configuring PCCH Config for SIB1 */ + pcchCfg.dfltPagingCycle = PagingCycle_rf64; + pcchCfg.nAndPagingFrmOffPresent = PCCH_Config__nAndPagingFrameOffset_PR_oneT; + pcchCfg.numPagingOcc = PCCH_Config__ns_four; + srvCellCfgComm->dlCfg.pcchCfg = pcchCfg; + + + /* Configuring UL Config Common */ + srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET; + srvCellCfgComm->ulCfg.ulScsCarrier.scs = SUBCARRIER_SPACING; + srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = SCS_CARRIER_BANDWIDTH; + srvCellCfgComm->ulCfg.pMax = UL_P_MAX; + srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW; + srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity; + + /* Configuring RACH Config Common for SIB1 */ + rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup; + rachCfg.prachCfgIdx = PRACH_CONFIG_IDX; + rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one; + rachCfg.msg1FreqStart = PRACH_FREQ_START; + rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG; + rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR; + rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200; + rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2; + rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl20; + rachCfg.numRaPreamble = NUM_RA_PREAMBLE; + rachCfg.ssbPerRachOccPresent = \ + RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one; + rachCfg.numSsbPerRachOcc = SSB_PER_RACH; + rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64; + rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB; + rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139; + rachCfg.rootSeqIdx = ROOT_SEQ_IDX; + rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ; + rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG; + srvCellCfgComm->ulCfg.rachCfg = rachCfg; + + /* Configuring PUSCH Config Common for SIB1 */ + puschCfg.present = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup; + puschCfg.k2 = PUSCH_K0; + puschCfg.mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA; + puschCfg.startSymbAndLen = PUSCH_START_SYMB_AND_LEN; + puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE; + puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT; + srvCellCfgComm->ulCfg.puschCfg = puschCfg; + + /* Configuring PUCCH Config Common for SIB1 */ + pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup; + pucchCfg.rsrcComm = PUCCH_RSRC_COMMON; + pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither; + pucchCfg.p0Nominal = PUCCH_P0_NOMINAL; + srvCellCfgComm->ulCfg.pucchCfg = pucchCfg; + + /* Configuring TDD UL DL config common */ + tddCfg.refScs = SubcarrierSpacing_kHz30; + tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2p5; + tddCfg.numDlSlots = NUM_DL_SLOTS; + tddCfg.numDlSymbols = NUM_DL_SYMBOLS; + tddCfg.numUlSlots = NUM_UL_SLOTS; + tddCfg.numUlSymbols = NUM_UL_SYMBOLS; + srvCellCfgComm->tddCfg = tddCfg; + + srvCellCfgComm->ssbPosInBurst = 192; + srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY; + srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR; + + return ROK; +} + /******************************************************************* * * @brief Configures the DU Parameters @@ -311,8 +468,20 @@ S16 readCfg() sib1.tac = DU_TAC; sib1.ranac = DU_RANAC; sib1.cellIdentity = CELL_IDENTITY; - sib1.cellResvdForOpUse = + sib1.cellResvdForOpUse =\ PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; + sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3; + sib1.connEstFailOffValidity =\ + ConnEstFailureControl__connEstFailOffsetValidity_s120; + sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5; + sib1.siSchedInfo.broadcastSta = \ + SchedulingInfo__si_BroadcastStatus_broadcasting; + sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8; + sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2; + sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG; + + fillServCellCfgCommSib(&sib1.srvCellCfgCommSib); + duCfgParam.sib1Params = sib1; for(i=0; iselector = DU_SELECTOR_LC; rspPst->pool= DU_POOL; - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -261,14 +261,14 @@ S16 egtpSrvOpenReq(Pst *pst) if(ret = egtpSrvOpenPrc(sockType, &(egtpCb.recvTptSrvr)) != ROK) { DU_LOG("\nEGTP : Failed while opening receiver transport server"); - RETVALUE(RFAILED); + return RFAILED; } /* Opening and Binding sender socket */ if(ret = egtpSrvOpenPrc(sockType, &(egtpCb.dstCb.sendTptSrvr)) != ROK) { DU_LOG("\nEGTP : Failed while opening sender transport server"); - RETVALUE(RFAILED); + return RFAILED; } DU_LOG("\nEGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd, egtpCb.dstCb.sendTptSrvr.sockFd.fd); @@ -279,9 +279,9 @@ S16 egtpSrvOpenReq(Pst *pst) egtpFillRspPst(pst, &rspPst); rspPst.event = EVTSRVOPENCFM; - cmPkEgtpSrvOpenCfm(&rspPst, cfm); + packEgtpSrvOpenCfm(&rspPst, cfm); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -308,16 +308,16 @@ S16 egtpSrvOpenPrc(U8 sockType, EgtpTptSrvr *server) if(ret = (cmInetSocket(sockType, &(server->sockFd), protType)) != ROK) { DU_LOG("\nEGTP : Failed to open UDP socket"); - RETVALUE(RFAILED); + return RFAILED; } if(ret = cmInetBind(&(server->sockFd), &(server->addr)) != ROK) { DU_LOG("\nEGTP : Failed to bind socket"); - RETVALUE(RFAILED); + return RFAILED; } - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -381,9 +381,9 @@ S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) DU_LOG("\nEGTP : Sending Tunnel management confirmation"); egtpFillRspPst(pst, &rspPst); rspPst.event = EVTTNLMGMTCFM; - cmPkEgtpTnlMgmtCfm(&rspPst, tnlEvt); + packEgtpTnlMgmtCfm(&rspPst, tnlEvt); - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -413,7 +413,7 @@ S16 egtpTnlAdd(EgtpTnlEvt tnlEvt) if(ret != ROK) { DU_LOG("\nEGTP : Memory allocation failed"); - RETVALUE(LCM_REASON_MEM_NOAVAIL); + return LCM_REASON_MEM_NOAVAIL; } cmMemset((U8 *)teidCb, 0, sizeof(EgtpTeIdCb)); @@ -425,7 +425,7 @@ S16 egtpTnlAdd(EgtpTnlEvt tnlEvt) { DU_LOG("\nEGTP : Failed to insert in hash list"); SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); - RETVALUE(LCM_REASON_HASHING_FAILED); + return LCM_REASON_HASHING_FAILED; } egtpCb.dstCb.numTunn++; @@ -439,7 +439,7 @@ S16 egtpTnlAdd(EgtpTnlEvt tnlEvt) egtpEncodeHdr((U8 *)teidCb->preEncodedHdr.hdr, &preDefHdr, &(teidCb->preEncodedHdr.cnt)); - RETVALUE(ROK); + return ROK; } /* egtpTnlAdd */ /************************************************************************** @@ -475,7 +475,7 @@ S16 egtpTnlMod(EgtpTnlEvt tnlEvt) teidCb->teId = tnlEvt.lclTeid; teidCb->remTeId = tnlEvt.remTeid; #endif - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -503,14 +503,14 @@ S16 egtpTnlDel(EgtpTnlEvt tnlEvt) if(teidCb == NULLP) { DU_LOG("\nEGTP : Tunnel id[%d] not configured", tnlEvt.lclTeid); - RETVALUE(LCM_REASON_INVALID_PAR_VAL); + return LCM_REASON_INVALID_PAR_VAL; } cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb); SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); egtpCb.dstCb.numTunn--; - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -544,7 +544,7 @@ S16 egtpHdlDatInd(EgtpMsg egtpMsg) if(teidCb == NULLP) { DU_LOG("\nEGTP : Tunnel id[%d] not configured", egtpMsg.msgHdr.teId); - RETVALUE(LCM_REASON_INVALID_PAR_VAL); + return LCM_REASON_INVALID_PAR_VAL; } msgHdr = &(egtpMsg.msgHdr); @@ -601,7 +601,7 @@ S16 egtpHdlDatInd(EgtpMsg egtpMsg) egtpSendMsg(egtpMsg.msg); SPutMsg(egtpMsg.msg); - RETVALUE(ROK); + return ROK; }/* EgtpHdlDatInd */ /******************************************************************* @@ -713,7 +713,7 @@ S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) } *hdrIdx = cnt; - RETVALUE(ROK); + return ROK; } /* egtpEncodeHdr */ /******************************************************************* @@ -749,21 +749,21 @@ S16 egtpSendMsg(Buffer *mBuf) if(ret != ROK && ret != RWOULDBLOCK) { DU_LOG("\nEGTP : Failed sending the message"); - RETVALUE(RFAILED); + return RFAILED; } DU_LOG("\nEGTP : Message Sent"); - RETVALUE(ROK); + return ROK; } /******************************************************************* * - * @brief Handles TTI Indication from PHY + * @brief Handles Slot Indication from PHY * * @details * - * Function : egtpTTIInd + * Function : egtpSlotInd * * Functionality: * Handles TTI Indication from PHY @@ -773,10 +773,10 @@ S16 egtpSendMsg(Buffer *mBuf) * RFAILED - failure * * ****************************************************************/ -S16 egtpTTIInd() +S16 egtpSlotInd() { egtpRecvMsg(); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -806,7 +806,7 @@ S16 egtpRecvMsg() CmInetMemInfo memInfo; /* Buffer allocation info */ - DU_LOG("\nEGTP : Received TTI Indication"); + DU_LOG("\nEGTP : Received Slot Indication"); nMsg = 0; memInfo.region = DU_APP_MEM_REGION; @@ -828,7 +828,7 @@ S16 egtpRecvMsg() nMsg++; } - RETVALUE(ROK); + return ROK; } S16 egtpHdlRecvData(Buffer *mBuf) @@ -841,7 +841,7 @@ S16 egtpHdlRecvData(Buffer *mBuf) /* TODO : Send received message to RLC */ duHdlEgtpDlData(&egtpMsg); - RETVALUE(ROK); + return ROK; } S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) @@ -1004,6 +1004,6 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) /* Forward the data to duApp/RLC */ - RETVALUE(ROK); + return ROK; } diff --git a/src/du_app/du_egtp.h b/src/du_app/du_egtp.h index db20d8fc8..e264a44bd 100644 --- a/src/du_app/du_egtp.h +++ b/src/du_app/du_egtp.h @@ -96,7 +96,7 @@ S16 egtpTnlDel(EgtpTnlEvt tnlEvt); S16 egtpHdlDatInd(EgtpMsg msg); S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx); S16 egtpSendMsg(Buffer *mBuf); -S16 egtpTTIInd(); +S16 egtpSlotInd(); S16 egtpRecvMsg(); S16 egtpHdlRecvData(Buffer *mBuf); S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg); diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index fc23787fb..f229b1ba0 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -75,7 +75,7 @@ #define EVTSRVOPENCFM 5 #define EVTTNLMGMTREQ 6 #define EVTTNLMGMTCFM 7 -#define EVTTTIIND 8 +#define EVTSLOTIND 8 #define EVTSTARTPOLL 9 #define EVENT_RIC_DATA 10 @@ -139,6 +139,12 @@ SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \ (Data *)_datPtr, _size); +/* Free shared memory, received through LWLC */ +#define DU_FREE_MEM(_region, _pool, _datPtr, _size) \ + if(_datPtr) \ + SPutSBuf(_region, _pool,(Data *)_datPtr, _size); \ + _datPtr = NULL; + typedef enum { CELL_OUT_OF_SERVICE, @@ -245,6 +251,7 @@ S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm); S16 duSendEgtpTestData(); S16 duSendEgtpDatInd(Buffer *mBuf); S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm); +uint16_t duBuildAndSendMacCellStartReq(); #endif diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 5d6d5477d..ef43ccd2d 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -54,6 +54,8 @@ extern S16 cmUnpkLrgCfgCfm(LrgCfgCfm func,Pst *pst, Buffer *mBuf); ***************************************************************************/ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason) { + uint8_t id; + duCb.init.procId = SFndProcId(); duCb.init.ent = entity; duCb.init.inst = inst; @@ -70,8 +72,11 @@ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason) duCb.f1Status = FALSE; duCb.e2Status = FALSE; - memset(duCb.cfgCellLst, '\0', DU_MAX_CELLS * sizeof(duCb.cfgCellLst)); - memset(duCb.actvCellLst, '\0',DU_MAX_CELLS * sizeof(duCb.actvCellLst)); + for(id = 0; id < DU_MAX_CELLS; id ++) + { + duCb.cfgCellLst[id] = NULL; + duCb.actvCellLst[id] = NULL; + } SSetProcId(DU_PROC); @@ -188,6 +193,11 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf); break; } + case EVENT_MAC_SLOT_IND: + { + ret = unpackMacSlotInd(duHandleSlotInd, pst, mBuf); + break; + } default: { DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG"); @@ -233,17 +243,17 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) { case EVTCFGCFM: { - cmUnpkEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf); + unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf); break; } case EVTSRVOPENCFM: { - cmUnpkEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf); + unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf); break; } case EVTTNLMGMTCFM: { - cmUnpkEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf); + unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf); break; } default: diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index ed91ea40d..2f77a76d9 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -16,7 +16,7 @@ ################################################################################ *******************************************************************************/ -/* This file contains message handling functionality for DU cell management */ +/* This file contains message handling functionality for DU APP */ #include "du_mgr.h" #include "du_sctp.h" @@ -44,6 +44,20 @@ packMacCellCfgReq packMacCellCfgOpts[] = packMacCellCfg, /* packing for light weight loosly coupled */ }; +DuMacCellStartReq packMacCellStartReqOpts[] = +{ + packMacCellStartReq, /* Loose coupling */ + MacHdlCellStartReq, /* TIght coupling */ + packMacCellStartReq /* Light weight-loose coupling */ +}; + +DuMacCellStopReq packMacCellStopReqOpts[] = +{ + packMacCellStopReq, /* Loose coupling */ + MacHdlCellStopReq, /* TIght coupling */ + packMacCellStopReq /* Light weight-loose coupling */ +}; + /************************************************************************** * @brief Function to fill configs required by RLC * @@ -1004,7 +1018,7 @@ S16 duBuildEgtpCfgReq() cmMemcpy((U8 *)&egtpCfg, (U8 *)&duCfgParam.egtpParams, (PTR)sizeof(EgtpConfig)); duFillEgtpPst(&pst, EVTCFGREQ); - cmPkEgtpCfgReq(&pst, egtpCfg); + packEgtpCfgReq(&pst, egtpCfg); RETVALUE(ROK); } @@ -1069,7 +1083,7 @@ S16 duSendEgtpSrvOpenReq() DU_LOG("\nDU_APP : Sending EGTP server open request"); duFillEgtpPst(&pst, EVTSRVOPENREQ); - cmPkEgtpSrvOpenReq(&pst); + packEgtpSrvOpenReq(&pst); RETVALUE(ROK); } @@ -1142,7 +1156,7 @@ S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid) DU_LOG("\nDU_APP : Sending EGTP tunnel management request"); duFillEgtpPst(&pst, EVTTNLMGMTREQ); - cmPkEgtpTnlMgmtReq(&pst, tnlEvt); + packEgtpTnlMgmtReq(&pst, tnlEvt); RETVALUE(ROK); } @@ -1175,9 +1189,6 @@ S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm) duSendUeCreateReqToRlc(); duSendEgtpTestData(); - - /* For testing purpose. TTI thread should actually be in L1 */ - duStartTtiThread(); #endif } else @@ -1481,26 +1492,26 @@ S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm) /******************************************************************* * - * @brief Handles TTI indication + * @brief Sends Slot indication to EGTP * * @details * - * Function : duSendEgtpTTIInd + * Function : duSendEgtpSlotInd * * Functionality: - * Handles TTI indication received from PHY + * Sends Slot indication to EGTP * * @params[in] * @return ROK - success * RFAILED - failure * * ****************************************************************/ -S16 duSendEgtpTTIInd() +S16 duSendEgtpSlotInd() { Pst pst; - duFillEgtpPst(&pst, EVTTTIIND); - cmPkEgtpTTIInd(&pst); + duFillEgtpPst(&pst, EVTSLOTIND); + packEgtpSlotInd(&pst); RETVALUE(ROK); @@ -1571,7 +1582,7 @@ S16 duBuildAndSendMacCellCfg() * RFAILED - failure * ***************************************************************************/ -S16 duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm) +uint16_t duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm) { S16 ret = ROK; @@ -1585,6 +1596,11 @@ S16 duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm) /* Build and send GNB-DU config update */ ret = BuildAndSendDUConfigUpdate(); + + /* TODO: Trigger cell start req once cell up slot ind is received*/ + /* Build and Send Cell Start Req to MAC */ + //ret = duBuildAndSendMacCellStartReq(); + } else { @@ -1601,6 +1617,140 @@ S16 duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm) return ret; } +/******************************************************************* + * + * @brief Handles slot indication from MAC + * + * @details + * + * Function : duHandleSlotInd + * + * Functionality: + * Handles slot indication from MAC + * + * @params[in] Post structure pointer + * Slot Info pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo) +{ + + DU_LOG("\nDU APP : Slot Indication received"); + + /* TODO : Slot Indication to be moved out of EGTP_TEST when + * data path is established */ +#ifdef EGTP_TEST + duSendEgtpSlotInd(); +#endif + DU_FREE_MEM(pst->region, pst->pool, slotInfo, sizeof(SlotInfo)); + return ROK; +} + +/******************************************************************* + * + * @brief Builds and sends cell start request to MAC + * + * @details + * + * Function : duBuildAndSendMacCellStartReq + * + * Functionality: + * Builds and sends cell start request to MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint16_t duBuildAndSendMacCellStartReq() +{ + Pst pst; + MacCellStartInfo *cellStartInfo = NULL; + + DU_LOG("\nDU APP : Building and Sending cell start request to MAC"); + + /* Send Cell Start Request to MAC */ + DU_ALLOC(cellStartInfo, sizeof(MacCellStartInfo)); + if(!cellStartInfo) + { + DU_LOG("\nDU APP : Memory alloc failed while building cell start request"); + return RFAILED; + } + + for(uint8_t id = 0; id < DU_MAX_CELLS; id++) + { + if(duCb.actvCellLst[id]) + { + cellStartInfo->cellId = duCb.actvCellLst[id]->cellInfo.nrEcgi.cellId; + + /* Fill Pst */ + pst.selector = DU_MAC_LWLC; + pst.srcEnt = ENTDUAPP; + pst.dstEnt = ENTRG; + pst.dstInst = 0; + pst.srcInst = 0; + pst.dstProcId = DU_PROC; + pst.srcProcId = DU_PROC; + pst.region = DU_APP_MEM_REGION; + pst.pool = DU_POOL; + pst.event = EVENT_MAC_CELL_START_REQ; + + return (*packMacCellStartReqOpts[pst.selector])(&pst, cellStartInfo); + } + } + return ROK; +} + +/******************************************************************* + * + * @brief Builds and sends cell stop request to MAC + * + * @details + * + * Function : duBuildAndSendMacCellStopReq + * + * Functionality: + * Builds and sends cell stop request to MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 duBuildAndSendMacCellStopReq() +{ + Pst pst; + MacCellStopInfo *cellStopInfo = NULL; + + DU_LOG("\nDU APP : Building and Sending cell stop request to MAC"); + + /* Send Cell Stop Request to MAC */ + DU_ALLOC(cellStopInfo, sizeof(MacCellStopInfo)); + if(!cellStopInfo) + { + DU_LOG("\nDU APP : Memory alloc failed while building cell stop request"); + return RFAILED; + } + cellStopInfo->cellId = duCb.actvCellLst[0]->cellId; + + /* Fill Pst */ + pst.selector = DU_MAC_LWLC; + pst.srcEnt = ENTDUAPP; + pst.dstEnt = ENTRG; + pst.dstInst = 0; + pst.srcInst = 0; + pst.dstProcId = DU_PROC; + pst.srcProcId = DU_PROC; + pst.region = DU_APP_MEM_REGION; + pst.pool = DU_POOL; + pst.event = EVENT_MAC_CELL_STOP_REQ; + + return (*packMacCellStopReqOpts[pst.selector])(&pst, cellStopInfo); +} + + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_sys_info_hdl.c b/src/du_app/du_sys_info_hdl.c index 790a10fb3..c3c979553 100644 --- a/src/du_app/du_sys_info_hdl.c +++ b/src/du_app/du_sys_info_hdl.c @@ -22,10 +22,32 @@ #include "du_log.h" #include "BCCH-BCH-Message.h" #include "MIB.h" -#include "SIB1.h" #include "PLMN-IdentityInfo.h" #include "PLMN-IdentitY.h" +#include "SIB-TypeInfo.h" +#include "SchedulingInfo.h" +#include "SI-SchedulingInfo.h" +#include "ConnEstFailureControl.h" +#include "FrequencyInfoDL-SIB.h" +#include "SearchSpace.h" +#include "SCS-SpecificCarrier.h" +#include "NR-MultiBandInfo.h" +#include "PDCCH-ConfigCommon.h" +#include "PDSCH-TimeDomainResourceAllocation.h" +#include "PDSCH-TimeDomainResourceAllocationList.h" +#include "PDSCH-ConfigCommon.h" +#include "BWP-DownlinkCommon.h" +#include "DownlinkConfigCommonSIB.h" +#include "RACH-ConfigCommon.h" +#include "PUSCH-TimeDomainResourceAllocation.h" +#include "PUSCH-TimeDomainResourceAllocationList.h" +#include "PUSCH-ConfigCommon.h" +#include "PUCCH-ConfigCommon.h" +#include "UplinkConfigCommonSIB.h" +#include "TDD-UL-DL-ConfigCommon.h" +#include "ServingCellConfigCommonSIB.h" #include "MCC.h" +#include "SIB1.h" #include "du_sys_info_hdl.h" extern char encBuf[ENC_BUF_MAX_LEN]; @@ -368,6 +390,7 @@ int BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) DU_LOG("DU APP: BuildPlmnList memory allocation failure"); return RFAILED; } + for(idx1=0; idx1list.array[idx1], @@ -458,110 +481,1906 @@ int BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) /******************************************************************* * - * @brief Builds SIB message in Served Cell Info + * @brief Build SIB Map Info List * * @details * - * Function : BuildSib1Msg + * Function : BuildSibMapInfoList * - * Functionality: Building SIB message in Served Cell Info + * Functionality: + * Build SIB MapInfo List * + * @params[in] SIB_Mapping_t pointer * @return ROK - success * RFAILED - failure * * ****************************************************************/ -int BuildSib1Msg() +S16 BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo) { - SIB1_t *sib1Msg; - CellAccessRelatedInfo_t *cellAccessInfo; - U8 elementCnt; - U8 idx, idx1, idx2; - asn_enc_rval_t encRetVal; - TrackingAreaCode_t *tac; - RAN_AreaCode_t *ranac; - CellIdentity_t *cellIdentity; - struct PLMN_IdentityInfo__plmn_IdentityList - *plmnIdInfo; + uint8_t itr; /* List iterator */ + uint8_t elementCnt; /* Number of elements in list */ + SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */ - DU_ALLOC(sib1Msg, sizeof(SIB1_t)); - if(!sib1Msg) - { - DU_LOG("DU APP: SIB1 msg memory allocation failure"); - return RFAILED; - } - elementCnt = ODU_VALUE_ONE; + /* SI scheduling info list */ + DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size); + if(!sibMapInfo->list.array) + { + DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure"); + return RFAILED; + } - /* PLMN list */ - cellAccessInfo = &sib1Msg->cellAccessRelatedInfo; - cellAccessInfo->plmn_IdentityList.list.count = - elementCnt; - cellAccessInfo->plmn_IdentityList.list.size - = elementCnt * sizeof(PLMN_IdentityInfo_t); + elementCnt = sibMapInfo->list.count; + for(itr = 0; itr < elementCnt; itr++) + { + DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t)); + if(!sibMapInfo->list.array[itr]) + { + DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure"); + return RFAILED; + } + } + + itr = 0; + sibTypeInfo = sibMapInfo->list.array[itr]; + sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType; + DU_ALLOC(sibTypeInfo->valueTag, sizeof(long)); + if(!sibTypeInfo->valueTag) + { + DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure"); + return RFAILED; + } - BuildPlmnList(cellAccessInfo); + *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag; - xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg); + return ROK; +} - /* Encode the F1SetupRequest type as APER */ - cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); - encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\ - encBuf); - printf("\nencbufSize: %d\n", encBufSize); - if(encRetVal.encoded == -1) - { - DU_LOG("\nDU APP : Could not encode SIB1 structure (at %s)\n",\ - encRetVal.failed_type ? - encRetVal.failed_type->name : - "unknown"); - return RFAILED; - } - for(int i=0; i< encBufSize; i++) - { - printf("%x\t",encBuf[i]); - } - printf("\n"); +/******************************************************************* + * + * @brief Builds SI Scheduling info list within SIB1 message + * + * @details + * + * Function : BuildSiSchedInfoList + * + * Functionality: + * Building SI Scheduling info list in SIB1 message + * + * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList) +{ + uint8_t itr; /* List iterator */ + uint8_t elementCnt; /* Number of elements in list */ + SchedulingInfo_t *schedInfo; /* Scheduling info */ - /* Free allocated memeory */ - /* Free PLMN List */ + /* SI scheduling info list */ + DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size); + if(!si_SchedulingInfoList->list.array) + { + DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure"); + return RFAILED; + } + + elementCnt = si_SchedulingInfoList->list.count; + for(itr = 0; itr < elementCnt; itr++) + { + DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo)); + if(!si_SchedulingInfoList->list.array[itr]) + { + DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure"); + return RFAILED; + } + } - for(idx=0; idxplmn_IdentityList.list.count; idx++) - { - plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\ - plmn_IdentityList; - for(idx1=0; idx1list.count; idx1++) - { - for(idx2=0; idx2list.array[idx1]->mnc.list.count; idx2++) - { - DU_FREE(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2], - sizeof(MCC_MNC_Digit_t)); - DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2], - sizeof(MCC_MNC_Digit_t)); - } - DU_FREE(plmnIdInfo->list.array[idx1]->mcc->list.array, - plmnIdInfo->list.array[idx1]->mcc->list.size); - DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array, - plmnIdInfo->list.array[idx1]->mnc.list.size); - DU_FREE(plmnIdInfo->list.array[idx1]->mcc, - sizeof(MCC_t)); - DU_FREE(plmnIdInfo->list.array[idx1], - sizeof(PLMN_IdentitY_t)); - } - DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx], - sizeof(PLMN_IdentityInfo_t)); - cellIdentity =\ - &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity; - DU_FREE(cellIdentity->buf, cellIdentity->size); + itr = 0; + schedInfo = si_SchedulingInfoList->list.array[itr]; + schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta; + schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity; - ranac = cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac; - DU_FREE(ranac, sizeof(RAN_AreaCode_t)); + elementCnt = ODU_VALUE_ONE; + schedInfo->sib_MappingInfo.list.count = elementCnt; + schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t); + + BuildSibMapInfoList(&schedInfo->sib_MappingInfo); - tac = cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode; - DU_FREE(tac->buf, tac->size); - DU_FREE(tac, sizeof(TrackingAreaCode_t)); - } - DU_FREE(cellAccessInfo->plmn_IdentityList.list.array, - cellAccessInfo->plmn_IdentityList.list.size); + return ROK; +} + +/******************************************************************* + * + * @brief Builds SCS Specific carrier list for DL + * + * @details + * + * Function : BuildScsSpecificCarrierListDl + * + * Functionality: + * Builds Subcarrier specific carrier list for downlink + * + * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildScsSpecificCarrierListDl +( +struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList +) +{ + uint8_t idx; + ScsSpecCarrier duScsSpecCarrier; + + duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier; + + DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size); + if(!scsCarrierList->list.array) + { + DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed"); + return RFAILED; + } + + for(idx = 0; idx < scsCarrierList->list.count; idx++) + { + DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t)); + if(!scsCarrierList->list.array[idx]) + { + DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed"); + return RFAILED; + } + } + + idx = 0; + scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset; + scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs; + scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw; + + return ROK; +} /* End of BuildScsSpecificCarrierListDl */ + +/******************************************************************* + * + * @brief Builds common search space list + * + * @details + * + * Function : BuildCommonSerachSpaceList + * + * Functionality: + * Builds common search space list + * + * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildCommonSerachSpaceList +( +struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist +) +{ + uint8_t idx; + SearchSpace_t *searchSpace; + PdcchCfgCommon duPdcchCfg; + + duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg; + + DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size) + if(!searchSpclist->list.array) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + + for(idx = 0; idx < searchSpclist->list.count; idx++) + { + DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t)); + if(!searchSpclist->list.array[idx]) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + } + + idx = 0; + searchSpace = searchSpclist->list.array[idx]; + + /* Search Space id */ + searchSpace->searchSpaceId = duPdcchCfg.searchSpcId; + + /* Control Resource Set Id */ + DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t)); + if(!searchSpace->controlResourceSetId) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId; + + /* Monitoring Slot periodicity and offset */ + DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\ + sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset)); + if(!searchSpace->monitoringSlotPeriodicityAndOffset) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + searchSpace->monitoringSlotPeriodicityAndOffset->present = \ + duPdcchCfg.monitorSlotPrdAndOffPresent; + switch(searchSpace->monitoringSlotPeriodicityAndOffset->present) + { + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1: + { + //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = \ + duPdcchCfg.monitorSlotPrdAndOff; + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16: + { + //TODO; + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320: + { + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280: + { + //TODO + break; + } + case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560: + { + //TODO + break; + } + default: + { + DU_LOG("\nDU APP : Invalid value:Montoring slot periodicity and offset"); + return RFAILED; + } + } + + /* Monitoring Symbols Within Slot */ + DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\ + sizeof(BIT_STRING_t)); + if(!searchSpace->monitoringSymbolsWithinSlot) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + searchSpace->monitoringSymbolsWithinSlot->size = 2; + DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \ + searchSpace->monitoringSymbolsWithinSlot->size * sizeof(uint8_t)); + if(!searchSpace->monitoringSymbolsWithinSlot->buf) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0]; + searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1]; + searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2; + + /* Number of candidates per aggregation level */ + DU_ALLOC(searchSpace->nrofCandidates,\ + sizeof(struct SearchSpace__nrofCandidates)); + if(!searchSpace->nrofCandidates) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1; + searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2; + searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4; + searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8; + searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16; + + /* Search Space type and DCI Format */ + DU_ALLOC(searchSpace->searchSpaceType,\ + sizeof( struct SearchSpace__searchSpaceType)); + if(!searchSpace->searchSpaceType) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + + searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType; + switch(searchSpace->searchSpaceType->present) + { + case SearchSpace__searchSpaceType_PR_NOTHING: + { + //TODO + break; + } + case SearchSpace__searchSpaceType_PR_common: + { + DU_ALLOC(searchSpace->searchSpaceType->choice.common,\ + sizeof(struct SearchSpace__searchSpaceType__common)); + if(!searchSpace->searchSpaceType->choice.common) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + + DU_ALLOC(searchSpace->searchSpaceType->choice.common->\ + dci_Format0_0_AndFormat1_0, sizeof(struct \ + SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); + if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) + { + DU_LOG("\nDU APP : Common search space list memory alloc failed"); + return RFAILED; + } + break; + } + case SearchSpace__searchSpaceType_PR_ue_Specific: + { + break; + } + default: + { + DU_LOG("\nDU_APP: Invalid Search Space type"); + return RFAILED; + } + + } + + return ROK; +}/* BuildCommonSerachSpaceList */ + +/******************************************************************* + * + * @brief Builds PDCCH configuration common + * + * @details + * + * Function : BuildPdcchCfgCommon + * + * Functionality: + * Builds PDCCH configuration common + * + * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg) +{ + uint8_t elementCnt; + PdcchCfgCommon duPdcchCfg; + PDCCH_ConfigCommon_t *pdcchSetup; + + duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg; + + pdcchCfg->present = duPdcchCfg.present; + + switch(pdcchCfg->present) + { + case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING: + { + //TODO + break; + } + case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release: + { + //TODO + break; + } + case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup: + { + DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t)); + if(!pdcchCfg->choice.setup) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + pdcchSetup = pdcchCfg->choice.setup; + + /* Control Resource Set Zero */ + DU_ALLOC(pdcchSetup->controlResourceSetZero, + sizeof(ControlResourceSetZero_t)); + if(!pdcchSetup->controlResourceSetZero) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero; + + /* Search space zero */ + DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t)); + if(!pdcchSetup->searchSpaceZero) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero; + + /* Common Search Space List */ + DU_ALLOC(pdcchSetup->commonSearchSpaceList,\ + sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList)); + if(!pdcchSetup->commonSearchSpaceList) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + elementCnt = ODU_VALUE_ONE; + pdcchSetup->commonSearchSpaceList->list.count = elementCnt; + pdcchSetup->commonSearchSpaceList->list.size = \ + elementCnt * sizeof(SearchSpace_t); + BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList); + + /* Search Space for SIB1 */ + DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t)); + if(!pdcchSetup->searchSpaceSIB1) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1; + + /* Serach Space for Paging */ + DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t)); + if(!pdcchSetup->pagingSearchSpace) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc; + + /* Search space for Random Access */ + DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t)); + if(!pdcchSetup->ra_SearchSpace) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc; + + break; + } + default : + { + DU_LOG("\nDU APP : Invalid PDCCH Config type"); + return RFAILED; + } + } + + return ROK; +} /* BuildPdcchCfgCommon */ + +/******************************************************************* + * + * @brief Builds PDSCH configuration common + * + * @details + * + * Function : BuildPdschCfgCommon + * + * Functionality: + * Builds PDSCH configuration common + * + * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg) +{ + uint8_t idx; + uint8_t elementCnt; + PdschCfgCommon duPdschCfg; + PDSCH_ConfigCommon_t *pdschSetup; + PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo; + + duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg; + + pdschCfg->present = duPdschCfg.present; + + switch(pdschCfg->present) + { + case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING: + { + //TODO + break; + } + case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release: + { + //TODO + break; + } + case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup: + { + DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t)); + if(!pdschCfg->choice.setup) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + pdschSetup = pdschCfg->choice.setup; + + /* Time Domain Allocation List */ + DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \ + sizeof(PDSCH_TimeDomainResourceAllocationList_t)); + if(!pdschSetup->pdsch_TimeDomainAllocationList) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + elementCnt = ODU_VALUE_ONE; + pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt; + pdschSetup->pdsch_TimeDomainAllocationList->list.size = \ + elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t); + + DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\ + pdschSetup->pdsch_TimeDomainAllocationList->list.size); + if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + + for(idx=0; idxpdsch_TimeDomainAllocationList->list.array[idx],\ + sizeof(PDSCH_TimeDomainResourceAllocation_t)); + if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx]) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + } + + idx = 0; + timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx]; + + /* K0 */ + DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long)); + if(!timeDomRsrcAllocInfo->k0) + { + DU_LOG("\nDU APP : PDCCH Config memory alloc failed"); + return RFAILED; + } + *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0; + + timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType; + timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.startSymbAndLen; + + break; + } + default: + { + DU_LOG("\nDU APP: Invalid PDSCH Configuration type"); + return RFAILED; + } + } + + return ROK; +}/* BuildPdschCfgCommon */ + +/******************************************************************* + * + * @brief Builds DL BWP common + * + * @details + * + * Function : BuildBwpDlCommon + * + * Functionality: + * Builds DL BWP common + * + * @params[in] BWP_DownlinkCommon_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp) +{ + DlCfgCommon duDlCfg; + + duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + + bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw; + bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs; + + /* PDCCH Config Common */ + DU_ALLOC(bwp->pdcch_ConfigCommon, \ + sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); + if(!bwp->pdcch_ConfigCommon) + { + DU_LOG("\nDU APP : DL BWP memory allocation failed"); + return RFAILED; + } + BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon); + + /* PDSCH Config Common */ + DU_ALLOC(bwp->pdsch_ConfigCommon, \ + sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon)); + if(!bwp->pdsch_ConfigCommon) + { + DU_LOG("\nDU APP : DL BWP memory allocation failed"); + return RFAILED; + } + BuildPdschCfgCommon(bwp->pdsch_ConfigCommon); + + return ROK; +} /* BuildBwpDlCommon */ + +/******************************************************************* + * + * @brief Build BCCH configuration + * + * @details + * + * Function : BuildBcchConfig + * + * Functionality: + * Build BCCH configuration + * + * @params[in] BCCH_Config_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildBcchConfig(BCCH_Config_t *bcchCfg) +{ + BcchCfg duBcchCfg; + + duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg; + + bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff; + + return ROK; +}/* BuildBcchConfig */ + +/******************************************************************* + * + * @brief Builds PCCH configuration + * + * @details + * + * Function : BuildPcchConfig + * + * Functionality: + * Builds PCCH configuration + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildPcchConfig(PCCH_Config_t *pcchCfg) +{ + PcchCfg duPcchCfg; + + duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg; + + pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle; + pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent; + switch(pcchCfg->nAndPagingFrameOffset.present) + { + case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING: + { + //TODO + break; + } + case PCCH_Config__nAndPagingFrameOffset_PR_oneT: + { + break; + } + case PCCH_Config__nAndPagingFrameOffset_PR_halfT: + { + //TODO + break; + } + case PCCH_Config__nAndPagingFrameOffset_PR_quarterT: + { + //TODO + break; + } + case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT: + { + //TODO + break; + } + case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT: + { + //TODO + break; + } + default: + { + DU_LOG("\nDU APP : Invalid nAndPagingFrameOffset configuration"); + return RFAILED; + } + } + pcchCfg->ns = duPcchCfg.numPagingOcc; + + return ROK; +}/* BuildPcchConfig */ + +/******************************************************************* + * + * @brief Builds Frequency Info for Downlink + * + * @details + * + * Function : BuildFreqInfoDl + * + * Functionality: + * Builds Frequency Info for Downlink + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) +{ + uint8_t idx; + uint8_t elementCnt; + DlCfgCommon dlCfg; + NR_MultiBandInfo_t *multiBandInfo; + + dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + + /* NR Multi-Band Info */ + elementCnt = ODU_VALUE_ONE; + frequencyInfoDL->frequencyBandList.list.count = elementCnt; + frequencyInfoDL->frequencyBandList.list.size = \ + elementCnt * sizeof(NR_MultiBandInfo_t); + + DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \ + frequencyInfoDL->frequencyBandList.list.size); + if(!frequencyInfoDL->frequencyBandList.list.array) + { + DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed"); + return RFAILED; + } + + for(idx = 0; idx < elementCnt; idx++) + { + DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\ + sizeof(NR_MultiBandInfo_t)); + if(!frequencyInfoDL->frequencyBandList.list.array[idx]) + { + DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed"); + return RFAILED; + } + } + + idx = 0; + multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx]; + + /* Frequency band indicator */ + DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t)); + if(!multiBandInfo->freqBandIndicatorNR) + { + DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed"); + return RFAILED; + } + *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd; + + /* Offset to Point A */ + frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA; + + /* Subcarrier Spacing specifc carrier */ + elementCnt = ODU_VALUE_ONE; + frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt; + frequencyInfoDL->scs_SpecificCarrierList.list.size = \ + elementCnt * sizeof(SCS_SpecificCarrier_t); + BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList); + + return ROK; +}/* BuildFreqInfoDl */ + +/******************************************************************* + * + * @brief Builds DL configuration common for SIB + * + * @details + * + * Function : BuildDlCfgCommSib + * + * Functionality: + * Builds DL configuration common for SIB + * + * @params[in] DownlinkConfigCommonSIB_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) +{ + /* DL frequency info */ + BuildFreqInfoDl(&dlCfg->frequencyInfoDL); + + /* BWP Downlink Common */ + BuildBwpDlCommon(&dlCfg->initialDownlinkBWP); + + /* BCCH Config */ + BuildBcchConfig(&dlCfg->bcch_Config); + + /* PCCH Config */ + BuildPcchConfig(&dlCfg->pcch_Config); + + return ROK; +} /* BuildDlCfgCommSib */ + +/******************************************************************* + * + * @brief Builds SCS specific carrier list for UL + * + * @details + * + * Function : BuildScsSpecificCarrierListUl + * + * Functionality: + * Builds SCS specific carrier list for UL + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildScsSpecificCarrierListUl +( +struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList +) +{ + uint8_t idx; + ScsSpecCarrier duScsSpecCarrier; + + duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier; + + DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size); + if(!scsCarrierList->list.array) + { + DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed"); + return RFAILED; + } + + for(idx = 0; idx < scsCarrierList->list.count; idx++) + { + DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t)); + if(!scsCarrierList->list.array[idx]) + { + DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed"); + return RFAILED; + } + } + idx = 0; + scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset; + scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs; + scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw; + + return ROK; +} /* End of BuildScsSpecificCarrierListUl */ + +/******************************************************************* + * + * @brief Builds frequency infor for UL + * + * @details + * + * Function : BuildFreqInfoUl + * + * Functionality: + * Builds frequency infor for UL + * + * @params[in] FrequencyInfoUL_SIB_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) +{ + uint8_t elementCnt; + UlCfgCommon ulCfg; + + ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + + /* Subcarrier Spacing specifc carrier */ + elementCnt = ODU_VALUE_ONE; + frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt; + frequencyInfoUL->scs_SpecificCarrierList.list.size = \ + elementCnt * sizeof(SCS_SpecificCarrier_t); + BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList); + + /* P-MAX */ + DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t)); + if(!frequencyInfoUL->p_Max) + { + DU_LOG("\nDU APP : UL Frequency Infoo memory allocation failure"); + return RFAILED; + } + *frequencyInfoUL->p_Max = ulCfg.pMax; + + return ROK; +}/* BuildFreqInfoUl */ + +/******************************************************************* + * + * @brief Builds RACH configuration common + * + * @details + * + * Function : BuildRachCfgCommon + * + * Functionality: + * Builds RACH configuration common + * + * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) +{ + RachCfgCommon duRachCfg; + RACH_ConfigCommon_t *setup; + + duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg; + + rachCfg->present = duRachCfg.present; + switch(rachCfg->present) + { + case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING: + { + //TODO + break; + } + case BWP_UplinkCommon__rach_ConfigCommon_PR_release: + { + //TODO + break; + } + case BWP_UplinkCommon__rach_ConfigCommon_PR_setup: + { + DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t)); + if(!rachCfg->choice.setup) + { + DU_LOG("\nDU APP : Rach Config memory alloc failed"); + return RFAILED; + } + setup = rachCfg->choice.setup; + + /* Generic RACH Configuration */ + setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx; + setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm; + setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart; + setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg; + setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr; + setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax; + setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep; + setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow; + + /* Total number of RA preambles */ + DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long)); + if(!setup->totalNumberOfRA_Preambles) + { + DU_LOG("\nDU APP : Rach Config memory alloc failed"); + return RFAILED; + } + *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble; + + /* SSB per RACH occassion and CB Preambles per SSB */ + DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\ + sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); + if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB) + { + DU_LOG("\nDU APP : Rach Config memory alloc failed"); + return RFAILED; + } + setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \ + duRachCfg.ssbPerRachOccPresent; + switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present) + { + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: + { + setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\ + duRachCfg.numSsbPerRachOcc; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: + { + //TODO + break; + } + case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: + { + //TODO + break; + } + default: + { + DU_LOG("\nDU APP: Invalid value for \ + ssb_PerRach_OccassionAndCB_PreamblesPerSSB"); + return RFAILED; + } + } + + /* RA Contention Resolution Timer */ + setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer; + + /* RSRP Threshold SSB */ + DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t)); + if(!setup->rsrp_ThresholdSSB) + { + DU_LOG("\nDU APP : Rach Config memory alloc failed"); + return RFAILED; + } + *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb; + + /* Root Sequence index */ + setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent; + switch(setup->prach_RootSequenceIndex.present) + { + case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING: + { + //TODO + break; + } + case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839: + { + //TODO + break;; + } + case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139: + { + setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx; + break; + } + default: + { + DU_LOG("\nDU APP: Inavlid PRACH root sequence index type"); + return RFAILED; + } + } + + /* Msg 1 Subcarrier spacing */ + DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t)); + if(!setup->msg1_SubcarrierSpacing) + { + DU_LOG("\nDU APP : Rach Config memory alloc failed"); + return RFAILED; + } + *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs; + + /* Restricted Set Config */ + setup->restrictedSetConfig = duRachCfg.restrictedSetCfg; + + break; + } + default: + { + DU_LOG("\nDU APP : Invalid RACH Config type "); + return RFAILED; + } + } + return ROK; +}/* BuildRachCfgCommon */ + +/******************************************************************* + * + * @brief Builds PUSCH configuration for common + * + * @details + * + * Function : BuildPuschCfgCommon + * + * Functionality: + * Builds PUSCH configuration for common + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) +{ + uint8_t idx; + uint8_t elementCnt; + PuschCfgCommon duPuschCfg; + PUSCH_ConfigCommon_t *setup; + PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo; + + duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg; + + puschCfg->present = duPuschCfg.present; + switch(puschCfg->present) + { + case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING: + { + //TODO + break; + } + case BWP_UplinkCommon__pusch_ConfigCommon_PR_release: + { + //TODO + break; + } + case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup: + { + DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t)); + if(!puschCfg->choice.setup) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + setup = puschCfg->choice.setup; + + /* Time Domain Resource Allocation List */ + DU_ALLOC(setup->pusch_TimeDomainAllocationList,\ + sizeof(PUSCH_TimeDomainResourceAllocationList_t)); + if(!setup->pusch_TimeDomainAllocationList) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + elementCnt = ODU_VALUE_ONE; + setup->pusch_TimeDomainAllocationList->list.count = elementCnt; + setup->pusch_TimeDomainAllocationList->list.size = \ + elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t); + + DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \ + setup->pusch_TimeDomainAllocationList->list.size); + if(!setup->pusch_TimeDomainAllocationList->list.array) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + + for(idx=0; idxpusch_TimeDomainAllocationList->list.array[idx],\ + sizeof(PUSCH_TimeDomainResourceAllocation_t)); + if(!setup->pusch_TimeDomainAllocationList->list.array[idx]) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + } + + idx = 0; + timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx]; + + /* K2 */ + DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long)); + if(!timeDomRsrcAllocInfo->k2) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2; + + timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType; + timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.startSymbAndLen; + + /* Msg3 Delta Preamble */ + DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long)); + if(!setup->msg3_DeltaPreamble) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble; + + /* P0 Nominal with grnat */ + DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long)); + if(!setup->p0_NominalWithGrant) + { + DU_LOG("\nDU APP : PUSCH Config memory alloc failed"); + return RFAILED; + } + *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant; + + break; + } + default: + { + DU_LOG("\nDU APP : Invalid PUSCH configuration type "); + return RFAILED; + } + } + + return ROK; +}/* BuildPuschCfgCommon */ + +/******************************************************************* + * + * @brief Builds PUCCH configuration common + * + * @details + * + * Function : BuildPucchCfgCommon + * + * Functionality: + * Builds PUCCH configuration common + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg) +{ + PucchCfgCommon duPucchCfg; + PUCCH_ConfigCommon_t *setup; + + duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg; + + pucchCfg->present = duPucchCfg.present; + switch(pucchCfg->present) + { + case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING: + { + //TODO + break; + } + case BWP_UplinkCommon__pucch_ConfigCommon_PR_release: + { + //TODO + break; + } + case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup: + { + DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t)); + if(!pucchCfg->choice.setup) + { + DU_LOG("\nDU APP : PUCCH Config memory alloc failed"); + return RFAILED; + } + setup = pucchCfg->choice.setup; + + /* Resource Common */ + DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long)); + if(!setup->pucch_ResourceCommon) + { + DU_LOG("\nDU APP : PUCCH Config memory alloc failed"); + return RFAILED; + } + *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm; + + /* Group hopping */ + setup->pucch_GroupHopping = duPucchCfg.grpHop; + + /* P0 nominal */ + DU_ALLOC(setup->p0_nominal, sizeof(long)); + if(!setup->p0_nominal) + { + DU_LOG("\nDU APP : PUCCH Config memory alloc failed"); + return RFAILED; + } + *setup->p0_nominal = duPucchCfg.p0Nominal; + + break; + } + default: + { + DU_LOG("\nDU APP : Invalid PUCCH Config type"); + return RFAILED; + } + } + return ROK; +}/* BuildPucchCfgCommon */ + +/******************************************************************* + * + * @brief Builds UL BWP Common + * + * @details + * + * Function : BuildBwpUlCommon + * + * Functionality: + * Builds UL BWP Common + * + * @params[in] BWP_UplinkCommon_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildBwpUlCommon(BWP_UplinkCommon_t *bwp) +{ + UlCfgCommon duUlCfg; + + duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + + bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw; + bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs; + + /* RACH Config Common */ + DU_ALLOC(bwp->rach_ConfigCommon,\ + sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); + if(!bwp->rach_ConfigCommon) + { + DU_LOG("\nDU APP : UL BWP memory allocation failed"); + return RFAILED; + } + BuildRachCfgCommon(bwp->rach_ConfigCommon); + + /* PUSCH Config Common */ + DU_ALLOC(bwp->pusch_ConfigCommon,\ + sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); + if(!bwp->pusch_ConfigCommon) + { + DU_LOG("\nDU APP : UL BWP memory allocation failed"); + return RFAILED; + } + BuildPuschCfgCommon(bwp->pusch_ConfigCommon); + + /* PUCCH Config Common */ + DU_ALLOC(bwp->pucch_ConfigCommon,\ + sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); + if(!bwp->pucch_ConfigCommon) + { + DU_LOG("\nDU APP : UL BWP memory allocation failed"); + return RFAILED; + } + BuildPucchCfgCommon(bwp->pucch_ConfigCommon); + + return ROK; +}/* BuildBwpUlCommon */ + +/******************************************************************* + * + * @brief Builds UL config common for SIB + * + * @details + * + * Function : BuildUlCfgCommSib + * + * Functionality: + * Builds UL config common for SIB + * + * @params[in] UplinkConfigCommonSIB_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) +{ + /* UL frequency info */ + BuildFreqInfoUl(&ulCfg->frequencyInfoUL); + + /* BWP Uplink Common */ + BuildBwpUlCommon(&ulCfg->initialUplinkBWP); + + /* Time Alignment timer */ + ulCfg->timeAlignmentTimerCommon = \ + duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm; + + return ROK; +}/* BuildUlCfgCommSib */ + +/******************************************************************* + * + * @brief Builds TDD UL DL configuration common + * + * @details + * + * Function : BuildTddUlDlCfgComm + * + * Functionality: + * Builds TDD UL DL configuration common + * + * @params[in] TDD_UL_DL_ConfigCommon_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +S16 BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg) +{ + TddUlDlCfgCommon duTddCfg; + + duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg; + + /* Reference Subcarrier spacing */ + tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs; + + /* Pattern 1*/ + tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd; + tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots; + tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols; + tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots; + tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols; + + return ROK; + +}/* BuildTddUlDlCfgComm */ + +/******************************************************************* + * + * @brief Builds Serving cell config common in SIB1 message + * + * @details + * + * Function : BuildServCellCfgCommonSib + * + * Functionality: + * Building Serving cell config common in SIB1 message + * + * @params[in] ServingCellConfigCommonSIB_t pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) +{ + SrvCellCfgCommSib duSrvCellCfg; + BIT_STRING_t *ssbPosInBurst; + + duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib; + + /* SSB Position in Burst */ + ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup; + ssbPosInBurst->size = 1; + DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t)); + if(!ssbPosInBurst->buf) + { + DU_LOG("\nDU APP : Serving cell config common memory allocation failure"); + return RFAILED; + } + ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst; + ssbPosInBurst->bits_unused = 0; + + srvCellCfg->ssb_PeriodicityServingCell = duSrvCellCfg.ssbPrdServingCell; + srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr; + + /* Downlink config common */ + BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon); + + /* Uplink Config Comm */ + DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t)); + if(!srvCellCfg->uplinkConfigCommon) + { + DU_LOG("\nDU APP : Serving cell config common memory allocation failure"); + return RFAILED; + } + BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon); + + /* TDD UL DL Config Comm */ + DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t)); + if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon) + { + DU_LOG("\nDU APP : Serving cell config common memory allocation failure"); + return RFAILED; + } + BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon); + + return ROK; +} + +/******************************************************************* + * + * @brief Builds SIB message in Served Cell Info + * + * @details + * + * Function : BuildSib1Msg + * + * Functionality: Building SIB message in Served Cell Info + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +int BuildSib1Msg() +{ + SIB1_t *sib1Msg; + CellAccessRelatedInfo_t *cellAccessInfo; + U8 elementCnt; + U8 idx, idx1, idx2; + asn_enc_rval_t encRetVal; + TrackingAreaCode_t *tac; + RAN_AreaCode_t *ranac; + CellIdentity_t *cellIdentity; + SIB_Mapping_t *sibMapInfo; + ServingCellConfigCommonSIB_t *srvCellCfg; + DownlinkConfigCommonSIB_t *dlCfg; + UplinkConfigCommonSIB_t *ulCfg; + FrequencyInfoDL_SIB_t *frequencyInfoDL; + FrequencyInfoUL_SIB_t *frequencyInfoUL; + BWP_DownlinkCommon_t *bwpDl; + BWP_UplinkCommon_t *bwpUl; + PDCCH_ConfigCommon_t *pdcchSetup; + SearchSpace_t *pdcchSearchSpace; + PDSCH_ConfigCommon_t *pdschSetup; + RACH_ConfigCommon_t *rachSetup; + PUSCH_ConfigCommon_t *puschSetup; + PUCCH_ConfigCommon_t *pucchSetup; + struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo; + struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList; + struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg; + struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg; + struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg; + struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg; + struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg; + struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList; + struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierListUl; + struct PDCCH_ConfigCommon__commonSearchSpaceList *pdcchSearchSpclist; + + + DU_ALLOC(sib1Msg, sizeof(SIB1_t)); + if(!sib1Msg) + { + DU_LOG("DU APP: SIB1 msg memory allocation failure"); + return RFAILED; + } + + elementCnt = ODU_VALUE_ONE; + + /* PLMN list */ + cellAccessInfo = &sib1Msg->cellAccessRelatedInfo; + cellAccessInfo->plmn_IdentityList.list.count = + elementCnt; + cellAccessInfo->plmn_IdentityList.list.size + = elementCnt * sizeof(PLMN_IdentityInfo_t); + + BuildPlmnList(cellAccessInfo); + + /* Connection Establish Failure Control */ + DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t)); + if(!sib1Msg->connEstFailureControl) + { + DU_LOG("DU APP: sib1Msg->connEstFailureControl memory allocation failure"); + return RFAILED; + } + sib1Msg->connEstFailureControl->connEstFailCount =\ + duCfgParam.sib1Params.connEstFailCnt; + sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\ + duCfgParam.sib1Params.connEstFailOffValidity; + + /* SI Scheduling Info */ + DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t)); + if(!sib1Msg->si_SchedulingInfo) + { + DU_LOG("DU APP: sib1Msg->si_SchedulingInfo memory allocation failure"); + return RFAILED; + } + elementCnt = ODU_VALUE_ONE; + sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt; + sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt * sizeof(struct SchedulingInfo); + BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList); + sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen; + + /* Serving Cell Config Common */ + DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t)); + if(!sib1Msg->servingCellConfigCommon) + { + DU_LOG("DU APP: sib1Msg->servingCellConfigCommon memory allocation failure"); + return RFAILED; + } + BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon); + + + xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\ + encBuf); + printf("\nencbufSize: %d\n", encBufSize); + if(encRetVal.encoded == -1) + { + DU_LOG("\nDU APP : Could not encode SIB1 structure (at %s)\n",\ + encRetVal.failed_type ? + encRetVal.failed_type->name : + "unknown"); + return RFAILED; + } + for(int i=0; i< encBufSize; i++) + { + printf("%x\t",encBuf[i]); + } + printf("\n"); + + /* Free allocated memeory */ + + /* Free serving cell config common */ + srvCellCfg = sib1Msg->servingCellConfigCommon; + + /* Free downling config common */ + dlCfg = &srvCellCfg->downlinkConfigCommon; + + /* Free DL frequency info */ + frequencyInfoDL = &dlCfg->frequencyInfoDL; + + for(idx = 0; idx < frequencyInfoDL->frequencyBandList.list.count; idx++) + { + DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx]->\ + freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t)); + DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\ + sizeof(NR_MultiBandInfo_t)); + } + DU_FREE(frequencyInfoDL->frequencyBandList.list.array, \ + frequencyInfoDL->frequencyBandList.list.size); + + scsCarrierList = &frequencyInfoDL->scs_SpecificCarrierList; + for(idx = 0; idx < scsCarrierList->list.count; idx++) + { + DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t)); + } + DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size); + + /* Free BWP DL common */ + bwpDl = &dlCfg->initialDownlinkBWP; + + /* Free PDCCH config common */ + pdcchCfg = bwpDl->pdcch_ConfigCommon; + pdcchSetup = pdcchCfg->choice.setup; + + DU_FREE(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t)); + DU_FREE(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t)); + + pdcchSearchSpclist = pdcchSetup->commonSearchSpaceList; + for(idx = 0; idx < pdcchSearchSpclist->list.count; idx++) + { + pdcchSearchSpace = pdcchSearchSpclist->list.array[idx]; + + DU_FREE(pdcchSearchSpace->controlResourceSetId, \ + sizeof(ControlResourceSetId_t)); + DU_FREE(pdcchSearchSpace->monitoringSlotPeriodicityAndOffset,\ + sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset)); + DU_FREE(pdcchSearchSpace->monitoringSymbolsWithinSlot->buf, \ + pdcchSearchSpace->monitoringSymbolsWithinSlot->size * sizeof(uint8_t)); + DU_FREE(pdcchSearchSpace->monitoringSymbolsWithinSlot,\ + sizeof(BIT_STRING_t)); + DU_FREE(pdcchSearchSpace->nrofCandidates,\ + sizeof(struct SearchSpace__nrofCandidates)); + DU_FREE(pdcchSearchSpace->searchSpaceType->choice.common->\ + dci_Format0_0_AndFormat1_0, sizeof(struct \ + SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); + DU_FREE(pdcchSearchSpace->searchSpaceType->choice.common,\ + sizeof(struct SearchSpace__searchSpaceType__common)); + DU_FREE(pdcchSearchSpace->searchSpaceType,\ + sizeof( struct SearchSpace__searchSpaceType)); + + DU_FREE(pdcchSearchSpclist->list.array[idx], sizeof(SearchSpace_t)); + } + DU_FREE(pdcchSearchSpclist->list.array, pdcchSearchSpclist->list.size); + + DU_FREE(pdcchSetup->commonSearchSpaceList,\ + sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList)); + DU_FREE(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t)); + DU_FREE(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t)); + DU_FREE(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t)); + + DU_FREE(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t)); + DU_FREE(bwpDl->pdcch_ConfigCommon, \ + sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); + + /* Free PDSCH Config Common */ + pdschCfg = bwpDl->pdsch_ConfigCommon; + pdschSetup = pdschCfg->choice.setup; + + for(idx=0; idxpdsch_TimeDomainAllocationList->list.count; idx++) + { + DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx]->k0, \ + sizeof(long)); + DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\ + sizeof(PDSCH_TimeDomainResourceAllocation_t)); + } + DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\ + pdschSetup->pdsch_TimeDomainAllocationList->list.size); + DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList, \ + sizeof(PDSCH_TimeDomainResourceAllocationList_t)); + DU_FREE(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t)); + DU_FREE(bwpDl->pdsch_ConfigCommon, \ + sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon)); + + /* Free Uplink Config Common */ + ulCfg = srvCellCfg->uplinkConfigCommon; + + /* Free UL Frequency Info */ + frequencyInfoUL = &ulCfg->frequencyInfoUL; + scsCarrierListUl = &frequencyInfoUL->scs_SpecificCarrierList; + for(idx = 0; idx < scsCarrierListUl->list.count; idx++) + { + DU_FREE(scsCarrierListUl->list.array[idx], sizeof(SCS_SpecificCarrier_t)); + } + DU_FREE(scsCarrierListUl->list.array, scsCarrierList->list.size); + DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t)); + + /* Free BWP Uplink common */ + bwpUl = &ulCfg->initialUplinkBWP; + + /* Free RACH config Common */ + rachCfg = bwpUl->rach_ConfigCommon; + rachSetup = rachCfg->choice.setup; + DU_FREE(rachSetup->totalNumberOfRA_Preambles, sizeof(long)); + DU_FREE(rachSetup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\ + sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); + DU_FREE(rachSetup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t)); + DU_FREE(rachSetup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t)); + DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t)); + DU_FREE(bwpUl->rach_ConfigCommon, \ + sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); + + /* Free PUSCH Config Common */ + puschCfg = bwpUl->pusch_ConfigCommon; + puschSetup = puschCfg->choice.setup; + for(idx=0; idxpusch_TimeDomainAllocationList->list.count; idx++) + { + DU_FREE(puschSetup->pusch_TimeDomainAllocationList->list.array[idx]->k2,\ + sizeof(long)); + DU_FREE(puschSetup->pusch_TimeDomainAllocationList->list.array[idx],\ + sizeof(PUSCH_TimeDomainResourceAllocation_t)); + } + DU_FREE(puschSetup->pusch_TimeDomainAllocationList->list.array, \ + puschSetup->pusch_TimeDomainAllocationList->list.size); + DU_FREE(puschSetup->pusch_TimeDomainAllocationList,\ + sizeof(PUSCH_TimeDomainResourceAllocationList_t)); + DU_FREE(puschSetup->msg3_DeltaPreamble, sizeof(long)); + DU_FREE(puschSetup->p0_NominalWithGrant, sizeof(long)); + DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t)); + DU_FREE(bwpUl->pusch_ConfigCommon,\ + sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); + + + /* Free PUCCH Config Common */ + pucchCfg = bwpUl->pucch_ConfigCommon; + pucchSetup = pucchCfg->choice.setup; + DU_FREE(pucchSetup->pucch_ResourceCommon, sizeof(long)); + DU_FREE(pucchSetup->p0_nominal, sizeof(long)); + DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t)); + DU_FREE(bwpUl->pucch_ConfigCommon,\ + sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); + + DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t)); + + DU_FREE(srvCellCfg->ssb_PositionsInBurst.inOneGroup.buf, \ + srvCellCfg->ssb_PositionsInBurst.inOneGroup.size * sizeof(uint8_t)); + DU_FREE(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t)); + + /* Free PLMN List */ + + for(idx=0; idxplmn_IdentityList.list.count; idx++) + { + plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\ + plmn_IdentityList; + for(idx1=0; idx1list.count; idx1++) + { + for(idx2=0; idx2list.array[idx1]->mnc.list.count; idx2++) + { + DU_FREE(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2], + sizeof(MCC_MNC_Digit_t)); + DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2], + sizeof(MCC_MNC_Digit_t)); + } + DU_FREE(plmnIdInfo->list.array[idx1]->mcc->list.array, + plmnIdInfo->list.array[idx1]->mcc->list.size); + DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array, + plmnIdInfo->list.array[idx1]->mnc.list.size); + DU_FREE(plmnIdInfo->list.array[idx1]->mcc, + sizeof(MCC_t)); + DU_FREE(plmnIdInfo->list.array[idx1], + sizeof(PLMN_IdentitY_t)); + } + DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx], + sizeof(PLMN_IdentityInfo_t)); + cellIdentity =\ + &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity; + DU_FREE(cellIdentity->buf, cellIdentity->size); + + ranac = cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac; + DU_FREE(ranac, sizeof(RAN_AreaCode_t)); + + tac = cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode; + DU_FREE(tac->buf, tac->size); + DU_FREE(tac, sizeof(TrackingAreaCode_t)); + } + DU_FREE(cellAccessInfo->plmn_IdentityList.list.array, + cellAccessInfo->plmn_IdentityList.list.size); + + si_SchedulingInfoList = &sib1Msg->si_SchedulingInfo->schedulingInfoList; + for(idx = 0; idx < si_SchedulingInfoList->list.count; idx++) + { + sibMapInfo = &si_SchedulingInfoList->list.array[idx]->sib_MappingInfo; + for(idx1 = 0; idx1 < sibMapInfo->list.count; idx1++) + { + DU_FREE(sibMapInfo->list.array[idx1]->valueTag, sizeof(long)); + DU_FREE(sibMapInfo->list.array[idx1], sizeof(SIB_TypeInfo_t)); + } + DU_FREE(sibMapInfo->list.array, sibMapInfo->list.size); + DU_FREE(si_SchedulingInfoList->list.array[idx], sizeof(struct SchedulingInfo)); + } + DU_FREE(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size); + DU_FREE(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t)); + DU_FREE(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t)); DU_FREE(sib1Msg, sizeof(SIB1_t)); return ROK; diff --git a/src/du_app/du_sys_info_hdl.h b/src/du_app/du_sys_info_hdl.h index 98dd35481..33fede18d 100644 --- a/src/du_app/du_sys_info_hdl.h +++ b/src/du_app/du_sys_info_hdl.h @@ -26,6 +26,10 @@ #define ODU_VALUE_FOUR 4 #define ODU_VALUE_FIVE 5 #define ODU_VALUE_SEVEN 7 +#define ODU_VALUE_EIGHT 8 +#define ODU_VALUE_NINE 9 +#define ODU_VALUE_TEN 10 + /* Function declarations */ int BuildMibPdu(); diff --git a/src/phy_stub/l1_bdy2.c b/src/phy_stub/l1_bdy2.c index 7a800afc7..61b1f30d0 100644 --- a/src/phy_stub/l1_bdy2.c +++ b/src/phy_stub/l1_bdy2.c @@ -9,18 +9,19 @@ void *GenerateTicks(void *arg) while(1) { sleep(1); - printf("\nTTI indication"); - /* Send TTI indication to CL */ - duSendEgtpTTIInd(); + printf("\nPHY STUB : Slot indication"); + + /* Send Slot indication indication to lower mac */ + //buildAndSendSlotIndication(); } } -void duStartTtiThread() +void duStartSlotIndicaion() { - pthread_t ttiThread; + pthread_t thread; int ret; - ret = pthread_create(&ttiThread, NULL, GenerateTicks, NULL); + ret = pthread_create(&thread, NULL, GenerateTicks, NULL); if(ret) { printf("\nUnable to create thread");