From d1ead035ab3b543810f1838b2519904bf84477ec Mon Sep 17 00:00:00 2001 From: balajihands Date: Thu, 12 Mar 2020 16:28:21 +0530 Subject: [PATCH] macCellCfg Change-Id: I970b68f7196a0618c6e3f52ae255bbfe3a4b3c10 Signed-off-by: balajihands --- build/common/mac.mak | 1 + src/5gnrmac/lwr_mac.h | 4 +- src/5gnrmac/rg.x | 1 + src/5gnrmac/rg_cfg.c | 1 + src/5gnrmac/rg_cl.h | 4 +- src/5gnrmac/rg_cl_cfg.c | 8 +- src/5gnrmac/rg_cl_li.c | 6 +- src/5gnrmac/rg_cl_util.c | 1 - src/5gnrmac/rg_com.c | 1 + src/5gnrmac/rg_dbm.c | 1 + src/5gnrmac/rg_dhm.c | 1 + src/5gnrmac/rg_dux.c | 1 + src/5gnrmac/rg_ex_ms.c | 5 + src/5gnrmac/rg_l2m.c | 1 + src/5gnrmac/rg_lim.c | 1 + src/5gnrmac/rg_lmm.c | 95 ++++++++++++++++- src/5gnrmac/rg_mux.c | 1 + src/5gnrmac/rg_pom_scell.c | 1 + src/5gnrmac/rg_prg.c | 1 + src/5gnrmac/rg_prg_pt.c | 1 + src/5gnrmac/rg_ram.c | 1 + src/5gnrmac/rg_rom.c | 1 + src/5gnrmac/rg_tom.c | 1 + src/5gnrmac/rg_uhm.c | 1 + src/5gnrmac/rg_uim.c | 1 + src/5gnrmac/rg_utl.c | 1 + src/cm/cm_gen.c | 20 ++++ src/cm/lrg.h | 1 - src/cm/lrg.x | 2 - src/cm/mac_interface.c | 246 +++++++++++++++++++++++++++++++++++++++++++++ src/cm/mac_interface.h | 232 ++++++++++++++++++++++++++++++++++++++++++ src/du_app/du_cell_mgr.c | 7 +- src/du_app/du_cfg.c | 152 ++++++++++++++-------------- src/du_app/du_cfg.h | 5 +- src/du_app/du_mgr.h | 4 +- src/du_app/du_mgr_ex_ms.c | 7 +- src/du_app/du_msg_hdl.c | 96 ++++++++++++++++++ 37 files changed, 815 insertions(+), 99 deletions(-) create mode 100644 src/cm/mac_interface.c create mode 100644 src/cm/mac_interface.h diff --git a/build/common/mac.mak b/build/common/mac.mak index 76feb8a95..f26441904 100644 --- a/build/common/mac.mak +++ b/build/common/mac.mak @@ -32,6 +32,7 @@ HDR_FILES+=$(wildcard $(CM_DIR)/crg.[hx]) HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) HDR_FILES+=$(wildcard $(CM_DIR)/rgr.[hx]) HDR_FILES+=$(wildcard $(CM_DIR)/rgm.[hx]) +HDR_FILES+=$(wildcard $(CM_DIR)/mac*.[hx]) # Add the product specific header files HDR_FILES+= $(wildcard $(SRC_DIR)/*.[hx]) diff --git a/src/5gnrmac/lwr_mac.h b/src/5gnrmac/lwr_mac.h index 2ceb98775..ea9cd95f5 100644 --- a/src/5gnrmac/lwr_mac.h +++ b/src/5gnrmac/lwr_mac.h @@ -31,7 +31,7 @@ #include "ssi.x" #include "cm_hash.x" #include "cm_lib.x" -#include "lcl.h" +#include "mac_interface.h" typedef enum { @@ -64,7 +64,7 @@ typedef struct clCb typedef struct cellCb { U16 cellId; - ClCellCfg cellCfg; + MacCellCfg cellCfg; PhyState phyState; }ClCellCb; diff --git a/src/5gnrmac/rg.x b/src/5gnrmac/rg.x index 73c0d9012..a4a1e9ac4 100755 --- a/src/5gnrmac/rg.x +++ b/src/5gnrmac/rg.x @@ -649,6 +649,7 @@ struct _rgCb RgCellCb *prevCell; /*!< Reference of last accessed cellCb*/ U8 bufCnt; /*!< Count of buffers in buffersToFree[] */ Buffer *bufToFree[RG_MAX_DFRD_FREE_BUFS];/*!< List of Shared Buffers to be freed */ + MacCellCfg macCellCfg; /* MAC cell config paramters */ }; /* Declaration for RgCb */ diff --git a/src/5gnrmac/rg_cfg.c b/src/5gnrmac/rg_cfg.c index c0220a0dd..f0cea9cef 100755 --- a/src/5gnrmac/rg_cfg.c +++ b/src/5gnrmac/rg_cfg.c @@ -73,6 +73,7 @@ static int RLOG_MODULE_ID=4096; #include "crg.x" /* CRG interface includes */ #include "rg_sch_inf.x" /* SCH interface typedefs */ #include "rg_prg.x" /* PRG (MAC-MAC) Interface typedefs */ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ #ifdef LTE_ADV #include "rg_pom_scell.x" diff --git a/src/5gnrmac/rg_cl.h b/src/5gnrmac/rg_cl.h index f1ec0cc04..79c3491c2 100644 --- a/src/5gnrmac/rg_cl.h +++ b/src/5gnrmac/rg_cl.h @@ -31,7 +31,7 @@ #include "ssi.x" #include "cm_hash.x" #include "cm_lib.x" -#include "lcl.h" +#include "mac_interface.h" typedef enum { @@ -66,7 +66,7 @@ typedef struct clCb typedef struct cellCb { U16 cellId; - ClCellCfg cellCfg; + MacCellCfg cellCfg; PhyState phyState; }ClCellCb; diff --git a/src/5gnrmac/rg_cl_cfg.c b/src/5gnrmac/rg_cl_cfg.c index 8d8f32f16..e08d724f5 100644 --- a/src/5gnrmac/rg_cl_cfg.c +++ b/src/5gnrmac/rg_cl_cfg.c @@ -28,7 +28,7 @@ #include "cm_hash.x" #include "cm_lib.x" -#include "lcl.h" +#include "mac_interface.h" #include "lwr_mac.h" EXTERN S16 rgClBldAndSndFAPICfgReq ARGS((ClCellCb *cellCb)); @@ -51,7 +51,7 @@ EXTERN S16 rgClBldAndSndFAPICfgReq ARGS((ClCellCb *cellCb)); * ****************************************************************/ PRIVATE S16 rgClVldtCellCfg ( -ClCellCfg *cellCfg +MacCellCfg *cellCfg ) { RETVALUE(ROK); @@ -76,7 +76,7 @@ ClCellCfg *cellCfg * ****************************************************************/ PUBLIC U16 RgClCellCfgReq ( -ClCellCfg *cellCfg +MacCellCfg *cellCfg ) { ClCellCb *cellCb = NULLP; @@ -115,7 +115,7 @@ ClCellCfg *cellCfg clGlobalCp.numOfCells++; } - cmMemcpy((U8 *)&cellCb->cellCfg, (U8 *)cellCfg, sizeof(ClCellCfg)); + cmMemcpy((U8 *)&cellCb->cellCfg, (U8 *)cellCfg, sizeof(MacCellCfg)); /* Build and send CONFIG request to PHY */ if(rgClBldAndSndFAPICfgReq(cellCb) != ROK ) diff --git a/src/5gnrmac/rg_cl_li.c b/src/5gnrmac/rg_cl_li.c index 673fb0594..30104d5aa 100644 --- a/src/5gnrmac/rg_cl_li.c +++ b/src/5gnrmac/rg_cl_li.c @@ -27,7 +27,7 @@ #include "ssi.x" #include "cm_hash.x" -#include "lcl.h" +#include "mac_interface.h" #include "lwr_mac.h" #include "rg_cl_phy.h" #include "fapi.h" @@ -138,7 +138,7 @@ ClCellCb *cellCb U8 *configTlvs; L1L2ConfigReq *FAPIConfigReq; L1L2Tlv *nextTlv; - ClCellCfg cellCfg; + MacCellCfg cellCfg; FAPIConfigReqSize = sizeof(L1L2ConfigReq) + (cellCb->cellCfg.numTlv * sizeof(L1L2Tlv)); @@ -186,7 +186,7 @@ ClCellCb *cellCb /* Filling SSB configuration */ fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SS_PBCH_PWR, sizeof(U16), cellCfg.ssbCfg.ssbPbchPwr, &msgLen); - fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BCH_PAYLOAD, sizeof(U16), cellCfg.ssbCfg.bchPayload, &msgLen); + fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BCH_PAYLOAD, sizeof(U16), cellCfg.ssbCfg.bchPayloadOption, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SCS_COMM, sizeof(U16), cellCfg.ssbCfg.scsCmn, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_OFFS_POINT_A, sizeof(U16), cellCfg.ssbCfg.ssbPrbOffset, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BETA_PSS, sizeof(U16), cellCfg.ssbCfg.betaPss, &msgLen); diff --git a/src/5gnrmac/rg_cl_util.c b/src/5gnrmac/rg_cl_util.c index edd749741..33403ef7d 100644 --- a/src/5gnrmac/rg_cl_util.c +++ b/src/5gnrmac/rg_cl_util.c @@ -24,7 +24,6 @@ #include "gen.x" #include "cm_hash.h" #include "cm_hash.x" -#include "lcl.h" #include "lwr_mac.h" /******************************************************************* diff --git a/src/5gnrmac/rg_com.c b/src/5gnrmac/rg_com.c index 9d95fecfa..46b72c026 100755 --- a/src/5gnrmac/rg_com.c +++ b/src/5gnrmac/rg_com.c @@ -73,6 +73,7 @@ static int RLOG_MODULE_ID=4096; #include "tfu.x" #include "rg_sch_inf.x" #include "rg_prg.x" /* PRG interface typedefs*/ +#include "mac_interface.h" #include "rg.x" #ifdef LTE_ADV #include "rg_pom_scell.x" diff --git a/src/5gnrmac/rg_dbm.c b/src/5gnrmac/rg_dbm.c index 936d4d0f3..b2505132f 100755 --- a/src/5gnrmac/rg_dbm.c +++ b/src/5gnrmac/rg_dbm.c @@ -67,6 +67,7 @@ #include "tfu.x" #include "rg_sch_inf.x" #include "rg_prg.x" /* PRG interface typedefs*/ +#include "mac_interface.h" #include "rg.x" diff --git a/src/5gnrmac/rg_dhm.c b/src/5gnrmac/rg_dhm.c index d77c3b428..493a4e5cc 100755 --- a/src/5gnrmac/rg_dhm.c +++ b/src/5gnrmac/rg_dhm.c @@ -78,6 +78,7 @@ static int RLOG_MODULE_ID=4096; #include "tfu.x" #include "rg_sch_inf.x" #include "rg_prg.x" /* PRG interface typedefs */ +#include "mac_interface.h" #include "rg.x" #ifdef L2_OPTMZ diff --git a/src/5gnrmac/rg_dux.c b/src/5gnrmac/rg_dux.c index 2498f8170..b2b58b89f 100755 --- a/src/5gnrmac/rg_dux.c +++ b/src/5gnrmac/rg_dux.c @@ -79,6 +79,7 @@ static int RLOG_MODULE_ID=4096; #include "rgu.x" /* RGU Interface includes */ #include "lrg.x" /* LRG Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ /* local defines */ diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index 39eda9786..65f5fa228 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -73,6 +73,7 @@ registered with SSI during the LTE MAC Task initialization. #include "crg.x" /* CRG interface typedes */ #include "rg_sch_inf.x" /* SCH interface typedefs */ #include "rg_prg.x" /*PRG interface includes*/ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ @@ -131,6 +132,10 @@ Buffer *mBuf; /* message buffer */ cmUnpkLrgStsReq(RgMiLrgStsReq, pst, mBuf); break; #endif /* LCRGMILRG */ + case EVENT_MAC_CELL_CONFIG_REQ: + /* Process MAC cell config */ + cmUnpackLwLcMacCellCfg(unpackMacCellCfgReq, pst, mBuf); + break; default: RG_FREE_MSG(mBuf); break; diff --git a/src/5gnrmac/rg_l2m.c b/src/5gnrmac/rg_l2m.c index 2018b9b1b..7ecdafabc 100755 --- a/src/5gnrmac/rg_l2m.c +++ b/src/5gnrmac/rg_l2m.c @@ -69,6 +69,7 @@ #include "crg.x" /* layer management typedefs for MAC */ #include "rg_sch_inf.x" /* typedefs for Scheduler */ #include "rg_prg.x" /* typedefs for PRG interface */ +#include "mac_interface.h" #include "rg.x" /* MAC types */ #ifdef LTE_L2_MEAS diff --git a/src/5gnrmac/rg_lim.c b/src/5gnrmac/rg_lim.c index 2d3188109..44c04515c 100755 --- a/src/5gnrmac/rg_lim.c +++ b/src/5gnrmac/rg_lim.c @@ -72,6 +72,7 @@ static int RLOG_MODULE_ID=4096; #include "crg.x" /* layer management typedefs for MAC */ #include "rg_sch_inf.x" /* SCH interface typedefs */ #include "rg_prg.x" /* PRG interface typedefs */ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ /* local defines */ diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index ced3b0679..4352ce38f 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -75,6 +75,7 @@ static int RLOG_MODULE_ID=4096; #include "rg_prg.x" /* PRG Interface includes */ #include "lrg.x" /* LRG Interface includes */ #include "rgr.x" /* LRG Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ #ifdef SS_DIAG #include "ss_diag.h" /* Common log file */ @@ -129,6 +130,16 @@ RgMngmt *cfm, Pst *cfmPst )); +extern U16 cmPackLcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); +extern U16 cmPackTcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); +extern U16 cmPackLwlcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); + +packMacCellCfgCfm packMacCellCfmMt[] = +{ + cmPackLcMacCellCfgCfm, /* packing for loosely coupled */ + cmPackTcMacCellCfgCfm, /* packing for tightly coupled */ + cmPackLwlcMacCellCfgCfm, /* packing for light weight loosly coupled */ +}; /** * @brief Task Initiation callback function. @@ -298,8 +309,6 @@ RgMngmt *cfg; /* config structure */ case STTFUSAP: reason = rgLMMSapCfg(inst,&cfg->t.cfg, cfg->hdr.elmId.elmnt); break; - case STCLCELL: - reason = RgClCellCfgReq(&cfg->t.cfg.s.cellCfg); default: ret = LCM_PRIM_NOK; reason = LCM_REASON_INVALID_ELMNT; @@ -2053,6 +2062,88 @@ PUBLIC S16 MacSchCfgReq(pst, transId, cfgReqInfo) } /* end of MacSchCfgReq*/ +/*********************************************************** + * + * Func : macCellCfgFillCfmPst + * + * + * Desc : Fills the Confirmation Post Structure cfmPst + * + * Ret : Void + * + * Notes: + * + * File : rg_lmm.c + * + **********************************************************/ +Void macCellCfgFillCfmPst +( +Pst *reqPst, +Pst *cfmPst +) +{ + Inst inst; + inst = reqPst->dstInst; + + cfmPst->srcEnt = rgCb[inst].rgInit.ent; + cfmPst->srcInst = rgCb[inst].rgInit.inst; + cfmPst->srcProcId = rgCb[inst].rgInit.procId; + + cfmPst->srcEnt = reqPst->dstEnt; + cfmPst->dstEnt = reqPst->srcEnt; + cfmPst->srcInst = reqPst->dstInst; + cfmPst->dstInst = reqPst->srcInst; + cfmPst->srcProcId = reqPst->dstProcId; + cfmPst->dstProcId = reqPst->srcProcId; + + cfmPst->selector = LRG_SEL_LC; + cfmPst->prior = reqPst->prior; + cfmPst->route = reqPst->route; + cfmPst->region = reqPst->region; + cfmPst->pool = reqPst->pool; + cfmPst->event = EVENT_MAC_CELL_CONFIG_CFM; + + RETVOID; +} + +/** + * @brief Layer Manager Configuration request handler. + * + * @details + * + * Function : unpackMacCellCfgReq + * + * This function handles the gNB and cell configuration + * request received from DU APP. + * This API unapcks and forwards the config towards SCH + * + * @param[in] Pst *pst + * @param[in] MacCellCfg *macCellCfg + * @return S16 + * -# ROK + **/ +S16 unpackMacCellCfgReq +( + Pst *pst, + MacCellCfg *macCellCfg +) +{ + U16 ret = ROK; + MacCellCfgCfm macCellCfgCfm; + Pst cnfPst; + Inst inst = pst->dstInst; + + memcpy(&rgCb[inst].macCellCfg,macCellCfg,sizeof(MacCellCfg)); + + macCellCfgFillCfmPst(pst,&cnfPst); + + macCellCfgCfm.transId = macCellCfg->transId; + //ret = cmPackLcMacCellCfgCfm(&cnfPst,&macCellCfgCfm); + ret = (*packMacCellCfmMt[cnfPst.selector])(&cnfPst,&macCellCfgCfm); + return ret; +} /* end of unpackMacCellCfgReq */ + + /********************************************************************** End of file diff --git a/src/5gnrmac/rg_mux.c b/src/5gnrmac/rg_mux.c index 6849151d5..748ccd109 100755 --- a/src/5gnrmac/rg_mux.c +++ b/src/5gnrmac/rg_mux.c @@ -79,6 +79,7 @@ static int RLOG_MODULE_ID=4096; #include "rgu.x" /* RGU Interface includes */ #include "lrg.x" /* LRG Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ #include "ss_queue.h" #include "ss_queue.x" diff --git a/src/5gnrmac/rg_pom_scell.c b/src/5gnrmac/rg_pom_scell.c index dda848f51..199cf5cca 100755 --- a/src/5gnrmac/rg_pom_scell.c +++ b/src/5gnrmac/rg_pom_scell.c @@ -69,6 +69,7 @@ #include "tfu.x" #include "rg_sch_inf.x" #include "rg_prg.x" /* PRG interface typedefs*/ +#include "mac_interface.h" #include "rg.x" #ifdef LTE_ADV #include "rg_pom_scell.x" diff --git a/src/5gnrmac/rg_prg.c b/src/5gnrmac/rg_prg.c index b4d3f9cfb..716c6260a 100755 --- a/src/5gnrmac/rg_prg.c +++ b/src/5gnrmac/rg_prg.c @@ -65,6 +65,7 @@ #include "crg.x" /* layer management typedefs for MAC */ #include "rg_sch_inf.x" /* layer management typedefs for MAC */ #include "rg_prg.x" /* Prg(MAC-MAC)interface includes */ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ #ifdef LTE_ADV diff --git a/src/5gnrmac/rg_prg_pt.c b/src/5gnrmac/rg_prg_pt.c index f8060546f..140142f0e 100755 --- a/src/5gnrmac/rg_prg_pt.c +++ b/src/5gnrmac/rg_prg_pt.c @@ -65,6 +65,7 @@ #include "crg.x" /* layer management typedefs for MAC */ #include "rg_sch_inf.x" /* layer management typedefs for MAC */ #include "rg_prg.x" /* PRG interface typedefs*/ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ #ifdef LTE_ADV diff --git a/src/5gnrmac/rg_ram.c b/src/5gnrmac/rg_ram.c index 7ed0d98bf..fbfd01f79 100755 --- a/src/5gnrmac/rg_ram.c +++ b/src/5gnrmac/rg_ram.c @@ -78,6 +78,7 @@ static int RLOG_MODULE_ID=4096; #include "rg_prg.x" /* PRG Interface includes */ #include "lrg.x" /* LRG Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ /* local defines */ diff --git a/src/5gnrmac/rg_rom.c b/src/5gnrmac/rg_rom.c index 587d23ef7..d775b0740 100755 --- a/src/5gnrmac/rg_rom.c +++ b/src/5gnrmac/rg_rom.c @@ -78,6 +78,7 @@ static int RLOG_MODULE_ID=4096; #include "rg_prg.x" /* PRG Interface includes */ #include "lrg.x" /* LRG Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ /* local defines */ diff --git a/src/5gnrmac/rg_tom.c b/src/5gnrmac/rg_tom.c index af55609e3..673cc24fd 100755 --- a/src/5gnrmac/rg_tom.c +++ b/src/5gnrmac/rg_tom.c @@ -75,6 +75,7 @@ invoked by PHY towards MAC #include "rg_prg.x" /* PRG interface typedefs */ #include "rgm.x" /* layer management typedefs for MAC */ #include "rgm.h" /* layer management typedefs for MAC */ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ #ifdef MAC_RLC_UL_RBUF diff --git a/src/5gnrmac/rg_uhm.c b/src/5gnrmac/rg_uhm.c index 1c7d9774b..dd2c18757 100755 --- a/src/5gnrmac/rg_uhm.c +++ b/src/5gnrmac/rg_uhm.c @@ -74,6 +74,7 @@ #include "rg_prg.x" /* PRG Interface defines */ #include "lrg.x" /* LRG Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ /* local defines */ diff --git a/src/5gnrmac/rg_uim.c b/src/5gnrmac/rg_uim.c index add49a0fe..0c7c5c28c 100755 --- a/src/5gnrmac/rg_uim.c +++ b/src/5gnrmac/rg_uim.c @@ -78,6 +78,7 @@ static int RLOG_FILE_ID=178; #include "rgu.x" #include "rg_sch_inf.x" #include "rg_prg.x" /* PRG interface typedefs*/ +#include "mac_interface.h" #include "rg.x" /* typedefs for MAC */ #include "ss_rbuf.h" diff --git a/src/5gnrmac/rg_utl.c b/src/5gnrmac/rg_utl.c index 709c0d2ba..8171c4c5a 100755 --- a/src/5gnrmac/rg_utl.c +++ b/src/5gnrmac/rg_utl.c @@ -78,6 +78,7 @@ static int RLOG_FILE_ID=179; #include "lrg.x" /* LRG Interface includes */ #include "rg_prg.x" /* PRG(MAC-MAC) Interface includes */ +#include "mac_interface.h" #include "rg.x" /* MAC includes */ /* local defines */ diff --git a/src/cm/cm_gen.c b/src/cm/cm_gen.c index a39e3ecd6..582049dc5 100644 --- a/src/cm/cm_gen.c +++ b/src/cm/cm_gen.c @@ -73,6 +73,7 @@ /* functions in other modules */ /* public variable declarations */ +U16 gTransId = 0; /* private variable declarations */ @@ -3553,6 +3554,25 @@ Buffer *mBuf; /* message buffer */ } /* end of cmUnpkIntf */ #endif /* TDS_ROLL_UPGRADE_SUPPORT */ +/* +* +* Fun: cmGetTransId +* +* Desc: This function return the transaction ID used for interface transactions +* +* Ret: gTransId +* +* File: cm_gen.c +* +*/ +U16 cmGetTransId() +{ + if(gTransId<65535) + gTransId++; + else + gTransId = 0; + return gTransId; +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/lrg.h b/src/cm/lrg.h index 44d512d0b..a6805eaa5 100755 --- a/src/cm/lrg.h +++ b/src/cm/lrg.h @@ -95,7 +95,6 @@ #define STRGRSAP STGEN + 2 #define STTFUSAP STGEN + 4 #define STSCHINST STGEN + 5 /* Scheduler Instance */ -#define STCLCELL STGEN + 6 /* CL cell */ #define LRG_USTA_DGNVAL_MEM 1 #define LRG_USTA_DGNVAL_HARQ 2 diff --git a/src/cm/lrg.x b/src/cm/lrg.x index 6480fcd8d..b56bdb000 100755 --- a/src/cm/lrg.x +++ b/src/cm/lrg.x @@ -34,7 +34,6 @@ #ifndef __LRGX__ #define __LRGX__ -#include "lcl.h" /* ccpu00121930 : ADD: c++ support*/ #ifdef __cplusplus @@ -178,7 +177,6 @@ typedef struct rgCfg RgUpSapCfg crgSap; /*!< CRG interface SAP */ RgLowSapCfg tfuSap; /*!< TFU interface SAP */ RgSchInstCfg schInstCfg;/*!< General Configuration for scheduler instances */ - ClCellCfg cellCfg; }s; }RgCfg; diff --git a/src/cm/mac_interface.c b/src/cm/mac_interface.c new file mode 100644 index 000000000..e4945ca13 --- /dev/null +++ b/src/cm/mac_interface.c @@ -0,0 +1,246 @@ +/******************************************************************************* +################################################################################ +# 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. # +################################################################################ +*******************************************************************************/ + +#include "envopt.h" /* Environment options */ +#include "envdep.h" /* Environment dependent */ +#include "envind.h" /* Environment independent */ +#include "gen.h" /* General */ +#include "ssi.h" /* System services */ +#include "ss_queue.h" +#include "ss_task.h" +#include "ss_msg.h" +#include "gen.x" /* general */ +#include "ssi.x" /* system services */ +#include "cm_tkns.x" /* Common Token Definitions */ +#include "cm_llist.x" /* Common Link List Definitions */ +#include "cm_lib.x" /* Common Library Definitions */ +#include "cm_hash.x" /* Common Hash List Definitions */ +#include "cm_lte.x" /* Common LTE Defines */ + +#include "mac_interface.h" + +/************************************************************************** + * @brief Function to pack Loose Coupled + * MAC cell config parameters required by MAC + * + * @details + * + * Function : packLcMacCellCfg + * + * Functionality: + * packs the macCellCfg parameters + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] MacCellCfg *macCellCfg, mac cell config parameters. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 packLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +{ + return ROK; +} + +/************************************************************************** + * @brief Function to pack tightly Coupled + * MAC cell config parameters required by MAC + * + * @details + * + * Function : packTcMacCellCfg + * + * Functionality: + * packs the macCellCfg parameters + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] MacCellCfg *macCellCfg, mac cell config parameters. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 packTcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +{ + return ROK; +} + +/************************************************************************** + * @brief Function to pack light weight Loose Coupled + * MAC cell config parameters required by MAC + * + * @details + * + * Function : packLwLcMacCellCfg + * + * Functionality: + * packs the macCellCfg parameters + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] MacCellCfg *macCellCfg, mac cell config parameters. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 packLwLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +{ + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + RETVALUE(RFAILED); + } + + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf); + + RETVALUE(SPstTsk(pst,mBuf)); +} + +/************************************************************************** + * @brief Function to pack Loose Coupled + * MAC cell config parameters required by MAC + * + * @details + * + * Function : unpackLwLcMacCellCfg + * + * Functionality: + * packs the macCellCfg parameters + * + * @param[in] DuMacCellCfgReq func; function pointer + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] Buffer *mBuf + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +void cmUnpackLwLcMacCellCfg( + DuMacCellCfgReq func, + Pst *pst, + Buffer *mBuf) +{ + MacCellCfg *macCellCfg; + + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&macCellCfg, mBuf); + + RETVALUE((*func)(pst, macCellCfg)); +} + +/************************************************************************** + * @brief Function to pack Loose Coupled + * MAC cell config confirm message + * + * @details + * + * Function : cmPackLcMacCellCfgCfm + * + * Functionality: + * packs the transaction ID + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +U16 cmPackLcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) +{ + Buffer *mBuf = NULLP; + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + RETVALUE(RFAILED); + } + + /* pack the transaction ID in CNF structure */ + CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf); + + RETVALUE(SPstTsk(pst,mBuf)); +} + +/************************************************************************** + * @brief Function to pack tightly Coupled + * MAC cell config confirm message + * + * @details + * + * Function : cmPackTcMacCellCfgCfm + * + * Functionality: + * packs the transaction ID + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +U16 cmPackTcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) +{ + return ROK; +} + +/************************************************************************** + * @brief Function to pack light weight Loose Coupled + * MAC cell config confirm message + * + * @details + * + * Function : cmPackLwlcMacCellCfgCfm + * + * Functionality: + * packs the transaction ID + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] MacCellCfgCfm *macCellCfgCfm, mac cell config confirm. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +U16 cmPackLwlcMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) +{ + return ROK; +} + +/************************************************************************** + * @brief Function to pack MAC cell config confirm message + * + * @details + * + * Function : cmUnpackLcMacCellCfgCfm + * + * Functionality: + * packs the transaction ID + * + * @param[in] DuMacCellCfgCfm func; function pointer + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] Buffer *mBuf + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 cmUnpackLcMacCellCfgCfm( + DuMacCellCfgCfm func, + Pst *pst, + Buffer *mBuf) +{ + MacCellCfgCfm macCellCfgCfm; + /* pack the transaction ID in CNF structure */ + CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf); + + RETVALUE((*func)(&macCellCfgCfm)); +} diff --git a/src/cm/mac_interface.h b/src/cm/mac_interface.h new file mode 100644 index 000000000..b7043cfb2 --- /dev/null +++ b/src/cm/mac_interface.h @@ -0,0 +1,232 @@ +/******************************************************************************* +################################################################################ +# 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. # +################################################################################ +*******************************************************************************/ + +/* Defines APIs exchanged between du_app and cl module of MAC */ +#ifndef __MACINT_H__ +#define __MACINT_H__ + +#define NUM_NUMEROLOGY 5 /* Number of numerology */ +#define MAXIMUM_TDD_PERIODICITY 5 +#define MAX_SYMB_PER_SLOT 14 + +#define NUM_SSB 1 /* max value is 64 */ +#define SSB_MASK_SIZE 1 /* SSB mask size is 32bit for sub6 */ + + +/* Event IDs */ +#define EVENT_MAC_CELL_CONFIG_REQ 200 +#define EVENT_MAC_CELL_CONFIG_CFM 201 + +typedef enum +{ + DUP_MODE_FDD, + DUP_MODE_TDD +}DuplexMode; + +typedef enum +{ + MAC_GEN_FULL_PBCH_PAYLD, /* MAC generated the full PBCH Payload */ + PHY_GEN_TIMING_PBCH_BIT, /* PHY generates the timing PBCH bits */ + PHY_GEN_FULL_PBCH_PAYLD /* PHY generates full PBCH payload */ +}BchPduOpt; + +typedef enum +{ + LONG_SEQUENCE, + SHORT_SEQUENCE +}PrachSeqLen; + +typedef enum +{ + UNRESTRICTED, + RESTRICTED_SET_TYPE_A, + RESTRICTED_SET_TYPE_B +}RstSetCfg; + +typedef enum +{ + DONT_REPORT_RSSI, + RSSI_UNIT_DBM, + RSSI_UNIT_DBFS +}RSSIMeasUnit; + +typedef enum +{ + DL_SLOT, + UL_SLOT, + GUARD_SLOT +}SlotConfig; + +typedef enum +{ + TX_PRDCTY_MS_0P5, + TX_PRDCTY_MS_0P625, + TX_PRDCTY_MS_1, + TX_PRDCTY_MS_1P25, + TX_PRDCTY_MS_2, + TX_PRDCTY_MS_2P5, + TX_PRDCTY_MS_5, + TX_PRDCTY_MS_10 +}DlUlTxPeriodicity; + +typedef enum +{ + BETA_PSS_0DB, + BETA_PSS_1DB +}BetaPss; + +typedef enum +{ + SSB_PRDCTY_MS_5, + SSB_PRDCTY_MS_10, + SSB_PRDCTY_MS_20, + SSB_PRDCTY_MS_40, + SSB_PRDCTY_MS_80, + SSB_PRDCTY_MS_160 +}SSBPeriod; + +typedef struct carrierCfg +{ + Bool pres; + U16 bw; /* DL/UL bandwidth */ + U32 freq; /* Absolute frequency of DL/UL point A in KHz */ + U16 k0[NUM_NUMEROLOGY]; /* K0 for DL/UL */ + U16 gridSize[NUM_NUMEROLOGY]; /* DL/UL Grid size for each numerologies */ + U16 numAnt; /* Number of Tx/Rx antennas */ +}CarrierCfg; + +typedef struct ssbCfg +{ + U32 ssbPbchPwr; /* SSB block power */ + BchPduOpt bchPayloadOption; /* Options for generation of payload */ + U8 scsCmn; /* subcarrier spacing for common */ + U16 ssbPrbOffset; /* SSB PRB offset from point A */ + BetaPss betaPss; + SSBPeriod ssbPeriod; /* SSB Periodicity in msec */ + U8 ssbSubcOffset; /* Subcarrier Offset */ + U32 mibPdu; /* MIB payload */ + U32 nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */ + U8 beamId[NUM_SSB]; + Bool multCarrBand; /* Multiple carriers in a band */ + Bool multCellCarr; /* Multiple cells in single carrier */ +}SsbCfg; + +typedef struct fdmInfo +{ + U16 rootSeqIdx; /* Root sequence index */ + U8 numRootSeq; /* Number of root sequences required for FD */ + U16 k1; /* Frequency Offset for each FD */ + U8 zeroCorrZoneCfg; /* Zero correlation zone cofig */ + U8 numUnusedRootSeq; /* Number of unused root sequence */ + U8 *unsuedRootSeq; /* Unused root sequence per FD */ +}FdmInfo; + +typedef struct prachCfg +{ + Bool pres; + PrachSeqLen prachSeqLen; /* RACH Sequence length: Long/short */ + U8 prachSubcSpacing; /* Subcarrier spacing of RACH */ + RstSetCfg prachRstSetCfg; /* PRACH restricted set config */ + U8 prachFdm; /* PRACH FDM (1,2,4,8) */ + FdmInfo fdm[8]; + U8 ssbPerRach; /* SSB per RACH occassion */ + Bool prachMultCarrBand; /* Multiple carriers in Band */ +}PrachCfg; + +typedef struct tddCfg +{ + Bool pres; + DlUlTxPeriodicity tddPeriod; /* DL UL Transmission periodicity */ + SlotConfig slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; +}TDDCfg; + +typedef struct macCellCfg +{ + U16 transId; + U8 numTlv; /* Number of configuration TLVs */ + U8 carrierId; /* Carrired Index */ + U16 cellId; /* Cell Id */ + U16 phyCellId; /* Physical cell id */ + DuplexMode dupType; /* Duplex type: TDD/FDD */ + CarrierCfg dlCarrCfg; /* DL Carrier configuration */ + CarrierCfg ulCarrCfg; /* UL Carrier configuration */ + Bool freqShft; /* Indicates presence of 7.5kHz frequency shift */ + SsbCfg ssbCfg; /* SSB configuration */ + PrachCfg prachCfg; /* PRACH Configuration */ + TDDCfg tddCfg; /* TDD periodicity and slot configuration */ + RSSIMeasUnit rssiUnit; /* RSSI measurement unit */ +}MacCellCfg; + +typedef struct macCellCfgCfm +{ + U16 transId; +}MacCellCfgCfm; + +/* function pointers for packing macCellCfg Request */ +typedef S16 (*packMacCellCfgReq) ARGS(( + Pst *pst, + MacCellCfg *macCellCfg +)); + +typedef S16 (*packMacCellCfgCfm) 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 */ + )); + +S16 packLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); + +S16 packTcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); + +S16 packLwLcMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); + + +EXTERN S16 unpackMacCellCfgReq +( + Pst *pst, + MacCellCfg *macCellCfg +); + +void cmUnpackLwLcMacCellCfg( + DuMacCellCfgReq func, + Pst *pst, + Buffer *mBuf); + +S16 cmUnpackLcMacCellCfgCfm( + DuMacCellCfgCfm func, + Pst *pst, + Buffer *mBuf); + +EXTERN S16 duHandleMacCellCfgCfm +( + MacCellCfgCfm *macCellCfgCfm +); + +#endif + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index 4f4782267..69ab4c2b1 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -25,6 +25,8 @@ extern DuCfgParams duCfgParam; extern S16 cmPkRgrCfgReq(Pst* pst, RgrCfgTransId transId, \ RgrCfgReqInfo *cfgReqInfo); +extern S16 duBuildAndSendMacCellCfg(); + /******************************************************************* * * @brief Processes cells to be activated @@ -180,8 +182,9 @@ S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg) SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); #endif - /* Build and send GNB-DU config update */ - ret = BuildAndSendDUConfigUpdate(); + /* Build and send Mac Cell Cfg Paramaters */ + ret = duBuildAndSendMacCellCfg(); + return ret; } diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 4fd8612a6..8113ccabd 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -58,16 +58,16 @@ void FillSlotConfig() for(slot = 0; slot <= 3; slot++) { for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) - duCfgParam.clCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT; + duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT; } - duCfgParam.clCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT; - duCfgParam.clCellCfg.tddCfg.slotCfg[3][11] = GUARD_SLOT; - duCfgParam.clCellCfg.tddCfg.slotCfg[3][12] = GUARD_SLOT; - duCfgParam.clCellCfg.tddCfg.slotCfg[3][13] = UL_SLOT; + duCfgParam.macCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT; + duCfgParam.macCellCfg.tddCfg.slotCfg[3][11] = GUARD_SLOT; + duCfgParam.macCellCfg.tddCfg.slotCfg[3][12] = GUARD_SLOT; + duCfgParam.macCellCfg.tddCfg.slotCfg[3][13] = UL_SLOT; for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++) - duCfgParam.clCellCfg.tddCfg.slotCfg[4][symbol] = UL_SLOT; + duCfgParam.macCellCfg.tddCfg.slotCfg[4][symbol] = UL_SLOT; } @@ -77,7 +77,7 @@ void FillSlotConfig() * * @details * - * Function : readClCfg + * Function : readMacCfg * * Functionality: * - Fills up the cell configuration for CL. @@ -91,96 +91,96 @@ void FillSlotConfig() /* This function is used to fill up the cell configuration for CL */ -S16 readClCfg() +S16 readMacCfg() { - duCfgParam.clCellCfg.carrierId = CARRIER_IDX; + duCfgParam.macCellCfg.carrierId = CARRIER_IDX; /* Cell configuration */ - duCfgParam.clCellCfg.cellId = NR_CELL_ID; - duCfgParam.clCellCfg.phyCellId = NR_PCI; - duCfgParam.clCellCfg.dupType = DUPLEX_MODE; + duCfgParam.macCellCfg.cellId = NR_CELL_ID; + duCfgParam.macCellCfg.phyCellId = NR_PCI; + duCfgParam.macCellCfg.dupType = DUPLEX_MODE; /* DL carrier configuration */ - duCfgParam.clCellCfg.dlCarrCfg.pres = TRUE; - duCfgParam.clCellCfg.dlCarrCfg.bw = SUL_ARFCN; - duCfgParam.clCellCfg.dlCarrCfg.freq = NR_ARFCN; - duCfgParam.clCellCfg.dlCarrCfg.k0[0] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[1] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[2] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[3] = 1; - duCfgParam.clCellCfg.dlCarrCfg.k0[4] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[0] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[1] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[2] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[3] = 1; - duCfgParam.clCellCfg.dlCarrCfg.gridSize[4] = 1; - duCfgParam.clCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT; + duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE; + duCfgParam.macCellCfg.dlCarrCfg.bw = SUL_ARFCN; + duCfgParam.macCellCfg.dlCarrCfg.freq = NR_ARFCN; + duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1; + duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1; + duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1; + duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1; + duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1; + duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 1; + duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1; + duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1; + duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1; + duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1; + duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT; /* UL Carrier configuration */ - duCfgParam.clCellCfg.ulCarrCfg.pres = TRUE; - duCfgParam.clCellCfg.ulCarrCfg.bw = SUL_ARFCN; - duCfgParam.clCellCfg.ulCarrCfg.freq = NR_ARFCN; - duCfgParam.clCellCfg.ulCarrCfg.k0[0] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[1] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[2] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[3] = 1; - duCfgParam.clCellCfg.ulCarrCfg.k0[4] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[0] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[1] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[2] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[3] = 1; - duCfgParam.clCellCfg.ulCarrCfg.gridSize[4] = 1; - duCfgParam.clCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT; - - duCfgParam.clCellCfg.freqShft = FREQ_SHIFT_7P5KHZ; + duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE; + duCfgParam.macCellCfg.ulCarrCfg.bw = SUL_ARFCN; + duCfgParam.macCellCfg.ulCarrCfg.freq = NR_ARFCN; + duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1; + duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1; + duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1; + duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1; + duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1; + duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1; + duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1; + duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1; + duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1; + duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1; + duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT; + + duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ; /* SSB configuration */ - duCfgParam.clCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; - duCfgParam.clCellCfg.ssbCfg.bchPayload = BCH_PAYLOAD; - duCfgParam.clCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING; - duCfgParam.clCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET; - duCfgParam.clCellCfg.ssbCfg.betaPss = BETA_PSS; - duCfgParam.clCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY; - duCfgParam.clCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET; - duCfgParam.clCellCfg.ssbCfg.mibPdu = 104; - duCfgParam.clCellCfg.ssbCfg.nSSBMask[0] = 2162721; - duCfgParam.clCellCfg.ssbCfg.nSSBMask[1] = 0; - duCfgParam.clCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND; - duCfgParam.clCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER; + duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; + duCfgParam.macCellCfg.ssbCfg.bchPayloadOption = BCH_PAYLOAD; + duCfgParam.macCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING; + duCfgParam.macCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET; + duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS; + duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY; + duCfgParam.macCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET; + duCfgParam.macCellCfg.ssbCfg.mibPdu = 104; + duCfgParam.macCellCfg.ssbCfg.nSSBMask[0] = 2162721; + duCfgParam.macCellCfg.ssbCfg.nSSBMask[1] = 0; + duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND; + duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER; /* PRACH configuration */ - duCfgParam.clCellCfg.prachCfg.pres = TRUE; - duCfgParam.clCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN; - duCfgParam.clCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING; - duCfgParam.clCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG; - duCfgParam.clCellCfg.prachCfg.prachFdm = NUM_PRACH_FDM; - duCfgParam.clCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX; - duCfgParam.clCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ; - duCfgParam.clCellCfg.prachCfg.fdm[0].k1 = 1; - duCfgParam.clCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG; - duCfgParam.clCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ; - DU_ALLOC(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq, NUM_UNUSED_ROOT_SEQ * sizeof(U8)); - if(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP) + duCfgParam.macCellCfg.prachCfg.pres = TRUE; + duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN; + duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING; + duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG; + duCfgParam.macCellCfg.prachCfg.prachFdm = NUM_PRACH_FDM; + duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX; + duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ; + duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 1; + duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG; + duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ; + DU_ALLOC(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, NUM_UNUSED_ROOT_SEQ * sizeof(U8)); + if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP) { DU_LOG("\nDU_APP : Memory allocation failed"); RETVALUE(RFAILED); } - *(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ; - duCfgParam.clCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH; - duCfgParam.clCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND; + *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ; + duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH; + duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND; /* TDD configuration */ - duCfgParam.clCellCfg.tddCfg.pres = TRUE; - duCfgParam.clCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY; + duCfgParam.macCellCfg.tddCfg.pres = TRUE; + duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY; FillSlotConfig(); /* RSSI Measurement configuration */ - duCfgParam.clCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT; + duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT; /* This should be calculated based on (number of mandatory parameters) + (number of otional parameters being filled) */ - duCfgParam.clCellCfg.numTlv = 39; + duCfgParam.macCellCfg.numTlv = 39; RETVALUE(ROK); } @@ -194,7 +194,7 @@ S16 readClCfg() * * Functionality: * - Initializes the DuCfg members. - * - Calls readClCfg() + * - Calls readMacCfg() * * @params[in] system task ID * @return ROK - success @@ -417,9 +417,9 @@ S16 readCfg() } - if(readClCfg() != ROK) + if(readMacCfg() != ROK) { - DU_LOG("\nDU_APP : Failed while reading CL config"); + DU_LOG("\nDU_APP : Failed while reading MAC config"); RETVALUE(RFAILED); } diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 25be7716b..91912731b 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -20,7 +20,7 @@ #define __DU_CONFIG_H__ #include "du_mgr.h" -#include "lcl.h" +#include "mac_interface.h" #include "du_log.h" #include "BIT_STRING.h" @@ -904,7 +904,8 @@ typedef struct duCfgParams CellCfgParams cellCfg[DU_MAX_CELLS]; /* Cell info config*/ F1DuSrvdCellInfo srvdCellLst[DU_MAX_CELLS]; /* Serving cell list *///TODO: this must be removed eventually F1RrcVersion rrcVersion; /* RRC version */ - ClCellCfg clCellCfg; /* CL cell configuration */ + + MacCellCfg macCellCfg; /* MAC cell configuration */ MibParams mibParams; /* MIB Params */ Sib1Params sib1Params; /* SIB1 Params */ }DuCfgParams; diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 10ba6af21..c51cc8a42 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -37,7 +37,7 @@ #include "lkw.h" #include "lrg.h" #include "legtp.h" - +#include "mac_interface.h" #include "gen.x" /* General */ #include "ssi.x" /* System services */ @@ -176,6 +176,8 @@ typedef struct duCb Bool f1Status; /* Status of F1 connection */ CmHashListCp cellLst; /* List of cells at DU APP of type DuCellCb */ CmHashListCp actvCellLst; /* List of cells activated/to be activated of type DuCellCb */ + /* pointer to store the address of macCellCfg params used to send du-app to MAC */ + MacCellCfg *ptrMacCellCfg; /* pointer to store params while sending DU-APP to MAC */ }DuCb; diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index ce4895b39..d2095e32e 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -22,6 +22,7 @@ #include "du_f1ap_msg_hdl.h" #include "lsctp.h" #include "legtp.h" +#include "mac_interface.h" extern S16 cmUnpkLkwCfgCfm(LkwCfgCfm func,Pst *pst, Buffer *mBuf); extern S16 cmUnpkLkwCntrlCfm(LkwCntrlCfm func,Pst *pst, Buffer *mBuf); @@ -191,7 +192,11 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf) ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf); break; } - + case EVENT_MAC_CELL_CONFIG_CFM: + { + ret = cmUnpackLcMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf); + break; + } default: { DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG"); diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 7a35a6859..910386a4d 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -37,6 +37,13 @@ extern S16 cmPkLkwCfgReq(Pst *pst, KwMngmt *cfg); extern S16 cmPkLkwCntrlReq(Pst *pst, KwMngmt *cfg); extern S16 cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg); +packMacCellCfgReq packMacCellCfgMt[] = +{ + packLcMacCellCfg, /* packing for loosely coupled */ + packTcMacCellCfg, /* packing for tightly coupled */ + packLwLcMacCellCfg, /* packing for light weight loosly coupled */ +}; + /************************************************************************** * @brief Function to fill configs required by RLC * @@ -1486,6 +1493,95 @@ S16 duSendEgtpTTIInd() RETVALUE(ROK); } + +/************************************************************************** + * @brief Function to fill and send MacCellconfig + * + * @details + * + * Function : duBuildAndSendMacCellCfg + * + * Functionality: + * Initiates MAC Configs towards MAC + * + * @param[in] void + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 duBuildAndSendMacCellCfg() +{ + Pst pst; + DU_SET_ZERO(&pst, sizeof(Pst)); + MacCellCfg *pMacCellCfg = NULLP; + + DU_ALLOC(pMacCellCfg, sizeof(MacCellCfg)); + if(pMacCellCfg == NULLP) + { + return RFAILED; + } + + /* store the address in the duCb so that we can free on confirm msg */ + duCb.ptrMacCellCfg = pMacCellCfg; + + /* copy the mac config structure from duCfgParams */ + memcpy(pMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg)); + + pMacCellCfg->transId = cmGetTransId(); /* transaction ID */ + + /* Fill Pst */ + pst.selector = DU_SELECTOR_LWLC; + pst.srcEnt = ENTDUAPP; + pst.dstEnt = ENTRG; + pst.dstInst = 0; + pst.srcInst = 0; + pst.dstProcId = DU_PROC; + pst.srcProcId = DU_PROC; + pst.region = duCb.init.region; + pst.event = EVENT_MAC_CELL_CONFIG_REQ; + + /* Send MAC cell config to MAC */ + return (*packMacCellCfgMt[pst.selector])(&pst, pMacCellCfg); +} + +/************************************************************************** + * @brief Function to Handle MAC cell config confirm + * + * @details + * + * Function : duHandleMacCellCfgCfm + * + * Functionality: + * Initiates general Configs towards MAC + * + * @param[in] void + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +S16 duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm) +{ + S16 ret = ROK; + + if(macCellCfgCfm->transId == duCb.ptrMacCellCfg->transId) + { + /* free the memory allocated during sending macCellCfg request */ + DU_FREE(duCb.ptrMacCellCfg,sizeof(MacCellCfg)); + duCb.ptrMacCellCfg = NULLP; + + /* Build and send GNB-DU config update */ + ret = BuildAndSendDUConfigUpdate(); + } + else + { + /* transaction ID missmatch */ + DU_LOG("\n transaction ID mismatch in macCellCfg"); + ret = RFAILED; + } + + return ret; +} + /********************************************************************** End of file **********************************************************************/ -- 2.16.6